source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/missing-data/all_ntuples.m @ 173

Last change on this file since 173 was 37, checked in by (none), 15 years ago

Added original make3d

File size: 442 bytes
Line 
1function y = all_ntuples(k,n)
2% Pick all k-tuples of numbers less than n.  Order is not important.
3% Output is a matrix that is n choose k rows and k columns.
4if k > n | k < 2
5  if k == 1
6    y = (1:n)';
7  else
8    y = []
9  end
10else
11  if k == n
12    y = 1:n;
13  else
14    smallertups = all_ntuples(k-1, n-1);
15    smallertups_and_n = [(repeat(n,size(smallertups,1)))',smallertups];
16    y = [smallertups_and_n', (all_ntuples(k,n-1))']';
17  end
18end
Note: See TracBrowser for help on using the repository browser.