MDSTk Libraries
1.1.0
Medical Data Segmentation Toolkit
|
Template for a two dimensional sparse matrix. More...
#include <mdsSparseMatrix.h>
Public Types | |
enum | { CLASS_SPARSEMATRIX } |
Templates that require members of the CMatrix class can use this enum to check the existence. More... | |
enum | { CLASS_OBJECT } |
Templates that require members of the CObject class can use this enum to check the existence. More... | |
enum | { HEAP_OBJECT = 0x70616568 } |
Signature used to recognize objects on the heap. More... | |
typedef CSparseMatrixBase < CSparseMatrix< T > > | tBase |
Base class. | |
typedef T | tElement |
Matrix element type. | |
typedef CSparseMatrix< T > | tMatrix |
Matrix type. | |
typedef Eigen::SparseMatrix < tElement, Eigen::ColMajor > | tStorage |
Underlying matrix data (see the Eigen library). | |
Public Member Functions | |
CSparseMatrix & | abs () |
Makes absolute value of all non-dominant (i.e. non-zero) elements. | |
CSparseMatrix & | asDense (CMatrix< T > &result) |
Stores the sparse matrix as dense. | |
tStorage & | asEigen () |
Returns reference to the underlying matrix data (see the Eigen library). | |
const tStorage & | asEigen () const |
tElement & | at (tSize row, tSize col) |
Method returns reference to the element at (row, col). | |
tElement | at (tSize row, tSize col) const |
Method returns element (by value) at (row, col). | |
tElement & | atRef (tSize row, tSize col) |
Method returns reference to the element at (row, col). | |
void | clear () |
Clears the whole matrix (i.e. removes all non zeros). | |
tSize | cols () const |
template<typename T > | |
CSparseMatrix< T > & | create (tSize rows, tSize cols) |
template<typename Derived > | |
CSparseMatrix< T > & | create (const CSparseMatrixBase< Derived > &Matrix) |
template<typename Derived > | |
CSparseMatrix< T > & | create (const Eigen::SparseMatrixBase< Derived > &Matrix) |
CSparseMatrix & | create (tSize NumOfRows, tSize NumOfCols) |
Creates new matrix of specified dimensions. | |
template<typename Derived > | |
CSparseMatrix & | create (const CSparseMatrixBase< Derived > &Matrix) |
Re-creates the matrix. | |
template<typename Derived > | |
CSparseMatrix & | create (const Eigen::SparseMatrixBase< Derived > &Matrix) |
Re-creates the matrix. | |
template<typename T > | |
CSparseMatrix () | |
template<typename T > | |
CSparseMatrix (tSize rows, tSize cols) | |
template<typename T > | |
CSparseMatrix (const CSparseMatrix< T > &Matrix) | |
template<typename Derived > | |
CSparseMatrix (const Eigen::SparseMatrixBase< Derived > &Matrix) | |
CSparseMatrix () | |
Declare iterator types tIterator and tConstIterator. | |
CSparseMatrix (tSize NumOfRows, tSize NumOfCols) | |
Constructor. | |
CSparseMatrix (const CSparseMatrix &Matrix) | |
Copy constructor. | |
template<typename Derived > | |
CSparseMatrix (const Eigen::SparseMatrixBase< Derived > &Matrix) | |
Constructor. | |
CSparseMatrix & | fill (const T &Value) |
Changes value of all non-dominant (i.e. non-zero) coefficients. | |
template<class Function > | |
Function | forEach (Function Func) const |
Calls a function object for every matrix element. | |
template<class Function > | |
Function | forEach (Function Func) const |
Calls a function object for every non-zero matrix element. | |
template<class Function > | |
Function | forEachRef (Function Func) |
Calls a function object for every non-dominant matrix element. | |
template<class Function > | |
Function | forEachRef (Function Func) |
Calls a function object for every non-zero matrix element. | |
tElement | getDominant () const |
Returns the matrix dominant value. | |
tElement | getDominant () |
Returns matrix dominant value (i.e. zero). | |
tMatrix & | getImpl () |
Returns reference to the matrix implementation. | |
const tMatrix & | getImpl () const |
tSize | getNumOfCols () const |
tSize | getNumOfNonDominant () const |
Returns number of non-dominant (i.e. non-zero) elements. | |
tSize | getNumOfRows () const |
Returns the matrix dimensions. | |
int | getReferencesCount () const |
Returns the number of references. | |
bool | isOnHeap () const |
Returns true if the object is allocated on the heap. | |
bool | isSquare () const |
Type of the matrix. | |
void | lmult (const CVector< T > &vec, CVector< T > &result) |
Matrix vector left multiplication. | |
MDS_SHAREDPTR (CSparseMatrix) | |
Smart pointer type. | |
tElement & | operator() (tSize row, tSize col) |
Method returns reference to the element at (row, col). | |
tElement | operator() (tSize row, tSize col) const |
Method returns element (by value) at (row, col). | |
template<typename T > | |
CSparseMatrix< T > & | operator= (const CSparseMatrix< T > &Matrix) |
CSparseMatrix & | operator= (const CSparseMatrix &Matrix) |
Assignment operator. | |
template<typename Derived > | |
CSparseMatrix & | operator= (const Eigen::SparseMatrixBase< Derived > &Matrix) |
Assignment operator. | |
template<typename Derived > | |
CSparseMatrix< T > & | operator= (const Eigen::SparseMatrixBase< Derived > &Matrix) |
template<class Function > | |
Function | pforEach (Function Func) const |
Calls a function object for every matrix element. | |
template<class Function > | |
Function | pforEach (Function Func) const |
Calls a function object for every non-zero matrix element. | |
template<class Function > | |
Function | pforEachRef (Function Func) |
Calls a function object for every non-dominant matrix element. | |
template<class Function > | |
Function | pforEachRef (Function Func) |
Calls a function object for every non-zero matrix element. | |
void | rmult (const CVector< T > &vec, CVector< T > &result) |
Matrix vector right multiplication. | |
tSize | rows () const |
Returns the matrix dimensions. | |
tMatrix & | set (tSize row, tSize col, const tElement &Value) |
Method sets value of element at (row, col). | |
CSparseMatrix & | set (tSize row, tSize col, const tElement &el) |
Method sets value of element at (row, col). | |
CSparseMatrix & | transpose (const CSparseMatrix &Matrix) |
Transpose of the matrix. | |
CSparseMatrix & | unit () |
Makes the matrix unit. | |
CSparseMatrix & | zeros () |
Sets all entries in matrix to zero. | |
virtual | ~CSparseMatrix () |
Destructor. | |
Static Public Member Functions | |
static void * | operator new (std::size_t Size) |
Allocates a new object on the heap. | |
Protected Member Functions | |
void | addReference () const |
Increase the reference counter. | |
bool | delReference () const |
Decrease the reference counter. | |
Protected Attributes | |
int | m_iHeapObject |
Flag initialized if the object is on the heap. | |
int | m_iReferences |
The number of references to the object. | |
tStorage | m_Matrix |
Internal data storage. |
Template for a two dimensional sparse matrix.
typedef CSparseMatrixBase<CSparseMatrix<T> > mds::math::CSparseMatrix< T >::tBase |
Base class.
typedef T mds::math::CSparseMatrix< T >::tElement |
Matrix element type.
Reimplemented from mds::math::CSparseMatrixBase< CSparseMatrix< T > >.
typedef CSparseMatrix< T > mds::math::CSparseMatrixBase< CSparseMatrix< T > >::tMatrix [inherited] |
Matrix type.
typedef Eigen::SparseMatrix<tElement, Eigen::ColMajor> mds::math::CSparseMatrix< T >::tStorage |
Underlying matrix data (see the Eigen library).
anonymous enum |
Templates that require members of the CMatrix class can use this enum to check the existence.
anonymous enum [inherited] |
Templates that require members of the CObject class can use this enum to check the existence.
mds::math::CSparseMatrix< T >::CSparseMatrix | ( | ) |
Declare iterator types tIterator and tConstIterator.
Default constructor.
mds::math::CSparseMatrix< T >::CSparseMatrix | ( | tSize | NumOfRows, |
tSize | NumOfCols | ||
) |
Constructor.
mds::math::CSparseMatrix< T >::CSparseMatrix | ( | const CSparseMatrix< T > & | Matrix | ) |
Copy constructor.
mds::math::CSparseMatrix< T >::CSparseMatrix | ( | const Eigen::SparseMatrixBase< Derived > & | Matrix | ) |
Constructor.
CSparseMatrix::~CSparseMatrix | ( | ) | [virtual] |
Destructor.
mds::math::CSparseMatrix< T >::CSparseMatrix | ( | tSize | rows, |
tSize | cols | ||
) |
mds::math::CSparseMatrix< T >::CSparseMatrix | ( | const CSparseMatrix< T > & | Matrix | ) |
mds::math::CSparseMatrix< T >::CSparseMatrix | ( | const Eigen::SparseMatrixBase< Derived > & | Matrix | ) |
CSparseMatrix< T > & CSparseMatrix::abs | ( | ) |
Makes absolute value of all non-dominant (i.e. non-zero) elements.
void mds::base::CObject::addReference | ( | ) | const [protected, inherited] |
Increase the reference counter.
CSparseMatrix< T > & CSparseMatrix::asDense | ( | CMatrix< T > & | result | ) |
Stores the sparse matrix as dense.
tStorage& mds::math::CSparseMatrix< T >::asEigen | ( | ) |
Returns reference to the underlying matrix data (see the Eigen library).
const tStorage& mds::math::CSparseMatrix< T >::asEigen | ( | ) | const |
tElement& mds::math::CSparseMatrixBase< CSparseMatrix< T > >::at | ( | tSize | row, |
tSize | col | ||
) | [inherited] |
Method returns reference to the element at (row, col).
tElement mds::math::CSparseMatrix< T >::at | ( | tSize | row, |
tSize | col | ||
) | const |
Method returns element (by value) at (row, col).
If specified element doesn't exist, returns the dominant value.
Reimplemented from mds::math::CSparseMatrixBase< CSparseMatrix< T > >.
tElement& mds::math::CSparseMatrix< T >::atRef | ( | tSize | row, |
tSize | col | ||
) |
Method returns reference to the element at (row, col).
If specified element doesn't exist, it is inserted automatically.
void CSparseMatrix::clear | ( | ) |
Clears the whole matrix (i.e. removes all non zeros).
tSize mds::math::CSparseMatrix< T >::cols | ( | ) | const |
Reimplemented from mds::math::CSparseMatrixBase< CSparseMatrix< T > >.
CSparseMatrix<T>& mds::math::CSparseMatrix< T >::create | ( | tSize | rows, |
tSize | cols | ||
) |
CSparseMatrix<T>& mds::math::CSparseMatrix< T >::create | ( | const CSparseMatrixBase< Derived > & | Matrix | ) |
CSparseMatrix<T>& mds::math::CSparseMatrix< T >::create | ( | const Eigen::SparseMatrixBase< Derived > & | Matrix | ) |
CSparseMatrix< T > & mds::math::CSparseMatrix< T >::create | ( | tSize | NumOfRows, |
tSize | NumOfCols | ||
) |
Creates new matrix of specified dimensions.
CSparseMatrix< T > & mds::math::CSparseMatrix< T >::create | ( | const CSparseMatrixBase< Derived > & | Matrix | ) |
Re-creates the matrix.
CSparseMatrix< T > & mds::math::CSparseMatrix< T >::create | ( | const Eigen::SparseMatrixBase< Derived > & | Matrix | ) |
Re-creates the matrix.
bool mds::base::CObject::delReference | ( | ) | const [protected, inherited] |
Decrease the reference counter.
CSparseMatrix< T > & CSparseMatrix::fill | ( | const T & | Value | ) |
Changes value of all non-dominant (i.e. non-zero) coefficients.
Function mds::math::CSparseMatrix< T >::forEach | ( | Function | Func | ) | const |
Calls a function object for every matrix element.
Reimplemented from mds::math::CSparseMatrixBase< CSparseMatrix< T > >.
Function mds::math::CSparseMatrix< T >::forEach | ( | Function | Func | ) | const |
Calls a function object for every non-zero matrix element.
Reimplemented from mds::math::CSparseMatrixBase< CSparseMatrix< T > >.
Function mds::math::CSparseMatrix< T >::forEachRef | ( | Function | Func | ) |
Calls a function object for every non-dominant matrix element.
Reimplemented from mds::math::CSparseMatrixBase< CSparseMatrix< T > >.
Function mds::math::CSparseMatrix< T >::forEachRef | ( | Function | Func | ) |
Calls a function object for every non-zero matrix element.
Reimplemented from mds::math::CSparseMatrixBase< CSparseMatrix< T > >.
tElement mds::math::CSparseMatrixBase< CSparseMatrix< T > >::getDominant | ( | ) | const [inherited] |
Returns the matrix dominant value.
tElement mds::math::CSparseMatrix< T >::getDominant | ( | ) |
Returns matrix dominant value (i.e. zero).
tMatrix& mds::math::CSparseMatrixBase< CSparseMatrix< T > >::getImpl | ( | ) | [inherited] |
Returns reference to the matrix implementation.
const tMatrix& mds::math::CSparseMatrixBase< CSparseMatrix< T > >::getImpl | ( | ) | const [inherited] |
tSize mds::math::CSparseMatrix< T >::getNumOfCols | ( | ) | const |
Reimplemented from mds::math::CSparseMatrixBase< CSparseMatrix< T > >.
tSize mds::math::CSparseMatrix< T >::getNumOfNonDominant | ( | ) | const |
Returns number of non-dominant (i.e. non-zero) elements.
tSize mds::math::CSparseMatrix< T >::getNumOfRows | ( | ) | const |
Returns the matrix dimensions.
Reimplemented from mds::math::CSparseMatrixBase< CSparseMatrix< T > >.
int mds::base::CObject::getReferencesCount | ( | ) | const [inherited] |
Returns the number of references.
bool mds::base::CObject::isOnHeap | ( | ) | const [inherited] |
Returns true if the object is allocated on the heap.
bool mds::math::CSparseMatrix< T >::isSquare | ( | ) | const |
Type of the matrix.
void CSparseMatrix::lmult | ( | const CVector< T > & | vec, |
CVector< T > & | result | ||
) |
Matrix vector left multiplication.
mds::math::CSparseMatrix< T >::MDS_SHAREDPTR | ( | CSparseMatrix< T > | ) |
Smart pointer type.
static void* mds::base::CObject::operator new | ( | std::size_t | Size | ) | [static, inherited] |
Allocates a new object on the heap.
tElement& mds::math::CSparseMatrixBase< CSparseMatrix< T > >::operator() | ( | tSize | row, |
tSize | col | ||
) | [inherited] |
Method returns reference to the element at (row, col).
tElement mds::math::CSparseMatrix< T >::operator() | ( | tSize | row, |
tSize | col | ||
) | const |
Method returns element (by value) at (row, col).
If specified element doesn't exist, it returns dominant value.
Reimplemented from mds::math::CSparseMatrixBase< CSparseMatrix< T > >.
CSparseMatrix<T>& mds::math::CSparseMatrix< T >::operator= | ( | const CSparseMatrix< T > & | Matrix | ) |
CSparseMatrix< T > & mds::math::CSparseMatrix< T >::operator= | ( | const CSparseMatrix< T > & | Matrix | ) |
Assignment operator.
CSparseMatrix< T > & mds::math::CSparseMatrix< T >::operator= | ( | const Eigen::SparseMatrixBase< Derived > & | Matrix | ) |
Assignment operator.
CSparseMatrix<T>& mds::math::CSparseMatrix< T >::operator= | ( | const Eigen::SparseMatrixBase< Derived > & | Matrix | ) |
Function mds::math::CSparseMatrix< T >::pforEach | ( | Function | Func | ) | const |
Calls a function object for every matrix element.
Reimplemented from mds::math::CSparseMatrixBase< CSparseMatrix< T > >.
Function mds::math::CSparseMatrix< T >::pforEach | ( | Function | Func | ) | const |
Calls a function object for every non-zero matrix element.
Reimplemented from mds::math::CSparseMatrixBase< CSparseMatrix< T > >.
Function mds::math::CSparseMatrix< T >::pforEachRef | ( | Function | Func | ) |
Calls a function object for every non-dominant matrix element.
Reimplemented from mds::math::CSparseMatrixBase< CSparseMatrix< T > >.
Function mds::math::CSparseMatrix< T >::pforEachRef | ( | Function | Func | ) |
Calls a function object for every non-zero matrix element.
Reimplemented from mds::math::CSparseMatrixBase< CSparseMatrix< T > >.
void CSparseMatrix::rmult | ( | const CVector< T > & | vec, |
CVector< T > & | result | ||
) |
Matrix vector right multiplication.
tSize mds::math::CSparseMatrix< T >::rows | ( | ) | const |
Returns the matrix dimensions.
Reimplemented from mds::math::CSparseMatrixBase< CSparseMatrix< T > >.
tMatrix& mds::math::CSparseMatrixBase< CSparseMatrix< T > >::set | ( | tSize | row, |
tSize | col, | ||
const tElement & | Value | ||
) | [inherited] |
Method sets value of element at (row, col).
CSparseMatrix& mds::math::CSparseMatrix< T >::set | ( | tSize | row, |
tSize | col, | ||
const tElement & | el | ||
) |
Method sets value of element at (row, col).
if element doesn't exist, new one is created.
CSparseMatrix< T > & CSparseMatrix::transpose | ( | const CSparseMatrix< T > & | Matrix | ) |
Transpose of the matrix.
CSparseMatrix< T > & CSparseMatrix::unit | ( | ) |
Makes the matrix unit.
CSparseMatrix< T > & CSparseMatrix::zeros | ( | ) |
Sets all entries in matrix to zero.
int mds::base::CObject::m_iHeapObject [mutable, protected, inherited] |
Flag initialized if the object is on the heap.
int mds::base::CObject::m_iReferences [mutable, protected, inherited] |
The number of references to the object.
tStorage mds::math::CSparseMatrix< T >::m_Matrix [protected] |
Internal data storage.