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

◆ dtrcon()

subroutine dtrcon ( character  norm,
character  uplo,
character  diag,
integer  n,
double precision, dimension( lda, * )  a,
integer  lda,
double precision  rcond,
double precision, dimension( * )  work,
integer, dimension( * )  iwork,
integer  info 
)

DTRCON

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

Purpose:
 DTRCON estimates the reciprocal of the condition number of a
 triangular matrix A, in either the 1-norm or the infinity-norm.

 The norm of A is computed and an estimate is obtained for
 norm(inv(A)), then 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]UPLO
          UPLO is CHARACTER*1
          = 'U':  A is upper triangular;
          = 'L':  A is lower triangular.
[in]DIAG
          DIAG is CHARACTER*1
          = 'N':  A is non-unit triangular;
          = 'U':  A is unit triangular.
[in]N
          N is INTEGER
          The order of the matrix A.  N >= 0.
[in]A
          A is DOUBLE PRECISION array, dimension (LDA,N)
          The triangular matrix A.  If UPLO = 'U', the leading N-by-N
          upper triangular part of the array A contains the upper
          triangular matrix, and the strictly lower triangular part of
          A is not referenced.  If UPLO = 'L', the leading N-by-N lower
          triangular part of the array A contains the lower triangular
          matrix, and the strictly upper triangular part of A is not
          referenced.  If DIAG = 'U', the diagonal elements of A are
          also not referenced and are assumed to be 1.
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A.  LDA >= max(1,N).
[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 (3*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
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 135 of file dtrcon.f.

137*
138* -- LAPACK computational routine --
139* -- LAPACK is a software package provided by Univ. of Tennessee, --
140* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
141*
142* .. Scalar Arguments ..
143 CHARACTER DIAG, NORM, UPLO
144 INTEGER INFO, LDA, N
145 DOUBLE PRECISION RCOND
146* ..
147* .. Array Arguments ..
148 INTEGER IWORK( * )
149 DOUBLE PRECISION A( LDA, * ), WORK( * )
150* ..
151*
152* =====================================================================
153*
154* .. Parameters ..
155 DOUBLE PRECISION ONE, ZERO
156 parameter( one = 1.0d+0, zero = 0.0d+0 )
157* ..
158* .. Local Scalars ..
159 LOGICAL NOUNIT, ONENRM, UPPER
160 CHARACTER NORMIN
161 INTEGER IX, KASE, KASE1
162 DOUBLE PRECISION AINVNM, ANORM, SCALE, SMLNUM, XNORM
163* ..
164* .. Local Arrays ..
165 INTEGER ISAVE( 3 )
166* ..
167* .. External Functions ..
168 LOGICAL LSAME
169 INTEGER IDAMAX
170 DOUBLE PRECISION DLAMCH, DLANTR
171 EXTERNAL lsame, idamax, dlamch, dlantr
172* ..
173* .. External Subroutines ..
174 EXTERNAL dlacn2, dlatrs, drscl, xerbla
175* ..
176* .. Intrinsic Functions ..
177 INTRINSIC abs, dble, max
178* ..
179* .. Executable Statements ..
180*
181* Test the input parameters.
182*
183 info = 0
184 upper = lsame( uplo, 'U' )
185 onenrm = norm.EQ.'1' .OR. lsame( norm, 'O' )
186 nounit = lsame( diag, 'N' )
187*
188 IF( .NOT.onenrm .AND. .NOT.lsame( norm, 'I' ) ) THEN
189 info = -1
190 ELSE IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
191 info = -2
192 ELSE IF( .NOT.nounit .AND. .NOT.lsame( diag, 'U' ) ) THEN
193 info = -3
194 ELSE IF( n.LT.0 ) THEN
195 info = -4
196 ELSE IF( lda.LT.max( 1, n ) ) THEN
197 info = -6
198 END IF
199 IF( info.NE.0 ) THEN
200 CALL xerbla( 'DTRCON', -info )
201 RETURN
202 END IF
203*
204* Quick return if possible
205*
206 IF( n.EQ.0 ) THEN
207 rcond = one
208 RETURN
209 END IF
210*
211 rcond = zero
212 smlnum = dlamch( 'Safe minimum' )*dble( max( 1, n ) )
213*
214* Compute the norm of the triangular matrix A.
215*
216 anorm = dlantr( norm, uplo, diag, n, n, a, lda, work )
217*
218* Continue only if ANORM > 0.
219*
220 IF( anorm.GT.zero ) THEN
221*
222* Estimate the norm of the inverse of A.
223*
224 ainvnm = zero
225 normin = 'N'
226 IF( onenrm ) THEN
227 kase1 = 1
228 ELSE
229 kase1 = 2
230 END IF
231 kase = 0
232 10 CONTINUE
233 CALL dlacn2( n, work( n+1 ), work, iwork, ainvnm, kase, isave )
234 IF( kase.NE.0 ) THEN
235 IF( kase.EQ.kase1 ) THEN
236*
237* Multiply by inv(A).
238*
239 CALL dlatrs( uplo, 'No transpose', diag, normin, n, a,
240 $ lda, work, scale, work( 2*n+1 ), info )
241 ELSE
242*
243* Multiply by inv(A**T).
244*
245 CALL dlatrs( uplo, 'Transpose', diag, normin, n, a, lda,
246 $ work, scale, work( 2*n+1 ), info )
247 END IF
248 normin = 'Y'
249*
250* Multiply by 1/SCALE if doing so will not cause overflow.
251*
252 IF( scale.NE.one ) THEN
253 ix = idamax( n, work, 1 )
254 xnorm = abs( work( ix ) )
255 IF( scale.LT.xnorm*smlnum .OR. scale.EQ.zero )
256 $ GO TO 20
257 CALL drscl( n, scale, work, 1 )
258 END IF
259 GO TO 10
260 END IF
261*
262* Compute the estimate of the reciprocal condition number.
263*
264 IF( ainvnm.NE.zero )
265 $ rcond = ( one / anorm ) / ainvnm
266 END IF
267*
268 20 CONTINUE
269 RETURN
270*
271* End of DTRCON
272*
subroutine xerbla(srname, info)
Definition cblat2.f:3285
integer function idamax(n, dx, incx)
IDAMAX
Definition idamax.f:71
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
double precision function dlamch(cmach)
DLAMCH
Definition dlamch.f:69
double precision function dlantr(norm, uplo, diag, m, n, a, lda, work)
DLANTR returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition dlantr.f:141
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
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:84
Here is the call graph for this function:
Here is the caller graph for this function: