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
dpocon.f
Go to the documentation of this file.
1  SUBROUTINE dpocon( UPLO, N, A, LDA, ANORM, RCOND, WORK, IWORK,
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 DLACN2 in place of DLACON, 5 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  INTEGER iwork( * )
17  DOUBLE PRECISION a( lda, * ), work( * )
18 * ..
19 *
20 * Purpose
21 * =======
22 *
23 * DPOCON estimates the reciprocal of the condition number (in the
24 * 1-norm) of a real symmetric positive definite matrix using the
25 * Cholesky factorization A = U**T*U or A = L*L**T computed by DPOTRF.
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) DOUBLE PRECISION array, dimension (LDA,N)
41 * The triangular factor U or L from the Cholesky factorization
42 * A = U**T*U or A = L*L**T, as computed by DPOTRF.
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 symmetric 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) DOUBLE PRECISION array, dimension (3*N)
56 *
57 * IWORK (workspace) INTEGER 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 * ..
75 * .. Local Arrays ..
76  INTEGER isave( 3 )
77 * ..
78 * .. External Functions ..
79  LOGICAL lsame
80  INTEGER idamax
81  DOUBLE PRECISION dlamch
82  EXTERNAL lsame, idamax, dlamch
83 * ..
84 * .. External Subroutines ..
85  EXTERNAL dlacn2, dlatrs, drscl, xerbla
86 * ..
87 * .. Intrinsic Functions ..
88  INTRINSIC abs, max
89 * ..
90 * .. Executable Statements ..
91 *
92 * Test the input parameters.
93 *
94  info = 0
95  upper = lsame( uplo, 'U' )
96  IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
97  info = -1
98  ELSE IF( n.LT.0 ) THEN
99  info = -2
100  ELSE IF( lda.LT.max( 1, n ) ) THEN
101  info = -4
102  ELSE IF( anorm.LT.zero ) THEN
103  info = -5
104  END IF
105  IF( info.NE.0 ) THEN
106  CALL xerbla( 'DPOCON', -info )
107  return
108  END IF
109 *
110 * Quick return if possible
111 *
112  rcond = zero
113  IF( n.EQ.0 ) THEN
114  rcond = one
115  return
116  ELSE IF( anorm.EQ.zero ) THEN
117  return
118  END IF
119 *
120  smlnum = dlamch( 'Safe minimum' )
121 *
122 * Estimate the 1-norm of inv(A).
123 *
124  kase = 0
125  normin = 'N'
126  10 continue
127  CALL dlacn2( n, work( n+1 ), work, iwork, ainvnm, kase, isave )
128  IF( kase.NE.0 ) THEN
129  IF( upper ) THEN
130 *
131 * Multiply by inv(U').
132 *
133  CALL dlatrs( 'Upper', 'Transpose', 'Non-unit', normin, n, a,
134  $ lda, work, scalel, work( 2*n+1 ), info )
135  normin = 'Y'
136 *
137 * Multiply by inv(U).
138 *
139  CALL dlatrs( 'Upper', 'No transpose', 'Non-unit', normin, n,
140  $ a, lda, work, scaleu, work( 2*n+1 ), info )
141  ELSE
142 *
143 * Multiply by inv(L).
144 *
145  CALL dlatrs( 'Lower', 'No transpose', 'Non-unit', normin, n,
146  $ a, lda, work, scalel, work( 2*n+1 ), info )
147  normin = 'Y'
148 *
149 * Multiply by inv(L').
150 *
151  CALL dlatrs( 'Lower', 'Transpose', 'Non-unit', normin, n, a,
152  $ lda, work, scaleu, work( 2*n+1 ), info )
153  END IF
154 *
155 * Multiply by 1/SCALE if doing so will not cause overflow.
156 *
157  scale = scalel*scaleu
158  IF( scale.NE.one ) THEN
159  ix = idamax( n, work, 1 )
160  IF( scale.LT.abs( work( ix ) )*smlnum .OR. scale.EQ.zero )
161  $ go to 20
162  CALL drscl( n, scale, work, 1 )
163  END IF
164  go to 10
165  END IF
166 *
167 * Compute the estimate of the reciprocal condition number.
168 *
169  IF( ainvnm.NE.zero )
170  $ rcond = ( one / ainvnm ) / anorm
171 *
172  20 continue
173  return
174 *
175 * End of DPOCON
176 *
177  END