Thea

Matrix that stores elements as a (row, col) –> value map. More...
#include <MappedMatrix.hpp>
Classes  
class  Triplet 
The stored (row, col, value) triplet type. More...  
Public Types  
typedef IndexT  Index 
The type of row or column indices. More...  
typedef TripletSet::const_iterator  TripletConstIterator 
Readonly iterator over triplets. More...  
typedef T  Value 
Type of values stored in the matrix. More...  
typedef T  value_type 
Type of values stored in the matrix (STL convention). More...  
Public Member Functions  
IAddressableMatrix< T > const *  asAddressable () const 
If the matrix elements are addressable by (row, col) pairs, get a pointer to a derived interface supporting such access. More...  
IAddressableMatrix< T > *  asAddressable () 
If the matrix elements are addressable by (row, col) pairs, get a pointer to a derived interface supporting such access. More...  
ICompressedSparseMatrix< T > const *  asCompressed () const 
If the matrix is stored in compressed column or row format, get a pointer to a derived interface supporting access specific to that format. More...  
ICompressedSparseMatrix< T > *  asCompressed () 
If the matrix is stored in compressed column or row format, get a pointer to a derived interface supporting access specific to that format. More...  
IDenseMatrix< T > const *  asDense () const 
If the matrix is stored as a dense array, get a pointer to a derived interface supporting densespecific access. More...  
IDenseMatrix< T > *  asDense () 
If the matrix is stored as a dense array, get a pointer to a derived interface supporting densespecific access. More...  
ISparseMatrix< T > const *  asSparse () const 
If the matrix elements are addressable by (row, col) pairs, get a pointer to a derived interface supporting such access. More...  
ISparseMatrix< T > *  asSparse () 
If the matrix is sparse, get a pointer to a derived interface giving sparsespecific access. More...  
T const &  at (int64 row, int64 col) const 
Get a readonly element. More...  
int64  cols () const 
Get the number of columns. More...  
void  getColumn (int64 col, T *values) const 
Get a column of the matrix. More...  
void  getRow (int64 row, T *values) const 
Get a row of the matrix. More...  
int8  isResizable () const 
Check if the matrix can be freely resized. More...  
MappedMatrix (intx nrows=0, intx ncols=0)  
Constructor. More...  
T &  mutableAt (int64 row, int64 col) 
Get an element that can be directly modified. More...  
int64  numStoredElements () const 
Get the number of entries actually stored in the matrix. More...  
T const &  operator() (Index row, Index col) const 
Get the element at position (row, col). More...  
int8  resize (int64 nrows, int64 ncols) 
Resize the matrix to new dimensions, if isResizable() returns true. More...  
int64  rows () const 
Get the number of rows. More...  
void  set (Index row, Index col, T const &value) 
Set the element at position (row, col). More...  
void  setColumn (int64 col, T const *values) 
Set a column of the matrix. More...  
void  setRow (int64 row, T const *values) 
Set a row of the matrix. More...  
void  setZero () 
Set all elements to zero. More...  
TripletConstIterator  tripletsBegin () const 
Get a readonly iterator pointing to the first (row, col, value) triplet in the matrix. More...  
TripletConstIterator  tripletsEnd () const 
Get a readonly iterator pointing to one past the last (row, col, value) triplet in the matrix. More...  
Matrix that stores elements as a (row, col) –> value map.
Definition at line 28 of file MappedMatrix.hpp.
typedef IndexT Index 
The type of row or column indices.
Definition at line 31 of file MappedMatrix.hpp.
typedef TripletSet::const_iterator TripletConstIterator 
Readonly iterator over triplets.
Definition at line 98 of file MappedMatrix.hpp.

inherited 
Type of values stored in the matrix.
Definition at line 33 of file IMatrix.hpp.

inherited 
Type of values stored in the matrix (STL convention).
Definition at line 34 of file IMatrix.hpp.
MappedMatrix  (  intx  nrows = 0 , 
intx  ncols = 0 

) 
Constructor.
Definition at line 101 of file MappedMatrix.hpp.

virtual 
If the matrix elements are addressable by (row, col) pairs, get a pointer to a derived interface supporting such access.
Else, return null.
dynamic_cast
does not work reliably across shared library boundaries, and relying on users to avoid it and only use static_cast
is dangerous. Implements IMatrix< T >.
Definition at line 233 of file MappedMatrix.hpp.

virtual 
If the matrix elements are addressable by (row, col) pairs, get a pointer to a derived interface supporting such access.
Else, return null.
dynamic_cast
does not work reliably across shared library boundaries, and relying on users to avoid it and only use static_cast
is dangerous. Implements IMatrix< T >.
Definition at line 234 of file MappedMatrix.hpp.

virtual 
If the matrix is stored in compressed column or row format, get a pointer to a derived interface supporting access specific to that format.
Else, return null.
dynamic_cast
does not work reliably across shared library boundaries, and relying on users to avoid it and only use static_cast
is dangerous. Implements ISparseMatrix< T >.
Definition at line 239 of file MappedMatrix.hpp.

virtual 
If the matrix is stored in compressed column or row format, get a pointer to a derived interface supporting access specific to that format.
Else, return null.
dynamic_cast
does not work reliably across shared library boundaries, and relying on users to avoid it and only use static_cast
is dangerous. Implements ISparseMatrix< T >.
Definition at line 240 of file MappedMatrix.hpp.

virtual 
If the matrix is stored as a dense array, get a pointer to a derived interface supporting densespecific access.
Else, return null.
dynamic_cast
does not work reliably across shared library boundaries, and relying on users to avoid it and only use static_cast
is dangerous. Implements IAddressableMatrix< T >.
Definition at line 237 of file MappedMatrix.hpp.

virtual 
If the matrix is stored as a dense array, get a pointer to a derived interface supporting densespecific access.
Else, return null.
dynamic_cast
does not work reliably across shared library boundaries, and relying on users to avoid it and only use static_cast
is dangerous. Implements IAddressableMatrix< T >.
Definition at line 238 of file MappedMatrix.hpp.

virtual 
If the matrix elements are addressable by (row, col) pairs, get a pointer to a derived interface supporting such access.
Else, return null.
dynamic_cast
does not work reliably across shared library boundaries, and relying on users to avoid it and only use static_cast
is dangerous. Implements IMatrix< T >.
Definition at line 235 of file MappedMatrix.hpp.

virtual 
If the matrix is sparse, get a pointer to a derived interface giving sparsespecific access.
Else, return null. Note that a sparse matrix can still be addressable, e.g. if it is stored as a map of (row, col) –> value
pairs.
dynamic_cast
does not work reliably across shared library boundaries, and relying on users to avoid it and only use static_cast
is dangerous. Implements IMatrix< T >.
Definition at line 236 of file MappedMatrix.hpp.

virtual 
Get a readonly element.
Most derived/underlying classes define operator() to access an element quicker, without the virtual function overhead. Use this function only in generic algorithms that need polymorphic access to matrices without using templates, or when accessing matrices across shared library boundaries.
If the element is not already stored in the matrix, it will return a zero value.
Implements IAddressableMatrix< T >.
Definition at line 159 of file MappedMatrix.hpp.

virtual 
Get the number of columns.
Implements IMatrix< T >.
Definition at line 109 of file MappedMatrix.hpp.

virtual 
Get a column of the matrix.
values must be preallocated with rows() elements.
This function is in general very slow because it has to iterate through all the stored elements, and should be avoided.
Implements IAddressableMatrix< T >.
Definition at line 210 of file MappedMatrix.hpp.

virtual 
Get a row of the matrix.
values must be preallocated with cols() elements.
This function is in general very slow because it has to iterate through all the stored elements, and should be avoided.
Implements IAddressableMatrix< T >.
Definition at line 182 of file MappedMatrix.hpp.

virtual 
Check if the matrix can be freely resized.
Implements IMatrix< T >.
Definition at line 111 of file MappedMatrix.hpp.

virtual 
Get an element that can be directly modified.
Most derived/underlying classes define operator() to access an element quicker, without the virtual function overhead. Use this function only in generic algorithms that need polymorphic access to matrices without using templates, or when accessing matrices across shared library boundaries.
If the element is not already stored in the matrix, it will be inserted with an initial value of zero, increasing the storage size.
Implements IAddressableMatrix< T >.
Definition at line 170 of file MappedMatrix.hpp.

virtual 
Get the number of entries actually stored in the matrix.
These are often called "nonzeros", though they may actually have the numeric value 0.
Implements ISparseMatrix< T >.
Definition at line 125 of file MappedMatrix.hpp.
Get the element at position (row, col).
If the element is not already stored in the matrix, it will return a zero value.
Definition at line 137 of file MappedMatrix.hpp.

virtual 
Resize the matrix to new dimensions, if isResizable() returns true.
Else, if the new dimensions are identical to the old dimensions, do nothing and return true, else return false. If the dimensions are changed, existing entries will in general not be preserved in the resized matrix.
Implements IMatrix< T >.
Definition at line 113 of file MappedMatrix.hpp.

virtual 
Set the element at position (row, col).
Definition at line 146 of file MappedMatrix.hpp.

virtual 
Set a column of the matrix.
values must contain rows() elements.
This function compares the elements of values to 0 using the notequals operator T::operator!=
. This may be prone to numerical (floatingpoint) error.
Implements IAddressableMatrix< T >.
Definition at line 225 of file MappedMatrix.hpp.

virtual 
Set a row of the matrix.
values must contain cols() elements.
This function compares the elements of values to 0 using the notequals operator T::operator!=
. This may be prone to numerical (floatingpoint) error.
Implements IAddressableMatrix< T >.
Definition at line 197 of file MappedMatrix.hpp.

virtual 
TripletConstIterator tripletsBegin  (  )  const 
Get a readonly iterator pointing to the first (row, col, value) triplet in the matrix.
Definition at line 128 of file MappedMatrix.hpp.
TripletConstIterator tripletsEnd  (  )  const 
Get a readonly iterator pointing to one past the last (row, col, value) triplet in the matrix.
Definition at line 131 of file MappedMatrix.hpp.