Inverse.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) 2014-2019 Gael Guennebaud <gael.guennebaud@inria.fr>
5 //
6 // This Source Code Form is subject to the terms of the Mozilla
7 // Public License v. 2.0. If a copy of the MPL was not distributed
8 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 
10 #ifndef EIGEN_INVERSE_H
11 #define EIGEN_INVERSE_H
12 
13 #include "./InternalHeaderCheck.h"
14 
15 namespace Eigen {
16 
17 template<typename XprType,typename StorageKind> class InverseImpl;
18 
19 namespace internal {
20 
21 template<typename XprType>
22 struct traits<Inverse<XprType> >
23  : traits<typename XprType::PlainObject>
24 {
25  typedef typename XprType::PlainObject PlainObject;
26  typedef traits<PlainObject> BaseTraits;
27  enum {
28  Flags = BaseTraits::Flags & RowMajorBit
29  };
30 };
31 
32 } // end namespace internal
33 
44 template<typename XprType>
45 class Inverse : public InverseImpl<XprType,typename internal::traits<XprType>::StorageKind>
46 {
47 public:
48  typedef typename XprType::StorageIndex StorageIndex;
49  typedef typename XprType::Scalar Scalar;
50  typedef typename internal::ref_selector<XprType>::type XprTypeNested;
52  typedef typename internal::ref_selector<Inverse>::type Nested;
54 
55  explicit EIGEN_DEVICE_FUNC Inverse(const XprType &xpr)
56  : m_xpr(xpr)
57  {}
58 
61 
63 
64 protected:
66 };
67 
68 // Generic API dispatcher
69 template<typename XprType, typename StorageKind>
71  : public internal::generic_xpr_base<Inverse<XprType> >::type
72 {
73 public:
74  typedef typename internal::generic_xpr_base<Inverse<XprType> >::type Base;
75  typedef typename XprType::Scalar Scalar;
76 private:
77 
79  Scalar coeff(Index i) const;
80 };
81 
82 namespace internal {
83 
94 template<typename ArgType>
95 struct unary_evaluator<Inverse<ArgType> >
96  : public evaluator<typename Inverse<ArgType>::PlainObject>
97 {
98  typedef Inverse<ArgType> InverseType;
99  typedef typename InverseType::PlainObject PlainObject;
100  typedef evaluator<PlainObject> Base;
101 
102  enum { Flags = Base::Flags | EvalBeforeNestingBit };
103 
104  unary_evaluator(const InverseType& inv_xpr)
105  : m_result(inv_xpr.rows(), inv_xpr.cols())
106  {
107  internal::construct_at<Base>(this, m_result);
108  internal::call_assignment_no_alias(m_result, inv_xpr);
109  }
110 
111 protected:
112  PlainObject m_result;
113 };
114 
115 } // end namespace internal
116 
117 } // end namespace Eigen
118 
119 #endif // EIGEN_INVERSE_H
RowXpr row(Index i)
This is the const version of row(). *‍/.
ColXpr col(Index i)
This is the const version of col().
#define EIGEN_NOEXCEPT
Definition: Macros.h:1260
#define EIGEN_CONSTEXPR
Definition: Macros.h:747
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:883
Scalar coeff(Index row, Index col) const
internal::generic_xpr_base< Inverse< XprType > >::type Base
Definition: Inverse.h:74
XprType::Scalar Scalar
Definition: Inverse.h:75
Scalar coeff(Index i) const
Expression of the inverse of another expression.
Definition: Inverse.h:46
internal::ref_selector< XprType >::type XprTypeNested
Definition: Inverse.h:50
XprType::StorageIndex StorageIndex
Definition: Inverse.h:48
EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
Definition: Inverse.h:60
internal::ref_selector< Inverse >::type Nested
Definition: Inverse.h:52
XprTypeNested m_xpr
Definition: Inverse.h:65
EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
Definition: Inverse.h:59
const XprTypeNestedCleaned & nestedExpression() const
Definition: Inverse.h:62
internal::remove_all_t< XprTypeNested > XprTypeNestedCleaned
Definition: Inverse.h:51
internal::remove_all_t< XprType > NestedExpression
Definition: Inverse.h:53
XprType::Scalar Scalar
Definition: Inverse.h:49
Inverse(const XprType &xpr)
Definition: Inverse.h:55
const unsigned int EvalBeforeNestingBit
Definition: Constants.h:72
const unsigned int RowMajorBit
Definition: Constants.h:68
EIGEN_CONSTEXPR void call_assignment_no_alias(Dst &dst, const Src &src, const Func &func)
typename remove_all< T >::type remove_all_t
Definition: Meta.h:119
: InteropHeaders
Definition: Core:139
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:82