18 inline namespace _V1 {
22 namespace experimental {
28 namespace cplx::detail {
30 template <
bool _Val>
using _BoolConstant = std::integral_constant<bool, _Val>;
32 template <
class _Tp,
class _Up>
45 static double __test(
unsigned long long);
56 template <
class _A1,
class _A2 = void,
class _A3 = void,
61 static const bool value =
false;
64 template <
class _A1,
class _A2,
class _A3>
72 typedef decltype(__type1() + __type2() + __type3())
type;
76 template <class _A1, class _A2> class
__promote_imp<_A1, _A2,
void, true> {
82 typedef decltype(__type1() + __type2())
type;
92 template <
class _A1,
class _A2 =
void,
class _A3 =
void>
95 template <class _Tp, bool = std::is_integral<_Tp>::value,
121 typename std::enable_if_t<is_genfloat<_Tp>::value, _Tp>
123 return sycl::hypot(__c.real(), __c.imag());
130 typename std::enable_if_t<is_genfloat<_Tp>::value, _Tp>
137 typename cplx::detail::__libcpp_complex_overload_traits<_Tp>::_ValueType
142 return sycl::atan2(
static_cast<_ValueType
>(0),
static_cast<_ValueType
>(__re));
149 typename std::enable_if_t<is_genfloat<_Tp>::value, _Tp>
151 if (sycl::isinf(__c.real()))
153 if (sycl::isinf(__c.imag()))
155 return __c.real() * __c.real() + __c.imag() * __c.imag();
160 typename cplx::detail::__libcpp_complex_overload_traits<_Tp>::_ValueType
165 return static_cast<_ValueType
>(__re) * __re;
172 typename std::enable_if_t<is_genfloat<_Tp>::value, complex<_Tp>>
179 typename cplx::detail::__libcpp_complex_overload_traits<_Tp>::_ComplexType
184 return _ComplexType(__re);
191 typename std::enable_if_t<is_genfloat<_Tp>::value, complex<_Tp>>
194 if (sycl::isinf(__c.real()) || sycl::isinf(__c.imag()))
201 typename cplx::detail::__libcpp_complex_overload_traits<_Tp>::_ComplexType
207 if constexpr (!std::is_integral_v<_Tp>) {
208 if (sycl::isinf(__re))
212 return _ComplexType(__re);
219 typename std::enable_if_t<is_genfloat<_Tp>::value, complex<_Tp>>
220 polar(
const _Tp &__rho,
const _Tp &__theta = _Tp()) {
224 if (sycl::isinf(__rho))
228 if (sycl::isinf(__theta)) {
229 if (sycl::isinf(__rho))
246 typename std::enable_if_t<is_genfloat<_Tp>::value, complex<_Tp>>
255 typename std::enable_if_t<is_genfloat<_Tp>::value, complex<_Tp>>
264 typename std::enable_if_t<is_genfloat<_Tp>::value, complex<_Tp>>
266 if (sycl::isinf(__x.imag()))
268 if (sycl::isinf(__x.real())) {
269 if (__x.real() > _Tp(0))
283 typename std::enable_if_t<is_genfloat<_Tp>::value, complex<_Tp>>
285 _Tp __i = __x.imag();
290 if (sycl::isinf(__x.real())) {
291 if (__x.real() < _Tp(0)) {
292 if (!sycl::isfinite(__i))
294 }
else if (__i == 0 || !sycl::isfinite(__i)) {
295 if (sycl::isinf(__i))
308 typename std::enable_if_t<is_genfloat<_Tp>::value, complex<_Tp>>
310 return exp(__y *
log(__x));
313 template <
class _Tp,
class _Up>
315 typename std::enable_if_t<
316 is_genfloat<_Tp>::value,
317 complex<typename cplx::detail::__promote<_Tp, _Up>::type>>
320 return pow(result_type(__x), result_type(__y));
323 template <
class _Tp,
class _Up>
325 typename std::enable_if_t<
326 is_genfloat<_Tp>::value && is_genfloat<_Up>::value,
327 complex<typename cplx::detail::__promote<_Tp, _Up>::type>>
330 return pow(result_type(__x), result_type(__y));
333 template <
class _Tp,
class _Up>
335 typename std::enable_if_t<
336 is_genfloat<_Tp>::value && is_genfloat<_Up>::value,
337 complex<typename cplx::detail::__promote<_Tp, _Up>::type>>
340 return pow(result_type(__x), result_type(__y));
343 namespace cplx::detail {
348 typename std::enable_if_t<is_genfloat<_Tp>::value, complex<_Tp>>
350 return complex<_Tp>((__x.real() - __x.imag()) * (__x.real() + __x.imag()),
351 _Tp(2) * __x.real() * __x.imag());
359 typename std::enable_if_t<is_genfloat<_Tp>::value,
complex<_Tp>>
362 if (sycl::isinf(__x.real())) {
365 if (sycl::isinf(__x.imag()))
371 if (sycl::isinf(__x.imag()))
377 if (sycl::isinf(__x.imag()))
389 typename std::enable_if_t<is_genfloat<_Tp>::value, complex<_Tp>>
392 if (sycl::isinf(__x.real())) {
395 if (sycl::isinf(__x.imag())) {
408 if (sycl::isinf(__x.imag()))
412 if (sycl::isinf(__x.imag()))
424 typename std::enable_if_t<is_genfloat<_Tp>::value, complex<_Tp>>
427 if (sycl::isinf(__x.imag())) {
432 if (sycl::isinf(__x.real()) || __x.real() == 0)
439 if (sycl::isinf(__x.real())) {
443 if (
sycl::fabs(__x.real()) == _Tp(1) && __x.imag() == _Tp(0)) {
456 typename std::enable_if_t<is_genfloat<_Tp>::value, complex<_Tp>>
458 if (sycl::isinf(__x.real()) && !sycl::isfinite(__x.imag()))
460 if (__x.real() == 0 && !sycl::isfinite(__x.imag()))
462 if (__x.imag() == 0 && !sycl::isfinite(__x.real()))
472 typename std::enable_if_t<is_genfloat<_Tp>::value, complex<_Tp>>
474 if (sycl::isinf(__x.real()) && !sycl::isfinite(__x.imag()))
476 if (__x.real() == 0 && !sycl::isfinite(__x.imag()))
478 if (__x.real() == 0 && __x.imag() == 0)
480 if (__x.imag() == 0 && !sycl::isfinite(__x.real()))
490 typename std::enable_if_t<is_genfloat<_Tp>::value, complex<_Tp>>
492 if (sycl::isinf(__x.real())) {
493 if (!sycl::isfinite(__x.imag()))
500 _Tp __2r(_Tp(2) * __x.real());
501 _Tp __2i(_Tp(2) * __x.imag());
504 if (sycl::isinf(__2rsh) && sycl::isinf(__d))
506 __2i > _Tp(0) ? _Tp(0) : _Tp(-0.));
514 typename std::enable_if_t<is_genfloat<_Tp>::value, complex<_Tp>>
524 typename std::enable_if_t<is_genfloat<_Tp>::value, complex<_Tp>>
527 if (sycl::isinf(__x.real())) {
530 if (sycl::isinf(__x.imag())) {
531 if (__x.real() < _Tp(0))
535 if (__x.real() < _Tp(0))
537 sycl::signbit(__x.imag()) ? -__x.real() : __x.real());
539 sycl::signbit(__x.imag()) ? __x.real() : -__x.real());
542 if (sycl::isinf(__x.imag()))
546 if (sycl::isinf(__x.imag()))
548 if (__x.real() == 0 && (__x.imag() == 0 ||
sycl::isnan(__x.imag())))
551 if (sycl::signbit(__x.imag()))
560 typename std::enable_if_t<is_genfloat<_Tp>::value, complex<_Tp>>
570 typename std::enable_if_t<is_genfloat<_Tp>::value, complex<_Tp>>
580 typename std::enable_if_t<is_genfloat<_Tp>::value, complex<_Tp>>
589 typename std::enable_if_t<is_genfloat<_Tp>::value, complex<_Tp>>
599 typename std::enable_if_t<is_genfloat<_Tp>::value, _Tp>
606 typename cplx::detail::__libcpp_complex_overload_traits<_Tp>::_ValueType
615 typename std::enable_if_t<is_genfloat<_Tp>::value, _Tp>
622 typename cplx::detail::__libcpp_complex_overload_traits<_Tp>::_ValueType
#define __DPCPP_SYCL_EXTERNAL
#define _SYCL_EXT_CPLX_INLINE_VISIBILITY
DEFINES.
sycl::ext::intel::esimd::simd< float, N > atan2(sycl::ext::intel::esimd::simd< float, N > y, sycl::ext::intel::esimd::simd< float, N > x)
std::enable_if_t< std::is_same_v< Tp, float >, float > copysign(Tp x, Tp y)
_BoolConstant<!__is_same(_Tp, _Up)> _IsNotSame
_SYCL_EXT_CPLX_INLINE_VISIBILITY std::enable_if_t< is_genfloat< _Tp >::value, complex< _Tp > > __sqr(const complex< _Tp > &__x)
std::integral_constant< bool, _Val > _BoolConstant
__DPCPP_SYCL_EXTERNAL constexpr _SYCL_EXT_CPLX_INLINE_VISIBILITY std::enable_if_t< is_genfloat< _Tp >::value, _Tp > real(const complex< _Tp > &__c)
__DPCPP_SYCL_EXTERNAL _SYCL_EXT_CPLX_INLINE_VISIBILITY std::enable_if_t< is_genfloat< _Tp >::value, complex< _Tp > > atanh(const complex< _Tp > &__x)
__DPCPP_SYCL_EXTERNAL _SYCL_EXT_CPLX_INLINE_VISIBILITY std::enable_if_t< is_genfloat< _Tp >::value, complex< _Tp > > sin(const complex< _Tp > &__x)
__DPCPP_SYCL_EXTERNAL _SYCL_EXT_CPLX_INLINE_VISIBILITY std::enable_if_t< is_genfloat< _Tp >::value, complex< _Tp > > tan(const complex< _Tp > &__x)
__DPCPP_SYCL_EXTERNAL _SYCL_EXT_CPLX_INLINE_VISIBILITY std::enable_if_t< is_genfloat< _Tp >::value, complex< _Tp > > cos(const complex< _Tp > &__x)
__DPCPP_SYCL_EXTERNAL _SYCL_EXT_CPLX_INLINE_VISIBILITY std::enable_if_t< is_genfloat< _Tp >::value, complex< _Tp > > asin(const complex< _Tp > &__x)
__DPCPP_SYCL_EXTERNAL _SYCL_EXT_CPLX_INLINE_VISIBILITY std::enable_if_t< is_genfloat< _Tp >::value, complex< _Tp > > cosh(const complex< _Tp > &__x)
__DPCPP_SYCL_EXTERNAL _SYCL_EXT_CPLX_INLINE_VISIBILITY std::enable_if_t< is_genfloat< _Tp >::value, complex< _Tp > > proj(const complex< _Tp > &__c)
__DPCPP_SYCL_EXTERNAL _SYCL_EXT_CPLX_INLINE_VISIBILITY std::enable_if_t< is_genfloat< _Tp >::value, complex< _Tp > > tanh(const complex< _Tp > &__x)
__DPCPP_SYCL_EXTERNAL _SYCL_EXT_CPLX_INLINE_VISIBILITY std::enable_if_t< is_genfloat< _Tp >::value, complex< _Tp > > conj(const complex< _Tp > &__c)
__DPCPP_SYCL_EXTERNAL _SYCL_EXT_CPLX_INLINE_VISIBILITY std::enable_if_t< is_genfloat< _Tp >::value, _Tp > arg(const complex< _Tp > &__c)
__DPCPP_SYCL_EXTERNAL _SYCL_EXT_CPLX_INLINE_VISIBILITY std::enable_if_t< is_genfloat< _Tp >::value, complex< _Tp > > sqrt(const complex< _Tp > &__x)
__DPCPP_SYCL_EXTERNAL _SYCL_EXT_CPLX_INLINE_VISIBILITY std::enable_if_t< is_genfloat< _Tp >::value, complex< _Tp > > asinh(const complex< _Tp > &__x)
__DPCPP_SYCL_EXTERNAL _SYCL_EXT_CPLX_INLINE_VISIBILITY std::enable_if_t< is_genfloat< _Tp >::value, _Tp > abs(const complex< _Tp > &__c)
FUNCTIONS.
std::enable_if_t< std::is_same_v< T, bfloat16 >, bool > isnan(T x)
__DPCPP_SYCL_EXTERNAL _SYCL_EXT_CPLX_INLINE_VISIBILITY std::enable_if_t< is_genfloat< _Tp >::value, complex< _Tp > > acos(const complex< _Tp > &__x)
__DPCPP_SYCL_EXTERNAL _SYCL_EXT_CPLX_INLINE_VISIBILITY std::enable_if_t< is_genfloat< _Tp >::value, complex< _Tp > > pow(const complex< _Tp > &__x, const complex< _Tp > &__y)
__DPCPP_SYCL_EXTERNAL constexpr _SYCL_EXT_CPLX_INLINE_VISIBILITY std::enable_if_t< is_genfloat< _Tp >::value, _Tp > imag(const complex< _Tp > &__c)
__DPCPP_SYCL_EXTERNAL _SYCL_EXT_CPLX_INLINE_VISIBILITY std::enable_if_t< is_genfloat< _Tp >::value, complex< _Tp > > exp(const complex< _Tp > &__x)
__DPCPP_SYCL_EXTERNAL _SYCL_EXT_CPLX_INLINE_VISIBILITY std::enable_if_t< is_genfloat< _Tp >::value, complex< _Tp > > log(const complex< _Tp > &__x)
__DPCPP_SYCL_EXTERNAL _SYCL_EXT_CPLX_INLINE_VISIBILITY std::enable_if_t< is_genfloat< _Tp >::value, complex< _Tp > > polar(const _Tp &__rho, const _Tp &__theta=_Tp())
__DPCPP_SYCL_EXTERNAL _SYCL_EXT_CPLX_INLINE_VISIBILITY std::enable_if_t< is_genfloat< _Tp >::value, complex< _Tp > > acosh(const complex< _Tp > &__x)
__DPCPP_SYCL_EXTERNAL _SYCL_EXT_CPLX_INLINE_VISIBILITY std::enable_if_t< is_genfloat< _Tp >::value, complex< _Tp > > log10(const complex< _Tp > &__x)
__DPCPP_SYCL_EXTERNAL _SYCL_EXT_CPLX_INLINE_VISIBILITY std::enable_if_t< is_genfloat< _Tp >::value, complex< _Tp > > atan(const complex< _Tp > &__x)
__DPCPP_SYCL_EXTERNAL _SYCL_EXT_CPLX_INLINE_VISIBILITY std::enable_if_t< is_genfloat< _Tp >::value, complex< _Tp > > sinh(const complex< _Tp > &__x)
__DPCPP_SYCL_EXTERNAL _SYCL_EXT_CPLX_INLINE_VISIBILITY std::enable_if_t< is_genfloat< _Tp >::value, _Tp > norm(const complex< _Tp > &__c)
std::enable_if_t< detail::is_bf16_storage_type< T >::value, T > fabs(T x)
ESIMD_NODEBUG ESIMD_INLINE sycl::ext::intel::esimd::simd< float, SZ > log(sycl::ext::intel::esimd::simd< float, SZ > x) __NOEXC
ESIMD_NODEBUG ESIMD_INLINE sycl::ext::intel::esimd::simd< float, SZ > sin(sycl::ext::intel::esimd::simd< float, SZ > x) __NOEXC
ESIMD_NODEBUG ESIMD_INLINE sycl::ext::intel::esimd::simd< float, SZ > cos(sycl::ext::intel::esimd::simd< float, SZ > x) __NOEXC
ESIMD_NODEBUG ESIMD_INLINE sycl::ext::intel::esimd::simd< float, SZ > exp(sycl::ext::intel::esimd::simd< float, SZ > x) __NOEXC
complex< double > _ComplexType
complex< _Tp > _ComplexType
static double __test(long)
static double __test(int)
decltype(__test(std::declval< _Tp >())) typedef type
static double __test(double)
static double __test(unsigned)
static double __test(long long)
static double __test(unsigned long long)
static float __test(float)
static double __test(char)
static double __test(unsigned long)
static sycl::half __test(sycl::half)