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


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