title: operations about two lists to index a two dimensional array
body: <p>Code:</p>
  
  <pre><code>import numpy as np
  a = np.array((1,1,1,1,2))
  b = np.array((2,2,2,2,1))
  g = np.zeros((3,3),np.int32)
  g[a,b] += 1
  </code></pre>
  
  <p>At the end, this should give an array</p>
  
  <pre><code>array([[0, 0, 0],
         [0, 0, 4],
         [0, 1, 0]])
  </code></pre>
  
  <p>i.e. g[1, 2] being incremented 4 times, and g[2, 1] being incremented once, but instead it gives</p>
  
  <pre><code>array([[0, 0, 0],
         [0, 0, 1],
         [0, 1, 0]])
  </code></pre>
  
  <p>The reason that I don't want to use a loop is because I think the vectorization can accelerate the computation. I have two large sets <code>a</code> and <code>b</code>. But I'm not sure whether this operation can exploit performance from vectorization mechanism of Python. and I'm not sure I understand this operation neither. I don't know which key words I should use to search in google, so I put my question here. </p>
  
  <p>If someone can help me understand it, that will be much better.</p>