LAPACK 3.3.0

ilaenv.f

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