1SLATRS(1) LAPACK auxiliary routine (version 3.1) SLATRS(1)
2
3
4
6 SLATRS - one of the triangular systems A *x = s*b or A'*x = s*b with
7 scaling to prevent overflow
8
10 SUBROUTINE SLATRS( UPLO, TRANS, DIAG, NORMIN, N, A, LDA, X, SCALE,
11 CNORM, INFO )
12
13 CHARACTER DIAG, NORMIN, TRANS, UPLO
14
15 INTEGER INFO, LDA, N
16
17 REAL SCALE
18
19 REAL A( LDA, * ), CNORM( * ), X( * )
20
22 SLATRS solves one of the triangular systems triangular matrix, A'
23 denotes the transpose of A, x and b are n-element vectors, and s is a
24 scaling factor, usually less than or equal to 1, chosen so that the
25 components of x will be less than the overflow threshold. If the
26 unscaled problem will not cause overflow, the Level 2 BLAS routine
27 STRSV is called. If the matrix A is singular (A(j,j) = 0 for some j),
28 then s is set to 0 and a non-trivial solution to A*x = 0 is returned.
29
30
32 UPLO (input) CHARACTER*1
33 Specifies whether the matrix A is upper or lower triangular. =
34 'U': Upper triangular
35 = 'L': Lower triangular
36
37 TRANS (input) CHARACTER*1
38 Specifies the operation applied to A. = 'N': Solve A * x =
39 s*b (No transpose)
40 = 'T': Solve A'* x = s*b (Transpose)
41 = 'C': Solve A'* x = s*b (Conjugate transpose = Transpose)
42
43 DIAG (input) CHARACTER*1
44 Specifies whether or not the matrix A is unit triangular. =
45 'N': Non-unit triangular
46 = 'U': Unit triangular
47
48 NORMIN (input) CHARACTER*1
49 Specifies whether CNORM has been set or not. = 'Y': CNORM
50 contains the column norms on entry
51 = 'N': CNORM is not set on entry. On exit, the norms will be
52 computed and stored in CNORM.
53
54 N (input) INTEGER
55 The order of the matrix A. N >= 0.
56
57 A (input) REAL array, dimension (LDA,N)
58 The triangular matrix A. If UPLO = 'U', the leading n by n
59 upper triangular part of the array A contains the upper trian‐
60 gular matrix, and the strictly lower triangular part of A is
61 not referenced. If UPLO = 'L', the leading n by n lower trian‐
62 gular part of the array A contains the lower triangular matrix,
63 and the strictly upper triangular part of A is not referenced.
64 If DIAG = 'U', the diagonal elements of A are also not refer‐
65 enced and are assumed to be 1.
66
67 LDA (input) INTEGER
68 The leading dimension of the array A. LDA >= max (1,N).
69
70 X (input/output) REAL array, dimension (N)
71 On entry, the right hand side b of the triangular system. On
72 exit, X is overwritten by the solution vector x.
73
74 SCALE (output) REAL
75 The scaling factor s for the triangular system A * x = s*b or
76 A'* x = s*b. If SCALE = 0, the matrix A is singular or badly
77 scaled, and the vector x is an exact or approximate solution to
78 A*x = 0.
79
80 CNORM (input or output) REAL array, dimension (N)
81
82 If NORMIN = 'Y', CNORM is an input argument and CNORM(j) con‐
83 tains the norm of the off-diagonal part of the j-th column of
84 A. If TRANS = 'N', CNORM(j) must be greater than or equal to
85 the infinity-norm, and if TRANS = 'T' or 'C', CNORM(j) must be
86 greater than or equal to the 1-norm.
87
88 If NORMIN = 'N', CNORM is an output argument and CNORM(j)
89 returns the 1-norm of the offdiagonal part of the j-th column
90 of A.
91
92 INFO (output) INTEGER
93 = 0: successful exit
94 < 0: if INFO = -k, the k-th argument had an illegal value
95
97 A rough bound on x is computed; if that is less than overflow, STRSV is
98 called, otherwise, specific code is used which checks for possible
99 overflow or divide-by-zero at every operation.
100
101 A columnwise scheme is used for solving A*x = b. The basic algorithm
102 if A is lower triangular is
103
104 x[1:n] := b[1:n]
105 for j = 1, ..., n
106 x(j) := x(j) / A(j,j)
107 x[j+1:n] := x[j+1:n] - x(j) * A[j+1:n,j]
108 end
109
110 Define bounds on the components of x after j iterations of the loop:
111 M(j) = bound on x[1:j]
112 G(j) = bound on x[j+1:n]
113 Initially, let M(0) = 0 and G(0) = max{x(i), i=1,...,n}.
114
115 Then for iteration j+1 we have
116 M(j+1) <= G(j) / | A(j+1,j+1) |
117 G(j+1) <= G(j) + M(j+1) * | A[j+2:n,j+1] |
118 <= G(j) ( 1 + CNORM(j+1) / | A(j+1,j+1) | )
119
120 where CNORM(j+1) is greater than or equal to the infinity-norm of col‐
121 umn j+1 of A, not counting the diagonal. Hence
122
123 G(j) <= G(0) product ( 1 + CNORM(i) / | A(i,i) | )
124 1<=i<=j
125 and
126
127 |x(j)| <= ( G(0) / |A(j,j)| ) product ( 1 + CNORM(i) / |A(i,i)| )
128 1<=i< j
129
130 Since |x(j)| <= M(j), we use the Level 2 BLAS routine STRSV if the
131 reciprocal of the largest M(j), j=1,..,n, is larger than
132 max(underflow, 1/overflow).
133
134 The bound on x(j) is also used to determine when a step in the column‐
135 wise method can be performed without fear of overflow. If the computed
136 bound is greater than a large constant, x is scaled to prevent over‐
137 flow, but if the bound overflows, x is set to 0, x(j) to 1, and scale
138 to 0, and a non-trivial solution to A*x = 0 is found.
139
140 Similarly, a row-wise scheme is used to solve A'*x = b. The basic
141 algorithm for A upper triangular is
142
143 for j = 1, ..., n
144 x(j) := ( b(j) - A[1:j-1,j]' * x[1:j-1] ) / A(j,j)
145 end
146
147 We simultaneously compute two bounds
148 G(j) = bound on ( b(i) - A[1:i-1,i]' * x[1:i-1] ), 1<=i<=j
149 M(j) = bound on x(i), 1<=i<=j
150
151 The initial values are G(0) = 0, M(0) = max{b(i), i=1,..,n}, and we add
152 the constraint G(j) >= G(j-1) and M(j) >= M(j-1) for j >= 1. Then the
153 bound on x(j) is
154
155 M(j) <= M(j-1) * ( 1 + CNORM(j) ) / | A(j,j) |
156
157 <= M(0) * product ( ( 1 + CNORM(i) ) / |A(i,i)| )
158 1<=i<=j
159
160 and we can safely call STRSV if 1/M(n) and 1/G(n) are both greater than
161 max(underflow, 1/overflow).
162
163
164
165
166 LAPACK auxiliary routine (versionNo3v.e1m)ber 2006 SLATRS(1)