NABLA  Nabla Ain't Basic Linear Algebra
Public Types | Public Member Functions | List of all members
vector< value_t > Class Template Reference

Vector template class. More...

Inheritance diagram for vector< value_t >:
Inheritance graph

Public Types

typedef util::sequence
< value_type >
::const_reference 
const_reference
 Type of reference to constant element.
typedef util::sequence
< value_type >::reference 
reference
 Type of reference to element.
typedef value_t value_type
 Type of elements.

Public Member Functions

 vector ()
 Default constructor.
 vector (const vector &a)
 Copy constructor.
 vector (temporary< vector > &a)
 Move constructor from temporary object.
template<typename expr_t , typename tag >
 vector (const vector_expression< value_type, expr_t, tag > &a)
 Copy constructor from vector expression.
 vector (size_t size)
 Constructor with size initialization.
 vector (size_t size, const_reference value)
 Constructor with size and value initialization.
 ~vector ()
 Destructor.
template<typename expr_t , typename tag >
void assign (const vector_expression< value_type, expr_t, tag > &rhs)
 Assigns vector expression to this object.
reference operator() (size_t i)
 Subscript operator.
const_reference operator() (size_t i) const
 Subscript operator.
vectoroperator= (const vector &a)
 Assignment operator.
template<typename expr_t , typename tag >
vectoroperator= (const vector_expression< value_type, expr_t, tag > &rhs)
 Assignment operator.
vectoroperator= (temporary< vector > &a)
 Move assignment operator.
reference operator[] (size_t i)
 Subscript operator.
const_reference operator[] (size_t i) const
 Subscript operator.
void resize (size_t size)
 Resizes vector.
void resize (size_t size, const_reference value)
 Resizes vector.
size_t size () const
 Returns size of vector.
void swap (vector &a)
 Swaps contents of two vectors.

Detailed Description

template<typename value_t>
class nabla::vector< value_t >

Vector template class.

This class represents a vector, i.e. a string of values.

Object of this type is a column vector – can act as a v.size() by 1 matrix. (For more information on orientation see Vector Orientation.)

Additional guarantees:
Elements are stored in memory continuously. This implies
&v(i)==&v(0) + i
is always satisfied for non-empty vector and i<v.size().
See Also
vector_expression, matrix

Definition at line 3128 of file matrix.h.

Constructor & Destructor Documentation

vector ( )
inline

Default constructor.

Initializes empty vector, i.e. zero sized vector with no elements.

Definition at line 3137 of file matrix.h.

Member Function Documentation

void assign ( const vector_expression< value_type, expr_t, tag > &  rhs)
inline

Assigns vector expression to this object.

Warning
This function may produce suprising results. Equivalent effect of this function is if this object were erased and then assigned the rhs.

This function assigns rhs in the most efficient way. That means that no temporary is introduced to store intermediate result. This circumstance can cause suprising results as stated above.

Like in the STL this function doesn't care about object's previous state. The function discards all the contents (which may immediately invalidate all references to this object) and copies the result of rhs expression to this object's new contents.

In other words this object should not be involved in the argument expression rhs. Otherwise this function may produce unexpected result or even crash the program.

Definition at line 3205 of file matrix.h.

References nabla::get_vector(), and vector< value_t >::resize().

void resize ( size_t  size)
inline

Resizes vector.

Changes vector size to size. Values of elements are undefined.

Definition at line 3215 of file matrix.h.

References vector< value_t >::size().

void resize ( size_t  size,
const_reference  value 
)
inline

Resizes vector.

Changes vector size to size. Values of elements are set to value.

Definition at line 3226 of file matrix.h.

References vector< value_t >::resize().

void swap ( vector< value_t > &  a)
inline

Swaps contents of two vectors.

This function is not meant to throw any exceptions.

Definition at line 3234 of file matrix.h.


The documentation for this class was generated from the following file: