Indexing one array by another in numpy : <p>Suppose I have a matrix <strong>A</strong> with some arbitrary values:</p>

<pre><code>array([[ 2, 4, 5, 3],
       [ 1, 6, 8, 9],
       [ 8, 7, 0, 2]])
</code></pre>

<p>And a matrix <strong>B</strong> which contains indices of elements in A:</p>

<pre><code>array([[0, 0, 1, 2],
       [0, 3, 2, 1],
       [3, 2, 1, 0]])
</code></pre>

<p>How do I select values from <strong>A</strong> pointed by <strong>B</strong>, i.e.:</p>

<pre><code>A[B] = [[2, 2, 4, 5],
        [1, 9, 8, 6],
        [2, 0, 7, 8]]
</code></pre>
