Eigen::SparseVector< Scalar_, Options_, StorageIndex_ > Class Template Reference

a sparse vector class More...

#include <SparseVector.h>

+ Inheritance diagram for Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >:

Public Types

enum  { IsColVector = internal::traits<SparseVector>::IsColVector }
 
enum  { Options = Options_ }
 
typedef internal::CompressedStorage< Scalar, StorageIndexStorage
 
typedef Base::InnerIterator InnerIterator
 
typedef Base::ReverseInnerIterator ReverseInnerIterator
 
- Public Types inherited from Eigen::SparseCompressedBase< SparseVector< Scalar_, Options_, StorageIndex_ > >
typedef SparseMatrixBase< SparseVector< Scalar_, Options_, StorageIndex_ > > Base
 
- Public Types inherited from Eigen::SparseMatrixBase< SparseVector< Scalar_, Options_, StorageIndex_ > >
enum  
 
typedef internal::traits< SparseVector< Scalar_, Options_, StorageIndex_ > >::Scalar Scalar
 
typedef Scalar value_type
 
typedef internal::packet_traits< Scalar >::type PacketScalar
 
typedef internal::traits< SparseVector< Scalar_, Options_, StorageIndex_ > >::StorageKind StorageKind
 
typedef internal::traits< SparseVector< Scalar_, Options_, StorageIndex_ > >::StorageIndex StorageIndex
 
typedef internal::add_const_on_value_type_if_arithmetic< typename internal::packet_traits< Scalar >::type >::type PacketReturnType
 
typedef SparseMatrixBase StorageBaseType
 
typedef Matrix< StorageIndex, Dynamic, 1 > IndexVector
 
typedef Matrix< Scalar, Dynamic, 1 > ScalarVector
 
typedef std::conditional_t< NumTraits< Scalar >::IsComplex, CwiseUnaryOp< internal::scalar_conjugate_op< Scalar >, Eigen::Transpose< const SparseVector< Scalar_, Options_, StorageIndex_ > > >, Transpose< const SparseVector< Scalar_, Options_, StorageIndex_ > > > AdjointReturnType
 
typedef Transpose< SparseVector< Scalar_, Options_, StorageIndex_ > > TransposeReturnType
 
typedef Transpose< const SparseVector< Scalar_, Options_, StorageIndex_ > > ConstTransposeReturnType
 
typedef SparseMatrix< Scalar, Flags &RowMajorBit ? RowMajor :ColMajor, StorageIndexPlainObject
 
typedef NumTraits< Scalar >::Real RealScalar
 
typedef std::conditional_t< HasDirectAccess_, const Scalar &, ScalarCoeffReturnType
 
typedef CwiseNullaryOp< internal::scalar_constant_op< Scalar >, Matrix< Scalar, Dynamic, Dynamic > > ConstantReturnType
 
typedef Matrix< Scalar, RowsAtCompileTime, ColsAtCompileTimeDenseMatrixType
 
typedef Matrix< Scalar, internal::max_size_prefer_dynamic(RowsAtCompileTime, ColsAtCompileTime), internal::max_size_prefer_dynamic(RowsAtCompileTime, ColsAtCompileTime)> SquareMatrixType
 
typedef EigenBase< SparseVector< Scalar_, Options_, StorageIndex_ > > Base
 
- Public Types inherited from Eigen::EigenBase< SparseVector< Scalar_, Options_, StorageIndex_ > >
typedef Eigen::Index Index
 The interface type of indices. More...
 
typedef internal::traits< SparseVector< Scalar_, Options_, StorageIndex_ > >::StorageKind StorageKind
 

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 StorageIndexinnerIndexPtr () const
 
EIGEN_STRONG_INLINE StorageIndexinnerIndexPtr ()
 
const StorageIndexouterIndexPtr () const
 
StorageIndexouterIndexPtr ()
 
const StorageIndexinnerNonZeroPtr () const
 
StorageIndexinnerNonZeroPtr ()
 
constexpr Storagedata ()
 
constexpr 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 ()
 
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)
 
SparseVectoroperator= (const SparseVector &other)
 
template<typename OtherDerived >
SparseVectoroperator= (const SparseMatrixBase< OtherDerived > &other)
 
 SparseVector (SparseVector &&other)
 
template<typename OtherDerived >
 SparseVector (SparseCompressedBase< OtherDerived > &&other)
 
SparseVectoroperator= (SparseVector &&other)
 
template<typename OtherDerived >
SparseVectoroperator= (SparseCompressedBase< 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
 
- Public Member Functions inherited from Eigen::SparseCompressedBase< SparseVector< Scalar_, Options_, StorageIndex_ > >
Index nonZeros () const
 
const ScalarvaluePtr () const
 
ScalarvaluePtr ()
 
const StorageIndexinnerIndexPtr () const
 
StorageIndexinnerIndexPtr ()
 
const StorageIndexouterIndexPtr () const
 
StorageIndexouterIndexPtr ()
 
const StorageIndexinnerNonZeroPtr () const
 
StorageIndexinnerNonZeroPtr ()
 
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)
 
- Public Member Functions inherited from Eigen::SparseMatrixBase< SparseVector< Scalar_, Options_, StorageIndex_ > >
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
 
- Public Member Functions inherited from Eigen::EigenBase< SparseVector< Scalar_, Options_, StorageIndex_ > >
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
 
- Protected Member Functions inherited from Eigen::SparseCompressedBase< SparseVector< Scalar_, Options_, StorageIndex_ > >
Eigen::Map< IndexVectorinnerNonZeros ()
 
const Eigen::Map< const IndexVectorinnerNonZeros () const
 
 SparseCompressedBase ()
 
internal::LowerBoundIndex lower_bound (Index row, Index col) const
 
- Protected Member Functions inherited from Eigen::SparseMatrixBase< SparseVector< Scalar_, Options_, StorageIndex_ > >
SparseVector< Scalar_, Options_, StorageIndex_ > & assign (const OtherDerived &other)
 
void assignGeneric (const OtherDerived &other)
 

Protected Attributes

Index m_size
 
- Protected Attributes inherited from Eigen::SparseMatrixBase< SparseVector< Scalar_, Options_, StorageIndex_ > >
bool m_isRValue
 

Private Types

typedef SparseCompressedBase< SparseVectorBase
 

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

- Protected Types inherited from Eigen::SparseCompressedBase< SparseVector< Scalar_, Options_, StorageIndex_ > >
typedef Base::IndexVector IndexVector
 
- Static Protected Member Functions inherited from Eigen::SparseMatrixBase< SparseVector< Scalar_, Options_, StorageIndex_ > >
static StorageIndex convert_index (const Index idx)
 

Detailed Description

template<typename Scalar_, int Options_, typename StorageIndex_>
class Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >

a sparse vector class

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

Member Typedef Documentation

◆ Base

template<typename Scalar_ , int Options_, typename StorageIndex_ >
typedef SparseCompressedBase<SparseVector> Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::Base
private

◆ InnerIterator

template<typename Scalar_ , int Options_, typename StorageIndex_ >
typedef Base::InnerIterator Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::InnerIterator

◆ ReverseInnerIterator

template<typename Scalar_ , int Options_, typename StorageIndex_ >
typedef Base::ReverseInnerIterator Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::ReverseInnerIterator

◆ Storage

template<typename Scalar_ , int Options_, typename StorageIndex_ >
typedef internal::CompressedStorage<Scalar, StorageIndex> Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::Storage

Member Enumeration Documentation

◆ anonymous enum

template<typename Scalar_ , int Options_, typename StorageIndex_ >
anonymous enum
Enumerator
IsColVector 
72 { IsColVector = internal::traits<SparseVector>::IsColVector };
@ IsColVector
Definition: SparseVector.h:72

◆ anonymous enum

template<typename Scalar_ , int Options_, typename StorageIndex_ >
anonymous enum
Enumerator
Options 
74 { Options = Options_ };
@ Options
Definition: SparseVector.h:74

Constructor & Destructor Documentation

◆ SparseVector() [1/7]

template<typename Scalar_ , int Options_, typename StorageIndex_ >
Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::SparseVector ( )
inline
257 : m_size(0) { resize(0); }
Index m_size
Definition: SparseVector.h:401
void resize(Index rows, Index cols)
Definition: SparseVector.h:225

References Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::resize().

◆ SparseVector() [2/7]

template<typename Scalar_ , int Options_, typename StorageIndex_ >
Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::SparseVector ( Index  size)
inlineexplicit

◆ SparseVector() [3/7]

template<typename Scalar_ , int Options_, typename StorageIndex_ >
Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::SparseVector ( Index  rows,
Index  cols 
)
inline
261 : m_size(0) { resize(rows, cols); }
EIGEN_STRONG_INLINE Index rows() const
Definition: SparseVector.h:76
EIGEN_STRONG_INLINE Index cols() const
Definition: SparseVector.h:77

References Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::cols(), Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::resize(), and Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::rows().

◆ SparseVector() [4/7]

template<typename Scalar_ , int Options_, typename StorageIndex_ >
template<typename OtherDerived >
Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::SparseVector ( const SparseMatrixBase< OtherDerived > &  other)
inline
264  : m_size(0) {
265 #ifdef EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN
267 #endif
268  *this = other.derived();
269  }
#define EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN
Definition: sparse_permutations.cpp:22

References Eigen::SparseMatrixBase< Derived >::derived(), and EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN.

◆ SparseVector() [5/7]

template<typename Scalar_ , int Options_, typename StorageIndex_ >
Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::SparseVector ( const SparseVector< Scalar_, Options_, StorageIndex_ > &  other)
inline
271 : Base(other), m_size(0) { *this = other.derived(); }
SparseCompressedBase< SparseVector > Base
Definition: SparseVector.h:63

References Eigen::SparseMatrixBase< Derived >::derived().

◆ SparseVector() [6/7]

template<typename Scalar_ , int Options_, typename StorageIndex_ >
Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::SparseVector ( SparseVector< Scalar_, Options_, StorageIndex_ > &&  other)
inline
316 : SparseVector() { this->swap(other); }
SparseVector()
Definition: SparseVector.h:257
void swap(SparseVector &other)
Definition: SparseVector.h:277

References Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::swap().

◆ SparseVector() [7/7]

template<typename Scalar_ , int Options_, typename StorageIndex_ >
template<typename OtherDerived >
Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::SparseVector ( SparseCompressedBase< OtherDerived > &&  other)
inline
319  : SparseVector() {
320  *this = other.derived().markAsRValue();
321  }

References Eigen::SparseMatrixBase< Derived >::derived().

◆ ~SparseVector()

template<typename Scalar_ , int Options_, typename StorageIndex_ >
Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::~SparseVector ( )
inline

Destructor

350 {}

Member Function Documentation

◆ _data() [1/2]

template<typename Scalar_ , int Options_, typename StorageIndex_ >
EIGEN_DEPRECATED Storage& Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::_data ( )
inline
Deprecated:
use data()
388 { return m_data; }

◆ _data() [2/2]

template<typename Scalar_ , int Options_, typename StorageIndex_ >
EIGEN_DEPRECATED const Storage& Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::_data ( ) const
inline
Deprecated:
use data()
390 { return m_data; }

◆ coeff() [1/2]

template<typename Scalar_ , int Options_, typename StorageIndex_ >
Scalar Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::coeff ( Index  i) const
inline
101  {
102  eigen_assert(i >= 0 && i < m_size);
103  return m_data.at(StorageIndex(i));
104  }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
#define eigen_assert(x)
Definition: Macros.h:910
internal::traits< SparseVector< Scalar_, Options_, StorageIndex_ > >::StorageIndex StorageIndex
Definition: SparseMatrixBase.h:44

References eigen_assert, i, and Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::m_size.

◆ coeff() [2/2]

template<typename Scalar_ , int Options_, typename StorageIndex_ >
Scalar Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::coeff ( Index  row,
Index  col 
) const
inline
97  {
98  eigen_assert(IsColVector ? (col == 0 && row >= 0 && row < m_size) : (row == 0 && col >= 0 && col < m_size));
99  return coeff(IsColVector ? row : col);
100  }
m col(1)
m row(1)
Scalar coeff(Index row, Index col) const
Definition: SparseVector.h:97

References col(), eigen_assert, Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::IsColVector, Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::m_size, and row().

◆ coeffRef() [1/2]

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

117  {
118  eigen_assert(i >= 0 && i < m_size);
119 
120  return m_data.atWithInsertion(StorageIndex(i));
121  }

References eigen_assert, i, and Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::m_size.

◆ coeffRef() [2/2]

template<typename Scalar_ , int Options_, typename StorageIndex_ >
Scalar& Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::coeffRef ( Index  row,
Index  col 
)
inline
106  {
107  eigen_assert(IsColVector ? (col == 0 && row >= 0 && row < m_size) : (row == 0 && col >= 0 && col < m_size));
108  return coeffRef(IsColVector ? row : col);
109  }
Scalar & coeffRef(Index row, Index col)
Definition: SparseVector.h:106

References col(), eigen_assert, Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::IsColVector, Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::m_size, and row().

◆ cols()

◆ conservativeResize()

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()
246  {
247  if (newSize < m_size) {
248  Index i = 0;
249  while (i < m_data.size() && m_data.index(i) < newSize) ++i;
250  m_data.resize(i);
251  }
252  m_size = newSize;
253  }
Eigen::Index Index
The interface type of indices.
Definition: EigenBase.h:43

References i, and Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::m_size.

◆ data() [1/2]

◆ data() [2/2]

template<typename Scalar_ , int Options_, typename StorageIndex_ >
constexpr const Storage& Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::data ( ) const
inlineconstexpr

◆ EIGEN_STATIC_ASSERT()

template<typename Scalar_ , int Options_, typename StorageIndex_ >
Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::EIGEN_STATIC_ASSERT ( (Options_ &(ColMajor|RowMajor))  = =Options,
INVALID_MATRIX_TEMPLATE_PARAMETERS   
)
protected

◆ endFill()

template<typename Scalar_ , int Options_, typename StorageIndex_ >
EIGEN_DEPRECATED void Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::endFill ( )
inline
Deprecated:
use finalize()
384 {}

◆ fill() [1/2]

template<typename Scalar_ , int Options_, typename StorageIndex_ >
EIGEN_DEPRECATED Scalar& Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::fill ( Index  i)
inline
Deprecated:
use insertBack(Index)
369  {
370  m_data.append(0, i);
371  return m_data.value(m_data.size() - 1);
372  }

References i.

◆ fill() [2/2]

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)
363  {
364  eigen_assert(r == 0 || c == 0);
365  return fill(IsColVector ? r : c);
366  }
EIGEN_DEPRECATED Scalar & fill(Index r, Index c)
Definition: SparseVector.h:363
r
Definition: UniformPSDSelfTest.py:20
int c
Definition: calibrate.py:100

References calibrate::c, eigen_assert, Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::IsColVector, and UniformPSDSelfTest::r.

◆ fillrand() [1/2]

template<typename Scalar_ , int Options_, typename StorageIndex_ >
EIGEN_DEPRECATED Scalar& Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::fillrand ( Index  i)
inline
Deprecated:
use insert(Index)
381 { return insert(i); }
Scalar & insert(Index row, Index col)
Definition: SparseVector.h:157

References i, and Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::insert().

◆ fillrand() [2/2]

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)
375  {
376  eigen_assert(r == 0 || c == 0);
377  return fillrand(IsColVector ? r : c);
378  }
EIGEN_DEPRECATED Scalar & fillrand(Index r, Index c)
Definition: SparseVector.h:375

References calibrate::c, eigen_assert, Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::IsColVector, and UniformPSDSelfTest::r.

◆ finalize()

template<typename Scalar_ , int Options_, typename StorageIndex_ >
void Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::finalize ( )
inline
188 {}

◆ innerIndexPtr() [1/2]

template<typename Scalar_ , int Options_, typename StorageIndex_ >
EIGEN_STRONG_INLINE StorageIndex* Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::innerIndexPtr ( )
inline
85 { return m_data.indexPtr(); }

◆ innerIndexPtr() [2/2]

template<typename Scalar_ , int Options_, typename StorageIndex_ >
EIGEN_STRONG_INLINE const StorageIndex* Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::innerIndexPtr ( ) const
inline
84 { return m_data.indexPtr(); }

◆ innerNonZeroPtr() [1/2]

template<typename Scalar_ , int Options_, typename StorageIndex_ >
StorageIndex* Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::innerNonZeroPtr ( )
inline
90 { return 0; }

◆ innerNonZeroPtr() [2/2]

template<typename Scalar_ , int Options_, typename StorageIndex_ >
const StorageIndex* Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::innerNonZeroPtr ( ) const
inline
89 { return 0; }

◆ innerSize()

template<typename Scalar_ , int Options_, typename StorageIndex_ >
EIGEN_STRONG_INLINE Index Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::innerSize ( ) const
inline

◆ insert() [1/2]

template<typename Scalar_ , int Options_, typename StorageIndex_ >
Scalar& Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::insert ( Index  i)
inline
166  {
167  eigen_assert(i >= 0 && i < m_size);
168 
169  Index startId = 0;
170  Index p = Index(m_data.size()) - 1;
171  // TODO smart realloc
172  m_data.resize(p + 2, 1);
173 
174  while ((p >= startId) && (m_data.index(p) > i)) {
175  m_data.index(p + 1) = m_data.index(p);
176  m_data.value(p + 1) = m_data.value(p);
177  --p;
178  }
179  m_data.index(p + 1) = convert_index(i);
180  m_data.value(p + 1) = 0;
181  return m_data.value(p + 1);
182  }
float * p
Definition: Tutorial_Map_using.cpp:9
static StorageIndex convert_index(const Index idx)
Definition: SparseMatrixBase.h:391

References Eigen::SparseMatrixBase< SparseVector< Scalar_, Options_, StorageIndex_ > >::convert_index(), eigen_assert, i, Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::m_size, and p.

◆ insert() [2/2]

template<typename Scalar_ , int Options_, typename StorageIndex_ >
Scalar& Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::insert ( Index  row,
Index  col 
)
inline
157  {
158  eigen_assert(IsColVector ? (col == 0 && row >= 0 && row < m_size) : (row == 0 && col >= 0 && col < m_size));
159 
160  Index inner = IsColVector ? row : col;
161  Index outer = IsColVector ? col : row;
163  eigen_assert(outer == 0);
164  return insert(inner);
165  }
#define EIGEN_ONLY_USED_FOR_DEBUG(x)
Definition: Macros.h:922

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().

◆ insertBack()

template<typename Scalar_ , int Options_, typename StorageIndex_ >
Scalar& Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::insertBack ( Index  i)
inline
142  {
143  m_data.append(0, i);
144  return m_data.value(m_data.size() - 1);
145  }

References i.

Referenced by initSparse(), and Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::insertBackByOuterInner().

◆ insertBackByOuterInner()

template<typename Scalar_ , int Options_, typename StorageIndex_ >
Scalar& Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::insertBackByOuterInner ( Index  outer,
Index  inner 
)
inline
137  {
138  EIGEN_UNUSED_VARIABLE(outer);
139  eigen_assert(outer == 0);
140  return insertBack(inner);
141  }
#define EIGEN_UNUSED_VARIABLE(var)
Definition: Macros.h:966
Scalar & insertBack(Index i)
Definition: SparseVector.h:142

References eigen_assert, EIGEN_UNUSED_VARIABLE, and Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::insertBack().

◆ insertBackByOuterInnerUnordered()

template<typename Scalar_ , int Options_, typename StorageIndex_ >
Scalar& Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::insertBackByOuterInnerUnordered ( Index  outer,
Index  inner 
)
inline
147  {
148  EIGEN_UNUSED_VARIABLE(outer);
149  eigen_assert(outer == 0);
150  return insertBackUnordered(inner);
151  }
Scalar & insertBackUnordered(Index i)
Definition: SparseVector.h:152

References eigen_assert, EIGEN_UNUSED_VARIABLE, and Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::insertBackUnordered().

◆ insertBackUnordered()

template<typename Scalar_ , int Options_, typename StorageIndex_ >
Scalar& Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::insertBackUnordered ( Index  i)
inline
152  {
153  m_data.append(0, i);
154  return m_data.value(m_data.size() - 1);
155  }

References i.

Referenced by Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::insertBackByOuterInnerUnordered().

◆ nonZeros()

template<typename Scalar_ , int Options_, typename StorageIndex_ >
Index Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::nonZeros ( ) const
inline
Returns
the number of non zero coefficients
130 { return m_data.size(); }

◆ operator=() [1/5]

template<typename Scalar_ , int Options_, typename StorageIndex_ >
template<typename OtherDerived >
SparseVector& Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::operator= ( const SparseMatrixBase< OtherDerived > &  other)
inline
309  {
310  SparseVector tmp(other.size());
312  this->swap(tmp);
313  return *this;
314  }
Eigen::Matrix< Scalar, Dynamic, Dynamic, ColMajor > tmp
Definition: level3_impl.h:365
void run(const string &dir_name, LinearSolver *linear_solver_pt, const unsigned nel_1d, bool mess_up_order)
Definition: two_d_poisson_compare_solvers.cc:317

References Eigen::SparseMatrixBase< Derived >::derived(), run(), Eigen::SparseMatrixBase< Derived >::size(), Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::swap(), and tmp.

◆ operator=() [2/5]

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
336  {
337  return Base::operator=(product);
338  }
Derived & operator=(const Derived &other)
Definition: SparseAssign.h:43
void product(const MatrixType &m)
Definition: product.h:42

References Eigen::SparseCompressedBase< Derived >::operator=(), and product().

◆ operator=() [3/5]

template<typename Scalar_ , int Options_, typename StorageIndex_ >
SparseVector& Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::operator= ( const SparseVector< Scalar_, Options_, StorageIndex_ > &  other)
inline
298  {
299  if (other.isRValue()) {
300  swap(other.const_cast_derived());
301  } else {
302  resize(other.size());
303  m_data = other.m_data;
304  }
305  return *this;
306  }

References Eigen::SparseMatrixBase< Derived >::const_cast_derived(), Eigen::SparseMatrixBase< Derived >::isRValue(), Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::resize(), Eigen::SparseMatrixBase< Derived >::size(), and Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::swap().

◆ operator=() [4/5]

template<typename Scalar_ , int Options_, typename StorageIndex_ >
template<typename OtherDerived >
SparseVector& Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::operator= ( SparseCompressedBase< OtherDerived > &&  other)
inline
329  {
330  *this = other.derived().markAsRValue();
331  return *this;
332  }

References Eigen::SparseMatrixBase< Derived >::derived().

◆ operator=() [5/5]

template<typename Scalar_ , int Options_, typename StorageIndex_ >
SparseVector& Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::operator= ( SparseVector< Scalar_, Options_, StorageIndex_ > &&  other)
inline
323  {
324  this->swap(other);
325  return *this;
326  }

References Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::swap().

◆ outerIndexPtr() [1/2]

template<typename Scalar_ , int Options_, typename StorageIndex_ >
StorageIndex* Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::outerIndexPtr ( )
inline
88 { return 0; }

◆ outerIndexPtr() [2/2]

template<typename Scalar_ , int Options_, typename StorageIndex_ >
const StorageIndex* Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::outerIndexPtr ( ) const
inline
87 { return 0; }

◆ outerSize()

template<typename Scalar_ , int Options_, typename StorageIndex_ >
EIGEN_STRONG_INLINE Index Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::outerSize ( ) const
inline
79 { return 1; }

◆ prune() [1/2]

template<typename Scalar_ , int Options_, typename StorageIndex_ >
Index 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 tolerance epsilon

191  {
192  return prune([&](const Scalar& val) { return !internal::isMuchSmallerThan(val, reference, epsilon); });
193  }
SCALAR Scalar
Definition: bench_gemm.cpp:45
Index prune(const Scalar &reference, const RealScalar &epsilon=NumTraits< RealScalar >::dummy_precision())
Definition: SparseVector.h:191
EIGEN_DEVICE_FUNC bool isMuchSmallerThan(const Scalar &x, const OtherScalar &y, const typename NumTraits< Scalar >::Real &precision=NumTraits< Scalar >::dummy_precision())
Definition: MathFunctions.h:1916
val
Definition: calibrate.py:119
double epsilon
Definition: osc_ring_sarah_asymptotics.h:43

References oomph::SarahBL::epsilon, Eigen::internal::isMuchSmallerThan(), and calibrate::val.

◆ prune() [2/2]

template<typename Scalar_ , int Options_, typename StorageIndex_ >
template<class F >
Index Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::prune ( F &&  keep_predicate)
inline

Prunes the entries of the vector based on a predicate

Template Parameters
FType of the predicate.
Parameters
keep_predicateThe 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.
Returns
The new number of structural non-zeros.
203  {
204  Index k = 0;
205  Index n = m_data.size();
206  for (Index i = 0; i < n; ++i) {
207  if (keep_predicate(m_data.value(i))) {
208  m_data.value(k) = std::move(m_data.value(i));
209  m_data.index(k) = m_data.index(i);
210  ++k;
211  }
212  }
213  m_data.resize(k);
214  return k;
215  }
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
char char char int int * k
Definition: level2_impl.h:374

References i, k, and n.

◆ reserve()

template<typename Scalar_ , int Options_, typename StorageIndex_ >
void Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::reserve ( Index  reserveSize)
inline
186 { m_data.reserve(reserveSize); }

Referenced by initSparse(), and Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::startFill().

◆ resize() [1/2]

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()
234  {
235  m_size = newSize;
236  m_data.clear();
237  }

References Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::m_size.

◆ resize() [2/2]

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)
225  {
226  eigen_assert((IsColVector ? cols : rows) == 1 && "Outer dimension must equal 1");
228  }

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().

◆ resizeNonZeros()

template<typename Scalar_ , int Options_, typename StorageIndex_ >
void Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::resizeNonZeros ( Index  size)
inline

◆ rows()

◆ setZero()

template<typename Scalar_ , int Options_, typename StorageIndex_ >
void Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::setZero ( )
inline

◆ startFill()

template<typename Scalar_ , int Options_, typename StorageIndex_ >
EIGEN_DEPRECATED void Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::startFill ( Index  reserve)
inline
Deprecated:
use setZero() and reserve()
357  {
358  setZero();
359  m_data.reserve(reserve);
360  }
void setZero()
Definition: SparseVector.h:127
void reserve(Index reserveSize)
Definition: SparseVector.h:186

References Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::reserve(), and Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::setZero().

◆ startVec()

template<typename Scalar_ , int Options_, typename StorageIndex_ >
void Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::startVec ( Index  outer)
inline
132  {
133  EIGEN_UNUSED_VARIABLE(outer);
134  eigen_assert(outer == 0);
135  }

References eigen_assert, and EIGEN_UNUSED_VARIABLE.

◆ sum()

template<typename Scalar_ , int Options_, typename Index_ >
internal::traits< SparseVector< Scalar_, Options_, Index_ > >::Scalar Eigen::SparseVector< Scalar_, Options_, Index_ >::sum

Overloaded for performance

40  {
41  eigen_assert(rows() > 0 && cols() > 0 && "you are using a non initialized matrix");
42  return Matrix<Scalar, 1, Dynamic>::Map(m_data.valuePtr(), m_data.size()).sum();
43 }
static ConstMapType Map(const Scalar *data)
Definition: PlainObjectBase.h:595

References cols, eigen_assert, Eigen::PlainObjectBase< Matrix< Scalar_, Rows_, Cols_, Options_, MaxRows_, MaxCols_ > >::Map(), and rows.

◆ swap() [1/2]

template<typename Scalar_ , int Options_, typename StorageIndex_ >
template<int OtherOptions>
void Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::swap ( SparseMatrix< Scalar, OtherOptions, StorageIndex > &  other)
inline
284  {
285  eigen_assert(other.outerSize() == 1);
286  std::swap(m_size, other.m_innerSize);
287  m_data.swap(other.m_data);
288  }
EIGEN_BLAS_FUNC() swap(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy)
Definition: level1_impl.h:117

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().

◆ swap() [2/2]

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 swapping pointers and attributes only.

See also
SparseMatrixBase::swap()
277  {
278  std::swap(m_size, other.m_size);
279  m_data.swap(other.m_data);
280  }

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().

◆ valuePtr() [1/2]

template<typename Scalar_ , int Options_, typename StorageIndex_ >
EIGEN_STRONG_INLINE Scalar* Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::valuePtr ( )
inline
82 { return m_data.valuePtr(); }

◆ valuePtr() [2/2]

template<typename Scalar_ , int Options_, typename StorageIndex_ >
EIGEN_STRONG_INLINE const Scalar* Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::valuePtr ( ) const
inline
81 { return m_data.valuePtr(); }

Friends And Related Function Documentation

◆ operator<<

template<typename Scalar_ , int Options_, typename StorageIndex_ >
std::ostream& operator<< ( std::ostream &  s,
const SparseVector< Scalar_, Options_, StorageIndex_ > &  m 
)
friend
342  {
343  for (Index i = 0; i < m.nonZeros(); ++i) s << "(" << m.m_data.value(i) << "," << m.m_data.index(i) << ") ";
344  s << std::endl;
345  return s;
346  }
RealScalar s
Definition: level1_cplx_impl.h:130
int * m
Definition: level2_cplx_impl.h:294

◆ swap [1/3]

template<typename Scalar_ , int Options_, typename StorageIndex_ >
template<int OtherOptions>
EIGEN_DEVICE_FUNC void swap ( SparseMatrix< Scalar, OtherOptions, StorageIndex > &  a,
SparseVector< Scalar_, Options_, StorageIndex_ > &  b 
)
friend
294  {
295  b.swap(a);
296  }
Scalar * b
Definition: benchVecAdd.cpp:17
const Scalar * a
Definition: level2_cplx_impl.h:32

◆ swap [2/3]

template<typename Scalar_ , int Options_, typename StorageIndex_ >
template<int OtherOptions>
EIGEN_DEVICE_FUNC void swap ( SparseVector< Scalar_, Options_, StorageIndex_ > &  a,
SparseMatrix< Scalar, OtherOptions, StorageIndex > &  b 
)
friend
290  {
291  a.swap(b);
292  }

◆ swap [3/3]

template<typename Scalar_ , int Options_, typename StorageIndex_ >
EIGEN_DEVICE_FUNC void swap ( SparseVector< Scalar_, Options_, StorageIndex_ > &  a,
SparseVector< Scalar_, Options_, StorageIndex_ > &  b 
)
friend
281 { a.swap(b); }

Member Data Documentation

◆ m_size


The documentation for this class was generated from the following files: