title: numpy: multiply arrays rowwise
body: <p>I have those arrays:</p>
  
  <pre><code>a = np.array([
       [1,2],
       [3,4],
       [5,6],
       [7,8]])
  
  b = np.array([1,2,3,4])
  </code></pre>
  
  <p>and I want them to multiply like so:</p>
  
  <pre><code>[[1*1, 2*1],
  [3*2, 4*2],
  [5*3, 6*3],
  [7*4, 8*4]]
  </code></pre>
  
  <p>... basically <code>out[i] = a[i] * b[i]</code>, where <code>a[i].shape</code> is <code>(2,)</code> and <code>b[i]</code> then is a scalar.</p>
  
  <p>What's the trick? <code>np.multiply</code> seems not to work:</p>
  
  <pre><code>&gt;&gt;&gt; np.multiply(a, b)
  ValueError: operands could not be broadcast together with shapes (4,2) (4)
  </code></pre>