title: numpy: multiplying a 2D array by a 1D array
body: <p>Let us say one has an array of 2D vectors:</p>
  
  <pre><code>v = np.array([ [1, 1], [1, 1], [1, 1], [1, 1]])
  v.shape = (4, 2)
  </code></pre>
  
  <p>And an array of scalars:</p>
  
  <pre><code>s = np.array( [2, 2, 2, 2] )
  s.shape = (4,)
  </code></pre>
  
  <p>I would like the result:</p>
  
  <pre><code>f(v, s) = np.array([ [2, 2], [2, 2], [2, 2], [2, 2]])
  </code></pre>
  
  <p>Now, executing <code>v*s</code> is an error. Then, what is the most efficient way to go about implementing <code>f</code>?</p>