LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
cppcon.f
Go to the documentation of this file.
1*> \brief \b CPPCON
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download CPPCON + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/cppcon.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/cppcon.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cppcon.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE CPPCON( UPLO, N, AP, ANORM, RCOND, WORK, RWORK, INFO )
20*
21* .. Scalar Arguments ..
22* CHARACTER UPLO
23* INTEGER INFO, N
24* REAL ANORM, RCOND
25* ..
26* .. Array Arguments ..
27* REAL RWORK( * )
28* COMPLEX AP( * ), WORK( * )
29* ..
30*
31*
32*> \par Purpose:
33* =============
34*>
35*> \verbatim
36*>
37*> CPPCON estimates the reciprocal of the condition number (in the
38*> 1-norm) of a complex Hermitian positive definite packed matrix using
39*> the Cholesky factorization A = U**H*U or A = L*L**H computed by
40*> CPPTRF.
41*>
42*> An estimate is obtained for norm(inv(A)), and the reciprocal of the
43*> condition number is computed as RCOND = 1 / (ANORM * norm(inv(A))).
44*> \endverbatim
45*
46* Arguments:
47* ==========
48*
49*> \param[in] UPLO
50*> \verbatim
51*> UPLO is CHARACTER*1
52*> = 'U': Upper triangle of A is stored;
53*> = 'L': Lower triangle of A is stored.
54*> \endverbatim
55*>
56*> \param[in] N
57*> \verbatim
58*> N is INTEGER
59*> The order of the matrix A. N >= 0.
60*> \endverbatim
61*>
62*> \param[in] AP
63*> \verbatim
64*> AP is COMPLEX array, dimension (N*(N+1)/2)
65*> The triangular factor U or L from the Cholesky factorization
66*> A = U**H*U or A = L*L**H, packed columnwise in a linear
67*> array. The j-th column of U or L is stored in the array AP
68*> as follows:
69*> if UPLO = 'U', AP(i + (j-1)*j/2) = U(i,j) for 1<=i<=j;
70*> if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = L(i,j) for j<=i<=n.
71*> \endverbatim
72*>
73*> \param[in] ANORM
74*> \verbatim
75*> ANORM is REAL
76*> The 1-norm (or infinity-norm) of the Hermitian matrix A.
77*> \endverbatim
78*>
79*> \param[out] RCOND
80*> \verbatim
81*> RCOND is REAL
82*> The reciprocal of the condition number of the matrix A,
83*> computed as RCOND = 1/(ANORM * AINVNM), where AINVNM is an
84*> estimate of the 1-norm of inv(A) computed in this routine.
85*> \endverbatim
86*>
87*> \param[out] WORK
88*> \verbatim
89*> WORK is COMPLEX array, dimension (2*N)
90*> \endverbatim
91*>
92*> \param[out] RWORK
93*> \verbatim
94*> RWORK is REAL array, dimension (N)
95*> \endverbatim
96*>
97*> \param[out] INFO
98*> \verbatim
99*> INFO is INTEGER
100*> = 0: successful exit
101*> < 0: if INFO = -i, the i-th argument had an illegal value
102*> \endverbatim
103*
104* Authors:
105* ========
106*
107*> \author Univ. of Tennessee
108*> \author Univ. of California Berkeley
109*> \author Univ. of Colorado Denver
110*> \author NAG Ltd.
111*
112*> \ingroup ppcon
113*
114* =====================================================================
115 SUBROUTINE cppcon( UPLO, N, AP, ANORM, RCOND, WORK, RWORK,
116 $ INFO )
117*
118* -- LAPACK computational routine --
119* -- LAPACK is a software package provided by Univ. of Tennessee, --
120* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
121*
122* .. Scalar Arguments ..
123 CHARACTER UPLO
124 INTEGER INFO, N
125 REAL ANORM, RCOND
126* ..
127* .. Array Arguments ..
128 REAL RWORK( * )
129 COMPLEX AP( * ), WORK( * )
130* ..
131*
132* =====================================================================
133*
134* .. Parameters ..
135 REAL ONE, ZERO
136 parameter( one = 1.0e+0, zero = 0.0e+0 )
137* ..
138* .. Local Scalars ..
139 LOGICAL UPPER
140 CHARACTER NORMIN
141 INTEGER IX, KASE
142 REAL AINVNM, SCALE, SCALEL, SCALEU, SMLNUM
143 COMPLEX ZDUM
144* ..
145* .. Local Arrays ..
146 INTEGER ISAVE( 3 )
147* ..
148* .. External Functions ..
149 LOGICAL LSAME
150 INTEGER ICAMAX
151 REAL SLAMCH
152 EXTERNAL lsame, icamax, slamch
153* ..
154* .. External Subroutines ..
155 EXTERNAL clacn2, clatps, csrscl, xerbla
156* ..
157* .. Intrinsic Functions ..
158 INTRINSIC abs, aimag, real
159* ..
160* .. Statement Functions ..
161 REAL CABS1
162* ..
163* .. Statement Function definitions ..
164 cabs1( zdum ) = abs( real( zdum ) ) + abs( aimag( zdum ) )
165* ..
166* .. Executable Statements ..
167*
168* Test the input parameters.
169*
170 info = 0
171 upper = lsame( uplo, 'U' )
172 IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
173 info = -1
174 ELSE IF( n.LT.0 ) THEN
175 info = -2
176 ELSE IF( anorm.LT.zero ) THEN
177 info = -4
178 END IF
179 IF( info.NE.0 ) THEN
180 CALL xerbla( 'CPPCON', -info )
181 RETURN
182 END IF
183*
184* Quick return if possible
185*
186 rcond = zero
187 IF( n.EQ.0 ) THEN
188 rcond = one
189 RETURN
190 ELSE IF( anorm.EQ.zero ) THEN
191 RETURN
192 END IF
193*
194 smlnum = slamch( 'Safe minimum' )
195*
196* Estimate the 1-norm of the inverse.
197*
198 kase = 0
199 normin = 'N'
200 10 CONTINUE
201 CALL clacn2( n, work( n+1 ), work, ainvnm, kase, isave )
202 IF( kase.NE.0 ) THEN
203 IF( upper ) THEN
204*
205* Multiply by inv(U**H).
206*
207 CALL clatps( 'Upper', 'Conjugate transpose', 'Non-unit',
208 $ normin, n, ap, work, scalel, rwork, info )
209 normin = 'Y'
210*
211* Multiply by inv(U).
212*
213 CALL clatps( 'Upper', 'No transpose', 'Non-unit', normin,
214 $ n,
215 $ ap, work, scaleu, rwork, info )
216 ELSE
217*
218* Multiply by inv(L).
219*
220 CALL clatps( 'Lower', 'No transpose', 'Non-unit', normin,
221 $ n,
222 $ ap, work, scalel, rwork, info )
223 normin = 'Y'
224*
225* Multiply by inv(L**H).
226*
227 CALL clatps( 'Lower', 'Conjugate transpose', 'Non-unit',
228 $ normin, n, ap, work, scaleu, rwork, info )
229 END IF
230*
231* Multiply by 1/SCALE if doing so will not cause overflow.
232*
233 scale = scalel*scaleu
234 IF( scale.NE.one ) THEN
235 ix = icamax( n, work, 1 )
236 IF( scale.LT.cabs1( work( ix ) )*smlnum .OR. scale.EQ.zero )
237 $ GO TO 20
238 CALL csrscl( n, scale, work, 1 )
239 END IF
240 GO TO 10
241 END IF
242*
243* Compute the estimate of the reciprocal condition number.
244*
245 IF( ainvnm.NE.zero )
246 $ rcond = ( one / ainvnm ) / anorm
247*
248 20 CONTINUE
249 RETURN
250*
251* End of CPPCON
252*
253 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 clatps(uplo, trans, diag, normin, n, ap, x, scale, cnorm, info)
CLATPS solves a triangular system of equations with the matrix held in packed storage.
Definition clatps.f:229
subroutine cppcon(uplo, n, ap, anorm, rcond, work, rwork, info)
CPPCON
Definition cppcon.f:117
subroutine csrscl(n, sa, sx, incx)
CSRSCL multiplies a vector by the reciprocal of a real scalar.
Definition csrscl.f:82