10#ifndef EIGEN_SPARSEVECTOR_H
11#define EIGEN_SPARSEVECTOR_H
29template<
typename _Scalar,
int _Options,
typename _StorageIndex>
39 RowsAtCompileTime = IsColVector ?
Dynamic : 1,
40 ColsAtCompileTime = IsColVector ? 1 :
Dynamic,
41 MaxRowsAtCompileTime = RowsAtCompileTime,
42 MaxColsAtCompileTime = ColsAtCompileTime,
55template<
typename Dest,
typename Src,
57 : Src::InnerSizeAtCompileTime==1 ?
SVA_Outer
63template<
typename _Scalar,
int _Options,
typename _StorageIndex>
265 template<
typename OtherDerived>
269 #ifdef EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN
270 EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN
293 template<
int OtherOptions>
315 template<
typename OtherDerived>
324 #ifndef EIGEN_PARSED_BY_DOXYGEN
325 template<
typename Lhs,
typename Rhs>
391# ifdef EIGEN_SPARSEVECTOR_PLUGIN
392# include EIGEN_SPARSEVECTOR_PLUGIN
409template<
typename _Scalar,
int _Options,
typename _Index>
420 Flags = SparseVectorType::Flags
431 return m_matrix->nonZeros();
440template<
typename Dest,
typename Src>
442 static void run(Dest& dst,
const Src& src) {
445 SrcEvaluatorType srcEval(src);
446 for(
typename SrcEvaluatorType::InnerIterator it(srcEval, 0); it; ++it)
447 dst.insert(it.index()) = it.value();
451template<
typename Dest,
typename Src>
453 static void run(Dest& dst,
const Src& src) {
456 SrcEvaluatorType srcEval(src);
457 for(
Index i=0; i<src.size(); ++i)
459 typename SrcEvaluatorType::InnerIterator it(srcEval, i);
461 dst.insert(i) = it.value();
466template<
typename Dest,
typename Src>
468 static void run(Dest& dst,
const Src& src) {
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ColXpr col(Index i)
This is the const version of col().
Definition: BlockMethods.h:1097
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE RowXpr row(Index i)
This is the const version of row(). */.
Definition: BlockMethods.h:1118
#define EIGEN_DEPRECATED
Definition: Macros.h:1068
#define eigen_internal_assert(x)
Definition: Macros.h:1053
#define EIGEN_UNUSED_VARIABLE(var)
Definition: Macros.h:1086
#define EIGEN_ONLY_USED_FOR_DEBUG(x)
Definition: Macros.h:1059
#define eigen_assert(x)
Definition: Macros.h:1047
#define EIGEN_STRONG_INLINE
Definition: Macros.h:927
#define EIGEN_SPARSE_PUBLIC_INTERFACE(Derived)
Definition: SparseUtil.h:43
#define EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATOR(Derived, Op)
Definition: SparseUtil.h:21
#define EIGEN_INTERNAL_CHECK_COST_VALUE(C)
Definition: StaticAssert.h:218
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
Definition: StaticAssert.h:127
Definition: SparseCompressedBase.h:159
Definition: SparseCompressedBase.h:245
Common base class for sparse [compressed]-{row|column}-storage format.
Definition: SparseCompressedBase.h:38
Derived & operator=(const EigenBase< OtherDerived > &other)
Definition: SparseAssign.h:17
Base class of any sparse matrices or sparse expressions.
Definition: SparseMatrixBase.h:28
internal::traits< SparseVector< _Scalar, _Options, _StorageIndex > >::StorageIndex StorageIndex
The integer type used to store indices within a SparseMatrix.
Definition: SparseMatrixBase.h:43
const Derived & derived() const
Definition: SparseMatrixBase.h:143
Index size() const
Definition: SparseMatrixBase.h:181
bool isRValue() const
Definition: SparseMatrixBase.h:194
internal::traits< SparseVector< _Scalar, _Options, _StorageIndex > >::Scalar Scalar
Definition: SparseMatrixBase.h:31
Derived & const_cast_derived() const
Definition: SparseMatrixBase.h:145
NumTraits< Scalar >::Real RealScalar
This is the "real scalar" type; if the Scalar type is already real numbers (e.g.
Definition: SparseMatrixBase.h:128
static StorageIndex convert_index(const Index idx)
Definition: SparseMatrixBase.h:389
A versatible sparse matrix representation.
Definition: SparseMatrix.h:98
Index outerSize() const
Definition: SparseMatrix.h:145
Storage m_data
Definition: SparseMatrix.h:133
Index m_innerSize
Definition: SparseMatrix.h:130
Definition: SparseUtil.h:61
a sparse vector class
Definition: SparseVector.h:66
SparseVector(Index size)
Definition: SparseVector.h:261
Scalar sum() const
Overloaded for performance.
Definition: SparseRedux.h:41
Base::ReverseInnerIterator ReverseInnerIterator
Definition: SparseVector.h:135
EIGEN_DEPRECATED void startFill(Index reserve)
Definition: SparseVector.h:349
void resize(Index newSize)
Resizes the sparse vector to newSize This method deletes all entries, thus leaving an empty sparse ve...
Definition: SparseVector.h:233
EIGEN_DEPRECATED Scalar & fill(Index r, Index c)
Definition: SparseVector.h:356
@ IsColVector
Definition: SparseVector.h:75
EIGEN_DEPRECATED void endFill()
Definition: SparseVector.h:383
EIGEN_DEPRECATED Scalar & fillrand(Index r, Index c)
Definition: SparseVector.h:370
void startVec(Index outer)
Definition: SparseVector.h:142
void resize(Index rows, Index cols)
Resizes the sparse vector to rows x cols.
Definition: SparseVector.h:223
Scalar & coeffRef(Index row, Index col)
Definition: SparseVector.h:113
Scalar & insertBackByOuterInnerUnordered(Index outer, Index inner)
Definition: SparseVector.h:160
EIGEN_DEPRECATED Scalar & fill(Index i)
Definition: SparseVector.h:363
StorageIndex * innerNonZeroPtr()
Definition: SparseVector.h:95
Scalar coeff(Index i) const
Definition: SparseVector.h:107
void swap(SparseMatrix< Scalar, OtherOptions, StorageIndex > &other)
Definition: SparseVector.h:294
EIGEN_DEPRECATED const Storage & _data() const
Definition: SparseVector.h:389
@ Options
Definition: SparseVector.h:78
EIGEN_STRONG_INLINE Index outerSize() const
Definition: SparseVector.h:84
void reserve(Index reserveSize)
Definition: SparseVector.h:204
Scalar & coeffRef(Index i)
Definition: SparseVector.h:125
Scalar & insert(Index i)
Definition: SparseVector.h:182
SparseVector & operator=(const SparseVector &other)
Definition: SparseVector.h:301
SparseVector & operator=(const SparseSparseProduct< Lhs, Rhs > &product)
Definition: SparseVector.h:326
EIGEN_STRONG_INLINE const StorageIndex * innerIndexPtr() const
Definition: SparseVector.h:89
EIGEN_STRONG_INLINE Index cols() const
Definition: SparseVector.h:82
Scalar & insertBackByOuterInner(Index outer, Index inner)
Definition: SparseVector.h:148
SparseVector & operator=(const SparseMatrixBase< OtherDerived > &other)
Definition: SparseVector.h:316
void finalize()
Definition: SparseVector.h:207
Base::InnerIterator InnerIterator
Definition: SparseVector.h:134
friend std::ostream & operator<<(std::ostream &s, const SparseVector &m)
Definition: SparseVector.h:332
SparseVector(const SparseMatrixBase< OtherDerived > &other)
Definition: SparseVector.h:266
EIGEN_STRONG_INLINE Index innerSize() const
Definition: SparseVector.h:83
void swap(SparseVector &other)
Swaps the values of *this and other.
Definition: SparseVector.h:287
Storage m_data
Definition: SparseVector.h:403
Scalar coeff(Index row, Index col) const
Definition: SparseVector.h:102
SparseVector(Index rows, Index cols)
Definition: SparseVector.h:263
void conservativeResize(Index newSize)
Resizes the sparse vector to newSize, while leaving old values untouched.
Definition: SparseVector.h:246
void resizeNonZeros(Index size)
Definition: SparseVector.h:257
SparseVector()
Definition: SparseVector.h:259
const Storage & data() const
Definition: SparseVector.h:100
void setZero()
Definition: SparseVector.h:137
static void check_template_parameters()
Definition: SparseVector.h:397
const StorageIndex * outerIndexPtr() const
Definition: SparseVector.h:92
Scalar & insertBack(Index i)
Definition: SparseVector.h:154
Storage & data()
Definition: SparseVector.h:98
EIGEN_STRONG_INLINE Index rows() const
Definition: SparseVector.h:81
StorageIndex * outerIndexPtr()
Definition: SparseVector.h:93
EIGEN_STRONG_INLINE Scalar * valuePtr()
Definition: SparseVector.h:87
~SparseVector()
Destructor.
Definition: SparseVector.h:341
Scalar & insertBackUnordered(Index i)
Definition: SparseVector.h:166
EIGEN_DEPRECATED Storage & _data()
Definition: SparseVector.h:387
EIGEN_STRONG_INLINE StorageIndex * innerIndexPtr()
Definition: SparseVector.h:90
Index nonZeros() const
Definition: SparseVector.h:140
const StorageIndex * innerNonZeroPtr() const
Definition: SparseVector.h:94
void prune(const Scalar &reference, const RealScalar &epsilon=NumTraits< RealScalar >::dummy_precision())
Suppresses all nonzeros which are much smaller than reference under the tolerance epsilon.
Definition: SparseVector.h:210
EIGEN_STRONG_INLINE const Scalar * valuePtr() const
Definition: SparseVector.h:86
SparseVector(const SparseVector &other)
Definition: SparseVector.h:276
EIGEN_DEPRECATED Scalar & fillrand(Index i)
Definition: SparseVector.h:377
Index m_size
Definition: SparseVector.h:404
Scalar & insert(Index row, Index col)
Definition: SparseVector.h:172
Scalar at(Index key, const Scalar &defaultValue=Scalar(0)) const
Definition: CompressedStorage.h:146
void reserve(Index size)
Definition: CompressedStorage.h:76
Index size() const
Definition: CompressedStorage.h:109
Scalar & value(Index i)
Definition: CompressedStorage.h:118
const Scalar * valuePtr() const
Definition: CompressedStorage.h:113
void clear()
Definition: CompressedStorage.h:111
void append(const Scalar &v, Index i)
Definition: CompressedStorage.h:101
StorageIndex & index(Index i)
Definition: CompressedStorage.h:121
Scalar & atWithInsertion(Index key, const Scalar &defaultValue=Scalar(0))
Definition: CompressedStorage.h:174
void resize(Index size, double reserveSizeFactor=0)
Definition: CompressedStorage.h:89
void swap(CompressedStorage &other)
Definition: CompressedStorage.h:62
void prune(const Scalar &reference, const RealScalar &epsilon=NumTraits< RealScalar >::dummy_precision())
Definition: CompressedStorage.h:226
const StorageIndex * indexPtr() const
Definition: CompressedStorage.h:115
@ ColMajor
Storage order is column major (see TopicStorageOrders).
Definition: Constants.h:319
@ RowMajor
Storage order is row major (see TopicStorageOrders).
Definition: Constants.h:321
const unsigned int LvalueBit
Means the expression has a coeffRef() method, i.e.
Definition: Constants.h:144
const unsigned int RowMajorBit
for a matrix, this means that the storage order is row-major.
Definition: Constants.h:66
const unsigned int CompressedAccessBit
Means that the underlying coefficients can be accessed through pointers to the sparse (un)compressed ...
Definition: Constants.h:191
@ SVA_Inner
Definition: SparseVector.h:51
@ SVA_Outer
Definition: SparseVector.h:52
@ SVA_RuntimeSwitch
Definition: SparseVector.h:50
Namespace containing all symbols from the Eigen library.
Definition: Core:141
const unsigned int NestByRefBit
Definition: Constants.h:169
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:74
const int InnerRandomAccessPattern
Definition: SparseUtil.h:48
const int Dynamic
This value means that a positive quantity (e.g., a size) is not known at compile-time,...
Definition: Constants.h:22
Definition: Eigen_Colamd.h:50
void swap(wpi::SmallPtrSet< T, N > &LHS, wpi::SmallPtrSet< T, N > &RHS)
Implement std::swap in terms of SmallPtrSet swap.
Definition: SmallPtrSet.h:512
static constexpr const velocity::meters_per_second_t c(299792458.0)
Speed of light in vacuum.
Eigen::Index Index
The interface type of indices.
Definition: EigenBase.h:39
The type used to identify a matrix expression.
Definition: Constants.h:522
Holds information about the various numeric (i.e.
Definition: NumTraits.h:233
The type used to identify a general sparse storage.
Definition: Constants.h:510
const SparseVectorType * m_matrix
Definition: SparseVector.h:437
evaluator_base< SparseVectorType > Base
Definition: SparseVector.h:414
evaluator(const SparseVectorType &mat)
Definition: SparseVector.h:425
SparseVectorType::InnerIterator InnerIterator
Definition: SparseVector.h:415
SparseVector< _Scalar, _Options, _Index > SparseVectorType
Definition: SparseVector.h:413
Index nonZerosEstimate() const
Definition: SparseVector.h:430
SparseVectorType::ReverseInnerIterator ReverseInnerIterator
Definition: SparseVector.h:416
evaluator()
Definition: SparseVector.h:423
Definition: CoreEvaluators.h:111
Definition: CoreEvaluators.h:91
static void run(Dest &dst, const Src &src)
Definition: SparseVector.h:442
static void run(Dest &dst, const Src &src)
Definition: SparseVector.h:453
static void run(Dest &dst, const Src &src)
Definition: SparseVector.h:468
Definition: SparseVector.h:59
Sparse StorageKind
Definition: SparseVector.h:34
MatrixXpr XprKind
Definition: SparseVector.h:35
_Scalar Scalar
Definition: SparseVector.h:32
_StorageIndex StorageIndex
Definition: SparseVector.h:33
Definition: ForwardDeclarations.h:17