WPILibC++ 2023.4.3-108-ge5452e3
GenericPacketMath.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 Gael Guennebaud <gael.guennebaud@inria.fr>
5// Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>
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_GENERIC_PACKET_MATH_H
12#define EIGEN_GENERIC_PACKET_MATH_H
13
14namespace Eigen {
15
16namespace internal {
17
18/** \internal
19 * \file GenericPacketMath.h
20 *
21 * Default implementation for types not supported by the vectorization.
22 * In practice these functions are provided to make easier the writing
23 * of generic vectorized code.
24 */
25
26#ifndef EIGEN_DEBUG_ALIGNED_LOAD
27#define EIGEN_DEBUG_ALIGNED_LOAD
28#endif
29
30#ifndef EIGEN_DEBUG_UNALIGNED_LOAD
31#define EIGEN_DEBUG_UNALIGNED_LOAD
32#endif
33
34#ifndef EIGEN_DEBUG_ALIGNED_STORE
35#define EIGEN_DEBUG_ALIGNED_STORE
36#endif
37
38#ifndef EIGEN_DEBUG_UNALIGNED_STORE
39#define EIGEN_DEBUG_UNALIGNED_STORE
40#endif
41
43{
44 enum {
46
47 HasAdd = 1,
48 HasSub = 1,
50 HasMul = 1,
52 HasAbs = 1,
53 HasArg = 0,
56 HasMin = 1,
57 HasMax = 1,
61 // This flag is used to indicate whether packet comparison is supported.
62 // pcmp_eq, pcmp_lt and pcmp_le should be defined for it to be true.
63 HasCmp = 0,
64
65 HasDiv = 0,
68 HasExp = 0,
70 HasLog = 0,
73 HasPow = 0,
74
75 HasSin = 0,
76 HasCos = 0,
77 HasTan = 0,
88 HasErf = 0,
97
102 HasSign = 0
103 };
104};
105
106template<typename T> struct packet_traits : default_packet_traits
107{
108 typedef T type;
109 typedef T half;
110 enum {
112 size = 1,
114 HasHalfPacket = 0
115 };
116 enum {
126 HasSetLinear = 0
127 };
128};
129
130template<typename T> struct packet_traits<const T> : packet_traits<T> { };
131
132template<typename T> struct unpacket_traits
133{
134 typedef T type;
135 typedef T half;
136 enum
137 {
138 size = 1,
143 };
144};
145
146template<typename T> struct unpacket_traits<const T> : unpacket_traits<T> { };
147
148template <typename Src, typename Tgt> struct type_casting_traits {
149 enum {
152 TgtCoeffRatio = 1
153 };
154};
155
156/** \internal Wrapper to ensure that multiple packet types can map to the same
157 same underlying vector type. */
158template<typename T, int unique_id = 0>
160{
161 EIGEN_ALWAYS_INLINE operator T&() { return m_val; }
162 EIGEN_ALWAYS_INLINE operator const T&() const { return m_val; }
166 m_val = v;
167 return *this;
168 }
169
171};
172
173
174/** \internal A convenience utility for determining if the type is a scalar.
175 * This is used to enable some generic packet implementations.
176 */
177template<typename Packet>
178struct is_scalar {
180 enum {
182 };
183};
184
185/** \internal \returns static_cast<TgtType>(a) (coeff-wise) */
186template <typename SrcPacket, typename TgtPacket>
187EIGEN_DEVICE_FUNC inline TgtPacket
188pcast(const SrcPacket& a) {
189 return static_cast<TgtPacket>(a);
190}
191template <typename SrcPacket, typename TgtPacket>
192EIGEN_DEVICE_FUNC inline TgtPacket
193pcast(const SrcPacket& a, const SrcPacket& /*b*/) {
194 return static_cast<TgtPacket>(a);
195}
196template <typename SrcPacket, typename TgtPacket>
197EIGEN_DEVICE_FUNC inline TgtPacket
198pcast(const SrcPacket& a, const SrcPacket& /*b*/, const SrcPacket& /*c*/, const SrcPacket& /*d*/) {
199 return static_cast<TgtPacket>(a);
200}
201template <typename SrcPacket, typename TgtPacket>
202EIGEN_DEVICE_FUNC inline TgtPacket
203pcast(const SrcPacket& a, const SrcPacket& /*b*/, const SrcPacket& /*c*/, const SrcPacket& /*d*/,
204 const SrcPacket& /*e*/, const SrcPacket& /*f*/, const SrcPacket& /*g*/, const SrcPacket& /*h*/) {
205 return static_cast<TgtPacket>(a);
206}
207
208/** \internal \returns reinterpret_cast<Target>(a) */
209template <typename Target, typename Packet>
211preinterpret(const Packet& a); /* { return reinterpret_cast<const Target&>(a); } */
212
213/** \internal \returns a + b (coeff-wise) */
214template<typename Packet> EIGEN_DEVICE_FUNC inline Packet
215padd(const Packet& a, const Packet& b) { return a+b; }
216// Avoid compiler warning for boolean algebra.
217template<> EIGEN_DEVICE_FUNC inline bool
218padd(const bool& a, const bool& b) { return a || b; }
219
220/** \internal \returns a - b (coeff-wise) */
221template<typename Packet> EIGEN_DEVICE_FUNC inline Packet
222psub(const Packet& a, const Packet& b) { return a-b; }
223
224/** \internal \returns -a (coeff-wise) */
225template<typename Packet> EIGEN_DEVICE_FUNC inline Packet
226pnegate(const Packet& a) { return -a; }
227
228template<> EIGEN_DEVICE_FUNC inline bool
229pnegate(const bool& a) { return !a; }
230
231/** \internal \returns conj(a) (coeff-wise) */
232template<typename Packet> EIGEN_DEVICE_FUNC inline Packet
233pconj(const Packet& a) { return numext::conj(a); }
234
235/** \internal \returns a * b (coeff-wise) */
236template<typename Packet> EIGEN_DEVICE_FUNC inline Packet
237pmul(const Packet& a, const Packet& b) { return a*b; }
238// Avoid compiler warning for boolean algebra.
239template<> EIGEN_DEVICE_FUNC inline bool
240pmul(const bool& a, const bool& b) { return a && b; }
241
242/** \internal \returns a / b (coeff-wise) */
243template<typename Packet> EIGEN_DEVICE_FUNC inline Packet
244pdiv(const Packet& a, const Packet& b) { return a/b; }
245
246// In the generic case, memset to all one bits.
247template<typename Packet, typename EnableIf = void>
249 static EIGEN_DEVICE_FUNC inline Packet run(const Packet& /*a*/){
250 Packet b;
251 memset(static_cast<void*>(&b), 0xff, sizeof(Packet));
252 return b;
253 }
254};
255
256// For non-trivial scalars, set to Scalar(1) (i.e. a non-zero value).
257// Although this is technically not a valid bitmask, the scalar path for pselect
258// uses a comparison to zero, so this should still work in most cases. We don't
259// have another option, since the scalar type requires initialization.
260template<typename T>
261struct ptrue_impl<T,
262 typename internal::enable_if<is_scalar<T>::value && NumTraits<T>::RequireInitialization>::type > {
263 static EIGEN_DEVICE_FUNC inline T run(const T& /*a*/){
264 return T(1);
265 }
266};
267
268/** \internal \returns one bits. */
269template<typename Packet> EIGEN_DEVICE_FUNC inline Packet
270ptrue(const Packet& a) {
271 return ptrue_impl<Packet>::run(a);
272}
273
274// In the general case, memset to zero.
275template<typename Packet, typename EnableIf = void>
277 static EIGEN_DEVICE_FUNC inline Packet run(const Packet& /*a*/) {
278 Packet b;
279 memset(static_cast<void*>(&b), 0x00, sizeof(Packet));
280 return b;
281 }
282};
283
284// For scalars, explicitly set to Scalar(0), since the underlying representation
285// for zero may not consist of all-zero bits.
286template<typename T>
287struct pzero_impl<T,
288 typename internal::enable_if<is_scalar<T>::value>::type> {
289 static EIGEN_DEVICE_FUNC inline T run(const T& /*a*/) {
290 return T(0);
291 }
292};
293
294/** \internal \returns packet of zeros */
295template<typename Packet> EIGEN_DEVICE_FUNC inline Packet
296pzero(const Packet& a) {
297 return pzero_impl<Packet>::run(a);
298}
299
300/** \internal \returns a <= b as a bit mask */
301template<typename Packet> EIGEN_DEVICE_FUNC inline Packet
302pcmp_le(const Packet& a, const Packet& b) { return a<=b ? ptrue(a) : pzero(a); }
303
304/** \internal \returns a < b as a bit mask */
305template<typename Packet> EIGEN_DEVICE_FUNC inline Packet
306pcmp_lt(const Packet& a, const Packet& b) { return a<b ? ptrue(a) : pzero(a); }
307
308/** \internal \returns a == b as a bit mask */
309template<typename Packet> EIGEN_DEVICE_FUNC inline Packet
310pcmp_eq(const Packet& a, const Packet& b) { return a==b ? ptrue(a) : pzero(a); }
311
312/** \internal \returns a < b or a==NaN or b==NaN as a bit mask */
313template<typename Packet> EIGEN_DEVICE_FUNC inline Packet
314pcmp_lt_or_nan(const Packet& a, const Packet& b) { return a>=b ? pzero(a) : ptrue(a); }
315
316template<typename T>
317struct bit_and {
319 return a & b;
320 }
321};
322
323template<typename T>
324struct bit_or {
326 return a | b;
327 }
328};
329
330template<typename T>
331struct bit_xor {
333 return a ^ b;
334 }
335};
336
337template<typename T>
338struct bit_not {
340 return ~a;
341 }
342};
343
344// Use operators &, |, ^, ~.
345template<typename T>
347 EIGEN_DEVICE_FUNC static inline T bitwise_and(const T& a, const T& b) { return bit_and<T>()(a, b); }
348 EIGEN_DEVICE_FUNC static inline T bitwise_or(const T& a, const T& b) { return bit_or<T>()(a, b); }
349 EIGEN_DEVICE_FUNC static inline T bitwise_xor(const T& a, const T& b) { return bit_xor<T>()(a, b); }
350 EIGEN_DEVICE_FUNC static inline T bitwise_not(const T& a) { return bit_not<T>()(a); }
351};
352
353// Apply binary operations byte-by-byte
354template<typename T>
356 EIGEN_DEVICE_FUNC static inline T bitwise_and(const T& a, const T& b) {
357 return binary(a, b, bit_and<unsigned char>());
358 }
359 EIGEN_DEVICE_FUNC static inline T bitwise_or(const T& a, const T& b) {
360 return binary(a, b, bit_or<unsigned char>());
361 }
362 EIGEN_DEVICE_FUNC static inline T bitwise_xor(const T& a, const T& b) {
363 return binary(a, b, bit_xor<unsigned char>());
364 }
365 EIGEN_DEVICE_FUNC static inline T bitwise_not(const T& a) {
366 return unary(a,bit_not<unsigned char>());
367 }
368
369 private:
370 template<typename Op>
371 EIGEN_DEVICE_FUNC static inline T unary(const T& a, Op op) {
372 const unsigned char* a_ptr = reinterpret_cast<const unsigned char*>(&a);
373 T c;
374 unsigned char* c_ptr = reinterpret_cast<unsigned char*>(&c);
375 for (size_t i = 0; i < sizeof(T); ++i) {
376 *c_ptr++ = op(*a_ptr++);
377 }
378 return c;
379 }
380
381 template<typename Op>
382 EIGEN_DEVICE_FUNC static inline T binary(const T& a, const T& b, Op op) {
383 const unsigned char* a_ptr = reinterpret_cast<const unsigned char*>(&a);
384 const unsigned char* b_ptr = reinterpret_cast<const unsigned char*>(&b);
385 T c;
386 unsigned char* c_ptr = reinterpret_cast<unsigned char*>(&c);
387 for (size_t i = 0; i < sizeof(T); ++i) {
388 *c_ptr++ = op(*a_ptr++, *b_ptr++);
389 }
390 return c;
391 }
392};
393
394// In the general case, use byte-by-byte manipulation.
395template<typename T, typename EnableIf = void>
397
398// For integers or non-trivial scalars, use binary operators.
399template<typename T>
401 typename internal::enable_if<
402 is_scalar<T>::value && (NumTraits<T>::IsInteger || NumTraits<T>::RequireInitialization)>::type
403 > : public operator_bitwise_helper<T> {};
404
405/** \internal \returns the bitwise and of \a a and \a b */
406template<typename Packet> EIGEN_DEVICE_FUNC inline Packet
407pand(const Packet& a, const Packet& b) {
409}
410
411/** \internal \returns the bitwise or of \a a and \a b */
412template<typename Packet> EIGEN_DEVICE_FUNC inline Packet
413por(const Packet& a, const Packet& b) {
415}
416
417/** \internal \returns the bitwise xor of \a a and \a b */
418template<typename Packet> EIGEN_DEVICE_FUNC inline Packet
419pxor(const Packet& a, const Packet& b) {
421}
422
423/** \internal \returns the bitwise not of \a a */
424template<typename Packet> EIGEN_DEVICE_FUNC inline Packet
425pnot(const Packet& a) {
427}
428
429/** \internal \returns the bitwise and of \a a and not \a b */
430template<typename Packet> EIGEN_DEVICE_FUNC inline Packet
431pandnot(const Packet& a, const Packet& b) { return pand(a, pnot(b)); }
432
433// In the general case, use bitwise select.
434template<typename Packet, typename EnableIf = void>
436 static EIGEN_DEVICE_FUNC inline Packet run(const Packet& mask, const Packet& a, const Packet& b) {
437 return por(pand(a,mask),pandnot(b,mask));
438 }
439};
440
441// For scalars, use ternary select.
442template<typename Packet>
443struct pselect_impl<Packet,
444 typename internal::enable_if<is_scalar<Packet>::value>::type > {
445 static EIGEN_DEVICE_FUNC inline Packet run(const Packet& mask, const Packet& a, const Packet& b) {
446 return numext::equal_strict(mask, Packet(0)) ? b : a;
447 }
448};
449
450/** \internal \returns \a or \b for each field in packet according to \mask */
451template<typename Packet> EIGEN_DEVICE_FUNC inline Packet
452pselect(const Packet& mask, const Packet& a, const Packet& b) {
453 return pselect_impl<Packet>::run(mask, a, b);
454}
455
456template<> EIGEN_DEVICE_FUNC inline bool pselect<bool>(
457 const bool& cond, const bool& a, const bool& b) {
458 return cond ? a : b;
459}
460
461/** \internal \returns the min or of \a a and \a b (coeff-wise)
462 If either \a a or \a b are NaN, the result is implementation defined. */
463template<int NaNPropagation>
465 template <typename Packet, typename Op>
466 static EIGEN_DEVICE_FUNC inline Packet run(const Packet& a, const Packet& b, Op op) {
467 return op(a,b);
468 }
469};
470
471/** \internal \returns the min or max of \a a and \a b (coeff-wise)
472 If either \a a or \a b are NaN, NaN is returned. */
473template<>
475 template <typename Packet, typename Op>
476 static EIGEN_DEVICE_FUNC inline Packet run(const Packet& a, const Packet& b, Op op) {
477 Packet not_nan_mask_a = pcmp_eq(a, a);
478 Packet not_nan_mask_b = pcmp_eq(b, b);
479 return pselect(not_nan_mask_a,
480 pselect(not_nan_mask_b, op(a, b), b),
481 a);
482 }
483};
484
485/** \internal \returns the min or max of \a a and \a b (coeff-wise)
486 If both \a a and \a b are NaN, NaN is returned.
487 Equivalent to std::fmin(a, b). */
488template<>
490 template <typename Packet, typename Op>
491 static EIGEN_DEVICE_FUNC inline Packet run(const Packet& a, const Packet& b, Op op) {
492 Packet not_nan_mask_a = pcmp_eq(a, a);
493 Packet not_nan_mask_b = pcmp_eq(b, b);
494 return pselect(not_nan_mask_a,
495 pselect(not_nan_mask_b, op(a, b), a),
496 b);
497 }
498};
499
500
501#ifndef SYCL_DEVICE_ONLY
502#define EIGEN_BINARY_OP_NAN_PROPAGATION(Type, Func) Func
503#else
504#define EIGEN_BINARY_OP_NAN_PROPAGATION(Type, Func) \
505[](const Type& a, const Type& b) { \
506 return Func(a, b);}
507#endif
508
509/** \internal \returns the min of \a a and \a b (coeff-wise).
510 If \a a or \b b is NaN, the return value is implementation defined. */
511template<typename Packet> EIGEN_DEVICE_FUNC inline Packet
512pmin(const Packet& a, const Packet& b) { return numext::mini(a,b); }
513
514/** \internal \returns the min of \a a and \a b (coeff-wise).
515 NaNPropagation determines the NaN propagation semantics. */
516template <int NaNPropagation, typename Packet>
517EIGEN_DEVICE_FUNC inline Packet pmin(const Packet& a, const Packet& b) {
518 return pminmax_impl<NaNPropagation>::run(a, b, EIGEN_BINARY_OP_NAN_PROPAGATION(Packet, (pmin<Packet>)));
519}
520
521/** \internal \returns the max of \a a and \a b (coeff-wise)
522 If \a a or \b b is NaN, the return value is implementation defined. */
523template<typename Packet> EIGEN_DEVICE_FUNC inline Packet
524pmax(const Packet& a, const Packet& b) { return numext::maxi(a, b); }
525
526/** \internal \returns the max of \a a and \a b (coeff-wise).
527 NaNPropagation determines the NaN propagation semantics. */
528template <int NaNPropagation, typename Packet>
529EIGEN_DEVICE_FUNC inline Packet pmax(const Packet& a, const Packet& b) {
531}
532
533/** \internal \returns the absolute value of \a a */
534template<typename Packet> EIGEN_DEVICE_FUNC inline Packet
535pabs(const Packet& a) { return numext::abs(a); }
536template<> EIGEN_DEVICE_FUNC inline unsigned int
537pabs(const unsigned int& a) { return a; }
538template<> EIGEN_DEVICE_FUNC inline unsigned long
539pabs(const unsigned long& a) { return a; }
540template<> EIGEN_DEVICE_FUNC inline unsigned long long
541pabs(const unsigned long long& a) { return a; }
542
543/** \internal \returns the addsub value of \a a,b */
544template<typename Packet> EIGEN_DEVICE_FUNC inline Packet
545paddsub(const Packet& a, const Packet& b) {
546 return pselect(peven_mask(a), padd(a, b), psub(a, b));
547 }
548
549/** \internal \returns the phase angle of \a a */
550template<typename Packet> EIGEN_DEVICE_FUNC inline Packet
551parg(const Packet& a) { using numext::arg; return arg(a); }
552
553
554/** \internal \returns \a a logically shifted by N bits to the right */
555template<int N> EIGEN_DEVICE_FUNC inline int
556parithmetic_shift_right(const int& a) { return a >> N; }
557template<int N> EIGEN_DEVICE_FUNC inline long int
558parithmetic_shift_right(const long int& a) { return a >> N; }
559
560/** \internal \returns \a a arithmetically shifted by N bits to the right */
561template<int N> EIGEN_DEVICE_FUNC inline int
562plogical_shift_right(const int& a) { return static_cast<int>(static_cast<unsigned int>(a) >> N); }
563template<int N> EIGEN_DEVICE_FUNC inline long int
564plogical_shift_right(const long int& a) { return static_cast<long>(static_cast<unsigned long>(a) >> N); }
565
566/** \internal \returns \a a shifted by N bits to the left */
567template<int N> EIGEN_DEVICE_FUNC inline int
568plogical_shift_left(const int& a) { return a << N; }
569template<int N> EIGEN_DEVICE_FUNC inline long int
570plogical_shift_left(const long int& a) { return a << N; }
571
572/** \internal \returns the significant and exponent of the underlying floating point numbers
573 * See https://en.cppreference.com/w/cpp/numeric/math/frexp
574 */
575template <typename Packet>
576EIGEN_DEVICE_FUNC inline Packet pfrexp(const Packet& a, Packet& exponent) {
577 int exp;
578 EIGEN_USING_STD(frexp);
579 Packet result = static_cast<Packet>(frexp(a, &exp));
580 exponent = static_cast<Packet>(exp);
581 return result;
582}
583
584/** \internal \returns a * 2^((int)exponent)
585 * See https://en.cppreference.com/w/cpp/numeric/math/ldexp
586 */
587template<typename Packet> EIGEN_DEVICE_FUNC inline Packet
588pldexp(const Packet &a, const Packet &exponent) {
589 EIGEN_USING_STD(ldexp)
590 return static_cast<Packet>(ldexp(a, static_cast<int>(exponent)));
591}
592
593/** \internal \returns the min of \a a and \a b (coeff-wise) */
594template<typename Packet> EIGEN_DEVICE_FUNC inline Packet
595pabsdiff(const Packet& a, const Packet& b) { return pselect(pcmp_lt(a, b), psub(b, a), psub(a, b)); }
596
597/** \internal \returns a packet version of \a *from, from must be 16 bytes aligned */
598template<typename Packet> EIGEN_DEVICE_FUNC inline Packet
599pload(const typename unpacket_traits<Packet>::type* from) { return *from; }
600
601/** \internal \returns a packet version of \a *from, (un-aligned load) */
602template<typename Packet> EIGEN_DEVICE_FUNC inline Packet
603ploadu(const typename unpacket_traits<Packet>::type* from) { return *from; }
604
605/** \internal \returns a packet version of \a *from, (un-aligned masked load)
606 * There is no generic implementation. We only have implementations for specialized
607 * cases. Generic case should not be called.
608 */
609template<typename Packet> EIGEN_DEVICE_FUNC inline
610typename enable_if<unpacket_traits<Packet>::masked_load_available, Packet>::type
612
613/** \internal \returns a packet with constant coefficients \a a, e.g.: (a,a,a,a) */
614template<typename Packet> EIGEN_DEVICE_FUNC inline Packet
615pset1(const typename unpacket_traits<Packet>::type& a) { return a; }
616
617/** \internal \returns a packet with constant coefficients set from bits */
618template<typename Packet,typename BitsType> EIGEN_DEVICE_FUNC inline Packet
619pset1frombits(BitsType a);
620
621/** \internal \returns a packet with constant coefficients \a a[0], e.g.: (a[0],a[0],a[0],a[0]) */
622template<typename Packet> EIGEN_DEVICE_FUNC inline Packet
623pload1(const typename unpacket_traits<Packet>::type *a) { return pset1<Packet>(*a); }
624
625/** \internal \returns a packet with elements of \a *from duplicated.
626 * For instance, for a packet of 8 elements, 4 scalars will be read from \a *from and
627 * duplicated to form: {from[0],from[0],from[1],from[1],from[2],from[2],from[3],from[3]}
628 * Currently, this function is only used for scalar * complex products.
629 */
630template<typename Packet> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet
631ploaddup(const typename unpacket_traits<Packet>::type* from) { return *from; }
632
633/** \internal \returns a packet with elements of \a *from quadrupled.
634 * For instance, for a packet of 8 elements, 2 scalars will be read from \a *from and
635 * replicated to form: {from[0],from[0],from[0],from[0],from[1],from[1],from[1],from[1]}
636 * Currently, this function is only used in matrix products.
637 * For packet-size smaller or equal to 4, this function is equivalent to pload1
638 */
639template<typename Packet> EIGEN_DEVICE_FUNC inline Packet
641{ return pload1<Packet>(from); }
642
643/** \internal equivalent to
644 * \code
645 * a0 = pload1(a+0);
646 * a1 = pload1(a+1);
647 * a2 = pload1(a+2);
648 * a3 = pload1(a+3);
649 * \endcode
650 * \sa pset1, pload1, ploaddup, pbroadcast2
651 */
652template<typename Packet> EIGEN_DEVICE_FUNC
653inline void pbroadcast4(const typename unpacket_traits<Packet>::type *a,
654 Packet& a0, Packet& a1, Packet& a2, Packet& a3)
655{
656 a0 = pload1<Packet>(a+0);
657 a1 = pload1<Packet>(a+1);
658 a2 = pload1<Packet>(a+2);
659 a3 = pload1<Packet>(a+3);
660}
661
662/** \internal equivalent to
663 * \code
664 * a0 = pload1(a+0);
665 * a1 = pload1(a+1);
666 * \endcode
667 * \sa pset1, pload1, ploaddup, pbroadcast4
668 */
669template<typename Packet> EIGEN_DEVICE_FUNC
670inline void pbroadcast2(const typename unpacket_traits<Packet>::type *a,
671 Packet& a0, Packet& a1)
672{
673 a0 = pload1<Packet>(a+0);
674 a1 = pload1<Packet>(a+1);
675}
676
677/** \internal \brief Returns a packet with coefficients (a,a+1,...,a+packet_size-1). */
678template<typename Packet> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet
679plset(const typename unpacket_traits<Packet>::type& a) { return a; }
680
681/** \internal \returns a packet with constant coefficients \a a, e.g.: (x, 0, x, 0),
682 where x is the value of all 1-bits. */
683template<typename Packet> EIGEN_DEVICE_FUNC inline Packet
684peven_mask(const Packet& /*a*/) {
685 typedef typename unpacket_traits<Packet>::type Scalar;
686 const size_t n = unpacket_traits<Packet>::size;
687 EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) Scalar elements[n];
688 for(size_t i = 0; i < n; ++i) {
689 memset(elements+i, ((i & 1) == 0 ? 0xff : 0), sizeof(Scalar));
690 }
691 return ploadu<Packet>(elements);
692}
693
694
695/** \internal copy the packet \a from to \a *to, \a to must be 16 bytes aligned */
696template<typename Scalar, typename Packet> EIGEN_DEVICE_FUNC inline void pstore(Scalar* to, const Packet& from)
697{ (*to) = from; }
698
699/** \internal copy the packet \a from to \a *to, (un-aligned store) */
700template<typename Scalar, typename Packet> EIGEN_DEVICE_FUNC inline void pstoreu(Scalar* to, const Packet& from)
701{ (*to) = from; }
702
703/** \internal copy the packet \a from to \a *to, (un-aligned store with a mask)
704 * There is no generic implementation. We only have implementations for specialized
705 * cases. Generic case should not be called.
706 */
707template<typename Scalar, typename Packet>
709typename enable_if<unpacket_traits<Packet>::masked_store_available, void>::type
710pstoreu(Scalar* to, const Packet& from, typename unpacket_traits<Packet>::mask_t umask);
711
712 template<typename Scalar, typename Packet> EIGEN_DEVICE_FUNC inline Packet pgather(const Scalar* from, Index /*stride*/)
713 { return ploadu<Packet>(from); }
714
715 template<typename Scalar, typename Packet> EIGEN_DEVICE_FUNC inline void pscatter(Scalar* to, const Packet& from, Index /*stride*/)
716 { pstore(to, from); }
717
718/** \internal tries to do cache prefetching of \a addr */
719template<typename Scalar> EIGEN_DEVICE_FUNC inline void prefetch(const Scalar* addr)
720{
721#if defined(EIGEN_HIP_DEVICE_COMPILE)
722 // do nothing
723#elif defined(EIGEN_CUDA_ARCH)
724#if defined(__LP64__) || EIGEN_OS_WIN64
725 // 64-bit pointer operand constraint for inlined asm
726 asm(" prefetch.L1 [ %1 ];" : "=l"(addr) : "l"(addr));
727#else
728 // 32-bit pointer operand constraint for inlined asm
729 asm(" prefetch.L1 [ %1 ];" : "=r"(addr) : "r"(addr));
730#endif
731#elif (!EIGEN_COMP_MSVC) && (EIGEN_COMP_GNUC || EIGEN_COMP_CLANG || EIGEN_COMP_ICC)
732 __builtin_prefetch(addr);
733#endif
734}
735
736/** \internal \returns the reversed elements of \a a*/
737template<typename Packet> EIGEN_DEVICE_FUNC inline Packet preverse(const Packet& a)
738{ return a; }
739
740/** \internal \returns \a a with real and imaginary part flipped (for complex type only) */
741template<typename Packet> EIGEN_DEVICE_FUNC inline Packet pcplxflip(const Packet& a)
742{
743 return Packet(numext::imag(a),numext::real(a));
744}
745
746/**************************
747* Special math functions
748***************************/
749
750/** \internal \returns the sine of \a a (coeff-wise) */
752Packet psin(const Packet& a) { EIGEN_USING_STD(sin); return sin(a); }
753
754/** \internal \returns the cosine of \a a (coeff-wise) */
756Packet pcos(const Packet& a) { EIGEN_USING_STD(cos); return cos(a); }
757
758/** \internal \returns the tan of \a a (coeff-wise) */
760Packet ptan(const Packet& a) { EIGEN_USING_STD(tan); return tan(a); }
761
762/** \internal \returns the arc sine of \a a (coeff-wise) */
764Packet pasin(const Packet& a) { EIGEN_USING_STD(asin); return asin(a); }
765
766/** \internal \returns the arc cosine of \a a (coeff-wise) */
768Packet pacos(const Packet& a) { EIGEN_USING_STD(acos); return acos(a); }
769
770/** \internal \returns the arc tangent of \a a (coeff-wise) */
772Packet patan(const Packet& a) { EIGEN_USING_STD(atan); return atan(a); }
773
774/** \internal \returns the hyperbolic sine of \a a (coeff-wise) */
776Packet psinh(const Packet& a) { EIGEN_USING_STD(sinh); return sinh(a); }
777
778/** \internal \returns the hyperbolic cosine of \a a (coeff-wise) */
780Packet pcosh(const Packet& a) { EIGEN_USING_STD(cosh); return cosh(a); }
781
782/** \internal \returns the hyperbolic tan of \a a (coeff-wise) */
784Packet ptanh(const Packet& a) { EIGEN_USING_STD(tanh); return tanh(a); }
785
786/** \internal \returns the exp of \a a (coeff-wise) */
788Packet pexp(const Packet& a) { EIGEN_USING_STD(exp); return exp(a); }
789
790/** \internal \returns the expm1 of \a a (coeff-wise) */
792Packet pexpm1(const Packet& a) { return numext::expm1(a); }
793
794/** \internal \returns the log of \a a (coeff-wise) */
796Packet plog(const Packet& a) { EIGEN_USING_STD(log); return log(a); }
797
798/** \internal \returns the log1p of \a a (coeff-wise) */
800Packet plog1p(const Packet& a) { return numext::log1p(a); }
801
802/** \internal \returns the log10 of \a a (coeff-wise) */
804Packet plog10(const Packet& a) { EIGEN_USING_STD(log10); return log10(a); }
805
806/** \internal \returns the log10 of \a a (coeff-wise) */
808Packet plog2(const Packet& a) {
809 typedef typename internal::unpacket_traits<Packet>::type Scalar;
810 return pmul(pset1<Packet>(Scalar(EIGEN_LOG2E)), plog(a));
811}
812
813/** \internal \returns the square-root of \a a (coeff-wise) */
815Packet psqrt(const Packet& a) { return numext::sqrt(a); }
816
817/** \internal \returns the reciprocal square-root of \a a (coeff-wise) */
819Packet prsqrt(const Packet& a) {
820 typedef typename internal::unpacket_traits<Packet>::type Scalar;
821 return pdiv(pset1<Packet>(Scalar(1)), psqrt(a));
822}
823
824/** \internal \returns the rounded value of \a a (coeff-wise) */
826Packet pround(const Packet& a) { using numext::round; return round(a); }
827
828/** \internal \returns the floor of \a a (coeff-wise) */
830Packet pfloor(const Packet& a) { using numext::floor; return floor(a); }
831
832/** \internal \returns the rounded value of \a a (coeff-wise) with current
833 * rounding mode */
835Packet print(const Packet& a) { using numext::rint; return rint(a); }
836
837/** \internal \returns the ceil of \a a (coeff-wise) */
839Packet pceil(const Packet& a) { using numext::ceil; return ceil(a); }
840
841/** \internal \returns the first element of a packet */
842template<typename Packet>
844pfirst(const Packet& a)
845{ return a; }
846
847/** \internal \returns the sum of the elements of upper and lower half of \a a if \a a is larger than 4.
848 * For a packet {a0, a1, a2, a3, a4, a5, a6, a7}, it returns a half packet {a0+a4, a1+a5, a2+a6, a3+a7}
849 * For packet-size smaller or equal to 4, this boils down to a noop.
850 */
851template<typename Packet>
852EIGEN_DEVICE_FUNC inline typename conditional<(unpacket_traits<Packet>::size%8)==0,typename unpacket_traits<Packet>::half,Packet>::type
853predux_half_dowto4(const Packet& a)
854{ return a; }
855
856// Slow generic implementation of Packet reduction.
857template <typename Packet, typename Op>
859predux_helper(const Packet& a, Op op) {
860 typedef typename unpacket_traits<Packet>::type Scalar;
861 const size_t n = unpacket_traits<Packet>::size;
862 EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) Scalar elements[n];
863 pstoreu<Scalar>(elements, a);
864 for(size_t k = n / 2; k > 0; k /= 2) {
865 for(size_t i = 0; i < k; ++i) {
866 elements[i] = op(elements[i], elements[i + k]);
867 }
868 }
869 return elements[0];
870}
871
872/** \internal \returns the sum of the elements of \a a*/
873template<typename Packet>
875predux(const Packet& a)
876{
877 return a;
878}
879
880/** \internal \returns the product of the elements of \a a */
881template <typename Packet>
883 const Packet& a) {
884 typedef typename unpacket_traits<Packet>::type Scalar;
885 return predux_helper(a, EIGEN_BINARY_OP_NAN_PROPAGATION(Scalar, (pmul<Scalar>)));
886}
887
888/** \internal \returns the min of the elements of \a a */
889template <typename Packet>
891 const Packet &a) {
892 typedef typename unpacket_traits<Packet>::type Scalar;
893 return predux_helper(a, EIGEN_BINARY_OP_NAN_PROPAGATION(Scalar, (pmin<PropagateFast, Scalar>)));
894}
895
896template <int NaNPropagation, typename Packet>
898 const Packet& a) {
899 typedef typename unpacket_traits<Packet>::type Scalar;
900 return predux_helper(a, EIGEN_BINARY_OP_NAN_PROPAGATION(Scalar, (pmin<NaNPropagation, Scalar>)));
901}
902
903/** \internal \returns the min of the elements of \a a */
904template <typename Packet>
906 const Packet &a) {
907 typedef typename unpacket_traits<Packet>::type Scalar;
908 return predux_helper(a, EIGEN_BINARY_OP_NAN_PROPAGATION(Scalar, (pmax<PropagateFast, Scalar>)));
909}
910
911template <int NaNPropagation, typename Packet>
913 const Packet& a) {
914 typedef typename unpacket_traits<Packet>::type Scalar;
915 return predux_helper(a, EIGEN_BINARY_OP_NAN_PROPAGATION(Scalar, (pmax<NaNPropagation, Scalar>)));
916}
917
918#undef EIGEN_BINARY_OP_NAN_PROPAGATION
919
920/** \internal \returns true if all coeffs of \a a means "true"
921 * It is supposed to be called on values returned by pcmp_*.
922 */
923// not needed yet
924// template<typename Packet> EIGEN_DEVICE_FUNC inline bool predux_all(const Packet& a)
925// { return bool(a); }
926
927/** \internal \returns true if any coeffs of \a a means "true"
928 * It is supposed to be called on values returned by pcmp_*.
929 */
930template<typename Packet> EIGEN_DEVICE_FUNC inline bool predux_any(const Packet& a)
931{
932 // Dirty but generic implementation where "true" is assumed to be non 0 and all the sames.
933 // It is expected that "true" is either:
934 // - Scalar(1)
935 // - bits full of ones (NaN for floats),
936 // - or first bit equals to 1 (1 for ints, smallest denormal for floats).
937 // For all these cases, taking the sum is just fine, and this boils down to a no-op for scalars.
938 typedef typename unpacket_traits<Packet>::type Scalar;
939 return numext::not_equal_strict(predux(a), Scalar(0));
940}
941
942/***************************************************************************
943* The following functions might not have to be overwritten for vectorized types
944***************************************************************************/
945
946/** \internal copy a packet with constant coefficient \a a (e.g., [a,a,a,a]) to \a *to. \a to must be 16 bytes aligned */
947// NOTE: this function must really be templated on the packet type (think about different packet types for the same scalar type)
948template<typename Packet>
949inline void pstore1(typename unpacket_traits<Packet>::type* to, const typename unpacket_traits<Packet>::type& a)
950{
951 pstore(to, pset1<Packet>(a));
952}
953
954/** \internal \returns a * b + c (coeff-wise) */
955template<typename Packet> EIGEN_DEVICE_FUNC inline Packet
956pmadd(const Packet& a,
957 const Packet& b,
958 const Packet& c)
959{ return padd(pmul(a, b),c); }
960
961/** \internal \returns a packet version of \a *from.
962 * The pointer \a from must be aligned on a \a Alignment bytes boundary. */
963template<typename Packet, int Alignment>
965{
967 return pload<Packet>(from);
968 else
969 return ploadu<Packet>(from);
970}
971
972/** \internal copy the packet \a from to \a *to.
973 * The pointer \a from must be aligned on a \a Alignment bytes boundary. */
974template<typename Scalar, typename Packet, int Alignment>
975EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void pstoret(Scalar* to, const Packet& from)
976{
978 pstore(to, from);
979 else
980 pstoreu(to, from);
981}
982
983/** \internal \returns a packet version of \a *from.
984 * Unlike ploadt, ploadt_ro takes advantage of the read-only memory path on the
985 * hardware if available to speedup the loading of data that won't be modified
986 * by the current computation.
987 */
988template<typename Packet, int LoadMode>
990{
991 return ploadt<Packet, LoadMode>(from);
992}
993
994/***************************************************************************
995* Fast complex products (GCC generates a function call which is very slow)
996***************************************************************************/
997
998// Eigen+CUDA does not support complexes.
999#if !defined(EIGEN_GPUCC)
1000
1001template<> inline std::complex<float> pmul(const std::complex<float>& a, const std::complex<float>& b)
1002{ return std::complex<float>(a.real()*b.real() - a.imag()*b.imag(), a.imag()*b.real() + a.real()*b.imag()); }
1003
1004template<> inline std::complex<double> pmul(const std::complex<double>& a, const std::complex<double>& b)
1005{ return std::complex<double>(a.real()*b.real() - a.imag()*b.imag(), a.imag()*b.real() + a.real()*b.imag()); }
1006
1007#endif
1008
1009
1010/***************************************************************************
1011 * PacketBlock, that is a collection of N packets where the number of words
1012 * in the packet is a multiple of N.
1013***************************************************************************/
1015 Packet packet[N];
1016};
1017
1018template<typename Packet> EIGEN_DEVICE_FUNC inline void
1020 // Nothing to do in the scalar case, i.e. a 1x1 matrix.
1021}
1022
1023/***************************************************************************
1024 * Selector, i.e. vector of N boolean values used to select (i.e. blend)
1025 * words from 2 packets.
1026***************************************************************************/
1027template <size_t N> struct Selector {
1028 bool select[N];
1029};
1030
1031template<typename Packet> EIGEN_DEVICE_FUNC inline Packet
1032pblend(const Selector<unpacket_traits<Packet>::size>& ifPacket, const Packet& thenPacket, const Packet& elsePacket) {
1033 return ifPacket.select[0] ? thenPacket : elsePacket;
1034}
1035
1036} // end namespace internal
1037
1038} // end namespace Eigen
1039
1040#endif // EIGEN_GENERIC_PACKET_MATH_H
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const ArgReturnType arg() const
Definition: ArrayCwiseUnaryOps.h:66
EIGEN_DEVICE_FUNC const RintReturnType rint() const
Definition: ArrayCwiseUnaryOps.h:453
EIGEN_DEVICE_FUNC RealReturnType real() const
Definition: CommonCwiseUnaryOps.h:100
EIGEN_DEVICE_FUNC const ImagReturnType imag() const
Definition: CommonCwiseUnaryOps.h:109
#define EIGEN_BINARY_OP_NAN_PROPAGATION(Type, Func)
Definition: GenericPacketMath.h:502
#define EIGEN_ALWAYS_INLINE
Definition: Macros.h:942
#define EIGEN_USING_STD(FUNC)
Definition: Macros.h:1195
#define EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
Definition: Macros.h:994
#define EIGEN_CONSTEXPR
Definition: Macros.h:797
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:986
#define EIGEN_STRONG_INLINE
Definition: Macros.h:927
#define EIGEN_LOG2E
Definition: MathFunctions.h:17
and restrictions which apply to each piece of software is included later in this file and or inside of the individual applicable source files The disclaimer of warranty in the WPILib license above applies to all code in and nothing in any of the other licenses gives permission to use the names of FIRST nor the names of the WPILib contributors to endorse or promote products derived from this software The following pieces of software have additional or alternate and or Google Inc All rights reserved Redistribution and use in source and binary with or without are permitted provided that the following conditions are this list of conditions and the following disclaimer *Redistributions in binary form must reproduce the above copyright this list of conditions and the following disclaimer in the documentation and or other materials provided with the distribution *Neither the name of Google Inc nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS OR IMPLIED BUT NOT LIMITED THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY OR CONSEQUENTIAL WHETHER IN STRICT OR EVEN IF ADVISED OF THE POSSIBILITY OF SUCH January AND DISTRIBUTION Definitions License shall mean the terms and conditions for and distribution as defined by Sections through of this document Licensor shall mean the copyright owner or entity authorized by the copyright owner that is granting the License Legal Entity shall mean the union of the acting entity and all other entities that control are controlled by or are under common control with that entity For the purposes of this definition control direct or to cause the direction or management of such whether by contract or including but not limited to software source documentation and configuration files Object form shall mean any form resulting from mechanical transformation or translation of a Source including but not limited to compiled object generated and conversions to other media types Work shall mean the work of whether in Source or Object made available under the as indicated by a copyright notice that is included in or attached to the whether in Source or Object that is based or other modifications as a an original work of authorship For the purposes of this Derivative Works shall not include works that remain separable from
Definition: ThirdPartyNotices.txt:128
Definition: core.h:1240
type
Definition: core.h:575
dimensionless::scalar_t sinh(const AngleUnit angle) noexcept
Compute hyperbolic sine.
Definition: math.h:226
UnitType round(const UnitType x) noexcept
Round to nearest.
Definition: math.h:591
angle::radian_t asin(const ScalarUnit x) noexcept
Compute arc sine.
Definition: math.h:137
angle::radian_t acos(const ScalarUnit x) noexcept
Compute arc cosine.
Definition: math.h:119
dimensionless::scalar_t expm1(const ScalarUnit x) noexcept
Compute exponential minus one.
Definition: math.h:420
dimensionless::scalar_t cosh(const AngleUnit angle) noexcept
Compute hyperbolic cosine.
Definition: math.h:206
angle::radian_t atan(const ScalarUnit x) noexcept
Compute arc tangent.
Definition: math.h:159
dimensionless::scalar_t cos(const AngleUnit angle) noexcept
Compute cosine.
Definition: math.h:61
dimensionless::scalar_t tanh(const AngleUnit angle) noexcept
Compute hyperbolic tangent.
Definition: math.h:246
UnitType floor(const UnitType x) noexcept
Round down value.
Definition: math.h:542
dimensionless::scalar_t log(const ScalarUnit x) noexcept
Compute natural logarithm.
Definition: math.h:349
dimensionless::scalar_t log1p(const ScalarUnit x) noexcept
Compute logarithm plus one.
Definition: math.h:437
dimensionless::scalar_t log10(const ScalarUnit x) noexcept
Compute common logarithm.
Definition: math.h:365
dimensionless::scalar_t sin(const AngleUnit angle) noexcept
Compute sine.
Definition: math.h:81
UnitType ceil(const UnitType x) noexcept
Round up value.
Definition: math.h:528
@ PropagateNaN
Always propagate NaNs.
Definition: Constants.h:343
@ PropagateNumbers
Always propagate not-NaNs.
Definition: Constants.h:345
@ Target
Definition: Constants.h:492
EIGEN_STRONG_INLINE Packet8f pcmp_lt_or_nan(const Packet8f &a, const Packet8f &b)
Definition: PacketMath.h:347
EIGEN_STRONG_INLINE Packet8f pblend(const Selector< 8 > &ifPacket, const Packet8f &thenPacket, const Packet8f &elsePacket)
Definition: PacketMath.h:921
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pexpm1(const Packet &a)
Definition: GenericPacketMath.h:792
EIGEN_DEVICE_FUNC unpacket_traits< Packet >::type predux_min(const Packet &a)
Definition: GenericPacketMath.h:890
EIGEN_DEVICE_FUNC TgtPacket pcast(const SrcPacket &a)
Definition: GenericPacketMath.h:188
EIGEN_STRONG_INLINE Packet8f pcmp_eq(const Packet8f &a, const Packet8f &b)
Definition: PacketMath.h:348
EIGEN_DEVICE_FUNC Packet padd(const Packet &a, const Packet &b)
Definition: GenericPacketMath.h:215
EIGEN_DEVICE_FUNC void ptranspose(PacketBlock< Packet8f, 8 > &kernel)
Definition: PacketMath.h:863
EIGEN_DEVICE_FUNC unpacket_traits< Packet >::type predux_helper(const Packet &a, Op op)
Definition: GenericPacketMath.h:859
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet plog10(const Packet &a)
Definition: GenericPacketMath.h:804
EIGEN_DEVICE_FUNC unpacket_traits< Packet >::type predux(const Packet &a)
Definition: GenericPacketMath.h:875
EIGEN_STRONG_INLINE Packet8f pzero(const Packet8f &)
Definition: PacketMath.h:247
EIGEN_STRONG_INLINE Packet8h pselect(const Packet8h &mask, const Packet8h &a, const Packet8h &b)
Definition: PacketMath.h:1057
EIGEN_DEVICE_FUNC Packet parg(const Packet &a)
Definition: GenericPacketMath.h:551
EIGEN_STRONG_INLINE Packet8i plogical_shift_left(Packet8i a)
Definition: PacketMath.h:567
EIGEN_DEVICE_FUNC void pbroadcast4(const typename unpacket_traits< Packet >::type *a, Packet &a0, Packet &a1, Packet &a2, Packet &a3)
Definition: GenericPacketMath.h:653
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet plog2(const Packet &a)
Definition: GenericPacketMath.h:808
EIGEN_DEVICE_FUNC Packet pset1frombits(BitsType a)
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet plog(const Packet &a)
Definition: GenericPacketMath.h:796
EIGEN_STRONG_INLINE Packet4i pmadd(const Packet4i &a, const Packet4i &b, const Packet4i &c)
Definition: PacketMath.h:370
EIGEN_DEVICE_FUNC Packet pdiv(const Packet &a, const Packet &b)
Definition: GenericPacketMath.h:244
EIGEN_DEVICE_FUNC Packet pgather(const Scalar *from, Index)
Definition: GenericPacketMath.h:712
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pexp(const Packet &a)
Definition: GenericPacketMath.h:788
EIGEN_STRONG_INLINE Packet8f pabs(const Packet8f &a)
Definition: PacketMath.h:725
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pcos(const Packet &a)
Definition: GenericPacketMath.h:756
EIGEN_DEVICE_FUNC void prefetch(const Scalar *addr)
Definition: GenericPacketMath.h:719
EIGEN_STRONG_INLINE Packet8f pcmp_le(const Packet8f &a, const Packet8f &b)
Definition: PacketMath.h:345
EIGEN_STRONG_INLINE Packet4f print(const Packet4f &a)
Definition: PacketMath.h:646
EIGEN_DEVICE_FUNC Packet ploadu(const typename unpacket_traits< Packet >::type *from)
Definition: GenericPacketMath.h:603
EIGEN_DEVICE_FUNC Packet pmax(const Packet &a, const Packet &b)
Definition: GenericPacketMath.h:524
EIGEN_DEVICE_FUNC Packet pnot(const Packet &a)
Definition: GenericPacketMath.h:425
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet psin(const Packet &a)
Definition: GenericPacketMath.h:752
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pacos(const Packet &a)
Definition: GenericPacketMath.h:768
EIGEN_DEVICE_FUNC Target preinterpret(const Packet &a)
EIGEN_DEVICE_FUNC bool pselect< bool >(const bool &cond, const bool &a, const bool &b)
Definition: GenericPacketMath.h:456
EIGEN_STRONG_INLINE Packet8h por(const Packet8h &a, const Packet8h &b)
Definition: PacketMath.h:1042
EIGEN_STRONG_INLINE Packet8i plogical_shift_right(Packet8i a)
Definition: PacketMath.h:557
EIGEN_STRONG_INLINE Packet8f pcmp_lt(const Packet8f &a, const Packet8f &b)
Definition: PacketMath.h:346
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet ptan(const Packet &a)
Definition: GenericPacketMath.h:760
EIGEN_DEVICE_FUNC unpacket_traits< Packet >::type predux_mul(const Packet &a)
Definition: GenericPacketMath.h:882
EIGEN_STRONG_INLINE Packet8f pconj(const Packet8f &a)
Definition: PacketMath.h:295
EIGEN_STRONG_INLINE Packet2cf pcplxflip(const Packet2cf &x)
Definition: Complex.h:168
EIGEN_DEVICE_FUNC Packet pmul(const Packet &a, const Packet &b)
Definition: GenericPacketMath.h:237
EIGEN_STRONG_INLINE Packet8h ptrue(const Packet8h &a)
Definition: PacketMath.h:978
EIGEN_DEVICE_FUNC Packet pmin(const Packet &a, const Packet &b)
Definition: GenericPacketMath.h:512
EIGEN_STRONG_INLINE Packet8h pandnot(const Packet8h &a, const Packet8h &b)
Definition: PacketMath.h:1053
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pcosh(const Packet &a)
Definition: GenericPacketMath.h:780
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pround(const Packet &a)
Definition: GenericPacketMath.h:826
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet ptanh(const Packet &a)
Definition: GenericPacketMath.h:784
EIGEN_DEVICE_FUNC Packet paddsub(const Packet &a, const Packet &b)
Definition: GenericPacketMath.h:545
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void pstoret(Scalar *to, const Packet &from)
Definition: GenericPacketMath.h:975
EIGEN_DEVICE_FUNC void pscatter(Scalar *to, const Packet &from, Index)
Definition: GenericPacketMath.h:715
EIGEN_DEVICE_FUNC Packet pabsdiff(const Packet &a, const Packet &b)
Definition: GenericPacketMath.h:595
EIGEN_DEVICE_FUNC unpacket_traits< Packet >::type predux_max(const Packet &a)
Definition: GenericPacketMath.h:905
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pceil(const Packet &a)
Definition: GenericPacketMath.h:839
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet plog1p(const Packet &a)
Definition: GenericPacketMath.h:800
EIGEN_STRONG_INLINE Packet8i parithmetic_shift_right(Packet8i a)
Definition: PacketMath.h:547
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet ploaddup(const typename unpacket_traits< Packet >::type *from)
Definition: GenericPacketMath.h:631
EIGEN_CONSTEXPR Index size(const T &x)
Definition: Meta.h:479
EIGEN_STRONG_INLINE Packet8f peven_mask(const Packet8f &)
Definition: PacketMath.h:252
EIGEN_DEVICE_FUNC void pstore(Scalar *to, const Packet &from)
Definition: GenericPacketMath.h:696
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet4c predux_half_dowto4(const Packet8c &a)
Definition: PacketMath.h:2478
EIGEN_STRONG_INLINE Packet8h pldexp(const Packet8h &a, const Packet8h &exponent)
Definition: MathFunctions.h:196
EIGEN_STRONG_INLINE bool predux_any(const Packet8f &x)
Definition: PacketMath.h:857
EIGEN_DEVICE_FUNC void pstoreu(Scalar *to, const Packet &from)
Definition: GenericPacketMath.h:700
EIGEN_STRONG_INLINE Packet8h pand(const Packet8h &a, const Packet8h &b)
Definition: PacketMath.h:1050
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Packet ploadt(const typename unpacket_traits< Packet >::type *from)
Definition: GenericPacketMath.h:964
EIGEN_STRONG_INLINE Packet8h pxor(const Packet8h &a, const Packet8h &b)
Definition: PacketMath.h:1047
EIGEN_DEVICE_FUNC void pbroadcast2(const typename unpacket_traits< Packet >::type *a, Packet &a0, Packet &a1)
Definition: GenericPacketMath.h:670
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet psinh(const Packet &a)
Definition: GenericPacketMath.h:776
EIGEN_DEVICE_FUNC unpacket_traits< Packet >::type pfirst(const Packet &a)
Definition: GenericPacketMath.h:844
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pasin(const Packet &a)
Definition: GenericPacketMath.h:764
EIGEN_DEVICE_FUNC Packet psub(const Packet &a, const Packet &b)
Definition: GenericPacketMath.h:222
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet plset(const typename unpacket_traits< Packet >::type &a)
Definition: GenericPacketMath.h:679
EIGEN_STRONG_INLINE Packet8h pfrexp(const Packet8h &a, Packet8h &exponent)
Definition: MathFunctions.h:188
EIGEN_STRONG_INLINE Packet8f preverse(const Packet8f &a)
Definition: PacketMath.h:707
EIGEN_DEVICE_FUNC Packet pload1(const typename unpacket_traits< Packet >::type *a)
Definition: GenericPacketMath.h:623
void pstore1(typename unpacket_traits< Packet >::type *to, const typename unpacket_traits< Packet >::type &a)
Definition: GenericPacketMath.h:949
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Packet ploadt_ro(const typename unpacket_traits< Packet >::type *from)
Definition: GenericPacketMath.h:989
EIGEN_DEVICE_FUNC Packet pload(const typename unpacket_traits< Packet >::type *from)
Definition: GenericPacketMath.h:599
EIGEN_STRONG_INLINE Packet4f prsqrt(const Packet4f &a)
Definition: PacketMath.h:3276
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet patan(const Packet &a)
Definition: GenericPacketMath.h:772
EIGEN_DEVICE_FUNC Packet ploadquad(const typename unpacket_traits< Packet >::type *from)
Definition: GenericPacketMath.h:640
EIGEN_STRONG_INLINE Packet8f pnegate(const Packet8f &a)
Definition: PacketMath.h:286
EIGEN_STRONG_INLINE Packet4uc psqrt(const Packet4uc &a)
Computes the integer square root.
Definition: PacketMath.h:3191
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pfloor(const Packet &a)
Definition: GenericPacketMath.h:830
EIGEN_DEVICE_FUNC Packet pset1(const typename unpacket_traits< Packet >::type &a)
Definition: GenericPacketMath.h:615
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bool equal_strict(const X &x, const Y &y)
Definition: Meta.h:787
EIGEN_DEVICE_FUNC T() floor(const T &x)
Definition: MathFunctions.h:1400
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T maxi(const T &x, const T &y)
Definition: MathFunctions.h:1091
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bool not_equal_strict(const X &x, const Y &y)
Definition: Meta.h:798
EIGEN_DEVICE_FUNC T() ceil(const T &x)
Definition: MathFunctions.h:1420
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE float sqrt(const float &x)
Definition: MathFunctions.h:177
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T mini(const T &x, const T &y)
Definition: MathFunctions.h:1083
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE internal::enable_if< NumTraits< T >::IsSigned||NumTraits< T >::IsComplex, typenameNumTraits< T >::Real >::type abs(const T &x)
Definition: MathFunctions.h:1509
Namespace containing all symbols from the Eigen library.
Definition: Core:141
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:74
result
Definition: format.h:2564
Definition: Eigen_Colamd.h:50
static constexpr const velocity::meters_per_second_t c(299792458.0)
Speed of light in vacuum.
b
Definition: data.h:44
Definition: GenericPacketMath.h:1014
Packet packet[N]
Definition: GenericPacketMath.h:1015
Definition: GenericPacketMath.h:1027
bool select[N]
Definition: GenericPacketMath.h:1028
Definition: GenericPacketMath.h:317
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_ALWAYS_INLINE T operator()(const T &a, const T &b) const
Definition: GenericPacketMath.h:318
Definition: GenericPacketMath.h:338
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_ALWAYS_INLINE T operator()(const T &a) const
Definition: GenericPacketMath.h:339
Definition: GenericPacketMath.h:324
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_ALWAYS_INLINE T operator()(const T &a, const T &b) const
Definition: GenericPacketMath.h:325
Definition: GenericPacketMath.h:331
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_ALWAYS_INLINE T operator()(const T &a, const T &b) const
Definition: GenericPacketMath.h:332
Definition: GenericPacketMath.h:396
Definition: GenericPacketMath.h:355
static EIGEN_DEVICE_FUNC T bitwise_xor(const T &a, const T &b)
Definition: GenericPacketMath.h:362
static EIGEN_DEVICE_FUNC T bitwise_not(const T &a)
Definition: GenericPacketMath.h:365
static EIGEN_DEVICE_FUNC T bitwise_and(const T &a, const T &b)
Definition: GenericPacketMath.h:356
static EIGEN_DEVICE_FUNC T bitwise_or(const T &a, const T &b)
Definition: GenericPacketMath.h:359
Definition: GenericPacketMath.h:43
@ HasSign
Definition: GenericPacketMath.h:102
@ HasZeta
Definition: GenericPacketMath.h:86
@ HasASin
Definition: GenericPacketMath.h:78
@ HasIGamma
Definition: GenericPacketMath.h:92
@ HasSub
Definition: GenericPacketMath.h:48
@ HasRsqrt
Definition: GenericPacketMath.h:67
@ HasSin
Definition: GenericPacketMath.h:75
@ HasBlend
Definition: GenericPacketMath.h:60
@ HasLog10
Definition: GenericPacketMath.h:72
@ HasTan
Definition: GenericPacketMath.h:77
@ HasErfc
Definition: GenericPacketMath.h:89
@ HasACos
Definition: GenericPacketMath.h:79
@ HasAbsDiff
Definition: GenericPacketMath.h:55
@ HasMin
Definition: GenericPacketMath.h:56
@ HasArg
Definition: GenericPacketMath.h:53
@ HasNdtri
Definition: GenericPacketMath.h:90
@ HasCos
Definition: GenericPacketMath.h:76
@ HasSinh
Definition: GenericPacketMath.h:81
@ HasPolygamma
Definition: GenericPacketMath.h:87
@ HasCmp
Definition: GenericPacketMath.h:63
@ HasDiGamma
Definition: GenericPacketMath.h:85
@ HasConj
Definition: GenericPacketMath.h:58
@ HasSetLinear
Definition: GenericPacketMath.h:59
@ HasShift
Definition: GenericPacketMath.h:49
@ HasLog1p
Definition: GenericPacketMath.h:71
@ HasMax
Definition: GenericPacketMath.h:57
@ HasPow
Definition: GenericPacketMath.h:73
@ HasIGammac
Definition: GenericPacketMath.h:95
@ HasCeil
Definition: GenericPacketMath.h:101
@ HasNegate
Definition: GenericPacketMath.h:51
@ HasAdd
Definition: GenericPacketMath.h:47
@ HasExp
Definition: GenericPacketMath.h:68
@ HasRound
Definition: GenericPacketMath.h:98
@ HasRint
Definition: GenericPacketMath.h:99
@ HasBetaInc
Definition: GenericPacketMath.h:96
@ HasSqrt
Definition: GenericPacketMath.h:66
@ HasLGamma
Definition: GenericPacketMath.h:84
@ HasErf
Definition: GenericPacketMath.h:88
@ HasBessel
Definition: GenericPacketMath.h:91
@ HasAbs
Definition: GenericPacketMath.h:52
@ HasCosh
Definition: GenericPacketMath.h:82
@ HasExpm1
Definition: GenericPacketMath.h:69
@ HasLog
Definition: GenericPacketMath.h:70
@ HasTanh
Definition: GenericPacketMath.h:83
@ HasMul
Definition: GenericPacketMath.h:50
@ HasAbs2
Definition: GenericPacketMath.h:54
@ HasGammaSampleDerAlpha
Definition: GenericPacketMath.h:94
@ HasIGammaDerA
Definition: GenericPacketMath.h:93
@ HasATan
Definition: GenericPacketMath.h:80
@ HasFloor
Definition: GenericPacketMath.h:100
@ HasHalfPacket
Definition: GenericPacketMath.h:45
@ HasDiv
Definition: GenericPacketMath.h:65
Definition: GenericPacketMath.h:160
EIGEN_ALWAYS_INLINE eigen_packet_wrapper & operator=(const T &v)
Definition: GenericPacketMath.h:165
EIGEN_ALWAYS_INLINE eigen_packet_wrapper(const T &v)
Definition: GenericPacketMath.h:164
EIGEN_ALWAYS_INLINE eigen_packet_wrapper()
Definition: GenericPacketMath.h:163
T m_val
Definition: GenericPacketMath.h:170
Definition: Meta.h:273
Definition: Meta.h:148
Definition: GenericPacketMath.h:178
unpacket_traits< Packet >::type Scalar
Definition: GenericPacketMath.h:179
Definition: GenericPacketMath.h:346
static EIGEN_DEVICE_FUNC T bitwise_not(const T &a)
Definition: GenericPacketMath.h:350
static EIGEN_DEVICE_FUNC T bitwise_xor(const T &a, const T &b)
Definition: GenericPacketMath.h:349
static EIGEN_DEVICE_FUNC T bitwise_and(const T &a, const T &b)
Definition: GenericPacketMath.h:347
static EIGEN_DEVICE_FUNC T bitwise_or(const T &a, const T &b)
Definition: GenericPacketMath.h:348
Definition: GenericPacketMath.h:107
T type
Definition: GenericPacketMath.h:108
@ HasHalfPacket
Definition: GenericPacketMath.h:114
@ size
Definition: GenericPacketMath.h:112
@ AlignedOnScalar
Definition: GenericPacketMath.h:113
@ Vectorizable
Definition: GenericPacketMath.h:111
T half
Definition: GenericPacketMath.h:109
@ HasSub
Definition: GenericPacketMath.h:118
@ HasMax
Definition: GenericPacketMath.h:124
@ HasNegate
Definition: GenericPacketMath.h:120
@ HasMul
Definition: GenericPacketMath.h:119
@ HasAdd
Definition: GenericPacketMath.h:117
@ HasSetLinear
Definition: GenericPacketMath.h:126
@ HasMin
Definition: GenericPacketMath.h:123
@ HasConj
Definition: GenericPacketMath.h:125
@ HasAbs2
Definition: GenericPacketMath.h:122
@ HasAbs
Definition: GenericPacketMath.h:121
static EIGEN_DEVICE_FUNC Packet run(const Packet &a, const Packet &b, Op op)
Definition: GenericPacketMath.h:476
static EIGEN_DEVICE_FUNC Packet run(const Packet &a, const Packet &b, Op op)
Definition: GenericPacketMath.h:491
Definition: GenericPacketMath.h:464
static EIGEN_DEVICE_FUNC Packet run(const Packet &a, const Packet &b, Op op)
Definition: GenericPacketMath.h:466
static EIGEN_DEVICE_FUNC Packet run(const Packet &mask, const Packet &a, const Packet &b)
Definition: GenericPacketMath.h:445
Definition: GenericPacketMath.h:435
static EIGEN_DEVICE_FUNC Packet run(const Packet &mask, const Packet &a, const Packet &b)
Definition: GenericPacketMath.h:436
Definition: GenericPacketMath.h:248
static EIGEN_DEVICE_FUNC Packet run(const Packet &)
Definition: GenericPacketMath.h:249
static EIGEN_DEVICE_FUNC T run(const T &)
Definition: GenericPacketMath.h:289
Definition: GenericPacketMath.h:276
static EIGEN_DEVICE_FUNC Packet run(const Packet &)
Definition: GenericPacketMath.h:277
Definition: GenericPacketMath.h:148
@ TgtCoeffRatio
Definition: GenericPacketMath.h:152
@ VectorizedCast
Definition: GenericPacketMath.h:150
@ SrcCoeffRatio
Definition: GenericPacketMath.h:151
Definition: GenericPacketMath.h:133
T type
Definition: GenericPacketMath.h:134
T half
Definition: GenericPacketMath.h:135
@ masked_load_available
Definition: GenericPacketMath.h:141
@ size
Definition: GenericPacketMath.h:138
@ masked_store_available
Definition: GenericPacketMath.h:142
@ vectorizable
Definition: GenericPacketMath.h:140
@ alignment
Definition: GenericPacketMath.h:139