annotate general/numerical/sbitmap.m @ 6:0ce3c2070089

Removed duplicate code and fixed doc in timed_action.
author samer
date Mon, 14 Jan 2013 14:33:37 +0000
parents e44f49929e56
children
rev   line source
samer@4 1 function X=sbitmap(c,K)
samer@4 2 % sbitmap - turn sequence of integers into sparse binary bitmap
samer@4 3 %
samer@4 4 % sbitmap ::
samer@4 5 % Y:[[1,L]->[K]] ~'sequence of L natural numbers in 1..K',
samer@4 6 % K:natural ~'height of array to return'
samer@4 7 % -> X:[[K,L]->0|1] ~'X(i,j)=1 if Y(j)=i'.
samer@4 8 %
samer@4 9 % See also BITMAP
samer@4 10
samer@4 11 L=length(c);
samer@4 12 if nargin<2, K=max(c); end
samer@4 13 X=sparse(c,1:L,1,K,L);