Matrix class that include the boost::ublas::matrix. More...
#include <jrl/mal/boostmatrix.hh>
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 ©) | |
Build a new internal vector from existing boost vector object by copying the data. | |
virtual | ~Matrix (void) |
InternalMatrix & | accessToMotherLib (void) |
Access to the boost internal vector. | |
const InternalMatrix & | accessToMotherLib (void) const |
Access to the boost internal vector. | |
Matrix & | initFromMotherLib (const InternalMatrix &bv) |
Copy the values and data of an existing boost vector. | |
Modifiors | |
Matrix & | resize (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. | |
Matrix & | setZero (void) |
Matrix & | setIdentity (void) |
Matrix & | fill (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 | |
Matrix & | transpose (Matrix &At) const |
Matrix | transpose (void) const |
Matrix & | inverse (Matrix &invMatrix) const |
Compute the inverse of the matrix. | |
Matrix | inverse (void) const |
virtual Matrix & | pseudoInverse (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 Matrix & | dampedInverse (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 |
Matrix & | opposite (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. | |
FloatType * | datablock (void) |
const FloatType * | datablock (void) const |
Matrix & | extract (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 FloatType & | elementAt (const int row, const int col) const |
FloatType & | elementAt (const int row, const int col) |
const FloatType & | elementAt (const int elmt) const |
FloatType & | elementAt (const int elmt) |
Bonus | |
Additional functions, not implemented yet. | |
Vector | getDiagonal (void) const |
Vector & | getDiagonal (Vector &vector) const |
Matrix & | setDiagonal (const Vector &vector) |
Matrix & | stackMatrix (const Matrix &, Matrix &C) const |
Matrix | stackMatrix (const Matrix &B) const |
Matrix & | juxtaposeMatrix (const Matrix &, Matrix &C) const |
Matrix | juxtaposeMatrix (const Matrix &B) const |
Public Attributes | |
InternalMatrix | staticMatrix |
InternalMatrix * | dynamicMatrix |
InternalMatrix & | matrix |
bool | proprio |
Static Public Attributes | |
static const bool | AUTORESIZE = true |
static const bool | CHECKRESIZE = true |
Friends | |
class | Vector |
Operator Functions ExE->E | |
Matrix & | multiply (const Matrix &A, const Matrix &B, Matrix &C) |
Vector & | multiply (const Matrix &M, const Vector &v, Vector &res) |
Matrix & | addition (const Matrix &A, const Matrix &B, Matrix &C) |
Matrix & | substraction (const Matrix &A, const Matrix &B, Matrix &C) |
Matrix & | multiply (const Matrix &A, const FloatType x, Matrix &C) |
Matrix & | addition (const Matrix &A, const FloatType x, Matrix &C) |
Matrix & | substraction (const Matrix &A, const FloatType x, Matrix &C) |
Matrix & | division (const Matrix &A, const FloatType x, Matrix &C) |
Matrix | multiply (const Matrix &B) const |
Matrix & | multiply (const Matrix &B, Matrix &C) const |
Vector | multiply (const Vector &v) const |
Vector & | multiply (const Vector &v, Vector &res) const |
Matrix | addition (const Matrix &B) const |
Matrix & | addition (const Matrix &B, Matrix &C) const |
Matrix | substraction (const Matrix &B) const |
Matrix & | substraction (const Matrix &B, Matrix &C) const |
Matrix | multiply (const FloatType x) const |
Matrix & | multiply (const FloatType x, Matrix &C) const |
Matrix | addition (const FloatType x) const |
Matrix & | addition (const FloatType x, Matrix &C) const |
Matrix | substraction (const FloatType x) const |
Matrix & | substraction (const FloatType x, Matrix &C) const |
Matrix | division (const FloatType x) const |
Matrix & | division (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) |
Matrix & | operator+= (const Matrix &m1) |
Matrix & | operator-= (const Matrix &m1) |
Matrix & | operator*= (const Matrix &m1) |
Matrix & | operator*= (const FloatType x) |
const FloatType & | operator() (const int i, const int j) const |
FloatType & | operator() (const int i, const int j) |
const FloatType & | operator() (const int n) const |
FloatType & | operator() (const int n) |
Matrix & | operator= (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) |
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.
typedef ::boost::numeric::ublas::matrix<FloatType> maal::boost::Matrix::InternalMatrix |
maal::boost::Matrix::Matrix | ( | const unsigned int | rows = 0 , |
const unsigned int | cols = 0 |
||
) | [inline] |
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.
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::_resizeInv | ( | InternalMatrix & | res, |
const InternalMatrix & | mat2 | ||
) | [inline, static, protected] |
References AUTORESIZE.
Referenced by maal::boost::MatrixSvd::dampedInverse(), dampedInverse(), inverse(), maal::boost::MatrixSvd::pseudoInverse(), and pseudoInverse().
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.
InternalMatrix& maal::boost::Matrix::accessToMotherLib | ( | void | ) | [inline] |
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.
References addition(), nbCols(), and nbRows().
Referenced by addition().
References _checksize(), MAAL_CHECKVERBOSE, and matrix.
References addition(), nbCols(), and nbRows().
Referenced by addition().
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().
const FloatType* maal::boost::Matrix::datablock | ( | void | ) | const [inline] |
FloatType maal::boost::Matrix::determinant | ( | void | ) | const [inline] |
References _checksizeSquareVerb(), and matrix.
References division(), nbCols(), and nbRows().
Referenced by division().
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] |
References _checksize(), MAAL_CHECKVERBOSE, and matrix.
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] |
References _checksize(), MAAL_CHECKVERBOSE, and matrix.
Matrix maal::boost::Matrix::extract | ( | const int | top, |
const int | left, | ||
const int | nbrows, | ||
const int | nbcols | ||
) | [inline] |
References matrix.
Referenced by setDiagonal().
Vector maal::boost::Matrix::getDiagonal | ( | void | ) | const [inline] |
References getDiagonal().
Referenced by getDiagonal().
References matrix, min(), nbCols(), nbRows(), and maal::boost::Vector::resize().
Matrix& maal::boost::Matrix::initFromMotherLib | ( | const InternalMatrix & | bv | ) | [inline] |
Copy the values and data of an existing boost vector.
References matrix.
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 ML_NOT_IMPLEMENTED.
References juxtaposeMatrix().
Referenced by juxtaposeMatrix().
FloatType maal::boost::Matrix::max | ( | void | ) | const [inline] |
Not implemented yet.
References ML_NOT_IMPLEMENTED.
Referenced by maal::boost::MatrixSvd::dampedInverse(), dampedInverse(), maal::boost::MatrixSvd::initSvdMemory(), maal::boost::MatrixSvd::pseudoInverse(), and pseudoInverse().
FloatType maal::boost::Matrix::min | ( | void | ) | const [inline] |
References multiply(), nbCols(), and nbRows().
Referenced by multiply().
References _checksizeProd(), _resizeProd(), MAAL_CHECKVERBOSE, and matrix.
References multiply(), and nbRows().
Referenced by multiply().
References _checksizeProd(), MAAL_CHECKVERBOSE, matrix, and maal::boost::Vector::vector.
References multiply(), nbCols(), and nbRows().
Referenced by multiply().
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] |
Get the number of rows.
References matrix.
Referenced by addition(), dampedInverse(), division(), elementAt(), getDiagonal(), inverse(), multiply(), pseudoInverse(), substraction(), and transpose().
FloatType maal::boost::Matrix::norm | ( | void | ) | const [inline] |
Not implemented yet.
References ML_NOT_IMPLEMENTED.
const FloatType& maal::boost::Matrix::operator() | ( | const int | i, |
const int | j | ||
) | const [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().
Compute the opposite of the matrix -M.
References matrix.
Matrix maal::boost::Matrix::opposite | ( | void | ) | const [inline] |
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 fill(), matrix, and maal::boost::Vector::size().
References ML_NOT_IMPLEMENTED.
References stackMatrix().
Referenced by stackMatrix().
References nbCols(), nbRows(), and substraction().
Referenced by substraction().
References _checksize(), MAAL_CHECKVERBOSE, and matrix.
References nbCols(), nbRows(), and substraction().
Referenced by substraction().
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.
Referenced by operator*=().
std::ostream& operator<< | ( | std::ostream & | os, |
const Matrix & | m1 | ||
) | [friend] |
std::istream& operator>> | ( | std::istream & | is, |
Matrix & | v1 | ||
) | [friend] |
friend class Vector [friend] |
const bool maal::boost::Matrix::AUTORESIZE = true [static] |
Referenced by _resize(), _resizeInv(), _resizeProd(), and autoresize().
const bool maal::boost::Matrix::CHECKRESIZE = true [static] |
Referenced by _checksize(), _checksizeProd(), _checksizeProdVerb(), _checksizeSquare(), _checksizeSquareVerb(), and _checksizeVerb().
Referenced by ~Matrix().
Referenced by accessToMotherLib(), addition(), maal::boost::MatrixSvd::dampedInverse(), dampedInverse(), datablock(), determinant(), division(), elementAt(), extract(), fill(), getDiagonal(), initFromMotherLib(), maal::boost::MatrixSvd::initSvdMemory(), inverse(), multiply(), nbCols(), nbRows(), norm1(), normInfty(), operator()(), operator*=(), operator+=(), operator-=(), operator=(), opposite(), maal::boost::MatrixSvd::pseudoInverse(), pseudoInverse(), resize(), maal::boost::MatrixSvd::reviseMemory(), setDiagonal(), setIdentity(), setZero(), substraction(), and transpose().
Referenced by ~Matrix().
Referenced by Matrix().