numba routines

This commit is contained in:
Michael Krayer 2021-08-12 21:58:27 +02:00
parent 1a8afb97d0
commit 5a88eebf4a
1 changed files with 13 additions and 0 deletions

13
jit.py Normal file
View File

@ -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