10#ifndef EIGEN_SPARSE_REF_H
11#define EIGEN_SPARSE_REF_H
21template<
typename Derived>
class SparseRefBase;
23template<
typename MatScalar,
int MatOptions,
typename MatIndex,
int _Options,
typename _Str
ideType>
25 :
public traits<SparseMatrix<MatScalar,MatOptions,MatIndex> >
33 template<
typename Derived>
struct match {
35 StorageOrderMatch = PlainObjectType::IsVectorAtCompileTime || Derived::IsVectorAtCompileTime || ((PlainObjectType::Flags&
RowMajorBit)==(Derived::Flags&RowMajorBit)),
36 MatchAtCompileTime = (Derived::Flags&CompressedAccessBit) && StorageOrderMatch
43template<
typename MatScalar,
int MatOptions,
typename MatIndex,
int _Options,
typename _Str
ideType>
45 :
public traits<Ref<SparseMatrix<MatScalar,MatOptions,MatIndex>, _Options, _StrideType> >
52template<
typename MatScalar,
int MatOptions,
typename MatIndex,
int _Options,
typename _Str
ideType>
54 :
public traits<SparseVector<MatScalar,MatOptions,MatIndex> >
62 template<
typename Derived>
struct match {
71template<
typename MatScalar,
int MatOptions,
typename MatIndex,
int _Options,
typename _Str
ideType>
73 :
public traits<Ref<SparseVector<MatScalar,MatOptions,MatIndex>, _Options, _StrideType> >
80template<
typename Derived>
92 :
Base(RowsAtCompileTime==
Dynamic?0:RowsAtCompileTime,ColsAtCompileTime==
Dynamic?0:ColsAtCompileTime, 0, 0, 0, 0, 0)
97 template<
typename Expression>
100 if(expr.outerIndexPtr()==0)
101 ::new (
static_cast<Base*
>(
this))
Base(expr.size(), expr.nonZeros(), expr.innerIndexPtr(), expr.valuePtr());
103 ::new (
static_cast<Base*
>(
this))
Base(expr.rows(), expr.cols(), expr.nonZeros(), expr.outerIndexPtr(), expr.innerIndexPtr(), expr.valuePtr(), expr.innerNonZeroPtr());
121#ifndef EIGEN_PARSED_BY_DOXYGEN
122template<
typename MatScalar,
int MatOptions,
typename MatIndex,
int Options,
typename Str
ideType>
126template<typename SparseMatrixType, int Options>
127class
Ref<SparseMatrixType, Options>
133 template<
int OtherOptions>
135 template<
int OtherOptions>
143 #ifndef EIGEN_PARSED_BY_DOXYGEN
144 template<
int OtherOptions>
152 template<
int OtherOptions>
160 template<
typename Derived>
164 template<
typename Derived>
169 EIGEN_STATIC_ASSERT(
bool(Traits::template match<Derived>::MatchAtCompileTime), STORAGE_LAYOUT_DOES_NOT_MATCH);
176template<
typename MatScalar,
int MatOptions,
typename MatIndex,
int Options,
typename Str
ideType>
187 template<
typename Derived>
190 construct(expr.
derived(),
typename Traits::template match<Derived>::type());
193 inline Ref(
const Ref& other) :
Base(other), m_hasCopy(false) {
197 template<
typename OtherRef>
199 construct(other.derived(),
typename Traits::template match<OtherRef>::type());
205 obj->~TPlainObjectType();
211 template<
typename Expression>
227 template<
typename Expression>
252#ifndef EIGEN_PARSED_BY_DOXYGEN
253template<
typename MatScalar,
int MatOptions,
typename MatIndex,
int Options,
typename Str
ideType>
257template<typename SparseVectorType>
258class
Ref<SparseVectorType>
264 template<
int OtherOptions>
271 #ifndef EIGEN_PARSED_BY_DOXYGEN
272 template<
int OtherOptions>
279 template<
typename Derived>
283 template<
typename Derived>
288 EIGEN_STATIC_ASSERT(
bool(Traits::template match<Derived>::MatchAtCompileTime), STORAGE_LAYOUT_DOES_NOT_MATCH);
294template<
typename MatScalar,
int MatOptions,
typename MatIndex,
int Options,
typename Str
ideType>
305 template<
typename Derived>
308 construct(expr.
derived(),
typename Traits::template match<Derived>::type());
311 inline Ref(
const Ref& other) :
Base(other), m_hasCopy(false) {
315 template<
typename OtherRef>
317 construct(other.derived(),
typename Traits::template match<OtherRef>::type());
323 obj->~TPlainObjectType();
329 template<
typename Expression>
335 template<
typename Expression>
353template<
typename MatScalar,
int MatOptions,
typename MatIndex,
int Options,
typename Str
ideType>
355 :
evaluator<SparseCompressedBase<Ref<SparseMatrix<MatScalar,MatOptions,MatIndex>, Options, StrideType> > >
363template<
typename MatScalar,
int MatOptions,
typename MatIndex,
int Options,
typename Str
ideType>
365 :
evaluator<SparseCompressedBase<Ref<const SparseMatrix<MatScalar,MatOptions,MatIndex>, Options, StrideType> > >
373template<
typename MatScalar,
int MatOptions,
typename MatIndex,
int Options,
typename Str
ideType>
375 :
evaluator<SparseCompressedBase<Ref<SparseVector<MatScalar,MatOptions,MatIndex>, Options, StrideType> > >
383template<
typename MatScalar,
int MatOptions,
typename MatIndex,
int Options,
typename Str
ideType>
385 :
evaluator<SparseCompressedBase<Ref<const SparseVector<MatScalar,MatOptions,MatIndex>, Options, StrideType> > >
#define eigen_assert(x)
Definition Macros.h:1037
#define EIGEN_SPARSE_PUBLIC_INTERFACE(Derived)
Definition SparseUtil.h:43
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
Definition StaticAssert.h:127
MatrixXf mat
Definition Tutorial_AdvancedInitialization_CommaTemporary.cpp:1
Sparse matrix.
Definition MappedSparseMatrix.h:34
EIGEN_DEVICE_FUNC bool construct(Expression &expr)
Definition Ref.h:109
A sparse matrix expression referencing an existing sparse expression.
Definition SparseRef.h:130
Ref(const SparseCompressedBase< Derived > &expr)
Definition SparseRef.h:161
Ref(SparseMatrix< MatScalar, OtherOptions, MatIndex > &expr)
Definition SparseRef.h:145
internal::SparseRefBase< Ref > Base
Definition SparseRef.h:139
Ref(MappedSparseMatrix< MatScalar, OtherOptions, MatIndex > &expr)
Definition SparseRef.h:153
A sparse vector expression referencing an existing sparse vector expression.
Definition SparseRef.h:261
internal::SparseRefBase< Ref > Base
Definition SparseRef.h:268
Ref(const SparseCompressedBase< Derived > &expr)
Definition SparseRef.h:280
Ref(SparseVector< MatScalar, OtherOptions, MatIndex > &expr)
Definition SparseRef.h:273
Definition SparseRef.h:179
Ref(const SparseMatrixBase< Derived > &expr)
Definition SparseRef.h:188
void construct(const Expression &expr, internal::true_type)
Definition SparseRef.h:212
Ref(const Ref &other)
Definition SparseRef.h:193
~Ref()
Definition SparseRef.h:202
internal::aligned_storage< sizeof(TPlainObjectType), EIGEN_ALIGNOF(TPlainObjectType)>::type m_storage
Definition SparseRef.h:237
internal::SparseRefBase< Ref > Base
Definition SparseRef.h:184
bool m_hasCopy
Definition SparseRef.h:238
Ref(const RefBase< OtherRef > &other)
Definition SparseRef.h:198
void construct(const Expression &expr, internal::false_type)
Definition SparseRef.h:228
Definition SparseRef.h:297
bool m_hasCopy
Definition SparseRef.h:346
~Ref()
Definition SparseRef.h:320
internal::SparseRefBase< Ref > Base
Definition SparseRef.h:302
Ref(const SparseMatrixBase< Derived > &expr)
Definition SparseRef.h:306
internal::aligned_storage< sizeof(TPlainObjectType), EIGEN_ALIGNOF(TPlainObjectType)>::type m_storage
Definition SparseRef.h:345
Ref(const Ref &other)
Definition SparseRef.h:311
Ref(const RefBase< OtherRef > &other)
Definition SparseRef.h:316
void construct(const Expression &expr, internal::false_type)
Definition SparseRef.h:336
void construct(const Expression &expr, internal::true_type)
Definition SparseRef.h:330
A matrix or vector expression mapping an existing expression.
Definition Ref.h:283
Common base class for sparse [compressed]-{row|column}-storage format.
Definition SparseCompressedBase.h:38
bool isCompressed() const
Definition SparseCompressedBase.h:107
Definition SparseMap.h:43
Base class of any sparse matrices or sparse expressions.
Definition SparseMatrixBase.h:28
const Derived & derived() const
Definition SparseMatrixBase.h:143
Derived & const_cast_derived() const
Definition SparseMatrixBase.h:145
A versatible sparse matrix representation.
Definition SparseMatrix.h:98
bool isCompressed() const
Definition SparseCompressedBase.h:107
a sparse vector class
Definition SparseVector.h:66
Definition SparseRef.h:85
SparseMapBase< Derived > Base
Definition SparseRef.h:88
void construct(Expression &expr)
Definition SparseRef.h:98
Definition TensorRef.h:81
const unsigned int LvalueBit
Definition Constants.h:144
const unsigned int RowMajorBit
Definition Constants.h:66
const unsigned int CompressedAccessBit
Definition Constants.h:191
bool match(const T &xpr, std::string ref, std::string str_xpr="")
Definition indexed_view.cpp:54
Namespace containing all symbols from the Eigen library.
Definition bench_norm.cpp:85
const unsigned int NestByRefBit
Definition Constants.h:169
const int Dynamic
Definition Constants.h:22
@ StandardCompressedFormat
Definition SparseRef.h:16
Definition BandTriangularSolver.h:13
evaluator(const XprType &mat)
Definition SparseRef.h:360
evaluator()
Definition SparseRef.h:359
evaluator< SparseCompressedBase< Ref< SparseMatrix< MatScalar, MatOptions, MatIndex >, Options, StrideType > > > Base
Definition SparseRef.h:357
Ref< SparseMatrix< MatScalar, MatOptions, MatIndex >, Options, StrideType > XprType
Definition SparseRef.h:358
Ref< SparseVector< MatScalar, MatOptions, MatIndex >, Options, StrideType > XprType
Definition SparseRef.h:378
evaluator< SparseCompressedBase< Ref< SparseVector< MatScalar, MatOptions, MatIndex >, Options, StrideType > > > Base
Definition SparseRef.h:377
evaluator(const XprType &mat)
Definition SparseRef.h:380
evaluator()
Definition SparseRef.h:379
Ref< const SparseMatrix< MatScalar, MatOptions, MatIndex >, Options, StrideType > XprType
Definition SparseRef.h:368
evaluator(const XprType &mat)
Definition SparseRef.h:370
evaluator()
Definition SparseRef.h:369
evaluator< SparseCompressedBase< Ref< const SparseMatrix< MatScalar, MatOptions, MatIndex >, Options, StrideType > > > Base
Definition SparseRef.h:367
evaluator< SparseCompressedBase< Ref< const SparseVector< MatScalar, MatOptions, MatIndex >, Options, StrideType > > > Base
Definition SparseRef.h:387
evaluator(const XprType &mat)
Definition SparseRef.h:390
Ref< const SparseVector< MatScalar, MatOptions, MatIndex >, Options, StrideType > XprType
Definition SparseRef.h:388
evaluator()
Definition SparseRef.h:389
Definition CoreEvaluators.h:91
Definition XprHelper.h:660
SparseMatrix< MatScalar, MatOptions, MatIndex > PlainObjectType
Definition SparseRef.h:27
internal::conditional< MatchAtCompileTime, internal::true_type, internal::false_type >::type type
Definition SparseRef.h:38
SparseVector< MatScalar, MatOptions, MatIndex > PlainObjectType
Definition SparseRef.h:56
internal::conditional< MatchAtCompileTime, internal::true_type, internal::false_type >::type type
Definition SparseRef.h:66
Definition ForwardDeclarations.h:17