Thanks so much Juan!
I did not know about this np.digitize command.
With this the vectorization of my function then reads as
def ZeroOrderInterpolation(t,table):
import numpy as np
lookup, values = table[:, 0], table[:, 1:]
values = np.concatenate((values[0:1], values), axis=0)
indices = n
Hi Seth,
The function you’re looking for is `np.digitize`:
In [1]: t = np.array([0.5,1,1.5,2.5,3,10])
...: table = np.array([[0,3],[1,0],[2,5],[3,-1]])
...:
In [2]: lookup, values = table[:, 0], table[:, 1:]
In [3]: values = np.concatenate((values[0:1], values), axis=0)
In [4]: indices = n
Hi everybody,
I am new to newpy and am trying to define a variant of piecewise or zero holder
interpolation function, say ZeroOrderInterpolation(t,a), where t is an 1D array
of size, say p, consisting of real numbers, and a is a 2D array of size, say
nxm, with first column consisting of increas