Using the excellent broadcasting rules of numpy you can subtract a shape (3,) array v
from a shape (5,3) array X
with
X - v
The result is a shape (5,3) array in which each row i
is the difference X[i] - v
.
Is there a way to subtract a shape (n,3) array w
from X
so that each row of w
is subtracted form the whole array X
without explicitly using a loop?