LFSQH
Solves a complex Hermitian positive definite system of linear equations given the factorization of the coefficient matrix in band Hermitian storage mode.
Required Arguments
FACT — Complex NCODA + 1 by N array containing the RH R factorization of the Hermitian positive definite band matrix A. (Input)
FACT is obtained as output from routine LFCQH/DLFCQH or LFTQH/DLFTQH .
NCODA — Number of upper or lower codiagonals of A. (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 LFSQH (FACT, NCODA, B, X [, …])
Specific: The specific interface names are S_LFSQH and D_LFSQH.
FORTRAN 77 Interface
Single: CALL LFSQH (N, FACT, LDFACT, NCODA, B, X)
Double: The double precision name is DLFSQH.
Description
Routine LFSQH computes the solution for a system of linear algebraic equations having a complex Hermitian positive definite band coefficient matrix. To compute the solution, the coefficient matrix must first undergo an RH R factorization. This may be done by calling either IMSL routine LFCQH or LFTQH. R is an upper triangular band matrix.
The solution to Ax = b is found by solving the triangular systems RH y = b and Rx = y.
LFSQH and LFIQH both solve a linear system given its RH R factorization. LFIQH generally takes more time and produces a more accurate answer than LFSQH. Each iteration of the iterative refinement algorithm used by LFIQH calls LFSQH.
LFSQH is based on the LINPACK routine CPBSL; see Dongarra et al. (1979).
Comments
Informational error
Type |
Code |
Description |
4 |
1 |
The factored matrix has a diagonal element close to zero. |
Example
A set of linear systems is solved successively. LFTQH is called to factor the coefficient matrix. LFSQH 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 LFCQH to perform the factorization, and LFIQH to compute the solutions.
USE LFSQH_INT
USE LFTQH_INT
USE WRCRN_INT
! Declare variables
INTEGER LDA, LDFACT, N, NCODA
PARAMETER (LDA=2, LDFACT=2, N=5, NCODA=1)
COMPLEX A(LDA,N), B(N,3), FACT(LDFACT,N), X(N,3)
!
! Set values for A in band Hermitian form, and B
!
! A = ( 0.0+0.0i -1.0+1.0i 1.0+2.0i 0.0+4.0i 1.0+1.0i )
! ( 2.0+0.0i 4.0+0.0i 10.0+0.0i 6.0+0.0i 9.0+0.0i )
!
! B = ( 3.0+3.0i 4.0+0.0i 29.0-9.0i )
! ( 5.0-5.0i 15.0-10.0i -36.0-17.0i )
! ( 5.0+4.0i -12.0-56.0i -15.0-24.0i )
! ( 9.0+7.0i -12.0+10.0i -23.0-15.0i )
! (-22.0+1.0i 3.0-1.0i -23.0-28.0i )
!
DATA A/(0.0,0.0), (2.0,0.0), (-1.0,1.0), (4.0, 0.0), (1.0,2.0),&
(10.0,0.0), (0.0,4.0), (6.0,0.0), (1.0,1.0), (9.0,0.0)/
DATA B/(3.0,3.0), (5.0,-5.0), (5.0,4.0), (9.0,7.0), (-22.0,1.0),&
(4.0,0.0), (15.0,-10.0), (-12.0,-56.0), (-12.0,10.0),&
(3.0,-1.0), (29.0,-9.0), (-36.0,-17.0), (-15.0,-24.0),&
(-23.0,-15.0), (-23.0,-28.0)/
! Factor the matrix A
CALL LFTQH (A, NCODA, FACT)
! Compute the solutions
DO 10 I=1, 3
CALL LFSQH (FACT, NCODA, B(:,I), X(:,I))
10 CONTINUE
! Print solutions
CALL WRCRN (’X’, X)
END
X
1 2 3
1 ( 1.00, 0.00) ( 3.00, -1.00) ( 11.00, -1.00)
2 ( 1.00, -2.00) ( 2.00, 0.00) ( -7.00, 0.00)
3 ( 2.00, 0.00) ( -1.00, -6.00) ( -2.00, -3.00)
4 ( 2.00, 3.00) ( 2.00, 1.00) ( -2.00, -3.00)
5 ( -3.00, 0.00) ( 0.00, 0.00) ( -2.00, -3.00)