10 #ifndef EIGEN_SPARSE_REF_H 11 #define EIGEN_SPARSE_REF_H 23 template<
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)),
43 template<
typename MatScalar,
int MatOptions,
typename MatIndex,
int _Options,
typename _Str
ideType>
45 :
public traits<Ref<SparseMatrix<MatScalar,MatOptions,MatIndex>, _Options, _StrideType> >
52 template<
typename MatScalar,
int MatOptions,
typename MatIndex,
int _Options,
typename _Str
ideType>
54 :
public traits<SparseVector<MatScalar,MatOptions,MatIndex> >
62 template<
typename Derived>
struct match {
71 template<
typename MatScalar,
int MatOptions,
typename MatIndex,
int _Options,
typename _Str
ideType>
73 :
public traits<Ref<SparseVector<MatScalar,MatOptions,MatIndex>, _Options, _StrideType> >
80 template<
typename Derived>
92 : Base(RowsAtCompileTime==
Dynamic?0:RowsAtCompileTime,ColsAtCompileTime==
Dynamic?0:ColsAtCompileTime, 0, 0, 0, 0, 0)
97 template<
typename Expression>
98 void construct(Expression& expr)
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 122 template<
typename MatScalar,
int MatOptions,
typename MatIndex,
int Options,
typename Str
ideType>
126 template<typename SparseMatrixType, int Options>
127 class
Ref<SparseMatrixType, Options>
133 template<
int OtherOptions>
135 template<
int OtherOptions>
140 EIGEN_SPARSE_PUBLIC_INTERFACE(Ref)
143 #ifndef EIGEN_PARSED_BY_DOXYGEN 144 template<
int OtherOptions>
149 Base::construct(expr.derived());
152 template<
int OtherOptions>
157 Base::construct(expr.derived());
160 template<
typename Derived>
164 template<
typename Derived>
169 EIGEN_STATIC_ASSERT(
bool(Traits::template match<Derived>::MatchAtCompileTime), STORAGE_LAYOUT_DOES_NOT_MATCH);
171 Base::construct(expr.const_cast_derived());
176 template<
typename MatScalar,
int MatOptions,
typename MatIndex,
int Options,
typename Str
ideType>
185 EIGEN_SPARSE_PUBLIC_INTERFACE(
Ref)
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());
204 TPlainObjectType* obj =
reinterpret_cast<TPlainObjectType*
>(m_object_bytes);
205 obj->~TPlainObjectType();
211 template<
typename Expression>
216 TPlainObjectType* obj =
reinterpret_cast<TPlainObjectType*
>(m_object_bytes);
217 ::new (obj) TPlainObjectType(expr);
219 Base::construct(*obj);
223 Base::construct(expr);
227 template<
typename Expression>
230 TPlainObjectType* obj =
reinterpret_cast<TPlainObjectType*
>(m_object_bytes);
231 ::new (obj) TPlainObjectType(expr);
233 Base::construct(*obj);
237 char m_object_bytes[
sizeof(TPlainObjectType)];
252 #ifndef EIGEN_PARSED_BY_DOXYGEN 253 template<
typename MatScalar,
int MatOptions,
typename MatIndex,
int Options,
typename Str
ideType>
257 template<typename SparseVectorType>
258 class
Ref<SparseVectorType>
264 template<
int OtherOptions>
269 EIGEN_SPARSE_PUBLIC_INTERFACE(Ref)
271 #ifndef EIGEN_PARSED_BY_DOXYGEN 272 template<
int OtherOptions>
276 Base::construct(expr.derived());
279 template<
typename Derived>
283 template<
typename Derived>
288 EIGEN_STATIC_ASSERT(
bool(Traits::template match<Derived>::MatchAtCompileTime), STORAGE_LAYOUT_DOES_NOT_MATCH);
289 Base::construct(expr.const_cast_derived());
294 template<
typename MatScalar,
int MatOptions,
typename MatIndex,
int Options,
typename Str
ideType>
303 EIGEN_SPARSE_PUBLIC_INTERFACE(
Ref)
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());
322 TPlainObjectType* obj =
reinterpret_cast<TPlainObjectType*
>(m_object_bytes);
323 obj->~TPlainObjectType();
329 template<
typename Expression>
332 Base::construct(expr);
335 template<
typename Expression>
338 TPlainObjectType* obj =
reinterpret_cast<TPlainObjectType*
>(m_object_bytes);
339 ::new (obj) TPlainObjectType(expr);
341 Base::construct(*obj);
345 char m_object_bytes[
sizeof(TPlainObjectType)];
353 template<
typename MatScalar,
int MatOptions,
typename MatIndex,
int Options,
typename Str
ideType>
355 :
evaluator<SparseCompressedBase<Ref<SparseMatrix<MatScalar,MatOptions,MatIndex>, Options, StrideType> > >
360 explicit evaluator(
const XprType &mat) : Base(mat) {}
363 template<
typename MatScalar,
int MatOptions,
typename MatIndex,
int Options,
typename Str
ideType>
365 :
evaluator<SparseCompressedBase<Ref<const SparseMatrix<MatScalar,MatOptions,MatIndex>, Options, StrideType> > >
370 explicit evaluator(
const XprType &mat) : Base(mat) {}
373 template<
typename MatScalar,
int MatOptions,
typename MatIndex,
int Options,
typename Str
ideType>
375 :
evaluator<SparseCompressedBase<Ref<SparseVector<MatScalar,MatOptions,MatIndex>, Options, StrideType> > >
380 explicit evaluator(
const XprType &mat) : Base(mat) {}
383 template<
typename MatScalar,
int MatOptions,
typename MatIndex,
int Options,
typename Str
ideType>
385 :
evaluator<SparseCompressedBase<Ref<const SparseVector<MatScalar,MatOptions,MatIndex>, Options, StrideType> > >
390 explicit evaluator(
const XprType &mat) : Base(mat) {}
397 #endif // EIGEN_SPARSE_REF_H A sparse matrix expression referencing an existing sparse expression.
Definition: SparseRef.h:123
bool isCompressed() const
Definition: SparseCompressedBase.h:107
const unsigned int CompressedAccessBit
Means that the underlying coefficients can be accessed through pointers to the sparse (un)compressed ...
Definition: Constants.h:186
A versatible sparse matrix representation.
Definition: SparseMatrix.h:92
const unsigned int LvalueBit
Means the expression has a coeffRef() method, i.e.
Definition: Constants.h:139
Definition: CoreEvaluators.h:90
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:85
const unsigned int RowMajorBit
for a matrix, this means that the storage order is row-major.
Definition: Constants.h:61
Base class of any sparse matrices or sparse expressions.
Definition: ForwardDeclarations.h:281
used by Ref<SparseMatrix> to specify whether the input storage must be in standard compressed form ...
Definition: SparseRef.h:16
A sparse vector expression referencing an existing sparse vector expression.
Definition: SparseRef.h:254
a sparse vector class
Definition: SparseUtil.h:54
A matrix or vector expression mapping an existing expression.
Definition: Ref.h:190
Definition: BandTriangularSolver.h:13
Definition: SparseRef.h:295
Definition: SparseRef.h:21
const int Dynamic
This value means that a positive quantity (e.g., a size) is not known at compile-time, and that instead the value is stored in some runtime variable.
Definition: Constants.h:21
Generic expression where a coefficient-wise unary operator is applied to an expression.
Definition: CwiseUnaryOp.h:55
Definition: SparseMap.h:43
Common base class for sparse [compressed]-{row|column}-storage format.
Definition: SparseCompressedBase.h:15
Sparse matrix.
Definition: MappedSparseMatrix.h:32
Definition: ForwardDeclarations.h:17
Definition: XprHelper.h:630
Definition: SparseRef.h:177