AssignmentFunctors.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) 2008-2010 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_ASSIGNMENT_FUNCTORS_H
11 #define EIGEN_ASSIGNMENT_FUNCTORS_H
12 
13 namespace Eigen {
14 
15 namespace internal {
16 
21 template<typename DstScalar,typename SrcScalar> struct assign_op {
22 
24  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignCoeff(DstScalar& a, const SrcScalar& b) const { a = b; }
25 
26  template<int Alignment, typename Packet>
27  EIGEN_STRONG_INLINE void assignPacket(DstScalar* a, const Packet& b) const
28  { internal::pstoret<DstScalar,Packet,Alignment>(a,b); }
29 };
30 
31 // Empty overload for void type (used by PermutationMatrix)
32 template<typename DstScalar> struct assign_op<DstScalar,void> {};
33 
34 template<typename DstScalar,typename SrcScalar>
35 struct functor_traits<assign_op<DstScalar,SrcScalar> > {
36  enum {
39  };
40 };
41 
46 template<typename DstScalar,typename SrcScalar> struct add_assign_op {
47 
49  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignCoeff(DstScalar& a, const SrcScalar& b) const { a += b; }
50 
51  template<int Alignment, typename Packet>
52  EIGEN_STRONG_INLINE void assignPacket(DstScalar* a, const Packet& b) const
53  { internal::pstoret<DstScalar,Packet,Alignment>(a,internal::padd(internal::ploadt<Packet,Alignment>(a),b)); }
54 };
55 template<typename DstScalar,typename SrcScalar>
56 struct functor_traits<add_assign_op<DstScalar,SrcScalar> > {
57  enum {
60  };
61 };
62 
67 template<typename DstScalar,typename SrcScalar> struct sub_assign_op {
68 
70  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignCoeff(DstScalar& a, const SrcScalar& b) const { a -= b; }
71 
72  template<int Alignment, typename Packet>
73  EIGEN_STRONG_INLINE void assignPacket(DstScalar* a, const Packet& b) const
74  { internal::pstoret<DstScalar,Packet,Alignment>(a,internal::psub(internal::ploadt<Packet,Alignment>(a),b)); }
75 };
76 template<typename DstScalar,typename SrcScalar>
77 struct functor_traits<sub_assign_op<DstScalar,SrcScalar> > {
78  enum {
81  };
82 };
83 
88 template<typename DstScalar, typename SrcScalar=DstScalar>
89 struct mul_assign_op {
90 
92  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignCoeff(DstScalar& a, const SrcScalar& b) const { a *= b; }
93 
94  template<int Alignment, typename Packet>
95  EIGEN_STRONG_INLINE void assignPacket(DstScalar* a, const Packet& b) const
96  { internal::pstoret<DstScalar,Packet,Alignment>(a,internal::pmul(internal::ploadt<Packet,Alignment>(a),b)); }
97 };
98 template<typename DstScalar, typename SrcScalar>
99 struct functor_traits<mul_assign_op<DstScalar,SrcScalar> > {
100  enum {
103  };
104 };
105 
110 template<typename DstScalar, typename SrcScalar=DstScalar> struct div_assign_op {
111 
113  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignCoeff(DstScalar& a, const SrcScalar& b) const { a /= b; }
114 
115  template<int Alignment, typename Packet>
116  EIGEN_STRONG_INLINE void assignPacket(DstScalar* a, const Packet& b) const
117  { internal::pstoret<DstScalar,Packet,Alignment>(a,internal::pdiv(internal::ploadt<Packet,Alignment>(a),b)); }
118 };
119 template<typename DstScalar, typename SrcScalar>
120 struct functor_traits<div_assign_op<DstScalar,SrcScalar> > {
121  enum {
124  };
125 };
126 
142 template<typename Scalar> struct swap_assign_op {
143 
146  {
147 #ifdef EIGEN_GPUCC
148  // FIXME is there some kind of cuda::swap?
149  Scalar t=b; const_cast<Scalar&>(b)=a; a=t;
150 #else
151  using std::swap;
152  swap(a,const_cast<Scalar&>(b));
153 #endif
154  }
155 };
156 template<typename Scalar>
158  enum {
160  PacketAccess =
161  #if defined(EIGEN_VECTORIZE_AVX) && EIGEN_COMP_CLANG && (EIGEN_COMP_CLANG<800 || defined(__apple_build_version__))
162  // This is a partial workaround for a bug in clang generating bad code
163  // when mixing 256/512 bits loads and 128 bits moves.
164  // See http://eigen.tuxfamily.org/bz/show_bug.cgi?id=1684
165  // https://bugs.llvm.org/show_bug.cgi?id=40815
166  0
167  #else
169  #endif
170  };
171 };
172 
173 } // namespace internal
174 
175 } // namespace Eigen
176 
177 #endif // EIGEN_ASSIGNMENT_FUNCTORS_H
EIGEN_STRONG_INLINE void assignPacket(DstScalar *a, const Packet &b) const
SCALAR Scalar
Definition: bench_gemm.cpp:46
#define EIGEN_STRONG_INLINE
Definition: Macros.h:917
EIGEN_STRONG_INLINE void assignPacket(DstScalar *a, const Packet &b) const
#define EIGEN_EMPTY_STRUCT_CTOR(X)
Definition: XprHelper.h:22
Scalar * b
Definition: benchVecAdd.cpp:17
Namespace containing all symbols from the Eigen library.
Definition: jet.h:637
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
Definition: NumTraits.h:232
EIGEN_DEVICE_FUNC Packet padd(const Packet &a, const Packet &b)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignCoeff(DstScalar &a, const SrcScalar &b) const
void swap(GeographicLib::NearestNeighbor< dist_t, pos_t, distfun_t > &a, GeographicLib::NearestNeighbor< dist_t, pos_t, distfun_t > &b)
EIGEN_STRONG_INLINE void assignPacket(DstScalar *a, const Packet &b) const
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:976
EIGEN_DEVICE_FUNC Packet pdiv(const Packet &a, const Packet &b)
EIGEN_STRONG_INLINE void assignPacket(DstScalar *a, const Packet &b) const
EIGEN_DEVICE_FUNC Packet psub(const Packet &a, const Packet &b)
EIGEN_STRONG_INLINE void assignPacket(DstScalar *a, const Packet &b) const
EIGEN_DEVICE_FUNC Packet pmul(const Packet &a, const Packet &b)
Point2 t(10, 10)
void swap(scoped_array< T > &a, scoped_array< T > &b)
Definition: Memory.h:709


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:33:56