17 template<
typename _PlainObjectType,
int _Options,
typename _Str
ideType>
18 struct traits<
Ref<_PlainObjectType, _Options, _StrideType> >
19 :
public traits<Map<_PlainObjectType, _Options, _StrideType> >
29 template<
typename Derived>
struct match {
32 StorageOrderMatch = PlainObjectType::IsVectorAtCompileTime || Derived::IsVectorAtCompileTime || ((PlainObjectType::Flags&
RowMajorBit)==(Derived::Flags&
RowMajorBit)),
33 InnerStrideMatch =
int(StrideType::InnerStrideAtCompileTime)==
int(
Dynamic)
34 ||
int(StrideType::InnerStrideAtCompileTime)==
int(Derived::InnerStrideAtCompileTime)
35 || (
int(StrideType::InnerStrideAtCompileTime)==0 &&
int(Derived::InnerStrideAtCompileTime)==1),
36 OuterStrideMatch = Derived::IsVectorAtCompileTime
37 ||
int(StrideType::OuterStrideAtCompileTime)==
int(
Dynamic) ||
int(StrideType::OuterStrideAtCompileTime)==
int(Derived::OuterStrideAtCompileTime),
46 MatchAtCompileTime = HasDirectAccess && StorageOrderMatch && InnerStrideMatch && OuterStrideMatch && AlignmentMatch && ScalarTypeMatch
53 template<
typename Derived>
69 EIGEN_DEVICE_FUNC inline
Index innerStride()
const 71 return StrideType::InnerStrideAtCompileTime != 0 ? m_stride.inner() : 1;
76 return StrideType::OuterStrideAtCompileTime != 0 ? m_stride.outer()
77 : IsVectorAtCompileTime ? this->
size()
78 :
int(Flags)&RowMajorBit ? this->
cols()
83 : Base(0,RowsAtCompileTime==
Dynamic?0:RowsAtCompileTime,ColsAtCompileTime==
Dynamic?0:ColsAtCompileTime),
85 m_stride(StrideType::OuterStrideAtCompileTime==
Dynamic?0:StrideType::OuterStrideAtCompileTime,
86 StrideType::InnerStrideAtCompileTime==
Dynamic?0:StrideType::InnerStrideAtCompileTime)
95 template<
typename Expression>
100 if(PlainObjectType::RowsAtCompileTime==1)
103 ::new (static_cast<Base*>(
this)) Base(expr.data(), 1, expr.size());
105 else if(PlainObjectType::ColsAtCompileTime==1)
108 ::new (static_cast<Base*>(
this)) Base(expr.data(), expr.size(), 1);
111 ::new (static_cast<Base*>(
this)) Base(expr.data(), expr.rows(), expr.cols());
113 if(Expression::IsVectorAtCompileTime && (!PlainObjectType::IsVectorAtCompileTime) && ((Expression::Flags&
RowMajorBit)!=(PlainObjectType::Flags&RowMajorBit)))
114 ::new (&m_stride) StrideBase(expr.innerStride(), StrideType::InnerStrideAtCompileTime==0?0:1);
116 ::new (&m_stride) StrideBase(StrideType::OuterStrideAtCompileTime==0?0:expr.outerStride(),
117 StrideType::InnerStrideAtCompileTime==0?0:expr.innerStride());
192 template<
typename PlainObjectType,
int Options,
typename Str
ideType>
class Ref 193 :
public RefBase<Ref<PlainObjectType, Options, StrideType> >
197 template<
typename Derived>
206 #ifndef EIGEN_PARSED_BY_DOXYGEN 207 template<
typename Derived>
211 EIGEN_STATIC_ASSERT(
bool(Traits::template match<Derived>::MatchAtCompileTime), STORAGE_LAYOUT_DOES_NOT_MATCH);
214 template<
typename Derived>
219 template<
typename Derived>
224 EIGEN_STATIC_ASSERT(
bool(Traits::template match<Derived>::MatchAtCompileTime), STORAGE_LAYOUT_DOES_NOT_MATCH);
225 EIGEN_STATIC_ASSERT(!Derived::IsPlainObjectBase,THIS_EXPRESSION_IS_NOT_A_LVALUE__IT_IS_READ_ONLY);
234 template<
typename TPlainObjectType,
int Options,
typename Str
ideType>
class Ref<const TPlainObjectType, Options, StrideType>
235 :
public RefBase<Ref<const TPlainObjectType, Options, StrideType> >
243 template<typename Derived>
245 typename
internal::enable_if<
bool(Traits::template match<Derived>::ScalarTypeMatch),Derived>::
type* = 0)
253 EIGEN_DEVICE_FUNC
inline Ref(
const Ref& other) : Base(other) {
257 template<
typename OtherRef>
264 template<
typename Expression>
270 template<
typename Expression>
283 #endif // EIGEN_REF_H EIGEN_DEVICE_FUNC Index outerStride() const
EIGEN_DEVICE_FUNC Ref(const DenseBase< Derived > &expr, typename internal::enable_if< bool(Traits::template match< Derived >::MatchAtCompileTime), Derived >::type *=0)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void call_assignment_no_alias(Dst &dst, const Src &src, const Func &func)
Stride< StrideType::OuterStrideAtCompileTime, StrideType::InnerStrideAtCompileTime > StrideBase
EIGEN_DEVICE_FUNC RefBase()
internal::traits< Ref > Traits
internal::traits< Ref > Traits
internal::traits< Derived >::PlainObjectType PlainObjectType
Namespace containing all symbols from the Eigen library.
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
EIGEN_DEVICE_FUNC Ref(const RefBase< OtherRef > &other)
const unsigned int RowMajorBit
Base class for all dense matrices, vectors, and arrays.
EIGEN_DEVICE_FUNC void construct(Expression &expr)
internal::conditional< MatchAtCompileTime, internal::true_type, internal::false_type >::type type
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
EIGEN_DEVICE_FUNC Ref(const Ref &other)
TPlainObjectType m_object
#define EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Derived)
A matrix or vector expression mapping an existing expression.
const unsigned int NestByRefBit
EIGEN_DEVICE_FUNC Ref(PlainObjectBase< Derived > &expr, typename internal::enable_if< bool(Traits::template match< Derived >::MatchAtCompileTime), Derived >::type *=0)
#define EIGEN_DENSE_PUBLIC_INTERFACE(Derived)
EIGEN_DEVICE_FUNC void construct(const Expression &expr, internal::true_type)
_PlainObjectType PlainObjectType
EIGEN_DEVICE_FUNC void construct(const Expression &expr, internal::false_type)
internal::traits< Derived >::StrideType StrideType
#define EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(TYPE0, TYPE1)