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
00041 namespace internal {
00042 template<typename ExpressionType>
00043 struct traits<ForceAlignedAccess<ExpressionType> > : public traits<ExpressionType>
00044 {};
00045 }
00046
00047 template<typename ExpressionType> class ForceAlignedAccess
00048 : public internal::dense_xpr_base< ForceAlignedAccess<ExpressionType> >::type
00049 {
00050 public:
00051
00052 typedef typename internal::dense_xpr_base<ForceAlignedAccess>::type Base;
00053 EIGEN_DENSE_PUBLIC_INTERFACE(ForceAlignedAccess)
00054
00055 inline ForceAlignedAccess(const ExpressionType& matrix) : m_expression(matrix) {}
00056
00057 inline Index rows() const { return m_expression.rows(); }
00058 inline Index cols() const { return m_expression.cols(); }
00059 inline Index outerStride() const { return m_expression.outerStride(); }
00060 inline Index innerStride() const { return m_expression.innerStride(); }
00061
00062 inline const CoeffReturnType coeff(Index row, Index col) const
00063 {
00064 return m_expression.coeff(row, col);
00065 }
00066
00067 inline Scalar& coeffRef(Index row, Index col)
00068 {
00069 return m_expression.const_cast_derived().coeffRef(row, col);
00070 }
00071
00072 inline const CoeffReturnType coeff(Index index) const
00073 {
00074 return m_expression.coeff(index);
00075 }
00076
00077 inline Scalar& coeffRef(Index index)
00078 {
00079 return m_expression.const_cast_derived().coeffRef(index);
00080 }
00081
00082 template<int LoadMode>
00083 inline const PacketScalar packet(Index row, Index col) const
00084 {
00085 return m_expression.template packet<Aligned>(row, col);
00086 }
00087
00088 template<int LoadMode>
00089 inline void writePacket(Index row, Index col, const PacketScalar& x)
00090 {
00091 m_expression.const_cast_derived().template writePacket<Aligned>(row, col, x);
00092 }
00093
00094 template<int LoadMode>
00095 inline const PacketScalar packet(Index index) const
00096 {
00097 return m_expression.template packet<Aligned>(index);
00098 }
00099
00100 template<int LoadMode>
00101 inline void writePacket(Index index, const PacketScalar& x)
00102 {
00103 m_expression.const_cast_derived().template writePacket<Aligned>(index, x);
00104 }
00105
00106 operator const ExpressionType&() const { return m_expression; }
00107
00108 protected:
00109 const ExpressionType& m_expression;
00110
00111 private:
00112 ForceAlignedAccess& operator=(const ForceAlignedAccess&);
00113 };
00114
00118 template<typename Derived>
00119 inline const ForceAlignedAccess<Derived>
00120 MatrixBase<Derived>::forceAlignedAccess() const
00121 {
00122 return ForceAlignedAccess<Derived>(derived());
00123 }
00124
00128 template<typename Derived>
00129 inline ForceAlignedAccess<Derived>
00130 MatrixBase<Derived>::forceAlignedAccess()
00131 {
00132 return ForceAlignedAccess<Derived>(derived());
00133 }
00134
00138 template<typename Derived>
00139 template<bool Enable>
00140 inline typename internal::add_const_on_value_type<typename internal::conditional<Enable,ForceAlignedAccess<Derived>,Derived&>::type>::type
00141 MatrixBase<Derived>::forceAlignedAccessIf() const
00142 {
00143 return derived();
00144 }
00145
00149 template<typename Derived>
00150 template<bool Enable>
00151 inline typename internal::conditional<Enable,ForceAlignedAccess<Derived>,Derived&>::type
00152 MatrixBase<Derived>::forceAlignedAccessIf()
00153 {
00154 return derived();
00155 }
00156
00157 #endif // EIGEN_FORCEALIGNEDACCESS_H