slarrr.c
Go to the documentation of this file.
00001 /* slarrr.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 slarrr_(integer *n, real *d__, real *e, integer *info)
00017 {
00018     /* System generated locals */
00019     integer i__1;
00020     real r__1;
00021 
00022     /* Builtin functions */
00023     double sqrt(doublereal);
00024 
00025     /* Local variables */
00026     integer i__;
00027     real eps, tmp, tmp2, rmin, offdig;
00028     extern doublereal slamch_(char *);
00029     real safmin;
00030     logical yesrel;
00031     real smlnum, offdig2;
00032 
00033 
00034 /*  -- LAPACK auxiliary routine (version 3.2) -- */
00035 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00036 /*     November 2006 */
00037 
00038 /*     .. Scalar Arguments .. */
00039 /*     .. */
00040 /*     .. Array Arguments .. */
00041 /*     .. */
00042 
00043 
00044 /*  Purpose */
00045 /*  ======= */
00046 
00047 /*  Perform tests to decide whether the symmetric tridiagonal matrix T */
00048 /*  warrants expensive computations which guarantee high relative accuracy */
00049 /*  in the eigenvalues. */
00050 
00051 /*  Arguments */
00052 /*  ========= */
00053 
00054 /*  N       (input) INTEGER */
00055 /*          The order of the matrix. N > 0. */
00056 
00057 /*  D       (input) REAL             array, dimension (N) */
00058 /*          The N diagonal elements of the tridiagonal matrix T. */
00059 
00060 /*  E       (input/output) REAL             array, dimension (N) */
00061 /*          On entry, the first (N-1) entries contain the subdiagonal */
00062 /*          elements of the tridiagonal matrix T; E(N) is set to ZERO. */
00063 
00064 /*  INFO    (output) INTEGER */
00065 /*          INFO = 0(default) : the matrix warrants computations preserving */
00066 /*                              relative accuracy. */
00067 /*          INFO = 1          : the matrix warrants computations guaranteeing */
00068 /*                              only absolute accuracy. */
00069 
00070 /*  Further Details */
00071 /*  =============== */
00072 
00073 /*  Based on contributions by */
00074 /*     Beresford Parlett, University of California, Berkeley, USA */
00075 /*     Jim Demmel, University of California, Berkeley, USA */
00076 /*     Inderjit Dhillon, University of Texas, Austin, USA */
00077 /*     Osni Marques, LBNL/NERSC, USA */
00078 /*     Christof Voemel, University of California, Berkeley, USA */
00079 
00080 /*  ===================================================================== */
00081 
00082 /*     .. Parameters .. */
00083 /*     .. */
00084 /*     .. Local Scalars .. */
00085 /*     .. */
00086 /*     .. External Functions .. */
00087 /*     .. */
00088 /*     .. Intrinsic Functions .. */
00089 /*     .. */
00090 /*     .. Executable Statements .. */
00091 
00092 /*     As a default, do NOT go for relative-accuracy preserving computations. */
00093     /* Parameter adjustments */
00094     --e;
00095     --d__;
00096 
00097     /* Function Body */
00098     *info = 1;
00099     safmin = slamch_("Safe minimum");
00100     eps = slamch_("Precision");
00101     smlnum = safmin / eps;
00102     rmin = sqrt(smlnum);
00103 /*     Tests for relative accuracy */
00104 
00105 /*     Test for scaled diagonal dominance */
00106 /*     Scale the diagonal entries to one and check whether the sum of the */
00107 /*     off-diagonals is less than one */
00108 
00109 /*     The sdd relative error bounds have a 1/(1- 2*x) factor in them, */
00110 /*     x = max(OFFDIG + OFFDIG2), so when x is close to 1/2, no relative */
00111 /*     accuracy is promised.  In the notation of the code fragment below, */
00112 /*     1/(1 - (OFFDIG + OFFDIG2)) is the condition number. */
00113 /*     We don't think it is worth going into "sdd mode" unless the relative */
00114 /*     condition number is reasonable, not 1/macheps. */
00115 /*     The threshold should be compatible with other thresholds used in the */
00116 /*     code. We set  OFFDIG + OFFDIG2 <= .999 =: RELCOND, it corresponds */
00117 /*     to losing at most 3 decimal digits: 1 / (1 - (OFFDIG + OFFDIG2)) <= 1000 */
00118 /*     instead of the current OFFDIG + OFFDIG2 < 1 */
00119 
00120     yesrel = TRUE_;
00121     offdig = 0.f;
00122     tmp = sqrt((dabs(d__[1])));
00123     if (tmp < rmin) {
00124         yesrel = FALSE_;
00125     }
00126     if (! yesrel) {
00127         goto L11;
00128     }
00129     i__1 = *n;
00130     for (i__ = 2; i__ <= i__1; ++i__) {
00131         tmp2 = sqrt((r__1 = d__[i__], dabs(r__1)));
00132         if (tmp2 < rmin) {
00133             yesrel = FALSE_;
00134         }
00135         if (! yesrel) {
00136             goto L11;
00137         }
00138         offdig2 = (r__1 = e[i__ - 1], dabs(r__1)) / (tmp * tmp2);
00139         if (offdig + offdig2 >= .999f) {
00140             yesrel = FALSE_;
00141         }
00142         if (! yesrel) {
00143             goto L11;
00144         }
00145         tmp = tmp2;
00146         offdig = offdig2;
00147 /* L10: */
00148     }
00149 L11:
00150     if (yesrel) {
00151         *info = 0;
00152         return 0;
00153     } else {
00154     }
00155 
00156 
00157 /*     *** MORE TO BE IMPLEMENTED *** */
00158 
00159 
00160 /*     Test if the lower bidiagonal matrix L from T = L D L^T */
00161 /*     (zero shift facto) is well conditioned */
00162 
00163 
00164 /*     Test if the upper bidiagonal matrix U from T = U D U^T */
00165 /*     (zero shift facto) is well conditioned. */
00166 /*     In this case, the matrix needs to be flipped and, at the end */
00167 /*     of the eigenvector computation, the flip needs to be applied */
00168 /*     to the computed eigenvectors (and the support) */
00169 
00170 
00171     return 0;
00172 
00173 /*     END OF SLARRR */
00174 
00175 } /* slarrr_ */


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