16#include "./InternalHeaderCheck.h"
21template <
typename PlainObjectType,
int MapOptions,
typename Str
ideType>
22struct traits<Map<PlainObjectType, MapOptions, StrideType> > :
public traits<PlainObjectType> {
23 using TraitsBase = traits<PlainObjectType>;
26 ? PlainObjectType::ColsAtCompileTime
27 : PlainObjectType::RowsAtCompileTime,
29 InnerStrideAtCompileTime = StrideType::InnerStrideAtCompileTime == 0
30 ? int(PlainObjectType::InnerStrideAtCompileTime)
31 : int(StrideType::InnerStrideAtCompileTime),
32 OuterStrideAtCompileTime = StrideType::OuterStrideAtCompileTime == 0
33 ? (InnerStrideAtCompileTime == Dynamic || PlainObjectTypeInnerSize == Dynamic
35 : int(InnerStrideAtCompileTime) * int(PlainObjectTypeInnerSize))
36 : int(StrideType::OuterStrideAtCompileTime),
37 Alignment = int(MapOptions) & int(AlignedMask),
38 Flags0 = TraitsBase::Flags & (~NestByRefBit),
39 Flags = is_lvalue<PlainObjectType>::value ? int(Flags0) : (int(Flags0) & ~
LvalueBit)
96template <
typename PlainObjectType,
int MapOptions,
typename Str
ideType>
97class Map :
public MapBase<Map<PlainObjectType, MapOptions, StrideType> > {
99 using Base = MapBase<Map>;
100 EIGEN_DENSE_PUBLIC_INTERFACE(
Map)
102 using PointerType =
typename Base::PointerType;
103 using PointerArgType = PointerType;
104 EIGEN_DEVICE_FUNC
constexpr inline PointerType cast_to_pointer_type(PointerArgType ptr)
const {
return ptr; }
106 EIGEN_DEVICE_FUNC
constexpr Index innerStride()
const {
107 return StrideType::InnerStrideAtCompileTime != 0 ? m_stride.inner() : 1;
110 EIGEN_DEVICE_FUNC
constexpr Index outerStride()
const {
111 return StrideType::OuterStrideAtCompileTime != 0 ? m_stride.outer()
112 : internal::traits<Map>::OuterStrideAtCompileTime != Dynamic
113 ? Index(internal::traits<Map>::OuterStrideAtCompileTime)
114 : IsVectorAtCompileTime ? (this->size() * innerStride())
115 : int(Flags) &
RowMajorBit ? (this->cols() * innerStride())
116 : (this->rows() * innerStride());
124 EIGEN_DEVICE_FUNC
constexpr explicit inline Map(PointerArgType dataPtr,
const StrideType& stride = StrideType())
125 : Base(cast_to_pointer_type(dataPtr)), m_stride(stride) {}
133 EIGEN_DEVICE_FUNC
constexpr inline Map(PointerArgType dataPtr, Index size,
const StrideType& stride = StrideType())
134 : Base(cast_to_pointer_type(dataPtr), size), m_stride(stride) {}
143 EIGEN_DEVICE_FUNC
constexpr inline Map(PointerArgType dataPtr, Index rows, Index cols,
144 const StrideType& stride = StrideType())
145 : Base(cast_to_pointer_type(dataPtr), rows, cols), m_stride(stride) {}
147 EIGEN_INHERIT_ASSIGNMENT_OPERATORS(
Map)
A matrix or vector expression mapping an existing array of data.
Definition Map.h:97
constexpr Map(PointerArgType dataPtr, Index rows, Index cols, const StrideType &stride=StrideType())
Definition Map.h:143
constexpr Map(PointerArgType dataPtr, const StrideType &stride=StrideType())
Definition Map.h:124
constexpr Map(PointerArgType dataPtr, Index size, const StrideType &stride=StrideType())
Definition Map.h:133
constexpr unsigned int LvalueBit
Definition Constants.h:149
constexpr unsigned int RowMajorBit
Definition Constants.h:71