• Nenhum resultado encontrado

IMSL MATH/LIBRARY Chapter 1: Linear Systems · 111

4 2 The input matrix is singular.

Description

Routine LFCCG performs an LU factorization of a complex general coefficient matrix. It also estimates the condition number of the matrix. The LU factorization is done using scaled partial pivoting. Scaled partial pivoting differs from partial pivoting in that the pivoting strategy is the same as if each row were scaled to have the same ¥-norm.

The L1 condition number of the matrix A is defined to be k(A) = ||A||1||A||1. Since it is expensive to compute ||A||1, the condition number is only estimated. The estimation algorithm is the same as used by LINPACK and is described by Cline et al. (1979).

If the estimated condition number is greater than 1/e (where e is machine precision), a warning error is issued. This indicates that very small changes in A can cause very large changes in the solution x. Iterative refinement can sometimes find the solution to such a system.

LFCCG fails if U, the upper triangular part of the factorization, has a zero diagonal element. This can occur only if A either is singular or is very close to a singular matrix.

The LU factors are returned in a form that is compatible with routines LFICG, page 116, LFSCG, page 114, and LFDCG, page 119. To solve systems of equations with multiple right-hand-side vectors, use LFCCG followed by either LFICG or LFSCG called once for each right-hand side.

The routine LFDCG can be called to compute the determinant of the coefficient matrix after LFCCG has performed the factorization.

Let F be the matrix FACT and let p be the vector IPVT. The triangular matrix U is stored in the upper triangle of F. The strict lower triangle of F contains the information needed to reconstruct L using

L11 = LN-1PN-1¼ L1P1

where Pk is the identity matrix with rows k and pk interchanged and Lk is the identity with Fik for i = k + 1, ..., N inserted below the diagonal. The strict lower half of F can also be thought of as containing the negative of the multipliers.

LFCCG is based on the LINPACK routine CGECO; see Dongarra et al. (1979). CGECO uses unscaled partial pivoting.

112 · Chapter 1: Linear Systems IMSL MATH/LIBRARY IPVT — Vector of length N containing the pivoting information for the LU factorization.

(Output) Optional Arguments

N — Order of the matrix. (Input) Default: N = size (A,2).

LDA — Leading dimension of A exactly as specified in the dimension statement of the calling program. (Input)

Default: LDA = size (A,1).

LDFACT — Leading dimension of FACT exactly as specified in the dimension statement of the calling program. (Input)

Default: LDFACT = size (FACT,1).

FORTRAN 90 Interface

Generic: CALL LFTCG (A, FACT, IPVT [,…])

Specific: The specific interface names are S_LFTCG and D_LFTCG. FORTRAN 77 Interface

Single: CALL LFTCG (N, A, LDA, FACT, LDFACT, IPVT) Double: The double precision name is DLFTCG.

Example

A linear system with multiple right-hand sides is solved. LFTCG is called to factor the

coefficient matrix. LFSCG is called to compute the two solutions for the two right-hand sides. In this case the coefficient matrix is assumed to be well-conditioned and correctly scaled.

Otherwise, it would be better to call LFCCG to perform the factorization, and LFICG to compute the solutions.

USE LFTCG_INT USE LFSCG_INT USE WRCRN_INT

! Declare variables PARAMETER (LDA=3, LDFACT=3, N=3)

INTEGER IPVT(N)

COMPLEX A(LDA,LDA), B(N,2), X(N,2), FACT(LDFACT,LDFACT)

! Set values for A

! A = ( 1.0+1.0i 2.0+3.0i 3.0-3.0i)

! ( 2.0+1.0i 5.0+3.0i 7.0-5.0i)

! (-2.0+1.0i -4.0+4.0i 5.0+3.0i)

!

DATA A/(1.0,1.0), (2.0,1.0), (-2.0,1.0), (2.0,3.0), (5.0,3.0),&

(-4.0,4.0), (3.0,-3.0), (7.0,-5.0), (5.0,3.0)/

IMSL MATH/LIBRARY Chapter 1: Linear Systems · 113

!

! Set the right-hand sides, B

! B = ( 3.0+ 5.0i 9.0+ 0.0i)

! ( 22.0+10.0i 13.0+ 9.0i)

! (-10.0+ 4.0i 6.0+10.0i)

!

DATA B/(3.0,5.0), (22.0,10.0), (-10.0,4.0), (9.0,0.0),&

(13.0,9.0), (6.0,10.0)/

!

! Factor A CALL LFTCG (A, FACT, IPVT)

! Solve for the two right-hand sides DO 10 J=1, 2

CALL LFSCG (FACT, IPVT, B(:,J), X(:,J)) 10 CONTINUE

! Print results CALL WRCRN (’X’, X)

END

Output

X

1 2 1 ( 1.000,-1.000) ( 0.000, 2.000) 2 ( 2.000, 4.000) (-2.000,-1.000) 3 ( 3.000, 0.000) ( 1.000, 3.000)

Comments

1. Workspace may be explicitly provided, if desired, by use of L2TCG/DL2TCG. The reference is:

CALL L2TCG (N, A, LDA, FACT, LDFACT, IPVT, WK) The additional argument is:

WK — Complex work vector of length N. 2. Informational error

Type Code

4 2 The input matrix is singular.

Description

Routine LFTCG performs an LU factorization of a complex general coefficient matrix. The LU factorization is done using scaled partial pivoting. Scaled partial pivoting differs from partial pivoting in that the pivoting strategy is the same as if each row were scaled to have the same ¥- norm.

LFTCG fails if U, the upper triangular part of the factorization, has a zero diagonal element. This can occur only if A either is singular or is very close to a singular matrix.

114 · Chapter 1: Linear Systems IMSL MATH/LIBRARY

The LU factors are returned in a form that is compatible with routines LFICG, page 116, LFSCG, page 114, and LFDCG, page 119. To solve systems of equations with multiple right-hand-side vectors, use LFTCG followed by either LFICG or LFSCG called once for each right-hand side.

The routine LFDCG can be called to compute the determinant of the coefficient matrix after LFCCG (page 108) has performed the factorization.

Let F be the matrix FACT and let p be the vector IPVT. The triangular matrix U is stored in the upper triangle of F. The strict lower triangle of F contains the information needed to reconstruct L using

L = LN-1PN-1¼ L1P1

where Pk is the identity matrix with rows k and Pk interchanged and Lk is the identity with Fik for i = k + 1, ..., N inserted below the diagonal. The strict lower half of F can also be thought of as containing the negative of the multipliers.

LFTCG is based on the LINPACK routine CGEFA; see Dongarra et al. (1979). CGEFA uses unscaled partial pivoting.

Documentos relacionados