EigenBase.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) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>
5 // Copyright (C) 2009 Gael Guennebaud <gael.guennebaud@inria.fr>
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_EIGENBASE_H
12 #define EIGEN_EIGENBASE_H
13 
14 namespace Eigen {
15 
29 template<typename Derived> struct EigenBase
30 {
31 // typedef typename internal::plain_matrix_type<Derived>::type PlainObject;
32 
39 
40  // FIXME is it needed?
42 
44  EIGEN_DEVICE_FUNC
45  Derived& derived() { return *static_cast<Derived*>(this); }
47  EIGEN_DEVICE_FUNC
48  const Derived& derived() const { return *static_cast<const Derived*>(this); }
49 
50  EIGEN_DEVICE_FUNC
51  inline Derived& const_cast_derived() const
52  { return *static_cast<Derived*>(const_cast<EigenBase*>(this)); }
53  EIGEN_DEVICE_FUNC
54  inline const Derived& const_derived() const
55  { return *static_cast<const Derived*>(this); }
56 
58  EIGEN_DEVICE_FUNC
59  inline Index rows() const { return derived().rows(); }
61  EIGEN_DEVICE_FUNC
62  inline Index cols() const { return derived().cols(); }
65  EIGEN_DEVICE_FUNC
66  inline Index size() const { return rows() * cols(); }
67 
69  template<typename Dest>
70  EIGEN_DEVICE_FUNC
71  inline void evalTo(Dest& dst) const
72  { derived().evalTo(dst); }
73 
75  template<typename Dest>
76  EIGEN_DEVICE_FUNC
77  inline void addTo(Dest& dst) const
78  {
79  // This is the default implementation,
80  // derived class can reimplement it in a more optimized way.
81  typename Dest::PlainObject res(rows(),cols());
82  evalTo(res);
83  dst += res;
84  }
85 
87  template<typename Dest>
88  EIGEN_DEVICE_FUNC
89  inline void subTo(Dest& dst) const
90  {
91  // This is the default implementation,
92  // derived class can reimplement it in a more optimized way.
93  typename Dest::PlainObject res(rows(),cols());
94  evalTo(res);
95  dst -= res;
96  }
97 
99  template<typename Dest>
100  EIGEN_DEVICE_FUNC inline void applyThisOnTheRight(Dest& dst) const
101  {
102  // This is the default implementation,
103  // derived class can reimplement it in a more optimized way.
104  dst = dst * this->derived();
105  }
106 
108  template<typename Dest>
109  EIGEN_DEVICE_FUNC inline void applyThisOnTheLeft(Dest& dst) const
110  {
111  // This is the default implementation,
112  // derived class can reimplement it in a more optimized way.
113  dst = this->derived() * dst;
114  }
115 
116 };
117 
118 /***************************************************************************
119 * Implementation of matrix base methods
120 ***************************************************************************/
121 
130 template<typename Derived>
131 template<typename OtherDerived>
132 EIGEN_DEVICE_FUNC
134 {
135  call_assignment(derived(), other.derived());
136  return derived();
137 }
138 
139 template<typename Derived>
140 template<typename OtherDerived>
141 EIGEN_DEVICE_FUNC
143 {
145  return derived();
146 }
147 
148 template<typename Derived>
149 template<typename OtherDerived>
150 EIGEN_DEVICE_FUNC
152 {
154  return derived();
155 }
156 
157 } // end namespace Eigen
158 
159 #endif // EIGEN_EIGENBASE_H
EIGEN_DEVICE_FUNC const Derived & derived() const
Definition: EigenBase.h:48
EIGEN_DEVICE_FUNC void evalTo(Dest &dst) const
Definition: EigenBase.h:71
EIGEN_DEVICE_FUNC const Derived & const_derived() const
Definition: EigenBase.h:54
EIGEN_DEVICE_FUNC void subTo(Dest &dst) const
Definition: EigenBase.h:89
EIGEN_DEVICE_FUNC Derived & operator+=(const EigenBase< OtherDerived > &other)
Definition: EigenBase.h:142
Definition: LDLT.h:16
EIGEN_DEVICE_FUNC void applyThisOnTheLeft(Dest &dst) const
Definition: EigenBase.h:109
EIGEN_DEVICE_FUNC void applyThisOnTheRight(Dest &dst) const
Definition: EigenBase.h:100
Eigen::Index Index
The interface type of indices.
Definition: EigenBase.h:38
EIGEN_DEVICE_FUNC void addTo(Dest &dst) const
Definition: EigenBase.h:77
EIGEN_DEVICE_FUNC Derived & operator-=(const EigenBase< OtherDerived > &other)
Definition: EigenBase.h:151
EIGEN_DEVICE_FUNC Derived & const_cast_derived() const
Definition: EigenBase.h:51
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:33
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived & operator=(const DenseBase< OtherDerived > &other)
Definition: Assign.h:39
EIGEN_DEVICE_FUNC Index cols() const
Definition: EigenBase.h:62
internal::traits< Derived >::StorageKind StorageKind
Definition: EigenBase.h:41
EIGEN_DEVICE_FUNC Index rows() const
Definition: EigenBase.h:59
EIGEN_DEVICE_FUNC Derived & derived()
Definition: EigenBase.h:45
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void call_assignment(Dst &dst, const Src &src)
EIGEN_DEVICE_FUNC Index size() const
Definition: EigenBase.h:66


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