title: numpy element-wise multiplication of an array and a vector
body: <p>I want to do something like this:</p>
  
  <pre><code>a =  # multi-dimensional numpy array
  ares = # multi-dim array, same shape as a
  a.shape
  &gt;&gt;&gt; (45, 72, 37, 24)  # the relevant point is that all dimension are different
  v = # 1D numpy array, i.e. a vector
  v.shape
  &gt;&gt;&gt; (37)  # note that v has the same length as the 3rd dimension of a
  for i in range(37):
      ares[:,:,i,:] = a[:,:,i,:]*v[i]
  </code></pre>
  
  <p>I'm thinking there has to be a more compact way to do this with numpy, but I haven't figured it out.  I guess I could replicate v and then calculate <code>a*v</code>, but I am guessing there is something better than that too.  So I need to do element wise multiplication "over a given axis", so to speak.  Anyone know how I can do this?  Thanks.  (BTW, I did find a close duplicate question, but because of the nature of the OP's particular problem there, the discussion was very short and got tracked into other issues.)</p>