Main MRPT website > C++ reference
MRPT logo
Classes | Public Types | Public Member Functions | Protected Types | Protected Attributes
Eigen::DynamicSparseMatrix Class Reference

Detailed Description

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
Inheritance diagram for Eigen::DynamicSparseMatrix:
Inheritance graph
[legend]

List of all members.

Classes

class  InnerIterator

Public Types

enum  { Options = _Options }
typedef MappedSparseMatrix
< Scalar, Flags > 
Map

Public Member Functions

Index rows () const
Index cols () const
Index innerSize () const
Index outerSize () const
Index innerNonZeros (Index j) const
std::vector< CompressedStorage
< Scalar, Index > > & 
_data ()
const std::vector
< CompressedStorage< Scalar,
Index > > & 
_data () const
Scalar coeff (Index row, Index col) const
Scalar & coeffRef (Index row, Index col)
void setZero ()
Index nonZeros () const
void reserve (Index reserveSize=1000)
void startVec (Index)
 Does nothing: provided for compatibility with SparseMatrix.
Scalar & insertBack (Index row, Index col)
Scalar & insertBackByOuterInner (Index outer, Index inner)
Scalar & insert (Index row, Index col)
void finalize ()
 Does nothing: provided for compatibility with SparseMatrix.
void prune (Scalar reference, RealScalar epsilon=NumTraits< RealScalar >::dummy_precision())
 Suppress all nonzeros which are smaller than reference under the tolerence epsilon.
void resize (Index rows, Index cols)
 Resize the matrix without preserving the data (the matrix is set to zero)
void resizeAndKeepData (Index rows, Index cols)
 DynamicSparseMatrix ()
 DynamicSparseMatrix (Index rows, Index cols)
template<typename OtherDerived >
 DynamicSparseMatrix (const SparseMatrixBase< OtherDerived > &other)
 DynamicSparseMatrix (const DynamicSparseMatrix &other)
void swap (DynamicSparseMatrix &other)
DynamicSparseMatrix & operator= (const DynamicSparseMatrix &other)
 ~DynamicSparseMatrix ()
 Destructor.
EIGEN_DEPRECATED void startFill (Index reserveSize=1000)
EIGEN_DEPRECATED Scalar & fill (Index row, Index col)
EIGEN_DEPRECATED Scalar & fillrand (Index row, Index col)
EIGEN_DEPRECATED void endFill ()

Protected Types

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

Protected Attributes

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

Member Typedef Documentation

Definition at line 76 of file Sparse.

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

Definition at line 85 of file Sparse.


Member Enumeration Documentation

anonymous enum
Enumerator:
Options 

Definition at line 79 of file Sparse.


Constructor & Destructor Documentation

Eigen::DynamicSparseMatrix::DynamicSparseMatrix ( ) [inline]

Definition at line 236 of file Sparse.

Eigen::DynamicSparseMatrix::DynamicSparseMatrix ( Index  rows,
Index  cols 
) [inline]

Definition at line 242 of file Sparse.

template<typename OtherDerived >
Eigen::DynamicSparseMatrix::DynamicSparseMatrix ( const SparseMatrixBase< OtherDerived > &  other) [inline, explicit]

Definition at line 249 of file Sparse.

Eigen::DynamicSparseMatrix::DynamicSparseMatrix ( const DynamicSparseMatrix &  other) [inline]

Definition at line 255 of file Sparse.

Eigen::DynamicSparseMatrix::~DynamicSparseMatrix ( ) [inline]

Destructor.

Definition at line 284 of file Sparse.


Member Function Documentation

std::vector<CompressedStorage<Scalar,Index> >& Eigen::DynamicSparseMatrix::_data ( ) [inline]

Definition at line 98 of file Sparse.

const std::vector<CompressedStorage<Scalar,Index> >& Eigen::DynamicSparseMatrix::_data ( ) const [inline]

Definition at line 99 of file Sparse.

Scalar Eigen::DynamicSparseMatrix::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.

Definition at line 104 of file Sparse.

Scalar& Eigen::DynamicSparseMatrix::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.

Definition at line 115 of file Sparse.

Index Eigen::DynamicSparseMatrix::cols ( void  ) const [inline]
Returns:
the number of columns.
See also:
rows(), ColsAtCompileTime

Reimplemented from Eigen::SparseMatrixBase< DynamicSparseMatrix< _Scalar, _Options, _Index > >.

Definition at line 93 of file Sparse.

EIGEN_DEPRECATED void Eigen::DynamicSparseMatrix::endFill ( ) [inline]
Deprecated:
use finalize() Does nothing.

Provided for compatibility with SparseMatrix.

Definition at line 324 of file Sparse.

EIGEN_DEPRECATED Scalar& Eigen::DynamicSparseMatrix::fill ( Index  row,
Index  col 
) [inline]
Deprecated:
use insert() inserts a nonzero coefficient at given coordinates row, col and returns its reference assuming that: 1 - the coefficient does not exist yet 2 - this the coefficient with greater inner coordinate for the given outer coordinate.

In other words, assuming *this is column-major, then there must not exists any nonzero coefficient of coordinates i x col such that i >= row. Otherwise the matrix is invalid.

See also:
fillrand(), coeffRef()

Definition at line 305 of file Sparse.

EIGEN_DEPRECATED Scalar& Eigen::DynamicSparseMatrix::fillrand ( Index  row,
Index  col 
) [inline]
Deprecated:
use insert() Like fill() but with random inner coordinates.

Compared to the generic coeffRef(), the unique limitation is that we assume the coefficient does not exist yet.

Definition at line 317 of file Sparse.

void Eigen::DynamicSparseMatrix::finalize ( ) [inline]

Does nothing: provided for compatibility with SparseMatrix.

Definition at line 197 of file Sparse.

Index Eigen::DynamicSparseMatrix::innerNonZeros ( Index  j) const [inline]

Definition at line 96 of file Sparse.

Index Eigen::DynamicSparseMatrix::innerSize ( ) const [inline]
Returns:
the size of the inner dimension according to the storage order, i.e., the number of rows for a columns major matrix, and the number of cols otherwise

Reimplemented from Eigen::SparseMatrixBase< DynamicSparseMatrix< _Scalar, _Options, _Index > >.

Definition at line 94 of file Sparse.

Scalar& Eigen::DynamicSparseMatrix::insert ( Index  row,
Index  col 
) [inline]

Definition at line 176 of file Sparse.

Scalar& Eigen::DynamicSparseMatrix::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

Definition at line 161 of file Sparse.

Scalar& Eigen::DynamicSparseMatrix::insertBackByOuterInner ( Index  outer,
Index  inner 
) [inline]
See also:
insertBack

Definition at line 167 of file Sparse.

Index Eigen::DynamicSparseMatrix::nonZeros ( ) const [inline]
Returns:
the number of non zero coefficients

Reimplemented from Eigen::SparseMatrixBase< DynamicSparseMatrix< _Scalar, _Options, _Index > >.

Definition at line 131 of file Sparse.

DynamicSparseMatrix& Eigen::DynamicSparseMatrix::operator= ( const DynamicSparseMatrix &  other) [inline]

Definition at line 269 of file Sparse.

Index Eigen::DynamicSparseMatrix::outerSize ( ) const [inline]
Returns:
the size of the storage major dimension, i.e., the number of columns for a columns major matrix, and the number of rows otherwise

Reimplemented from Eigen::SparseMatrixBase< DynamicSparseMatrix< _Scalar, _Options, _Index > >.

Definition at line 95 of file Sparse.

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

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

Definition at line 200 of file Sparse.

void Eigen::DynamicSparseMatrix::reserve ( Index  reserveSize = 1000) [inline]

Definition at line 141 of file Sparse.

void Eigen::DynamicSparseMatrix::resize ( Index  rows,
Index  cols 
) [inline]

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

Definition at line 208 of file Sparse.

void Eigen::DynamicSparseMatrix::resizeAndKeepData ( Index  rows,
Index  cols 
) [inline]

Definition at line 219 of file Sparse.

Index Eigen::DynamicSparseMatrix::rows ( void  ) const [inline]
Returns:
the number of rows.
See also:
cols(), RowsAtCompileTime

Reimplemented from Eigen::SparseMatrixBase< DynamicSparseMatrix< _Scalar, _Options, _Index > >.

Definition at line 92 of file Sparse.

void Eigen::DynamicSparseMatrix::setZero ( ) [inline]

Definition at line 124 of file Sparse.

EIGEN_DEPRECATED void Eigen::DynamicSparseMatrix::startFill ( Index  reserveSize = 1000) [inline]
Deprecated:
Set the matrix to zero and reserve the memory for reserveSize nonzero coefficients.

Definition at line 290 of file Sparse.

void Eigen::DynamicSparseMatrix::startVec ( Index  ) [inline]

Does nothing: provided for compatibility with SparseMatrix.

Definition at line 154 of file Sparse.

void Eigen::DynamicSparseMatrix::swap ( DynamicSparseMatrix &  other) [inline]

Definition at line 261 of file Sparse.


Member Data Documentation

Definition at line 88 of file Sparse.

Definition at line 87 of file Sparse.




Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Sun Oct 16 12:16:33 UTC 2011