BinaryFunctors.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_BINARY_FUNCTORS_H
11 #define EIGEN_BINARY_FUNCTORS_H
12 
13 // IWYU pragma: private
14 #include "../InternalHeaderCheck.h"
15 
16 namespace Eigen {
17 
18 namespace internal {
19 
20 //---------- associative binary functors ----------
21 
22 template <typename Arg1, typename Arg2>
24  typedef Arg1 first_argument_type;
25  typedef Arg2 second_argument_type;
26 };
27 
33 template <typename LhsScalar, typename RhsScalar>
34 struct scalar_sum_op : binary_op_base<LhsScalar, RhsScalar> {
36 #ifdef EIGEN_SCALAR_BINARY_OP_PLUGIN
38 #endif
40  operator()(const LhsScalar& a, const RhsScalar& b) const {
41  return a + b;
42  }
43  template <typename Packet>
45  return internal::padd(a, b);
46  }
47  template <typename Packet>
49  return internal::predux(a);
50  }
51 };
52 template <typename LhsScalar, typename RhsScalar>
53 struct functor_traits<scalar_sum_op<LhsScalar, RhsScalar>> {
54  enum {
56  PacketAccess =
58  // TODO vectorize mixed sum
59  };
60 };
61 
62 template <>
64  return a || b;
65 }
66 
72 template <typename LhsScalar, typename RhsScalar>
73 struct scalar_product_op : binary_op_base<LhsScalar, RhsScalar> {
75 #ifdef EIGEN_SCALAR_BINARY_OP_PLUGIN
77 #endif
79  operator()(const LhsScalar& a, const RhsScalar& b) const {
80  return a * b;
81  }
82  template <typename Packet>
84  return internal::pmul(a, b);
85  }
86  template <typename Packet>
88  return internal::predux_mul(a);
89  }
90 };
91 template <typename LhsScalar, typename RhsScalar>
92 struct functor_traits<scalar_product_op<LhsScalar, RhsScalar>> {
93  enum {
95  PacketAccess =
97  // TODO vectorize mixed product
98  };
99 };
100 
101 template <>
103  const bool& b) const {
104  return a && b;
105 }
106 
113 template <typename LhsScalar, typename RhsScalar>
114 struct scalar_conj_product_op : binary_op_base<LhsScalar, RhsScalar> {
116 
118 
119  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator()(const LhsScalar& a, const RhsScalar& b) const {
121  }
122 
123  template <typename Packet>
126  }
127 };
128 template <typename LhsScalar, typename RhsScalar>
129 struct functor_traits<scalar_conj_product_op<LhsScalar, RhsScalar>> {
130  enum {
133  };
134 };
135 
141 template <typename LhsScalar, typename RhsScalar, int NaNPropagation>
142 struct scalar_min_op : binary_op_base<LhsScalar, RhsScalar> {
144  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator()(const LhsScalar& a, const RhsScalar& b) const {
145  return internal::pmin<NaNPropagation>(a, b);
146  }
147  template <typename Packet>
149  return internal::pmin<NaNPropagation>(a, b);
150  }
151  template <typename Packet>
153  return internal::predux_min<NaNPropagation>(a);
154  }
155 };
156 
157 template <typename LhsScalar, typename RhsScalar, int NaNPropagation>
158 struct functor_traits<scalar_min_op<LhsScalar, RhsScalar, NaNPropagation>> {
159  enum {
162  };
163 };
164 
170 template <typename LhsScalar, typename RhsScalar, int NaNPropagation>
171 struct scalar_max_op : binary_op_base<LhsScalar, RhsScalar> {
173  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator()(const LhsScalar& a, const RhsScalar& b) const {
174  return internal::pmax<NaNPropagation>(a, b);
175  }
176  template <typename Packet>
178  return internal::pmax<NaNPropagation>(a, b);
179  }
180  template <typename Packet>
182  return internal::predux_max<NaNPropagation>(a);
183  }
184 };
185 
186 template <typename LhsScalar, typename RhsScalar, int NaNPropagation>
187 struct functor_traits<scalar_max_op<LhsScalar, RhsScalar, NaNPropagation>> {
188  enum {
191  };
192 };
193 
198 template <typename LhsScalar, typename RhsScalar, ComparisonName cmp, bool UseTypedComparators = false>
200 
201 template <typename LhsScalar, typename RhsScalar, ComparisonName cmp, bool UseTypedComparators>
202 struct functor_traits<scalar_cmp_op<LhsScalar, RhsScalar, cmp, UseTypedComparators>> {
203  enum {
207  };
208 };
209 
210 template <typename LhsScalar, typename RhsScalar, bool UseTypedComparators>
214  static constexpr bool UseTyped = UseTypedComparators && SameType && IsNumeric;
216 };
217 
218 template <typename LhsScalar, typename RhsScalar, bool UseTypedComparators>
220 
221 template <typename LhsScalar, typename RhsScalar, bool UseTypedComparators>
222 struct scalar_cmp_op<LhsScalar, RhsScalar, cmp_EQ, UseTypedComparators> : binary_op_base<LhsScalar, RhsScalar> {
224  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator()(const LhsScalar& a, const RhsScalar& b) const {
225  return a == b ? result_type(1) : result_type(0);
226  }
227  template <typename Packet>
229  const Packet cst_one = pset1<Packet>(result_type(1));
230  return pand(pcmp_eq(a, b), cst_one);
231  }
232 };
233 
234 template <typename LhsScalar, typename RhsScalar, bool UseTypedComparators>
235 struct scalar_cmp_op<LhsScalar, RhsScalar, cmp_LT, UseTypedComparators> : binary_op_base<LhsScalar, RhsScalar> {
237  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator()(const LhsScalar& a, const RhsScalar& b) const {
238  return a < b ? result_type(1) : result_type(0);
239  }
240  template <typename Packet>
242  const Packet cst_one = pset1<Packet>(result_type(1));
243  return pand(pcmp_lt(a, b), cst_one);
244  }
245 };
246 
247 template <typename LhsScalar, typename RhsScalar, bool UseTypedComparators>
248 struct scalar_cmp_op<LhsScalar, RhsScalar, cmp_LE, UseTypedComparators> : binary_op_base<LhsScalar, RhsScalar> {
250  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator()(const LhsScalar& a, const RhsScalar& b) const {
251  return a <= b ? result_type(1) : result_type(0);
252  }
253  template <typename Packet>
255  const Packet cst_one = pset1<Packet>(result_type(1));
256  return pand(cst_one, pcmp_le(a, b));
257  }
258 };
259 
260 template <typename LhsScalar, typename RhsScalar, bool UseTypedComparators>
261 struct scalar_cmp_op<LhsScalar, RhsScalar, cmp_GT, UseTypedComparators> : binary_op_base<LhsScalar, RhsScalar> {
263  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator()(const LhsScalar& a, const RhsScalar& b) const {
264  return a > b ? result_type(1) : result_type(0);
265  }
266  template <typename Packet>
268  const Packet cst_one = pset1<Packet>(result_type(1));
269  return pand(cst_one, pcmp_lt(b, a));
270  }
271 };
272 
273 template <typename LhsScalar, typename RhsScalar, bool UseTypedComparators>
274 struct scalar_cmp_op<LhsScalar, RhsScalar, cmp_GE, UseTypedComparators> : binary_op_base<LhsScalar, RhsScalar> {
276  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator()(const LhsScalar& a, const RhsScalar& b) const {
277  return a >= b ? result_type(1) : result_type(0);
278  }
279  template <typename Packet>
281  const Packet cst_one = pset1<Packet>(result_type(1));
282  return pand(cst_one, pcmp_le(b, a));
283  }
284 };
285 
286 template <typename LhsScalar, typename RhsScalar, bool UseTypedComparators>
287 struct scalar_cmp_op<LhsScalar, RhsScalar, cmp_UNORD, UseTypedComparators> : binary_op_base<LhsScalar, RhsScalar> {
289  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator()(const LhsScalar& a, const RhsScalar& b) const {
290  return !(a <= b || b <= a) ? result_type(1) : result_type(0);
291  }
292  template <typename Packet>
294  const Packet cst_one = pset1<Packet>(result_type(1));
295  return pandnot(cst_one, por(pcmp_le(a, b), pcmp_le(b, a)));
296  }
297 };
298 
299 template <typename LhsScalar, typename RhsScalar, bool UseTypedComparators>
300 struct scalar_cmp_op<LhsScalar, RhsScalar, cmp_NEQ, UseTypedComparators> : binary_op_base<LhsScalar, RhsScalar> {
302  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator()(const LhsScalar& a, const RhsScalar& b) const {
303  return a != b ? result_type(1) : result_type(0);
304  }
305  template <typename Packet>
307  const Packet cst_one = pset1<Packet>(result_type(1));
308  return pandnot(cst_one, pcmp_eq(a, b));
309  }
310 };
311 
317 template <typename Scalar>
318 struct scalar_hypot_op<Scalar, Scalar> : binary_op_base<Scalar, Scalar> {
320  // This functor is used by hypotNorm only for which it is faster to first apply abs
321  // on all coefficients prior to reduction through hypot.
322  // This way we avoid calling abs on positive and real entries, and this also permits
323  // to seamlessly handle complexes. Otherwise we would have to handle both real and complexes
324  // through the same functor...
326  }
327 };
328 template <typename Scalar>
330  enum {
332  PacketAccess = false
333  };
334 };
335 
340 template <typename Scalar, typename Exponent>
341 struct scalar_pow_op : binary_op_base<Scalar, Exponent> {
343 #ifdef EIGEN_SCALAR_BINARY_OP_PLUGIN
344  scalar_pow_op() {
345  typedef Scalar LhsScalar;
346  typedef Exponent RhsScalar;
348  }
349 #endif
350 
351  EIGEN_DEVICE_FUNC inline result_type operator()(const Scalar& a, const Exponent& b) const {
352  return numext::pow(a, b);
353  }
354 
355  template <typename Packet>
357  return generic_pow(a, b);
358  }
359 };
360 
361 template <typename Scalar, typename Exponent>
362 struct functor_traits<scalar_pow_op<Scalar, Exponent>> {
363  enum {
367  // Temporarily disable packet access for half/bfloat16 until
368  // accuracy is improved.
370  };
371 };
372 
373 //---------- non associative binary functors ----------
374 
380 template <typename LhsScalar, typename RhsScalar>
381 struct scalar_difference_op : binary_op_base<LhsScalar, RhsScalar> {
383 #ifdef EIGEN_SCALAR_BINARY_OP_PLUGIN
385 #endif
387  operator()(const LhsScalar& a, const RhsScalar& b) const {
388  return a - b;
389  }
390  template <typename Packet>
392  return internal::psub(a, b);
393  }
394 };
395 template <typename LhsScalar, typename RhsScalar>
396 struct functor_traits<scalar_difference_op<LhsScalar, RhsScalar>> {
397  enum {
399  PacketAccess =
401  };
402 };
403 
407 };
408 
409 #ifndef EIGEN_GPU_COMPILE_PHASE
410 template <typename Packet>
414  // Use volatile variables to force a division by zero, which will
415  // result in the default platform behaviour (usually SIGFPE).
416  volatile typename unpacket_traits<Packet>::type zero = 0;
417  volatile typename unpacket_traits<Packet>::type val = 1;
418  val = val / zero;
419  }
420  }
421 };
422 #endif
423 
429 template <typename LhsScalar, typename RhsScalar>
430 struct scalar_quotient_op : binary_op_base<LhsScalar, RhsScalar> {
432 #ifdef EIGEN_SCALAR_BINARY_OP_PLUGIN
434 #endif
436  operator()(const LhsScalar& a, const RhsScalar& b) const {
437  return a / b;
438  }
439  template <typename Packet>
442  return internal::pdiv(a, b);
443  }
444 };
445 template <typename LhsScalar, typename RhsScalar>
446 struct functor_traits<scalar_quotient_op<LhsScalar, RhsScalar>> {
448  enum {
449  PacketAccess =
452  };
453 };
454 
460 template <typename Scalar>
463  // `false` any value `a` that satisfies `a == Scalar(0)`
464  // `true` is the complement of `false`
466  return (a != Scalar(0)) && (b != Scalar(0)) ? Scalar(1) : Scalar(0);
467  }
468  template <typename Packet>
470  const Packet cst_one = pset1<Packet>(Scalar(1));
471  // and(a,b) == !or(!a,!b)
472  Packet not_a = pcmp_eq(a, pzero(a));
473  Packet not_b = pcmp_eq(b, pzero(b));
474  Packet a_nand_b = por(not_a, not_b);
475  return pandnot(cst_one, a_nand_b);
476  }
477 };
478 template <typename Scalar>
481 };
482 
488 template <typename Scalar>
491  // `false` any value `a` that satisfies `a == Scalar(0)`
492  // `true` is the complement of `false`
494  return (a != Scalar(0)) || (b != Scalar(0)) ? Scalar(1) : Scalar(0);
495  }
496  template <typename Packet>
498  const Packet cst_one = pset1<Packet>(Scalar(1));
499  // if or(a,b) == 0, then a == 0 and b == 0
500  // or(a,b) == !nor(a,b)
501  Packet a_nor_b = pcmp_eq(por(a, b), pzero(a));
502  return pandnot(cst_one, a_nor_b);
503  }
504 };
505 template <typename Scalar>
508 };
509 
515 template <typename Scalar>
518  // `false` any value `a` that satisfies `a == Scalar(0)`
519  // `true` is the complement of `false`
521  return (a != Scalar(0)) != (b != Scalar(0)) ? Scalar(1) : Scalar(0);
522  }
523  template <typename Packet>
525  const Packet cst_one = pset1<Packet>(Scalar(1));
526  // xor(a,b) == xor(!a,!b)
527  Packet not_a = pcmp_eq(a, pzero(a));
528  Packet not_b = pcmp_eq(b, pzero(b));
529  Packet a_xor_b = pxor(not_a, not_b);
530  return pand(cst_one, a_xor_b);
531  }
532 };
533 template <typename Scalar>
536 };
537 
540  static constexpr size_t Size = sizeof(Scalar);
543  uint_t a_as_uint = numext::bit_cast<uint_t, Scalar>(a);
544  uint_t b_as_uint = numext::bit_cast<uint_t, Scalar>(b);
545  uint_t result = a_as_uint & b_as_uint;
546  return numext::bit_cast<Scalar, uint_t>(result);
547  }
549  uint_t a_as_uint = numext::bit_cast<uint_t, Scalar>(a);
550  uint_t b_as_uint = numext::bit_cast<uint_t, Scalar>(b);
551  uint_t result = a_as_uint | b_as_uint;
552  return numext::bit_cast<Scalar, uint_t>(result);
553  }
555  uint_t a_as_uint = numext::bit_cast<uint_t, Scalar>(a);
556  uint_t b_as_uint = numext::bit_cast<uint_t, Scalar>(b);
557  uint_t result = a_as_uint ^ b_as_uint;
558  return numext::bit_cast<Scalar, uint_t>(result);
559  }
560 };
561 
562 template <typename Scalar>
564  using Real = typename NumTraits<Scalar>::Real;
568  return Scalar(real_result, imag_result);
569  }
573  return Scalar(real_result, imag_result);
574  }
578  return Scalar(real_result, imag_result);
579  }
580 };
581 
587 template <typename Scalar>
590  BITWISE OPERATIONS MAY ONLY BE PERFORMED ON PLAIN DATA TYPES)
591  EIGEN_STATIC_ASSERT((!internal::is_same<Scalar, bool>::value), DONT USE BITWISE OPS ON BOOLEAN TYPES)
592  using result_type = Scalar;
595  }
596  template <typename Packet>
598  return pand(a, b);
599  }
600 };
601 template <typename Scalar>
604 };
605 
611 template <typename Scalar>
614  BITWISE OPERATIONS MAY ONLY BE PERFORMED ON PLAIN DATA TYPES)
615  EIGEN_STATIC_ASSERT((!internal::is_same<Scalar, bool>::value), DONT USE BITWISE OPS ON BOOLEAN TYPES)
616  using result_type = Scalar;
619  }
620  template <typename Packet>
622  return por(a, b);
623  }
624 };
625 template <typename Scalar>
628 };
629 
635 template <typename Scalar>
638  BITWISE OPERATIONS MAY ONLY BE PERFORMED ON PLAIN DATA TYPES)
639  EIGEN_STATIC_ASSERT((!internal::is_same<Scalar, bool>::value), DONT USE BITWISE OPS ON BOOLEAN TYPES)
640  using result_type = Scalar;
643  }
644  template <typename Packet>
646  return pxor(a, b);
647  }
648 };
649 template <typename Scalar>
652 };
653 
659 template <typename LhsScalar, typename RhsScalar>
660 struct scalar_absolute_difference_op : binary_op_base<LhsScalar, RhsScalar> {
662 #ifdef EIGEN_SCALAR_BINARY_OP_PLUGIN
664 #endif
666  operator()(const LhsScalar& a, const RhsScalar& b) const {
667  return numext::absdiff(a, b);
668  }
669  template <typename Packet>
671  return internal::pabsdiff(a, b);
672  }
673 };
674 template <typename LhsScalar, typename RhsScalar>
675 struct functor_traits<scalar_absolute_difference_op<LhsScalar, RhsScalar>> {
676  enum {
679  };
680 };
681 
682 template <typename LhsScalar, typename RhsScalar>
684  using Scalar = LhsScalar;
685 
686  static constexpr bool Enable =
688  EIGEN_STATIC_ASSERT(Enable, "LhsScalar and RhsScalar must be the same non-integer, non-complex type")
689 
690  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const Scalar& y, const Scalar& x) const {
691  return numext::atan2(y, x);
692  }
693  template <typename Packet>
695  return internal::patan2(y, x);
696  }
697 };
698 
699 template <typename LhsScalar, typename RhsScalar>
700 struct functor_traits<scalar_atan2_op<LhsScalar, RhsScalar>> {
701  using Scalar = LhsScalar;
702  enum {
706  };
707 };
708 
709 //---------- binary functors bound to a constant, thus appearing as a unary functor ----------
710 
711 // The following two classes permits to turn any binary functor into a unary one with one argument bound to a constant
712 // value. They are analogues to std::binder1st/binder2nd but with the following differences:
713 // - they are compatible with packetOp
714 // - they are portable across C++ versions (the std::binder* are deprecated in C++11)
715 template <typename BinaryOp>
716 struct bind1st_op : BinaryOp {
717  typedef typename BinaryOp::first_argument_type first_argument_type;
718  typedef typename BinaryOp::second_argument_type second_argument_type;
719  typedef typename BinaryOp::result_type result_type;
720 
722 
724  return BinaryOp::operator()(m_value, b);
725  }
726 
727  template <typename Packet>
729  return BinaryOp::packetOp(internal::pset1<Packet>(m_value), b);
730  }
731 
733 };
734 template <typename BinaryOp>
735 struct functor_traits<bind1st_op<BinaryOp>> : functor_traits<BinaryOp> {};
736 
737 template <typename BinaryOp>
738 struct bind2nd_op : BinaryOp {
739  typedef typename BinaryOp::first_argument_type first_argument_type;
740  typedef typename BinaryOp::second_argument_type second_argument_type;
741  typedef typename BinaryOp::result_type result_type;
742 
744 
746  return BinaryOp::operator()(a, m_value);
747  }
748 
749  template <typename Packet>
751  return BinaryOp::packetOp(a, internal::pset1<Packet>(m_value));
752  }
753 
755 };
756 template <typename BinaryOp>
757 struct functor_traits<bind2nd_op<BinaryOp>> : functor_traits<BinaryOp> {};
758 
759 } // end namespace internal
760 
761 } // end namespace Eigen
762 
763 #endif // EIGEN_BINARY_FUNCTORS_H
AnnoyingScalar imag(const AnnoyingScalar &)
Definition: AnnoyingScalar.h:132
#define EIGEN_PREDICT_FALSE(x)
Definition: Macros.h:1179
#define EIGEN_UNUSED_VARIABLE(var)
Definition: Macros.h:966
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:892
#define EIGEN_STRONG_INLINE
Definition: Macros.h:834
#define EIGEN_STATIC_ASSERT(X, MSG)
Definition: StaticAssert.h:26
Scalar * b
Definition: benchVecAdd.cpp:17
SCALAR Scalar
Definition: bench_gemm.cpp:45
@ IsComplex
Definition: common.h:73
float real
Definition: datatypes.h:10
return int(ret)+1
const Scalar * a
Definition: level2_cplx_impl.h:32
#define EIGEN_SCALAR_BINARY_OP_PLUGIN
Definition: linearstructure.cpp:12
@ cmp_NEQ
Definition: Constants.h:590
@ cmp_EQ
Definition: Constants.h:586
@ cmp_GT
Definition: Constants.h:591
@ cmp_LT
Definition: Constants.h:587
@ cmp_GE
Definition: Constants.h:592
@ cmp_LE
Definition: Constants.h:588
@ cmp_UNORD
Definition: Constants.h:589
EIGEN_DEVICE_FUNC Packet padd(const Packet &a, const Packet &b)
Definition: GenericPacketMath.h:318
EIGEN_STRONG_INLINE Packet8f pzero(const Packet8f &)
Definition: AVX/PacketMath.h:774
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE RealScalar positive_real_hypot(const RealScalar &x, const RealScalar &y)
Definition: MathFunctionsImpl.h:150
const Scalar & y
Definition: RandomImpl.h:36
EIGEN_STRONG_INLINE bool predux_any(const Packet4f &x)
Definition: AltiVec/PacketMath.h:2751
EIGEN_DEVICE_FUNC Packet pdiv(const Packet &a, const Packet &b)
Definition: GenericPacketMath.h:368
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Packet patan2(const Packet &y, const Packet &x)
Definition: GenericPacketMath.h:1475
EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet generic_pow(const Packet &x, const Packet &y)
Definition: GenericPacketMathFunctions.h:2043
EIGEN_STRONG_INLINE Packet4f pcmp_le(const Packet4f &a, const Packet4f &b)
Definition: AltiVec/PacketMath.h:1314
EIGEN_STRONG_INLINE Packet8h por(const Packet8h &a, const Packet8h &b)
Definition: AVX/PacketMath.h:2309
EIGEN_STRONG_INLINE Packet4i pcmp_lt(const Packet4i &a, const Packet4i &b)
Definition: AltiVec/PacketMath.h:1341
EIGEN_STRONG_INLINE Packet4cf pmul(const Packet4cf &a, const Packet4cf &b)
Definition: AVX/Complex.h:88
EIGEN_STRONG_INLINE Packet8h pandnot(const Packet8h &a, const Packet8h &b)
Definition: AVX/PacketMath.h:2323
EIGEN_DEVICE_FUNC Packet pabsdiff(const Packet &a, const Packet &b)
Definition: GenericPacketMath.h:746
EIGEN_DEVICE_FUNC unpacket_traits< Packet >::type predux(const Packet &a)
Definition: GenericPacketMath.h:1232
EIGEN_STRONG_INLINE Packet2cf pcmp_eq(const Packet2cf &a, const Packet2cf &b)
Definition: AltiVec/Complex.h:353
EIGEN_STRONG_INLINE Packet8h pand(const Packet8h &a, const Packet8h &b)
Definition: AVX/PacketMath.h:2319
EIGEN_STRONG_INLINE Packet8h pxor(const Packet8h &a, const Packet8h &b)
Definition: AVX/PacketMath.h:2315
EIGEN_DEVICE_FUNC Packet psub(const Packet &a, const Packet &b)
Definition: GenericPacketMath.h:337
EIGEN_DEVICE_FUNC unpacket_traits< Packet >::type predux_mul(const Packet &a)
Definition: GenericPacketMath.h:1238
typename typed_cmp_helper< LhsScalar, RhsScalar, UseTypedComparators >::type cmp_return_t
Definition: BinaryFunctors.h:219
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T absdiff(const T &x, const T &y)
Definition: MathFunctions.h:1105
EIGEN_DEVICE_FUNC internal::pow_impl< ScalarX, ScalarY >::result_type pow(const ScalarX &x, const ScalarY &y)
Definition: MathFunctions.h:1161
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T atan2(const T &y, const T &x)
Definition: MathFunctions.h:1689
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:70
squared absolute value
Definition: GlobalFunctions.h:87
val
Definition: calibrate.py:119
type
Definition: compute_granudrum_aor.py:141
Definition: Eigen_Colamd.h:49
list x
Definition: plotDoE.py:28
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition: NumTraits.h:217
Determines whether the given binary operation of two numeric types is allowed and what the scalar ret...
Definition: XprHelper.h:1043
Definition: BinaryFunctors.h:23
Arg1 first_argument_type
Definition: BinaryFunctors.h:24
Arg2 second_argument_type
Definition: BinaryFunctors.h:25
Definition: BinaryFunctors.h:716
BinaryOp::second_argument_type second_argument_type
Definition: BinaryFunctors.h:718
EIGEN_DEVICE_FUNC bind1st_op(const first_argument_type &val)
Definition: BinaryFunctors.h:721
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet packetOp(const Packet &b) const
Definition: BinaryFunctors.h:728
first_argument_type m_value
Definition: BinaryFunctors.h:732
BinaryOp::first_argument_type first_argument_type
Definition: BinaryFunctors.h:717
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const result_type operator()(const second_argument_type &b) const
Definition: BinaryFunctors.h:723
BinaryOp::result_type result_type
Definition: BinaryFunctors.h:719
Definition: BinaryFunctors.h:738
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet packetOp(const Packet &a) const
Definition: BinaryFunctors.h:750
BinaryOp::first_argument_type first_argument_type
Definition: BinaryFunctors.h:739
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const result_type operator()(const first_argument_type &a) const
Definition: BinaryFunctors.h:745
BinaryOp::second_argument_type second_argument_type
Definition: BinaryFunctors.h:740
second_argument_type m_value
Definition: BinaryFunctors.h:754
EIGEN_DEVICE_FUNC bind2nd_op(const second_argument_type &val)
Definition: BinaryFunctors.h:743
BinaryOp::result_type result_type
Definition: BinaryFunctors.h:741
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar run_xor(const Scalar &a, const Scalar &b)
Definition: BinaryFunctors.h:575
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar run_or(const Scalar &a, const Scalar &b)
Definition: BinaryFunctors.h:570
typename NumTraits< Scalar >::Real Real
Definition: BinaryFunctors.h:564
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar run_and(const Scalar &a, const Scalar &b)
Definition: BinaryFunctors.h:565
Definition: BinaryFunctors.h:539
static constexpr size_t Size
Definition: BinaryFunctors.h:540
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar run_xor(const Scalar &a, const Scalar &b)
Definition: BinaryFunctors.h:554
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar run_or(const Scalar &a, const Scalar &b)
Definition: BinaryFunctors.h:548
typename numext::get_integer_by_size< Size >::unsigned_type uint_t
Definition: BinaryFunctors.h:541
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar run_and(const Scalar &a, const Scalar &b)
Definition: BinaryFunctors.h:542
Definition: ConjHelper.h:71
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ResultType pmul(const LhsType &x, const RhsType &y) const
Definition: ConjHelper.h:79
scalar_quotient_op< LhsScalar, RhsScalar >::result_type result_type
Definition: BinaryFunctors.h:447
Definition: XprHelper.h:205
@ PacketAccess
Definition: XprHelper.h:206
@ Cost
Definition: XprHelper.h:206
Definition: Meta.h:145
Definition: Meta.h:205
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Packet x)
Definition: BinaryFunctors.h:412
Definition: BinaryFunctors.h:405
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Packet x)
Definition: BinaryFunctors.h:406
Definition: GenericPacketMath.h:108
Template functor to compute the absolute difference of two scalars.
Definition: BinaryFunctors.h:660
ScalarBinaryOpTraits< LhsScalar, RhsScalar, scalar_absolute_difference_op >::ReturnType result_type
Definition: BinaryFunctors.h:661
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const result_type operator()(const LhsScalar &a, const RhsScalar &b) const
Definition: BinaryFunctors.h:666
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet packetOp(const Packet &a, const Packet &b) const
Definition: BinaryFunctors.h:670
Definition: BinaryFunctors.h:683
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet &y, const Packet &x) const
Definition: BinaryFunctors.h:694
LhsScalar Scalar
Definition: BinaryFunctors.h:684
static constexpr bool Enable
Definition: BinaryFunctors.h:686
Template functor to compute the atan of a scalar.
Definition: functors/UnaryFunctors.h:676
Template functor to compute the bitwise and of two scalars.
Definition: BinaryFunctors.h:588
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const Scalar &a, const Scalar &b) const
Definition: BinaryFunctors.h:593
EIGEN_STATIC_ASSERT(!NumTraits< Scalar >::RequireInitialization, BITWISE OPERATIONS MAY ONLY BE PERFORMED ON PLAIN DATA TYPES) using result_type
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet &a, const Packet &b) const
Definition: BinaryFunctors.h:597
Template functor to compute the bitwise or of two scalars.
Definition: BinaryFunctors.h:612
EIGEN_STATIC_ASSERT(!NumTraits< Scalar >::RequireInitialization, BITWISE OPERATIONS MAY ONLY BE PERFORMED ON PLAIN DATA TYPES) using result_type
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const Scalar &a, const Scalar &b) const
Definition: BinaryFunctors.h:617
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet &a, const Packet &b) const
Definition: BinaryFunctors.h:621
Template functor to compute the bitwise xor of two scalars.
Definition: BinaryFunctors.h:636
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet &a, const Packet &b) const
Definition: BinaryFunctors.h:645
EIGEN_STATIC_ASSERT(!NumTraits< Scalar >::RequireInitialization, BITWISE OPERATIONS MAY ONLY BE PERFORMED ON PLAIN DATA TYPES) using result_type
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const Scalar &a, const Scalar &b) const
Definition: BinaryFunctors.h:641
Template functor to compute the and of two scalars as if they were booleans.
Definition: BinaryFunctors.h:461
Scalar result_type
Definition: BinaryFunctors.h:462
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const Scalar &a, const Scalar &b) const
Definition: BinaryFunctors.h:465
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet &a, const Packet &b) const
Definition: BinaryFunctors.h:469
Template functor to compute the or of two scalars as if they were booleans.
Definition: BinaryFunctors.h:489
EIGEN_STRONG_INLINE Packet packetOp(const Packet &a, const Packet &b) const
Definition: BinaryFunctors.h:497
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const Scalar &a, const Scalar &b) const
Definition: BinaryFunctors.h:493
Scalar result_type
Definition: BinaryFunctors.h:490
Template functor to compute the xor of two scalars as if they were booleans.
Definition: BinaryFunctors.h:516
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const Scalar &a, const Scalar &b) const
Definition: BinaryFunctors.h:520
Scalar result_type
Definition: BinaryFunctors.h:517
EIGEN_STRONG_INLINE Packet packetOp(const Packet &a, const Packet &b) const
Definition: BinaryFunctors.h:524
cmp_return_t< LhsScalar, RhsScalar, UseTypedComparators > result_type
Definition: BinaryFunctors.h:223
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet &a, const Packet &b) const
Definition: BinaryFunctors.h:228
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator()(const LhsScalar &a, const RhsScalar &b) const
Definition: BinaryFunctors.h:224
cmp_return_t< LhsScalar, RhsScalar, UseTypedComparators > result_type
Definition: BinaryFunctors.h:275
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet &a, const Packet &b) const
Definition: BinaryFunctors.h:280
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator()(const LhsScalar &a, const RhsScalar &b) const
Definition: BinaryFunctors.h:276
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet &a, const Packet &b) const
Definition: BinaryFunctors.h:267
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator()(const LhsScalar &a, const RhsScalar &b) const
Definition: BinaryFunctors.h:263
cmp_return_t< LhsScalar, RhsScalar, UseTypedComparators > result_type
Definition: BinaryFunctors.h:262
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet &a, const Packet &b) const
Definition: BinaryFunctors.h:254
cmp_return_t< LhsScalar, RhsScalar, UseTypedComparators > result_type
Definition: BinaryFunctors.h:249
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator()(const LhsScalar &a, const RhsScalar &b) const
Definition: BinaryFunctors.h:250
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator()(const LhsScalar &a, const RhsScalar &b) const
Definition: BinaryFunctors.h:237
cmp_return_t< LhsScalar, RhsScalar, UseTypedComparators > result_type
Definition: BinaryFunctors.h:236
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet &a, const Packet &b) const
Definition: BinaryFunctors.h:241
cmp_return_t< LhsScalar, RhsScalar, UseTypedComparators > result_type
Definition: BinaryFunctors.h:301
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator()(const LhsScalar &a, const RhsScalar &b) const
Definition: BinaryFunctors.h:302
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet &a, const Packet &b) const
Definition: BinaryFunctors.h:306
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet &a, const Packet &b) const
Definition: BinaryFunctors.h:293
cmp_return_t< LhsScalar, RhsScalar, UseTypedComparators > result_type
Definition: BinaryFunctors.h:288
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator()(const LhsScalar &a, const RhsScalar &b) const
Definition: BinaryFunctors.h:289
Template functors for comparison of two scalars.
Definition: BinaryFunctors.h:199
Template functor to compute the conjugate product of two scalars.
Definition: BinaryFunctors.h:114
ScalarBinaryOpTraits< LhsScalar, RhsScalar, scalar_conj_product_op >::ReturnType result_type
Definition: BinaryFunctors.h:117
@ Conj
Definition: BinaryFunctors.h:115
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator()(const LhsScalar &a, const RhsScalar &b) const
Definition: BinaryFunctors.h:119
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet &a, const Packet &b) const
Definition: BinaryFunctors.h:124
Template functor to compute the difference of two scalars.
Definition: BinaryFunctors.h:381
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet packetOp(const Packet &a, const Packet &b) const
Definition: BinaryFunctors.h:391
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const result_type operator()(const LhsScalar &a, const RhsScalar &b) const
Definition: BinaryFunctors.h:387
ScalarBinaryOpTraits< LhsScalar, RhsScalar, scalar_difference_op >::ReturnType result_type
Definition: BinaryFunctors.h:382
Definition: XprHelper.h:883
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator()(const Scalar &x, const Scalar &y) const
Definition: BinaryFunctors.h:319
Definition: ForwardDeclarations.h:320
Template functor to compute the max of two scalars.
Definition: BinaryFunctors.h:171
ScalarBinaryOpTraits< LhsScalar, RhsScalar, scalar_max_op >::ReturnType result_type
Definition: BinaryFunctors.h:172
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type predux(const Packet &a) const
Definition: BinaryFunctors.h:181
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator()(const LhsScalar &a, const RhsScalar &b) const
Definition: BinaryFunctors.h:173
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet &a, const Packet &b) const
Definition: BinaryFunctors.h:177
Template functor to compute the min of two scalars.
Definition: BinaryFunctors.h:142
ScalarBinaryOpTraits< LhsScalar, RhsScalar, scalar_min_op >::ReturnType result_type
Definition: BinaryFunctors.h:143
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator()(const LhsScalar &a, const RhsScalar &b) const
Definition: BinaryFunctors.h:144
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type predux(const Packet &a) const
Definition: BinaryFunctors.h:152
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet &a, const Packet &b) const
Definition: BinaryFunctors.h:148
Template functor to compute the pow of two scalars See the specification of pow in https://en....
Definition: BinaryFunctors.h:341
ScalarBinaryOpTraits< Scalar, Exponent, scalar_pow_op >::ReturnType result_type
Definition: BinaryFunctors.h:342
EIGEN_DEVICE_FUNC result_type operator()(const Scalar &a, const Exponent &b) const
Definition: BinaryFunctors.h:351
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet packetOp(const Packet &a, const Packet &b) const
Definition: BinaryFunctors.h:356
Template functor to compute the product of two scalars.
Definition: BinaryFunctors.h:73
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator()(const LhsScalar &a, const RhsScalar &b) const
Definition: BinaryFunctors.h:79
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type predux(const Packet &a) const
Definition: BinaryFunctors.h:87
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet &a, const Packet &b) const
Definition: BinaryFunctors.h:83
ScalarBinaryOpTraits< LhsScalar, RhsScalar, scalar_product_op >::ReturnType result_type
Definition: BinaryFunctors.h:74
Template functor to compute the quotient of two scalars.
Definition: BinaryFunctors.h:430
ScalarBinaryOpTraits< LhsScalar, RhsScalar, scalar_quotient_op >::ReturnType result_type
Definition: BinaryFunctors.h:431
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet packetOp(const Packet &a, const Packet &b) const
Definition: BinaryFunctors.h:440
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const result_type operator()(const LhsScalar &a, const RhsScalar &b) const
Definition: BinaryFunctors.h:436
Template functor to compute the sum of two scalars.
Definition: BinaryFunctors.h:34
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type predux(const Packet &a) const
Definition: BinaryFunctors.h:48
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet &a, const Packet &b) const
Definition: BinaryFunctors.h:44
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator()(const LhsScalar &a, const RhsScalar &b) const
Definition: BinaryFunctors.h:40
ScalarBinaryOpTraits< LhsScalar, RhsScalar, scalar_sum_op >::ReturnType result_type
Definition: BinaryFunctors.h:35
Definition: BinaryFunctors.h:211
static constexpr bool IsNumeric
Definition: BinaryFunctors.h:213
static constexpr bool SameType
Definition: BinaryFunctors.h:212
static constexpr bool UseTyped
Definition: BinaryFunctors.h:214
typename conditional< UseTyped, LhsScalar, bool >::type type
Definition: BinaryFunctors.h:215
void unsigned_type
Definition: Meta.h:48
EIGEN_DONT_INLINE Scalar zero()
Definition: svd_common.h:232
Definition: ZVector/PacketMath.h:50