1       INTEGER          FUNCTION ILAENV( ISPEC, NAME, OPTS, N1, N2, N3,
  2      $                 N4 )
  3 *
  4 *  -- LAPACK auxiliary routine (version 3.1) --
  5 *     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
  6 *     November 2006
  7 *
  8 *     .. Scalar Arguments ..
  9       CHARACTER** )    NAME, OPTS
 10       INTEGER            ISPEC, N1, N2, N3, N4
 11 *     ..
 12 *
 13 *  Purpose
 14 *  =======
 15 *
 16 *  ILAENV returns problem-dependent parameters for the local
 17 *  environment.  See ISPEC for a description of the parameters.
 18 *
 19 *  In this version, the problem-dependent parameters are contained in
 20 *  the integer array IPARMS in the common block CLAENV and the value
 21 *  with index ISPEC is copied to ILAENV.  This version of ILAENV is
 22 *  to be used in conjunction with XLAENV in TESTING and TIMING.
 23 *
 24 *  Arguments
 25 *  =========
 26 *
 27 *  ISPEC   (input) INTEGER
 28 *          Specifies the parameter to be returned as the value of
 29 *          ILAENV.
 30 *          = 1: the optimal blocksize; if this value is 1, an unblocked
 31 *               algorithm will give the best performance.
 32 *          = 2: the minimum block size for which the block routine
 33 *               should be used; if the usable block size is less than
 34 *               this value, an unblocked routine should be used.
 35 *          = 3: the crossover point (in a block routine, for N less
 36 *               than this value, an unblocked routine should be used)
 37 *          = 4: the number of shifts, used in the nonsymmetric
 38 *               eigenvalue routines
 39 *          = 5: the minimum column dimension for blocking to be used;
 40 *               rectangular blocks must have dimension at least k by m,
 41 *               where k is given by ILAENV(2,...) and m by ILAENV(5,...)
 42 *          = 6: the crossover point for the SVD (when reducing an m by n
 43 *               matrix to bidiagonal form, if max(m,n)/min(m,n) exceeds
 44 *               this value, a QR factorization is used first to reduce
 45 *               the matrix to a triangular form.)
 46 *          = 7: the number of processors
 47 *          = 8: the crossover point for the multishift QR and QZ methods
 48 *               for nonsymmetric eigenvalue problems.
 49 *          = 9: maximum size of the subproblems at the bottom of the
 50 *               computation tree in the divide-and-conquer algorithm
 51 *          =10: ieee NaN arithmetic can be trusted not to trap
 52 *          =11: infinity arithmetic can be trusted not to trap
 53 *
 54 *          Other specifications (up to 100) can be added later.
 55 *
 56 *  NAME    (input) CHARACTER*(*)
 57 *          The name of the calling subroutine.
 58 *
 59 *  OPTS    (input) CHARACTER*(*)
 60 *          The character options to the subroutine NAME, concatenated
 61 *          into a single character string.  For example, UPLO = 'U',
 62 *          TRANS = 'T', and DIAG = 'N' for a triangular routine would
 63 *          be specified as OPTS = 'UTN'.
 64 *
 65 *  N1      (input) INTEGER
 66 *  N2      (input) INTEGER
 67 *  N3      (input) INTEGER
 68 *  N4      (input) INTEGER
 69 *          Problem dimensions for the subroutine NAME; these may not all
 70 *          be required.
 71 *
 72 * (ILAENV) (output) INTEGER
 73 *          >= 0: the value of the parameter specified by ISPEC
 74 *          < 0:  if ILAENV = -k, the k-th argument had an illegal value.
 75 *
 76 *  Further Details
 77 *  ===============
 78 *
 79 *  The following conventions have been used when calling ILAENV from the
 80 *  LAPACK routines:
 81 *  1)  OPTS is a concatenation of all of the character options to
 82 *      subroutine NAME, in the same order that they appear in the
 83 *      argument list for NAME, even if they are not used in determining
 84 *      the value of the parameter specified by ISPEC.
 85 *  2)  The problem dimensions N1, N2, N3, N4 are specified in the order
 86 *      that they appear in the argument list for NAME.  N1 is used
 87 *      first, N2 second, and so on, and unused problem dimensions are
 88 *      passed a value of -1.
 89 *  3)  The parameter value returned by ILAENV is checked for validity in
 90 *      the calling subroutine.  For example, ILAENV is used to retrieve
 91 *      the optimal blocksize for STRTRI as follows:
 92 *
 93 *      NB = ILAENV( 1, 'STRTRI', UPLO // DIAG, N, -1, -1, -1 )
 94 *      IF( NB.LE.1 ) NB = MAX( 1, N )
 95 *
 96 *  =====================================================================
 97 *
 98 *     .. Intrinsic Functions ..
 99       INTRINSIC          INTMIN, REAL
100 *     ..
101 *     .. External Functions ..
102       INTEGER            IEEECK
103       EXTERNAL           IEEECK
104 *     ..
105 *     .. Arrays in Common ..
106       INTEGER            IPARMS( 100 )
107 *     ..
108 *     .. Common blocks ..
109       COMMON             / CLAENV / IPARMS
110 *     ..
111 *     .. Save statement ..
112       SAVE               / CLAENV /
113 *     ..
114 *     .. Executable Statements ..
115 *
116       IF( ISPEC.GE.1 .AND. ISPEC.LE.5 ) THEN
117 *
118 *        Return a value from the common block.
119 *
120          ILAENV = IPARMS( ISPEC )
121 *
122       ELSE IF( ISPEC.EQ.6 ) THEN
123 *
124 *        Compute SVD crossover point.
125 *
126          ILAENV = INTREALMIN( N1, N2 ) )*1.6E0 )
127 *
128       ELSE IF( ISPEC.GE.7 .AND. ISPEC.LE.9 ) THEN
129 *
130 *        Return a value from the common block.
131 *
132          ILAENV = IPARMS( ISPEC )
133 *
134       ELSE IF( ISPEC.EQ.10 ) THEN
135 *
136 *        IEEE NaN arithmetic can be trusted not to trap
137 *
138 C        ILAENV = 0
139          ILAENV = 1
140          IF( ILAENV.EQ.1 ) THEN
141             ILAENV = IEEECK( 10.01.0 )
142          END IF
143 *
144       ELSE IF( ISPEC.EQ.11 ) THEN
145 *
146 *        Infinity arithmetic can be trusted not to trap
147 *
148 C        ILAENV = 0
149          ILAENV = 1
150          IF( ILAENV.EQ.1 ) THEN
151             ILAENV = IEEECK( 00.01.0 )
152          END IF
153 *
154       ELSE
155 *
156 *        Invalid value for ISPEC
157 *
158          ILAENV = -1
159       END IF
160 *
161       RETURN
162 *
163 *     End of ILAENV
164 *
165       END