SOFA API  6dc60b15
Open source framework for multi-physics simuation
sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex > Class Template Reference

#include <CompressedRowSparseMatrix.h>

Inheritance diagram for sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >:

Classes

struct  IndexedBloc
 
class  Range
 

Public Attributes

Index nRow
 
Index nCol
 Mathematical size of the matrix, in scalars. More...
 
Index nBlocRow
 
Index nBlocCol
 Mathematical size of the matrix, in blocks. More...
 
VecIndex rowIndex
 indices of non-empty block rows More...
 
VecIndex rowBegin
 column indices of non-empty blocks in each row. The column indices of the non-empty block within the i-th non-empty row are all the colsIndex[j], j in [rowBegin[i],rowBegin[i+1]) More...
 
VecIndex colsIndex
 column indices of all the non-empty blocks, sorted by increasing row index and column index More...
 
VecBloc colsValue
 values of the non-empty blocks, in the same order as in colsIndex More...
 
VecIndexedBloc btemp
 unsorted blocks and their indices More...
 
bool compressed
 true if the additional storage is empty or has been transfered to the compressed data structure More...
 
VecIndex oldRowIndex
 
VecIndex oldRowBegin
 
VecIndex oldColsIndex
 
VecBloc oldColsValue
 

Public Member Functions

 CompressedRowSparseMatrix ()
 
 CompressedRowSparseMatrix (Index nbRow, Index nbCol)
 
 ~CompressedRowSparseMatrix () override
 
Index rowBSize () const
 
Index colBSize () const
 
const VecIndexgetRowIndex () const
 
const VecIndexgetRowBegin () const
 
Range getRowRange (Index id) const
 
const VecIndexgetColsIndex () const
 
const VecBlocgetColsValue () const
 
void resizeBloc (Index nbBRow, Index nbBCol)
 
void compress () override
 
void swap (Matrix &m)
 
void fullRows ()
 Make sure all rows have an entry even if they are empty. More...
 
void fullDiagonal ()
 Make sure all diagonal entries are present even if they are zero. More...
 
void shiftIndices (Index base)
 
template<class TMatrix >
void filterValues (TMatrix &M, filter_fn *filter=&nonzeros, const Bloc &ref=Bloc())
 
template<class TMatrix >
void copyNonZeros (TMatrix &M)
 
template<class TMatrix >
void copyNonSmall (TMatrix &M, const Bloc &ref)
 
void copyUpper (Matrix &M)
 
void copyLower (Matrix &M)
 
template<class TMatrix >
void copyUpperNonZeros (TMatrix &M)
 
template<class TMatrix >
void copyLowerNonZeros (TMatrix &M)
 
void copyUpperNonSmall (Matrix &M, const Bloc &ref)
 
void copyLowerNonSmall (Matrix &M, const Bloc &ref)
 
const Blocbloc (Index i, Index j) const
 
Blocwbloc (Index i, Index j, bool create=false)
 Mathematical size of the matrix. More...
 
Index rowSize () const override
 Mathematical size of the matrix. More...
 
Index colSize () const override
 Number of columns. More...
 
void resize (Index nbRow, Index nbCol) override
 Resize the matrix and reset all values to 0. More...
 
SReal element (Index i, Index j) const override
 Read the value of the element at row i, column j (using 0-based indices) More...
 
void set (Index i, Index j, double v) override
 Write the value of the element at row i, column j (using 0-based indices) More...
 
void add (Index i, Index j, double v) override
 Add v to the existing value of the element at row i, column j (using 0-based indices) More...
 
void clear (Index i, Index j) override
 
void clearRow (Index i) override
 Reset all the values in row i to 0. More...
 
void clearCol (Index j) override
 Reset the all values in column j to 0. More...
 
void clearRowCol (Index i) override
 Reset the value of both row and column i to 0. More...
 
void clear () override
 Reset all values to 0. More...
 
template<class M2 >
bool hasRef (const M2 *m) const
 
std::string expr () const
 
bool valid () const
 
template<class Dest >
void addTo (Dest *dest) const
 
template<class TBloc2 , class TVecBloc2 , class TVecIndex2 >
void operator= (const CompressedRowSparseMatrix< TBloc2, TVecBloc2, TVecIndex2 > &m)
 
template<class TBloc2 , class TVecBloc2 , class TVecIndex2 >
void operator+= (const CompressedRowSparseMatrix< TBloc2, TVecBloc2, TVecIndex2 > &m)
 
template<class TBloc2 , class TVecBloc2 , class TVecIndex2 >
void operator-= (const CompressedRowSparseMatrix< TBloc2, TVecBloc2, TVecIndex2 > &m)
 
template<class Expr2 >
void operator= (const MatrixExpr< Expr2 > &m)
 
template<class Expr2 >
void operator+= (const MatrixExpr< Expr2 > &m)
 
template<class Expr2 >
void operator-= (const MatrixExpr< Expr2 > &m)
 
MatrixExpr< MatrixTranspose< Matrix > > t () const
 
MatrixExpr< MatrixInverse< Matrix > > i () const
 
MatrixExpr< MatrixNegative< Matrix > > operator- () const
 
MatrixExpr< MatrixScale< Matrix, double > > operator* (const double &r) const
 
bool check_matrix ()
 
template<>
void filterValues (CompressedRowSparseMatrix< defaulttype::Mat< 3, 3, double > > &M, filter_fn *filter, const Bloc &ref)
 
template<>
void filterValues (CompressedRowSparseMatrix< defaulttype::Mat< 3, 3, float > > &M, filter_fn *filter, const Bloc &ref)
 
template<>
void filterValues (CompressedRowSparseMatrix< defaulttype::Mat< 3, 3, float > > &M, filter_fn *filter, const Bloc &ref)
 
template<>
void filterValues (CompressedRowSparseMatrix< defaulttype::Mat< 3, 3, double > > &M, filter_fn *filter, const Bloc &ref)
 
Get information about the content and structure of this matrix (diagonal, band, sparse, full, block size, ...)
ElementType getElementType () const override
 
virtual std::size_t getElementSize () const override
 
MatrixCategory getCategory () const override
 
Index getBlockRows () const override
 
Index getBlockCols () const override
 
Index bRowSize () const override
 
Index bColSize () const override
 
Index getBandWidth () const override
 
Matrix operators
template<typename RB , typename RVB , typename RVI , typename MB , typename MVB , typename MVI >
void mul (CompressedRowSparseMatrix< RB, RVB, RVI > &res, const CompressedRowSparseMatrix< MB, MVB, MVI > &m) const
 
template<typename RB , typename RVB , typename RVI , typename MB , typename MVB , typename MVI >
void mulTranspose (CompressedRowSparseMatrix< RB, RVB, RVI > &res, const CompressedRowSparseMatrix< MB, MVB, MVI > &m) const
 
CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex > operator+ (const CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex > &m) const
 
specialization of product methods on a few vector types
template<typename V1 , typename V2 >
void mul (V2 &result, const V1 &v) const
 
template<typename V1 , typename V2 >
void addMultTranspose (V1 &result, const V2 &v) const
 
template<class Vec >
Vec operator* (const Vec &v) const
 
template<typename V , typename Real2 >
void addMul_by_line (V &res, const defaulttype::Vec< NC, Real2 > &v) const
 
template<typename Real , typename V , typename V2 >
void addMul_by_line (V &res, const V2 &v) const
 
template<typename V1 , typename V2 >
void addMul (V1 &res, const V2 &v) const
 result += this * v More...
 
- Public Member Functions inherited from sofa::defaulttype::BaseMatrix
 BaseMatrix ()
 
virtual ~BaseMatrix ()
 
Index rows (void) const
 Number of rows (Eigen-compatible API) More...
 
Index cols (void) const
 Number of columns (Eigen-compatible API) More...
 
SReal operator() (Index i, Index j) const
 Read the value of the element at row i, column j (using 0-based indices). Eigen-compatible API. More...
 
virtual void add (Index _i, Index _j, const defaulttype::Mat3x3d &_M)
 Adding values from a 3x3d matrix this function may be overload to obtain better performances. More...
 
virtual void add (Index _i, Index _j, const defaulttype::Mat3x3f &_M)
 Adding values from a 3x3f matrix this function may be overload to obtain better performances. More...
 
virtual void add (Index _i, Index _j, const defaulttype::Mat2x2d &_M)
 Adding values from a 2x2d matrix this function may be overload to obtain better performances. More...
 
virtual void add (Index _i, Index _j, const defaulttype::Mat2x2f &_M)
 Adding values from a 2x2f matrix this function may be overload to obtain better performances. More...
 
virtual void clearRows (Index imin, Index imax)
 Clears the value of rows imin to imax-1. More...
 
virtual void clearCols (Index imin, Index imax)
 Clears all the values in columns imin to imax-1. More...
 
virtual void clearRowsCols (Index imin, Index imax)
 Clears all the values in rows imin to imax-1 and columns imin to imax-1. More...
 
virtual void opMulV (defaulttype::BaseVector *result, const defaulttype::BaseVector *v) const
 Multiply the matrix by vector v and put the result in vector result. More...
 
virtual void opMulV (float *result, const float *v) const
 Multiply the matrix by float vector v and put the result in vector result. More...
 
virtual void opMulV (double *result, const double *v) const
 Multiply the matrix by double vector v and put the result in vector result. More...
 
virtual void opPMulV (defaulttype::BaseVector *result, const defaulttype::BaseVector *v) const
 Multiply the matrix by vector v and add the result in vector result. More...
 
virtual void opPMulV (float *result, const float *v) const
 Multiply the matrix by float vector v and add the result in vector result. More...
 
virtual void opPMulV (double *result, const double *v) const
 Multiply the matrix by double vector v and add the result in vector result. More...
 
virtual void opMulTV (defaulttype::BaseVector *result, const defaulttype::BaseVector *v) const
 Multiply the transposed matrix by vector v and put the result in vector result. More...
 
virtual void opMulTV (float *result, const float *v) const
 Multiply the transposed matrix by float vector v and put the result in vector result. More...
 
virtual void opMulTV (double *result, const double *v) const
 Multiply the transposed matrix by double vector v and put the result in vector result. More...
 
virtual void opPMulTV (defaulttype::BaseVector *result, const defaulttype::BaseVector *v) const
 Multiply the transposed matrix by vector v and add the result in vector result. More...
 
virtual void opPMulTV (float *result, const float *v) const
 Multiply the transposed matrix by float vector v and add the result in vector result. More...
 
virtual void opPMulTV (double *result, const double *v) const
 Multiply the transposed matrix by double vector v and add the result in vector result. More...
 
virtual void opMulTM (BaseMatrix *result, BaseMatrix *m) const
 Multiply the transposed matrix by matrix m and store the result in matrix result. More...
 
virtual void opAddM (defaulttype::BaseMatrix *m, double fact) const
 Subtract the matrix to the m matrix and strore the result in m. More...
 
virtual void opAddMT (defaulttype::BaseMatrix *m, double fact) const
 Subtract the transposed matrix to the m matrix and strore the result in m. More...
 
bool isDiagonal () const
 
bool isBlockDiagonal () const
 
bool isBand () const
 
bool isSparse () const
 
template<class T >
const T * blocElements (Index i, Index j, T *buffer) const
 Shortcut for blocGet(i,j).elements(buffer) More...
 
template<class T >
void blocSet (Index i, Index j, const T *buffer)
 Shortcut for blocCreate(i,j).set(buffer) More...
 
template<class T >
void blocAdd (Index i, Index j, const T *buffer)
 Shortcut for blocCreate(i,j).add(buffer) More...
 

Static Public Member Functions

static void split_row_index (Index &index, Index &modulo)
 
static void split_col_index (Index &index, Index &modulo)
 
static bool sortedFind (const VecIndex &v, Range in, Index val, Index &result)
 
static bool sortedFind (const VecIndex &v, Index val, Index &result)
 
static bool nonzeros (Index, Index, Bloc &val, const Bloc &)
 
static bool nonsmall (Index, Index, Bloc &val, const Bloc &ref)
 
static bool upper (Index i, Index j, Bloc &val, const Bloc &)
 
static bool lower (Index i, Index j, Bloc &val, const Bloc &)
 
static bool upper_nonzeros (Index i, Index j, Bloc &val, const Bloc &ref)
 
static bool lower_nonzeros (Index i, Index j, Bloc &val, const Bloc &ref)
 
static bool upper_nonsmall (Index i, Index j, Bloc &val, const Bloc &ref)
 
static bool lower_nonsmall (Index i, Index j, Bloc &val, const Bloc &ref)
 
static const char * Name ()
 
static bool check_matrix (Index nzmax, Index m, Index n, Index *a_p, Index *a_i, double *a_x)
 

Protected Member Functions

template<class M >
void equal (const M &m, bool add=false)
 
template<class M >
void addEqual (const M &m)
 this += m More...
 
- Protected Member Functions inherited from sofa::defaulttype::BaseMatrix
template<class T >
const T * bAccessorElementsDefaultImpl (const InternalBlockAccessor *b, T *buffer) const
 
template<class T >
void bAccessorSetDefaultImpl (InternalBlockAccessor *b, const T *buffer)
 
template<class T >
void bAccessorAddDefaultImpl (InternalBlockAccessor *b, const T *buffer)
 
template<class T >
T * bAccessorPrepareAddDefaultImpl (InternalBlockAccessor *, T *buffer)
 
virtual floatbAccessorPrepareAdd (InternalBlockAccessor *b, float *buffer)
 
virtual doublebAccessorPrepareAdd (InternalBlockAccessor *b, double *buffer)
 
virtual intbAccessorPrepareAdd (InternalBlockAccessor *b, int *buffer)
 
virtual void bAccessorFinishAdd (InternalBlockAccessor *b, const float *buffer)
 
virtual void bAccessorFinishAdd (InternalBlockAccessor *b, const double *buffer)
 
virtual void bAccessorFinishAdd (InternalBlockAccessor *b, const int *buffer)
 
BlockAccessor createBlockAccessor (Index row, Index col, void *internalPtr=nullptr)
 
BlockAccessor createBlockAccessor (Index row, Index col, Index internalData)
 
BlockConstAccessor createBlockConstAccessor (Index row, Index col, void *internalPtr=nullptr) const
 
BlockConstAccessor createBlockConstAccessor (Index row, Index col, Index internalData) const
 
void setMatrix (BlockAccessor *b)
 
void setMatrix (BlockConstAccessor *b) const
 
ColBlockConstIterator createColBlockConstIterator (Index row, void *internalPtr) const
 
ColBlockConstIterator createColBlockConstIterator (Index row, Index internalData) const
 
RowBlockConstIterator createRowBlockConstIterator (void *internalPtr) const
 
RowBlockConstIterator createRowBlockConstIterator (Index internalData0, Index internalData1) const
 

Virtual iterator classes and methods

BlockConstAccessor blocGet (Index i, Index j) const override
 Get read access to a bloc. More...
 
BlockAccessor blocGetW (Index i, Index j) override
 Get write access to a bloc. More...
 
BlockAccessor blocCreate (Index i, Index j) override
 Get write access to a bloc, possibly creating it. More...
 
ColBlockConstIterator bRowBegin (Index ib) const override
 Get the iterator corresponding to the beginning of the given row of blocks. More...
 
ColBlockConstIterator bRowEnd (Index ib) const override
 Get the iterator corresponding to the end of the given row of blocks. More...
 
std::pair< ColBlockConstIterator, ColBlockConstIteratorbRowRange (Index ib) const override
 Get the iterators corresponding to the beginning and end of the given row of blocks. More...
 
RowBlockConstIterator bRowsBegin () const override
 Get the iterator corresponding to the beginning of the rows of blocks. More...
 
RowBlockConstIterator bRowsEnd () const override
 Get the iterator corresponding to the end of the rows of blocks. More...
 
std::pair< RowBlockConstIterator, RowBlockConstIteratorbRowsRange () const override
 Get the iterators corresponding to the beginning and end of the given row of blocks. More...
 
void bAccessorDelete (const InternalBlockAccessor *) const override
 
void bAccessorCopy (InternalBlockAccessor *) const override
 
SReal bAccessorElement (const InternalBlockAccessor *b, Index i, Index j) const override
 
void bAccessorSet (InternalBlockAccessor *b, Index i, Index j, double v) override
 
void bAccessorAdd (InternalBlockAccessor *b, Index i, Index j, double v) override
 
template<class T >
const T * bAccessorElementsCSRImpl (const InternalBlockAccessor *b, T *buffer) const
 
const floatbAccessorElements (const InternalBlockAccessor *b, float *buffer) const override
 
const doublebAccessorElements (const InternalBlockAccessor *b, double *buffer) const override
 
const intbAccessorElements (const InternalBlockAccessor *b, int *buffer) const override
 
template<class T >
void bAccessorSetCSRImpl (InternalBlockAccessor *b, const T *buffer)
 
void bAccessorSet (InternalBlockAccessor *b, const float *buffer) override
 
void bAccessorSet (InternalBlockAccessor *b, const double *buffer) override
 
void bAccessorSet (InternalBlockAccessor *b, const int *buffer) override
 
template<class T >
void bAccessorAddCSRImpl (InternalBlockAccessor *b, const T *buffer)
 
void bAccessorAdd (InternalBlockAccessor *b, const float *buffer) override
 
void bAccessorAdd (InternalBlockAccessor *b, const double *buffer) override
 
void bAccessorAdd (InternalBlockAccessor *b, const int *buffer) override
 
void itCopyColBlock (InternalColBlockIterator *) const override
 
void itDeleteColBlock (const InternalColBlockIterator *) const override
 
void itAccessColBlock (InternalColBlockIterator *it, BlockConstAccessor *b) const override
 
void itIncColBlock (InternalColBlockIterator *it) const override
 
void itDecColBlock (InternalColBlockIterator *it) const override
 
bool itEqColBlock (const InternalColBlockIterator *it, const InternalColBlockIterator *it2) const override
 
bool itLessColBlock (const InternalColBlockIterator *it, const InternalColBlockIterator *it2) const override
 
void itCopyRowBlock (InternalRowBlockIterator *) const override
 
void itDeleteRowBlock (const InternalRowBlockIterator *) const override
 
Index itAccessRowBlock (InternalRowBlockIterator *it) const override
 
ColBlockConstIterator itBeginRowBlock (InternalRowBlockIterator *it) const override
 
ColBlockConstIterator itEndRowBlock (InternalRowBlockIterator *it) const override
 
std::pair< ColBlockConstIterator, ColBlockConstIteratoritRangeRowBlock (InternalRowBlockIterator *it) const override
 
void itIncRowBlock (InternalRowBlockIterator *it) const override
 
void itDecRowBlock (InternalRowBlockIterator *it) const override
 
bool itEqRowBlock (const InternalRowBlockIterator *it, const InternalRowBlockIterator *it2) const override
 
bool itLessRowBlock (const InternalRowBlockIterator *it, const InternalRowBlockIterator *it2) const override
 

setter/getter & product methods on template vector types

template<class Real2 , class V1 , class V2 >
void tmul (V1 &res, const V2 &vec) const
 
template<class Real2 , class V1 , class V2 >
void taddMul (V1 &res, const V2 &vec) const
 
template<class Real2 , class V1 , class V2 >
void taddMul_by_line (V1 &res, const V2 &vec) const
 
template<class Real2 , class V1 , class V2 >
void taddMulTranspose (V1 &res, const V2 &vec) const
 
template<class Vec >
static Real vget (const Vec &vec, Index i, Index j, Index k)
 
template<class Vec >
static Real vget (const helper::vector< Vec > &vec, Index i, Index, Index k)
 
static Real vget (const defaulttype::BaseVector &vec, Index i)
 
template<class Real2 >
static Real2 vget (const FullVector< Real2 > &vec, Index i)
 
template<class Vec >
static void vset (Vec &vec, Index i, Index j, Index k, Real v)
 
template<class Vec >
static void vset (helper::vector< Vec > &vec, Index i, Index, Index k, Real v)
 
static void vset (defaulttype::BaseVector &vec, Index i, Real v)
 
template<class Real2 >
static void vset (FullVector< Real2 > &vec, Index i, Real2 v)
 
template<class Vec >
static void vadd (Vec &vec, Index i, Index j, Index k, Real v)
 
template<class Vec >
static void vadd (helper::vector< Vec > &vec, Index i, Index, Index k, Real v)
 
static void vadd (defaulttype::BaseVector &vec, Index i, Real v)
 
template<class Real2 >
static void vadd (FullVector< Real2 > &vec, Index i, Real2 v)
 
template<class Vec >
static void vresize (Vec &vec, Index, Index totalSize)
 
template<class Vec >
static void vresize (helper::vector< Vec > &vec, Index blockSize, Index)
 

Additional Inherited Members

- Static Protected Member Functions inherited from sofa::defaulttype::BaseMatrix
static InternalBlockAccessorgetInternal (BlockConstAccessor *b)
 
static const InternalBlockAccessorgetInternal (const BlockConstAccessor *b)
 
static InternalBlockAccessorgetInternal (BlockAccessor *b)
 
static const InternalBlockAccessorgetInternal (const BlockAccessor *b)
 
static InternalColBlockIteratorgetInternal (ColBlockConstIterator *b)
 
static const InternalColBlockIteratorgetInternal (const ColBlockConstIterator *b)
 
static InternalRowBlockIteratorgetInternal (RowBlockConstIterator *b)
 
static const InternalRowBlockIteratorgetInternal (const RowBlockConstIterator *b)
 

Attribute details

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
VecIndexedBloc sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::btemp

unsorted blocks and their indices

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
VecIndex sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::colsIndex

column indices of all the non-empty blocks, sorted by increasing row index and column index

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
VecBloc sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::colsValue

values of the non-empty blocks, in the same order as in colsIndex

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
bool sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::compressed

true if the additional storage is empty or has been transfered to the compressed data structure

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
Index sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::nBlocCol

Mathematical size of the matrix, in blocks.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
Index sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::nBlocRow
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
Index sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::nCol

Mathematical size of the matrix, in scalars.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
Index sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::nRow
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
VecIndex sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::oldColsIndex
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
VecBloc sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::oldColsValue
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
VecIndex sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::oldRowBegin
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
VecIndex sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::oldRowIndex
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
VecIndex sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::rowBegin

column indices of non-empty blocks in each row. The column indices of the non-empty block within the i-th non-empty row are all the colsIndex[j], j in [rowBegin[i],rowBegin[i+1])

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
VecIndex sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::rowIndex

indices of non-empty block rows

Constructor details

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::CompressedRowSparseMatrix ( )
inline
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::CompressedRowSparseMatrix ( Index  nbRow,
Index  nbCol 
)
inline
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::~CompressedRowSparseMatrix ( )
inlineoverride

Function details

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::add ( Index  i,
Index  j,
double  v 
)
inlineoverridevirtual

Add v to the existing value of the element at row i, column j (using 0-based indices)

Implements sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
template<class M >
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::addEqual ( const M &  m)
inlineprotected

this += m

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
template<typename V1 , typename V2 >
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::addMul ( V1 &  res,
const V2 &  v 
) const
inline

result += this * v

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
template<typename V , typename Real2 >
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::addMul_by_line ( V &  res,
const defaulttype::Vec< NC, Real2 > &  v 
) const
inline

result += this * (v,...,v)^T v has the size of one bloc

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
template<typename Real , typename V , typename V2 >
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::addMul_by_line ( V &  res,
const V2 &  v 
) const
inline
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
template<typename V1 , typename V2 >
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::addMultTranspose ( V1 &  result,
const V2 &  v 
) const
inline

equal result += this^T * v

Warning
The block sizes must be compatible ie v.size() must be a multiple of block size.
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
template<class Dest >
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::addTo ( Dest *  dest) const
inline

dest += this different bloc types possible

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::bAccessorAdd ( InternalBlockAccessor b,
Index  i,
Index  j,
double  v 
)
inlineoverrideprotectedvirtual

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::bAccessorAdd ( InternalBlockAccessor b,
const float buffer 
)
inlineoverrideprotectedvirtual

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::bAccessorAdd ( InternalBlockAccessor b,
const double buffer 
)
inlineoverrideprotectedvirtual

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::bAccessorAdd ( InternalBlockAccessor b,
const int buffer 
)
inlineoverrideprotectedvirtual

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
template<class T >
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::bAccessorAddCSRImpl ( InternalBlockAccessor b,
const T *  buffer 
)
inlineprotected
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::bAccessorCopy ( InternalBlockAccessor ) const
inlineoverrideprotectedvirtual

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::bAccessorDelete ( const InternalBlockAccessor ) const
inlineoverrideprotectedvirtual

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
SReal sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::bAccessorElement ( const InternalBlockAccessor b,
Index  i,
Index  j 
) const
inlineoverrideprotectedvirtual

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
const float* sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::bAccessorElements ( const InternalBlockAccessor b,
float buffer 
) const
inlineoverrideprotectedvirtual

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
const double* sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::bAccessorElements ( const InternalBlockAccessor b,
double buffer 
) const
inlineoverrideprotectedvirtual

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
const int* sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::bAccessorElements ( const InternalBlockAccessor b,
int buffer 
) const
inlineoverrideprotectedvirtual

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
template<class T >
const T* sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::bAccessorElementsCSRImpl ( const InternalBlockAccessor b,
T *  buffer 
) const
inlineprotected
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::bAccessorSet ( InternalBlockAccessor b,
Index  i,
Index  j,
double  v 
)
inlineoverrideprotectedvirtual

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::bAccessorSet ( InternalBlockAccessor b,
const float buffer 
)
inlineoverrideprotectedvirtual

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::bAccessorSet ( InternalBlockAccessor b,
const double buffer 
)
inlineoverrideprotectedvirtual

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::bAccessorSet ( InternalBlockAccessor b,
const int buffer 
)
inlineoverrideprotectedvirtual

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
template<class T >
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::bAccessorSetCSRImpl ( InternalBlockAccessor b,
const T *  buffer 
)
inlineprotected
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
Index sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::bColSize ( ) const
inlineoverridevirtual
Returns
the number of columns of blocks

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
const Bloc& sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::bloc ( Index  i,
Index  j 
) const
inline
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
BlockAccessor sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::blocCreate ( Index  i,
Index  j 
)
inlineoverridevirtual

Get write access to a bloc, possibly creating it.

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
BlockConstAccessor sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::blocGet ( Index  i,
Index  j 
) const
inlineoverridevirtual

Get read access to a bloc.

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
BlockAccessor sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::blocGetW ( Index  i,
Index  j 
)
inlineoverridevirtual

Get write access to a bloc.

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
ColBlockConstIterator sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::bRowBegin ( Index  ib) const
inlineoverridevirtual

Get the iterator corresponding to the beginning of the given row of blocks.

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
ColBlockConstIterator sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::bRowEnd ( Index  ib) const
inlineoverridevirtual

Get the iterator corresponding to the end of the given row of blocks.

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
std::pair<ColBlockConstIterator, ColBlockConstIterator> sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::bRowRange ( Index  ib) const
inlineoverridevirtual

Get the iterators corresponding to the beginning and end of the given row of blocks.

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
RowBlockConstIterator sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::bRowsBegin ( ) const
inlineoverridevirtual

Get the iterator corresponding to the beginning of the rows of blocks.

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
RowBlockConstIterator sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::bRowsEnd ( ) const
inlineoverridevirtual

Get the iterator corresponding to the end of the rows of blocks.

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
Index sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::bRowSize ( ) const
inlineoverridevirtual
Returns
the number of rows of blocks

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
std::pair<RowBlockConstIterator, RowBlockConstIterator> sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::bRowsRange ( ) const
inlineoverridevirtual

Get the iterators corresponding to the beginning and end of the given row of blocks.

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
bool sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::check_matrix ( )
inline
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
static bool sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::check_matrix ( Index  nzmax,
Index  m,
Index  n,
Index a_p,
Index a_i,
double a_x 
)
inlinestatic
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::clear ( Index  i,
Index  j 
)
inlineoverridevirtual

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::clear ( )
inlineoverridevirtual

Reset all values to 0.

Implements sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::clearCol ( Index  j)
inlineoverridevirtual

Reset the all values in column j to 0.

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::clearRow ( Index  i)
inlineoverridevirtual

Reset all the values in row i to 0.

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::clearRowCol ( Index  i)
inlineoverridevirtual

Reset the value of both row and column i to 0.

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
Index sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::colBSize ( ) const
inline
Returns
the number of col blocs
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
Index sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::colSize ( ) const
inlineoverridevirtual

Number of columns.

Implements sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::compress ( )
inlineoverridevirtual

Make the final data setup after adding entries. For most concrete types, this method does nothing.

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::copyLower ( Matrix M)
inline
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::copyLowerNonSmall ( Matrix M,
const Bloc ref 
)
inline
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
template<class TMatrix >
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::copyLowerNonZeros ( TMatrix &  M)
inline
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
template<class TMatrix >
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::copyNonSmall ( TMatrix &  M,
const Bloc ref 
)
inline
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
template<class TMatrix >
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::copyNonZeros ( TMatrix &  M)
inline
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::copyUpper ( Matrix M)
inline
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::copyUpperNonSmall ( Matrix M,
const Bloc ref 
)
inline
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
template<class TMatrix >
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::copyUpperNonZeros ( TMatrix &  M)
inline
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
SReal sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::element ( Index  i,
Index  j 
) const
inlineoverridevirtual

Read the value of the element at row i, column j (using 0-based indices)

Implements sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
template<class M >
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::equal ( const M &  m,
bool  add = false 
)
inlineprotected

add ? this += m : this = m m can be the same as this

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
std::string sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::expr ( ) const
inline
template<>
void sofa::component::linearsolver::CompressedRowSparseMatrix< double >::filterValues ( CompressedRowSparseMatrix< defaulttype::Mat< 3, 3, double > > &  M,
filter_fn filter,
const Bloc ref 
)
inline
template<>
void sofa::component::linearsolver::CompressedRowSparseMatrix< double >::filterValues ( CompressedRowSparseMatrix< defaulttype::Mat< 3, 3, float > > &  M,
filter_fn filter,
const Bloc ref 
)
inline
template<>
void sofa::component::linearsolver::CompressedRowSparseMatrix< float >::filterValues ( CompressedRowSparseMatrix< defaulttype::Mat< 3, 3, float > > &  M,
filter_fn filter,
const Bloc ref 
)
inline
template<>
void sofa::component::linearsolver::CompressedRowSparseMatrix< float >::filterValues ( CompressedRowSparseMatrix< defaulttype::Mat< 3, 3, double > > &  M,
filter_fn filter,
const Bloc ref 
)
inline
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
template<class TMatrix >
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::filterValues ( TMatrix &  M,
filter_fn filter = &nonzeros,
const Bloc ref = Bloc() 
)
inline
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::fullDiagonal ( )
inline

Make sure all diagonal entries are present even if they are zero.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::fullRows ( )
inline

Make sure all rows have an entry even if they are empty.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
Index sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::getBandWidth ( ) const
inlineoverridevirtual
Returns
the width of the band on each side of the diagonal (only for band matrices)

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
Index sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::getBlockCols ( ) const
inlineoverridevirtual
Returns
the number of columns in each block, or 1 of there are no fixed block size

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
Index sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::getBlockRows ( ) const
inlineoverridevirtual
Returns
the number of rows in each block, or 1 of there are no fixed block size

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
MatrixCategory sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::getCategory ( ) const
inlineoverridevirtual
Returns
the category of this matrix

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
const VecIndex& sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::getColsIndex ( ) const
inline
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
const VecBloc& sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::getColsValue ( ) const
inline
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
virtual std::size_t sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::getElementSize ( ) const
inlineoverridevirtual
Returns
size of elements stored in this matrix

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
ElementType sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::getElementType ( ) const
inlineoverridevirtual
Returns
type of elements stored in this matrix

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
const VecIndex& sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::getRowBegin ( ) const
inline
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
const VecIndex& sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::getRowIndex ( ) const
inline
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
Range sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::getRowRange ( Index  id) const
inline
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
template<class M2 >
bool sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::hasRef ( const M2 *  m) const
inline
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
MatrixExpr< MatrixInverse< Matrix > > sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::i ( ) const
inline
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::itAccessColBlock ( InternalColBlockIterator it,
BlockConstAccessor b 
) const
inlineoverrideprotectedvirtual

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
Index sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::itAccessRowBlock ( InternalRowBlockIterator it) const
inlineoverrideprotectedvirtual

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
ColBlockConstIterator sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::itBeginRowBlock ( InternalRowBlockIterator it) const
inlineoverrideprotectedvirtual

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::itCopyColBlock ( InternalColBlockIterator ) const
inlineoverrideprotectedvirtual

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::itCopyRowBlock ( InternalRowBlockIterator ) const
inlineoverrideprotectedvirtual

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::itDecColBlock ( InternalColBlockIterator it) const
inlineoverrideprotectedvirtual

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::itDecRowBlock ( InternalRowBlockIterator it) const
inlineoverrideprotectedvirtual

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::itDeleteColBlock ( const InternalColBlockIterator ) const
inlineoverrideprotectedvirtual

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::itDeleteRowBlock ( const InternalRowBlockIterator ) const
inlineoverrideprotectedvirtual

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
ColBlockConstIterator sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::itEndRowBlock ( InternalRowBlockIterator it) const
inlineoverrideprotectedvirtual

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
bool sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::itEqColBlock ( const InternalColBlockIterator it,
const InternalColBlockIterator it2 
) const
inlineoverrideprotectedvirtual

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
bool sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::itEqRowBlock ( const InternalRowBlockIterator it,
const InternalRowBlockIterator it2 
) const
inlineoverrideprotectedvirtual

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::itIncColBlock ( InternalColBlockIterator it) const
inlineoverrideprotectedvirtual

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::itIncRowBlock ( InternalRowBlockIterator it) const
inlineoverrideprotectedvirtual

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
bool sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::itLessColBlock ( const InternalColBlockIterator it,
const InternalColBlockIterator it2 
) const
inlineoverrideprotectedvirtual

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
bool sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::itLessRowBlock ( const InternalRowBlockIterator it,
const InternalRowBlockIterator it2 
) const
inlineoverrideprotectedvirtual

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
std::pair<ColBlockConstIterator, ColBlockConstIterator> sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::itRangeRowBlock ( InternalRowBlockIterator it) const
inlineoverrideprotectedvirtual

Reimplemented from sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
static bool sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::lower ( Index  i,
Index  j,
Bloc val,
const Bloc  
)
inlinestatic
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
static bool sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::lower_nonsmall ( Index  i,
Index  j,
Bloc val,
const Bloc ref 
)
inlinestatic
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
static bool sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::lower_nonzeros ( Index  i,
Index  j,
Bloc val,
const Bloc ref 
)
inlinestatic
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
template<typename RB , typename RVB , typename RVI , typename MB , typename MVB , typename MVI >
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::mul ( CompressedRowSparseMatrix< RB, RVB, RVI > &  res,
const CompressedRowSparseMatrix< MB, MVB, MVI > &  m 
) const
inline

Compute res = this * m

Warning
The block sizes must be compatible, i.e. this::NC==m::NR and res::NR==this::NR and res::NC==m::NC. The basic algorithm consists in accumulating rows of m to rows of res: foreach row { foreach col { res[row] += this[row,col] * m[col] } }
matrices this and m must be compressed
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
template<typename V1 , typename V2 >
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::mul ( V2 &  result,
const V1 &  v 
) const
inline

equal result = this * v

Warning
The block sizes must be compatible ie v.size() must be a multiple of block size.
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
template<typename RB , typename RVB , typename RVI , typename MB , typename MVB , typename MVI >
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::mulTranspose ( CompressedRowSparseMatrix< RB, RVB, RVI > &  res,
const CompressedRowSparseMatrix< MB, MVB, MVI > &  m 
) const
inline

Compute res = this.transpose * m

Warning
The block sizes must be compatible, i.e. this::NR==m::NR and res::NR==this::NC and res::NC==m::NC The basic algorithm consists in accumulating rows of m to rows of res: foreach row { foreach col { res[row] += this[row,col] * m[col] } }
matrices this and m must be compressed
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
static const char* sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::Name ( )
inlinestatic
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
static bool sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::nonsmall ( Index  ,
Index  ,
Bloc val,
const Bloc ref 
)
inlinestatic
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
static bool sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::nonzeros ( Index  ,
Index  ,
Bloc val,
const Bloc  
)
inlinestatic
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
template<class Vec >
Vec sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::operator* ( const Vec &  v) const
inline
Returns
this * v
Warning
The block sizes must be compatible ie v.size() must be a multiple of block size.
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
MatrixExpr< MatrixScale< Matrix, double > > sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::operator* ( const double r) const
inline
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
CompressedRowSparseMatrix<TBloc,TVecBloc,TVecIndex> sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::operator+ ( const CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex > &  m) const
inline
Returns
this + m
Warning
The block must be the same (same type and same size)
The matrices must have the same mathematical size
matrices this and m must be compressed
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
template<class TBloc2 , class TVecBloc2 , class TVecIndex2 >
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::operator+= ( const CompressedRowSparseMatrix< TBloc2, TVecBloc2, TVecIndex2 > &  m)
inline
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
template<class Expr2 >
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::operator+= ( const MatrixExpr< Expr2 > &  m)
inline
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
MatrixExpr< MatrixNegative< Matrix > > sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::operator- ( ) const
inline
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
template<class TBloc2 , class TVecBloc2 , class TVecIndex2 >
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::operator-= ( const CompressedRowSparseMatrix< TBloc2, TVecBloc2, TVecIndex2 > &  m)
inline
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
template<class Expr2 >
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::operator-= ( const MatrixExpr< Expr2 > &  m)
inline
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
template<class TBloc2 , class TVecBloc2 , class TVecIndex2 >
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::operator= ( const CompressedRowSparseMatrix< TBloc2, TVecBloc2, TVecIndex2 > &  m)
inline
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
template<class Expr2 >
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::operator= ( const MatrixExpr< Expr2 > &  m)
inline
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::resize ( Index  nbRow,
Index  nbCol 
)
inlineoverridevirtual

Resize the matrix and reset all values to 0.

Implements sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::resizeBloc ( Index  nbBRow,
Index  nbBCol 
)
inline
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
Index sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::rowBSize ( ) const
inline
Returns
the number of row blocs
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
Index sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::rowSize ( void  ) const
inlineoverridevirtual

Mathematical size of the matrix.

Implements sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::set ( Index  i,
Index  j,
double  v 
)
inlineoverridevirtual

Write the value of the element at row i, column j (using 0-based indices)

Implements sofa::defaulttype::BaseMatrix.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::shiftIndices ( Index  base)
inline

Add the given base to all indices. Use 1 to convert do Fortran 1-based notation. Note that the matrix will no longer be valid from the point of view of C/C++ codes. You need to call again with -1 as base to undo it.

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
static bool sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::sortedFind ( const VecIndex v,
Range  in,
Index  val,
Index result 
)
inlinestatic
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
static bool sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::sortedFind ( const VecIndex v,
Index  val,
Index result 
)
inlinestatic
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
static void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::split_col_index ( Index index,
Index modulo 
)
inlinestatic
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
static void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::split_row_index ( Index index,
Index modulo 
)
inlinestatic
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::swap ( Matrix m)
inline
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
MatrixExpr< MatrixTranspose< Matrix > > sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::t ( ) const
inline
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
template<class Real2 , class V1 , class V2 >
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::taddMul ( V1 &  res,
const V2 &  vec 
) const
inlineprotected

Product of the matrix with a templated vector res += this * vec

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
template<class Real2 , class V1 , class V2 >
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::taddMul_by_line ( V1 &  res,
const V2 &  vec 
) const
inlineprotected

Product of the matrix with a templated vector that have the size of the bloc res += this * [vec,...,vec]^T

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
template<class Real2 , class V1 , class V2 >
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::taddMulTranspose ( V1 &  res,
const V2 &  vec 
) const
inlineprotected

Product of the transpose with a templated vector and add it to res res += this^T * vec

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
template<class Real2 , class V1 , class V2 >
void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::tmul ( V1 &  res,
const V2 &  vec 
) const
inlineprotected

Product of the matrix with a templated vector res = this * vec

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
static bool sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::upper ( Index  i,
Index  j,
Bloc val,
const Bloc  
)
inlinestatic
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
static bool sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::upper_nonsmall ( Index  i,
Index  j,
Bloc val,
const Bloc ref 
)
inlinestatic
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
static bool sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::upper_nonzeros ( Index  i,
Index  j,
Bloc val,
const Bloc ref 
)
inlinestatic
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
template<class Vec >
static void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::vadd ( Vec &  vec,
Index  i,
Index  j,
Index  k,
Real  v 
)
inlinestaticprotected
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
template<class Vec >
static void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::vadd ( helper::vector< Vec > &  vec,
Index  i,
Index  ,
Index  k,
Real  v 
)
inlinestaticprotected
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
static void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::vadd ( defaulttype::BaseVector vec,
Index  i,
Real  v 
)
inlinestaticprotected
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
template<class Real2 >
static void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::vadd ( FullVector< Real2 > &  vec,
Index  i,
Real2  v 
)
inlinestaticprotected
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
bool sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::valid ( ) const
inline
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
template<class Vec >
static Real sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::vget ( const Vec &  vec,
Index  i,
Index  j,
Index  k 
)
inlinestaticprotected
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
template<class Vec >
static Real sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::vget ( const helper::vector< Vec > &  vec,
Index  i,
Index  ,
Index  k 
)
inlinestaticprotected
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
static Real sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::vget ( const defaulttype::BaseVector vec,
Index  i 
)
inlinestaticprotected
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
template<class Real2 >
static Real2 sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::vget ( const FullVector< Real2 > &  vec,
Index  i 
)
inlinestaticprotected
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
template<class Vec >
static void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::vresize ( Vec &  vec,
Index  ,
Index  totalSize 
)
inlinestaticprotected
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
template<class Vec >
static void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::vresize ( helper::vector< Vec > &  vec,
Index  blockSize,
Index   
)
inlinestaticprotected
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
template<class Vec >
static void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::vset ( Vec &  vec,
Index  i,
Index  j,
Index  k,
Real  v 
)
inlinestaticprotected
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
template<class Vec >
static void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::vset ( helper::vector< Vec > &  vec,
Index  i,
Index  ,
Index  k,
Real  v 
)
inlinestaticprotected
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
static void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::vset ( defaulttype::BaseVector vec,
Index  i,
Real  v 
)
inlinestaticprotected
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
template<class Real2 >
static void sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::vset ( FullVector< Real2 > &  vec,
Index  i,
Real2  v 
)
inlinestaticprotected
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
Bloc* sofa::component::linearsolver::CompressedRowSparseMatrix< TBloc, TVecBloc, TVecIndex >::wbloc ( Index  i,
Index  j,
bool  create = false 
)
inline

Mathematical size of the matrix.

Enum details

template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
anonymous enum
Enumerator
NL 
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
anonymous enum
Enumerator
NC 
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
anonymous enum
Enumerator
category 
template<typename TBloc, typename TVecBloc = helper::vector<TBloc>, typename TVecIndex = helper::vector<defaulttype::BaseMatrix::Index>>
anonymous enum
Enumerator
operand