title: add a vector to all rows of a matrix
body: <p>I am maximizing a likelihood function and trying to reduce the loop.
  I want to add the vector(parameters to be estimated) to all rows of a matrix (data). The length of vector equals to the column of matrix.
  <code>a+b</code> would give the wrong results because the recycle rule of R is by column not row. </p>
  
  <pre><code>a&lt;-c(1,2,0,0,0)  # parameters to be optimized
  b&lt;-matrix(1,ncol=5,nrow=6) # data
  t(a+t(b)) # my code would work, anything more intuitive?
  </code></pre>
  
  <p><strong>Desired</strong> output</p>
  
  <pre><code>        [,1] [,2] [,3] [,4] [,5]
      [1,]    2    3    1    1    1
      [2,]    2    3    1    1    1
      [3,]    2    3    1    1    1
      [4,]    2    3    1    1    1
      [5,]    2    3    1    1    1
      [6,]    2    3    1    1    1
  </code></pre>
  
  <p>The <strong>wrong</strong> output</p>
  
  <pre><code>a+b
      [,1] [,2] [,3] [,4] [,5]
  [1,]    2    3    1    1    1
  [2,]    3    1    1    1    2
  [3,]    1    1    1    2    3
  [4,]    1    1    2    3    1
  [5,]    1    2    3    1    1
  [6,]    2    3    1    1    1
  </code></pre>