2
%TEST_QR test various QR factorization methods
8
% Copyright 2006-2007, Timothy A. Davis.
9
% http://www.cise.ufl.edu/research/sparse
12
[ignore f] = sort (max (index.nrows,index.ncols)) ;
20
% Prob = UFget (i,index)
29
if (sprank (A) < n | ~isreal (A)) %#ok
33
[V,beta,p,R1,q] = cs_qr(A) ;
35
parent = etree (A, 'col') ; %#ok
38
R2 = qr_givens (full (A)) ;
39
R3 = qr_givens_full (full (A)) ;
41
subplot (2,2,1) ; cspy (R0) ; title ('matlab') ;
42
subplot (2,2,2) ; cspy (R3) ; title ('qr-full') ;
43
subplot (2,2,3) ; cspy (R2) ; title ('qr-givens') ;
44
subplot (2,2,4) ; cspy (R1) ; title ('cs-qr') ;
46
e0 = norm (A'*A-R0'*R0,1) / norm (A,1) ;
47
e1 = norm (A'*A-R1'*R1,1) / norm (A,1) ;
48
e2 = norm (A'*A-R2'*R2,1) / norm (A,1) ;
49
e3 = norm (A'*A-R3'*R3,1) / norm (A,1) ;
50
fprintf ('error %6.2e %6.2e %6.2e %6.2e\n', e0, e1, e2, e3) ;
52
if (e1 > e0*1e3 | e2 > e0*1e3) %#ok