Please, help us to better know about our user community by answering the following short survey: https://forms.gle/wpyrxWi18ox9Z5ae9
 Eigen  3.3.9
Eigen::SparseMatrixBase< Derived > Class Template Reference

## Detailed Description

### template<typename Derived> class Eigen::SparseMatrixBase< Derived >

Base class of any sparse matrices or sparse expressions.

Template Parameters
 Derived is the derived type, e.g. a sparse matrix type, or an expression, etc.

This class can be extended with the help of the plugin mechanism described on the page Extending MatrixBase (and other classes) by defining the preprocessor symbol EIGEN_SPARSEMATRIXBASE_PLUGIN.

Inheritance diagram for Eigen::SparseMatrixBase< Derived >:

## Public Types

enum  {
RowsAtCompileTime,
ColsAtCompileTime,
SizeAtCompileTime ,
IsVectorAtCompileTime,
Flags
}

typedef internal::traits< Derived >::StorageIndex StorageIndex

typedef Scalar value_type

Public Types inherited from Eigen::EigenBase< Derived >
typedef Eigen::Index Index
The interface type of indices. More...

## Public Member Functions

Index cols () const

const internal::eval< Derived >::type eval () const

Index innerSize () const

InnerVectorReturnType innerVector (Index outer)

const ConstInnerVectorReturnType innerVector (Index outer) const

InnerVectorsReturnType innerVectors (Index outerStart, Index outerSize)

const ConstInnerVectorsReturnType innerVectors (Index outerStart, Index outerSize) const

bool isVector () const

template<typename OtherDerived >
const Product< Derived, OtherDerived, AliasFreeProduct > operator* (const SparseMatrixBase< OtherDerived > &other) const

Index outerSize () const

const SparseView< Derived > pruned (const Scalar &reference=Scalar(0), const RealScalar &epsilon=NumTraits< Scalar >::dummy_precision()) const

Index rows () const

Index size () const

SparseSymmetricPermutationProduct< Derived, Upper|LowertwistedBy (const PermutationMatrix< Dynamic, Dynamic, StorageIndex > &perm) const

Public Member Functions inherited from Eigen::EigenBase< Derived >
Index cols () const

Derived & derived ()

const Derived & derived () const

Index rows () const

Index size () const

## ◆ StorageIndex

template<typename Derived >
 typedef internal::traits::StorageIndex Eigen::SparseMatrixBase< Derived >::StorageIndex

The integer type used to store indices within a SparseMatrix. For a SparseMatrix<Scalar,Options,IndexType> it an alias of the third template parameter IndexType.

## ◆ value_type

template<typename Derived >
 typedef Scalar Eigen::SparseMatrixBase< Derived >::value_type

The numeric type of the expression' coefficients, e.g. float, double, int or std::complex<float>, etc.

It is an alias for the Scalar type

## ◆ anonymous enum

template<typename Derived >
 anonymous enum
Enumerator
RowsAtCompileTime

The number of rows at compile-time. This is just a copy of the value provided by the Derived type. If a value is not known at compile-time, it is set to the Dynamic constant.

MatrixBase::rows(), MatrixBase::cols(), ColsAtCompileTime, SizeAtCompileTime
ColsAtCompileTime

The number of columns at compile-time. This is just a copy of the value provided by the Derived type. If a value is not known at compile-time, it is set to the Dynamic constant.

MatrixBase::rows(), MatrixBase::cols(), RowsAtCompileTime, SizeAtCompileTime
SizeAtCompileTime

This is equal to the number of coefficients, i.e. the number of rows times the number of columns, or to Dynamic if this is not known at compile-time.

RowsAtCompileTime, ColsAtCompileTime
IsVectorAtCompileTime

This is set to true if either the number of rows or the number of columns is known at compile-time to be equal to 1. Indeed, in that case, we are dealing with a column-vector (if there is only one column) or with a row-vector (if there is only one row).

Flags

This stores expression Flags flags which may or may not be inherited by new expressions constructed from this one. See the list of flags.

## ◆ cols()

template<typename Derived >
 Index Eigen::SparseMatrixBase< Derived >::cols ( void ) const
inline
Returns
the number of columns.
rows()

## ◆ eval()

template<typename Derived >
 const internal::eval::type Eigen::SparseMatrixBase< Derived >::eval ( ) const
inline
Returns
the matrix or vector obtained by evaluating this expression.

Notice that in the case of a plain matrix or vector (not an expression) this function just returns a const reference, in order to avoid a useless copy.

## ◆ innerSize()

template<typename Derived >
 Index Eigen::SparseMatrixBase< Derived >::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

## ◆ innerVector() [1/2]

template<typename Derived >
 SparseMatrixBase< Derived >::InnerVectorReturnType Eigen::SparseMatrixBase< Derived >::innerVector ( Index outer )
Returns
the outer -th column (resp. row) of the matrix *this if *this is col-major (resp. row-major).

## ◆ innerVector() [2/2]

template<typename Derived >
 const SparseMatrixBase< Derived >::ConstInnerVectorReturnType Eigen::SparseMatrixBase< Derived >::innerVector ( Index outer ) const
Returns
the outer -th column (resp. row) of the matrix *this if *this is col-major (resp. row-major). Read-only.

## ◆ innerVectors() [1/2]

template<typename Derived >
 SparseMatrixBase< Derived >::InnerVectorsReturnType Eigen::SparseMatrixBase< Derived >::innerVectors ( Index outerStart, Index outerSize )
Returns
the outer -th column (resp. row) of the matrix *this if *this is col-major (resp. row-major).

## ◆ innerVectors() [2/2]

template<typename Derived >
 const SparseMatrixBase< Derived >::ConstInnerVectorsReturnType Eigen::SparseMatrixBase< Derived >::innerVectors ( Index outerStart, Index outerSize ) const
Returns
the outer -th column (resp. row) of the matrix *this if *this is col-major (resp. row-major). Read-only.

## ◆ isVector()

template<typename Derived >
 bool Eigen::SparseMatrixBase< Derived >::isVector ( ) const
inline
Returns
true if either the number of rows or the number of columns is equal to 1. In other words, this function returns
rows()==1 || cols()==1
rows(), cols(), IsVectorAtCompileTime.

## ◆ operator*()

template<typename Derived >
template<typename OtherDerived >
 const Product< Derived, OtherDerived, AliasFreeProduct > Eigen::SparseMatrixBase< Derived >::operator* ( const SparseMatrixBase< OtherDerived > & other ) const
inline
Returns
an expression of the product of two sparse matrices. By default a conservative product preserving the symbolic non zeros is performed. The automatic pruning of the small values can be achieved by calling the pruned() function in which case a totally different product algorithm is employed:
C = (A*B).pruned(); // supress numerical zeros (exact)
C = (A*B).pruned(ref);
C = (A*B).pruned(ref,epsilon);
where ref is a meaningful non zero reference value.

## ◆ outerSize()

template<typename Derived >
 Index Eigen::SparseMatrixBase< Derived >::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

## ◆ pruned()

template<typename Derived >
 const SparseView< Derived > Eigen::SparseMatrixBase< Derived >::pruned ( const Scalar & reference = Scalar(0), const RealScalar & epsilon = NumTraits::dummy_precision() ) const
inline
Returns
an expression of *this with values smaller than reference * epsilon removed.

This method is typically used in conjunction with the product of two sparse matrices to automatically prune the smallest values as follows:

C = (A*B).pruned(); // suppress numerical zeros (exact)
C = (A*B).pruned(ref);
C = (A*B).pruned(ref,epsilon);

where ref is a meaningful non zero reference value.

## ◆ rows()

template<typename Derived >
 Index Eigen::SparseMatrixBase< Derived >::rows ( void ) const
inline
Returns
the number of rows.
cols()

## ◆ size()

template<typename Derived >
 Index Eigen::SparseMatrixBase< Derived >::size ( ) const
inline
Returns
the number of coefficients, which is rows()*cols().
rows(), cols().

## ◆ twistedBy()

template<typename Derived >
 SparseSymmetricPermutationProduct Eigen::SparseMatrixBase< Derived >::twistedBy ( const PermutationMatrix< Dynamic, Dynamic, StorageIndex > & perm ) const
inline
Returns
an expression of P H P^-1 where H is the matrix represented by *this

The documentation for this class was generated from the following files:
Eigen::SparseMatrixBase::cols
Index cols() const
Definition: SparseMatrixBase.h:173
Eigen::SparseMatrixBase::rows
Index rows() const
Definition: SparseMatrixBase.h:171
Eigen::SparseMatrixBase::pruned
const SparseView< Derived > pruned(const Scalar &reference=Scalar(0), const RealScalar &epsilon=NumTraits< Scalar >::dummy_precision()) const
Definition: SparseView.h:246