A.I.M.S


aims::SparseOrDenseMatrix Class Reference

#include <aims/sparsematrix/sparseordensematrix.h>

Inheritance diagram for aims::SparseOrDenseMatrix:
Collaboration diagram for aims::SparseOrDenseMatrix:

Public Types

typedef carto::VolumeRef< double > DenseMatrixType
 
typedef carto::rc_ptr
< SparseMatrix
SparseMatrixType
 

Public Member Functions

 SparseOrDenseMatrix (int32_t size1=1, int32_t size2=1)
 
 SparseOrDenseMatrix (const SparseOrDenseMatrix &other)
 
virtual ~SparseOrDenseMatrix ()
 
SparseOrDenseMatrixoperator= (const SparseOrDenseMatrix &other)
 
void reallocate (int32_t size1, int32_t size2)
 
int32_t getSize1 () const
 
int32_t getSize2 () const
 
int32_t getNonZeroElementCount () 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
 
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...
 
SparseOrDenseMatrixoperator+= (const SparseOrDenseMatrix &thing)
 
SparseOrDenseMatrixoperator-= (const SparseOrDenseMatrix &thing)
 
SparseOrDenseMatrixoperator*= (double x)
 
SparseOrDenseMatrixoperator/= (double x)
 

Protected Attributes

SparseMatrixType _sparsematrix
 
DenseMatrixType _densematrix
 
carto::Object _fakeheader
 

Detailed Description

Definition at line 45 of file sparseordensematrix.h.

Member Typedef Documentation

Constructor & Destructor Documentation

aims::SparseOrDenseMatrix::SparseOrDenseMatrix ( int32_t  size1 = 1,
int32_t  size2 = 1 
)
aims::SparseOrDenseMatrix::SparseOrDenseMatrix ( const SparseOrDenseMatrix other)
virtual aims::SparseOrDenseMatrix::~SparseOrDenseMatrix ( )
virtual

Member Function Documentation

DenseMatrixType aims::SparseOrDenseMatrix::asDense ( bool  copy = false) const

get a shallow or deep copy in dense shape

SparseMatrixType aims::SparseOrDenseMatrix::asSparse ( bool  copy = false) const

get a shallow or deep copy in sparse shape

DenseMatrixType aims::SparseOrDenseMatrix::denseMatrix ( )
inline

Definition at line 90 of file sparseordensematrix.h.

References _densematrix.

Referenced by getSparseColumn(), and getSparseRow().

const DenseMatrixType aims::SparseOrDenseMatrix::denseMatrix ( ) const
inline

Definition at line 91 of file sparseordensematrix.h.

References _densematrix.

void aims::SparseOrDenseMatrix::erase_element ( int32_t  i,
int32_t  j 
)
std::vector<double> aims::SparseOrDenseMatrix::getColumn ( int32_t  j) const
int32_t aims::SparseOrDenseMatrix::getNonZeroElementCount ( ) const
std::vector<double> aims::SparseOrDenseMatrix::getRow ( int32_t  i) const
int32_t aims::SparseOrDenseMatrix::getSize1 ( ) const
int32_t aims::SparseOrDenseMatrix::getSize2 ( ) const
template<typename VectorType >
VectorType aims::SparseOrDenseMatrix::getSparseColumn ( int32_t  i) const
inline
template<typename VectorType >
VectorType aims::SparseOrDenseMatrix::getSparseRow ( int32_t  i) const
inline
bool aims::SparseOrDenseMatrix::hasElement ( int32_t  i,
int32_t  j 
) const
carto::Object aims::SparseOrDenseMatrix::header ( )
const carto::Object aims::SparseOrDenseMatrix::header ( ) const
bool aims::SparseOrDenseMatrix::isDense ( ) const
inline

Definition at line 86 of file sparseordensematrix.h.

References _densematrix, and carto::const_ref< T >::isNull().

Referenced by getSparseColumn(), and getSparseRow().

bool aims::SparseOrDenseMatrix::isOptimalShape ( ) const
void aims::SparseOrDenseMatrix::muteToDense ( )
void aims::SparseOrDenseMatrix::muteToOptimalShape ( )

mute to sparse or dense according to the less memory consuming

void aims::SparseOrDenseMatrix::muteToSparse ( )
double aims::SparseOrDenseMatrix::operator() ( int32_t  i,
int32_t  j 
) const
SparseOrDenseMatrix& aims::SparseOrDenseMatrix::operator*= ( double  x)
SparseOrDenseMatrix& aims::SparseOrDenseMatrix::operator+= ( const SparseOrDenseMatrix thing)
SparseOrDenseMatrix& aims::SparseOrDenseMatrix::operator-= ( const SparseOrDenseMatrix thing)
SparseOrDenseMatrix& aims::SparseOrDenseMatrix::operator/= ( double  x)
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

void aims::SparseOrDenseMatrix::read ( const std::string &  filename)
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)
void aims::SparseOrDenseMatrix::setMatrix ( SparseMatrixType  matrix)
void aims::SparseOrDenseMatrix::setMatrix ( DenseMatrixType  matrix)
void aims::SparseOrDenseMatrix::setRow ( int32_t  s1,
const std::vector< double > &  row 
)
SparseMatrixType aims::SparseOrDenseMatrix::sparseMatrix ( )
inline

Definition at line 88 of file sparseordensematrix.h.

References _sparsematrix.

Referenced by getSparseColumn(), and getSparseRow().

const SparseMatrixType aims::SparseOrDenseMatrix::sparseMatrix ( ) const
inline

Definition at line 89 of file sparseordensematrix.h.

References _sparsematrix.

void aims::SparseOrDenseMatrix::write ( const std::string &  filename,
carto::Object  options = carto::none() 
) const

Member Data Documentation

DenseMatrixType aims::SparseOrDenseMatrix::_densematrix
protected

Definition at line 124 of file sparseordensematrix.h.

Referenced by denseMatrix(), and isDense().

carto::Object aims::SparseOrDenseMatrix::_fakeheader
protected

Definition at line 125 of file sparseordensematrix.h.

SparseMatrixType aims::SparseOrDenseMatrix::_sparsematrix
protected

Definition at line 123 of file sparseordensematrix.h.

Referenced by sparseMatrix().


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