C_LAPACK: Fixes to make it compile with MSVC (#3605)
[platform/upstream/openblas.git] / lapack-netlib / SRC / ilaenv.c
1 #include <math.h>
2 #include <stdlib.h>
3 #include <string.h>
4 #include <stdio.h>
5 #include <complex.h>
6 #ifdef complex
7 #undef complex
8 #endif
9 #ifdef I
10 #undef I
11 #endif
12
13 #if defined(_WIN64)
14 typedef long long BLASLONG;
15 typedef unsigned long long BLASULONG;
16 #else
17 typedef long BLASLONG;
18 typedef unsigned long BLASULONG;
19 #endif
20
21 #ifdef LAPACK_ILP64
22 typedef BLASLONG blasint;
23 #if defined(_WIN64)
24 #define blasabs(x) llabs(x)
25 #else
26 #define blasabs(x) labs(x)
27 #endif
28 #else
29 typedef int blasint;
30 #define blasabs(x) abs(x)
31 #endif
32
33 typedef blasint integer;
34
35 typedef unsigned int uinteger;
36 typedef char *address;
37 typedef short int shortint;
38 typedef float real;
39 typedef double doublereal;
40 typedef struct { real r, i; } complex;
41 typedef struct { doublereal r, i; } doublecomplex;
42 #ifdef _MSC_VER
43 static inline _Fcomplex Cf(complex *z) {_Fcomplex zz={z->r , z->i}; return zz;}
44 static inline _Dcomplex Cd(doublecomplex *z) {_Dcomplex zz={z->r , z->i};return zz;}
45 static inline _Fcomplex * _pCf(complex *z) {return (_Fcomplex*)z;}
46 static inline _Dcomplex * _pCd(doublecomplex *z) {return (_Dcomplex*)z;}
47 #else
48 static inline _Complex float Cf(complex *z) {return z->r + z->i*_Complex_I;}
49 static inline _Complex double Cd(doublecomplex *z) {return z->r + z->i*_Complex_I;}
50 static inline _Complex float * _pCf(complex *z) {return (_Complex float*)z;}
51 static inline _Complex double * _pCd(doublecomplex *z) {return (_Complex double*)z;}
52 #endif
53 #define pCf(z) (*_pCf(z))
54 #define pCd(z) (*_pCd(z))
55 typedef int logical;
56 typedef short int shortlogical;
57 typedef char logical1;
58 typedef char integer1;
59
60 #define TRUE_ (1)
61 #define FALSE_ (0)
62
63 /* Extern is for use with -E */
64 #ifndef Extern
65 #define Extern extern
66 #endif
67
68 /* I/O stuff */
69
70 typedef int flag;
71 typedef int ftnlen;
72 typedef int ftnint;
73
74 /*external read, write*/
75 typedef struct
76 {       flag cierr;
77         ftnint ciunit;
78         flag ciend;
79         char *cifmt;
80         ftnint cirec;
81 } cilist;
82
83 /*internal read, write*/
84 typedef struct
85 {       flag icierr;
86         char *iciunit;
87         flag iciend;
88         char *icifmt;
89         ftnint icirlen;
90         ftnint icirnum;
91 } icilist;
92
93 /*open*/
94 typedef struct
95 {       flag oerr;
96         ftnint ounit;
97         char *ofnm;
98         ftnlen ofnmlen;
99         char *osta;
100         char *oacc;
101         char *ofm;
102         ftnint orl;
103         char *oblnk;
104 } olist;
105
106 /*close*/
107 typedef struct
108 {       flag cerr;
109         ftnint cunit;
110         char *csta;
111 } cllist;
112
113 /*rewind, backspace, endfile*/
114 typedef struct
115 {       flag aerr;
116         ftnint aunit;
117 } alist;
118
119 /* inquire */
120 typedef struct
121 {       flag inerr;
122         ftnint inunit;
123         char *infile;
124         ftnlen infilen;
125         ftnint  *inex;  /*parameters in standard's order*/
126         ftnint  *inopen;
127         ftnint  *innum;
128         ftnint  *innamed;
129         char    *inname;
130         ftnlen  innamlen;
131         char    *inacc;
132         ftnlen  inacclen;
133         char    *inseq;
134         ftnlen  inseqlen;
135         char    *indir;
136         ftnlen  indirlen;
137         char    *infmt;
138         ftnlen  infmtlen;
139         char    *inform;
140         ftnint  informlen;
141         char    *inunf;
142         ftnlen  inunflen;
143         ftnint  *inrecl;
144         ftnint  *innrec;
145         char    *inblank;
146         ftnlen  inblanklen;
147 } inlist;
148
149 #define VOID void
150
151 union Multitype {       /* for multiple entry points */
152         integer1 g;
153         shortint h;
154         integer i;
155         /* longint j; */
156         real r;
157         doublereal d;
158         complex c;
159         doublecomplex z;
160         };
161
162 typedef union Multitype Multitype;
163
164 struct Vardesc {        /* for Namelist */
165         char *name;
166         char *addr;
167         ftnlen *dims;
168         int  type;
169         };
170 typedef struct Vardesc Vardesc;
171
172 struct Namelist {
173         char *name;
174         Vardesc **vars;
175         int nvars;
176         };
177 typedef struct Namelist Namelist;
178
179 #define abs(x) ((x) >= 0 ? (x) : -(x))
180 #define dabs(x) (fabs(x))
181 #define f2cmin(a,b) ((a) <= (b) ? (a) : (b))
182 #define f2cmax(a,b) ((a) >= (b) ? (a) : (b))
183 #define dmin(a,b) (f2cmin(a,b))
184 #define dmax(a,b) (f2cmax(a,b))
185 #define bit_test(a,b)   ((a) >> (b) & 1)
186 #define bit_clear(a,b)  ((a) & ~((uinteger)1 << (b)))
187 #define bit_set(a,b)    ((a) |  ((uinteger)1 << (b)))
188
189 #define abort_() { sig_die("Fortran abort routine called", 1); }
190 #define c_abs(z) (cabsf(Cf(z)))
191 #define c_cos(R,Z) { pCf(R)=ccos(Cf(Z)); }
192 #ifdef _MSC_VER
193 #define c_div(c, a, b) {Cf(c)._Val[0] = (Cf(a)._Val[0]/Cf(b)._Val[0]); Cf(c)._Val[1]=(Cf(a)._Val[1]/Cf(b)._Val[1]);}
194 #define z_div(c, a, b) {Cd(c)._Val[0] = (Cd(a)._Val[0]/Cd(b)._Val[0]); Cd(c)._Val[1]=(Cd(a)._Val[1]/df(b)._Val[1]);}
195 #else
196 #define c_div(c, a, b) {pCf(c) = Cf(a)/Cf(b);}
197 #define z_div(c, a, b) {pCd(c) = Cd(a)/Cd(b);}
198 #endif
199 #define c_exp(R, Z) {pCf(R) = cexpf(Cf(Z));}
200 #define c_log(R, Z) {pCf(R) = clogf(Cf(Z));}
201 #define c_sin(R, Z) {pCf(R) = csinf(Cf(Z));}
202 //#define c_sqrt(R, Z) {*(R) = csqrtf(Cf(Z));}
203 #define c_sqrt(R, Z) {pCf(R) = csqrtf(Cf(Z));}
204 #define d_abs(x) (fabs(*(x)))
205 #define d_acos(x) (acos(*(x)))
206 #define d_asin(x) (asin(*(x)))
207 #define d_atan(x) (atan(*(x)))
208 #define d_atn2(x, y) (atan2(*(x),*(y)))
209 #define d_cnjg(R, Z) { pCd(R) = conj(Cd(Z)); }
210 #define r_cnjg(R, Z) { pCf(R) = conjf(Cf(Z)); }
211 #define d_cos(x) (cos(*(x)))
212 #define d_cosh(x) (cosh(*(x)))
213 #define d_dim(__a, __b) ( *(__a) > *(__b) ? *(__a) - *(__b) : 0.0 )
214 #define d_exp(x) (exp(*(x)))
215 #define d_imag(z) (cimag(Cd(z)))
216 #define r_imag(z) (cimagf(Cf(z)))
217 #define d_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x)))
218 #define r_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x)))
219 #define d_lg10(x) ( 0.43429448190325182765 * log(*(x)) )
220 #define r_lg10(x) ( 0.43429448190325182765 * log(*(x)) )
221 #define d_log(x) (log(*(x)))
222 #define d_mod(x, y) (fmod(*(x), *(y)))
223 #define u_nint(__x) ((__x)>=0 ? floor((__x) + .5) : -floor(.5 - (__x)))
224 #define d_nint(x) u_nint(*(x))
225 #define u_sign(__a,__b) ((__b) >= 0 ? ((__a) >= 0 ? (__a) : -(__a)) : -((__a) >= 0 ? (__a) : -(__a)))
226 #define d_sign(a,b) u_sign(*(a),*(b))
227 #define r_sign(a,b) u_sign(*(a),*(b))
228 #define d_sin(x) (sin(*(x)))
229 #define d_sinh(x) (sinh(*(x)))
230 #define d_sqrt(x) (sqrt(*(x)))
231 #define d_tan(x) (tan(*(x)))
232 #define d_tanh(x) (tanh(*(x)))
233 #define i_abs(x) abs(*(x))
234 #define i_dnnt(x) ((integer)u_nint(*(x)))
235 #define i_len(s, n) (n)
236 #define i_nint(x) ((integer)u_nint(*(x)))
237 #define i_sign(a,b) ((integer)u_sign((integer)*(a),(integer)*(b)))
238 #define pow_dd(ap, bp) ( pow(*(ap), *(bp)))
239 #define pow_si(B,E) spow_ui(*(B),*(E))
240 #define pow_ri(B,E) spow_ui(*(B),*(E))
241 #define pow_di(B,E) dpow_ui(*(B),*(E))
242 #define pow_zi(p, a, b) {pCd(p) = zpow_ui(Cd(a), *(b));}
243 #define pow_ci(p, a, b) {pCf(p) = cpow_ui(Cf(a), *(b));}
244 #define pow_zz(R,A,B) {pCd(R) = cpow(Cd(A),*(B));}
245 #define s_cat(lpp, rpp, rnp, np, llp) {         ftnlen i, nc, ll; char *f__rp, *lp;     ll = (llp); lp = (lpp);         for(i=0; i < (int)*(np); ++i) {                 nc = ll;                if((rnp)[i] < nc) nc = (rnp)[i];                ll -= nc;               f__rp = (rpp)[i];               while(--nc >= 0) *lp++ = *(f__rp)++;         }  while(--ll >= 0) *lp++ = ' '; }
246 #define s_cmp(a,b,c,d) ((integer)strncmp((a),(b),f2cmin((c),(d))))
247 #define s_copy(A,B,C,D) { int __i,__m; for (__i=0, __m=f2cmin((C),(D)); __i<__m && (B)[__i] != 0; ++__i) (A)[__i] = (B)[__i]; }
248 #define sig_die(s, kill) { exit(1); }
249 #define s_stop(s, n) {exit(0);}
250 static char junk[] = "\n@(#)LIBF77 VERSION 19990503\n";
251 #define z_abs(z) (cabs(Cd(z)))
252 #define z_exp(R, Z) {pCd(R) = cexp(Cd(Z));}
253 #define z_sqrt(R, Z) {pCd(R) = csqrt(Cd(Z));}
254 #define myexit_() break;
255 #define mycycle() continue;
256 #define myceiling(w) {ceil(w)}
257 #define myhuge(w) {HUGE_VAL}
258 //#define mymaxloc_(w,s,e,n) {if (sizeof(*(w)) == sizeof(double)) dmaxloc_((w),*(s),*(e),n); else dmaxloc_((w),*(s),*(e),n);}
259 #define mymaxloc(w,s,e,n) {dmaxloc_(w,*(s),*(e),n)}
260
261 /* procedure parameter types for -A and -C++ */
262
263 #define F2C_proc_par_types 1
264 #ifdef __cplusplus
265 typedef logical (*L_fp)(...);
266 #else
267 typedef logical (*L_fp)();
268 #endif
269
270 static float spow_ui(float x, integer n) {
271         float pow=1.0; unsigned long int u;
272         if(n != 0) {
273                 if(n < 0) n = -n, x = 1/x;
274                 for(u = n; ; ) {
275                         if(u & 01) pow *= x;
276                         if(u >>= 1) x *= x;
277                         else break;
278                 }
279         }
280         return pow;
281 }
282 static double dpow_ui(double x, integer n) {
283         double pow=1.0; unsigned long int u;
284         if(n != 0) {
285                 if(n < 0) n = -n, x = 1/x;
286                 for(u = n; ; ) {
287                         if(u & 01) pow *= x;
288                         if(u >>= 1) x *= x;
289                         else break;
290                 }
291         }
292         return pow;
293 }
294 #ifdef _MSC_VER
295 static _Fcomplex cpow_ui(complex x, integer n) {
296         complex pow={1.0,0.0}; unsigned long int u;
297                 if(n != 0) {
298                 if(n < 0) n = -n, x.r = 1/x.r, x.i=1/x.i;
299                 for(u = n; ; ) {
300                         if(u & 01) pow.r *= x.r, pow.i *= x.i;
301                         if(u >>= 1) x.r *= x.r, x.i *= x.i;
302                         else break;
303                 }
304         }
305         _Fcomplex p={pow.r, pow.i};
306         return p;
307 }
308 #else
309 static _Complex float cpow_ui(_Complex float x, integer n) {
310         _Complex float pow=1.0; unsigned long int u;
311         if(n != 0) {
312                 if(n < 0) n = -n, x = 1/x;
313                 for(u = n; ; ) {
314                         if(u & 01) pow *= x;
315                         if(u >>= 1) x *= x;
316                         else break;
317                 }
318         }
319         return pow;
320 }
321 #endif
322 #ifdef _MSC_VER
323 static _Dcomplex zpow_ui(_Dcomplex x, integer n) {
324         _Dcomplex pow={1.0,0.0}; unsigned long int u;
325         if(n != 0) {
326                 if(n < 0) n = -n, x._Val[0] = 1/x._Val[0], x._Val[1] =1/x._Val[1];
327                 for(u = n; ; ) {
328                         if(u & 01) pow._Val[0] *= x._Val[0], pow._Val[1] *= x._Val[1];
329                         if(u >>= 1) x._Val[0] *= x._Val[0], x._Val[1] *= x._Val[1];
330                         else break;
331                 }
332         }
333         _Dcomplex p = {pow._Val[0], pow._Val[1]};
334         return p;
335 }
336 #else
337 static _Complex double zpow_ui(_Complex double x, integer n) {
338         _Complex double pow=1.0; unsigned long int u;
339         if(n != 0) {
340                 if(n < 0) n = -n, x = 1/x;
341                 for(u = n; ; ) {
342                         if(u & 01) pow *= x;
343                         if(u >>= 1) x *= x;
344                         else break;
345                 }
346         }
347         return pow;
348 }
349 #endif
350 static integer pow_ii(integer x, integer n) {
351         integer pow; unsigned long int u;
352         if (n <= 0) {
353                 if (n == 0 || x == 1) pow = 1;
354                 else if (x != -1) pow = x == 0 ? 1/x : 0;
355                 else n = -n;
356         }
357         if ((n > 0) || !(n == 0 || x == 1 || x != -1)) {
358                 u = n;
359                 for(pow = 1; ; ) {
360                         if(u & 01) pow *= x;
361                         if(u >>= 1) x *= x;
362                         else break;
363                 }
364         }
365         return pow;
366 }
367 static integer dmaxloc_(double *w, integer s, integer e, integer *n)
368 {
369         double m; integer i, mi;
370         for(m=w[s-1], mi=s, i=s+1; i<=e; i++)
371                 if (w[i-1]>m) mi=i ,m=w[i-1];
372         return mi-s+1;
373 }
374 static integer smaxloc_(float *w, integer s, integer e, integer *n)
375 {
376         float m; integer i, mi;
377         for(m=w[s-1], mi=s, i=s+1; i<=e; i++)
378                 if (w[i-1]>m) mi=i ,m=w[i-1];
379         return mi-s+1;
380 }
381 static inline void cdotc_(complex *z, integer *n_, complex *x, integer *incx_, complex *y, integer *incy_) {
382         integer n = *n_, incx = *incx_, incy = *incy_, i;
383 #ifdef _MSC_VER
384         _Fcomplex zdotc = {0.0, 0.0};
385         if (incx == 1 && incy == 1) {
386                 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
387                         zdotc._Val[0] += conjf(Cf(&x[i]))._Val[0] * Cf(&y[i])._Val[0];
388                         zdotc._Val[1] += conjf(Cf(&x[i]))._Val[1] * Cf(&y[i])._Val[1];
389                 }
390         } else {
391                 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
392                         zdotc._Val[0] += conjf(Cf(&x[i*incx]))._Val[0] * Cf(&y[i*incy])._Val[0];
393                         zdotc._Val[1] += conjf(Cf(&x[i*incx]))._Val[1] * Cf(&y[i*incy])._Val[1];
394                 }
395         }
396         pCf(z) = zdotc;
397 }
398 #else
399         _Complex float zdotc = 0.0;
400         if (incx == 1 && incy == 1) {
401                 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
402                         zdotc += conjf(Cf(&x[i])) * Cf(&y[i]);
403                 }
404         } else {
405                 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
406                         zdotc += conjf(Cf(&x[i*incx])) * Cf(&y[i*incy]);
407                 }
408         }
409         pCf(z) = zdotc;
410 }
411 #endif
412 static inline void zdotc_(doublecomplex *z, integer *n_, doublecomplex *x, integer *incx_, doublecomplex *y, integer *incy_) {
413         integer n = *n_, incx = *incx_, incy = *incy_, i;
414 #ifdef _MSC_VER
415         _Dcomplex zdotc = {0.0, 0.0};
416         if (incx == 1 && incy == 1) {
417                 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
418                         zdotc._Val[0] += conj(Cd(&x[i]))._Val[0] * Cd(&y[i])._Val[0];
419                         zdotc._Val[1] += conj(Cd(&x[i]))._Val[1] * Cd(&y[i])._Val[1];
420                 }
421         } else {
422                 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
423                         zdotc._Val[0] += conj(Cd(&x[i*incx]))._Val[0] * Cd(&y[i*incy])._Val[0];
424                         zdotc._Val[1] += conj(Cd(&x[i*incx]))._Val[1] * Cd(&y[i*incy])._Val[1];
425                 }
426         }
427         pCd(z) = zdotc;
428 }
429 #else
430         _Complex double zdotc = 0.0;
431         if (incx == 1 && incy == 1) {
432                 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
433                         zdotc += conj(Cd(&x[i])) * Cd(&y[i]);
434                 }
435         } else {
436                 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
437                         zdotc += conj(Cd(&x[i*incx])) * Cd(&y[i*incy]);
438                 }
439         }
440         pCd(z) = zdotc;
441 }
442 #endif  
443 static inline void cdotu_(complex *z, integer *n_, complex *x, integer *incx_, complex *y, integer *incy_) {
444         integer n = *n_, incx = *incx_, incy = *incy_, i;
445 #ifdef _MSC_VER
446         _Fcomplex zdotc = {0.0, 0.0};
447         if (incx == 1 && incy == 1) {
448                 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
449                         zdotc._Val[0] += Cf(&x[i])._Val[0] * Cf(&y[i])._Val[0];
450                         zdotc._Val[1] += Cf(&x[i])._Val[1] * Cf(&y[i])._Val[1];
451                 }
452         } else {
453                 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
454                         zdotc._Val[0] += Cf(&x[i*incx])._Val[0] * Cf(&y[i*incy])._Val[0];
455                         zdotc._Val[1] += Cf(&x[i*incx])._Val[1] * Cf(&y[i*incy])._Val[1];
456                 }
457         }
458         pCf(z) = zdotc;
459 }
460 #else
461         _Complex float zdotc = 0.0;
462         if (incx == 1 && incy == 1) {
463                 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
464                         zdotc += Cf(&x[i]) * Cf(&y[i]);
465                 }
466         } else {
467                 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
468                         zdotc += Cf(&x[i*incx]) * Cf(&y[i*incy]);
469                 }
470         }
471         pCf(z) = zdotc;
472 }
473 #endif
474 static inline void zdotu_(doublecomplex *z, integer *n_, doublecomplex *x, integer *incx_, doublecomplex *y, integer *incy_) {
475         integer n = *n_, incx = *incx_, incy = *incy_, i;
476 #ifdef _MSC_VER
477         _Dcomplex zdotc = {0.0, 0.0};
478         if (incx == 1 && incy == 1) {
479                 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
480                         zdotc._Val[0] += Cd(&x[i])._Val[0] * Cd(&y[i])._Val[0];
481                         zdotc._Val[1] += Cd(&x[i])._Val[1] * Cd(&y[i])._Val[1];
482                 }
483         } else {
484                 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
485                         zdotc._Val[0] += Cd(&x[i*incx])._Val[0] * Cd(&y[i*incy])._Val[0];
486                         zdotc._Val[1] += Cd(&x[i*incx])._Val[1] * Cd(&y[i*incy])._Val[1];
487                 }
488         }
489         pCd(z) = zdotc;
490 }
491 #else
492         _Complex double zdotc = 0.0;
493         if (incx == 1 && incy == 1) {
494                 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
495                         zdotc += Cd(&x[i]) * Cd(&y[i]);
496                 }
497         } else {
498                 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
499                         zdotc += Cd(&x[i*incx]) * Cd(&y[i*incy]);
500                 }
501         }
502         pCd(z) = zdotc;
503 }
504 #endif
505 /*  -- translated by f2c (version 20000121).
506    You must link the resulting object file with the libraries:
507         -lf2c -lm   (in that order)
508 */
509
510
511
512
513 /* Table of constant values */
514
515 static integer c__1 = 1;
516 static real c_b174 = 0.f;
517 static real c_b175 = 1.f;
518 static integer c__0 = 0;
519
520 /* > \brief \b ILAENV */
521
522 /*  =========== DOCUMENTATION =========== */
523
524 /* Online html documentation available at */
525 /*            http://www.netlib.org/lapack/explore-html/ */
526
527 /* > \htmlonly */
528 /* > Download ILAENV + dependencies */
529 /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/ilaenv.
530 f"> */
531 /* > [TGZ]</a> */
532 /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/ilaenv.
533 f"> */
534 /* > [ZIP]</a> */
535 /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/ilaenv.
536 f"> */
537 /* > [TXT]</a> */
538 /* > \endhtmlonly */
539
540 /*  Definition: */
541 /*  =========== */
542
543 /*       INTEGER FUNCTION ILAENV( ISPEC, NAME, OPTS, N1, N2, N3, N4 ) */
544
545 /*       CHARACTER*( * )    NAME, OPTS */
546 /*       INTEGER            ISPEC, N1, N2, N3, N4 */
547
548
549 /* > \par Purpose: */
550 /*  ============= */
551 /* > */
552 /* > \verbatim */
553 /* > */
554 /* > ILAENV is called from the LAPACK routines to choose problem-dependent */
555 /* > parameters for the local environment.  See ISPEC for a description of */
556 /* > the parameters. */
557 /* > */
558 /* > ILAENV returns an INTEGER */
559 /* > if ILAENV >= 0: ILAENV returns the value of the parameter specified by ISPEC */
560 /* > if ILAENV < 0:  if ILAENV = -k, the k-th argument had an illegal value. */
561 /* > */
562 /* > This version provides a set of parameters which should give good, */
563 /* > but not optimal, performance on many of the currently available */
564 /* > computers.  Users are encouraged to modify this subroutine to set */
565 /* > the tuning parameters for their particular machine using the option */
566 /* > and problem size information in the arguments. */
567 /* > */
568 /* > This routine will not function correctly if it is converted to all */
569 /* > lower case.  Converting it to all upper case is allowed. */
570 /* > \endverbatim */
571
572 /*  Arguments: */
573 /*  ========== */
574
575 /* > \param[in] ISPEC */
576 /* > \verbatim */
577 /* >          ISPEC is INTEGER */
578 /* >          Specifies the parameter to be returned as the value of */
579 /* >          ILAENV. */
580 /* >          = 1: the optimal blocksize; if this value is 1, an unblocked */
581 /* >               algorithm will give the best performance. */
582 /* >          = 2: the minimum block size for which the block routine */
583 /* >               should be used; if the usable block size is less than */
584 /* >               this value, an unblocked routine should be used. */
585 /* >          = 3: the crossover point (in a block routine, for N less */
586 /* >               than this value, an unblocked routine should be used) */
587 /* >          = 4: the number of shifts, used in the nonsymmetric */
588 /* >               eigenvalue routines (DEPRECATED) */
589 /* >          = 5: the minimum column dimension for blocking to be used; */
590 /* >               rectangular blocks must have dimension at least k by m, */
591 /* >               where k is given by ILAENV(2,...) and m by ILAENV(5,...) */
592 /* >          = 6: the crossover point for the SVD (when reducing an m by n */
593 /* >               matrix to bidiagonal form, if f2cmax(m,n)/f2cmin(m,n) exceeds */
594 /* >               this value, a QR factorization is used first to reduce */
595 /* >               the matrix to a triangular form.) */
596 /* >          = 7: the number of processors */
597 /* >          = 8: the crossover point for the multishift QR method */
598 /* >               for nonsymmetric eigenvalue problems (DEPRECATED) */
599 /* >          = 9: maximum size of the subproblems at the bottom of the */
600 /* >               computation tree in the divide-and-conquer algorithm */
601 /* >               (used by xGELSD and xGESDD) */
602 /* >          =10: ieee NaN arithmetic can be trusted not to trap */
603 /* >          =11: infinity arithmetic can be trusted not to trap */
604 /* >          12 <= ISPEC <= 16: */
605 /* >               xHSEQR or related subroutines, */
606 /* >               see IPARMQ for detailed explanation */
607 /* > \endverbatim */
608 /* > */
609 /* > \param[in] NAME */
610 /* > \verbatim */
611 /* >          NAME is CHARACTER*(*) */
612 /* >          The name of the calling subroutine, in either upper case or */
613 /* >          lower case. */
614 /* > \endverbatim */
615 /* > */
616 /* > \param[in] OPTS */
617 /* > \verbatim */
618 /* >          OPTS is CHARACTER*(*) */
619 /* >          The character options to the subroutine NAME, concatenated */
620 /* >          into a single character string.  For example, UPLO = 'U', */
621 /* >          TRANS = 'T', and DIAG = 'N' for a triangular routine would */
622 /* >          be specified as OPTS = 'UTN'. */
623 /* > \endverbatim */
624 /* > */
625 /* > \param[in] N1 */
626 /* > \verbatim */
627 /* >          N1 is INTEGER */
628 /* > \endverbatim */
629 /* > */
630 /* > \param[in] N2 */
631 /* > \verbatim */
632 /* >          N2 is INTEGER */
633 /* > \endverbatim */
634 /* > */
635 /* > \param[in] N3 */
636 /* > \verbatim */
637 /* >          N3 is INTEGER */
638 /* > \endverbatim */
639 /* > */
640 /* > \param[in] N4 */
641 /* > \verbatim */
642 /* >          N4 is INTEGER */
643 /* >          Problem dimensions for the subroutine NAME; these may not all */
644 /* >          be required. */
645 /* > \endverbatim */
646
647 /*  Authors: */
648 /*  ======== */
649
650 /* > \author Univ. of Tennessee */
651 /* > \author Univ. of California Berkeley */
652 /* > \author Univ. of Colorado Denver */
653 /* > \author NAG Ltd. */
654
655 /* > \date November 2019 */
656
657 /* > \ingroup OTHERauxiliary */
658
659 /* > \par Further Details: */
660 /*  ===================== */
661 /* > */
662 /* > \verbatim */
663 /* > */
664 /* >  The following conventions have been used when calling ILAENV from the */
665 /* >  LAPACK routines: */
666 /* >  1)  OPTS is a concatenation of all of the character options to */
667 /* >      subroutine NAME, in the same order that they appear in the */
668 /* >      argument list for NAME, even if they are not used in determining */
669 /* >      the value of the parameter specified by ISPEC. */
670 /* >  2)  The problem dimensions N1, N2, N3, N4 are specified in the order */
671 /* >      that they appear in the argument list for NAME.  N1 is used */
672 /* >      first, N2 second, and so on, and unused problem dimensions are */
673 /* >      passed a value of -1. */
674 /* >  3)  The parameter value returned by ILAENV is checked for validity in */
675 /* >      the calling subroutine.  For example, ILAENV is used to retrieve */
676 /* >      the optimal blocksize for STRTRI as follows: */
677 /* > */
678 /* >      NB = ILAENV( 1, 'STRTRI', UPLO // DIAG, N, -1, -1, -1 ) */
679 /* >      IF( NB.LE.1 ) NB = MAX( 1, N ) */
680 /* > \endverbatim */
681 /* > */
682 /*  ===================================================================== */
683 integer ilaenv_(integer *ispec, char *name__, char *opts, integer *n1, 
684         integer *n2, integer *n3, integer *n4, ftnlen name_len, ftnlen 
685         opts_len)
686 {
687     /* System generated locals */
688     integer ret_val;
689
690     /* Local variables */
691     logical twostage;
692     integer i__;
693     logical cname;
694     integer nbmin;
695     logical sname;
696     char c1[1], c2[2], c3[3], c4[2];
697     integer ic, nb;
698     extern integer ieeeck_(integer *, real *, real *);
699     integer iz, nx;
700     char subnam[16];
701     extern integer iparmq_(integer *, char *, char *, integer *, integer *, 
702             integer *, integer *);
703
704
705 /*  -- LAPACK auxiliary routine (version 3.9.0) -- */
706 /*  -- LAPACK is a software package provided by Univ. of Tennessee,    -- */
707 /*  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- */
708 /*     November 2019 */
709
710
711 /*  ===================================================================== */
712
713
714     switch (*ispec) {
715         case 1:  goto L10;
716         case 2:  goto L10;
717         case 3:  goto L10;
718         case 4:  goto L80;
719         case 5:  goto L90;
720         case 6:  goto L100;
721         case 7:  goto L110;
722         case 8:  goto L120;
723         case 9:  goto L130;
724         case 10:  goto L140;
725         case 11:  goto L150;
726         case 12:  goto L160;
727         case 13:  goto L160;
728         case 14:  goto L160;
729         case 15:  goto L160;
730         case 16:  goto L160;
731     }
732
733 /*     Invalid value for ISPEC */
734
735     ret_val = -1;
736     return ret_val;
737
738 L10:
739
740 /*     Convert NAME to upper case if the first character is lower case. */
741
742     ret_val = 1;
743     s_copy(subnam, name__, (ftnlen)16, name_len);
744     ic = *(unsigned char *)subnam;
745     iz = 'Z';
746     if (iz == 90 || iz == 122) {
747
748 /*        ASCII character set */
749
750         if (ic >= 97 && ic <= 122) {
751             *(unsigned char *)subnam = (char) (ic - 32);
752             for (i__ = 2; i__ <= 6; ++i__) {
753                 ic = *(unsigned char *)&subnam[i__ - 1];
754                 if (ic >= 97 && ic <= 122) {
755                     *(unsigned char *)&subnam[i__ - 1] = (char) (ic - 32);
756                 }
757 /* L20: */
758             }
759         }
760
761     } else if (iz == 233 || iz == 169) {
762
763 /*        EBCDIC character set */
764
765         if (ic >= 129 && ic <= 137 || ic >= 145 && ic <= 153 || ic >= 162 && 
766                 ic <= 169) {
767             *(unsigned char *)subnam = (char) (ic + 64);
768             for (i__ = 2; i__ <= 6; ++i__) {
769                 ic = *(unsigned char *)&subnam[i__ - 1];
770                 if (ic >= 129 && ic <= 137 || ic >= 145 && ic <= 153 || ic >= 
771                         162 && ic <= 169) {
772                     *(unsigned char *)&subnam[i__ - 1] = (char) (ic + 64);
773                 }
774 /* L30: */
775             }
776         }
777
778     } else if (iz == 218 || iz == 250) {
779
780 /*        Prime machines:  ASCII+128 */
781
782         if (ic >= 225 && ic <= 250) {
783             *(unsigned char *)subnam = (char) (ic - 32);
784             for (i__ = 2; i__ <= 6; ++i__) {
785                 ic = *(unsigned char *)&subnam[i__ - 1];
786                 if (ic >= 225 && ic <= 250) {
787                     *(unsigned char *)&subnam[i__ - 1] = (char) (ic - 32);
788                 }
789 /* L40: */
790             }
791         }
792     }
793
794     *(unsigned char *)c1 = *(unsigned char *)subnam;
795     sname = *(unsigned char *)c1 == 'S' || *(unsigned char *)c1 == 'D';
796     cname = *(unsigned char *)c1 == 'C' || *(unsigned char *)c1 == 'Z';
797     if (! (cname || sname)) {
798         return ret_val;
799     }
800     s_copy(c2, subnam + 1, (ftnlen)2, (ftnlen)2);
801     s_copy(c3, subnam + 3, (ftnlen)3, (ftnlen)3);
802     s_copy(c4, c3 + 1, (ftnlen)2, (ftnlen)2);
803     twostage = i_len(subnam, (ftnlen)16) >= 11 && *(unsigned char *)&subnam[
804             10] == '2';
805
806     switch (*ispec) {
807         case 1:  goto L50;
808         case 2:  goto L60;
809         case 3:  goto L70;
810     }
811
812 L50:
813
814 /*     ISPEC = 1:  block size */
815
816 /*     In these examples, separate code is provided for setting NB for */
817 /*     real and complex.  We assume that NB will take the same value in */
818 /*     single or double precision. */
819
820     nb = 1;
821
822     if (s_cmp(subnam + 1, "LAORH", (ftnlen)5, (ftnlen)5) == 0) {
823
824 /*        This is for *LAORHR_GETRFNP routine */
825
826         if (sname) {
827             nb = 32;
828         } else {
829             nb = 32;
830         }
831     } else if (s_cmp(c2, "GE", (ftnlen)2, (ftnlen)2) == 0) {
832         if (s_cmp(c3, "TRF", (ftnlen)3, (ftnlen)3) == 0) {
833             if (sname) {
834                 nb = 64;
835             } else {
836                 nb = 64;
837             }
838         } else if (s_cmp(c3, "QRF", (ftnlen)3, (ftnlen)3) == 0 || s_cmp(c3, 
839                 "RQF", (ftnlen)3, (ftnlen)3) == 0 || s_cmp(c3, "LQF", (ftnlen)
840                 3, (ftnlen)3) == 0 || s_cmp(c3, "QLF", (ftnlen)3, (ftnlen)3) 
841                 == 0) {
842             if (sname) {
843                 nb = 32;
844             } else {
845                 nb = 32;
846             }
847         } else if (s_cmp(c3, "QR ", (ftnlen)3, (ftnlen)3) == 0) {
848             if (*n3 == 1) {
849                 if (sname) {
850 /*     M*N */
851                     if (*n1 * *n2 <= 131072 || *n1 <= 8192) {
852                         nb = *n1;
853                     } else {
854                         nb = 32768 / *n2;
855                     }
856                 } else {
857                     if (*n1 * *n2 <= 131072 || *n1 <= 8192) {
858                         nb = *n1;
859                     } else {
860                         nb = 32768 / *n2;
861                     }
862                 }
863             } else {
864                 if (sname) {
865                     nb = 1;
866                 } else {
867                     nb = 1;
868                 }
869             }
870         } else if (s_cmp(c3, "LQ ", (ftnlen)3, (ftnlen)3) == 0) {
871             if (*n3 == 2) {
872                 if (sname) {
873 /*     M*N */
874                     if (*n1 * *n2 <= 131072 || *n1 <= 8192) {
875                         nb = *n1;
876                     } else {
877                         nb = 32768 / *n2;
878                     }
879                 } else {
880                     if (*n1 * *n2 <= 131072 || *n1 <= 8192) {
881                         nb = *n1;
882                     } else {
883                         nb = 32768 / *n2;
884                     }
885                 }
886             } else {
887                 if (sname) {
888                     nb = 1;
889                 } else {
890                     nb = 1;
891                 }
892             }
893         } else if (s_cmp(c3, "HRD", (ftnlen)3, (ftnlen)3) == 0) {
894             if (sname) {
895                 nb = 32;
896             } else {
897                 nb = 32;
898             }
899         } else if (s_cmp(c3, "BRD", (ftnlen)3, (ftnlen)3) == 0) {
900             if (sname) {
901                 nb = 32;
902             } else {
903                 nb = 32;
904             }
905         } else if (s_cmp(c3, "TRI", (ftnlen)3, (ftnlen)3) == 0) {
906             if (sname) {
907                 nb = 64;
908             } else {
909                 nb = 64;
910             }
911         }
912     } else if (s_cmp(c2, "PO", (ftnlen)2, (ftnlen)2) == 0) {
913         if (s_cmp(c3, "TRF", (ftnlen)3, (ftnlen)3) == 0) {
914             if (sname) {
915                 nb = 64;
916             } else {
917                 nb = 64;
918             }
919         }
920     } else if (s_cmp(c2, "SY", (ftnlen)2, (ftnlen)2) == 0) {
921         if (s_cmp(c3, "TRF", (ftnlen)3, (ftnlen)3) == 0) {
922             if (sname) {
923                 if (twostage) {
924                     nb = 192;
925                 } else {
926                     nb = 64;
927                 }
928             } else {
929                 if (twostage) {
930                     nb = 192;
931                 } else {
932                     nb = 64;
933                 }
934             }
935         } else if (sname && s_cmp(c3, "TRD", (ftnlen)3, (ftnlen)3) == 0) {
936             nb = 32;
937         } else if (sname && s_cmp(c3, "GST", (ftnlen)3, (ftnlen)3) == 0) {
938             nb = 64;
939         }
940     } else if (cname && s_cmp(c2, "HE", (ftnlen)2, (ftnlen)2) == 0) {
941         if (s_cmp(c3, "TRF", (ftnlen)3, (ftnlen)3) == 0) {
942             if (twostage) {
943                 nb = 192;
944             } else {
945                 nb = 64;
946             }
947         } else if (s_cmp(c3, "TRD", (ftnlen)3, (ftnlen)3) == 0) {
948             nb = 32;
949         } else if (s_cmp(c3, "GST", (ftnlen)3, (ftnlen)3) == 0) {
950             nb = 64;
951         }
952     } else if (sname && s_cmp(c2, "OR", (ftnlen)2, (ftnlen)2) == 0) {
953         if (*(unsigned char *)c3 == 'G') {
954             if (s_cmp(c4, "QR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "RQ", 
955                     (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "LQ", (ftnlen)2, (
956                     ftnlen)2) == 0 || s_cmp(c4, "QL", (ftnlen)2, (ftnlen)2) ==
957                      0 || s_cmp(c4, "HR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(
958                     c4, "TR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "BR", (
959                     ftnlen)2, (ftnlen)2) == 0) {
960                 nb = 32;
961             }
962         } else if (*(unsigned char *)c3 == 'M') {
963             if (s_cmp(c4, "QR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "RQ", 
964                     (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "LQ", (ftnlen)2, (
965                     ftnlen)2) == 0 || s_cmp(c4, "QL", (ftnlen)2, (ftnlen)2) ==
966                      0 || s_cmp(c4, "HR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(
967                     c4, "TR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "BR", (
968                     ftnlen)2, (ftnlen)2) == 0) {
969                 nb = 32;
970             }
971         }
972     } else if (cname && s_cmp(c2, "UN", (ftnlen)2, (ftnlen)2) == 0) {
973         if (*(unsigned char *)c3 == 'G') {
974             if (s_cmp(c4, "QR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "RQ", 
975                     (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "LQ", (ftnlen)2, (
976                     ftnlen)2) == 0 || s_cmp(c4, "QL", (ftnlen)2, (ftnlen)2) ==
977                      0 || s_cmp(c4, "HR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(
978                     c4, "TR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "BR", (
979                     ftnlen)2, (ftnlen)2) == 0) {
980                 nb = 32;
981             }
982         } else if (*(unsigned char *)c3 == 'M') {
983             if (s_cmp(c4, "QR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "RQ", 
984                     (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "LQ", (ftnlen)2, (
985                     ftnlen)2) == 0 || s_cmp(c4, "QL", (ftnlen)2, (ftnlen)2) ==
986                      0 || s_cmp(c4, "HR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(
987                     c4, "TR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "BR", (
988                     ftnlen)2, (ftnlen)2) == 0) {
989                 nb = 32;
990             }
991         }
992     } else if (s_cmp(c2, "GB", (ftnlen)2, (ftnlen)2) == 0) {
993         if (s_cmp(c3, "TRF", (ftnlen)3, (ftnlen)3) == 0) {
994             if (sname) {
995                 if (*n4 <= 64) {
996                     nb = 1;
997                 } else {
998                     nb = 32;
999                 }
1000             } else {
1001                 if (*n4 <= 64) {
1002                     nb = 1;
1003                 } else {
1004                     nb = 32;
1005                 }
1006             }
1007         }
1008     } else if (s_cmp(c2, "PB", (ftnlen)2, (ftnlen)2) == 0) {
1009         if (s_cmp(c3, "TRF", (ftnlen)3, (ftnlen)3) == 0) {
1010             if (sname) {
1011                 if (*n2 <= 64) {
1012                     nb = 1;
1013                 } else {
1014                     nb = 32;
1015                 }
1016             } else {
1017                 if (*n2 <= 64) {
1018                     nb = 1;
1019                 } else {
1020                     nb = 32;
1021                 }
1022             }
1023         }
1024     } else if (s_cmp(c2, "TR", (ftnlen)2, (ftnlen)2) == 0) {
1025         if (s_cmp(c3, "TRI", (ftnlen)3, (ftnlen)3) == 0) {
1026             if (sname) {
1027                 nb = 64;
1028             } else {
1029                 nb = 64;
1030             }
1031         } else if (s_cmp(c3, "EVC", (ftnlen)3, (ftnlen)3) == 0) {
1032             if (sname) {
1033                 nb = 64;
1034             } else {
1035                 nb = 64;
1036             }
1037         }
1038     } else if (s_cmp(c2, "LA", (ftnlen)2, (ftnlen)2) == 0) {
1039         if (s_cmp(c3, "UUM", (ftnlen)3, (ftnlen)3) == 0) {
1040             if (sname) {
1041                 nb = 64;
1042             } else {
1043                 nb = 64;
1044             }
1045         }
1046     } else if (sname && s_cmp(c2, "ST", (ftnlen)2, (ftnlen)2) == 0) {
1047         if (s_cmp(c3, "EBZ", (ftnlen)3, (ftnlen)3) == 0) {
1048             nb = 1;
1049         }
1050     } else if (s_cmp(c2, "GG", (ftnlen)2, (ftnlen)2) == 0) {
1051         nb = 32;
1052         if (s_cmp(c3, "HD3", (ftnlen)3, (ftnlen)3) == 0) {
1053             if (sname) {
1054                 nb = 32;
1055             } else {
1056                 nb = 32;
1057             }
1058         }
1059     }
1060     ret_val = nb;
1061     return ret_val;
1062
1063 L60:
1064
1065 /*     ISPEC = 2:  minimum block size */
1066
1067     nbmin = 2;
1068     if (s_cmp(c2, "GE", (ftnlen)2, (ftnlen)2) == 0) {
1069         if (s_cmp(c3, "QRF", (ftnlen)3, (ftnlen)3) == 0 || s_cmp(c3, "RQF", (
1070                 ftnlen)3, (ftnlen)3) == 0 || s_cmp(c3, "LQF", (ftnlen)3, (
1071                 ftnlen)3) == 0 || s_cmp(c3, "QLF", (ftnlen)3, (ftnlen)3) == 0)
1072                  {
1073             if (sname) {
1074                 nbmin = 2;
1075             } else {
1076                 nbmin = 2;
1077             }
1078         } else if (s_cmp(c3, "HRD", (ftnlen)3, (ftnlen)3) == 0) {
1079             if (sname) {
1080                 nbmin = 2;
1081             } else {
1082                 nbmin = 2;
1083             }
1084         } else if (s_cmp(c3, "BRD", (ftnlen)3, (ftnlen)3) == 0) {
1085             if (sname) {
1086                 nbmin = 2;
1087             } else {
1088                 nbmin = 2;
1089             }
1090         } else if (s_cmp(c3, "TRI", (ftnlen)3, (ftnlen)3) == 0) {
1091             if (sname) {
1092                 nbmin = 2;
1093             } else {
1094                 nbmin = 2;
1095             }
1096         }
1097     } else if (s_cmp(c2, "SY", (ftnlen)2, (ftnlen)2) == 0) {
1098         if (s_cmp(c3, "TRF", (ftnlen)3, (ftnlen)3) == 0) {
1099             if (sname) {
1100                 nbmin = 8;
1101             } else {
1102                 nbmin = 8;
1103             }
1104         } else if (sname && s_cmp(c3, "TRD", (ftnlen)3, (ftnlen)3) == 0) {
1105             nbmin = 2;
1106         }
1107     } else if (cname && s_cmp(c2, "HE", (ftnlen)2, (ftnlen)2) == 0) {
1108         if (s_cmp(c3, "TRD", (ftnlen)3, (ftnlen)3) == 0) {
1109             nbmin = 2;
1110         }
1111     } else if (sname && s_cmp(c2, "OR", (ftnlen)2, (ftnlen)2) == 0) {
1112         if (*(unsigned char *)c3 == 'G') {
1113             if (s_cmp(c4, "QR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "RQ", 
1114                     (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "LQ", (ftnlen)2, (
1115                     ftnlen)2) == 0 || s_cmp(c4, "QL", (ftnlen)2, (ftnlen)2) ==
1116                      0 || s_cmp(c4, "HR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(
1117                     c4, "TR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "BR", (
1118                     ftnlen)2, (ftnlen)2) == 0) {
1119                 nbmin = 2;
1120             }
1121         } else if (*(unsigned char *)c3 == 'M') {
1122             if (s_cmp(c4, "QR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "RQ", 
1123                     (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "LQ", (ftnlen)2, (
1124                     ftnlen)2) == 0 || s_cmp(c4, "QL", (ftnlen)2, (ftnlen)2) ==
1125                      0 || s_cmp(c4, "HR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(
1126                     c4, "TR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "BR", (
1127                     ftnlen)2, (ftnlen)2) == 0) {
1128                 nbmin = 2;
1129             }
1130         }
1131     } else if (cname && s_cmp(c2, "UN", (ftnlen)2, (ftnlen)2) == 0) {
1132         if (*(unsigned char *)c3 == 'G') {
1133             if (s_cmp(c4, "QR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "RQ", 
1134                     (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "LQ", (ftnlen)2, (
1135                     ftnlen)2) == 0 || s_cmp(c4, "QL", (ftnlen)2, (ftnlen)2) ==
1136                      0 || s_cmp(c4, "HR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(
1137                     c4, "TR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "BR", (
1138                     ftnlen)2, (ftnlen)2) == 0) {
1139                 nbmin = 2;
1140             }
1141         } else if (*(unsigned char *)c3 == 'M') {
1142             if (s_cmp(c4, "QR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "RQ", 
1143                     (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "LQ", (ftnlen)2, (
1144                     ftnlen)2) == 0 || s_cmp(c4, "QL", (ftnlen)2, (ftnlen)2) ==
1145                      0 || s_cmp(c4, "HR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(
1146                     c4, "TR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "BR", (
1147                     ftnlen)2, (ftnlen)2) == 0) {
1148                 nbmin = 2;
1149             }
1150         }
1151     } else if (s_cmp(c2, "GG", (ftnlen)2, (ftnlen)2) == 0) {
1152         nbmin = 2;
1153         if (s_cmp(c3, "HD3", (ftnlen)3, (ftnlen)3) == 0) {
1154             nbmin = 2;
1155         }
1156     }
1157     ret_val = nbmin;
1158     return ret_val;
1159
1160 L70:
1161
1162 /*     ISPEC = 3:  crossover point */
1163
1164     nx = 0;
1165     if (s_cmp(c2, "GE", (ftnlen)2, (ftnlen)2) == 0) {
1166         if (s_cmp(c3, "QRF", (ftnlen)3, (ftnlen)3) == 0 || s_cmp(c3, "RQF", (
1167                 ftnlen)3, (ftnlen)3) == 0 || s_cmp(c3, "LQF", (ftnlen)3, (
1168                 ftnlen)3) == 0 || s_cmp(c3, "QLF", (ftnlen)3, (ftnlen)3) == 0)
1169                  {
1170             if (sname) {
1171                 nx = 128;
1172             } else {
1173                 nx = 128;
1174             }
1175         } else if (s_cmp(c3, "HRD", (ftnlen)3, (ftnlen)3) == 0) {
1176             if (sname) {
1177                 nx = 128;
1178             } else {
1179                 nx = 128;
1180             }
1181         } else if (s_cmp(c3, "BRD", (ftnlen)3, (ftnlen)3) == 0) {
1182             if (sname) {
1183                 nx = 128;
1184             } else {
1185                 nx = 128;
1186             }
1187         }
1188     } else if (s_cmp(c2, "SY", (ftnlen)2, (ftnlen)2) == 0) {
1189         if (sname && s_cmp(c3, "TRD", (ftnlen)3, (ftnlen)3) == 0) {
1190             nx = 32;
1191         }
1192     } else if (cname && s_cmp(c2, "HE", (ftnlen)2, (ftnlen)2) == 0) {
1193         if (s_cmp(c3, "TRD", (ftnlen)3, (ftnlen)3) == 0) {
1194             nx = 32;
1195         }
1196     } else if (sname && s_cmp(c2, "OR", (ftnlen)2, (ftnlen)2) == 0) {
1197         if (*(unsigned char *)c3 == 'G') {
1198             if (s_cmp(c4, "QR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "RQ", 
1199                     (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "LQ", (ftnlen)2, (
1200                     ftnlen)2) == 0 || s_cmp(c4, "QL", (ftnlen)2, (ftnlen)2) ==
1201                      0 || s_cmp(c4, "HR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(
1202                     c4, "TR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "BR", (
1203                     ftnlen)2, (ftnlen)2) == 0) {
1204                 nx = 128;
1205             }
1206         }
1207     } else if (cname && s_cmp(c2, "UN", (ftnlen)2, (ftnlen)2) == 0) {
1208         if (*(unsigned char *)c3 == 'G') {
1209             if (s_cmp(c4, "QR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "RQ", 
1210                     (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "LQ", (ftnlen)2, (
1211                     ftnlen)2) == 0 || s_cmp(c4, "QL", (ftnlen)2, (ftnlen)2) ==
1212                      0 || s_cmp(c4, "HR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(
1213                     c4, "TR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "BR", (
1214                     ftnlen)2, (ftnlen)2) == 0) {
1215                 nx = 128;
1216             }
1217         }
1218     } else if (s_cmp(c2, "GG", (ftnlen)2, (ftnlen)2) == 0) {
1219         nx = 128;
1220         if (s_cmp(c3, "HD3", (ftnlen)3, (ftnlen)3) == 0) {
1221             nx = 128;
1222         }
1223     }
1224     ret_val = nx;
1225     return ret_val;
1226
1227 L80:
1228
1229 /*     ISPEC = 4:  number of shifts (used by xHSEQR) */
1230
1231     ret_val = 6;
1232     return ret_val;
1233
1234 L90:
1235
1236 /*     ISPEC = 5:  minimum column dimension (not used) */
1237
1238     ret_val = 2;
1239     return ret_val;
1240
1241 L100:
1242
1243 /*     ISPEC = 6:  crossover point for SVD (used by xGELSS and xGESVD) */
1244
1245     ret_val = (integer) ((real) f2cmin(*n1,*n2) * 1.6f);
1246     return ret_val;
1247
1248 L110:
1249
1250 /*     ISPEC = 7:  number of processors (not used) */
1251
1252     ret_val = 1;
1253     return ret_val;
1254
1255 L120:
1256
1257 /*     ISPEC = 8:  crossover point for multishift (used by xHSEQR) */
1258
1259     ret_val = 50;
1260     return ret_val;
1261
1262 L130:
1263
1264 /*     ISPEC = 9:  maximum size of the subproblems at the bottom of the */
1265 /*                 computation tree in the divide-and-conquer algorithm */
1266 /*                 (used by xGELSD and xGESDD) */
1267
1268     ret_val = 25;
1269     return ret_val;
1270
1271 L140:
1272
1273 /*     ISPEC = 10: ieee NaN arithmetic can be trusted not to trap */
1274
1275 /*     ILAENV = 0 */
1276     ret_val = 1;
1277     if (ret_val == 1) {
1278         ret_val = ieeeck_(&c__1, &c_b174, &c_b175);
1279     }
1280     return ret_val;
1281
1282 L150:
1283
1284 /*     ISPEC = 11: infinity arithmetic can be trusted not to trap */
1285
1286 /*     ILAENV = 0 */
1287     ret_val = 1;
1288     if (ret_val == 1) {
1289         ret_val = ieeeck_(&c__0, &c_b174, &c_b175);
1290     }
1291     return ret_val;
1292
1293 L160:
1294
1295 /*     12 <= ISPEC <= 16: xHSEQR or related subroutines. */
1296
1297     ret_val = iparmq_(ispec, name__, opts, n1, n2, n3, n4)
1298             ;
1299     return ret_val;
1300
1301 /*     End of ILAENV */
1302
1303 } /* ilaenv_ */
1304