ArmadilloSolver
The GeMA Armadillo Numeric Solver Plugin
Loading...
Searching...
No Matches
GmpArmadilloMatrix Class Reference

A class for wrapping up an Armadillo sparse matrix sharing the memory with a GeMA sparse matrix. This setup is better than simply using
directly an Armadillo sparse matrix since creating a GeMA sparse matrix is far more efficient than creating an Armadillo one. More...

#include <gmpArmadilloMatrix.h>

Inheritance diagram for GmpArmadilloMatrix:
Collaboration diagram for GmpArmadilloMatrix:

Public Member Functions

 GmpArmadilloMatrix (int nlin, const GmpArmadilloMatrix *sharedLayout, GmSparseMatrixOptions options)
 Constructor for the square matrix used by the Armadillo solver. If sharedLayout is different from NULL, this matrix layout will be given by it.
 
virtual ~GmpArmadilloMatrix ()
 Destructor.
 
const arma::sp_mat & armaMat () const
 Returns the Armadillo matrix wrapped by this class.
 
virtual void clear (bool keepSparseLayout)
 
virtual void clearLineAndColumnSet (const QVector< int > &indexList, bool setDiagonal, bool keepSparseLayout)
 
virtual void ensureDiagonal ()
 
- Public Member Functions inherited from GmSparseMatrix< arma::uword, GM_CSC_SPARSE_FORMAT >
 GmSparseMatrix (int n, const GmSparseMatrix< IndexType, T > *sharedLayout, GmSparseMatrixOptions options, bool arma)
 
virtual bool supportsBatchInsert () const
 
virtual bool supportsSparseLayouts () const
 
virtual bool supportsRandomSet () const
 
virtual ParallelAddMode supportedParallelAddMode () const
 
virtual bool beginBatchInsert (size_t expectedEntries=0)
 
virtual bool endBatchInsert (bool discardData=false)
 
virtual GmSparseMatrixLayoutBuilderlayoutBuilder () const
 
virtual bool emptyLayout () const
 
virtual bool symmetric () const
 
virtual void setSymmetric (bool sym)
 
virtual bool isSymmetric (double relTol=GM_DOUBLECMP_RELTOL, double absTol=GM_DOUBLECMP_ABSTOL) const
 
virtual int nlin () const
 
virtual int ncol () const
 
virtual int layoutSize () const
 
virtual double at (int lin, int col) const
 
virtual bool inLayout (int lin, int col) const
 
virtual void set (int lin, int col, double value)
 
virtual void set (GmSolverMatrix *A, GmSolverMatrix *B, double c, bool sameStructure)
 
virtual void add (int lin, int col, double value)
 
virtual void matAdd (const GmVector &a, const GmVector &b, double zeroTol=0.0)
 
virtual void mul (const GmVector &a, GmVector &b) const
 
virtual void mulAdd (const GmVector &a, GmVector &b) const
 
virtual void mulSub (const GmVector &a, GmVector &b) const
 
virtual void columnMulAdd (int col, GmVector &f, double v, const bool *skipRows=NULL) const
 
virtual size_t usedMemory () const
 
virtual bool hasNanInf () const
 
virtual bool saveMatrixCoordinatesToFile (FILE *f) const
 
- Public Member Functions inherited from GmSolverMatrix
double operator() (int lin, int col) const
 
void print (const GmLogCategory &logger, GmLogLevel level, int fieldWidth=0, char format='g', int precision=-1) const
 

Protected Member Functions

virtual void matrixLayoutReady ()
 Allocates space for matrix values and build the Armadillo wrapper over matrix vectors.
 
virtual GmSparseMatrix< arma::uword, GM_CSC_SPARSE_FORMAT > * detachAndClear ()
 
- Protected Member Functions inherited from GmSparseMatrix< arma::uword, GM_CSC_SPARSE_FORMAT >
void addBatch (int lin, int col, double value)
 
void addToPtrIndexFromThread (int tid, int ptr, int index, double value)
 
GmSparseMatrixLayoutBuildercreateLayoutBuilder (GmSparseMatrixLayoutMode mode, GmCSxSparseMatrixLayout< IndexType, T > *layout)
 

Private Attributes

arma::sp_mat _armaMat
 An Armadillo matrix created sharing vectors with the base class memory.
 

Additional Inherited Members

- Public Types inherited from GmSolverMatrix
enum  ParallelAddMode
 
- Protected Attributes inherited from GmSparseMatrix< arma::uword, GM_CSC_SPARSE_FORMAT >
GmSparseMatrixOptions _opt
 
bool _batch
 
int _n
 
QAtomicInt _sym
 
double * _values
 
const GmCSxSparseMatrixLayout< IndexType, T > * _layout
 
GmCSxSparseMatrixLayout< IndexType, T > * _masterLayout
 
GmSparseMatrixLayoutBuilder_layoutBuilder
 
GmSparseMatrixTripletBuffer< T > * _batchData
 

Detailed Description

A class for wrapping up an Armadillo sparse matrix sharing the memory with a GeMA sparse matrix. This setup is better than simply using
directly an Armadillo sparse matrix since creating a GeMA sparse matrix is far more efficient than creating an Armadillo one.

Constructor & Destructor Documentation

◆ GmpArmadilloMatrix()

GmpArmadilloMatrix::GmpArmadilloMatrix ( int nlin,
const GmpArmadilloMatrix * sharedLayout,
GmSparseMatrixOptions options )

Constructor for the square matrix used by the Armadillo solver. If sharedLayout is different from NULL, this matrix layout will be given by it.

IMPORTANT: When sharing a layout with another matrix, this matrix will become invalid if the matrix owning the layout is destroyed.

Member Function Documentation

◆ clear()

void GmpArmadilloMatrix::clear ( bool keepSparseLayout)
virtual

◆ clearLineAndColumnSet()

void GmpArmadilloMatrix::clearLineAndColumnSet ( const QVector< int > & indexList,
bool setDiagonal,
bool keepSparseLayout )
virtual

◆ detachAndClear()

GmSparseMatrix< arma::uword, GM_CSC_SPARSE_FORMAT > * GmpArmadilloMatrix::detachAndClear ( )
protectedvirtual

◆ ensureDiagonal()

void GmpArmadilloMatrix::ensureDiagonal ( )
virtual

◆ matrixLayoutReady()

void GmpArmadilloMatrix::matrixLayoutReady ( )
protectedvirtual

Allocates space for matrix values and build the Armadillo wrapper over matrix vectors.

Reimplemented from GmSparseMatrix< arma::uword, GM_CSC_SPARSE_FORMAT >.


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