LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
cgecon.f
Go to the documentation of this file.
1*> \brief \b CGECON
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download CGECON + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/cgecon.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/cgecon.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgecon.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE CGECON( NORM, N, A, LDA, ANORM, RCOND, WORK, RWORK,
20* INFO )
21*
22* .. Scalar Arguments ..
23* CHARACTER NORM
24* INTEGER INFO, LDA, N
25* REAL ANORM, RCOND
26* ..
27* .. Array Arguments ..
28* REAL RWORK( * )
29* COMPLEX A( LDA, * ), WORK( * )
30* ..
31*
32*
33*> \par Purpose:
34* =============
35*>
36*> \verbatim
37*>
38*> CGECON estimates the reciprocal of the condition number of a general
39*> complex matrix A, in either the 1-norm or the infinity-norm, using
40*> the LU factorization computed by CGETRF.
41*>
42*> An estimate is obtained for norm(inv(A)), and the reciprocal of the
43*> condition number is 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] N
60*> \verbatim
61*> N is INTEGER
62*> The order of the matrix A. N >= 0.
63*> \endverbatim
64*>
65*> \param[in] A
66*> \verbatim
67*> A is COMPLEX array, dimension (LDA,N)
68*> The factors L and U from the factorization A = P*L*U
69*> as computed by CGETRF.
70*> \endverbatim
71*>
72*> \param[in] LDA
73*> \verbatim
74*> LDA is INTEGER
75*> The leading dimension of the array A. LDA >= max(1,N).
76*> \endverbatim
77*>
78*> \param[in] ANORM
79*> \verbatim
80*> ANORM is REAL
81*> If NORM = '1' or 'O', the 1-norm of the original matrix A.
82*> If NORM = 'I', the infinity-norm of the original matrix A.
83*> \endverbatim
84*>
85*> \param[out] RCOND
86*> \verbatim
87*> RCOND is REAL
88*> The reciprocal of the condition number of the matrix A,
89*> computed as RCOND = 1/(norm(A) * norm(inv(A))).
90*> \endverbatim
91*>
92*> \param[out] WORK
93*> \verbatim
94*> WORK is COMPLEX array, dimension (2*N)
95*> \endverbatim
96*>
97*> \param[out] RWORK
98*> \verbatim
99*> RWORK is REAL array, dimension (2*N)
100*> \endverbatim
101*>
102*> \param[out] INFO
103*> \verbatim
104*> INFO is INTEGER
105*> = 0: successful exit
106*> < 0: if INFO = -i, the i-th argument had an illegal value.
107*> NaNs are illegal values for ANORM, and they propagate to
108*> the output parameter RCOND.
109*> Infinity is illegal for ANORM, and it propagates to the output
110*> parameter RCOND as 0.
111*> = 1: if RCOND = NaN, or
112*> RCOND = Inf, or
113*> the computed norm of the inverse of A is 0.
114*> In the latter, RCOND = 0 is returned.
115*> \endverbatim
116*
117* Authors:
118* ========
119*
120*> \author Univ. of Tennessee
121*> \author Univ. of California Berkeley
122*> \author Univ. of Colorado Denver
123*> \author NAG Ltd.
124*
125*> \ingroup gecon
126*
127* =====================================================================
128 SUBROUTINE cgecon( NORM, N, A, LDA, ANORM, RCOND, WORK, RWORK,
129 $ INFO )
130*
131* -- LAPACK computational routine --
132* -- LAPACK is a software package provided by Univ. of Tennessee, --
133* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
134*
135* .. Scalar Arguments ..
136 CHARACTER NORM
137 INTEGER INFO, LDA, N
138 REAL ANORM, RCOND
139* ..
140* .. Array Arguments ..
141 REAL RWORK( * )
142 COMPLEX A( LDA, * ), WORK( * )
143* ..
144*
145* =====================================================================
146*
147* .. Parameters ..
148 REAL ONE, ZERO
149 parameter( one = 1.0e+0, zero = 0.0e+0 )
150* ..
151* .. Local Scalars ..
152 LOGICAL ONENRM
153 CHARACTER NORMIN
154 INTEGER IX, KASE, KASE1
155 REAL AINVNM, SCALE, SL, SMLNUM, SU, HUGEVAL
156 COMPLEX ZDUM
157* ..
158* .. Local Arrays ..
159 INTEGER ISAVE( 3 )
160* ..
161* .. External Functions ..
162 LOGICAL LSAME, SISNAN
163 INTEGER ICAMAX
164 REAL SLAMCH
165 EXTERNAL lsame, icamax, slamch, sisnan
166* ..
167* .. External Subroutines ..
168 EXTERNAL clacn2, clatrs, csrscl, xerbla
169* ..
170* .. Intrinsic Functions ..
171 INTRINSIC abs, aimag, max, real
172* ..
173* .. Statement Functions ..
174 REAL CABS1
175* ..
176* .. Statement Function definitions ..
177 cabs1( zdum ) = abs( real( zdum ) ) + abs( aimag( zdum ) )
178* ..
179* .. Executable Statements ..
180*
181 hugeval = slamch( 'Overflow' )
182*
183* Test the input parameters.
184*
185 info = 0
186 onenrm = norm.EQ.'1' .OR. lsame( norm, 'O' )
187 IF( .NOT.onenrm .AND. .NOT.lsame( norm, 'I' ) ) THEN
188 info = -1
189 ELSE IF( n.LT.0 ) THEN
190 info = -2
191 ELSE IF( lda.LT.max( 1, n ) ) THEN
192 info = -4
193 ELSE IF( anorm.LT.zero ) THEN
194 info = -5
195 END IF
196 IF( info.NE.0 ) THEN
197 CALL xerbla( 'CGECON', -info )
198 RETURN
199 END IF
200*
201* Quick return if possible
202*
203 rcond = zero
204 IF( n.EQ.0 ) THEN
205 rcond = one
206 RETURN
207 ELSE IF( anorm.EQ.zero ) THEN
208 RETURN
209 ELSE IF( sisnan( anorm ) ) THEN
210 rcond = anorm
211 info = -5
212 RETURN
213 ELSE IF( anorm.GT.hugeval ) THEN
214 info = -5
215 RETURN
216 END IF
217*
218 smlnum = slamch( 'Safe minimum' )
219*
220* Estimate the norm of inv(A).
221*
222 ainvnm = zero
223 normin = 'N'
224 IF( onenrm ) THEN
225 kase1 = 1
226 ELSE
227 kase1 = 2
228 END IF
229 kase = 0
230 10 CONTINUE
231 CALL clacn2( n, work( n+1 ), work, ainvnm, kase, isave )
232 IF( kase.NE.0 ) THEN
233 IF( kase.EQ.kase1 ) THEN
234*
235* Multiply by inv(L).
236*
237 CALL clatrs( 'Lower', 'No transpose', 'Unit', normin, n,
238 $ a,
239 $ lda, work, sl, rwork, info )
240*
241* Multiply by inv(U).
242*
243 CALL clatrs( 'Upper', 'No transpose', 'Non-unit', normin,
244 $ n,
245 $ a, lda, work, su, rwork( n+1 ), info )
246 ELSE
247*
248* Multiply by inv(U**H).
249*
250 CALL clatrs( 'Upper', 'Conjugate transpose', 'Non-unit',
251 $ normin, n, a, lda, work, su, rwork( n+1 ),
252 $ info )
253*
254* Multiply by inv(L**H).
255*
256 CALL clatrs( 'Lower', 'Conjugate transpose', 'Unit',
257 $ normin,
258 $ n, a, lda, work, sl, rwork, info )
259 END IF
260*
261* Divide X by 1/(SL*SU) if doing so will not cause overflow.
262*
263 scale = sl*su
264 normin = 'Y'
265 IF( scale.NE.one ) THEN
266 ix = icamax( n, work, 1 )
267 IF( scale.LT.cabs1( work( ix ) )*smlnum .OR. scale.EQ.zero )
268 $ GO TO 20
269 CALL csrscl( n, scale, work, 1 )
270 END IF
271 GO TO 10
272 END IF
273*
274* Compute the estimate of the reciprocal condition number.
275*
276 IF( ainvnm.NE.zero ) THEN
277 rcond = ( one / ainvnm ) / anorm
278 ELSE
279 info = 1
280 RETURN
281 END IF
282*
283* Check for NaNs and Infs
284*
285 IF( sisnan( rcond ) .OR. rcond.GT.hugeval )
286 $ info = 1
287*
288 20 CONTINUE
289 RETURN
290*
291* End of CGECON
292*
293 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine cgecon(norm, n, a, lda, anorm, rcond, work, rwork, info)
CGECON
Definition cgecon.f:130
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 clatrs(uplo, trans, diag, normin, n, a, lda, x, scale, cnorm, info)
CLATRS solves a triangular system of equations with the scale factor set to prevent overflow.
Definition clatrs.f:238
subroutine csrscl(n, sa, sx, incx)
CSRSCL multiplies a vector by the reciprocal of a real scalar.
Definition csrscl.f:82