00001 /* dtpt06.f -- translated by f2c (version 20061008). 00002 You must link the resulting object file with libf2c: 00003 on Microsoft Windows system, link with libf2c.lib; 00004 on Linux or Unix systems, link with .../path/to/libf2c.a -lm 00005 or, if you install libf2c.a in a standard place, with -lf2c -lm 00006 -- in that order, at the end of the command line, as in 00007 cc *.o -lf2c -lm 00008 Source for libf2c is in /netlib/f2c/libf2c.zip, e.g., 00009 00010 http://www.netlib.org/f2c/libf2c.zip 00011 */ 00012 00013 #include "f2c.h" 00014 #include "blaswrap.h" 00015 00016 /* Subroutine */ int dtpt06_(doublereal *rcond, doublereal *rcondc, char * 00017 uplo, char *diag, integer *n, doublereal *ap, doublereal *work, 00018 doublereal *rat) 00019 { 00020 /* System generated locals */ 00021 doublereal d__1, d__2; 00022 00023 /* Local variables */ 00024 doublereal eps, rmin, rmax, anorm; 00025 extern /* Subroutine */ int dlabad_(doublereal *, doublereal *); 00026 extern doublereal dlamch_(char *); 00027 doublereal bignum; 00028 extern doublereal dlantp_(char *, char *, char *, integer *, doublereal *, 00029 doublereal *); 00030 doublereal smlnum; 00031 00032 00033 /* -- LAPACK test routine (version 3.1) -- */ 00034 /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */ 00035 /* November 2006 */ 00036 00037 /* .. Scalar Arguments .. */ 00038 /* .. */ 00039 /* .. Array Arguments .. */ 00040 /* .. */ 00041 00042 /* Purpose */ 00043 /* ======= */ 00044 00045 /* DTPT06 computes a test ratio comparing RCOND (the reciprocal */ 00046 /* condition number of a triangular matrix A) and RCONDC, the estimate */ 00047 /* computed by DTPCON. Information about the triangular matrix A is */ 00048 /* used if one estimate is zero and the other is non-zero to decide if */ 00049 /* underflow in the estimate is justified. */ 00050 00051 /* Arguments */ 00052 /* ========= */ 00053 00054 /* RCOND (input) DOUBLE PRECISION */ 00055 /* The estimate of the reciprocal condition number obtained by */ 00056 /* forming the explicit inverse of the matrix A and computing */ 00057 /* RCOND = 1/( norm(A) * norm(inv(A)) ). */ 00058 00059 /* RCONDC (input) DOUBLE PRECISION */ 00060 /* The estimate of the reciprocal condition number computed by */ 00061 /* DTPCON. */ 00062 00063 /* UPLO (input) CHARACTER */ 00064 /* Specifies whether the matrix A is upper or lower triangular. */ 00065 /* = 'U': Upper triangular */ 00066 /* = 'L': Lower triangular */ 00067 00068 /* DIAG (input) CHARACTER */ 00069 /* Specifies whether or not the matrix A is unit triangular. */ 00070 /* = 'N': Non-unit triangular */ 00071 /* = 'U': Unit triangular */ 00072 00073 /* N (input) INTEGER */ 00074 /* The order of the matrix A. N >= 0. */ 00075 00076 /* AP (input) DOUBLE PRECISION array, dimension (N*(N+1)/2) */ 00077 /* The upper or lower triangular matrix A, packed columnwise in */ 00078 /* a linear array. The j-th column of A is stored in the array */ 00079 /* AP as follows: */ 00080 /* if UPLO = 'U', AP((j-1)*j/2 + i) = A(i,j) for 1<=i<=j; */ 00081 /* if UPLO = 'L', */ 00082 /* AP((j-1)*(n-j) + j*(j+1)/2 + i-j) = A(i,j) for j<=i<=n. */ 00083 00084 /* WORK (workspace) DOUBLE PRECISION array, dimension (N) */ 00085 00086 /* RAT (output) DOUBLE PRECISION */ 00087 /* The test ratio. If both RCOND and RCONDC are nonzero, */ 00088 /* RAT = MAX( RCOND, RCONDC )/MIN( RCOND, RCONDC ) - 1. */ 00089 /* If RAT = 0, the two estimates are exactly the same. */ 00090 00091 /* ===================================================================== */ 00092 00093 /* .. Parameters .. */ 00094 /* .. */ 00095 /* .. Local Scalars .. */ 00096 /* .. */ 00097 /* .. External Functions .. */ 00098 /* .. */ 00099 /* .. Intrinsic Functions .. */ 00100 /* .. */ 00101 /* .. External Subroutines .. */ 00102 /* .. */ 00103 /* .. Executable Statements .. */ 00104 00105 /* Parameter adjustments */ 00106 --work; 00107 --ap; 00108 00109 /* Function Body */ 00110 eps = dlamch_("Epsilon"); 00111 rmax = max(*rcond,*rcondc); 00112 rmin = min(*rcond,*rcondc); 00113 00114 /* Do the easy cases first. */ 00115 00116 if (rmin < 0.) { 00117 00118 /* Invalid value for RCOND or RCONDC, return 1/EPS. */ 00119 00120 *rat = 1. / eps; 00121 00122 } else if (rmin > 0.) { 00123 00124 /* Both estimates are positive, return RMAX/RMIN - 1. */ 00125 00126 *rat = rmax / rmin - 1.; 00127 00128 } else if (rmax == 0.) { 00129 00130 /* Both estimates zero. */ 00131 00132 *rat = 0.; 00133 00134 } else { 00135 00136 /* One estimate is zero, the other is non-zero. If the matrix is */ 00137 /* ill-conditioned, return the nonzero estimate multiplied by */ 00138 /* 1/EPS; if the matrix is badly scaled, return the nonzero */ 00139 /* estimate multiplied by BIGNUM/TMAX, where TMAX is the maximum */ 00140 /* element in absolute value in A. */ 00141 00142 smlnum = dlamch_("Safe minimum"); 00143 bignum = 1. / smlnum; 00144 dlabad_(&smlnum, &bignum); 00145 anorm = dlantp_("M", uplo, diag, n, &ap[1], &work[1]); 00146 00147 /* Computing MIN */ 00148 d__1 = bignum / max(1.,anorm), d__2 = 1. / eps; 00149 *rat = rmax * min(d__1,d__2); 00150 } 00151 00152 return 0; 00153 00154 /* End of DTPT06 */ 00155 00156 } /* dtpt06_ */