title: Fastest way to multiply matrix columns with vector elements in R
body: <p>I have a matrix <code>m</code> and a vector <code>v</code>. I would like to multiply first column of matrix <code>m</code> by the first element of vector <code>v</code>, and multiply the second column of matrix <code>m</code> by the second element of vector <code>v</code>, and so on. I can do it with the following code, but I am looking for a way which does not require the two transpose calls. How can I do this faster in R?</p>
  
  <pre><code>m &lt;- matrix(rnorm(120000), ncol=6)
  v &lt;- c(1.5, 3.5, 4.5, 5.5, 6.5, 7.5)
  
  system.time(t(t(m) * v))
  
  #   user  system elapsed 
  #   0.02    0.00    0.02 
  </code></pre>