11 #ifndef EIGEN_GENERIC_PACKET_MATH_H
12 #define EIGEN_GENERIC_PACKET_MATH_H
26 #ifndef EIGEN_DEBUG_ALIGNED_LOAD
27 #define EIGEN_DEBUG_ALIGNED_LOAD
30 #ifndef EIGEN_DEBUG_UNALIGNED_LOAD
31 #define EIGEN_DEBUG_UNALIGNED_LOAD
34 #ifndef EIGEN_DEBUG_ALIGNED_STORE
35 #define EIGEN_DEBUG_ALIGNED_STORE
38 #ifndef EIGEN_DEBUG_UNALIGNED_STORE
39 #define EIGEN_DEBUG_UNALIGNED_STORE
42 struct default_packet_traits
71 template<
typename T>
struct packet_traits : default_packet_traits
94 template<
typename Packet>
inline Packet
96 const Packet& b) {
return a+b; }
99 template<
typename Packet>
inline Packet
100 psub(
const Packet& a,
101 const Packet& b) {
return a-b; }
104 template<
typename Packet>
inline Packet
105 pnegate(
const Packet& a) {
return -a; }
108 template<
typename Packet>
inline Packet
109 pconj(
const Packet& a) {
return numext::conj(a); }
112 template<
typename Packet>
inline Packet
113 pmul(
const Packet& a,
114 const Packet& b) {
return a*b; }
117 template<
typename Packet>
inline Packet
118 pdiv(
const Packet& a,
119 const Packet& b) {
return a/b; }
122 template<
typename Packet>
inline Packet
123 pmin(
const Packet& a,
124 const Packet& b) {
using std::min;
return (min)(a, b); }
127 template<
typename Packet>
inline Packet
128 pmax(
const Packet& a,
129 const Packet& b) {
using std::max;
return (max)(a, b); }
132 template<
typename Packet>
inline Packet
133 pabs(
const Packet& a) {
using std::abs;
return abs(a); }
136 template<
typename Packet>
inline Packet
137 pand(
const Packet& a,
const Packet& b) {
return a & b; }
140 template<
typename Packet>
inline Packet
141 por(
const Packet& a,
const Packet& b) {
return a | b; }
144 template<
typename Packet>
inline Packet
145 pxor(
const Packet& a,
const Packet& b) {
return a ^ b; }
148 template<
typename Packet>
inline Packet
149 pandnot(
const Packet& a,
const Packet& b) {
return a & (!b); }
152 template<
typename Packet>
inline Packet
153 pload(
const typename unpacket_traits<Packet>::type* from) {
return *from; }
156 template<
typename Packet>
inline Packet
157 ploadu(
const typename unpacket_traits<Packet>::type* from) {
return *from; }
164 template<
typename Packet>
inline Packet
165 ploaddup(
const typename unpacket_traits<Packet>::type* from) {
return *from; }
168 template<
typename Packet>
inline Packet
169 pset1(
const typename unpacket_traits<Packet>::type& a) {
return a; }
172 template<
typename Scalar>
inline typename packet_traits<Scalar>::type
173 plset(
const Scalar& a) {
return a; }
176 template<
typename Scalar,
typename Packet>
inline void pstore(Scalar* to,
const Packet& from)
180 template<
typename Scalar,
typename Packet>
inline void pstoreu(Scalar* to,
const Packet& from)
184 template<
typename Scalar>
inline void prefetch(
const Scalar* addr)
186 #if !defined(_MSC_VER)
187 __builtin_prefetch(addr);
192 template<
typename Packet>
inline typename unpacket_traits<Packet>::type pfirst(
const Packet& a)
196 template<
typename Packet>
inline Packet
197 preduxp(
const Packet* vecs) {
return vecs[0]; }
200 template<
typename Packet>
inline typename unpacket_traits<Packet>::type predux(
const Packet& a)
204 template<
typename Packet>
inline typename unpacket_traits<Packet>::type predux_mul(
const Packet& a)
208 template<
typename Packet>
inline typename unpacket_traits<Packet>::type predux_min(
const Packet& a)
212 template<
typename Packet>
inline typename unpacket_traits<Packet>::type predux_max(
const Packet& a)
216 template<
typename Packet>
inline Packet preverse(
const Packet& a)
221 template<
typename Packet>
inline Packet pcplxflip(
const Packet& a)
226 return Packet(imag(a),real(a));
234 template<
typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
235 Packet psin(
const Packet& a) {
using std::sin;
return sin(a); }
238 template<
typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
239 Packet pcos(
const Packet& a) {
using std::cos;
return cos(a); }
242 template<
typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
243 Packet ptan(
const Packet& a) {
using std::tan;
return tan(a); }
246 template<
typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
247 Packet pasin(
const Packet& a) {
using std::asin;
return asin(a); }
250 template<
typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
251 Packet pacos(
const Packet& a) {
using std::acos;
return acos(a); }
254 template<
typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
255 Packet pexp(
const Packet& a) {
using std::exp;
return exp(a); }
258 template<
typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
259 Packet plog(
const Packet& a) {
using std::log;
return log(a); }
262 template<
typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
263 Packet psqrt(
const Packet& a) {
using std::sqrt;
return sqrt(a); }
271 template<
typename Packet>
272 inline void pstore1(
typename unpacket_traits<Packet>::type* to,
const typename unpacket_traits<Packet>::type& a)
274 pstore(to, pset1<Packet>(a));
278 template<
typename Packet>
inline Packet
279 pmadd(
const Packet& a,
282 {
return padd(pmul(a, b),c); }
286 template<
typename Packet,
int LoadMode>
287 inline Packet ploadt(
const typename unpacket_traits<Packet>::type* from)
290 return pload<Packet>(from);
292 return ploadu<Packet>(from);
297 template<
typename Scalar,
typename Packet,
int LoadMode>
298 inline void pstoret(Scalar* to,
const Packet& from)
307 template<
int Offset,
typename PacketType>
311 static inline void run(PacketType&,
const PacketType&) {}
329 template<
int Offset,
typename PacketType>
330 inline void palign(PacketType& first,
const PacketType& second)
332 palign_impl<Offset,PacketType>::run(first,second);
339 template<>
inline std::complex<float> pmul(
const std::complex<float>& a,
const std::complex<float>& b)
340 {
return std::complex<float>(real(a)*real(b) - imag(a)*imag(b), imag(a)*real(b) + real(a)*imag(b)); }
342 template<>
inline std::complex<double> pmul(
const std::complex<double>& a,
const std::complex<double>& b)
343 {
return std::complex<double>(real(a)*real(b) - imag(a)*imag(b), imag(a)*real(b) + real(a)*imag(b)); }
349 #endif // EIGEN_GENERIC_PACKET_MATH_H
Definition: Constants.h:194