Medial Code Documentation
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 <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
14namespace Eigen {
15
29namespace internal {
30template<typename ExpressionType>
31struct traits<NestByValue<ExpressionType> > : public traits<ExpressionType>
32{};
33}
34
35template<typename ExpressionType> class NestByValue
36 : public internal::dense_xpr_base< NestByValue<ExpressionType> >::type
37{
38 public:
39
41 EIGEN_DENSE_PUBLIC_INTERFACE(NestByValue)
42
43 EIGEN_DEVICE_FUNC explicit inline NestByValue(const ExpressionType& matrix) : m_expression(matrix) {}
44
45 EIGEN_DEVICE_FUNC inline Index rows() const { return m_expression.rows(); }
46 EIGEN_DEVICE_FUNC inline Index cols() const { return m_expression.cols(); }
47 EIGEN_DEVICE_FUNC inline Index outerStride() const { return m_expression.outerStride(); }
48 EIGEN_DEVICE_FUNC inline Index innerStride() const { return m_expression.innerStride(); }
49
50 EIGEN_DEVICE_FUNC inline const CoeffReturnType coeff(Index row, Index col) const
51 {
52 return m_expression.coeff(row, col);
53 }
54
55 EIGEN_DEVICE_FUNC inline Scalar& coeffRef(Index row, Index col)
56 {
57 return m_expression.const_cast_derived().coeffRef(row, col);
58 }
59
60 EIGEN_DEVICE_FUNC inline const CoeffReturnType coeff(Index index) const
61 {
62 return m_expression.coeff(index);
63 }
64
65 EIGEN_DEVICE_FUNC inline Scalar& coeffRef(Index index)
66 {
67 return m_expression.const_cast_derived().coeffRef(index);
68 }
69
70 template<int LoadMode>
71 inline const PacketScalar packet(Index row, Index col) const
72 {
73 return m_expression.template packet<LoadMode>(row, col);
74 }
75
76 template<int LoadMode>
77 inline void writePacket(Index row, Index col, const PacketScalar& x)
78 {
79 m_expression.const_cast_derived().template writePacket<LoadMode>(row, col, x);
80 }
81
82 template<int LoadMode>
83 inline const PacketScalar packet(Index index) const
84 {
85 return m_expression.template packet<LoadMode>(index);
86 }
87
88 template<int LoadMode>
89 inline void writePacket(Index index, const PacketScalar& x)
90 {
91 m_expression.const_cast_derived().template writePacket<LoadMode>(index, x);
92 }
93
94 EIGEN_DEVICE_FUNC operator const ExpressionType&() const { return m_expression; }
95
96 protected:
97 const ExpressionType m_expression;
98};
99
102template<typename Derived>
103inline const NestByValue<Derived>
105{
106 return NestByValue<Derived>(derived());
107}
108
109} // end namespace Eigen
110
111#endif // EIGEN_NESTBYVALUE_H
Base class for all dense matrices, vectors, and arrays.
Definition DenseBase.h:49
Expression which must be nested by value.
Definition NestByValue.h:37
Pseudo expression representing a solving operation.
Definition Solve.h:63
Definition XprHelper.h:428
Definition ForwardDeclarations.h:17