Geophysical Inversion and Modelling Library
v1.5.2-5-g042d7f36
|
Sparse matrix in compressed row storage (CRS) form. More...
Public Member Functions | |
SparseMatrix () | |
SparseMatrix (const SparseMatrix< ValueType > &S) | |
SparseMatrix (const SparseMapMatrix< ValueType, Index > &S) | |
SparseMatrix (const IndexArray &colPtr, const IndexArray &rowIdx, const Vector< ValueType > vals, int stype=0) | |
SparseMatrix (const std::vector< int > &colPtr, const std::vector< int > &rowIdx, const Vector< ValueType > vals, int stype=0) | |
virtual | ~SparseMatrix () |
SparseMatrix< ValueType > & | operator= (const SparseMatrix< ValueType > &S) |
SparseMatrix< ValueType > & | operator= (const SparseMapMatrix< ValueType, Index > &S) |
SparseMatrix< ValueType > & | operator+= (const SparseMatrix< ValueType > &A) |
SparseMatrix< ValueType > & | operator-= (const SparseMatrix< ValueType > &A) |
SparseMatrix< ValueType > & | operator+= (const ElementMatrix< double > &A) |
virtual uint | rtti () const |
virtual Vector< ValueType > | mult (const Vector< ValueType > &a) const |
virtual Vector< ValueType > | transMult (const Vector< ValueType > &a) const |
void | add (const ElementMatrix< double > &A) |
void | add (const ElementMatrix< double > &A, ValueType scale) |
void | add (const ElementMatrix< double > &A, const Pos &scale) |
void | add (const ElementMatrix< double > &A, const Matrix< ValueType > &scale) |
void | clean () |
void | clear () |
void | setVal (int i, int j, ValueType val) |
ValueType | getVal (int i, int j, bool warn=true) const |
void | cleanRow (int row) |
void | cleanCol (int col) |
void | copy_ (const SparseMapMatrix< double, Index > &S) |
void | copy_ (const SparseMapMatrix< Complex, Index > &S) |
void | buildSparsityPattern (const Mesh &mesh) |
void | fillStiffnessMatrix (const Mesh &mesh) |
void | fillStiffnessMatrix (const Mesh &mesh, const RVector &a) |
void | fillMassMatrix (const Mesh &mesh) |
void | fillMassMatrix (const Mesh &mesh, const RVector &a) |
int | stype () const |
int * | colPtr () |
const int & | colPtr () const |
const std::vector< int > & | vecColPtr () const |
int * | rowIdx () |
const int & | rowIdx () const |
const std::vector< int > & | vecRowIdx () const |
ValueType * | vals () |
const Vector< ValueType > & | vecVals () const |
Vector< ValueType > & | vecVals () |
Index | size () const |
Index | nVals () const |
Index | cols () const |
Index | rows () const |
Index | nCols () const |
Index | nRows () const |
void | save (const std::string &fileName) const |
bool | valid () const |
void | copy_ (const SparseMapMatrix< double, Index > &S) |
void | copy_ (const SparseMapMatrix< Complex, Index > &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 Matrix< double > &scale) |
void | add (const ElementMatrix< double > &A, Complex scale) |
void | add (const ElementMatrix< double > &A, const Pos &scale) |
void | add (const ElementMatrix< double > &A, const CMatrix &scale) |
DLLEXPORT void | copy_ (const SparseMapMatrix< double, Index > &S) |
DLLEXPORT void | copy_ (const SparseMapMatrix< Complex, Index > &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, Complex scale) |
DLLEXPORT void | add (const ElementMatrix< double > &A, const Pos &scale) |
DLLEXPORT void | add (const ElementMatrix< double > &A, const CMatrix &scale) |
![]() | |
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 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 |
Protected Attributes | |
std::vector< int > | colPtr_ |
std::vector< int > | rowIdx_ |
Vector< ValueType > | vals_ |
bool | valid_ |
int | stype_ |
Index | rows_ |
Index | cols_ |
![]() | |
bool | verbose_ |
Sparse matrix in compressed row storage (CRS) form.
Sparse matrix in compressed row storage (CRS) form. IF you need native CCS format you need to transpose CRS Symmetry type: 0 = nonsymmetric, -1 symmetric lower part, 1 symmetric upper part.
|
inline |
Default constructor. Builds invalid sparse matrix
|
inline |
Copy constructor.
References GIMLI::SparseMatrix< ValueType >::cols(), and GIMLI::SparseMatrix< ValueType >::rows().
|
inline |
Copy constructor.
References GIMLI::SparseMatrix< ValueType >::copy_().
|
inlinevirtual |
Destructor
|
inlinevirtual |
Fill Vector with 0.0. Don't change size.
Reimplemented from GIMLI::MatrixBase.
|
inlinevirtual |
Clear the data, set size to zero and frees memory.
Reimplemented from GIMLI::MatrixBase.
|
inlinevirtual |
Return number of colums
Reimplemented from GIMLI::MatrixBase.
Referenced by GIMLI::SparseMatrix< ValueType >::mult(), GIMLI::SparseMatrix< ValueType >::operator=(), GIMLI::SparseMatrix< ValueType >::SparseMatrix(), and GIMLI::SparseMatrix< ValueType >::transMult().
void GIMLI::SparseMatrix< ValueType >::copy_ | ( | const SparseMapMatrix< double, Index > & | S | ) |
SparseMatrix specialized type traits in sparsematrix.cpp
Referenced by GIMLI::SparseMatrix< ValueType >::SparseMatrix().
|
inline |
Get matrix value at i,j. If i and j is not part of the matrix sparsity pattern return 0 and print a warning. This warning can be disabled by setting warn to false.
|
inlinevirtual |
Return this * a
References GIMLI::SparseMatrix< ValueType >::cols(), and GIMLI::SparseMatrix< ValueType >::rows().
|
inline |
Copy assignment operator.
References GIMLI::SparseMatrix< ValueType >::cols(), GIMLI::SparseMatrix< ValueType >::rows(), and GIMLI::SparseMatrix< ValueType >::stype().
|
inlinevirtual |
Return number of cols
Reimplemented from GIMLI::MatrixBase.
Referenced by GIMLI::SparseMatrix< ValueType >::mult(), GIMLI::SparseMatrix< ValueType >::operator=(), GIMLI::SparseMatrix< ValueType >::SparseMatrix(), and GIMLI::SparseMatrix< ValueType >::transMult().
|
inlinevirtual |
Return entity rtti value.
Reimplemented from GIMLI::MatrixBase.
|
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.
|
inline |
symmetric type. 0 = nonsymmetric, -1 symmetric lower part, 1 symmetric upper part.
Referenced by GIMLI::SparseMatrix< ValueType >::operator=().
|
inlinevirtual |
Return this.T * a
References GIMLI::SparseMatrix< ValueType >::cols(), and GIMLI::SparseMatrix< ValueType >::rows().