LAPACK  3.11.0
LAPACK: Linear Algebra PACKage
dgecon.f
1 *> \brief \b DGECON
2 *
3 * =========== DOCUMENTATION ===========
4 *
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
7 *
8 *> \htmlonly
9 *> Download DGECON + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dgecon.f">
11 *> [TGZ]</a>
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dgecon.f">
13 *> [ZIP]</a>
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dgecon.f">
15 *> [TXT]</a>
16 *> \endhtmlonly
17 *
18 * Definition:
19 * ===========
20 *
21 * SUBROUTINE DGECON( NORM, N, A, LDA, ANORM, RCOND, WORK, IWORK,
22 * INFO )
23 *
24 * .. Scalar Arguments ..
25 * CHARACTER NORM
26 * INTEGER INFO, LDA, N
27 * DOUBLE PRECISION ANORM, RCOND
28 * ..
29 * .. Array Arguments ..
30 * INTEGER IWORK( * )
31 * DOUBLE PRECISION A( LDA, * ), WORK( * )
32 * ..
33 *
34 *
35 *> \par Purpose:
36 * =============
37 *>
38 *> \verbatim
39 *>
40 *> DGECON estimates the reciprocal of the condition number of a general
41 *> real matrix A, in either the 1-norm or the infinity-norm, using
42 *> the LU factorization computed by DGETRF.
43 *>
44 *> An estimate is obtained for norm(inv(A)), and the reciprocal of the
45 *> condition number is computed as
46 *> RCOND = 1 / ( norm(A) * norm(inv(A)) ).
47 *> \endverbatim
48 *
49 * Arguments:
50 * ==========
51 *
52 *> \param[in] NORM
53 *> \verbatim
54 *> NORM is CHARACTER*1
55 *> Specifies whether the 1-norm condition number or the
56 *> infinity-norm condition number is required:
57 *> = '1' or 'O': 1-norm;
58 *> = 'I': Infinity-norm.
59 *> \endverbatim
60 *>
61 *> \param[in] N
62 *> \verbatim
63 *> N is INTEGER
64 *> The order of the matrix A. N >= 0.
65 *> \endverbatim
66 *>
67 *> \param[in] A
68 *> \verbatim
69 *> A is DOUBLE PRECISION array, dimension (LDA,N)
70 *> The factors L and U from the factorization A = P*L*U
71 *> as computed by DGETRF.
72 *> \endverbatim
73 *>
74 *> \param[in] LDA
75 *> \verbatim
76 *> LDA is INTEGER
77 *> The leading dimension of the array A. LDA >= max(1,N).
78 *> \endverbatim
79 *>
80 *> \param[in] ANORM
81 *> \verbatim
82 *> ANORM is DOUBLE PRECISION
83 *> If NORM = '1' or 'O', the 1-norm of the original matrix A.
84 *> If NORM = 'I', the infinity-norm of the original matrix A.
85 *> \endverbatim
86 *>
87 *> \param[out] RCOND
88 *> \verbatim
89 *> RCOND is DOUBLE PRECISION
90 *> The reciprocal of the condition number of the matrix A,
91 *> computed as RCOND = 1/(norm(A) * norm(inv(A))).
92 *> \endverbatim
93 *>
94 *> \param[out] WORK
95 *> \verbatim
96 *> WORK is DOUBLE PRECISION array, dimension (4*N)
97 *> \endverbatim
98 *>
99 *> \param[out] IWORK
100 *> \verbatim
101 *> IWORK is INTEGER array, dimension (N)
102 *> \endverbatim
103 *>
104 *> \param[out] INFO
105 *> \verbatim
106 *> INFO is INTEGER
107 *> = 0: successful exit
108 *> < 0: if INFO = -i, the i-th argument had an illegal value
109 *> =-5: if ANORM is NAN or negative.
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 *> \ingroup gecon
121 *
122 * =====================================================================
123  SUBROUTINE dgecon( NORM, N, A, LDA, ANORM, RCOND, WORK, IWORK,
124  $ INFO )
125 *
126 * -- LAPACK computational routine --
127 * -- LAPACK is a software package provided by Univ. of Tennessee, --
128 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
129 *
130 * .. Scalar Arguments ..
131  CHARACTER NORM
132  INTEGER INFO, LDA, N
133  DOUBLE PRECISION ANORM, RCOND
134 * ..
135 * .. Array Arguments ..
136  INTEGER IWORK( * )
137  DOUBLE PRECISION A( lda, * ), WORK( * )
138 * ..
139 *
140 * =====================================================================
141 *
142 * .. Parameters ..
143  DOUBLE PRECISION ONE, ZERO
144  parameter( one = 1.0d+0, zero = 0.0d+0 )
145 * ..
146 * .. Local Scalars ..
147  LOGICAL ONENRM
148  CHARACTER NORMIN
149  INTEGER IX, KASE, KASE1
150  DOUBLE PRECISION AINVNM, SCALE, SL, SMLNUM, SU
151 * ..
152 * .. Local Arrays ..
153  INTEGER ISAVE( 3 )
154 * ..
155 * .. External Functions ..
156  LOGICAL LSAME, DISNAN
157  INTEGER IDAMAX
158  DOUBLE PRECISION DLAMCH
159  EXTERNAL lsame, idamax, dlamch, disnan
160 * ..
161 * .. External Subroutines ..
162  EXTERNAL dlacn2, dlatrs, drscl, xerbla
163 * ..
164 * .. Intrinsic Functions ..
165  INTRINSIC abs, max
166 * ..
167 * .. Executable Statements ..
168 *
169 * Test the input parameters.
170 *
171  info = 0
172  onenrm = norm.EQ.'1' .OR. lsame( norm, 'O' )
173  IF( .NOT.onenrm .AND. .NOT.lsame( norm, 'I' ) ) 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 .OR. disnan( anorm ) ) THEN
180  info = -5
181  END IF
182  IF( info.NE.0 ) THEN
183  CALL xerbla( 'DGECON', -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.EQ.zero ) THEN
194  RETURN
195  END IF
196 *
197  smlnum = dlamch( 'Safe minimum' )
198 *
199 * Estimate the norm of inv(A).
200 *
201  ainvnm = zero
202  normin = 'N'
203  IF( onenrm ) THEN
204  kase1 = 1
205  ELSE
206  kase1 = 2
207  END IF
208  kase = 0
209  10 CONTINUE
210  CALL dlacn2( n, work( n+1 ), work, iwork, ainvnm, kase, isave )
211  IF( kase.NE.0 ) THEN
212  IF( kase.EQ.kase1 ) THEN
213 *
214 * Multiply by inv(L).
215 *
216  CALL dlatrs( 'Lower', 'No transpose', 'Unit', normin, n, a,
217  $ lda, work, sl, work( 2*n+1 ), info )
218 *
219 * Multiply by inv(U).
220 *
221  CALL dlatrs( 'Upper', 'No transpose', 'Non-unit', normin, n,
222  $ a, lda, work, su, work( 3*n+1 ), info )
223  ELSE
224 *
225 * Multiply by inv(U**T).
226 *
227  CALL dlatrs( 'Upper', 'Transpose', 'Non-unit', normin, n, a,
228  $ lda, work, su, work( 3*n+1 ), info )
229 *
230 * Multiply by inv(L**T).
231 *
232  CALL dlatrs( 'Lower', 'Transpose', 'Unit', normin, n, a,
233  $ lda, work, sl, work( 2*n+1 ), info )
234  END IF
235 *
236 * Divide X by 1/(SL*SU) if doing so will not cause overflow.
237 *
238  scale = sl*su
239  normin = 'Y'
240  IF( scale.NE.one ) THEN
241  ix = idamax( n, work, 1 )
242  IF( scale.LT.abs( work( ix ) )*smlnum .OR. scale.EQ.zero )
243  $ GO TO 20
244  CALL drscl( n, scale, work, 1 )
245  END IF
246  GO TO 10
247  END IF
248 *
249 * Compute the estimate of the reciprocal condition number.
250 *
251  IF( ainvnm.NE.zero )
252  $ rcond = ( one / ainvnm ) / anorm
253 *
254  20 CONTINUE
255  RETURN
256 *
257 * End of DGECON
258 *
259  END
subroutine dgecon(NORM, N, A, LDA, ANORM, RCOND, WORK, IWORK, INFO)
DGECON
Definition: dgecon.f:125
subroutine drscl(N, SA, SX, INCX)
DRSCL multiplies a vector by the reciprocal of a real scalar.
Definition: drscl.f:84
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:60
subroutine dlatrs(UPLO, TRANS, DIAG, NORMIN, N, A, LDA, X, SCALE, CNORM, INFO)
DLATRS solves a triangular system of equations with the scale factor set to prevent overflow...
Definition: dlatrs.f:238
subroutine dlacn2(N, V, X, ISGN, EST, KASE, ISAVE)
DLACN2 estimates the 1-norm of a square matrix, using reverse communication for evaluating matrix-vec...
Definition: dlacn2.f:136