Please, help us to better know about our user community by answering the following short survey: https://forms.gle/wpyrxWi18ox9Z5ae9 Eigen  3.3.8 Eigen::SparseVector Class Reference

## Detailed Description

a sparse vector class

Template Parameters
 _Scalar the scalar type, i.e. the type of the coefficients

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 Extending MatrixBase (and other classes) by defining the preprocessor symbol `EIGEN_SPARSEVECTOR_PLUGIN`.

## Public Member Functions

Scalar & coeffRef (Index i)

void conservativeResize (Index newSize)

Index nonZeros () const

void prune (const Scalar &reference, const RealScalar &epsilon=NumTraits< RealScalar >::dummy_precision())

void resize (Index newSize)

void resize (Index rows, Index cols)

Scalar sum () const

void swap (SparseVector &other)

~SparseVector ()

## ◆ ~SparseVector()

 Eigen::SparseVector::~SparseVector ( )
inline

Destructor

## ◆ coeffRef()

 Scalar& Eigen::SparseVector::coeffRef ( Index i )
inline
Returns
a reference to the coefficient value at given index i This operation involes a log(rho*size) binary search. If the coefficient does not exist yet, then a sorted insertion into a sequential buffer is performed.

This insertion might be very costly if the number of nonzeros above i is large.

## ◆ conservativeResize()

 void Eigen::SparseVector::conservativeResize ( Index newSize )
inline

Resizes the sparse vector to newSize, while leaving old values untouched.

If the size of the vector is decreased, then the storage of the out-of bounds coefficients is kept and reserved. Call .data().squeeze() to free extra memory.

reserve(), setZero()

## ◆ nonZeros()

 Index Eigen::SparseVector::nonZeros ( ) const
inline
Returns
the number of non zero coefficients

## ◆ prune()

 void Eigen::SparseVector::prune ( const Scalar & reference, const RealScalar & epsilon = `NumTraits::dummy_precision()` )
inline

Suppresses all nonzeros which are much smaller than reference under the tolerence epsilon

## ◆ resize() [1/2]

 void Eigen::SparseVector::resize ( Index newSize )
inline

Resizes the sparse vector to newSize This method deletes all entries, thus leaving an empty sparse vector

conservativeResize(), setZero()

## ◆ resize() [2/2]

 void Eigen::SparseVector::resize ( Index rows, Index cols )
inline

Resizes the sparse vector to rows x cols

This method is provided for compatibility with matrices. For a column vector, cols must be equal to 1. For a row vector, rows must be equal to 1.

resize(Index)

## ◆ sum()

 internal::traits< SparseVector< _Scalar, _Options, _Index > >::Scalar Eigen::SparseVector::sum ( ) const

Swaps the values of `*this` and other. Overloaded for performance: this version performs a shallow swap by swaping pointers and attributes only.