LFIRB

   more...
Uses iterative refinement to improve the solution of a real system of linear equations in band storage mode.
Required Arguments
A — (NUCA + NLCA + 1) by N array containing the N by N banded coefficient matrix in band storage mode. (Input)
NLCA — Number of lower codiagonals of A. (Input)
NUCA — Number of upper codiagonals of A. (Input)
FACT — (2 * NLCA + NUCA + 1) by N array containing the LU factorization of the matrix A as output from routines LFCRB/DLFCRB or LFTRB/DLFTRB. (Input)
IPVT — Vector of length N containing the pivoting information for the LU factorization of A as output from routine LFCRB/DLFCRB or LFTRB/DLFTRB. (Input)
B — Vector of length N containing the right-hand side of the linear system. (Input)
X — Vector of length N containing the solution to the linear system. (Output)
RES — Vector of length N containing the residual vector at the improved solution . (Output)
Optional Arguments
N — Number of equations. (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).
IPATH — Path indicator. (Input)
IPATH = 1 means the system AX = B is solved.
IPATH = 2 means the system ATX = B is solved.
Default: IPATH =1.
FORTRAN 90 Interface
Generic: CALL LFIRB (A, NLCA, NUCA, FACT, IPVT, B, X, RES [])
Specific: The specific interface names are S_LFIRB and D_LFIRB.
FORTRAN 77 Interface
Single: CALL LFIRB (N, A, LDA, NLCA, NUCA, FACT, LDFACT, IPVT, B, IPATH, X, RES)
Double: The double precision name is DLFIRB.
Description
Routine LFIRB computes the solution of a system of linear algebraic equations having a real banded coefficient matrix. Iterative refinement is performed on the solution vector to improve the accuracy. Usually almost all of the digits in the solution are accurate, even if the matrix is somewhat ill-conditioned.
To compute the solution, the coefficient matrix must first undergo an LU factorization. This may be done by calling either LFCRB or LFTRB.
Iterative refinement fails only if the matrix is very ill-conditioned.
LFIRB and LFSRB both solve a linear system given its LU factorization. LFIRB generally takes more time and produces a more accurate answer than LFSRB. Each iteration of the iterative refinement algorithm used by LFIRB calls LFSRB.
Comments
Informational error
Type
Code
Description
3
2
The input matrix is too ill-conditioned for iterative refinement to be effective
Example
A set of linear systems is solved successively. The right-hand-side vector is perturbed after solving the system each of the first two times by adding 0.5 to the second element.
 
USE LFIRB_INT
USE LFCRB_INT
USE UMACH_INT
USE WRRRN_INT
! Declare variables
INTEGER LDA, LDFACT, N, NLCA, NUCA, NOUT
PARAMETER (LDA=3, LDFACT=4, N=4, NLCA=1, NUCA=1)
INTEGER IPVT(N)
REAL A(LDA,N), B(N), FACT(LDFACT,N), RCOND, RES(N), X(N)
! Set values for A in band form, and B
!
! A = ( 0.0 -1.0 -2.0 2.0)
! ( 2.0 1.0 -1.0 1.0)
! ( -3.0 0.0 2.0 0.0)
!
! B = ( 3.0 5.0 7.0 -9.0)
!
DATA A/0.0, 2.0, -3.0, -1.0, 1.0, 0.0, -2.0, -1.0, 2.0,&
2.0, 1.0, 0.0/
DATA B/3.0, 5.0, 7.0, -9.0/
!
CALL LFCRB (A, NLCA, NUCA, FACT, IPVT, RCOND)
! Print the reciprocal condition number
CALL UMACH (2, NOUT)
WRITE (NOUT,99999) RCOND, 1.0E0/RCOND
! Solve the three systems
DO 10 J=1, 3
CALL LFIRB (A, NLCA, NUCA, FACT, IPVT, B, X, RES)
! Print results
CALL WRRRN (’X’, X, 1, N, 1)
! Perturb B by adding 0.5 to B(2)
B(2) = B(2) + 0.5E0
10 CONTINUE
!
99999 FORMAT (’ RCOND = ’,F5.3,/,’ L1 Condition number = ’,F6.3)
END
Output
 
RCOND < .07
L1 Condition number = 25.0
X
1 2 3 4
2.000 1.000 -5.000 1.000
 
X
1 2 3 4
1.500 0.000 -5.000 1.000
 
X
1 2 3 4
1.000 -1.000 -5.000 1.000
Published date: 03/19/2020
Last modified date: 03/19/2020