LFIQS
Uses iterative refinement to improve the solution of a real symmetric positive definite system of linear equations in band symmetric storage mode.
Required Arguments
A — NCODA + 1 by N array containing the N by N positive definite band coefficient matrix in band symmetric storage mode. (Input)
NCODA — Number of upper codiagonals of A. (Input)
FACT — NCODA + 1 by N array containing the RT R factorization of the matrix A from routine LFCQS/DLFCQS or LFTQS/DLFTQS. (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 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).
FORTRAN 90 Interface
Generic: CALL LFIQS (A, NCODA, FACT, B, X, RES [, …])
Specific: The specific interface names are S_LFIQS and D_LFIQS.
FORTRAN 77 Interface
Single: CALL LFIQS (N, A, LDA, NCODA, FACT, LDFACT, B, X, RES)
Double: The double precision name is DLFIQS.
Description
Routine LFIQS computes the solution of a system of linear algebraic equations having a real symmetric positive-definite band 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 RT R factorization. This may be done by calling either IMSL routine LFCQS or LFTQS.
Iterative refinement fails only if the matrix is very ill-conditioned.
LFIQS and LFSQS both solve a linear system given its RT R factorization. LFIQS generally takes more time and produces a more accurate answer than LFSQS. Each iteration of the iterative refinement algorithm used by LFIQS calls LFSQS.
Comments
Informational error
Type |
Code |
Description |
3 |
4 |
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 LFIQS_INT
USE UMACH_INT
USE LFCQS_INT
USE WRRRN_INT
! Declare variables
INTEGER LDA, LDFACT, N, NCODA, NOUT
PARAMETER (LDA=2, LDFACT=2, N=4, NCODA=1)
REAL A(LDA,N), B(N), RCOND, FACT(LDFACT,N), RES(N,3),&
X(N,3)
!
! Set values for A in band symmetric form, and B
!
! A = ( 0.0 1.0 1.0 1.0 )
! ( 2.0 2.5 2.5 2.0 )
!
! B = ( 3.0 5.0 7.0 4.0 )
!
DATA A/0.0, 2.0, 1.0, 2.5, 1.0, 2.5, 1.0, 2.0/
DATA B/3.0, 5.0, 7.0, 4.0/
! Factor the matrix A
CALL LFCQS (A, NCODA, FACT, RCOND)
! Print the estimated condition number
CALL UMACH (2, NOUT)
WRITE (NOUT,99999) RCOND, 1.0E0/RCOND
! Compute the solutions
DO 10 I=1, 3
CALL LFIQS (A, NCODA, FACT, B, X(:,I), RES(:,I))
B(2) = B(2) + 0.5E0
10 CONTINUE
! Print solutions and residuals
CALL WRRRN (’X’, X)
CALL WRRRN (’RES’, RES)
99999 FORMAT (’ RCOND = ’,F5.3,/,’ L1 Condition number = ’,F6.3)
END
RCOND = 0.160
L1 Condition number = 6.239
X
1 2 3
1 1.167 1.000 0.833
2 0.667 1.000 1.333
3 2.167 2.000 1.833
4 0.917 1.000 1.083
RES
1 2 3
1 7.947E-08 0.000E+00 9.934E-08
2 7.947E-08 0.000E+00 3.974E-08
3 7.947E-08 0.000E+00 1.589E-07
4 -3.974E-08 0.000E+00 -7.947E-08