WPILibC++ 2023.4.3-108-ge5452e3
UnaryFunctors.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-2016 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_UNARY_FUNCTORS_H
11#define EIGEN_UNARY_FUNCTORS_H
12
13namespace Eigen {
14
15namespace internal {
16
17/** \internal
18 * \brief Template functor to compute the opposite of a scalar
19 *
20 * \sa class CwiseUnaryOp, MatrixBase::operator-
21 */
22template<typename Scalar> struct scalar_opposite_op {
24 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a) const { return -a; }
25 template<typename Packet>
26 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const
27 { return internal::pnegate(a); }
28};
29template<typename Scalar>
31{ enum {
34};
35
36/** \internal
37 * \brief Template functor to compute the absolute value of a scalar
38 *
39 * \sa class CwiseUnaryOp, Cwise::abs
40 */
41template<typename Scalar> struct scalar_abs_op {
43 typedef typename NumTraits<Scalar>::Real result_type;
44 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const result_type operator() (const Scalar& a) const { return numext::abs(a); }
45 template<typename Packet>
46 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const
47 { return internal::pabs(a); }
48};
49template<typename Scalar>
51{
52 enum {
55 };
56};
57
58/** \internal
59 * \brief Template functor to compute the score of a scalar, to chose a pivot
60 *
61 * \sa class CwiseUnaryOp
62 */
63template<typename Scalar> struct scalar_score_coeff_op : scalar_abs_op<Scalar>
64{
65 typedef void Score_is_abs;
66};
67template<typename Scalar>
68struct functor_traits<scalar_score_coeff_op<Scalar> > : functor_traits<scalar_abs_op<Scalar> > {};
69
70/* Avoid recomputing abs when we know the score and they are the same. Not a true Eigen functor. */
71template<typename Scalar, typename=void> struct abs_knowing_score
72{
74 typedef typename NumTraits<Scalar>::Real result_type;
75 template<typename Score>
76 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const result_type operator() (const Scalar& a, const Score&) const { return numext::abs(a); }
77};
78template<typename Scalar> struct abs_knowing_score<Scalar, typename scalar_score_coeff_op<Scalar>::Score_is_abs>
79{
81 typedef typename NumTraits<Scalar>::Real result_type;
82 template<typename Scal>
83 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const result_type operator() (const Scal&, const result_type& a) const { return a; }
84};
85
86/** \internal
87 * \brief Template functor to compute the squared absolute value of a scalar
88 *
89 * \sa class CwiseUnaryOp, Cwise::abs2
90 */
91template<typename Scalar> struct scalar_abs2_op {
93 typedef typename NumTraits<Scalar>::Real result_type;
95 EIGEN_STRONG_INLINE const result_type operator() (const Scalar& a) const { return numext::abs2(a); }
96 template<typename Packet>
97 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const
98 { return internal::pmul(a,a); }
99};
100template<typename Scalar>
103
104/** \internal
105 * \brief Template functor to compute the conjugate of a complex value
106 *
107 * \sa class CwiseUnaryOp, MatrixBase::conjugate()
108 */
109template<typename Scalar> struct scalar_conjugate_op {
112 EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a) const { return numext::conj(a); }
113 template<typename Packet>
114 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const { return internal::pconj(a); }
115};
116template<typename Scalar>
118{
119 enum {
120 Cost = 0,
121 // Yes the cost is zero even for complexes because in most cases for which
122 // the cost is used, conjugation turns to be a no-op. Some examples:
123 // cost(a*conj(b)) == cost(a*b)
124 // cost(a+conj(b)) == cost(a+b)
125 // <etc.
126 // If we don't set it to zero, then:
127 // A.conjugate().lazyProduct(B.conjugate())
128 // will bake its operands. We definitely don't want that!
130 };
131};
132
133/** \internal
134 * \brief Template functor to compute the phase angle of a complex
135 *
136 * \sa class CwiseUnaryOp, Cwise::arg
137 */
138template<typename Scalar> struct scalar_arg_op {
140 typedef typename NumTraits<Scalar>::Real result_type;
141 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const result_type operator() (const Scalar& a) const { return numext::arg(a); }
142 template<typename Packet>
143 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const
144 { return internal::parg(a); }
145};
146template<typename Scalar>
148{
149 enum {
152 };
153};
154/** \internal
155 * \brief Template functor to cast a scalar to another type
156 *
157 * \sa class CwiseUnaryOp, MatrixBase::cast()
158 */
159template<typename Scalar, typename NewType>
162 typedef NewType result_type;
163 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const NewType operator() (const Scalar& a) const { return cast<Scalar, NewType>(a); }
164};
165template<typename Scalar, typename NewType>
166struct functor_traits<scalar_cast_op<Scalar,NewType> >
168
169/** \internal
170 * \brief Template functor to arithmetically shift a scalar right by a number of bits
171 *
172 * \sa class CwiseUnaryOp, MatrixBase::shift_right()
173 */
174template<typename Scalar, int N>
177
178 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a) const
179 { return a >> N; }
180 template<typename Packet>
181 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const
182 { return internal::parithmetic_shift_right<N>(a); }
183};
184template<typename Scalar, int N>
187
188/** \internal
189 * \brief Template functor to logically shift a scalar left by a number of bits
190 *
191 * \sa class CwiseUnaryOp, MatrixBase::shift_left()
192 */
193template<typename Scalar, int N>
196
197 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a) const
198 { return a << N; }
199 template<typename Packet>
200 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const
201 { return internal::plogical_shift_left<N>(a); }
202};
203template<typename Scalar, int N>
206
207/** \internal
208 * \brief Template functor to extract the real part of a complex
209 *
210 * \sa class CwiseUnaryOp, MatrixBase::real()
211 */
212template<typename Scalar>
215 typedef typename NumTraits<Scalar>::Real result_type;
217 EIGEN_STRONG_INLINE result_type operator() (const Scalar& a) const { return numext::real(a); }
218};
219template<typename Scalar>
221{ enum { Cost = 0, PacketAccess = false }; };
222
223/** \internal
224 * \brief Template functor to extract the imaginary part of a complex
225 *
226 * \sa class CwiseUnaryOp, MatrixBase::imag()
227 */
228template<typename Scalar>
231 typedef typename NumTraits<Scalar>::Real result_type;
233 EIGEN_STRONG_INLINE result_type operator() (const Scalar& a) const { return numext::imag(a); }
234};
235template<typename Scalar>
237{ enum { Cost = 0, PacketAccess = false }; };
238
239/** \internal
240 * \brief Template functor to extract the real part of a complex as a reference
241 *
242 * \sa class CwiseUnaryOp, MatrixBase::real()
243 */
244template<typename Scalar>
247 typedef typename NumTraits<Scalar>::Real result_type;
249 EIGEN_STRONG_INLINE result_type& operator() (const Scalar& a) const { return numext::real_ref(*const_cast<Scalar*>(&a)); }
250};
251template<typename Scalar>
253{ enum { Cost = 0, PacketAccess = false }; };
254
255/** \internal
256 * \brief Template functor to extract the imaginary part of a complex as a reference
257 *
258 * \sa class CwiseUnaryOp, MatrixBase::imag()
259 */
260template<typename Scalar>
263 typedef typename NumTraits<Scalar>::Real result_type;
265 EIGEN_STRONG_INLINE result_type& operator() (const Scalar& a) const { return numext::imag_ref(*const_cast<Scalar*>(&a)); }
266};
267template<typename Scalar>
269{ enum { Cost = 0, PacketAccess = false }; };
270
271/** \internal
272 *
273 * \brief Template functor to compute the exponential of a scalar
274 *
275 * \sa class CwiseUnaryOp, Cwise::exp()
276 */
277template<typename Scalar> struct scalar_exp_op {
279 EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a) const { return numext::exp(a); }
280 template <typename Packet>
281 EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::pexp(a); }
282};
283template <typename Scalar>
285 enum {
287 // The following numbers are based on the AVX implementation.
288#ifdef EIGEN_VECTORIZE_FMA
289 // Haswell can issue 2 add/mul/madd per cycle.
290 Cost =
291 (sizeof(Scalar) == 4
292 // float: 8 pmadd, 4 pmul, 2 padd/psub, 6 other
294 // double: 7 pmadd, 5 pmul, 3 padd/psub, 1 div, 13 other
298#else
299 Cost =
300 (sizeof(Scalar) == 4
301 // float: 7 pmadd, 6 pmul, 4 padd/psub, 10 other
303 // double: 7 pmadd, 5 pmul, 3 padd/psub, 1 div, 13 other
307#endif
308 };
309};
310
311/** \internal
312 *
313 * \brief Template functor to compute the exponential of a scalar - 1.
314 *
315 * \sa class CwiseUnaryOp, ArrayBase::expm1()
316 */
317template<typename Scalar> struct scalar_expm1_op {
319 EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a) const { return numext::expm1(a); }
320 template <typename Packet>
321 EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::pexpm1(a); }
322};
323template <typename Scalar>
325 enum {
327 Cost = functor_traits<scalar_exp_op<Scalar> >::Cost // TODO measure cost of expm1
328 };
329};
330
331/** \internal
332 *
333 * \brief Template functor to compute the logarithm of a scalar
334 *
335 * \sa class CwiseUnaryOp, ArrayBase::log()
336 */
337template<typename Scalar> struct scalar_log_op {
339 EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a) const { return numext::log(a); }
340 template <typename Packet>
341 EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::plog(a); }
342};
343template <typename Scalar>
345 enum {
347 Cost =
349 // The following numbers are based on the AVX implementation.
350#ifdef EIGEN_VECTORIZE_FMA
351 // 8 pmadd, 6 pmul, 8 padd/psub, 16 other, can issue 2 add/mul/madd per cycle.
353#else
354 // 8 pmadd, 6 pmul, 8 padd/psub, 20 other
356#endif
357 // Measured cost of std::log.
358 : sizeof(Scalar)==4 ? 40 : 85)
359 };
360};
361
362/** \internal
363 *
364 * \brief Template functor to compute the logarithm of 1 plus a scalar value
365 *
366 * \sa class CwiseUnaryOp, ArrayBase::log1p()
367 */
368template<typename Scalar> struct scalar_log1p_op {
370 EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a) const { return numext::log1p(a); }
371 template <typename Packet>
372 EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::plog1p(a); }
373};
374template <typename Scalar>
376 enum {
378 Cost = functor_traits<scalar_log_op<Scalar> >::Cost // TODO measure cost of log1p
379 };
380};
381
382/** \internal
383 *
384 * \brief Template functor to compute the base-10 logarithm of a scalar
385 *
386 * \sa class CwiseUnaryOp, Cwise::log10()
387 */
388template<typename Scalar> struct scalar_log10_op {
390 EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a) const { EIGEN_USING_STD(log10) return log10(a); }
391 template <typename Packet>
392 EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::plog10(a); }
393};
394template<typename Scalar>
397
398/** \internal
399 *
400 * \brief Template functor to compute the base-2 logarithm of a scalar
401 *
402 * \sa class CwiseUnaryOp, Cwise::log2()
403 */
404template<typename Scalar> struct scalar_log2_op {
406 EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a) const { return Scalar(EIGEN_LOG2E) * numext::log(a); }
407 template <typename Packet>
408 EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::plog2(a); }
409};
410template<typename Scalar>
413
414/** \internal
415 * \brief Template functor to compute the square root of a scalar
416 * \sa class CwiseUnaryOp, Cwise::sqrt()
417 */
418template<typename Scalar> struct scalar_sqrt_op {
420 EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a) const { return numext::sqrt(a); }
421 template <typename Packet>
422 EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::psqrt(a); }
423};
424template <typename Scalar>
426 enum {
427#if EIGEN_FAST_MATH
428 // The following numbers are based on the AVX implementation.
429 Cost = (sizeof(Scalar) == 8 ? 28
430 // 4 pmul, 1 pmadd, 3 other
433#else
434 // The following numbers are based on min VSQRT throughput on Haswell.
435 Cost = (sizeof(Scalar) == 8 ? 28 : 14),
436#endif
438 };
439};
440
441// Boolean specialization to eliminate -Wimplicit-conversion-floating-point-to-bool warnings.
442template<> struct scalar_sqrt_op<bool> {
444 EIGEN_DEPRECATED EIGEN_DEVICE_FUNC inline bool operator() (const bool& a) const { return a; }
445 template <typename Packet>
446 EIGEN_DEPRECATED EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return a; }
447};
448template <>
451};
452
453/** \internal
454 * \brief Template functor to compute the reciprocal square root of a scalar
455 * \sa class CwiseUnaryOp, Cwise::rsqrt()
456 */
457template<typename Scalar> struct scalar_rsqrt_op {
459 EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a) const { return numext::rsqrt(a); }
460 template <typename Packet>
461 EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::prsqrt(a); }
462};
463
464template<typename Scalar>
466{ enum {
469 };
470};
471
472/** \internal
473 * \brief Template functor to compute the cosine of a scalar
474 * \sa class CwiseUnaryOp, ArrayBase::cos()
475 */
476template<typename Scalar> struct scalar_cos_op {
478 EIGEN_DEVICE_FUNC inline Scalar operator() (const Scalar& a) const { return numext::cos(a); }
479 template <typename Packet>
480 EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::pcos(a); }
481};
482template<typename Scalar>
484{
485 enum {
488 };
489};
490
491/** \internal
492 * \brief Template functor to compute the sine of a scalar
493 * \sa class CwiseUnaryOp, ArrayBase::sin()
494 */
495template<typename Scalar> struct scalar_sin_op {
497 EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a) const { return numext::sin(a); }
498 template <typename Packet>
499 EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::psin(a); }
500};
501template<typename Scalar>
503{
504 enum {
507 };
508};
509
510
511/** \internal
512 * \brief Template functor to compute the tan of a scalar
513 * \sa class CwiseUnaryOp, ArrayBase::tan()
514 */
515template<typename Scalar> struct scalar_tan_op {
517 EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a) const { return numext::tan(a); }
518 template <typename Packet>
519 EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::ptan(a); }
520};
521template<typename Scalar>
523{
524 enum {
527 };
528};
529
530/** \internal
531 * \brief Template functor to compute the arc cosine of a scalar
532 * \sa class CwiseUnaryOp, ArrayBase::acos()
533 */
534template<typename Scalar> struct scalar_acos_op {
536 EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a) const { return numext::acos(a); }
537 template <typename Packet>
538 EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::pacos(a); }
539};
540template<typename Scalar>
542{
543 enum {
546 };
547};
548
549/** \internal
550 * \brief Template functor to compute the arc sine of a scalar
551 * \sa class CwiseUnaryOp, ArrayBase::asin()
552 */
553template<typename Scalar> struct scalar_asin_op {
555 EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a) const { return numext::asin(a); }
556 template <typename Packet>
557 EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::pasin(a); }
558};
559template<typename Scalar>
561{
562 enum {
565 };
566};
567
568
569/** \internal
570 * \brief Template functor to compute the atan of a scalar
571 * \sa class CwiseUnaryOp, ArrayBase::atan()
572 */
573template<typename Scalar> struct scalar_atan_op {
575 EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a) const { return numext::atan(a); }
576 template <typename Packet>
577 EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::patan(a); }
578};
579template<typename Scalar>
581{
582 enum {
585 };
586};
587
588/** \internal
589 * \brief Template functor to compute the tanh of a scalar
590 * \sa class CwiseUnaryOp, ArrayBase::tanh()
591 */
592template <typename Scalar>
595 EIGEN_DEVICE_FUNC inline const Scalar operator()(const Scalar& a) const { return numext::tanh(a); }
596 template <typename Packet>
597 EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& x) const { return ptanh(x); }
598};
599
600template <typename Scalar>
602 enum {
605// The following numbers are based on the AVX implementation,
606#ifdef EIGEN_VECTORIZE_FMA
607 // Haswell can issue 2 add/mul/madd per cycle.
608 // 9 pmadd, 2 pmul, 1 div, 2 other
612#else
616#endif
617 // This number assumes a naive implementation of tanh
622 };
623};
624
625#if EIGEN_HAS_CXX11_MATH
626/** \internal
627 * \brief Template functor to compute the atanh of a scalar
628 * \sa class CwiseUnaryOp, ArrayBase::atanh()
629 */
630template <typename Scalar>
631struct scalar_atanh_op {
632 EIGEN_EMPTY_STRUCT_CTOR(scalar_atanh_op)
633 EIGEN_DEVICE_FUNC inline const Scalar operator()(const Scalar& a) const { return numext::atanh(a); }
634};
635
636template <typename Scalar>
637struct functor_traits<scalar_atanh_op<Scalar> > {
638 enum { Cost = 5 * NumTraits<Scalar>::MulCost, PacketAccess = false };
639};
640#endif
641
642/** \internal
643 * \brief Template functor to compute the sinh of a scalar
644 * \sa class CwiseUnaryOp, ArrayBase::sinh()
645 */
646template<typename Scalar> struct scalar_sinh_op {
648 EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a) const { return numext::sinh(a); }
649 template <typename Packet>
650 EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::psinh(a); }
651};
652template<typename Scalar>
654{
655 enum {
658 };
659};
660
661#if EIGEN_HAS_CXX11_MATH
662/** \internal
663 * \brief Template functor to compute the asinh of a scalar
664 * \sa class CwiseUnaryOp, ArrayBase::asinh()
665 */
666template <typename Scalar>
667struct scalar_asinh_op {
668 EIGEN_EMPTY_STRUCT_CTOR(scalar_asinh_op)
669 EIGEN_DEVICE_FUNC inline const Scalar operator()(const Scalar& a) const { return numext::asinh(a); }
670};
671
672template <typename Scalar>
673struct functor_traits<scalar_asinh_op<Scalar> > {
674 enum { Cost = 5 * NumTraits<Scalar>::MulCost, PacketAccess = false };
675};
676#endif
677
678/** \internal
679 * \brief Template functor to compute the cosh of a scalar
680 * \sa class CwiseUnaryOp, ArrayBase::cosh()
681 */
682template<typename Scalar> struct scalar_cosh_op {
684 EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a) const { return numext::cosh(a); }
685 template <typename Packet>
686 EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::pcosh(a); }
687};
688template<typename Scalar>
690{
691 enum {
694 };
695};
696
697#if EIGEN_HAS_CXX11_MATH
698/** \internal
699 * \brief Template functor to compute the acosh of a scalar
700 * \sa class CwiseUnaryOp, ArrayBase::acosh()
701 */
702template <typename Scalar>
703struct scalar_acosh_op {
704 EIGEN_EMPTY_STRUCT_CTOR(scalar_acosh_op)
705 EIGEN_DEVICE_FUNC inline const Scalar operator()(const Scalar& a) const { return numext::acosh(a); }
706};
707
708template <typename Scalar>
709struct functor_traits<scalar_acosh_op<Scalar> > {
710 enum { Cost = 5 * NumTraits<Scalar>::MulCost, PacketAccess = false };
711};
712#endif
713
714/** \internal
715 * \brief Template functor to compute the inverse of a scalar
716 * \sa class CwiseUnaryOp, Cwise::inverse()
717 */
718template<typename Scalar>
721 EIGEN_DEVICE_FUNC inline Scalar operator() (const Scalar& a) const { return Scalar(1)/a; }
722 template<typename Packet>
723 EIGEN_DEVICE_FUNC inline const Packet packetOp(const Packet& a) const
724 { return internal::pdiv(pset1<Packet>(Scalar(1)),a); }
725};
726template <typename Scalar>
728 enum {
731 };
732};
733
734/** \internal
735 * \brief Template functor to compute the square of a scalar
736 * \sa class CwiseUnaryOp, Cwise::square()
737 */
738template<typename Scalar>
741 EIGEN_DEVICE_FUNC inline Scalar operator() (const Scalar& a) const { return a*a; }
742 template<typename Packet>
743 EIGEN_DEVICE_FUNC inline const Packet packetOp(const Packet& a) const
744 { return internal::pmul(a,a); }
745};
746template<typename Scalar>
749
750// Boolean specialization to avoid -Wint-in-bool-context warnings on GCC.
751template<>
752struct scalar_square_op<bool> {
754 EIGEN_DEPRECATED EIGEN_DEVICE_FUNC inline bool operator() (const bool& a) const { return a; }
755 template<typename Packet>
756 EIGEN_DEPRECATED EIGEN_DEVICE_FUNC inline const Packet packetOp(const Packet& a) const
757 { return a; }
758};
759template<>
762
763/** \internal
764 * \brief Template functor to compute the cube of a scalar
765 * \sa class CwiseUnaryOp, Cwise::cube()
766 */
767template<typename Scalar>
770 EIGEN_DEVICE_FUNC inline Scalar operator() (const Scalar& a) const { return a*a*a; }
771 template<typename Packet>
772 EIGEN_DEVICE_FUNC inline const Packet packetOp(const Packet& a) const
773 { return internal::pmul(a,pmul(a,a)); }
774};
775template<typename Scalar>
778
779// Boolean specialization to avoid -Wint-in-bool-context warnings on GCC.
780template<>
781struct scalar_cube_op<bool> {
783 EIGEN_DEPRECATED EIGEN_DEVICE_FUNC inline bool operator() (const bool& a) const { return a; }
784 template<typename Packet>
785 EIGEN_DEPRECATED EIGEN_DEVICE_FUNC inline const Packet packetOp(const Packet& a) const
786 { return a; }
787};
788template<>
791
792/** \internal
793 * \brief Template functor to compute the rounded value of a scalar
794 * \sa class CwiseUnaryOp, ArrayBase::round()
795 */
796template<typename Scalar> struct scalar_round_op {
798 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a) const { return numext::round(a); }
799 template <typename Packet>
800 EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::pround(a); }
801};
802template<typename Scalar>
804{
805 enum {
808 };
809};
810
811/** \internal
812 * \brief Template functor to compute the floor of a scalar
813 * \sa class CwiseUnaryOp, ArrayBase::floor()
814 */
815template<typename Scalar> struct scalar_floor_op {
817 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a) const { return numext::floor(a); }
818 template <typename Packet>
819 EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::pfloor(a); }
820};
821template<typename Scalar>
823{
824 enum {
827 };
828};
829
830/** \internal
831 * \brief Template functor to compute the rounded (with current rounding mode) value of a scalar
832 * \sa class CwiseUnaryOp, ArrayBase::rint()
833 */
834template<typename Scalar> struct scalar_rint_op {
836 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a) const { return numext::rint(a); }
837 template <typename Packet>
838 EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::print(a); }
839};
840template<typename Scalar>
842{
843 enum {
846 };
847};
848
849/** \internal
850 * \brief Template functor to compute the ceil of a scalar
851 * \sa class CwiseUnaryOp, ArrayBase::ceil()
852 */
853template<typename Scalar> struct scalar_ceil_op {
855 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a) const { return numext::ceil(a); }
856 template <typename Packet>
857 EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::pceil(a); }
858};
859template<typename Scalar>
861{
862 enum {
865 };
866};
867
868/** \internal
869 * \brief Template functor to compute whether a scalar is NaN
870 * \sa class CwiseUnaryOp, ArrayBase::isnan()
871 */
872template<typename Scalar> struct scalar_isnan_op {
874 typedef bool result_type;
875 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator() (const Scalar& a) const {
876#if defined(SYCL_DEVICE_ONLY)
877 return numext::isnan(a);
878#else
879 return (numext::isnan)(a);
880#endif
881 }
882};
883template<typename Scalar>
885{
886 enum {
888 PacketAccess = false
889 };
890};
891
892/** \internal
893 * \brief Template functor to check whether a scalar is +/-inf
894 * \sa class CwiseUnaryOp, ArrayBase::isinf()
895 */
896template<typename Scalar> struct scalar_isinf_op {
898 typedef bool result_type;
899 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator() (const Scalar& a) const {
900#if defined(SYCL_DEVICE_ONLY)
901 return numext::isinf(a);
902#else
903 return (numext::isinf)(a);
904#endif
905 }
906};
907template<typename Scalar>
909{
910 enum {
912 PacketAccess = false
913 };
914};
915
916/** \internal
917 * \brief Template functor to check whether a scalar has a finite value
918 * \sa class CwiseUnaryOp, ArrayBase::isfinite()
919 */
920template<typename Scalar> struct scalar_isfinite_op {
922 typedef bool result_type;
923 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator() (const Scalar& a) const {
924#if defined(SYCL_DEVICE_ONLY)
925 return numext::isfinite(a);
926#else
927 return (numext::isfinite)(a);
928#endif
929 }
930};
931template<typename Scalar>
933{
934 enum {
936 PacketAccess = false
937 };
938};
939
940/** \internal
941 * \brief Template functor to compute the logical not of a boolean
942 *
943 * \sa class CwiseUnaryOp, ArrayBase::operator!
944 */
945template<typename Scalar> struct scalar_boolean_not_op {
947 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool operator() (const bool& a) const { return !a; }
948};
949template<typename Scalar>
951 enum {
953 PacketAccess = false
954 };
955};
956
957/** \internal
958 * \brief Template functor to compute the signum of a scalar
959 * \sa class CwiseUnaryOp, Cwise::sign()
960 */
961template<typename Scalar,bool is_complex=(NumTraits<Scalar>::IsComplex!=0), bool is_integer=(NumTraits<Scalar>::IsInteger!=0) > struct scalar_sign_op;
962template<typename Scalar>
963struct scalar_sign_op<Scalar, false, true> {
965 EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a) const
966 {
967 return Scalar( (a>Scalar(0)) - (a<Scalar(0)) );
968 }
969 //TODO
970 //template <typename Packet>
971 //EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::psign(a); }
972};
973
974template<typename Scalar>
975struct scalar_sign_op<Scalar, false, false> {
977 EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a) const
978 {
979 return (numext::isnan)(a) ? a : Scalar( (a>Scalar(0)) - (a<Scalar(0)) );
980 }
981 //TODO
982 //template <typename Packet>
983 //EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::psign(a); }
984};
985
986template<typename Scalar, bool is_integer>
987struct scalar_sign_op<Scalar,true, is_integer> {
989 EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a) const
990 {
991 typedef typename NumTraits<Scalar>::Real real_type;
992 real_type aa = numext::abs(a);
993 if (aa==real_type(0))
994 return Scalar(0);
995 aa = real_type(1)/aa;
996 return Scalar(a.real()*aa, a.imag()*aa );
997 }
998 //TODO
999 //template <typename Packet>
1000 //EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::psign(a); }
1001};
1002template<typename Scalar>
1004{ enum {
1005 Cost =
1007 ? ( 8*NumTraits<Scalar>::MulCost ) // roughly
1011};
1012
1013/** \internal
1014 * \brief Template functor to compute the logistic function of a scalar
1015 * \sa class CwiseUnaryOp, ArrayBase::logistic()
1016 */
1017template <typename T>
1020 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T operator()(const T& x) const {
1021 return packetOp(x);
1022 }
1023
1024 template <typename Packet> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1025 Packet packetOp(const Packet& x) const {
1026 const Packet one = pset1<Packet>(T(1));
1027 return pdiv(one, padd(one, pexp(pnegate(x))));
1028 }
1029};
1030
1031#ifndef EIGEN_GPU_COMPILE_PHASE
1032/** \internal
1033 * \brief Template specialization of the logistic function for float.
1034 *
1035 * Uses just a 9/10-degree rational interpolant which
1036 * interpolates 1/(1+exp(-x)) - 0.5 up to a couple of ulps in the range
1037 * [-9, 18]. Below -9 we use the more accurate approximation
1038 * 1/(1+exp(-x)) ~= exp(x), and above 18 the logistic function is 1 withing
1039 * one ulp. The shifted logistic is interpolated because it was easier to
1040 * make the fit converge.
1041 *
1042 */
1043template <>
1044struct scalar_logistic_op<float> {
1046 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float operator()(const float& x) const {
1047 return packetOp(x);
1048 }
1049
1050 template <typename Packet> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1051 Packet packetOp(const Packet& _x) const {
1052 const Packet cutoff_lower = pset1<Packet>(-9.f);
1053 const Packet lt_mask = pcmp_lt<Packet>(_x, cutoff_lower);
1054 const bool any_small = predux_any(lt_mask);
1055
1056 // The upper cut-off is the smallest x for which the rational approximation evaluates to 1.
1057 // Choosing this value saves us a few instructions clamping the results at the end.
1058#ifdef EIGEN_VECTORIZE_FMA
1059 const Packet cutoff_upper = pset1<Packet>(15.7243833541870117f);
1060#else
1061 const Packet cutoff_upper = pset1<Packet>(15.6437711715698242f);
1062#endif
1063 const Packet x = pmin(_x, cutoff_upper);
1064
1065 // The monomial coefficients of the numerator polynomial (odd).
1066 const Packet alpha_1 = pset1<Packet>(2.48287947061529e-01f);
1067 const Packet alpha_3 = pset1<Packet>(8.51377133304701e-03f);
1068 const Packet alpha_5 = pset1<Packet>(6.08574864600143e-05f);
1069 const Packet alpha_7 = pset1<Packet>(1.15627324459942e-07f);
1070 const Packet alpha_9 = pset1<Packet>(4.37031012579801e-11f);
1071
1072 // The monomial coefficients of the denominator polynomial (even).
1073 const Packet beta_0 = pset1<Packet>(9.93151921023180e-01f);
1074 const Packet beta_2 = pset1<Packet>(1.16817656904453e-01f);
1075 const Packet beta_4 = pset1<Packet>(1.70198817374094e-03f);
1076 const Packet beta_6 = pset1<Packet>(6.29106785017040e-06f);
1077 const Packet beta_8 = pset1<Packet>(5.76102136993427e-09f);
1078 const Packet beta_10 = pset1<Packet>(6.10247389755681e-13f);
1079
1080 // Since the polynomials are odd/even, we need x^2.
1081 const Packet x2 = pmul(x, x);
1082
1083 // Evaluate the numerator polynomial p.
1084 Packet p = pmadd(x2, alpha_9, alpha_7);
1085 p = pmadd(x2, p, alpha_5);
1086 p = pmadd(x2, p, alpha_3);
1087 p = pmadd(x2, p, alpha_1);
1088 p = pmul(x, p);
1089
1090 // Evaluate the denominator polynomial q.
1091 Packet q = pmadd(x2, beta_10, beta_8);
1092 q = pmadd(x2, q, beta_6);
1093 q = pmadd(x2, q, beta_4);
1094 q = pmadd(x2, q, beta_2);
1095 q = pmadd(x2, q, beta_0);
1096 // Divide the numerator by the denominator and shift it up.
1097 const Packet logistic = padd(pdiv(p, q), pset1<Packet>(0.5f));
1098 if (EIGEN_PREDICT_FALSE(any_small)) {
1099 const Packet exponential = pexp(_x);
1100 return pselect(lt_mask, exponential, logistic);
1101 } else {
1102 return logistic;
1103 }
1104 }
1105};
1106#endif // #ifndef EIGEN_GPU_COMPILE_PHASE
1107
1108template <typename T>
1110 enum {
1111 // The cost estimate for float here here is for the common(?) case where
1112 // all arguments are greater than -9.
1116 : NumTraits<T>::AddCost * 2 +
1118 PacketAccess =
1125};
1126
1127} // end namespace internal
1128
1129} // end namespace Eigen
1130
1131#endif // EIGEN_FUNCTORS_H
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const ArgReturnType arg() const
Definition: ArrayCwiseUnaryOps.h:66
EIGEN_DEVICE_FUNC const LogisticReturnType logistic() const
Definition: ArrayCwiseUnaryOps.h:397
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
internal::enable_if< internal::valid_indexed_view_overload< RowIndices, ColIndices >::value &&internal::traits< typenameEIGEN_INDEXED_VIEW_METHOD_TYPE< RowIndices, ColIndices >::type >::ReturnAsIndexedView, typenameEIGEN_INDEXED_VIEW_METHOD_TYPE< RowIndices, ColIndices >::type >::type operator()(const RowIndices &rowIndices, const ColIndices &colIndices) EIGEN_INDEXED_VIEW_METHOD_CONST
Definition: IndexedViewMethods.h:73
#define EIGEN_DEPRECATED
Definition: Macros.h:1068
#define EIGEN_USING_STD(FUNC)
Definition: Macros.h:1195
#define EIGEN_PREDICT_FALSE(x)
Definition: Macros.h:1331
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:986
#define EIGEN_FAST_MATH
Allows to disable some optimizations which might affect the accuracy of the result.
Definition: Macros.h:49
#define EIGEN_STRONG_INLINE
Definition: Macros.h:927
#define EIGEN_LOG2E
Definition: MathFunctions.h:17
#define EIGEN_EMPTY_STRUCT_CTOR(X)
Definition: XprHelper.h:22
constexpr return_t< T > acosh(const T x) noexcept
Compile-time inverse hyperbolic cosine function.
Definition: acosh.hpp:62
constexpr return_t< T > asinh(const T x) noexcept
Compile-time inverse hyperbolic sine function.
Definition: asinh.hpp:59
constexpr return_t< T > atanh(const T x) noexcept
Compile-time inverse hyperbolic tangent function.
Definition: atanh.hpp:73
Definition: core.h:1240
bool_constant< is_integral< T >::value &&!std::is_same< T, bool >::value &&!std::is_same< T, char >::value &&!std::is_same< T, wchar_t >::value > is_integer
Definition: format.h:3433
UnitType round(const UnitType x) noexcept
Round to nearest.
Definition: math.h:591
dimensionless::scalar_t expm1(const ScalarUnit x) noexcept
Compute exponential minus one.
Definition: math.h:420
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
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pexpm1(const Packet &a)
Definition: GenericPacketMath.h:792
EIGEN_DEVICE_FUNC Packet padd(const Packet &a, const Packet &b)
Definition: GenericPacketMath.h:215
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet plog10(const Packet &a)
Definition: GenericPacketMath.h:804
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_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet plog2(const Packet &a)
Definition: GenericPacketMath.h:808
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_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_STRONG_INLINE Packet4f print(const Packet4f &a)
Definition: PacketMath.h:646
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_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet ptan(const Packet &a)
Definition: GenericPacketMath.h:760
EIGEN_STRONG_INLINE Packet8f pconj(const Packet8f &a)
Definition: PacketMath.h:295
EIGEN_DEVICE_FUNC Packet pmul(const Packet &a, const Packet &b)
Definition: GenericPacketMath.h:237
EIGEN_DEVICE_FUNC Packet pmin(const Packet &a, const Packet &b)
Definition: GenericPacketMath.h:512
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_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 bool predux_any(const Packet8f &x)
Definition: PacketMath.h:857
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet psinh(const Packet &a)
Definition: GenericPacketMath.h:776
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pasin(const Packet &a)
Definition: GenericPacketMath.h:764
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_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 EIGEN_ALWAYS_INLINE T log(const T &x)
Definition: MathFunctions.h:1489
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool() isinf(const Eigen::bfloat16 &h)
Definition: BFloat16.h:665
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool() isfinite(const Eigen::bfloat16 &h)
Definition: BFloat16.h:671
EIGEN_DEVICE_FUNC T() floor(const T &x)
Definition: MathFunctions.h:1400
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T cos(const T &x)
Definition: MathFunctions.h:1600
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T rsqrt(const T &x)
Definition: MathFunctions.h:1482
EIGEN_DEVICE_FUNC internal::add_const_on_value_type< EIGEN_MATHFUNC_RETVAL(imag_ref, Scalar)>::type imag_ref(const Scalar &x)
Definition: MathFunctions.h:1265
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool() isnan(const Eigen::bfloat16 &h)
Definition: BFloat16.h:659
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T asin(const T &x)
Definition: MathFunctions.h:1686
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T tanh(const T &x)
Definition: MathFunctions.h:1783
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T atan(const T &x)
Definition: MathFunctions.h:1715
EIGEN_DEVICE_FUNC T() ceil(const T &x)
Definition: MathFunctions.h:1420
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T cosh(const T &x)
Definition: MathFunctions.h:1745
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T exp(const T &x)
Definition: MathFunctions.h:1546
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T sin(const T &x)
Definition: MathFunctions.h:1619
EIGEN_DEVICE_FUNC internal::add_const_on_value_type< EIGEN_MATHFUNC_RETVAL(real_ref, Scalar)>::type real_ref(const Scalar &x)
Definition: MathFunctions.h:1237
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T acos(const T &x)
Definition: MathFunctions.h:1657
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE float sqrt(const float &x)
Definition: MathFunctions.h:177
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T tan(const T &x)
Definition: MathFunctions.h:1638
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
EIGEN_DEVICE_FUNC bool abs2(bool x)
Definition: MathFunctions.h:1292
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T sinh(const T &x)
Definition: MathFunctions.h:1764
Namespace containing all symbols from the Eigen library.
Definition: Core:141
Definition: Eigen_Colamd.h:50
@ MulCost
Definition: NumTraits.h:161
Holds information about the various numeric (i.e.
Definition: NumTraits.h:233
Definition: UnaryFunctors.h:72
NumTraits< Scalar >::Real result_type
Definition: UnaryFunctors.h:74
Definition: XprHelper.h:176
@ PacketAccess
Definition: XprHelper.h:180
@ Cost
Definition: XprHelper.h:179
Definition: Meta.h:148
Definition: GenericPacketMath.h:107
Definition: UnaryFunctors.h:91
NumTraits< Scalar >::Real result_type
Definition: UnaryFunctors.h:93
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet packetOp(const Packet &a) const
Definition: UnaryFunctors.h:97
Definition: UnaryFunctors.h:41
NumTraits< Scalar >::Real result_type
Definition: UnaryFunctors.h:43
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet packetOp(const Packet &a) const
Definition: UnaryFunctors.h:46
Definition: UnaryFunctors.h:534
EIGEN_DEVICE_FUNC Packet packetOp(const Packet &a) const
Definition: UnaryFunctors.h:538
Definition: UnaryFunctors.h:138
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet packetOp(const Packet &a) const
Definition: UnaryFunctors.h:143
NumTraits< Scalar >::Real result_type
Definition: UnaryFunctors.h:140
Definition: UnaryFunctors.h:553
EIGEN_DEVICE_FUNC Packet packetOp(const Packet &a) const
Definition: UnaryFunctors.h:557
Definition: UnaryFunctors.h:573
EIGEN_DEVICE_FUNC Packet packetOp(const Packet &a) const
Definition: UnaryFunctors.h:577
Definition: UnaryFunctors.h:945
Definition: UnaryFunctors.h:160
NewType result_type
Definition: UnaryFunctors.h:162
Definition: UnaryFunctors.h:853
EIGEN_DEVICE_FUNC Packet packetOp(const Packet &a) const
Definition: UnaryFunctors.h:857
Definition: UnaryFunctors.h:109
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet packetOp(const Packet &a) const
Definition: UnaryFunctors.h:114
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator()(const Scalar &a) const
Definition: UnaryFunctors.h:112
Definition: UnaryFunctors.h:476
EIGEN_DEVICE_FUNC Packet packetOp(const Packet &a) const
Definition: UnaryFunctors.h:480
Definition: UnaryFunctors.h:682
EIGEN_DEVICE_FUNC Packet packetOp(const Packet &a) const
Definition: UnaryFunctors.h:686
EIGEN_DEPRECATED EIGEN_DEVICE_FUNC const Packet packetOp(const Packet &a) const
Definition: UnaryFunctors.h:785
Definition: UnaryFunctors.h:768
EIGEN_DEVICE_FUNC const Packet packetOp(const Packet &a) const
Definition: UnaryFunctors.h:772
Definition: XprHelper.h:710
Definition: UnaryFunctors.h:277
EIGEN_DEVICE_FUNC Packet packetOp(const Packet &a) const
Definition: UnaryFunctors.h:281
Definition: UnaryFunctors.h:317
EIGEN_DEVICE_FUNC Packet packetOp(const Packet &a) const
Definition: UnaryFunctors.h:321
Definition: UnaryFunctors.h:815
EIGEN_DEVICE_FUNC Packet packetOp(const Packet &a) const
Definition: UnaryFunctors.h:819
Definition: UnaryFunctors.h:229
NumTraits< Scalar >::Real result_type
Definition: UnaryFunctors.h:231
Definition: UnaryFunctors.h:261
NumTraits< Scalar >::Real result_type
Definition: UnaryFunctors.h:263
Definition: UnaryFunctors.h:719
EIGEN_DEVICE_FUNC const Packet packetOp(const Packet &a) const
Definition: UnaryFunctors.h:723
Definition: UnaryFunctors.h:920
bool result_type
Definition: UnaryFunctors.h:922
Definition: UnaryFunctors.h:896
bool result_type
Definition: UnaryFunctors.h:898
Definition: UnaryFunctors.h:872
bool result_type
Definition: UnaryFunctors.h:874
Definition: UnaryFunctors.h:388
EIGEN_DEVICE_FUNC Packet packetOp(const Packet &a) const
Definition: UnaryFunctors.h:392
Definition: UnaryFunctors.h:368
EIGEN_DEVICE_FUNC Packet packetOp(const Packet &a) const
Definition: UnaryFunctors.h:372
Definition: UnaryFunctors.h:404
EIGEN_DEVICE_FUNC Packet packetOp(const Packet &a) const
Definition: UnaryFunctors.h:408
Definition: UnaryFunctors.h:337
EIGEN_DEVICE_FUNC Packet packetOp(const Packet &a) const
Definition: UnaryFunctors.h:341
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet &_x) const
Definition: UnaryFunctors.h:1051
Definition: UnaryFunctors.h:1018
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet &x) const
Definition: UnaryFunctors.h:1025
Definition: UnaryFunctors.h:22
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet packetOp(const Packet &a) const
Definition: UnaryFunctors.h:26
Definition: UnaryFunctors.h:213
NumTraits< Scalar >::Real result_type
Definition: UnaryFunctors.h:215
Definition: UnaryFunctors.h:245
NumTraits< Scalar >::Real result_type
Definition: UnaryFunctors.h:247
Definition: UnaryFunctors.h:834
EIGEN_DEVICE_FUNC Packet packetOp(const Packet &a) const
Definition: UnaryFunctors.h:838
Definition: UnaryFunctors.h:796
EIGEN_DEVICE_FUNC Packet packetOp(const Packet &a) const
Definition: UnaryFunctors.h:800
Definition: UnaryFunctors.h:457
EIGEN_DEVICE_FUNC Packet packetOp(const Packet &a) const
Definition: UnaryFunctors.h:461
Definition: UnaryFunctors.h:64
void Score_is_abs
Definition: UnaryFunctors.h:65
Definition: UnaryFunctors.h:194
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet packetOp(const Packet &a) const
Definition: UnaryFunctors.h:200
Definition: UnaryFunctors.h:175
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet packetOp(const Packet &a) const
Definition: UnaryFunctors.h:181
Definition: UnaryFunctors.h:961
Definition: UnaryFunctors.h:495
EIGEN_DEVICE_FUNC Packet packetOp(const Packet &a) const
Definition: UnaryFunctors.h:499
Definition: UnaryFunctors.h:646
EIGEN_DEVICE_FUNC Packet packetOp(const Packet &a) const
Definition: UnaryFunctors.h:650
EIGEN_DEPRECATED EIGEN_DEVICE_FUNC Packet packetOp(const Packet &a) const
Definition: UnaryFunctors.h:446
Definition: UnaryFunctors.h:418
EIGEN_DEVICE_FUNC Packet packetOp(const Packet &a) const
Definition: UnaryFunctors.h:422
EIGEN_DEPRECATED EIGEN_DEVICE_FUNC const Packet packetOp(const Packet &a) const
Definition: UnaryFunctors.h:756
Definition: UnaryFunctors.h:739
EIGEN_DEVICE_FUNC const Packet packetOp(const Packet &a) const
Definition: UnaryFunctors.h:743
Definition: UnaryFunctors.h:515
EIGEN_DEVICE_FUNC Packet packetOp(const Packet &a) const
Definition: UnaryFunctors.h:519
Definition: UnaryFunctors.h:593
EIGEN_DEVICE_FUNC Packet packetOp(const Packet &x) const
Definition: UnaryFunctors.h:597