17template<
typename _PlainObjectType,
int _Options,
typename _Str
ideType>
18struct traits<
Ref<_PlainObjectType, _Options, _StrideType> >
19 :
public traits<Map<_PlainObjectType, _Options, _StrideType> >
29 template<
typename Derived>
struct match {
31 IsVectorAtCompileTime = PlainObjectType::IsVectorAtCompileTime || Derived::IsVectorAtCompileTime,
34 InnerStrideMatch =
int(StrideType::InnerStrideAtCompileTime)==int(
Dynamic)
35 || int(StrideType::InnerStrideAtCompileTime)==int(Derived::InnerStrideAtCompileTime)
36 || (int(StrideType::InnerStrideAtCompileTime)==0 && int(Derived::InnerStrideAtCompileTime)==1),
37 OuterStrideMatch = IsVectorAtCompileTime
38 ||
int(StrideType::OuterStrideAtCompileTime)==int(
Dynamic) || int(StrideType::OuterStrideAtCompileTime)==int(Derived::OuterStrideAtCompileTime),
47 MatchAtCompileTime = HasDirectAccess && StorageOrderMatch && InnerStrideMatch && OuterStrideMatch && AlignmentMatch && ScalarTypeMatch
54template<
typename Derived>
72 return StrideType::InnerStrideAtCompileTime != 0 ?
m_stride.
inner() : 1;
77 return StrideType::OuterStrideAtCompileTime != 0 ?
m_stride.
outer()
78 : IsVectorAtCompileTime ? this->
size()
84 :
Base(0,RowsAtCompileTime==
Dynamic?0:RowsAtCompileTime,ColsAtCompileTime==
Dynamic?0:ColsAtCompileTime),
86 m_stride(StrideType::OuterStrideAtCompileTime==
Dynamic?0:StrideType::OuterStrideAtCompileTime,
87 StrideType::InnerStrideAtCompileTime==
Dynamic?0:StrideType::InnerStrideAtCompileTime)
98 return inner == 0 ? 1 : inner;
103 return outer == 0 ? isVectorAtCompileTime ? inner * rows * cols : isRowMajor ? inner * cols : inner * rows : outer;
108 template<
typename Expression>
116 || ( PlainObjectType::IsVectorAtCompileTime
119 ||
int(PlainObjectType::RowsAtCompileTime)==
int(Expression::ColsAtCompileTime))
122 ||
int(PlainObjectType::ColsAtCompileTime)==
int(Expression::RowsAtCompileTime)))),
123 YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES
127 Index rows = expr.rows();
128 Index cols = expr.cols();
129 if(PlainObjectType::RowsAtCompileTime==1)
135 else if(PlainObjectType::ColsAtCompileTime==1)
143 (PlainObjectType::RowsAtCompileTime ==
Dynamic) || (PlainObjectType::RowsAtCompileTime == rows));
145 (PlainObjectType::ColsAtCompileTime ==
Dynamic) || (PlainObjectType::ColsAtCompileTime == cols));
149 const bool transpose = PlainObjectType::IsVectorAtCompileTime && (rows != expr.rows());
151 const bool row_major = ((PlainObjectType::Flags)&
RowMajorBit) != 0;
152 const bool expr_row_major = (Expression::Flags&
RowMajorBit) != 0;
153 const bool storage_differs = (row_major != expr_row_major);
155 const bool swap_stride = (transpose != storage_differs);
163 Expression::IsVectorAtCompileTime != 0,
168 const bool row_vector = (rows == 1);
169 const bool col_vector = (cols == 1);
170 const Index inner_stride =
171 ( (!row_major && row_vector) || (row_major && col_vector) ) ?
172 ( StrideType::InnerStrideAtCompileTime > 0 ?
Index(StrideType::InnerStrideAtCompileTime) : 1)
173 : swap_stride ? expr_outer_actual : expr_inner_actual;
177 const Index outer_stride =
178 ( (!row_major && col_vector) || (row_major && row_vector) ) ?
179 ( StrideType::OuterStrideAtCompileTime > 0 ?
Index(StrideType::OuterStrideAtCompileTime) : rows * cols * inner_stride)
180 : swap_stride ? expr_inner_actual : expr_outer_actual;
183 const bool inner_valid = (StrideType::InnerStrideAtCompileTime ==
Dynamic)
189 const bool outer_valid = (StrideType::OuterStrideAtCompileTime ==
Dynamic)
192 Index(StrideType::OuterStrideAtCompileTime),
193 rows, cols, PlainObjectType::IsVectorAtCompileTime != 0,
200 ::new (
static_cast<Base*
>(
this))
Base(expr.data(), rows, cols);
202 (StrideType::OuterStrideAtCompileTime == 0) ? 0 : outer_stride,
203 (StrideType::InnerStrideAtCompileTime == 0) ? 0 : inner_stride );
281template<
typename PlainObjectType,
int Options,
typename Str
ideType>
class Ref
282 :
public RefBase<Ref<PlainObjectType, Options, StrideType> >
286 template<
typename Derived>
295 #ifndef EIGEN_PARSED_BY_DOXYGEN
296 template<
typename Derived>
300 EIGEN_STATIC_ASSERT(
bool(Traits::template match<Derived>::MatchAtCompileTime), STORAGE_LAYOUT_DOES_NOT_MATCH);
306 template<
typename Derived>
311 template<
typename Derived>
316 EIGEN_STATIC_ASSERT(
bool(Traits::template match<Derived>::MatchAtCompileTime), STORAGE_LAYOUT_DOES_NOT_MATCH);
317 EIGEN_STATIC_ASSERT(!Derived::IsPlainObjectBase,THIS_EXPRESSION_IS_NOT_A_LVALUE__IT_IS_READ_ONLY);
329template<
typename TPlainObjectType,
int Options,
typename Str
ideType>
class Ref<const TPlainObjectType, Options, StrideType>
330 :
public RefBase<Ref<const TPlainObjectType, Options, StrideType> >
338 template<
typename Derived>
352 template<
typename OtherRef>
359 template<
typename Expression>
368 template<
typename Expression>
#define EIGEN_CONSTEXPR
Definition: Macros.h:797
#define EIGEN_UNUSED_VARIABLE(var)
Definition: Macros.h:1086
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:986
#define EIGEN_DENSE_PUBLIC_INTERFACE(Derived)
Definition: Macros.h:1293
#define eigen_assert(x)
Definition: Macros.h:1047
#define EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Derived)
Definition: Macros.h:1241
#define EIGEN_PREDICATE_SAME_MATRIX_SIZE(TYPE0, TYPE1)
Definition: StaticAssert.h:174
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
Definition: StaticAssert.h:127
Base class for all dense matrices, vectors, and arrays.
Definition: DenseBase.h:47
Definition: ForwardDeclarations.h:112
Definition: PlainObjectBase.h:100
EIGEN_DEVICE_FUNC Ref(const RefBase< OtherRef > &other)
Definition: Ref.h:353
EIGEN_DEVICE_FUNC Ref(const DenseBase< Derived > &expr, typename internal::enable_if< bool(Traits::template match< Derived >::ScalarTypeMatch), Derived >::type *=0)
Definition: Ref.h:339
TPlainObjectType m_object
Definition: Ref.h:376
RefBase< Ref > Base
Definition: Ref.h:335
EIGEN_DEVICE_FUNC void construct(const Expression &expr, internal::false_type)
Definition: Ref.h:369
EIGEN_DEVICE_FUNC void construct(const Expression &expr, internal::true_type)
Definition: Ref.h:360
EIGEN_DEVICE_FUNC Ref(const Ref &other)
Definition: Ref.h:348
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index innerStride() const
Definition: Ref.h:70
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index outerStride() const
Definition: Ref.h:75
static EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index resolveInnerStride(Index inner)
Definition: Ref.h:97
static EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index resolveOuterStride(Index inner, Index outer, Index rows, Index cols, bool isVectorAtCompileTime, bool isRowMajor)
Definition: Ref.h:102
EIGEN_DEVICE_FUNC bool construct(Expression &expr)
Definition: Ref.h:109
Stride< StrideType::OuterStrideAtCompileTime, StrideType::InnerStrideAtCompileTime > StrideBase
Definition: Ref.h:94
EIGEN_DEVICE_FUNC RefBase()
Definition: Ref.h:83
StrideBase m_stride
Definition: Ref.h:207
MapBase< Derived > Base
Definition: Ref.h:67
A matrix or vector expression mapping an existing expression.
Definition: Ref.h:283
RefBase< Ref > Base
Definition: Ref.h:291
EIGEN_DEVICE_FUNC Ref(const DenseBase< Derived > &expr, typename internal::enable_if< bool(Traits::template match< Derived >::MatchAtCompileTime), Derived >::type *=0)
Definition: Ref.h:307
EIGEN_DEVICE_FUNC Ref(PlainObjectBase< Derived > &expr, typename internal::enable_if< bool(Traits::template match< Derived >::MatchAtCompileTime), Derived >::type *=0)
Definition: Ref.h:297
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index inner() const
Definition: Stride.h:85
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index outer() const
Definition: Stride.h:82
type
Definition: core.h:575
@ Unaligned
Data pointer has no specific alignment.
Definition: Constants.h:233
const unsigned int RowMajorBit
for a matrix, this means that the storage order is row-major.
Definition: Constants.h:66
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void call_assignment_no_alias(Dst &dst, const Src &src, const Func &func)
Definition: AssignEvaluator.h:873
EIGEN_CONSTEXPR Index size(const T &x)
Definition: Meta.h:479
Namespace containing all symbols from the Eigen library.
Definition: Core:141
const unsigned int NestByRefBit
Definition: Constants.h:169
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:74
const int Dynamic
This value means that a positive quantity (e.g., a size) is not known at compile-time,...
Definition: Constants.h:22
Definition: Eigen_Colamd.h:50
Definition: AssignmentFunctors.h:21
Definition: CoreEvaluators.h:91
Definition: ForwardDeclarations.h:26
Definition: XprHelper.h:660
internal::conditional< MatchAtCompileTime, internal::true_type, internal::false_type >::type type
Definition: Ref.h:49
_PlainObjectType PlainObjectType
Definition: Ref.h:21
_StrideType StrideType
Definition: Ref.h:22
Definition: ForwardDeclarations.h:17