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

General matrix template class. More...

Inheritance diagram for matrix< value_t, rectangular >:
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

 matrix ()
 Default constructor.
 matrix (const matrix &a)
 Copy constructor.
 matrix (temporary< matrix > &a)
 Move constructor from temporary object.
template<typename expr_t , typename tag >
 matrix (const matrix_expression< value_type, expr_t, tag > &a)
 Copy constructor from matrix expression.
 matrix (size_t nrows, size_t ncols)
 Constructor with size initialization.
 matrix (size_t nrows, size_t ncols, const_reference value)
 Constructor with size and value initialization.
 ~matrix ()
 Destructor.
template<typename expr_t , typename tag >
void assign (const matrix_expression< value_type, expr_t, tag > &rhs)
 Assigns matrix expression to this object.
size_t cols () const
 Returns number of columns.
reference operator() (size_t row, size_t column)
 Subscript operator.
const_reference operator() (size_t row, size_t column) const
 Subscript operator.
row_ref operator() (size_t row)
 Subscript operator.
const_row_ref operator() (size_t row) const
 Subscript operator.
matrixoperator= (const matrix &a)
 Assignment operator.
template<typename expr_t , typename tag >
matrixoperator= (const matrix_expression< value_type, expr_t, tag > &rhs)
 Assignment operator.
matrixoperator= (temporary< matrix > &a)
 Move assignment operator.
row_ref operator[] (size_t row)
 Subscript operator.
const_row_ref operator[] (size_t row) const
 Subscript operator.
void resize (size_t nrows, size_t ncols)
 Resizes matrix.
void resize (size_t nrows, size_t ncols, const_reference value)
 Resizes matrix.
size_t rows () const
 Returns number of rows.
void swap (matrix &a)
 Swaps contents of two matrices.

Detailed Description

template<typename value_t>
class nabla::matrix< value_t, rectangular >

General matrix template class.

This is a partial specialization of matrix template class.

This class represents a general rectangular shaped matrix. It is the most common and least constrained matrix type. Typically you will use this type to carry out most operations.

Additional guarantees:
Elements are stored in memory continuously in row-major order. This implies
&m(i, j)==&m(0, 0) + i*m.cols() + j
is always satisfied for non-empty matrix and i<m.rows() && j<m.cols().
See Also
matrix_expression, vector

Definition at line 2880 of file matrix.h.

Constructor & Destructor Documentation

matrix ( )
inline

Default constructor.

Initializes empty matrix, i.e. 0 by 0 matrix with no elements.

Definition at line 2893 of file matrix.h.

Member Function Documentation

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

Assigns matrix 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. It 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 2967 of file matrix.h.

References nabla::get_matrix(), and matrix< value_t, shape >::resize().

void resize ( size_t  nrows,
size_t  ncols 
)
inline

Resizes matrix.

Changes matrix size to nrows by ncols. Values of elements are undefined.

Definition at line 2982 of file matrix.h.

void resize ( size_t  nrows,
size_t  ncols,
const_reference  value 
)
inline

Resizes matrix.

Changes matrix size to nrows by ncols. Values of elements are set to value.

Definition at line 2998 of file matrix.h.

References matrix< value_t, shape >::resize().

void swap ( matrix< value_t, rectangular > &  a)
inline

Swaps contents of two matrices.

This function is not meant to throw any exceptions.

Definition at line 3006 of file matrix.h.

References matrix< value_t, shape >::swap().


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