NABLA
Nabla Ain't Basic Linear Algebra
|
General matrix template class. More...
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. | |
matrix & | operator= (const matrix &a) |
Assignment operator. | |
template<typename expr_t , typename tag > | |
matrix & | operator= (const matrix_expression< value_type, expr_t, tag > &rhs) |
Assignment operator. | |
matrix & | operator= (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. |
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.
&m(i, j)==&m(0, 0) + i*m.cols() + j
i<m.rows() && j<m.cols()
.
|
inline |
|
inline |
Assigns matrix expression to this object.
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().
|
inline |
|
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().
|
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().