LAPACK 3.3.0

ctpt06.f

Go to the documentation of this file.
00001       SUBROUTINE CTPT06( RCOND, RCONDC, UPLO, DIAG, N, AP, RWORK, RAT )
00002 *
00003 *  -- LAPACK test routine (version 3.1) --
00004 *     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
00005 *     November 2006
00006 *
00007 *     .. Scalar Arguments ..
00008       CHARACTER          DIAG, UPLO
00009       INTEGER            N
00010       REAL               RAT, RCOND, RCONDC
00011 *     ..
00012 *     .. Array Arguments ..
00013       REAL               RWORK( * )
00014       COMPLEX            AP( * )
00015 *     ..
00016 *
00017 *  Purpose
00018 *  =======
00019 *
00020 *  CTPT06 computes a test ratio comparing RCOND (the reciprocal
00021 *  condition number of the triangular matrix A) and RCONDC, the estimate
00022 *  computed by CTPCON.  Information about the triangular matrix is used
00023 *  if one estimate is zero and the other is non-zero to decide if
00024 *  underflow in the estimate is justified.
00025 *
00026 *  Arguments
00027 *  =========
00028 *
00029 *  RCOND   (input) REAL
00030 *          The estimate of the reciprocal condition number obtained by
00031 *          forming the explicit inverse of the matrix A and computing
00032 *          RCOND = 1/( norm(A) * norm(inv(A)) ).
00033 *
00034 *  RCONDC  (input) REAL
00035 *          The estimate of the reciprocal condition number computed by
00036 *          CTPCON.
00037 *
00038 *  UPLO    (input) CHARACTER
00039 *          Specifies whether the matrix A is upper or lower triangular.
00040 *          = 'U':  Upper triangular
00041 *          = 'L':  Lower triangular
00042 *
00043 *  DIAG    (input) CHARACTER
00044 *          Specifies whether or not the matrix A is unit triangular.
00045 *          = 'N':  Non-unit triangular
00046 *          = 'U':  Unit triangular
00047 *
00048 *  N       (input) INTEGER
00049 *          The order of the matrix A.  N >= 0.
00050 *
00051 *  AP      (input) COMPLEX array, dimension (N*(N+1)/2)
00052 *          The upper or lower triangular matrix A, packed columnwise in
00053 *          a linear array.  The j-th column of A is stored in the array
00054 *          AP as follows:
00055 *          if UPLO = 'U', AP((j-1)*j/2 + i) = A(i,j) for 1<=i<=j;
00056 *          if UPLO = 'L',
00057 *             AP((j-1)*(n-j) + j*(j+1)/2 + i-j) = A(i,j) for j<=i<=n.
00058 *
00059 *  RWORK   (workspace) REAL array, dimension (N)
00060 *
00061 *  RAT     (output) REAL
00062 *          The test ratio.  If both RCOND and RCONDC are nonzero,
00063 *             RAT = MAX( RCOND, RCONDC )/MIN( RCOND, RCONDC ) - 1.
00064 *          If RAT = 0, the two estimates are exactly the same.
00065 *
00066 *  =====================================================================
00067 *
00068 *     .. Parameters ..
00069       REAL               ZERO, ONE
00070       PARAMETER          ( ZERO = 0.0E+0, ONE = 1.0E+0 )
00071 *     ..
00072 *     .. Local Scalars ..
00073       REAL               ANORM, BIGNUM, EPS, RMAX, RMIN
00074 *     ..
00075 *     .. External Functions ..
00076       REAL               CLANTP, SLAMCH
00077       EXTERNAL           CLANTP, SLAMCH
00078 *     ..
00079 *     .. Intrinsic Functions ..
00080       INTRINSIC          MAX, MIN
00081 *     ..
00082 *     .. Executable Statements ..
00083 *
00084       EPS = SLAMCH( 'Epsilon' )
00085       RMAX = MAX( RCOND, RCONDC )
00086       RMIN = MIN( RCOND, RCONDC )
00087 *
00088 *     Do the easy cases first.
00089 *
00090       IF( RMIN.LT.ZERO ) THEN
00091 *
00092 *        Invalid value for RCOND or RCONDC, return 1/EPS.
00093 *
00094          RAT = ONE / EPS
00095 *
00096       ELSE IF( RMIN.GT.ZERO ) THEN
00097 *
00098 *        Both estimates are positive, return RMAX/RMIN - 1.
00099 *
00100          RAT = RMAX / RMIN - ONE
00101 *
00102       ELSE IF( RMAX.EQ.ZERO ) THEN
00103 *
00104 *        Both estimates zero.
00105 *
00106          RAT = ZERO
00107 *
00108       ELSE
00109 *
00110 *        One estimate is zero, the other is non-zero.  If the matrix is
00111 *        ill-conditioned, return the nonzero estimate multiplied by
00112 *        1/EPS; if the matrix is badly scaled, return the nonzero
00113 *        estimate multiplied by BIGNUM/TMAX, where TMAX is the maximum
00114 *        element in absolute value in A.
00115 *
00116          BIGNUM = ONE / SLAMCH( 'Safe minimum' )
00117          ANORM = CLANTP( 'M', UPLO, DIAG, N, AP, RWORK )
00118 *
00119          RAT = RMAX*( MIN( BIGNUM / MAX( ONE, ANORM ), ONE / EPS ) )
00120       END IF
00121 *
00122       RETURN
00123 *
00124 *     End of CTPT06
00125 *
00126       END
 All Files Functions