![]() |
aimsdata
4.7.0
Neuroimaging data handling
|
#include <aims/sparsematrix/sparseordensematrix.h>


Classes | |
| class | MatrixLazyReader |
| MatrixLazyReader allows to read a row or a column from file, on demand. More... | |
Public Types | |
| typedef carto::VolumeRef< double > | DenseMatrixType |
| typedef carto::rc_ptr< SparseMatrix > | SparseMatrixType |
Public Types inherited from carto::RCObject | |
| typedef int | RefCounterType |
Public Member Functions | |
| SparseOrDenseMatrix (int32_t size1=1, int32_t size2=1) | |
| SparseOrDenseMatrix (const SparseOrDenseMatrix &other) | |
| virtual | ~SparseOrDenseMatrix () |
| SparseOrDenseMatrix & | operator= (const SparseOrDenseMatrix &other) |
| void | reallocate (int32_t size1, int32_t size2) |
| int32_t | getSize1 () const |
| int32_t | getSize2 () const |
| int32_t | getNonZeroElementCount () const |
| std::vector< int32_t > | getSize () const |
| bool | hasElement (int32_t i, int32_t j) const |
| double | operator() (int32_t i, int32_t j) const |
| void | erase_element (int32_t i, int32_t j) |
| void | set_element (int32_t i, int32_t j, double x) |
| void | setRow (int32_t s1, const std::vector< double > &row) |
| void | setColumn (int32_t s2, const std::vector< double > &column) |
| std::vector< double > | getRow (int32_t i) const |
| std::vector< double > | getColumn (int32_t j) const |
| void | readRow (int32_t i) |
| read a row using lazy reading, using the MatrixLazyReader. More... | |
| void | readColumn (int32_t i) |
| read a column using lazy reading, using the MatrixLazyReader. More... | |
| std::vector< double > * | getReadRow (int32_t i, bool store=true) |
| Get row, read it if it is not in memory, and optionally store it for later access. More... | |
| std::vector< double > * | getReadColumn (int32_t i, bool store=true) |
| Get column, read it if it is not in memory, and optionally store it for later access. More... | |
| void | readAll () |
| read all rows using lazy reading, using the MatrixLazyReader. More... | |
| void | freeRow (int32_t i) |
| void | freeColumn (int32_t i) |
| template<typename VectorType > | |
| VectorType | getSparseRow (int32_t i) const |
| template<typename VectorType > | |
| VectorType | getSparseColumn (int32_t i) const |
| void | read (const std::string &filename) |
| void | write (const std::string &filename, carto::Object options=carto::none()) const |
| bool | isDense () const |
| SparseMatrixType | sparseMatrix () |
| const SparseMatrixType | sparseMatrix () const |
| DenseMatrixType | denseMatrix () |
| const DenseMatrixType | denseMatrix () const |
| void | setMatrix (SparseMatrixType matrix) |
| void | setMatrix (DenseMatrixType matrix) |
| carto::Object | header () |
| const carto::Object | header () const |
| void | setHeader (carto::Object ph) |
| SparseMatrixType | asSparse (bool copy=false) const |
| get a shallow or deep copy in sparse shape More... | |
| DenseMatrixType | asDense (bool copy=false) const |
| get a shallow or deep copy in dense shape More... | |
| void | muteToDense () |
| void | muteToSparse () |
| void | muteToOptimalShape () |
| mute to sparse or dense according to the less memory consuming More... | |
| bool | isOptimalShape () const |
| unsigned long | optimalShapeThreshold () const |
| below this number of non-nul elements, the optimal shape is sparse More... | |
| SparseOrDenseMatrix & | operator+= (const SparseOrDenseMatrix &thing) |
| SparseOrDenseMatrix & | operator-= (const SparseOrDenseMatrix &thing) |
| SparseOrDenseMatrix & | operator*= (double x) |
| SparseOrDenseMatrix & | operator/= (double x) |
| void | setLazyReader (MatrixLazyReader *reader) |
| MatrixLazyReader * | lazyReader () const |
| SparseOrDenseMatrix * | subMatrix (const std::vector< int32_t > &start, const std::vector< int32_t > &size) |
| SparseOrDenseMatrix * | subMatrix (const std::vector< std::vector< int32_t > > &indices_along_dims) |
Public Member Functions inherited from carto::RCObject | |
| RCObject () | |
| RCObject (const RCObject &) | |
| RCObject & | operator= (const RCObject &) |
| virtual | ~RCObject () |
Protected Attributes | |
| SparseMatrixType | _sparsematrix |
| DenseMatrixType | _densematrix |
| carto::Object | _fakeheader |
| MatrixLazyReader * | _lazyreader |
Definition at line 45 of file sparseordensematrix.h.
| typedef carto::VolumeRef<double> aims::SparseOrDenseMatrix::DenseMatrixType |
Definition at line 86 of file sparseordensematrix.h.
Definition at line 87 of file sparseordensematrix.h.
| aims::SparseOrDenseMatrix::SparseOrDenseMatrix | ( | int32_t | size1 = 1, |
| int32_t | size2 = 1 |
||
| ) |
| aims::SparseOrDenseMatrix::SparseOrDenseMatrix | ( | const SparseOrDenseMatrix & | other | ) |
|
virtual |
| DenseMatrixType aims::SparseOrDenseMatrix::asDense | ( | bool | copy = false | ) | const |
get a shallow or deep copy in dense shape
Referenced by denseMatrix().
| SparseMatrixType aims::SparseOrDenseMatrix::asSparse | ( | bool | copy = false | ) | const |
get a shallow or deep copy in sparse shape
Referenced by denseMatrix().
|
inline |
Definition at line 162 of file sparseordensematrix.h.
References _densematrix.
Referenced by getSparseColumn(), and getSparseRow().
|
inline |
Definition at line 163 of file sparseordensematrix.h.
References _densematrix, asDense(), asSparse(), copy(), header(), isOptimalShape(), muteToDense(), muteToOptimalShape(), muteToSparse(), operator*=(), operator+=(), operator-=(), operator/=(), optimalShapeThreshold(), setHeader(), and setMatrix().
| void aims::SparseOrDenseMatrix::erase_element | ( | int32_t | i, |
| int32_t | j | ||
| ) |
| void aims::SparseOrDenseMatrix::freeColumn | ( | int32_t | i | ) |
| void aims::SparseOrDenseMatrix::freeRow | ( | int32_t | i | ) |
| std::vector<double> aims::SparseOrDenseMatrix::getColumn | ( | int32_t | j | ) | const |
| int32_t aims::SparseOrDenseMatrix::getNonZeroElementCount | ( | ) | const |
| std::vector<double>* aims::SparseOrDenseMatrix::getReadColumn | ( | int32_t | i, |
| bool | store = true |
||
| ) |
Get column, read it if it is not in memory, and optionally store it for later access.
The returned vector has to be freed after use.
| std::vector<double>* aims::SparseOrDenseMatrix::getReadRow | ( | int32_t | i, |
| bool | store = true |
||
| ) |
Get row, read it if it is not in memory, and optionally store it for later access.
The returned vector has to be freed after use.
| std::vector<double> aims::SparseOrDenseMatrix::getRow | ( | int32_t | i | ) | const |
| std::vector<int32_t> aims::SparseOrDenseMatrix::getSize | ( | ) | const |
| int32_t aims::SparseOrDenseMatrix::getSize1 | ( | ) | const |
| int32_t aims::SparseOrDenseMatrix::getSize2 | ( | ) | const |
|
inline |
Definition at line 237 of file sparseordensematrix.h.
References carto::VolumeRef< T >::at(), denseMatrix(), isDense(), aims::operator*(), aims::operator+(), aims::operator-(), aims::operator/(), and sparseMatrix().
|
inline |
Definition at line 218 of file sparseordensematrix.h.
References carto::VolumeRef< T >::at(), denseMatrix(), isDense(), and sparseMatrix().
| bool aims::SparseOrDenseMatrix::hasElement | ( | int32_t | i, |
| int32_t | j | ||
| ) | const |
| carto::Object aims::SparseOrDenseMatrix::header | ( | ) |
Referenced by denseMatrix().
| const carto::Object aims::SparseOrDenseMatrix::header | ( | ) | const |
|
inline |
Definition at line 158 of file sparseordensematrix.h.
References _densematrix, and carto::const_ref< T >::isNull().
Referenced by getSparseColumn(), and getSparseRow().
| bool aims::SparseOrDenseMatrix::isOptimalShape | ( | ) | const |
Referenced by denseMatrix().
|
inline |
Definition at line 198 of file sparseordensematrix.h.
References _lazyreader, and subMatrix().
| void aims::SparseOrDenseMatrix::muteToDense | ( | ) |
Referenced by denseMatrix().
| void aims::SparseOrDenseMatrix::muteToOptimalShape | ( | ) |
mute to sparse or dense according to the less memory consuming
Referenced by denseMatrix().
| void aims::SparseOrDenseMatrix::muteToSparse | ( | ) |
Referenced by denseMatrix().
| double aims::SparseOrDenseMatrix::operator() | ( | int32_t | i, |
| int32_t | j | ||
| ) | const |
| SparseOrDenseMatrix& aims::SparseOrDenseMatrix::operator*= | ( | double | x | ) |
Referenced by denseMatrix().
| SparseOrDenseMatrix& aims::SparseOrDenseMatrix::operator+= | ( | const SparseOrDenseMatrix & | thing | ) |
Referenced by denseMatrix().
| SparseOrDenseMatrix& aims::SparseOrDenseMatrix::operator-= | ( | const SparseOrDenseMatrix & | thing | ) |
Referenced by denseMatrix().
| SparseOrDenseMatrix& aims::SparseOrDenseMatrix::operator/= | ( | double | x | ) |
Referenced by denseMatrix().
| SparseOrDenseMatrix& aims::SparseOrDenseMatrix::operator= | ( | const SparseOrDenseMatrix & | other | ) |
| unsigned long aims::SparseOrDenseMatrix::optimalShapeThreshold | ( | ) | const |
below this number of non-nul elements, the optimal shape is sparse
Referenced by denseMatrix().
| void aims::SparseOrDenseMatrix::read | ( | const std::string & | filename | ) |
| void aims::SparseOrDenseMatrix::readAll | ( | ) |
read all rows using lazy reading, using the MatrixLazyReader.
The default implementation does just nothing.
| void aims::SparseOrDenseMatrix::readColumn | ( | int32_t | i | ) |
read a column using lazy reading, using the MatrixLazyReader.
The default implementation does just nothing.
If "vector" is not Null, the read vector is "returned" in vector. In such a case, the vector has to be freed after use. If store is false and vector is not null, the vector is read (potentially from disk) but not kept in the matrix.
| void aims::SparseOrDenseMatrix::readRow | ( | int32_t | i | ) |
read a row using lazy reading, using the MatrixLazyReader.
The default implementation does just nothing.
If "vector" is not Null, the read vector is "returned" in vector. In such a case, the vector has to be freed after use. If store is false and vector is not null, the vector is read (potentially from disk) but not kept in the matrix.
| void aims::SparseOrDenseMatrix::reallocate | ( | int32_t | size1, |
| int32_t | size2 | ||
| ) |
| void aims::SparseOrDenseMatrix::set_element | ( | int32_t | i, |
| int32_t | j, | ||
| double | x | ||
| ) |
| void aims::SparseOrDenseMatrix::setColumn | ( | int32_t | s2, |
| const std::vector< double > & | column | ||
| ) |
| void aims::SparseOrDenseMatrix::setHeader | ( | carto::Object | ph | ) |
Referenced by denseMatrix().
|
inline |
Definition at line 193 of file sparseordensematrix.h.
References _lazyreader.
| void aims::SparseOrDenseMatrix::setMatrix | ( | SparseMatrixType | matrix | ) |
Referenced by denseMatrix().
| void aims::SparseOrDenseMatrix::setMatrix | ( | DenseMatrixType | matrix | ) |
| void aims::SparseOrDenseMatrix::setRow | ( | int32_t | s1, |
| const std::vector< double > & | row | ||
| ) |
|
inline |
Definition at line 160 of file sparseordensematrix.h.
References _sparsematrix.
Referenced by getSparseColumn(), and getSparseRow().
|
inline |
Definition at line 161 of file sparseordensematrix.h.
References _sparsematrix.
| SparseOrDenseMatrix* aims::SparseOrDenseMatrix::subMatrix | ( | const std::vector< int32_t > & | start, |
| const std::vector< int32_t > & | size | ||
| ) |
Referenced by lazyReader().
| SparseOrDenseMatrix* aims::SparseOrDenseMatrix::subMatrix | ( | const std::vector< std::vector< int32_t > > & | indices_along_dims | ) |
| void aims::SparseOrDenseMatrix::write | ( | const std::string & | filename, |
| carto::Object | options = carto::none() |
||
| ) | const |
|
protected |
Definition at line 209 of file sparseordensematrix.h.
Referenced by denseMatrix(), and isDense().
|
protected |
Definition at line 210 of file sparseordensematrix.h.
|
protected |
Definition at line 211 of file sparseordensematrix.h.
Referenced by lazyReader(), and setLazyReader().
|
protected |
Definition at line 208 of file sparseordensematrix.h.
Referenced by sparseMatrix().