title: Multiply array of vectors with array of matrices; return array of vectors?
body: <p>I've got a <code>numpy</code> array of row vectors of shape (n,3) and another numpy array of matrices of shape (n,3,3). I would like to multiply each of the n vectors with the corresponding matrix and return an array of shape (n,3) of the resulting vectors.</p>
  
  <p>By now I've been using a for loop to iterate through the n vectors/matrices and do the multiplication item by item. </p>
  
  <p>I would like to know if there's a more numpy-ish way of doing this. A way without the for loop that might even be faster.</p>
  
  <p>//edit 1:</p>
  
  <p>As requested, here's my loopy code (with <code>n = 10</code>):</p>
  
  <pre><code>    arr_in = np.random.randn(10, 3)
      matrices = np.random.randn(10, 3, 3)
  
      for i in range(arr_in.shape[0]): # 10 iterations
          arr_out[i] = np.asarray(np.dot(arr_in[i], matrices[i]))
  </code></pre>