title: How to apply a function to a list of matrices elementwise
body: <p>I have a list of matrices and I would like to multiply each matrix with a different factor from a vector of the same length as the list.
  I tried the following:</p>
  
  <pre><code>lapply(list(mat1, mat2, mat3),"*",c(1,2,3))
  </code></pre>
  
  <p>However, this returns:</p>
  
  <pre><code>list(mat1*c(1,2,3), mat2*c(1,2,3), mat3*c(1,2,3))
  </code></pre>
  
  <p>instead of what I need:</p>
  
  <pre><code>list(mat1*1,mat2*2,mat3*3)
  </code></pre>
  
  <p>Has anybody a solution to this problem?</p>