Classes | Public Types | Public Member Functions | Public Attributes | Friends

SparseVector< _Scalar, _Options, _Index > Class Template Reference

a sparse vector class More...

#include <SparseVector.h>

Inheritance diagram for SparseVector< _Scalar, _Options, _Index >:
SparseMatrixBase< SparseVector< _Scalar, _Options, _Index > > EigenBase< SparseVector< _Scalar, _Options, _Index > >

List of all members.

Classes

class  InnerIterator

Public Types

enum  { IsColVector = internal::traits<SparseVector>::IsColVector }
enum  { Options = _Options }
typedef SparseMatrixBase
< SparseVector
SparseBase

Public Member Functions

CompressedStorage< Scalar,
Index > & 
_data ()
CompressedStorage< Scalar,
Index > & 
_data () const
EIGEN_STRONG_INLINE Index rows () const
EIGEN_STRONG_INLINE Index cols () const
EIGEN_STRONG_INLINE Index innerSize () const
EIGEN_STRONG_INLINE Index outerSize () const
EIGEN_STRONG_INLINE Index innerNonZeros (Index j) const
EIGEN_STRONG_INLINE const Scalar_valuePtr () const
EIGEN_STRONG_INLINE Scalar_valuePtr ()
EIGEN_STRONG_INLINE const Index_innerIndexPtr () const
EIGEN_STRONG_INLINE Index_innerIndexPtr ()
Scalar coeff (Index row, Index col) const
Scalar coeff (Index i) const
ScalarcoeffRef (Index row, Index col)
ScalarcoeffRef (Index i)
void setZero ()
Index nonZeros () const
void startVec (Index outer)
ScalarinsertBackByOuterInner (Index outer, Index inner)
ScalarinsertBack (Index i)
Scalarinsert (Index row, Index col)
Scalarinsert (Index i)
void reserve (Index reserveSize)
void finalize ()
void prune (Scalar reference, RealScalar epsilon=NumTraits< RealScalar >::dummy_precision())
void resize (Index rows, Index cols)
void resize (Index newSize)
void resizeNonZeros (Index size)
 SparseVector ()
 SparseVector (Index size)
 SparseVector (Index rows, Index cols)
template<typename OtherDerived >
 SparseVector (const MatrixBase< OtherDerived > &other)
template<typename OtherDerived >
 SparseVector (const SparseMatrixBase< OtherDerived > &other)
 SparseVector (const SparseVector &other)
void swap (SparseVector &other)
SparseVectoroperator= (const SparseVector &other)
template<typename OtherDerived >
SparseVectoroperator= (const SparseMatrixBase< OtherDerived > &other)
template<typename Lhs , typename Rhs >
SparseVectoroperator= (const SparseSparseProduct< Lhs, Rhs > &product)
 ~SparseVector ()
Scalar sum () const
EIGEN_DEPRECATED void startFill (Index reserve)
EIGEN_DEPRECATED Scalarfill (Index r, Index c)
EIGEN_DEPRECATED Scalarfill (Index i)
EIGEN_DEPRECATED Scalarfillrand (Index r, Index c)
EIGEN_DEPRECATED Scalarfillrand (Index i)
EIGEN_DEPRECATED void endFill ()

Public Attributes

CompressedStorage< Scalar, Indexm_data
Index m_size

Friends

std::ostream & operator<< (std::ostream &s, const SparseVector &m)

Detailed Description

template<typename _Scalar, int _Options, typename _Index>
class SparseVector< _Scalar, _Options, _Index >

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 TopicCustomizingEigen by defining the preprocessor symbol EIGEN_SPARSEVECTOR_PLUGIN.


Member Typedef Documentation

template<typename _Scalar , int _Options, typename _Index >
typedef SparseMatrixBase<SparseVector> SparseVector< _Scalar, _Options, _Index >::SparseBase

Member Enumeration Documentation

template<typename _Scalar , int _Options, typename _Index >
anonymous enum
Enumerator:
IsColVector 
template<typename _Scalar , int _Options, typename _Index >
anonymous enum
Enumerator:
Options 

Constructor & Destructor Documentation

template<typename _Scalar , int _Options, typename _Index >
SparseVector< _Scalar, _Options, _Index >::SparseVector (  )  [inline]
template<typename _Scalar , int _Options, typename _Index >
SparseVector< _Scalar, _Options, _Index >::SparseVector ( Index  size  )  [inline]
template<typename _Scalar , int _Options, typename _Index >
SparseVector< _Scalar, _Options, _Index >::SparseVector ( Index  rows,
Index  cols 
) [inline]
template<typename _Scalar , int _Options, typename _Index >
template<typename OtherDerived >
SparseVector< _Scalar, _Options, _Index >::SparseVector ( const MatrixBase< OtherDerived > &  other  )  [inline]
template<typename _Scalar , int _Options, typename _Index >
template<typename OtherDerived >
SparseVector< _Scalar, _Options, _Index >::SparseVector ( const SparseMatrixBase< OtherDerived > &  other  )  [inline]
template<typename _Scalar , int _Options, typename _Index >
SparseVector< _Scalar, _Options, _Index >::SparseVector ( const SparseVector< _Scalar, _Options, _Index > &  other  )  [inline]
template<typename _Scalar , int _Options, typename _Index >
SparseVector< _Scalar, _Options, _Index >::~SparseVector (  )  [inline]

Destructor


Member Function Documentation

template<typename _Scalar , int _Options, typename _Index >
CompressedStorage<Scalar,Index>& SparseVector< _Scalar, _Options, _Index >::_data (  )  [inline]
template<typename _Scalar , int _Options, typename _Index >
CompressedStorage<Scalar,Index>& SparseVector< _Scalar, _Options, _Index >::_data (  )  const [inline]
template<typename _Scalar , int _Options, typename _Index >
EIGEN_STRONG_INLINE const Index* SparseVector< _Scalar, _Options, _Index >::_innerIndexPtr (  )  const [inline]
template<typename _Scalar , int _Options, typename _Index >
EIGEN_STRONG_INLINE Index* SparseVector< _Scalar, _Options, _Index >::_innerIndexPtr (  )  [inline]
template<typename _Scalar , int _Options, typename _Index >
EIGEN_STRONG_INLINE const Scalar* SparseVector< _Scalar, _Options, _Index >::_valuePtr (  )  const [inline]
template<typename _Scalar , int _Options, typename _Index >
EIGEN_STRONG_INLINE Scalar* SparseVector< _Scalar, _Options, _Index >::_valuePtr (  )  [inline]
template<typename _Scalar , int _Options, typename _Index >
Scalar SparseVector< _Scalar, _Options, _Index >::coeff ( Index  row,
Index  col 
) const [inline]
template<typename _Scalar , int _Options, typename _Index >
Scalar SparseVector< _Scalar, _Options, _Index >::coeff ( Index  i  )  const [inline]
template<typename _Scalar , int _Options, typename _Index >
Scalar& SparseVector< _Scalar, _Options, _Index >::coeffRef ( Index  row,
Index  col 
) [inline]
template<typename _Scalar , int _Options, typename _Index >
Scalar& SparseVector< _Scalar, _Options, _Index >::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.

template<typename _Scalar , int _Options, typename _Index >
EIGEN_STRONG_INLINE Index SparseVector< _Scalar, _Options, _Index >::cols ( void   )  const [inline]
Returns:
the number of columns.
See also:
rows(), ColsAtCompileTime

Reimplemented from SparseMatrixBase< SparseVector< _Scalar, _Options, _Index > >.

template<typename _Scalar , int _Options, typename _Index >
EIGEN_DEPRECATED void SparseVector< _Scalar, _Options, _Index >::endFill (  )  [inline]
template<typename _Scalar , int _Options, typename _Index >
EIGEN_DEPRECATED Scalar& SparseVector< _Scalar, _Options, _Index >::fill ( Index  r,
Index  c 
) [inline]
Deprecated:
use insertBack(Index,Index)
template<typename _Scalar , int _Options, typename _Index >
EIGEN_DEPRECATED Scalar& SparseVector< _Scalar, _Options, _Index >::fill ( Index  i  )  [inline]
template<typename _Scalar , int _Options, typename _Index >
EIGEN_DEPRECATED Scalar& SparseVector< _Scalar, _Options, _Index >::fillrand ( Index  r,
Index  c 
) [inline]
template<typename _Scalar , int _Options, typename _Index >
EIGEN_DEPRECATED Scalar& SparseVector< _Scalar, _Options, _Index >::fillrand ( Index  i  )  [inline]
template<typename _Scalar , int _Options, typename _Index >
void SparseVector< _Scalar, _Options, _Index >::finalize (  )  [inline]
template<typename _Scalar , int _Options, typename _Index >
EIGEN_STRONG_INLINE Index SparseVector< _Scalar, _Options, _Index >::innerNonZeros ( Index  j  )  const [inline]
template<typename _Scalar , int _Options, typename _Index >
EIGEN_STRONG_INLINE Index SparseVector< _Scalar, _Options, _Index >::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

Reimplemented from SparseMatrixBase< SparseVector< _Scalar, _Options, _Index > >.

template<typename _Scalar , int _Options, typename _Index >
Scalar& SparseVector< _Scalar, _Options, _Index >::insert ( Index  row,
Index  col 
) [inline]
template<typename _Scalar , int _Options, typename _Index >
Scalar& SparseVector< _Scalar, _Options, _Index >::insert ( Index  i  )  [inline]
template<typename _Scalar , int _Options, typename _Index >
Scalar& SparseVector< _Scalar, _Options, _Index >::insertBack ( Index  i  )  [inline]
template<typename _Scalar , int _Options, typename _Index >
Scalar& SparseVector< _Scalar, _Options, _Index >::insertBackByOuterInner ( Index  outer,
Index  inner 
) [inline]
template<typename _Scalar , int _Options, typename _Index >
Index SparseVector< _Scalar, _Options, _Index >::nonZeros (  )  const [inline]
Returns:
the number of non zero coefficients

Reimplemented from SparseMatrixBase< SparseVector< _Scalar, _Options, _Index > >.

template<typename _Scalar , int _Options, typename _Index >
template<typename Lhs , typename Rhs >
SparseVector& SparseVector< _Scalar, _Options, _Index >::operator= ( const SparseSparseProduct< Lhs, Rhs > &  product  )  [inline]
template<typename _Scalar , int _Options, typename _Index >
SparseVector& SparseVector< _Scalar, _Options, _Index >::operator= ( const SparseVector< _Scalar, _Options, _Index > &  other  )  [inline]
template<typename _Scalar , int _Options, typename _Index >
template<typename OtherDerived >
SparseVector& SparseVector< _Scalar, _Options, _Index >::operator= ( const SparseMatrixBase< OtherDerived > &  other  )  [inline]
template<typename _Scalar , int _Options, typename _Index >
EIGEN_STRONG_INLINE Index SparseVector< _Scalar, _Options, _Index >::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

Reimplemented from SparseMatrixBase< SparseVector< _Scalar, _Options, _Index > >.

template<typename _Scalar , int _Options, typename _Index >
void SparseVector< _Scalar, _Options, _Index >::prune ( Scalar  reference,
RealScalar  epsilon = NumTraits<RealScalar>::dummy_precision() 
) [inline]
template<typename _Scalar , int _Options, typename _Index >
void SparseVector< _Scalar, _Options, _Index >::reserve ( Index  reserveSize  )  [inline]
template<typename _Scalar , int _Options, typename _Index >
void SparseVector< _Scalar, _Options, _Index >::resize ( Index  newSize  )  [inline]
template<typename _Scalar , int _Options, typename _Index >
void SparseVector< _Scalar, _Options, _Index >::resize ( Index  rows,
Index  cols 
) [inline]
template<typename _Scalar , int _Options, typename _Index >
void SparseVector< _Scalar, _Options, _Index >::resizeNonZeros ( Index  size  )  [inline]
template<typename _Scalar , int _Options, typename _Index >
EIGEN_STRONG_INLINE Index SparseVector< _Scalar, _Options, _Index >::rows ( void   )  const [inline]
Returns:
the number of rows.
See also:
cols(), RowsAtCompileTime

Reimplemented from SparseMatrixBase< SparseVector< _Scalar, _Options, _Index > >.

template<typename _Scalar , int _Options, typename _Index >
void SparseVector< _Scalar, _Options, _Index >::setZero (  )  [inline]
template<typename _Scalar , int _Options, typename _Index >
EIGEN_DEPRECATED void SparseVector< _Scalar, _Options, _Index >::startFill ( Index  reserve  )  [inline]
template<typename _Scalar , int _Options, typename _Index >
void SparseVector< _Scalar, _Options, _Index >::startVec ( Index  outer  )  [inline]
template<typename _Scalar , int _Options, typename _Index >
internal::traits< SparseVector< _Scalar, _Options, _Index > >::Scalar SparseVector< _Scalar, _Options, _Index >::sum (  )  const

Overloaded for performance

Reimplemented from SparseMatrixBase< SparseVector< _Scalar, _Options, _Index > >.

template<typename _Scalar , int _Options, typename _Index >
void SparseVector< _Scalar, _Options, _Index >::swap ( SparseVector< _Scalar, _Options, _Index > &  other  )  [inline]

Friends And Related Function Documentation

template<typename _Scalar , int _Options, typename _Index >
std::ostream& operator<< ( std::ostream &  s,
const SparseVector< _Scalar, _Options, _Index > &  m 
) [friend]

Member Data Documentation

template<typename _Scalar , int _Options, typename _Index >
CompressedStorage<Scalar,Index> SparseVector< _Scalar, _Options, _Index >::m_data
template<typename _Scalar , int _Options, typename _Index >
Index SparseVector< _Scalar, _Options, _Index >::m_size

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