LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
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.
Date
November 2011

Definition at line 139 of file ctrcon.f.

139 *
140 * -- LAPACK computational routine (version 3.4.0) --
141 * -- LAPACK is a software package provided by Univ. of Tennessee, --
142 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
143 * November 2011
144 *
145 * .. Scalar Arguments ..
146  CHARACTER diag, norm, uplo
147  INTEGER info, lda, n
148  REAL rcond
149 * ..
150 * .. Array Arguments ..
151  REAL rwork( * )
152  COMPLEX a( lda, * ), work( * )
153 * ..
154 *
155 * =====================================================================
156 *
157 * .. Parameters ..
158  REAL one, zero
159  parameter ( one = 1.0e+0, zero = 0.0e+0 )
160 * ..
161 * .. Local Scalars ..
162  LOGICAL nounit, onenrm, upper
163  CHARACTER normin
164  INTEGER ix, kase, kase1
165  REAL ainvnm, anorm, scale, smlnum, xnorm
166  COMPLEX zdum
167 * ..
168 * .. Local Arrays ..
169  INTEGER isave( 3 )
170 * ..
171 * .. External Functions ..
172  LOGICAL lsame
173  INTEGER icamax
174  REAL clantr, slamch
175  EXTERNAL lsame, icamax, clantr, slamch
176 * ..
177 * .. External Subroutines ..
178  EXTERNAL clacn2, clatrs, csrscl, xerbla
179 * ..
180 * .. Intrinsic Functions ..
181  INTRINSIC abs, aimag, max, real
182 * ..
183 * .. Statement Functions ..
184  REAL cabs1
185 * ..
186 * .. Statement Function definitions ..
187  cabs1( zdum ) = abs( REAL( ZDUM ) ) + abs( aimag( zdum ) )
188 * ..
189 * .. Executable Statements ..
190 *
191 * Test the input parameters.
192 *
193  info = 0
194  upper = lsame( uplo, 'U' )
195  onenrm = norm.EQ.'1' .OR. lsame( norm, 'O' )
196  nounit = lsame( diag, 'N' )
197 *
198  IF( .NOT.onenrm .AND. .NOT.lsame( norm, 'I' ) ) THEN
199  info = -1
200  ELSE IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
201  info = -2
202  ELSE IF( .NOT.nounit .AND. .NOT.lsame( diag, 'U' ) ) THEN
203  info = -3
204  ELSE IF( n.LT.0 ) THEN
205  info = -4
206  ELSE IF( lda.LT.max( 1, n ) ) THEN
207  info = -6
208  END IF
209  IF( info.NE.0 ) THEN
210  CALL xerbla( 'CTRCON', -info )
211  RETURN
212  END IF
213 *
214 * Quick return if possible
215 *
216  IF( n.EQ.0 ) THEN
217  rcond = one
218  RETURN
219  END IF
220 *
221  rcond = zero
222  smlnum = slamch( 'Safe minimum' )*REAL( MAX( 1, N ) )
223 *
224 * Compute the norm of the triangular matrix A.
225 *
226  anorm = clantr( norm, uplo, diag, n, n, a, lda, rwork )
227 *
228 * Continue only if ANORM > 0.
229 *
230  IF( anorm.GT.zero ) THEN
231 *
232 * Estimate the norm of the inverse of A.
233 *
234  ainvnm = zero
235  normin = 'N'
236  IF( onenrm ) THEN
237  kase1 = 1
238  ELSE
239  kase1 = 2
240  END IF
241  kase = 0
242  10 CONTINUE
243  CALL clacn2( n, work( n+1 ), work, ainvnm, kase, isave )
244  IF( kase.NE.0 ) THEN
245  IF( kase.EQ.kase1 ) THEN
246 *
247 * Multiply by inv(A).
248 *
249  CALL clatrs( uplo, 'No transpose', diag, normin, n, a,
250  $ lda, work, scale, rwork, info )
251  ELSE
252 *
253 * Multiply by inv(A**H).
254 *
255  CALL clatrs( uplo, 'Conjugate transpose', diag, normin,
256  $ n, a, lda, work, scale, rwork, info )
257  END IF
258  normin = 'Y'
259 *
260 * Multiply by 1/SCALE if doing so will not cause overflow.
261 *
262  IF( scale.NE.one ) THEN
263  ix = icamax( n, work, 1 )
264  xnorm = cabs1( work( ix ) )
265  IF( scale.LT.xnorm*smlnum .OR. scale.EQ.zero )
266  $ GO TO 20
267  CALL csrscl( n, scale, work, 1 )
268  END IF
269  GO TO 10
270  END IF
271 *
272 * Compute the estimate of the reciprocal condition number.
273 *
274  IF( ainvnm.NE.zero )
275  $ rcond = ( one / anorm ) / ainvnm
276  END IF
277 *
278  20 CONTINUE
279  RETURN
280 *
281 * End of CTRCON
282 *
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:241
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, or the element of largest absolute value of a trapezoidal or triangular matrix.
Definition: clantr.f:144
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
integer function icamax(N, CX, INCX)
ICAMAX
Definition: icamax.f:53
subroutine csrscl(N, SA, SX, INCX)
CSRSCL multiplies a vector by the reciprocal of a real scalar.
Definition: csrscl.f:86
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:69
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
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:135

Here is the call graph for this function:

Here is the caller graph for this function: