Geophysical Inversion and Modelling Library  v1.3.0-2-gcf7079e5
GIMLI::SparseMapMatrix< ValueType, IndexType > Class Template Reference

based on: Ulrich Breymann, Addison Wesley Longman 2000 , revised edition ISBN 0-201-67488-2, Designing Components with the C++ STL More...

Classes

class  Aux
 

Public Types

typedef std::pair< IndexType, IndexType > IndexPair
 
typedef std::map< IndexPair, ValueType, std::less< IndexPair > > ContainerType
 
typedef ContainerType::iterator iterator
 
typedef ContainerType::const_iterator const_iterator
 
typedef MatrixElement< ValueType, IndexType, ContainerType > MatElement
 

Public Member Functions

 SparseMapMatrix (IndexType r=0, IndexType c=0, int stype=0)
 
 SparseMapMatrix (const std::string &filename)
 
 SparseMapMatrix (const SparseMapMatrix< ValueType, IndexType > &S)
 
 SparseMapMatrix (const SparseMatrix< ValueType > &S)
 
 SparseMapMatrix (const IndexArray &i, const IndexArray &j, const RVector &v)
 
SparseMapMatrix< ValueType, IndexType > & operator= (const SparseMapMatrix< ValueType, IndexType > &S)
 
SparseMapMatrixoperator= (const SparseMatrix< ValueType > &S)
 
virtual uint rtti () const
 
void resize (Index rows, Index cols)
 
void copy_ (const SparseMatrix< double > &S)
 
void copy_ (const SparseMatrix< Complex > &S)
 
void add (const IndexArray &rows, const IndexArray &cols, const RVector &vals)
 
virtual void clear ()
 
void cleanRow (IndexType row)
 
void cleanCol (IndexType col)
 
int stype () const
 
void setRows (IndexType r)
 
virtual IndexType rows () const
 
virtual IndexType nRows () const
 
void setCols (IndexType c)
 
virtual IndexType cols () const
 
virtual IndexType nCols () const
 
IndexType size () const
 
IndexType max_size () const
 
IndexType nVals () const
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
void add (const ElementMatrix< double > &A, ValueType scale=1.0)
 
void add (const ElementMatrix< double > &A, const Pos &scale)
 
void add (const ElementMatrix< double > &A, const Matrix< ValueType > &scale)
 
void add (const ElementMatrix< double > &A, const Vector< ValueType > &scale)
 
void addToCol (Index id, const ElementMatrix< double > &A, ValueType scale=1.0, bool isDiag=false)
 
void addToRow (Index id, const ElementMatrix< double > &A, ValueType scale=1.0, bool isDiag=false)
 
SparseMapMatrix< ValueType, IndexType > & operator+= (const SparseMapMatrix< ValueType, IndexType > &A)
 
SparseMapMatrix< ValueType, IndexType > & operator-= (const SparseMapMatrix< ValueType, IndexType > &A)
 
void operator+= (const ElementMatrix< double > &A)
 
Aux operator[] (IndexType r)
 
IndexType idx1 (const const_iterator &I) const
 
IndexType idx2 (const const_iterator &I) const
 
const ValueType & val (const const_iterator &I) const
 
ValueType & val (const iterator &I)
 
Vector< ValueType > values () const
 
ValueType getVal (IndexType i, IndexType j)
 
void setVal (IndexType i, IndexType j, const ValueType &val)
 
void addVal (IndexType i, IndexType j, const ValueType &val)
 
virtual Vector< ValueType > mult (const Vector< ValueType > &a) const
 
virtual Vector< ValueType > transMult (const Vector< ValueType > &a) const
 
virtual Vector< ValueType > col (const Index i)
 
virtual Vector< ValueType > row (const Index i)
 
void save (const std::string &filename) const
 
void load (const std::string &filename)
 
void importCol (const std::string &filename, double dropTol, Index colOffset)
 
void importCol (const std::string &filename, double dropTol=1e-3)
 
void fillArrays (Vector< ValueType > &vals, IndexArray &rows, IndexArray &cols)
 
void copy_ (const SparseMatrix< double > &S)
 
void add (const ElementMatrix< double > &A, double scale)
 
void add (const ElementMatrix< double > &A, const Pos &scale)
 
void add (const ElementMatrix< double > &A, const RMatrix &scale)
 
void add (const ElementMatrix< double > &A, const Vector< double > &scale)
 
void add (const ElementMatrix< double > &A, Complex scale)
 
void add (const ElementMatrix< double > &A, const Vector< Complex > &scale)
 
void add (const ElementMatrix< double > &A, const CMatrix &scale)
 
void add (const ElementMatrix< double > &A, const Pos &scale)
 
void addToCol (Index id, const ElementMatrix< double > &A, double scale, bool isDiag)
 
void addToRow (Index id, const ElementMatrix< double > &A, double scale, bool isDiag)
 
void addToCol (Index id, const ElementMatrix< double > &A, Complex scale, bool isDiag)
 
void addToRow (Index id, const ElementMatrix< double > &A, Complex scale, bool isDiag)
 
DLLEXPORT void copy_ (const SparseMatrix< double > &S)
 
DLLEXPORT void add (const ElementMatrix< double > &A, double scale)
 
DLLEXPORT void add (const ElementMatrix< double > &A, const Pos &scale)
 
DLLEXPORT void add (const ElementMatrix< double > &A, const RMatrix &scale)
 
DLLEXPORT void add (const ElementMatrix< double > &A, const Vector< double > &scale)
 
DLLEXPORT void add (const ElementMatrix< double > &A, Complex scale)
 
DLLEXPORT void add (const ElementMatrix< double > &A, const Pos &scale)
 
DLLEXPORT void add (const ElementMatrix< double > &A, const Matrix< Complex > &scale)
 
DLLEXPORT void add (const ElementMatrix< double > &A, const Vector< Complex > &scale)
 
DLLEXPORT void addToCol (Index id, const ElementMatrix< double > &A, double scale, bool isDiag)
 
DLLEXPORT void addToRow (Index id, const ElementMatrix< double > &A, double scale, bool isDiag)
 
DLLEXPORT void addToCol (Index id, const ElementMatrix< double > &A, Complex scale, bool isDiag)
 
DLLEXPORT void addToRow (Index id, const ElementMatrix< double > &A, Complex scale, bool isDiag)
 

Protected Attributes

IndexType rows_
 
IndexType cols_
 
ContainerType C_
 
int stype_
 

Detailed Description

template<class ValueType, class IndexType>
class GIMLI::SparseMapMatrix< ValueType, IndexType >

based on: Ulrich Breymann, Addison Wesley Longman 2000 , revised edition ISBN 0-201-67488-2, Designing Components with the C++ STL

Constructor & Destructor Documentation

◆ SparseMapMatrix() [1/2]

template<class ValueType , class IndexType >
GIMLI::SparseMapMatrix< ValueType, IndexType >::SparseMapMatrix ( IndexType  r = 0,
IndexType  c = 0,
int  stype = 0 
)
inline

stype .. symmetric style. stype=0 (full), stype=1 (UpperRight), stype=2 (LowerLeft)

◆ SparseMapMatrix() [2/2]

template<class ValueType , class IndexType >
GIMLI::SparseMapMatrix< ValueType, IndexType >::SparseMapMatrix ( const IndexArray i,
const IndexArray j,
const RVector v 
)
inline

Contruct Map Matrix from 3 arrays of the same length. Number of colums are max(j)+1 and Number of rows are max(i)+1.

Member Function Documentation

◆ add() [1/3]

template<class ValueType , class IndexType >
void GIMLI::SparseMapMatrix< ValueType, IndexType >::add ( const ElementMatrix< double > &  A,
const Vector< ValueType > &  scale 
)

Scale with values from vector scale. Take values from scale[A.ids()].

◆ add() [2/3]

template<class ValueType , class IndexType >
void GIMLI::SparseMapMatrix< ValueType, IndexType >::add ( const ElementMatrix< double > &  A,
ValueType  scale = 1.0 
)

Scale with scale

◆ add() [3/3]

template<class ValueType , class IndexType >
void GIMLI::SparseMapMatrix< ValueType, IndexType >::add ( const IndexArray rows,
const IndexArray cols,
const RVector vals 
)
inline

Add this values to the matrix.

◆ copy_()

DLLEXPORT void GIMLI::SparseMapMatrix< double, Index >::copy_ ( const SparseMatrix< double > &  S)

SparseMapMatrix specialized type traits in sparsematrix.cpp

◆ fillArrays()

template<class ValueType , class IndexType >
void GIMLI::SparseMapMatrix< ValueType, IndexType >::fillArrays ( Vector< ValueType > &  vals,
IndexArray rows,
IndexArray cols 
)
inline

Fill existing arrays with values, row and column indieces of this SparseMapMatrix

◆ importCol()

template<class ValueType , class IndexType >
void GIMLI::SparseMapMatrix< ValueType, IndexType >::importCol ( const std::string &  filename,
double  dropTol,
Index  colOffset 
)
inline

Import columnwise from bmat starting at offset

◆ mult()

template<class ValueType , class IndexType >
virtual Vector< ValueType > GIMLI::SparseMapMatrix< ValueType, IndexType >::mult ( const Vector< ValueType > &  a) const
inlinevirtual

◆ rtti()

template<class ValueType , class IndexType >
virtual uint GIMLI::SparseMapMatrix< ValueType, IndexType >::rtti ( ) const
inlinevirtual

Return entity rtti value.

◆ stype()

template<class ValueType , class IndexType >
int GIMLI::SparseMapMatrix< ValueType, IndexType >::stype ( ) const
inline

symmetric type. 0 = nonsymmetric, -1 symmetric lower part, 1 symmetric upper part.

Referenced by GIMLI::SparseMatrix< ValueType >::SparseMatrix().

◆ transMult()

template<class ValueType , class IndexType >
virtual Vector< ValueType > GIMLI::SparseMapMatrix< ValueType, IndexType >::transMult ( const Vector< ValueType > &  a) const
inlinevirtual

Return SparseMapMatrix: this.T * a