LAPACK  3.10.0
LAPACK: Linear Algebra PACKage
ztrtrs.f
Go to the documentation of this file.
1 *> \brief \b ZTRTRS
2 *
3 * =========== DOCUMENTATION ===========
4 *
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
7 *
8 *> \htmlonly
9 *> Download ZTRTRS + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/ztrtrs.f">
11 *> [TGZ]</a>
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/ztrtrs.f">
13 *> [ZIP]</a>
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/ztrtrs.f">
15 *> [TXT]</a>
16 *> \endhtmlonly
17 *
18 * Definition:
19 * ===========
20 *
21 * SUBROUTINE ZTRTRS( UPLO, TRANS, DIAG, N, NRHS, A, LDA, B, LDB,
22 * INFO )
23 *
24 * .. Scalar Arguments ..
25 * CHARACTER DIAG, TRANS, UPLO
26 * INTEGER INFO, LDA, LDB, N, NRHS
27 * ..
28 * .. Array Arguments ..
29 * COMPLEX*16 A( LDA, * ), B( LDB, * )
30 * ..
31 *
32 *
33 *> \par Purpose:
34 * =============
35 *>
36 *> \verbatim
37 *>
38 *> ZTRTRS solves a triangular system of the form
39 *>
40 *> A * X = B, A**T * X = B, or A**H * X = B,
41 *>
42 *> where A is a triangular matrix of order N, and B is an N-by-NRHS
43 *> matrix. A check is made to verify that A is nonsingular.
44 *> \endverbatim
45 *
46 * Arguments:
47 * ==========
48 *
49 *> \param[in] UPLO
50 *> \verbatim
51 *> UPLO is CHARACTER*1
52 *> = 'U': A is upper triangular;
53 *> = 'L': A is lower triangular.
54 *> \endverbatim
55 *>
56 *> \param[in] TRANS
57 *> \verbatim
58 *> TRANS is CHARACTER*1
59 *> Specifies the form of the system of equations:
60 *> = 'N': A * X = B (No transpose)
61 *> = 'T': A**T * X = B (Transpose)
62 *> = 'C': A**H * X = B (Conjugate transpose)
63 *> \endverbatim
64 *>
65 *> \param[in] DIAG
66 *> \verbatim
67 *> DIAG is CHARACTER*1
68 *> = 'N': A is non-unit triangular;
69 *> = 'U': A is unit triangular.
70 *> \endverbatim
71 *>
72 *> \param[in] N
73 *> \verbatim
74 *> N is INTEGER
75 *> The order of the matrix A. N >= 0.
76 *> \endverbatim
77 *>
78 *> \param[in] NRHS
79 *> \verbatim
80 *> NRHS is INTEGER
81 *> The number of right hand sides, i.e., the number of columns
82 *> of the matrix B. NRHS >= 0.
83 *> \endverbatim
84 *>
85 *> \param[in] A
86 *> \verbatim
87 *> A is COMPLEX*16 array, dimension (LDA,N)
88 *> The triangular matrix A. If UPLO = 'U', the leading N-by-N
89 *> upper triangular part of the array A contains the upper
90 *> triangular matrix, and the strictly lower triangular part of
91 *> A is not referenced. If UPLO = 'L', the leading N-by-N lower
92 *> triangular part of the array A contains the lower triangular
93 *> matrix, and the strictly upper triangular part of A is not
94 *> referenced. If DIAG = 'U', the diagonal elements of A are
95 *> also not referenced and are assumed to be 1.
96 *> \endverbatim
97 *>
98 *> \param[in] LDA
99 *> \verbatim
100 *> LDA is INTEGER
101 *> The leading dimension of the array A. LDA >= max(1,N).
102 *> \endverbatim
103 *>
104 *> \param[in,out] B
105 *> \verbatim
106 *> B is COMPLEX*16 array, dimension (LDB,NRHS)
107 *> On entry, the right hand side matrix B.
108 *> On exit, if INFO = 0, the solution matrix X.
109 *> \endverbatim
110 *>
111 *> \param[in] LDB
112 *> \verbatim
113 *> LDB is INTEGER
114 *> The leading dimension of the array B. LDB >= max(1,N).
115 *> \endverbatim
116 *>
117 *> \param[out] INFO
118 *> \verbatim
119 *> INFO is INTEGER
120 *> = 0: successful exit
121 *> < 0: if INFO = -i, the i-th argument had an illegal value
122 *> > 0: if INFO = i, the i-th diagonal element of A is zero,
123 *> indicating that the matrix is singular and the solutions
124 *> X have not been computed.
125 *> \endverbatim
126 *
127 * Authors:
128 * ========
129 *
130 *> \author Univ. of Tennessee
131 *> \author Univ. of California Berkeley
132 *> \author Univ. of Colorado Denver
133 *> \author NAG Ltd.
134 *
135 *> \ingroup complex16OTHERcomputational
136 *
137 * =====================================================================
138  SUBROUTINE ztrtrs( UPLO, TRANS, DIAG, N, NRHS, A, LDA, B, LDB,
139  $ INFO )
140 *
141 * -- LAPACK computational routine --
142 * -- LAPACK is a software package provided by Univ. of Tennessee, --
143 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
144 *
145 * .. Scalar Arguments ..
146  CHARACTER DIAG, TRANS, UPLO
147  INTEGER INFO, LDA, LDB, N, NRHS
148 * ..
149 * .. Array Arguments ..
150  COMPLEX*16 A( LDA, * ), B( LDB, * )
151 * ..
152 *
153 * =====================================================================
154 *
155 * .. Parameters ..
156  COMPLEX*16 ZERO, ONE
157  parameter( zero = ( 0.0d+0, 0.0d+0 ),
158  $ one = ( 1.0d+0, 0.0d+0 ) )
159 * ..
160 * .. Local Scalars ..
161  LOGICAL NOUNIT
162 * ..
163 * .. External Functions ..
164  LOGICAL LSAME
165  EXTERNAL lsame
166 * ..
167 * .. External Subroutines ..
168  EXTERNAL xerbla, ztrsm
169 * ..
170 * .. Intrinsic Functions ..
171  INTRINSIC max
172 * ..
173 * .. Executable Statements ..
174 *
175 * Test the input parameters.
176 *
177  info = 0
178  nounit = lsame( diag, 'N' )
179  IF( .NOT.lsame( uplo, 'U' ) .AND. .NOT.lsame( uplo, 'L' ) ) THEN
180  info = -1
181  ELSE IF( .NOT.lsame( trans, 'N' ) .AND. .NOT.
182  $ lsame( trans, 'T' ) .AND. .NOT.lsame( trans, 'C' ) ) THEN
183  info = -2
184  ELSE IF( .NOT.nounit .AND. .NOT.lsame( diag, 'U' ) ) THEN
185  info = -3
186  ELSE IF( n.LT.0 ) THEN
187  info = -4
188  ELSE IF( nrhs.LT.0 ) THEN
189  info = -5
190  ELSE IF( lda.LT.max( 1, n ) ) THEN
191  info = -7
192  ELSE IF( ldb.LT.max( 1, n ) ) THEN
193  info = -9
194  END IF
195  IF( info.NE.0 ) THEN
196  CALL xerbla( 'ZTRTRS', -info )
197  RETURN
198  END IF
199 *
200 * Quick return if possible
201 *
202  IF( n.EQ.0 )
203  $ RETURN
204 *
205 * Check for singularity.
206 *
207  IF( nounit ) THEN
208  DO 10 info = 1, n
209  IF( a( info, info ).EQ.zero )
210  $ RETURN
211  10 CONTINUE
212  END IF
213  info = 0
214 *
215 * Solve A * x = b, A**T * x = b, or A**H * x = b.
216 *
217  CALL ztrsm( 'Left', uplo, trans, diag, n, nrhs, one, a, lda, b,
218  $ ldb )
219 *
220  RETURN
221 *
222 * End of ZTRTRS
223 *
224  END
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:60
subroutine ztrsm(SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA, A, LDA, B, LDB)
ZTRSM
Definition: ztrsm.f:180
subroutine ztrtrs(UPLO, TRANS, DIAG, N, NRHS, A, LDA, B, LDB, INFO)
ZTRTRS
Definition: ztrtrs.f:140