Feb-03-2022, 01:14 AM
I have a 1D array containing ending values of a financial computation that has n elements and a matrix of inflation factors that has n rows and w columns. I'd like to divide each member of the 1D array with the product of column values of the corresponding row in the matrix. I know I can do this in a loop:
for i in range(n): b[i] /= numpy.product(infl[i,:]))But I'd like to vectorize it to save (a lot) of time because n is big (1-2M). Is there a way to do this?