15#include "./InternalHeaderCheck.h"
20template <
typename PlainObjectType,
int MapOptions,
typename Str
ideType>
21struct traits<Map<PlainObjectType, MapOptions, StrideType> > :
public traits<PlainObjectType> {
22 typedef traits<PlainObjectType> TraitsBase;
24 PlainObjectTypeInnerSize = ((traits<PlainObjectType>::Flags &
RowMajorBit) == RowMajorBit)
25 ? PlainObjectType::ColsAtCompileTime
26 : PlainObjectType::RowsAtCompileTime,
28 InnerStrideAtCompileTime = StrideType::InnerStrideAtCompileTime == 0
29 ? int(PlainObjectType::InnerStrideAtCompileTime)
30 : int(StrideType::InnerStrideAtCompileTime),
31 OuterStrideAtCompileTime = StrideType::OuterStrideAtCompileTime == 0
32 ? (InnerStrideAtCompileTime ==
Dynamic || PlainObjectTypeInnerSize ==
Dynamic
34 : int(InnerStrideAtCompileTime) * int(PlainObjectTypeInnerSize))
35 : int(StrideType::OuterStrideAtCompileTime),
36 Alignment = int(MapOptions) & int(AlignedMask),
37 Flags0 = TraitsBase::Flags & (~NestByRefBit),
38 Flags = is_lvalue<PlainObjectType>::value ? int(Flags0) : (int(Flags0) & ~
LvalueBit)
95template <
typename PlainObjectType,
int MapOptions,
typename Str
ideType>
96class Map :
public MapBase<Map<PlainObjectType, MapOptions, StrideType> > {
98 typedef MapBase<Map> Base;
99 EIGEN_DENSE_PUBLIC_INTERFACE(
Map)
101 typedef typename Base::PointerType PointerType;
102 typedef PointerType PointerArgType;
103 EIGEN_DEVICE_FUNC
inline PointerType cast_to_pointer_type(PointerArgType ptr) {
return ptr; }
105 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
inline Index innerStride()
const {
106 return StrideType::InnerStrideAtCompileTime != 0 ? m_stride.inner() : 1;
109 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
inline Index outerStride()
const {
110 return StrideType::OuterStrideAtCompileTime != 0 ? m_stride.outer()
111 : internal::traits<Map>::OuterStrideAtCompileTime !=
Dynamic
112 ?
Index(internal::traits<Map>::OuterStrideAtCompileTime)
113 : IsVectorAtCompileTime ? (this->size() * innerStride())
114 : int(Flags) &
RowMajorBit ? (this->cols() * innerStride())
115 : (this->rows() * innerStride());
123 EIGEN_DEVICE_FUNC
explicit inline Map(PointerArgType dataPtr,
const StrideType& stride = StrideType())
124 : Base(cast_to_pointer_type(dataPtr)), m_stride(stride) {}
132 EIGEN_DEVICE_FUNC
inline Map(PointerArgType dataPtr,
Index size,
const StrideType& stride = StrideType())
133 : Base(cast_to_pointer_type(dataPtr), size), m_stride(stride) {}
142 EIGEN_DEVICE_FUNC
inline Map(PointerArgType dataPtr,
Index rows,
Index cols,
const StrideType& stride = StrideType())
143 : Base(cast_to_pointer_type(dataPtr), rows, cols), m_stride(stride) {}
145 EIGEN_INHERIT_ASSIGNMENT_OPERATORS(
Map)
A matrix or vector expression mapping an existing array of data.
Definition Map.h:96
Map(PointerArgType dataPtr, Index rows, Index cols, const StrideType &stride=StrideType())
Definition Map.h:142
Map(PointerArgType dataPtr, const StrideType &stride=StrideType())
Definition Map.h:123
Map(PointerArgType dataPtr, Index size, const StrideType &stride=StrideType())
Definition Map.h:132
const unsigned int LvalueBit
Definition Constants.h:148
const unsigned int RowMajorBit
Definition Constants.h:70
Namespace containing all symbols from the Eigen library.
Definition Core:137
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition Meta.h:83
const int Dynamic
Definition Constants.h:25