title: "To location array" to index array
body: <p>I have some data array</p>
  <pre><code>a = [6,4,3,1,5]
  </code></pre>
  <p>and a &quot;to location array&quot;, that gives indices for how these elements should be reshuffled,</p>
  <pre><code>b = [4,2,0,1,3]
  </code></pre>
  <p>What this means: the 1st element of <code>a</code> should go to index 4, the 2nd element of <code>a</code> should go to index 2, and so on. So when applying <code>b</code> to <code>a</code>, I should get:</p>
  <pre><code>c = [3,1,4,5,6]
  </code></pre>
  <p>However, I am struggling to implement this operation. Is it a common operation? If so, could someone give me an example? I want to generate some array <code>d</code> from <code>b</code> so that</p>
  <pre><code>c = a[d]
  </code></pre>
  <p>In the above example,</p>
  <pre><code>d = [2,3,1,4,0]
  </code></pre>
  <p><strong>What I tried:</strong> <code>d = b[b]</code>, but this is not always correct.</p>