Feellgood
Classes | Public Member Functions | Private Attributes | List of all members
algebra::r_sparseMat Class Reference

Read-mode square sparse matrix. More...

#include <sparseMat.h>

Classes

struct  SparseVector
 

Public Member Functions

 r_sparseMat (const w_sparseMat &source)
 
 r_sparseMat (const MatrixShape &shape)
 
void clear ()
 
void add (int i, int j, double val)
 
void print (std::ostream &flux=std::cout) const
 
double operator() (const int i, const int j) const
 
template<typename T >
void mult (std::vector< T > const &X, std::vector< T > &Y)
 
template<typename T >
void build_diag_precond (std::vector< T > &D) const
 

Private Attributes

std::vector< SparseVectorrows
 

Detailed Description

Read-mode square sparse matrix.

This is the main sparse matrix class, meant for efficiently computing matrix-vector products.

Constructor & Destructor Documentation

◆ r_sparseMat() [1/2]

algebra::r_sparseMat::r_sparseMat ( const w_sparseMat source)
inline

Construct from a read-mode sparse matrix.

◆ r_sparseMat() [2/2]

algebra::r_sparseMat::r_sparseMat ( const MatrixShape shape)
inline

Construct from a matrix shape. Initialize all stored values to zero.

Member Function Documentation

◆ add()

void algebra::r_sparseMat::add ( int  i,
int  j,
double  val 
)
inline

Add the provided value at position (i, j), which must belong to the shape. This method is thread-safe.

◆ build_diag_precond()

template<typename T >
void algebra::r_sparseMat::build_diag_precond ( std::vector< T > &  D) const
inline

Build a diagonal preconditioner D from this matrix.

◆ clear()

void algebra::r_sparseMat::clear ( )
inline

Zero-out all elements, while preserving the shape.

◆ mult()

template<typename T >
void algebra::r_sparseMat::mult ( std::vector< T > const &  X,
std::vector< T > &  Y 
)
inline

Y = this*X

◆ operator()()

double algebra::r_sparseMat::operator() ( const int  i,
const int  j 
) const
inline

Return the value at position (i, j).

◆ print()

void algebra::r_sparseMat::print ( std::ostream &  flux = std::cout) const
inline

Print to the provided stream.

Member Data Documentation

◆ rows

std::vector<SparseVector> algebra::r_sparseMat::rows
private

Container for the matrix rows. Since SparseVector is not movable, this container cannot be resized.


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