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::traits<Derived>::Flags) & LinearAccessBit) || Derived::IsVectorAtCompileTime, \ 16 YOU_ARE_TRYING_TO_USE_AN_INDEX_BASED_ACCESSOR_ON_AN_EXPRESSION_THAT_DOES_NOT_SUPPORT_THAT) 36 SizeAtCompileTime = Base::SizeAtCompileTime
54 using Base::MaxRowsAtCompileTime;
55 using Base::MaxColsAtCompileTime;
56 using Base::MaxSizeAtCompileTime;
57 using Base::IsVectorAtCompileTime;
59 using Base::IsRowMajor;
66 using Base::lazyAssign;
69 using Base::innerStride;
70 using Base::outerStride;
71 using Base::rowStride;
72 using Base::colStride;
75 using Base::operator=;
79 inline Index
rows()
const {
return m_rows.value(); }
80 inline Index
cols()
const {
return m_cols.value(); }
88 inline const Scalar*
data()
const {
return m_data; }
90 inline const Scalar&
coeff(Index rowId, Index colId)
const 92 return m_data[colId * colStride() + rowId * rowStride()];
95 inline const Scalar&
coeff(Index index)
const 98 return m_data[index * innerStride()];
101 inline const Scalar&
coeffRef(Index rowId, Index colId)
const 103 return this->m_data[colId * colStride() + rowId * rowStride()];
109 return this->m_data[index * innerStride()];
112 template<
int LoadMode>
113 inline PacketScalar
packet(Index rowId, Index colId)
const 115 return internal::ploadt<PacketScalar, LoadMode>
116 (m_data + (colId * colStride() + rowId * rowStride()));
119 template<
int LoadMode>
120 inline PacketScalar
packet(Index index)
const 123 return internal::ploadt<PacketScalar, LoadMode>(m_data + index * innerStride());
126 inline MapBase(
PointerType dataPtr) : m_data(dataPtr), m_rows(RowsAtCompileTime), m_cols(ColsAtCompileTime)
134 m_rows(RowsAtCompileTime ==
Dynamic ? vecSize : Index(RowsAtCompileTime)),
135 m_cols(ColsAtCompileTime ==
Dynamic ? vecSize : Index(ColsAtCompileTime))
139 eigen_assert(dataPtr == 0 || SizeAtCompileTime ==
Dynamic || SizeAtCompileTime == vecSize);
144 : m_data(dataPtr), m_rows(nbRows), m_cols(nbCols)
147 || ( nbRows >= 0 && (RowsAtCompileTime ==
Dynamic || RowsAtCompileTime == nbRows)
148 && nbCols >= 0 && (ColsAtCompileTime ==
Dynamic || ColsAtCompileTime == nbCols)));
158 PACKET_ACCESS_REQUIRES_TO_HAVE_INNER_STRIDE_FIXED_TO_1);
160 &&
"data is not aligned");
169 :
public MapBase<Derived, ReadOnlyAccessors>
185 using Base::coeffRef;
187 using Base::innerStride;
188 using Base::outerStride;
189 using Base::rowStride;
190 using Base::colStride;
198 inline const Scalar*
data()
const {
return this->m_data; }
199 inline ScalarWithConstIfNotLvalue*
data() {
return this->m_data; }
203 return this->m_data[col * colStride() + row * rowStride()];
206 inline ScalarWithConstIfNotLvalue&
coeffRef(Index index)
209 return this->m_data[index * innerStride()];
212 template<
int StoreMode>
215 internal::pstoret<Scalar, PacketScalar, StoreMode>
216 (this->m_data + (col * colStride() + row * rowStride()), val);
219 template<
int StoreMode>
223 internal::pstoret<Scalar, PacketScalar, StoreMode>
224 (this->m_data + index * innerStride(), val);
227 explicit inline MapBase(PointerType dataPtr) : Base(dataPtr) {}
228 inline MapBase(PointerType dataPtr, Index vecSize) : Base(dataPtr, vecSize) {}
229 inline MapBase(PointerType dataPtr, Index nbRows, Index nbCols) : Base(dataPtr, nbRows, nbCols) {}
233 Base::Base::operator=(other);
237 using Base::Base::operator=;
242 #endif // EIGEN_MAPBASE_H MapBase(PointerType dataPtr, Index nbRows, Index nbCols)
Base::CoeffReturnType CoeffReturnType
const internal::variable_if_dynamic< Index, ColsAtCompileTime > m_cols
internal::packet_traits< Scalar >::type PacketScalar
MapBase(PointerType dataPtr)
Base class for Map and Block expression with direct access.
const Scalar * data() const
ScalarWithConstIfNotLvalue & coeffRef(Index index)
Base::PacketScalar PacketScalar
MapBase(PointerType dataPtr, Index vecSize)
void writePacket(Index index, const PacketScalar &val)
iterative scaling algorithm to equilibrate rows and column norms in matrices
PacketScalar packet(Index rowId, Index colId) const
MapBase(PointerType dataPtr, Index vecSize)
internal::traits< Derived >::Index Index
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
const Scalar & coeff(Index index) const
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
Base::PointerType PointerType
internal::dense_xpr_base< Derived >::type Base
const Scalar * data() const
const unsigned int PacketAccessBit
const Scalar & coeffRef(Index rowId, Index colId) const
const unsigned int AlignedBit
void writePacket(Index row, Index col, const PacketScalar &val)
const Scalar & coeff(Index rowId, Index colId) const
MapBase(PointerType dataPtr, Index nbRows, Index nbCols)
internal::conditional< bool(internal::is_lvalue< Derived >::value), Scalar *, const Scalar * >::type PointerType
PacketScalar packet(Index index) const
MapBase(PointerType dataPtr)
#define EIGEN_STATIC_ASSERT_FIXED_SIZE(TYPE)
#define EIGEN_STATIC_ASSERT_INDEX_BASED_ACCESS(Derived)
MapBase< Derived, ReadOnlyAccessors > Base
ScalarWithConstIfNotLvalue & coeffRef(Index row, Index col)
internal::traits< Derived >::StorageKind StorageKind
const internal::variable_if_dynamic< Index, RowsAtCompileTime > m_rows
#define EIGEN_IMPLIES(a, b)
const Scalar & coeffRef(Index index) const
internal::traits< Derived >::Scalar Scalar
#define EIGEN_STATIC_ASSERT_VECTOR_ONLY(TYPE)
NumTraits< Scalar >::Real RealScalar
Derived & operator=(const MapBase &other)
ScalarWithConstIfNotLvalue * data()
internal::conditional< internal::is_lvalue< Derived >::value, Scalar, const Scalar >::type ScalarWithConstIfNotLvalue