Mercurial > hg > ishara
view general/numerical/sbitmap.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
function X=sbitmap(c,K) % sbitmap - turn sequence of integers into sparse binary bitmap % % sbitmap :: % Y:[[1,L]->[K]] ~'sequence of L natural numbers in 1..K', % K:natural ~'height of array to return' % -> X:[[K,L]->0|1] ~'X(i,j)=1 if Y(j)=i'. % % See also BITMAP L=length(c); if nargin<2, K=max(c); end X=sparse(c,1:L,1,K,L);