From 5a88eebf4a5917e5d3aaa3615e406b4e5f8dfe1c Mon Sep 17 00:00:00 2001 From: Michael Krayer Date: Thu, 12 Aug 2021 21:58:27 +0200 Subject: [PATCH] numba routines --- jit.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 jit.py diff --git a/jit.py b/jit.py new file mode 100644 index 0000000..e7b7514 --- /dev/null +++ b/jit.py @@ -0,0 +1,13 @@ +import numba +import numpy as np + +@numba.jit(nopython=True) +def minmax(array): + N = array.shape[0] + vmin = np.full((N,), np.inf,dtype=array.dtype) + vmax = np.full((N,),-np.inf,dtype=array.dtype) + for ii in range(N): + for val in array[ii,...].ravel(): + vmin[ii] = min(vmin[ii],val) + vmax[ii] = max(vmax[ii],val) + return vmin,vmax \ No newline at end of file