LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
ztbcon.f
Go to the documentation of this file.
1 *> \brief \b ZTBCON
2 *
3 * =========== DOCUMENTATION ===========
4 *
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
7 *
8 *> \htmlonly
9 *> Download ZTBCON + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/ztbcon.f">
11 *> [TGZ]</a>
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/ztbcon.f">
13 *> [ZIP]</a>
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/ztbcon.f">
15 *> [TXT]</a>
16 *> \endhtmlonly
17 *
18 * Definition:
19 * ===========
20 *
21 * SUBROUTINE ZTBCON( NORM, UPLO, DIAG, N, KD, AB, LDAB, RCOND, WORK,
22 * RWORK, INFO )
23 *
24 * .. Scalar Arguments ..
25 * CHARACTER DIAG, NORM, UPLO
26 * INTEGER INFO, KD, LDAB, N
27 * DOUBLE PRECISION RCOND
28 * ..
29 * .. Array Arguments ..
30 * DOUBLE PRECISION RWORK( * )
31 * COMPLEX*16 AB( LDAB, * ), WORK( * )
32 * ..
33 *
34 *
35 *> \par Purpose:
36 * =============
37 *>
38 *> \verbatim
39 *>
40 *> ZTBCON estimates the reciprocal of the condition number of a
41 *> triangular band matrix A, in either the 1-norm or the infinity-norm.
42 *>
43 *> The norm of A is computed and an estimate is obtained for
44 *> norm(inv(A)), then the reciprocal of the condition number is
45 *> computed as
46 *> RCOND = 1 / ( norm(A) * norm(inv(A)) ).
47 *> \endverbatim
48 *
49 * Arguments:
50 * ==========
51 *
52 *> \param[in] NORM
53 *> \verbatim
54 *> NORM is CHARACTER*1
55 *> Specifies whether the 1-norm condition number or the
56 *> infinity-norm condition number is required:
57 *> = '1' or 'O': 1-norm;
58 *> = 'I': Infinity-norm.
59 *> \endverbatim
60 *>
61 *> \param[in] UPLO
62 *> \verbatim
63 *> UPLO is CHARACTER*1
64 *> = 'U': A is upper triangular;
65 *> = 'L': A is lower triangular.
66 *> \endverbatim
67 *>
68 *> \param[in] DIAG
69 *> \verbatim
70 *> DIAG is CHARACTER*1
71 *> = 'N': A is non-unit triangular;
72 *> = 'U': A is unit triangular.
73 *> \endverbatim
74 *>
75 *> \param[in] N
76 *> \verbatim
77 *> N is INTEGER
78 *> The order of the matrix A. N >= 0.
79 *> \endverbatim
80 *>
81 *> \param[in] KD
82 *> \verbatim
83 *> KD is INTEGER
84 *> The number of superdiagonals or subdiagonals of the
85 *> triangular band matrix A. KD >= 0.
86 *> \endverbatim
87 *>
88 *> \param[in] AB
89 *> \verbatim
90 *> AB is COMPLEX*16 array, dimension (LDAB,N)
91 *> The upper or lower triangular band matrix A, stored in the
92 *> first kd+1 rows of the array. The j-th column of A is stored
93 *> in the j-th column of the array AB as follows:
94 *> if UPLO = 'U', AB(kd+1+i-j,j) = A(i,j) for max(1,j-kd)<=i<=j;
95 *> if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(n,j+kd).
96 *> If DIAG = 'U', the diagonal elements of A are not referenced
97 *> and are assumed to be 1.
98 *> \endverbatim
99 *>
100 *> \param[in] LDAB
101 *> \verbatim
102 *> LDAB is INTEGER
103 *> The leading dimension of the array AB. LDAB >= KD+1.
104 *> \endverbatim
105 *>
106 *> \param[out] RCOND
107 *> \verbatim
108 *> RCOND is DOUBLE PRECISION
109 *> The reciprocal of the condition number of the matrix A,
110 *> computed as RCOND = 1/(norm(A) * norm(inv(A))).
111 *> \endverbatim
112 *>
113 *> \param[out] WORK
114 *> \verbatim
115 *> WORK is COMPLEX*16 array, dimension (2*N)
116 *> \endverbatim
117 *>
118 *> \param[out] RWORK
119 *> \verbatim
120 *> RWORK is DOUBLE PRECISION array, dimension (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 *> \endverbatim
129 *
130 * Authors:
131 * ========
132 *
133 *> \author Univ. of Tennessee
134 *> \author Univ. of California Berkeley
135 *> \author Univ. of Colorado Denver
136 *> \author NAG Ltd.
137 *
138 *> \date November 2011
139 *
140 *> \ingroup complex16OTHERcomputational
141 *
142 * =====================================================================
143  SUBROUTINE ztbcon( NORM, UPLO, DIAG, N, KD, AB, LDAB, RCOND, WORK,
144  $ rwork, info )
145 *
146 * -- LAPACK computational routine (version 3.4.0) --
147 * -- LAPACK is a software package provided by Univ. of Tennessee, --
148 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
149 * November 2011
150 *
151 * .. Scalar Arguments ..
152  CHARACTER DIAG, NORM, UPLO
153  INTEGER INFO, KD, LDAB, N
154  DOUBLE PRECISION RCOND
155 * ..
156 * .. Array Arguments ..
157  DOUBLE PRECISION RWORK( * )
158  COMPLEX*16 AB( ldab, * ), WORK( * )
159 * ..
160 *
161 * =====================================================================
162 *
163 * .. Parameters ..
164  DOUBLE PRECISION ONE, ZERO
165  parameter ( one = 1.0d+0, zero = 0.0d+0 )
166 * ..
167 * .. Local Scalars ..
168  LOGICAL NOUNIT, ONENRM, UPPER
169  CHARACTER NORMIN
170  INTEGER IX, KASE, KASE1
171  DOUBLE PRECISION AINVNM, ANORM, SCALE, SMLNUM, XNORM
172  COMPLEX*16 ZDUM
173 * ..
174 * .. Local Arrays ..
175  INTEGER ISAVE( 3 )
176 * ..
177 * .. External Functions ..
178  LOGICAL LSAME
179  INTEGER IZAMAX
180  DOUBLE PRECISION DLAMCH, ZLANTB
181  EXTERNAL lsame, izamax, dlamch, zlantb
182 * ..
183 * .. External Subroutines ..
184  EXTERNAL xerbla, zdrscl, zlacn2, zlatbs
185 * ..
186 * .. Intrinsic Functions ..
187  INTRINSIC abs, dble, dimag, max
188 * ..
189 * .. Statement Functions ..
190  DOUBLE PRECISION CABS1
191 * ..
192 * .. Statement Function definitions ..
193  cabs1( zdum ) = abs( dble( zdum ) ) + abs( dimag( zdum ) )
194 * ..
195 * .. Executable Statements ..
196 *
197 * Test the input parameters.
198 *
199  info = 0
200  upper = lsame( uplo, 'U' )
201  onenrm = norm.EQ.'1' .OR. lsame( norm, 'O' )
202  nounit = lsame( diag, 'N' )
203 *
204  IF( .NOT.onenrm .AND. .NOT.lsame( norm, 'I' ) ) THEN
205  info = -1
206  ELSE IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
207  info = -2
208  ELSE IF( .NOT.nounit .AND. .NOT.lsame( diag, 'U' ) ) THEN
209  info = -3
210  ELSE IF( n.LT.0 ) THEN
211  info = -4
212  ELSE IF( kd.LT.0 ) THEN
213  info = -5
214  ELSE IF( ldab.LT.kd+1 ) THEN
215  info = -7
216  END IF
217  IF( info.NE.0 ) THEN
218  CALL xerbla( 'ZTBCON', -info )
219  RETURN
220  END IF
221 *
222 * Quick return if possible
223 *
224  IF( n.EQ.0 ) THEN
225  rcond = one
226  RETURN
227  END IF
228 *
229  rcond = zero
230  smlnum = dlamch( 'Safe minimum' )*dble( max( n, 1 ) )
231 *
232 * Compute the 1-norm of the triangular matrix A or A**H.
233 *
234  anorm = zlantb( norm, uplo, diag, n, kd, ab, ldab, rwork )
235 *
236 * Continue only if ANORM > 0.
237 *
238  IF( anorm.GT.zero ) THEN
239 *
240 * Estimate the 1-norm of the inverse of A.
241 *
242  ainvnm = zero
243  normin = 'N'
244  IF( onenrm ) THEN
245  kase1 = 1
246  ELSE
247  kase1 = 2
248  END IF
249  kase = 0
250  10 CONTINUE
251  CALL zlacn2( n, work( n+1 ), work, ainvnm, kase, isave )
252  IF( kase.NE.0 ) THEN
253  IF( kase.EQ.kase1 ) THEN
254 *
255 * Multiply by inv(A).
256 *
257  CALL zlatbs( uplo, 'No transpose', diag, normin, n, kd,
258  $ ab, ldab, work, scale, rwork, info )
259  ELSE
260 *
261 * Multiply by inv(A**H).
262 *
263  CALL zlatbs( uplo, 'Conjugate transpose', diag, normin,
264  $ n, kd, ab, ldab, work, scale, rwork, info )
265  END IF
266  normin = 'Y'
267 *
268 * Multiply by 1/SCALE if doing so will not cause overflow.
269 *
270  IF( scale.NE.one ) THEN
271  ix = izamax( n, work, 1 )
272  xnorm = cabs1( work( ix ) )
273  IF( scale.LT.xnorm*smlnum .OR. scale.EQ.zero )
274  $ GO TO 20
275  CALL zdrscl( n, scale, work, 1 )
276  END IF
277  GO TO 10
278  END IF
279 *
280 * Compute the estimate of the reciprocal condition number.
281 *
282  IF( ainvnm.NE.zero )
283  $ rcond = ( one / anorm ) / ainvnm
284  END IF
285 *
286  20 CONTINUE
287  RETURN
288 *
289 * End of ZTBCON
290 *
291  END
subroutine zdrscl(N, SA, SX, INCX)
ZDRSCL multiplies a vector by the reciprocal of a real scalar.
Definition: zdrscl.f:86
subroutine ztbcon(NORM, UPLO, DIAG, N, KD, AB, LDAB, RCOND, WORK, RWORK, INFO)
ZTBCON
Definition: ztbcon.f:145
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine zlacn2(N, V, X, EST, KASE, ISAVE)
ZLACN2 estimates the 1-norm of a square matrix, using reverse communication for evaluating matrix-vec...
Definition: zlacn2.f:135
subroutine zlatbs(UPLO, TRANS, DIAG, NORMIN, N, KD, AB, LDAB, X, SCALE, CNORM, INFO)
ZLATBS solves a triangular banded system of equations.
Definition: zlatbs.f:245