Main MRPT website > C++ reference
MRPT logo
Classes | Public Types | Public Member Functions | Public Attributes | Friends

SparseVector< _Scalar, _Options, _Index > Class Template Reference


Detailed Description

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

a sparse vector class

Parameters:
_Scalarthe 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.

Definition at line 61 of file SparseVector.h.

#include <src/Sparse/SparseVector.h>

Inheritance diagram for SparseVector< _Scalar, _Options, _Index >:
Inheritance graph
[legend]

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
Scalar & coeffRef (Index row, Index col)
Scalar & coeffRef (Index i)
void setZero ()
Index nonZeros () const
void startVec (Index outer)
Scalar & insertBackByOuterInner (Index outer, Index inner)
Scalar & insertBack (Index i)
Scalar & insert (Index row, Index col)
Scalar & insert (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)
SparseVector & operator= (const SparseVector &other)
template<typename OtherDerived >
SparseVector & operator= (const SparseMatrixBase< OtherDerived > &other)
 ~SparseVector ()
 Destructor.
Scalar sum () const
 Overloaded for performance.
EIGEN_DEPRECATED void startFill (Index reserve)
EIGEN_DEPRECATED Scalar & fill (Index r, Index c)
EIGEN_DEPRECATED Scalar & fill (Index i)
EIGEN_DEPRECATED Scalar & fillrand (Index r, Index c)
EIGEN_DEPRECATED Scalar & fillrand (Index i)
EIGEN_DEPRECATED void endFill ()

Public Attributes

CompressedStorage< Scalar, Index > m_data
Index m_size

Friends

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

Member Typedef Documentation

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

Definition at line 73 of file SparseVector.h.


Member Enumeration Documentation

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

Definition at line 74 of file SparseVector.h.

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

Definition at line 76 of file SparseVector.h.


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]

Definition at line 207 of file SparseVector.h.

template<typename _Scalar , int _Options, typename _Index >
template<typename OtherDerived >
SparseVector< _Scalar, _Options, _Index >::SparseVector ( const SparseMatrixBase< OtherDerived > &  other) [inline]

Definition at line 214 of file SparseVector.h.

References EigenBase< Derived >::derived().

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

Definition at line 220 of file SparseVector.h.

References EigenBase< Derived >::derived().

template<typename _Scalar , int _Options, typename _Index >
SparseVector< _Scalar, _Options, _Index >::~SparseVector ( ) [inline]

Destructor.

Definition at line 344 of file SparseVector.h.


Member Function Documentation

template<typename _Scalar , int _Options, typename _Index >
CompressedStorage<Scalar,Index>& SparseVector< _Scalar, _Options, _Index >::_data ( ) [inline]

Definition at line 83 of file SparseVector.h.

References SparseVector< _Scalar, _Options, _Index >::m_data.

template<typename _Scalar , int _Options, typename _Index >
CompressedStorage<Scalar,Index>& SparseVector< _Scalar, _Options, _Index >::_data ( ) const [inline]

Definition at line 84 of file SparseVector.h.

References SparseVector< _Scalar, _Options, _Index >::m_data.

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.

Definition at line 119 of file SparseVector.h.

References CompressedStorage< _Scalar, _Index >::atWithInsertion(), and SparseVector< _Scalar, _Options, _Index >::m_data.

template<typename _Scalar , int _Options, typename _Index >
EIGEN_STRONG_INLINE Index SparseVector< _Scalar, _Options, _Index >::cols ( void  ) const [inline]
template<typename _Scalar , int _Options, typename _Index >
EIGEN_DEPRECATED void SparseVector< _Scalar, _Options, _Index >::endFill ( ) [inline]
Deprecated:
use finalize()

Definition at line 386 of file SparseVector.h.

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 >::fill ( Index  r,
Index  c 
) [inline]
Deprecated:
use insertBack(Index,Index)

Definition at line 359 of file SparseVector.h.

References eigen_assert, and SparseVector< _Scalar, _Options, _Index >::IsColVector.

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]

Definition at line 179 of file SparseVector.h.

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 > >.

Definition at line 90 of file SparseVector.h.

References SparseVector< _Scalar, _Options, _Index >::m_size.

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 > >.

Definition at line 131 of file SparseVector.h.

References SparseVector< _Scalar, _Options, _Index >::m_data, and CompressedStorage< _Scalar, _Index >::size().

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 >
SparseVector& SparseVector< _Scalar, _Options, _Index >::operator= ( const SparseVector< _Scalar, _Options, _Index > &  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 > >.

Definition at line 91 of file SparseVector.h.

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]
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]

Definition at line 133 of file SparseVector.h.

References eigen_assert.

template<typename _Scalar , int _Options, typename _Index >
internal::traits< SparseVector< _Scalar, _Options, _Index > >::Scalar SparseVector< _Scalar, _Options, _Index >::sum ( ) const
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]

Definition at line 313 of file SparseVector.h.


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



Page generated by Doxygen 1.7.3 for MRPT 0.9.4 SVN:exported at Tue Jan 25 21:56:31 UTC 2011