LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
cla_gercond_x.f
Go to the documentation of this file.
1*> \brief \b CLA_GERCOND_X computes the infinity norm condition number of op(A)*diag(x) for general matrices.
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download CLA_GERCOND_X + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/cla_gercond_x.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/cla_gercond_x.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cla_gercond_x.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* REAL FUNCTION CLA_GERCOND_X( TRANS, N, A, LDA, AF, LDAF, IPIV, X,
20* INFO, WORK, RWORK )
21*
22* .. Scalar Arguments ..
23* CHARACTER TRANS
24* INTEGER N, LDA, LDAF, INFO
25* ..
26* .. Array Arguments ..
27* INTEGER IPIV( * )
28* COMPLEX A( LDA, * ), AF( LDAF, * ), WORK( * ), X( * )
29* REAL RWORK( * )
30* ..
31*
32*
33*> \par Purpose:
34* =============
35*>
36*> \verbatim
37*>
38*>
39*> CLA_GERCOND_X computes the infinity norm condition number of
40*> op(A) * diag(X) where X is a COMPLEX vector.
41*> \endverbatim
42*
43* Arguments:
44* ==========
45*
46*> \param[in] TRANS
47*> \verbatim
48*> TRANS is CHARACTER*1
49*> Specifies the form of the system of equations:
50*> = 'N': A * X = B (No transpose)
51*> = 'T': A**T * X = B (Transpose)
52*> = 'C': A**H * X = B (Conjugate Transpose = Transpose)
53*> \endverbatim
54*>
55*> \param[in] N
56*> \verbatim
57*> N is INTEGER
58*> The number of linear equations, i.e., the order of the
59*> matrix A. N >= 0.
60*> \endverbatim
61*>
62*> \param[in] A
63*> \verbatim
64*> A is COMPLEX array, dimension (LDA,N)
65*> On entry, the N-by-N matrix A.
66*> \endverbatim
67*>
68*> \param[in] LDA
69*> \verbatim
70*> LDA is INTEGER
71*> The leading dimension of the array A. LDA >= max(1,N).
72*> \endverbatim
73*>
74*> \param[in] AF
75*> \verbatim
76*> AF is COMPLEX array, dimension (LDAF,N)
77*> The factors L and U from the factorization
78*> A = P*L*U as computed by CGETRF.
79*> \endverbatim
80*>
81*> \param[in] LDAF
82*> \verbatim
83*> LDAF is INTEGER
84*> The leading dimension of the array AF. LDAF >= max(1,N).
85*> \endverbatim
86*>
87*> \param[in] IPIV
88*> \verbatim
89*> IPIV is INTEGER array, dimension (N)
90*> The pivot indices from the factorization A = P*L*U
91*> as computed by CGETRF; row i of the matrix was interchanged
92*> with row IPIV(i).
93*> \endverbatim
94*>
95*> \param[in] X
96*> \verbatim
97*> X is COMPLEX array, dimension (N)
98*> The vector X in the formula op(A) * diag(X).
99*> \endverbatim
100*>
101*> \param[out] INFO
102*> \verbatim
103*> INFO is INTEGER
104*> = 0: Successful exit.
105*> i > 0: The ith argument is invalid.
106*> \endverbatim
107*>
108*> \param[out] WORK
109*> \verbatim
110*> WORK is COMPLEX array, dimension (2*N).
111*> Workspace.
112*> \endverbatim
113*>
114*> \param[out] RWORK
115*> \verbatim
116*> RWORK is REAL array, dimension (N).
117*> Workspace.
118*> \endverbatim
119*
120* Authors:
121* ========
122*
123*> \author Univ. of Tennessee
124*> \author Univ. of California Berkeley
125*> \author Univ. of Colorado Denver
126*> \author NAG Ltd.
127*
128*> \ingroup la_gercond
129*
130* =====================================================================
131 REAL function cla_gercond_x( trans, n, a, lda, af, ldaf, ipiv,
132 $ x,
133 $ info, work, rwork )
134*
135* -- LAPACK computational routine --
136* -- LAPACK is a software package provided by Univ. of Tennessee, --
137* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
138*
139* .. Scalar Arguments ..
140 CHARACTER trans
141 INTEGER n, lda, ldaf, info
142* ..
143* .. Array Arguments ..
144 INTEGER ipiv( * )
145 COMPLEX a( lda, * ), af( ldaf, * ), work( * ), x( * )
146 REAL rwork( * )
147* ..
148*
149* =====================================================================
150*
151* .. Local Scalars ..
152 LOGICAL notrans
153 INTEGER kase
154 REAL ainvnm, anorm, tmp
155 INTEGER i, j
156 COMPLEX zdum
157* ..
158* .. Local Arrays ..
159 INTEGER isave( 3 )
160* ..
161* .. External Functions ..
162 LOGICAL lsame
163 EXTERNAL lsame
164* ..
165* .. External Subroutines ..
166 EXTERNAL clacn2, cgetrs, xerbla
167* ..
168* .. Intrinsic Functions ..
169 INTRINSIC abs, max, real, aimag
170* ..
171* .. Statement Functions ..
172 REAL cabs1
173* ..
174* .. Statement Function Definitions ..
175 cabs1( zdum ) = abs( real( zdum ) ) + abs( aimag( zdum ) )
176* ..
177* .. Executable Statements ..
178*
179 cla_gercond_x = 0.0e+0
180*
181 info = 0
182 notrans = lsame( trans, 'N' )
183 IF ( .NOT. notrans .AND. .NOT. lsame( trans, 'T' ) .AND. .NOT.
184 $ lsame( trans, 'C' ) ) THEN
185 info = -1
186 ELSE IF( n.LT.0 ) THEN
187 info = -2
188 ELSE IF( lda.LT.max( 1, n ) ) THEN
189 info = -4
190 ELSE IF( ldaf.LT.max( 1, n ) ) THEN
191 info = -6
192 END IF
193 IF( info.NE.0 ) THEN
194 CALL xerbla( 'CLA_GERCOND_X', -info )
195 RETURN
196 END IF
197*
198* Compute norm of op(A)*op2(C).
199*
200 anorm = 0.0
201 IF ( notrans ) THEN
202 DO i = 1, n
203 tmp = 0.0e+0
204 DO j = 1, n
205 tmp = tmp + cabs1( a( i, j ) * x( j ) )
206 END DO
207 rwork( i ) = tmp
208 anorm = max( anorm, tmp )
209 END DO
210 ELSE
211 DO i = 1, n
212 tmp = 0.0e+0
213 DO j = 1, n
214 tmp = tmp + cabs1( a( j, i ) * x( j ) )
215 END DO
216 rwork( i ) = tmp
217 anorm = max( anorm, tmp )
218 END DO
219 END IF
220*
221* Quick return if possible.
222*
223 IF( n.EQ.0 ) THEN
224 cla_gercond_x = 1.0e+0
225 RETURN
226 ELSE IF( anorm .EQ. 0.0e+0 ) THEN
227 RETURN
228 END IF
229*
230* Estimate the norm of inv(op(A)).
231*
232 ainvnm = 0.0e+0
233*
234 kase = 0
235 10 CONTINUE
236 CALL clacn2( n, work( n+1 ), work, ainvnm, kase, isave )
237 IF( kase.NE.0 ) THEN
238 IF( kase.EQ.2 ) THEN
239* Multiply by R.
240 DO i = 1, n
241 work( i ) = work( i ) * rwork( i )
242 END DO
243*
244 IF ( notrans ) THEN
245 CALL cgetrs( 'No transpose', n, 1, af, ldaf, ipiv,
246 $ work, n, info )
247 ELSE
248 CALL cgetrs( 'Conjugate transpose', n, 1, af, ldaf,
249 $ ipiv,
250 $ work, n, info )
251 ENDIF
252*
253* Multiply by inv(X).
254*
255 DO i = 1, n
256 work( i ) = work( i ) / x( i )
257 END DO
258 ELSE
259*
260* Multiply by inv(X**H).
261*
262 DO i = 1, n
263 work( i ) = work( i ) / x( i )
264 END DO
265*
266 IF ( notrans ) THEN
267 CALL cgetrs( 'Conjugate transpose', n, 1, af, ldaf,
268 $ ipiv,
269 $ work, n, info )
270 ELSE
271 CALL cgetrs( 'No transpose', n, 1, af, ldaf, ipiv,
272 $ work, n, info )
273 END IF
274*
275* Multiply by R.
276*
277 DO i = 1, n
278 work( i ) = work( i ) * rwork( i )
279 END DO
280 END IF
281 GO TO 10
282 END IF
283*
284* Compute the estimate of the reciprocal condition number.
285*
286 IF( ainvnm .NE. 0.0e+0 )
287 $ cla_gercond_x = 1.0e+0 / ainvnm
288*
289 RETURN
290*
291* End of CLA_GERCOND_X
292*
293 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine cgetrs(trans, n, nrhs, a, lda, ipiv, b, ldb, info)
CGETRS
Definition cgetrs.f:119
real function cla_gercond_x(trans, n, a, lda, af, ldaf, ipiv, x, info, work, rwork)
CLA_GERCOND_X computes the infinity norm condition number of op(A)*diag(x) for general matrices.
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
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48