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>
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>
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);
176 template<
typename MatScalar,
int MatOptions,
typename MatIndex,
int Options,
typename Str
ideType>
187 template<typename Derived>
193 inline Ref(
const Ref& other) : Base(other), m_hasCopy(false) {
197 template<
typename OtherRef>
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);
227 template<
typename Expression>
230 TPlainObjectType* obj =
reinterpret_cast<TPlainObjectType*
>(m_object_bytes);
231 ::new (obj) TPlainObjectType(expr);
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>
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);
294 template<
typename MatScalar,
int MatOptions,
typename MatIndex,
int Options,
typename Str
ideType>
305 template<typename Derived>
311 inline Ref(
const Ref& other) : Base(other), m_hasCopy(false) {
315 template<
typename OtherRef>
322 TPlainObjectType* obj =
reinterpret_cast<TPlainObjectType*
>(m_object_bytes);
323 obj->~TPlainObjectType();
329 template<
typename Expression>
335 template<
typename Expression>
338 TPlainObjectType* obj =
reinterpret_cast<TPlainObjectType*
>(m_object_bytes);
339 ::new (obj) TPlainObjectType(expr);
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> > >
363 template<
typename MatScalar,
int MatOptions,
typename MatIndex,
int Options,
typename Str
ideType>
365 :
evaluator<SparseCompressedBase<Ref<const SparseMatrix<MatScalar,MatOptions,MatIndex>, Options, StrideType> > >
373 template<
typename MatScalar,
int MatOptions,
typename MatIndex,
int Options,
typename Str
ideType>
375 :
evaluator<SparseCompressedBase<Ref<SparseVector<MatScalar,MatOptions,MatIndex>, Options, StrideType> > >
383 template<
typename MatScalar,
int MatOptions,
typename MatIndex,
int Options,
typename Str
ideType>
385 :
evaluator<SparseCompressedBase<Ref<const SparseVector<MatScalar,MatOptions,MatIndex>, Options, StrideType> > >
397 #endif // EIGEN_SPARSE_REF_H
evaluator(const XprType &mat)
Ref< SparseMatrix< MatScalar, MatOptions, MatIndex >, Options, StrideType > XprType
const unsigned int CompressedAccessBit
SparseMatrix< MatScalar, MatOptions, MatIndex > PlainObjectType
A versatible sparse matrix representation.
internal::traits< Ref > Traits
internal::SparseRefBase< Ref > Base
SparseVector< MatScalar, MatOptions, MatIndex > PlainObjectType
const unsigned int LvalueBit
evaluator(const XprType &mat)
SparseVector< MatScalar, MatOptions, MatIndex > TPlainObjectType
Ref(SparseMatrix< MatScalar, OtherOptions, MatIndex > &expr)
Namespace containing all symbols from the Eigen library.
SparseMapBase< Derived > Base
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
internal::SparseRefBase< Ref > Base
void construct(const Expression &expr, internal::false_type)
evaluator< SparseCompressedBase< Ref< SparseVector< MatScalar, MatOptions, MatIndex >, Options, StrideType > > > Base
internal::SparseRefBase< Ref > Base
const unsigned int RowMajorBit
internal::conditional< MatchAtCompileTime, internal::true_type, internal::false_type >::type type
Ref(SparseVector< MatScalar, OtherOptions, MatIndex > &expr)
void construct(Expression &expr)
Ref(const RefBase< OtherRef > &other)
#define EIGEN_SPARSE_PUBLIC_INTERFACE(Derived)
Base class of any sparse matrices or sparse expressions.
internal::traits< Ref > Traits
Ref< const SparseVector< MatScalar, MatOptions, MatIndex >, Options, StrideType > XprType
evaluator< SparseCompressedBase< Ref< const SparseVector< MatScalar, MatOptions, MatIndex >, Options, StrideType > > > Base
Ref< const SparseMatrix< MatScalar, MatOptions, MatIndex >, Options, StrideType > XprType
Ref(MappedSparseMatrix< MatScalar, OtherOptions, MatIndex > &expr)
SparseMatrix< MatScalar, MatOptions, MatIndex > TPlainObjectType
SparseMatrix< MatScalar, MatOptions, MatIndex > PlainObjectType
Ref(const SparseCompressedBase< Derived > &expr)
Ref(const RefBase< OtherRef > &other)
evaluator< SparseCompressedBase< Ref< SparseMatrix< MatScalar, MatOptions, MatIndex >, Options, StrideType > > > Base
A matrix or vector expression mapping an existing expression.
bool isCompressed() const
const unsigned int NestByRefBit
internal::traits< Ref > Traits
Ref< SparseVector< MatScalar, MatOptions, MatIndex >, Options, StrideType > XprType
evaluator(const XprType &mat)
evaluator(const XprType &mat)
internal::traits< Ref > Traits
const SparseMatrix< _Scalar, _Options, _StorageIndex > & derived() const
void construct(const Expression &expr, internal::false_type)
evaluator< SparseCompressedBase< Ref< const SparseMatrix< MatScalar, MatOptions, MatIndex >, Options, StrideType > > > Base
void construct(const Expression &expr, internal::true_type)
internal::conditional< MatchAtCompileTime, internal::true_type, internal::false_type >::type type
Common base class for sparse [compressed]-{row|column}-storage format.
Ref(const SparseCompressedBase< Derived > &expr)
internal::SparseRefBase< Ref > Base
void construct(const Expression &expr, internal::true_type)
SparseVector< MatScalar, MatOptions, MatIndex > PlainObjectType
Derived & const_cast_derived() const