ForceAlignedAccess.h
Go to the documentation of this file.
00001 // This file is part of Eigen, a lightweight C++ template library
00002 // for linear algebra.
00003 //
00004 // Copyright (C) 2009-2010 Gael Guennebaud <gael.guennebaud@inria.fr>
00005 //
00006 // This Source Code Form is subject to the terms of the Mozilla
00007 // Public License v. 2.0. If a copy of the MPL was not distributed
00008 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
00009 
00010 #ifndef EIGEN_FORCEALIGNEDACCESS_H
00011 #define EIGEN_FORCEALIGNEDACCESS_H
00012 
00013 namespace Eigen {
00014 
00028 namespace internal {
00029 template<typename ExpressionType>
00030 struct traits<ForceAlignedAccess<ExpressionType> > : public traits<ExpressionType>
00031 {};
00032 }
00033 
00034 template<typename ExpressionType> class ForceAlignedAccess
00035   : public internal::dense_xpr_base< ForceAlignedAccess<ExpressionType> >::type
00036 {
00037   public:
00038 
00039     typedef typename internal::dense_xpr_base<ForceAlignedAccess>::type Base;
00040     EIGEN_DENSE_PUBLIC_INTERFACE(ForceAlignedAccess)
00041 
00042     inline ForceAlignedAccess(const ExpressionType& matrix) : m_expression(matrix) {}
00043 
00044     inline Index rows() const { return m_expression.rows(); }
00045     inline Index cols() const { return m_expression.cols(); }
00046     inline Index outerStride() const { return m_expression.outerStride(); }
00047     inline Index innerStride() const { return m_expression.innerStride(); }
00048 
00049     inline const CoeffReturnType coeff(Index row, Index col) const
00050     {
00051       return m_expression.coeff(row, col);
00052     }
00053 
00054     inline Scalar& coeffRef(Index row, Index col)
00055     {
00056       return m_expression.const_cast_derived().coeffRef(row, col);
00057     }
00058 
00059     inline const CoeffReturnType coeff(Index index) const
00060     {
00061       return m_expression.coeff(index);
00062     }
00063 
00064     inline Scalar& coeffRef(Index index)
00065     {
00066       return m_expression.const_cast_derived().coeffRef(index);
00067     }
00068 
00069     template<int LoadMode>
00070     inline const PacketScalar packet(Index row, Index col) const
00071     {
00072       return m_expression.template packet<Aligned>(row, col);
00073     }
00074 
00075     template<int LoadMode>
00076     inline void writePacket(Index row, Index col, const PacketScalar& x)
00077     {
00078       m_expression.const_cast_derived().template writePacket<Aligned>(row, col, x);
00079     }
00080 
00081     template<int LoadMode>
00082     inline const PacketScalar packet(Index index) const
00083     {
00084       return m_expression.template packet<Aligned>(index);
00085     }
00086 
00087     template<int LoadMode>
00088     inline void writePacket(Index index, const PacketScalar& x)
00089     {
00090       m_expression.const_cast_derived().template writePacket<Aligned>(index, x);
00091     }
00092 
00093     operator const ExpressionType&() const { return m_expression; }
00094 
00095   protected:
00096     const ExpressionType& m_expression;
00097 
00098   private:
00099     ForceAlignedAccess& operator=(const ForceAlignedAccess&);
00100 };
00101 
00105 template<typename Derived>
00106 inline const ForceAlignedAccess<Derived>
00107 MatrixBase<Derived>::forceAlignedAccess() const
00108 {
00109   return ForceAlignedAccess<Derived>(derived());
00110 }
00111 
00115 template<typename Derived>
00116 inline ForceAlignedAccess<Derived>
00117 MatrixBase<Derived>::forceAlignedAccess()
00118 {
00119   return ForceAlignedAccess<Derived>(derived());
00120 }
00121 
00125 template<typename Derived>
00126 template<bool Enable>
00127 inline typename internal::add_const_on_value_type<typename internal::conditional<Enable,ForceAlignedAccess<Derived>,Derived&>::type>::type
00128 MatrixBase<Derived>::forceAlignedAccessIf() const
00129 {
00130   return derived();
00131 }
00132 
00136 template<typename Derived>
00137 template<bool Enable>
00138 inline typename internal::conditional<Enable,ForceAlignedAccess<Derived>,Derived&>::type
00139 MatrixBase<Derived>::forceAlignedAccessIf()
00140 {
00141   return derived();
00142 }
00143 
00144 } // end namespace Eigen
00145 
00146 #endif // EIGEN_FORCEALIGNEDACCESS_H


win_eigen
Author(s): Daniel Stonier
autogenerated on Wed Sep 16 2015 07:10:31