File indexing completed on 2025-01-18 09:56:13
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef EIGEN_FORCEALIGNEDACCESS_H
0011 #define EIGEN_FORCEALIGNEDACCESS_H
0012
0013 namespace Eigen {
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028 namespace internal {
0029 template<typename ExpressionType>
0030 struct traits<ForceAlignedAccess<ExpressionType> > : public traits<ExpressionType>
0031 {};
0032 }
0033
0034 template<typename ExpressionType> class ForceAlignedAccess
0035 : public internal::dense_xpr_base< ForceAlignedAccess<ExpressionType> >::type
0036 {
0037 public:
0038
0039 typedef typename internal::dense_xpr_base<ForceAlignedAccess>::type Base;
0040 EIGEN_DENSE_PUBLIC_INTERFACE(ForceAlignedAccess)
0041
0042 EIGEN_DEVICE_FUNC explicit inline ForceAlignedAccess(const ExpressionType& matrix) : m_expression(matrix) {}
0043
0044 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
0045 inline Index rows() const EIGEN_NOEXCEPT { return m_expression.rows(); }
0046 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
0047 inline Index cols() const EIGEN_NOEXCEPT { return m_expression.cols(); }
0048 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
0049 inline Index outerStride() const EIGEN_NOEXCEPT { return m_expression.outerStride(); }
0050 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
0051 inline Index innerStride() const EIGEN_NOEXCEPT { return m_expression.innerStride(); }
0052
0053 EIGEN_DEVICE_FUNC inline const CoeffReturnType coeff(Index row, Index col) const
0054 {
0055 return m_expression.coeff(row, col);
0056 }
0057
0058 EIGEN_DEVICE_FUNC inline Scalar& coeffRef(Index row, Index col)
0059 {
0060 return m_expression.const_cast_derived().coeffRef(row, col);
0061 }
0062
0063 EIGEN_DEVICE_FUNC inline const CoeffReturnType coeff(Index index) const
0064 {
0065 return m_expression.coeff(index);
0066 }
0067
0068 EIGEN_DEVICE_FUNC inline Scalar& coeffRef(Index index)
0069 {
0070 return m_expression.const_cast_derived().coeffRef(index);
0071 }
0072
0073 template<int LoadMode>
0074 inline const PacketScalar packet(Index row, Index col) const
0075 {
0076 return m_expression.template packet<Aligned>(row, col);
0077 }
0078
0079 template<int LoadMode>
0080 inline void writePacket(Index row, Index col, const PacketScalar& x)
0081 {
0082 m_expression.const_cast_derived().template writePacket<Aligned>(row, col, x);
0083 }
0084
0085 template<int LoadMode>
0086 inline const PacketScalar packet(Index index) const
0087 {
0088 return m_expression.template packet<Aligned>(index);
0089 }
0090
0091 template<int LoadMode>
0092 inline void writePacket(Index index, const PacketScalar& x)
0093 {
0094 m_expression.const_cast_derived().template writePacket<Aligned>(index, x);
0095 }
0096
0097 EIGEN_DEVICE_FUNC operator const ExpressionType&() const { return m_expression; }
0098
0099 protected:
0100 const ExpressionType& m_expression;
0101
0102 private:
0103 ForceAlignedAccess& operator=(const ForceAlignedAccess&);
0104 };
0105
0106
0107
0108
0109 template<typename Derived>
0110 inline const ForceAlignedAccess<Derived>
0111 MatrixBase<Derived>::forceAlignedAccess() const
0112 {
0113 return ForceAlignedAccess<Derived>(derived());
0114 }
0115
0116
0117
0118
0119 template<typename Derived>
0120 inline ForceAlignedAccess<Derived>
0121 MatrixBase<Derived>::forceAlignedAccess()
0122 {
0123 return ForceAlignedAccess<Derived>(derived());
0124 }
0125
0126
0127
0128
0129 template<typename Derived>
0130 template<bool Enable>
0131 inline typename internal::add_const_on_value_type<typename internal::conditional<Enable,ForceAlignedAccess<Derived>,Derived&>::type>::type
0132 MatrixBase<Derived>::forceAlignedAccessIf() const
0133 {
0134 return derived();
0135 }
0136
0137
0138
0139
0140 template<typename Derived>
0141 template<bool Enable>
0142 inline typename internal::conditional<Enable,ForceAlignedAccess<Derived>,Derived&>::type
0143 MatrixBase<Derived>::forceAlignedAccessIf()
0144 {
0145 return derived();
0146 }
0147
0148 }
0149
0150 #endif