Geophysical Inversion and Modelling Library  v1.5.2-5-g042d7f36
GIMLI::BlockMatrix< ValueType > Class Template Reference
+ Inheritance diagram for GIMLI::BlockMatrix< ValueType >:
+ Collaboration diagram for GIMLI::BlockMatrix< ValueType >:

Public Member Functions

 BlockMatrix (bool verbose=false)
 
virtual uint rtti () const
 
virtual const Vector< ValueType > operator[] (Index r) const
 
virtual Index rows () const
 
virtual Index cols () const
 
virtual const Vector< ValueType > row (Index r) const
 
virtual const Vector< ValueType > col (Index r) const
 
virtual void clear ()
 
virtual void clean ()
 
MatrixBasemat (Index idx)
 
MatrixBasematRef (Index idx) const
 
std::vector< BlockMatrixEntryentries () const
 
Index add (MatrixBase *matrix, Index rowStart, Index colStart)
 
Index addMatrix (MatrixBase *matrix)
 
Index addMatrix (MatrixBase *matrix, Index rowStart, Index colStart, ValueType scale=1.0)
 
void addMatrixEntry (Index matrixID, Index rowStart, Index colStart)
 
void addMatrixEntry (Index matrixID, Index rowStart, Index colStart, ValueType scale, bool transpose=false)
 
void recalcMatrixSize () const
 
virtual Vector< ValueType > mult (const Vector< ValueType > &b) const
 
virtual Vector< ValueType > transMult (const Vector< ValueType > &b) const
 
RSparseMapMatrix sparseMapMatrix () const
 
virtual void save (const std::string &filename) const
 
Vector< double > mult (const Vector< double > &b) const
 
Vector< double > transMult (const Vector< double > &b) const
 
RSparseMapMatrix sparseMapMatrix () const
 
DLLEXPORT RVector mult (const RVector &b) const
 
DLLEXPORT RVector transMult (const RVector &b) const
 
DLLEXPORT RSparseMapMatrix sparseMapMatrix () const
 
- Public Member Functions inherited from GIMLI::MatrixBase
 MatrixBase (bool verbose=false)
 
virtual ~MatrixBase ()
 
void setVerbose (bool verbose)
 
bool verbose () const
 
Index size () const
 
virtual void resize (Index rows, Index cols)
 
virtual RVector dot (const RVector &a) const
 
virtual CVector mult (const CVector &a) const
 
virtual RVector mult (const RVector &b, Index startI, Index endI) const
 
virtual CVector mult (const CVector &b, Index startI, Index endI) const
 
virtual CVector transMult (const CVector &a) const
 

Protected Attributes

std::vector< MatrixBase * > matrices_
 
std::vector< BlockMatrixEntryentries_
 
- Protected Attributes inherited from GIMLI::MatrixBase
bool verbose_
 

Member Function Documentation

◆ add()

template<class ValueType >
Index GIMLI::BlockMatrix< ValueType >::add ( MatrixBase matrix,
Index  rowStart,
Index  colStart 
)
inline

Syntaxtic sugar for addMatrix

◆ addMatrix() [1/2]

template<class ValueType >
Index GIMLI::BlockMatrix< ValueType >::addMatrix ( MatrixBase matrix)
inline

Add an existing matrix to this block matrix and return a unique index. The Matrix will not be used until the matrix index has been assigned to a row and column number by adding a matrix entry.

◆ addMatrix() [2/2]

template<class ValueType >
Index GIMLI::BlockMatrix< ValueType >::addMatrix ( MatrixBase matrix,
Index  rowStart,
Index  colStart,
ValueType  scale = 1.0 
)
inline

Shortcut for addMatrix and addMatrixEntry.

◆ addMatrixEntry() [1/2]

template<class ValueType >
void GIMLI::BlockMatrix< ValueType >::addMatrixEntry ( Index  matrixID,
Index  rowStart,
Index  colStart 
)
inline

Shortcut for addMatrixEntry(matrixID, rowStart, colStart, 1.0).

◆ addMatrixEntry() [2/2]

template<class ValueType >
void GIMLI::BlockMatrix< ValueType >::addMatrixEntry ( Index  matrixID,
Index  rowStart,
Index  colStart,
ValueType  scale,
bool  transpose = false 
)
inline

Set a entry to this block matrix with the matrix index matrixID.

◆ clean()

template<class ValueType >
virtual void GIMLI::BlockMatrix< ValueType >::clean ( )
inlinevirtual

Fill Vector with 0.0. Don't change size.

Reimplemented from GIMLI::MatrixBase.

◆ clear()

template<class ValueType >
virtual void GIMLI::BlockMatrix< ValueType >::clear ( )
inlinevirtual

Clear the data, set size to zero and frees memory.

Reimplemented from GIMLI::MatrixBase.

References GIMLI::Vector< ValueType >::clear().

◆ cols()

template<class ValueType >
virtual Index GIMLI::BlockMatrix< ValueType >::cols ( ) const
inlinevirtual

Return number of colums

Reimplemented from GIMLI::MatrixBase.

◆ mult() [1/2]

DLLEXPORT RVector GIMLI::BlockMatrix< double >::mult ( const RVector a) const
virtual

Return this * a

Reimplemented from GIMLI::MatrixBase.

◆ mult() [2/2]

Vector< double > GIMLI::BlockMatrix< double >::mult ( const Vector< double > &  a) const
virtual

◆ rows()

template<class ValueType >
virtual Index GIMLI::BlockMatrix< ValueType >::rows ( ) const
inlinevirtual

Return number of cols

Reimplemented from GIMLI::MatrixBase.

◆ rtti()

template<class ValueType >
virtual uint GIMLI::BlockMatrix< ValueType >::rtti ( ) const
inlinevirtual

Return entity rtti value.

Reimplemented from GIMLI::MatrixBase.

◆ save()

template<class ValueType >
virtual void GIMLI::BlockMatrix< ValueType >::save ( const std::string &  filename) const
inlinevirtual

Brute force column separation fallback .. should be overwriten if you need performance for your onw matrix type.

Brute force row separation fallback .. should be overwriten if you need performance for your onw matrix type. ‍/ template< class ValueType > const Vector < ValueType > row(Index r) const{ __M ASSERT_RANGE(r, 0, rows()) Vector < ValueType > b(rows(), 0.0); b[r] = 1.0; return this->transMult(b); } these template function above will not work until MatrixBase is a non template function /! Brute force column separation fallback .. should be overwriten if you need performance for your onw matrix type.

Brute force row separation fallback .. should be overwriten if you need performance for your onw matrix type. *‍/ virtual const RVector row(Index r) const { __M ASSERT_RANGE(r, 0, rows()) RVector b(rows(), 0.0); b[r] = 1.0; return this->transMult(b); }

/*! Save this matrix into the file filename given. 

Reimplemented from GIMLI::MatrixBase.

◆ transMult() [1/2]

DLLEXPORT RVector GIMLI::BlockMatrix< double >::transMult ( const RVector a) const
virtual

Return this.T * a

Reimplemented from GIMLI::MatrixBase.

◆ transMult() [2/2]

Vector< double > GIMLI::BlockMatrix< double >::transMult ( const Vector< double > &  a) const
virtual