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