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 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 namespace Eigen {
14 
15 template<typename XprType,typename StorageKind> class InverseImpl;
16 
17 namespace internal {
18 
19 template<typename XprType>
20 struct traits<Inverse<XprType> >
21  : traits<typename XprType::PlainObject>
22 {
23  typedef typename XprType::PlainObject PlainObject;
25  enum {
26  Flags = BaseTraits::Flags & RowMajorBit
27  };
28 };
29 
30 } // end namespace internal
31 
42 template<typename XprType>
43 class Inverse : public InverseImpl<XprType,typename internal::traits<XprType>::StorageKind>
44 {
45 public:
46  typedef typename XprType::StorageIndex StorageIndex;
47  typedef typename XprType::PlainObject PlainObject;
48  typedef typename XprType::Scalar Scalar;
53 
54  explicit EIGEN_DEVICE_FUNC Inverse(const XprType &xpr)
55  : m_xpr(xpr)
56  {}
57 
58  EIGEN_DEVICE_FUNC Index rows() const { return m_xpr.rows(); }
59  EIGEN_DEVICE_FUNC Index cols() const { return m_xpr.cols(); }
60 
61  EIGEN_DEVICE_FUNC const XprTypeNestedCleaned& nestedExpression() const { return m_xpr; }
62 
63 protected:
64  XprTypeNested m_xpr;
65 };
66 
67 // Generic API dispatcher
68 template<typename XprType, typename StorageKind>
69 class InverseImpl
70  : public internal::generic_xpr_base<Inverse<XprType> >::type
71 {
72 public:
74  typedef typename XprType::Scalar Scalar;
75 private:
76 
77  Scalar coeff(Index row, Index col) const;
78  Scalar coeff(Index i) const;
79 };
80 
81 namespace internal {
82 
93 template<typename ArgType>
94 struct unary_evaluator<Inverse<ArgType> >
95  : public evaluator<typename Inverse<ArgType>::PlainObject>
96 {
100 
101  enum { Flags = Base::Flags | EvalBeforeNestingBit };
102 
103  unary_evaluator(const InverseType& inv_xpr)
104  : m_result(inv_xpr.rows(), inv_xpr.cols())
105  {
106  ::new (static_cast<Base*>(this)) Base(m_result);
107  internal::call_assignment_no_alias(m_result, inv_xpr);
108  }
109 
110 protected:
111  PlainObject m_result;
112 };
113 
114 } // end namespace internal
115 
116 } // end namespace Eigen
117 
118 #endif // EIGEN_INVERSE_H
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void call_assignment_no_alias(Dst &dst, const Src &src, const Func &func)
EIGEN_DEVICE_FUNC Index rows() const
Definition: Inverse.h:58
XprType::StorageIndex StorageIndex
Definition: Inverse.h:46
Definition: LDLT.h:16
const unsigned int RowMajorBit
Definition: Constants.h:61
EIGEN_DEVICE_FUNC Inverse(const XprType &xpr)
Definition: Inverse.h:54
Expression of the inverse of another expression.
Definition: Inverse.h:43
internal::remove_all< XprTypeNested >::type XprTypeNestedCleaned
Definition: Inverse.h:50
EIGEN_DEVICE_FUNC ColXpr col(Index i)
This is the const version of col().
Definition: BlockMethods.h:838
XprType::PlainObject PlainObject
Definition: Inverse.h:47
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:33
EIGEN_DEVICE_FUNC Index cols() const
Definition: Inverse.h:59
EIGEN_DEVICE_FUNC RowXpr row(Index i)
This is the const version of row(). */.
Definition: BlockMethods.h:859
internal::remove_all< XprType >::type NestedExpression
Definition: Inverse.h:52
internal::generic_xpr_base< Inverse< XprType > >::type Base
Definition: Inverse.h:73
internal::ref_selector< XprType >::type XprTypeNested
Definition: Inverse.h:49
XprType::Scalar Scalar
Definition: Inverse.h:48
internal::ref_selector< Inverse >::type Nested
Definition: Inverse.h:51
const unsigned int EvalBeforeNestingBit
Definition: Constants.h:65
XprTypeNested m_xpr
Definition: Inverse.h:64
EIGEN_DEVICE_FUNC const XprTypeNestedCleaned & nestedExpression() const
Definition: Inverse.h:61
XprType::Scalar Scalar
Definition: Inverse.h:74


hebiros
Author(s): Xavier Artache , Matthew Tesch
autogenerated on Thu Sep 3 2020 04:08:16