#include <matrix.hh>
Public Member Functions | |
Construction and destruction | |
template<int Rows2, int Cols2, typename Precision2 , typename Base2 > | |
Matrix (const Matrix< Rows2, Cols2, Precision2, Base2 > &from) | |
constructor from arbitrary matrix | |
template<class Op > | |
Matrix (const Operator< Op > &op) | |
Construction from an operator. | |
Matrix (Precision *data, int rows, int cols, int rowstride, int colstride, Internal::Slicing) | |
Matrix (Precision *p, int r, int c) | |
Construction of dynamically sized slice matrices. | |
Matrix (Precision *p) | |
Construction of statically sized slice matrices. | |
Matrix (int rows, int cols) | |
Construction of dynamic matrices. Values are not initialized. | |
Matrix () | |
Construction of static matrices. Values are not initialized. | |
operations on the matrix | |
template<int Rows2, int Cols2, typename Precision2 , typename Base2 > | |
bool | operator!= (const Matrix< Rows2, Cols2, Precision2, Base2 > &rhs) |
Matrix & | operator*= (const Precision &rhs) |
template<class Op > | |
Matrix & | operator+= (const Operator< Op > &op) |
template<int Rows2, int Cols2, typename Precision2 , typename Base2 > | |
Matrix & | operator+= (const Matrix< Rows2, Cols2, Precision2, Base2 > &from) |
template<int Rows2, int Cols2, typename Precision2 , typename Base2 > | |
Matrix & | operator-= (const Matrix< Rows2, Cols2, Precision2, Base2 > &from) |
template<class Op > | |
Matrix & | operator-= (const Operator< Op > &op) |
Matrix & | operator/= (const Precision &rhs) |
template<int Rows2, int Cols2, typename Precision2 , typename Base2 > | |
bool | operator== (const Matrix< Rows2, Cols2, Precision2, Base2 > &rhs) |
Assignment | |
template<int Rows2, int Cols2, typename Precision2 , typename Base2 > | |
Matrix & | operator= (const Matrix< Rows2, Cols2, Precision2, Base2 > &from) |
template<class Op > | |
Matrix & | operator= (const Operator< Op > &op) |
Matrix & | operator= (const Matrix &from) |
Misc | |
Matrix & | ref () |
return me as a non const reference - useful for temporaries |
A matrix. Support is provided for all the usual matrix operations:
See individual member function documentation for examples of usage.
The library provides classes for statically and dynamically sized matrices. As with Vectors, statically sized matrices are more efficient, since their size is determined at compile-time, not run-time. To create a matrix, use:
Matrix<3,4> M;
or replace 3 and 4 with the dimensions of your choice. If the matrix is square, it can be declared as:
Matrix<3> M;
which just is a synonym for Matrix<3,3>
. Matrices can also be constructed from pointers or static 1D or 2D arrays of doubles:
double dvals1[9]={1,2,3,4,5,6};
Matrix<2,3, Reference::RowMajor> M2 (dvals1);
To create a dynamically sized matrix, use:
Matrix<> M(num_rows, num_cols);
where num_rows and num_cols are integers which will be evaluated at run time.
Half-dynamic matriced can be constructed in either dimension:
Matrix<Dynamic, 2> M(num_rows, 2);
note that the static dimension must be provided, but it is ignored.
Matrix<>
is a synonym for Matrix<Dynamic, Dynamic>
which is Matrix<-1,-1>
The library supports both row major (the default - but you can change this if you prefer) and column major layout ordering. Row major implies that the matrix is laid out in memory in raster scan order:
You can override the default for a specific matrix by specifying the layout when you construct it:
Matrix<3,3,double,ColMajor> M1; Matrix<-1,-1,double,RowMajor> M2(nrows, ncols);
In this case the precision template argument must be given as it precedes the layout argument
Definition at line 110 of file matrix.hh.
TooN::Matrix< Rows, Cols, Precision, Layout >::Matrix | ( | ) | [inline] |
TooN::Matrix< Rows, Cols, Precision, Layout >::Matrix | ( | int | rows, | |
int | cols | |||
) | [inline] |
TooN::Matrix< Rows, Cols, Precision, Layout >::Matrix | ( | Precision * | p | ) | [inline] |
TooN::Matrix< Rows, Cols, Precision, Layout >::Matrix | ( | Precision * | p, | |
int | r, | |||
int | c | |||
) | [inline] |
TooN::Matrix< Rows, Cols, Precision, Layout >::Matrix | ( | Precision * | data, | |
int | rows, | |||
int | cols, | |||
int | rowstride, | |||
int | colstride, | |||
Internal::Slicing | ||||
) | [inline] |
TooN::Matrix< Rows, Cols, Precision, Layout >::Matrix | ( | const Operator< Op > & | op | ) | [inline] |
TooN::Matrix< Rows, Cols, Precision, Layout >::Matrix | ( | const Matrix< Rows2, Cols2, Precision2, Base2 > & | from | ) | [inline] |
bool TooN::Matrix< Rows, Cols, Precision, Layout >::operator!= | ( | const Matrix< Rows2, Cols2, Precision2, Base2 > & | rhs | ) | [inline] |
Matrix& TooN::Matrix< Rows, Cols, Precision, Layout >::operator*= | ( | const Precision & | rhs | ) | [inline] |
Matrix& TooN::Matrix< Rows, Cols, Precision, Layout >::operator+= | ( | const Operator< Op > & | op | ) | [inline] |
Matrix& TooN::Matrix< Rows, Cols, Precision, Layout >::operator+= | ( | const Matrix< Rows2, Cols2, Precision2, Base2 > & | from | ) | [inline] |
Matrix& TooN::Matrix< Rows, Cols, Precision, Layout >::operator-= | ( | const Matrix< Rows2, Cols2, Precision2, Base2 > & | from | ) | [inline] |
Matrix& TooN::Matrix< Rows, Cols, Precision, Layout >::operator-= | ( | const Operator< Op > & | op | ) | [inline] |
Matrix& TooN::Matrix< Rows, Cols, Precision, Layout >::operator/= | ( | const Precision & | rhs | ) | [inline] |
Matrix& TooN::Matrix< Rows, Cols, Precision, Layout >::operator= | ( | const Matrix< Rows2, Cols2, Precision2, Base2 > & | from | ) | [inline] |
Matrix& TooN::Matrix< Rows, Cols, Precision, Layout >::operator= | ( | const Operator< Op > & | op | ) | [inline] |
Matrix& TooN::Matrix< Rows, Cols, Precision, Layout >::operator= | ( | const Matrix< Rows, Cols, Precision, Layout > & | from | ) | [inline] |
bool TooN::Matrix< Rows, Cols, Precision, Layout >::operator== | ( | const Matrix< Rows2, Cols2, Precision2, Base2 > & | rhs | ) | [inline] |
Matrix& TooN::Matrix< Rows, Cols, Precision, Layout >::ref | ( | ) | [inline] |