LAPACK  3.4.2
LAPACK: Linear Algebra PACKage
 All Files Functions Groups
zhecon.f
Go to the documentation of this file.
1 *> \brief \b ZHECON
2 *
3 * =========== DOCUMENTATION ===========
4 *
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
7 *
8 *> \htmlonly
9 *> Download ZHECON + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zhecon.f">
11 *> [TGZ]</a>
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zhecon.f">
13 *> [ZIP]</a>
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zhecon.f">
15 *> [TXT]</a>
16 *> \endhtmlonly
17 *
18 * Definition:
19 * ===========
20 *
21 * SUBROUTINE ZHECON( UPLO, N, A, LDA, IPIV, ANORM, RCOND, WORK,
22 * INFO )
23 *
24 * .. Scalar Arguments ..
25 * CHARACTER UPLO
26 * INTEGER INFO, LDA, N
27 * DOUBLE PRECISION ANORM, RCOND
28 * ..
29 * .. Array Arguments ..
30 * INTEGER IPIV( * )
31 * COMPLEX*16 A( LDA, * ), WORK( * )
32 * ..
33 *
34 *
35 *> \par Purpose:
36 * =============
37 *>
38 *> \verbatim
39 *>
40 *> ZHECON estimates the reciprocal of the condition number of a complex
41 *> Hermitian matrix A using the factorization A = U*D*U**H or
42 *> A = L*D*L**H computed by ZHETRF.
43 *>
44 *> An estimate is obtained for norm(inv(A)), and the reciprocal of the
45 *> condition number is computed as RCOND = 1 / (ANORM * norm(inv(A))).
46 *> \endverbatim
47 *
48 * Arguments:
49 * ==========
50 *
51 *> \param[in] UPLO
52 *> \verbatim
53 *> UPLO is CHARACTER*1
54 *> Specifies whether the details of the factorization are stored
55 *> as an upper or lower triangular matrix.
56 *> = 'U': Upper triangular, form is A = U*D*U**H;
57 *> = 'L': Lower triangular, form is A = L*D*L**H.
58 *> \endverbatim
59 *>
60 *> \param[in] N
61 *> \verbatim
62 *> N is INTEGER
63 *> The order of the matrix A. N >= 0.
64 *> \endverbatim
65 *>
66 *> \param[in] A
67 *> \verbatim
68 *> A is COMPLEX*16 array, dimension (LDA,N)
69 *> The block diagonal matrix D and the multipliers used to
70 *> obtain the factor U or L as computed by ZHETRF.
71 *> \endverbatim
72 *>
73 *> \param[in] LDA
74 *> \verbatim
75 *> LDA is INTEGER
76 *> The leading dimension of the array A. LDA >= max(1,N).
77 *> \endverbatim
78 *>
79 *> \param[in] IPIV
80 *> \verbatim
81 *> IPIV is INTEGER array, dimension (N)
82 *> Details of the interchanges and the block structure of D
83 *> as determined by ZHETRF.
84 *> \endverbatim
85 *>
86 *> \param[in] ANORM
87 *> \verbatim
88 *> ANORM is DOUBLE PRECISION
89 *> The 1-norm of the original matrix A.
90 *> \endverbatim
91 *>
92 *> \param[out] RCOND
93 *> \verbatim
94 *> RCOND is DOUBLE PRECISION
95 *> The reciprocal of the condition number of the matrix A,
96 *> computed as RCOND = 1/(ANORM * AINVNM), where AINVNM is an
97 *> estimate of the 1-norm of inv(A) computed in this routine.
98 *> \endverbatim
99 *>
100 *> \param[out] WORK
101 *> \verbatim
102 *> WORK is COMPLEX*16 array, dimension (2*N)
103 *> \endverbatim
104 *>
105 *> \param[out] INFO
106 *> \verbatim
107 *> INFO is INTEGER
108 *> = 0: successful exit
109 *> < 0: if INFO = -i, the i-th argument had an illegal value
110 *> \endverbatim
111 *
112 * Authors:
113 * ========
114 *
115 *> \author Univ. of Tennessee
116 *> \author Univ. of California Berkeley
117 *> \author Univ. of Colorado Denver
118 *> \author NAG Ltd.
119 *
120 *> \date November 2011
121 *
122 *> \ingroup complex16HEcomputational
123 *
124 * =====================================================================
125  SUBROUTINE zhecon( UPLO, N, A, LDA, IPIV, ANORM, RCOND, WORK,
126  $ info )
127 *
128 * -- LAPACK computational routine (version 3.4.0) --
129 * -- LAPACK is a software package provided by Univ. of Tennessee, --
130 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
131 * November 2011
132 *
133 * .. Scalar Arguments ..
134  CHARACTER uplo
135  INTEGER info, lda, n
136  DOUBLE PRECISION anorm, rcond
137 * ..
138 * .. Array Arguments ..
139  INTEGER ipiv( * )
140  COMPLEX*16 a( lda, * ), work( * )
141 * ..
142 *
143 * =====================================================================
144 *
145 * .. Parameters ..
146  DOUBLE PRECISION one, zero
147  parameter( one = 1.0d+0, zero = 0.0d+0 )
148 * ..
149 * .. Local Scalars ..
150  LOGICAL upper
151  INTEGER i, kase
152  DOUBLE PRECISION ainvnm
153 * ..
154 * .. Local Arrays ..
155  INTEGER isave( 3 )
156 * ..
157 * .. External Functions ..
158  LOGICAL lsame
159  EXTERNAL lsame
160 * ..
161 * .. External Subroutines ..
162  EXTERNAL xerbla, zhetrs, zlacn2
163 * ..
164 * .. Intrinsic Functions ..
165  INTRINSIC max
166 * ..
167 * .. Executable Statements ..
168 *
169 * Test the input parameters.
170 *
171  info = 0
172  upper = lsame( uplo, 'U' )
173  IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
174  info = -1
175  ELSE IF( n.LT.0 ) THEN
176  info = -2
177  ELSE IF( lda.LT.max( 1, n ) ) THEN
178  info = -4
179  ELSE IF( anorm.LT.zero ) THEN
180  info = -6
181  END IF
182  IF( info.NE.0 ) THEN
183  CALL xerbla( 'ZHECON', -info )
184  return
185  END IF
186 *
187 * Quick return if possible
188 *
189  rcond = zero
190  IF( n.EQ.0 ) THEN
191  rcond = one
192  return
193  ELSE IF( anorm.LE.zero ) THEN
194  return
195  END IF
196 *
197 * Check that the diagonal matrix D is nonsingular.
198 *
199  IF( upper ) THEN
200 *
201 * Upper triangular storage: examine D from bottom to top
202 *
203  DO 10 i = n, 1, -1
204  IF( ipiv( i ).GT.0 .AND. a( i, i ).EQ.zero )
205  $ return
206  10 continue
207  ELSE
208 *
209 * Lower triangular storage: examine D from top to bottom.
210 *
211  DO 20 i = 1, n
212  IF( ipiv( i ).GT.0 .AND. a( i, i ).EQ.zero )
213  $ return
214  20 continue
215  END IF
216 *
217 * Estimate the 1-norm of the inverse.
218 *
219  kase = 0
220  30 continue
221  CALL zlacn2( n, work( n+1 ), work, ainvnm, kase, isave )
222  IF( kase.NE.0 ) THEN
223 *
224 * Multiply by inv(L*D*L**H) or inv(U*D*U**H).
225 *
226  CALL zhetrs( uplo, n, 1, a, lda, ipiv, work, n, info )
227  go to 30
228  END IF
229 *
230 * Compute the estimate of the reciprocal condition number.
231 *
232  IF( ainvnm.NE.zero )
233  $ rcond = ( one / ainvnm ) / anorm
234 *
235  return
236 *
237 * End of ZHECON
238 *
239  END