MOAB  4.9.3pre
Eigen::SparseVector< _Scalar, _Options, _StorageIndex > Class Template Reference

a sparse vector class More...

#include <SparseVector.h>

Inheritance diagram for Eigen::SparseVector< _Scalar, _Options, _StorageIndex >:
Collaboration diagram for Eigen::SparseVector< _Scalar, _Options, _StorageIndex >:

List of all members.

Public Types

enum  { IsColVector = internal::traits<SparseVector>::IsColVector }
enum  { Options = _Options }
typedef
internal::CompressedStorage
< Scalar, StorageIndex
Storage
typedef Base::InnerIterator InnerIterator
typedef Base::ReverseInnerIterator ReverseInnerIterator

Public Member Functions

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 const ScalarvaluePtr () const
EIGEN_STRONG_INLINE ScalarvaluePtr ()
EIGEN_STRONG_INLINE const
StorageIndex
innerIndexPtr () const
EIGEN_STRONG_INLINE StorageIndexinnerIndexPtr ()
const StorageIndexouterIndexPtr () const
StorageIndexouterIndexPtr ()
const StorageIndexinnerNonZeroPtr () const
StorageIndexinnerNonZeroPtr ()
Storagedata ()
const Storagedata () const
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)
ScalarinsertBackByOuterInnerUnordered (Index outer, Index inner)
ScalarinsertBackUnordered (Index i)
Scalarinsert (Index row, Index col)
Scalarinsert (Index i)
void reserve (Index reserveSize)
void finalize ()
void prune (const Scalar &reference, const RealScalar &epsilon=NumTraits< RealScalar >::dummy_precision())
void resize (Index rows, Index cols)
void resize (Index newSize)
void conservativeResize (Index newSize)
void resizeNonZeros (Index size)
 SparseVector ()
 SparseVector (Index size)
 SparseVector (Index rows, Index cols)
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 ()
EIGEN_DEPRECATED Storage_data ()
EIGEN_DEPRECATED const Storage_data () const

Static Protected Member Functions

static void check_template_parameters ()

Protected Attributes

Storage m_data
Index m_size

Private Types

typedef SparseCompressedBase
< SparseVector
Base

Friends

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

Detailed Description

template<typename _Scalar, int _Options, typename _StorageIndex>
class Eigen::SparseVector< _Scalar, _Options, _StorageIndex >

a sparse vector class

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

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.

Definition at line 64 of file SparseVector.h.


Member Typedef Documentation

template<typename _Scalar, int _Options, typename _StorageIndex>
typedef SparseCompressedBase<SparseVector> Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::Base [private]
template<typename _Scalar, int _Options, typename _StorageIndex>
typedef Base::InnerIterator Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::InnerIterator

Definition at line 134 of file SparseVector.h.

template<typename _Scalar, int _Options, typename _StorageIndex>
typedef Base::ReverseInnerIterator Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::ReverseInnerIterator

Definition at line 135 of file SparseVector.h.

template<typename _Scalar, int _Options, typename _StorageIndex>
typedef internal::CompressedStorage<Scalar,StorageIndex> Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::Storage

Definition at line 74 of file SparseVector.h.


Member Enumeration Documentation

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

Definition at line 75 of file SparseVector.h.

{ IsColVector = internal::traits<SparseVector>::IsColVector };
template<typename _Scalar, int _Options, typename _StorageIndex>
anonymous enum
Enumerator:
Options 

Definition at line 77 of file SparseVector.h.

         {
      Options = _Options
    };

Constructor & Destructor Documentation

template<typename _Scalar, int _Options, typename _StorageIndex>
Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::SparseVector ( ) [inline]

Definition at line 259 of file SparseVector.h.

template<typename _Scalar, int _Options, typename _StorageIndex>
Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::SparseVector ( Index  size) [inline, explicit]

Definition at line 261 of file SparseVector.h.

template<typename _Scalar, int _Options, typename _StorageIndex>
Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::SparseVector ( Index  rows,
Index  cols 
) [inline]

Definition at line 263 of file SparseVector.h.

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

Definition at line 266 of file SparseVector.h.

      : m_size(0)
    {
      #ifdef EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN
        EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN
      #endif
      check_template_parameters();
      *this = other.derived();
    }
template<typename _Scalar, int _Options, typename _StorageIndex>
Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::SparseVector ( const SparseVector< _Scalar, _Options, _StorageIndex > &  other) [inline]

Definition at line 276 of file SparseVector.h.

      : Base(other), m_size(0)
    {
      check_template_parameters();
      *this = other.derived();
    }
template<typename _Scalar, int _Options, typename _StorageIndex>
Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::~SparseVector ( ) [inline]

Destructor

Definition at line 333 of file SparseVector.h.

{}

Member Function Documentation

template<typename _Scalar, int _Options, typename _StorageIndex>
EIGEN_DEPRECATED Storage& Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::_data ( ) [inline]
Deprecated:
use data()

Definition at line 379 of file SparseVector.h.

{ return m_data; }
template<typename _Scalar, int _Options, typename _StorageIndex>
EIGEN_DEPRECATED const Storage& Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::_data ( ) const [inline]
Deprecated:
use data()

Definition at line 381 of file SparseVector.h.

{ return m_data; }
template<typename _Scalar, int _Options, typename _StorageIndex>
static void Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::check_template_parameters ( ) [inline, static, protected]

Definition at line 389 of file SparseVector.h.

    {
      EIGEN_STATIC_ASSERT(NumTraits<StorageIndex>::IsSigned,THE_INDEX_TYPE_MUST_BE_A_SIGNED_TYPE);
      EIGEN_STATIC_ASSERT((_Options&(ColMajor|RowMajor))==Options,INVALID_MATRIX_TEMPLATE_PARAMETERS);
    }
template<typename _Scalar, int _Options, typename _StorageIndex>
Scalar Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::coeff ( Index  row,
Index  col 
) const [inline]

Definition at line 102 of file SparseVector.h.

    {
      eigen_assert(IsColVector ? (col==0 && row>=0 && row<m_size) : (row==0 && col>=0 && col<m_size));
      return coeff(IsColVector ? row : col);
    }
template<typename _Scalar, int _Options, typename _StorageIndex>
Scalar Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::coeff ( Index  i) const [inline]

Definition at line 107 of file SparseVector.h.

    {
      eigen_assert(i>=0 && i<m_size);
      return m_data.at(StorageIndex(i));
    }
template<typename _Scalar, int _Options, typename _StorageIndex>
Scalar& Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::coeffRef ( Index  row,
Index  col 
) [inline]

Definition at line 113 of file SparseVector.h.

    {
      eigen_assert(IsColVector ? (col==0 && row>=0 && row<m_size) : (row==0 && col>=0 && col<m_size));
      return coeffRef(IsColVector ? row : col);
    }
template<typename _Scalar, int _Options, typename _StorageIndex>
Scalar& Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::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 125 of file SparseVector.h.

    {
      eigen_assert(i>=0 && i<m_size);

      return m_data.atWithInsertion(StorageIndex(i));
    }
template<typename _Scalar, int _Options, typename _StorageIndex>
EIGEN_STRONG_INLINE Index Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::cols ( void  ) const [inline]
Returns:
the number of columns.
See also:
rows()

Reimplemented from Eigen::SparseMatrixBase< SparseVector< _Scalar, _Options, _StorageIndex > >.

Definition at line 82 of file SparseVector.h.

{ return IsColVector ? 1 : m_size; }
template<typename _Scalar, int _Options, typename _StorageIndex>
void Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::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.

See also:
reserve(), setZero()

Definition at line 246 of file SparseVector.h.

    {
      if (newSize < m_size)
      {
        Index i = 0;
        while (i<m_data.size() && m_data.index(i)<newSize) ++i;
        m_data.resize(i);
      }
      m_size = newSize;
    }
template<typename _Scalar, int _Options, typename _StorageIndex>
Storage& Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::data ( ) [inline]

Definition at line 98 of file SparseVector.h.

{ return m_data; }
template<typename _Scalar, int _Options, typename _StorageIndex>
const Storage& Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::data ( ) const [inline]

Definition at line 100 of file SparseVector.h.

{ return m_data; }
template<typename _Scalar, int _Options, typename _StorageIndex>
EIGEN_DEPRECATED void Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::endFill ( ) [inline]
Deprecated:
use finalize()

Definition at line 375 of file SparseVector.h.

{}
template<typename _Scalar, int _Options, typename _StorageIndex>
EIGEN_DEPRECATED Scalar& Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::fill ( Index  r,
Index  c 
) [inline]
Deprecated:
use insertBack(Index,Index)

Definition at line 348 of file SparseVector.h.

    {
      eigen_assert(r==0 || c==0);
      return fill(IsColVector ? r : c);
    }
template<typename _Scalar, int _Options, typename _StorageIndex>
EIGEN_DEPRECATED Scalar& Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::fill ( Index  i) [inline]
Deprecated:
use insertBack(Index)

Definition at line 355 of file SparseVector.h.

    {
      m_data.append(0, i);
      return m_data.value(m_data.size()-1);
    }
template<typename _Scalar, int _Options, typename _StorageIndex>
EIGEN_DEPRECATED Scalar& Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::fillrand ( Index  r,
Index  c 
) [inline]
Deprecated:
use insert(Index,Index)

Definition at line 362 of file SparseVector.h.

    {
      eigen_assert(r==0 || c==0);
      return fillrand(IsColVector ? r : c);
    }
template<typename _Scalar, int _Options, typename _StorageIndex>
EIGEN_DEPRECATED Scalar& Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::fillrand ( Index  i) [inline]
Deprecated:
use insert(Index)

Definition at line 369 of file SparseVector.h.

    {
      return insert(i);
    }
template<typename _Scalar, int _Options, typename _StorageIndex>
void Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::finalize ( ) [inline]

Definition at line 207 of file SparseVector.h.

{}
template<typename _Scalar, int _Options, typename _StorageIndex>
EIGEN_STRONG_INLINE const StorageIndex* Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::innerIndexPtr ( ) const [inline]
Returns:
a const pointer to the array of inner indices. This function is aimed at interoperability with other libraries.
See also:
valuePtr(), outerIndexPtr()

Reimplemented from Eigen::SparseCompressedBase< SparseVector< _Scalar, _Options, _StorageIndex > >.

Definition at line 89 of file SparseVector.h.

{ return m_data.indexPtr(); }
template<typename _Scalar, int _Options, typename _StorageIndex>
EIGEN_STRONG_INLINE StorageIndex* Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::innerIndexPtr ( ) [inline]
Returns:
a non-const pointer to the array of inner indices. This function is aimed at interoperability with other libraries.
See also:
valuePtr(), outerIndexPtr()

Reimplemented from Eigen::SparseCompressedBase< SparseVector< _Scalar, _Options, _StorageIndex > >.

Definition at line 90 of file SparseVector.h.

{ return m_data.indexPtr(); }
template<typename _Scalar, int _Options, typename _StorageIndex>
const StorageIndex* Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::innerNonZeroPtr ( ) const [inline]
Returns:
a const pointer to the array of the number of non zeros of the inner vectors. This function is aimed at interoperability with other libraries.
Warning:
it returns the null pointer 0 in compressed mode

Reimplemented from Eigen::SparseCompressedBase< SparseVector< _Scalar, _Options, _StorageIndex > >.

Definition at line 94 of file SparseVector.h.

{ return 0; }
template<typename _Scalar, int _Options, typename _StorageIndex>
StorageIndex* Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::innerNonZeroPtr ( ) [inline]
Returns:
a non-const pointer to the array of the number of non zeros of the inner vectors. This function is aimed at interoperability with other libraries.
Warning:
it returns the null pointer 0 in compressed mode

Reimplemented from Eigen::SparseCompressedBase< SparseVector< _Scalar, _Options, _StorageIndex > >.

Definition at line 95 of file SparseVector.h.

{ return 0; }
template<typename _Scalar, int _Options, typename _StorageIndex>
EIGEN_STRONG_INLINE Index Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::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 Eigen::SparseMatrixBase< SparseVector< _Scalar, _Options, _StorageIndex > >.

Definition at line 83 of file SparseVector.h.

{ return m_size; }
template<typename _Scalar, int _Options, typename _StorageIndex>
Scalar& Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::insert ( Index  row,
Index  col 
) [inline]

Definition at line 172 of file SparseVector.h.

    {
      eigen_assert(IsColVector ? (col==0 && row>=0 && row<m_size) : (row==0 && col>=0 && col<m_size));
      
      Index inner = IsColVector ? row : col;
      Index outer = IsColVector ? col : row;
      EIGEN_ONLY_USED_FOR_DEBUG(outer);
      eigen_assert(outer==0);
      return insert(inner);
    }
template<typename _Scalar, int _Options, typename _StorageIndex>
Scalar& Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::insert ( Index  i) [inline]

Definition at line 182 of file SparseVector.h.

    {
      eigen_assert(i>=0 && i<m_size);
      
      Index startId = 0;
      Index p = Index(m_data.size()) - 1;
      // TODO smart realloc
      m_data.resize(p+2,1);

      while ( (p >= startId) && (m_data.index(p) > i) )
      {
        m_data.index(p+1) = m_data.index(p);
        m_data.value(p+1) = m_data.value(p);
        --p;
      }
      m_data.index(p+1) = convert_index(i);
      m_data.value(p+1) = 0;
      return m_data.value(p+1);
    }
template<typename _Scalar, int _Options, typename _StorageIndex>
Scalar& Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::insertBack ( Index  i) [inline]

Definition at line 154 of file SparseVector.h.

    {
      m_data.append(0, i);
      return m_data.value(m_data.size()-1);
    }
template<typename _Scalar, int _Options, typename _StorageIndex>
Scalar& Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::insertBackByOuterInner ( Index  outer,
Index  inner 
) [inline]

Definition at line 148 of file SparseVector.h.

    {
      EIGEN_UNUSED_VARIABLE(outer);
      eigen_assert(outer==0);
      return insertBack(inner);
    }
template<typename _Scalar, int _Options, typename _StorageIndex>
Scalar& Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::insertBackByOuterInnerUnordered ( Index  outer,
Index  inner 
) [inline]

Definition at line 160 of file SparseVector.h.

    {
      EIGEN_UNUSED_VARIABLE(outer);
      eigen_assert(outer==0);
      return insertBackUnordered(inner);
    }
template<typename _Scalar, int _Options, typename _StorageIndex>
Scalar& Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::insertBackUnordered ( Index  i) [inline]

Definition at line 166 of file SparseVector.h.

    {
      m_data.append(0, i);
      return m_data.value(m_data.size()-1);
    }
template<typename _Scalar, int _Options, typename _StorageIndex>
Index Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::nonZeros ( ) const [inline]
Returns:
the number of non zero coefficients

Reimplemented from Eigen::SparseCompressedBase< SparseVector< _Scalar, _Options, _StorageIndex > >.

Definition at line 140 of file SparseVector.h.

{ return m_data.size(); }
template<typename _Scalar, int _Options, typename _StorageIndex>
SparseVector& Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::operator= ( const SparseVector< _Scalar, _Options, _StorageIndex > &  other) [inline]

Reimplemented from Eigen::SparseMatrixBase< SparseVector< _Scalar, _Options, _StorageIndex > >.

Definition at line 293 of file SparseVector.h.

    {
      if (other.isRValue())
      {
        swap(other.const_cast_derived());
      }
      else
      {
        resize(other.size());
        m_data = other.m_data;
      }
      return *this;
    }
template<typename _Scalar, int _Options, typename _StorageIndex>
template<typename OtherDerived >
SparseVector& Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::operator= ( const SparseMatrixBase< OtherDerived > &  other) [inline]

Reimplemented from Eigen::SparseMatrixBase< SparseVector< _Scalar, _Options, _StorageIndex > >.

Definition at line 308 of file SparseVector.h.

    {
      SparseVector tmp(other.size());
      internal::sparse_vector_assign_selector<SparseVector,OtherDerived>::run(tmp,other.derived());
      this->swap(tmp);
      return *this;
    }
template<typename _Scalar, int _Options, typename _StorageIndex>
template<typename Lhs , typename Rhs >
SparseVector& Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::operator= ( const SparseSparseProduct< Lhs, Rhs > &  product) [inline]

Definition at line 318 of file SparseVector.h.

    {
      return Base::operator=(product);
    }
template<typename _Scalar, int _Options, typename _StorageIndex>
const StorageIndex* Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::outerIndexPtr ( ) const [inline]
Returns:
a const pointer to the array of the starting positions of the inner vectors. This function is aimed at interoperability with other libraries.
Warning:
it returns the null pointer 0 for SparseVector
See also:
valuePtr(), innerIndexPtr()

Reimplemented from Eigen::SparseCompressedBase< SparseVector< _Scalar, _Options, _StorageIndex > >.

Definition at line 92 of file SparseVector.h.

{ return 0; }
template<typename _Scalar, int _Options, typename _StorageIndex>
StorageIndex* Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::outerIndexPtr ( ) [inline]
Returns:
a non-const pointer to the array of the starting positions of the inner vectors. This function is aimed at interoperability with other libraries.
Warning:
it returns the null pointer 0 for SparseVector
See also:
valuePtr(), innerIndexPtr()

Reimplemented from Eigen::SparseCompressedBase< SparseVector< _Scalar, _Options, _StorageIndex > >.

Definition at line 93 of file SparseVector.h.

{ return 0; }
template<typename _Scalar, int _Options, typename _StorageIndex>
EIGEN_STRONG_INLINE Index Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::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 Eigen::SparseMatrixBase< SparseVector< _Scalar, _Options, _StorageIndex > >.

Definition at line 84 of file SparseVector.h.

{ return 1; }
template<typename _Scalar, int _Options, typename _StorageIndex>
void Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::prune ( const Scalar reference,
const RealScalar epsilon = NumTraits<RealScalar>::dummy_precision() 
) [inline]

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

Definition at line 210 of file SparseVector.h.

    {
      m_data.prune(reference,epsilon);
    }
template<typename _Scalar, int _Options, typename _StorageIndex>
void Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::reserve ( Index  reserveSize) [inline]

Definition at line 204 of file SparseVector.h.

{ m_data.reserve(reserveSize); }
template<typename _Scalar, int _Options, typename _StorageIndex>
void Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::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.

See also:
resize(Index)

Definition at line 223 of file SparseVector.h.

    {
      eigen_assert((IsColVector ? cols : rows)==1 && "Outer dimension must equal 1");
      resize(IsColVector ? rows : cols);
    }
template<typename _Scalar, int _Options, typename _StorageIndex>
void Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::resize ( Index  newSize) [inline]

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

See also:
conservativeResize(), setZero()

Definition at line 233 of file SparseVector.h.

    {
      m_size = newSize;
      m_data.clear();
    }
template<typename _Scalar, int _Options, typename _StorageIndex>
void Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::resizeNonZeros ( Index  size) [inline]

Definition at line 257 of file SparseVector.h.

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

Reimplemented from Eigen::SparseMatrixBase< SparseVector< _Scalar, _Options, _StorageIndex > >.

Definition at line 81 of file SparseVector.h.

{ return IsColVector ? m_size : 1; }
template<typename _Scalar, int _Options, typename _StorageIndex>
void Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::setZero ( ) [inline]

Definition at line 137 of file SparseVector.h.

{ m_data.clear(); }
template<typename _Scalar, int _Options, typename _StorageIndex>
EIGEN_DEPRECATED void Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::startFill ( Index  reserve) [inline]
Deprecated:
use setZero() and reserve()

Definition at line 341 of file SparseVector.h.

template<typename _Scalar, int _Options, typename _StorageIndex>
void Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::startVec ( Index  outer) [inline]

Definition at line 142 of file SparseVector.h.

    {
      EIGEN_UNUSED_VARIABLE(outer);
      eigen_assert(outer==0);
    }
template<typename _Scalar , int _Options, typename _Index >
internal::traits< SparseVector< _Scalar, _Options, _Index > >::Scalar Eigen::SparseVector< _Scalar, _Options, _Index >::sum ( ) const

Overloaded for performance

Reimplemented from Eigen::SparseMatrixBase< SparseVector< _Scalar, _Options, _StorageIndex > >.

Definition at line 38 of file SparseRedux.h.

{
  eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix");
  return Matrix<Scalar,1,Dynamic>::Map(m_data.valuePtr(), m_data.size()).sum();
}
template<typename _Scalar, int _Options, typename _StorageIndex>
void Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::swap ( SparseVector< _Scalar, _Options, _StorageIndex > &  other) [inline]

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

See also:
SparseMatrixBase::swap()

Definition at line 287 of file SparseVector.h.

    {
      std::swap(m_size, other.m_size);
      m_data.swap(other.m_data);
    }
template<typename _Scalar, int _Options, typename _StorageIndex>
EIGEN_STRONG_INLINE const Scalar* Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::valuePtr ( ) const [inline]
Returns:
a const pointer to the array of values. This function is aimed at interoperability with other libraries.
See also:
innerIndexPtr(), outerIndexPtr()

Reimplemented from Eigen::SparseCompressedBase< SparseVector< _Scalar, _Options, _StorageIndex > >.

Definition at line 86 of file SparseVector.h.

{ return m_data.valuePtr(); }
template<typename _Scalar, int _Options, typename _StorageIndex>
EIGEN_STRONG_INLINE Scalar* Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::valuePtr ( ) [inline]
Returns:
a non-const pointer to the array of values. This function is aimed at interoperability with other libraries.
See also:
innerIndexPtr(), outerIndexPtr()

Reimplemented from Eigen::SparseCompressedBase< SparseVector< _Scalar, _Options, _StorageIndex > >.

Definition at line 87 of file SparseVector.h.

{ return m_data.valuePtr(); }

Friends And Related Function Documentation

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

Definition at line 324 of file SparseVector.h.

    {
      for (Index i=0; i<m.nonZeros(); ++i)
        s << "(" << m.m_data.value(i) << "," << m.m_data.index(i) << ") ";
      s << std::endl;
      return s;
    }

Member Data Documentation

template<typename _Scalar, int _Options, typename _StorageIndex>
Storage Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::m_data [protected]

Definition at line 395 of file SparseVector.h.

template<typename _Scalar, int _Options, typename _StorageIndex>
Index Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::m_size [protected]

Definition at line 396 of file SparseVector.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines