
clear
index = UFget ;

nmat = length (index.nnz) ;
Filesize = zeros (nmat,1) ;
Bytes = 8*index.ncols' + 12*(index.nnz' + index.nzero') ;

for id = 1:nmat
    group = index.Group {id} ;
    name = index.Name {id} ;
    d = dir (['/cise/research/sparse/public_html/mat/' group '/' name '.mat']) ;
    if (length (d) > 0)
        filesize = d.bytes ;
    else
        % no compress if *.mat file doesn't exist
        filesize = Bytes (id) ;
    end
    Filesize (id) = filesize ;
end

fprintf ('max (Bytes ./ Filesize) = %g\n', max (Bytes ./ Filesize)) ;
fprintf ('min (Bytes ./ Filesize) = %g\n', min (Bytes ./ Filesize)) ;
fprintf ('median (Bytes ./ Filesize) = %g\n', median (Bytes ./ Filesize)) ;

loglog (Bytes, Bytes ./ Filesize, 'o') ;

xlabel ('# of bytes in uncompressed matrix') ;
ylabel ('compression ratio') ;

