dlasq5.c
Go to the documentation of this file.
00001 /* dlasq5.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 dlasq5_(integer *i0, integer *n0, doublereal *z__, 
00017         integer *pp, doublereal *tau, doublereal *dmin__, doublereal *dmin1, 
00018         doublereal *dmin2, doublereal *dn, doublereal *dnm1, doublereal *dnm2, 
00019          logical *ieee)
00020 {
00021     /* System generated locals */
00022     integer i__1;
00023     doublereal d__1, d__2;
00024 
00025     /* Local variables */
00026     doublereal d__;
00027     integer j4, j4p2;
00028     doublereal emin, temp;
00029 
00030 
00031 /*  -- LAPACK routine (version 3.2)                                    -- */
00032 
00033 /*  -- Contributed by Osni Marques of the Lawrence Berkeley National   -- */
00034 /*  -- Laboratory and Beresford Parlett of the Univ. of California at  -- */
00035 /*  -- Berkeley                                                        -- */
00036 /*  -- November 2008                                                   -- */
00037 
00038 /*  -- LAPACK is a software package provided by Univ. of Tennessee,    -- */
00039 /*  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- */
00040 
00041 /*     .. Scalar Arguments .. */
00042 /*     .. */
00043 /*     .. Array Arguments .. */
00044 /*     .. */
00045 
00046 /*  Purpose */
00047 /*  ======= */
00048 
00049 /*  DLASQ5 computes one dqds transform in ping-pong form, one */
00050 /*  version for IEEE machines another for non IEEE machines. */
00051 
00052 /*  Arguments */
00053 /*  ========= */
00054 
00055 /*  I0    (input) INTEGER */
00056 /*        First index. */
00057 
00058 /*  N0    (input) INTEGER */
00059 /*        Last index. */
00060 
00061 /*  Z     (input) DOUBLE PRECISION array, dimension ( 4*N ) */
00062 /*        Z holds the qd array. EMIN is stored in Z(4*N0) to avoid */
00063 /*        an extra argument. */
00064 
00065 /*  PP    (input) INTEGER */
00066 /*        PP=0 for ping, PP=1 for pong. */
00067 
00068 /*  TAU   (input) DOUBLE PRECISION */
00069 /*        This is the shift. */
00070 
00071 /*  DMIN  (output) DOUBLE PRECISION */
00072 /*        Minimum value of d. */
00073 
00074 /*  DMIN1 (output) DOUBLE PRECISION */
00075 /*        Minimum value of d, excluding D( N0 ). */
00076 
00077 /*  DMIN2 (output) DOUBLE PRECISION */
00078 /*        Minimum value of d, excluding D( N0 ) and D( N0-1 ). */
00079 
00080 /*  DN    (output) DOUBLE PRECISION */
00081 /*        d(N0), the last value of d. */
00082 
00083 /*  DNM1  (output) DOUBLE PRECISION */
00084 /*        d(N0-1). */
00085 
00086 /*  DNM2  (output) DOUBLE PRECISION */
00087 /*        d(N0-2). */
00088 
00089 /*  IEEE  (input) LOGICAL */
00090 /*        Flag for IEEE or non IEEE arithmetic. */
00091 
00092 /*  ===================================================================== */
00093 
00094 /*     .. Parameter .. */
00095 /*     .. */
00096 /*     .. Local Scalars .. */
00097 /*     .. */
00098 /*     .. Intrinsic Functions .. */
00099 /*     .. */
00100 /*     .. Executable Statements .. */
00101 
00102     /* Parameter adjustments */
00103     --z__;
00104 
00105     /* Function Body */
00106     if (*n0 - *i0 - 1 <= 0) {
00107         return 0;
00108     }
00109 
00110     j4 = (*i0 << 2) + *pp - 3;
00111     emin = z__[j4 + 4];
00112     d__ = z__[j4] - *tau;
00113     *dmin__ = d__;
00114     *dmin1 = -z__[j4];
00115 
00116     if (*ieee) {
00117 
00118 /*        Code for IEEE arithmetic. */
00119 
00120         if (*pp == 0) {
00121             i__1 = *n0 - 3 << 2;
00122             for (j4 = *i0 << 2; j4 <= i__1; j4 += 4) {
00123                 z__[j4 - 2] = d__ + z__[j4 - 1];
00124                 temp = z__[j4 + 1] / z__[j4 - 2];
00125                 d__ = d__ * temp - *tau;
00126                 *dmin__ = min(*dmin__,d__);
00127                 z__[j4] = z__[j4 - 1] * temp;
00128 /* Computing MIN */
00129                 d__1 = z__[j4];
00130                 emin = min(d__1,emin);
00131 /* L10: */
00132             }
00133         } else {
00134             i__1 = *n0 - 3 << 2;
00135             for (j4 = *i0 << 2; j4 <= i__1; j4 += 4) {
00136                 z__[j4 - 3] = d__ + z__[j4];
00137                 temp = z__[j4 + 2] / z__[j4 - 3];
00138                 d__ = d__ * temp - *tau;
00139                 *dmin__ = min(*dmin__,d__);
00140                 z__[j4 - 1] = z__[j4] * temp;
00141 /* Computing MIN */
00142                 d__1 = z__[j4 - 1];
00143                 emin = min(d__1,emin);
00144 /* L20: */
00145             }
00146         }
00147 
00148 /*        Unroll last two steps. */
00149 
00150         *dnm2 = d__;
00151         *dmin2 = *dmin__;
00152         j4 = (*n0 - 2 << 2) - *pp;
00153         j4p2 = j4 + (*pp << 1) - 1;
00154         z__[j4 - 2] = *dnm2 + z__[j4p2];
00155         z__[j4] = z__[j4p2 + 2] * (z__[j4p2] / z__[j4 - 2]);
00156         *dnm1 = z__[j4p2 + 2] * (*dnm2 / z__[j4 - 2]) - *tau;
00157         *dmin__ = min(*dmin__,*dnm1);
00158 
00159         *dmin1 = *dmin__;
00160         j4 += 4;
00161         j4p2 = j4 + (*pp << 1) - 1;
00162         z__[j4 - 2] = *dnm1 + z__[j4p2];
00163         z__[j4] = z__[j4p2 + 2] * (z__[j4p2] / z__[j4 - 2]);
00164         *dn = z__[j4p2 + 2] * (*dnm1 / z__[j4 - 2]) - *tau;
00165         *dmin__ = min(*dmin__,*dn);
00166 
00167     } else {
00168 
00169 /*        Code for non IEEE arithmetic. */
00170 
00171         if (*pp == 0) {
00172             i__1 = *n0 - 3 << 2;
00173             for (j4 = *i0 << 2; j4 <= i__1; j4 += 4) {
00174                 z__[j4 - 2] = d__ + z__[j4 - 1];
00175                 if (d__ < 0.) {
00176                     return 0;
00177                 } else {
00178                     z__[j4] = z__[j4 + 1] * (z__[j4 - 1] / z__[j4 - 2]);
00179                     d__ = z__[j4 + 1] * (d__ / z__[j4 - 2]) - *tau;
00180                 }
00181                 *dmin__ = min(*dmin__,d__);
00182 /* Computing MIN */
00183                 d__1 = emin, d__2 = z__[j4];
00184                 emin = min(d__1,d__2);
00185 /* L30: */
00186             }
00187         } else {
00188             i__1 = *n0 - 3 << 2;
00189             for (j4 = *i0 << 2; j4 <= i__1; j4 += 4) {
00190                 z__[j4 - 3] = d__ + z__[j4];
00191                 if (d__ < 0.) {
00192                     return 0;
00193                 } else {
00194                     z__[j4 - 1] = z__[j4 + 2] * (z__[j4] / z__[j4 - 3]);
00195                     d__ = z__[j4 + 2] * (d__ / z__[j4 - 3]) - *tau;
00196                 }
00197                 *dmin__ = min(*dmin__,d__);
00198 /* Computing MIN */
00199                 d__1 = emin, d__2 = z__[j4 - 1];
00200                 emin = min(d__1,d__2);
00201 /* L40: */
00202             }
00203         }
00204 
00205 /*        Unroll last two steps. */
00206 
00207         *dnm2 = d__;
00208         *dmin2 = *dmin__;
00209         j4 = (*n0 - 2 << 2) - *pp;
00210         j4p2 = j4 + (*pp << 1) - 1;
00211         z__[j4 - 2] = *dnm2 + z__[j4p2];
00212         if (*dnm2 < 0.) {
00213             return 0;
00214         } else {
00215             z__[j4] = z__[j4p2 + 2] * (z__[j4p2] / z__[j4 - 2]);
00216             *dnm1 = z__[j4p2 + 2] * (*dnm2 / z__[j4 - 2]) - *tau;
00217         }
00218         *dmin__ = min(*dmin__,*dnm1);
00219 
00220         *dmin1 = *dmin__;
00221         j4 += 4;
00222         j4p2 = j4 + (*pp << 1) - 1;
00223         z__[j4 - 2] = *dnm1 + z__[j4p2];
00224         if (*dnm1 < 0.) {
00225             return 0;
00226         } else {
00227             z__[j4] = z__[j4p2 + 2] * (z__[j4p2] / z__[j4 - 2]);
00228             *dn = z__[j4p2 + 2] * (*dnm1 / z__[j4 - 2]) - *tau;
00229         }
00230         *dmin__ = min(*dmin__,*dn);
00231 
00232     }
00233 
00234     z__[j4 + 2] = *dn;
00235     z__[(*n0 << 2) - *pp] = emin;
00236     return 0;
00237 
00238 /*     End of DLASQ5 */
00239 
00240 } /* dlasq5_ */


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