|
Index | rows () const |
|
Index | cols () const |
|
Index | innerSize () const |
|
Index | outerSize () const |
|
const Scalar * | valuePtr () const |
|
Scalar * | valuePtr () |
|
const StorageIndex * | innerIndexPtr () const |
|
StorageIndex * | innerIndexPtr () |
|
const StorageIndex * | outerIndexPtr () const |
|
StorageIndex * | outerIndexPtr () |
|
const StorageIndex * | innerNonZeroPtr () const |
|
StorageIndex * | innerNonZeroPtr () |
|
Storage & | data () |
|
const Storage & | data () const |
|
Scalar | coeff (Index row, Index col) const |
|
Scalar & | coeffRef (Index row, Index col) |
|
Scalar & | insert (Index row, Index col) |
|
void | setZero () |
| Removes all non zeros but keep allocated memory. More...
|
|
void | reserve (Index reserveSize) |
| Preallocates reserveSize non zeros. More...
|
|
template<class SizesType > |
void | reserve (const SizesType &reserveSizes, const typename SizesType::value_type &enableif=typename SizesType::value_type()) |
|
Scalar & | insertBack (Index row, Index col) |
|
Scalar & | insertBackByOuterInner (Index outer, Index inner) |
|
Scalar & | insertBackByOuterInnerUnordered (Index outer, Index inner) |
|
void | startVec (Index outer) |
|
void | finalize () |
|
template<typename InputIterators > |
void | setFromTriplets (const InputIterators &begin, const InputIterators &end) |
| Fill the matrix *this with the list of triplets defined by the iterator range begin - end. More...
|
|
template<typename InputIterators , typename DupFunctor > |
void | setFromTriplets (const InputIterators &begin, const InputIterators &end, DupFunctor dup_func) |
| The same as setFromTriplets but when duplicates are met the functor dup_func is applied: More...
|
|
void | sumupDuplicates () |
|
template<typename DupFunctor > |
void | collapseDuplicates (DupFunctor dup_func=DupFunctor()) |
|
Scalar & | insertByOuterInner (Index j, Index i) |
|
void | makeCompressed () |
| Turns the matrix into the compressed format. More...
|
|
void | uncompress () |
| Turns the matrix into the uncompressed mode. More...
|
|
void | prune (const Scalar &reference, const RealScalar &epsilon=NumTraits< RealScalar >::dummy_precision()) |
| Suppresses all nonzeros which are much smaller than reference under the tolerance epsilon. More...
|
|
template<typename KeepFunc > |
void | prune (const KeepFunc &keep=KeepFunc()) |
| Turns the matrix into compressed format, and suppresses all nonzeros which do not satisfy the predicate keep. More...
|
|
void | conservativeResize (Index rows, Index cols) |
| Resizes the matrix to a rows x cols matrix leaving old values untouched. More...
|
|
void | resize (Index rows, Index cols) |
| Resizes the matrix to a rows x cols matrix and initializes it to zero. More...
|
|
void | resizeNonZeros (Index size) |
|
const ConstDiagonalReturnType | diagonal () const |
|
DiagonalReturnType | diagonal () |
|
| SparseMatrix () |
| Default constructor yielding an empty 0 x 0 matrix. More...
|
|
| SparseMatrix (Index rows, Index cols) |
| Constructs a rows x cols empty matrix. More...
|
|
template<typename OtherDerived > |
| SparseMatrix (const SparseMatrixBase< OtherDerived > &other) |
| Constructs a sparse matrix from the sparse expression other. More...
|
|
template<typename OtherDerived , unsigned int UpLo> |
| SparseMatrix (const SparseSelfAdjointView< OtherDerived, UpLo > &other) |
| Constructs a sparse matrix from the sparse selfadjoint view other. More...
|
|
| SparseMatrix (const SparseMatrix &other) |
| Copy constructor (it performs a deep copy) More...
|
|
template<typename OtherDerived > |
| SparseMatrix (const ReturnByValue< OtherDerived > &other) |
| Copy constructor with in-place evaluation. More...
|
|
template<typename OtherDerived > |
| SparseMatrix (const DiagonalBase< OtherDerived > &other) |
| Copy constructor with in-place evaluation. More...
|
|
void | swap (SparseMatrix &other) |
| Swaps the content of two sparse matrices of the same type. More...
|
|
void | setIdentity () |
| Sets *this to the identity matrix. More...
|
|
SparseMatrix & | operator= (const SparseMatrix &other) |
|
template<typename OtherDerived > |
SparseMatrix & | operator= (const EigenBase< OtherDerived > &other) |
|
template<typename Lhs , typename Rhs > |
SparseMatrix & | operator= (const Product< Lhs, Rhs, AliasFreeProduct > &other) |
|
template<typename OtherDerived > |
EIGEN_DONT_INLINE SparseMatrix & | operator= (const SparseMatrixBase< OtherDerived > &other) |
|
| ~SparseMatrix () |
| Destructor. More...
|
|
Scalar | sum () const |
| Overloaded for performance. More...
|
|
EIGEN_STRONG_INLINE Scalar & | insertBackUncompressed (Index row, Index col) |
|
template<typename Lhs , typename Rhs > |
SparseMatrix< Scalar, _Options, _StorageIndex > & | operator= (const Product< Lhs, Rhs, AliasFreeProduct > &src) |
|
template<typename OtherDerived > |
EIGEN_DONT_INLINE SparseMatrix< Scalar, _Options, _StorageIndex > & | operator= (const SparseMatrixBase< OtherDerived > &other) |
|
bool | isCompressed () const |
|
Index | nonZeros () const |
|
Index | nonZeros () const |
|
const Scalar * | valuePtr () const |
|
Scalar * | valuePtr () |
|
const StorageIndex * | innerIndexPtr () const |
|
StorageIndex * | innerIndexPtr () |
|
const StorageIndex * | outerIndexPtr () const |
|
StorageIndex * | outerIndexPtr () |
|
const StorageIndex * | innerNonZeroPtr () const |
|
StorageIndex * | innerNonZeroPtr () |
|
bool | isCompressed () const |
|
const Map< const Array< Scalar, Dynamic, 1 > > | coeffs () const |
|
Map< Array< Scalar, Dynamic, 1 > > | coeffs () |
|
SparseMatrix< _Scalar, _Options, _StorageIndex > & | operator= (const EigenBase< OtherDerived > &other) |
|
SparseMatrix< _Scalar, _Options, _StorageIndex > & | operator= (const ReturnByValue< OtherDerived > &other) |
|
SparseMatrix< _Scalar, _Options, _StorageIndex > & | operator= (const SparseMatrixBase< OtherDerived > &other) |
|
SparseMatrix< _Scalar, _Options, _StorageIndex > & | operator= (const SparseMatrix< _Scalar, _Options, _StorageIndex > &other) |
|
const SparseMatrix< _Scalar, _Options, _StorageIndex > & | derived () const |
|
SparseMatrix< _Scalar, _Options, _StorageIndex > & | derived () |
|
SparseMatrix< _Scalar, _Options, _StorageIndex > & | const_cast_derived () const |
|
Index | rows () const |
|
Index | cols () const |
|
Index | size () const |
|
bool | isVector () const |
|
Index | outerSize () const |
|
Index | innerSize () const |
|
bool | isRValue () const |
|
SparseMatrix< _Scalar, _Options, _StorageIndex > & | markAsRValue () |
|
| SparseMatrixBase () |
|
SparseMatrix< _Scalar, _Options, _StorageIndex > & | operator+= (const SparseMatrixBase< OtherDerived > &other) |
|
SparseMatrix< _Scalar, _Options, _StorageIndex > & | operator+= (const DiagonalBase< OtherDerived > &other) |
|
SparseMatrix< _Scalar, _Options, _StorageIndex > & | operator+= (const EigenBase< OtherDerived > &other) |
|
EIGEN_STRONG_INLINE SparseMatrix< _Scalar, _Options, _StorageIndex > & | operator+= (const SparseMatrixBase< OtherDerived > &other) |
|
SparseMatrix< _Scalar, _Options, _StorageIndex > & | operator-= (const SparseMatrixBase< OtherDerived > &other) |
|
SparseMatrix< _Scalar, _Options, _StorageIndex > & | operator-= (const DiagonalBase< OtherDerived > &other) |
|
SparseMatrix< _Scalar, _Options, _StorageIndex > & | operator-= (const EigenBase< OtherDerived > &other) |
|
EIGEN_STRONG_INLINE SparseMatrix< _Scalar, _Options, _StorageIndex > & | operator-= (const SparseMatrixBase< OtherDerived > &other) |
|
SparseMatrix< _Scalar, _Options, _StorageIndex > & | operator*= (const Scalar &other) |
|
SparseMatrix< _Scalar, _Options, _StorageIndex > & | operator*= (const SparseMatrixBase< OtherDerived > &other) |
|
SparseMatrix< _Scalar, _Options, _StorageIndex > & | operator/= (const Scalar &other) |
|
EIGEN_STRONG_INLINE const CwiseProductDenseReturnType< OtherDerived >::Type | cwiseProduct (const MatrixBase< OtherDerived > &other) const |
|
EIGEN_STRONG_INLINE const SparseMatrixBase< SparseMatrix< _Scalar, _Options, _StorageIndex > >::template CwiseProductDenseReturnType< OtherDerived >::Type | cwiseProduct (const MatrixBase< OtherDerived > &other) const |
|
const Product< SparseMatrix< _Scalar, _Options, _StorageIndex >, OtherDerived > | operator* (const DiagonalBase< OtherDerived > &other) const |
|
const Product< SparseMatrix< _Scalar, _Options, _StorageIndex >, OtherDerived, AliasFreeProduct > | operator* (const SparseMatrixBase< OtherDerived > &other) const |
|
const Product< SparseMatrix< _Scalar, _Options, _StorageIndex >, OtherDerived > | operator* (const MatrixBase< OtherDerived > &other) const |
|
SparseSymmetricPermutationProduct< SparseMatrix< _Scalar, _Options, _StorageIndex >, Upper|Lower > | twistedBy (const PermutationMatrix< Dynamic, Dynamic, StorageIndex > &perm) const |
|
const TriangularView< const SparseMatrix< _Scalar, _Options, _StorageIndex >, Mode > | triangularView () const |
|
ConstSelfAdjointViewReturnType< UpLo >::Type | selfadjointView () const |
|
SelfAdjointViewReturnType< UpLo >::Type | selfadjointView () |
|
SparseMatrixBase< SparseMatrix< _Scalar, _Options, _StorageIndex > >::template ConstSelfAdjointViewReturnType< UpLo >::Type | selfadjointView () const |
|
SparseMatrixBase< SparseMatrix< _Scalar, _Options, _StorageIndex > >::template SelfAdjointViewReturnType< UpLo >::Type | selfadjointView () |
|
Scalar | dot (const MatrixBase< OtherDerived > &other) const |
|
Scalar | dot (const SparseMatrixBase< OtherDerived > &other) const |
|
internal::traits< SparseMatrix< _Scalar, _Options, _StorageIndex > >::Scalar | dot (const MatrixBase< OtherDerived > &other) const |
|
internal::traits< SparseMatrix< _Scalar, _Options, _StorageIndex > >::Scalar | dot (const SparseMatrixBase< OtherDerived > &other) const |
|
RealScalar | squaredNorm () const |
|
RealScalar | norm () const |
|
RealScalar | blueNorm () const |
|
TransposeReturnType | transpose () |
|
const ConstTransposeReturnType | transpose () const |
|
const AdjointReturnType | adjoint () const |
|
DenseMatrixType | toDense () const |
|
bool | isApprox (const SparseMatrixBase< OtherDerived > &other, const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const |
|
bool | isApprox (const MatrixBase< OtherDerived > &other, const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const |
|
const internal::eval< SparseMatrix< _Scalar, _Options, _StorageIndex > >::type | eval () const |
|
Scalar | sum () const |
|
const SparseView< SparseMatrix< _Scalar, _Options, _StorageIndex > > | pruned (const Scalar &reference=Scalar(0), const RealScalar &epsilon=NumTraits< Scalar >::dummy_precision()) const |
|
EIGEN_DEVICE_FUNC SparseMatrix< _Scalar, _Options, _StorageIndex > & | derived () |
|
EIGEN_DEVICE_FUNC const SparseMatrix< _Scalar, _Options, _StorageIndex > & | derived () const |
|
EIGEN_DEVICE_FUNC SparseMatrix< _Scalar, _Options, _StorageIndex > & | const_cast_derived () const |
|
EIGEN_DEVICE_FUNC const SparseMatrix< _Scalar, _Options, _StorageIndex > & | const_derived () const |
|
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index | rows () const EIGEN_NOEXCEPT |
|
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index | cols () const EIGEN_NOEXCEPT |
|
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index | size () const EIGEN_NOEXCEPT |
|
EIGEN_DEVICE_FUNC void | evalTo (Dest &dst) const |
|
EIGEN_DEVICE_FUNC void | addTo (Dest &dst) const |
|
EIGEN_DEVICE_FUNC void | subTo (Dest &dst) const |
|
EIGEN_DEVICE_FUNC void | applyThisOnTheRight (Dest &dst) const |
|
EIGEN_DEVICE_FUNC void | applyThisOnTheLeft (Dest &dst) const |
|
template<typename _Scalar, int _Options, typename _StorageIndex>
class Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >
A versatible sparse matrix representation.
This class implements a more versatile variants of the common compressed row/column storage format. Each colmun's (resp. row) non zeros are stored as a pair of value with associated row (resp. colmiun) index. All the non zeros are stored in a single large buffer. Unlike the compressed format, there might be extra space in between the nonzeros of two successive colmuns (resp. rows) such that insertion of new non-zero can be done with limited memory reallocation and copies.
A call to the function makeCompressed() turns the matrix into the standard compressed format compatible with many library.
More details on this storage sceheme are given in the manual pages.
- Template Parameters
-
_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 ColMajor or RowMajor. The default is 0 which means column-major. |
_StorageIndex | the type of the indices. It has to be a signed type (e.g., short, int, std::ptrdiff_t). Default is int . |
- Warning
- In Eigen 3.2, the undocumented type
SparseMatrix::Index
was improperly defined as the storage index type (e.g., int), whereas it is now (starting from Eigen 3.3) deprecated and always defined as Eigen::Index. Codes making use of SparseMatrix::Index
, might thus likely have to be changed to use SparseMatrix::StorageIndex
instead.
This class can be extended with the help of the plugin mechanism described on the page TopicCustomizing_Plugins by defining the preprocessor symbol EIGEN_SPARSEMATRIX_PLUGIN
.