MOAB
4.9.3pre
|
a sparse vector class More...
#include <SparseVector.h>
a sparse vector class
_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
.
Definition at line 64 of file SparseVector.h.
typedef SparseCompressedBase<SparseVector> Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::Base [private] |
Reimplemented from Eigen::SparseCompressedBase< SparseVector< _Scalar, _Options, _StorageIndex > >.
Definition at line 67 of file SparseVector.h.
typedef Base::InnerIterator Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::InnerIterator |
Definition at line 134 of file SparseVector.h.
typedef Base::ReverseInnerIterator Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::ReverseInnerIterator |
Definition at line 135 of file SparseVector.h.
typedef internal::CompressedStorage<Scalar,StorageIndex> Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::Storage |
Definition at line 74 of file SparseVector.h.
anonymous enum |
Definition at line 75 of file SparseVector.h.
{ IsColVector = internal::traits<SparseVector>::IsColVector };
anonymous enum |
Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::SparseVector | ( | ) | [inline] |
Definition at line 259 of file SparseVector.h.
: m_size(0) { check_template_parameters(); resize(0); }
Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::SparseVector | ( | Index | size | ) | [inline, explicit] |
Definition at line 261 of file SparseVector.h.
: m_size(0) { check_template_parameters(); resize(size); }
Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::SparseVector | ( | Index | rows, |
Index | cols | ||
) | [inline] |
Definition at line 263 of file SparseVector.h.
: m_size(0) { check_template_parameters(); resize(rows,cols); }
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(); }
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(); }
Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::~SparseVector | ( | ) | [inline] |
EIGEN_DEPRECATED Storage& Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::_data | ( | ) | [inline] |
EIGEN_DEPRECATED const Storage& Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::_data | ( | ) | const [inline] |
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); }
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); }
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)); }
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); }
Scalar& Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::coeffRef | ( | Index | i | ) | [inline] |
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)); }
EIGEN_STRONG_INLINE Index Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::cols | ( | void | ) | const [inline] |
Reimplemented from Eigen::SparseMatrixBase< SparseVector< _Scalar, _Options, _StorageIndex > >.
Definition at line 82 of file SparseVector.h.
{ return IsColVector ? 1 : m_size; }
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.
Definition at line 246 of file SparseVector.h.
Storage& Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::data | ( | ) | [inline] |
Definition at line 98 of file SparseVector.h.
{ return m_data; }
const Storage& Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::data | ( | ) | const [inline] |
Definition at line 100 of file SparseVector.h.
{ return m_data; }
EIGEN_DEPRECATED void Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::endFill | ( | ) | [inline] |
EIGEN_DEPRECATED Scalar& Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::fill | ( | Index | r, |
Index | c | ||
) | [inline] |
Definition at line 348 of file SparseVector.h.
{ eigen_assert(r==0 || c==0); return fill(IsColVector ? r : c); }
EIGEN_DEPRECATED Scalar& Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::fill | ( | Index | i | ) | [inline] |
Definition at line 355 of file SparseVector.h.
EIGEN_DEPRECATED Scalar& Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::fillrand | ( | Index | r, |
Index | c | ||
) | [inline] |
Definition at line 362 of file SparseVector.h.
{ eigen_assert(r==0 || c==0); return fillrand(IsColVector ? r : c); }
EIGEN_DEPRECATED Scalar& Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::fillrand | ( | Index | i | ) | [inline] |
void Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::finalize | ( | ) | [inline] |
Definition at line 207 of file SparseVector.h.
{}
EIGEN_STRONG_INLINE const StorageIndex* Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::innerIndexPtr | ( | ) | const [inline] |
Reimplemented from Eigen::SparseCompressedBase< SparseVector< _Scalar, _Options, _StorageIndex > >.
Definition at line 89 of file SparseVector.h.
EIGEN_STRONG_INLINE StorageIndex* Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::innerIndexPtr | ( | ) | [inline] |
Reimplemented from Eigen::SparseCompressedBase< SparseVector< _Scalar, _Options, _StorageIndex > >.
Definition at line 90 of file SparseVector.h.
const StorageIndex* Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::innerNonZeroPtr | ( | ) | const [inline] |
Reimplemented from Eigen::SparseCompressedBase< SparseVector< _Scalar, _Options, _StorageIndex > >.
Definition at line 94 of file SparseVector.h.
{ return 0; }
StorageIndex* Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::innerNonZeroPtr | ( | ) | [inline] |
Reimplemented from Eigen::SparseCompressedBase< SparseVector< _Scalar, _Options, _StorageIndex > >.
Definition at line 95 of file SparseVector.h.
{ return 0; }
EIGEN_STRONG_INLINE Index Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::innerSize | ( | ) | const [inline] |
Reimplemented from Eigen::SparseMatrixBase< SparseVector< _Scalar, _Options, _StorageIndex > >.
Definition at line 83 of file SparseVector.h.
{ return m_size; }
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); }
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); }
Scalar& Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::insertBack | ( | Index | i | ) | [inline] |
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); }
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); }
Scalar& Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::insertBackUnordered | ( | Index | i | ) | [inline] |
Index Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::nonZeros | ( | ) | const [inline] |
Reimplemented from Eigen::SparseCompressedBase< SparseVector< _Scalar, _Options, _StorageIndex > >.
Definition at line 140 of file SparseVector.h.
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.
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; }
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); }
const StorageIndex* Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::outerIndexPtr | ( | ) | const [inline] |
Reimplemented from Eigen::SparseCompressedBase< SparseVector< _Scalar, _Options, _StorageIndex > >.
Definition at line 92 of file SparseVector.h.
{ return 0; }
StorageIndex* Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::outerIndexPtr | ( | ) | [inline] |
Reimplemented from Eigen::SparseCompressedBase< SparseVector< _Scalar, _Options, _StorageIndex > >.
Definition at line 93 of file SparseVector.h.
{ return 0; }
EIGEN_STRONG_INLINE Index Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::outerSize | ( | ) | const [inline] |
Reimplemented from Eigen::SparseMatrixBase< SparseVector< _Scalar, _Options, _StorageIndex > >.
Definition at line 84 of file SparseVector.h.
{ return 1; }
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.
void Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::reserve | ( | Index | reserveSize | ) | [inline] |
Definition at line 204 of file SparseVector.h.
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.
Definition at line 223 of file SparseVector.h.
{ eigen_assert((IsColVector ? cols : rows)==1 && "Outer dimension must equal 1"); resize(IsColVector ? rows : cols); }
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
Definition at line 233 of file SparseVector.h.
void Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::resizeNonZeros | ( | Index | size | ) | [inline] |
Definition at line 257 of file SparseVector.h.
EIGEN_STRONG_INLINE Index Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::rows | ( | void | ) | const [inline] |
Reimplemented from Eigen::SparseMatrixBase< SparseVector< _Scalar, _Options, _StorageIndex > >.
Definition at line 81 of file SparseVector.h.
{ return IsColVector ? m_size : 1; }
void Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::setZero | ( | ) | [inline] |
Definition at line 137 of file SparseVector.h.
EIGEN_DEPRECATED void Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::startFill | ( | Index | reserve | ) | [inline] |
Definition at line 341 of file SparseVector.h.
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); }
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.
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.
Definition at line 287 of file SparseVector.h.
EIGEN_STRONG_INLINE const Scalar* Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::valuePtr | ( | ) | const [inline] |
Reimplemented from Eigen::SparseCompressedBase< SparseVector< _Scalar, _Options, _StorageIndex > >.
Definition at line 86 of file SparseVector.h.
EIGEN_STRONG_INLINE Scalar* Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::valuePtr | ( | ) | [inline] |
Reimplemented from Eigen::SparseCompressedBase< SparseVector< _Scalar, _Options, _StorageIndex > >.
Definition at line 87 of file SparseVector.h.
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; }
Storage Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::m_data [protected] |
Definition at line 395 of file SparseVector.h.
Index Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::m_size [protected] |
Definition at line 396 of file SparseVector.h.