68 template<
typename PlainObjectType,
int MapOptions,
typename Str
ideType>
69 struct traits<Map<PlainObjectType, MapOptions, StrideType> >
70 :
public traits<PlainObjectType>
72 typedef traits<PlainObjectType> TraitsBase;
73 typedef typename PlainObjectType::Index Index;
74 typedef typename PlainObjectType::Scalar Scalar;
76 InnerStrideAtCompileTime = StrideType::InnerStrideAtCompileTime == 0
77 ? int(PlainObjectType::InnerStrideAtCompileTime)
78 : int(StrideType::InnerStrideAtCompileTime),
79 OuterStrideAtCompileTime = StrideType::OuterStrideAtCompileTime == 0
80 ? int(PlainObjectType::OuterStrideAtCompileTime)
81 : int(StrideType::OuterStrideAtCompileTime),
82 HasNoInnerStride = InnerStrideAtCompileTime == 1,
83 HasNoOuterStride = StrideType::OuterStrideAtCompileTime == 0,
84 HasNoStride = HasNoInnerStride && HasNoOuterStride,
85 IsAligned = bool(EIGEN_ALIGN) && ((int(MapOptions)&
Aligned)==
Aligned),
86 IsDynamicSize = PlainObjectType::SizeAtCompileTime==
Dynamic,
87 KeepsPacketAccess = bool(HasNoInnerStride)
88 && ( bool(IsDynamicSize)
90 || ( OuterStrideAtCompileTime!=
Dynamic
91 && ((static_cast<int>(sizeof(Scalar))*OuterStrideAtCompileTime)%16)==0 ) ),
92 Flags0 = TraitsBase::Flags & (~NestByRefBit),
94 Flags2 = (bool(HasNoStride) || bool(PlainObjectType::IsVectorAtCompileTime))
96 Flags3 = is_lvalue<PlainObjectType>::value ? int(Flags2) : (int(Flags2) & ~
LvalueBit),
97 Flags = KeepsPacketAccess ? int(Flags3) : (int(Flags3) & ~
PacketAccessBit)
104 template<
typename PlainObjectType,
int MapOptions,
typename Str
ideType>
class Map
105 :
public MapBase<Map<PlainObjectType, MapOptions, StrideType> >
110 EIGEN_DENSE_PUBLIC_INTERFACE(
Map)
112 typedef typename Base::PointerType PointerType;
113 #if EIGEN2_SUPPORT_STAGE <= STAGE30_FULL_EIGEN3_API
114 typedef const Scalar* PointerArgType;
115 inline PointerType cast_to_pointer_type(PointerArgType ptr) {
return const_cast<PointerType
>(ptr); }
117 typedef PointerType PointerArgType;
118 inline PointerType cast_to_pointer_type(PointerArgType ptr) {
return ptr; }
121 inline Index innerStride()
const
123 return StrideType::InnerStrideAtCompileTime != 0 ? m_stride.inner() : 1;
126 inline Index outerStride()
const
128 return StrideType::OuterStrideAtCompileTime != 0 ? m_stride.outer()
129 : IsVectorAtCompileTime ? this->size()
139 inline Map(PointerArgType dataPtr,
const StrideType& a_stride = StrideType())
140 :
Base(cast_to_pointer_type(dataPtr)), m_stride(a_stride)
142 PlainObjectType::Base::_check_template_params();
151 inline Map(PointerArgType dataPtr, Index a_size,
const StrideType& a_stride = StrideType())
152 :
Base(cast_to_pointer_type(dataPtr), a_size), m_stride(a_stride)
154 PlainObjectType::Base::_check_template_params();
164 inline Map(PointerArgType dataPtr, Index nbRows, Index nbCols,
const StrideType& a_stride = StrideType())
165 :
Base(cast_to_pointer_type(dataPtr), nbRows, nbCols), m_stride(a_stride)
167 PlainObjectType::Base::_check_template_params();
170 EIGEN_INHERIT_ASSIGNMENT_OPERATORS(
Map)
176 template<typename _Scalar,
int _Rows,
int _Cols,
int _Options,
int _MaxRows,
int _MaxCols>
177 inline
Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>
178 ::
Array(const Scalar *data)
183 template<
typename _Scalar,
int _Rows,
int _Cols,
int _Options,
int _MaxRows,
int _MaxCols>
192 #endif // EIGEN_MAP_H
Base class for Map and Block expression with direct access.
Definition: ForwardDeclarations.h:109
A matrix or vector expression mapping an existing array of data.
Definition: Map.h:104
Matrix()
Default constructor.
Definition: Matrix.h:203
const int Dynamic
Definition: Constants.h:21
Map(PointerArgType dataPtr, Index nbRows, Index nbCols, const StrideType &a_stride=StrideType())
Definition: Map.h:164
const unsigned int PacketAccessBit
Definition: Constants.h:81
Definition: Constants.h:194
const unsigned int LinearAccessBit
Definition: Constants.h:117
const unsigned int LvalueBit
Definition: Constants.h:131
Map(PointerArgType dataPtr, Index a_size, const StrideType &a_stride=StrideType())
Definition: Map.h:151
Map(PointerArgType dataPtr, const StrideType &a_stride=StrideType())
Definition: Map.h:139
General-purpose arrays with easy API for coefficient-wise operations.
Definition: Array.h:42
const unsigned int RowMajorBit
Definition: Constants.h:53
const unsigned int AlignedBit
Definition: Constants.h:147