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


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:56:15