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