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