2
% test23: test chol and cholmod on the sparse matrix used in "bench"
3
fprintf ('=================================================================\n');
4
fprintf ('test23: test chol & cholmod on the sparse matrix used in "bench"\n');
7
A = delsq (numgrid ('L', n)) ;
10
fprintf ('Using each method''s internal fill-reducing ordering:\n') ;
22
fprintf ('MATLAB x=A\\b time: %8.4f resid: %8.0e\n', t1, e1) ;
23
fprintf ('CHOLMOD x=A\\b time: %8.4f resid: %8.0e\n', t2, e2) ;
24
fprintf ('CHOLMOD speedup: %8.2f\n', t1/t2) ;
26
% get CHOLMOD's ordering (best of AMD and METIS)
33
x = R \ (R' \ b (p)) ;
40
x = L' \ (L \ b (p)) ;
44
fprintf ('\nS = A(p,p) where p is CHOLMOD''s ordering:\n') ;
45
fprintf ('MATLAB R=chol(S) time: %8.4f resid: %8.0e\n', t1, e1) ;
46
fprintf ('CHOLMOD L=lchol(S) time: %8.4f resid: %8.0e\n', t2, e2) ;
47
fprintf ('CHOLMOD speedup: %8.2f\n', t1/t2) ;
49
% get MATLABS's ordering (symmmd in v7.0.4). If that fails then use amd.
50
% A future version of MATLAB will remove symmmd, since it is declared
51
% "deprecated" in v7.0.4.
52
try % symmmd, use amd if it fails
57
fprintf ('\nsymmmd not available, using amd instead.\n') ;
65
x = R \ (R' \ b (p)) ;
72
x = L' \ (L \ b (p)) ;
76
fprintf ('\nS = A(p,p) where p is MATLAB''s ordering in x=A\\b (%s):\n',method);
77
fprintf ('MATLAB R=chol(S) time: %8.4f resid: %8.0e\n', t1, e1) ;
78
fprintf ('CHOLMOD L=lchol(S) time: %8.4f resid: %8.0e\n', t2, e2) ;
79
fprintf ('CHOLMOD speedup: %8.2f\n', t1/t2) ;
81
fprintf ('\n\nWith no fill-reducing orderings:\n') ;
94
fprintf ('MATLAB R=chol(A) time: %8.4f resid: %8.0e\n', t1, e1) ;
95
fprintf ('CHOLMOD L=lchol(A) time: %8.4f resid: %8.0e\n', t2, e2) ;
96
fprintf ('CHOLMOD speedup: %8.2f\n', t1/t2) ;
98
fprintf ('\n\nWith no fill-reducing orderings (as used in "bench"):\n') ;
100
spparms ('autommd',0) ;
107
x = cholmod (A,b,0) ;
111
fprintf ('MATLAB x=A\\b time: %8.4f resid: %8.0e\n', t1, e1) ;
112
fprintf ('CHOLMOD x=A\\b time: %8.4f resid: %8.0e\n', t2, e2) ;
113
fprintf ('CHOLMOD speedup: %8.2f\n', t1/t2) ;
115
spparms ('default') ;