Mercurial > hg > ishara
annotate general/numerical/array/binary.m @ 61:eff6bddf82e3 tip
Finally implemented perceptual brightness thing.
author | samer |
---|---|
date | Sun, 11 Oct 2015 10:20:42 +0100 |
parents | db7f4afd27c5 |
children |
rev | line source |
---|---|
samer@4 | 1 % binary - return array contain binary sequece over N columns |
samer@4 | 2 % |
samer@4 | 3 % binary :: N:natural -> [[2^N,N]->{0,1}]. |
samer@4 | 4 % |
samer@16 | 5 % note: returns an array of uint32 |
samer@4 | 6 |
samer@4 | 7 function B=binary(N) |
samer@4 | 8 |
samer@4 | 9 M=2^N; |
samer@4 | 10 B=zeros(M,N,'uint8'); |
samer@4 | 11 b=1:N; |
samer@4 | 12 for i=1:M |
samer@4 | 13 B(i,:)=bitget(uint32(i-1),b); |
samer@4 | 14 end |