LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
ztpcon.f
Go to the documentation of this file.
1*> \brief \b ZTPCON
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download ZTPCON + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/ztpcon.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/ztpcon.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/ztpcon.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE ZTPCON( NORM, UPLO, DIAG, N, AP, RCOND, WORK, RWORK,
20* INFO )
21*
22* .. Scalar Arguments ..
23* CHARACTER DIAG, NORM, UPLO
24* INTEGER INFO, N
25* DOUBLE PRECISION RCOND
26* ..
27* .. Array Arguments ..
28* DOUBLE PRECISION RWORK( * )
29* COMPLEX*16 AP( * ), WORK( * )
30* ..
31*
32*
33*> \par Purpose:
34* =============
35*>
36*> \verbatim
37*>
38*> ZTPCON estimates the reciprocal of the condition number of a packed
39*> triangular 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] AP
80*> \verbatim
81*> AP is COMPLEX*16 array, dimension (N*(N+1)/2)
82*> The upper or lower triangular matrix A, packed columnwise in
83*> a linear array. The j-th column of A is stored in the array
84*> AP as follows:
85*> if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
86*> if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n.
87*> If DIAG = 'U', the diagonal elements of A are not referenced
88*> and are assumed to be 1.
89*> \endverbatim
90*>
91*> \param[out] RCOND
92*> \verbatim
93*> RCOND is DOUBLE PRECISION
94*> The reciprocal of the condition number of the matrix A,
95*> computed as RCOND = 1/(norm(A) * norm(inv(A))).
96*> \endverbatim
97*>
98*> \param[out] WORK
99*> \verbatim
100*> WORK is COMPLEX*16 array, dimension (2*N)
101*> \endverbatim
102*>
103*> \param[out] RWORK
104*> \verbatim
105*> RWORK is DOUBLE PRECISION array, dimension (N)
106*> \endverbatim
107*>
108*> \param[out] INFO
109*> \verbatim
110*> INFO is INTEGER
111*> = 0: successful exit
112*> < 0: if INFO = -i, the i-th argument had an illegal value
113*> \endverbatim
114*
115* Authors:
116* ========
117*
118*> \author Univ. of Tennessee
119*> \author Univ. of California Berkeley
120*> \author Univ. of Colorado Denver
121*> \author NAG Ltd.
122*
123*> \ingroup tpcon
124*
125* =====================================================================
126 SUBROUTINE ztpcon( NORM, UPLO, DIAG, N, AP, RCOND, WORK, RWORK,
127 $ INFO )
128*
129* -- LAPACK computational routine --
130* -- LAPACK is a software package provided by Univ. of Tennessee, --
131* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
132*
133* .. Scalar Arguments ..
134 CHARACTER DIAG, NORM, UPLO
135 INTEGER INFO, N
136 DOUBLE PRECISION RCOND
137* ..
138* .. Array Arguments ..
139 DOUBLE PRECISION RWORK( * )
140 COMPLEX*16 AP( * ), WORK( * )
141* ..
142*
143* =====================================================================
144*
145* .. Parameters ..
146 DOUBLE PRECISION ONE, ZERO
147 parameter( one = 1.0d+0, zero = 0.0d+0 )
148* ..
149* .. Local Scalars ..
150 LOGICAL NOUNIT, ONENRM, UPPER
151 CHARACTER NORMIN
152 INTEGER IX, KASE, KASE1
153 DOUBLE PRECISION AINVNM, ANORM, SCALE, SMLNUM, XNORM
154 COMPLEX*16 ZDUM
155* ..
156* .. Local Arrays ..
157 INTEGER ISAVE( 3 )
158* ..
159* .. External Functions ..
160 LOGICAL LSAME
161 INTEGER IZAMAX
162 DOUBLE PRECISION DLAMCH, ZLANTP
163 EXTERNAL lsame, izamax, dlamch, zlantp
164* ..
165* .. External Subroutines ..
166 EXTERNAL xerbla, zdrscl, zlacn2, zlatps
167* ..
168* .. Intrinsic Functions ..
169 INTRINSIC abs, dble, dimag, max
170* ..
171* .. Statement Functions ..
172 DOUBLE PRECISION CABS1
173* ..
174* .. Statement Function definitions ..
175 cabs1( zdum ) = abs( dble( zdum ) ) + abs( dimag( zdum ) )
176* ..
177* .. Executable Statements ..
178*
179* Test the input parameters.
180*
181 info = 0
182 upper = lsame( uplo, 'U' )
183 onenrm = norm.EQ.'1' .OR. lsame( norm, 'O' )
184 nounit = lsame( diag, 'N' )
185*
186 IF( .NOT.onenrm .AND. .NOT.lsame( norm, 'I' ) ) THEN
187 info = -1
188 ELSE IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
189 info = -2
190 ELSE IF( .NOT.nounit .AND. .NOT.lsame( diag, 'U' ) ) THEN
191 info = -3
192 ELSE IF( n.LT.0 ) THEN
193 info = -4
194 END IF
195 IF( info.NE.0 ) THEN
196 CALL xerbla( 'ZTPCON', -info )
197 RETURN
198 END IF
199*
200* Quick return if possible
201*
202 IF( n.EQ.0 ) THEN
203 rcond = one
204 RETURN
205 END IF
206*
207 rcond = zero
208 smlnum = dlamch( 'Safe minimum' )*dble( max( 1, n ) )
209*
210* Compute the norm of the triangular matrix A.
211*
212 anorm = zlantp( norm, uplo, diag, n, ap, rwork )
213*
214* Continue only if ANORM > 0.
215*
216 IF( anorm.GT.zero ) THEN
217*
218* Estimate the norm of the inverse of A.
219*
220 ainvnm = zero
221 normin = 'N'
222 IF( onenrm ) THEN
223 kase1 = 1
224 ELSE
225 kase1 = 2
226 END IF
227 kase = 0
228 10 CONTINUE
229 CALL zlacn2( n, work( n+1 ), work, ainvnm, kase, isave )
230 IF( kase.NE.0 ) THEN
231 IF( kase.EQ.kase1 ) THEN
232*
233* Multiply by inv(A).
234*
235 CALL zlatps( uplo, 'No transpose', diag, normin, n,
236 $ ap,
237 $ work, scale, rwork, info )
238 ELSE
239*
240* Multiply by inv(A**H).
241*
242 CALL zlatps( uplo, 'Conjugate transpose', diag,
243 $ normin,
244 $ n, ap, work, scale, rwork, info )
245 END IF
246 normin = 'Y'
247*
248* Multiply by 1/SCALE if doing so will not cause overflow.
249*
250 IF( scale.NE.one ) THEN
251 ix = izamax( n, work, 1 )
252 xnorm = cabs1( work( ix ) )
253 IF( scale.LT.xnorm*smlnum .OR. scale.EQ.zero )
254 $ GO TO 20
255 CALL zdrscl( n, scale, work, 1 )
256 END IF
257 GO TO 10
258 END IF
259*
260* Compute the estimate of the reciprocal condition number.
261*
262 IF( ainvnm.NE.zero )
263 $ rcond = ( one / anorm ) / ainvnm
264 END IF
265*
266 20 CONTINUE
267 RETURN
268*
269* End of ZTPCON
270*
271 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
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:131
subroutine zlatps(uplo, trans, diag, normin, n, ap, x, scale, cnorm, info)
ZLATPS solves a triangular system of equations with the matrix held in packed storage.
Definition zlatps.f:229
subroutine zdrscl(n, sa, sx, incx)
ZDRSCL multiplies a vector by the reciprocal of a real scalar.
Definition zdrscl.f:82
subroutine ztpcon(norm, uplo, diag, n, ap, rcond, work, rwork, info)
ZTPCON
Definition ztpcon.f:128