Eigen::half_impl Namespace Reference

Classes

struct  __half_raw
 
struct  half_base
 
struct  numeric_limits_half_impl
 
union  float32_bits
 

Functions

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR __half_raw raw_uint16_to_half (numext::uint16_t x)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC __half_raw float_to_half_rtne (float ff)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC float half_to_float (__half_raw h)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half operator+ (const half &a, const half &b)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half operator* (const half &a, const half &b)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half operator- (const half &a, const half &b)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half operator/ (const half &a, const half &b)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half operator- (const half &a)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC halfoperator+= (half &a, const half &b)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC halfoperator*= (half &a, const half &b)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC halfoperator-= (half &a, const half &b)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC halfoperator/= (half &a, const half &b)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bool operator== (const half &a, const half &b)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bool operator!= (const half &a, const half &b)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bool operator< (const half &a, const half &b)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bool operator<= (const half &a, const half &b)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bool operator> (const half &a, const half &b)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bool operator>= (const half &a, const half &b)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half operator/ (const half &a, Index b)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half operator++ (half &a)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half operator-- (half &a)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half operator++ (half &a, int)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half operator-- (half &a, int)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC numext::uint16_t raw_half_as_uint16 (const __half_raw &h)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bool() isinf (const half &a)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bool() isnan (const half &a)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bool() isfinite (const half &a)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half abs (const half &a)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half exp (const half &a)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half exp2 (const half &a)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half expm1 (const half &a)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half log (const half &a)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half log1p (const half &a)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half log10 (const half &a)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half log2 (const half &a)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half sqrt (const half &a)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half pow (const half &a, const half &b)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half atan2 (const half &a, const half &b)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half sin (const half &a)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half cos (const half &a)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half tan (const half &a)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half tanh (const half &a)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half asin (const half &a)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half acos (const half &a)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half atan (const half &a)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half atanh (const half &a)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half floor (const half &a)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half ceil (const half &a)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half rint (const half &a)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half round (const half &a)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half trunc (const half &a)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half fmod (const half &a, const half &b)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half() min (const half &a, const half &b)
 
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half() max (const half &a, const half &b)
 
EIGEN_ALWAYS_INLINE std::ostream & operator<< (std::ostream &os, const half &v)
 

Function Documentation

◆ abs()

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half Eigen::half_impl::abs ( const half a)
658  {
659 #if defined(EIGEN_HAS_ARM64_FP16_SCALAR_ARITHMETIC)
660  return half(vabsh_f16(a.x));
661 #else
662  half result;
663  result.x = a.x & 0x7FFF;
664  return result;
665 #endif
666 }
const Scalar * a
Definition: level2_cplx_impl.h:32

References a, and Eigen::half_impl::__half_raw::x.

◆ acos()

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half Eigen::half_impl::acos ( const half a)
718 { return half(::acosf(float(a))); }

References a.

◆ asin()

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half Eigen::half_impl::asin ( const half a)
717 { return half(::asinf(float(a))); }

References a.

◆ atan()

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half Eigen::half_impl::atan ( const half a)
719 { return half(::atanf(float(a))); }

References a.

◆ atan2()

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half Eigen::half_impl::atan2 ( const half a,
const half b 
)
710  {
711  return half(::atan2f(float(a), float(b)));
712 }
Scalar * b
Definition: benchVecAdd.cpp:17

References a, and b.

◆ atanh()

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half Eigen::half_impl::atanh ( const half a)
720 { return half(::atanhf(float(a))); }

References a.

◆ ceil()

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half Eigen::half_impl::ceil ( const half a)
729  {
730 #if (EIGEN_CUDA_SDK_VER >= 80000 && defined EIGEN_CUDA_ARCH && EIGEN_CUDA_ARCH >= 300) || \
731  defined(EIGEN_HIP_DEVICE_COMPILE)
732  return half(hceil(a));
733 #else
734  return half(::ceilf(float(a)));
735 #endif
736 }

References a.

◆ cos()

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half Eigen::half_impl::cos ( const half a)
714 { return half(::cosf(float(a))); }

References a.

◆ exp()

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half Eigen::half_impl::exp ( const half a)
667  {
668 #if (EIGEN_CUDA_SDK_VER >= 80000 && defined EIGEN_CUDA_ARCH && EIGEN_CUDA_ARCH >= 530) || \
669  defined(EIGEN_HIP_DEVICE_COMPILE)
670  return half(hexp(a));
671 #else
672  return half(::expf(float(a)));
673 #endif
674 }

References a.

Referenced by half_to_float().

◆ exp2()

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half Eigen::half_impl::exp2 ( const half a)
675  {
676 #if (EIGEN_CUDA_SDK_VER >= 80000 && defined EIGEN_CUDA_ARCH && EIGEN_CUDA_ARCH >= 530) || \
677  defined(EIGEN_HIP_DEVICE_COMPILE)
678  return half(hexp2(a));
679 #else
680  return half(::exp2f(float(a)));
681 #endif
682 }

References a.

◆ expm1()

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half Eigen::half_impl::expm1 ( const half a)
683 { return half(numext::expm1(float(a))); }
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half expm1(const half &a)
Definition: Half.h:683

References a.

◆ float_to_half_rtne()

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC __half_raw Eigen::half_impl::float_to_half_rtne ( float  ff)
530  {
531 #if (defined(EIGEN_HAS_CUDA_FP16) && defined(EIGEN_CUDA_ARCH) && EIGEN_CUDA_ARCH >= 300) || \
532  (defined(EIGEN_HAS_HIP_FP16) && defined(EIGEN_HIP_DEVICE_COMPILE))
533  __half tmp_ff = __float2half(ff);
534  return *(__half_raw*)&tmp_ff;
535 
536 #elif defined(EIGEN_HAS_FP16_C)
537  __half_raw h;
538 #if EIGEN_COMP_MSVC
539  // MSVC does not have scalar instructions.
540  h.x = _mm_extract_epi16(_mm_cvtps_ph(_mm_set_ss(ff), 0), 0);
541 #else
542  h.x = _cvtss_sh(ff, 0);
543 #endif
544  return h;
545 
546 #elif defined(EIGEN_HAS_ARM64_FP16_SCALAR_ARITHMETIC)
547  __half_raw h;
548  h.x = static_cast<__fp16>(ff);
549  return h;
550 
551 #else
552  float32_bits f;
553  f.f = ff;
554 
555  const float32_bits f32infty = {255 << 23};
556  const float32_bits f16max = {(127 + 16) << 23};
557  const float32_bits denorm_magic = {((127 - 15) + (23 - 10) + 1) << 23};
558  unsigned int sign_mask = 0x80000000u;
559  __half_raw o;
560  o.x = static_cast<numext::uint16_t>(0x0u);
561 
562  unsigned int sign = f.u & sign_mask;
563  f.u ^= sign;
564 
565  // NOTE all the integer compares in this function can be safely
566  // compiled into signed compares since all operands are below
567  // 0x80000000. Important if you want fast straight SSE2 code
568  // (since there's no unsigned PCMPGTD).
569 
570  if (f.u >= f16max.u) { // result is Inf or NaN (all exponent bits set)
571  o.x = (f.u > f32infty.u) ? 0x7e00 : 0x7c00; // NaN->qNaN and Inf->Inf
572  } else { // (De)normalized number or zero
573  if (f.u < (113 << 23)) { // resulting FP16 is subnormal or zero
574  // use a magic value to align our 10 mantissa bits at the bottom of
575  // the float. as long as FP addition is round-to-nearest-even this
576  // just works.
577  f.f += denorm_magic.f;
578 
579  // and one integer subtract of the bias later, we have our final float!
580  o.x = static_cast<numext::uint16_t>(f.u - denorm_magic.u);
581  } else {
582  unsigned int mant_odd = (f.u >> 13) & 1; // resulting mantissa is odd
583 
584  // update exponent, rounding bias part 1
585  // Equivalent to `f.u += ((unsigned int)(15 - 127) << 23) + 0xfff`, but
586  // without arithmetic overflow.
587  f.u += 0xc8000fffU;
588  // rounding bias part 2
589  f.u += mant_odd;
590  // take the bits!
591  o.x = static_cast<numext::uint16_t>(f.u >> 13);
592  }
593  }
594 
595  o.x |= static_cast<numext::uint16_t>(sign >> 16);
596  return o;
597 #endif
598 }
static int f(const TensorMap< Tensor< int, 3 > > &tensor)
Definition: cxx11_tensor_map.cpp:237
std::uint16_t uint16_t
Definition: Meta.h:38
T sign(T x)
Definition: cxx11_tensor_builtins_sycl.cpp:172

References Eigen::half_impl::float32_bits::f, f(), SYCL::sign(), Eigen::half_impl::float32_bits::u, and Eigen::half_impl::__half_raw::x.

◆ floor()

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half Eigen::half_impl::floor ( const half a)
721  {
722 #if (EIGEN_CUDA_SDK_VER >= 80000 && defined EIGEN_CUDA_ARCH && EIGEN_CUDA_ARCH >= 300) || \
723  defined(EIGEN_HIP_DEVICE_COMPILE)
724  return half(hfloor(a));
725 #else
726  return half(::floorf(float(a)));
727 #endif
728 }

References a.

◆ fmod()

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half Eigen::half_impl::fmod ( const half a,
const half b 
)
740  {
741  return half(::fmodf(float(a), float(b)));
742 }

References a, and b.

◆ half_to_float()

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC float Eigen::half_impl::half_to_float ( __half_raw  h)
600  {
601 #if (defined(EIGEN_HAS_CUDA_FP16) && defined(EIGEN_CUDA_ARCH) && EIGEN_CUDA_ARCH >= 300) || \
602  (defined(EIGEN_HAS_HIP_FP16) && defined(EIGEN_HIP_DEVICE_COMPILE))
603  return __half2float(h);
604 #elif defined(EIGEN_HAS_FP16_C)
605 #if EIGEN_COMP_MSVC
606  // MSVC does not have scalar instructions.
607  return _mm_cvtss_f32(_mm_cvtph_ps(_mm_set1_epi16(h.x)));
608 #else
609  return _cvtsh_ss(h.x);
610 #endif
611 #elif defined(EIGEN_HAS_ARM64_FP16_SCALAR_ARITHMETIC)
612  return static_cast<float>(h.x);
613 #else
614  const float32_bits magic = {113 << 23};
615  const unsigned int shifted_exp = 0x7c00 << 13; // exponent mask after shift
616  float32_bits o;
617 
618  o.u = (h.x & 0x7fff) << 13; // exponent/mantissa bits
619  unsigned int exp = shifted_exp & o.u; // just the exponent
620  o.u += (127 - 15) << 23; // exponent adjust
621 
622  // handle exponent special cases
623  if (exp == shifted_exp) { // Inf/NaN?
624  o.u += (128 - 16) << 23; // extra exp adjust
625  } else if (exp == 0) { // Zero/Denormal?
626  o.u += 1 << 23; // extra exp adjust
627  o.f -= magic.f; // renormalize
628  }
629 
630  o.u |= (h.x & 0x8000) << 16; // sign bit
631  return o.f;
632 #endif
633 }
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half exp(const half &a)
Definition: Half.h:667

References exp(), Eigen::half_impl::float32_bits::f, Eigen::half_impl::float32_bits::u, and Eigen::half_impl::__half_raw::x.

Referenced by Eigen::half::operator float().

◆ isfinite()

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bool() Eigen::half_impl::isfinite ( const half a)
654  {
655  return !(isinf EIGEN_NOT_A_MACRO(a)) && !(isnan EIGEN_NOT_A_MACRO(a));
656 }
#define EIGEN_NOT_A_MACRO
Definition: Macros.h:813
#define isnan(X)
Definition: main.h:109
#define isinf(X)
Definition: main.h:110

References a, EIGEN_NOT_A_MACRO, isinf(), and isnan().

◆ isinf()

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bool() Eigen::half_impl::isinf ( const half a)
637  {
638 #ifdef EIGEN_HAS_ARM64_FP16_SCALAR_ARITHMETIC
639  return (numext::bit_cast<numext::uint16_t>(a.x) & 0x7fff) == 0x7c00;
640 #else
641  return (a.x & 0x7fff) == 0x7c00;
642 #endif
643 }

References a.

Referenced by isfinite().

◆ isnan()

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bool() Eigen::half_impl::isnan ( const half a)
644  {
645 #if (defined(EIGEN_HAS_CUDA_FP16) && defined(EIGEN_CUDA_ARCH) && EIGEN_CUDA_ARCH >= 530) || \
646  (defined(EIGEN_HAS_HIP_FP16) && defined(EIGEN_HIP_DEVICE_COMPILE))
647  return __hisnan(a);
648 #elif defined(EIGEN_HAS_ARM64_FP16_SCALAR_ARITHMETIC)
649  return (numext::bit_cast<numext::uint16_t>(a.x) & 0x7fff) > 0x7c00;
650 #else
651  return (a.x & 0x7fff) > 0x7c00;
652 #endif
653 }

References a.

Referenced by isfinite().

◆ log()

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half Eigen::half_impl::log ( const half a)
684  {
685 #if (defined(EIGEN_HAS_CUDA_FP16) && EIGEN_CUDA_SDK_VER >= 80000 && defined(EIGEN_CUDA_ARCH) && \
686  EIGEN_CUDA_ARCH >= 530) || \
687  (defined(EIGEN_HAS_HIP_FP16) && defined(EIGEN_HIP_DEVICE_COMPILE))
688  return half(hlog(a));
689 #else
690  return half(::logf(float(a)));
691 #endif
692 }

References a.

◆ log10()

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half Eigen::half_impl::log10 ( const half a)
694 { return half(::log10f(float(a))); }

References a.

◆ log1p()

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half Eigen::half_impl::log1p ( const half a)
693 { return half(numext::log1p(float(a))); }
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half log1p(const half &a)
Definition: Half.h:693

References a.

◆ log2()

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half Eigen::half_impl::log2 ( const half a)
695  {
696  return half(static_cast<float>(EIGEN_LOG2E) * ::logf(float(a)));
697 }
#define EIGEN_LOG2E
Definition: MathFunctions.h:17

References a, and EIGEN_LOG2E.

◆ max()

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half() Eigen::half_impl::max ( const half a,
const half b 
)
754  {
755 #if (defined(EIGEN_HAS_CUDA_FP16) && defined(EIGEN_CUDA_ARCH) && EIGEN_CUDA_ARCH >= 530) || \
756  (defined(EIGEN_HAS_HIP_FP16) && defined(EIGEN_HIP_DEVICE_COMPILE))
757  return __hlt(a, b) ? b : a;
758 #else
759  const float f1 = static_cast<float>(a);
760  const float f2 = static_cast<float>(b);
761  return f1 < f2 ? b : a;
762 #endif
763 }
double f2(const Vector< double > &coord)
f2 function, in front of the C2 unknown
Definition: poisson/poisson_with_singularity/two_d_poisson.cc:233
double f1(const Vector< double > &coord)
f1 function, in front of the C1 unknown
Definition: poisson/poisson_with_singularity/two_d_poisson.cc:147

References a, b, Global_parameters::f1(), and Global_parameters::f2().

◆ min()

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half() Eigen::half_impl::min ( const half a,
const half b 
)
744  {
745 #if (defined(EIGEN_HAS_CUDA_FP16) && defined(EIGEN_CUDA_ARCH) && EIGEN_CUDA_ARCH >= 530) || \
746  (defined(EIGEN_HAS_HIP_FP16) && defined(EIGEN_HIP_DEVICE_COMPILE))
747  return __hlt(b, a) ? b : a;
748 #else
749  const float f1 = static_cast<float>(a);
750  const float f2 = static_cast<float>(b);
751  return f2 < f1 ? b : a;
752 #endif
753 }

References a, b, Global_parameters::f1(), and Global_parameters::f2().

◆ operator!=()

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bool Eigen::half_impl::operator!= ( const half a,
const half b 
)
450  {
451  return numext::not_equal_strict(float(a), float(b));
452 }
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bool not_equal_strict(const X &x, const Y &y)
Definition: Meta.h:606

References a, b, and Eigen::numext::not_equal_strict().

◆ operator*()

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half Eigen::half_impl::operator* ( const half a,
const half b 
)
423 { return half(float(a) * float(b)); }

References a, and b.

◆ operator*=()

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half& Eigen::half_impl::operator*= ( half a,
const half b 
)
435  {
436  a = half(float(a) * float(b));
437  return a;
438 }

References a, and b.

◆ operator+()

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half Eigen::half_impl::operator+ ( const half a,
const half b 
)
422 { return half(float(a) + float(b)); }

References a, and b.

◆ operator++() [1/2]

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half Eigen::half_impl::operator++ ( half a)
469  {
470  a += half(1);
471  return a;
472 }

References a.

◆ operator++() [2/2]

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half Eigen::half_impl::operator++ ( half a,
int   
)
479  {
480  half original_value = a;
481  ++a;
482  return original_value;
483 }

References a.

◆ operator+=()

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half& Eigen::half_impl::operator+= ( half a,
const half b 
)
431  {
432  a = half(float(a) + float(b));
433  return a;
434 }

References a, and b.

◆ operator-() [1/2]

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half Eigen::half_impl::operator- ( const half a)
426  {
427  half result;
428  result.x = a.x ^ 0x8000;
429  return result;
430 }

References a, and Eigen::half_impl::__half_raw::x.

◆ operator-() [2/2]

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half Eigen::half_impl::operator- ( const half a,
const half b 
)
424 { return half(float(a) - float(b)); }

References a, and b.

◆ operator--() [1/2]

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half Eigen::half_impl::operator-- ( half a)
474  {
475  a -= half(1);
476  return a;
477 }

References a.

◆ operator--() [2/2]

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half Eigen::half_impl::operator-- ( half a,
int   
)
485  {
486  half original_value = a;
487  --a;
488  return original_value;
489 }

References a.

◆ operator-=()

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half& Eigen::half_impl::operator-= ( half a,
const half b 
)
439  {
440  a = half(float(a) - float(b));
441  return a;
442 }

References a, and b.

◆ operator/() [1/2]

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half Eigen::half_impl::operator/ ( const half a,
const half b 
)
425 { return half(float(a) / float(b)); }

References a, and b.

◆ operator/() [2/2]

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half Eigen::half_impl::operator/ ( const half a,
Index  b 
)
465  {
466  return half(static_cast<float>(a) / static_cast<float>(b));
467 }

References a, and b.

◆ operator/=()

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half& Eigen::half_impl::operator/= ( half a,
const half b 
)
443  {
444  a = half(float(a) / float(b));
445  return a;
446 }

References a, and b.

◆ operator<()

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bool Eigen::half_impl::operator< ( const half a,
const half b 
)
453 { return float(a) < float(b); }

References a, and b.

◆ operator<<()

EIGEN_ALWAYS_INLINE std::ostream& Eigen::half_impl::operator<< ( std::ostream &  os,
const half v 
)
766  {
767  os << static_cast<float>(v);
768  return os;
769 }
Array< int, Dynamic, 1 > v
Definition: Array_initializer_list_vector_cxx11.cpp:1

References v.

◆ operator<=()

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bool Eigen::half_impl::operator<= ( const half a,
const half b 
)
454 { return float(a) <= float(b); }

References a, and b.

◆ operator==()

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bool Eigen::half_impl::operator== ( const half a,
const half b 
)
447  {
448  return numext::equal_strict(float(a), float(b));
449 }
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bool equal_strict(const X &x, const Y &y)
Definition: Meta.h:571

References a, b, and Eigen::numext::equal_strict().

◆ operator>()

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bool Eigen::half_impl::operator> ( const half a,
const half b 
)
455 { return float(a) > float(b); }

References a, and b.

◆ operator>=()

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bool Eigen::half_impl::operator>= ( const half a,
const half b 
)
456 { return float(a) >= float(b); }

References a, and b.

◆ pow()

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half Eigen::half_impl::pow ( const half a,
const half b 
)
707  {
708  return half(::powf(float(a), float(b)));
709 }

References a, and b.

◆ raw_half_as_uint16()

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC numext::uint16_t Eigen::half_impl::raw_half_as_uint16 ( const __half_raw h)
512  {
513  // HIP/CUDA/Default have a member 'x' of type uint16_t.
514  // For ARM64 native half, the member 'x' is of type __fp16, so we need to bit-cast.
515  // For SYCL, cl::sycl::half is _Float16, so cast directly.
516 #if defined(EIGEN_HAS_ARM64_FP16_SCALAR_ARITHMETIC)
517  return numext::bit_cast<numext::uint16_t>(h.x);
518 #elif defined(SYCL_DEVICE_ONLY)
519  return numext::bit_cast<numext::uint16_t>(h);
520 #else
521  return h.x;
522 #endif
523 }

References Eigen::half_impl::__half_raw::x.

Referenced by Eigen::numext::bit_cast< uint16_t, Eigen::half >().

◆ raw_uint16_to_half()

496  {
497  // We cannot simply do a "return __half_raw(x)" here, because __half_raw is union type
498  // in the hip_fp16 header file, and that will trigger a compile error
499  // On the other hand, having anything but a return statement also triggers a compile error
500  // because this is constexpr function.
501  // Fortunately, since we need to disable EIGEN_CONSTEXPR for GPU anyway, we can get out
502  // of this catch22 by having separate bodies for GPU / non GPU
503 #if defined(EIGEN_HAS_GPU_FP16)
504  __half_raw h;
505  h.x = x;
506  return h;
507 #else
508  return __half_raw(x);
509 #endif
510 }
list x
Definition: plotDoE.py:28

References plotDoE::x, and Eigen::half_impl::__half_raw::x.

Referenced by Eigen::numext::bit_cast< Eigen::half, uint16_t >(), Eigen::half_impl::numeric_limits_half_impl< typename >::denorm_min(), Eigen::NumTraits< Eigen::half >::dummy_precision(), Eigen::half_impl::numeric_limits_half_impl< typename >::epsilon(), Eigen::NumTraits< Eigen::half >::epsilon(), Eigen::NumTraits< Eigen::half >::highest(), Eigen::half_impl::numeric_limits_half_impl< typename >::infinity(), Eigen::NumTraits< Eigen::half >::infinity(), Eigen::half_impl::numeric_limits_half_impl< typename >::lowest(), Eigen::NumTraits< Eigen::half >::lowest(), Eigen::half_impl::numeric_limits_half_impl< typename >::max(), Eigen::half_impl::numeric_limits_half_impl< typename >::min(), Eigen::internal::pfirst< Packet16h >(), Eigen::internal::pfirst< Packet32h >(), Eigen::half_impl::numeric_limits_half_impl< typename >::quiet_NaN(), Eigen::NumTraits< Eigen::half >::quiet_NaN(), Eigen::half_impl::numeric_limits_half_impl< typename >::round_error(), and Eigen::half_impl::numeric_limits_half_impl< typename >::signaling_NaN().

◆ rint()

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half Eigen::half_impl::rint ( const half a)
737 { return half(::rintf(float(a))); }

References a.

◆ round()

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half Eigen::half_impl::round ( const half a)
738 { return half(::roundf(float(a))); }

References a.

◆ sin()

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half Eigen::half_impl::sin ( const half a)
713 { return half(::sinf(float(a))); }

References a.

◆ sqrt()

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half Eigen::half_impl::sqrt ( const half a)
699  {
700 #if (EIGEN_CUDA_SDK_VER >= 80000 && defined EIGEN_CUDA_ARCH && EIGEN_CUDA_ARCH >= 530) || \
701  defined(EIGEN_HIP_DEVICE_COMPILE)
702  return half(hsqrt(a));
703 #else
704  return half(::sqrtf(float(a)));
705 #endif
706 }

References a.

◆ tan()

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half Eigen::half_impl::tan ( const half a)
715 { return half(::tanf(float(a))); }

References a.

◆ tanh()

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half Eigen::half_impl::tanh ( const half a)
716 { return half(::tanhf(float(a))); }

References a.

◆ trunc()

EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half Eigen::half_impl::trunc ( const half a)
739 { return half(::truncf(float(a))); }

References a.