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