source:
proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/missing-data/all_ntuples.m
@
162
Last change on this file since 162 was 37, checked in by , 15 years ago | |
---|---|
File size: 442 bytes |
Line | |
---|---|
1 | function 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. |
4 | if k > n | k < 2 |
5 | if k == 1 |
6 | y = (1:n)'; |
7 | else |
8 | y = [] |
9 | end |
10 | else |
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 |
18 | end |
Note: See TracBrowser
for help on using the repository browser.