LFSCB
Solves a complex system of linear equations given the LU factorization of the coefficient matrix in band storage mode.
Required Arguments
FACT — Complex 2 * NLCA + NUCA + 1 by N array containing the LU factorization of the coefficient matrix A as output from subroutine LFCCB/DLFCCB or LFTCB/DLFTCB. (Input)
NLCA — Number of lower codiagonals of A. (Input)
NUCA — Number of upper codiagonals of A. (Input)
IPVT — Vector of length N containing the pivoting information for the LU factorization of A as output from subroutine LFCCB/DLFCCB or LFTCB/DLFTCB. (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).
IPATH — Path indicator. (Input)
IPATH = 1 means the system AX = B is solved.
IPATH = 2 means the system AHX = B is solved.
Default: IPATH = 1.
FORTRAN 90 Interface
Generic: CALL LFSCB (FACT, NLCA, NUCA, IPVT, B, X [, …])
Specific: The specific interface names are S_LFSCB and D_LFSCB.
FORTRAN 77 Interface
Single: CALL LFSCB (N, FACT, LDFACT, NLCA, NUCA, IPVT, B, IPATH, X)
Double: The double precision name is DLFSCB.
Description
Routine
LFSCB computes the solution of a system of linear algebraic equations having a complex banded coefficient matrix. To compute the solution, the coefficient matrix must first undergo an
LU factorization. This may be done by calling either
LFCCB or
LFTCB. The solution to
Ax =
b is found by solving the banded triangular systems
Ly =
b and
Ux =
y. The forward elimination step consists of solving the system
Ly =
b by applying the same permutations and elimination operations to
b that were applied to the columns of
A in the factorization routine. The backward substitution step consists of solving the banded triangular system
Ux =
y for
x.
LFSCB and
LFICB both solve a linear system given its
LU factorization.
LFICB generally takes more time and produces a more accurate answer than
LFSCB. Each iteration of the iterative refinement algorithm used by
LFICB calls
LFSCB.
LFSCB is based on the LINPACK routine CGBSL; see Dongarra et al. (1979).
Example
The inverse is computed for a real banded 4
× 4 matrix with one upper and one lower codiagonal. The input matrix is assumed to be well-conditioned; hence
LFTCB is used rather than
LFCCB.
USE LFSCB_INT
USE LFTCB_INT
USE WRCRN_INT
! Declare variables
INTEGER LDA, LDFACT, N, NLCA, NUCA
PARAMETER (LDA=3, LDFACT=4, N=4, NLCA=1, NUCA=1)
INTEGER IPVT(N)
COMPLEX A(LDA,N), AINV(N,N), FACT(LDFACT,N), RJ(N)
!
! Set values for A in band form
!
! A = ( 0.0+0.0i 4.0+0.0i -2.0+2.0i -4.0-1.0i )
! ( -2.0-3.0i -0.5+3.0i 3.0-3.0i 1.0-1.0i )
! ( 6.0+1.0i 1.0+1.0i 0.0+2.0i 0.0+0.0i )
!
DATA A/(0.0,0.0), (-2.0,-3.0), (6.0,1.0), (4.0,0.0), (-0.5,3.0),&
(1.0,1.0), (-2.0,2.0), (3.0,-3.0), (0.0,2.0), (-4.0,-1.0),&
(1.0,-1.0), (0.0,0.0)/
!
CALL LFTCB (A, NLCA, NUCA, FACT, IPVT)
! Set up the columns of the identity
! matrix one at a time in RJ
RJ = (0.0E0,0.0E0)
DO 10 J=1, N
RJ(J) = (1.0E0,0.0E0)
! RJ is the J-th column of the identity
! matrix so the following LFSCB
! reference places the J-th column of
! the inverse of A in the J-th column
! of AINV
CALL LFSCB (FACT, NLCA, NUCA, IPVT, RJ, AINV(:,J))
RJ(J) = (0.0E0,0.0E0)
10 CONTINUE
! Print results
CALL WRCRN (’AINV’, AINV)
!
END
Output
1 2 3 4
1 ( 0.165,-0.341) ( 0.376,-0.094) (-0.282, 0.471) (-1.600, 0.000)
2 ( 0.588,-0.047) ( 0.259, 0.235) (-0.494, 0.024) (-0.800,-1.200)
3 ( 0.318, 0.271) ( 0.012, 0.247) (-0.759,-0.235) (-0.550,-2.250)
4 ( 0.588,-0.047) ( 0.259, 0.235) (-0.994, 0.524) (-2.300,-1.200)