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 {
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_EMPTY_STRUCT_CTOR
#define EIGEN_EMPTY_STRUCT_CTOR(X)
Definition: XprHelper.h:22
Eigen::internal::mul_assign_op::assignCoeff
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignCoeff(DstScalar &a, const SrcScalar &b) const
Definition: AssignmentFunctors.h:92
Eigen::internal::assign_op::assignPacket
EIGEN_STRONG_INLINE void assignPacket(DstScalar *a, const Packet &b) const
Definition: AssignmentFunctors.h:27
EIGEN_DEVICE_FUNC
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:976
Eigen
Namespace containing all symbols from the Eigen library.
Definition: jet.h:637
Eigen::internal::div_assign_op::assignCoeff
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignCoeff(DstScalar &a, const SrcScalar &b) const
Definition: AssignmentFunctors.h:113
Eigen::internal::div_assign_op::assignPacket
EIGEN_STRONG_INLINE void assignPacket(DstScalar *a, const Packet &b) const
Definition: AssignmentFunctors.h:116
b
Scalar * b
Definition: benchVecAdd.cpp:17
Eigen::internal::packet_traits
Definition: GenericPacketMath.h:106
Eigen::internal::sub_assign_op::assignCoeff
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignCoeff(DstScalar &a, const SrcScalar &b) const
Definition: AssignmentFunctors.h:70
Eigen::internal::pdiv
EIGEN_DEVICE_FUNC Packet pdiv(const Packet &a, const Packet &b)
Definition: GenericPacketMath.h:244
Eigen::internal::add_assign_op::assignPacket
EIGEN_STRONG_INLINE void assignPacket(DstScalar *a, const Packet &b) const
Definition: AssignmentFunctors.h:52
Eigen::internal::add_assign_op::assignCoeff
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignCoeff(DstScalar &a, const SrcScalar &b) const
Definition: AssignmentFunctors.h:49
Eigen::internal::mul_assign_op
Definition: AssignmentFunctors.h:89
Eigen::internal::swap_assign_op
Definition: AssignmentFunctors.h:142
EIGEN_STRONG_INLINE
#define EIGEN_STRONG_INLINE
Definition: Macros.h:917
std::swap
void swap(GeographicLib::NearestNeighbor< dist_t, pos_t, distfun_t > &a, GeographicLib::NearestNeighbor< dist_t, pos_t, distfun_t > &b)
Definition: NearestNeighbor.hpp:827
Eigen::internal::Packet
Definition: ZVector/PacketMath.h:47
Eigen::internal::psub
EIGEN_DEVICE_FUNC Packet psub(const Packet &a, const Packet &b)
Definition: GenericPacketMath.h:222
Eigen::internal::functor_traits::PacketAccess
@ PacketAccess
Definition: XprHelper.h:180
Eigen::internal::sub_assign_op::assignPacket
EIGEN_STRONG_INLINE void assignPacket(DstScalar *a, const Packet &b) const
Definition: AssignmentFunctors.h:73
Eigen::internal::assign_op::assignCoeff
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignCoeff(DstScalar &a, const SrcScalar &b) const
Definition: AssignmentFunctors.h:24
Eigen::internal::div_assign_op
Definition: AssignmentFunctors.h:110
Eigen::internal::assign_op
Definition: AssignmentFunctors.h:21
a
ArrayXXi a
Definition: Array_initializer_list_23_cxx11.cpp:1
Eigen::internal::swap_assign_op::assignCoeff
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignCoeff(Scalar &a, const Scalar &b) const
Definition: AssignmentFunctors.h:145
Eigen::internal::pmul
EIGEN_DEVICE_FUNC Packet pmul(const Packet &a, const Packet &b)
Definition: GenericPacketMath.h:237
Eigen::internal::functor_traits::Cost
@ Cost
Definition: XprHelper.h:179
Eigen::internal::mul_assign_op::assignPacket
EIGEN_STRONG_INLINE void assignPacket(DstScalar *a, const Packet &b) const
Definition: AssignmentFunctors.h:95
Eigen::internal::sub_assign_op
Definition: AssignmentFunctors.h:67
Eigen::internal::swap
void swap(scoped_array< T > &a, scoped_array< T > &b)
Definition: Memory.h:709
Eigen::internal::padd
EIGEN_DEVICE_FUNC Packet padd(const Packet &a, const Packet &b)
Definition: GenericPacketMath.h:215
Eigen::internal::is_same
Definition: Meta.h:148
Eigen::internal::functor_traits
Definition: XprHelper.h:175
Eigen::internal::add_assign_op
Definition: AssignmentFunctors.h:46
internal
Definition: BandTriangularSolver.h:13
align_3::t
Point2 t(10, 10)
Eigen::NumTraits
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition: NumTraits.h:232
Scalar
SCALAR Scalar
Definition: bench_gemm.cpp:46


gtsam
Author(s):
autogenerated on Fri Nov 1 2024 03:31:57