LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
dtrcon.f
Go to the documentation of this file.
1*> \brief \b DTRCON
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download DTRCON + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dtrcon.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dtrcon.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dtrcon.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE DTRCON( NORM, UPLO, DIAG, N, A, LDA, RCOND, WORK,
20* IWORK, INFO )
21*
22* .. Scalar Arguments ..
23* CHARACTER DIAG, NORM, UPLO
24* INTEGER INFO, LDA, N
25* DOUBLE PRECISION RCOND
26* ..
27* .. Array Arguments ..
28* INTEGER IWORK( * )
29* DOUBLE PRECISION A( LDA, * ), WORK( * )
30* ..
31*
32*
33*> \par Purpose:
34* =============
35*>
36*> \verbatim
37*>
38*> DTRCON estimates the reciprocal of the condition number of a
39*> triangular matrix A, in either the 1-norm or the infinity-norm.
40*>
41*> The norm of A is computed and an estimate is obtained for
42*> norm(inv(A)), then the reciprocal of the condition number is
43*> computed as
44*> RCOND = 1 / ( norm(A) * norm(inv(A)) ).
45*> \endverbatim
46*
47* Arguments:
48* ==========
49*
50*> \param[in] NORM
51*> \verbatim
52*> NORM is CHARACTER*1
53*> Specifies whether the 1-norm condition number or the
54*> infinity-norm condition number is required:
55*> = '1' or 'O': 1-norm;
56*> = 'I': Infinity-norm.
57*> \endverbatim
58*>
59*> \param[in] UPLO
60*> \verbatim
61*> UPLO is CHARACTER*1
62*> = 'U': A is upper triangular;
63*> = 'L': A is lower triangular.
64*> \endverbatim
65*>
66*> \param[in] DIAG
67*> \verbatim
68*> DIAG is CHARACTER*1
69*> = 'N': A is non-unit triangular;
70*> = 'U': A is unit triangular.
71*> \endverbatim
72*>
73*> \param[in] N
74*> \verbatim
75*> N is INTEGER
76*> The order of the matrix A. N >= 0.
77*> \endverbatim
78*>
79*> \param[in] A
80*> \verbatim
81*> A is DOUBLE PRECISION array, dimension (LDA,N)
82*> The triangular matrix A. If UPLO = 'U', the leading N-by-N
83*> upper triangular part of the array A contains the upper
84*> triangular matrix, and the strictly lower triangular part of
85*> A is not referenced. If UPLO = 'L', the leading N-by-N lower
86*> triangular part of the array A contains the lower triangular
87*> matrix, and the strictly upper triangular part of A is not
88*> referenced. If DIAG = 'U', the diagonal elements of A are
89*> also not referenced and are assumed to be 1.
90*> \endverbatim
91*>
92*> \param[in] LDA
93*> \verbatim
94*> LDA is INTEGER
95*> The leading dimension of the array A. LDA >= max(1,N).
96*> \endverbatim
97*>
98*> \param[out] RCOND
99*> \verbatim
100*> RCOND is DOUBLE PRECISION
101*> The reciprocal of the condition number of the matrix A,
102*> computed as RCOND = 1/(norm(A) * norm(inv(A))).
103*> \endverbatim
104*>
105*> \param[out] WORK
106*> \verbatim
107*> WORK is DOUBLE PRECISION array, dimension (3*N)
108*> \endverbatim
109*>
110*> \param[out] IWORK
111*> \verbatim
112*> IWORK is INTEGER array, dimension (N)
113*> \endverbatim
114*>
115*> \param[out] INFO
116*> \verbatim
117*> INFO is INTEGER
118*> = 0: successful exit
119*> < 0: if INFO = -i, the i-th argument had an illegal value
120*> \endverbatim
121*
122* Authors:
123* ========
124*
125*> \author Univ. of Tennessee
126*> \author Univ. of California Berkeley
127*> \author Univ. of Colorado Denver
128*> \author NAG Ltd.
129*
130*> \ingroup trcon
131*
132* =====================================================================
133 SUBROUTINE dtrcon( NORM, UPLO, DIAG, N, A, LDA, RCOND, WORK,
134 $ IWORK, INFO )
135*
136* -- LAPACK computational routine --
137* -- LAPACK is a software package provided by Univ. of Tennessee, --
138* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
139*
140* .. Scalar Arguments ..
141 CHARACTER DIAG, NORM, UPLO
142 INTEGER INFO, LDA, N
143 DOUBLE PRECISION RCOND
144* ..
145* .. Array Arguments ..
146 INTEGER IWORK( * )
147 DOUBLE PRECISION A( LDA, * ), WORK( * )
148* ..
149*
150* =====================================================================
151*
152* .. Parameters ..
153 DOUBLE PRECISION ONE, ZERO
154 parameter( one = 1.0d+0, zero = 0.0d+0 )
155* ..
156* .. Local Scalars ..
157 LOGICAL NOUNIT, ONENRM, UPPER
158 CHARACTER NORMIN
159 INTEGER IX, KASE, KASE1
160 DOUBLE PRECISION AINVNM, ANORM, SCALE, SMLNUM, XNORM
161* ..
162* .. Local Arrays ..
163 INTEGER ISAVE( 3 )
164* ..
165* .. External Functions ..
166 LOGICAL LSAME
167 INTEGER IDAMAX
168 DOUBLE PRECISION DLAMCH, DLANTR
169 EXTERNAL lsame, idamax, dlamch, dlantr
170* ..
171* .. External Subroutines ..
172 EXTERNAL dlacn2, dlatrs, drscl, xerbla
173* ..
174* .. Intrinsic Functions ..
175 INTRINSIC abs, dble, max
176* ..
177* .. Executable Statements ..
178*
179* Test the input parameters.
180*
181 info = 0
182 upper = lsame( uplo, 'U' )
183 onenrm = norm.EQ.'1' .OR. lsame( norm, 'O' )
184 nounit = lsame( diag, 'N' )
185*
186 IF( .NOT.onenrm .AND. .NOT.lsame( norm, 'I' ) ) THEN
187 info = -1
188 ELSE IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
189 info = -2
190 ELSE IF( .NOT.nounit .AND. .NOT.lsame( diag, 'U' ) ) THEN
191 info = -3
192 ELSE IF( n.LT.0 ) THEN
193 info = -4
194 ELSE IF( lda.LT.max( 1, n ) ) THEN
195 info = -6
196 END IF
197 IF( info.NE.0 ) THEN
198 CALL xerbla( 'DTRCON', -info )
199 RETURN
200 END IF
201*
202* Quick return if possible
203*
204 IF( n.EQ.0 ) THEN
205 rcond = one
206 RETURN
207 END IF
208*
209 rcond = zero
210 smlnum = dlamch( 'Safe minimum' )*dble( max( 1, n ) )
211*
212* Compute the norm of the triangular matrix A.
213*
214 anorm = dlantr( norm, uplo, diag, n, n, a, lda, work )
215*
216* Continue only if ANORM > 0.
217*
218 IF( anorm.GT.zero ) THEN
219*
220* Estimate the norm of the inverse of A.
221*
222 ainvnm = zero
223 normin = 'N'
224 IF( onenrm ) THEN
225 kase1 = 1
226 ELSE
227 kase1 = 2
228 END IF
229 kase = 0
230 10 CONTINUE
231 CALL dlacn2( n, work( n+1 ), work, iwork, ainvnm, kase,
232 $ isave )
233 IF( kase.NE.0 ) THEN
234 IF( kase.EQ.kase1 ) THEN
235*
236* Multiply by inv(A).
237*
238 CALL dlatrs( uplo, 'No transpose', diag, normin, n, a,
239 $ lda, work, scale, work( 2*n+1 ), info )
240 ELSE
241*
242* Multiply by inv(A**T).
243*
244 CALL dlatrs( uplo, 'Transpose', diag, normin, n, a,
245 $ 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*
273 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
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
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
subroutine drscl(n, sa, sx, incx)
DRSCL multiplies a vector by the reciprocal of a real scalar.
Definition drscl.f:82
subroutine dtrcon(norm, uplo, diag, n, a, lda, rcond, work, iwork, info)
DTRCON
Definition dtrcon.f:135