Geophysical Inversion and Modelling Library  v1.5.0
GIMLI::MatrixBase Class Reference

Interface class for matrices. More...

Inherited by GIMLI::Matrix< double >, GIMLI::SparseMapMatrix< double, Index >, GIMLI::BlockMatrix< ValueType >, GIMLI::D2Matrix< Matrix1, Matrix2 >, GIMLI::DNMatrix< Matrix >, GIMLI::DRMatrix< Matrix >, GIMLI::H2SparseMapMatrix, GIMLI::HNMatrix< Matrix >, GIMLI::HRMatrix< Matrix >, GIMLI::IdentityMatrix, GIMLI::Matrix< ValueType >, GIMLI::SparseMapMatrix< ValueType, IndexType >, GIMLI::SparseMatrix< ValueType >, GIMLI::V2Matrix< Matrix1, Matrix2 >, GIMLI::VNMatrix< Matrix >, and GIMLI::VRMatrix< Matrix >.

Public Member Functions

 MatrixBase (bool verbose=false)
 
virtual ~MatrixBase ()
 
virtual uint rtti () const
 
void setVerbose (bool verbose)
 
bool verbose () const
 
Index size () const
 
virtual Index rows () const
 
virtual Index cols () const
 
virtual void resize (Index rows, Index cols)
 
virtual void clean ()
 
virtual void clear ()
 
virtual RVector dot (const RVector &a) const
 
virtual RVector mult (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 RVector transMult (const RVector &a) const
 
virtual CVector transMult (const CVector &a) const
 
virtual void save (const std::string &filename) const
 

Protected Attributes

bool verbose_
 

Detailed Description

Interface class for matrices.

Pure virtual interface class for matrices. If you want your own Jacobian matrix to be used in Inversion or ModellingBase you have to derive your matrix from this class and implement all necessary members.

Constructor & Destructor Documentation

◆ MatrixBase()

GIMLI::MatrixBase::MatrixBase ( bool  verbose = false)
inline

Default constructor.

◆ ~MatrixBase()

virtual GIMLI::MatrixBase::~MatrixBase ( )
inlinevirtual

Default destructor.

Member Function Documentation

◆ clean()

virtual void GIMLI::MatrixBase::clean ( )
inlinevirtual

◆ clear()

◆ cols()

◆ dot()

virtual RVector GIMLI::MatrixBase::dot ( const RVector a) const
inlinevirtual

Return this * a. For being numpy api-compatible

◆ mult() [1/2]

virtual CVector GIMLI::MatrixBase::mult ( const CVector a) const
inlinevirtual

Return this * a

◆ mult() [2/2]

◆ resize()

virtual void GIMLI::MatrixBase::resize ( Index  rows,
Index  cols 
)
inlinevirtual

◆ rows()

◆ rtti()

◆ save()

virtual void GIMLI::MatrixBase::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 in GIMLI::SparseMatrix< ValueType >, GIMLI::SparseMapMatrix< ValueType, IndexType >, GIMLI::SparseMapMatrix< double, Index >, GIMLI::Matrix< ValueType >, GIMLI::Matrix< double >, and GIMLI::BlockMatrix< ValueType >.

◆ size()

Index GIMLI::MatrixBase::size ( ) const
inline

Return number of rows

Referenced by GIMLI::interpolate(), and GIMLI::DataMap::save().

◆ transMult() [1/2]

virtual CVector GIMLI::MatrixBase::transMult ( const CVector a) const
inlinevirtual

Return this.T * a

◆ transMult() [2/2]