Mercurial > hg > ishara
comparison general/numerical/array/nary.m @ 16:db7f4afd27c5
Rearranging numerical toolbox.
author | samer |
---|---|
date | Thu, 17 Jan 2013 13:20:44 +0000 |
parents | general/numerical/nary.m@e44f49929e56 |
children |
comparison
equal
deleted
inserted
replaced
15:19ec801ee487 | 16:db7f4afd27c5 |
---|---|
1 % nary - return array contain nary sequece over N columns | |
2 % | |
3 % nary :: M:natural, N:natural -> [[M^N,N]->1..M]. | |
4 | |
5 function B=nary(M,N) | |
6 | |
7 if (N==1), B=(1:M)'; | |
8 else | |
9 b=nary(M,N-1); | |
10 m=size(b,1); | |
11 B=[ kron((1:M)',ones(m,1)), repmat(b,M,1)]; | |
12 end |