title: Efficient creation of tridiagonal matrices
body: <p>How can I create a quadratic band matrix, where I give the diagonal and the first diagonal below and above the diagonal? I am looking for a function like</p>
  
  <pre><code>tridiag(upper, lower, main)
  </code></pre>
  
  <p>where <code>length(upper)==length(lower)==length(main)-1</code> and returns, for example,</p>
  
  <pre><code>tridiag(1:3, 2:4, 3:6)
  
           [,1] [,2] [,3] [,4]
  [1,]    3    1    0    0
  [2,]    2    4    2    0
  [3,]    0    3    5    3
  [4,]    0    0    4    6
  </code></pre>
  
  <p>Is there an efficient way to do it?</p>