ztpt06.c
Go to the documentation of this file.
00001 /* ztpt06.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 ztpt06_(doublereal *rcond, doublereal *rcondc, char *
00017         uplo, char *diag, integer *n, doublecomplex *ap, doublereal *rwork, 
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 doublereal dlamch_(char *);
00026     doublereal bignum;
00027     extern doublereal zlantp_(char *, char *, char *, integer *, 
00028             doublecomplex *, doublereal *);
00029 
00030 
00031 /*  -- LAPACK test routine (version 3.1) -- */
00032 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00033 /*     November 2006 */
00034 
00035 /*     .. Scalar Arguments .. */
00036 /*     .. */
00037 /*     .. Array Arguments .. */
00038 /*     .. */
00039 
00040 /*  Purpose */
00041 /*  ======= */
00042 
00043 /*  ZTPT06 computes a test ratio comparing RCOND (the reciprocal */
00044 /*  condition number of the triangular matrix A) and RCONDC, the estimate */
00045 /*  computed by ZTPCON.  Information about the triangular matrix is used */
00046 /*  if one estimate is zero and the other is non-zero to decide if */
00047 /*  underflow in the estimate is justified. */
00048 
00049 /*  Arguments */
00050 /*  ========= */
00051 
00052 /*  RCOND   (input) DOUBLE PRECISION */
00053 /*          The estimate of the reciprocal condition number obtained by */
00054 /*          forming the explicit inverse of the matrix A and computing */
00055 /*          RCOND = 1/( norm(A) * norm(inv(A)) ). */
00056 
00057 /*  RCONDC  (input) DOUBLE PRECISION */
00058 /*          The estimate of the reciprocal condition number computed by */
00059 /*          ZTPCON. */
00060 
00061 /*  UPLO    (input) CHARACTER */
00062 /*          Specifies whether the matrix A is upper or lower triangular. */
00063 /*          = 'U':  Upper triangular */
00064 /*          = 'L':  Lower triangular */
00065 
00066 /*  DIAG    (input) CHARACTER */
00067 /*          Specifies whether or not the matrix A is unit triangular. */
00068 /*          = 'N':  Non-unit triangular */
00069 /*          = 'U':  Unit triangular */
00070 
00071 /*  N       (input) INTEGER */
00072 /*          The order of the matrix A.  N >= 0. */
00073 
00074 /*  AP      (input) COMPLEX*16 array, dimension (N*(N+1)/2) */
00075 /*          The upper or lower triangular matrix A, packed columnwise in */
00076 /*          a linear array.  The j-th column of A is stored in the array */
00077 /*          AP as follows: */
00078 /*          if UPLO = 'U', AP((j-1)*j/2 + i) = A(i,j) for 1<=i<=j; */
00079 /*          if UPLO = 'L', */
00080 /*             AP((j-1)*(n-j) + j*(j+1)/2 + i-j) = A(i,j) for j<=i<=n. */
00081 
00082 /*  RWORK   (workspace) DOUBLE PRECISION array, dimension (N) */
00083 
00084 /*  RAT     (output) DOUBLE PRECISION */
00085 /*          The test ratio.  If both RCOND and RCONDC are nonzero, */
00086 /*             RAT = MAX( RCOND, RCONDC )/MIN( RCOND, RCONDC ) - 1. */
00087 /*          If RAT = 0, the two estimates are exactly the same. */
00088 
00089 /*  ===================================================================== */
00090 
00091 /*     .. Parameters .. */
00092 /*     .. */
00093 /*     .. Local Scalars .. */
00094 /*     .. */
00095 /*     .. External Functions .. */
00096 /*     .. */
00097 /*     .. Intrinsic Functions .. */
00098 /*     .. */
00099 /*     .. Executable Statements .. */
00100 
00101     /* Parameter adjustments */
00102     --rwork;
00103     --ap;
00104 
00105     /* Function Body */
00106     eps = dlamch_("Epsilon");
00107     rmax = max(*rcond,*rcondc);
00108     rmin = min(*rcond,*rcondc);
00109 
00110 /*     Do the easy cases first. */
00111 
00112     if (rmin < 0.) {
00113 
00114 /*        Invalid value for RCOND or RCONDC, return 1/EPS. */
00115 
00116         *rat = 1. / eps;
00117 
00118     } else if (rmin > 0.) {
00119 
00120 /*        Both estimates are positive, return RMAX/RMIN - 1. */
00121 
00122         *rat = rmax / rmin - 1.;
00123 
00124     } else if (rmax == 0.) {
00125 
00126 /*        Both estimates zero. */
00127 
00128         *rat = 0.;
00129 
00130     } else {
00131 
00132 /*        One estimate is zero, the other is non-zero.  If the matrix is */
00133 /*        ill-conditioned, return the nonzero estimate multiplied by */
00134 /*        1/EPS; if the matrix is badly scaled, return the nonzero */
00135 /*        estimate multiplied by BIGNUM/TMAX, where TMAX is the maximum */
00136 /*        element in absolute value in A. */
00137 
00138         bignum = 1. / dlamch_("Safe minimum");
00139         anorm = zlantp_("M", uplo, diag, n, &ap[1], &rwork[1]);
00140 
00141 /* Computing MIN */
00142         d__1 = bignum / max(1.,anorm), d__2 = 1. / eps;
00143         *rat = rmax * min(d__1,d__2);
00144     }
00145 
00146     return 0;
00147 
00148 /*     End of ZTPT06 */
00149 
00150 } /* ztpt06_ */


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