LFSQS

Solves a real symmetric positive definite system of linear equations given the factorization of the coefficient matrix in band symmetric storage mode.

Required Arguments

FACTNCODA + 1 by N array containing the RT R factorization of the positive definite band matrix A in band symmetric storage mode as output from subroutine LFCQS/DLFCQS or LFTQS/DLFTQS. (Input)

NCODA — Number of upper codiagonals of A. (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)
If B is not needed, B and X an 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 LFSQS (FACT, NCODA, B, X [])

Specific: The specific interface names are S_LFSQS and D_LFSQS.

FORTRAN 77 Interface

Single: CALL LFSQS (N, FACT, LDFACT, NCODA, B, X)

Double: The double precision name is DLFSQS.

Description

Routine LFSQS computes the solution for a system of linear algebraic equations having a real symmetric positive definite band coefficient matrix. To compute the solution, the coefficient matrix must first undergo an RT R factorization. This may be done by calling either LFCQS or LFTQS. R is an upper triangular band matrix.

The solution to Ax = b is found by solving the triangular systems RTy = b and Rx = y.

LFSQS and LFIQS 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.

LFSQS is based on the LINPACK routine SPBSL; see Dongarra et al. (1979).

Comments

Informational error

 

Type

Code

Description

4

1

The factored matrix is singular.

Example

A set of linear systems is solved successively. LFTQS is called to factor the coefficient matrix. LFSQS is called to compute the four solutions for the four 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 LFCQS to perform the factorization, and LFIQS to compute the solutions.

 

USE LFSQS_INT

USE LFTQS_INT

USE WRRRN_INT

! Declare variables

INTEGER LDA, LDFACT, N, NCODA

PARAMETER (LDA=3, LDFACT=3, N=4, NCODA=2)

REAL A(LDA,N), B(N,4), FACT(LDFACT,N), X(N,4)

!

!

! Set values for A in band symmetric form, and B

!

! A = ( 0.0 0.0 -1.0 1.0 )

! ( 0.0 0.0 2.0 -1.0 )

! ( 2.0 4.0 7.0 3.0 )

!

! B = ( 4.0 -3.0 9.0 -1.0 )

! ( 6.0 10.0 29.0 3.0 )

! ( 15.0 12.0 11.0 6.0 )

! ( -7.0 1.0 14.0 2.0 )

!

DATA A/2*0.0, 2.0, 2*0.0, 4.0, -1.0, 2.0, 7.0, 1.0, -1.0, 3.0/

DATA B/4.0, 6.0, 15.0, -7.0, -3.0, 10.0, 12.0, 1.0, 9.0, 29.0,&

11.0, 14.0, -1.0, 3.0, 6.0, 2.0/

! Factor the matrix A

CALL LFTQS (A, NCODA, FACT)

! Compute the solutions

DO 10 I=1, 4

CALL LFSQS (FACT, NCODA, B(:,I), X(:,I))

10 CONTINUE

! Print solutions

CALL WRRRN (’X’, X)

!

END

Output

 

X

1 2 3 4

1 3.000 -1.000 5.000 0.000

2 1.000 2.000 6.000 0.000

3 2.000 1.000 1.000 1.000

4 -2.000 0.000 3.000 1.000