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