LAPACK 3.3.0

iparmq.f

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