Mercurial > hg > ishara
view general/numerical/nary.m @ 4:e44f49929e56
Adding reorganised general toolbox, now in several subdirectories.
author | samer |
---|---|
date | Sat, 12 Jan 2013 19:21:22 +0000 |
parents | |
children |
line wrap: on
line source
% binary - return array contain binary sequece over N columns % % binary :: M:natural, N:natural -> [[M^N,N]->1..M]. function B=nary(M,N) if (N==1), B=(1:M)'; else b=nary(M,N-1); m=size(b,1); B=[ kron((1:M)',ones(m,1)), repmat(b,M,1)]; end