ScaLAPACK 2.1  2.1
ScaLAPACK: Scalable Linear Algebra PACKage
zdttrsv.f
Go to the documentation of this file.
1  SUBROUTINE zdttrsv( UPLO, TRANS, N, NRHS, DL, D, DU,
2  $ B, LDB, INFO )
3 *
4 * -- ScaLAPACK auxiliary routine (version 2.0) --
5 * Univ. of Tennessee, Univ. of California Berkeley, Univ. of Colorado Denver
6 *
7 * Written by Andrew J. Cleary, University of Tennessee.
8 * August, 1996.
9 * Modified from ZGTTRS:
10 * -- LAPACK routine (preliminary version) --
11 * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
12 * Courant Institute, Argonne National Lab, and Rice University
13 *
14 * .. Scalar Arguments ..
15  CHARACTER UPLO, TRANS
16  INTEGER INFO, LDB, N, NRHS
17 * ..
18 * .. Array Arguments ..
19  COMPLEX*16 B( LDB, * ), D( * ), DL( * ), DU( * )
20 * ..
21 *
22 * Purpose
23 * =======
24 *
25 * ZDTTRSV solves one of the systems of equations
26 * L * X = B, L**T * X = B, or L**H * X = B,
27 * U * X = B, U**T * X = B, or U**H * X = B,
28 * with factors of the tridiagonal matrix A from the LU factorization
29 * computed by ZDTTRF.
30 *
31 * Arguments
32 * =========
33 *
34 * UPLO (input) CHARACTER*1
35 * Specifies whether to solve with L or U.
36 *
37 * TRANS (input) CHARACTER
38 * Specifies the form of the system of equations:
39 * = 'N': A * X = B (No transpose)
40 * = 'T': A**T * X = B (Transpose)
41 * = 'C': A**H * X = B (Conjugate transpose)
42 *
43 * N (input) INTEGER
44 * The order of the matrix A. N >= 0.
45 *
46 * NRHS (input) INTEGER
47 * The number of right hand sides, i.e., the number of columns
48 * of the matrix B. NRHS >= 0.
49 *
50 * DL (input) COMPLEX array, dimension (N-1)
51 * The (n-1) multipliers that define the matrix L from the
52 * LU factorization of A.
53 *
54 * D (input) COMPLEX array, dimension (N)
55 * The n diagonal elements of the upper triangular matrix U from
56 * the LU factorization of A.
57 *
58 * DU (input) COMPLEX array, dimension (N-1)
59 * The (n-1) elements of the first superdiagonal of U.
60 *
61 * B (input/output) COMPLEX array, dimension (LDB,NRHS)
62 * On entry, the right hand side matrix B.
63 * On exit, B is overwritten by the solution matrix X.
64 *
65 * LDB (input) INTEGER
66 * The leading dimension of the array B. LDB >= max(1,N).
67 *
68 * INFO (output) INTEGER
69 * = 0: successful exit
70 * < 0: if INFO = -i, the i-th argument had an illegal value
71 *
72 * =====================================================================
73 *
74 * .. Local Scalars ..
75  LOGICAL LOWER, NOTRAN
76  INTEGER I, J
77 * ..
78 * .. External Functions ..
79  LOGICAL LSAME
80  EXTERNAL lsame
81 * ..
82 * .. External Subroutines ..
83  EXTERNAL xerbla
84 * ..
85 * .. Intrinsic Functions ..
86  INTRINSIC conjg, max
87 * ..
88 * .. Executable Statements ..
89 *
90  info = 0
91  notran = lsame( trans, 'N' )
92  lower = lsame( uplo, 'L' )
93  IF( .NOT.lower .AND. .NOT.lsame( uplo, 'U' ) ) THEN
94  info = -1
95  ELSE IF( .NOT.notran .AND. .NOT.lsame( trans, 'T' ) .AND. .NOT.
96  $ lsame( trans, 'C' ) ) THEN
97  info = -2
98  ELSE IF( n.LT.0 ) THEN
99  info = -3
100  ELSE IF( nrhs.LT.0 ) THEN
101  info = -4
102  ELSE IF( ldb.LT.max( n, 1 ) ) THEN
103  info = -9
104  END IF
105  IF( info.NE.0 ) THEN
106  CALL xerbla( 'ZDTTRSV', -info )
107  RETURN
108  END IF
109 *
110 * Quick return if possible
111 *
112  IF( n.EQ.0 .OR. nrhs.EQ.0 )
113  $ RETURN
114 *
115  IF( notran ) THEN
116 *
117  IF( lower ) THEN
118 * Solve L*X = B, overwriting B with X.
119 *
120  DO 35 j = 1, nrhs
121 *
122 * Solve L*x = b.
123 *
124  DO 10 i = 1, n - 1
125  b( i+1, j ) = b( i+1, j ) - dl( i )*b( i, j )
126  10 CONTINUE
127  35 CONTINUE
128 *
129  ELSE
130 * Solve U*x = b.
131 *
132  DO 30 j = 1, nrhs
133  b( n, j ) = b( n, j ) / d( n )
134  IF( n.GT.1 )
135  $ b( n-1, j ) = ( b( n-1, j )-du( n-1 )*b( n, j ) ) /
136  $ d( n-1 )
137  DO 20 i = n - 2, 1, -1
138  b( i, j ) = ( b( i, j )-du( i )*b( i+1, j ) ) / d( i )
139  20 CONTINUE
140  30 CONTINUE
141 *
142  ENDIF
143 *
144  ELSE IF( lsame( trans, 'T' ) ) THEN
145 *
146  IF( .NOT. lower ) THEN
147 * Solve U**T * X = B, overwriting B with X.
148 *
149  DO 65 j = 1, nrhs
150 *
151 * Solve U**T * x = b.
152 *
153  b( 1, j ) = b( 1, j ) / d( 1 )
154  IF( n.GT.1 )
155  $ b( 2, j ) = ( b( 2, j )-du( 1 )*b( 1, j ) ) / d( 2 )
156  DO 40 i = 3, n
157  b( i, j ) = ( b( i, j )-du( i-1 )*b( i-1, j ) ) / d( i )
158  40 CONTINUE
159  65 CONTINUE
160 *
161  ELSE
162 *
163 * Solve L**T * X = B, overwriting B with X.
164  DO 60 j = 1, nrhs
165 *
166 * Solve L**T * x = b.
167 *
168  DO 50 i = n - 1, 1, -1
169  b( i, j ) = b( i, j ) - dl( i )*b( i+1, j )
170  50 CONTINUE
171  60 CONTINUE
172  ENDIF
173  ELSE
174 *
175  IF( .NOT. lower ) THEN
176 * Solve U**H * X = B, overwriting B with X.
177 *
178  DO 95 j = 1, nrhs
179 *
180 * Solve U**H * x = b.
181 *
182  b( 1, j ) = b( 1, j ) / dconjg( d( 1 ) )
183  IF( n.GT.1 )
184  $ b( 2, j ) = ( b( 2, j )-dconjg( du( 1 ) )*b( 1, j ) ) /
185  $ dconjg( d( 2 ) )
186  DO 70 i = 3, n
187  b( i, j ) = ( b( i, j )
188  $ -dconjg( du( i-1 ) )*b( i-1, j ) ) /
189  $ dconjg( d( i ) )
190  70 CONTINUE
191  95 CONTINUE
192 *
193  ELSE
194 *
195 * Solve L**H * X = B, overwriting B with X.
196  DO 90 j = 1, nrhs
197 *
198 * Solve L**H * x = b.
199 *
200  DO 80 i = n - 1, 1, -1
201  b( i, j ) = b( i, j ) - dconjg( dl( i ) )*b( i+1, j )
202  80 CONTINUE
203  90 CONTINUE
204  ENDIF
205  END IF
206 *
207 * End of ZDTTRSV
208 *
209  END
max
#define max(A, B)
Definition: pcgemr.c:180
zdttrsv
subroutine zdttrsv(UPLO, TRANS, N, NRHS, DL, D, DU, B, LDB, INFO)
Definition: zdttrsv.f:3