title: how to do scatter/gather operations in numpy
body: <p>lets say i have arrays:</p>
  
  <pre><code>a = array((1,2,3,4,5))
  indices = array((1,1,1,1))
  </code></pre>
  
  <p>and i perform operation:</p>
  
  <pre><code>a[indices] += 1
  </code></pre>
  
  <p>the result is</p>
  
  <pre><code>array([1, 3, 3, 4, 5])
  </code></pre>
  
  <p>in other words, the duplicates in <code>indices</code> are ignored</p>
  
  <p>if I wanted the duplicates not to be ignored, resulting in:</p>
  
  <pre><code>array([1, 6, 3, 4, 5])
  </code></pre>
  
  <p>how would I go about this?</p>
  
  <p>the example above is somewhat trivial, what follows is exactly what I am trying to do:</p>
  
  <pre><code>def inflate(self,pressure):
      faceforces = pressure * cross(self.verts[self.faces[:,1]]-self.verts[self.faces[:,0]], self.verts[self.faces[:,2]]-self.verts[self.faces[:,0]])
      self.verts[self.faces[:,0]] += faceforces
      self.verts[self.faces[:,1]] += faceforces
      self.verts[self.faces[:,2]] += faceforces
  
  def constrain_lengths(self):
      vectors = self.verts[self.constraints[:,1]] - self.verts[self.constraints[:,0]]
      lengths = sqrt(sum(square(vectors), axis=1))
      correction = 0.5 * (vectors.T * (1 - (self.restlengths / lengths))).T
      self.verts[self.constraints[:,0]] += correction
      self.verts[self.constraints[:,1]] -= correction
  
  def compute_normals(self):
      facenormals = cross(self.verts[self.faces[:,1]]-self.verts[self.faces[:,0]], self.verts[self.faces[:,2]]-self.verts[self.faces[:,0]])
      self.normals.fill(0)
      self.normals[self.faces[:,0]] += facenormals
      self.normals[self.faces[:,1]] += facenormals
      self.normals[self.faces[:,2]] += facenormals
      lengths = sqrt(sum(square(self.normals), axis=1))
      self.normals = (self.normals.T / lengths).T
  </code></pre>
  
  <p>Ive been getting some very buggy results as a result of duplicates being ignored in my indexed assignment operations.</p>