Skip to content

Commit a1ad4d9

Browse files
committed
Use dedicated DPNPSinc class for dpnp.sinc implementation
1 parent 6f028ea commit a1ad4d9

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

dpnp/dpnp_algo/dpnp_elementwise_common.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
"DPNPImag",
4949
"DPNPReal",
5050
"DPNPRound",
51+
"DPNPSinc",
5152
"DPNPUnaryFunc",
5253
"resolve_weak_types_2nd_arg_int",
5354
]
@@ -584,6 +585,27 @@ def __call__(self, x, decimals=0, out=None, dtype=None):
584585
return super().__call__(x, out=out, dtype=dtype)
585586

586587

588+
class DPNPSinc(DPNPUnaryFunc):
589+
"""Class that implements dpnp.sinc unary element-wise functions."""
590+
591+
def __init__(
592+
self,
593+
name,
594+
result_type_resolver_fn,
595+
unary_dp_impl_fn,
596+
docs,
597+
):
598+
super().__init__(
599+
name,
600+
result_type_resolver_fn,
601+
unary_dp_impl_fn,
602+
docs,
603+
)
604+
605+
def __call__(self, x, out=None, order="K"):
606+
return super().__call__(x, out=out, order=order)
607+
608+
587609
def acceptance_fn_gcd_lcm(
588610
arg1_dtype, arg2_dtype, buf1_dt, buf2_dt, res_dt, sycl_dev
589611
):

dpnp/dpnp_iface_mathematical.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
DPNPImag,
6666
DPNPReal,
6767
DPNPRound,
68+
DPNPSinc,
6869
DPNPUnaryFunc,
6970
acceptance_fn_gcd_lcm,
7071
acceptance_fn_negative,
@@ -3806,7 +3807,7 @@ def real_if_close(a, tol=100):
38063807
0. ])
38073808
"""
38083809

3809-
sinc = DPNPUnaryFunc(
3810+
sinc = DPNPSinc(
38103811
"sinc",
38113812
ufi._sinc_result_type,
38123813
ufi._sinc,

0 commit comments

Comments
 (0)