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


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