dtbt06.c
Go to the documentation of this file.
00001 /* dtbt06.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 dtbt06_(doublereal *rcond, doublereal *rcondc, char *
00017         uplo, char *diag, integer *n, integer *kd, doublereal *ab, integer *
00018         ldab, doublereal *work, doublereal *rat)
00019 {
00020     /* System generated locals */
00021     integer ab_dim1, ab_offset;
00022     doublereal d__1, d__2;
00023 
00024     /* Local variables */
00025     doublereal eps, rmin, rmax, anorm;
00026     extern /* Subroutine */ int dlabad_(doublereal *, doublereal *);
00027     extern doublereal dlamch_(char *), dlantb_(char *, char *, char *, 
00028              integer *, integer *, doublereal *, integer *, doublereal *);
00029     doublereal bignum, smlnum;
00030 
00031 
00032 /*  -- LAPACK test routine (version 3.1) -- */
00033 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00034 /*     November 2006 */
00035 
00036 /*     .. Scalar Arguments .. */
00037 /*     .. */
00038 /*     .. Array Arguments .. */
00039 /*     .. */
00040 
00041 /*  Purpose */
00042 /*  ======= */
00043 
00044 /*  DTBT06 computes a test ratio comparing RCOND (the reciprocal */
00045 /*  condition number of a triangular matrix A) and RCONDC, the estimate */
00046 /*  computed by DTBCON.  Information about the triangular matrix A is */
00047 /*  used if one estimate is zero and the other is non-zero to decide if */
00048 /*  underflow in the estimate is justified. */
00049 
00050 /*  Arguments */
00051 /*  ========= */
00052 
00053 /*  RCOND   (input) DOUBLE PRECISION */
00054 /*          The estimate of the reciprocal condition number obtained by */
00055 /*          forming the explicit inverse of the matrix A and computing */
00056 /*          RCOND = 1/( norm(A) * norm(inv(A)) ). */
00057 
00058 /*  RCONDC  (input) DOUBLE PRECISION */
00059 /*          The estimate of the reciprocal condition number computed by */
00060 /*          DTBCON. */
00061 
00062 /*  UPLO    (input) CHARACTER */
00063 /*          Specifies whether the matrix A is upper or lower triangular. */
00064 /*          = 'U':  Upper triangular */
00065 /*          = 'L':  Lower triangular */
00066 
00067 /*  DIAG    (input) CHARACTER */
00068 /*          Specifies whether or not the matrix A is unit triangular. */
00069 /*          = 'N':  Non-unit triangular */
00070 /*          = 'U':  Unit triangular */
00071 
00072 /*  N       (input) INTEGER */
00073 /*          The order of the matrix A.  N >= 0. */
00074 
00075 /*  KD      (input) INTEGER */
00076 /*          The number of superdiagonals or subdiagonals of the */
00077 /*          triangular band matrix A.  KD >= 0. */
00078 
00079 /*  AB      (input) DOUBLE PRECISION array, dimension (LDAB,N) */
00080 /*          The upper or lower triangular band matrix A, stored in the */
00081 /*          first kd+1 rows of the array. The j-th column of A is stored */
00082 /*          in the j-th column of the array AB as follows: */
00083 /*          if UPLO = 'U', AB(kd+1+i-j,j) = A(i,j) for max(1,j-kd)<=i<=j; */
00084 /*          if UPLO = 'L', AB(1+i-j,j)    = A(i,j) for j<=i<=min(n,j+kd). */
00085 
00086 /*  LDAB    (input) INTEGER */
00087 /*          The leading dimension of the array AB.  LDAB >= KD+1. */
00088 
00089 /*  WORK    (workspace) DOUBLE PRECISION array, dimension (N) */
00090 
00091 /*  RAT     (output) DOUBLE PRECISION */
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     ab_dim1 = *ldab;
00112     ab_offset = 1 + ab_dim1;
00113     ab -= ab_offset;
00114     --work;
00115 
00116     /* Function Body */
00117     eps = dlamch_("Epsilon");
00118     rmax = max(*rcond,*rcondc);
00119     rmin = min(*rcond,*rcondc);
00120 
00121 /*     Do the easy cases first. */
00122 
00123     if (rmin < 0.) {
00124 
00125 /*        Invalid value for RCOND or RCONDC, return 1/EPS. */
00126 
00127         *rat = 1. / eps;
00128 
00129     } else if (rmin > 0.) {
00130 
00131 /*        Both estimates are positive, return RMAX/RMIN - 1. */
00132 
00133         *rat = rmax / rmin - 1.;
00134 
00135     } else if (rmax == 0.) {
00136 
00137 /*        Both estimates zero. */
00138 
00139         *rat = 0.;
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 = dlamch_("Safe minimum");
00150         bignum = 1. / smlnum;
00151         dlabad_(&smlnum, &bignum);
00152         anorm = dlantb_("M", uplo, diag, n, kd, &ab[ab_offset], ldab, &work[1]
00153 );
00154 
00155 /* Computing MIN */
00156         d__1 = bignum / max(1.,anorm), d__2 = 1. / eps;
00157         *rat = rmax * min(d__1,d__2);
00158     }
00159 
00160     return 0;
00161 
00162 /*     End of DTBT06 */
00163 
00164 } /* dtbt06_ */


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:55:49