title: Index 2D numpy array by a 2D array of indices without loops
body: <p>I am looking for a vectorized way to index a <code>numpy.array</code> by <code>numpy.array</code> of indices. </p>
  
  <p>For example:</p>
  
  <pre><code>import numpy as np
  
  a = np.array([[0,3,4],
                [5,6,0],
                [0,1,9]])
  
  inds = np.array([[0,1],
                   [1,2],
                   [0,2]])
  </code></pre>
  
  <p>I want to build a new array, such that every row(i) in that array is a row(i) of array <code>a</code>, indexed by row of array inds(i). My desired output is:</p>
  
  <pre><code>array([[ 0.,  3.],   # a[0][:,[0,1]]
         [ 6.,  0.],   # a[1][:,[1,2]] 
         [ 0.,  9.]])  # a[2][:,[0,2]]
  </code></pre>
  
  <p>I can achieve this with a loop:</p>
  
  <pre><code>def loop_way(my_array, my_indices):
      new_array = np.empty(my_indices.shape)
      for i in xrange(len(my_indices)):
          new_array[i, :] = my_array[i][:, my_indices[i]]
      return new_array 
  </code></pre>
  
  <p>But I am looking for a pure vectorized solution.</p>