TooN::Matrix< Rows, Cols, Precision, Layout > Struct Template Reference
[Linear Algebra]

#include <matrix.hh>

List of all members.

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)
Matrixoperator*= (const Precision &rhs)
template<class Op >
Matrixoperator+= (const Operator< Op > &op)
template<int Rows2, int Cols2, typename Precision2 , typename Base2 >
Matrixoperator+= (const Matrix< Rows2, Cols2, Precision2, Base2 > &from)
template<int Rows2, int Cols2, typename Precision2 , typename Base2 >
Matrixoperator-= (const Matrix< Rows2, Cols2, Precision2, Base2 > &from)
template<class Op >
Matrixoperator-= (const Operator< Op > &op)
Matrixoperator/= (const Precision &rhs)
template<int Rows2, int Cols2, typename Precision2 , typename Base2 >
bool operator== (const Matrix< Rows2, Cols2, Precision2, Base2 > &rhs)
Assignment

operator = from copy

template<int Rows2, int Cols2, typename Precision2 , typename Base2 >
Matrixoperator= (const Matrix< Rows2, Cols2, Precision2, Base2 > &from)
template<class Op >
Matrixoperator= (const Operator< Op > &op)
Matrixoperator= (const Matrix &from)
Misc

Matrixref ()
 return me as a non const reference - useful for temporaries

Detailed Description

template<int Rows = -1, int Cols = Rows, class Precision = DefaultPrecision, class Layout = RowMajor>
struct TooN::Matrix< Rows, Cols, Precision, Layout >

A matrix. Support is provided for all the usual matrix operations:

See individual member function documentation for examples of usage.

Statically-sized matrices

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 $3\times4$ 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);
Dynamically-sized matrices

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>

Row-major and column-major

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:

\[\begin{matrix}\text{Row major} & \text {Column major}\\ \begin{bmatrix}1&2&3\\4&5&6\\7&8&9\end{bmatrix} & \begin{bmatrix}1&4&7\\2&5&8\\3&6&9\end{bmatrix} \end{matrix}\]

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.


Constructor & Destructor Documentation

template<int Rows = -1, int Cols = Rows, class Precision = DefaultPrecision, class Layout = RowMajor>
TooN::Matrix< Rows, Cols, Precision, Layout >::Matrix (  )  [inline]

Construction of static matrices. Values are not initialized.

Definition at line 124 of file matrix.hh.

template<int Rows = -1, int Cols = Rows, class Precision = DefaultPrecision, class Layout = RowMajor>
TooN::Matrix< Rows, Cols, Precision, Layout >::Matrix ( int  rows,
int  cols 
) [inline]

Construction of dynamic matrices. Values are not initialized.

Definition at line 127 of file matrix.hh.

template<int Rows = -1, int Cols = Rows, class Precision = DefaultPrecision, class Layout = RowMajor>
TooN::Matrix< Rows, Cols, Precision, Layout >::Matrix ( Precision *  p  )  [inline]

Construction of statically sized slice matrices.

Definition at line 132 of file matrix.hh.

template<int Rows = -1, int Cols = Rows, class Precision = DefaultPrecision, class Layout = RowMajor>
TooN::Matrix< Rows, Cols, Precision, Layout >::Matrix ( Precision *  p,
int  r,
int  c 
) [inline]

Construction of dynamically sized slice matrices.

Definition at line 137 of file matrix.hh.

template<int Rows = -1, int Cols = Rows, class Precision = DefaultPrecision, class Layout = RowMajor>
TooN::Matrix< Rows, Cols, Precision, Layout >::Matrix ( Precision *  data,
int  rows,
int  cols,
int  rowstride,
int  colstride,
Internal::Slicing   
) [inline]

Advanced construction of dynamically sized slice matrices. Internal constructor used by GenericMBase::slice(...).

Definition at line 143 of file matrix.hh.

template<int Rows = -1, int Cols = Rows, class Precision = DefaultPrecision, class Layout = RowMajor>
template<class Op >
TooN::Matrix< Rows, Cols, Precision, Layout >::Matrix ( const Operator< Op > &  op  )  [inline]

Construction from an operator.

Definition at line 151 of file matrix.hh.

template<int Rows = -1, int Cols = Rows, class Precision = DefaultPrecision, class Layout = RowMajor>
template<int Rows2, int Cols2, typename Precision2 , typename Base2 >
TooN::Matrix< Rows, Cols, Precision, Layout >::Matrix ( const Matrix< Rows2, Cols2, Precision2, Base2 > &  from  )  [inline]

constructor from arbitrary matrix

Definition at line 159 of file matrix.hh.


Member Function Documentation

template<int Rows = -1, int Cols = Rows, class Precision = DefaultPrecision, class Layout = RowMajor>
template<int Rows2, int Cols2, typename Precision2 , typename Base2 >
bool TooN::Matrix< Rows, Cols, Precision, Layout >::operator!= ( const Matrix< Rows2, Cols2, Precision2, Base2 > &  rhs  )  [inline]

Definition at line 278 of file matrix.hh.

template<int Rows = -1, int Cols = Rows, class Precision = DefaultPrecision, class Layout = RowMajor>
Matrix& TooN::Matrix< Rows, Cols, Precision, Layout >::operator*= ( const Precision &  rhs  )  [inline]

Definition at line 206 of file matrix.hh.

template<int Rows = -1, int Cols = Rows, class Precision = DefaultPrecision, class Layout = RowMajor>
template<class Op >
Matrix& TooN::Matrix< Rows, Cols, Precision, Layout >::operator+= ( const Operator< Op > &  op  )  [inline]

Definition at line 238 of file matrix.hh.

template<int Rows = -1, int Cols = Rows, class Precision = DefaultPrecision, class Layout = RowMajor>
template<int Rows2, int Cols2, typename Precision2 , typename Base2 >
Matrix& TooN::Matrix< Rows, Cols, Precision, Layout >::operator+= ( const Matrix< Rows2, Cols2, Precision2, Base2 > &  from  )  [inline]

Definition at line 225 of file matrix.hh.

template<int Rows = -1, int Cols = Rows, class Precision = DefaultPrecision, class Layout = RowMajor>
template<int Rows2, int Cols2, typename Precision2 , typename Base2 >
Matrix& TooN::Matrix< Rows, Cols, Precision, Layout >::operator-= ( const Matrix< Rows2, Cols2, Precision2, Base2 > &  from  )  [inline]

Definition at line 252 of file matrix.hh.

template<int Rows = -1, int Cols = Rows, class Precision = DefaultPrecision, class Layout = RowMajor>
template<class Op >
Matrix& TooN::Matrix< Rows, Cols, Precision, Layout >::operator-= ( const Operator< Op > &  op  )  [inline]

Definition at line 245 of file matrix.hh.

template<int Rows = -1, int Cols = Rows, class Precision = DefaultPrecision, class Layout = RowMajor>
Matrix& TooN::Matrix< Rows, Cols, Precision, Layout >::operator/= ( const Precision &  rhs  )  [inline]

Definition at line 215 of file matrix.hh.

template<int Rows = -1, int Cols = Rows, class Precision = DefaultPrecision, class Layout = RowMajor>
template<int Rows2, int Cols2, typename Precision2 , typename Base2 >
Matrix& TooN::Matrix< Rows, Cols, Precision, Layout >::operator= ( const Matrix< Rows2, Cols2, Precision2, Base2 > &  from  )  [inline]

Definition at line 190 of file matrix.hh.

template<int Rows = -1, int Cols = Rows, class Precision = DefaultPrecision, class Layout = RowMajor>
template<class Op >
Matrix& TooN::Matrix< Rows, Cols, Precision, Layout >::operator= ( const Operator< Op > &  op  )  [inline]

Definition at line 182 of file matrix.hh.

template<int Rows = -1, int Cols = Rows, class Precision = DefaultPrecision, class Layout = RowMajor>
Matrix& TooN::Matrix< Rows, Cols, Precision, Layout >::operator= ( const Matrix< Rows, Cols, Precision, Layout > &  from  )  [inline]

Definition at line 169 of file matrix.hh.

template<int Rows = -1, int Cols = Rows, class Precision = DefaultPrecision, class Layout = RowMajor>
template<int Rows2, int Cols2, typename Precision2 , typename Base2 >
bool TooN::Matrix< Rows, Cols, Precision, Layout >::operator== ( const Matrix< Rows2, Cols2, Precision2, Base2 > &  rhs  )  [inline]

Definition at line 265 of file matrix.hh.

template<int Rows = -1, int Cols = Rows, class Precision = DefaultPrecision, class Layout = RowMajor>
Matrix& TooN::Matrix< Rows, Cols, Precision, Layout >::ref (  )  [inline]

return me as a non const reference - useful for temporaries

Definition at line 296 of file matrix.hh.


The documentation for this struct was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Friends Defines


libtoon
Author(s): Florian Weisshardt
autogenerated on Fri Jan 11 10:09:49 2013