LAPACK  3.4.2
LAPACK: Linear Algebra PACKage
 All Files Functions Groups
ctbtrs.f
Go to the documentation of this file.
1 *> \brief \b CTBTRS
2 *
3 * =========== DOCUMENTATION ===========
4 *
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
7 *
8 *> \htmlonly
9 *> Download CTBTRS + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/ctbtrs.f">
11 *> [TGZ]</a>
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/ctbtrs.f">
13 *> [ZIP]</a>
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/ctbtrs.f">
15 *> [TXT]</a>
16 *> \endhtmlonly
17 *
18 * Definition:
19 * ===========
20 *
21 * SUBROUTINE CTBTRS( UPLO, TRANS, DIAG, N, KD, NRHS, AB, LDAB, B,
22 * LDB, INFO )
23 *
24 * .. Scalar Arguments ..
25 * CHARACTER DIAG, TRANS, UPLO
26 * INTEGER INFO, KD, LDAB, LDB, N, NRHS
27 * ..
28 * .. Array Arguments ..
29 * COMPLEX AB( LDAB, * ), B( LDB, * )
30 * ..
31 *
32 *
33 *> \par Purpose:
34 * =============
35 *>
36 *> \verbatim
37 *>
38 *> CTBTRS 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 band matrix of order N, and B is an
43 *> N-by-NRHS 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] KD
79 *> \verbatim
80 *> KD is INTEGER
81 *> The number of superdiagonals or subdiagonals of the
82 *> triangular band matrix A. KD >= 0.
83 *> \endverbatim
84 *>
85 *> \param[in] NRHS
86 *> \verbatim
87 *> NRHS is INTEGER
88 *> The number of right hand sides, i.e., the number of columns
89 *> of the matrix B. NRHS >= 0.
90 *> \endverbatim
91 *>
92 *> \param[in] AB
93 *> \verbatim
94 *> AB is COMPLEX array, dimension (LDAB,N)
95 *> The upper or lower triangular band matrix A, stored in the
96 *> first kd+1 rows of AB. The j-th column of A is stored
97 *> in the j-th column of the array AB as follows:
98 *> if UPLO = 'U', AB(kd+1+i-j,j) = A(i,j) for max(1,j-kd)<=i<=j;
99 *> if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(n,j+kd).
100 *> If DIAG = 'U', the diagonal elements of A are not referenced
101 *> and are assumed to be 1.
102 *> \endverbatim
103 *>
104 *> \param[in] LDAB
105 *> \verbatim
106 *> LDAB is INTEGER
107 *> The leading dimension of the array AB. LDAB >= KD+1.
108 *> \endverbatim
109 *>
110 *> \param[in,out] B
111 *> \verbatim
112 *> B is COMPLEX array, dimension (LDB,NRHS)
113 *> On entry, the right hand side matrix B.
114 *> On exit, if INFO = 0, the solution matrix X.
115 *> \endverbatim
116 *>
117 *> \param[in] LDB
118 *> \verbatim
119 *> LDB is INTEGER
120 *> The leading dimension of the array B. LDB >= max(1,N).
121 *> \endverbatim
122 *>
123 *> \param[out] INFO
124 *> \verbatim
125 *> INFO is INTEGER
126 *> = 0: successful exit
127 *> < 0: if INFO = -i, the i-th argument had an illegal value
128 *> > 0: if INFO = i, the i-th diagonal element of A is zero,
129 *> indicating that the matrix is singular and the
130 *> solutions X have not been computed.
131 *> \endverbatim
132 *
133 * Authors:
134 * ========
135 *
136 *> \author Univ. of Tennessee
137 *> \author Univ. of California Berkeley
138 *> \author Univ. of Colorado Denver
139 *> \author NAG Ltd.
140 *
141 *> \date November 2011
142 *
143 *> \ingroup complexOTHERcomputational
144 *
145 * =====================================================================
146  SUBROUTINE ctbtrs( UPLO, TRANS, DIAG, N, KD, NRHS, AB, LDAB, B,
147  $ ldb, info )
148 *
149 * -- LAPACK computational routine (version 3.4.0) --
150 * -- LAPACK is a software package provided by Univ. of Tennessee, --
151 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
152 * November 2011
153 *
154 * .. Scalar Arguments ..
155  CHARACTER diag, trans, uplo
156  INTEGER info, kd, ldab, ldb, n, nrhs
157 * ..
158 * .. Array Arguments ..
159  COMPLEX ab( ldab, * ), b( ldb, * )
160 * ..
161 *
162 * =====================================================================
163 *
164 * .. Parameters ..
165  COMPLEX zero
166  parameter( zero = ( 0.0e+0, 0.0e+0 ) )
167 * ..
168 * .. Local Scalars ..
169  LOGICAL nounit, upper
170  INTEGER j
171 * ..
172 * .. External Functions ..
173  LOGICAL lsame
174  EXTERNAL lsame
175 * ..
176 * .. External Subroutines ..
177  EXTERNAL ctbsv, xerbla
178 * ..
179 * .. Intrinsic Functions ..
180  INTRINSIC max
181 * ..
182 * .. Executable Statements ..
183 *
184 * Test the input parameters.
185 *
186  info = 0
187  nounit = lsame( diag, 'N' )
188  upper = lsame( uplo, 'U' )
189  IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
190  info = -1
191  ELSE IF( .NOT.lsame( trans, 'N' ) .AND. .NOT.
192  $ lsame( trans, 'T' ) .AND. .NOT.lsame( trans, 'C' ) ) THEN
193  info = -2
194  ELSE IF( .NOT.nounit .AND. .NOT.lsame( diag, 'U' ) ) THEN
195  info = -3
196  ELSE IF( n.LT.0 ) THEN
197  info = -4
198  ELSE IF( kd.LT.0 ) THEN
199  info = -5
200  ELSE IF( nrhs.LT.0 ) THEN
201  info = -6
202  ELSE IF( ldab.LT.kd+1 ) THEN
203  info = -8
204  ELSE IF( ldb.LT.max( 1, n ) ) THEN
205  info = -10
206  END IF
207  IF( info.NE.0 ) THEN
208  CALL xerbla( 'CTBTRS', -info )
209  return
210  END IF
211 *
212 * Quick return if possible
213 *
214  IF( n.EQ.0 )
215  $ return
216 *
217 * Check for singularity.
218 *
219  IF( nounit ) THEN
220  IF( upper ) THEN
221  DO 10 info = 1, n
222  IF( ab( kd+1, info ).EQ.zero )
223  $ return
224  10 continue
225  ELSE
226  DO 20 info = 1, n
227  IF( ab( 1, info ).EQ.zero )
228  $ return
229  20 continue
230  END IF
231  END IF
232  info = 0
233 *
234 * Solve A * X = B, A**T * X = B, or A**H * X = B.
235 *
236  DO 30 j = 1, nrhs
237  CALL ctbsv( uplo, trans, diag, n, kd, ab, ldab, b( 1, j ), 1 )
238  30 continue
239 *
240  return
241 *
242 * End of CTBTRS
243 *
244  END