LAPACK  3.10.0 LAPACK: Linear Algebra PACKage
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
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[out] WORK
130 *> \verbatim
131 *> WORK is COMPLEX*16 array, dimension (2*N).
132 *> Workspace.
133 *> \endverbatim
134 *>
135 *> \param[out] 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 *> \ingroup complex16GBcomputational
150 *
151 * =====================================================================
152  DOUBLE PRECISION FUNCTION zla_gbrcond_x( TRANS, N, KL, KU, AB,
153  \$ LDAB, AFB, LDAFB, IPIV,
154  \$ X, INFO, WORK, RWORK )
155 *
156 * -- LAPACK computational routine --
157 * -- LAPACK is a software package provided by Univ. of Tennessee, --
158 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
159 *
160 * .. Scalar Arguments ..
161  CHARACTER trans
162  INTEGER n, kl, ku, kd, ke, ldab, ldafb, info
163 * ..
164 * .. Array Arguments ..
165  INTEGER ipiv( * )
166  COMPLEX*16 ab( ldab, * ), afb( ldafb, * ), work( * ),
167  \$ x( * )
168  DOUBLE PRECISION rwork( * )
169 *
170 *
171 * =====================================================================
172 *
173 * .. Local Scalars ..
174  LOGICAL notrans
175  INTEGER kase, i, j
176  DOUBLE PRECISION ainvnm, anorm, tmp
177  COMPLEX*16 zdum
178 * ..
179 * .. Local Arrays ..
180  INTEGER isave( 3 )
181 * ..
182 * .. External Functions ..
183  LOGICAL lsame
184  EXTERNAL lsame
185 * ..
186 * .. External Subroutines ..
187  EXTERNAL zlacn2, zgbtrs, xerbla
188 * ..
189 * .. Intrinsic Functions ..
190  INTRINSIC abs, max
191 * ..
192 * .. Statement Functions ..
193  DOUBLE PRECISION cabs1
194 * ..
195 * .. Statement Function Definitions ..
196  cabs1( zdum ) = abs( dble( zdum ) ) + abs( dimag( zdum ) )
197 * ..
198 * .. Executable Statements ..
199 *
200  zla_gbrcond_x = 0.0d+0
201 *
202  info = 0
203  notrans = lsame( trans, 'N' )
204  IF ( .NOT. notrans .AND. .NOT. lsame(trans, 'T') .AND. .NOT.
205  \$ lsame( trans, 'C' ) ) THEN
206  info = -1
207  ELSE IF( n.LT.0 ) THEN
208  info = -2
209  ELSE IF( kl.LT.0 .OR. kl.GT.n-1 ) THEN
210  info = -3
211  ELSE IF( ku.LT.0 .OR. ku.GT.n-1 ) THEN
212  info = -4
213  ELSE IF( ldab.LT.kl+ku+1 ) THEN
214  info = -6
215  ELSE IF( ldafb.LT.2*kl+ku+1 ) THEN
216  info = -8
217  END IF
218  IF( info.NE.0 ) THEN
219  CALL xerbla( 'ZLA_GBRCOND_X', -info )
220  RETURN
221  END IF
222 *
223 * Compute norm of op(A)*op2(C).
224 *
225  kd = ku + 1
226  ke = kl + 1
227  anorm = 0.0d+0
228  IF ( notrans ) THEN
229  DO i = 1, n
230  tmp = 0.0d+0
231  DO j = max( i-kl, 1 ), min( i+ku, n )
232  tmp = tmp + cabs1( ab( kd+i-j, j) * x( j ) )
233  END DO
234  rwork( i ) = tmp
235  anorm = max( anorm, tmp )
236  END DO
237  ELSE
238  DO i = 1, n
239  tmp = 0.0d+0
240  DO j = max( i-kl, 1 ), min( i+ku, n )
241  tmp = tmp + cabs1( ab( ke-i+j, i ) * x( j ) )
242  END DO
243  rwork( i ) = tmp
244  anorm = max( anorm, tmp )
245  END DO
246  END IF
247 *
248 * Quick return if possible.
249 *
250  IF( n.EQ.0 ) THEN
251  zla_gbrcond_x = 1.0d+0
252  RETURN
253  ELSE IF( anorm .EQ. 0.0d+0 ) THEN
254  RETURN
255  END IF
256 *
257 * Estimate the norm of inv(op(A)).
258 *
259  ainvnm = 0.0d+0
260 *
261  kase = 0
262  10 CONTINUE
263  CALL zlacn2( n, work( n+1 ), work, ainvnm, kase, isave )
264  IF( kase.NE.0 ) THEN
265  IF( kase.EQ.2 ) THEN
266 *
267 * Multiply by R.
268 *
269  DO i = 1, n
270  work( i ) = work( i ) * rwork( i )
271  END DO
272 *
273  IF ( notrans ) THEN
274  CALL zgbtrs( 'No transpose', n, kl, ku, 1, afb, ldafb,
275  \$ ipiv, work, n, info )
276  ELSE
277  CALL zgbtrs( 'Conjugate transpose', n, kl, ku, 1, afb,
278  \$ ldafb, ipiv, work, n, info )
279  ENDIF
280 *
281 * Multiply by inv(X).
282 *
283  DO i = 1, n
284  work( i ) = work( i ) / x( i )
285  END DO
286  ELSE
287 *
288 * Multiply by inv(X**H).
289 *
290  DO i = 1, n
291  work( i ) = work( i ) / x( i )
292  END DO
293 *
294  IF ( notrans ) THEN
295  CALL zgbtrs( 'Conjugate transpose', n, kl, ku, 1, afb,
296  \$ ldafb, ipiv, work, n, info )
297  ELSE
298  CALL zgbtrs( 'No transpose', n, kl, ku, 1, afb, ldafb,
299  \$ ipiv, work, n, info )
300  END IF
301 *
302 * Multiply by R.
303 *
304  DO i = 1, n
305  work( i ) = work( i ) * rwork( i )
306  END DO
307  END IF
308  GO TO 10
309  END IF
310 *
311 * Compute the estimate of the reciprocal condition number.
312 *
313  IF( ainvnm .NE. 0.0d+0 )
314  \$ zla_gbrcond_x = 1.0d+0 / ainvnm
315 *
316  RETURN
317 *
318 * End of ZLA_GBRCOND_X
319 *
320  END
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:60
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:53
double precision function zla_gbrcond_x(TRANS, N, KL, KU, AB, LDAB, AFB, LDAFB, IPIV, X, INFO, WORK, RWORK)
ZLA_GBRCOND_X computes the infinity norm condition number of op(A)*diag(x) for general banded matrice...
subroutine zgbtrs(TRANS, N, KL, KU, NRHS, AB, LDAB, IPIV, B, LDB, INFO)
ZGBTRS
Definition: zgbtrs.f:138
subroutine zlacn2(N, V, X, EST, KASE, ISAVE)
ZLACN2 estimates the 1-norm of a square matrix, using reverse communication for evaluating matrix-vec...
Definition: zlacn2.f:133