title: Method for associating vector elements with items they represent
body: <p>Imagine an "item" structure (represented as a JSON hash)</p>
  
  <pre><code>{
    id: 1,
    value: 5
  }
  </code></pre>
  
  <p>Now imagine I have a set of 100,000 items, and I need to perform calculations on the value associated with each.  At the end of the calculation, I update each item with the new value.</p>
  
  <p>To do this quickly, I have been using GSL vector libraries, loading each value as an element of the vector.</p>
  
  <p>For example, the items:</p>
  
  <pre><code>{ id: 1, value: 5 }
  { id: 2, value: 6 }
  { id: 3, value: 7 }
  </code></pre>
  
  <p>Becomes:</p>
  
  <pre><code>GSL::Vector[5, 6, 7]
  </code></pre>
  
  <p>Element 1 corresponds to item id 1, element 2 corresponds to item id 2, etc.  I then proceed to perform element-wise calculations on each element in the vector, multiplying, dividing etc.</p>
  
  <p>While this works, it bothers me that I have to depend on the list of items being sorted by ID.</p>
  
  <p>Is there another structure that acts like a hash (allowing me to say with certainty a particular result value corresponds to a particular item), but allows me to do fast, memory efficient element-wise operations like a vector?</p>
  
  <p>I'm using Ruby and the GSL bindings, but willing to re-write this in another language if necessary.</p>