SparseVector.h
Go to the documentation of this file.
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2008-2015 Gael Guennebaud <gael.guennebaud@inria.fr>
5 //
6 // This Source Code Form is subject to the terms of the Mozilla
7 // Public License v. 2.0. If a copy of the MPL was not distributed
8 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 
10 #ifndef EIGEN_SPARSEVECTOR_H
11 #define EIGEN_SPARSEVECTOR_H
12 
13 // IWYU pragma: private
14 #include "./InternalHeaderCheck.h"
15 
16 namespace Eigen {
17 
31 namespace internal {
32 template <typename Scalar_, int Options_, typename StorageIndex_>
33 struct traits<SparseVector<Scalar_, Options_, StorageIndex_> > {
34  typedef Scalar_ Scalar;
35  typedef StorageIndex_ StorageIndex;
37  typedef MatrixXpr XprKind;
38  enum {
39  IsColVector = (Options_ & RowMajorBit) ? 0 : 1,
40 
41  RowsAtCompileTime = IsColVector ? Dynamic : 1,
42  ColsAtCompileTime = IsColVector ? 1 : Dynamic,
43  MaxRowsAtCompileTime = RowsAtCompileTime,
44  MaxColsAtCompileTime = ColsAtCompileTime,
45  Flags = Options_ | NestByRefBit | LvalueBit | (IsColVector ? 0 : RowMajorBit) | CompressedAccessBit,
46  SupportedAccessPatterns = InnerRandomAccessPattern
47  };
48 };
49 
50 // Sparse-Vector-Assignment kinds:
52 
53 template <typename Dest, typename Src,
54  int AssignmentKind = !bool(Src::IsVectorAtCompileTime) ? SVA_RuntimeSwitch
55  : Src::InnerSizeAtCompileTime == 1 ? SVA_Outer
56  : SVA_Inner>
58 
59 } // namespace internal
60 
61 template <typename Scalar_, int Options_, typename StorageIndex_>
62 class SparseVector : public SparseCompressedBase<SparseVector<Scalar_, Options_, StorageIndex_> > {
64  using Base::convert_index;
65 
66  public:
70 
71  typedef internal::CompressedStorage<Scalar, StorageIndex> Storage;
73 
74  enum { Options = Options_ };
75 
76  EIGEN_STRONG_INLINE Index rows() const { return IsColVector ? m_size : 1; }
77  EIGEN_STRONG_INLINE Index cols() const { return IsColVector ? 1 : m_size; }
79  EIGEN_STRONG_INLINE Index outerSize() const { return 1; }
80 
81  EIGEN_STRONG_INLINE const Scalar* valuePtr() const { return m_data.valuePtr(); }
82  EIGEN_STRONG_INLINE Scalar* valuePtr() { return m_data.valuePtr(); }
83 
84  EIGEN_STRONG_INLINE const StorageIndex* innerIndexPtr() const { return m_data.indexPtr(); }
85  EIGEN_STRONG_INLINE StorageIndex* innerIndexPtr() { return m_data.indexPtr(); }
86 
87  inline const StorageIndex* outerIndexPtr() const { return 0; }
88  inline StorageIndex* outerIndexPtr() { return 0; }
89  inline const StorageIndex* innerNonZeroPtr() const { return 0; }
90  inline StorageIndex* innerNonZeroPtr() { return 0; }
91 
93  constexpr Storage& data() { return m_data; }
95  constexpr const Storage& data() const { return m_data; }
96 
97  inline Scalar coeff(Index row, Index col) const {
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  }
101  inline Scalar coeff(Index i) const {
102  eigen_assert(i >= 0 && i < m_size);
103  return m_data.at(StorageIndex(i));
104  }
105 
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  }
110 
117  inline Scalar& coeffRef(Index i) {
118  eigen_assert(i >= 0 && i < m_size);
119 
120  return m_data.atWithInsertion(StorageIndex(i));
121  }
122 
123  public:
126 
127  inline void setZero() { m_data.clear(); }
128 
130  inline Index nonZeros() const { return m_data.size(); }
131 
132  inline void startVec(Index outer) {
133  EIGEN_UNUSED_VARIABLE(outer);
134  eigen_assert(outer == 0);
135  }
136 
137  inline Scalar& insertBackByOuterInner(Index outer, Index inner) {
138  EIGEN_UNUSED_VARIABLE(outer);
139  eigen_assert(outer == 0);
140  return insertBack(inner);
141  }
143  m_data.append(0, i);
144  return m_data.value(m_data.size() - 1);
145  }
146 
148  EIGEN_UNUSED_VARIABLE(outer);
149  eigen_assert(outer == 0);
150  return insertBackUnordered(inner);
151  }
153  m_data.append(0, i);
154  return m_data.value(m_data.size() - 1);
155  }
156 
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  }
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  }
183 
186  inline void reserve(Index reserveSize) { m_data.reserve(reserveSize); }
187 
188  inline void finalize() {}
189 
192  return prune([&](const Scalar& val) { return !internal::isMuchSmallerThan(val, reference, epsilon); });
193  }
194 
202  template <class F>
203  Index prune(F&& keep_predicate) {
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  }
216 
226  eigen_assert((IsColVector ? cols : rows) == 1 && "Outer dimension must equal 1");
228  }
229 
234  void resize(Index newSize) {
235  m_size = newSize;
236  m_data.clear();
237  }
238 
246  void conservativeResize(Index newSize) {
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  }
254 
255  void resizeNonZeros(Index size) { m_data.resize(size); }
256 
257  inline SparseVector() : m_size(0) { resize(0); }
258 
259  explicit inline SparseVector(Index size) : m_size(0) { resize(size); }
260 
262 
263  template <typename OtherDerived>
265 #ifdef EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN
267 #endif
268  *this = other.derived();
269  }
270 
271  inline SparseVector(const SparseVector& other) : Base(other), m_size(0) { *this = other.derived(); }
272 
277  inline void swap(SparseVector& other) {
278  std::swap(m_size, other.m_size);
279  m_data.swap(other.m_data);
280  }
281  friend EIGEN_DEVICE_FUNC void swap(SparseVector& a, SparseVector& b) { a.swap(b); }
282 
283  template <int OtherOptions>
285  eigen_assert(other.outerSize() == 1);
286  std::swap(m_size, other.m_innerSize);
287  m_data.swap(other.m_data);
288  }
289  template <int OtherOptions>
291  a.swap(b);
292  }
293  template <int OtherOptions>
295  b.swap(a);
296  }
297 
298  inline SparseVector& operator=(const SparseVector& other) {
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  }
307 
308  template <typename OtherDerived>
310  SparseVector tmp(other.size());
312  this->swap(tmp);
313  return *this;
314  }
315 
316  inline SparseVector(SparseVector&& other) : SparseVector() { this->swap(other); }
317 
318  template <typename OtherDerived>
320  *this = other.derived().markAsRValue();
321  }
322 
324  this->swap(other);
325  return *this;
326  }
327 
328  template <typename OtherDerived>
330  *this = other.derived().markAsRValue();
331  return *this;
332  }
333 
334 #ifndef EIGEN_PARSED_BY_DOXYGEN
335  template <typename Lhs, typename Rhs>
337  return Base::operator=(product);
338  }
339 #endif
340 
341 #ifndef EIGEN_NO_IO
342  friend std::ostream& operator<<(std::ostream& s, const SparseVector& m) {
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  }
347 #endif
348 
350  inline ~SparseVector() {}
351 
353  Scalar sum() const;
354 
355  public:
358  setZero();
359  m_data.reserve(reserve);
360  }
361 
364  eigen_assert(r == 0 || c == 0);
365  return fill(IsColVector ? r : c);
366  }
367 
370  m_data.append(0, i);
371  return m_data.value(m_data.size() - 1);
372  }
373 
376  eigen_assert(r == 0 || c == 0);
377  return fillrand(IsColVector ? r : c);
378  }
379 
382 
385 
386  // These two functions were here in the 3.1 release, so let's keep them in case some code rely on them.
388  EIGEN_DEPRECATED Storage& _data() { return m_data; }
390  EIGEN_DEPRECATED const Storage& _data() const { return m_data; }
391 
392 #ifdef EIGEN_SPARSEVECTOR_PLUGIN
393 #include EIGEN_SPARSEVECTOR_PLUGIN
394 #endif
395 
396  protected:
397  EIGEN_STATIC_ASSERT(NumTraits<StorageIndex>::IsSigned, THE_INDEX_TYPE_MUST_BE_A_SIGNED_TYPE)
398  EIGEN_STATIC_ASSERT((Options_ & (ColMajor | RowMajor)) == Options, INVALID_MATRIX_TEMPLATE_PARAMETERS)
399 
400  Storage m_data;
402 };
403 
404 namespace internal {
405 
406 template <typename Scalar_, int Options_, typename Index_>
407 struct evaluator<SparseVector<Scalar_, Options_, Index_> > : evaluator_base<SparseVector<Scalar_, Options_, Index_> > {
412 
413  enum { CoeffReadCost = NumTraits<Scalar_>::ReadCost, Flags = SparseVectorType::Flags };
414 
415  evaluator() : Base() {}
416 
417  explicit evaluator(const SparseVectorType& mat) : m_matrix(&mat) { EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); }
418 
419  inline Index nonZerosEstimate() const { return m_matrix->nonZeros(); }
420 
421  operator SparseVectorType&() { return m_matrix->const_cast_derived(); }
422  operator const SparseVectorType&() const { return *m_matrix; }
423 
425 };
426 
427 template <typename Dest, typename Src>
429  static void run(Dest& dst, const Src& src) {
430  eigen_internal_assert(src.innerSize() == src.size());
431  typedef internal::evaluator<Src> SrcEvaluatorType;
432  SrcEvaluatorType srcEval(src);
433  for (typename SrcEvaluatorType::InnerIterator it(srcEval, 0); it; ++it) dst.insert(it.index()) = it.value();
434  }
435 };
436 
437 template <typename Dest, typename Src>
439  static void run(Dest& dst, const Src& src) {
440  eigen_internal_assert(src.outerSize() == src.size());
441  typedef internal::evaluator<Src> SrcEvaluatorType;
442  SrcEvaluatorType srcEval(src);
443  for (Index i = 0; i < src.size(); ++i) {
444  typename SrcEvaluatorType::InnerIterator it(srcEval, i);
445  if (it) dst.insert(i) = it.value();
446  }
447  }
448 };
449 
450 template <typename Dest, typename Src>
452  static void run(Dest& dst, const Src& src) {
453  if (src.outerSize() == 1)
455  else
457  }
458 };
459 
460 } // namespace internal
461 
462 // Specialization for SparseVector.
463 // Serializes [size, numNonZeros, innerIndices, values].
464 template <typename Scalar, int Options, typename StorageIndex>
466  public:
468 
469  struct Header {
472  };
473 
474  EIGEN_DEVICE_FUNC size_t size(const SparseMat& value) const {
475  return sizeof(Header) + (sizeof(Scalar) + sizeof(StorageIndex)) * value.nonZeros();
476  }
477 
479  if (EIGEN_PREDICT_FALSE(dest == nullptr)) return nullptr;
480  if (EIGEN_PREDICT_FALSE(dest + size(value) > end)) return nullptr;
481 
482  const size_t header_bytes = sizeof(Header);
483  Header header = {value.innerSize(), value.nonZeros()};
484  EIGEN_USING_STD(memcpy)
485  memcpy(dest, &header, header_bytes);
486  dest += header_bytes;
487 
488  // Inner indices.
489  std::size_t data_bytes = sizeof(StorageIndex) * header.num_non_zeros;
490  memcpy(dest, value.innerIndexPtr(), data_bytes);
491  dest += data_bytes;
492 
493  // Values.
494  data_bytes = sizeof(Scalar) * header.num_non_zeros;
495  memcpy(dest, value.valuePtr(), data_bytes);
496  dest += data_bytes;
497 
498  return dest;
499  }
500 
501  EIGEN_DEVICE_FUNC const uint8_t* deserialize(const uint8_t* src, const uint8_t* end, SparseMat& value) const {
502  if (EIGEN_PREDICT_FALSE(src == nullptr)) return nullptr;
503  if (EIGEN_PREDICT_FALSE(src + sizeof(Header) > end)) return nullptr;
504 
505  const size_t header_bytes = sizeof(Header);
506  Header header;
507  EIGEN_USING_STD(memcpy)
508  memcpy(&header, src, header_bytes);
509  src += header_bytes;
510 
511  value.setZero();
512  value.resize(header.size);
513  value.resizeNonZeros(header.num_non_zeros);
514 
515  // Inner indices.
516  std::size_t data_bytes = sizeof(StorageIndex) * header.num_non_zeros;
517  if (EIGEN_PREDICT_FALSE(src + data_bytes > end)) return nullptr;
518  memcpy(value.innerIndexPtr(), src, data_bytes);
519  src += data_bytes;
520 
521  // Values.
522  data_bytes = sizeof(Scalar) * header.num_non_zeros;
523  if (EIGEN_PREDICT_FALSE(src + data_bytes > end)) return nullptr;
524  memcpy(value.valuePtr(), src, data_bytes);
525  src += data_bytes;
526  return src;
527  }
528 };
529 
530 } // end namespace Eigen
531 
532 #endif // EIGEN_SPARSEVECTOR_H
int i
Definition: BiCGSTAB_step_by_step.cpp:9
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
#define EIGEN_DEPRECATED
Definition: Macros.h:931
#define EIGEN_USING_STD(FUNC)
Definition: Macros.h:1090
#define eigen_internal_assert(x)
Definition: Macros.h:916
#define EIGEN_PREDICT_FALSE(x)
Definition: Macros.h:1179
#define EIGEN_UNUSED_VARIABLE(var)
Definition: Macros.h:966
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:892
#define EIGEN_ONLY_USED_FOR_DEBUG(x)
Definition: Macros.h:922
#define eigen_assert(x)
Definition: Macros.h:910
#define EIGEN_STRONG_INLINE
Definition: Macros.h:834
m col(1)
m row(1)
#define EIGEN_SPARSE_PUBLIC_INTERFACE(Derived)
Definition: SparseUtil.h:39
#define EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATOR(Derived, Op)
Definition: SparseUtil.h:24
#define EIGEN_INTERNAL_CHECK_COST_VALUE(C)
Definition: StaticAssert.h:101
float * p
Definition: Tutorial_Map_using.cpp:9
Scalar * b
Definition: benchVecAdd.cpp:17
SCALAR Scalar
Definition: bench_gemm.cpp:45
EIGEN_DEVICE_FUNC const uint8_t * deserialize(const uint8_t *src, const uint8_t *end, SparseMat &value) const
Definition: SparseVector.h:501
EIGEN_DEVICE_FUNC size_t size(const SparseMat &value) const
Definition: SparseVector.h:474
SparseVector< Scalar, Options, StorageIndex > SparseMat
Definition: SparseVector.h:467
EIGEN_DEVICE_FUNC uint8_t * serialize(uint8_t *dest, uint8_t *end, const SparseMat &value)
Definition: SparseVector.h:478
Definition: Serializer.h:27
Definition: SparseCompressedBase.h:207
Definition: SparseCompressedBase.h:292
Common base class for sparse [compressed]-{row|column}-storage format.
Definition: SparseCompressedBase.h:43
Derived & operator=(const Derived &other)
Definition: SparseAssign.h:43
Base class of any sparse matrices or sparse expressions.
Definition: SparseMatrixBase.h:30
internal::traits< SparseVector< Scalar_, Options_, StorageIndex_ > >::StorageIndex StorageIndex
Definition: SparseMatrixBase.h:44
bool isRValue() const
Definition: SparseMatrixBase.h:200
Derived & const_cast_derived() const
Definition: SparseMatrixBase.h:146
internal::traits< SparseVector< Scalar_, Options_, StorageIndex_ > >::Scalar Scalar
Definition: SparseMatrixBase.h:32
const Derived & derived() const
Definition: SparseMatrixBase.h:144
NumTraits< Scalar >::Real RealScalar
Definition: SparseMatrixBase.h:128
static StorageIndex convert_index(const Index idx)
Definition: SparseMatrixBase.h:391
A versatible sparse matrix representation.
Definition: SparseMatrix.h:121
Storage m_data
Definition: SparseMatrix.h:155
Index outerSize() const
Definition: SparseMatrix.h:166
Index m_innerSize
Definition: SparseMatrix.h:152
Definition: SparseUtil.h:59
a sparse vector class
Definition: SparseVector.h:62
void startVec(Index outer)
Definition: SparseVector.h:132
@ IsColVector
Definition: SparseVector.h:72
EIGEN_DEPRECATED Scalar & fillrand(Index r, Index c)
Definition: SparseVector.h:375
Scalar & insertBackByOuterInnerUnordered(Index outer, Index inner)
Definition: SparseVector.h:147
Scalar & coeffRef(Index row, Index col)
Definition: SparseVector.h:106
StorageIndex * innerNonZeroPtr()
Definition: SparseVector.h:90
void resizeNonZeros(Index size)
Definition: SparseVector.h:255
constexpr Storage & data()
Definition: SparseVector.h:93
SparseVector(SparseCompressedBase< OtherDerived > &&other)
Definition: SparseVector.h:319
Index m_size
Definition: SparseVector.h:401
void finalize()
Definition: SparseVector.h:188
EIGEN_DEPRECATED Scalar & fill(Index i)
Definition: SparseVector.h:369
Scalar & insert(Index row, Index col)
Definition: SparseVector.h:157
void conservativeResize(Index newSize)
Definition: SparseVector.h:246
EIGEN_STRONG_INLINE const Scalar * valuePtr() const
Definition: SparseVector.h:81
SparseVector(Index rows, Index cols)
Definition: SparseVector.h:261
Scalar & insertBackByOuterInner(Index outer, Index inner)
Definition: SparseVector.h:137
SparseVector(SparseVector &&other)
Definition: SparseVector.h:316
Base::ReverseInnerIterator ReverseInnerIterator
Definition: SparseVector.h:125
EIGEN_STRONG_INLINE StorageIndex * innerIndexPtr()
Definition: SparseVector.h:85
const StorageIndex * outerIndexPtr() const
Definition: SparseVector.h:87
friend EIGEN_DEVICE_FUNC void swap(SparseVector &a, SparseVector &b)
Definition: SparseVector.h:281
friend EIGEN_DEVICE_FUNC void swap(SparseVector &a, SparseMatrix< Scalar, OtherOptions, StorageIndex > &b)
Definition: SparseVector.h:290
Index prune(const Scalar &reference, const RealScalar &epsilon=NumTraits< RealScalar >::dummy_precision())
Definition: SparseVector.h:191
friend std::ostream & operator<<(std::ostream &s, const SparseVector &m)
Definition: SparseVector.h:342
@ Options
Definition: SparseVector.h:74
void resize(Index rows, Index cols)
Definition: SparseVector.h:225
SparseVector & operator=(SparseCompressedBase< OtherDerived > &&other)
Definition: SparseVector.h:329
SparseVector()
Definition: SparseVector.h:257
Scalar & coeffRef(Index i)
Definition: SparseVector.h:117
constexpr const Storage & data() const
Definition: SparseVector.h:95
~SparseVector()
Definition: SparseVector.h:350
friend EIGEN_DEVICE_FUNC void swap(SparseMatrix< Scalar, OtherOptions, StorageIndex > &a, SparseVector &b)
Definition: SparseVector.h:294
EIGEN_STRONG_INLINE Index innerSize() const
Definition: SparseVector.h:78
SparseVector & operator=(SparseVector &&other)
Definition: SparseVector.h:323
Scalar & insert(Index i)
Definition: SparseVector.h:166
EIGEN_STRONG_INLINE const StorageIndex * innerIndexPtr() const
Definition: SparseVector.h:84
const StorageIndex * innerNonZeroPtr() const
Definition: SparseVector.h:89
void swap(SparseVector &other)
Definition: SparseVector.h:277
void swap(SparseMatrix< Scalar, OtherOptions, StorageIndex > &other)
Definition: SparseVector.h:284
Scalar & insertBack(Index i)
Definition: SparseVector.h:142
EIGEN_STRONG_INLINE Index rows() const
Definition: SparseVector.h:76
Index prune(F &&keep_predicate)
Prunes the entries of the vector based on a predicate
Definition: SparseVector.h:203
Scalar coeff(Index row, Index col) const
Definition: SparseVector.h:97
EIGEN_STRONG_INLINE Scalar * valuePtr()
Definition: SparseVector.h:82
SparseVector & operator=(const SparseMatrixBase< OtherDerived > &other)
Definition: SparseVector.h:309
EIGEN_DEPRECATED void startFill(Index reserve)
Definition: SparseVector.h:357
EIGEN_DEPRECATED Scalar & fillrand(Index i)
Definition: SparseVector.h:381
EIGEN_STRONG_INLINE Index cols() const
Definition: SparseVector.h:77
void setZero()
Definition: SparseVector.h:127
EIGEN_STRONG_INLINE Index outerSize() const
Definition: SparseVector.h:79
void reserve(Index reserveSize)
Definition: SparseVector.h:186
Scalar & insertBackUnordered(Index i)
Definition: SparseVector.h:152
Index nonZeros() const
Definition: SparseVector.h:130
SparseVector(Index size)
Definition: SparseVector.h:259
SparseCompressedBase< SparseVector > Base
Definition: SparseVector.h:63
EIGEN_DEPRECATED Scalar & fill(Index r, Index c)
Definition: SparseVector.h:363
Base::InnerIterator InnerIterator
Definition: SparseVector.h:124
SparseVector(const SparseMatrixBase< OtherDerived > &other)
Definition: SparseVector.h:264
StorageIndex * outerIndexPtr()
Definition: SparseVector.h:88
SparseVector(const SparseVector &other)
Definition: SparseVector.h:271
SparseVector & operator=(const SparseVector &other)
Definition: SparseVector.h:298
EIGEN_DEPRECATED void endFill()
Definition: SparseVector.h:384
EIGEN_DEPRECATED const Storage & _data() const
Definition: SparseVector.h:390
void resize(Index newSize)
Definition: SparseVector.h:234
Scalar coeff(Index i) const
Definition: SparseVector.h:101
EIGEN_DEPRECATED Storage & _data()
Definition: SparseVector.h:388
EIGEN_STATIC_ASSERT((Options_ &(ColMajor|RowMajor))==Options, INVALID_MATRIX_TEMPLATE_PARAMETERS) Storage m_data
Scalar sum() const
Definition: SparseRedux.h:40
SparseVector & operator=(const SparseSparseProduct< Lhs, Rhs > &product)
Definition: SparseVector.h:336
static constexpr lastp1_t end
Definition: IndexedViewHelper.h:79
@ ColMajor
Definition: Constants.h:318
@ RowMajor
Definition: Constants.h:320
const unsigned int LvalueBit
Definition: Constants.h:148
const unsigned int RowMajorBit
Definition: Constants.h:70
const unsigned int CompressedAccessBit
Definition: Constants.h:195
RealScalar s
Definition: level1_cplx_impl.h:130
EIGEN_BLAS_FUNC() swap(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy)
Definition: level1_impl.h:117
const Scalar * a
Definition: level2_cplx_impl.h:32
int * m
Definition: level2_cplx_impl.h:294
if(UPLO(*uplo)==INVALID) info
Definition: level3_impl.h:428
char char char int int * k
Definition: level2_impl.h:374
Eigen::Matrix< Scalar, Dynamic, Dynamic, ColMajor > tmp
Definition: level3_impl.h:365
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
@ SVA_Inner
Definition: SparseVector.h:51
@ SVA_Outer
Definition: SparseVector.h:51
@ SVA_RuntimeSwitch
Definition: SparseVector.h:51
std::uint8_t uint8_t
Definition: Meta.h:36
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:70
squared absolute value
Definition: GlobalFunctions.h:87
const unsigned int NestByRefBit
Definition: Constants.h:173
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:83
const int InnerRandomAccessPattern
Definition: SparseUtil.h:42
const int Dynamic
Definition: Constants.h:25
Extend namespace for flags.
Definition: fsi_chan_precond_driver.cc:56
r
Definition: UniformPSDSelfTest.py:20
int c
Definition: calibrate.py:100
val
Definition: calibrate.py:119
Definition: Eigen_Colamd.h:49
@ F
Definition: octree.h:74
double epsilon
Definition: osc_ring_sarah_asymptotics.h:43
void product(const MatrixType &m)
Definition: product.h:42
#define EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN
Definition: sparse_permutations.cpp:22
Eigen::Index Index
The interface type of indices.
Definition: EigenBase.h:43
Definition: Constants.h:534
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition: NumTraits.h:217
Definition: Constants.h:522
evaluator(const SparseVectorType &mat)
Definition: SparseVector.h:417
SparseVectorType::InnerIterator InnerIterator
Definition: SparseVector.h:410
const SparseVectorType * m_matrix
Definition: SparseVector.h:424
evaluator_base< SparseVectorType > Base
Definition: SparseVector.h:409
SparseVector< Scalar_, Options_, Index_ > SparseVectorType
Definition: SparseVector.h:408
Index nonZerosEstimate() const
Definition: SparseVector.h:419
SparseVectorType::ReverseInnerIterator ReverseInnerIterator
Definition: SparseVector.h:411
Definition: CoreEvaluators.h:118
Definition: CoreEvaluators.h:104
static void run(Dest &dst, const Src &src)
Definition: SparseVector.h:429
static void run(Dest &dst, const Src &src)
Definition: SparseVector.h:439
static void run(Dest &dst, const Src &src)
Definition: SparseVector.h:452
Definition: ForwardDeclarations.h:21
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