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


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