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