~logan/ubuntu/trusty/suitesparse/4.2.1-3ubuntu1

« back to all changes in this revision

Viewing changes to CHOLMOD/MATLAB/Test/test0.m

  • Committer: Bazaar Package Importer
  • Author(s): Christophe Prud'homme
  • Date: 2007-05-29 09:36:29 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070529093629-zowquo0b7slkk6nc
Tags: 3.0.0-2
* suitesparse builds properly twice in a row
* Bug fix: "suitesparse - FTBFS: Broken build depens: libgfortran1-dev",
  thanks to Bastian Blank (Closes: #426349).
* Bug fix: "suitesparse_3.0.0-1: FTBFS: build-depends on
  libgfortran1-dev", thanks to Steve Langasek (Closes: #426354).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
function test0 (nmat)
2
 
% test0(nmat): test most CHOLMOD functions
 
2
%TEST0 test most CHOLMOD functions
 
3
% Example:
 
4
%   test0(nmat)
 
5
% See also cholmod_test
 
6
 
 
7
% Copyright 2006-2007, Timothy A. Davis, University of Florida
 
8
 
3
9
fprintf ('=================================================================\n');
4
10
fprintf ('test0: test most CHOLMOD functions\n') ;
5
11
 
7
13
% collection.  You can obtain UFget from
8
14
% http://www.cise.ufl.edu/research/sparse/matrices.
9
15
 
10
 
s = exist ('amd') ;
11
 
use_amd = (s == 3 || s == 5) ;
 
16
s = exist ('amd') ;     %#ok
 
17
use_amd = (s == 3 | s == 5) ;                                               %#ok
12
18
if (use_amd)
13
19
fprintf ('Testing CHOLMOD with AMD and the UF sparse matrix collection\n') ;
14
20
else
35
41
end
36
42
 
37
43
% skip = [937:939 1202:1211] ;
38
 
skip = [937:939] ;
 
44
skip = 937:939 ;
39
45
if (nargin > 0)
40
46
    nmat = max (0,nmat) ;
41
47
    nmat = min (nmat, length (f)) ;
95
101
        end
96
102
 
97
103
        % ensure chol, chol2, and lchol are loaded, for more accurate timing
98
 
        R = chol2 (sparse (1)) ;
99
 
        R = chol (sparse (1)) ;
100
 
        R = lchol (sparse (1)) ;
101
 
        R = ldlchol (sparse (1)) ;
102
 
        R = ldlupdate (sparse (1), sparse (1)) ;
103
 
        c = symbfact (sparse (1)) ;
 
104
        R = chol2 (sparse (1)) ;            %#ok
 
105
        R = chol (sparse (1)) ;             %#ok
 
106
        R = lchol (sparse (1)) ;            %#ok
 
107
        R = ldlchol (sparse (1)) ;          %#ok
 
108
        R = ldlupdate (sparse (1), sparse (1)) ;            %#ok
 
109
        c = symbfact (sparse (1)) ;         %#ok
104
110
 
105
111
        tic ;
106
112
        L = lchol (S) ;
112
118
        fprintf ('CHOLMOD time: L=lchol  %10.4f  nnz(L): %d\n', t3, nnz (L)) ;
113
119
        lnorm = norm (L, 1) ;
114
120
 
115
 
        err = lu_normest (S, L, L') / lnorm ;
 
121
        err = ldl_normest (S, L) / lnorm ;
116
122
        if (err > 1e-6)
117
123
            error ('!') ;
118
124
        end
127
133
        end
128
134
        fprintf ('CHOLMOD time: R=chol2  %10.4f  nnz(R): %d\n', t2, nnz (R)) ;
129
135
 
130
 
        err = lu_normest (S, R', R) / lnorm ;
 
136
        err = ldl_normest (S, R') / lnorm ;
131
137
        if (err > 1e-6)
132
138
            error ('!') ;
133
139
        end
142
148
            drawnow ;
143
149
        end
144
150
 
145
 
        err = lu_normest (S, R', R) / lnorm ;
 
151
        err = ldl_normest (S, R') / lnorm ;
146
152
        if (err > 1e-6)
147
153
            error ('!') ;
148
154
        end
171
177
            drawnow ;
172
178
        end
173
179
 
174
 
        err = lu_normest (A (q,q), L, L') / lnorm ;
 
180
        err = ldl_normest (A (q,q), L) / lnorm ;
175
181
        if (err > 1e-6)
176
182
            error ('!') ;
177
183
        end
202
208
        row = 1 + floor (rand (1) * n) ;
203
209
        C (row,1) = 1 ;
204
210
 
 
211
        if (~isreal (C) | ~isreal (LD))                                     %#ok
 
212
            fprintf ('skip update/downdate of complex matrix ...\n') ;
 
213
            continue ;
 
214
        end
 
215
 
205
216
        tic
206
217
        LD2 = ldlupdate (LD, C) ;
207
218
        t = toc ;
227
238
        % no change to the pattern occurs.
228
239
        k = max (1, floor (k/2)) ;
229
240
        C1 = C (:, 1:k) ;
230
 
        C2 = C (:, k+1:end) ;
 
241
        C2 = C (:, k+1:end) ;           %#ok
231
242
        tic
232
243
        LD3 = ldlupdate (LD2, C1, '-') ;
233
244
        t = toc ;