2
SUBROUTINE STRSL (T, LDT, N, B, JOB, INFO)
3
C***BEGIN PROLOGUE STRSL
4
C***PURPOSE Solve a system of the form T*X=B or TRANS(T)*X=B, where
5
C T is a triangular matrix.
6
C***LIBRARY SLATEC (LINPACK)
8
C***TYPE SINGLE PRECISION (STRSL-S, DTRSL-D, CTRSL-C)
9
C***KEYWORDS LINEAR ALGEBRA, LINPACK, TRIANGULAR LINEAR SYSTEM,
11
C***AUTHOR Stewart, G. W., (U. of Maryland)
14
C STRSL solves systems of the form
20
C where T is a triangular matrix of order N. Here TRANS(T)
21
C denotes the transpose of the matrix T.
26
C T contains the matrix of the system. The zero
27
C elements of the matrix are not referenced, and
28
C the corresponding elements of the array can be
29
C used to store other information.
32
C LDT is the leading dimension of the array T.
35
C N is the order of the system.
38
C B contains the right hand side of the system.
41
C JOB specifies what kind of system is to be solved.
44
C 00 solve T*X=B, T lower triangular,
45
C 01 solve T*X=B, T upper triangular,
46
C 10 solve TRANS(T)*X=B, T lower triangular,
47
C 11 solve TRANS(T)*X=B, T upper triangular.
51
C B B contains the solution, if INFO .EQ. 0.
52
C Otherwise B is unaltered.
55
C INFO contains zero if the system is nonsingular.
56
C Otherwise INFO contains the index of
57
C the first zero diagonal element of T.
59
C***REFERENCES J. J. Dongarra, J. R. Bunch, C. B. Moler, and G. W.
60
C Stewart, LINPACK Users' Guide, SIAM, 1979.
61
C***ROUTINES CALLED SAXPY, SDOT
62
C***REVISION HISTORY (YYMMDD)
64
C 890831 Modified array declarations. (WRB)
65
C 890831 REVISION DATE from Version 3.2
66
C 891214 Prologue converted to Version 4.0 format. (BAB)
67
C 900326 Removed duplicate information from DESCRIPTION section.
69
C 920501 Reformatted the REFERENCES section. (WRB)
70
C***END PROLOGUE STRSL
71
INTEGER LDT,N,JOB,INFO
77
C***FIRST EXECUTABLE STATEMENT STRSL
79
C CHECK FOR ZERO DIAGONAL ELEMENTS.
82
IF (T(INFO,INFO) .EQ. 0.0E0) GO TO 150
86
C DETERMINE THE TASK AND GO TO IT.
89
IF (MOD(JOB,10) .NE. 0) CASE = 2
90
IF (MOD(JOB,100)/10 .NE. 0) CASE = CASE + 2
91
GO TO (20,50,80,110), CASE
93
C SOLVE T*X=B FOR T LOWER TRIANGULAR
97
IF (N .LT. 2) GO TO 40
100
CALL SAXPY(N-J+1,TEMP,T(J,J-1),1,B(J),1)
106
C SOLVE T*X=B FOR T UPPER TRIANGULAR.
110
IF (N .LT. 2) GO TO 70
114
CALL SAXPY(J,TEMP,T(1,J+1),1,B(1),1)
120
C SOLVE TRANS(T)*X=B FOR T LOWER TRIANGULAR.
124
IF (N .LT. 2) GO TO 100
127
B(J) = B(J) - SDOT(JJ-1,T(J+1,J),1,B(J+1),1)
133
C SOLVE TRANS(T)*X=B FOR T UPPER TRIANGULAR.
137
IF (N .LT. 2) GO TO 130
139
B(J) = B(J) - SDOT(J-1,T(1,J),1,B(1),1)