LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
ilaenv.f
Go to the documentation of this file.
00001 *> \brief \b ILAENV
00002 *
00003 *  =========== DOCUMENTATION ===========
00004 *
00005 * Online html documentation available at 
00006 *            http://www.netlib.org/lapack/explore-html/ 
00007 *
00008 *  Definition:
00009 *  ===========
00010 *
00011 *       INTEGER          FUNCTION ILAENV( ISPEC, NAME, OPTS, N1, N2, N3,
00012 *                        N4 )
00013 * 
00014 *       .. Scalar Arguments ..
00015 *       CHARACTER*( * )    NAME, OPTS
00016 *       INTEGER            ISPEC, N1, N2, N3, N4
00017 *       ..
00018 *  
00019 *
00020 *> \par Purpose:
00021 *  =============
00022 *>
00023 *> \verbatim
00024 *>
00025 *> ILAENV returns problem-dependent parameters for the local
00026 *> environment.  See ISPEC for a description of the parameters.
00027 *>
00028 *> In this version, the problem-dependent parameters are contained in
00029 *> the integer array IPARMS in the common block CLAENV and the value
00030 *> with index ISPEC is copied to ILAENV.  This version of ILAENV is
00031 *> to be used in conjunction with XLAENV in TESTING and TIMING.
00032 *> \endverbatim
00033 *
00034 *  Arguments:
00035 *  ==========
00036 *
00037 *> \param[in] ISPEC
00038 *> \verbatim
00039 *>          ISPEC is INTEGER
00040 *>          Specifies the parameter to be returned as the value of
00041 *>          ILAENV.
00042 *>          = 1: the optimal blocksize; if this value is 1, an unblocked
00043 *>               algorithm will give the best performance.
00044 *>          = 2: the minimum block size for which the block routine
00045 *>               should be used; if the usable block size is less than
00046 *>               this value, an unblocked routine should be used.
00047 *>          = 3: the crossover point (in a block routine, for N less
00048 *>               than this value, an unblocked routine should be used)
00049 *>          = 4: the number of shifts, used in the nonsymmetric
00050 *>               eigenvalue routines
00051 *>          = 5: the minimum column dimension for blocking to be used;
00052 *>               rectangular blocks must have dimension at least k by m,
00053 *>               where k is given by ILAENV(2,...) and m by ILAENV(5,...)
00054 *>          = 6: the crossover point for the SVD (when reducing an m by n
00055 *>               matrix to bidiagonal form, if max(m,n)/min(m,n) exceeds
00056 *>               this value, a QR factorization is used first to reduce
00057 *>               the matrix to a triangular form.)
00058 *>          = 7: the number of processors
00059 *>          = 8: the crossover point for the multishift QR and QZ methods
00060 *>               for nonsymmetric eigenvalue problems.
00061 *>          = 9: maximum size of the subproblems at the bottom of the
00062 *>               computation tree in the divide-and-conquer algorithm
00063 *>          =10: ieee NaN arithmetic can be trusted not to trap
00064 *>          =11: infinity arithmetic can be trusted not to trap
00065 *>          12 <= ISPEC <= 16:
00066 *>               xHSEQR or one of its subroutines,
00067 *>               see IPARMQ for detailed explanation
00068 *>
00069 *>          Other specifications (up to 100) can be added later.
00070 *> \endverbatim
00071 *>
00072 *> \param[in] NAME
00073 *> \verbatim
00074 *>          NAME is CHARACTER*(*)
00075 *>          The name of the calling subroutine.
00076 *> \endverbatim
00077 *>
00078 *> \param[in] OPTS
00079 *> \verbatim
00080 *>          OPTS is CHARACTER*(*)
00081 *>          The character options to the subroutine NAME, concatenated
00082 *>          into a single character string.  For example, UPLO = 'U',
00083 *>          TRANS = 'T', and DIAG = 'N' for a triangular routine would
00084 *>          be specified as OPTS = 'UTN'.
00085 *> \endverbatim
00086 *>
00087 *> \param[in] N1
00088 *> \verbatim
00089 *>          N1 is INTEGER
00090 *> \endverbatim
00091 *>
00092 *> \param[in] N2
00093 *> \verbatim
00094 *>          N2 is INTEGER
00095 *> \endverbatim
00096 *>
00097 *> \param[in] N3
00098 *> \verbatim
00099 *>          N3 is INTEGER
00100 *> \endverbatim
00101 *>
00102 *> \param[in] N4
00103 *> \verbatim
00104 *>          N4 is INTEGER
00105 *>
00106 *>          Problem dimensions for the subroutine NAME; these may not all
00107 *>          be required.
00108 *> \endverbatim
00109 *>
00110 *> \result ILAENV
00111 *> \verbatim
00112 *>          ILAENV is INTEGER
00113 *>          >= 0: the value of the parameter specified by ISPEC
00114 *>          < 0:  if ILAENV = -k, the k-th argument had an illegal value.
00115 *> \endverbatim
00116 *
00117 *  Authors:
00118 *  ========
00119 *
00120 *> \author Univ. of Tennessee 
00121 *> \author Univ. of California Berkeley 
00122 *> \author Univ. of Colorado Denver 
00123 *> \author NAG Ltd. 
00124 *
00125 *> \date November 2011
00126 *
00127 *> \ingroup aux_eig
00128 *
00129 *> \par Further Details:
00130 *  =====================
00131 *>
00132 *> \verbatim
00133 *>
00134 *>  The following conventions have been used when calling ILAENV from the
00135 *>  LAPACK routines:
00136 *>  1)  OPTS is a concatenation of all of the character options to
00137 *>      subroutine NAME, in the same order that they appear in the
00138 *>      argument list for NAME, even if they are not used in determining
00139 *>      the value of the parameter specified by ISPEC.
00140 *>  2)  The problem dimensions N1, N2, N3, N4 are specified in the order
00141 *>      that they appear in the argument list for NAME.  N1 is used
00142 *>      first, N2 second, and so on, and unused problem dimensions are
00143 *>      passed a value of -1.
00144 *>  3)  The parameter value returned by ILAENV is checked for validity in
00145 *>      the calling subroutine.  For example, ILAENV is used to retrieve
00146 *>      the optimal blocksize for STRTRI as follows:
00147 *>
00148 *>      NB = ILAENV( 1, 'STRTRI', UPLO // DIAG, N, -1, -1, -1 )
00149 *>      IF( NB.LE.1 ) NB = MAX( 1, N )
00150 *> \endverbatim
00151 *>
00152 *  =====================================================================
00153       INTEGER          FUNCTION ILAENV( ISPEC, NAME, OPTS, N1, N2, N3,
00154      $                 N4 )
00155 *
00156 *  -- LAPACK test routine (version 3.4.0) --
00157 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00158 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00159 *     November 2011
00160 *
00161 *     .. Scalar Arguments ..
00162       CHARACTER*( * )    NAME, OPTS
00163       INTEGER            ISPEC, N1, N2, N3, N4
00164 *     ..
00165 *
00166 *  =====================================================================
00167 *
00168 *     .. Intrinsic Functions ..
00169       INTRINSIC          INT, MIN, REAL
00170 *     ..
00171 *     .. External Functions ..
00172       INTEGER            IEEECK
00173       EXTERNAL           IEEECK
00174 *     ..
00175 *     .. Arrays in Common ..
00176       INTEGER            IPARMS( 100 )
00177 *     ..
00178 *     .. Common blocks ..
00179       COMMON             / CLAENV / IPARMS
00180 *     ..
00181 *     .. Save statement ..
00182       SAVE               / CLAENV /
00183 *     ..
00184 *     .. Executable Statements ..
00185 *
00186       IF( ISPEC.GE.1 .AND. ISPEC.LE.5 ) THEN
00187 *
00188 *        Return a value from the common block.
00189 *
00190          ILAENV = IPARMS( ISPEC )
00191 *
00192       ELSE IF( ISPEC.EQ.6 ) THEN
00193 *
00194 *        Compute SVD crossover point.
00195 *
00196          ILAENV = INT( REAL( MIN( N1, N2 ) )*1.6E0 )
00197 *
00198       ELSE IF( ISPEC.GE.7 .AND. ISPEC.LE.9 ) THEN
00199 *
00200 *        Return a value from the common block.
00201 *
00202          ILAENV = IPARMS( ISPEC )
00203 *
00204       ELSE IF( ISPEC.EQ.10 ) THEN
00205 *
00206 *        IEEE NaN arithmetic can be trusted not to trap
00207 *
00208 C        ILAENV = 0
00209          ILAENV = 1
00210          IF( ILAENV.EQ.1 ) THEN
00211             ILAENV = IEEECK( 1, 0.0, 1.0 )
00212          END IF
00213 *
00214       ELSE IF( ISPEC.EQ.11 ) THEN
00215 *
00216 *        Infinity arithmetic can be trusted not to trap
00217 *
00218 C        ILAENV = 0
00219          ILAENV = 1
00220          IF( ILAENV.EQ.1 ) THEN
00221             ILAENV = IEEECK( 0, 0.0, 1.0 )
00222          END IF
00223 *
00224       ELSE IF(( ISPEC.GE.12 ) .AND. (ISPEC.LE.16)) THEN
00225 *
00226 *     12 <= ISPEC <= 16: xHSEQR or one of its subroutines. 
00227 *
00228          ILAENV = IPARMS( ISPEC )
00229 *         WRITE(*,*) 'ISPEC = ',ISPEC,' ILAENV =',ILAENV
00230 *         ILAENV = IPARMQ( ISPEC, NAME, OPTS, N1, N2, N3, N4 )
00231 *
00232       ELSE
00233 *
00234 *        Invalid value for ISPEC
00235 *
00236          ILAENV = -1
00237       END IF
00238 *
00239       RETURN
00240 *
00241 *     End of ILAENV
00242 *
00243       END
00244       INTEGER FUNCTION IPARMQ( ISPEC, NAME, OPTS, N, ILO, IHI, LWORK )
00245 *
00246       INTEGER            INMIN, INWIN, INIBL, ISHFTS, IACC22
00247       PARAMETER          ( INMIN = 12, INWIN = 13, INIBL = 14,
00248      $                   ISHFTS = 15, IACC22 = 16 )
00249       INTEGER            NMIN, K22MIN, KACMIN, NIBBLE, KNWSWP
00250       PARAMETER          ( NMIN = 11, K22MIN = 14, KACMIN = 14,
00251      $                   NIBBLE = 14, KNWSWP = 500 )
00252       REAL               TWO
00253       PARAMETER          ( TWO = 2.0 )
00254 *     ..
00255 *     .. Scalar Arguments ..
00256       INTEGER            IHI, ILO, ISPEC, LWORK, N
00257       CHARACTER          NAME*( * ), OPTS*( * )
00258 *     ..
00259 *     .. Local Scalars ..
00260       INTEGER            NH, NS
00261 *     ..
00262 *     .. Intrinsic Functions ..
00263       INTRINSIC          LOG, MAX, MOD, NINT, REAL
00264 *     ..
00265 *     .. Executable Statements ..
00266       IF( ( ISPEC.EQ.ISHFTS ) .OR. ( ISPEC.EQ.INWIN ) .OR.
00267      $    ( ISPEC.EQ.IACC22 ) ) THEN
00268 *
00269 *        ==== Set the number simultaneous shifts ====
00270 *
00271          NH = IHI - ILO + 1
00272          NS = 2
00273          IF( NH.GE.30 )
00274      $      NS = 4
00275          IF( NH.GE.60 )
00276      $      NS = 10
00277          IF( NH.GE.150 )
00278      $      NS = MAX( 10, NH / NINT( LOG( REAL( NH ) ) / LOG( TWO ) ) )
00279          IF( NH.GE.590 )
00280      $      NS = 64
00281          IF( NH.GE.3000 )
00282      $      NS = 128
00283          IF( NH.GE.6000 )
00284      $      NS = 256
00285          NS = MAX( 2, NS-MOD( NS, 2 ) )
00286       END IF
00287 *
00288       IF( ISPEC.EQ.INMIN ) THEN
00289 *
00290 *
00291 *        ===== Matrices of order smaller than NMIN get sent
00292 *        .     to LAHQR, the classic double shift algorithm.
00293 *        .     This must be at least 11. ====
00294 *
00295          IPARMQ = NMIN
00296 *
00297       ELSE IF( ISPEC.EQ.INIBL ) THEN
00298 *
00299 *        ==== INIBL: skip a multi-shift qr iteration and
00300 *        .    whenever aggressive early deflation finds
00301 *        .    at least (NIBBLE*(window size)/100) deflations. ====
00302 *
00303          IPARMQ = NIBBLE
00304 *
00305       ELSE IF( ISPEC.EQ.ISHFTS ) THEN
00306 *
00307 *        ==== NSHFTS: The number of simultaneous shifts =====
00308 *
00309          IPARMQ = NS
00310 *
00311       ELSE IF( ISPEC.EQ.INWIN ) THEN
00312 *
00313 *        ==== NW: deflation window size.  ====
00314 *
00315          IF( NH.LE.KNWSWP ) THEN
00316             IPARMQ = NS
00317          ELSE
00318             IPARMQ = 3*NS / 2
00319          END IF
00320 *
00321       ELSE IF( ISPEC.EQ.IACC22 ) THEN
00322 *
00323 *        ==== IACC22: Whether to accumulate reflections
00324 *        .     before updating the far-from-diagonal elements
00325 *        .     and whether to use 2-by-2 block structure while
00326 *        .     doing it.  A small amount of work could be saved
00327 *        .     by making this choice dependent also upon the
00328 *        .     NH=IHI-ILO+1.
00329 *
00330          IPARMQ = 0
00331          IF( NS.GE.KACMIN )
00332      $      IPARMQ = 1
00333          IF( NS.GE.K22MIN )
00334      $      IPARMQ = 2
00335 *
00336       ELSE
00337 *        ===== invalid value of ispec =====
00338          IPARMQ = -1
00339 *
00340       END IF
00341 *
00342 *     ==== End of IPARMQ ====
00343 *
00344       END
 All Files Functions