ArrayBase.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 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_ARRAYBASE_H
11 #define EIGEN_ARRAYBASE_H
12 
13 namespace Eigen {
14 
15 template<typename ExpressionType> class MatrixWrapper;
16 
39 template<typename Derived> class ArrayBase
40  : public DenseBase<Derived>
41 {
42  public:
43 #ifndef EIGEN_PARSED_BY_DOXYGEN
44 
46 
48 
51 
57 
66  using Base::Flags;
68 
69  using Base::derived;
70  using Base::const_cast_derived;
71  using Base::rows;
72  using Base::cols;
73  using Base::size;
74  using Base::coeff;
75  using Base::coeffRef;
76  using Base::lazyAssign;
77  using Base::operator=;
78  using Base::operator+=;
79  using Base::operator-=;
80  using Base::operator*=;
81  using Base::operator/=;
82 
84 
85 #endif // not EIGEN_PARSED_BY_DOXYGEN
86 
87 #ifndef EIGEN_PARSED_BY_DOXYGEN
88 
100 
101 
104 #endif // not EIGEN_PARSED_BY_DOXYGEN
105 
106 #define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::ArrayBase
107 # include "../plugins/CommonCwiseUnaryOps.h"
108 # include "../plugins/MatrixCwiseUnaryOps.h"
109 # include "../plugins/ArrayCwiseUnaryOps.h"
110 # include "../plugins/CommonCwiseBinaryOps.h"
111 # include "../plugins/MatrixCwiseBinaryOps.h"
112 # include "../plugins/ArrayCwiseBinaryOps.h"
113 # ifdef EIGEN_ARRAYBASE_PLUGIN
114 # include EIGEN_ARRAYBASE_PLUGIN
115 # endif
116 #undef EIGEN_CURRENT_STORAGE_BASE_CLASS
121  Derived& operator=(const ArrayBase& other)
122  {
123  return internal::assign_selector<Derived,Derived>::run(derived(), other.derived());
124  }
125 
126  Derived& operator+=(const Scalar& scalar)
127  { return *this = derived() + scalar; }
128  Derived& operator-=(const Scalar& scalar)
129  { return *this = derived() - scalar; }
131  template<typename OtherDerived>
132  Derived& operator+=(const ArrayBase<OtherDerived>& other);
133  template<typename OtherDerived>
134  Derived& operator-=(const ArrayBase<OtherDerived>& other);
135 
136  template<typename OtherDerived>
137  Derived& operator*=(const ArrayBase<OtherDerived>& other);
138 
139  template<typename OtherDerived>
140  Derived& operator/=(const ArrayBase<OtherDerived>& other);
141 
142  public:
143  ArrayBase<Derived>& array() { return *this; }
144  const ArrayBase<Derived>& array() const { return *this; }
145 
148  MatrixWrapper<Derived> matrix() { return derived(); }
149  const MatrixWrapper<const Derived> matrix() const { return derived(); }
150 
151 // template<typename Dest>
152 // inline void evalTo(Dest& dst) const { dst = matrix(); }
153 
154  protected:
155  ArrayBase() : Base() {}
156 
157  private:
158  explicit ArrayBase(Index);
159  ArrayBase(Index,Index);
160  template<typename OtherDerived> explicit ArrayBase(const ArrayBase<OtherDerived>&);
161  protected:
162  // mixing arrays and matrices is not legal
163  template<typename OtherDerived> Derived& operator+=(const MatrixBase<OtherDerived>& )
164  {EIGEN_STATIC_ASSERT(std::ptrdiff_t(sizeof(typename OtherDerived::Scalar))==-1,YOU_CANNOT_MIX_ARRAYS_AND_MATRICES); return *this;}
165  // mixing arrays and matrices is not legal
166  template<typename OtherDerived> Derived& operator-=(const MatrixBase<OtherDerived>& )
167  {EIGEN_STATIC_ASSERT(std::ptrdiff_t(sizeof(typename OtherDerived::Scalar))==-1,YOU_CANNOT_MIX_ARRAYS_AND_MATRICES); return *this;}
168 };
169 
174 template<typename Derived>
175 template<typename OtherDerived>
176 EIGEN_STRONG_INLINE Derived &
178 {
179  SelfCwiseBinaryOp<internal::scalar_difference_op<Scalar>, Derived, OtherDerived> tmp(derived());
180  tmp = other.derived();
181  return derived();
182 }
183 
188 template<typename Derived>
189 template<typename OtherDerived>
190 EIGEN_STRONG_INLINE Derived &
192 {
193  SelfCwiseBinaryOp<internal::scalar_sum_op<Scalar>, Derived, OtherDerived> tmp(derived());
194  tmp = other.derived();
195  return derived();
196 }
197 
202 template<typename Derived>
203 template<typename OtherDerived>
204 EIGEN_STRONG_INLINE Derived &
206 {
207  SelfCwiseBinaryOp<internal::scalar_product_op<Scalar>, Derived, OtherDerived> tmp(derived());
208  tmp = other.derived();
209  return derived();
210 }
211 
216 template<typename Derived>
217 template<typename OtherDerived>
218 EIGEN_STRONG_INLINE Derived &
220 {
221  SelfCwiseBinaryOp<internal::scalar_quotient_op<Scalar>, Derived, OtherDerived> tmp(derived());
222  tmp = other.derived();
223  return derived();
224 }
225 
226 } // end namespace Eigen
227 
228 #endif // EIGEN_ARRAYBASE_H
Generic expression of a matrix where all coefficients are defined by a functor.
internal::traits< Derived >::Index Index
Definition: ArrayBase.h:53
internal::traits< Derived >::Scalar Scalar
Definition: ArrayBase.h:54
#define EIGEN_STRONG_INLINE
Base::CoeffReturnType CoeffReturnType
Definition: DenseBase.h:98
ArrayBase StorageBaseType
Definition: ArrayBase.h:45
CwiseNullaryOp< internal::scalar_constant_op< Scalar >, Derived > ConstantReturnType
Definition: ArrayBase.h:103
Derived & operator+=(const MatrixBase< OtherDerived > &)
Definition: ArrayBase.h:163
NumTraits< Scalar >::Real RealScalar
Definition: ArrayBase.h:56
Definition: LDLT.h:16
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
Definition: NumTraits.h:88
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
Definition: StaticAssert.h:111
Derived & operator-=(const MatrixBase< OtherDerived > &)
Definition: ArrayBase.h:166
const unsigned int RowMajorBit
Definition: Constants.h:53
Base class for all dense matrices, vectors, and arrays.
Definition: DenseBase.h:41
Derived & operator/=(const ArrayBase< OtherDerived > &other)
Expression of an array as a mathematical vector or matrix.
Definition: ArrayBase.h:15
Derived & operator-=(const Scalar &scalar)
Definition: ArrayBase.h:128
Derived & lazyAssign(const DenseBase< OtherDerived > &other)
Derived & operator*=(const ArrayBase< OtherDerived > &other)
Base::CoeffReturnType CoeffReturnType
Definition: ArrayBase.h:83
DenseBase< Derived > Base
Definition: ArrayBase.h:58
Derived & operator=(const ArrayBase &other)
Definition: ArrayBase.h:121
Base class for all 1D and 2D array, and related expressions.
Definition: ArrayBase.h:39
ArrayBase Eigen_BaseClassForSpecializationOfGlobalMathFuncImpl
Definition: ArrayBase.h:47
MatrixWrapper< Derived > matrix()
Definition: ArrayBase.h:148
Derived & operator+=(const Scalar &scalar)
Definition: ArrayBase.h:126
General-purpose arrays with easy API for coefficient-wise operations.
Definition: Array.h:42
ArrayBase< Derived > & array()
Definition: ArrayBase.h:143
internal::traits< Derived >::StorageKind StorageKind
Definition: ArrayBase.h:52
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:48
const MatrixWrapper< const Derived > matrix() const
Definition: ArrayBase.h:149
internal::packet_traits< Scalar >::type PacketScalar
Definition: ArrayBase.h:55


tuw_aruco
Author(s): Lukas Pfeifhofer
autogenerated on Mon Jun 10 2019 15:40:45