The IMSL_LUFAC procedure computes the LU factorization of a real or complex matrix.

This routine requires an IDL Advanced Math and Stats license. For more information, contact your sales or technical support representative.

Any of several related computations can be performed by using keywords. These extra tasks include computing the LU factorization of AT, computing an estimate of the L1 condition number, and returning L or U separately.

The IMSL_LUFAC procedure computes the LU factorization of A with partial pivoting such that L–1PA = U. The matrix U is upper-triangular, while L–1A ≡ Pn – 1 Ln – 2Pn – 2...L0 P0 A ≡ U. The factors Pi and Li are defined by the partial pivoting. Each Pi is an interchange of row i with row i ≥ j. Thus, Pi is defined by that value of j. Every Li = mieiT is an elementary elimination matrix. The vector mi is zero in entries 0, ..., i – 1. This vector is stored as column i in the strictly lower-triangular part of the working array containing the decomposition information.

The factorization efficiency is based on a technique of “loop unrolling and jamming” due to Dr. Leonard J. Harding of the University of Michigan, Ann Arbor, Michigan. When the inverse of the matrix is sought, an estimate of the L1 condition number of A is computed using the same algorithm as in Dongarra et al. (1979). If the estimated condition number is greater than 1/ε (where ε is the machine precision), a warning message is issued. This indicates that very small changes in A may produce large changes in the solution x. The IMSL_LUFAC procedure fails if U, the upper triangular part of the factorization, has a zero diagonal element.

Examples


Example 1

This example computes the LU factorization of a matrix and prints it out in the default form with the information needed to construct L and U combined in one array.

RM, a, 3, 3
; Input the matrix to be factored.
row 0: 1 3 3
row 1: 1 3 4
row 2: 1 4 3
IMSL_LUFAC, a, pvt, fac
; Factor the matrix by calling IMSL_LUFAC.
PM, fac, Title = 'LU factors of A'
 
; Print the results.
LU factors of A
  1.00000 3.00000 3.00000
  -1.00000 1.00000 0.00000
  -1.00000 -0.00000 1.00000
PM, pvt, Title = 'Pivot sequence'
Pivot sequence
  1
  3
  3

Example 2

This example computes the factorization, uses keywords to return the factorization in separate named variables, and returns the original matrix after the pivot permutation is applied.

RM, a, 3, 3
 
; Input the matrix to be factored.
row 0: 1 3 3
  row 1: 1 3 4
  row 2: 1 4 3
IMSL_LUFAC, a, L = l, U = u, PA = pa
 
; Call IMSL_LUFAC with the keywords L and U.
PM, l, Title = 'L'
 
; Print the results.
L
  1.00000 0.00000 0.00000
  1.00000 1.00000 0.00000
  1.00000 0.00000 1.00000
PM, u, Title = 'U'
U
  1.00000 3.00000 3.00000
  0.00000 1.00000 0.00000
  0.00000 0.00000 1.00000
PM, l # u - pa, $
Title = 'Residual: L # U - PA'
Residual: L # U - PA
  0.00000 0.00000 0.00000
  0.00000 0.00000 0.00000
  0.00000 0.00000 0.00000

Syntax


Result = IMSL_LUFAC, A, [Pivot[,Fac] [, CONDITION=variable] [, /DOUBLE] [, INVERSE=variable] [, L=variable] [, PA=variable] [TRANSPOSE=value] [, U=variable]]

Arguments


A

Two-dimensional matrix containing the coefficient matrix. Element A (i, j) contains the j-th coefficient of the i-th equation.

Fac

A named variable that will contain a two-dimensional matrix containing the LU factorization of A. The strictly lower-triangular part of this matrix contains information necessary to construct L, and the upper-triangular part contains U.

Pivot

A named variable that will contain a one-dimensional matrix containing the pivot sequence of the factorization.

Keywords


CONDITION (optional)

Named variable into which an estimate of the L1 condition number is stored.

DOUBLE (optional)

If present and nonzero, double precision is used.

INVERSE (optional)

Named variable into which the inverse of the matrix A is stored.

L (optional)

Named variable into which the strictly lower-triangular matrix L of the LU factorization is stored.

PA (optional)

Named variable into which the matrix resulting from applying the pivot permutation to A is stored.

TRANSPOSE (optional)

If present and nonzero, ATX=b is solved.

U (optional)

Named variable into which the upper-triangular matrix U of the LU factorization is stored.

Errors


Warning Errors

MATH_ILL_CONDITIONED: Input matrix is too ill-conditioned. An estimate of the reciprocal of its L1 condition number is #. The solution might not be accurate.

Fatal Errors

MATH_SINGULAR_MATRIX: Input matrix is singular

Version History


6.4

Introduced

See Also


IMSL_SP_BDPDFAC, IMSL_SP_BDPDSOL, IMSL_SP_BDSOL, IMSL_SP_CG, IMSL_SP_GMRES, IMSL_SP_LUSOL, IMSL_SP_MVMUL, IMSL_SP_PDFAC, IMSL_SP_PDSOL