iparmq.c
Go to the documentation of this file.
00001 /* iparmq.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 integer iparmq_(integer *ispec, char *name__, char *opts, integer *n, integer 
00017         *ilo, integer *ihi, integer *lwork)
00018 {
00019     /* System generated locals */
00020     integer ret_val, i__1, i__2;
00021     real r__1;
00022 
00023     /* Builtin functions */
00024     double log(doublereal);
00025     integer i_nint(real *);
00026 
00027     /* Local variables */
00028     integer nh, ns;
00029 
00030 
00031 /*  -- LAPACK auxiliary routine (version 3.2) -- */
00032 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00033 /*     November 2006 */
00034 
00035 /*     .. Scalar Arguments .. */
00036 
00037 /*  Purpose */
00038 /*  ======= */
00039 
00040 /*       This program sets problem and machine dependent parameters */
00041 /*       useful for xHSEQR and its subroutines. It is called whenever */
00042 /*       ILAENV is called with 12 <= ISPEC <= 16 */
00043 
00044 /*  Arguments */
00045 /*  ========= */
00046 
00047 /*       ISPEC  (input) integer scalar */
00048 /*              ISPEC specifies which tunable parameter IPARMQ should */
00049 /*              return. */
00050 
00051 /*              ISPEC=12: (INMIN)  Matrices of order nmin or less */
00052 /*                        are sent directly to xLAHQR, the implicit */
00053 /*                        double shift QR algorithm.  NMIN must be */
00054 /*                        at least 11. */
00055 
00056 /*              ISPEC=13: (INWIN)  Size of the deflation window. */
00057 /*                        This is best set greater than or equal to */
00058 /*                        the number of simultaneous shifts NS. */
00059 /*                        Larger matrices benefit from larger deflation */
00060 /*                        windows. */
00061 
00062 /*              ISPEC=14: (INIBL) Determines when to stop nibbling and */
00063 /*                        invest in an (expensive) multi-shift QR sweep. */
00064 /*                        If the aggressive early deflation subroutine */
00065 /*                        finds LD converged eigenvalues from an order */
00066 /*                        NW deflation window and LD.GT.(NW*NIBBLE)/100, */
00067 /*                        then the next QR sweep is skipped and early */
00068 /*                        deflation is applied immediately to the */
00069 /*                        remaining active diagonal block.  Setting */
00070 /*                        IPARMQ(ISPEC=14) = 0 causes TTQRE to skip a */
00071 /*                        multi-shift QR sweep whenever early deflation */
00072 /*                        finds a converged eigenvalue.  Setting */
00073 /*                        IPARMQ(ISPEC=14) greater than or equal to 100 */
00074 /*                        prevents TTQRE from skipping a multi-shift */
00075 /*                        QR sweep. */
00076 
00077 /*              ISPEC=15: (NSHFTS) The number of simultaneous shifts in */
00078 /*                        a multi-shift QR iteration. */
00079 
00080 /*              ISPEC=16: (IACC22) IPARMQ is set to 0, 1 or 2 with the */
00081 /*                        following meanings. */
00082 /*                        0:  During the multi-shift QR sweep, */
00083 /*                            xLAQR5 does not accumulate reflections and */
00084 /*                            does not use matrix-matrix multiply to */
00085 /*                            update the far-from-diagonal matrix */
00086 /*                            entries. */
00087 /*                        1:  During the multi-shift QR sweep, */
00088 /*                            xLAQR5 and/or xLAQRaccumulates reflections and uses */
00089 /*                            matrix-matrix multiply to update the */
00090 /*                            far-from-diagonal matrix entries. */
00091 /*                        2:  During the multi-shift QR sweep. */
00092 /*                            xLAQR5 accumulates reflections and takes */
00093 /*                            advantage of 2-by-2 block structure during */
00094 /*                            matrix-matrix multiplies. */
00095 /*                        (If xTRMM is slower than xGEMM, then */
00096 /*                        IPARMQ(ISPEC=16)=1 may be more efficient than */
00097 /*                        IPARMQ(ISPEC=16)=2 despite the greater level of */
00098 /*                        arithmetic work implied by the latter choice.) */
00099 
00100 /*       NAME    (input) character string */
00101 /*               Name of the calling subroutine */
00102 
00103 /*       OPTS    (input) character string */
00104 /*               This is a concatenation of the string arguments to */
00105 /*               TTQRE. */
00106 
00107 /*       N       (input) integer scalar */
00108 /*               N is the order of the Hessenberg matrix H. */
00109 
00110 /*       ILO     (input) INTEGER */
00111 /*       IHI     (input) INTEGER */
00112 /*               It is assumed that H is already upper triangular */
00113 /*               in rows and columns 1:ILO-1 and IHI+1:N. */
00114 
00115 /*       LWORK   (input) integer scalar */
00116 /*               The amount of workspace available. */
00117 
00118 /*  Further Details */
00119 /*  =============== */
00120 
00121 /*       Little is known about how best to choose these parameters. */
00122 /*       It is possible to use different values of the parameters */
00123 /*       for each of CHSEQR, DHSEQR, SHSEQR and ZHSEQR. */
00124 
00125 /*       It is probably best to choose different parameters for */
00126 /*       different matrices and different parameters at different */
00127 /*       times during the iteration, but this has not been */
00128 /*       implemented --- yet. */
00129 
00130 
00131 /*       The best choices of most of the parameters depend */
00132 /*       in an ill-understood way on the relative execution */
00133 /*       rate of xLAQR3 and xLAQR5 and on the nature of each */
00134 /*       particular eigenvalue problem.  Experiment may be the */
00135 /*       only practical way to determine which choices are most */
00136 /*       effective. */
00137 
00138 /*       Following is a list of default values supplied by IPARMQ. */
00139 /*       These defaults may be adjusted in order to attain better */
00140 /*       performance in any particular computational environment. */
00141 
00142 /*       IPARMQ(ISPEC=12) The xLAHQR vs xLAQR0 crossover point. */
00143 /*                        Default: 75. (Must be at least 11.) */
00144 
00145 /*       IPARMQ(ISPEC=13) Recommended deflation window size. */
00146 /*                        This depends on ILO, IHI and NS, the */
00147 /*                        number of simultaneous shifts returned */
00148 /*                        by IPARMQ(ISPEC=15).  The default for */
00149 /*                        (IHI-ILO+1).LE.500 is NS.  The default */
00150 /*                        for (IHI-ILO+1).GT.500 is 3*NS/2. */
00151 
00152 /*       IPARMQ(ISPEC=14) Nibble crossover point.  Default: 14. */
00153 
00154 /*       IPARMQ(ISPEC=15) Number of simultaneous shifts, NS. */
00155 /*                        a multi-shift QR iteration. */
00156 
00157 /*                        If IHI-ILO+1 is ... */
00158 
00159 /*                        greater than      ...but less    ... the */
00160 /*                        or equal to ...      than        default is */
00161 
00162 /*                                0               30       NS =   2+ */
00163 /*                               30               60       NS =   4+ */
00164 /*                               60              150       NS =  10 */
00165 /*                              150              590       NS =  ** */
00166 /*                              590             3000       NS =  64 */
00167 /*                             3000             6000       NS = 128 */
00168 /*                             6000             infinity   NS = 256 */
00169 
00170 /*                    (+)  By default matrices of this order are */
00171 /*                         passed to the implicit double shift routine */
00172 /*                         xLAHQR.  See IPARMQ(ISPEC=12) above.   These */
00173 /*                         values of NS are used only in case of a rare */
00174 /*                         xLAHQR failure. */
00175 
00176 /*                    (**) The asterisks (**) indicate an ad-hoc */
00177 /*                         function increasing from 10 to 64. */
00178 
00179 /*       IPARMQ(ISPEC=16) Select structured matrix multiply. */
00180 /*                        (See ISPEC=16 above for details.) */
00181 /*                        Default: 3. */
00182 
00183 /*     ================================================================ */
00184 /*     .. Parameters .. */
00185 /*     .. */
00186 /*     .. Local Scalars .. */
00187 /*     .. */
00188 /*     .. Intrinsic Functions .. */
00189 /*     .. */
00190 /*     .. Executable Statements .. */
00191     if (*ispec == 15 || *ispec == 13 || *ispec == 16) {
00192 
00193 /*        ==== Set the number simultaneous shifts ==== */
00194 
00195         nh = *ihi - *ilo + 1;
00196         ns = 2;
00197         if (nh >= 30) {
00198             ns = 4;
00199         }
00200         if (nh >= 60) {
00201             ns = 10;
00202         }
00203         if (nh >= 150) {
00204 /* Computing MAX */
00205             r__1 = log((real) nh) / log(2.f);
00206             i__1 = 10, i__2 = nh / i_nint(&r__1);
00207             ns = max(i__1,i__2);
00208         }
00209         if (nh >= 590) {
00210             ns = 64;
00211         }
00212         if (nh >= 3000) {
00213             ns = 128;
00214         }
00215         if (nh >= 6000) {
00216             ns = 256;
00217         }
00218 /* Computing MAX */
00219         i__1 = 2, i__2 = ns - ns % 2;
00220         ns = max(i__1,i__2);
00221     }
00222 
00223     if (*ispec == 12) {
00224 
00225 
00226 /*        ===== Matrices of order smaller than NMIN get sent */
00227 /*        .     to xLAHQR, the classic double shift algorithm. */
00228 /*        .     This must be at least 11. ==== */
00229 
00230         ret_val = 75;
00231 
00232     } else if (*ispec == 14) {
00233 
00234 /*        ==== INIBL: skip a multi-shift qr iteration and */
00235 /*        .    whenever aggressive early deflation finds */
00236 /*        .    at least (NIBBLE*(window size)/100) deflations. ==== */
00237 
00238         ret_val = 14;
00239 
00240     } else if (*ispec == 15) {
00241 
00242 /*        ==== NSHFTS: The number of simultaneous shifts ===== */
00243 
00244         ret_val = ns;
00245 
00246     } else if (*ispec == 13) {
00247 
00248 /*        ==== NW: deflation window size.  ==== */
00249 
00250         if (nh <= 500) {
00251             ret_val = ns;
00252         } else {
00253             ret_val = ns * 3 / 2;
00254         }
00255 
00256     } else if (*ispec == 16) {
00257 
00258 /*        ==== IACC22: Whether to accumulate reflections */
00259 /*        .     before updating the far-from-diagonal elements */
00260 /*        .     and whether to use 2-by-2 block structure while */
00261 /*        .     doing it.  A small amount of work could be saved */
00262 /*        .     by making this choice dependent also upon the */
00263 /*        .     NH=IHI-ILO+1. */
00264 
00265         ret_val = 0;
00266         if (ns >= 14) {
00267             ret_val = 1;
00268         }
00269         if (ns >= 14) {
00270             ret_val = 2;
00271         }
00272 
00273     } else {
00274 /*        ===== invalid value of ispec ===== */
00275         ret_val = -1;
00276 
00277     }
00278 
00279 /*     ==== End of IPARMQ ==== */
00280 
00281     return ret_val;
00282 } /* iparmq_ */


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