c@427: /* iparmq.f -- translated by f2c (version 20061008). c@427: You must link the resulting object file with libf2c: c@427: on Microsoft Windows system, link with libf2c.lib; c@427: on Linux or Unix systems, link with .../path/to/libf2c.a -lm c@427: or, if you install libf2c.a in a standard place, with -lf2c -lm c@427: -- in that order, at the end of the command line, as in c@427: cc *.o -lf2c -lm c@427: Source for libf2c is in /netlib/f2c/libf2c.zip, e.g., c@427: c@427: http://www.netlib.org/f2c/libf2c.zip c@427: */ c@427: c@427: #include "f2c.h" c@427: #include "blaswrap.h" c@427: c@427: integer iparmq_(integer *ispec, char *name__, char *opts, integer *n, integer c@427: *ilo, integer *ihi, integer *lwork) c@427: { c@427: /* System generated locals */ c@427: integer ret_val, i__1, i__2; c@427: real r__1; c@427: c@427: /* Builtin functions */ c@427: double log(doublereal); c@427: integer i_nint(real *); c@427: c@427: /* Local variables */ c@427: integer nh, ns; c@427: c@427: c@427: /* -- LAPACK auxiliary routine (version 3.2) -- */ c@427: /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */ c@427: /* November 2006 */ c@427: c@427: /* .. Scalar Arguments .. */ c@427: c@427: /* Purpose */ c@427: /* ======= */ c@427: c@427: /* This program sets problem and machine dependent parameters */ c@427: /* useful for xHSEQR and its subroutines. It is called whenever */ c@427: /* ILAENV is called with 12 <= ISPEC <= 16 */ c@427: c@427: /* Arguments */ c@427: /* ========= */ c@427: c@427: /* ISPEC (input) integer scalar */ c@427: /* ISPEC specifies which tunable parameter IPARMQ should */ c@427: /* return. */ c@427: c@427: /* ISPEC=12: (INMIN) Matrices of order nmin or less */ c@427: /* are sent directly to xLAHQR, the implicit */ c@427: /* double shift QR algorithm. NMIN must be */ c@427: /* at least 11. */ c@427: c@427: /* ISPEC=13: (INWIN) Size of the deflation window. */ c@427: /* This is best set greater than or equal to */ c@427: /* the number of simultaneous shifts NS. */ c@427: /* Larger matrices benefit from larger deflation */ c@427: /* windows. */ c@427: c@427: /* ISPEC=14: (INIBL) Determines when to stop nibbling and */ c@427: /* invest in an (expensive) multi-shift QR sweep. */ c@427: /* If the aggressive early deflation subroutine */ c@427: /* finds LD converged eigenvalues from an order */ c@427: /* NW deflation window and LD.GT.(NW*NIBBLE)/100, */ c@427: /* then the next QR sweep is skipped and early */ c@427: /* deflation is applied immediately to the */ c@427: /* remaining active diagonal block. Setting */ c@427: /* IPARMQ(ISPEC=14) = 0 causes TTQRE to skip a */ c@427: /* multi-shift QR sweep whenever early deflation */ c@427: /* finds a converged eigenvalue. Setting */ c@427: /* IPARMQ(ISPEC=14) greater than or equal to 100 */ c@427: /* prevents TTQRE from skipping a multi-shift */ c@427: /* QR sweep. */ c@427: c@427: /* ISPEC=15: (NSHFTS) The number of simultaneous shifts in */ c@427: /* a multi-shift QR iteration. */ c@427: c@427: /* ISPEC=16: (IACC22) IPARMQ is set to 0, 1 or 2 with the */ c@427: /* following meanings. */ c@427: /* 0: During the multi-shift QR sweep, */ c@427: /* xLAQR5 does not accumulate reflections and */ c@427: /* does not use matrix-matrix multiply to */ c@427: /* update the far-from-diagonal matrix */ c@427: /* entries. */ c@427: /* 1: During the multi-shift QR sweep, */ c@427: /* xLAQR5 and/or xLAQRaccumulates reflections and uses */ c@427: /* matrix-matrix multiply to update the */ c@427: /* far-from-diagonal matrix entries. */ c@427: /* 2: During the multi-shift QR sweep. */ c@427: /* xLAQR5 accumulates reflections and takes */ c@427: /* advantage of 2-by-2 block structure during */ c@427: /* matrix-matrix multiplies. */ c@427: /* (If xTRMM is slower than xGEMM, then */ c@427: /* IPARMQ(ISPEC=16)=1 may be more efficient than */ c@427: /* IPARMQ(ISPEC=16)=2 despite the greater level of */ c@427: /* arithmetic work implied by the latter choice.) */ c@427: c@427: /* NAME (input) character string */ c@427: /* Name of the calling subroutine */ c@427: c@427: /* OPTS (input) character string */ c@427: /* This is a concatenation of the string arguments to */ c@427: /* TTQRE. */ c@427: c@427: /* N (input) integer scalar */ c@427: /* N is the order of the Hessenberg matrix H. */ c@427: c@427: /* ILO (input) INTEGER */ c@427: /* IHI (input) INTEGER */ c@427: /* It is assumed that H is already upper triangular */ c@427: /* in rows and columns 1:ILO-1 and IHI+1:N. */ c@427: c@427: /* LWORK (input) integer scalar */ c@427: /* The amount of workspace available. */ c@427: c@427: /* Further Details */ c@427: /* =============== */ c@427: c@427: /* Little is known about how best to choose these parameters. */ c@427: /* It is possible to use different values of the parameters */ c@427: /* for each of CHSEQR, DHSEQR, SHSEQR and ZHSEQR. */ c@427: c@427: /* It is probably best to choose different parameters for */ c@427: /* different matrices and different parameters at different */ c@427: /* times during the iteration, but this has not been */ c@427: /* implemented --- yet. */ c@427: c@427: c@427: /* The best choices of most of the parameters depend */ c@427: /* in an ill-understood way on the relative execution */ c@427: /* rate of xLAQR3 and xLAQR5 and on the nature of each */ c@427: /* particular eigenvalue problem. Experiment may be the */ c@427: /* only practical way to determine which choices are most */ c@427: /* effective. */ c@427: c@427: /* Following is a list of default values supplied by IPARMQ. */ c@427: /* These defaults may be adjusted in order to attain better */ c@427: /* performance in any particular computational environment. */ c@427: c@427: /* IPARMQ(ISPEC=12) The xLAHQR vs xLAQR0 crossover point. */ c@427: /* Default: 75. (Must be at least 11.) */ c@427: c@427: /* IPARMQ(ISPEC=13) Recommended deflation window size. */ c@427: /* This depends on ILO, IHI and NS, the */ c@427: /* number of simultaneous shifts returned */ c@427: /* by IPARMQ(ISPEC=15). The default for */ c@427: /* (IHI-ILO+1).LE.500 is NS. The default */ c@427: /* for (IHI-ILO+1).GT.500 is 3*NS/2. */ c@427: c@427: /* IPARMQ(ISPEC=14) Nibble crossover point. Default: 14. */ c@427: c@427: /* IPARMQ(ISPEC=15) Number of simultaneous shifts, NS. */ c@427: /* a multi-shift QR iteration. */ c@427: c@427: /* If IHI-ILO+1 is ... */ c@427: c@427: /* greater than ...but less ... the */ c@427: /* or equal to ... than default is */ c@427: c@427: /* 0 30 NS = 2+ */ c@427: /* 30 60 NS = 4+ */ c@427: /* 60 150 NS = 10 */ c@427: /* 150 590 NS = ** */ c@427: /* 590 3000 NS = 64 */ c@427: /* 3000 6000 NS = 128 */ c@427: /* 6000 infinity NS = 256 */ c@427: c@427: /* (+) By default matrices of this order are */ c@427: /* passed to the implicit double shift routine */ c@427: /* xLAHQR. See IPARMQ(ISPEC=12) above. These */ c@427: /* values of NS are used only in case of a rare */ c@427: /* xLAHQR failure. */ c@427: c@427: /* (**) The asterisks (**) indicate an ad-hoc */ c@427: /* function increasing from 10 to 64. */ c@427: c@427: /* IPARMQ(ISPEC=16) Select structured matrix multiply. */ c@427: /* (See ISPEC=16 above for details.) */ c@427: /* Default: 3. */ c@427: c@427: /* ================================================================ */ c@427: /* .. Parameters .. */ c@427: /* .. */ c@427: /* .. Local Scalars .. */ c@427: /* .. */ c@427: /* .. Intrinsic Functions .. */ c@427: /* .. */ c@427: /* .. Executable Statements .. */ c@427: if (*ispec == 15 || *ispec == 13 || *ispec == 16) { c@427: c@427: /* ==== Set the number simultaneous shifts ==== */ c@427: c@427: nh = *ihi - *ilo + 1; c@427: ns = 2; c@427: if (nh >= 30) { c@427: ns = 4; c@427: } c@427: if (nh >= 60) { c@427: ns = 10; c@427: } c@427: if (nh >= 150) { c@427: /* Computing MAX */ c@427: r__1 = log((real) nh) / log(2.f); c@427: i__1 = 10, i__2 = nh / i_nint(&r__1); c@427: ns = max(i__1,i__2); c@427: } c@427: if (nh >= 590) { c@427: ns = 64; c@427: } c@427: if (nh >= 3000) { c@427: ns = 128; c@427: } c@427: if (nh >= 6000) { c@427: ns = 256; c@427: } c@427: /* Computing MAX */ c@427: i__1 = 2, i__2 = ns - ns % 2; c@427: ns = max(i__1,i__2); c@427: } c@427: c@427: if (*ispec == 12) { c@427: c@427: c@427: /* ===== Matrices of order smaller than NMIN get sent */ c@427: /* . to xLAHQR, the classic double shift algorithm. */ c@427: /* . This must be at least 11. ==== */ c@427: c@427: ret_val = 75; c@427: c@427: } else if (*ispec == 14) { c@427: c@427: /* ==== INIBL: skip a multi-shift qr iteration and */ c@427: /* . whenever aggressive early deflation finds */ c@427: /* . at least (NIBBLE*(window size)/100) deflations. ==== */ c@427: c@427: ret_val = 14; c@427: c@427: } else if (*ispec == 15) { c@427: c@427: /* ==== NSHFTS: The number of simultaneous shifts ===== */ c@427: c@427: ret_val = ns; c@427: c@427: } else if (*ispec == 13) { c@427: c@427: /* ==== NW: deflation window size. ==== */ c@427: c@427: if (nh <= 500) { c@427: ret_val = ns; c@427: } else { c@427: ret_val = ns * 3 / 2; c@427: } c@427: c@427: } else if (*ispec == 16) { c@427: c@427: /* ==== IACC22: Whether to accumulate reflections */ c@427: /* . before updating the far-from-diagonal elements */ c@427: /* . and whether to use 2-by-2 block structure while */ c@427: /* . doing it. A small amount of work could be saved */ c@427: /* . by making this choice dependent also upon the */ c@427: /* . NH=IHI-ILO+1. */ c@427: c@427: ret_val = 0; c@427: if (ns >= 14) { c@427: ret_val = 1; c@427: } c@427: if (ns >= 14) { c@427: ret_val = 2; c@427: } c@427: c@427: } else { c@427: /* ===== invalid value of ispec ===== */ c@427: ret_val = -1; c@427: c@427: } c@427: c@427: /* ==== End of IPARMQ ==== */ c@427: c@427: return ret_val; c@427: } /* iparmq_ */