Let's say we have two sorted numpy arrays,
a = np.array([ 0, 1, 2, 10]) b = np.array([ 7, 13])
For each element array
a, I want to subtract the first larger element in
b to get something like this:
>>> f(a, b) array([-7, -6, -5, -3])
I can do this with an inefficient for loop, but is there a more numpythonic way to do it?