Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef EIGEN_FORCEALIGNEDACCESS_H
00026 #define EIGEN_FORCEALIGNEDACCESS_H
00027
00028 namespace Eigen {
00029
00043 namespace internal {
00044 template<typename ExpressionType>
00045 struct traits<ForceAlignedAccess<ExpressionType> > : public traits<ExpressionType>
00046 {};
00047 }
00048
00049 template<typename ExpressionType> class ForceAlignedAccess
00050 : public internal::dense_xpr_base< ForceAlignedAccess<ExpressionType> >::type
00051 {
00052 public:
00053
00054 typedef typename internal::dense_xpr_base<ForceAlignedAccess>::type Base;
00055 EIGEN_DENSE_PUBLIC_INTERFACE(ForceAlignedAccess)
00056
00057 inline ForceAlignedAccess(const ExpressionType& matrix) : m_expression(matrix) {}
00058
00059 inline Index rows() const { return m_expression.rows(); }
00060 inline Index cols() const { return m_expression.cols(); }
00061 inline Index outerStride() const { return m_expression.outerStride(); }
00062 inline Index innerStride() const { return m_expression.innerStride(); }
00063
00064 inline const CoeffReturnType coeff(Index row, Index col) const
00065 {
00066 return m_expression.coeff(row, col);
00067 }
00068
00069 inline Scalar& coeffRef(Index row, Index col)
00070 {
00071 return m_expression.const_cast_derived().coeffRef(row, col);
00072 }
00073
00074 inline const CoeffReturnType coeff(Index index) const
00075 {
00076 return m_expression.coeff(index);
00077 }
00078
00079 inline Scalar& coeffRef(Index index)
00080 {
00081 return m_expression.const_cast_derived().coeffRef(index);
00082 }
00083
00084 template<int LoadMode>
00085 inline const PacketScalar packet(Index row, Index col) const
00086 {
00087 return m_expression.template packet<Aligned>(row, col);
00088 }
00089
00090 template<int LoadMode>
00091 inline void writePacket(Index row, Index col, const PacketScalar& x)
00092 {
00093 m_expression.const_cast_derived().template writePacket<Aligned>(row, col, x);
00094 }
00095
00096 template<int LoadMode>
00097 inline const PacketScalar packet(Index index) const
00098 {
00099 return m_expression.template packet<Aligned>(index);
00100 }
00101
00102 template<int LoadMode>
00103 inline void writePacket(Index index, const PacketScalar& x)
00104 {
00105 m_expression.const_cast_derived().template writePacket<Aligned>(index, x);
00106 }
00107
00108 operator const ExpressionType&() const { return m_expression; }
00109
00110 protected:
00111 const ExpressionType& m_expression;
00112
00113 private:
00114 ForceAlignedAccess& operator=(const ForceAlignedAccess&);
00115 };
00116
00120 template<typename Derived>
00121 inline const ForceAlignedAccess<Derived>
00122 MatrixBase<Derived>::forceAlignedAccess() const
00123 {
00124 return ForceAlignedAccess<Derived>(derived());
00125 }
00126
00130 template<typename Derived>
00131 inline ForceAlignedAccess<Derived>
00132 MatrixBase<Derived>::forceAlignedAccess()
00133 {
00134 return ForceAlignedAccess<Derived>(derived());
00135 }
00136
00140 template<typename Derived>
00141 template<bool Enable>
00142 inline typename internal::add_const_on_value_type<typename internal::conditional<Enable,ForceAlignedAccess<Derived>,Derived&>::type>::type
00143 MatrixBase<Derived>::forceAlignedAccessIf() const
00144 {
00145 return derived();
00146 }
00147
00151 template<typename Derived>
00152 template<bool Enable>
00153 inline typename internal::conditional<Enable,ForceAlignedAccess<Derived>,Derived&>::type
00154 MatrixBase<Derived>::forceAlignedAccessIf()
00155 {
00156 return derived();
00157 }
00158
00159 }
00160
00161 #endif // EIGEN_FORCEALIGNEDACCESS_H