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

◆ ctrcon()

subroutine ctrcon ( character norm,
character uplo,
character diag,
integer n,
complex, dimension( lda, * ) a,
integer lda,
real rcond,
complex, dimension( * ) work,
real, dimension( * ) rwork,
integer info )

CTRCON

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

Purpose:
!>
!> CTRCON 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 COMPLEX 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 REAL
!>          The reciprocal of the condition number of the matrix A,
!>          computed as RCOND = 1/(norm(A) * norm(inv(A))).
!> 
[out]WORK
!>          WORK is COMPLEX array, dimension (2*N)
!> 
[out]RWORK
!>          RWORK is REAL 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 133 of file ctrcon.f.

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 REAL RCOND
144* ..
145* .. Array Arguments ..
146 REAL RWORK( * )
147 COMPLEX A( LDA, * ), WORK( * )
148* ..
149*
150* =====================================================================
151*
152* .. Parameters ..
153 REAL ONE, ZERO
154 parameter( one = 1.0e+0, zero = 0.0e+0 )
155* ..
156* .. Local Scalars ..
157 LOGICAL NOUNIT, ONENRM, UPPER
158 CHARACTER NORMIN
159 INTEGER IX, KASE, KASE1
160 REAL AINVNM, ANORM, SCALE, SMLNUM, XNORM
161 COMPLEX ZDUM
162* ..
163* .. Local Arrays ..
164 INTEGER ISAVE( 3 )
165* ..
166* .. External Functions ..
167 LOGICAL LSAME
168 INTEGER ICAMAX
169 REAL CLANTR, SLAMCH
170 EXTERNAL lsame, icamax, clantr, slamch
171* ..
172* .. External Subroutines ..
173 EXTERNAL clacn2, clatrs, csrscl, xerbla
174* ..
175* .. Intrinsic Functions ..
176 INTRINSIC abs, aimag, max, real
177* ..
178* .. Statement Functions ..
179 REAL CABS1
180* ..
181* .. Statement Function definitions ..
182 cabs1( zdum ) = abs( real( zdum ) ) + abs( aimag( zdum ) )
183* ..
184* .. Executable Statements ..
185*
186* Test the input parameters.
187*
188 info = 0
189 upper = lsame( uplo, 'U' )
190 onenrm = norm.EQ.'1' .OR. lsame( norm, 'O' )
191 nounit = lsame( diag, 'N' )
192*
193 IF( .NOT.onenrm .AND. .NOT.lsame( norm, 'I' ) ) THEN
194 info = -1
195 ELSE IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
196 info = -2
197 ELSE IF( .NOT.nounit .AND. .NOT.lsame( diag, 'U' ) ) THEN
198 info = -3
199 ELSE IF( n.LT.0 ) THEN
200 info = -4
201 ELSE IF( lda.LT.max( 1, n ) ) THEN
202 info = -6
203 END IF
204 IF( info.NE.0 ) THEN
205 CALL xerbla( 'CTRCON', -info )
206 RETURN
207 END IF
208*
209* Quick return if possible
210*
211 IF( n.EQ.0 ) THEN
212 rcond = one
213 RETURN
214 END IF
215*
216 rcond = zero
217 smlnum = slamch( 'Safe minimum' )*real( max( 1, n ) )
218*
219* Compute the norm of the triangular matrix A.
220*
221 anorm = clantr( norm, uplo, diag, n, n, a, lda, rwork )
222*
223* Continue only if ANORM > 0.
224*
225 IF( anorm.GT.zero ) THEN
226*
227* Estimate the norm of the inverse of A.
228*
229 ainvnm = zero
230 normin = 'N'
231 IF( onenrm ) THEN
232 kase1 = 1
233 ELSE
234 kase1 = 2
235 END IF
236 kase = 0
237 10 CONTINUE
238 CALL clacn2( n, work( n+1 ), work, ainvnm, kase, isave )
239 IF( kase.NE.0 ) THEN
240 IF( kase.EQ.kase1 ) THEN
241*
242* Multiply by inv(A).
243*
244 CALL clatrs( uplo, 'No transpose', diag, normin, n, a,
245 $ lda, work, scale, rwork, info )
246 ELSE
247*
248* Multiply by inv(A**H).
249*
250 CALL clatrs( uplo, 'Conjugate transpose', diag,
251 $ normin,
252 $ n, a, lda, work, scale, rwork, info )
253 END IF
254 normin = 'Y'
255*
256* Multiply by 1/SCALE if doing so will not cause overflow.
257*
258 IF( scale.NE.one ) THEN
259 ix = icamax( n, work, 1 )
260 xnorm = cabs1( work( ix ) )
261 IF( scale.LT.xnorm*smlnum .OR. scale.EQ.zero )
262 $ GO TO 20
263 CALL csrscl( n, scale, work, 1 )
264 END IF
265 GO TO 10
266 END IF
267*
268* Compute the estimate of the reciprocal condition number.
269*
270 IF( ainvnm.NE.zero )
271 $ rcond = ( one / anorm ) / ainvnm
272 END IF
273*
274 20 CONTINUE
275 RETURN
276*
277* End of CTRCON
278*
subroutine xerbla(srname, info)
Definition cblat2.f:3285
integer function icamax(n, cx, incx)
ICAMAX
Definition icamax.f:71
subroutine clacn2(n, v, x, est, kase, isave)
CLACN2 estimates the 1-norm of a square matrix, using reverse communication for evaluating matrix-vec...
Definition clacn2.f:131
real function slamch(cmach)
SLAMCH
Definition slamch.f:68
real function clantr(norm, uplo, diag, m, n, a, lda, work)
CLANTR returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition clantr.f:141
subroutine clatrs(uplo, trans, diag, normin, n, a, lda, x, scale, cnorm, info)
CLATRS solves a triangular system of equations with the scale factor set to prevent overflow.
Definition clatrs.f:238
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
subroutine csrscl(n, sa, sx, incx)
CSRSCL multiplies a vector by the reciprocal of a real scalar.
Definition csrscl.f:82
Here is the call graph for this function:
Here is the caller graph for this function: