NestByValue.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) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
5 // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>
6 //
7 // This Source Code Form is subject to the terms of the Mozilla
8 // Public License v. 2.0. If a copy of the MPL was not distributed
9 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 
11 #ifndef EIGEN_NESTBYVALUE_H
12 #define EIGEN_NESTBYVALUE_H
13 
14 namespace Eigen {
15 
16 namespace internal {
17 template<typename ExpressionType>
18 struct traits<NestByValue<ExpressionType> > : public traits<ExpressionType>
19 {};
20 }
21 
34 template<typename ExpressionType> class NestByValue
35  : public internal::dense_xpr_base< NestByValue<ExpressionType> >::type
36 {
37  public:
38 
41 
42  EIGEN_DEVICE_FUNC explicit inline NestByValue(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<LoadMode>(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<LoadMode>(row, col, x);
79  }
80 
81  template<int LoadMode>
82  inline const PacketScalar packet(Index index) const
83  {
84  return m_expression.template packet<LoadMode>(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<LoadMode>(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 
101 template<typename Derived>
102 inline const NestByValue<Derived>
104 {
105  return NestByValue<Derived>(derived());
106 }
107 
108 } // end namespace Eigen
109 
110 #endif // EIGEN_NESTBYVALUE_H
internal::dense_xpr_base< NestByValue >::type Base
Definition: NestByValue.h:39
EIGEN_DEVICE_FUNC Scalar & coeffRef(Index row, Index col)
Definition: NestByValue.h:54
Definition: LDLT.h:16
EIGEN_DEVICE_FUNC Index innerStride() const
Definition: NestByValue.h:47
EIGEN_DEVICE_FUNC const CoeffReturnType coeff(Index index) const
Definition: NestByValue.h:59
EIGEN_DEVICE_FUNC Index outerStride() const
Definition: NestByValue.h:46
EIGEN_DEVICE_FUNC Index rows() const
Definition: NestByValue.h:44
const PacketScalar packet(Index row, Index col) const
Definition: NestByValue.h:70
const ExpressionType m_expression
Definition: NestByValue.h:96
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 RowXpr row(Index i)
This is the const version of row(). */.
Definition: BlockMethods.h:859
void writePacket(Index index, const PacketScalar &x)
Definition: NestByValue.h:88
Expression which must be nested by value.
Definition: NestByValue.h:34
EIGEN_DEVICE_FUNC const CoeffReturnType coeff(Index row, Index col) const
Definition: NestByValue.h:49
EIGEN_DEVICE_FUNC Scalar & coeffRef(Index index)
Definition: NestByValue.h:64
#define EIGEN_DENSE_PUBLIC_INTERFACE(Derived)
Definition: Macros.h:867
EIGEN_DEVICE_FUNC const NestByValue< Derived > nestByValue() const
Definition: NestByValue.h:103
EIGEN_DEVICE_FUNC Index cols() const
Definition: NestByValue.h:45
void writePacket(Index row, Index col, const PacketScalar &x)
Definition: NestByValue.h:76
const PacketScalar packet(Index index) const
Definition: NestByValue.h:82


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