Public Types | Public Member Functions | Protected Types | Protected Attributes | List of all members
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, Flags
Map
 

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 ()
 
EIGEN_DEPRECATED DynamicSparseMatrix (Index rows, Index cols)
 
template<typename OtherDerived >
EIGEN_DEPRECATED DynamicSparseMatrix (const SparseMatrixBase< OtherDerived > &other)
 
 DynamicSparseMatrix (const DynamicSparseMatrix &other)
 
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
DynamicSparseMatrix< _Scalar,
_Options, _Index >, const
OtherDerived > 
binaryExpr (const Eigen::SparseMatrixBase< OtherDerived > &other, const CustomBinaryOp &func=CustomBinaryOp()) const
 
internal::cast_return_type
< DynamicSparseMatrix< _Scalar,
_Options, _Index >, const
CwiseUnaryOp
< internal::scalar_cast_op
< typename internal::traits
< DynamicSparseMatrix< _Scalar,
_Options, _Index > >::Scalar,
NewType >, const
DynamicSparseMatrix< _Scalar,
_Options, _Index > > >::type 
cast () const
 
const SparseInnerVectorSet
< DynamicSparseMatrix< _Scalar,
_Options, _Index >, 1 > 
col (Index j) const
 
SparseInnerVectorSet
< DynamicSparseMatrix< _Scalar,
_Options, _Index >, 1 > 
col (Index j)
 
Index cols () const
 
ConjugateReturnType conjugate () const
 
const CwiseUnaryOp
< internal::scalar_abs_op
< Scalar >, const
DynamicSparseMatrix< _Scalar,
_Options, _Index > > 
cwiseAbs () const
 
const CwiseUnaryOp
< internal::scalar_abs2_op
< Scalar >, const
DynamicSparseMatrix< _Scalar,
_Options, _Index > > 
cwiseAbs2 () const
 
const CwiseUnaryOp
< std::binder1st
< std::equal_to< Scalar >
>, const DynamicSparseMatrix
< _Scalar, _Options, _Index > > 
cwiseEqual (const Scalar &s) const
 
const CwiseUnaryOp
< internal::scalar_inverse_op
< Scalar >, const
DynamicSparseMatrix< _Scalar,
_Options, _Index > > 
cwiseInverse () const
 
const CwiseBinaryOp
< internal::scalar_max_op
< Scalar >, const
DynamicSparseMatrix< _Scalar,
_Options, _Index >, const
OtherDerived > 
cwiseMax (const Eigen::SparseMatrixBase< OtherDerived > &other) const
 
const CwiseBinaryOp
< internal::scalar_max_op
< Scalar >, const
DynamicSparseMatrix< _Scalar,
_Options, _Index >, const
ConstantReturnType > 
cwiseMax (const Scalar &other) const
 
const CwiseBinaryOp
< internal::scalar_min_op
< Scalar >, const
DynamicSparseMatrix< _Scalar,
_Options, _Index >, const
OtherDerived > 
cwiseMin (const Eigen::SparseMatrixBase< OtherDerived > &other) const
 
const CwiseBinaryOp
< internal::scalar_min_op
< Scalar >, const
DynamicSparseMatrix< _Scalar,
_Options, _Index >, const
ConstantReturnType > 
cwiseMin (const Scalar &other) const
 
const CwiseBinaryOp
< std::not_equal_to< Scalar >
, const DynamicSparseMatrix
< _Scalar, _Options, _Index >
, const OtherDerived > 
cwiseNotEqual (const Eigen::SparseMatrixBase< OtherDerived > &other) const
 
const CwiseBinaryOp
< internal::scalar_quotient_op
< Scalar >, const
DynamicSparseMatrix< _Scalar,
_Options, _Index >, const
OtherDerived > 
cwiseQuotient (const Eigen::SparseMatrixBase< OtherDerived > &other) const
 
const CwiseUnaryOp
< internal::scalar_sqrt_op
< Scalar >, const
DynamicSparseMatrix< _Scalar,
_Options, _Index > > 
cwiseSqrt () const
 
const internal::eval
< DynamicSparseMatrix< _Scalar,
_Options, _Index > >::type 
eval () const
 
const ImagReturnType imag () const
 
NonConstImagReturnType imag ()
 
Index innerSize () const
 
SparseInnerVectorSet
< DynamicSparseMatrix< _Scalar,
_Options, _Index >, 1 > 
innerVector (Index outer)
 
const SparseInnerVectorSet
< DynamicSparseMatrix< _Scalar,
_Options, _Index >, 1 > 
innerVector (Index outer) const
 
SparseInnerVectorSet
< DynamicSparseMatrix< _Scalar,
_Options, _Index >, Dynamic > 
innerVectors (Index outerStart, Index outerSize)
 
const SparseInnerVectorSet
< DynamicSparseMatrix< _Scalar,
_Options, _Index >, Dynamic > 
innerVectors (Index outerStart, Index outerSize) const
 
bool isVector () const
 
SparseInnerVectorSet
< DynamicSparseMatrix< _Scalar,
_Options, _Index >, Dynamic > 
middleCols (Index start, Index size)
 
const SparseInnerVectorSet
< DynamicSparseMatrix< _Scalar,
_Options, _Index >, Dynamic > 
middleCols (Index start, Index size) const
 
SparseInnerVectorSet
< DynamicSparseMatrix< _Scalar,
_Options, _Index >, Dynamic > 
middleRows (Index start, Index size)
 
const SparseInnerVectorSet
< DynamicSparseMatrix< _Scalar,
_Options, _Index >, Dynamic > 
middleRows (Index start, Index size) const
 
Index nonZeros () const
 
const ScalarMultipleReturnType operator* (const Scalar &scalar) const
 
const CwiseUnaryOp
< internal::scalar_multiple2_op
< Scalar, std::complex< Scalar >
>, const DynamicSparseMatrix
< _Scalar, _Options, _Index > > 
operator* (const std::complex< Scalar > &scalar) const
 
const
SparseSparseProductReturnType
< DynamicSparseMatrix< _Scalar,
_Options, _Index >
, OtherDerived >::Type 
operator* (const SparseMatrixBase< OtherDerived > &other) const
 
const
SparseDenseProductReturnType
< DynamicSparseMatrix< _Scalar,
_Options, _Index >
, OtherDerived >::Type 
operator* (const MatrixBase< OtherDerived > &other) const
 
const CwiseUnaryOp
< internal::scalar_opposite_op
< typename internal::traits
< DynamicSparseMatrix< _Scalar,
_Options, _Index > >::Scalar >
, const DynamicSparseMatrix
< _Scalar, _Options, _Index > > 
operator- () const
 
const CwiseUnaryOp
< internal::scalar_quotient1_op
< typename internal::traits
< DynamicSparseMatrix< _Scalar,
_Options, _Index > >::Scalar >
, const DynamicSparseMatrix
< _Scalar, _Options, _Index > > 
operator/ (const Scalar &scalar) const
 
Index outerSize () const
 
NonConstRealReturnType real ()
 
RealReturnType real () const
 
SparseInnerVectorSet
< DynamicSparseMatrix< _Scalar,
_Options, _Index >, 1 > 
row (Index i)
 
const SparseInnerVectorSet
< DynamicSparseMatrix< _Scalar,
_Options, _Index >, 1 > 
row (Index i) const
 
Index rows () const
 
Index size () const
 
SparseSymmetricPermutationProduct
< DynamicSparseMatrix< _Scalar,
_Options, _Index >, Upper|Lower
twistedBy (const PermutationMatrix< Dynamic, Dynamic, Index > &perm) const
 
const CwiseUnaryOp
< CustomUnaryOp, const
DynamicSparseMatrix< _Scalar,
_Options, _Index > > 
unaryExpr (const CustomUnaryOp &func=CustomUnaryOp()) const
 
const CwiseUnaryView
< CustomViewOp, const
DynamicSparseMatrix< _Scalar,
_Options, _Index > > 
unaryViewExpr (const CustomViewOp &func=CustomViewOp()) 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
 

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

EIGEN_DEPRECATED DynamicSparseMatrix ( )
inline

The class DynamicSparseMatrix is deprectaed

EIGEN_DEPRECATED DynamicSparseMatrix ( Index  rows,
Index  cols 
)
inline
EIGEN_DEPRECATED DynamicSparseMatrix ( const SparseMatrixBase< OtherDerived > &  other)
inlineexplicit

The class DynamicSparseMatrix is deprectaed

~DynamicSparseMatrix ( )
inline

Destructor

Member Function Documentation

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.

References SparseMatrixBase< DynamicSparseMatrix< _Scalar, _Options, _Index > >::col(), and SparseMatrixBase< DynamicSparseMatrix< _Scalar, _Options, _Index > >::row().

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.

References SparseMatrixBase< DynamicSparseMatrix< _Scalar, _Options, _Index > >::col(), and SparseMatrixBase< DynamicSparseMatrix< _Scalar, _Options, _Index > >::row().

EIGEN_DEPRECATED void endFill ( )
inline
EIGEN_DEPRECATED Scalar& fill ( Index  row,
Index  col 
)
inline
EIGEN_DEPRECATED Scalar& fillrand ( Index  row,
Index  col 
)
inline
void finalize ( )
inline

Does nothing: provided for compatibility with SparseMatrix

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

References DynamicSparseMatrix< _Scalar, _Options, _Index >::insertBackByOuterInner().

Referenced by DynamicSparseMatrix< _Scalar, _Options, _Index >::fill().

Scalar& insertBackByOuterInner ( Index  outer,
Index  inner 
)
inline
Index nonZeros ( ) const
inline
Returns
the number of non zero coefficients

References SparseMatrixBase< DynamicSparseMatrix< _Scalar, _Options, _Index > >::size().

void prune ( Scalar  reference,
RealScalar  epsilon = NumTraits<RealScalar>::dummy_precision() 
)
inline

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

void resize ( Index  rows,
Index  cols 
)
inline

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

Referenced by DynamicSparseMatrix< _Scalar, _Options, _Index >::DynamicSparseMatrix().

EIGEN_DEPRECATED void startFill ( Index  reserveSize = 1000)
inline
void startVec ( Index  )
inline

Does nothing: provided for compatibility with SparseMatrix


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