~ubuntu-branches/ubuntu/natty/suitesparse/natty

« back to all changes in this revision

Viewing changes to UMFPACK/MATLAB/umfpack_report.m

  • Committer: Bazaar Package Importer
  • Author(s): Christophe Prud'homme
  • Date: 2006-12-22 10:16:15 UTC
  • Revision ID: james.westby@ubuntu.com-20061222101615-2ohaj8902oix2rnk
Tags: upstream-2.3.1
ImportĀ upstreamĀ versionĀ 2.3.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
function umfpack_report (Control, Info)
 
2
% UMFPACK_REPORT
 
3
%
 
4
%       umfpack_report (Control, Info) ;
 
5
%
 
6
% Prints the current Control settings for umfpack, and the statistical
 
7
% information returned by umfpack in the Info array.  If Control is
 
8
% an empty matrix, then the default control settings are printed.
 
9
%
 
10
% Control is 20-by-1, and Info is 90-by-1.  Not all entries are used.
 
11
%
 
12
% Alternative usages:
 
13
%
 
14
%       umfpack_report ([ ], Info) ;    print the default control parameters
 
15
%                                       and the Info array.
 
16
%       umfpack_report (Control) ;      print the control parameters only.
 
17
%       umfpack_report ;                print the default control parameters
 
18
%                                       and an empty Info array.
 
19
%
 
20
% See also umfpack, umfpack_make, umfpack_details,
 
21
% umfpack_demo, and umfpack_simple.
 
22
 
 
23
% UMFPACK Version 5.0, Copyright (c) 1995-2006 by Timothy A. Davis.
 
24
% All Rights Reserved.  Type umfpack_details for License.
 
25
 
 
26
%-------------------------------------------------------------------------------
 
27
% get inputs, use defaults if input arguments not present
 
28
%-------------------------------------------------------------------------------
 
29
 
 
30
% The contents of Control and Info are defined in umfpack.h
 
31
if (nargin < 1)
 
32
    Control = [] ;
 
33
end
 
34
if (nargin < 2)
 
35
    Info = [] ;
 
36
end
 
37
if (isempty (Control))
 
38
    Control = umfpack ;
 
39
end
 
40
if (isempty (Info))
 
41
    Info = [ 0 (-ones (1, 89)) ] ;
 
42
end
 
43
 
 
44
%-------------------------------------------------------------------------------
 
45
% control settings
 
46
%-------------------------------------------------------------------------------
 
47
 
 
48
fprintf ('\nUMFPACK Version 5.0:  Control settings:\n\n') ;
 
49
fprintf ('    Control (1): print level: %d\n', Control (1)) ;
 
50
fprintf ('    Control (2): dense row parameter:    %g\n', Control (2)) ;
 
51
fprintf ('       "dense" rows have    > max (16, (%g)*16*sqrt(n_col)) entries\n', Control (2)) ;
 
52
fprintf ('    Control (3): dense column parameter: %g\n', Control (3)) ;
 
53
fprintf ('       "dense" columns have > max (16, (%g)*16*sqrt(n_row)) entries\n', Control (3)) ;
 
54
fprintf ('    Control (4): pivot tolerance: %g\n', Control (4)) ;
 
55
fprintf ('    Control (5): max block size for dense matrix kernels: %d\n', Control (5)) ;
 
56
prstrat ('    Control (6): strategy: %g ', Control (6)) ;
 
57
fprintf ('    Control (7): initial allocation ratio: %g\n', Control (7)) ;
 
58
fprintf ('    Control (8): max iterative refinement steps: %d\n', Control (8)) ;
 
59
fprintf ('    Control (13): 2-by-2 pivot tolerance: %g\n', Control (13)) ;
 
60
fprintf ('    Control (14): Q fixed during numeric factorization: %g ', Control (14)) ;
 
61
if (Control (14) > 0)
 
62
    fprintf ('(yes)\n') ;
 
63
elseif (Control (14) < 0)
 
64
    fprintf ('(no)\n') ;
 
65
else
 
66
    fprintf ('(auto)\n') ;
 
67
end
 
68
fprintf ('    Control (15): AMD dense row/column parameter: %g\n', Control (15)) ;
 
69
fprintf ('       "dense" rows/columns in A+A'' have > max (16, (%g)*sqrt(n)) entries.\n', Control (15)) ;
 
70
fprintf ('        Only used if the AMD ordering is used.\n') ;
 
71
fprintf ('    Control (16): diagonal pivot tolerance: %g\n', Control (16)) ;
 
72
fprintf ('        Only used if diagonal pivoting is attempted.\n') ;
 
73
 
 
74
fprintf ('    Control (17): scaling option: %g ', Control (17)) ;
 
75
if (Control (17) == 0)
 
76
    fprintf ('(none)\n') ;
 
77
elseif (Control (17) == 2)
 
78
    fprintf ('(scale the matrix by\n') ;
 
79
    fprintf ('        dividing each row by max. abs. value in each row)\n') ;
 
80
else
 
81
    fprintf ('(scale the matrix by\n') ;
 
82
    fprintf ('        dividing each row by sum of abs. values in each row)\n') ;
 
83
end
 
84
 
 
85
fprintf ('    Control (18): frontal matrix allocation ratio: %g\n', Control (18)) ;
 
86
fprintf ('    Control (19): drop tolerance: %g\n', Control (19)) ;
 
87
fprintf ('    Control (20): AMD and COLAMD aggressive absorption: %g ', Control (20)) ;
 
88
yes_no (Control (20)) ;
 
89
 
 
90
% compile-time options:
 
91
 
 
92
fprintf ('\n  The following options can only be changed at compile-time:\n') ;
 
93
 
 
94
if (Control (9) == 1)
 
95
    fprintf ('    Control (9): compiled to use the BLAS\n') ;
 
96
else
 
97
    fprintf ('    Control (9): compiled without the BLAS\n') ;
 
98
    fprintf ('        (you will not get the best possible performance)\n') ;
 
99
end
 
100
 
 
101
if (Control (10) == 1)
 
102
    fprintf ('    Control (10): compiled for MATLAB\n') ;
 
103
elseif (Control (10) == 2)
 
104
    fprintf ('    Control (10): compiled for MATLAB\n') ;
 
105
else
 
106
    fprintf ('    Control (10): not compiled for MATLAB\n') ;
 
107
    fprintf ('        Printing will be in terms of 0-based matrix indexing,\n') ;
 
108
    fprintf ('        not 1-based as is expected in MATLAB.  Diary output may\n') ;
 
109
    fprintf ('        not be properly recorded.\n') ;
 
110
end
 
111
 
 
112
if (Control (11) == 2)
 
113
    fprintf ('    Control (11): uses POSIX times ( ) to get CPU time and wallclock time.\n') ;
 
114
elseif (Control (11) == 1)
 
115
    fprintf ('    Control (11): uses getrusage to get CPU time.\n') ;
 
116
else
 
117
    fprintf ('    Control (11): uses ANSI C clock to get CPU time.\n') ;
 
118
    fprintf ('        The CPU time may wrap around, type "help cputime".\n') ;
 
119
end
 
120
 
 
121
if (Control (12) == 1)
 
122
    fprintf ('    Control (12): compiled with debugging enabled\n') ;
 
123
    fprintf ('        ###########################################\n') ;
 
124
    fprintf ('        ### This will be exceedingly slow! ########\n') ;
 
125
    fprintf ('        ###########################################\n') ;
 
126
else
 
127
    fprintf ('    Control (12): compiled for normal operation (no debugging)\n') ;
 
128
end
 
129
 
 
130
%-------------------------------------------------------------------------------
 
131
% Info:
 
132
%-------------------------------------------------------------------------------
 
133
 
 
134
if (nargin == 1)
 
135
    return
 
136
end
 
137
 
 
138
status = Info (1) ;
 
139
fprintf ('\nUMFPACK status:  Info (1): %d, ', status) ;
 
140
 
 
141
if (status == 0)
 
142
    fprintf ('OK\n') ;
 
143
elseif (status == 1)
 
144
    fprintf ('WARNING  matrix is singular\n') ;
 
145
elseif (status == -1)
 
146
    fprintf ('ERROR    out of memory\n') ;
 
147
elseif (status == -3)
 
148
    fprintf ('ERROR    numeric LU factorization is invalid\n') ;
 
149
elseif (status == -4)
 
150
    fprintf ('ERROR    symbolic LU factorization is invalid\n') ;
 
151
elseif (status == -5)
 
152
    fprintf ('ERROR    required argument is missing\n') ;
 
153
elseif (status == -6)
 
154
    fprintf ('ERROR    n <= 0\n') ;
 
155
elseif (status <= -7 & status >= -12 | status == -14)
 
156
    fprintf ('ERROR    matrix A is corrupted\n') ;
 
157
elseif (status == -13)
 
158
    fprintf ('ERROR    invalid system\n') ;
 
159
elseif (status == -15)
 
160
    fprintf ('ERROR    invalid permutation\n') ;
 
161
elseif (status == -911)
 
162
    fprintf ('ERROR    internal error!\n') ;
 
163
    fprintf ('Please report this error to Tim Davis (davis@cise.ufl.edu)\n') ;
 
164
else
 
165
    fprintf ('ERROR    unrecognized error.  Info array corrupted\n') ;
 
166
end
 
167
 
 
168
fprintf ('    (a -1 means the entry has not been computed):\n') ;
 
169
 
 
170
fprintf ('\n  Basic statistics:\n') ;
 
171
fprintf ('    Info (2):  %d, # of rows of A\n', Info (2)) ;
 
172
fprintf ('    Info (17): %d, # of columns of A\n', Info (17)) ;
 
173
fprintf ('    Info (3): %d, nnz (A)\n', Info (3)) ;
 
174
fprintf ('    Info (4): %d, Unit size, in bytes, for memory usage reported below\n', Info (4)) ;
 
175
fprintf ('    Info (5): %d, size of int (in bytes)\n', Info (5)) ;
 
176
fprintf ('    Info (6): %d, size of UF_long (in bytes)\n', Info (6)) ;
 
177
fprintf ('    Info (7): %d, size of pointer (in bytes)\n', Info (7)) ;
 
178
fprintf ('    Info (8): %d, size of numerical entry (in bytes)\n', Info (8)) ;
 
179
 
 
180
fprintf ('\n  Pivots with zero Markowitz cost removed to obtain submatrix S:\n') ;
 
181
fprintf ('    Info (57): %d, # of pivots with one entry in pivot column\n', Info (57)) ;
 
182
fprintf ('    Info (58): %d, # of pivots with one entry in pivot row\n', Info (58)) ;
 
183
fprintf ('    Info (59): %d, # of rows/columns in submatrix S (if square)\n', Info (59)) ;
 
184
fprintf ('    Info (60): %d ') ;
 
185
if (Info (60) > 0)
 
186
    fprintf ('submatrix S square and diagonal preserved\n') ;
 
187
elseif (Info  (60) == 0)
 
188
    fprintf ('submatrix S not square or diagonal not preserved\n') ;
 
189
else
 
190
    fprintf ('\n') ;
 
191
end
 
192
fprintf ('    Info (9):  %d, # of "dense" rows in S\n', Info (9)) ;
 
193
fprintf ('    Info (10): %d, # of empty rows in S\n', Info (10)) ;
 
194
fprintf ('    Info (11): %d, # of "dense" columns in S\n', Info (11)) ;
 
195
fprintf ('    Info (12): %d, # of empty columns in S\n', Info (12)) ;
 
196
fprintf ('    Info (34): %g, symmetry of pattern of S\n', Info (34)) ;
 
197
fprintf ('    Info (35): %d, # of off-diagonal nonzeros in S+S''\n', Info (35)) ;
 
198
fprintf ('    Info (36): %d, nnz (diag (S))\n', Info (36)) ;
 
199
 
 
200
fprintf ('\n  2-by-2 pivoting to place large entries on diagonal:\n') ;
 
201
fprintf ('    Info (52): %d, # of small diagonal entries of S\n', Info (52)) ;
 
202
fprintf ('    Info (53): %d, # of unmatched small diagonal entries\n', Info (53)) ;
 
203
fprintf ('    Info (54): %g, symmetry of P2*S\n', Info (54)) ;
 
204
fprintf ('    Info (55): %d, # of off-diagonal entries in (P2*S)+(P2*S)''\n', Info (55)) ;
 
205
fprintf ('    Info (56): %d, nnz (diag (P2*S))\n', Info (56)) ;
 
206
 
 
207
fprintf ('\n  AMD results, for strict diagonal pivoting:\n') ;
 
208
fprintf ('    Info (37): %d, est. nz in L and U\n', Info (37)) ;
 
209
fprintf ('    Info (38): %g, est. flop count\n', Info (38)) ;
 
210
fprintf ('    Info (39): %g, # of "dense" rows in S+S''\n', Info (39)) ;
 
211
fprintf ('    Info (40): %g, est. max. nz in any column of L\n', Info (40)) ;
 
212
 
 
213
fprintf ('\n  Final strategy selection, based on the analysis above:\n') ;
 
214
prstrat ('    Info (19): %d, strategy used ', Info (19)) ;
 
215
fprintf ('    Info (20): %d, ordering used ', Info (20)) ;
 
216
if (Info (20) == 0)
 
217
    fprintf ('(COLAMD on A)\n') ;
 
218
elseif (Info (20) == 1)
 
219
    fprintf ('(AMD on A+A'')\n') ;
 
220
elseif (Info (20) == 2)
 
221
    fprintf ('(provided by user)\n') ;
 
222
else
 
223
    fprintf ('(undefined ordering option)\n') ;
 
224
end
 
225
fprintf ('    Info (32): %d, Q fixed during numeric factorization: ', Info (32)) ;
 
226
yes_no (Info (32)) ;
 
227
fprintf ('    Info (33): %d, prefer diagonal pivoting: ', Info (33)) ;
 
228
yes_no (Info (33)) ;
 
229
 
 
230
fprintf ('\n  symbolic analysis time and memory usage:\n') ;
 
231
fprintf ('    Info (13): %d, defragmentations during symbolic analysis\n', Info (13)) ;
 
232
fprintf ('    Info (14): %d, memory used during symbolic analysis (Units)\n', Info (14)) ;
 
233
fprintf ('    Info (15): %d, final size of symbolic factors (Units)\n', Info (15)) ;
 
234
fprintf ('    Info (16): %.2f, symbolic analysis CPU time (seconds)\n', Info (16)) ;
 
235
fprintf ('    Info (18): %.2f, symbolic analysis wall clock time (seconds)\n', Info (18)) ;
 
236
 
 
237
fprintf ('\n  Estimates computed in the symbolic analysis:\n') ;
 
238
fprintf ('    Info (21): %d, est. size of LU factors (Units)\n', Info (21)) ;
 
239
fprintf ('    Info (22): %d, est. total peak memory usage (Units)\n', Info (22)) ;
 
240
fprintf ('    Info (23): %d, est. factorization flop count\n', Info (23)) ;
 
241
fprintf ('    Info (24): %d, est. nnz (L)\n', Info (24)) ;
 
242
fprintf ('    Info (25): %d, est. nnz (U)\n', Info (25)) ;
 
243
fprintf ('    Info (26): %d, est. initial size, variable-part of LU (Units)\n', Info (26)) ;
 
244
fprintf ('    Info (27): %d, est. peak size, of variable-part of LU (Units)\n', Info (27)) ;
 
245
fprintf ('    Info (28): %d, est. final size, of variable-part of LU (Units)\n', Info (28)) ;
 
246
fprintf ('    Info (29): %d, est. max frontal matrix size (# of entries)\n', Info (29)) ;
 
247
fprintf ('    Info (30): %d, est. max # of rows in frontal matrix\n', Info (30)) ;
 
248
fprintf ('    Info (31): %d, est. max # of columns in frontal matrix\n', Info (31)) ;
 
249
 
 
250
fprintf ('\n  Computed in the numeric factorization (estimates shown above):\n') ;
 
251
fprintf ('    Info (41): %d, size of LU factors (Units)\n', Info (41)) ;
 
252
fprintf ('    Info (42): %d, total peak memory usage (Units)\n', Info (42)) ;
 
253
fprintf ('    Info (43): %d, factorization flop count\n', Info (43)) ;
 
254
fprintf ('    Info (44): %d, nnz (L)\n', Info (44)) ;
 
255
fprintf ('    Info (45): %d, nnz (U)\n', Info (45)) ;
 
256
fprintf ('    Info (46): %d, initial size of variable-part of LU (Units)\n', Info (46)) ;
 
257
fprintf ('    Info (47): %d, peak size of variable-part of LU (Units)\n', Info (47)) ;
 
258
fprintf ('    Info (48): %d, final size of variable-part of LU (Units)\n', Info (48)) ;
 
259
fprintf ('    Info (49): %d, max frontal matrix size (# of numerical entries)\n', Info (49)) ;
 
260
fprintf ('    Info (50): %d, max # of rows in frontal matrix\n', Info (50)) ;
 
261
fprintf ('    Info (51): %d, max # of columns in frontal matrix\n', Info (51)) ;
 
262
 
 
263
fprintf ('\n  Computed in the numeric factorization (no estimates computed a priori):\n') ;
 
264
fprintf ('    Info (61): %d, defragmentations during numeric factorization\n', Info (61)) ;
 
265
fprintf ('    Info (62): %d, reallocations during numeric factorization\n', Info (62)) ;
 
266
fprintf ('    Info (63): %d, costly reallocations during numeric factorization\n', Info (63)) ;
 
267
fprintf ('    Info (64): %d, integer indices in compressed pattern of L and U\n', Info (64)) ;
 
268
fprintf ('    Info (65): %d, numerical values stored in L and U\n', Info (65)) ;
 
269
fprintf ('    Info (66): %.2f, numeric factorization CPU time (seconds)\n', Info (66)) ;
 
270
fprintf ('    Info (76): %.2f, numeric factorization wall clock time (seconds)\n', Info (76)) ;
 
271
if (Info (66) > 0.05 & Info (43) > 0)
 
272
fprintf ('    mflops in numeric factorization phase: %.2f\n', 1e-6 * Info (43) / Info (66)) ;
 
273
end
 
274
fprintf ('    Info (67): %d, nnz (diag (U))\n', Info (67)) ;
 
275
fprintf ('    Info (68): %g, reciprocal condition number estimate\n', Info (68)) ;
 
276
fprintf ('    Info (69): %g, matrix was ', Info (69)) ;
 
277
if (Info (69) == 0)
 
278
    fprintf ('not scaled\n') ;
 
279
elseif (Info (69) == 2)
 
280
    fprintf ('scaled (row max)\n') ;
 
281
else
 
282
    fprintf ('scaled (row sum)\n') ;
 
283
end
 
284
fprintf ('    Info (70): %g, min. scale factor of rows of A\n', Info (70)) ;
 
285
fprintf ('    Info (71): %g, max. scale factor of rows of A\n', Info (71)) ;
 
286
fprintf ('    Info (72): %g, min. abs. on diagonal of U\n', Info (72)) ;
 
287
fprintf ('    Info (73): %g, max. abs. on diagonal of U\n', Info (73)) ;
 
288
fprintf ('    Info (74): %g, initial allocation parameter used\n', Info (74)) ;
 
289
fprintf ('    Info (75): %g, # of forced updates due to frontal growth\n', Info (75)) ;
 
290
fprintf ('    Info (77): %d, # of off-diaogonal pivots\n', Info (77)) ;
 
291
fprintf ('    Info (78): %d, nnz (L), if no small entries dropped\n', Info (78)) ;
 
292
fprintf ('    Info (79): %d, nnz (U), if no small entries dropped\n', Info (79)) ;
 
293
fprintf ('    Info (80): %d, # of small entries dropped\n', Info (80)) ;
 
294
 
 
295
fprintf ('\n  Computed in the solve step:\n') ;
 
296
fprintf ('    Info (81): %d, iterative refinement steps taken\n', Info (81)) ;
 
297
fprintf ('    Info (82): %d, iterative refinement steps attempted\n', Info (82)) ;
 
298
fprintf ('    Info (83): %g, omega(1), sparse-backward error estimate\n', Info (83)) ;
 
299
fprintf ('    Info (84): %g, omega(2), sparse-backward error estimate\n', Info (84)) ;
 
300
fprintf ('    Info (85): %d, solve flop count\n', Info (85)) ;
 
301
fprintf ('    Info (86): %.2f, solve CPU time (seconds)\n', Info (86)) ;
 
302
fprintf ('    Info (87): %.2f, solve wall clock time (seconds)\n', Info (87)) ;
 
303
 
 
304
fprintf ('\n    Info (88:90): unused\n\n') ;
 
305
 
 
306
%-------------------------------------------------------------------------------
 
307
 
 
308
function prstrat (fmt, strategy)
 
309
fprintf (fmt, strategy) ;
 
310
if (strategy == 1)
 
311
    fprintf ('(unsymmetric)\n') ;
 
312
    fprintf ('        Q = COLAMD (A), Q refined during numerical\n') ;
 
313
    fprintf ('        factorization, and no attempt at diagonal pivoting.\n') ;
 
314
elseif (strategy == 2)
 
315
    fprintf ('(symmetric, with 2-by-2 pivoting)\n') ;
 
316
    fprintf ('        P2 = row permutation to place large values on the diagonal\n') ;
 
317
    fprintf ('        Q = AMD (P2*A+(P2*A)''), Q not refined during numeric factorization,\n') ;
 
318
    fprintf ('        and diagonal pivoting attempted.\n') ;
 
319
elseif (strategy == 3)
 
320
    fprintf ('(symmetric)\n') ;
 
321
    fprintf ('        Q = AMD (A+A''), Q not refined during numeric factorization,\n') ;
 
322
    fprintf ('        and diagonal pivoting (P=Q'') attempted.\n') ;
 
323
else
 
324
    strategy = 0 ;
 
325
    fprintf ('(auto)\n') ;
 
326
end
 
327
 
 
328
%-------------------------------------------------------------------------------
 
329
 
 
330
function yes_no (s)
 
331
if (s == 0)
 
332
    fprintf ('(no)\n') ;
 
333
else
 
334
    fprintf ('(yes)\n') ;
 
335
end