load number6x4.dat
inperm = [1 2 10 4 8 6 7 5 3 9]
[fit,diff,rowperm,colperm] = linfittm(number6x4,inperm)
[monproxpermuttm, vaf, diff] = proxmontm(number6x4(rowperm,colperm), fit)
sumfitsq = sum(sum(fit.^2));
prevvaf = 2;


while (abs(prevvaf-vaf) >= 1.0e-006)
    
   prevvaf = vaf; 
   mondata(rowperm,colperm) = monproxpermuttm;
   [fit diff rowperm colperm] = linfittm(mondata,inperm);
   sumnewfitsq = sum(sum(fit.^2));
   fit = sqrt(sumfitsq)*(fit/sqrt(sumnewfitsq));
    
   [monproxpermuttm vaf diff] = proxmontm(number6x4(rowperm,colperm), fit);
        

end

fit
vaf
monproxpermuttm
mondata

