LAPACK 3.3.1
Linear Algebra PACKage

SRC/ilaenv.f

Go to the documentation of this file.
00001       INTEGER FUNCTION ILAENV( ISPEC, NAME, OPTS, N1, N2, N3, N4 )
00002 *
00003 *  -- LAPACK auxiliary routine (version 3.2.1)                        --
00004 *
00005 *  -- April 2009                                                      --
00006 *
00007 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00008 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00009 *
00010 *     .. Scalar Arguments ..
00011       CHARACTER*( * )    NAME, OPTS
00012       INTEGER            ISPEC, N1, N2, N3, N4
00013 *     ..
00014 *
00015 *  Purpose
00016 *  =======
00017 *
00018 *  ILAENV is called from the LAPACK routines to choose problem-dependent
00019 *  parameters for the local environment.  See ISPEC for a description of
00020 *  the parameters.
00021 *
00022 *  ILAENV returns an INTEGER
00023 *  if ILAENV >= 0: ILAENV returns the value of the parameter specified by ISPEC
00024 *  if ILAENV < 0:  if ILAENV = -k, the k-th argument had an illegal value.
00025 *
00026 *  This version provides a set of parameters which should give good,
00027 *  but not optimal, performance on many of the currently available
00028 *  computers.  Users are encouraged to modify this subroutine to set
00029 *  the tuning parameters for their particular machine using the option
00030 *  and problem size information in the arguments.
00031 *
00032 *  This routine will not function correctly if it is converted to all
00033 *  lower case.  Converting it to all upper case is allowed.
00034 *
00035 *  Arguments
00036 *  =========
00037 *
00038 *  ISPEC   (input) INTEGER
00039 *          Specifies the parameter to be returned as the value of
00040 *          ILAENV.
00041 *          = 1: the optimal blocksize; if this value is 1, an unblocked
00042 *               algorithm will give the best performance.
00043 *          = 2: the minimum block size for which the block routine
00044 *               should be used; if the usable block size is less than
00045 *               this value, an unblocked routine should be used.
00046 *          = 3: the crossover point (in a block routine, for N less
00047 *               than this value, an unblocked routine should be used)
00048 *          = 4: the number of shifts, used in the nonsymmetric
00049 *               eigenvalue routines (DEPRECATED)
00050 *          = 5: the minimum column dimension for blocking to be used;
00051 *               rectangular blocks must have dimension at least k by m,
00052 *               where k is given by ILAENV(2,...) and m by ILAENV(5,...)
00053 *          = 6: the crossover point for the SVD (when reducing an m by n
00054 *               matrix to bidiagonal form, if max(m,n)/min(m,n) exceeds
00055 *               this value, a QR factorization is used first to reduce
00056 *               the matrix to a triangular form.)
00057 *          = 7: the number of processors
00058 *          = 8: the crossover point for the multishift QR method
00059 *               for nonsymmetric eigenvalue problems (DEPRECATED)
00060 *          = 9: maximum size of the subproblems at the bottom of the
00061 *               computation tree in the divide-and-conquer algorithm
00062 *               (used by xGELSD and xGESDD)
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 *  NAME    (input) CHARACTER*(*)
00070 *          The name of the calling subroutine, in either upper case or
00071 *          lower case.
00072 *
00073 *  OPTS    (input) CHARACTER*(*)
00074 *          The character options to the subroutine NAME, concatenated
00075 *          into a single character string.  For example, UPLO = 'U',
00076 *          TRANS = 'T', and DIAG = 'N' for a triangular routine would
00077 *          be specified as OPTS = 'UTN'.
00078 *
00079 *  N1      (input) INTEGER
00080 *  N2      (input) INTEGER
00081 *  N3      (input) INTEGER
00082 *  N4      (input) INTEGER
00083 *          Problem dimensions for the subroutine NAME; these may not all
00084 *          be required.
00085 *
00086 *  Further Details
00087 *  ===============
00088 *
00089 *  The following conventions have been used when calling ILAENV from the
00090 *  LAPACK routines:
00091 *  1)  OPTS is a concatenation of all of the character options to
00092 *      subroutine NAME, in the same order that they appear in the
00093 *      argument list for NAME, even if they are not used in determining
00094 *      the value of the parameter specified by ISPEC.
00095 *  2)  The problem dimensions N1, N2, N3, N4 are specified in the order
00096 *      that they appear in the argument list for NAME.  N1 is used
00097 *      first, N2 second, and so on, and unused problem dimensions are
00098 *      passed a value of -1.
00099 *  3)  The parameter value returned by ILAENV is checked for validity in
00100 *      the calling subroutine.  For example, ILAENV is used to retrieve
00101 *      the optimal blocksize for STRTRI as follows:
00102 *
00103 *      NB = ILAENV( 1, 'STRTRI', UPLO // DIAG, N, -1, -1, -1 )
00104 *      IF( NB.LE.1 ) NB = MAX( 1, N )
00105 *
00106 *  =====================================================================
00107 *
00108 *     .. Local Scalars ..
00109       INTEGER            I, IC, IZ, NB, NBMIN, NX
00110       LOGICAL            CNAME, SNAME
00111       CHARACTER          C1*1, C2*2, C4*2, C3*3, SUBNAM*6
00112 *     ..
00113 *     .. Intrinsic Functions ..
00114       INTRINSIC          CHAR, ICHAR, INT, MIN, REAL
00115 *     ..
00116 *     .. External Functions ..
00117       INTEGER            IEEECK, IPARMQ
00118       EXTERNAL           IEEECK, IPARMQ
00119 *     ..
00120 *     .. Executable Statements ..
00121 *
00122       GO TO ( 10, 10, 10, 80, 90, 100, 110, 120,
00123      $        130, 140, 150, 160, 160, 160, 160, 160 )ISPEC
00124 *
00125 *     Invalid value for ISPEC
00126 *
00127       ILAENV = -1
00128       RETURN
00129 *
00130    10 CONTINUE
00131 *
00132 *     Convert NAME to upper case if the first character is lower case.
00133 *
00134       ILAENV = 1
00135       SUBNAM = NAME
00136       IC = ICHAR( SUBNAM( 1: 1 ) )
00137       IZ = ICHAR( 'Z' )
00138       IF( IZ.EQ.90 .OR. IZ.EQ.122 ) THEN
00139 *
00140 *        ASCII character set
00141 *
00142          IF( IC.GE.97 .AND. IC.LE.122 ) THEN
00143             SUBNAM( 1: 1 ) = CHAR( IC-32 )
00144             DO 20 I = 2, 6
00145                IC = ICHAR( SUBNAM( I: I ) )
00146                IF( IC.GE.97 .AND. IC.LE.122 )
00147      $            SUBNAM( I: I ) = CHAR( IC-32 )
00148    20       CONTINUE
00149          END IF
00150 *
00151       ELSE IF( IZ.EQ.233 .OR. IZ.EQ.169 ) THEN
00152 *
00153 *        EBCDIC character set
00154 *
00155          IF( ( IC.GE.129 .AND. IC.LE.137 ) .OR.
00156      $       ( IC.GE.145 .AND. IC.LE.153 ) .OR.
00157      $       ( IC.GE.162 .AND. IC.LE.169 ) ) THEN
00158             SUBNAM( 1: 1 ) = CHAR( IC+64 )
00159             DO 30 I = 2, 6
00160                IC = ICHAR( SUBNAM( I: I ) )
00161                IF( ( IC.GE.129 .AND. IC.LE.137 ) .OR.
00162      $             ( IC.GE.145 .AND. IC.LE.153 ) .OR.
00163      $             ( IC.GE.162 .AND. IC.LE.169 ) )SUBNAM( I:
00164      $             I ) = CHAR( IC+64 )
00165    30       CONTINUE
00166          END IF
00167 *
00168       ELSE IF( IZ.EQ.218 .OR. IZ.EQ.250 ) THEN
00169 *
00170 *        Prime machines:  ASCII+128
00171 *
00172          IF( IC.GE.225 .AND. IC.LE.250 ) THEN
00173             SUBNAM( 1: 1 ) = CHAR( IC-32 )
00174             DO 40 I = 2, 6
00175                IC = ICHAR( SUBNAM( I: I ) )
00176                IF( IC.GE.225 .AND. IC.LE.250 )
00177      $            SUBNAM( I: I ) = CHAR( IC-32 )
00178    40       CONTINUE
00179          END IF
00180       END IF
00181 *
00182       C1 = SUBNAM( 1: 1 )
00183       SNAME = C1.EQ.'S' .OR. C1.EQ.'D'
00184       CNAME = C1.EQ.'C' .OR. C1.EQ.'Z'
00185       IF( .NOT.( CNAME .OR. SNAME ) )
00186      $   RETURN
00187       C2 = SUBNAM( 2: 3 )
00188       C3 = SUBNAM( 4: 6 )
00189       C4 = C3( 2: 3 )
00190 *
00191       GO TO ( 50, 60, 70 )ISPEC
00192 *
00193    50 CONTINUE
00194 *
00195 *     ISPEC = 1:  block size
00196 *
00197 *     In these examples, separate code is provided for setting NB for
00198 *     real and complex.  We assume that NB will take the same value in
00199 *     single or double precision.
00200 *
00201       NB = 1
00202 *
00203       IF( C2.EQ.'GE' ) THEN
00204          IF( C3.EQ.'TRF' ) THEN
00205             IF( SNAME ) THEN
00206                NB = 64
00207             ELSE
00208                NB = 64
00209             END IF
00210          ELSE IF( C3.EQ.'QRF' .OR. C3.EQ.'RQF' .OR. C3.EQ.'LQF' .OR.
00211      $            C3.EQ.'QLF' ) THEN
00212             IF( SNAME ) THEN
00213                NB = 32
00214             ELSE
00215                NB = 32
00216             END IF
00217          ELSE IF( C3.EQ.'HRD' ) THEN
00218             IF( SNAME ) THEN
00219                NB = 32
00220             ELSE
00221                NB = 32
00222             END IF
00223          ELSE IF( C3.EQ.'BRD' ) THEN
00224             IF( SNAME ) THEN
00225                NB = 32
00226             ELSE
00227                NB = 32
00228             END IF
00229          ELSE IF( C3.EQ.'TRI' ) THEN
00230             IF( SNAME ) THEN
00231                NB = 64
00232             ELSE
00233                NB = 64
00234             END IF
00235          END IF
00236       ELSE IF( C2.EQ.'PO' ) THEN
00237          IF( C3.EQ.'TRF' ) THEN
00238             IF( SNAME ) THEN
00239                NB = 64
00240             ELSE
00241                NB = 64
00242             END IF
00243          END IF
00244       ELSE IF( C2.EQ.'SY' ) THEN
00245          IF( C3.EQ.'TRF' ) THEN
00246             IF( SNAME ) THEN
00247                NB = 64
00248             ELSE
00249                NB = 64
00250             END IF
00251          ELSE IF( SNAME .AND. C3.EQ.'TRD' ) THEN
00252             NB = 32
00253          ELSE IF( SNAME .AND. C3.EQ.'GST' ) THEN
00254             NB = 64
00255          END IF
00256       ELSE IF( CNAME .AND. C2.EQ.'HE' ) THEN
00257          IF( C3.EQ.'TRF' ) THEN
00258             NB = 64
00259          ELSE IF( C3.EQ.'TRD' ) THEN
00260             NB = 32
00261          ELSE IF( C3.EQ.'GST' ) THEN
00262             NB = 64
00263          END IF
00264       ELSE IF( SNAME .AND. C2.EQ.'OR' ) THEN
00265          IF( C3( 1: 1 ).EQ.'G' ) THEN
00266             IF( C4.EQ.'QR' .OR. C4.EQ.'RQ' .OR. C4.EQ.'LQ' .OR. C4.EQ.
00267      $          'QL' .OR. C4.EQ.'HR' .OR. C4.EQ.'TR' .OR. C4.EQ.'BR' )
00268      $           THEN
00269                NB = 32
00270             END IF
00271          ELSE IF( C3( 1: 1 ).EQ.'M' ) THEN
00272             IF( C4.EQ.'QR' .OR. C4.EQ.'RQ' .OR. C4.EQ.'LQ' .OR. C4.EQ.
00273      $          'QL' .OR. C4.EQ.'HR' .OR. C4.EQ.'TR' .OR. C4.EQ.'BR' )
00274      $           THEN
00275                NB = 32
00276             END IF
00277          END IF
00278       ELSE IF( CNAME .AND. C2.EQ.'UN' ) THEN
00279          IF( C3( 1: 1 ).EQ.'G' ) THEN
00280             IF( C4.EQ.'QR' .OR. C4.EQ.'RQ' .OR. C4.EQ.'LQ' .OR. C4.EQ.
00281      $          'QL' .OR. C4.EQ.'HR' .OR. C4.EQ.'TR' .OR. C4.EQ.'BR' )
00282      $           THEN
00283                NB = 32
00284             END IF
00285          ELSE IF( C3( 1: 1 ).EQ.'M' ) THEN
00286             IF( C4.EQ.'QR' .OR. C4.EQ.'RQ' .OR. C4.EQ.'LQ' .OR. C4.EQ.
00287      $          'QL' .OR. C4.EQ.'HR' .OR. C4.EQ.'TR' .OR. C4.EQ.'BR' )
00288      $           THEN
00289                NB = 32
00290             END IF
00291          END IF
00292       ELSE IF( C2.EQ.'GB' ) THEN
00293          IF( C3.EQ.'TRF' ) THEN
00294             IF( SNAME ) THEN
00295                IF( N4.LE.64 ) THEN
00296                   NB = 1
00297                ELSE
00298                   NB = 32
00299                END IF
00300             ELSE
00301                IF( N4.LE.64 ) THEN
00302                   NB = 1
00303                ELSE
00304                   NB = 32
00305                END IF
00306             END IF
00307          END IF
00308       ELSE IF( C2.EQ.'PB' ) THEN
00309          IF( C3.EQ.'TRF' ) THEN
00310             IF( SNAME ) THEN
00311                IF( N2.LE.64 ) THEN
00312                   NB = 1
00313                ELSE
00314                   NB = 32
00315                END IF
00316             ELSE
00317                IF( N2.LE.64 ) THEN
00318                   NB = 1
00319                ELSE
00320                   NB = 32
00321                END IF
00322             END IF
00323          END IF
00324       ELSE IF( C2.EQ.'TR' ) THEN
00325          IF( C3.EQ.'TRI' ) THEN
00326             IF( SNAME ) THEN
00327                NB = 64
00328             ELSE
00329                NB = 64
00330             END IF
00331          END IF
00332       ELSE IF( C2.EQ.'LA' ) THEN
00333          IF( C3.EQ.'UUM' ) THEN
00334             IF( SNAME ) THEN
00335                NB = 64
00336             ELSE
00337                NB = 64
00338             END IF
00339          END IF
00340       ELSE IF( SNAME .AND. C2.EQ.'ST' ) THEN
00341          IF( C3.EQ.'EBZ' ) THEN
00342             NB = 1
00343          END IF
00344       END IF
00345       ILAENV = NB
00346       RETURN
00347 *
00348    60 CONTINUE
00349 *
00350 *     ISPEC = 2:  minimum block size
00351 *
00352       NBMIN = 2
00353       IF( C2.EQ.'GE' ) THEN
00354          IF( C3.EQ.'QRF' .OR. C3.EQ.'RQF' .OR. C3.EQ.'LQF' .OR. C3.EQ.
00355      $       'QLF' ) THEN
00356             IF( SNAME ) THEN
00357                NBMIN = 2
00358             ELSE
00359                NBMIN = 2
00360             END IF
00361          ELSE IF( C3.EQ.'HRD' ) THEN
00362             IF( SNAME ) THEN
00363                NBMIN = 2
00364             ELSE
00365                NBMIN = 2
00366             END IF
00367          ELSE IF( C3.EQ.'BRD' ) THEN
00368             IF( SNAME ) THEN
00369                NBMIN = 2
00370             ELSE
00371                NBMIN = 2
00372             END IF
00373          ELSE IF( C3.EQ.'TRI' ) THEN
00374             IF( SNAME ) THEN
00375                NBMIN = 2
00376             ELSE
00377                NBMIN = 2
00378             END IF
00379          END IF
00380       ELSE IF( C2.EQ.'SY' ) THEN
00381          IF( C3.EQ.'TRF' ) THEN
00382             IF( SNAME ) THEN
00383                NBMIN = 8
00384             ELSE
00385                NBMIN = 8
00386             END IF
00387          ELSE IF( SNAME .AND. C3.EQ.'TRD' ) THEN
00388             NBMIN = 2
00389          END IF
00390       ELSE IF( CNAME .AND. C2.EQ.'HE' ) THEN
00391          IF( C3.EQ.'TRD' ) THEN
00392             NBMIN = 2
00393          END IF
00394       ELSE IF( SNAME .AND. C2.EQ.'OR' ) THEN
00395          IF( C3( 1: 1 ).EQ.'G' ) THEN
00396             IF( C4.EQ.'QR' .OR. C4.EQ.'RQ' .OR. C4.EQ.'LQ' .OR. C4.EQ.
00397      $          'QL' .OR. C4.EQ.'HR' .OR. C4.EQ.'TR' .OR. C4.EQ.'BR' )
00398      $           THEN
00399                NBMIN = 2
00400             END IF
00401          ELSE IF( C3( 1: 1 ).EQ.'M' ) THEN
00402             IF( C4.EQ.'QR' .OR. C4.EQ.'RQ' .OR. C4.EQ.'LQ' .OR. C4.EQ.
00403      $          'QL' .OR. C4.EQ.'HR' .OR. C4.EQ.'TR' .OR. C4.EQ.'BR' )
00404      $           THEN
00405                NBMIN = 2
00406             END IF
00407          END IF
00408       ELSE IF( CNAME .AND. C2.EQ.'UN' ) THEN
00409          IF( C3( 1: 1 ).EQ.'G' ) THEN
00410             IF( C4.EQ.'QR' .OR. C4.EQ.'RQ' .OR. C4.EQ.'LQ' .OR. C4.EQ.
00411      $          'QL' .OR. C4.EQ.'HR' .OR. C4.EQ.'TR' .OR. C4.EQ.'BR' )
00412      $           THEN
00413                NBMIN = 2
00414             END IF
00415          ELSE IF( C3( 1: 1 ).EQ.'M' ) THEN
00416             IF( C4.EQ.'QR' .OR. C4.EQ.'RQ' .OR. C4.EQ.'LQ' .OR. C4.EQ.
00417      $          'QL' .OR. C4.EQ.'HR' .OR. C4.EQ.'TR' .OR. C4.EQ.'BR' )
00418      $           THEN
00419                NBMIN = 2
00420             END IF
00421          END IF
00422       END IF
00423       ILAENV = NBMIN
00424       RETURN
00425 *
00426    70 CONTINUE
00427 *
00428 *     ISPEC = 3:  crossover point
00429 *
00430       NX = 0
00431       IF( C2.EQ.'GE' ) THEN
00432          IF( C3.EQ.'QRF' .OR. C3.EQ.'RQF' .OR. C3.EQ.'LQF' .OR. C3.EQ.
00433      $       'QLF' ) THEN
00434             IF( SNAME ) THEN
00435                NX = 128
00436             ELSE
00437                NX = 128
00438             END IF
00439          ELSE IF( C3.EQ.'HRD' ) THEN
00440             IF( SNAME ) THEN
00441                NX = 128
00442             ELSE
00443                NX = 128
00444             END IF
00445          ELSE IF( C3.EQ.'BRD' ) THEN
00446             IF( SNAME ) THEN
00447                NX = 128
00448             ELSE
00449                NX = 128
00450             END IF
00451          END IF
00452       ELSE IF( C2.EQ.'SY' ) THEN
00453          IF( SNAME .AND. C3.EQ.'TRD' ) THEN
00454             NX = 32
00455          END IF
00456       ELSE IF( CNAME .AND. C2.EQ.'HE' ) THEN
00457          IF( C3.EQ.'TRD' ) THEN
00458             NX = 32
00459          END IF
00460       ELSE IF( SNAME .AND. C2.EQ.'OR' ) THEN
00461          IF( C3( 1: 1 ).EQ.'G' ) THEN
00462             IF( C4.EQ.'QR' .OR. C4.EQ.'RQ' .OR. C4.EQ.'LQ' .OR. C4.EQ.
00463      $          'QL' .OR. C4.EQ.'HR' .OR. C4.EQ.'TR' .OR. C4.EQ.'BR' )
00464      $           THEN
00465                NX = 128
00466             END IF
00467          END IF
00468       ELSE IF( CNAME .AND. C2.EQ.'UN' ) THEN
00469          IF( C3( 1: 1 ).EQ.'G' ) THEN
00470             IF( C4.EQ.'QR' .OR. C4.EQ.'RQ' .OR. C4.EQ.'LQ' .OR. C4.EQ.
00471      $          'QL' .OR. C4.EQ.'HR' .OR. C4.EQ.'TR' .OR. C4.EQ.'BR' )
00472      $           THEN
00473                NX = 128
00474             END IF
00475          END IF
00476       END IF
00477       ILAENV = NX
00478       RETURN
00479 *
00480    80 CONTINUE
00481 *
00482 *     ISPEC = 4:  number of shifts (used by xHSEQR)
00483 *
00484       ILAENV = 6
00485       RETURN
00486 *
00487    90 CONTINUE
00488 *
00489 *     ISPEC = 5:  minimum column dimension (not used)
00490 *
00491       ILAENV = 2
00492       RETURN
00493 *
00494   100 CONTINUE
00495 *
00496 *     ISPEC = 6:  crossover point for SVD (used by xGELSS and xGESVD)
00497 *
00498       ILAENV = INT( REAL( MIN( N1, N2 ) )*1.6E0 )
00499       RETURN
00500 *
00501   110 CONTINUE
00502 *
00503 *     ISPEC = 7:  number of processors (not used)
00504 *
00505       ILAENV = 1
00506       RETURN
00507 *
00508   120 CONTINUE
00509 *
00510 *     ISPEC = 8:  crossover point for multishift (used by xHSEQR)
00511 *
00512       ILAENV = 50
00513       RETURN
00514 *
00515   130 CONTINUE
00516 *
00517 *     ISPEC = 9:  maximum size of the subproblems at the bottom of the
00518 *                 computation tree in the divide-and-conquer algorithm
00519 *                 (used by xGELSD and xGESDD)
00520 *
00521       ILAENV = 25
00522       RETURN
00523 *
00524   140 CONTINUE
00525 *
00526 *     ISPEC = 10: ieee NaN arithmetic can be trusted not to trap
00527 *
00528 *     ILAENV = 0
00529       ILAENV = 1
00530       IF( ILAENV.EQ.1 ) THEN
00531          ILAENV = IEEECK( 1, 0.0, 1.0 )
00532       END IF
00533       RETURN
00534 *
00535   150 CONTINUE
00536 *
00537 *     ISPEC = 11: infinity arithmetic can be trusted not to trap
00538 *
00539 *     ILAENV = 0
00540       ILAENV = 1
00541       IF( ILAENV.EQ.1 ) THEN
00542          ILAENV = IEEECK( 0, 0.0, 1.0 )
00543       END IF
00544       RETURN
00545 *
00546   160 CONTINUE
00547 *
00548 *     12 <= ISPEC <= 16: xHSEQR or one of its subroutines. 
00549 *
00550       ILAENV = IPARMQ( ISPEC, NAME, OPTS, N1, N2, N3, N4 )
00551       RETURN
00552 *
00553 *     End of ILAENV
00554 *
00555       END
 All Files Functions