0001 function gmC=Compress(gm,m)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 if (gm.n<=m) || (m==0)
0016 gmC=gm;
0017 else
0018
0019 gmN=Normalize(gm);
0020
0021
0022
0023
0024 [gmLC mapLC]=RemoveSmallComponents(gmN,0.1/gmN.n);
0025
0026
0027
0028
0029
0030
0031 [gmC mapC]=CompressGR(Normalize(gmLC),m,1e-5,50);
0032
0033
0034
0035 gmC.w=zeros(1,gmC.n);
0036 for i=1:gmC.n
0037 ndx=(mapC==i);
0038 gmC.w(i)=sum(gm.w(mapLC(ndx)));
0039 end
0040
0041
0042 gmC=RemoveSmallComponents(gmC,1e-3);
0043 end