Eigen  3.4.90 (git rev 67eeba6e720c5745abc77ae6c92ce0a44aa7b7ae)
NestByValue.h
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 #include "./InternalHeaderCheck.h"
15 
16 namespace Eigen {
17 
18 namespace internal {
19 template<typename ExpressionType>
20 struct traits<NestByValue<ExpressionType> > : public traits<ExpressionType>
21 {
22  enum {
23  Flags = traits<ExpressionType>::Flags & ~NestByRefBit
24  };
25 };
26 }
27 
40 template<typename ExpressionType> class NestByValue
41  : public internal::dense_xpr_base< NestByValue<ExpressionType> >::type
42 {
43  public:
44 
45  typedef typename internal::dense_xpr_base<NestByValue>::type Base;
46  EIGEN_DENSE_PUBLIC_INTERFACE(NestByValue)
47 
48  EIGEN_DEVICE_FUNC explicit inline NestByValue(const ExpressionType& matrix) : m_expression(matrix) {}
49 
50  EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index rows() const EIGEN_NOEXCEPT { return m_expression.rows(); }
51  EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index cols() const EIGEN_NOEXCEPT { return m_expression.cols(); }
52 
53  EIGEN_DEVICE_FUNC operator const ExpressionType&() const { return m_expression; }
54 
55  EIGEN_DEVICE_FUNC const ExpressionType& nestedExpression() const { return m_expression; }
56 
57  protected:
58  const ExpressionType m_expression;
59 };
60 
63 template<typename Derived>
64 EIGEN_DEVICE_FUNC inline const NestByValue<Derived>
66 {
67  return NestByValue<Derived>(derived());
68 }
69 
70 namespace internal {
71 
72 // Evaluator of Solve -> eval into a temporary
73 template<typename ArgType>
74 struct evaluator<NestByValue<ArgType> >
75  : public evaluator<ArgType>
76 {
77  typedef evaluator<ArgType> Base;
78 
79  EIGEN_DEVICE_FUNC explicit evaluator(const NestByValue<ArgType>& xpr)
80  : Base(xpr.nestedExpression())
81  {}
82 };
83 }
84 
85 } // end namespace Eigen
86 
87 #endif // EIGEN_NESTBYVALUE_H
const NestByValue< Derived > nestByValue() const
Definition: NestByValue.h:65
Expression which must be nested by value.
Definition: NestByValue.h:42
Namespace containing all symbols from the Eigen library.
Definition: Core:139
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:59