SMILE  v2.5
Schwarzschild Modelling Interactive expLoratory Environment
Public Member Functions | List of all members
smile::CMatrix< NumT > Struct Template Referenceabstract

interface for matrix storage. More...

#include <common.h>

Inheritance diagram for smile::CMatrix< NumT >:
Inheritance graph
[legend]

Public Member Functions

virtual bool isDense () const
 whether the matrix is dense or sparse (may be used to optimize calculations)
 
virtual size_t size1 () const =0
 return size for first index
 
virtual size_t size2 () const =0
 same for second
 
virtual size_t numElems () const
 number of possibly nonzero elements in sparse matrix More...
 
virtual NumT at (size_t i1, size_t i2) const =0
 return value at indices i1,i2. Note: there is no abstract function to set a value.
 
virtual NumT getElem (size_t index, size_t *i1, size_t *i2) const
 get an element from the matrix, 0<=index<numElems() More...
 

Detailed Description

template<typename NumT>
struct smile::CMatrix< NumT >

interface for matrix storage.

used to pass around large quantities of data without making temporary copies of arrays; derived classes may provide virtual method which returns matrix elements, or simply keep the matrix "as is" in std::vector<std::vector<NumT> >

Template Parameters
NumTis a numerical type (double or float)

Member Function Documentation

template<typename NumT>
virtual NumT smile::CMatrix< NumT >::getElem ( size_t  index,
size_t *  i1,
size_t *  i2 
) const
inlinevirtual

get an element from the matrix, 0<=index<numElems()

by default get an element from the dense matrix representation

Reimplemented in smile::CMatrixDiagonal< NumT >.

template<typename NumT>
virtual size_t smile::CMatrix< NumT >::numElems ( ) const
inlinevirtual

number of possibly nonzero elements in sparse matrix

by default all size1*size2 elements count, even if some of them are zero

Reimplemented in smile::CMatrixDiagonal< NumT >.


The documentation for this struct was generated from the following file: