10 #ifndef EIGEN_SPARSEVECTOR_H
11 #define EIGEN_SPARSEVECTOR_H
29 template<
typename _Scalar,
int _Options,
typename _StorageIndex>
39 RowsAtCompileTime = IsColVector ?
Dynamic : 1,
40 ColsAtCompileTime = IsColVector ? 1 :
Dynamic,
41 MaxRowsAtCompileTime = RowsAtCompileTime,
42 MaxColsAtCompileTime = ColsAtCompileTime,
55 template<
typename Dest,
typename Src,
57 : Src::InnerSizeAtCompileTime==1 ?
SVA_Outer
63 template<
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
409 template<
typename _Scalar,
int _Options,
typename _Index>
431 return m_matrix->nonZeros();
440 template<
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();
451 template<
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();
466 template<
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:1058
#define eigen_internal_assert(x)
Definition: Macros.h:1043
#define EIGEN_UNUSED_VARIABLE(var)
Definition: Macros.h:1076
#define EIGEN_ONLY_USED_FOR_DEBUG(x)
Definition: Macros.h:1049
#define eigen_assert(x)
Definition: Macros.h:1037
#define EIGEN_STRONG_INLINE
Definition: Macros.h:917
#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 Derived &other)
Definition: SparseAssign.h:43
Base class of any sparse matrices or sparse expressions.
Definition: SparseMatrixBase.h:28
internal::traits< SparseVector< _Scalar, _Options, _StorageIndex > >::StorageIndex StorageIndex
Definition: SparseMatrixBase.h:43
Index size() const
Definition: SparseMatrixBase.h:181
bool isRValue() const
Definition: SparseMatrixBase.h:194
Derived & const_cast_derived() const
Definition: SparseMatrixBase.h:145
internal::traits< SparseVector< _Scalar, _Options, _StorageIndex > >::Scalar Scalar
Definition: SparseMatrixBase.h:31
const Derived & derived() const
Definition: SparseMatrixBase.h:143
NumTraits< Scalar >::Real RealScalar
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
Definition: SparseRedux.h:41
Base::ReverseInnerIterator ReverseInnerIterator
Definition: SparseVector.h:135
Scalar & insertBackByOuterInner(Index outer, Index inner)
Definition: SparseVector.h:148
EIGEN_DEPRECATED void startFill(Index reserve)
Definition: SparseVector.h:349
EIGEN_STRONG_INLINE const StorageIndex * innerIndexPtr() const
Definition: SparseVector.h:89
void resize(Index newSize)
Definition: SparseVector.h:233
Scalar & insertBackUnordered(Index i)
Definition: SparseVector.h:166
EIGEN_DEPRECATED void endFill()
Definition: SparseVector.h:383
void startVec(Index outer)
Definition: SparseVector.h:142
SparseVector & operator=(const SparseMatrixBase< OtherDerived > &other)
Definition: SparseVector.h:316
EIGEN_STRONG_INLINE StorageIndex * innerIndexPtr()
Definition: SparseVector.h:90
void resize(Index rows, Index cols)
Definition: SparseVector.h:223
const Storage & data() const
Definition: SparseVector.h:100
Scalar coeff(Index i) const
Definition: SparseVector.h:107
StorageIndex * innerNonZeroPtr()
Definition: SparseVector.h:95
void swap(SparseMatrix< Scalar, OtherOptions, StorageIndex > &other)
Definition: SparseVector.h:294
SparseVector & operator=(const SparseSparseProduct< Lhs, Rhs > &product)
Definition: SparseVector.h:326
Scalar & coeffRef(Index i)
Definition: SparseVector.h:125
EIGEN_STRONG_INLINE Index outerSize() const
Definition: SparseVector.h:84
EIGEN_STRONG_INLINE Scalar * valuePtr()
Definition: SparseVector.h:87
void reserve(Index reserveSize)
Definition: SparseVector.h:204
friend std::ostream & operator<<(std::ostream &s, const SparseVector &m)
Definition: SparseVector.h:332
EIGEN_STRONG_INLINE Index cols() const
Definition: SparseVector.h:82
const StorageIndex * innerNonZeroPtr() const
Definition: SparseVector.h:94
const StorageIndex * outerIndexPtr() const
Definition: SparseVector.h:92
Scalar & insert(Index row, Index col)
Definition: SparseVector.h:172
EIGEN_DEPRECATED Scalar & fillrand(Index i)
Definition: SparseVector.h:377
Scalar & insert(Index i)
Definition: SparseVector.h:182
void finalize()
Definition: SparseVector.h:207
Base::InnerIterator InnerIterator
Definition: SparseVector.h:134
SparseVector(const SparseMatrixBase< OtherDerived > &other)
Definition: SparseVector.h:266
SparseVector & operator=(const SparseVector &other)
Definition: SparseVector.h:301
EIGEN_STRONG_INLINE Index innerSize() const
Definition: SparseVector.h:83
Scalar & insertBackByOuterInnerUnordered(Index outer, Index inner)
Definition: SparseVector.h:160
void swap(SparseVector &other)
Definition: SparseVector.h:287
EIGEN_DEPRECATED const Storage & _data() const
Definition: SparseVector.h:389
Scalar & coeffRef(Index row, Index col)
Definition: SparseVector.h:113
@ IsColVector
Definition: SparseVector.h:75
Storage m_data
Definition: SparseVector.h:403
StorageIndex * outerIndexPtr()
Definition: SparseVector.h:93
EIGEN_DEPRECATED Storage & _data()
Definition: SparseVector.h:387
Scalar coeff(Index row, Index col) const
Definition: SparseVector.h:102
SparseVector(Index rows, Index cols)
Definition: SparseVector.h:263
Scalar & insertBack(Index i)
Definition: SparseVector.h:154
SparseCompressedBase< SparseVector > Base
Definition: SparseVector.h:67
void conservativeResize(Index newSize)
Definition: SparseVector.h:246
void resizeNonZeros(Index size)
Definition: SparseVector.h:257
SparseVector()
Definition: SparseVector.h:259
@ Options
Definition: SparseVector.h:78
void setZero()
Definition: SparseVector.h:137
static void check_template_parameters()
Definition: SparseVector.h:397
EIGEN_STRONG_INLINE Index rows() const
Definition: SparseVector.h:81
~SparseVector()
Definition: SparseVector.h:341
EIGEN_DEPRECATED Scalar & fill(Index i)
Definition: SparseVector.h:363
EIGEN_DEPRECATED Scalar & fill(Index r, Index c)
Definition: SparseVector.h:356
EIGEN_DEPRECATED Scalar & fillrand(Index r, Index c)
Definition: SparseVector.h:370
EIGEN_STRONG_INLINE const Scalar * valuePtr() const
Definition: SparseVector.h:86
Index nonZeros() const
Definition: SparseVector.h:140
void prune(const Scalar &reference, const RealScalar &epsilon=NumTraits< RealScalar >::dummy_precision())
Definition: SparseVector.h:210
SparseVector(const SparseVector &other)
Definition: SparseVector.h:276
Index m_size
Definition: SparseVector.h:404
Storage & data()
Definition: SparseVector.h:98
StorageIndex & index(Index i)
Definition: CompressedStorage.h:121
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
void clear()
Definition: CompressedStorage.h:111
Scalar & atWithInsertion(Index key, const Scalar &defaultValue=Scalar(0))
Definition: CompressedStorage.h:174
void append(const Scalar &v, Index i)
Definition: CompressedStorage.h:101
const Scalar * valuePtr() const
Definition: CompressedStorage.h:113
const StorageIndex * indexPtr() const
Definition: CompressedStorage.h:115
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
Scalar & value(Index i)
Definition: CompressedStorage.h:118
@ ColMajor
Definition: Constants.h:319
@ RowMajor
Definition: Constants.h:321
const unsigned int LvalueBit
Definition: Constants.h:144
const unsigned int RowMajorBit
Definition: Constants.h:66
const unsigned int CompressedAccessBit
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: LDLT.h:16
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
Definition: Constants.h:22
Flags
Special flags for archives.
Definition: cereal.hpp:185
Definition: document.h:416
NLOHMANN_BASIC_JSON_TPL_DECLARATION void swap(nlohmann::NLOHMANN_BASIC_JSON_TPL &j1, nlohmann::NLOHMANN_BASIC_JSON_TPL &j2) noexcept(//NOLINT(readability-inconsistent-declaration-parameter-name, cert-dcl58-cpp) is_nothrow_move_constructible< nlohmann::NLOHMANN_BASIC_JSON_TPL >::value &&//NOLINT(misc-redundant-expression, cppcoreguidelines-noexcept-swap, performance-noexcept-swap) is_nothrow_move_assignable< nlohmann::NLOHMANN_BASIC_JSON_TPL >::value)
exchanges the values of two JSON objects
Definition: json.hpp:25399
Eigen::Index Index
The interface type of indices.
Definition: EigenBase.h:39
Definition: Constants.h:522
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition: NumTraits.h:233
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