www.pudn.com > ConstrainedEM.zip > prepare_chunclets.m
function inds =prepare_chunclets(cSizes,chun_num,av_chun_size,std_chun_size)
% cSizes - size of classes
% chun_num - number of chunclets.
% av_chun_size - average chunclet size
% if chunklets are not disjoint the intersection belong only to one of them , and the other becomes smaller.
% inds - a cell(1,chun_num) containing the indexes of the points in chunklets.
limits=[0 cumsum(cSizes) ];
unused_flags=ones(1,limits(end));
nc=length(cSizes);
inds=cell(chun_num,1);
for i=1:chun_num
chunklet_not_ready=1;
while chunklet_not_ready==1
seed=floor(rand*limits(end))+1; % first member in chunclet
tmp=limits=cSizes(class) % chunklet with size of the whole class.
inds{i}=(limits(class)+1):limits(class+1);
else
choosen=1; % choosing the chunclet members.
inds{i,choosen}=seed;
while choosen