1function test22
2%TEST22 test cond1est
3%
4% Example:
5%   test22
6% See also: testall
7
8% Copyright 2006-2012, Timothy A. Davis, http://www.suitesparse.com
9
10index = ssget ;
11[ignore f] = sort (max (index.nrows, index.ncols)) ;
12f = f (1:200) ;
13
14clf
15% f = f(1)
16
17nprob = length (f) ;
18C1 = zeros (nprob,1) ;
19C2 = zeros (nprob,1) ;
20C3 = zeros (nprob,1) ;
21
22
23for k = 1:length (f)
24
25    i = f (k) ;
26    Prob = ssget (i) ;
27    disp (Prob) ;
28    A = Prob.A ;
29    [m n] = size (A) ;
30    if (~isreal (A) | m ~= n)                                               %#ok
31        continue
32    end
33
34    c1 = condest (A) ;
35    c2 = cond1est (A) ;
36    if (c1 == c2)
37        err = 0 ;
38    else
39        err = (c1-c2)/max(1,c1) ;
40    end
41
42    c3 = cond (full (A), 1) ;
43
44    fprintf ('%10.4e %10.4e (%10.4e)  :    %10.4e\n', c1, c2, c3, err) ;
45
46    C1 (k) = c1 ;
47    C2 (k) = c2 ;
48    C3 (k) = c3 ;
49
50    subplot (1,2,1) ;
51    loglog (C1, C2, 'x', [1 1e20], [1 1e20], 'r') ;
52    subplot (1,2,2) ;
53    loglog (C3, C2, 'x', [1 1e20], [1 1e20], 'r') ;
54    drawnow
55
56end
57