From 6a4e02d3c2d2f63fa42fa9ad75248cfb4b12b5f9 Mon Sep 17 00:00:00 2001 From: Adarsh Yoga Date: Thu, 6 Apr 2023 18:00:10 +0000 Subject: [PATCH] adding numba numpy version of rambo --- .../benchmarks/rambo/rambo_numba_dpex_n.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 dpbench/benchmarks/rambo/rambo_numba_dpex_n.py diff --git a/dpbench/benchmarks/rambo/rambo_numba_dpex_n.py b/dpbench/benchmarks/rambo/rambo_numba_dpex_n.py new file mode 100644 index 00000000..89752dd8 --- /dev/null +++ b/dpbench/benchmarks/rambo/rambo_numba_dpex_n.py @@ -0,0 +1,19 @@ +# SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation +# +# SPDX-License-Identifier: Apache-2.0 + +import dpnp as np +from numba_dpex import dpjit + + +@dpjit +def rambo(nevts, nout, C1, F1, Q1, output): + C = 2.0 * C1 - 1.0 + S = np.sqrt(1 - np.square(C)) + F = 2.0 * np.pi * F1 + Q = -np.log(Q1) + + output[:, :, 0] = Q + output[:, :, 1] = Q * S * np.sin(F) + output[:, :, 2] = Q * S * np.cos(F) + output[:, :, 3] = Q * C