LAPACK  3.10.0
LAPACK: Linear Algebra PACKage
zla_hercond_x.f
Go to the documentation of this file.
1 *> \brief \b ZLA_HERCOND_X computes the infinity norm condition number of op(A)*diag(x) for Hermitian indefinite 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_HERCOND_X + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zla_hercond_x.f">
11 *> [TGZ]</a>
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zla_hercond_x.f">
13 *> [ZIP]</a>
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zla_hercond_x.f">
15 *> [TXT]</a>
16 *> \endhtmlonly
17 *
18 * Definition:
19 * ===========
20 *
21 * DOUBLE PRECISION FUNCTION ZLA_HERCOND_X( UPLO, N, A, LDA, AF,
22 * LDAF, IPIV, X, INFO,
23 * WORK, RWORK )
24 *
25 * .. Scalar Arguments ..
26 * CHARACTER UPLO
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_HERCOND_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] UPLO
49 *> \verbatim
50 *> UPLO is CHARACTER*1
51 *> = 'U': Upper triangle of A is stored;
52 *> = 'L': Lower triangle of A is stored.
53 *> \endverbatim
54 *>
55 *> \param[in] N
56 *> \verbatim
57 *> N is INTEGER
58 *> The number of linear equations, i.e., the order of the
59 *> matrix A. N >= 0.
60 *> \endverbatim
61 *>
62 *> \param[in] A
63 *> \verbatim
64 *> A is COMPLEX*16 array, dimension (LDA,N)
65 *> On entry, the N-by-N matrix A.
66 *> \endverbatim
67 *>
68 *> \param[in] LDA
69 *> \verbatim
70 *> LDA is INTEGER
71 *> The leading dimension of the array A. LDA >= max(1,N).
72 *> \endverbatim
73 *>
74 *> \param[in] AF
75 *> \verbatim
76 *> AF is COMPLEX*16 array, dimension (LDAF,N)
77 *> The block diagonal matrix D and the multipliers used to
78 *> obtain the factor U or L as computed by ZHETRF.
79 *> \endverbatim
80 *>
81 *> \param[in] LDAF
82 *> \verbatim
83 *> LDAF is INTEGER
84 *> The leading dimension of the array AF. LDAF >= max(1,N).
85 *> \endverbatim
86 *>
87 *> \param[in] IPIV
88 *> \verbatim
89 *> IPIV is INTEGER array, dimension (N)
90 *> Details of the interchanges and the block structure of D
91 *> as determined by CHETRF.
92 *> \endverbatim
93 *>
94 *> \param[in] X
95 *> \verbatim
96 *> X is COMPLEX*16 array, dimension (N)
97 *> The vector X in the formula op(A) * diag(X).
98 *> \endverbatim
99 *>
100 *> \param[out] INFO
101 *> \verbatim
102 *> INFO is INTEGER
103 *> = 0: Successful exit.
104 *> i > 0: The ith argument is invalid.
105 *> \endverbatim
106 *>
107 *> \param[out] WORK
108 *> \verbatim
109 *> WORK is COMPLEX*16 array, dimension (2*N).
110 *> Workspace.
111 *> \endverbatim
112 *>
113 *> \param[out] RWORK
114 *> \verbatim
115 *> RWORK is DOUBLE PRECISION array, dimension (N).
116 *> Workspace.
117 *> \endverbatim
118 *
119 * Authors:
120 * ========
121 *
122 *> \author Univ. of Tennessee
123 *> \author Univ. of California Berkeley
124 *> \author Univ. of Colorado Denver
125 *> \author NAG Ltd.
126 *
127 *> \ingroup complex16HEcomputational
128 *
129 * =====================================================================
130  DOUBLE PRECISION FUNCTION zla_hercond_x( UPLO, N, A, LDA, AF,
131  $ LDAF, IPIV, X, INFO,
132  $ WORK, RWORK )
133 *
134 * -- LAPACK computational routine --
135 * -- LAPACK is a software package provided by Univ. of Tennessee, --
136 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
137 *
138 * .. Scalar Arguments ..
139  CHARACTER uplo
140  INTEGER n, lda, ldaf, info
141 * ..
142 * .. Array Arguments ..
143  INTEGER ipiv( * )
144  COMPLEX*16 a( lda, * ), af( ldaf, * ), work( * ), x( * )
145  DOUBLE PRECISION rwork( * )
146 * ..
147 *
148 * =====================================================================
149 *
150 * .. Local Scalars ..
151  INTEGER kase, i, j
152  DOUBLE PRECISION ainvnm, anorm, tmp
153  LOGICAL up, upper
154  COMPLEX*16 zdum
155 * ..
156 * .. Local Arrays ..
157  INTEGER isave( 3 )
158 * ..
159 * .. External Functions ..
160  LOGICAL lsame
161  EXTERNAL lsame
162 * ..
163 * .. External Subroutines ..
164  EXTERNAL zlacn2, zhetrs, xerbla
165 * ..
166 * .. Intrinsic Functions ..
167  INTRINSIC abs, max
168 * ..
169 * .. Statement Functions ..
170  DOUBLE PRECISION cabs1
171 * ..
172 * .. Statement Function Definitions ..
173  cabs1( zdum ) = abs( dble( zdum ) ) + abs( dimag( zdum ) )
174 * ..
175 * .. Executable Statements ..
176 *
177  zla_hercond_x = 0.0d+0
178 *
179  info = 0
180  upper = lsame( uplo, 'U' )
181  IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
182  info = -1
183  ELSE IF ( n.LT.0 ) THEN
184  info = -2
185  ELSE IF( lda.LT.max( 1, n ) ) THEN
186  info = -4
187  ELSE IF( ldaf.LT.max( 1, n ) ) THEN
188  info = -6
189  END IF
190  IF( info.NE.0 ) THEN
191  CALL xerbla( 'ZLA_HERCOND_X', -info )
192  RETURN
193  END IF
194  up = .false.
195  IF ( lsame( uplo, 'U' ) ) up = .true.
196 *
197 * Compute norm of op(A)*op2(C).
198 *
199  anorm = 0.0d+0
200  IF ( up ) THEN
201  DO i = 1, n
202  tmp = 0.0d+0
203  DO j = 1, i
204  tmp = tmp + cabs1( a( j, i ) * x( j ) )
205  END DO
206  DO j = i+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, i
216  tmp = tmp + cabs1( a( i, j ) * x( j ) )
217  END DO
218  DO j = i+1, n
219  tmp = tmp + cabs1( a( j, i ) * x( j ) )
220  END DO
221  rwork( i ) = tmp
222  anorm = max( anorm, tmp )
223  END DO
224  END IF
225 *
226 * Quick return if possible.
227 *
228  IF( n.EQ.0 ) THEN
229  zla_hercond_x = 1.0d+0
230  RETURN
231  ELSE IF( anorm .EQ. 0.0d+0 ) THEN
232  RETURN
233  END IF
234 *
235 * Estimate the norm of inv(op(A)).
236 *
237  ainvnm = 0.0d+0
238 *
239  kase = 0
240  10 CONTINUE
241  CALL zlacn2( n, work( n+1 ), work, ainvnm, kase, isave )
242  IF( kase.NE.0 ) THEN
243  IF( kase.EQ.2 ) THEN
244 *
245 * Multiply by R.
246 *
247  DO i = 1, n
248  work( i ) = work( i ) * rwork( i )
249  END DO
250 *
251  IF ( up ) THEN
252  CALL zhetrs( 'U', n, 1, af, ldaf, ipiv,
253  $ work, n, info )
254  ELSE
255  CALL zhetrs( 'L', n, 1, af, ldaf, ipiv,
256  $ work, n, info )
257  ENDIF
258 *
259 * Multiply by inv(X).
260 *
261  DO i = 1, n
262  work( i ) = work( i ) / x( i )
263  END DO
264  ELSE
265 *
266 * Multiply by inv(X**H).
267 *
268  DO i = 1, n
269  work( i ) = work( i ) / x( i )
270  END DO
271 *
272  IF ( up ) THEN
273  CALL zhetrs( 'U', n, 1, af, ldaf, ipiv,
274  $ work, n, info )
275  ELSE
276  CALL zhetrs( 'L', n, 1, af, ldaf, ipiv,
277  $ work, n, info )
278  END IF
279 *
280 * Multiply by R.
281 *
282  DO i = 1, n
283  work( i ) = work( i ) * rwork( i )
284  END DO
285  END IF
286  GO TO 10
287  END IF
288 *
289 * Compute the estimate of the reciprocal condition number.
290 *
291  IF( ainvnm .NE. 0.0d+0 )
292  $ zla_hercond_x = 1.0d+0 / ainvnm
293 *
294  RETURN
295 *
296 * End of ZLA_HERCOND_X
297 *
298  END
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:60
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:53
double precision function zla_hercond_x(UPLO, N, A, LDA, AF, LDAF, IPIV, X, INFO, WORK, RWORK)
ZLA_HERCOND_X computes the infinity norm condition number of op(A)*diag(x) for Hermitian indefinite m...
subroutine zhetrs(UPLO, N, NRHS, A, LDA, IPIV, B, LDB, INFO)
ZHETRS
Definition: zhetrs.f:120
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