maal::boost::Matrix Class Reference

Matrix class that include the boost::ublas::matrix. More...

#include <jrl/mal/boostmatrix.hh>

Inheritance diagram for maal::boost::Matrix:
maal::boost::MatrixSvd

List of all members.

Public Types

typedef
::boost::numeric::ublas::matrix
< FloatType
InternalMatrix

Public Member Functions

Constructors
 Matrix (const unsigned int rows=0, const unsigned int cols=0)
 Classical constructor.
 Matrix (InternalMatrix *clone, const bool proprio=false)
 Build only the capsule around a already existing boost vector object.
 Matrix (const Matrix &copy)
 Build a new internal vector from existing boost vector object by copying the data.
virtual ~Matrix (void)
InternalMatrixaccessToMotherLib (void)
 Access to the boost internal vector.
const InternalMatrixaccessToMotherLib (void) const
 Access to the boost internal vector.
MatrixinitFromMotherLib (const InternalMatrix &bv)
 Copy the values and data of an existing boost vector.
Modifiors
Matrixresize (const unsigned int nbRows, const unsigned int nbCols, const bool setZero=true)
unsigned int nbRows (void) const
 Get the number of rows.
unsigned int nbCols (void) const
 Get the number of columns.
MatrixsetZero (void)
MatrixsetIdentity (void)
Matrixfill (const FloatType value)
Scalar Operator E->R
FloatType determinant (void) const
FloatType trace (void) const
 Not implemented yet.
FloatType norm (void) const
 Not implemented yet.
FloatType norm1 (void) const
 Norm 1 sum( |xi| )
FloatType normInfty (void) const
FloatType max (void) const
 Not implemented yet.
FloatType min (void) const
 Not implemented yet.
FloatType sumSquare (void) const
 Not implemented yet.
Inverse
Matrixtranspose (Matrix &At) const
Matrix transpose (void) const
Matrixinverse (Matrix &invMatrix) const
 Compute the inverse of the matrix.
Matrix inverse (void) const
virtual MatrixpseudoInverse (Matrix &invMatrix, const FloatType threshold=1e-6, Matrix *Uref=NULL, Vector *Sref=NULL, Matrix *Vref=NULL) const
 Compute the pseudo-inverse of the matrix.
Matrix pseudoInverse (const FloatType threshold=1e-6, Matrix *U=NULL, Vector *S=NULL, Matrix *V=NULL) const
virtual MatrixdampedInverse (Matrix &invMatrix, const FloatType threshold=1e-6, Matrix *Uref=NULL, Vector *Sref=NULL, Matrix *Vref=NULL) const
 Compute the pseudo-inverse of the matrix.
Matrix dampedInverse (const FloatType threshold=1e-6, Matrix *U=NULL, Vector *S=NULL, Matrix *V=NULL) const
Matrixopposite (Matrix &res) const
 Compute the opposite of the matrix -M.
Matrix opposite (void) const
 Compute the opposite of the matrix -M.
Accessors

Access to an element, a block of element or the hidden double-array matrix.

FloatTypedatablock (void)
const FloatTypedatablock (void) const
Matrixextract (const int top, const int left, const int nbrows, const int nbcols, Matrix &C) const
Matrix extract (const int top, const int left, const int nbrows, const int nbcols)
const FloatTypeelementAt (const int row, const int col) const
FloatTypeelementAt (const int row, const int col)
const FloatTypeelementAt (const int elmt) const
FloatTypeelementAt (const int elmt)
Bonus

Additional functions, not implemented yet.

Vector getDiagonal (void) const
VectorgetDiagonal (Vector &vector) const
MatrixsetDiagonal (const Vector &vector)
MatrixstackMatrix (const Matrix &, Matrix &C) const
Matrix stackMatrix (const Matrix &B) const
MatrixjuxtaposeMatrix (const Matrix &, Matrix &C) const
Matrix juxtaposeMatrix (const Matrix &B) const

Public Attributes

InternalMatrix staticMatrix
InternalMatrixdynamicMatrix
InternalMatrixmatrix
bool proprio

Static Public Attributes

static const bool AUTORESIZE = true
static const bool CHECKRESIZE = true

Friends

class Vector

Operator Functions ExE->E

Each C-style function is implemented as a C++ operator.

Matrixmultiply (const Matrix &A, const Matrix &B, Matrix &C)
Vectormultiply (const Matrix &M, const Vector &v, Vector &res)
Matrixaddition (const Matrix &A, const Matrix &B, Matrix &C)
Matrixsubstraction (const Matrix &A, const Matrix &B, Matrix &C)
Matrixmultiply (const Matrix &A, const FloatType x, Matrix &C)
Matrixaddition (const Matrix &A, const FloatType x, Matrix &C)
Matrixsubstraction (const Matrix &A, const FloatType x, Matrix &C)
Matrixdivision (const Matrix &A, const FloatType x, Matrix &C)
Matrix multiply (const Matrix &B) const
Matrixmultiply (const Matrix &B, Matrix &C) const
Vector multiply (const Vector &v) const
Vectormultiply (const Vector &v, Vector &res) const
Matrix addition (const Matrix &B) const
Matrixaddition (const Matrix &B, Matrix &C) const
Matrix substraction (const Matrix &B) const
Matrixsubstraction (const Matrix &B, Matrix &C) const
Matrix multiply (const FloatType x) const
Matrixmultiply (const FloatType x, Matrix &C) const
Matrix addition (const FloatType x) const
Matrixaddition (const FloatType x, Matrix &C) const
Matrix substraction (const FloatType x) const
Matrixsubstraction (const FloatType x, Matrix &C) const
Matrix division (const FloatType x) const
Matrixdivision (const FloatType x, Matrix &C) const

Operators

Classical operators: use v1 + v2 for addition, v1(i) for i-th element...

Matrix operator+ (const Matrix &m1, const Matrix &m2)
Matrix operator- (const Matrix &m1, const Matrix &m2)
Matrix operator* (const Matrix &m1, const Matrix &m2)
Matrix operator- (const Matrix &m)
Vector operator* (const Matrix &M, const Vector &v1)
Vector operator* (const Vector &v1, const Matrix &M)
Matrix operator+ (const FloatType x, const Matrix &m1)
Matrix operator- (const FloatType x, const Matrix &m1)
Matrix operator* (const FloatType x, const Matrix &m1)
Matrix operator/ (const FloatType x, const Matrix &m1)
Matrix operator+ (const Matrix &m1, const FloatType x)
Matrix operator- (const Matrix &m1, const FloatType x)
Matrix operator* (const Matrix &m1, const FloatType x)
Matrix operator/ (const Matrix &m1, const FloatType x)
std::ostream & operator<< (std::ostream &os, const Matrix &m1)
std::istream & operator>> (std::istream &is, Matrix &v1)
Matrixoperator+= (const Matrix &m1)
Matrixoperator-= (const Matrix &m1)
Matrixoperator*= (const Matrix &m1)
Matrixoperator*= (const FloatType x)
const FloatTypeoperator() (const int i, const int j) const
FloatTypeoperator() (const int i, const int j)
const FloatTypeoperator() (const int n) const
FloatTypeoperator() (const int n)
Matrixoperator= (const Matrix &m1)

Autoresize internal

bool autoresize (void)
static void _resize (InternalMatrix &mat1, const InternalMatrix &mat2)
static bool _checksize (const InternalMatrix &mat1, const InternalMatrix &mat2)
static bool _checksizeVerb (const InternalMatrix &mat1, const InternalMatrix &mat2)
static bool _checksize (const InternalMatrix &mat1, const unsigned int s1, const unsigned int s2)
static bool _checksizeVerb (const InternalMatrix &mat1, const unsigned int s1, const unsigned int s2)
static bool _checksizeProd (const InternalMatrix &mat1, const InternalMatrix &mat2)
static bool _checksizeProdVerb (const InternalMatrix &mat1, const InternalMatrix &mat2)
static void _resizeProd (InternalMatrix &res, const InternalMatrix &mat1, const InternalMatrix &mat2)
static bool _checksizeProd (const InternalMatrix &mat1, const Vector::InternalVector &vct)
static bool _checksizeProdVerb (const InternalMatrix &mat1, const Vector::InternalVector &vct)
static void _resizeProd (Vector::InternalVector &res, const InternalMatrix &mat1)
static void _resizeInv (InternalMatrix &res, const InternalMatrix &mat2)
static bool _checksizeSquare (const InternalMatrix &mat1)
static bool _checksizeSquareVerb (const InternalMatrix &mat1)

Detailed Description

Matrix class that include the boost::ublas::matrix.

The class encapsulates the ublas::matrix object, and implement a set of standard functions. When the maal::boost::Matrix object is constructed, it automatically builds the internal ublas::matrix object. The internal object can be access through accessToMotherLib. Finally, it is possible to build the capsule around an existing boost ublas::matrix through the appropriate constructor.


Member Typedef Documentation

typedef ::boost::numeric::ublas::matrix<FloatType> maal::boost::Matrix::InternalMatrix

Constructor & Destructor Documentation

maal::boost::Matrix::Matrix ( const unsigned int  rows = 0,
const unsigned int  cols = 0 
) [inline]

Classical constructor.

Build the internal matrix from the demanded size.

References staticMatrix.

maal::boost::Matrix::Matrix ( InternalMatrix clone,
const bool  proprio = false 
) [inline]

Build only the capsule around a already existing boost vector object.

maal::boost::Matrix::Matrix ( const Matrix copy) [inline]

Build a new internal vector from existing boost vector object by copying the data.

virtual maal::boost::Matrix::~Matrix ( void  ) [inline, virtual]

References dynamicMatrix, and proprio.


Member Function Documentation

static bool maal::boost::Matrix::_checksize ( const InternalMatrix mat1,
const InternalMatrix mat2 
) [inline, static, protected]

References CHECKRESIZE.

Referenced by addition(), elementAt(), extract(), and substraction().

static bool maal::boost::Matrix::_checksize ( const InternalMatrix mat1,
const unsigned int  s1,
const unsigned int  s2 
) [inline, static, protected]

References CHECKRESIZE.

static bool maal::boost::Matrix::_checksizeProd ( const InternalMatrix mat1,
const InternalMatrix mat2 
) [inline, static, protected]

References CHECKRESIZE.

Referenced by multiply().

static bool maal::boost::Matrix::_checksizeProd ( const InternalMatrix mat1,
const Vector::InternalVector &  vct 
) [inline, static, protected]

References CHECKRESIZE.

static bool maal::boost::Matrix::_checksizeProdVerb ( const InternalMatrix mat1,
const InternalMatrix mat2 
) [inline, static, protected]

References CHECKRESIZE.

static bool maal::boost::Matrix::_checksizeProdVerb ( const InternalMatrix mat1,
const Vector::InternalVector &  vct 
) [inline, static, protected]

References CHECKRESIZE.

static bool maal::boost::Matrix::_checksizeSquare ( const InternalMatrix mat1) [inline, static, protected]

References CHECKRESIZE.

static bool maal::boost::Matrix::_checksizeSquareVerb ( const InternalMatrix mat1) [inline, static, protected]

References CHECKRESIZE.

Referenced by determinant().

static bool maal::boost::Matrix::_checksizeVerb ( const InternalMatrix mat1,
const InternalMatrix mat2 
) [inline, static, protected]

References CHECKRESIZE.

static bool maal::boost::Matrix::_checksizeVerb ( const InternalMatrix mat1,
const unsigned int  s1,
const unsigned int  s2 
) [inline, static, protected]

References CHECKRESIZE.

static void maal::boost::Matrix::_resize ( InternalMatrix mat1,
const InternalMatrix mat2 
) [inline, static, protected]

References AUTORESIZE.

Referenced by dampedInverse().

static void maal::boost::Matrix::_resizeProd ( InternalMatrix res,
const InternalMatrix mat1,
const InternalMatrix mat2 
) [inline, static, protected]

References AUTORESIZE.

Referenced by multiply().

static void maal::boost::Matrix::_resizeProd ( Vector::InternalVector &  res,
const InternalMatrix mat1 
) [inline, static, protected]

References AUTORESIZE.

Access to the boost internal vector.

References matrix.

const InternalMatrix& maal::boost::Matrix::accessToMotherLib ( void  ) const [inline]

Access to the boost internal vector.

References matrix.

Matrix maal::boost::Matrix::addition ( const Matrix B) const [inline]

References addition(), nbCols(), and nbRows().

Referenced by addition().

Matrix& maal::boost::Matrix::addition ( const Matrix B,
Matrix C 
) const [inline]
Matrix maal::boost::Matrix::addition ( const FloatType  x) const [inline]

References addition(), nbCols(), and nbRows().

Referenced by addition().

Matrix& maal::boost::Matrix::addition ( const FloatType  x,
Matrix C 
) const [inline]

References matrix, nbCols(), and nbRows().

bool maal::boost::Matrix::autoresize ( void  ) [inline]

References AUTORESIZE.

virtual Matrix& maal::boost::Matrix::dampedInverse ( Matrix invMatrix,
const FloatType  threshold = 1e-6,
Matrix Uref = NULL,
Vector Sref = NULL,
Matrix Vref = NULL 
) const [inline, virtual]

Compute the pseudo-inverse of the matrix.

By default, the function uses the dgesvd_ fortran routine. It should be provided by the host software.

Reimplemented in maal::boost::MatrixSvd.

References _resize(), _resizeInv(), dgesvd_(), matrix, max(), MRAWDATA, nbCols(), nbRows(), and VRAWDATA.

Matrix maal::boost::Matrix::dampedInverse ( const FloatType  threshold = 1e-6,
Matrix U = NULL,
Vector S = NULL,
Matrix V = NULL 
) const [inline]

References dampedInverse(), nbCols(), and nbRows().

Referenced by dampedInverse().

References matrix, and MRAWDATA.

const FloatType* maal::boost::Matrix::datablock ( void  ) const [inline]

References matrix, and MRAWDATA.

FloatType maal::boost::Matrix::determinant ( void  ) const [inline]

References _checksizeSquareVerb(), and matrix.

Matrix maal::boost::Matrix::division ( const FloatType  x) const [inline]

References division(), nbCols(), and nbRows().

Referenced by division().

Matrix& maal::boost::Matrix::division ( const FloatType  x,
Matrix C 
) const [inline]

References matrix, nbCols(), and nbRows().

const FloatType& maal::boost::Matrix::elementAt ( const int  row,
const int  col 
) const [inline]

References _checksize(), MAAL_CHECKVERBOSE, and matrix.

Referenced by elementAt(), and operator()().

FloatType& maal::boost::Matrix::elementAt ( const int  row,
const int  col 
) [inline]
const FloatType& maal::boost::Matrix::elementAt ( const int  elmt) const [inline]

References elementAt(), and nbRows().

FloatType& maal::boost::Matrix::elementAt ( const int  elmt) [inline]

References elementAt(), and nbRows().

Matrix& maal::boost::Matrix::extract ( const int  top,
const int  left,
const int  nbrows,
const int  nbcols,
Matrix C 
) const [inline]
Matrix maal::boost::Matrix::extract ( const int  top,
const int  left,
const int  nbrows,
const int  nbcols 
) [inline]

References extract().

Referenced by extract().

Matrix& maal::boost::Matrix::fill ( const FloatType  value) [inline]

References matrix.

Referenced by setDiagonal().

Vector maal::boost::Matrix::getDiagonal ( void  ) const [inline]

References getDiagonal().

Referenced by getDiagonal().

Copy the values and data of an existing boost vector.

References matrix.

Matrix& maal::boost::Matrix::inverse ( Matrix invMatrix) const [inline]

Compute the inverse of the matrix.

The matrix has to be invertible. By default, the function uses the dgesvd_ fortran routine. It should be provided by the host software (i.e. lapack).

References _resizeInv(), and matrix.

Matrix maal::boost::Matrix::inverse ( void  ) const [inline]

References inverse(), nbCols(), and nbRows().

Referenced by inverse().

Matrix& maal::boost::Matrix::juxtaposeMatrix ( const Matrix ,
Matrix C 
) const [inline]

References ML_NOT_IMPLEMENTED.

Matrix maal::boost::Matrix::juxtaposeMatrix ( const Matrix B) const [inline]

References juxtaposeMatrix().

Referenced by juxtaposeMatrix().

FloatType maal::boost::Matrix::min ( void  ) const [inline]

Not implemented yet.

References ML_NOT_IMPLEMENTED.

Referenced by getDiagonal().

Matrix maal::boost::Matrix::multiply ( const Matrix B) const [inline]

References multiply(), nbCols(), and nbRows().

Referenced by multiply().

Matrix& maal::boost::Matrix::multiply ( const Matrix B,
Matrix C 
) const [inline]
Vector maal::boost::Matrix::multiply ( const Vector v) const [inline]

References multiply(), and nbRows().

Referenced by multiply().

Matrix maal::boost::Matrix::multiply ( const FloatType  x) const [inline]

References multiply(), nbCols(), and nbRows().

Referenced by multiply().

Matrix& maal::boost::Matrix::multiply ( const FloatType  x,
Matrix C 
) const [inline]

References matrix.

unsigned int maal::boost::Matrix::nbCols ( void  ) const [inline]

Get the number of columns.

References matrix.

Referenced by addition(), dampedInverse(), division(), getDiagonal(), inverse(), multiply(), pseudoInverse(), substraction(), and transpose().

unsigned int maal::boost::Matrix::nbRows ( void  ) const [inline]
FloatType maal::boost::Matrix::norm ( void  ) const [inline]

Not implemented yet.

References ML_NOT_IMPLEMENTED.

FloatType maal::boost::Matrix::norm1 ( void  ) const [inline]

Norm 1 sum( |xi| )

References matrix.

FloatType maal::boost::Matrix::normInfty ( void  ) const [inline]

References matrix.

const FloatType& maal::boost::Matrix::operator() ( const int  i,
const int  j 
) const [inline]

References matrix.

FloatType& maal::boost::Matrix::operator() ( const int  i,
const int  j 
) [inline]

References matrix.

const FloatType& maal::boost::Matrix::operator() ( const int  n) const [inline]

References elementAt().

FloatType& maal::boost::Matrix::operator() ( const int  n) [inline]

References elementAt().

Matrix& maal::boost::Matrix::operator*= ( const Matrix m1) [inline]

References multiply.

Matrix& maal::boost::Matrix::operator*= ( const FloatType  x) [inline]

References matrix.

Matrix& maal::boost::Matrix::operator+= ( const Matrix m1) [inline]

References matrix.

Matrix& maal::boost::Matrix::operator-= ( const Matrix m1) [inline]

References matrix.

Matrix& maal::boost::Matrix::operator= ( const Matrix m1) [inline]

References matrix.

Matrix& maal::boost::Matrix::opposite ( Matrix res) const [inline]

Compute the opposite of the matrix -M.

References matrix.

Matrix maal::boost::Matrix::opposite ( void  ) const [inline]

Compute the opposite of the matrix -M.

References opposite().

Referenced by opposite().

virtual Matrix& maal::boost::Matrix::pseudoInverse ( Matrix invMatrix,
const FloatType  threshold = 1e-6,
Matrix Uref = NULL,
Vector Sref = NULL,
Matrix Vref = NULL 
) const [inline, virtual]

Compute the pseudo-inverse of the matrix.

By default, the function uses the dgesvd_ fortran routine. It should be provided by the host software.

Reimplemented in maal::boost::MatrixSvd.

References _resizeInv(), dgesvd_(), matrix, max(), MRAWDATA, nbCols(), nbRows(), and VRAWDATA.

Matrix maal::boost::Matrix::pseudoInverse ( const FloatType  threshold = 1e-6,
Matrix U = NULL,
Vector S = NULL,
Matrix V = NULL 
) const [inline]

References nbCols(), nbRows(), and pseudoInverse().

Referenced by pseudoInverse().

Matrix& maal::boost::Matrix::resize ( const unsigned int  nbRows,
const unsigned int  nbCols,
const bool  setZero = true 
) [inline]

References matrix, and setZero().

References matrix.

Matrix& maal::boost::Matrix::setZero ( void  ) [inline]

References matrix.

Referenced by resize().

Matrix& maal::boost::Matrix::stackMatrix ( const Matrix ,
Matrix C 
) const [inline]

References ML_NOT_IMPLEMENTED.

Matrix maal::boost::Matrix::stackMatrix ( const Matrix B) const [inline]

References stackMatrix().

Referenced by stackMatrix().

Matrix maal::boost::Matrix::substraction ( const Matrix B) const [inline]

References nbCols(), nbRows(), and substraction().

Referenced by substraction().

Matrix& maal::boost::Matrix::substraction ( const Matrix B,
Matrix C 
) const [inline]
Matrix maal::boost::Matrix::substraction ( const FloatType  x) const [inline]

References nbCols(), nbRows(), and substraction().

Referenced by substraction().

Matrix& maal::boost::Matrix::substraction ( const FloatType  x,
Matrix C 
) const [inline]

References matrix, nbCols(), and nbRows().

FloatType maal::boost::Matrix::sumSquare ( void  ) const [inline]

Not implemented yet.

References ML_NOT_IMPLEMENTED.

FloatType maal::boost::Matrix::trace ( void  ) const [inline]

Not implemented yet.

Matrix& maal::boost::Matrix::transpose ( Matrix At) const [inline]

References matrix.

Matrix maal::boost::Matrix::transpose ( void  ) const [inline]

References nbCols(), and nbRows().


Friends And Related Function Documentation

Matrix& addition ( const Matrix A,
const Matrix B,
Matrix C 
) [friend]
Matrix& addition ( const Matrix A,
const FloatType  x,
Matrix C 
) [friend]
Matrix& division ( const Matrix A,
const FloatType  x,
Matrix C 
) [friend]
Matrix& multiply ( const Matrix A,
const Matrix B,
Matrix C 
) [friend]

Referenced by operator*=().

Vector& multiply ( const Matrix M,
const Vector v,
Vector res 
) [friend]
Matrix& multiply ( const Matrix A,
const FloatType  x,
Matrix C 
) [friend]
Matrix operator* ( const Matrix m1,
const Matrix m2 
) [friend]
Vector operator* ( const Matrix M,
const Vector v1 
) [friend]
Vector operator* ( const Vector v1,
const Matrix M 
) [friend]
Matrix operator* ( const FloatType  x,
const Matrix m1 
) [friend]
Matrix operator* ( const Matrix m1,
const FloatType  x 
) [friend]
Matrix operator+ ( const Matrix m1,
const Matrix m2 
) [friend]
Matrix operator+ ( const FloatType  x,
const Matrix m1 
) [friend]
Matrix operator+ ( const Matrix m1,
const FloatType  x 
) [friend]
Matrix operator- ( const Matrix m1,
const Matrix m2 
) [friend]
Matrix operator- ( const Matrix m) [friend]
Matrix operator- ( const FloatType  x,
const Matrix m1 
) [friend]
Matrix operator- ( const Matrix m1,
const FloatType  x 
) [friend]
Matrix operator/ ( const FloatType  x,
const Matrix m1 
) [friend]
Matrix operator/ ( const Matrix m1,
const FloatType  x 
) [friend]
std::ostream& operator<< ( std::ostream &  os,
const Matrix m1 
) [friend]
std::istream& operator>> ( std::istream &  is,
Matrix v1 
) [friend]
Matrix& substraction ( const Matrix A,
const Matrix B,
Matrix C 
) [friend]
Matrix& substraction ( const Matrix A,
const FloatType  x,
Matrix C 
) [friend]
friend class Vector [friend]

Member Data Documentation

const bool maal::boost::Matrix::AUTORESIZE = true [static]
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines