title: Numpy Array summing with weights
body: <p>I have a two dimensional numpy array.</p>
  
  <p>Each row is three elements long and is an integer 0-3. This represents a 6 bit integer, with each cell representing two bits, in order.</p>
  
  <p>I'm trying to transform them into the full integer.</p>
  
  <p>E.g.</p>
  
  <pre><code>for i in range(len(myarray)):
    myarray[i] = myarray[i][0] * 16 + myarray[i][1] * 4 + myarray[i][2]
  </code></pre>
  
  <p>E.g. I'm trying to sum each row but according to a certain weight vector of [16,4,1].</p>
  
  <p>What is the most elegant way to do this? I'm thinking I have to do some sort of dot product followed by a sum, but I'm not 100% confident where to do the dot.</p>