![]() |
|
a sparse vector class More...
#include <SparseVector.h>
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 Scalar * | valuePtr () const |
EIGEN_STRONG_INLINE Scalar * | valuePtr () |
EIGEN_STRONG_INLINE const StorageIndex * | innerIndexPtr () const |
EIGEN_STRONG_INLINE StorageIndex * | innerIndexPtr () |
const StorageIndex * | outerIndexPtr () const |
StorageIndex * | outerIndexPtr () |
const StorageIndex * | innerNonZeroPtr () const |
StorageIndex * | innerNonZeroPtr () |
constexpr Storage & | data () |
constexpr const Storage & | data () const |
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 & | insertBackByOuterInnerUnordered (Index outer, Index inner) |
Scalar & | insertBackUnordered (Index i) |
Scalar & | insert (Index row, Index col) |
Scalar & | insert (Index i) |
void | reserve (Index reserveSize) |
void | finalize () |
Index | prune (const Scalar &reference, const RealScalar &epsilon=NumTraits< RealScalar >::dummy_precision()) |
template<class F > | |
Index | prune (F &&keep_predicate) |
Prunes the entries of the vector based on a predicate More... | |
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) |
template<int OtherOptions> | |
void | swap (SparseMatrix< Scalar, OtherOptions, StorageIndex > &other) |
SparseVector & | operator= (const SparseVector &other) |
template<typename OtherDerived > | |
SparseVector & | operator= (const SparseMatrixBase< OtherDerived > &other) |
SparseVector (SparseVector &&other) | |
template<typename OtherDerived > | |
SparseVector (SparseCompressedBase< OtherDerived > &&other) | |
SparseVector & | operator= (SparseVector &&other) |
template<typename OtherDerived > | |
SparseVector & | operator= (SparseCompressedBase< OtherDerived > &&other) |
template<typename Lhs , typename Rhs > | |
SparseVector & | operator= (const SparseSparseProduct< Lhs, Rhs > &product) |
~SparseVector () | |
Scalar | sum () const |
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 () |
EIGEN_DEPRECATED Storage & | _data () |
EIGEN_DEPRECATED const Storage & | _data () const |
![]() | |
Index | nonZeros () const |
const Scalar * | valuePtr () const |
Scalar * | valuePtr () |
const StorageIndex * | innerIndexPtr () const |
StorageIndex * | innerIndexPtr () |
const StorageIndex * | outerIndexPtr () const |
StorageIndex * | outerIndexPtr () |
const StorageIndex * | innerNonZeroPtr () const |
StorageIndex * | innerNonZeroPtr () |
bool | isCompressed () const |
const Map< const Array< Scalar, Dynamic, 1 > > | coeffs () const |
Map< Array< Scalar, Dynamic, 1 > > | coeffs () |
void | sortInnerIndices (Index begin, Index end) |
void | sortInnerIndices () |
Index | innerIndicesAreSorted (Index begin, Index end) const |
Index | innerIndicesAreSorted () const |
SparseVector< Scalar_, Options_, StorageIndex_ > & | operator= (const EigenBase< OtherDerived > &other) |
SparseVector< Scalar_, Options_, StorageIndex_ > & | operator= (const ReturnByValue< OtherDerived > &other) |
SparseVector< Scalar_, Options_, StorageIndex_ > & | operator= (const SparseMatrixBase< OtherDerived > &other) |
SparseVector< Scalar_, Options_, StorageIndex_ > & | operator= (const SparseVector< Scalar_, Options_, StorageIndex_ > &other) |
![]() | |
SparseVector< Scalar_, Options_, StorageIndex_ > & | operator= (const EigenBase< OtherDerived > &other) |
SparseVector< Scalar_, Options_, StorageIndex_ > & | operator= (const ReturnByValue< OtherDerived > &other) |
SparseVector< Scalar_, Options_, StorageIndex_ > & | operator= (const SparseMatrixBase< OtherDerived > &other) |
SparseVector< Scalar_, Options_, StorageIndex_ > & | operator= (const SparseVector< Scalar_, Options_, StorageIndex_ > &other) |
const SparseVector< Scalar_, Options_, StorageIndex_ > & | derived () const |
SparseVector< Scalar_, Options_, StorageIndex_ > & | derived () |
SparseVector< Scalar_, Options_, StorageIndex_ > & | const_cast_derived () const |
Index | rows () const |
Index | cols () const |
Index | size () const |
bool | isVector () const |
Index | outerSize () const |
Index | innerSize () const |
bool | isRValue () const |
SparseVector< Scalar_, Options_, StorageIndex_ > & | markAsRValue () |
SparseMatrixBase () | |
SparseVector< Scalar_, Options_, StorageIndex_ > & | operator+= (const SparseMatrixBase< OtherDerived > &other) |
SparseVector< Scalar_, Options_, StorageIndex_ > & | operator+= (const DiagonalBase< OtherDerived > &other) |
SparseVector< Scalar_, Options_, StorageIndex_ > & | operator+= (const EigenBase< OtherDerived > &other) |
EIGEN_STRONG_INLINE SparseVector< Scalar_, Options_, StorageIndex_ > & | operator+= (const SparseMatrixBase< OtherDerived > &other) |
SparseVector< Scalar_, Options_, StorageIndex_ > & | operator-= (const SparseMatrixBase< OtherDerived > &other) |
SparseVector< Scalar_, Options_, StorageIndex_ > & | operator-= (const DiagonalBase< OtherDerived > &other) |
SparseVector< Scalar_, Options_, StorageIndex_ > & | operator-= (const EigenBase< OtherDerived > &other) |
EIGEN_STRONG_INLINE SparseVector< Scalar_, Options_, StorageIndex_ > & | operator-= (const SparseMatrixBase< OtherDerived > &other) |
SparseVector< Scalar_, Options_, StorageIndex_ > & | operator*= (const Scalar &other) |
SparseVector< Scalar_, Options_, StorageIndex_ > & | operator*= (const SparseMatrixBase< OtherDerived > &other) |
SparseVector< Scalar_, Options_, StorageIndex_ > & | operator/= (const Scalar &other) |
EIGEN_STRONG_INLINE const CwiseProductDenseReturnType< OtherDerived >::Type | cwiseProduct (const MatrixBase< OtherDerived > &other) const |
EIGEN_STRONG_INLINE const SparseMatrixBase< SparseVector< Scalar_, Options_, StorageIndex_ > >::template CwiseProductDenseReturnType< OtherDerived >::Type | cwiseProduct (const MatrixBase< OtherDerived > &other) const |
const Product< SparseVector< Scalar_, Options_, StorageIndex_ >, OtherDerived > | operator* (const DiagonalBase< OtherDerived > &other) const |
const Product< SparseVector< Scalar_, Options_, StorageIndex_ >, OtherDerived, AliasFreeProduct > | operator* (const SparseMatrixBase< OtherDerived > &other) const |
const Product< SparseVector< Scalar_, Options_, StorageIndex_ >, OtherDerived > | operator* (const MatrixBase< OtherDerived > &other) const |
SparseSymmetricPermutationProduct< SparseVector< Scalar_, Options_, StorageIndex_ >, Upper|Lower > | twistedBy (const PermutationMatrix< Dynamic, Dynamic, StorageIndex > &perm) const |
const TriangularView< const SparseVector< Scalar_, Options_, StorageIndex_ >, Mode > | triangularView () const |
ConstSelfAdjointViewReturnType< UpLo >::Type | selfadjointView () const |
SelfAdjointViewReturnType< UpLo >::Type | selfadjointView () |
SparseMatrixBase< SparseVector< Scalar_, Options_, StorageIndex_ > >::template ConstSelfAdjointViewReturnType< UpLo >::Type | selfadjointView () const |
SparseMatrixBase< SparseVector< Scalar_, Options_, StorageIndex_ > >::template SelfAdjointViewReturnType< UpLo >::Type | selfadjointView () |
Scalar | dot (const MatrixBase< OtherDerived > &other) const |
Scalar | dot (const SparseMatrixBase< OtherDerived > &other) const |
internal::traits< SparseVector< Scalar_, Options_, StorageIndex_ > >::Scalar | dot (const MatrixBase< OtherDerived > &other) const |
internal::traits< SparseVector< Scalar_, Options_, StorageIndex_ > >::Scalar | dot (const SparseMatrixBase< OtherDerived > &other) const |
RealScalar | squaredNorm () const |
RealScalar | norm () const |
RealScalar | blueNorm () const |
TransposeReturnType | transpose () |
const ConstTransposeReturnType | transpose () const |
const AdjointReturnType | adjoint () const |
DenseMatrixType | toDense () const |
bool | isApprox (const SparseMatrixBase< OtherDerived > &other, const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const |
bool | isApprox (const MatrixBase< OtherDerived > &other, const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const |
const internal::eval< SparseVector< Scalar_, Options_, StorageIndex_ > >::type | eval () const |
Scalar | sum () const |
const SparseView< SparseVector< Scalar_, Options_, StorageIndex_ > > | pruned (const Scalar &reference=Scalar(0), const RealScalar &epsilon=NumTraits< Scalar >::dummy_precision()) const |
![]() | |
constexpr EIGEN_DEVICE_FUNC SparseVector< Scalar_, Options_, StorageIndex_ > & | derived () |
constexpr EIGEN_DEVICE_FUNC const SparseVector< Scalar_, Options_, StorageIndex_ > & | derived () const |
EIGEN_DEVICE_FUNC SparseVector< Scalar_, Options_, StorageIndex_ > & | const_cast_derived () const |
EIGEN_DEVICE_FUNC const SparseVector< Scalar_, Options_, StorageIndex_ > & | const_derived () const |
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index | rows () const EIGEN_NOEXCEPT |
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index | cols () const EIGEN_NOEXCEPT |
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index | size () const EIGEN_NOEXCEPT |
EIGEN_DEVICE_FUNC void | evalTo (Dest &dst) const |
EIGEN_DEVICE_FUNC void | addTo (Dest &dst) const |
EIGEN_DEVICE_FUNC void | subTo (Dest &dst) const |
EIGEN_DEVICE_FUNC void | applyThisOnTheRight (Dest &dst) const |
EIGEN_DEVICE_FUNC void | applyThisOnTheLeft (Dest &dst) const |
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DeviceWrapper< SparseVector< Scalar_, Options_, StorageIndex_ >, Device > | device (Device &device) |
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DeviceWrapper< const SparseVector< Scalar_, Options_, StorageIndex_ >, Device > | device (Device &device) const |
Protected Member Functions | |
EIGEN_STATIC_ASSERT ((Options_ &(ColMajor|RowMajor))==Options, INVALID_MATRIX_TEMPLATE_PARAMETERS) Storage m_data | |
![]() | |
Eigen::Map< IndexVector > | innerNonZeros () |
const Eigen::Map< const IndexVector > | innerNonZeros () const |
SparseCompressedBase () | |
internal::LowerBoundIndex | lower_bound (Index row, Index col) const |
![]() | |
SparseVector< Scalar_, Options_, StorageIndex_ > & | assign (const OtherDerived &other) |
void | assignGeneric (const OtherDerived &other) |
Protected Attributes | |
Index | m_size |
![]() | |
bool | m_isRValue |
Private Types | |
typedef SparseCompressedBase< SparseVector > | Base |
Friends | |
EIGEN_DEVICE_FUNC void | swap (SparseVector &a, SparseVector &b) |
template<int OtherOptions> | |
EIGEN_DEVICE_FUNC void | swap (SparseVector &a, SparseMatrix< Scalar, OtherOptions, StorageIndex > &b) |
template<int OtherOptions> | |
EIGEN_DEVICE_FUNC void | swap (SparseMatrix< Scalar, OtherOptions, StorageIndex > &a, SparseVector &b) |
std::ostream & | operator<< (std::ostream &s, const SparseVector &m) |
Additional Inherited Members | |
![]() | |
typedef Base::IndexVector | IndexVector |
![]() | |
static StorageIndex | convert_index (const Index idx) |
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 Extending MatrixBase (and other classes) by defining the preprocessor symbol EIGEN_SPARSEVECTOR_PLUGIN
.
|
private |
typedef Base::InnerIterator Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::InnerIterator |
typedef Base::ReverseInnerIterator Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::ReverseInnerIterator |
typedef internal::CompressedStorage<Scalar, StorageIndex> Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::Storage |
anonymous enum |
|
inline |
|
inlineexplicit |
References Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::resize(), and Eigen::SparseMatrixBase< SparseVector< Scalar_, Options_, StorageIndex_ > >::size().
|
inline |
|
inline |
References Eigen::SparseMatrixBase< Derived >::derived(), and EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN.
|
inline |
References Eigen::SparseMatrixBase< Derived >::derived().
|
inline |
|
inline |
References Eigen::SparseMatrixBase< Derived >::derived().
|
inline |
|
inline |
|
inline |
|
inline |
References eigen_assert, i, and Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::m_size.
|
inline |
References col(), eigen_assert, Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::IsColVector, Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::m_size, and row().
|
inline |
This insertion might be very costly if the number of nonzeros above i is large.
References eigen_assert, i, and Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::m_size.
|
inline |
References col(), eigen_assert, Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::IsColVector, Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::m_size, and row().
|
inline |
References Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::IsColVector, and Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::m_size.
Referenced by gdb.printers._MatrixEntryIterator::__next__(), gdb.printers.EigenMatrixPrinter::children(), gdb.printers.EigenSparseMatrixPrinter::children(), Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::resize(), Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::SparseVector(), gdb.printers.EigenMatrixPrinter::to_string(), and gdb.printers.EigenSparseMatrixPrinter::to_string().
|
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.
References i, and Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::m_size.
|
inlineconstexpr |
Referenced by gdb.printers.EigenMatrixPrinter::children(), gdb.printers.EigenSparseMatrixPrinter::children(), gdb.printers.EigenQuaternionPrinter::children(), gdb.printers.EigenMatrixPrinter::to_string(), gdb.printers.EigenSparseMatrixPrinter::to_string(), and gdb.printers.EigenQuaternionPrinter::to_string().
|
inlineconstexpr |
Referenced by gdb.printers.EigenMatrixPrinter::children(), gdb.printers.EigenSparseMatrixPrinter::children(), gdb.printers.EigenQuaternionPrinter::children(), gdb.printers.EigenMatrixPrinter::to_string(), gdb.printers.EigenSparseMatrixPrinter::to_string(), and gdb.printers.EigenQuaternionPrinter::to_string().
|
protected |
|
inline |
|
inline |
References i.
|
inline |
References calibrate::c, eigen_assert, Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::IsColVector, and UniformPSDSelfTest::r.
|
inline |
References i, and Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::insert().
|
inline |
References calibrate::c, eigen_assert, Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::IsColVector, and UniformPSDSelfTest::r.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
References Eigen::SparseMatrixBase< SparseVector< Scalar_, Options_, StorageIndex_ > >::convert_index(), eigen_assert, i, Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::m_size, and p.
|
inline |
References col(), eigen_assert, EIGEN_ONLY_USED_FOR_DEBUG, Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::IsColVector, Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::m_size, and row().
Referenced by Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::fillrand().
|
inline |
References i.
Referenced by initSparse(), and Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::insertBackByOuterInner().
|
inline |
|
inline |
References eigen_assert, EIGEN_UNUSED_VARIABLE, and Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::insertBackUnordered().
|
inline |
References i.
Referenced by Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::insertBackByOuterInnerUnordered().
|
inline |
|
inline |
References Eigen::SparseMatrixBase< Derived >::derived(), run(), Eigen::SparseMatrixBase< Derived >::size(), Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::swap(), and tmp.
|
inline |
References Eigen::SparseCompressedBase< Derived >::operator=(), and product().
|
inline |
|
inline |
References Eigen::SparseMatrixBase< Derived >::derived().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Suppresses all nonzeros which are much smaller than reference under the tolerance epsilon
References oomph::SarahBL::epsilon, Eigen::internal::isMuchSmallerThan(), and calibrate::val.
|
inline |
Prunes the entries of the vector based on a predicate
F | Type of the predicate. |
keep_predicate | The predicate that is used to test whether a value should be kept. A callable that gets passed om a Scalar value and returns a boolean. If the predicate returns true, the value is kept. |
|
inline |
Referenced by initSparse(), and Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::startFill().
|
inline |
Resizes the sparse vector to newSize This method deletes all entries, thus leaving an empty sparse vector
References Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::m_size.
|
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.
References Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::cols(), eigen_assert, Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::IsColVector, and Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::rows().
Referenced by Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::operator=(), Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::SparseVector(), and test_pruning().
|
inline |
|
inline |
References Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::IsColVector, and Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::m_size.
Referenced by gdb.printers._MatrixEntryIterator::__next__(), gdb.printers.EigenMatrixPrinter::children(), gdb.printers.EigenSparseMatrixPrinter::children(), Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::resize(), Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::SparseVector(), gdb.printers.EigenMatrixPrinter::to_string(), and gdb.printers.EigenSparseMatrixPrinter::to_string().
|
inline |
Referenced by initSparse(), and Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::startFill().
|
inline |
References Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::reserve(), and Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::setZero().
|
inline |
References eigen_assert, and EIGEN_UNUSED_VARIABLE.
internal::traits< SparseVector< Scalar_, Options_, Index_ > >::Scalar Eigen::SparseVector< Scalar_, Options_, Index_ >::sum |
Overloaded for performance
References cols, eigen_assert, Eigen::PlainObjectBase< Matrix< Scalar_, Rows_, Cols_, Options_, MaxRows_, MaxCols_ > >::Map(), and rows.
|
inline |
References eigen_assert, Eigen::SparseMatrix< Scalar_, Options_, StorageIndex_ >::m_data, Eigen::SparseMatrix< Scalar_, Options_, StorageIndex_ >::m_innerSize, Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::m_size, Eigen::SparseMatrix< Scalar_, Options_, StorageIndex_ >::outerSize(), and swap().
|
inline |
Swaps the values of *this
and other. Overloaded for performance: this version performs a shallow swap by swapping pointers and attributes only.
References Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::m_size, and swap().
Referenced by Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::operator=(), and Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::SparseVector().
|
inline |
|
inline |
|
friend |
|
friend |
|
friend |
|
friend |
|
protected |
Referenced by Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::coeff(), Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::coeffRef(), Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::cols(), Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::conservativeResize(), Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::innerSize(), Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::insert(), Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::resize(), Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::rows(), and Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::swap().