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)));
61 ? std::complex<Eigen::half>(
u,
y /
t)
68inline std::istream& operator>>(std::istream& is, Eigen::half& x)
Sort the numbers in D in increasing order (if ID = 'I') or in decreasing order (if ID = 'D' ).
Definition arrayTraits.hpp:15
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 real_type< T > real(const T &x) noexcept
Extends std::real() to real datatypes.
Definition utils.hpp:71
constexpr real_type< T > imag(const T &x) noexcept
Extends std::imag() to real datatypes.
Definition utils.hpp:86
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