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