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 // IWYU pragma: private
14 #include "./InternalHeaderCheck.h"
15 
16 namespace Eigen {
17 
18 template <typename XprType, typename StorageKind>
19 class InverseImpl;
20 
21 namespace internal {
22 
23 template <typename XprType>
24 struct traits<Inverse<XprType> > : traits<typename XprType::PlainObject> {
25  typedef typename XprType::PlainObject PlainObject;
27  enum { Flags = BaseTraits::Flags & RowMajorBit };
28 };
29 
30 } // end namespace internal
31 
42 template <typename XprType>
43 class Inverse : public InverseImpl<XprType, typename internal::traits<XprType>::StorageKind> {
44  public:
45  typedef typename XprType::StorageIndex StorageIndex;
46  typedef typename XprType::Scalar Scalar;
51 
52  explicit EIGEN_DEVICE_FUNC Inverse(const XprType& xpr) : m_xpr(xpr) {}
53 
56 
58 
59  protected:
61 };
62 
63 // Generic API dispatcher
64 template <typename XprType, typename StorageKind>
65 class InverseImpl : public internal::generic_xpr_base<Inverse<XprType> >::type {
66  public:
68  typedef typename XprType::Scalar Scalar;
69 
70  private:
72  Scalar coeff(Index i) const;
73 };
74 
75 namespace internal {
76 
87 template <typename ArgType>
88 struct unary_evaluator<Inverse<ArgType> > : public evaluator<typename Inverse<ArgType>::PlainObject> {
90  typedef typename InverseType::PlainObject PlainObject;
92 
93  enum { Flags = Base::Flags | EvalBeforeNestingBit };
94 
95  EIGEN_DEVICE_FUNC unary_evaluator(const InverseType& inv_xpr) : m_result(inv_xpr.rows(), inv_xpr.cols()) {
96  internal::construct_at<Base>(this, m_result);
97  internal::call_assignment_no_alias(m_result, inv_xpr);
98  }
99 
100  protected:
102 };
103 
104 } // end namespace internal
105 
106 } // end namespace Eigen
107 
108 #endif // EIGEN_INVERSE_H
int i
Definition: BiCGSTAB_step_by_step.cpp:9
#define EIGEN_NOEXCEPT
Definition: Macros.h:1267
#define EIGEN_CONSTEXPR
Definition: Macros.h:758
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:892
m col(1)
m row(1)
int rows
Definition: Tutorial_commainit_02.cpp:1
int cols
Definition: Tutorial_commainit_02.cpp:1
SCALAR Scalar
Definition: bench_gemm.cpp:45
Generic expression where a coefficient-wise binary operator is applied to two expressions.
Definition: CwiseBinaryOp.h:79
Definition: Inverse.h:65
Scalar coeff(Index row, Index col) const
internal::generic_xpr_base< Inverse< XprType > >::type Base
Definition: Inverse.h:67
XprType::Scalar Scalar
Definition: Inverse.h:68
Scalar coeff(Index i) const
Expression of the inverse of another expression.
Definition: Inverse.h:43
internal::ref_selector< XprType >::type XprTypeNested
Definition: Inverse.h:47
XprType::StorageIndex StorageIndex
Definition: Inverse.h:45
internal::ref_selector< Inverse >::type Nested
Definition: Inverse.h:49
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
Definition: Inverse.h:55
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
Definition: Inverse.h:54
XprTypeNested m_xpr
Definition: Inverse.h:60
EIGEN_DEVICE_FUNC const XprTypeNestedCleaned & nestedExpression() const
Definition: Inverse.h:57
EIGEN_DEVICE_FUNC Inverse(const XprType &xpr)
Definition: Inverse.h:52
internal::remove_all_t< XprTypeNested > XprTypeNestedCleaned
Definition: Inverse.h:48
internal::remove_all_t< XprType > NestedExpression
Definition: Inverse.h:50
XprType::Scalar Scalar
Definition: Inverse.h:46
const unsigned int EvalBeforeNestingBit
Definition: Constants.h:74
const unsigned int RowMajorBit
Definition: Constants.h:70
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR void call_assignment_no_alias(Dst &dst, const Src &src, const Func &func)
Definition: AssignEvaluator.h:812
typename remove_all< T >::type remove_all_t
Definition: Meta.h:142
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:70
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: CoreEvaluators.h:104
Definition: XprHelper.h:575
std::conditional_t< bool(traits< T >::Flags &NestByRefBit), T const &, const T > type
Definition: XprHelper.h:507
XprType::PlainObject PlainObject
Definition: Inverse.h:25
traits< PlainObject > BaseTraits
Definition: Inverse.h:26
Definition: ForwardDeclarations.h:21
EIGEN_DEVICE_FUNC unary_evaluator(const InverseType &inv_xpr)
Definition: Inverse.h:95
InverseType::PlainObject PlainObject
Definition: Inverse.h:90
PlainObject m_result
Definition: Inverse.h:101
evaluator< PlainObject > Base
Definition: Inverse.h:91
Inverse< ArgType > InverseType
Definition: Inverse.h:89
Definition: CoreEvaluators.h:82