00001 /* strt06.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 strt06_(real *rcond, real *rcondc, char *uplo, char * 00017 diag, integer *n, real *a, integer *lda, real *work, real *rat) 00018 { 00019 /* System generated locals */ 00020 integer a_dim1, a_offset; 00021 real r__1, r__2; 00022 00023 /* Local variables */ 00024 real eps, rmin, rmax, anorm; 00025 extern /* Subroutine */ int slabad_(real *, real *); 00026 extern doublereal slamch_(char *); 00027 real bignum; 00028 extern doublereal slantr_(char *, char *, char *, integer *, integer *, 00029 real *, integer *, real *); 00030 real 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 /* STRT06 computes a test ratio comparing RCOND (the reciprocal */ 00046 /* condition number of a triangular matrix A) and RCONDC, the estimate */ 00047 /* computed by STRCON. 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) REAL */ 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) REAL */ 00060 /* The estimate of the reciprocal condition number computed by */ 00061 /* STRCON. */ 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 /* A (input) REAL array, dimension (LDA,N) */ 00077 /* The triangular matrix A. If UPLO = 'U', the leading n by n */ 00078 /* upper triangular part of the array A contains the upper */ 00079 /* triangular matrix, and the strictly lower triangular part of */ 00080 /* A is not referenced. If UPLO = 'L', the leading n by n lower */ 00081 /* triangular part of the array A contains the lower triangular */ 00082 /* matrix, and the strictly upper triangular part of A is not */ 00083 /* referenced. If DIAG = 'U', the diagonal elements of A are */ 00084 /* also not referenced and are assumed to be 1. */ 00085 00086 /* LDA (input) INTEGER */ 00087 /* The leading dimension of the array A. LDA >= max(1,N). */ 00088 00089 /* WORK (workspace) REAL array, dimension (N) */ 00090 00091 /* RAT (output) REAL */ 00092 /* The test ratio. If both RCOND and RCONDC are nonzero, */ 00093 /* RAT = MAX( RCOND, RCONDC )/MIN( RCOND, RCONDC ) - 1. */ 00094 /* If RAT = 0, the two estimates are exactly the same. */ 00095 00096 /* ===================================================================== */ 00097 00098 /* .. Parameters .. */ 00099 /* .. */ 00100 /* .. Local Scalars .. */ 00101 /* .. */ 00102 /* .. External Functions .. */ 00103 /* .. */ 00104 /* .. Intrinsic Functions .. */ 00105 /* .. */ 00106 /* .. External Subroutines .. */ 00107 /* .. */ 00108 /* .. Executable Statements .. */ 00109 00110 /* Parameter adjustments */ 00111 a_dim1 = *lda; 00112 a_offset = 1 + a_dim1; 00113 a -= a_offset; 00114 --work; 00115 00116 /* Function Body */ 00117 eps = slamch_("Epsilon"); 00118 rmax = dmax(*rcond,*rcondc); 00119 rmin = dmin(*rcond,*rcondc); 00120 00121 /* Do the easy cases first. */ 00122 00123 if (rmin < 0.f) { 00124 00125 /* Invalid value for RCOND or RCONDC, return 1/EPS. */ 00126 00127 *rat = 1.f / eps; 00128 00129 } else if (rmin > 0.f) { 00130 00131 /* Both estimates are positive, return RMAX/RMIN - 1. */ 00132 00133 *rat = rmax / rmin - 1.f; 00134 00135 } else if (rmax == 0.f) { 00136 00137 /* Both estimates zero. */ 00138 00139 *rat = 0.f; 00140 00141 } else { 00142 00143 /* One estimate is zero, the other is non-zero. If the matrix is */ 00144 /* ill-conditioned, return the nonzero estimate multiplied by */ 00145 /* 1/EPS; if the matrix is badly scaled, return the nonzero */ 00146 /* estimate multiplied by BIGNUM/TMAX, where TMAX is the maximum */ 00147 /* element in absolute value in A. */ 00148 00149 smlnum = slamch_("Safe minimum"); 00150 bignum = 1.f / smlnum; 00151 slabad_(&smlnum, &bignum); 00152 anorm = slantr_("M", uplo, diag, n, n, &a[a_offset], lda, &work[1]); 00153 00154 /* Computing MIN */ 00155 r__1 = bignum / dmax(1.f,anorm), r__2 = 1.f / eps; 00156 *rat = rmax * dmin(r__1,r__2); 00157 } 00158 00159 return 0; 00160 00161 /* End of STRT06 */ 00162 00163 } /* strt06_ */