SOFA API  99934cbc
Open source framework for multi-physics simuation
sofa::component::linearsolver::BTDMatrix< N, T > Class Template Reference

#include <BTDLinearSolver.h>

Simple BTD matrix container. More...

Inheritance diagram for sofa::component::linearsolver::BTDMatrix< N, T >:

Detailed Description

template<std::size_t N, typename T>
class sofa::component::linearsolver::BTDMatrix< N, T >

Simple BTD matrix container.

Classes

class  Bloc
 
class  TransposedBloc
 

Protected Attributes

Blocdata
 
Index nTRow
 
Index nTCol
 
Index nBRow
 
Index nBCol
 
Index allocsize
 

Public Member Functions

 BTDMatrix ()
 
 BTDMatrix (Index nbRow, Index nbCol)
 
 ~BTDMatrix () override
 
Blocptr ()
 
const Blocptr () const
 
const Blocbloc (Index bi, Index bj) const
 
Blocbloc (Index bi, Index bj)
 
void resize (Index nbRow, Index nbCol) override
 Resize the matrix and reset all values to 0. More...
 
Index rowSize (void) const override
 Number of rows. More...
 
Index colSize (void) const override
 Number of columns. 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...
 
const Blocasub (Index bi, Index bj, Index, Index) const
 
const Blocsub (Index i, Index j, Index, Index) const
 
Blocasub (Index bi, Index bj, Index, Index)
 
Blocsub (Index i, Index j, Index, Index)
 
template<class B >
void getSubMatrix (Index i, Index j, Index nrow, Index ncol, B &m)
 
template<class B >
void getAlignedSubMatrix (Index bi, Index bj, Index nrow, Index ncol, B &m)
 
template<class B >
void setSubMatrix (Index i, Index j, Index nrow, Index ncol, const B &m)
 
template<class B >
void setAlignedSubMatrix (Index bi, Index bj, Index nrow, Index ncol, const B &m)
 
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 Real2 >
FullVector< Real2 > operator* (const FullVector< Real2 > &v) const
 
template<>
const char * Name ()
 
template<>
const char * Name ()
 
template<>
const char * Name ()
 
template<>
const char * Name ()
 
template<>
const char * Name ()
 
template<>
const char * Name ()
 
- 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 compress ()
 
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...
 
virtual ElementType getElementType () const
 
virtual std::size_t getElementSize () const
 
virtual MatrixCategory getCategory () const
 
virtual Index getBlockRows () const
 
virtual Index getBlockCols () const
 
virtual Index bRowSize () const
 
virtual Index bColSize () const
 
virtual Index getBandWidth () const
 
bool isDiagonal () const
 
bool isBlockDiagonal () const
 
bool isBand () const
 
bool isSparse () const
 
virtual BlockConstAccessor blocGet (Index i, Index j) const
 Get read access to a bloc. More...
 
virtual BlockAccessor blocGetW (Index i, Index j)
 Get write access to a bloc. More...
 
virtual BlockAccessor blocCreate (Index i, Index j)
 Get write access to a bloc, possibly creating it. More...
 
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...
 
virtual ColBlockConstIterator bRowBegin (Index ib) const
 Get the iterator corresponding to the beginning of the given row of blocks. More...
 
virtual ColBlockConstIterator bRowEnd (Index ib) const
 Get the iterator corresponding to the end of the given row of blocks. More...
 
virtual std::pair< ColBlockConstIterator, ColBlockConstIteratorbRowRange (Index ib) const
 Get the iterators corresponding to the beginning and end of the given row of blocks. More...
 
virtual RowBlockConstIterator bRowsBegin () const
 Get the iterator corresponding to the beginning of the rows of blocks. More...
 
virtual RowBlockConstIterator bRowsEnd () const
 Get the iterator corresponding to the end of the rows of blocks. More...
 
virtual std::pair< RowBlockConstIterator, RowBlockConstIteratorbRowsRange () const
 Get the iterators corresponding to the beginning and end of the given row of blocks. More...
 

Static Public Member Functions

static Index getSubMatrixDim (Index)
 
static const char * Name ()
 

Additional Inherited Members

- Protected Member Functions inherited from sofa::defaulttype::BaseMatrix
virtual void bAccessorDelete (const InternalBlockAccessor *) const
 
virtual void bAccessorCopy (InternalBlockAccessor *) const
 
virtual SReal bAccessorElement (const InternalBlockAccessor *b, Index i, Index j) const
 
virtual void bAccessorSet (InternalBlockAccessor *b, Index i, Index j, double v)
 
virtual void bAccessorAdd (InternalBlockAccessor *b, Index i, Index j, double v)
 
template<class T >
const T * bAccessorElementsDefaultImpl (const InternalBlockAccessor *b, T *buffer) const
 
virtual const floatbAccessorElements (const InternalBlockAccessor *b, float *buffer) const
 
virtual const doublebAccessorElements (const InternalBlockAccessor *b, double *buffer) const
 
virtual const intbAccessorElements (const InternalBlockAccessor *b, int *buffer) const
 
template<class T >
void bAccessorSetDefaultImpl (InternalBlockAccessor *b, const T *buffer)
 
virtual void bAccessorSet (InternalBlockAccessor *b, const float *buffer)
 
virtual void bAccessorSet (InternalBlockAccessor *b, const double *buffer)
 
virtual void bAccessorSet (InternalBlockAccessor *b, const int *buffer)
 
template<class T >
void bAccessorAddDefaultImpl (InternalBlockAccessor *b, const T *buffer)
 
virtual void bAccessorAdd (InternalBlockAccessor *b, const float *buffer)
 
virtual void bAccessorAdd (InternalBlockAccessor *b, const double *buffer)
 
virtual void bAccessorAdd (InternalBlockAccessor *b, const int *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
 
virtual void itCopyColBlock (InternalColBlockIterator *) const
 
virtual void itDeleteColBlock (const InternalColBlockIterator *) const
 
virtual void itAccessColBlock (InternalColBlockIterator *it, BlockConstAccessor *b) const
 
virtual void itIncColBlock (InternalColBlockIterator *it) const
 
virtual void itDecColBlock (InternalColBlockIterator *it) const
 
virtual bool itEqColBlock (const InternalColBlockIterator *it, const InternalColBlockIterator *it2) const
 
virtual bool itLessColBlock (const InternalColBlockIterator *it, const InternalColBlockIterator *it2) const
 
ColBlockConstIterator createColBlockConstIterator (Index row, void *internalPtr) const
 
ColBlockConstIterator createColBlockConstIterator (Index row, Index internalData) const
 
virtual void itCopyRowBlock (InternalRowBlockIterator *) const
 
virtual void itDeleteRowBlock (const InternalRowBlockIterator *) const
 
virtual Index itAccessRowBlock (InternalRowBlockIterator *it) const
 
virtual ColBlockConstIterator itBeginRowBlock (InternalRowBlockIterator *it) const
 
virtual ColBlockConstIterator itEndRowBlock (InternalRowBlockIterator *it) const
 
virtual std::pair< ColBlockConstIterator, ColBlockConstIteratoritRangeRowBlock (InternalRowBlockIterator *it) const
 
virtual void itIncRowBlock (InternalRowBlockIterator *it) const
 
virtual void itDecRowBlock (InternalRowBlockIterator *it) const
 
virtual bool itEqRowBlock (const InternalRowBlockIterator *it, const InternalRowBlockIterator *it2) const
 
virtual bool itLessRowBlock (const InternalRowBlockIterator *it, const InternalRowBlockIterator *it2) const
 
RowBlockConstIterator createRowBlockConstIterator (void *internalPtr) const
 
RowBlockConstIterator createRowBlockConstIterator (Index internalData0, Index internalData1) const
 
- 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<std::size_t N, typename T>
Index sofa::component::linearsolver::BTDMatrix< N, T >::allocsize
protected
template<std::size_t N, typename T>
Bloc* sofa::component::linearsolver::BTDMatrix< N, T >::data
protected
template<std::size_t N, typename T>
Index sofa::component::linearsolver::BTDMatrix< N, T >::nBCol
protected
template<std::size_t N, typename T>
Index sofa::component::linearsolver::BTDMatrix< N, T >::nBRow
protected
template<std::size_t N, typename T>
Index sofa::component::linearsolver::BTDMatrix< N, T >::nTCol
protected
template<std::size_t N, typename T>
Index sofa::component::linearsolver::BTDMatrix< N, T >::nTRow
protected

Constructor details

template<std::size_t N, typename T >
sofa::component::linearsolver::BTDMatrix< N, T >::BTDMatrix ( )
template<std::size_t N, typename T >
sofa::component::linearsolver::BTDMatrix< N, T >::BTDMatrix ( Index  nbRow,
Index  nbCol 
)
template<std::size_t N, typename T >
sofa::component::linearsolver::BTDMatrix< N, T >::~BTDMatrix ( )
override

Function details

template<std::size_t N, typename T >
void sofa::component::linearsolver::BTDMatrix< N, T >::add ( Index  i,
Index  j,
double  v 
)
overridevirtual

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

Implements sofa::defaulttype::BaseMatrix.

template<std::size_t N, typename T >
const BTDMatrix< N, T >::Bloc & sofa::component::linearsolver::BTDMatrix< N, T >::asub ( Index  bi,
Index  bj,
Index  ,
Index   
) const
template<std::size_t N, typename T >
BTDMatrix< N, T >::Bloc & sofa::component::linearsolver::BTDMatrix< N, T >::asub ( Index  bi,
Index  bj,
Index  ,
Index   
)
template<std::size_t N, typename T >
const BTDMatrix< N, T >::Bloc & sofa::component::linearsolver::BTDMatrix< N, T >::bloc ( Index  bi,
Index  bj 
) const
template<std::size_t N, typename T >
BTDMatrix< N, T >::Bloc & sofa::component::linearsolver::BTDMatrix< N, T >::bloc ( Index  bi,
Index  bj 
)
template<std::size_t N, typename T >
void sofa::component::linearsolver::BTDMatrix< N, T >::clear ( Index  i,
Index  j 
)
overridevirtual

Reimplemented from sofa::defaulttype::BaseMatrix.

template<std::size_t N, typename T >
void sofa::component::linearsolver::BTDMatrix< N, T >::clear ( )
overridevirtual

Reset all values to 0.

Implements sofa::defaulttype::BaseMatrix.

template<std::size_t N, typename T >
void sofa::component::linearsolver::BTDMatrix< N, T >::clearCol ( Index  j)
overridevirtual

Reset the all values in column j to 0.

Reimplemented from sofa::defaulttype::BaseMatrix.

template<std::size_t N, typename T >
void sofa::component::linearsolver::BTDMatrix< N, T >::clearRow ( Index  i)
overridevirtual

Reset all the values in row i to 0.

Reimplemented from sofa::defaulttype::BaseMatrix.

template<std::size_t N, typename T >
void sofa::component::linearsolver::BTDMatrix< N, T >::clearRowCol ( Index  i)
overridevirtual

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

Reimplemented from sofa::defaulttype::BaseMatrix.

template<std::size_t N, typename T >
BTDMatrix< N, T >::Index sofa::component::linearsolver::BTDMatrix< N, T >::colSize ( void  ) const
overridevirtual

Number of columns.

Implements sofa::defaulttype::BaseMatrix.

template<std::size_t N, typename T >
SReal sofa::component::linearsolver::BTDMatrix< N, T >::element ( Index  i,
Index  j 
) const
overridevirtual

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

Implements sofa::defaulttype::BaseMatrix.

template<std::size_t N, typename T >
template<class B >
void sofa::component::linearsolver::BTDMatrix< N, T >::getAlignedSubMatrix ( Index  bi,
Index  bj,
Index  nrow,
Index  ncol,
B &  m 
)
template<std::size_t N, typename T >
template<class B >
void sofa::component::linearsolver::BTDMatrix< N, T >::getSubMatrix ( Index  i,
Index  j,
Index  nrow,
Index  ncol,
B &  m 
)
template<std::size_t N, typename T>
static Index sofa::component::linearsolver::BTDMatrix< N, T >::getSubMatrixDim ( Index  )
inlinestatic
template<std::size_t N, typename T>
static const char* sofa::component::linearsolver::BTDMatrix< N, T >::Name ( )
static
template<>
const char * sofa::component::linearsolver::BTDMatrix< 1, double >::Name ( )
template<>
const char * sofa::component::linearsolver::BTDMatrix< 2, double >::Name ( )
template<>
const char * sofa::component::linearsolver::BTDMatrix< 3, double >::Name ( )
template<>
const char * sofa::component::linearsolver::BTDMatrix< 4, double >::Name ( )
template<>
const char * sofa::component::linearsolver::BTDMatrix< 5, double >::Name ( )
template<>
const char * sofa::component::linearsolver::BTDMatrix< 6, double >::Name ( )
template<std::size_t N, typename T>
template<class Real2 >
FullVector<Real2> sofa::component::linearsolver::BTDMatrix< N, T >::operator* ( const FullVector< Real2 > &  v) const
inline
template<std::size_t N, typename T>
Bloc* sofa::component::linearsolver::BTDMatrix< N, T >::ptr ( )
inline
template<std::size_t N, typename T>
const Bloc* sofa::component::linearsolver::BTDMatrix< N, T >::ptr ( ) const
inline
template<std::size_t N, typename T >
void sofa::component::linearsolver::BTDMatrix< N, T >::resize ( Index  nbRow,
Index  nbCol 
)
overridevirtual

Resize the matrix and reset all values to 0.

Implements sofa::defaulttype::BaseMatrix.

template<std::size_t N, typename T >
BTDMatrix< N, T >::Index sofa::component::linearsolver::BTDMatrix< N, T >::rowSize ( void  ) const
overridevirtual

Number of rows.

Implements sofa::defaulttype::BaseMatrix.

template<std::size_t N, typename T >
void sofa::component::linearsolver::BTDMatrix< N, T >::set ( Index  i,
Index  j,
double  v 
)
overridevirtual

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

Implements sofa::defaulttype::BaseMatrix.

template<std::size_t N, typename T >
template<class B >
void sofa::component::linearsolver::BTDMatrix< N, T >::setAlignedSubMatrix ( Index  bi,
Index  bj,
Index  nrow,
Index  ncol,
const B &  m 
)
template<std::size_t N, typename T >
template<class B >
void sofa::component::linearsolver::BTDMatrix< N, T >::setSubMatrix ( Index  i,
Index  j,
Index  nrow,
Index  ncol,
const B &  m 
)
template<std::size_t N, typename T >
const BTDMatrix< N, T >::Bloc & sofa::component::linearsolver::BTDMatrix< N, T >::sub ( Index  i,
Index  j,
Index  ,
Index   
) const
template<std::size_t N, typename T >
BTDMatrix< N, T >::Bloc & sofa::component::linearsolver::BTDMatrix< N, T >::sub ( Index  i,
Index  j,
Index  ,
Index   
)

Enum details

template<std::size_t N, typename T>
anonymous enum
Enumerator
BSIZE