1
INTEGER FUNCTION GAL_ILAENV( ISPEC, NAME, OPTS,
4
* -- LAPACK auxiliary routine (preliminary version) --
5
* Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
6
* Courant Institute, Argonne National Lab, and Rice University
9
* .. Scalar Arguments ..
10
CHARACTER*( * ) NAME, OPTS
11
INTEGER ISPEC, N1, N2, N3, N4
17
* GAL_ILAENV is called from the LAPACK routines to choose
18
* problem-dependent parameters for the local environment. See ISPEC
19
* for a description of the parameters.
21
* This version provides a set of parameters which should give good,
22
* but not optimal, performance on many of the currently available
23
* computers. Users are encouraged to modify this subroutine to set
24
* the tuning parameters for their particular machine using the option
25
* and problem size information in the arguments.
27
* This routine will not function correctly if it is converted to all
28
* lower case. Converting it to all upper case is allowed.
33
* ISPEC (input) INTEGER
34
* Specifies the parameter to be returned as the value of
36
* = 1: the optimal blocksize; if this value is 1, an unblocked
37
* algorithm will give the best performance.
38
* = 2: the minimum block size for which the block routine
39
* should be used; if the usable block size is less than
40
* this value, an unblocked routine should be used.
41
* = 3: the crossover point (in a block routine, for N less
42
* than this value, an unblocked routine should be used)
43
* = 4: the number of shifts, used in the nonsymmetric
45
* = 5: the minimum column dimension for blocking to be used;
46
* rectangular blocks must have dimension at least k by m,
47
* where k is given by GAL_ILAENV(2,...) and m by
49
* = 6: the crossover point for the SVD (when reducing an m by n
50
* matrix to bidiagonal form, if max(m,n)/min(m,n) exceeds
51
* this value, a QR factorization is used first to reduce
52
* the matrix to a triangular form.)
53
* = 7: the number of processors
54
* = 8: the crossover point for the multishift QR and QZ methods
55
* for nonsymmetric eigenvalue problems.
57
* NAME (input) CHARACTER*(*)
58
* The name of the calling subroutine, in either upper case or
61
* OPTS (input) CHARACTER*(*)
62
* The character options to the subroutine NAME, concatenated
63
* into a single character string. For example, UPLO = 'U',
64
* TRANS = 'T', and DIAG = 'N' for a triangular routine would
65
* be specified as OPTS = 'UTN'.
71
* Problem dimensions for the subroutine NAME; these may not all
74
* (GAL_ILAENV) (output) INTEGER
75
* >= 0: the value of the parameter specified by ISPEC
76
* < 0: if GAL_ILAENV = -k, the k-th argument had an illegal
82
* The following conventions have been used when calling GAL_ILAENV from
83
* the LAPACK routines:
84
* 1) OPTS is a concatenation of all of the character options to
85
* subroutine NAME, in the same order that they appear in the
86
* argument list for NAME, even if they are not used in determining
87
* the value of the parameter specified by ISPEC.
88
* 2) The problem dimensions N1, N2, N3, N4 are specified in the order
89
* that they appear in the argument list for NAME. N1 is used
90
* first, N2 second, and so on, and unused problem dimensions are
91
* passed a value of -1.
92
* 3) The parameter value returned by GAL_ILAENV is checked for
93
* validity in the calling subroutine. For example, GAL_ILAENV is
94
* used to retrieve the optimal blocksize for STRTRI as follows:
96
* NB = GAL_ILAENV( 1, 'STRTRI', UPLO // DIAG, N, -1, -1, -1 )
97
* IF( NB.LE.1 ) NB = MAX( 1, N )
99
* =====================================================================
101
* .. Local Scalars ..
107
INTEGER I, IC, IZ, NB, NBMIN, NX
109
* .. Intrinsic Functions ..
110
INTRINSIC CHAR, ICHAR, INT, MIN, REAL
112
* .. Executable Statements ..
114
GO TO ( 100, 100, 100, 400, 500, 600, 700, 800 ) ISPEC
116
* Invalid value for ISPEC
123
* Convert NAME to upper case if the first character is lower case.
127
IC = ICHAR( SUBNAM( 1:1 ) )
129
IF( IZ.EQ.90 .OR. IZ.EQ.122 ) THEN
131
* ASCII character set
133
IF( IC.GE.97 .AND. IC.LE.122 ) THEN
134
SUBNAM( 1:1 ) = CHAR( IC-32 )
136
IC = ICHAR( SUBNAM( I:I ) )
137
IF( IC.GE.97 .AND. IC.LE.122 )
138
$ SUBNAM( I:I ) = CHAR( IC-32 )
142
ELSE IF( IZ.EQ.233 .OR. IZ.EQ.169 ) THEN
144
* EBCDIC character set
146
IF( ( IC.GE.129 .AND. IC.LE.137 ) .OR.
147
$ ( IC.GE.145 .AND. IC.LE.153 ) .OR.
148
$ ( IC.GE.162 .AND. IC.LE.169 ) ) THEN
149
SUBNAM( 1:1 ) = CHAR( IC+64 )
151
IC = ICHAR( SUBNAM( I:I ) )
152
IF( ( IC.GE.129 .AND. IC.LE.137 ) .OR.
153
$ ( IC.GE.145 .AND. IC.LE.153 ) .OR.
154
$ ( IC.GE.162 .AND. IC.LE.169 ) )
155
$ SUBNAM( I:I ) = CHAR( IC+64 )
159
ELSE IF( IZ.EQ.218 .OR. IZ.EQ.250 ) THEN
161
* Prime machines: ASCII+128
163
IF( IC.GE.225 .AND. IC.LE.250 ) THEN
164
SUBNAM( 1:1 ) = CHAR( IC-32 )
166
IC = ICHAR( SUBNAM( I:I ) )
167
IF( IC.GE.225 .AND. IC.LE.250 )
168
$ SUBNAM( I:I ) = CHAR( IC-32 )
174
SNAME = C1.EQ.'S' .OR. C1.EQ.'D'
175
CNAME = C1.EQ.'C' .OR. C1.EQ.'Z'
176
IF( .NOT.( CNAME .OR. SNAME ) )
182
GO TO ( 110, 200, 300 ) ISPEC
186
* ISPEC = 1: block size
188
* In these examples, separate code is provided for setting NB for
189
* real and complex. We assume that NB will take the same value in
190
* single or double precision.
194
IF( C2.EQ.'GE' ) THEN
195
IF( C3.EQ.'TRF' ) THEN
201
ELSE IF( C3.EQ.'QRF' .OR. C3.EQ.'RQF' .OR. C3.EQ.'LQF' .OR.
208
ELSE IF( C3.EQ.'HRD' ) THEN
214
ELSE IF( C3.EQ.'BRD' ) THEN
220
ELSE IF( C3.EQ.'TRI' ) THEN
227
ELSE IF( C2.EQ.'PO' ) THEN
228
IF( C3.EQ.'TRF' ) THEN
235
ELSE IF( C2.EQ.'SY' ) THEN
236
IF( C3.EQ.'TRF' ) THEN
242
ELSE IF( SNAME .AND. C3.EQ.'TRD' ) THEN
244
ELSE IF( SNAME .AND. C3.EQ.'GST' ) THEN
247
ELSE IF( CNAME .AND. C2.EQ.'HE' ) THEN
248
IF( C3.EQ.'TRF' ) THEN
250
ELSE IF( C3.EQ.'TRD' ) THEN
252
ELSE IF( C3.EQ.'GST' ) THEN
255
ELSE IF( SNAME .AND. C2.EQ.'OR' ) THEN
256
IF( C3( 1:1 ).EQ.'G' ) THEN
257
IF( C4.EQ.'QR' .OR. C4.EQ.'RQ' .OR. C4.EQ.'LQ' .OR.
258
$ C4.EQ.'QL' .OR. C4.EQ.'HR' .OR. C4.EQ.'TR' .OR.
262
ELSE IF( C3( 1:1 ).EQ.'M' ) THEN
263
IF( C4.EQ.'QR' .OR. C4.EQ.'RQ' .OR. C4.EQ.'LQ' .OR.
264
$ C4.EQ.'QL' .OR. C4.EQ.'HR' .OR. C4.EQ.'TR' .OR.
269
ELSE IF( CNAME .AND. C2.EQ.'UN' ) THEN
270
IF( C3( 1:1 ).EQ.'G' ) THEN
271
IF( C4.EQ.'QR' .OR. C4.EQ.'RQ' .OR. C4.EQ.'LQ' .OR.
272
$ C4.EQ.'QL' .OR. C4.EQ.'HR' .OR. C4.EQ.'TR' .OR.
276
ELSE IF( C3( 1:1 ).EQ.'M' ) THEN
277
IF( C4.EQ.'QR' .OR. C4.EQ.'RQ' .OR. C4.EQ.'LQ' .OR.
278
$ C4.EQ.'QL' .OR. C4.EQ.'HR' .OR. C4.EQ.'TR' .OR.
283
ELSE IF( C2.EQ.'GB' ) THEN
284
IF( C3.EQ.'TRF' ) THEN
299
ELSE IF( C2.EQ.'PB' ) THEN
300
IF( C3.EQ.'TRF' ) THEN
315
ELSE IF( C2.EQ.'TR' ) THEN
316
IF( C3.EQ.'TRI' ) THEN
323
ELSE IF( C2.EQ.'LA' ) THEN
324
IF( C3.EQ.'UUM' ) THEN
331
ELSE IF( SNAME .AND. C2.EQ.'ST' ) THEN
332
IF( C3.EQ.'EBZ' ) THEN
341
* ISPEC = 2: minimum block size
344
IF( C2.EQ.'GE' ) THEN
345
IF( C3.EQ.'QRF' .OR. C3.EQ.'RQF' .OR. C3.EQ.'LQF' .OR.
352
ELSE IF( C3.EQ.'HRD' ) THEN
358
ELSE IF( C3.EQ.'BRD' ) THEN
364
ELSE IF( C3.EQ.'TRI' ) THEN
371
ELSE IF( C2.EQ.'SY' ) THEN
372
IF( C3.EQ.'TRF' ) THEN
378
ELSE IF( SNAME .AND. C3.EQ.'TRD' ) THEN
381
ELSE IF( CNAME .AND. C2.EQ.'HE' ) THEN
382
IF( C3.EQ.'TRD' ) THEN
385
ELSE IF( SNAME .AND. C2.EQ.'OR' ) THEN
386
IF( C3( 1:1 ).EQ.'G' ) THEN
387
IF( C4.EQ.'QR' .OR. C4.EQ.'RQ' .OR. C4.EQ.'LQ' .OR.
388
$ C4.EQ.'QL' .OR. C4.EQ.'HR' .OR. C4.EQ.'TR' .OR.
392
ELSE IF( C3( 1:1 ).EQ.'M' ) THEN
393
IF( C4.EQ.'QR' .OR. C4.EQ.'RQ' .OR. C4.EQ.'LQ' .OR.
394
$ C4.EQ.'QL' .OR. C4.EQ.'HR' .OR. C4.EQ.'TR' .OR.
399
ELSE IF( CNAME .AND. C2.EQ.'UN' ) THEN
400
IF( C3( 1:1 ).EQ.'G' ) THEN
401
IF( C4.EQ.'QR' .OR. C4.EQ.'RQ' .OR. C4.EQ.'LQ' .OR.
402
$ C4.EQ.'QL' .OR. C4.EQ.'HR' .OR. C4.EQ.'TR' .OR.
406
ELSE IF( C3( 1:1 ).EQ.'M' ) THEN
407
IF( C4.EQ.'QR' .OR. C4.EQ.'RQ' .OR. C4.EQ.'LQ' .OR.
408
$ C4.EQ.'QL' .OR. C4.EQ.'HR' .OR. C4.EQ.'TR' .OR.
419
* ISPEC = 3: crossover point
422
IF( C2.EQ.'GE' ) THEN
423
IF( C3.EQ.'QRF' .OR. C3.EQ.'RQF' .OR. C3.EQ.'LQF' .OR.
430
ELSE IF( C3.EQ.'HRD' ) THEN
436
ELSE IF( C3.EQ.'BRD' ) THEN
443
ELSE IF( C2.EQ.'SY' ) THEN
444
IF( SNAME .AND. C3.EQ.'TRD' ) THEN
447
ELSE IF( CNAME .AND. C2.EQ.'HE' ) THEN
448
IF( C3.EQ.'TRD' ) THEN
451
ELSE IF( SNAME .AND. C2.EQ.'OR' ) THEN
452
IF( C3( 1:1 ).EQ.'G' ) THEN
453
IF( C4.EQ.'QR' .OR. C4.EQ.'RQ' .OR. C4.EQ.'LQ' .OR.
454
$ C4.EQ.'QL' .OR. C4.EQ.'HR' .OR. C4.EQ.'TR' .OR.
459
ELSE IF( CNAME .AND. C2.EQ.'UN' ) THEN
460
IF( C3( 1:1 ).EQ.'G' ) THEN
461
IF( C4.EQ.'QR' .OR. C4.EQ.'RQ' .OR. C4.EQ.'LQ' .OR.
462
$ C4.EQ.'QL' .OR. C4.EQ.'HR' .OR. C4.EQ.'TR' .OR.
473
* ISPEC = 4: number of shifts (used by xHSEQR)
480
* ISPEC = 5: minimum column dimension (not used)
487
* ISPEC = 6: crossover point for SVD (used by xGELSS and xGESVD)
489
GAL_ILAENV = INT( REAL( MIN( N1, N2 ) )*1.6E0 )
494
* ISPEC = 7: number of processors (not used)
501
* ISPEC = 8: crossover point for multishift (used by xHSEQR)