// ============================================================================ // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab // Copyright (C) 2007-2008 - Sylvestre LEDRU // // This file is distributed under the same license as the Scilab package. // ============================================================================ // <-- CLI SHELL MODE --> // Check value provided here: // http://math.nist.gov/MatrixMarket/data/SPARSKIT/tokamak/utm300.html warning("off"); [A, dsc]=ReadHBSparse(SCI+"/modules/umfpack/examples/utm300.rua"); if dsc <> "utm300" then bugmes();quit;end [nl,nc] = size(A) nc = 300. nl = 300. if nl <> 300 then bugmes();quit;end if nc <> 300 then bugmes();quit;end if nnz(A) <> 3155 then bugmes();quit;end // Diagonal if nnz(diag(A)) <> 300 then bugmes();quit;end // A-A' if nnz(A-A') <> 4382 then bugmes();quit;end // Heaviest diagonals offsets = [ 0 -50 50 1 -1 -5 5 2 -2 -4 ]; nonzerosExpected = [ 300 190 186 180 166 159 158 150 134 113 ]; for j=1:length(offsets) if nnz(diag(A, offsets(j))) <> nonzerosExpected(j) then bugmes();quit;end end // TODO add the rest of information [ij]=spget(A); e=ij(:,1)-ij(:,2); // Bandwidths average |i-j| m=ceil(mean(abs(e))); if m <> 21 then bugmes();quit;end // Bandwidths std.dev. d=ceil(stdev(abs(e))); if d <> 23 then bugmes();quit;end lastinrow=[find(diff(ij(:,1))>0) size(ij,1)]; rowlength=diff([0 lastinrow]); // Row Data [longest,indlongest]=max(rowlength); if longest <> 33 then bugmes();quit;end if indlongest <> 116 then bugmes();quit;end [shortest,indshortest]=min(rowlength); if shortest <> 1 then bugmes();quit;end if indshortest <> 3 then bugmes();quit;end // Average nonzeros per row m=ceil(mean(rowlength)); if m <> 11 then bugmes();quit;end d=round(stdev(rowlength)*10)/10; if d <> 7.7 then bugmes();quit;end // Column Data ji=gsort(ij(:,[2 1]),"lr","i"); lastincol=[find(diff(ji(:,1))>0) size(ji,1)]; collength=diff([0 lastincol]); [longest,indlongest]=max(collength); if longest <> 22 then bugmes();quit;end if indlongest <> 59 then bugmes();quit;end [shortest,indshortest]=min(collength); if shortest <> 1 then bugmes();quit;end if indshortest <> 16 then bugmes();quit;end m=ceil(mean(collength)); if m <> 11 then bugmes();quit;end d=round(stdev(collength)*10)/10; if d <> 7.1 then bugmes();quit;end // Profile Storage lastinrow=[find(diff(ij(:,1))>0) size(ij,1)]; rowbounds= [ij([1 lastinrow(1:$-1)+1],2) ij(lastinrow,2)]; rowindex=ij(lastinrow,1); rowbandwidth=rowbounds-rowindex*ones(1,2); lowband=[-rowbandwidth(find(rowbandwidth(:,1)<=0),1) -rowbandwidth(find(rowbandwidth(:,2)<=0),2)]; uppband=[rowbandwidth(find(rowbandwidth(:,1)>=0),1) rowbandwidth(find(rowbandwidth(:,2)>=0),2)]; // lower bandwidth => max minlow=max(lowband); if minlow <> 74 then bugmes();quit;end // lower bandwidth => min maxlow=min(lowband); if maxlow <> 0 then bugmes();quit;end // upper bandwidth => max maxupp=max(uppband); if maxupp <> 66 then bugmes();quit;end // upper bandwidth => min minupp=min(uppband); if minupp <> 0 then bugmes();quit;end