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);
199 || (
cols() *
rows() * minInnerStride *
sizeof(Scalar)) < internal::traits<Derived>::Alignment ) &&
"data is not aligned");
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;
255 inline const Scalar*
data()
const {
return this->m_data; }
257 inline ScalarWithConstIfNotLvalue*
data() {
return this->m_data; }
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 310 #endif // EIGEN_MAPBASE_H Base::CoeffReturnType CoeffReturnType
const internal::variable_if_dynamic< Index, ColsAtCompileTime > m_cols
internal::packet_traits< Scalar >::type PacketScalar
Base::PacketScalar PacketScalar
EIGEN_DEVICE_FUNC const Scalar & coeff(Index index) const
EIGEN_DEVICE_FUNC const Scalar & coeff(Index rowId, Index colId) const
void writePacket(Index index, const PacketScalar &val)
Namespace containing all symbols from the Eigen library.
EIGEN_DEVICE_FUNC MapBase(PointerType dataPtr, Index vecSize)
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
Base::PointerType PointerType
#define EIGEN_DEFAULT_COPY_CONSTRUCTOR(CLASS)
internal::dense_xpr_base< Derived >::type Base
EIGEN_DEVICE_FUNC ScalarWithConstIfNotLvalue & coeffRef(Index index)
EIGEN_DEVICE_FUNC const Scalar & coeffRef(Index index) const
void writePacket(Index row, Index col, const PacketScalar &val)
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
Base class for dense Map and Block expression with direct access.
internal::conditional< bool(internal::is_lvalue< Derived >::value), Scalar *, const Scalar * >::type PointerType
PacketScalar packet(Index rowId, Index colId) const
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
EIGEN_DEVICE_FUNC Derived & operator=(const MapBase &other)
EIGEN_DEVICE_FUNC MapBase(PointerType dataPtr, Index vecSize)
#define EIGEN_STATIC_ASSERT_FIXED_SIZE(TYPE)
MapBase< Derived, ReadOnlyAccessors > ReadOnlyMapBase
#define EIGEN_STATIC_ASSERT_INDEX_BASED_ACCESS(Derived)
EIGEN_DEVICE_FUNC void checkSanity(typename internal::enable_if< internal::traits< T >::Alignment==0, void *>::type=0) const
EIGEN_DEVICE_FUNC MapBase(PointerType dataPtr)
EIGEN_DEVICE_FUNC const Scalar * data() const
EIGEN_DEVICE_FUNC ScalarWithConstIfNotLvalue * data()
MapBase< Derived, ReadOnlyAccessors > Base
EIGEN_DEVICE_FUNC MapBase(PointerType dataPtr, Index rows, Index cols)
internal::traits< Derived >::StorageKind StorageKind
#define EIGEN_DEVICE_FUNC
EIGEN_DEVICE_FUNC const Scalar * data() const
const internal::variable_if_dynamic< Index, RowsAtCompileTime > m_rows
EIGEN_DEVICE_FUNC ScalarWithConstIfNotLvalue & coeffRef(Index row, Index col)
#define EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(Derived)
PacketScalar packet(Index index) const
EIGEN_DEVICE_FUNC MapBase(PointerType dataPtr)
Base::StorageIndex StorageIndex
EIGEN_DEVICE_FUNC void checkSanity(typename internal::enable_if<(internal::traits< T >::Alignment >0), void *>::type=0) const
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
internal::nested_eval< T, 1 >::type eval(const T &xpr)
EIGEN_DEVICE_FUNC MapBase(PointerType dataPtr, Index rows, Index cols)
Generic expression where a coefficient-wise unary operator is applied to an expression.
internal::traits< Derived >::Scalar Scalar
#define EIGEN_STATIC_ASSERT_VECTOR_ONLY(TYPE)
NumTraits< Scalar >::Real RealScalar
EIGEN_DEVICE_FUNC const Scalar & coeffRef(Index rowId, Index colId) const
internal::conditional< internal::is_lvalue< Derived >::value, Scalar, const Scalar >::type ScalarWithConstIfNotLvalue
#define EIGEN_ONLY_USED_FOR_DEBUG(x)