KTH framework for Nek5000 toolboxes; testing version  0.0.1
ilaenv.f
Go to the documentation of this file.
1  INTEGER FUNCTION ilaenv( ISPEC, NAME, OPTS, N1, N2, N3,
2  $ N4 )
3 *
4 * -- LAPACK auxiliary routine (version 3.0) --
5 * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
6 * Courant Institute, Argonne National Lab, and Rice University
7 * June 30, 1999
8 *
9 * .. Scalar Arguments ..
10  CHARACTER*( * ) name, opts
11  INTEGER ispec, n1, n2, n3, n4
12 * ..
13 *
14 * Purpose
15 * =======
16 *
17 * ILAENV is called from the LAPACK routines to choose problem-dependent
18 * parameters for the local environment. See ISPEC for a description of
19 * the parameters.
20 *
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.
26 *
27 * This routine will not function correctly if it is converted to all
28 * lower case. Converting it to all upper case is allowed.
29 *
30 * Arguments
31 * =========
32 *
33 * ISPEC (input) INTEGER
34 * Specifies the parameter to be returned as the value of
35 * ILAENV.
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
44 * eigenvalue routines
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 ILAENV(2,...) and m by ILAENV(5,...)
48 * = 6: the crossover point for the SVD (when reducing an m by n
49 * matrix to bidiagonal form, if max(m,n)/min(m,n) exceeds
50 * this value, a QR factorization is used first to reduce
51 * the matrix to a triangular form.)
52 * = 7: the number of processors
53 * = 8: the crossover point for the multishift QR and QZ methods
54 * for nonsymmetric eigenvalue problems.
55 * = 9: maximum size of the subproblems at the bottom of the
56 * computation tree in the divide-and-conquer algorithm
57 * (used by xGELSD and xGESDD)
58 * =10: ieee NaN arithmetic can be trusted not to trap
59 * =11: infinity arithmetic can be trusted not to trap
60 *
61 * NAME (input) CHARACTER*(*)
62 * The name of the calling subroutine, in either upper case or
63 * lower case.
64 *
65 * OPTS (input) CHARACTER*(*)
66 * The character options to the subroutine NAME, concatenated
67 * into a single character string. For example, UPLO = 'U',
68 * TRANS = 'T', and DIAG = 'N' for a triangular routine would
69 * be specified as OPTS = 'UTN'.
70 *
71 * N1 (input) INTEGER
72 * N2 (input) INTEGER
73 * N3 (input) INTEGER
74 * N4 (input) INTEGER
75 * Problem dimensions for the subroutine NAME; these may not all
76 * be required.
77 *
78 * (ILAENV) (output) INTEGER
79 * >= 0: the value of the parameter specified by ISPEC
80 * < 0: if ILAENV = -k, the k-th argument had an illegal value.
81 *
82 * Further Details
83 * ===============
84 *
85 * The following conventions have been used when calling ILAENV from the
86 * LAPACK routines:
87 * 1) OPTS is a concatenation of all of the character options to
88 * subroutine NAME, in the same order that they appear in the
89 * argument list for NAME, even if they are not used in determining
90 * the value of the parameter specified by ISPEC.
91 * 2) The problem dimensions N1, N2, N3, N4 are specified in the order
92 * that they appear in the argument list for NAME. N1 is used
93 * first, N2 second, and so on, and unused problem dimensions are
94 * passed a value of -1.
95 * 3) The parameter value returned by ILAENV is checked for validity in
96 * the calling subroutine. For example, ILAENV is used to retrieve
97 * the optimal blocksize for STRTRI as follows:
98 *
99 * NB = ILAENV( 1, 'STRTRI', UPLO // DIAG, N, -1, -1, -1 )
100 * IF( NB.LE.1 ) NB = MAX( 1, N )
101 *
102 * =====================================================================
103 *
104 * .. Local Scalars ..
105  LOGICAL cname, sname
106  CHARACTER*1 c1
107  CHARACTER*2 c2, c4
108  CHARACTER*3 c3
109  CHARACTER*6 subnam
110  INTEGER i, ic, iz, nb, nbmin, nx
111 * ..
112 * .. Intrinsic Functions ..
113  INTRINSIC char, ichar, int, min, real
114 * ..
115 * .. External Functions ..
116  INTEGER ieeeck
117  EXTERNAL ieeeck
118 * ..
119 * .. Executable Statements ..
120 *
121  GO TO ( 100, 100, 100, 400, 500, 600, 700, 800, 900, 1000,
122  $ 1100 ) ispec
123 *
124 * Invalid value for ISPEC
125 *
126  ilaenv = -1
127  RETURN
128 *
129  100 CONTINUE
130 *
131 * Convert NAME to upper case if the first character is lower case.
132 *
133  ilaenv = 1
134  subnam = name
135  ic = ichar( subnam( 1:1 ) )
136  iz = ichar( 'Z' )
137  IF( iz.EQ.90 .OR. iz.EQ.122 ) THEN
138 *
139 * ASCII character set
140 *
141  IF( ic.GE.97 .AND. ic.LE.122 ) THEN
142  subnam( 1:1 ) = char( ic-32 )
143  DO 10 i = 2, 6
144  ic = ichar( subnam( i:i ) )
145  IF( ic.GE.97 .AND. ic.LE.122 )
146  $ subnam( i:i ) = char( ic-32 )
147  10 CONTINUE
148  END IF
149 *
150  ELSE IF( iz.EQ.233 .OR. iz.EQ.169 ) THEN
151 *
152 * EBCDIC character set
153 *
154  IF( ( ic.GE.129 .AND. ic.LE.137 ) .OR.
155  $ ( ic.GE.145 .AND. ic.LE.153 ) .OR.
156  $ ( ic.GE.162 .AND. ic.LE.169 ) ) THEN
157  subnam( 1:1 ) = char( ic+64 )
158  DO 20 i = 2, 6
159  ic = ichar( subnam( i:i ) )
160  IF( ( ic.GE.129 .AND. ic.LE.137 ) .OR.
161  $ ( ic.GE.145 .AND. ic.LE.153 ) .OR.
162  $ ( ic.GE.162 .AND. ic.LE.169 ) )
163  $ subnam( i:i ) = char( ic+64 )
164  20 CONTINUE
165  END IF
166 *
167  ELSE IF( iz.EQ.218 .OR. iz.EQ.250 ) THEN
168 *
169 * Prime machines: ASCII+128
170 *
171  IF( ic.GE.225 .AND. ic.LE.250 ) THEN
172  subnam( 1:1 ) = char( ic-32 )
173  DO 30 i = 2, 6
174  ic = ichar( subnam( i:i ) )
175  IF( ic.GE.225 .AND. ic.LE.250 )
176  $ subnam( i:i ) = char( ic-32 )
177  30 CONTINUE
178  END IF
179  END IF
180 *
181  c1 = subnam( 1:1 )
182  sname = c1.EQ.'S' .OR. c1.EQ.'D'
183  cname = c1.EQ.'C' .OR. c1.EQ.'Z'
184  IF( .NOT.( cname .OR. sname ) )
185  $ RETURN
186  c2 = subnam( 2:3 )
187  c3 = subnam( 4:6 )
188  c4 = c3( 2:3 )
189 *
190  GO TO ( 110, 200, 300 ) ispec
191 *
192  110 CONTINUE
193 *
194 * ISPEC = 1: block size
195 *
196 * In these examples, separate code is provided for setting NB for
197 * real and complex. We assume that NB will take the same value in
198 * single or double precision.
199 *
200  nb = 1
201 *
202  IF( c2.EQ.'GE' ) THEN
203  IF( c3.EQ.'TRF' ) THEN
204  IF( sname ) THEN
205  nb = 64
206  ELSE
207  nb = 64
208  END IF
209  ELSE IF( c3.EQ.'QRF' .OR. c3.EQ.'RQF' .OR. c3.EQ.'LQF' .OR.
210  $ c3.EQ.'QLF' ) THEN
211  IF( sname ) THEN
212  nb = 32
213  ELSE
214  nb = 32
215  END IF
216  ELSE IF( c3.EQ.'HRD' ) THEN
217  IF( sname ) THEN
218  nb = 32
219  ELSE
220  nb = 32
221  END IF
222  ELSE IF( c3.EQ.'BRD' ) THEN
223  IF( sname ) THEN
224  nb = 32
225  ELSE
226  nb = 32
227  END IF
228  ELSE IF( c3.EQ.'TRI' ) THEN
229  IF( sname ) THEN
230  nb = 64
231  ELSE
232  nb = 64
233  END IF
234  END IF
235  ELSE IF( c2.EQ.'PO' ) THEN
236  IF( c3.EQ.'TRF' ) THEN
237  IF( sname ) THEN
238  nb = 64
239  ELSE
240  nb = 64
241  END IF
242  END IF
243  ELSE IF( c2.EQ.'SY' ) THEN
244  IF( c3.EQ.'TRF' ) THEN
245  IF( sname ) THEN
246  nb = 64
247  ELSE
248  nb = 64
249  END IF
250  ELSE IF( sname .AND. c3.EQ.'TRD' ) THEN
251  nb = 32
252  ELSE IF( sname .AND. c3.EQ.'GST' ) THEN
253  nb = 64
254  END IF
255  ELSE IF( cname .AND. c2.EQ.'HE' ) THEN
256  IF( c3.EQ.'TRF' ) THEN
257  nb = 64
258  ELSE IF( c3.EQ.'TRD' ) THEN
259  nb = 32
260  ELSE IF( c3.EQ.'GST' ) THEN
261  nb = 64
262  END IF
263  ELSE IF( sname .AND. c2.EQ.'OR' ) THEN
264  IF( c3( 1:1 ).EQ.'G' ) THEN
265  IF( c4.EQ.'QR' .OR. c4.EQ.'RQ' .OR. c4.EQ.'LQ' .OR.
266  $ c4.EQ.'QL' .OR. c4.EQ.'HR' .OR. c4.EQ.'TR' .OR.
267  $ c4.EQ.'BR' ) THEN
268  nb = 32
269  END IF
270  ELSE IF( c3( 1:1 ).EQ.'M' ) 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.
273  $ c4.EQ.'BR' ) THEN
274  nb = 32
275  END IF
276  END IF
277  ELSE IF( cname .AND. c2.EQ.'UN' ) THEN
278  IF( c3( 1:1 ).EQ.'G' ) THEN
279  IF( c4.EQ.'QR' .OR. c4.EQ.'RQ' .OR. c4.EQ.'LQ' .OR.
280  $ c4.EQ.'QL' .OR. c4.EQ.'HR' .OR. c4.EQ.'TR' .OR.
281  $ c4.EQ.'BR' ) THEN
282  nb = 32
283  END IF
284  ELSE IF( c3( 1:1 ).EQ.'M' ) THEN
285  IF( c4.EQ.'QR' .OR. c4.EQ.'RQ' .OR. c4.EQ.'LQ' .OR.
286  $ c4.EQ.'QL' .OR. c4.EQ.'HR' .OR. c4.EQ.'TR' .OR.
287  $ c4.EQ.'BR' ) THEN
288  nb = 32
289  END IF
290  END IF
291  ELSE IF( c2.EQ.'GB' ) THEN
292  IF( c3.EQ.'TRF' ) THEN
293  IF( sname ) THEN
294  IF( n4.LE.64 ) THEN
295  nb = 1
296  ELSE
297  nb = 32
298  END IF
299  ELSE
300  IF( n4.LE.64 ) THEN
301  nb = 1
302  ELSE
303  nb = 32
304  END IF
305  END IF
306  END IF
307  ELSE IF( c2.EQ.'PB' ) THEN
308  IF( c3.EQ.'TRF' ) THEN
309  IF( sname ) THEN
310  IF( n2.LE.64 ) THEN
311  nb = 1
312  ELSE
313  nb = 32
314  END IF
315  ELSE
316  IF( n2.LE.64 ) THEN
317  nb = 1
318  ELSE
319  nb = 32
320  END IF
321  END IF
322  END IF
323  ELSE IF( c2.EQ.'TR' ) THEN
324  IF( c3.EQ.'TRI' ) THEN
325  IF( sname ) THEN
326  nb = 64
327  ELSE
328  nb = 64
329  END IF
330  END IF
331  ELSE IF( c2.EQ.'LA' ) THEN
332  IF( c3.EQ.'UUM' ) THEN
333  IF( sname ) THEN
334  nb = 64
335  ELSE
336  nb = 64
337  END IF
338  END IF
339  ELSE IF( sname .AND. c2.EQ.'ST' ) THEN
340  IF( c3.EQ.'EBZ' ) THEN
341  nb = 1
342  END IF
343  END IF
344  ilaenv = nb
345  RETURN
346 *
347  200 CONTINUE
348 *
349 * ISPEC = 2: minimum block size
350 *
351  nbmin = 2
352  IF( c2.EQ.'GE' ) THEN
353  IF( c3.EQ.'QRF' .OR. c3.EQ.'RQF' .OR. c3.EQ.'LQF' .OR.
354  $ c3.EQ.'QLF' ) THEN
355  IF( sname ) THEN
356  nbmin = 2
357  ELSE
358  nbmin = 2
359  END IF
360  ELSE IF( c3.EQ.'HRD' ) THEN
361  IF( sname ) THEN
362  nbmin = 2
363  ELSE
364  nbmin = 2
365  END IF
366  ELSE IF( c3.EQ.'BRD' ) THEN
367  IF( sname ) THEN
368  nbmin = 2
369  ELSE
370  nbmin = 2
371  END IF
372  ELSE IF( c3.EQ.'TRI' ) THEN
373  IF( sname ) THEN
374  nbmin = 2
375  ELSE
376  nbmin = 2
377  END IF
378  END IF
379  ELSE IF( c2.EQ.'SY' ) THEN
380  IF( c3.EQ.'TRF' ) THEN
381  IF( sname ) THEN
382  nbmin = 8
383  ELSE
384  nbmin = 8
385  END IF
386  ELSE IF( sname .AND. c3.EQ.'TRD' ) THEN
387  nbmin = 2
388  END IF
389  ELSE IF( cname .AND. c2.EQ.'HE' ) THEN
390  IF( c3.EQ.'TRD' ) THEN
391  nbmin = 2
392  END IF
393  ELSE IF( sname .AND. c2.EQ.'OR' ) THEN
394  IF( c3( 1:1 ).EQ.'G' ) THEN
395  IF( c4.EQ.'QR' .OR. c4.EQ.'RQ' .OR. c4.EQ.'LQ' .OR.
396  $ c4.EQ.'QL' .OR. c4.EQ.'HR' .OR. c4.EQ.'TR' .OR.
397  $ c4.EQ.'BR' ) THEN
398  nbmin = 2
399  END IF
400  ELSE IF( c3( 1:1 ).EQ.'M' ) 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.
403  $ c4.EQ.'BR' ) THEN
404  nbmin = 2
405  END IF
406  END IF
407  ELSE IF( cname .AND. c2.EQ.'UN' ) THEN
408  IF( c3( 1:1 ).EQ.'G' ) THEN
409  IF( c4.EQ.'QR' .OR. c4.EQ.'RQ' .OR. c4.EQ.'LQ' .OR.
410  $ c4.EQ.'QL' .OR. c4.EQ.'HR' .OR. c4.EQ.'TR' .OR.
411  $ c4.EQ.'BR' ) THEN
412  nbmin = 2
413  END IF
414  ELSE IF( c3( 1:1 ).EQ.'M' ) THEN
415  IF( c4.EQ.'QR' .OR. c4.EQ.'RQ' .OR. c4.EQ.'LQ' .OR.
416  $ c4.EQ.'QL' .OR. c4.EQ.'HR' .OR. c4.EQ.'TR' .OR.
417  $ c4.EQ.'BR' ) THEN
418  nbmin = 2
419  END IF
420  END IF
421  END IF
422  ilaenv = nbmin
423  RETURN
424 *
425  300 CONTINUE
426 *
427 * ISPEC = 3: crossover point
428 *
429  nx = 0
430  IF( c2.EQ.'GE' ) THEN
431  IF( c3.EQ.'QRF' .OR. c3.EQ.'RQF' .OR. c3.EQ.'LQF' .OR.
432  $ c3.EQ.'QLF' ) THEN
433  IF( sname ) THEN
434  nx = 128
435  ELSE
436  nx = 128
437  END IF
438  ELSE IF( c3.EQ.'HRD' ) THEN
439  IF( sname ) THEN
440  nx = 128
441  ELSE
442  nx = 128
443  END IF
444  ELSE IF( c3.EQ.'BRD' ) THEN
445  IF( sname ) THEN
446  nx = 128
447  ELSE
448  nx = 128
449  END IF
450  END IF
451  ELSE IF( c2.EQ.'SY' ) THEN
452  IF( sname .AND. c3.EQ.'TRD' ) THEN
453  nx = 32
454  END IF
455  ELSE IF( cname .AND. c2.EQ.'HE' ) THEN
456  IF( c3.EQ.'TRD' ) THEN
457  nx = 32
458  END IF
459  ELSE IF( sname .AND. c2.EQ.'OR' ) 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.
463  $ c4.EQ.'BR' ) THEN
464  nx = 128
465  END IF
466  END IF
467  ELSE IF( cname .AND. c2.EQ.'UN' ) THEN
468  IF( c3( 1:1 ).EQ.'G' ) THEN
469  IF( c4.EQ.'QR' .OR. c4.EQ.'RQ' .OR. c4.EQ.'LQ' .OR.
470  $ c4.EQ.'QL' .OR. c4.EQ.'HR' .OR. c4.EQ.'TR' .OR.
471  $ c4.EQ.'BR' ) THEN
472  nx = 128
473  END IF
474  END IF
475  END IF
476  ilaenv = nx
477  RETURN
478 *
479  400 CONTINUE
480 *
481 * ISPEC = 4: number of shifts (used by xHSEQR)
482 *
483  ilaenv = 6
484  RETURN
485 *
486  500 CONTINUE
487 *
488 * ISPEC = 5: minimum column dimension (not used)
489 *
490  ilaenv = 2
491  RETURN
492 *
493  600 CONTINUE
494 *
495 * ISPEC = 6: crossover point for SVD (used by xGELSS and xGESVD)
496 *
497  ilaenv = int( real( min( n1, n2 ) )*1.6e0 )
498  RETURN
499 *
500  700 CONTINUE
501 *
502 * ISPEC = 7: number of processors (not used)
503 *
504  ilaenv = 1
505  RETURN
506 *
507  800 CONTINUE
508 *
509 * ISPEC = 8: crossover point for multishift (used by xHSEQR)
510 *
511  ilaenv = 50
512  RETURN
513 *
514  900 CONTINUE
515 *
516 * ISPEC = 9: maximum size of the subproblems at the bottom of the
517 * computation tree in the divide-and-conquer algorithm
518 * (used by xGELSD and xGESDD)
519 *
520  ilaenv = 25
521  RETURN
522 *
523  1000 CONTINUE
524 *
525 * ISPEC = 10: ieee NaN arithmetic can be trusted not to trap
526 *
527 C ILAENV = 0
528  ilaenv = 1
529  IF( ilaenv.EQ.1 ) THEN
530  ilaenv = ieeeck( 0, 0.0, 1.0 )
531  END IF
532  RETURN
533 *
534  1100 CONTINUE
535 *
536 * ISPEC = 11: infinity arithmetic can be trusted not to trap
537 *
538 C ILAENV = 0
539  ilaenv = 1
540  IF( ilaenv.EQ.1 ) THEN
541  ilaenv = ieeeck( 1, 0.0, 1.0 )
542  END IF
543  RETURN
544 *
545 * End of ILAENV
546 *
547  END
integer function ieeeck(ISPEC, ZERO, ONE)
Definition: ieeeck.f:2
integer function ilaenv(ISPEC, NAME, OPTS, N1, N2, N3, N4)
Definition: ilaenv.f:3