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