view general/numerical/array/nary.m @ 61:eff6bddf82e3 tip

Finally implemented perceptual brightness thing.
author samer
date Sun, 11 Oct 2015 10:20:42 +0100
parents db7f4afd27c5
children
line wrap: on
line source
% nary - return array contain nary sequece over N columns
%
% nary :: 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