10#ifndef TLAPACK_EIGEN_HALF_HH
11#define TLAPACK_EIGEN_HALF_HH
23 using type = Eigen::half;
24 constexpr static bool is_real =
true;
29 using type = std::complex<Eigen::half>;
34inline Eigen::half pow(
int base,
const Eigen::half&
exp)
36 return Eigen::half_impl::pow(Eigen::half(
base),
exp);
41inline std::complex<Eigen::half> sqrt(
const std::complex<Eigen::half>& z)
43 const Eigen::half x = real(z);
44 const Eigen::half y = imag(z);
45 const Eigen::half zero(0);
46 const Eigen::half two(2);
47 const Eigen::half half(0.5);
49 if (isnan(x) || isnan(y))
50 return std::numeric_limits<Eigen::half>::quiet_NaN();
51 else if (isinf(x) || isinf(y))
52 return std::numeric_limits<Eigen::half>::infinity();
54 Eigen::half t = sqrt(half * abs(y));
55 return std::complex<Eigen::half>(t, (y < zero) ? -t : t);
58 Eigen::half t = sqrt(two * (std::abs(z) + abs(x)));
59 Eigen::half u = half * t;
61 ? std::complex<Eigen::half>(u, y / t)
62 : std::complex<Eigen::half>(abs(y) / t, (y < zero) ? -u : u);
68inline std::istream& operator>>(std::istream& is, Eigen::half& x)
typename traits::real_type_traits< Types..., int >::type real_type
The common real type of the list of types.
Definition scalar_type_traits.hpp:113
constexpr bool is_complex
True if T is a complex scalar type.
Definition scalar_type_traits.hpp:192
constexpr bool is_real
True if T is a real scalar type.
Definition scalar_type_traits.hpp:117
Complex type traits for the list of types Types.
Definition scalar_type_traits.hpp:145
Real type traits for the list of types Types.
Definition scalar_type_traits.hpp:71