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 // IWYU pragma: private
15 #include "./InternalHeaderCheck.h"
16 
17 namespace Eigen {
18 
19 namespace internal {
20 template <typename ExpressionType>
21 struct traits<NestByValue<ExpressionType> > : public traits<ExpressionType> {
23 };
24 } // namespace internal
25 
38 template <typename ExpressionType>
39 class NestByValue : public internal::dense_xpr_base<NestByValue<ExpressionType> >::type {
40  public:
43 
45 
46  EIGEN_DEVICE_FUNC explicit inline NestByValue(const ExpressionType& matrix) : m_expression(matrix) {}
47 
50 
51  EIGEN_DEVICE_FUNC operator const ExpressionType&() const { return m_expression; }
52 
53  EIGEN_DEVICE_FUNC const ExpressionType& nestedExpression() const { return m_expression; }
54 
56  return m_expression.data();
57  }
58 
60  return m_expression.innerStride();
61  }
62 
64  return m_expression.outerStride();
65  }
66 
67  protected:
68  const ExpressionType m_expression;
69 };
70 
73 template <typename Derived>
75  return NestByValue<Derived>(derived());
76 }
77 
78 namespace internal {
79 
80 // Evaluator of Solve -> eval into a temporary
81 template <typename ArgType>
82 struct evaluator<NestByValue<ArgType> > : public evaluator<ArgType> {
84 
85  EIGEN_DEVICE_FUNC explicit evaluator(const NestByValue<ArgType>& xpr) : Base(xpr.nestedExpression()) {}
86 };
87 } // namespace internal
88 
89 } // end namespace Eigen
90 
91 #endif // EIGEN_NESTBYVALUE_H
#define EIGEN_NOEXCEPT
Definition: Macros.h:1267
#define EIGEN_CONSTEXPR
Definition: Macros.h:758
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:892
#define EIGEN_DENSE_PUBLIC_INTERFACE(Derived)
Definition: Macros.h:1171
EIGEN_DEVICE_FUNC const NestByValue< Derived > nestByValue() const
Definition: NestByValue.h:74
Expression which must be nested by value.
Definition: NestByValue.h:39
EIGEN_DEVICE_FUNC std::enable_if< HasDirectAccess, Index >::type outerStride() const
Definition: NestByValue.h:63
internal::dense_xpr_base< NestByValue >::type Base
Definition: NestByValue.h:41
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
Definition: NestByValue.h:49
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
Definition: NestByValue.h:48
EIGEN_DEVICE_FUNC std::enable_if< HasDirectAccess, Index >::type innerStride() const
Definition: NestByValue.h:59
const ExpressionType m_expression
Definition: NestByValue.h:68
EIGEN_DEVICE_FUNC const ExpressionType & nestedExpression() const
Definition: NestByValue.h:53
static constexpr bool HasDirectAccess
Definition: NestByValue.h:42
EIGEN_DEVICE_FUNC std::enable_if< HasDirectAccess, const Scalar * >::type data() const
Definition: NestByValue.h:55
Eigen::Map< Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor >, 0, Eigen::OuterStride<> > matrix(T *data, int rows, int cols, int stride)
Definition: common.h:85
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:70
const unsigned int NestByRefBit
Definition: Constants.h:173
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:83
Extend namespace for flags.
Definition: fsi_chan_precond_driver.cc:56
type
Definition: compute_granudrum_aor.py:141
Definition: Eigen_Colamd.h:49
Definition: XprHelper.h:558
EIGEN_DEVICE_FUNC evaluator(const NestByValue< ArgType > &xpr)
Definition: NestByValue.h:85
evaluator< ArgType > Base
Definition: NestByValue.h:83
Definition: CoreEvaluators.h:104
Definition: ForwardDeclarations.h:31
Definition: ForwardDeclarations.h:21