Please, help us to better know about our user community by answering the following short survey:
Eigen  3.3.8
Eigen::SparseVector Class Reference

Detailed Description

a sparse vector class

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

See 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 ()

Constructor & Destructor Documentation

◆ ~SparseVector()

Eigen::SparseVector::~SparseVector ( )


Member Function Documentation

◆ coeffRef()

Scalar& Eigen::SparseVector::coeffRef ( Index  i)
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)

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.

See also
reserve(), setZero()

◆ nonZeros()

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

◆ prune()

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

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

◆ resize() [1/2]

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

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

See also
conservativeResize(), setZero()

◆ resize() [2/2]

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

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.

See also

◆ sum()

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

Overloaded for performance

◆ swap()

void Eigen::SparseVector::swap ( SparseVector other)

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

See also

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