This question is a follow-up of a previous post of mine:
Multiply each column of a numpy array with each value of another array.
Suppose i have the following arrays:
In [252]: k
Out[252]:
array([[200, 800, 400, 1600],
[400, 1000, 800, 2000],
[600, 1200, 1200,2400]])
In [271]: f = np.array([[100,50],[200,100],[300,200]])
In [272]: f
Out[272]:
array([[100, 50],
[200, 100],
[300, 200]])
How can i subtract f from k to obtain the following?
In [252]: g
Out[252]:
array([[100, 750, 300, 1550],
[200, 900, 600, 1900],
[300, 1000, 900,2200]])
Ideally, i would like to make the subtraction in as fewer steps as possible and in concert with the solution provided in my other post, but any solution welcome.