LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
spaceClosedSingle.m
1function SS = spaceClosedSingle(M, N)
2% SS = SPACECLOSEDSINGLE(M, N)
3
4% Copyright (c) 2012-2014, Imperial College London
5% All rights reserved.
6if M==0
7 SS = [];
8else
9 SS = multichoose(M, N);
10end
11end
12
13function [v] = multichoose(n,k)
14% [V] = MULTICHOOSE(N,K)
15
16v=[];
17if n==1
18 v=k;
19 return
20elseif k==0
21 v=zeros(1,n);
22else
23 last=0;
24 for i=0:k
25 w=multichoose(n-1,k-i);
26 for j=1:size(w,1)
27 v(end+1,:)=[i w(j,:)];
28 end %for
29 end %for
30end %if
31end