template<class T> class Vector

The vector class

Inheritance:


Public Methods

[more] Vector()
Constructor with no arguments (must subsequently invoke "alloc" to allocate memory)
[more] Vector(size_type n)
Constructor: create vector of "n" elements.
[more] Vector(size_type n, const T &e)
Constructor: create vector of "n" elements "e".
[more] Vector(const Vector<T> &)
Copy constructor: elements are copied into a new vector.
[more]Vector<T> & operator=(const T f)
Assignment operator: set all elements to "f".
[more]Vector<T> & operator+=(const T f)
Add the value "f" to every element of the vector.
[more]Vector<T> & operator-=(const T f)
Subtract the value "f" to every element of the vector.
[more]Vector<T> & operator*=(const T f)
Multiply every element by the value "f".
[more]Vector<T> & operator/=(const T f)
Divide every element by the value "f".
[more]Vector<T> & operator+=(const Vector<T> &w)
Vector addition.
[more]Vector<T> & operator-=(const Vector<T> &w)
Vector subtraction.
[more]Vector<T> & operator*=(const Vector<T> &w)
Elementwise multiplication.
[more]Vector<T> & operator/=(const Vector<T> &w)
Elementwise division.
[more]void space(const T xmin, const T xmax)
Uniform grid generation.
[more]void range(const T imin=0)
Uniform grid generation with unit increment.
[more]void random(void)
Fill the vector with random numbers between 0 and 1 (two subsequent calls to random will generate different elements)
[more]size_t bra(const T elem)
Return the index of the element closest to the left of/at position of elem.
[more]Vector<size_t> bra(const Vector<T> &elem)
Return the indices of the elements that are closest to the left of elem.
[more]size_t ket(const T elem)
Return the index of the element closest to the right of elem.
[more]Vector<size_t> ket(const Vector<T> &elem)
Return the indices of the elements that are closest to the right of elem.
[more]Vector<T> & alloc(const size_type n)
Resizes the vector to the "n" size.
[more]inline const T& operator()(size_type i) const
Return reference to "i"-th element.
[more]inline T& operator()(size_type i)
Returns reference to an element of index "i" (can be used for assignment).


Documentation

The vector class

The class to represent vectors. Elements are adjacent in memory.

o Vector()
Constructor with no arguments (must subsequently invoke "alloc" to allocate memory)

o Vector(size_type n)
Constructor: create vector of "n" elements.

Parameters:
n - vector size

o Vector(size_type n, const T &e)
Constructor: create vector of "n" elements "e".

Parameters:
n - vector size
e - value of each element

o Vector(const Vector<T> &)
Copy constructor: elements are copied into a new vector.
Parameters:
vector - to be copied

oVector<T> & operator=(const T f)
Assignment operator: set all elements to "f".
Parameters:
f - scalar
Returns:
vector instance

oVector<T> & operator+=(const T f)
Add the value "f" to every element of the vector.
Parameters:
f - scalar
Returns:
vector

oVector<T> & operator-=(const T f)
Subtract the value "f" to every element of the vector.
Parameters:
f - scalar
Returns:
vector

oVector<T> & operator*=(const T f)
Multiply every element by the value "f".
Parameters:
f - scalar
Returns:
vector

oVector<T> & operator/=(const T f)
Divide every element by the value "f".
Parameters:
f - scalar
Returns:
vector

oVector<T> & operator+=(const Vector<T> &w)
Vector addition.
Parameters:
w - vector
Returns:
vector = original vector incremented by w

oVector<T> & operator-=(const Vector<T> &w)
Vector subtraction.
Parameters:
w - vector
Returns:
vector = original vector decremented by w

oVector<T> & operator*=(const Vector<T> &w)
Elementwise multiplication. Multiply every vector element (of the vector on the left of "*=") by its counterpart in the "b" vector.
Parameters:
w - vector
Returns:
vector

oVector<T> & operator/=(const Vector<T> &w)
Elementwise division. Divide every vector element (of the vector on the left of "*=") by its counterpart in the "b" vector.
Parameters:
w - vector
Returns:
vector

ovoid space(const T xmin, const T xmax)
Uniform grid generation. Elements are set so as to span uniformly from xmin to xmax, in increasing order.
Parameters:
- xmin minimum value
- xmax maximum value

ovoid range(const T imin=0)
Uniform grid generation with unit increment. Similar to space except that the increment is one. For instance x.range(0) has elements 0, 1, ... (up to size x.size()-1).
See Also:
space

ovoid random(void)
Fill the vector with random numbers between 0 and 1 (two subsequent calls to random will generate different elements)

osize_t bra(const T elem)
Return the index of the element closest to the left of/at position of elem. This assumes that the sequence is monotonically increasing. The min/max return values are 0 and size()-1, respectively.
Parameters:
elem - reference abscissa
See Also:
ket

oVector<size_t> bra(const Vector<T> &elem)
Return the indices of the elements that are closest to the left of elem. This assumes that the sequence is monotonically increasing.
Parameters:
elem - reference abscissa

osize_t ket(const T elem)
Return the index of the element closest to the right of elem. This assumes that the sequence is monotonically increasing. The min/max return values are 0 and size()-1, respectively.
Parameters:
elem - reference abscissa
See Also:
bra

oVector<size_t> ket(const Vector<T> &elem)
Return the indices of the elements that are closest to the right of elem. This assumes that the sequence is monotonically increasing.
Parameters:
elem - reference abscissa

oVector<T> & alloc(const size_type n)
Resizes the vector to the "n" size.
Parameters:
n - new size

oinline const T& operator()(size_type i) const
Return reference to "i"-th element.
Parameters:
i - index
Returns:
element

oinline T& operator()(size_type i)
Returns reference to an element of index "i" (can be used for assignment).
Parameters:
i - index
Returns:
element


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.