Solves a triangular (possibly singular) set of linear systems and/or compute a generalized inverse of an upper triangular matrix.
R − N by N upper triangular
matrix. (Input)
If R contains a zero
along the diagonal, the remaining elements of the row must also be zero. Only
the upper triangle of R is referenced.
B − N by NB matrix containing
the right hand sides of the linear system. (Input, if NB > 0)
If NB = 0, B is not referenced
and can be a vector length one.
IRANK − Rank of R. (Output)
X − N by NB matrix containing
the solution matrix corresponding to the right hand side B.
(Output, if NB
> 0)
If B
is not needed, then X and B can share the same
storage locations. If NB = 0, x is not
referenced and can be a vector of length one.
N − Order of the
upper triangular matrix R. (Input)
Default: N =
size (R,2).
LDR − Leading
dimension of R
exactly as specified in the dimension statement of the calling
program. (Input)
Default: LDR = size (R,1).
NB − Number of
columns in B.
(Input)
NB
must be nonnegative. If NB is zero, no linear
systems are solved.
Default: NB = size (B,2).
LDB − Leading
dimension of B
exactly as specified in the dimension statement of the calling
program. (Input)
Default: LDB = size (B,1).
IPATH − Path
option. (Input)
Default: IPATH = 1.
IPATH Action
1 Solve R * X = B.
2 Solve RT * X = B.
3 Solve R * X = B and compute RINV.
4 Solve RT * X = B and compute RINV.
LDX − Leading
dimension of X
exactly as specified in the dimension statement of the calling
program. (Input)
Default: LDX = size (X,1).
RINV − N by N upper triangular
matrix that is the inverse of R when R is
nonsingular. (Output, if IPATH equals 3 or
4)
(When R is
singular, RINV
is g3 inverse. See the Algorithm section for an
explanation of g3 inverses.) If IPATH = 1 or 2, RINV is not referenced
and can be a 1x1 array. If IPATH = 3 or 4 and
R is not needed,
then R and RINV can share the
same storage locations.
LDRINV − Leading dimension of RINV exactly as specified in the dimension statement of the calling program. (Input)
Generic: CALL GIRTS (R, B, IRANK, X [,…])
Specific: The specific interface names are S_GIRTS and D_GIRTS.
Single: CALL GIRTS (N, R, LDR, NB, B, LDB, IPATH, IRANK, X, LDX, RINV, LDRINV)
Double: The double precision name is DGIRTS.
Routine GIRTS solves systems of linear algebraic equations with a triangular coefficient matrix. Inversion of the coefficient matrix is an option. The coefficient matrix can contain a zero diagonal element, but if so, the remaining elements in the row must be zero also. (A terminal error message is issued if a nonzero element appears in the row of the coefficient matrix where a zero diagonal element appears.)
If solution of a linear system is requested (i.e., NB > 0) and row i of the coefficient matrix contains elements all equal to zero, the following action is taken:
The i-th row of the solution X is set to zero.
If IPATH is 1 or 3, a warning error is issued when the i-th row of the right-hand side B is not zero.
If
IPATH
is 2 or 4, a warning error is issued when the i-th row of the reduced
right-hand side (obtained after the first i − 1 variables are
eliminated from row i) is not zero within a computed tolerance.
If an inverse of the coefficient matrix is requested and
row i contains elements all equal to zero, row i and column
i elements of RINV
are set to zero. The resulting inverse is a g3 inverse of R.
For a matrix G to be g3 inverse of a matrix
A, G must satisfy Conditions 1, 2, and 3 for the
Moore-Penrose
inverse but generally fail Condition 4. The four conditions for G to be a
Moore-Penrose inverse of A are as follows:
1. AGA = A
2. GAG = G
3 AG is symmetric
4 GA is symmetric
For a detailed description of the algorithm, see Section 2 in Sallas and Lionti (1988).
1. Informational error
Type Code
3 1 The linear system of equations is inconsistent.
2. Routine GIRTS assumes that a singular R is represented by zero rows in R. No other forms of singularity in R are allowed.
The following example is taken from Maindonald (1984, pp. 102-105). A linear system Rx = B is solved, and a g3 inverse of R is computed.
USE GIRTS_INT
USE WRRRN_INT
IMPLICIT NONE
INTEGER LDB, LDR, LDRINV, LDX, N, NB, J
PARAMETER (N=4, NB=1, LDB=N, LDR=N, LDRINV=N, LDX=N)
!
INTEGER IPATH, IRANK
REAL B(LDB,NB), R(LDR,N), RINV(LDRINV,N), X(LDX,NB)
!
DATA (R(1,J),J=1,N)/6.0, 2.0, 5.0, 1.0/, B(1,1)/3.0/
DATA (R(2,J),J=1,N)/0.0, 4.0,-2.0, 2.0/, B(2,1)/4.0/
DATA (R(3,J),J=1,N)/0.0, 0.0, 0.0, 0.0/, B(3,1)/0.0/
DATA (R(4,J),J=1,N)/0.0, 0.0, 0.0, 3.0/, B(4,1)/3.0/
!
IPATH = 3
CALL GIRTS (R, B, IRANK, X, IPATH=IPATH, RINV=RINV)
!
CALL WRRRN ('RINV', RINV)
CALL WRRRN ('X', X)
END
RINV
1
2
3 4
1 0.1667
-0.0833 0.0000 0.0000
2
0.0000 0.2500 0.0000 -0.1667
3
0.0000 0.0000 0.0000 0.0000
4
0.0000 0.0000 0.0000
0.3333
X
1 0.167
2
0.500
3 0.000
4 1.000
PHONE: 713.784.3131 FAX:713.781.9260 |