AI P

0

votes
0

answer
4

views

Numpy ordered subtraction of elements with full vectorization

Imagine a mxn array a, and a 1xn array b, we want to subtract b from a so that b is subtracted from the first element of a, then maximum of zero and b-a[0] is subtracted from a[1], and so on... So: x = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) a = np.repeat(x, 100000).reshape(10, 100000) b = np.repe...
AI_p