File: test9.m

package info (click to toggle)
suitesparse 1%3A5.12.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 176,720 kB
  • sloc: ansic: 1,193,914; cpp: 31,704; makefile: 6,638; fortran: 1,927; java: 1,826; csh: 765; ruby: 725; sh: 529; python: 333; perl: 225; sed: 164; awk: 35
file content (78 lines) | stat: -rw-r--r-- 2,224 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
function test9
%TEST9 test metis, etree, bisect, nesdis
% Example:
%   test9
% See also cholmod_test

% Copyright 2007, Timothy A. Davis, http://www.suitesparse.com

fprintf ('=================================================================\n');
fprintf ('test9: test metis, etree, bisect, nesdis\n') ;

% Prob = ssget ('LPnetlib/lp_qap15') ;
Prob = ssget ('HB/bcsstk15')						    %#ok
A = Prob.A ;
C = A'*A ;
R = A*A' ;

fprintf ('\nmetis:\n') ;
tic ; p0 = metis (R) ; toc						    %#ok
% [pa po] = etree2 (R (p0,p0)) ; sparse (po - (1:size(R,1)))

tic ; p1 = metis (C) ; toc						    %#ok
% [pa po] = etree2 (C (p1,p1)) ; sparse (po - (1:size(C,1)))

tic ; p2 = metis (C, 'sym') ; toc					    %#ok
% [pa po] = etree2 (C (p1,p1)) ; sparse (po - (1:size(C,1)))

tic ; p3 = metis (A, 'row') ; toc					    %#ok
% [pa po] = etree2 (A (p1,:), 'row') ; sparse (po - (1:size(A,1)))

tic ; p4 = metis (A, 'col') ; toc					    %#ok
% [pa po] = etree2 (A (:,p1), 'col') ; sparse (po - (1:size(A,2)))

fprintf ('\nmetis(A):\n') ;
[m n] = size(A) ;
if (m == n)
    if (nnz (A-A') == 0)
	tic ; p5 = metis (A) ; toc
	% spy (A (p5,p5)) ;
	[ignore q] = etree (A(p5,p5)) ;
	p5post = p5 (q) ;						    %#ok
	% spy (A (p5post,p5post)) ;
	lnz0 = sum (symbfact (A (p5,p5)))				    %#ok
    end
end

fprintf ('\namd:\n') ;
if (m == n)
    if (nnz (A-A') == 0)
	tic ; z0 = amd2 (A) ; toc					    %#ok
	lnz = sum (symbfact (A (z0,z0)))				    %#ok
    end
end

fprintf ('\nbisect:\n') ;
tic ; s0 = bisect (R) ; toc						    %#ok
tic ; s1 = bisect (C) ; toc						    %#ok
tic ; s2 = bisect (C, 'sym') ; toc					    %#ok
tic ; s3 = bisect (A, 'row') ; toc					    %#ok
tic ; s4 = bisect (A, 'col') ; toc					    %#ok


fprintf ('\nnested dissection:\n') ;
tic ; [c0 cp0 cmem0] = nesdis (R) ; toc					    %#ok
tic ; [c1 cp1 cmem1] = nesdis (C) ; toc					    %#ok
tic ; [c2 cp2 cmem2] = nesdis (C, 'sym') ; toc				    %#ok
tic ; [c3 cp3 cmem3] = nesdis (A, 'row') ; toc				    %#ok
tic ; [c4 cp4 cmem4] = nesdis (A, 'col') ; toc				    %#ok

fprintf ('\nnested_dissection(A):\n') ;
if (m == n)
    if (nnz (A-A') == 0)
	tic ; c5 = nesdis (A) ; toc					    %#ok
	lnz1 = sum (symbfact (A (c5,c5)))				    %#ok
    end
end

fprintf ('test9 passed\n') ;