G+Smo  24.08.0
Geometry + Simulation Modules
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gsSparseMatrix< T, _Options, _Index > Class Template Reference

Detailed Description

template<typename T, int _Options, typename _Index>
class gismo::gsSparseMatrix< T, _Options, _Index >

Sparse matrix class, based on gsEigen::SparseMatrix.

Forward declaration gsSparseMatrix.

See http://eigen.tuxfamily.org/dox/group__SparseQuickRefPage.html for Eigen's sparse matrix manipulations and http://eigen.tuxfamily.org/dox/classEigen_1_1SparseMatrix.html for documentation of the gsEigen::SparseMatrix class.

Remarks:

An entry of the gsSparseMatrix can be accessed by coeff( index row, index col ) or just with the operator ( index row, index col ).
An entry can be changed with either coeffRef( index row, index col) or operator ( index row, index col ).

Template Parameters
Tcoefficient type
_Optionzero is ColMajor order.
_Indexindex type

Inherits SparseMatrix< T, _Options, _Index >.

Public Types

typedef
gsEigen::SparseSelfAdjointView
< const Base, Lower > 
constFullView
 
typedef
gsEigen::SparseSelfAdjointView
< Base, Lower > 
fullView
 
typedef memory::shared_ptr
< gsSparseMatrix
Ptr
 Shared pointer for gsSparseMatrix.
 
typedef memory::unique_ptr
< gsSparseMatrix
uPtr
 Unique pointer for gsSparseMatrix.
 

Public Member Functions

void addTo (_Index i, _Index j, const T val)
 
iterator begin (const index_t outer) const
 Returns an iterator to the first non-zero elemenent of column \ a outer (or row outer if the matrix is RowMajor)
 
BlockView blockView (const gsVector< index_t > &rowSizes, const gsVector< index_t > &colSizes)
 Return a block view of the matrix with rowSizes and colSizes.
 
constBlockView blockView (const gsVector< index_t > &rowSizes, const gsVector< index_t > &colSizes) const
 Return a const block view of the matrix with rowSizes and colSizes.
 
template<typename OtherDerived >
 gsSparseMatrix (const gsEigen::EigenBase< OtherDerived > &other)
 This constructor allows constructing a gsSparseMatrix from Eigen expressions.
 
template<typename OtherDerived , unsigned int UpLo>
 gsSparseMatrix (const gsEigen::SparseSelfAdjointView< OtherDerived, UpLo > &other)
 This constructor allows constructing a gsSparseMatrix from a selfadjoint view.
 
template<typename OtherDerived >
 gsSparseMatrix (const gsEigen::MatrixBase< OtherDerived > &other)
 This constructor allows constructing a gsSparseMatrix from Eigen expressions.
 
template<typename OtherDerived >
 gsSparseMatrix (const gsEigen::SparseMatrixBase< OtherDerived > &other)
 This constructor allows constructing a gsSparseMatrix from another sparse expression.
 
template<typename OtherDerived >
 gsSparseMatrix (const gsEigen::ReturnByValue< OtherDerived > &other)
 This constructor allows constructing a gsSparseMatrix from Eigen expressions.
 
template<class container >
container innerOf (const container &outer) const
 
void insertTo (_Index i, _Index j, const T val)
 
gsSparseMatrix kron (const gsSparseMatrix &other) const
 Returns the Kronecker product of this with other.
 
uPtr moveToPtr ()
 This function returns a smart pointer to the matrix. After calling it, the matrix object becomes empty, ie the size of the matrix is 0.
 
template<class container >
gsMatrix< T > multiplyBy (const container &inner, const container &outer, const gsMatrix< T > &other)
 
gsAsConstVector< _Index > nonZerosPerCol ()
 
template<class container >
gsMatrix< T > submatrix (const container &inner, const container &outer) const
 

Member Typedef Documentation

typedef gsEigen::SparseSelfAdjointView<const Base, Lower> constFullView

Type of the full view of the matrix, for the case when only the lower diagonal part is stored

typedef gsEigen::SparseSelfAdjointView<Base, Lower> fullView

Type of the full view of the matrix, for the case when only the lower diagonal part is stored

Member Function Documentation

void addTo ( _Index  i,
_Index  j,
const T  val 
)
inline

Add to entry (i, j) the value val, but not an explicit zero

container innerOf ( const container &  outer) const
inline

Returns a set of (inner) indices, which consists of all rows/columns of the matrix with non-zero coefficients at columns/rows outer

void insertTo ( _Index  i,
_Index  j,
const T  val 
)
inline

Insert to entry (i, j) the value val, but not an explicit zero

gsMatrix<T> multiplyBy ( const container &  inner,
const container &  outer,
const gsMatrix< T > &  other 
)
inline

Returns the result of multiplication of this and other, where other has rows/columns indexed by inner and outer

gsAsConstVector<_Index> nonZerosPerCol ( )
inline

Returns a pointer wrapped as a gsAsConstVector, which contains the number of non-zero entries per column. Note that the matrix must be uncompressed format for this to work

gsMatrix<T> submatrix ( const container &  inner,
const container &  outer 
) const
inline

Returns the submatrix consisting of the rows and columns indexed by the vector containers inner and outer