11#ifndef EIGEN_MAPBASE_H
12#define EIGEN_MAPBASE_H
14#define EIGEN_STATIC_ASSERT_INDEX_BASED_ACCESS(Derived) \
15 EIGEN_STATIC_ASSERT((int(internal::evaluator<Derived>::Flags) & LinearAccessBit) || Derived::IsVectorAtCompileTime, \
16 YOU_ARE_TRYING_TO_USE_AN_INDEX_BASED_ACCESSOR_ON_AN_EXPRESSION_THAT_DOES_NOT_SUPPORT_THAT)
47 SizeAtCompileTime = Base::SizeAtCompileTime
64 using Base::MaxRowsAtCompileTime;
65 using Base::MaxColsAtCompileTime;
66 using Base::MaxSizeAtCompileTime;
67 using Base::IsVectorAtCompileTime;
69 using Base::IsRowMajor;
76 using Base::lazyAssign;
79 using Base::innerStride;
80 using Base::outerStride;
81 using Base::rowStride;
82 using Base::colStride;
85 using Base::operator=;
108 return m_data[colId * colStride() + rowId * rowStride()];
116 return m_data[
index * innerStride()];
123 return this->m_data[colId * colStride() + rowId * rowStride()];
131 return this->m_data[
index * innerStride()];
135 template<
int LoadMode>
138 return internal::ploadt<PacketScalar, LoadMode>
139 (m_data + (colId * colStride() + rowId * rowStride()));
143 template<
int LoadMode>
147 return internal::ploadt<PacketScalar, LoadMode>(m_data +
index * innerStride());
152 explicit inline MapBase(
PointerType dataPtr) : m_data(dataPtr), m_rows(RowsAtCompileTime), m_cols(ColsAtCompileTime)
155 checkSanity<Derived>();
162 m_rows(RowsAtCompileTime ==
Dynamic ? vecSize :
Index(RowsAtCompileTime)),
163 m_cols(ColsAtCompileTime ==
Dynamic ? vecSize :
Index(ColsAtCompileTime))
167 eigen_assert(dataPtr == 0 || SizeAtCompileTime ==
Dynamic || SizeAtCompileTime == vecSize);
168 checkSanity<Derived>();
174 : m_data(dataPtr), m_rows(rows), m_cols(cols)
177 || ( rows >= 0 && (RowsAtCompileTime ==
Dynamic || RowsAtCompileTime == rows)
178 && cols >= 0 && (ColsAtCompileTime ==
Dynamic || ColsAtCompileTime == cols)));
179 checkSanity<Derived>();
182 #ifdef EIGEN_MAPBASE_PLUGIN
183 #include EIGEN_MAPBASE_PLUGIN
194#if EIGEN_MAX_ALIGN_BYTES>0
196 const Index minInnerStride = InnerStrideAtCompileTime ==
Dynamic ? 1 :
Index(InnerStrideAtCompileTime);
224 :
public MapBase<Derived, ReadOnlyAccessors>
241 using Base::coeffRef;
243 using Base::innerStride;
244 using Base::outerStride;
245 using Base::rowStride;
246 using Base::colStride;
262 return this->m_data[
col * colStride() +
row * rowStride()];
269 return this->m_data[
index * innerStride()];
272 template<
int StoreMode>
275 internal::pstoret<Scalar, PacketScalar, StoreMode>
276 (this->m_data + (
col * colStride() +
row * rowStride()), val);
279 template<
int StoreMode>
283 internal::pstoret<Scalar, PacketScalar, StoreMode>
284 (this->m_data +
index * innerStride(), val);
294 ReadOnlyMapBase::Base::operator=(other);
300 using ReadOnlyMapBase::Base::operator=;
306#undef EIGEN_STATIC_ASSERT_INDEX_BASED_ACCESS
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ColXpr col(Index i)
This is the const version of col().
Definition: BlockMethods.h:1097
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE RowXpr row(Index i)
This is the const version of row(). */.
Definition: BlockMethods.h:1118
#define EIGEN_DEFAULT_COPY_CONSTRUCTOR(CLASS)
Definition: Macros.h:1231
#define EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(Derived)
Definition: Macros.h:1257
#define EIGEN_NOEXCEPT
Definition: Macros.h:1428
#define EIGEN_CONSTEXPR
Definition: Macros.h:797
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:986
#define EIGEN_ONLY_USED_FOR_DEBUG(x)
Definition: Macros.h:1059
#define eigen_assert(x)
Definition: Macros.h:1047
#define EIGEN_STATIC_ASSERT_INDEX_BASED_ACCESS(Derived)
Definition: MapBase.h:14
#define EIGEN_STATIC_ASSERT_FIXED_SIZE(TYPE)
Definition: StaticAssert.h:147
#define EIGEN_STATIC_ASSERT_VECTOR_ONLY(TYPE)
Definition: StaticAssert.h:142
Base class for dense Map and Block expression with direct access.
Definition: MapBase.h:39
EIGEN_DEVICE_FUNC const Scalar & coeff(Index rowId, Index colId) const
This is an overloaded version of DenseCoeffsBase<Derived,ReadOnlyAccessors>::coeff(Index,...
Definition: MapBase.h:106
PacketScalar packet(Index rowId, Index colId) const
Definition: MapBase.h:136
internal::dense_xpr_base< Derived >::type Base
Definition: MapBase.h:42
internal::packet_traits< Scalar >::type PacketScalar
Definition: MapBase.h:52
Base::CoeffReturnType CoeffReturnType
Definition: MapBase.h:87
EIGEN_DEVICE_FUNC MapBase(PointerType dataPtr, Index vecSize)
Definition: MapBase.h:160
EIGEN_DEVICE_FUNC void checkSanity(typename internal::enable_if<(internal::traits< T >::Alignment >0), void * >::type=0) const
Definition: MapBase.h:192
internal::conditional< bool(internal::is_lvalue< Derived >::value), Scalar *, constScalar * >::type PointerType
Definition: MapBase.h:58
PacketScalar packet(Index index) const
Definition: MapBase.h:144
const internal::variable_if_dynamic< Index, ColsAtCompileTime > m_cols
Definition: MapBase.h:210
EIGEN_DEVICE_FUNC const Scalar & coeffRef(Index index) const
This is the const version of coeffRef(Index) which is thus synonym of coeff(Index).
Definition: MapBase.h:128
PointerType m_data
Definition: MapBase.h:208
internal::traits< Derived >::Scalar Scalar
Definition: MapBase.h:51
const internal::variable_if_dynamic< Index, RowsAtCompileTime > m_rows
Definition: MapBase.h:209
EIGEN_DEVICE_FUNC MapBase(PointerType dataPtr)
Definition: MapBase.h:152
NumTraits< Scalar >::Real RealScalar
Definition: MapBase.h:53
EIGEN_DEVICE_FUNC const Scalar & coeff(Index index) const
This is an overloaded version of DenseCoeffsBase<Derived,ReadOnlyAccessors>::coeff(Index) const provi...
Definition: MapBase.h:113
EIGEN_DEVICE_FUNC const Scalar * data() const
Returns a pointer to the first coefficient of the matrix or vector.
Definition: MapBase.h:102
EIGEN_DEVICE_FUNC void checkSanity(typename internal::enable_if< internal::traits< T >::Alignment==0, void * >::type=0) const
Definition: MapBase.h:205
internal::traits< Derived >::StorageKind StorageKind
Definition: MapBase.h:50
EIGEN_DEVICE_FUNC MapBase(PointerType dataPtr, Index rows, Index cols)
Definition: MapBase.h:173
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
Definition: MapBase.h:91
EIGEN_DEVICE_FUNC const Scalar & coeffRef(Index rowId, Index colId) const
This is the const version of coeffRef(Index,Index) which is thus synonym of coeff(Index,...
Definition: MapBase.h:121
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
Definition: MapBase.h:94
EIGEN_DEVICE_FUNC ScalarWithConstIfNotLvalue & coeffRef(Index row, Index col)
Definition: MapBase.h:260
Base::PacketScalar PacketScalar
Definition: MapBase.h:232
EIGEN_DEVICE_FUNC ScalarWithConstIfNotLvalue & coeffRef(Index index)
Definition: MapBase.h:266
EIGEN_DEVICE_FUNC MapBase(PointerType dataPtr)
Definition: MapBase.h:287
MapBase< Derived, ReadOnlyAccessors > Base
Definition: MapBase.h:229
Base::StorageIndex StorageIndex
Definition: MapBase.h:233
EIGEN_DEVICE_FUNC MapBase(PointerType dataPtr, Index vecSize)
Definition: MapBase.h:288
void writePacket(Index row, Index col, const PacketScalar &val)
Definition: MapBase.h:273
EIGEN_DEVICE_FUNC Derived & operator=(const MapBase &other)
Definition: MapBase.h:292
Base::PointerType PointerType
Definition: MapBase.h:234
void writePacket(Index index, const PacketScalar &val)
Definition: MapBase.h:280
EIGEN_DEVICE_FUNC MapBase(PointerType dataPtr, Index rows, Index cols)
Definition: MapBase.h:289
internal::conditional< internal::is_lvalue< Derived >::value, Scalar, constScalar >::type ScalarWithConstIfNotLvalue
Definition: MapBase.h:252
Base::Scalar Scalar
Definition: MapBase.h:231
EIGEN_DEVICE_FUNC ScalarWithConstIfNotLvalue * data()
Definition: MapBase.h:257
EIGEN_DEVICE_FUNC const Scalar * data() const
Definition: MapBase.h:255
Definition: ForwardDeclarations.h:112
type
Definition: core.h:575
@ ReadOnlyAccessors
Read-only access via a member function.
Definition: Constants.h:376
@ WriteAccessors
Read/write access via member functions.
Definition: Constants.h:378
std::size_t UIntPtr
Definition: Meta.h:92
EIGEN_CONSTEXPR Index size(const T &x)
Definition: Meta.h:479
Namespace containing all symbols from the Eigen library.
Definition: Core:141
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
Holds information about the various numeric (i.e.
Definition: NumTraits.h:233
Definition: XprHelper.h:484
Definition: XprHelper.h:660
T type
Definition: GenericPacketMath.h:108
Definition: ForwardDeclarations.h:17