1
/* ========================================================================== */
2
/* === umfpack_symbolic ===================================================== */
3
/* ========================================================================== */
5
/* -------------------------------------------------------------------------- */
6
/* UMFPACK Copyright (c) Timothy A. Davis, CISE, */
7
/* Univ. of Florida. All Rights Reserved. See ../Doc/License for License. */
8
/* web: http://www.cise.ufl.edu/research/sparse/umfpack */
9
/* -------------------------------------------------------------------------- */
11
int umfpack_di_symbolic
19
const double Control [UMFPACK_CONTROL],
20
double Info [UMFPACK_INFO]
23
UF_long umfpack_dl_symbolic
31
const double Control [UMFPACK_CONTROL],
32
double Info [UMFPACK_INFO]
35
int umfpack_zi_symbolic
41
const double Ax [ ], const double Az [ ],
43
const double Control [UMFPACK_CONTROL],
44
double Info [UMFPACK_INFO]
47
UF_long umfpack_zl_symbolic
53
const double Ax [ ], const double Az [ ],
55
const double Control [UMFPACK_CONTROL],
56
double Info [UMFPACK_INFO]
64
int n_row, n_col, *Ap, *Ai, status ;
65
double Control [UMFPACK_CONTROL], Info [UMFPACK_INFO], *Ax ;
66
status = umfpack_di_symbolic (n_row, n_col, Ap, Ai, Ax,
67
&Symbolic, Control, Info) ;
69
double UF_long Syntax:
73
UF_long n_row, n_col, *Ap, *Ai, status ;
74
double Control [UMFPACK_CONTROL], Info [UMFPACK_INFO], *Ax ;
75
status = umfpack_dl_symbolic (n_row, n_col, Ap, Ai, Ax,
76
&Symbolic, Control, Info) ;
82
int n_row, n_col, *Ap, *Ai, status ;
83
double Control [UMFPACK_CONTROL], Info [UMFPACK_INFO], *Ax, *Az ;
84
status = umfpack_zi_symbolic (n_row, n_col, Ap, Ai, Ax, Az,
85
&Symbolic, Control, Info) ;
87
complex UF_long Syntax:
91
UF_long n_row, n_col, *Ap, *Ai, status ;
92
double Control [UMFPACK_CONTROL], Info [UMFPACK_INFO], *Ax, *Az ;
93
status = umfpack_zl_symbolic (n_row, n_col, Ap, Ai, Ax, Az,
94
&Symbolic, Control, Info) ;
96
packed complex Syntax:
98
Same as above, except Az is NULL.
102
Given nonzero pattern of a sparse matrix A in column-oriented form,
103
umfpack_*_symbolic performs a column pre-ordering to reduce fill-in
104
(using COLAMD or AMD) and a symbolic factorization. This is required
105
before the matrix can be numerically factorized with umfpack_*_numeric.
106
If you wish to bypass the COLAMD or AMD pre-ordering and provide your own
107
ordering, use umfpack_*_qsymbolic instead.
109
Since umfpack_*_symbolic and umfpack_*_qsymbolic are very similar, options
110
for both routines are discussed below.
112
For the following discussion, let S be the submatrix of A obtained after
113
eliminating all pivots of zero Markowitz cost. S has dimension
114
(n_row-n1-nempty_row) -by- (n_col-n1-nempty_col), where
115
n1 = Info [UMFPACK_COL_SINGLETONS] + Info [UMFPACK_ROW_SINGLETONS],
116
nempty_row = Info [UMFPACK_NEMPTY_ROW] and
117
nempty_col = Info [UMFPACK_NEMPTY_COL].
121
The status code is returned. See Info [UMFPACK_STATUS], below.
125
Int n_row ; Input argument, not modified.
126
Int n_col ; Input argument, not modified.
128
A is an n_row-by-n_col matrix. Restriction: n_row > 0 and n_col > 0.
130
Int Ap [n_col+1] ; Input argument, not modified.
132
Ap is an integer array of size n_col+1. On input, it holds the
133
"pointers" for the column form of the sparse matrix A. Column j of
134
the matrix A is held in Ai [(Ap [j]) ... (Ap [j+1]-1)]. The first
135
entry, Ap [0], must be zero, and Ap [j] <= Ap [j+1] must hold for all
136
j in the range 0 to n_col-1. The value nz = Ap [n_col] is thus the
137
total number of entries in the pattern of the matrix A. nz must be
138
greater than or equal to zero.
140
Int Ai [nz] ; Input argument, not modified, of size nz = Ap [n_col].
142
The nonzero pattern (row indices) for column j is stored in
143
Ai [(Ap [j]) ... (Ap [j+1]-1)]. The row indices in a given column j
144
must be in ascending order, and no duplicate row indices may be present.
145
Row indices must be in the range 0 to n_row-1 (the matrix is 0-based).
146
See umfpack_*_triplet_to_col for how to sort the columns of a matrix
147
and sum up the duplicate entries. See umfpack_*_report_matrix for how
148
to print the matrix A.
150
double Ax [nz] ; Optional input argument, not modified.
151
Size 2*nz for packed complex case.
153
The numerical values of the sparse matrix A. The nonzero pattern (row
154
indices) for column j is stored in Ai [(Ap [j]) ... (Ap [j+1]-1)], and
155
the corresponding numerical values are stored in
156
Ax [(Ap [j]) ... (Ap [j+1]-1)]. Used only by the 2-by-2 strategy to
157
determine whether entries are "large" or "small". You do not have to
158
pass the same numerical values to umfpack_*_numeric. If Ax is not
159
present (a (double *) NULL pointer), then any entry in A is assumed to
162
double Az [nz] ; Optional input argument, not modified, for complex
165
For the complex versions, this holds the imaginary part of A. The
166
imaginary part of column j is held in Az [(Ap [j]) ... (Ap [j+1]-1)].
168
If Az is NULL, then both real
169
and imaginary parts are contained in Ax[0..2*nz-1], with Ax[2*k]
170
and Ax[2*k+1] being the real and imaginary part of the kth entry.
172
Used by the 2-by-2 strategy only. See the description of Ax, above.
174
void **Symbolic ; Output argument.
176
**Symbolic is the address of a (void *) pointer variable in the user's
177
calling routine (see Syntax, above). On input, the contents of this
178
variable are not defined. On output, this variable holds a (void *)
179
pointer to the Symbolic object (if successful), or (void *) NULL if
182
double Control [UMFPACK_CONTROL] ; Input argument, not modified.
184
If a (double *) NULL pointer is passed, then the default control
185
settings are used (the defaults are suitable for all matrices,
186
ranging from those with highly unsymmetric nonzero pattern, to
187
symmetric matrices). Otherwise, the settings are determined from the
188
Control array. See umfpack_*_defaults on how to fill the Control
189
array with the default settings. If Control contains NaN's, the
190
defaults are used. The following Control parameters are used:
192
Control [UMFPACK_STRATEGY]: This is the most important control
193
parameter. It determines what kind of ordering and pivoting
194
strategy that UMFPACK should use. There are 4 options:
196
UMFPACK_STRATEGY_AUTO: This is the default. The input matrix is
197
analyzed to determine how symmetric the nonzero pattern is, and
198
how many entries there are on the diagonal. It then selects one
199
of the following strategies. Refer to the User Guide for a
200
description of how the strategy is automatically selected.
202
UMFPACK_STRATEGY_UNSYMMETRIC: Use the unsymmetric strategy. COLAMD
203
is used to order the columns of A, followed by a postorder of
204
the column elimination tree. No attempt is made to perform
205
diagonal pivoting. The column ordering is refined during
208
In the numerical factorization, the
209
Control [UMFPACK_SYM_PIVOT_TOLERANCE] parameter is ignored. A
210
pivot is selected if its magnitude is >=
211
Control [UMFPACK_PIVOT_TOLERANCE] (default 0.1) times the
212
largest entry in its column.
214
UMFPACK_STRATEGY_SYMMETRIC: Use the symmetric strategy
215
In this method, the approximate minimum degree
216
ordering (AMD) is applied to A+A', followed by a postorder of
217
the elimination tree of A+A'. UMFPACK attempts to perform
218
diagonal pivoting during numerical factorization. No refinement
219
of the column pre-ordering is performed during factorization.
221
In the numerical factorization, a nonzero entry on the diagonal
222
is selected as the pivot if its magnitude is >= Control
223
[UMFPACK_SYM_PIVOT_TOLERANCE] (default 0.001) times the largest
224
entry in its column. If this is not acceptable, then an
225
off-diagonal pivot is selected with magnitude >= Control
226
[UMFPACK_PIVOT_TOLERANCE] (default 0.1) times the largest entry
229
UMFPACK_STRATEGY_2BY2: a row permutation P2 is found that places
230
large entries on the diagonal. The matrix P2*A is then
231
factorized using the symmetric strategy, described above.
232
Refer to the User Guide for more information.
234
Control [UMFPACK_DENSE_COL]:
235
If COLAMD is used, columns with more than
236
max (16, Control [UMFPACK_DENSE_COL] * 16 * sqrt (n_row)) entries
237
are placed placed last in the column pre-ordering. Default: 0.2.
239
Control [UMFPACK_DENSE_ROW]:
240
Rows with more than max (16, Control [UMFPACK_DENSE_ROW] * 16 *
241
sqrt (n_col)) entries are treated differently in the COLAMD
242
pre-ordering, and in the internal data structures during the
243
subsequent numeric factorization. Default: 0.2.
245
Control [UMFPACK_AMD_DENSE]: rows/columns in A+A' with more than
246
max (16, Control [UMFPACK_AMD_DENSE] * sqrt (n)) entries
247
(where n = n_row = n_col) are ignored in the AMD pre-ordering.
250
Control [UMFPACK_BLOCK_SIZE]: the block size to use for Level-3 BLAS
251
in the subsequent numerical factorization (umfpack_*_numeric).
252
A value less than 1 is treated as 1. Default: 32. Modifying this
253
parameter affects when updates are applied to the working frontal
254
matrix, and can indirectly affect fill-in and operation count.
255
Assuming the block size is large enough (8 or so), this parameter
256
has a modest effect on performance.
258
Control [UMFPACK_2BY2_TOLERANCE]: a diagonal entry S (k,k) is
259
considered "small" if it is < tol * max (abs (S (:,k))), where S a
260
submatrix of the scaled input matrix, with pivots of zero Markowitz
263
Control [UMFPACK_SCALE]: See umfpack_numeric.h for a description.
264
Only affects the 2-by-2 strategy. Default: UMFPACK_SCALE_SUM.
266
Control [UMFPACK_FIXQ]: If > 0, then the pre-ordering Q is not modified
267
during numeric factorization. If < 0, then Q may be modified. If
268
zero, then this is controlled automatically (the unsymmetric
269
strategy modifies Q, the others do not). Default: 0.
271
Control [UMFPACK_AGGRESSIVE]: If nonzero, aggressive absorption is used
272
in COLAMD and AMD. Default: 1.
274
double Info [UMFPACK_INFO] ; Output argument, not defined on input.
276
Contains statistics about the symbolic analysis. If a (double *) NULL
277
pointer is passed, then no statistics are returned in Info (this is not
278
an error condition). The entire Info array is cleared (all entries set
279
to -1) and then the following statistics are computed:
281
Info [UMFPACK_STATUS]: status code. This is also the return value,
282
whether or not Info is present.
286
Each column of the input matrix contained row indices
287
in increasing order, with no duplicates. Only in this case
288
does umfpack_*_symbolic compute a valid symbolic factorization.
289
For the other cases below, no Symbolic object is created
290
(*Symbolic is (void *) NULL).
292
UMFPACK_ERROR_n_nonpositive
294
n is less than or equal to zero.
296
UMFPACK_ERROR_invalid_matrix
298
Number of entries in the matrix is negative, Ap [0] is nonzero,
299
a column has a negative number of entries, a row index is out of
300
bounds, or the columns of input matrix were jumbled (unsorted
301
columns or duplicate entries).
303
UMFPACK_ERROR_out_of_memory
305
Insufficient memory to perform the symbolic analysis. If the
306
analysis requires more than 2GB of memory and you are using
307
the 32-bit ("int") version of UMFPACK, then you are guaranteed
308
to run out of memory. Try using the 64-bit version of UMFPACK.
310
UMFPACK_ERROR_argument_missing
312
One or more required arguments is missing.
314
UMFPACK_ERROR_internal_error
316
Something very serious went wrong. This is a bug.
317
Please contact the author (davis@cise.ufl.edu).
319
Info [UMFPACK_NROW]: the value of the input argument n_row.
321
Info [UMFPACK_NCOL]: the value of the input argument n_col.
323
Info [UMFPACK_NZ]: the number of entries in the input matrix
326
Info [UMFPACK_SIZE_OF_UNIT]: the number of bytes in a Unit,
327
for memory usage statistics below.
329
Info [UMFPACK_SIZE_OF_INT]: the number of bytes in an int.
331
Info [UMFPACK_SIZE_OF_LONG]: the number of bytes in a UF_long.
333
Info [UMFPACK_SIZE_OF_POINTER]: the number of bytes in a void *
336
Info [UMFPACK_SIZE_OF_ENTRY]: the number of bytes in a numerical entry.
338
Info [UMFPACK_NDENSE_ROW]: number of "dense" rows in A. These rows are
339
ignored when the column pre-ordering is computed in COLAMD. They
340
are also treated differently during numeric factorization. If > 0,
341
then the matrix had to be re-analyzed by UMF_analyze, which does
342
not ignore these rows.
344
Info [UMFPACK_NEMPTY_ROW]: number of "empty" rows in A, as determined
345
These are rows that either have no entries, or whose entries are
346
all in pivot columns of zero-Markowitz-cost pivots.
348
Info [UMFPACK_NDENSE_COL]: number of "dense" columns in A. COLAMD
349
orders these columns are ordered last in the factorization, but
350
before "empty" columns.
352
Info [UMFPACK_NEMPTY_COL]: number of "empty" columns in A. These are
353
columns that either have no entries, or whose entries are all in
354
pivot rows of zero-Markowitz-cost pivots. These columns are
355
ordered last in the factorization, to the right of "dense" columns.
357
Info [UMFPACK_SYMBOLIC_DEFRAG]: number of garbage collections
358
performed during ordering and symbolic pre-analysis.
360
Info [UMFPACK_SYMBOLIC_PEAK_MEMORY]: the amount of memory (in Units)
361
required for umfpack_*_symbolic to complete. This count includes
362
the size of the Symbolic object itself, which is also reported in
363
Info [UMFPACK_SYMBOLIC_SIZE].
365
Info [UMFPACK_SYMBOLIC_SIZE]: the final size of the Symbolic object (in
366
Units). This is fairly small, roughly 2*n to 13*n integers,
367
depending on the matrix.
369
Info [UMFPACK_VARIABLE_INIT_ESTIMATE]: the Numeric object contains two
370
parts. The first is fixed in size (O (n_row+n_col)). The
371
second part holds the sparse LU factors and the contribution blocks
372
from factorized frontal matrices. This part changes in size during
373
factorization. Info [UMFPACK_VARIABLE_INIT_ESTIMATE] is the exact
374
size (in Units) required for this second variable-sized part in
375
order for the numerical factorization to start.
377
Info [UMFPACK_VARIABLE_PEAK_ESTIMATE]: the estimated peak size (in
378
Units) of the variable-sized part of the Numeric object. This is
379
usually an upper bound, but that is not guaranteed.
381
Info [UMFPACK_VARIABLE_FINAL_ESTIMATE]: the estimated final size (in
382
Units) of the variable-sized part of the Numeric object. This is
383
usually an upper bound, but that is not guaranteed. It holds just
384
the sparse LU factors.
386
Info [UMFPACK_NUMERIC_SIZE_ESTIMATE]: an estimate of the final size (in
387
Units) of the entire Numeric object (both fixed-size and variable-
388
sized parts), which holds the LU factorization (including the L, U,
391
Info [UMFPACK_PEAK_MEMORY_ESTIMATE]: an estimate of the total amount of
392
memory (in Units) required by umfpack_*_symbolic and
393
umfpack_*_numeric to perform both the symbolic and numeric
394
factorization. This is the larger of the amount of memory needed
395
in umfpack_*_numeric itself, and the amount of memory needed in
396
umfpack_*_symbolic (Info [UMFPACK_SYMBOLIC_PEAK_MEMORY]). The
397
count includes the size of both the Symbolic and Numeric objects
398
themselves. It can be a very loose upper bound, particularly when
399
the symmetric or 2-by-2 strategies are used.
401
Info [UMFPACK_FLOPS_ESTIMATE]: an estimate of the total floating-point
402
operations required to factorize the matrix. This is a "true"
403
theoretical estimate of the number of flops that would be performed
404
by a flop-parsimonious sparse LU algorithm. It assumes that no
405
extra flops are performed except for what is strictly required to
406
compute the LU factorization. It ignores, for example, the flops
407
performed by umfpack_di_numeric to add contribution blocks of
408
frontal matrices together. If L and U are the upper bound on the
409
pattern of the factors, then this flop count estimate can be
410
represented in MATLAB (for real matrices, not complex) as:
412
Lnz = full (sum (spones (L))) - 1 ; % nz in each col of L
413
Unz = full (sum (spones (U')))' - 1 ; % nz in each row of U
414
flops = 2*Lnz*Unz + sum (Lnz) ;
416
The actual "true flop" count found by umfpack_*_numeric will be
417
less than this estimate.
419
For the real version, only (+ - * /) are counted. For the complex
420
version, the following counts are used:
427
Info [UMFPACK_LNZ_ESTIMATE]: an estimate of the number of nonzeros in
428
L, including the diagonal. Since L is unit-diagonal, the diagonal
429
of L is not stored. This estimate is a strict upper bound on the
430
actual nonzeros in L to be computed by umfpack_*_numeric.
432
Info [UMFPACK_UNZ_ESTIMATE]: an estimate of the number of nonzeros in
433
U, including the diagonal. This estimate is a strict upper bound on
434
the actual nonzeros in U to be computed by umfpack_*_numeric.
436
Info [UMFPACK_MAX_FRONT_SIZE_ESTIMATE]: estimate of the size of the
437
largest frontal matrix (# of entries), for arbitrary partial
438
pivoting during numerical factorization.
440
Info [UMFPACK_SYMBOLIC_TIME]: The CPU time taken, in seconds.
442
Info [UMFPACK_SYMBOLIC_WALLTIME]: The wallclock time taken, in seconds.
444
Info [UMFPACK_STRATEGY_USED]: The ordering strategy used:
445
UMFPACK_STRATEGY_SYMMETRIC, UMFPACK_STRATEGY_UNSYMMETRIC, or
446
UMFPACK_STRATEGY_2BY2.
448
Info [UMFPACK_ORDERING_USED]: The ordering method used:
449
UMFPACK_ORDERING_COLAMD or UMFPACK_ORDERING_AMD. It can be
450
UMFPACK_ORDERING_GIVEN for umfpack_*_qsymbolic.
452
Info [UMFPACK_QFIXED]: 1 if the column pre-ordering will be refined
453
during numerical factorization, 0 if not.
455
Info [UMFPACK_DIAG_PREFERED]: 1 if diagonal pivoting will be attempted,
458
Info [UMFPACK_COL_SINGLETONS]: the matrix A is analyzed by first
459
eliminating all pivots with zero Markowitz cost. This count is the
460
number of these pivots with exactly one nonzero in their pivot
463
Info [UMFPACK_ROW_SINGLETONS]: the number of zero-Markowitz-cost
464
pivots with exactly one nonzero in their pivot row.
466
Info [UMFPACK_PATTERN_SYMMETRY]: the symmetry of the pattern of S.
468
Info [UMFPACK_NZ_A_PLUS_AT]: the number of off-diagonal entries in S+S'.
470
Info [UMFPACK_NZDIAG]: the number of entries on the diagonal of S.
472
Info [UMFPACK_N2]: if S is square, and nempty_row = nempty_col, this
473
is equal to n_row - n1 - nempty_row.
475
Info [UMFPACK_S_SYMMETRIC]: 1 if S is square and its diagonal has been
476
preserved, 0 otherwise.
479
Info [UMFPACK_MAX_FRONT_NROWS_ESTIMATE]: estimate of the max number of
480
rows in any frontal matrix, for arbitrary partial pivoting.
482
Info [UMFPACK_MAX_FRONT_NCOLS_ESTIMATE]: estimate of the max number of
483
columns in any frontal matrix, for arbitrary partial pivoting.
485
------------------------------------------------------------------------
486
The next four statistics are computed only if AMD is used:
487
------------------------------------------------------------------------
489
Info [UMFPACK_SYMMETRIC_LUNZ]: The number of nonzeros in L and U,
490
assuming no pivoting during numerical factorization, and assuming a
491
zero-free diagonal of U. Excludes the entries on the diagonal of
492
L. If the matrix has a purely symmetric nonzero pattern, this is
493
often a lower bound on the nonzeros in the actual L and U computed
494
in the numerical factorization, for matrices that fit the criteria
495
for the "symmetric" strategy.
497
Info [UMFPACK_SYMMETRIC_FLOPS]: The floating-point operation count in
498
the numerical factorization phase, assuming no pivoting. If the
499
pattern of the matrix is symmetric, this is normally a lower bound
500
on the floating-point operation count in the actual numerical
501
factorization, for matrices that fit the criteria for the symmetric
504
Info [UMFPACK_SYMMETRIC_NDENSE]: The number of "dense" rows/columns of
505
S+S' that were ignored during the AMD ordering. These are placed
506
last in the output order. If > 0, then the
507
Info [UMFPACK_SYMMETRIC_*] statistics, above are rough upper bounds.
509
Info [UMFPACK_SYMMETRIC_DMAX]: The maximum number of nonzeros in any
510
column of L, if no pivoting is performed during numerical
511
factorization. Excludes the part of the LU factorization for
512
pivots with zero Markowitz cost.
514
------------------------------------------------------------------------
515
The following statistics are computed only if the 2-by-2 strategy is
517
------------------------------------------------------------------------
519
Info [UMFPACK_2BY2_NWEAK]: the number of small diagonal entries in S.
521
Info [UMFPACK_2BY2_UNMATCHED]: the number of small diagonal entries
524
Info [UMFPACK_2BY2_PATTERN_SYMMETRY]: the symmetry of P2*S.
526
Info [UMFPACK_2BY2_NZ_PA_PLUS_AT]: the number of off-diagonal entries
529
Info [UMFPACK_2BY2_NZDIAG]: the number of nonzero entries on the
533
At the start of umfpack_*_symbolic, all of Info is set of -1, and then
534
after that only the above listed Info [...] entries are accessed.
535
Future versions might modify different parts of Info.