1function test28
2%TEST28 test nesdis
3% Example:
4%   test28
5% See also cholmod_test
6
7% Copyright 2007, Timothy A. Davis, http://www.suitesparse.com
8
9index = ssget ;
10
11[ignore f] = sort (index.nnz) ;
12
13% f = find (index.nrows < index.ncols) ;
14% [ignore i] = sort (index.nnz (f)) ;
15% f = f (i) ;
16
17f = f (1:100) ;
18
19for i = f
20
21    try
22
23	Prob = ssget (i, index) ;
24	A = spones (Prob.A) ;
25	[m n] = size (A) ;
26
27	if (m < n)
28	    A = A*A' ;
29	elseif (m > n) ;
30	    A = A'*A ;
31	else
32	    A = A+A' ;
33	end
34
35	% default: do not split connected components
36	[p1 cp1 cmem1] = nesdis (A) ;					    %#ok
37
38	% order connected components separately
39	[p2 cp2 cmem2] = nesdis (A, 'sym', [200 1]) ;			    %#ok
40	c1 = symbfact (A (p1,p1)) ;
41	c2 = symbfact (A (p2,p2)) ;
42	lnz1 = sum (c1) ;
43	lnz2 = sum (c2) ;
44	fprintf ('%35s %8d %8d ', Prob.name, lnz1, lnz2)
45	if (lnz1 == lnz2)
46	    fprintf ('        1\n') ;
47	else
48	    fprintf (' %8.3f\n', lnz1/lnz2) ;
49	end
50
51	subplot (2,3,1) ; spy (A) ;
52	subplot (2,3,2) ; spy (A (p1,p1)) ;
53	subplot (2,3,3) ; treeplot (cp1) ;
54	subplot (2,3,5) ; spy (A (p2,p2)) ;
55	subplot (2,3,6) ; treeplot (cp2) ;
56	drawnow
57
58    catch
59	fprintf ('%4d failed\n', i) ;
60    end
61end
62