PLASMA  2.4.5
PLASMA - Parallel Linear Algebra for Scalable Multi-core Architectures
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
zpocon.f
Go to the documentation of this file.
1  SUBROUTINE zpocon( UPLO, N, A, LDA, ANORM, RCOND, WORK, RWORK,
2  $ info )
3 *
4 * -- LAPACK routine (version 3.2) --
5 * Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
6 * November 2006
7 *
8 * Modified to call ZLACN2 in place of ZLACON, 10 Feb 03, SJH.
9 *
10 * .. Scalar Arguments ..
11  CHARACTER uplo
12  INTEGER info, lda, n
13  DOUBLE PRECISION anorm, rcond
14 * ..
15 * .. Array Arguments ..
16  DOUBLE PRECISION rwork( * )
17  COMPLEX*16 a( lda, * ), work( * )
18 * ..
19 *
20 * Purpose
21 * =======
22 *
23 * ZPOCON estimates the reciprocal of the condition number (in the
24 * 1-norm) of a complex Hermitian positive definite matrix using the
25 * Cholesky factorization A = U**H*U or A = L*L**H computed by ZPOTRF.
26 *
27 * An estimate is obtained for norm(inv(A)), and the reciprocal of the
28 * condition number is computed as RCOND = 1 / (ANORM * norm(inv(A))).
29 *
30 * Arguments
31 * =========
32 *
33 * UPLO (input) CHARACTER*1
34 * = 'U': Upper triangle of A is stored;
35 * = 'L': Lower triangle of A is stored.
36 *
37 * N (input) INTEGER
38 * The order of the matrix A. N >= 0.
39 *
40 * A (input) COMPLEX*16 array, dimension (LDA,N)
41 * The triangular factor U or L from the Cholesky factorization
42 * A = U**H*U or A = L*L**H, as computed by ZPOTRF.
43 *
44 * LDA (input) INTEGER
45 * The leading dimension of the array A. LDA >= max(1,N).
46 *
47 * ANORM (input) DOUBLE PRECISION
48 * The 1-norm (or infinity-norm) of the Hermitian matrix A.
49 *
50 * RCOND (output) DOUBLE PRECISION
51 * The reciprocal of the condition number of the matrix A,
52 * computed as RCOND = 1/(ANORM * AINVNM), where AINVNM is an
53 * estimate of the 1-norm of inv(A) computed in this routine.
54 *
55 * WORK (workspace) COMPLEX*16 array, dimension (2*N)
56 *
57 * RWORK (workspace) DOUBLE PRECISION array, dimension (N)
58 *
59 * INFO (output) INTEGER
60 * = 0: successful exit
61 * < 0: if INFO = -i, the i-th argument had an illegal value
62 *
63 * =====================================================================
64 *
65 * .. Parameters ..
66  DOUBLE PRECISION one, zero
67  parameter( one = 1.0d+0, zero = 0.0d+0 )
68 * ..
69 * .. Local Scalars ..
70  LOGICAL upper
71  CHARACTER normin
72  INTEGER ix, kase
73  DOUBLE PRECISION ainvnm, scale, scalel, scaleu, smlnum
74  COMPLEX*16 zdum
75 * ..
76 * .. Local Arrays ..
77  INTEGER isave( 3 )
78 * ..
79 * .. External Functions ..
80  LOGICAL lsame
81  INTEGER izamax
82  DOUBLE PRECISION dlamch
83  EXTERNAL lsame, izamax, dlamch
84 * ..
85 * .. External Subroutines ..
86  EXTERNAL xerbla, zdrscl, zlacn2, zlatrs
87 * ..
88 * .. Intrinsic Functions ..
89  INTRINSIC abs, dble, dimag, max
90 * ..
91 * .. Statement Functions ..
92  DOUBLE PRECISION cabs1
93 * ..
94 * .. Statement Function definitions ..
95  cabs1( zdum ) = abs( dble( zdum ) ) + abs( dimag( zdum ) )
96 * ..
97 * .. Executable Statements ..
98 *
99 * Test the input parameters.
100 *
101  info = 0
102  upper = lsame( uplo, 'U' )
103  IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
104  info = -1
105  ELSE IF( n.LT.0 ) THEN
106  info = -2
107  ELSE IF( lda.LT.max( 1, n ) ) THEN
108  info = -4
109  ELSE IF( anorm.LT.zero ) THEN
110  info = -5
111  END IF
112  IF( info.NE.0 ) THEN
113  CALL xerbla( 'ZPOCON', -info )
114  return
115  END IF
116 *
117 * Quick return if possible
118 *
119  rcond = zero
120  IF( n.EQ.0 ) THEN
121  rcond = one
122  return
123  ELSE IF( anorm.EQ.zero ) THEN
124  return
125  END IF
126 *
127  smlnum = dlamch( 'Safe minimum' )
128 *
129 * Estimate the 1-norm of inv(A).
130 *
131  kase = 0
132  normin = 'N'
133  10 continue
134  CALL zlacn2( n, work( n+1 ), work, ainvnm, kase, isave )
135  IF( kase.NE.0 ) THEN
136  IF( upper ) THEN
137 *
138 * Multiply by inv(U').
139 *
140  CALL zlatrs( 'Upper', 'Conjugate transpose', 'Non-unit',
141  $ normin, n, a, lda, work, scalel, rwork, info )
142  normin = 'Y'
143 *
144 * Multiply by inv(U).
145 *
146  CALL zlatrs( 'Upper', 'No transpose', 'Non-unit', normin, n,
147  $ a, lda, work, scaleu, rwork, info )
148  ELSE
149 *
150 * Multiply by inv(L).
151 *
152  CALL zlatrs( 'Lower', 'No transpose', 'Non-unit', normin, n,
153  $ a, lda, work, scalel, rwork, info )
154  normin = 'Y'
155 *
156 * Multiply by inv(L').
157 *
158  CALL zlatrs( 'Lower', 'Conjugate transpose', 'Non-unit',
159  $ normin, n, a, lda, work, scaleu, rwork, info )
160  END IF
161 *
162 * Multiply by 1/SCALE if doing so will not cause overflow.
163 *
164  scale = scalel*scaleu
165  IF( scale.NE.one ) THEN
166  ix = izamax( n, work, 1 )
167  IF( scale.LT.cabs1( work( ix ) )*smlnum .OR. scale.EQ.zero )
168  $ go to 20
169  CALL zdrscl( n, scale, work, 1 )
170  END IF
171  go to 10
172  END IF
173 *
174 * Compute the estimate of the reciprocal condition number.
175 *
176  IF( ainvnm.NE.zero )
177  $ rcond = ( one / ainvnm ) / anorm
178 *
179  20 continue
180  return
181 *
182 * End of ZPOCON
183 *
184  END