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