LFSHF

 


   more...

Solves a complex Hermitian system of linear equations given the U DUH factorization of the coefficient matrix.

Required Arguments

FACT — Complex N by N matrix containing the factorization of the coefficient matrix A as output from routine LFCHF/DLFCHF or LFTHF/DLFTHF. (Input)
Only the upper triangle of FACT is used.

IPVT — Vector of length N containing the pivoting information for the factorization of A as output from routine LFCHF/DLFCHF or LFTHF/DLFTHF. (Input)

B — Complex vector of length N containing the right-hand side of the linear system. (Input)

X — Complex vector of length N containing the solution to the linear system. (Output)
If B is not needed, B and X can share the same storage locations.

Optional Arguments

N — Number of equations. (Input)
Default: N = size (FACT,2).

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 LFSHF (FACT, IPVT, B, X [, …])

Specific: The specific interface names are S_LFSHF and D_LFSHF.

FORTRAN 77 Interface

Single: CALL LFSHF (N, FACT, LDFACT, IPVT, B, X)

Double: The double precision name is DLFSHF.

Description

Routine LFSHF computes the solution of a system of linear algebraic equations having a complex Hermitian indefinite coefficient matrix.

To compute the solution, the coefficient matrix must first undergo a U DUH factorization. This may be done by calling either LFCHF or LFTHF.

LFSHF and LFIHF both solve a linear system given its U DUH factorization. LFIHF generally takes more time and produces a more accurate answer than LFSHF. Each iteration of the iterative refinement algorithm used by LFIHF calls LFSHF.

The underlying code is based on either LINPACK or LAPACK code depending upon which supporting libraries are used during linking. For a detailed explanation see Using ScaLAPACK, LAPACK, LINPACK, and EISPACK in the Introduction section of this manual.

Example

A set of linear systems is solved successively. LFTHF is called to factor the coefficient matrix. LFSHF is called to compute the three solutions for the three 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 LFCHF to perform the factorization, and LFIHF to compute the solutions.

 

USE LFSHF_INT

USE WRCRN_INT

USE LFTHF_INT

! Declare variables

INTEGER LDA, N

PARAMETER (LDA=3, N=3)

INTEGER IPVT(N), I

COMPLEX A(LDA,LDA), B(N,3), X(N,3), FACT(LDA,LDA)

!

! Set values for A and B

!

! A = ( 3.0+0.0i 1.0-1.0i 4.0+0.0i )

! ( 1.0+1.0i 2.0+0.0i -5.0+1.0i )

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

!

! B = ( 7.0+32.0i -6.0+11.0i -2.0-17.0i )

! (-39.0-21.0i -5.5-22.5i 4.0+10.0i )

! ( 51.0+ 9.0i 16.0+17.0i -2.0+12.0i )

!

DATA A/(3.0,0.0), (1.0,1.0), (4.0,0.0), (1.0,-1.0), (2.0,0.0),&

(-5.0,-1.0), (4.0,0.0), (-5.0,1.0), (-2.0,0.0)/

DATA B/(7.0,32.0), (-39.0,-21.0), (51.0,9.0), (-6.0,11.0),&

(-5.5,-22.5), (16.0,17.0), (-2.0,-17.0), (4.0,10.0),&

(-2.0,12.0)/

! Factor A

CALL LFTHF (A, FACT, IPVT)

! Solve for the three right-hand sides

DO 10 I=1, 3

CALL LFSHF (FACT, IPVT, B(:,I), X(:,I))

10 CONTINUE

! Print results

CALL WRCRN (’X’, X)

END

Output

 

X

1 2 3

1 ( 2.00, 1.00) ( 1.00, 0.00) ( 0.00, -1.00)

2 (-10.00, -1.00) ( -3.00, -4.00) ( 0.00, -2.00)

3 ( 3.00, 5.00) ( -0.50, 3.00) ( 0.00, -3.00)