1function test25 2%TEST25 test cs_nd 3% 4% Example: 5% test25 6% See also: testall 7 8% Copyright 2006-2012, Timothy A. Davis, http://www.suitesparse.com 9 10clear functions 11 12index = ssget ; 13[ignore f] = sort (max (index.nrows, index.ncols)) ; 14f = f (1:100) ; 15 16clf 17% f = f(1) 18 19for k = 1:length (f) 20 21 i = f (k) ; 22 Prob = ssget (i) ; 23 disp (Prob) ; 24 A = real (Prob.A) ; 25 [m n] = size (A) ; 26 if (m ~= n) 27 continue 28 end 29 30 A = A|A' ; 31 32 tic ; 33 p1 = symrcm (A) ; 34 t1 = toc ; 35 36 tic ; 37 p2 = cs_nd (sparse (1)) ; 38 toc ; 39 if (p2 ~= 1) 40 error ('!') ; 41 end 42 43 tic ; 44 p2 = cs_nd (A) ; 45 t2 = toc ; 46 47 if (any (sort (p2) ~= 1:n)) 48 error ('!') ; 49 end 50 51 rel = t2 / max (t1,1e-6) ; 52 53 fprintf ('time: symrcm %8.3f nd %8.3f rel %8.2f\n', t1, t2, rel) ; 54 55 subplot (1,3,1) ; spy (A) ; 56 subplot (1,3,2) ; spy (A (p1,p1)) ; 57 subplot (1,3,3) ; spy (A (p2,p2)) ; 58 59 % evaluate the profile ... 60 61 62 drawnow 63 % pause 64end 65