Logo Search packages:      
Sourcecode: eigen3 version File versions  Download package

Classes | Public Types | Public Member Functions | Protected Types | Protected Attributes | Friends

DynamicSparseMatrix< _Scalar, _Options, _Index > Class Template Reference

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

#include <DynamicSparseMatrix.h>

Inheritance diagram for DynamicSparseMatrix< _Scalar, _Options, _Index >:
Inheritance graph
[legend]
Collaboration diagram for DynamicSparseMatrix< _Scalar, _Options, _Index >:
Collaboration graph
[legend]

List of all members.

Classes

class  InnerIterator

Public Types

enum  { Options = _Options }
enum  
typedef internal::conditional
< NumTraits< Scalar >
::IsComplex, CwiseUnaryOp
< internal::scalar_conjugate_op
< Scalar >, Eigen::Transpose
< const DynamicSparseMatrix
< _Scalar, _Options, _Index >
> >, Transpose< const
DynamicSparseMatrix< _Scalar,
_Options, _Index > > >::type 
AdjointReturnType
typedef EigenBase
< DynamicSparseMatrix< _Scalar,
_Options, _Index > > 
Base
typedef internal::conditional
< _HasDirectAccess, const
Scalar &, Scalar >::type 
CoeffReturnType
typedef internal::conditional
< NumTraits< Scalar >
::IsComplex, const
CwiseUnaryOp
< internal::scalar_conjugate_op
< Scalar >, const
DynamicSparseMatrix< _Scalar,
_Options, _Index > >, const
DynamicSparseMatrix< _Scalar,
_Options, _Index > & >::type 
ConjugateReturnType
typedef CwiseNullaryOp
< internal::scalar_constant_op
< Scalar >, Matrix< Scalar,
Dynamic, Dynamic > > 
ConstantReturnType
typedef CwiseUnaryOp
< internal::scalar_imag_op
< Scalar >, const
DynamicSparseMatrix< _Scalar,
_Options, _Index > > 
ImagReturnType
typedef internal::traits
< DynamicSparseMatrix< _Scalar,
_Options, _Index > >::Index 
Index
typedef MappedSparseMatrix
< Scalar, Flags > 
Map
typedef CwiseUnaryView
< internal::scalar_imag_ref_op
< Scalar >
, DynamicSparseMatrix< _Scalar,
_Options, _Index > > 
NonConstImagReturnType
typedef internal::conditional
< NumTraits< Scalar >
::IsComplex, CwiseUnaryView
< internal::scalar_real_ref_op
< Scalar >
, DynamicSparseMatrix< _Scalar,
_Options, _Index >
>, DynamicSparseMatrix
< _Scalar, _Options, _Index >
& >::type 
NonConstRealReturnType
typedef
internal::packet_traits
< Scalar >::type 
PacketScalar
typedef SparseMatrix< Scalar,
Flags &RowMajorBit?RowMajor:ColMajor > 
PlainObject
typedef internal::conditional
< NumTraits< Scalar >
::IsComplex, const
CwiseUnaryOp
< internal::scalar_real_op
< Scalar >, const
DynamicSparseMatrix< _Scalar,
_Options, _Index > >, const
DynamicSparseMatrix< _Scalar,
_Options, _Index > & >::type 
RealReturnType
typedef NumTraits< Scalar >::Real RealScalar
typedef internal::traits
< DynamicSparseMatrix< _Scalar,
_Options, _Index > >::Scalar 
Scalar
typedef CwiseUnaryOp
< internal::scalar_multiple_op
< Scalar >, const
DynamicSparseMatrix< _Scalar,
_Options, _Index > > 
ScalarMultipleReturnType
typedef CwiseUnaryOp
< internal::scalar_quotient1_op
< Scalar >, const
DynamicSparseMatrix< _Scalar,
_Options, _Index > > 
ScalarQuotient1ReturnType
typedef Matrix< Scalar,
EIGEN_SIZE_MAX(RowsAtCompileTime,
ColsAtCompileTime),
EIGEN_SIZE_MAX(RowsAtCompileTime,
ColsAtCompileTime)> 
SquareMatrixType
typedef SparseMatrixBase StorageBaseType
typedef internal::traits
< DynamicSparseMatrix< _Scalar,
_Options, _Index >
>::StorageKind 
StorageKind

Public Member Functions

std::vector< CompressedStorage
< Scalar, Index > > & 
_data ()
const std::vector
< CompressedStorage< Scalar,
Index > > & 
_data () const
void _experimentalNewProduct (const Lhs &lhs, const Rhs &rhs)
void addTo (Dest &dst) const
const AdjointReturnType adjoint () const
void applyThisOnTheLeft (Dest &dst) const
void applyThisOnTheRight (Dest &dst) const
void assignGeneric (const OtherDerived &other)
EIGEN_STRONG_INLINE const
CwiseBinaryOp< CustomBinaryOp,
const DynamicSparseMatrix
< _Scalar, _Options, _Index >
, const OtherDerived > 
binaryExpr (const EIGEN_CURRENT_STORAGE_BASE_CLASS< 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
Scalar coeff (Index row, Index col) const
Scalar & coeffRef (Index row, Index col)
SparseInnerVectorSet
< DynamicSparseMatrix< _Scalar,
_Options, _Index >, 1 > 
col (Index j)
const SparseInnerVectorSet
< DynamicSparseMatrix< _Scalar,
_Options, _Index >, 1 > 
col (Index j) const
Index cols () const
ConjugateReturnType conjugate () const
DynamicSparseMatrix< _Scalar,
_Options, _Index > & 
const_cast_derived () const
const DynamicSparseMatrix
< _Scalar, _Options, _Index > & 
const_derived () const
EIGEN_STRONG_INLINE const
CwiseUnaryOp
< internal::scalar_abs_op
< Scalar >, const
DynamicSparseMatrix< _Scalar,
_Options, _Index > > 
cwiseAbs () const
EIGEN_STRONG_INLINE const
CwiseUnaryOp
< internal::scalar_abs2_op
< Scalar >, const
DynamicSparseMatrix< _Scalar,
_Options, _Index > > 
cwiseAbs2 () const
const CwiseBinaryOp
< std::equal_to< Scalar >
, const DynamicSparseMatrix
< _Scalar, _Options, _Index >
, const OtherDerived > 
cwiseEqual (const EIGEN_CURRENT_STORAGE_BASE_CLASS< OtherDerived > &other) 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
EIGEN_STRONG_INLINE const
CwiseBinaryOp
< internal::scalar_max_op
< Scalar >, const
DynamicSparseMatrix< _Scalar,
_Options, _Index >, const
OtherDerived > 
cwiseMax (const EIGEN_CURRENT_STORAGE_BASE_CLASS< OtherDerived > &other) const
EIGEN_STRONG_INLINE const
CwiseBinaryOp
< internal::scalar_min_op
< Scalar >, const
DynamicSparseMatrix< _Scalar,
_Options, _Index >, const
OtherDerived > 
cwiseMin (const EIGEN_CURRENT_STORAGE_BASE_CLASS< OtherDerived > &other) const
const CwiseBinaryOp
< std::not_equal_to< Scalar >
, const DynamicSparseMatrix
< _Scalar, _Options, _Index >
, const OtherDerived > 
cwiseNotEqual (const EIGEN_CURRENT_STORAGE_BASE_CLASS< OtherDerived > &other) const
EIGEN_STRONG_INLINE const
EIGEN_SPARSE_CWISE_PRODUCT_RETURN_TYPE 
cwiseProduct (const MatrixBase< OtherDerived > &other) const
EIGEN_STRONG_INLINE const
CwiseBinaryOp
< internal::scalar_quotient_op
< Scalar >, const
DynamicSparseMatrix< _Scalar,
_Options, _Index >, const
OtherDerived > 
cwiseQuotient (const EIGEN_CURRENT_STORAGE_BASE_CLASS< OtherDerived > &other) const
const CwiseUnaryOp
< internal::scalar_sqrt_op
< Scalar >, const
DynamicSparseMatrix< _Scalar,
_Options, _Index > > 
cwiseSqrt () const
const DynamicSparseMatrix
< _Scalar, _Options, _Index > & 
derived () const
DynamicSparseMatrix< _Scalar,
_Options, _Index > & 
derived ()
Scalar dot (const MatrixBase< OtherDerived > &other) const
Scalar dot (const SparseMatrixBase< OtherDerived > &other) const
 DynamicSparseMatrix (Index rows, Index cols)
template<typename OtherDerived >
 DynamicSparseMatrix (const SparseMatrixBase< OtherDerived > &other)
 DynamicSparseMatrix (const DynamicSparseMatrix &other)
EIGEN_STRONG_INLINE const EIGEN_CWISE_PRODUCT_RETURN_TYPE (DynamicSparseMatrix< _Scalar, _Options, _Index >, OtherDerived) cwiseProduct(const EIGEN_CURRENT_STORAGE_BASE_CLASS< OtherDerived > &other) const
EIGEN_DEPRECATED void endFill ()
const internal::eval
< DynamicSparseMatrix< _Scalar,
_Options, _Index > >::type 
eval () const
void evalTo (Dest &dst) const
void evalTo (MatrixBase< DenseDerived > &dst) const
EIGEN_DEPRECATED Scalar & fill (Index row, Index col)
EIGEN_DEPRECATED Scalar & fillrand (Index row, Index col)
void finalize ()
const ImagReturnType imag () const
NonConstImagReturnType imag ()
Index innerNonZeros (Index j) const
Index innerSize () const
SparseInnerVectorSet
< DynamicSparseMatrix< _Scalar,
_Options, _Index >, 1 > 
innerVector (Index outer)
const SparseInnerVectorSet
< DynamicSparseMatrix< _Scalar,
_Options, _Index >, 1 > 
innerVector (Index outer) const
const SparseInnerVectorSet
< DynamicSparseMatrix< _Scalar,
_Options, _Index >, Dynamic > 
innerVectors (Index outerStart, Index outerSize) const
SparseInnerVectorSet
< DynamicSparseMatrix< _Scalar,
_Options, _Index >, Dynamic > 
innerVectors (Index outerStart, Index outerSize)
Scalar & insert (Index row, Index col)
Scalar & insertBack (Index row, Index col)
Scalar & insertBackByOuterInner (Index outer, Index inner)
bool isApprox (const MatrixBase< OtherDerived > &other, RealScalar prec=NumTraits< Scalar >::dummy_precision()) const
bool isApprox (const SparseMatrixBase< OtherDerived > &other, RealScalar prec=NumTraits< Scalar >::dummy_precision()) const
bool isRValue () const
bool isVector () const
DynamicSparseMatrix< _Scalar,
_Options, _Index > & 
markAsRValue ()
Index nonZeros () const
RealScalar norm () 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 SparseDiagonalProduct
< DynamicSparseMatrix< _Scalar,
_Options, _Index >
, OtherDerived > 
operator* (const DiagonalBase< OtherDerived > &other) const
const
SparseDenseProductReturnType
< DynamicSparseMatrix< _Scalar,
_Options, _Index >
, OtherDerived >::Type 
operator* (const MatrixBase< OtherDerived > &other) const
const ScalarMultipleReturnType operator* (const Scalar &scalar) const
DynamicSparseMatrix< _Scalar,
_Options, _Index > & 
operator*= (const Scalar &other)
DynamicSparseMatrix< _Scalar,
_Options, _Index > & 
operator*= (const SparseMatrixBase< OtherDerived > &other)
DynamicSparseMatrix< _Scalar,
_Options, _Index > & 
operator+= (const SparseMatrixBase< OtherDerived > &other)
const CwiseUnaryOp
< internal::scalar_opposite_op
< typename internal::traits
< DynamicSparseMatrix< _Scalar,
_Options, _Index > >::Scalar >
, const DynamicSparseMatrix
< _Scalar, _Options, _Index > > 
operator- () const
DynamicSparseMatrix< _Scalar,
_Options, _Index > & 
operator-= (const SparseMatrixBase< OtherDerived > &other)
const CwiseUnaryOp
< internal::scalar_quotient1_op
< typename internal::traits
< DynamicSparseMatrix< _Scalar,
_Options, _Index > >::Scalar >
, const DynamicSparseMatrix
< _Scalar, _Options, _Index > > 
operator/ (const Scalar &scalar) const
DynamicSparseMatrix< _Scalar,
_Options, _Index > & 
operator/= (const Scalar &other)
DynamicSparseMatrixoperator= (const DynamicSparseMatrix &other)
Index outerSize () const
void prune (Scalar reference, RealScalar epsilon=NumTraits< RealScalar >::dummy_precision())
NonConstRealReturnType real ()
RealReturnType real () const
void reserve (Index reserveSize=1000)
void resize (Index rows, Index cols)
void resizeAndKeepData (Index rows, Index cols)
SparseInnerVectorSet
< DynamicSparseMatrix< _Scalar,
_Options, _Index >, 1 > 
row (Index i)
const SparseInnerVectorSet
< DynamicSparseMatrix< _Scalar,
_Options, _Index >, 1 > 
row (Index i) const
Index rows () const
const SparseSelfAdjointView
< DynamicSparseMatrix< _Scalar,
_Options, _Index >, UpLo > 
selfadjointView () const
SparseSelfAdjointView
< DynamicSparseMatrix< _Scalar,
_Options, _Index >, UpLo > 
selfadjointView ()
void setZero ()
Index size () const
RealScalar squaredNorm () const
EIGEN_DEPRECATED void startFill (Index reserveSize=1000)
void startVec (Index)
SparseInnerVectorSet
< DynamicSparseMatrix< _Scalar,
_Options, _Index >, Dynamic > 
subcols (Index start, Index size)
const SparseInnerVectorSet
< DynamicSparseMatrix< _Scalar,
_Options, _Index >, Dynamic > 
subcols (Index start, Index size) const
SparseInnerVectorSet
< DynamicSparseMatrix< _Scalar,
_Options, _Index >, Dynamic > 
subrows (Index start, Index size)
const SparseInnerVectorSet
< DynamicSparseMatrix< _Scalar,
_Options, _Index >, Dynamic > 
subrows (Index start, Index size) const
void subTo (Dest &dst) const
Scalar sum () const
void swap (DynamicSparseMatrix &other)
Matrix< Scalar,
RowsAtCompileTime,
ColsAtCompileTime > 
toDense () const
const Transpose< const
DynamicSparseMatrix< _Scalar,
_Options, _Index > > 
transpose () const
Transpose< DynamicSparseMatrix
< _Scalar, _Options, _Index > > 
transpose ()
const SparseTriangularView
< DynamicSparseMatrix< _Scalar,
_Options, _Index >, Mode > 
triangularView () const
const CwiseUnaryOp
< CustomUnaryOp, const
DynamicSparseMatrix< _Scalar,
_Options, _Index > > 
unaryExpr (const CustomUnaryOp &func=CustomUnaryOp()) const
 Apply a unary operator coefficient-wise.
const CwiseUnaryView
< CustomViewOp, const
DynamicSparseMatrix< _Scalar,
_Options, _Index > > 
unaryViewExpr (const CustomViewOp &func=CustomViewOp()) const
 ~DynamicSparseMatrix ()

Protected Types

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

Protected Attributes

std::vector< CompressedStorage
< Scalar, Index > > 
m_data
Index m_innerSize
bool m_isRValue

Friends

const ScalarMultipleReturnType operator* (const Scalar &scalar, const StorageBaseType &matrix)
const CwiseUnaryOp
< internal::scalar_multiple2_op
< Scalar, std::complex< Scalar >
>, const DynamicSparseMatrix
< _Scalar, _Options, _Index > > 
operator* (const std::complex< Scalar > &scalar, const StorageBaseType &matrix)
const
DenseSparseProductReturnType
< OtherDerived,
DynamicSparseMatrix< _Scalar,
_Options, _Index > >::Type 
operator* (const MatrixBase< OtherDerived > &lhs, const DynamicSparseMatrix< _Scalar, _Options, _Index > &rhs)
const SparseDiagonalProduct
< OtherDerived,
DynamicSparseMatrix< _Scalar,
_Options, _Index > > 
operator* (const DiagonalBase< OtherDerived > &lhs, const SparseMatrixBase &rhs)
std::ostream & operator<< (std::ostream &s, const SparseMatrixBase &m)

Detailed Description

template<typename _Scalar, int _Options, typename _Index>
class 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

Definition at line 67 of file DynamicSparseMatrix.h.


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

Generated by  Doxygen 1.6.0   Back to index