So I have a n x d matrix and an n x 1 vector. I'm trying to write a code to subtract every row in the matrix by the vector.
I currently have a for loop that iterates through and subtracts the i-th row in the matrix by the vector. Is there a way to simply subtract an entire matrix by the vector?
Thanks!
Current code:
for i in xrange( len( X1 ) ): X[i,:] = X1[i,:] - X2 This is where X1 is the matrix's i-th row and X2 is vector. Can I make it so that I don't need a for loop?