Rev 1820 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
/* ========================================================================== *//* === umfpack_numeric ====================================================== *//* ========================================================================== *//* -------------------------------------------------------------------------- *//* UMFPACK Version 4.5, Copyright (c) 2005 by Timothy A. Davis. CISE Dept, *//* Univ. of Florida. All Rights Reserved. See ../Doc/License for License. *//* web: http://www.cise.ufl.edu/research/sparse/umfpack *//* -------------------------------------------------------------------------- */int umfpack_di_numeric(const int Ap [ ],const int Ai [ ],const double Ax [ ],void *Symbolic,void **Numeric,const double Control [UMFPACK_CONTROL],double Info [UMFPACK_INFO]) ;long umfpack_dl_numeric(const long Ap [ ],const long Ai [ ],const double Ax [ ],void *Symbolic,void **Numeric,const double Control [UMFPACK_CONTROL],double Info [UMFPACK_INFO]) ;int umfpack_zi_numeric(const int Ap [ ],const int Ai [ ],const double Ax [ ], const double Az [ ],void *Symbolic,void **Numeric,const double Control [UMFPACK_CONTROL],double Info [UMFPACK_INFO]) ;long umfpack_zl_numeric(const long Ap [ ],const long Ai [ ],const double Ax [ ], const double Az [ ],void *Symbolic,void **Numeric,const double Control [UMFPACK_CONTROL],double Info [UMFPACK_INFO]) ;/*double int Syntax:#include "umfpack.h"void *Symbolic, *Numeric ;int *Ap, *Ai, status ;double *Ax, Control [UMFPACK_CONTROL], Info [UMFPACK_INFO] ;status = umfpack_di_numeric (Ap, Ai, Ax, Symbolic, &Numeric, Control, Info);double long Syntax:#include "umfpack.h"void *Symbolic, *Numeric ;long *Ap, *Ai, status ;double *Ax, Control [UMFPACK_CONTROL], Info [UMFPACK_INFO] ;status = umfpack_dl_numeric (Ap, Ai, Ax, Symbolic, &Numeric, Control, Info);complex int Syntax:#include "umfpack.h"void *Symbolic, *Numeric ;int *Ap, *Ai, status ;double *Ax, *Az, Control [UMFPACK_CONTROL], Info [UMFPACK_INFO] ;status = umfpack_zi_numeric (Ap, Ai, Ax, Az, Symbolic, &Numeric,Control, Info) ;complex long Syntax:#include "umfpack.h"void *Symbolic, *Numeric ;long *Ap, *Ai, status ;double *Ax, *Az, Control [UMFPACK_CONTROL], Info [UMFPACK_INFO] ;status = umfpack_zl_numeric (Ap, Ai, Ax, Az, Symbolic, &Numeric,Control, Info) ;packed complex Syntax:Same as above, except that Az is NULL.Purpose:Given a sparse matrix A in column-oriented form, and a symbolic analysiscomputed by umfpack_*_*symbolic, the umfpack_*_numeric routine performs thenumerical factorization, PAQ=LU, PRAQ=LU, or P(R\A)Q=LU, where P and Q arepermutation matrices (represented as permutation vectors), R is the rowscaling, L is unit-lower triangular, and U is upper triangular. This isrequired before the system Ax=b (or other related linear systems) can besolved. umfpack_*_numeric can be called multiple times for each call toumfpack_*_*symbolic, to factorize a sequence of matrices with identicalnonzero pattern. Simply compute the Symbolic object once, withumfpack_*_*symbolic, and reuse it for subsequent matrices. This routinesafely detects if the pattern changes, and sets an appropriate error code.Returns:The status code is returned. See Info [UMFPACK_STATUS], below.Arguments:Int Ap [n_col+1] ; Input argument, not modified.This must be identical to the Ap array passed to umfpack_*_*symbolic.The value of n_col is what was passed to umfpack_*_*symbolic (this isheld in the Symbolic object).Int Ai [nz] ; Input argument, not modified, of size nz = Ap [n_col].This must be identical to the Ai array passed to umfpack_*_*symbolic.double Ax [nz] ; Input argument, not modified, of size nz = Ap [n_col].Size 2*nz for packed complex case.The numerical values of the sparse matrix A. The nonzero pattern (rowindices) for column j is stored in Ai [(Ap [j]) ... (Ap [j+1]-1)], andthe corresponding numerical values are stored inAx [(Ap [j]) ... (Ap [j+1]-1)].double Az [nz] ; Input argument, not modified, for complex versions.For the complex versions, this holds the imaginary part of A. Theimaginary part of column j is held in Az [(Ap [j]) ... (Ap [j+1]-1)].If Az is NULL, then both realand imaginary parts are contained in Ax[0..2*nz-1], with Ax[2*k]and Ax[2*k+1] being the real and imaginary part of the kth entry.void *Symbolic ; Input argument, not modified.The Symbolic object, which holds the symbolic factorization computed byumfpack_*_*symbolic. The Symbolic object is not modified byumfpack_*_numeric.void **Numeric ; Output argument.**Numeric is the address of a (void *) pointer variable in the user'scalling routine (see Syntax, above). On input, the contents of thisvariable are not defined. On output, this variable holds a (void *)pointer to the Numeric object (if successful), or (void *) NULL ifa failure occurred.double Control [UMFPACK_CONTROL] ; Input argument, not modified.If a (double *) NULL pointer is passed, then the default controlsettings are used. Otherwise, the settings are determined from theControl array. See umfpack_*_defaults on how to fill the Controlarray with the default settings. If Control contains NaN's, thedefaults are used. The following Control parameters are used:Control [UMFPACK_PIVOT_TOLERANCE]: relative pivot tolerance forthreshold partial pivoting with row interchanges. In any givencolumn, an entry is numerically acceptable if its absolute value isgreater than or equal to Control [UMFPACK_PIVOT_TOLERANCE] timesthe largest absolute value in the column. A value of 1.0 gives truepartial pivoting. If less than or equal to zero, then any nonzeroentry is numerically acceptable as a pivot. Default: 0.1.Smaller values tend to lead to sparser LU factors, but the solutionto the linear system can become inaccurate. Larger values can leadto a more accurate solution (but not always), and usually anincrease in the total work.For complex matrices, a cheap approximate of the absolute valueis used for the threshold partial pivoting test (|a_real| + |a_imag|instead of the more expensive-to-compute exact absolute valuesqrt (a_real^2 + a_imag^2)).Control [UMFPACK_SYM_PIVOT_TOLERANCE]:If diagonal pivoting is attempted (the symmetric or symmetric-2by2strategies are used) then this parameter is used to control when thediagonal entry is selected in a given pivot column. The absolutevalue of the entry must be >= Control [UMFPACK_SYM_PIVOT_TOLERANCE]times the largest absolute value in the column. A value of zerowill ensure that no off-diagonal pivoting is performed, except thatzero diagonal entries are not selected if there are any off-diagonalnonzero entries.If an off-diagonal pivot is selected, an attempt is made to restoresymmetry later on. Suppose A (i,j) is selected, where i != j.If column i has not yet been selected as a pivot column, thenthe entry A (j,i) is redefined as a "diagonal" entry, except thatthe tighter tolerance (Control [UMFPACK_PIVOT_TOLERANCE]) isapplied. This strategy has an effect similar to 2-by-2 pivotingfor symmetric indefinite matrices. If a 2-by-2 block pivot withnonzero structurei ji: 0 xj: x 0is selected in a symmetric indefinite factorization method, the2-by-2 block is inverted and a rank-2 update is applied. InUMFPACK, this 2-by-2 block would be reordered asj ii: x 0j: 0 xIn both cases, the symmetry of the Schur complement is preserved.Control [UMFPACK_SCALE]: Note that the user's input matrix isnever modified, only an internal copy is scaled.There are three valid settings for this parameter. If any othervalue is provided, the default is used.UMFPACK_SCALE_NONE: no scaling is performed.UMFPACK_SCALE_SUM: each row of the input matrix A is divided bythe sum of the absolute values of the entries in that row.The scaled matrix has an infinity norm of 1.UMFPACK_SCALE_MAX: each row of the input matrix A is divided bythe maximum the absolute values of the entries in that row.In the scaled matrix the largest entry in each row hasa magnitude exactly equal to 1.Note that for complex matrices, a cheap approximate absolute valueis used, |a_real| + |a_imag|, instead of the exact absolute valuesqrt ((a_real)^2 + (a_imag)^2).Scaling is very important for the "symmetric" strategy whendiagonal pivoting is attempted. It also improves the performanceof the "unsymmetric" strategy.Default: UMFPACK_SCALE_SUM.Control [UMFPACK_ALLOC_INIT]:When umfpack_*_numeric starts, it allocates memory for the Numericobject. Part of this is of fixed size (approximately n double's +12*n integers). The remainder is of variable size, which grows tohold the LU factors and the frontal matrices created duringfactorization. A estimate of the upper bound is computed byumfpack_*_*symbolic, and returned by umfpack_*_*symbolic inInfo [UMFPACK_VARIABLE_PEAK_ESTIMATE] (in Units).If Control [UMFPACK_ALLOC_INIT] is >= 0, umfpack_*_numeric initiallyallocates space for the variable-sized part equal to this estimatetimes Control [UMFPACK_ALLOC_INIT]. Typically, for matrices forwhich the "unsymmetric" strategy applies, umfpack_*_numeric needsonly about half the estimated memory space, so a setting of 0.5 or0.6 often provides enough memory for umfpack_*_numeric to factorizethe matrix with no subsequent increases in the size of this block.If the matrix is ordered via AMD, then this non-negative parameteris ignored. The initial allocation ratio computed automatically,as 1.2 * (nz + Info [UMFPACK_SYMMETRIC_LUNZ]) /(Info [UMFPACK_LNZ_ESTIMATE] + Info [UMFPACK_UNZ_ESTIMATE] -min (n_row, n_col)).If Control [UMFPACK_ALLOC_INIT] is negative, then umfpack_*_numericallocates a space with initial size (in Units) equal to(-Control [UMFPACK_ALLOC_INIT]).Regardless of the value of this parameter, a space equal to orgreater than the the bare minimum amount of memory needed to startthe factorization is always initially allocated. The bare initialmemory required is returned by umfpack_*_*symbolic inInfo [UMFPACK_VARIABLE_INIT_ESTIMATE] (an exact value, not anestimate).If the variable-size part of the Numeric object is found to be toosmall sometime after numerical factorization has started, the memoryis increased in size by a factor of 1.2. If this fails, therequest is reduced by a factor of 0.95 until it succeeds, or untilit determines that no increase in size is possible. Garbagecollection then occurs.The strategy of attempting to "malloc" a working space, andre-trying with a smaller space, may not work when UMFPACK is usedas a mexFunction MATLAB, since mxMalloc aborts the mexFunction if itfails. This issue does not affect the use of UMFPACK as a part ofthe built-in x=A\b in MATLAB 6.5 and later.If you are using the umfpack mexFunction, decrease the magnitude ofControl [UMFPACK_ALLOC_INIT] if you run out of memory in MATLAB.Default initial allocation size: 0.7. Thus, with the defaultcontrol settings and the "unsymmetric" strategy, the upper-bound isreached after two reallocations (0.7 * 1.2 * 1.2 = 1.008).Changing this parameter has little effect on fill-in or operationcount. It has a small impact on run-time (the extra time requiredto do the garbage collection and memory reallocation).Control [UMFPACK_FRONT_ALLOC_INIT]:When UMFPACK starts the factorization of each "chain" of frontalmatrices, it allocates a working array to hold the frontal matricesas they are factorized. The symbolic factorization computes thesize of the largest possible frontal matrix that could occur duringthe factorization of each chain.If Control [UMFPACK_FRONT_ALLOC_INIT] is >= 0, the followingstrategy is used. If the AMD ordering was used, this non-negativeparameter is ignored. A front of size (d+2)*(d+2) is allocated,where d = Info [UMFPACK_SYMMETRIC_DMAX]. Otherwise, a front ofsize Control [UMFPACK_FRONT_ALLOC_INIT] times the largest frontpossible for this chain is allocated.If Control [UMFPACK_FRONT_ALLOC_INIT] is negative, then a front ofsize (-Control [UMFPACK_FRONT_ALLOC_INIT]) is allocated (where thesize is in terms of the number of numerical entries). This is doneregardless of the ordering method or ordering strategy used.Default: 0.5.Control [UMFPACK_DROPTOL]:Entries in L and U with absolute value less than or equal to thedrop tolerance are removed from the data structures (unless leavingthem there reduces memory usage by reducing the space requiredfor the nonzero pattern of L and U).Default: 0.0.double Info [UMFPACK_INFO] ; Output argument.Contains statistics about the numeric factorization. If a(double *) NULL pointer is passed, then no statistics are returned inInfo (this is not an error condition). The following statistics arecomputed in umfpack_*_numeric:Info [UMFPACK_STATUS]: status code. This is also the return value,whether or not Info is present.UMFPACK_OKNumeric factorization was successful. umfpack_*_numericcomputed a valid numeric factorization.UMFPACK_WARNING_singular_matrixNumeric factorization was successful, but the matrix issingular. umfpack_*_numeric computed a valid numericfactorization, but you will get a divide by zero inumfpack_*_*solve. For the other cases below, no Numeric objectis created (*Numeric is (void *) NULL).UMFPACK_ERROR_out_of_memoryInsufficient memory to complete the numeric factorization.UMFPACK_ERROR_argument_missingOne or more required arguments are missing.UMFPACK_ERROR_invalid_Symbolic_objectSymbolic object provided as input is invalid.UMFPACK_ERROR_different_patternThe pattern (Ap and/or Ai) has changed since the call toumfpack_*_*symbolic which produced the Symbolic object.Info [UMFPACK_NROW]: the value of n_row stored in the Symbolic object.Info [UMFPACK_NCOL]: the value of n_col stored in the Symbolic object.Info [UMFPACK_NZ]: the number of entries in the input matrix.This value is obtained from the Symbolic object.Info [UMFPACK_SIZE_OF_UNIT]: the number of bytes in a Unit, for memoryusage statistics below.Info [UMFPACK_VARIABLE_INIT]: the initial size (in Units) of thevariable-sized part of the Numeric object. If this differs fromInfo [UMFPACK_VARIABLE_INIT_ESTIMATE], then the pattern (Ap and/orAi) has changed since the last call to umfpack_*_*symbolic, which isan error condition.Info [UMFPACK_VARIABLE_PEAK]: the peak size (in Units) of thevariable-sized part of the Numeric object. This size is the amountof space actually used inside the block of memory, not the spaceallocated via UMF_malloc. You can reduce UMFPACK's memoryrequirements by setting Control [UMFPACK_ALLOC_INIT] to the ratioInfo [UMFPACK_VARIABLE_PEAK] / Info[UMFPACK_VARIABLE_PEAK_ESTIMATE].This will ensure that no memory reallocations occur (you may want toadd 0.001 to make sure that integer roundoff does not lead to amemory size that is 1 Unit too small; otherwise, garbage collectionand reallocation will occur).Info [UMFPACK_VARIABLE_FINAL]: the final size (in Units) of thevariable-sized part of the Numeric object. It holds just thesparse LU factors.Info [UMFPACK_NUMERIC_SIZE]: the actual final size (in Units) of theentire Numeric object, including the final size of the variablepart of the object. Info [UMFPACK_NUMERIC_SIZE_ESTIMATE],an estimate, was computed by umfpack_*_*symbolic. The estimate isnormally an upper bound on the actual final size, but this is notguaranteed.Info [UMFPACK_PEAK_MEMORY]: the actual peak memory usage (in Units) ofboth umfpack_*_*symbolic and umfpack_*_numeric. An estimate,Info [UMFPACK_PEAK_MEMORY_ESTIMATE], was computed byumfpack_*_*symbolic. The estimate is normally an upper bound on theactual peak usage, but this is not guaranteed. With testing onhundreds of matrix arising in real applications, I have neverobserved a matrix where this estimate or the Numeric size estimatewas less than the actual result, but this is theoretically possible.Please send me one if you find such a matrix.Info [UMFPACK_FLOPS]: the actual count of the (useful) floating-pointoperations performed. An estimate, Info [UMFPACK_FLOPS_ESTIMATE],was computed by umfpack_*_*symbolic. The estimate is guaranteed tobe an upper bound on this flop count. The flop count excludes"useless" flops on zero values, flops performed during the pivotsearch (for tentative updates and assembly of candidate columns),and flops performed to add frontal matrices together.For the real version, only (+ - * /) are counted. For the complexversion, the following counts are used:operation flopsc = 1/b 6c = a*b 6c -= a*b 8Info [UMFPACK_LNZ]: the actual nonzero entries in final factor L,including the diagonal. This excludes any zero entries in L,although some of these are stored in the Numeric object. TheInfo [UMFPACK_LU_ENTRIES] statistic does account for allexplicitly stored zeros, however. Info [UMFPACK_LNZ_ESTIMATE],an estimate, was computed by umfpack_*_*symbolic. The estimate isguaranteed to be an upper bound on Info [UMFPACK_LNZ].Info [UMFPACK_UNZ]: the actual nonzero entries in final factor U,including the diagonal. This excludes any zero entries in U,although some of these are stored in the Numeric object. TheInfo [UMFPACK_LU_ENTRIES] statistic does account for allexplicitly stored zeros, however. Info [UMFPACK_UNZ_ESTIMATE],an estimate, was computed by umfpack_*_*symbolic. The estimate isguaranteed to be an upper bound on Info [UMFPACK_UNZ].Info [UMFPACK_NUMERIC_DEFRAG]: The number of garbage collectionsperformed during umfpack_*_numeric, to compact the contents of thevariable-sized workspace used by umfpack_*_numeric. No estimate wascomputed by umfpack_*_*symbolic. In the current version of UMFPACK,garbage collection is performed and then the memory is reallocated,so this statistic is the same as Info [UMFPACK_NUMERIC_REALLOC],below. It may differ in future releases.Info [UMFPACK_NUMERIC_REALLOC]: The number of times that the Numericobject was increased in size from its initial size. A rough upperbound on the peak size of the Numeric object was computed byumfpack_*_*symbolic, so reallocations should be rare. However, ifumfpack_*_numeric is unable to allocate that much storage, itreduces its request until either the allocation succeeds, or untilit gets too small to do anything with. If the memory that itfinally got was small, but usable, then the reallocation countcould be high. No estimate of this count was computed byumfpack_*_*symbolic.Info [UMFPACK_NUMERIC_COSTLY_REALLOC]: The number of times that thesystem realloc library routine (or mxRealloc for the mexFunction)had to move the workspace. Realloc can sometimes increase the sizeof a block of memory without moving it, which is much faster. Thisstatistic will always be <= Info [UMFPACK_NUMERIC_REALLOC]. If yourmemory space is fragmented, then the number of "costly" realloc'swill be equal to Info [UMFPACK_NUMERIC_REALLOC].Info [UMFPACK_COMPRESSED_PATTERN]: The number of integers used torepresent the pattern of L and U.Info [UMFPACK_LU_ENTRIES]: The total number of numerical values thatare stored for the LU factors. Some of the values may be explicitlyzero in order to save space (allowing for a smaller compressedpattern).Info [UMFPACK_NUMERIC_TIME]: The CPU time taken, in seconds.Info [UMFPACK_RCOND]: A rough estimate of the condition number, equalto min (abs (diag (U))) / max (abs (diag (U))), or zero if thediagonal of U is all zero.Info [UMFPACK_UDIAG_NZ]: The number of numerically nonzero values onthe diagonal of U.Info [UMFPACK_UMIN]: the smallest absolute value on the diagonal of U.Info [UMFPACK_UMAX]: the smallest absolute value on the diagonal of U.Info [UMFPACK_MAX_FRONT_SIZE]: the size of thelargest frontal matrix (number of entries).Info [UMFPACK_NUMERIC_WALLTIME]: The wallclock time taken, in seconds.Info [UMFPACK_MAX_FRONT_NROWS]: the max number ofrows in any frontal matrix.Info [UMFPACK_MAX_FRONT_NCOLS]: the max number ofcolumns in any frontal matrix.Info [UMFPACK_WAS_SCALED]: the scaling used, either UMFPACK_SCALE_NONE,UMFPACK_SCALE_SUM, or UMFPACK_SCALE_MAX.Info [UMFPACK_RSMIN]: if scaling is performed, the smallest scale factorfor any row (either the smallest sum of absolute entries, or thesmallest maximum of absolute entries).Info [UMFPACK_RSMAX]: if scaling is performed, the largest scale factorfor any row (either the largest sum of absolute entries, or thelargest maximum of absolute entries).Info [UMFPACK_ALLOC_INIT_USED]: the initial allocation parameter used.Info [UMFPACK_FORCED_UPDATES]: the number of BLAS-3 updates to thefrontal matrices that were required because the frontal matrixgrew larger than its current working array.Info [UMFPACK_NOFF_DIAG]: number of off-diagonal pivots selected, if thesymmetric or 2-by-2 strategies are used.Info [UMFPACK_NZDROPPED]: the number of entries smaller in absolutevalue than Control [UMFPACK_DROPTOL] that were dropped from L and U.Note that entries on the diagonal of U are never dropped.Info [UMFPACK_ALL_LNZ]: the number of entries in L, including thediagonal, if no small entries are dropped.Info [UMFPACK_ALL_UNZ]: the number of entries in U, including thediagonal, if no small entries are dropped.Only the above listed Info [...] entries are accessed. The remainingentries of Info are not accessed or modified by umfpack_*_numeric.Future versions might modify different parts of Info.*/