aimsdata  4.7.0
Neuroimaging data handling
aims::SparseMatrix Class Reference

#include <aims/sparsematrix/sparseMatrix.h>

Inheritance diagram for aims::SparseMatrix:
Collaboration diagram for aims::SparseMatrix:

Public Types

typedef boost_sparse_matrix::reference reference
 
typedef boost_sparse_matrix::const_reference const_reference
 
typedef boost_sparse_matrix::iterator1 iterator1
 
typedef boost_sparse_matrix::iterator2 iterator2
 
typedef boost_sparse_matrix::const_iterator1 const_iterator1
 
typedef boost_sparse_matrix::const_iterator2 const_iterator2
 
- Public Types inherited from carto::RCObject
typedef int RefCounterType
 

Public Member Functions

 SparseMatrix (int32_t size1=1, int32_t size2=1)
 
 SparseMatrix (const SparseMatrix &other)
 
virtual ~SparseMatrix ()
 
SparseMatrixoperator= (const SparseMatrix &other)
 
void reallocate (int32_t size1, int32_t size2)
 
iterator1 begin1 ()
 
iterator1 end1 ()
 
const_iterator1 begin1 () const
 
const_iterator1 end1 () const
 
iterator2 begin2 ()
 
iterator2 end2 ()
 
const_iterator2 begin2 () const
 
const_iterator2 end2 () const
 
int32_t getSize1 () const
 
int32_t getSize2 () const
 
int32_t getNonZeroElementCount () const
 
bool hasElement (int32_t i, int32_t j) const
 
const_reference operator() (int32_t i, int32_t j) const
 
reference operator() (int32_t i, int32_t j)
 
bool isSquare () const
 
void setZero ()
 
void setIdentity ()
 
void setRow (int32_t s1, const std::vector< double > &row)
 
void setColumn (int32_t s2, const std::vector< double > &column)
 
void fill (const double &value)
 
void fill (int32_t offset1, int32_t offset2, int32_t size1, int32_t size2, const double &value)
 
void fill (int32_t offset1, int32_t offset2, const SparseMatrix &other, int32_t size1=0, int32_t size2=0)
 
void setDiagonal (const double &value)
 
void transpose ()
 
double getTrace () const
 
SparseMatrix getTransposition () const
 
SparseMatrix getComposition (const SparseMatrix &other) const
 
std::vector< double > getComposition (const std::vector< double > &other) const
 
std::vector< double > toVector () const
 
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 erase_element (int32_t i, int32_t j)
 
void read (const std::string &filename, const std::string &openmode="binar", bool bswap=false)
 Avoid using this function, prefer the more standard Reader<SparseMatrix> instead. More...
 
void write (const std::string &filename, const std::string &openmode="binar", bool bswap=false) const
 Avoid using this function, prefer the more standard Writer<SparseMatrix> instead. More...
 
aims::SparseMatrixoperator+= (const aims::SparseMatrix &thing)
 
aims::SparseMatrixoperator-= (const aims::SparseMatrix &thing)
 
aims::SparseMatrixoperator*= (double x)
 
aims::SparseMatrixoperator/= (double x)
 
boost_sparse_matrixboostMatrix ()
 for low-level boost operations More...
 
const boost_sparse_matrixboostMatrix () const
 
carto::Object header ()
 
const carto::Object header () const
 
void setHeader (carto::Object ph)
 
- Public Member Functions inherited from carto::RCObject
 RCObject ()
 
 RCObject (const RCObject &)
 
RCObjectoperator= (const RCObject &)
 
virtual ~RCObject ()
 

Protected Attributes

boost_sparse_matrix _matrix
 
carto::Object _header
 

Detailed Description

Definition at line 57 of file sparseMatrix.h.

Member Typedef Documentation

◆ const_iterator1

typedef boost_sparse_matrix::const_iterator1 aims::SparseMatrix::const_iterator1

Definition at line 71 of file sparseMatrix.h.

◆ const_iterator2

typedef boost_sparse_matrix::const_iterator2 aims::SparseMatrix::const_iterator2

Definition at line 73 of file sparseMatrix.h.

◆ const_reference

typedef boost_sparse_matrix::const_reference aims::SparseMatrix::const_reference

Definition at line 65 of file sparseMatrix.h.

◆ iterator1

typedef boost_sparse_matrix::iterator1 aims::SparseMatrix::iterator1

Definition at line 67 of file sparseMatrix.h.

◆ iterator2

typedef boost_sparse_matrix::iterator2 aims::SparseMatrix::iterator2

Definition at line 68 of file sparseMatrix.h.

◆ reference

typedef boost_sparse_matrix::reference aims::SparseMatrix::reference

Definition at line 63 of file sparseMatrix.h.

Constructor & Destructor Documentation

◆ SparseMatrix() [1/2]

aims::SparseMatrix::SparseMatrix ( int32_t  size1 = 1,
int32_t  size2 = 1 
)

◆ SparseMatrix() [2/2]

aims::SparseMatrix::SparseMatrix ( const SparseMatrix other)

◆ ~SparseMatrix()

virtual aims::SparseMatrix::~SparseMatrix ( )
virtual

Member Function Documentation

◆ begin1() [1/2]

iterator1 aims::SparseMatrix::begin1 ( )

◆ begin1() [2/2]

const_iterator1 aims::SparseMatrix::begin1 ( ) const

◆ begin2() [1/2]

iterator2 aims::SparseMatrix::begin2 ( )

◆ begin2() [2/2]

const_iterator2 aims::SparseMatrix::begin2 ( ) const

◆ boostMatrix() [1/2]

boost_sparse_matrix& aims::SparseMatrix::boostMatrix ( )
inline

for low-level boost operations

Definition at line 162 of file sparseMatrix.h.

References _matrix.

◆ boostMatrix() [2/2]

const boost_sparse_matrix& aims::SparseMatrix::boostMatrix ( ) const
inline

Definition at line 163 of file sparseMatrix.h.

References _matrix.

◆ end1() [1/2]

iterator1 aims::SparseMatrix::end1 ( )

◆ end1() [2/2]

const_iterator1 aims::SparseMatrix::end1 ( ) const

◆ end2() [1/2]

iterator2 aims::SparseMatrix::end2 ( )

◆ end2() [2/2]

const_iterator2 aims::SparseMatrix::end2 ( ) const

◆ erase_element()

void aims::SparseMatrix::erase_element ( int32_t  i,
int32_t  j 
)

◆ fill() [1/3]

void aims::SparseMatrix::fill ( const double &  value)

◆ fill() [2/3]

void aims::SparseMatrix::fill ( int32_t  offset1,
int32_t  offset2,
int32_t  size1,
int32_t  size2,
const double &  value 
)

◆ fill() [3/3]

void aims::SparseMatrix::fill ( int32_t  offset1,
int32_t  offset2,
const SparseMatrix other,
int32_t  size1 = 0,
int32_t  size2 = 0 
)

◆ getColumn()

std::vector<double> aims::SparseMatrix::getColumn ( int32_t  j) const

◆ getComposition() [1/2]

SparseMatrix aims::SparseMatrix::getComposition ( const SparseMatrix other) const

◆ getComposition() [2/2]

std::vector<double> aims::SparseMatrix::getComposition ( const std::vector< double > &  other) const

◆ getNonZeroElementCount()

int32_t aims::SparseMatrix::getNonZeroElementCount ( ) const

◆ getRow()

std::vector<double> aims::SparseMatrix::getRow ( int32_t  i) const

◆ getSize1()

int32_t aims::SparseMatrix::getSize1 ( ) const

Referenced by getSparseColumn().

◆ getSize2()

int32_t aims::SparseMatrix::getSize2 ( ) const

Referenced by getSparseRow().

◆ getSparseColumn()

template<typename VectorType >
VectorType aims::SparseMatrix::getSparseColumn ( int32_t  i) const
inline

◆ getSparseRow()

template<typename VectorType >
VectorType aims::SparseMatrix::getSparseRow ( int32_t  i) const
inline

Definition at line 179 of file sparseMatrix.h.

References _matrix, and getSize2().

◆ getTrace()

double aims::SparseMatrix::getTrace ( ) const

◆ getTransposition()

SparseMatrix aims::SparseMatrix::getTransposition ( ) const

◆ hasElement()

bool aims::SparseMatrix::hasElement ( int32_t  i,
int32_t  j 
) const

◆ header() [1/2]

carto::Object aims::SparseMatrix::header ( )
inline

Definition at line 165 of file sparseMatrix.h.

References _header.

◆ header() [2/2]

const carto::Object aims::SparseMatrix::header ( ) const
inline

Definition at line 166 of file sparseMatrix.h.

References _header, and setHeader().

◆ isSquare()

bool aims::SparseMatrix::isSquare ( ) const

◆ operator()() [1/2]

const_reference aims::SparseMatrix::operator() ( int32_t  i,
int32_t  j 
) const

◆ operator()() [2/2]

reference aims::SparseMatrix::operator() ( int32_t  i,
int32_t  j 
)

◆ operator*=()

aims::SparseMatrix& aims::SparseMatrix::operator*= ( double  x)

◆ operator+=()

aims::SparseMatrix& aims::SparseMatrix::operator+= ( const aims::SparseMatrix thing)

◆ operator-=()

aims::SparseMatrix& aims::SparseMatrix::operator-= ( const aims::SparseMatrix thing)

◆ operator/=()

aims::SparseMatrix& aims::SparseMatrix::operator/= ( double  x)

◆ operator=()

SparseMatrix& aims::SparseMatrix::operator= ( const SparseMatrix other)

◆ read()

void aims::SparseMatrix::read ( const std::string &  filename,
const std::string &  openmode = "binar",
bool  bswap = false 
)

Avoid using this function, prefer the more standard Reader<SparseMatrix> instead.

◆ reallocate()

void aims::SparseMatrix::reallocate ( int32_t  size1,
int32_t  size2 
)

◆ setColumn()

void aims::SparseMatrix::setColumn ( int32_t  s2,
const std::vector< double > &  column 
)

◆ setDiagonal()

void aims::SparseMatrix::setDiagonal ( const double &  value)

◆ setHeader()

void aims::SparseMatrix::setHeader ( carto::Object  ph)

Referenced by header().

◆ setIdentity()

void aims::SparseMatrix::setIdentity ( )

◆ setRow()

void aims::SparseMatrix::setRow ( int32_t  s1,
const std::vector< double > &  row 
)

◆ setZero()

void aims::SparseMatrix::setZero ( )

◆ toVector()

std::vector<double> aims::SparseMatrix::toVector ( ) const

◆ transpose()

void aims::SparseMatrix::transpose ( )

◆ write()

void aims::SparseMatrix::write ( const std::string &  filename,
const std::string &  openmode = "binar",
bool  bswap = false 
) const

Avoid using this function, prefer the more standard Writer<SparseMatrix> instead.

Member Data Documentation

◆ _header

carto::Object aims::SparseMatrix::_header
protected

Definition at line 172 of file sparseMatrix.h.

Referenced by header().

◆ _matrix

boost_sparse_matrix aims::SparseMatrix::_matrix
protected

Definition at line 171 of file sparseMatrix.h.

Referenced by boostMatrix(), and getSparseRow().


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