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