ForceAlignedAccess.h
Go to the documentation of this file.
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2009-2010 Gael Guennebaud <gael.guennebaud@inria.fr>
5 //
6 // This Source Code Form is subject to the terms of the Mozilla
7 // Public License v. 2.0. If a copy of the MPL was not distributed
8 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 
10 #ifndef EIGEN_FORCEALIGNEDACCESS_H
11 #define EIGEN_FORCEALIGNEDACCESS_H
12 
13 namespace Eigen {
14 
28 namespace internal {
29 template<typename ExpressionType>
30 struct traits<ForceAlignedAccess<ExpressionType> > : public traits<ExpressionType>
31 {};
32 }
33 
34 template<typename ExpressionType> class ForceAlignedAccess
35  : public internal::dense_xpr_base< ForceAlignedAccess<ExpressionType> >::type
36 {
37  public:
38 
41 
42  EIGEN_DEVICE_FUNC explicit inline ForceAlignedAccess(const ExpressionType& matrix) : m_expression(matrix) {}
43 
44  EIGEN_DEVICE_FUNC inline Index rows() const { return m_expression.rows(); }
45  EIGEN_DEVICE_FUNC inline Index cols() const { return m_expression.cols(); }
46  EIGEN_DEVICE_FUNC inline Index outerStride() const { return m_expression.outerStride(); }
47  EIGEN_DEVICE_FUNC inline Index innerStride() const { return m_expression.innerStride(); }
48 
49  EIGEN_DEVICE_FUNC inline const CoeffReturnType coeff(Index row, Index col) const
50  {
51  return m_expression.coeff(row, col);
52  }
53 
54  EIGEN_DEVICE_FUNC inline Scalar& coeffRef(Index row, Index col)
55  {
56  return m_expression.const_cast_derived().coeffRef(row, col);
57  }
58 
59  EIGEN_DEVICE_FUNC inline const CoeffReturnType coeff(Index index) const
60  {
61  return m_expression.coeff(index);
62  }
63 
64  EIGEN_DEVICE_FUNC inline Scalar& coeffRef(Index index)
65  {
66  return m_expression.const_cast_derived().coeffRef(index);
67  }
68 
69  template<int LoadMode>
70  inline const PacketScalar packet(Index row, Index col) const
71  {
72  return m_expression.template packet<Aligned>(row, col);
73  }
74 
75  template<int LoadMode>
76  inline void writePacket(Index row, Index col, const PacketScalar& x)
77  {
78  m_expression.const_cast_derived().template writePacket<Aligned>(row, col, x);
79  }
80 
81  template<int LoadMode>
82  inline const PacketScalar packet(Index index) const
83  {
84  return m_expression.template packet<Aligned>(index);
85  }
86 
87  template<int LoadMode>
88  inline void writePacket(Index index, const PacketScalar& x)
89  {
90  m_expression.const_cast_derived().template writePacket<Aligned>(index, x);
91  }
92 
93  EIGEN_DEVICE_FUNC operator const ExpressionType&() const { return m_expression; }
94 
95  protected:
96  const ExpressionType& m_expression;
97 
98  private:
99  ForceAlignedAccess& operator=(const ForceAlignedAccess&);
100 };
101 
105 template<typename Derived>
106 inline const ForceAlignedAccess<Derived>
108 {
109  return ForceAlignedAccess<Derived>(derived());
110 }
111 
115 template<typename Derived>
118 {
119  return ForceAlignedAccess<Derived>(derived());
120 }
121 
125 template<typename Derived>
126 template<bool Enable>
129 {
130  return derived(); // FIXME This should not work but apparently is never used
131 }
132 
136 template<typename Derived>
137 template<bool Enable>
138 inline typename internal::conditional<Enable,ForceAlignedAccess<Derived>,Derived&>::type
140 {
141  return derived(); // FIXME This should not work but apparently is never used
142 }
143 
144 } // end namespace Eigen
145 
146 #endif // EIGEN_FORCEALIGNEDACCESS_H
void writePacket(Index index, const PacketScalar &x)
EIGEN_DEVICE_FUNC Scalar & coeffRef(Index row, Index col)
Enforce aligned packet loads and stores regardless of what is requested.
EIGEN_DEVICE_FUNC Index innerStride() const
const PacketScalar packet(Index index) const
internal::dense_xpr_base< ForceAlignedAccess >::type Base
Definition: LDLT.h:16
const Derived & forceAlignedAccess() const
Definition: MatrixBase.h:312
EIGEN_DEVICE_FUNC Index cols() const
void writePacket(Index row, Index col, const PacketScalar &x)
EIGEN_DEVICE_FUNC ColXpr col(Index i)
This is the const version of col().
Definition: BlockMethods.h:838
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:33
EIGEN_DEVICE_FUNC Scalar & coeffRef(Index index)
EIGEN_DEVICE_FUNC RowXpr row(Index i)
This is the const version of row(). */.
Definition: BlockMethods.h:859
EIGEN_DEVICE_FUNC Index rows() const
const Derived & forceAlignedAccessIf() const
Definition: MatrixBase.h:314
const ExpressionType & m_expression
EIGEN_DEVICE_FUNC Index outerStride() const
const PacketScalar packet(Index row, Index col) const
#define EIGEN_DENSE_PUBLIC_INTERFACE(Derived)
Definition: Macros.h:867
EIGEN_DEVICE_FUNC const CoeffReturnType coeff(Index row, Index col) const
EIGEN_DEVICE_FUNC const CoeffReturnType coeff(Index index) const


hebiros
Author(s): Xavier Artache , Matthew Tesch
autogenerated on Thu Sep 3 2020 04:08:11