Public Member Functions
SparseMatrix< _Scalar, _Options, _Index > Class Template Reference

The main sparse matrix class. More...

+ Inheritance diagram for SparseMatrix< _Scalar, _Options, _Index >:

List of all members.

Public Member Functions

Index cols () const
EIGEN_DEPRECATED void endFill ()
EIGEN_DEPRECATED Scalar & fill (Index row, Index col)
EIGEN_DEPRECATED Scalar & fillrand (Index row, Index col)
void finalize ()
Index innerSize () const
EIGEN_DONT_INLINE Scalar & insert (Index row, Index col)
Scalar & insertBack (Index row, Index col)
Scalar & insertBackByOuterInner (Index outer, Index inner)
Scalar & insertBackByOuterInnerUnordered (Index outer, Index inner)
Index nonZeros () const
Index outerSize () const
void prune (Scalar reference, RealScalar epsilon=NumTraits< RealScalar >::dummy_precision())
template<typename KeepFunc >
void prune (const KeepFunc &keep=KeepFunc())
void reserve (Index reserveSize)
void resize (Index rows, Index cols)
void resizeNonZeros (Index size)
Index rows () const
void setZero ()
 SparseMatrix ()
 SparseMatrix (Index rows, Index cols)
template<typename OtherDerived >
 SparseMatrix (const SparseMatrixBase< OtherDerived > &other)
 SparseMatrix (const SparseMatrix &other)
EIGEN_DEPRECATED void startFill (Index reserveSize=1000)
void startVec (Index outer)
Scalar sum () const
void swap (SparseMatrix &other)
 ~SparseMatrix ()

Detailed Description

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

The main sparse matrix class.

This class implements a sparse matrix using the very common compressed row/column storage scheme.

Template Parameters:
_Scalarthe scalar type, i.e. the type of the coefficients
_OptionsUnion of bit flags controlling the storage scheme. Currently the only possibility is RowMajor. The default is 0 which means column-major.
_Indexthe type of the indices. Default is int.

See http://www.netlib.org/linalg/html_templates/node91.html for details on the storage scheme.

This class can be extended with the help of the plugin mechanism described on the page Customizing/Extending Eigen by defining the preprocessor symbol EIGEN_SPARSEMATRIX_PLUGIN.


Constructor & Destructor Documentation

SparseMatrix ( ) [inline]

Default constructor yielding an empty 0 x 0 matrix

SparseMatrix ( Index  rows,
Index  cols 
) [inline]

Constructs a rows x cols empty matrix

SparseMatrix ( const SparseMatrixBase< OtherDerived > &  other) [inline]

Constructs a sparse matrix from the sparse expression other

SparseMatrix ( const SparseMatrix< _Scalar, _Options, _Index > &  other) [inline]

Copy constructor

~SparseMatrix ( ) [inline]

Destructor


Member Function Documentation

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

Reimplemented from SparseMatrixBase< SparseMatrix< _Scalar, _Options, _Index > >.

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]

Must be called after inserting a set of non zero entries.

Index 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 SparseMatrixBase< SparseMatrix< _Scalar, _Options, _Index > >.

EIGEN_DONT_INLINE Scalar& insert ( Index  row,
Index  col 
) [inline]
Returns:
a reference to a novel non zero coefficient with coordinates row x col. The non zero coefficient must not already exist.
Warning:
This function can be extremely slow if the non zero coefficients are not inserted in a coherent order.

After an insertion session, you should call the finalize() function.

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 according to the storage order

Before filling a given inner vector you must call the statVec(Index) function.

After an insertion session, you should call the finalize() function.

See also:
insert, insertBackByOuterInner, startVec
Scalar& insertBackByOuterInner ( Index  outer,
Index  inner 
) [inline]
See also:
insertBack, startVec
Scalar& insertBackByOuterInnerUnordered ( Index  outer,
Index  inner 
) [inline]
Warning:
use it only if you know what you are doing
Index nonZeros ( ) const [inline]
Returns:
the number of non zero coefficients

Reimplemented from SparseMatrixBase< SparseMatrix< _Scalar, _Options, _Index > >.

Index 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 SparseMatrixBase< SparseMatrix< _Scalar, _Options, _Index > >.

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

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

void prune ( const KeepFunc &  keep = KeepFunc()) [inline]

Suppress all nonzeros which do not satisfy the predicate keep. The functor type KeepFunc must implement the following function:

 bool operator() (const Index& row, const Index& col, const Scalar& value) const;
See also:
prune(Scalar,RealScalar)
void reserve ( Index  reserveSize) [inline]

Preallocates reserveSize non zeros

void resize ( Index  rows,
Index  cols 
) [inline]

Resizes the matrix to a rows x cols matrix and initializes it to zero

See also:
resizeNonZeros(Index), reserve(), setZero()
void resizeNonZeros ( Index  size) [inline]

Low level API Resize the nonzero vector to size

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

Reimplemented from SparseMatrixBase< SparseMatrix< _Scalar, _Options, _Index > >.

void setZero ( ) [inline]

Removes all non zeros

EIGEN_DEPRECATED void startFill ( Index  reserveSize = 1000) [inline]
Parameters:
reserveSizeapproximate number of nonzeros Note that the matrix *this is zero-ed.
void startVec ( Index  outer) [inline]
internal::traits< SparseMatrix< _Scalar, _Options, _Index > >::Scalar sum ( ) const

Overloaded for performance

Reimplemented from SparseMatrixBase< SparseMatrix< _Scalar, _Options, _Index > >.

void swap ( SparseMatrix< _Scalar, _Options, _Index > &  other) [inline]

Swap the content of two sparse matrices of same type (optimization)


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