title: Creating all multi indices of given length
body: <p>Given an integer <code>K</code> and a dimension <code>d</code>, how can I get all multi-indices <code>alpha</code> with <code>length(alpha) = d</code> and <code>sum(alpha) = K</code> in R?</p>
  <p>Example: For <code>K=3</code> and <code>d=2</code> and if we organize the multi-indices in a list <code>alphas</code> we would get</p>
  <pre><code>alphas[[1]] = c(3,0)
  alphas[[2]] = c(2,1)
  alphas[[3]] = c(1,2)
  alphas[[4]] = c(0,3)
  </code></pre>