DPC++ Runtime
Runtime libraries for oneAPI DPC++
complex_math.hpp
Go to the documentation of this file.
1 //===- complex_math.hpp ---------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #pragma once
10 
11 #include "common.hpp"
12 
13 #include <sycl/builtins.hpp>
14 
15 #include <math.h>
16 
17 namespace sycl {
18 inline namespace _V1 {
19 
20 namespace ext {
21 namespace oneapi {
22 namespace experimental {
23 
27 
28 namespace cplx::detail {
29 
30 template <bool _Val> using _BoolConstant = std::integral_constant<bool, _Val>;
31 
32 template <class _Tp, class _Up>
33 using _IsNotSame = _BoolConstant<!__is_same(_Tp, _Up)>;
34 
35 template <class _Tp> struct __numeric_type {
36  static void __test(...);
38  static float __test(float);
39  static double __test(char);
40  static double __test(int);
41  static double __test(unsigned);
42  static double __test(long);
43  static double __test(unsigned long);
44  static double __test(long long);
45  static double __test(unsigned long long);
46  static double __test(double);
47 
48  typedef decltype(__test(std::declval<_Tp>())) type;
49  static const bool value = _IsNotSame<type, void>::value;
50 };
51 
52 template <> struct __numeric_type<void> {
53  static const bool value = true;
54 };
55 
56 template <class _A1, class _A2 = void, class _A3 = void,
60 public:
61  static const bool value = false;
62 };
63 
64 template <class _A1, class _A2, class _A3>
65 class __promote_imp<_A1, _A2, _A3, true> {
66 private:
67  typedef typename __promote_imp<_A1>::type __type1;
68  typedef typename __promote_imp<_A2>::type __type2;
69  typedef typename __promote_imp<_A3>::type __type3;
70 
71 public:
72  typedef decltype(__type1() + __type2() + __type3()) type;
73  static const bool value = true;
74 };
75 
76 template <class _A1, class _A2> class __promote_imp<_A1, _A2, void, true> {
77 private:
78  typedef typename __promote_imp<_A1>::type __type1;
79  typedef typename __promote_imp<_A2>::type __type2;
80 
81 public:
82  typedef decltype(__type1() + __type2()) type;
83  static const bool value = true;
84 };
85 
86 template <class _A1> class __promote_imp<_A1, void, void, true> {
87 public:
88  typedef typename __numeric_type<_A1>::type type;
89  static const bool value = true;
90 };
91 
92 template <class _A1, class _A2 = void, class _A3 = void>
93 class __promote : public __promote_imp<_A1, _A2, _A3> {};
94 
95 template <class _Tp, bool = std::is_integral<_Tp>::value,
98 
99 // Integral Types
100 template <class _Tp> struct __libcpp_complex_overload_traits<_Tp, true, false> {
101  typedef double _ValueType;
103 };
104 
105 // Floating point types
106 template <class _Tp> struct __libcpp_complex_overload_traits<_Tp, false, true> {
107  typedef _Tp _ValueType;
109 };
110 
111 } // namespace cplx::detail
112 
116 
117 // abs
118 
119 template <class _Tp>
121  typename std::enable_if_t<is_genfloat<_Tp>::value, _Tp>
122  abs(const complex<_Tp> &__c) {
123  return sycl::hypot(__c.real(), __c.imag());
124 }
125 
126 // arg
127 
128 template <class _Tp>
130  typename std::enable_if_t<is_genfloat<_Tp>::value, _Tp>
131  arg(const complex<_Tp> &__c) {
132  return sycl::atan2(__c.imag(), __c.real());
133 }
134 
135 template <class _Tp>
137  typename cplx::detail::__libcpp_complex_overload_traits<_Tp>::_ValueType
138  arg(_Tp __re) {
139  typedef
141  _ValueType;
142  return sycl::atan2(static_cast<_ValueType>(0), static_cast<_ValueType>(__re));
143 }
144 
145 // norm
146 
147 template <class _Tp>
149  typename std::enable_if_t<is_genfloat<_Tp>::value, _Tp>
150  norm(const complex<_Tp> &__c) {
151  if (sycl::isinf(__c.real()))
152  return sycl::fabs(__c.real());
153  if (sycl::isinf(__c.imag()))
154  return sycl::fabs(__c.imag());
155  return __c.real() * __c.real() + __c.imag() * __c.imag();
156 }
157 
158 template <class _Tp>
160  typename cplx::detail::__libcpp_complex_overload_traits<_Tp>::_ValueType
161  norm(_Tp __re) {
162  typedef
164  _ValueType;
165  return static_cast<_ValueType>(__re) * __re;
166 }
167 
168 // conj
169 
170 template <class _Tp>
172  typename std::enable_if_t<is_genfloat<_Tp>::value, complex<_Tp>>
173  conj(const complex<_Tp> &__c) {
174  return complex<_Tp>(__c.real(), -__c.imag());
175 }
176 
177 template <class _Tp>
179  typename cplx::detail::__libcpp_complex_overload_traits<_Tp>::_ComplexType
180  conj(_Tp __re) {
181  typedef
183  _ComplexType;
184  return _ComplexType(__re);
185 }
186 
187 // proj
188 
189 template <class _Tp>
191  typename std::enable_if_t<is_genfloat<_Tp>::value, complex<_Tp>>
192  proj(const complex<_Tp> &__c) {
193  complex<_Tp> __r = __c;
194  if (sycl::isinf(__c.real()) || sycl::isinf(__c.imag()))
195  __r = complex<_Tp>(INFINITY, sycl::copysign(_Tp(0), __c.imag()));
196  return __r;
197 }
198 
199 template <class _Tp>
201  typename cplx::detail::__libcpp_complex_overload_traits<_Tp>::_ComplexType
202  proj(_Tp __re) {
203  typedef
205  _ComplexType;
206 
207  if constexpr (!std::is_integral_v<_Tp>) {
208  if (sycl::isinf(__re))
209  __re = sycl::fabs(__re);
210  }
211 
212  return _ComplexType(__re);
213 }
214 
215 // polar
216 
217 template <class _Tp>
219  typename std::enable_if_t<is_genfloat<_Tp>::value, complex<_Tp>>
220  polar(const _Tp &__rho, const _Tp &__theta = _Tp()) {
221  if (sycl::isnan(__rho) || sycl::signbit(__rho))
222  return complex<_Tp>(_Tp(NAN), _Tp(NAN));
223  if (sycl::isnan(__theta)) {
224  if (sycl::isinf(__rho))
225  return complex<_Tp>(__rho, __theta);
226  return complex<_Tp>(__theta, __theta);
227  }
228  if (sycl::isinf(__theta)) {
229  if (sycl::isinf(__rho))
230  return complex<_Tp>(__rho, _Tp(NAN));
231  return complex<_Tp>(_Tp(NAN), _Tp(NAN));
232  }
233  _Tp __x = __rho * sycl::cos(__theta);
234  if (sycl::isnan(__x))
235  __x = 0;
236  _Tp __y = __rho * sycl::sin(__theta);
237  if (sycl::isnan(__y))
238  __y = 0;
239  return complex<_Tp>(__x, __y);
240 }
241 
242 // log
243 
244 template <class _Tp>
246  typename std::enable_if_t<is_genfloat<_Tp>::value, complex<_Tp>>
247  log(const complex<_Tp> &__x) {
248  return complex<_Tp>(sycl::log(abs(__x)), arg(__x));
249 }
250 
251 // log10
252 
253 template <class _Tp>
255  typename std::enable_if_t<is_genfloat<_Tp>::value, complex<_Tp>>
256  log10(const complex<_Tp> &__x) {
257  return log(__x) / sycl::log(_Tp(10));
258 }
259 
260 // sqrt
261 
262 template <class _Tp>
264  typename std::enable_if_t<is_genfloat<_Tp>::value, complex<_Tp>>
265  sqrt(const complex<_Tp> &__x) {
266  if (sycl::isinf(__x.imag()))
267  return complex<_Tp>(_Tp(INFINITY), __x.imag());
268  if (sycl::isinf(__x.real())) {
269  if (__x.real() > _Tp(0))
270  return complex<_Tp>(__x.real(), sycl::isnan(__x.imag())
271  ? __x.imag()
272  : sycl::copysign(_Tp(0), __x.imag()));
273  return complex<_Tp>(sycl::isnan(__x.imag()) ? __x.imag() : _Tp(0),
274  sycl::copysign(__x.real(), __x.imag()));
275  }
276  return polar(sycl::sqrt(abs(__x)), arg(__x) / _Tp(2));
277 }
278 
279 // exp
280 
281 template <class _Tp>
283  typename std::enable_if_t<is_genfloat<_Tp>::value, complex<_Tp>>
284  exp(const complex<_Tp> &__x) {
285  _Tp __i = __x.imag();
286  if (__i == 0) {
287  return complex<_Tp>(sycl::exp(__x.real()),
288  sycl::copysign(_Tp(0), __x.imag()));
289  }
290  if (sycl::isinf(__x.real())) {
291  if (__x.real() < _Tp(0)) {
292  if (!sycl::isfinite(__i))
293  __i = _Tp(1);
294  } else if (__i == 0 || !sycl::isfinite(__i)) {
295  if (sycl::isinf(__i))
296  __i = _Tp(NAN);
297  return complex<_Tp>(__x.real(), __i);
298  }
299  }
300  _Tp __e = sycl::exp(__x.real());
301  return complex<_Tp>(__e * sycl::cos(__i), __e * sycl::sin(__i));
302 }
303 
304 // pow
305 
306 template <class _Tp>
308  typename std::enable_if_t<is_genfloat<_Tp>::value, complex<_Tp>>
309  pow(const complex<_Tp> &__x, const complex<_Tp> &__y) {
310  return exp(__y * log(__x));
311 }
312 
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>>
318  pow(const complex<_Tp> &__x, const complex<_Up> &__y) {
320  return pow(result_type(__x), result_type(__y));
321 }
322 
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>>
328  pow(const complex<_Tp> &__x, const _Up &__y) {
330  return pow(result_type(__x), result_type(__y));
331 }
332 
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>>
338  pow(const _Tp &__x, const complex<_Up> &__y) {
340  return pow(result_type(__x), result_type(__y));
341 }
342 
343 namespace cplx::detail {
344 // __sqr, computes pow(x, 2)
345 
346 template <class _Tp>
348  typename std::enable_if_t<is_genfloat<_Tp>::value, complex<_Tp>>
349  __sqr(const complex<_Tp> &__x) {
350  return complex<_Tp>((__x.real() - __x.imag()) * (__x.real() + __x.imag()),
351  _Tp(2) * __x.real() * __x.imag());
352 }
353 } // namespace cplx::detail
354 
355 // asinh
356 
357 template <class _Tp>
359  typename std::enable_if_t<is_genfloat<_Tp>::value, complex<_Tp>>
360  asinh(const complex<_Tp> &__x) {
361  const _Tp __pi(sycl::atan2(_Tp(+0.), _Tp(-0.)));
362  if (sycl::isinf(__x.real())) {
363  if (sycl::isnan(__x.imag()))
364  return __x;
365  if (sycl::isinf(__x.imag()))
366  return complex<_Tp>(__x.real(),
367  sycl::copysign(__pi * _Tp(0.25), __x.imag()));
368  return complex<_Tp>(__x.real(), sycl::copysign(_Tp(0), __x.imag()));
369  }
370  if (sycl::isnan(__x.real())) {
371  if (sycl::isinf(__x.imag()))
372  return complex<_Tp>(__x.imag(), __x.real());
373  if (__x.imag() == 0)
374  return __x;
375  return complex<_Tp>(__x.real(), __x.real());
376  }
377  if (sycl::isinf(__x.imag()))
378  return complex<_Tp>(sycl::copysign(__x.imag(), __x.real()),
379  sycl::copysign(__pi / _Tp(2), __x.imag()));
380  complex<_Tp> __z = log(__x + sqrt(cplx::detail::__sqr(__x) + _Tp(1)));
381  return complex<_Tp>(sycl::copysign(__z.real(), __x.real()),
382  sycl::copysign(__z.imag(), __x.imag()));
383 }
384 
385 // acosh
386 
387 template <class _Tp>
389  typename std::enable_if_t<is_genfloat<_Tp>::value, complex<_Tp>>
390  acosh(const complex<_Tp> &__x) {
391  const _Tp __pi(sycl::atan2(_Tp(+0.), _Tp(-0.)));
392  if (sycl::isinf(__x.real())) {
393  if (sycl::isnan(__x.imag()))
394  return complex<_Tp>(sycl::fabs(__x.real()), __x.imag());
395  if (sycl::isinf(__x.imag())) {
396  if (__x.real() > 0)
397  return complex<_Tp>(__x.real(),
398  sycl::copysign(__pi * _Tp(0.25), __x.imag()));
399  else
400  return complex<_Tp>(-__x.real(),
401  sycl::copysign(__pi * _Tp(0.75), __x.imag()));
402  }
403  if (__x.real() < 0)
404  return complex<_Tp>(-__x.real(), sycl::copysign(__pi, __x.imag()));
405  return complex<_Tp>(__x.real(), sycl::copysign(_Tp(0), __x.imag()));
406  }
407  if (sycl::isnan(__x.real())) {
408  if (sycl::isinf(__x.imag()))
409  return complex<_Tp>(sycl::fabs(__x.imag()), __x.real());
410  return complex<_Tp>(__x.real(), __x.real());
411  }
412  if (sycl::isinf(__x.imag()))
413  return complex<_Tp>(sycl::fabs(__x.imag()),
414  sycl::copysign(__pi / _Tp(2), __x.imag()));
415  complex<_Tp> __z = log(__x + sqrt(cplx::detail::__sqr(__x) - _Tp(1)));
416  return complex<_Tp>(sycl::copysign(__z.real(), _Tp(0)),
417  sycl::copysign(__z.imag(), __x.imag()));
418 }
419 
420 // atanh
421 
422 template <class _Tp>
424  typename std::enable_if_t<is_genfloat<_Tp>::value, complex<_Tp>>
425  atanh(const complex<_Tp> &__x) {
426  const _Tp __pi(sycl::atan2(_Tp(+0.), _Tp(-0.)));
427  if (sycl::isinf(__x.imag())) {
428  return complex<_Tp>(sycl::copysign(_Tp(0), __x.real()),
429  sycl::copysign(__pi / _Tp(2), __x.imag()));
430  }
431  if (sycl::isnan(__x.imag())) {
432  if (sycl::isinf(__x.real()) || __x.real() == 0)
433  return complex<_Tp>(sycl::copysign(_Tp(0), __x.real()), __x.imag());
434  return complex<_Tp>(__x.imag(), __x.imag());
435  }
436  if (sycl::isnan(__x.real())) {
437  return complex<_Tp>(__x.real(), __x.real());
438  }
439  if (sycl::isinf(__x.real())) {
440  return complex<_Tp>(sycl::copysign(_Tp(0), __x.real()),
441  sycl::copysign(__pi / _Tp(2), __x.imag()));
442  }
443  if (sycl::fabs(__x.real()) == _Tp(1) && __x.imag() == _Tp(0)) {
444  return complex<_Tp>(sycl::copysign(_Tp(INFINITY), __x.real()),
445  sycl::copysign(_Tp(0), __x.imag()));
446  }
447  complex<_Tp> __z = log((_Tp(1) + __x) / (_Tp(1) - __x)) / _Tp(2);
448  return complex<_Tp>(sycl::copysign(__z.real(), __x.real()),
449  sycl::copysign(__z.imag(), __x.imag()));
450 }
451 
452 // sinh
453 
454 template <class _Tp>
456  typename std::enable_if_t<is_genfloat<_Tp>::value, complex<_Tp>>
457  sinh(const complex<_Tp> &__x) {
458  if (sycl::isinf(__x.real()) && !sycl::isfinite(__x.imag()))
459  return complex<_Tp>(__x.real(), _Tp(NAN));
460  if (__x.real() == 0 && !sycl::isfinite(__x.imag()))
461  return complex<_Tp>(__x.real(), _Tp(NAN));
462  if (__x.imag() == 0 && !sycl::isfinite(__x.real()))
463  return __x;
464  return complex<_Tp>(sycl::sinh(__x.real()) * sycl::cos(__x.imag()),
465  sycl::cosh(__x.real()) * sycl::sin(__x.imag()));
466 }
467 
468 // cosh
469 
470 template <class _Tp>
472  typename std::enable_if_t<is_genfloat<_Tp>::value, complex<_Tp>>
473  cosh(const complex<_Tp> &__x) {
474  if (sycl::isinf(__x.real()) && !sycl::isfinite(__x.imag()))
475  return complex<_Tp>(sycl::fabs(__x.real()), _Tp(NAN));
476  if (__x.real() == 0 && !sycl::isfinite(__x.imag()))
477  return complex<_Tp>(_Tp(NAN), __x.real());
478  if (__x.real() == 0 && __x.imag() == 0)
479  return complex<_Tp>(_Tp(1), __x.imag());
480  if (__x.imag() == 0 && !sycl::isfinite(__x.real()))
481  return complex<_Tp>(sycl::fabs(__x.real()), __x.imag());
482  return complex<_Tp>(sycl::cosh(__x.real()) * sycl::cos(__x.imag()),
483  sycl::sinh(__x.real()) * sycl::sin(__x.imag()));
484 }
485 
486 // tanh
487 
488 template <class _Tp>
490  typename std::enable_if_t<is_genfloat<_Tp>::value, complex<_Tp>>
491  tanh(const complex<_Tp> &__x) {
492  if (sycl::isinf(__x.real())) {
493  if (!sycl::isfinite(__x.imag()))
494  return complex<_Tp>(sycl::copysign(_Tp(1), __x.real()), _Tp(0));
495  return complex<_Tp>(sycl::copysign(_Tp(1), __x.real()),
496  sycl::copysign(_Tp(0), sycl::sin(_Tp(2) * __x.imag())));
497  }
498  if (sycl::isnan(__x.real()) && __x.imag() == 0)
499  return __x;
500  _Tp __2r(_Tp(2) * __x.real());
501  _Tp __2i(_Tp(2) * __x.imag());
502  _Tp __d(sycl::cosh(__2r) + sycl::cos(__2i));
503  _Tp __2rsh(sycl::sinh(__2r));
504  if (sycl::isinf(__2rsh) && sycl::isinf(__d))
505  return complex<_Tp>(__2rsh > _Tp(0) ? _Tp(1) : _Tp(-1),
506  __2i > _Tp(0) ? _Tp(0) : _Tp(-0.));
507  return complex<_Tp>(__2rsh / __d, sycl::sin(__2i) / __d);
508 }
509 
510 // asin
511 
512 template <class _Tp>
514  typename std::enable_if_t<is_genfloat<_Tp>::value, complex<_Tp>>
515  asin(const complex<_Tp> &__x) {
516  complex<_Tp> __z = asinh(complex<_Tp>(-__x.imag(), __x.real()));
517  return complex<_Tp>(__z.imag(), -__z.real());
518 }
519 
520 // acos
521 
522 template <class _Tp>
524  typename std::enable_if_t<is_genfloat<_Tp>::value, complex<_Tp>>
525  acos(const complex<_Tp> &__x) {
526  const _Tp __pi(sycl::atan2(_Tp(+0.), _Tp(-0.)));
527  if (sycl::isinf(__x.real())) {
528  if (sycl::isnan(__x.imag()))
529  return complex<_Tp>(__x.imag(), __x.real());
530  if (sycl::isinf(__x.imag())) {
531  if (__x.real() < _Tp(0))
532  return complex<_Tp>(_Tp(0.75) * __pi, -__x.imag());
533  return complex<_Tp>(_Tp(0.25) * __pi, -__x.imag());
534  }
535  if (__x.real() < _Tp(0))
536  return complex<_Tp>(__pi,
537  sycl::signbit(__x.imag()) ? -__x.real() : __x.real());
538  return complex<_Tp>(_Tp(0),
539  sycl::signbit(__x.imag()) ? __x.real() : -__x.real());
540  }
541  if (sycl::isnan(__x.real())) {
542  if (sycl::isinf(__x.imag()))
543  return complex<_Tp>(__x.real(), -__x.imag());
544  return complex<_Tp>(__x.real(), __x.real());
545  }
546  if (sycl::isinf(__x.imag()))
547  return complex<_Tp>(__pi / _Tp(2), -__x.imag());
548  if (__x.real() == 0 && (__x.imag() == 0 || sycl::isnan(__x.imag())))
549  return complex<_Tp>(__pi / _Tp(2), -__x.imag());
550  complex<_Tp> __z = log(__x + sqrt(cplx::detail::__sqr(__x) - _Tp(1)));
551  if (sycl::signbit(__x.imag()))
552  return complex<_Tp>(sycl::fabs(__z.imag()), sycl::fabs(__z.real()));
553  return complex<_Tp>(sycl::fabs(__z.imag()), -sycl::fabs(__z.real()));
554 }
555 
556 // atan
557 
558 template <class _Tp>
560  typename std::enable_if_t<is_genfloat<_Tp>::value, complex<_Tp>>
561  atan(const complex<_Tp> &__x) {
562  complex<_Tp> __z = atanh(complex<_Tp>(-__x.imag(), __x.real()));
563  return complex<_Tp>(__z.imag(), -__z.real());
564 }
565 
566 // sin
567 
568 template <class _Tp>
570  typename std::enable_if_t<is_genfloat<_Tp>::value, complex<_Tp>>
571  sin(const complex<_Tp> &__x) {
572  complex<_Tp> __z = sinh(complex<_Tp>(-__x.imag(), __x.real()));
573  return complex<_Tp>(__z.imag(), -__z.real());
574 }
575 
576 // cos
577 
578 template <class _Tp>
580  typename std::enable_if_t<is_genfloat<_Tp>::value, complex<_Tp>>
581  cos(const complex<_Tp> &__x) {
582  return cosh(complex<_Tp>(-__x.imag(), __x.real()));
583 }
584 
585 // tan
586 
587 template <class _Tp>
589  typename std::enable_if_t<is_genfloat<_Tp>::value, complex<_Tp>>
590  tan(const complex<_Tp> &__x) {
591  complex<_Tp> __z = tanh(complex<_Tp>(-__x.imag(), __x.real()));
592  return complex<_Tp>(__z.imag(), -__z.real());
593 }
594 
595 // real
596 
597 template <class _Tp>
599  typename std::enable_if_t<is_genfloat<_Tp>::value, _Tp>
600  real(const complex<_Tp> &__c) {
601  return __c.real();
602 }
603 
604 template <class _Tp>
606  typename cplx::detail::__libcpp_complex_overload_traits<_Tp>::_ValueType
607  real(_Tp __re) {
608  return __re;
609 }
610 
611 // imag
612 
613 template <class _Tp>
615  typename std::enable_if_t<is_genfloat<_Tp>::value, _Tp>
616  imag(const complex<_Tp> &__c) {
617  return __c.imag();
618 }
619 
620 template <class _Tp>
622  typename cplx::detail::__libcpp_complex_overload_traits<_Tp>::_ValueType
623  imag(_Tp) {
624  return 0;
625 }
626 
627 } // namespace experimental
628 } // namespace oneapi
629 } // namespace ext
630 
631 } // namespace _V1
632 } // namespace sycl
#define __DPCPP_SYCL_EXTERNAL
#define _SYCL_EXT_CPLX_INLINE_VISIBILITY
DEFINES.
Definition: common.hpp:54
sycl::ext::intel::esimd::simd< float, N > atan2(sycl::ext::intel::esimd::simd< float, N > y, sycl::ext::intel::esimd::simd< float, N > x)
Definition: math.hpp:1446
std::enable_if_t< std::is_same_v< Tp, float >, float > copysign(Tp x, Tp y)
Definition: math.hpp:76
_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
Definition: access.hpp:18
decltype(__test(std::declval< _Tp >())) typedef type