10 #ifndef EIGEN_FORCEALIGNEDACCESS_H 11 #define EIGEN_FORCEALIGNEDACCESS_H 14 #include "./InternalHeaderCheck.h" 32 template <
typename ExpressionType>
33 struct traits<ForceAlignedAccess<ExpressionType>> :
public traits<ExpressionType> {};
36 template <
typename ExpressionType>
37 class ForceAlignedAccess :
public internal::dense_xpr_base<ForceAlignedAccess<ExpressionType>>::type {
39 typedef typename internal::dense_xpr_base<ForceAlignedAccess>::type Base;
42 EIGEN_DEVICE_FUNC
explicit inline ForceAlignedAccess(
const ExpressionType& matrix) : m_expression(matrix) {}
44 EIGEN_DEVICE_FUNC constexpr
Index rows()
const noexcept {
return m_expression.rows(); }
45 EIGEN_DEVICE_FUNC constexpr
Index cols()
const noexcept {
return m_expression.cols(); }
46 EIGEN_DEVICE_FUNC constexpr
Index outerStride()
const noexcept {
return m_expression.outerStride(); }
47 EIGEN_DEVICE_FUNC constexpr
Index innerStride()
const noexcept {
return m_expression.innerStride(); }
49 EIGEN_DEVICE_FUNC
inline const CoeffReturnType coeff(
Index row,
Index col)
const {
50 return m_expression.coeff(row, col);
53 EIGEN_DEVICE_FUNC
inline Scalar& coeffRef(
Index row,
Index col) {
54 return m_expression.const_cast_derived().coeffRef(row, col);
57 EIGEN_DEVICE_FUNC
inline const CoeffReturnType coeff(
Index index)
const {
return m_expression.coeff(index); }
59 EIGEN_DEVICE_FUNC
inline Scalar& coeffRef(
Index index) {
return m_expression.const_cast_derived().coeffRef(index); }
61 template <
int LoadMode>
62 inline const PacketScalar packet(
Index row,
Index col)
const {
63 return m_expression.template packet<Aligned>(row, col);
66 template <
int LoadMode>
67 inline void writePacket(
Index row,
Index col,
const PacketScalar& x) {
68 m_expression.const_cast_derived().template writePacket<Aligned>(row, col, x);
71 template <
int LoadMode>
72 inline const PacketScalar packet(
Index index)
const {
73 return m_expression.template packet<Aligned>(index);
76 template <
int LoadMode>
77 inline void writePacket(
Index index,
const PacketScalar& x) {
78 m_expression.const_cast_derived().template writePacket<Aligned>(index, x);
81 EIGEN_DEVICE_FUNC
operator const ExpressionType&()
const {
return m_expression; }
84 const ExpressionType& m_expression;
93 template <
typename Derived>
101 template <
typename Derived>
103 return ForceAlignedAccess<Derived>(derived());
109 template <
typename Derived>
110 template <
bool Enable>
111 inline add_const_on_value_type_t<std::conditional_t<Enable, ForceAlignedAccess<Derived>, Derived&>>
119 template <
typename Derived>
120 template <
bool Enable>
127 #endif // EIGEN_FORCEALIGNEDACCESS_H Enforce aligned packet loads and stores regardless of what is requested.
Definition: ForceAlignedAccess.h:37
Namespace containing all symbols from the Eigen library.
Definition: B01_Experimental.dox:1
const Derived & forceAlignedAccess() const
Definition: MatrixBase.h:299
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:82
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:52