LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ dgecon()

subroutine dgecon ( character norm,
integer n,
double precision, dimension( lda, * ) a,
integer lda,
double precision anorm,
double precision rcond,
double precision, dimension( * ) work,
integer, dimension( * ) iwork,
integer info )

DGECON

Download DGECON + dependencies [TGZ] [ZIP] [TXT]

Purpose:
!>
!> DGECON estimates the reciprocal of the condition number of a general
!> real matrix A, in either the 1-norm or the infinity-norm, using
!> the LU factorization computed by DGETRF.
!>
!> An estimate is obtained for norm(inv(A)), and the reciprocal of the
!> condition number is computed as
!>    RCOND = 1 / ( norm(A) * norm(inv(A)) ).
!> 
Parameters
[in]NORM
!>          NORM is CHARACTER*1
!>          Specifies whether the 1-norm condition number or the
!>          infinity-norm condition number is required:
!>          = '1' or 'O':  1-norm;
!>          = 'I':         Infinity-norm.
!> 
[in]N
!>          N is INTEGER
!>          The order of the matrix A.  N >= 0.
!> 
[in]A
!>          A is DOUBLE PRECISION array, dimension (LDA,N)
!>          The factors L and U from the factorization A = P*L*U
!>          as computed by DGETRF.
!> 
[in]LDA
!>          LDA is INTEGER
!>          The leading dimension of the array A.  LDA >= max(1,N).
!> 
[in]ANORM
!>          ANORM is DOUBLE PRECISION
!>          If NORM = '1' or 'O', the 1-norm of the original matrix A.
!>          If NORM = 'I', the infinity-norm of the original matrix A.
!> 
[out]RCOND
!>          RCOND is DOUBLE PRECISION
!>          The reciprocal of the condition number of the matrix A,
!>          computed as RCOND = 1/(norm(A) * norm(inv(A))).
!> 
[out]WORK
!>          WORK is DOUBLE PRECISION array, dimension (4*N)
!> 
[out]IWORK
!>          IWORK is INTEGER array, dimension (N)
!> 
[out]INFO
!>          INFO is INTEGER
!>          = 0:  successful exit
!>          < 0:  if INFO = -i, the i-th argument had an illegal value.
!>                NaNs are illegal values for ANORM, and they propagate to
!>                the output parameter RCOND.
!>                Infinity is illegal for ANORM, and it propagates to the output
!>                parameter RCOND as 0.
!>          = 1:  if RCOND = NaN, or
!>                   RCOND = Inf, or
!>                   the computed norm of the inverse of A is 0.
!>                In the latter, RCOND = 0 is returned.
!> 
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 128 of file dgecon.f.

130*
131* -- LAPACK computational routine --
132* -- LAPACK is a software package provided by Univ. of Tennessee, --
133* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
134*
135* .. Scalar Arguments ..
136 CHARACTER NORM
137 INTEGER INFO, LDA, N
138 DOUBLE PRECISION ANORM, RCOND
139* ..
140* .. Array Arguments ..
141 INTEGER IWORK( * )
142 DOUBLE PRECISION A( LDA, * ), WORK( * )
143* ..
144*
145* =====================================================================
146*
147* .. Parameters ..
148 DOUBLE PRECISION ONE, ZERO
149 parameter( one = 1.0d+0, zero = 0.0d+0 )
150* ..
151* .. Local Scalars ..
152 LOGICAL ONENRM
153 CHARACTER NORMIN
154 INTEGER IX, KASE, KASE1
155 DOUBLE PRECISION AINVNM, SCALE, SL, SMLNUM, SU, HUGEVAL
156* ..
157* .. Local Arrays ..
158 INTEGER ISAVE( 3 )
159* ..
160* .. External Functions ..
161 LOGICAL LSAME, DISNAN
162 INTEGER IDAMAX
163 DOUBLE PRECISION DLAMCH
164 EXTERNAL lsame, idamax, dlamch, disnan
165* ..
166* .. External Subroutines ..
167 EXTERNAL dlacn2, dlatrs, drscl, xerbla
168* ..
169* .. Intrinsic Functions ..
170 INTRINSIC abs, max
171* ..
172* .. Executable Statements ..
173*
174 hugeval = dlamch( 'Overflow' )
175*
176* Test the input parameters.
177*
178 info = 0
179 onenrm = norm.EQ.'1' .OR. lsame( norm, 'O' )
180 IF( .NOT.onenrm .AND. .NOT.lsame( norm, 'I' ) ) THEN
181 info = -1
182 ELSE IF( n.LT.0 ) THEN
183 info = -2
184 ELSE IF( lda.LT.max( 1, n ) ) THEN
185 info = -4
186 ELSE IF( anorm.LT.zero ) THEN
187 info = -5
188 END IF
189 IF( info.NE.0 ) THEN
190 CALL xerbla( 'DGECON', -info )
191 RETURN
192 END IF
193*
194* Quick return if possible
195*
196 rcond = zero
197 IF( n.EQ.0 ) THEN
198 rcond = one
199 RETURN
200 ELSE IF( anorm.EQ.zero ) THEN
201 RETURN
202 ELSE IF( disnan( anorm ) ) THEN
203 rcond = anorm
204 info = -5
205 RETURN
206 ELSE IF( anorm.GT.hugeval ) THEN
207 info = -5
208 RETURN
209 END IF
210*
211 smlnum = dlamch( 'Safe minimum' )
212*
213* Estimate the norm of inv(A).
214*
215 ainvnm = zero
216 normin = 'N'
217 IF( onenrm ) THEN
218 kase1 = 1
219 ELSE
220 kase1 = 2
221 END IF
222 kase = 0
223 10 CONTINUE
224 CALL dlacn2( n, work( n+1 ), work, iwork, ainvnm, kase, isave )
225 IF( kase.NE.0 ) THEN
226 IF( kase.EQ.kase1 ) THEN
227*
228* Multiply by inv(L).
229*
230 CALL dlatrs( 'Lower', 'No transpose', 'Unit', normin, n,
231 $ a,
232 $ lda, work, sl, work( 2*n+1 ), info )
233*
234* Multiply by inv(U).
235*
236 CALL dlatrs( 'Upper', 'No transpose', 'Non-unit', normin,
237 $ n,
238 $ a, lda, work, su, work( 3*n+1 ), info )
239 ELSE
240*
241* Multiply by inv(U**T).
242*
243 CALL dlatrs( 'Upper', 'Transpose', 'Non-unit', normin, n,
244 $ a,
245 $ lda, work, su, work( 3*n+1 ), info )
246*
247* Multiply by inv(L**T).
248*
249 CALL dlatrs( 'Lower', 'Transpose', 'Unit', normin, n, a,
250 $ lda, work, sl, work( 2*n+1 ), info )
251 END IF
252*
253* Divide X by 1/(SL*SU) if doing so will not cause overflow.
254*
255 scale = sl*su
256 normin = 'Y'
257 IF( scale.NE.one ) THEN
258 ix = idamax( n, work, 1 )
259 IF( scale.LT.abs( work( ix ) )*smlnum .OR. scale.EQ.zero )
260 $ GO TO 20
261 CALL drscl( n, scale, work, 1 )
262 END IF
263 GO TO 10
264 END IF
265*
266* Compute the estimate of the reciprocal condition number.
267*
268 IF( ainvnm.NE.zero ) THEN
269 rcond = ( one / ainvnm ) / anorm
270 ELSE
271 info = 1
272 RETURN
273 END IF
274*
275* Check for NaNs and Infs
276*
277 IF( disnan( rcond ) .OR. rcond.GT.hugeval )
278 $ info = 1
279*
280 20 CONTINUE
281 RETURN
282*
283* End of DGECON
284*
subroutine xerbla(srname, info)
Definition cblat2.f:3285
integer function idamax(n, dx, incx)
IDAMAX
Definition idamax.f:71
logical function disnan(din)
DISNAN tests input for NaN.
Definition disnan.f:57
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:134
double precision function dlamch(cmach)
DLAMCH
Definition dlamch.f:69
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:237
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
subroutine drscl(n, sa, sx, incx)
DRSCL multiplies a vector by the reciprocal of a real scalar.
Definition drscl.f:82
Here is the call graph for this function:
Here is the caller graph for this function: