Eigen  3.4.90 (git rev 5a9f66fb35d03a4da9ef8976e67a61b30aa16dcf)
 
Loading...
Searching...
No Matches
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 <[email protected]>
5// Copyright (C) 2006-2008 Benoit Jacob <[email protected]>
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
17namespace Eigen {
18
19namespace internal {
20template <typename ExpressionType>
21struct traits<NestByValue<ExpressionType> > : public traits<ExpressionType> {
22 enum { Flags = traits<ExpressionType>::Flags & ~NestByRefBit };
23};
24} // namespace internal
25
38template <typename ExpressionType>
39class NestByValue : public internal::dense_xpr_base<NestByValue<ExpressionType> >::type {
40 public:
41 typedef typename internal::dense_xpr_base<NestByValue>::type Base;
42 static constexpr bool HasDirectAccess = internal::has_direct_access<ExpressionType>::ret;
43
44 EIGEN_DENSE_PUBLIC_INTERFACE(NestByValue)
45
46 EIGEN_DEVICE_FUNC explicit inline NestByValue(const ExpressionType& matrix) : m_expression(matrix) {}
47
48 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index rows() const EIGEN_NOEXCEPT { return m_expression.rows(); }
49 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index cols() const EIGEN_NOEXCEPT { return m_expression.cols(); }
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
55 EIGEN_DEVICE_FUNC typename std::enable_if<HasDirectAccess, const Scalar*>::type data() const {
56 return m_expression.data();
57 }
58
59 EIGEN_DEVICE_FUNC typename std::enable_if<HasDirectAccess, Index>::type innerStride() const {
60 return m_expression.innerStride();
61 }
62
63 EIGEN_DEVICE_FUNC typename std::enable_if<HasDirectAccess, Index>::type outerStride() const {
64 return m_expression.outerStride();
65 }
66
67 protected:
68 const ExpressionType m_expression;
69};
70
73template <typename Derived>
74EIGEN_DEVICE_FUNC inline const NestByValue<Derived> DenseBase<Derived>::nestByValue() const {
75 return NestByValue<Derived>(derived());
76}
77
78namespace internal {
79
80// Evaluator of Solve -> eval into a temporary
81template <typename ArgType>
82struct evaluator<NestByValue<ArgType> > : public evaluator<ArgType> {
83 typedef evaluator<ArgType> Base;
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
Base class for all dense matrices, vectors, and arrays.
Definition DenseBase.h:44
Expression which must be nested by value.
Definition NestByValue.h:39
Namespace containing all symbols from the Eigen library.
Definition Core:137
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition Meta.h:83