00001 /* stbt06.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 stbt06_(real *rcond, real *rcondc, char *uplo, char * 00017 diag, integer *n, integer *kd, real *ab, integer *ldab, real *work, 00018 real *rat) 00019 { 00020 /* System generated locals */ 00021 integer ab_dim1, ab_offset; 00022 real r__1, r__2; 00023 00024 /* Local variables */ 00025 real eps, rmin, rmax, anorm; 00026 extern /* Subroutine */ int slabad_(real *, real *); 00027 extern doublereal slamch_(char *); 00028 real bignum; 00029 extern doublereal slantb_(char *, char *, char *, integer *, integer *, 00030 real *, integer *, real *); 00031 real smlnum; 00032 00033 00034 /* -- LAPACK test routine (version 3.1) -- */ 00035 /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */ 00036 /* November 2006 */ 00037 00038 /* .. Scalar Arguments .. */ 00039 /* .. */ 00040 /* .. Array Arguments .. */ 00041 /* .. */ 00042 00043 /* Purpose */ 00044 /* ======= */ 00045 00046 /* STBT06 computes a test ratio comparing RCOND (the reciprocal */ 00047 /* condition number of a triangular matrix A) and RCONDC, the estimate */ 00048 /* computed by STBCON. Information about the triangular matrix A is */ 00049 /* used if one estimate is zero and the other is non-zero to decide if */ 00050 /* underflow in the estimate is justified. */ 00051 00052 /* Arguments */ 00053 /* ========= */ 00054 00055 /* RCOND (input) REAL */ 00056 /* The estimate of the reciprocal condition number obtained by */ 00057 /* forming the explicit inverse of the matrix A and computing */ 00058 /* RCOND = 1/( norm(A) * norm(inv(A)) ). */ 00059 00060 /* RCONDC (input) REAL */ 00061 /* The estimate of the reciprocal condition number computed by */ 00062 /* STBCON. */ 00063 00064 /* UPLO (input) CHARACTER */ 00065 /* Specifies whether the matrix A is upper or lower triangular. */ 00066 /* = 'U': Upper triangular */ 00067 /* = 'L': Lower triangular */ 00068 00069 /* DIAG (input) CHARACTER */ 00070 /* Specifies whether or not the matrix A is unit triangular. */ 00071 /* = 'N': Non-unit triangular */ 00072 /* = 'U': Unit triangular */ 00073 00074 /* N (input) INTEGER */ 00075 /* The order of the matrix A. N >= 0. */ 00076 00077 /* KD (input) INTEGER */ 00078 /* The number of superdiagonals or subdiagonals of the */ 00079 /* triangular band matrix A. KD >= 0. */ 00080 00081 /* AB (input) REAL array, dimension (LDAB,N) */ 00082 /* The upper or lower triangular band matrix A, stored in the */ 00083 /* first kd+1 rows of the array. The j-th column of A is stored */ 00084 /* in the j-th column of the array AB as follows: */ 00085 /* if UPLO = 'U', AB(kd+1+i-j,j) = A(i,j) for max(1,j-kd)<=i<=j; */ 00086 /* if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(n,j+kd). */ 00087 00088 /* LDAB (input) INTEGER */ 00089 /* The leading dimension of the array AB. LDAB >= KD+1. */ 00090 00091 /* WORK (workspace) REAL array, dimension (N) */ 00092 00093 /* RAT (output) REAL */ 00094 /* The test ratio. If both RCOND and RCONDC are nonzero, */ 00095 /* RAT = MAX( RCOND, RCONDC )/MIN( RCOND, RCONDC ) - 1. */ 00096 /* If RAT = 0, the two estimates are exactly the same. */ 00097 00098 /* ===================================================================== */ 00099 00100 /* .. Parameters .. */ 00101 /* .. */ 00102 /* .. Local Scalars .. */ 00103 /* .. */ 00104 /* .. External Functions .. */ 00105 /* .. */ 00106 /* .. Intrinsic Functions .. */ 00107 /* .. */ 00108 /* .. External Subroutines .. */ 00109 /* .. */ 00110 /* .. Executable Statements .. */ 00111 00112 /* Parameter adjustments */ 00113 ab_dim1 = *ldab; 00114 ab_offset = 1 + ab_dim1; 00115 ab -= ab_offset; 00116 --work; 00117 00118 /* Function Body */ 00119 eps = slamch_("Epsilon"); 00120 rmax = dmax(*rcond,*rcondc); 00121 rmin = dmin(*rcond,*rcondc); 00122 00123 /* Do the easy cases first. */ 00124 00125 if (rmin < 0.f) { 00126 00127 /* Invalid value for RCOND or RCONDC, return 1/EPS. */ 00128 00129 *rat = 1.f / eps; 00130 00131 } else if (rmin > 0.f) { 00132 00133 /* Both estimates are positive, return RMAX/RMIN - 1. */ 00134 00135 *rat = rmax / rmin - 1.f; 00136 00137 } else if (rmax == 0.f) { 00138 00139 /* Both estimates zero. */ 00140 00141 *rat = 0.f; 00142 00143 } else { 00144 00145 /* One estimate is zero, the other is non-zero. If the matrix is */ 00146 /* ill-conditioned, return the nonzero estimate multiplied by */ 00147 /* 1/EPS; if the matrix is badly scaled, return the nonzero */ 00148 /* estimate multiplied by BIGNUM/TMAX, where TMAX is the maximum */ 00149 /* element in absolute value in A. */ 00150 00151 smlnum = slamch_("Safe minimum"); 00152 bignum = 1.f / smlnum; 00153 slabad_(&smlnum, &bignum); 00154 anorm = slantb_("M", uplo, diag, n, kd, &ab[ab_offset], ldab, &work[1] 00155 ); 00156 00157 /* Computing MIN */ 00158 r__1 = bignum / dmax(1.f,anorm), r__2 = 1.f / eps; 00159 *rat = rmax * dmin(r__1,r__2); 00160 } 00161 00162 return 0; 00163 00164 /* End of STBT06 */ 00165 00166 } /* stbt06_ */