title: Numpy: How to elementwise-multiply two vectors, shape (n,1) and (n,)?
body: <p>Elementwise multiplication of two vectors is no problem if they both have the same shape, say both (n,1) or both (n,). If one vector has shape (n,1) and the other (n,), though, the <code>*</code>-operator returns something funny.</p>
  
  <pre><code>a = np.ones((3,1))
  b = np.ones((3,))
  print a * b
  </code></pre>
  
  <p>The resulting nxn-matrix contains A_{i,j}=a_i*b_j.</p>
  
  <p>How can I do elementwise multiplication for the <code>a</code> and <code>b</code> then?</p>