DynamicSparseMatrix< _Scalar, _Options, _Index > Class Template Reference

A sparse matrix class designed for matrix assembly purpose. More...

#include <DynamicSparseMatrix.h>

Public Types

enum  { Options }
 
typedef MappedSparseMatrix< Scalar, FlagsMap
 

Public Member Functions

std::vector< internal::CompressedStorage< Scalar, Index > > & _data ()
 
const std::vector< internal::CompressedStorage< Scalar, Index > > & _data () const
 
Scalar coeff (Index row, Index col) const
 
Scalar & coeffRef (Index row, Index col)
 
Index cols () const
 
EIGEN_DEPRECATED DynamicSparseMatrix ()
 
 DynamicSparseMatrix (const DynamicSparseMatrix &other)
 
template<typename OtherDerived>
EIGEN_DEPRECATED DynamicSparseMatrix (const SparseMatrixBase< OtherDerived > &other)
 
EIGEN_DEPRECATED DynamicSparseMatrix (Index rows, Index cols)
 
EIGEN_DEPRECATED void endFill ()
 
EIGEN_DEPRECATED Scalar & fill (Index row, Index col)
 
EIGEN_DEPRECATED Scalar & fillrand (Index row, Index col)
 
void finalize ()
 
Index innerNonZeros (Index j) const
 
Index innerSize () const
 
Scalar & insert (Index row, Index col)
 
Scalar & insertBack (Index row, Index col)
 
Scalar & insertBackByOuterInner (Index outer, Index inner)
 
Index nonZeros () const
 
DynamicSparseMatrixoperator= (const DynamicSparseMatrix &other)
 
Index outerSize () const
 
void prune (Scalar reference, RealScalar epsilon=NumTraits< RealScalar >::dummy_precision())
 
void reserve (Index reserveSize=1000)
 
void resize (Index rows, Index cols)
 
void resizeAndKeepData (Index rows, Index cols)
 
Index rows () const
 
void setZero ()
 
EIGEN_DEPRECATED void startFill (Index reserveSize=1000)
 
void startVec (Index)
 
void swap (DynamicSparseMatrix &other)
 
 ~DynamicSparseMatrix ()
 
- Public Member Functions inherited from SparseMatrixBase< DynamicSparseMatrix< _Scalar, _Options, _Index > >
const CwiseBinaryOp< CustomBinaryOp, const Derived, const OtherDerived > binaryExpr (const Eigen::SparseMatrixBase< OtherDerived > &other, const CustomBinaryOp &func=CustomBinaryOp()) const
 
internal::cast_return_type< Derived, constCwiseUnaryOp< internal::scalar_cast_op< typenameinternal::traits< Derived >::Scalar, NewType >, constDerived > >::type cast () const
 
SparseInnerVectorSet< Derived, 1 > col (Index j)
 
const SparseInnerVectorSet< Derived, 1 > col (Index j) const
 
Index cols () const
 
ConjugateReturnType conjugate () const
 
const CwiseUnaryOp< internal::scalar_abs_op< Scalar >, const Derived > cwiseAbs () const
 
const CwiseUnaryOp< internal::scalar_abs2_op< Scalar >, const Derived > cwiseAbs2 () const
 
const CwiseUnaryOp< std::binder1st< std::equal_to< Scalar > >, const Derived > cwiseEqual (const Scalar &s) const
 
const CwiseUnaryOp< internal::scalar_inverse_op< Scalar >, const Derived > cwiseInverse () const
 
const CwiseUnaryOp< internal::scalar_sqrt_op< Scalar >, const Derived > cwiseSqrt () const
 
Derived & derived ()
 
const Derived & derived () const
 
const EIGEN_CWISE_PRODUCT_RETURN_TYPE (Derived, OtherDerived) cwiseProduct(const Eigen
 
const internal::eval< Derived >::type eval () const
 
NonConstImagReturnType imag ()
 
const ImagReturnType imag () const
 
SparseInnerVectorSet< Derived, 1 > innerVector (Index outer)
 
const SparseInnerVectorSet< Derived, 1 > innerVector (Index outer) const
 
SparseInnerVectorSet< Derived, Dynamic > innerVectors (Index outerStart, Index outerSize)
 
const SparseInnerVectorSet< Derived, Dynamic > innerVectors (Index outerStart, Index outerSize) const
 
SparseInnerVectorSet< Derived, Dynamic > middleCols (Index start, Index size)
 
const SparseInnerVectorSet< Derived, Dynamic > middleCols (Index start, Index size) const
 
SparseInnerVectorSet< Derived, Dynamic > middleRows (Index start, Index size)
 
const SparseInnerVectorSet< Derived, Dynamic > middleRows (Index start, Index size) const
 
const SparseDenseProductReturnType< Derived, OtherDerived >::Type operator* (const MatrixBase< OtherDerived > &other) const
 
const ScalarMultipleReturnType operator* (const Scalar &scalar) const
 
const SparseSparseProductReturnType< Derived, OtherDerived >::Type operator* (const SparseMatrixBase< OtherDerived > &other) const
 
const CwiseUnaryOp< internal::scalar_multiple2_op< Scalar, std::complex< Scalar > >, const Derived > operator* (const std::complex< Scalar > &scalar) const
 
const CwiseUnaryOp< internal::scalar_opposite_op< typename internal::traits< Derived >::Scalar >, const Derived > operator- () const
 
const CwiseUnaryOp< internal::scalar_quotient1_op< typename internal::traits< Derived >::Scalar >, const Derived > operator/ (const Scalar &scalar) const
 
NonConstRealReturnType real ()
 
RealReturnType real () const
 
SparseInnerVectorSet< Derived, 1 > row (Index i)
 
const SparseInnerVectorSet< Derived, 1 > row (Index i) const
 
Index rows () const
 
Index size () const
 
SparseSymmetricPermutationProduct< Derived, Upper|LowertwistedBy (const PermutationMatrix< Dynamic, Dynamic, Index > &perm) const
 
const CwiseUnaryOp< CustomUnaryOp, const Derived > unaryExpr (const CustomUnaryOp &func=CustomUnaryOp()) const
 
const CwiseUnaryView< CustomViewOp, const Derived > unaryViewExpr (const CustomViewOp &func=CustomViewOp()) const
 
- Public Member Functions inherited from EigenBase< Derived >
Index cols () const
 
Derived & derived ()
 
const Derived & derived () const
 
Index rows () const
 
Index size () const
 

Protected Types

typedef DynamicSparseMatrix< Scalar,(Flags &~RowMajorBit)|(IsRowMajor?RowMajorBit:0)> TransposedSparseMatrix
 

Protected Attributes

std::vector< internal::CompressedStorage< Scalar, Index > > m_data
 
Index m_innerSize
 

Additional Inherited Members

- Public Attributes inherited from SparseMatrixBase< DynamicSparseMatrix< _Scalar, _Options, _Index > >
 CoeffReadCost
 
 ColsAtCompileTime
 
 Flags
 
 IsVectorAtCompileTime
 
 RowsAtCompileTime
 
 SizeAtCompileTime
 

Detailed Description

template<typename _Scalar, int _Options, typename _Index>
class Eigen::DynamicSparseMatrix< _Scalar, _Options, _Index >

A sparse matrix class designed for matrix assembly purpose.

Parameters
_Scalarthe scalar type, i.e. the type of the coefficients

Unlike SparseMatrix, this class provides a much higher degree of flexibility. In particular, it allows random read/write accesses in log(rho*outer_size) where rho is the probability that a coefficient is nonzero and outer_size is the number of columns if the matrix is column-major and the number of rows otherwise.

Internally, the data are stored as a std::vector of compressed vector. The performances of random writes might decrease as the number of nonzeros per inner-vector increase. In practice, we observed very good performance till about 100 nonzeros/vector, and the performance remains relatively good till 500 nonzeros/vectors.

See also
SparseMatrix

Constructor & Destructor Documentation

◆ DynamicSparseMatrix() [1/3]

template<typename _Scalar, int _Options, typename _Index>
EIGEN_DEPRECATED DynamicSparseMatrix ( )
inline

The class DynamicSparseMatrix is deprectaed

◆ DynamicSparseMatrix() [2/3]

template<typename _Scalar, int _Options, typename _Index>
EIGEN_DEPRECATED DynamicSparseMatrix ( Index rows,
Index cols )
inline

The class DynamicSparseMatrix is deprectaed

◆ DynamicSparseMatrix() [3/3]

template<typename _Scalar, int _Options, typename _Index>
template<typename OtherDerived>
EIGEN_DEPRECATED DynamicSparseMatrix ( const SparseMatrixBase< OtherDerived > & other)
inlineexplicit

The class DynamicSparseMatrix is deprectaed

◆ ~DynamicSparseMatrix()

template<typename _Scalar, int _Options, typename _Index>
~DynamicSparseMatrix ( )
inline

Destructor

Member Function Documentation

◆ coeff()

template<typename _Scalar, int _Options, typename _Index>
Scalar coeff ( Index row,
Index col ) const
inline
Returns
the coefficient value at given position row, col This operation involes a log(rho*outer_size) binary search.

◆ coeffRef()

template<typename _Scalar, int _Options, typename _Index>
Scalar & coeffRef ( Index row,
Index col )
inline
Returns
a reference to the coefficient value at given position row, col This operation involes a log(rho*outer_size) binary search. If the coefficient does not exist yet, then a sorted insertion into a sequential buffer is performed.

◆ endFill()

template<typename _Scalar, int _Options, typename _Index>
EIGEN_DEPRECATED void endFill ( )
inline

◆ fill()

template<typename _Scalar, int _Options, typename _Index>
EIGEN_DEPRECATED Scalar & fill ( Index row,
Index col )
inline

◆ fillrand()

template<typename _Scalar, int _Options, typename _Index>
EIGEN_DEPRECATED Scalar & fillrand ( Index row,
Index col )
inline

◆ finalize()

template<typename _Scalar, int _Options, typename _Index>
void finalize ( )
inline

Does nothing: provided for compatibility with SparseMatrix

◆ insertBack()

template<typename _Scalar, int _Options, typename _Index>
Scalar & insertBack ( Index row,
Index col )
inline
Returns
a reference to the non zero coefficient at position row, col assuming that:
  • the nonzero does not already exist
  • the new coefficient is the last one of the given inner vector.
See also
insert, insertBackByOuterInner

Referenced by DynamicSparseMatrix< Scalar,(Flags &~RowMajorBit)|(IsRowMajor?RowMajorBit:0)>::fill().

◆ insertBackByOuterInner()

template<typename _Scalar, int _Options, typename _Index>
Scalar & insertBackByOuterInner ( Index outer,
Index inner )
inline

◆ nonZeros()

template<typename _Scalar, int _Options, typename _Index>
Index nonZeros ( ) const
inline
Returns
the number of non zero coefficients

◆ prune()

template<typename _Scalar, int _Options, typename _Index>
void prune ( Scalar reference,
RealScalar epsilon = NumTraits<RealScalar>::dummy_precision() )
inline

Suppress all nonzeros which are smaller than reference under the tolerence epsilon

Referenced by DynamicSparseMatrix< Scalar,(Flags &~RowMajorBit)|(IsRowMajor?RowMajorBit:0)>::prune().

◆ resize()

template<typename _Scalar, int _Options, typename _Index>
void resize ( Index rows,
Index cols )
inline

Resize the matrix without preserving the data (the matrix is set to zero)

Referenced by DynamicSparseMatrix< Scalar,(Flags &~RowMajorBit)|(IsRowMajor?RowMajorBit:0)>::DynamicSparseMatrix().

◆ startFill()

template<typename _Scalar, int _Options, typename _Index>
EIGEN_DEPRECATED void startFill ( Index reserveSize = 1000)
inline

◆ startVec()

template<typename _Scalar, int _Options, typename _Index>
void startVec ( Index )
inline

Does nothing: provided for compatibility with SparseMatrix


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