% Antti Hannukainen 
% 
% Use recursion to compute all 
% possible values of multi-index u
%
% nu = number of variables in the multi-index
% N  = number of permutations lleft ! 

function u = multi_index(nu,N)

if(nu <= 1)
  u = N;
  return;
else
  

u =[];
  
for i=0:N

  abu = multi_index(nu-1,N-i);
  u = [u ; ones(size(abu,1),1)*i abu];
  
  end

end