33#include <sycl/sycl.hpp> 
   36#include "kernels/elementwise_functions/sycl_complex.hpp" 
   37#include "utils/type_utils.hpp" 
   39namespace dpnp::kernels::sinc
 
   41namespace tu_ns = dpctl::tensor::type_utils;
 
   46inline Tp sin(
const Tp &in)
 
   48    if constexpr (tu_ns::is_complex<Tp>::value) {
 
   49        using realTp = 
typename Tp::value_type;
 
   51        constexpr realTp q_nan = std::numeric_limits<realTp>::quiet_NaN();
 
   53        realTp 
const &in_re = std::real(in);
 
   54        realTp 
const &in_im = std::imag(in);
 
   56        const bool in_re_finite = sycl::isfinite(in_re);
 
   57        const bool in_im_finite = sycl::isfinite(in_im);
 
   62        if (in_re_finite && in_im_finite) {
 
   63            Tp res = exprm_ns::sin(exprm_ns::complex<realTp>(in)); 
 
   64            if (in_re == realTp(0)) {
 
   65                res.real(sycl::copysign(realTp(0), in_re));
 
   75        const realTp x = -in_im;
 
   76        const realTp y = in_re;
 
   77        const bool xfinite = in_im_finite;
 
   78        const bool yfinite = in_re_finite;
 
   88        if (x == realTp(0) && !yfinite) {
 
   89            const realTp sinh_im = q_nan;
 
   90            const realTp sinh_re = sycl::copysign(realTp(0), x * sinh_im);
 
   91            return Tp{sinh_im, -sinh_re};
 
   99        if (y == realTp(0) && !xfinite) {
 
  101                const realTp sinh_re = x;
 
  102                const realTp sinh_im = y;
 
  103                return Tp{sinh_im, -sinh_re};
 
  105            const realTp sinh_re = x;
 
  106            const realTp sinh_im = sycl::copysign(realTp(0), y);
 
  107            return Tp{sinh_im, -sinh_re};
 
  115        if (xfinite && !yfinite) {
 
  116            const realTp sinh_re = q_nan;
 
  117            const realTp sinh_im = x * sinh_re;
 
  118            return Tp{sinh_im, -sinh_re};
 
  135                const realTp sinh_re = -x * x;
 
  136                const realTp sinh_im = x * (y - y);
 
  137                return Tp{sinh_im, -sinh_re};
 
  139            const realTp sinh_re = x * sycl::cos(y);
 
  140            const realTp sinh_im =
 
  141                std::numeric_limits<realTp>::infinity() * sycl::sin(y);
 
  142            return Tp{sinh_im, -sinh_re};
 
  152        const realTp y_m_y = (y - y);
 
  153        const realTp sinh_re = (x * x) * y_m_y;
 
  154        const realTp sinh_im = (x + x) * y_m_y;
 
  155        return Tp{sinh_im, -sinh_re};
 
  161        return sycl::sin(in);
 
  166template <
typename argT, 
typename Tp>
 
  170    using is_constant = 
typename std::false_type;
 
  174    using supports_vec = 
typename std::false_type;
 
  176    using supports_sg_loadstore = 
typename std::negation<
 
  177        std::disjunction<tu_ns::is_complex<Tp>, tu_ns::is_complex<argT>>>;
 
  179    Tp operator()(
const argT &x)
 const 
  182            static_cast<argT
>(3.1415926535897932384626433832795029L);
 
  183        const argT y = pi * x;
 
  189        if constexpr (tu_ns::is_complex<argT>::value) {
 
  190            return impl::sin(y) / y;
 
  193            return sycl::sinpi(x) / y;