Public Member Functions
fmatvec::Matrix< General, Fixed< M >, Fixed< N >, AT > Class Template Reference

This is a matrix class for general matrices. More...

#include <fixed_general_matrix.h>

List of all members.

Public Member Functions

 Matrix (Noinit)
 Matrix (Init ini=INIT, const AT &a=0)
 Matrix (Eye ini, const AT &a=1)
 Matrix (int m, int n, Noinit)
 Matrix (int m, int n, Init ini=INIT, const AT &a=0)
 Matrix (int m, int n, Eye ini, const AT &a=1)
template<class Row , class Col >
 Matrix (const Matrix< General, Row, Col, AT > &A)
template<class Type , class Row , class Col >
 Matrix (const Matrix< Type, Row, Col, AT > &A)
 Matrix (const char *str)
 String Constructor.
template<class Type , class Row , class Col >
Matrix< General, Fixed< M >
, Fixed< N >, AT > & 
operator= (const Matrix< Type, Row, Col, AT > &A)
AT & operator() (int i, int j)
 Element operator.
const AT & operator() (int i, int j) const
 Element operator.
AT & e (int i, int j)
const AT & e (int i, int j) const
 Element operator.
AT * operator() ()
 Pointer operator.
const AT * operator() () const
 Pointer operator.
int rows () const
 Number of rows.
int cols () const
 Number of columns.
int ldim () const
 Leading dimension.
const CBLAS_TRANSPOSE blasTrans () const
 Transposed status.
const CBLAS_ORDER blasOrder () const
 Storage convention.
const Matrix< General, Var,
Var, AT > 
operator() (const Range< Var, Var > &I, const Range< Var, Var > &J) const
 Submatrix operator.
template<int M1, int M2, int N1, int N2>
const Matrix< General, Fixed
< M2-M1+1 >, Fixed< N2-N1+1 >
, AT > 
operator() (const Range< Fixed< M1 >, Fixed< M2 > > &I, const Range< Fixed< N1 >, Fixed< N2 > > &J) const
template<int M1, int M2>
const Matrix< General, Fixed
< M2-M1+1 >, Var, AT > 
operator() (const Range< Fixed< M1 >, Fixed< M2 > > &I, const Range< Var, Var > &J) const
template<int N1, int N2>
const Matrix< General, Var,
Fixed< N2-N1+1 >, AT > 
operator() (const Range< Var, Var > &I, const Range< Fixed< N1 >, Fixed< N2 > > &J) const
const RowVector< Fixed< N >, AT > row (int j) const
const Vector< Fixed< M >, AT > col (int i) const
Matrix< General, Fixed< M >
, Fixed< N >, AT > & 
init (const AT &a=0)
 Initialization.
Matrix< General, Fixed< M >
, Fixed< N >, AT > & 
init (Init, const AT &a=0)
Matrix< General, Fixed< M >
, Fixed< N >, AT > & 
init (Eye, const AT &a=1)
Matrix< General, Fixed< M >
, Fixed< N >, AT > & 
init (Noinit, const AT &a=0)
 operator std::vector< std::vector< AT > > ()
 Cast to std::vector<std::vector<AT> >.
 Matrix (std::vector< std::vector< AT > > m)
 std::vector<std::vector<AT> > Constructor. Constructs and initializes a matrix with a std::vector<std::vector<AT> > object. An assert checks for constant length of each row.
const Matrix< General, Fixed
< N >, Fixed< M >, AT > 
T () const
template<class Row >
void set (int j, const Vector< Row, AT > &x)
 set Column j of matrix to given Vector
template<class Col >
void set (int i, const RowVector< Col, AT > &x)
 set Row i of matrix to given RowVector
template<class Type , class Row , class Col >
void set (const Range< Var, Var > &I, const Range< Var, Var > &J, const Matrix< Type, Row, Col, AT > &A)
 set the submatrix - specified by the Range operators - to the values of A
template<class Row >
void add (int j, const Vector< Row, AT > &x)
 add to Column j of the matrix the given Vector
template<class Col >
void add (int i, const RowVector< Col, AT > &x)
 add to Row i of the matrix the given RowVector
template<class Type , class Row , class Col >
void add (const Range< Var, Var > &I, const Range< Var, Var > &J, const Matrix< Type, Row, Col, AT > &A)

Detailed Description

template<int M, int N, class AT>
class fmatvec::Matrix< General, Fixed< M >, Fixed< N >, AT >

This is a matrix class for general matrices.

Template class Matrix with shape type General, Fixed and atomic type AT. The storage form is dense. The template parameter AT defines the atomic type of the matrix. Valid types are int, float, double, complex<float> and complex<double>


Constructor & Destructor Documentation

template<int M, int N, class AT >
fmatvec::Matrix< General, Fixed< M >, Fixed< N >, AT >::Matrix ( const char *  str)

String Constructor.

Constructs and initializes a matrix with a string in a matlab-like notation. The rows are seperated by semicolons, the columns by commas. For example

 Matrix<General, Fixed,double> A("[3,2;1,2]");

constructs the matrix

\[ A=\begin{pmatrix}3 & 2\\ 1 & 2\end{pmatrix} \]

Parameters:
strThe string the matrix will be initialized with.
template<int M, int N, class AT >
fmatvec::Matrix< General, Fixed< M >, Fixed< N >, AT >::Matrix ( std::vector< std::vector< AT > >  m) [inline]

std::vector<std::vector<AT> > Constructor. Constructs and initializes a matrix with a std::vector<std::vector<AT> > object. An assert checks for constant length of each row.

Parameters:
mThe std::vector<std::vector<AT> > the matrix will be initialized with.

Member Function Documentation

template<int M, int N, class AT >
const CBLAS_ORDER fmatvec::Matrix< General, Fixed< M >, Fixed< N >, AT >::blasOrder ( ) const [inline]

Storage convention.

Returns the blas-conform storage convention. The elements are stored in columnmajor form, i.e. the elements are stored columnwise.

Returns:
CblasColMajor.
template<int M, int N, class AT >
const CBLAS_TRANSPOSE fmatvec::Matrix< General, Fixed< M >, Fixed< N >, AT >::blasTrans ( ) const [inline]

Transposed status.

Returns the blas-conform transposed status.

Returns:
CblasTrans if the matrix is in transposed form, CblasNoTrans otherwise.
template<int M, int N, class AT >
int fmatvec::Matrix< General, Fixed< M >, Fixed< N >, AT >::cols ( ) const [inline]

Number of columns.

Returns:
The number of columns of the matrix.
template<int M, int N, class AT >
const AT& fmatvec::Matrix< General, Fixed< M >, Fixed< N >, AT >::e ( int  i,
int  j 
) const [inline]

Element operator.

See e(int,int)

template<int M, int N, class AT >
Matrix< General, Fixed< M >, Fixed< N >, AT > & fmatvec::Matrix< General, Fixed< M >, Fixed< N >, AT >::init ( const AT &  a = 0) [inline]

Initialization.

Initializes all elements of the calling matrix with the value given by a.

Parameters:
aValue all elements will be initialized with.
Returns:
A reference to the calling matrix.
template<int M, int N, class AT >
int fmatvec::Matrix< General, Fixed< M >, Fixed< N >, AT >::ldim ( ) const [inline]

Leading dimension.

Returns:
The leading dimension of the matrix
template<int M, int N, class AT >
fmatvec::Matrix< General, Fixed< M >, Fixed< N >, AT >::operator std::vector< std::vector< AT > > ( ) [inline]

Cast to std::vector<std::vector<AT> >.

Returns:
The std::vector<std::vector<AT> > representation of the matrix
template<int M, int N, class AT >
AT& fmatvec::Matrix< General, Fixed< M >, Fixed< N >, AT >::operator() ( int  i,
int  j 
) [inline]

Element operator.

Returns a reference to the element in the i-th row and the j-th column.

Parameters:
iThe i-th row of the matrix
jThe j-th column of the matrix
Returns:
A reference to the element A(i,j).
Remarks:
The bounds are checked by default. To change this behavior, define FMATVEC_NO_BOUNDS_CHECK.
See also:
operator()(int,int) const
template<int M, int N, class AT >
const AT& fmatvec::Matrix< General, Fixed< M >, Fixed< N >, AT >::operator() ( int  i,
int  j 
) const [inline]

Element operator.

See operator()(int,int)

template<int M, int N, class AT >
AT* fmatvec::Matrix< General, Fixed< M >, Fixed< N >, AT >::operator() ( ) [inline]

Pointer operator.

Returns the pointer to the first element.

Returns:
The pointer to the first element.
template<int M, int N, class AT >
const AT* fmatvec::Matrix< General, Fixed< M >, Fixed< N >, AT >::operator() ( ) const [inline]

Pointer operator.

See operator()()

template<int M, int N, class AT >
const Matrix< General, Var, Var, AT > fmatvec::Matrix< General, Fixed< M >, Fixed< N >, AT >::operator() ( const Range< Var, Var > &  I,
const Range< Var, Var > &  J 
) const [inline]

Submatrix operator.

Returns a submatrix of the calling matrix.

Attention:
The submatrix and the calling matrix will share the same physical memory.
Parameters:
i1The starting row.
j1The starting column.
i2The ending row.
j2The ending column.
Returns:
A submatrix of the calling matrix.

Submatrix operator.

See operator()(int,int,int,int);

Submatrix operator.

Returns a submatrix of the calling matrix. For example

 B = A(Range<Var,Var>(1,2),Range<Var,Var>(2,4));

yields

\[ A=\begin{pmatrix} a_{00} & a_{01} & a_{02} & a_{03} & a_{04}\\ a_{10} & a_{11} & a_{12} & a_{13} & a_{14}\\ a_{20} & a_{21} & a_{22} & a_{23} & a_{24}\\ a_{30} & a_{31} & a_{32} & a_{33} & a_{34} \end{pmatrix}\quad \Rightarrow \quad B=\begin{pmatrix} a_{12} & a_{13} & a_{14}\\ a_{22} & a_{23} & a_{24} \end{pmatrix} \]

Attention:
The submatrix and the calling matrix will share the same physical memory.
Parameters:
IRange<Var,Var> containing the starting and the ending row.
JRange<Var,Var> containing the starting and the ending column.
Returns:
A submatrix of the calling matrix.

Submatrix operator.

See operator()(const Range<Var,Var>&, const Range<Var,Var>&)

template<int M, int N, class AT >
int fmatvec::Matrix< General, Fixed< M >, Fixed< N >, AT >::rows ( ) const [inline]

Number of rows.

Returns:
The number of rows of the matrix.
template<int M, int N, class AT >
template<class Type , class Row , class Col >
void fmatvec::Matrix< General, Fixed< M >, Fixed< N >, AT >::set ( const Range< Var, Var > &  I,
const Range< Var, Var > &  J,
const Matrix< Type, Row, Col, AT > &  A 
) [inline]

set the submatrix - specified by the Range operators - to the values of A

Parameters:
IRange of starting and ending row
JRange of starting and ending column
AMatrix with the values the submatrix should take

References fmatvec::Matrix< Type, Row, Col, AT >::cols(), fmatvec::Range< Var, Var >::end(), fmatvec::Matrix< Type, Row, Col, AT >::rows(), fmatvec::Range< Var, Var >::size(), and fmatvec::Range< Var, Var >::start().


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