The main sparse matrix class. More...
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 () |
template<typename OtherDerived > | |
SparseMatrix (const SparseMatrixBase< OtherDerived > &other) | |
SparseMatrix () | |
SparseMatrix (Index rows, Index cols) | |
SparseMatrix (const SparseMatrix &other) | |
EIGEN_DEPRECATED void | startFill (Index reserveSize=1000) |
void | startVec (Index outer) |
Scalar | sum () const |
void | swap (SparseMatrix &other) |
~SparseMatrix () |
The main sparse matrix class.
This class implements a sparse matrix using the very common compressed row/column storage scheme.
_Scalar | the scalar type, i.e. the type of the coefficients |
_Options | Union of bit flags controlling the storage scheme. Currently the only possibility is RowMajor. The default is 0 which means column-major. |
_Index | the 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
.
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
Index cols | ( | void | ) | const [inline] |
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] |
Reimplemented from SparseMatrixBase< SparseMatrix< _Scalar, _Options, _Index > >.
EIGEN_DONT_INLINE Scalar& insert | ( | Index | row, |
Index | col | ||
) | [inline] |
After an insertion session, you should call the finalize() function.
Scalar& insertBack | ( | Index | row, |
Index | col | ||
) | [inline] |
Before filling a given inner vector you must call the statVec(Index) function.
After an insertion session, you should call the finalize() function.
Scalar& insertBackByOuterInner | ( | Index | outer, |
Index | inner | ||
) | [inline] |
Scalar& insertBackByOuterInnerUnordered | ( | Index | outer, |
Index | inner | ||
) | [inline] |
Index nonZeros | ( | ) | const [inline] |
Reimplemented from SparseMatrixBase< SparseMatrix< _Scalar, _Options, _Index > >.
Index outerSize | ( | ) | const [inline] |
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:
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
void resizeNonZeros | ( | Index | size | ) | [inline] |
Low level API Resize the nonzero vector to size
Index rows | ( | void | ) | const [inline] |
Reimplemented from SparseMatrixBase< SparseMatrix< _Scalar, _Options, _Index > >.
void setZero | ( | ) | [inline] |
Removes all non zeros
EIGEN_DEPRECATED void startFill | ( | Index | reserveSize = 1000 | ) | [inline] |
reserveSize | approximate 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)