ilaenv.c
Go to the documentation of this file.
00001 /* ilaenv.f -- translated by f2c (version 20061008).
00002    You must link the resulting object file with libf2c:
00003         on Microsoft Windows system, link with libf2c.lib;
00004         on Linux or Unix systems, link with .../path/to/libf2c.a -lm
00005         or, if you install libf2c.a in a standard place, with -lf2c -lm
00006         -- in that order, at the end of the command line, as in
00007                 cc *.o -lf2c -lm
00008         Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
00009 
00010                 http://www.netlib.org/f2c/libf2c.zip
00011 */
00012 
00013 #include "f2c.h"
00014 #include "blaswrap.h"
00015 
00016 /* Common Block Declarations */
00017 
00018 struct {
00019     integer iparms[100];
00020 } claenv_;
00021 
00022 #define claenv_1 claenv_
00023 
00024 /* Table of constant values */
00025 
00026 static integer c__1 = 1;
00027 static real c_b3 = 0.f;
00028 static real c_b4 = 1.f;
00029 static integer c__0 = 0;
00030 
00031 integer ilaenv_(integer *ispec, char *name__, char *opts, integer *n1, 
00032         integer *n2, integer *n3, integer *n4)
00033 {
00034     /* System generated locals */
00035     integer ret_val;
00036 
00037     /* Local variables */
00038     extern integer ieeeck_(integer *, real *, real *);
00039 
00040 
00041 /*  -- LAPACK auxiliary routine (version 3.1) -- */
00042 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00043 /*     November 2006 */
00044 
00045 /*     .. Scalar Arguments .. */
00046 /*     .. */
00047 
00048 /*  Purpose */
00049 /*  ======= */
00050 
00051 /*  ILAENV returns problem-dependent parameters for the local */
00052 /*  environment.  See ISPEC for a description of the parameters. */
00053 
00054 /*  In this version, the problem-dependent parameters are contained in */
00055 /*  the integer array IPARMS in the common block CLAENV and the value */
00056 /*  with index ISPEC is copied to ILAENV.  This version of ILAENV is */
00057 /*  to be used in conjunction with XLAENV in TESTING and TIMING. */
00058 
00059 /*  Arguments */
00060 /*  ========= */
00061 
00062 /*  ISPEC   (input) INTEGER */
00063 /*          Specifies the parameter to be returned as the value of */
00064 /*          ILAENV. */
00065 /*          = 1: the optimal blocksize; if this value is 1, an unblocked */
00066 /*               algorithm will give the best performance. */
00067 /*          = 2: the minimum block size for which the block routine */
00068 /*               should be used; if the usable block size is less than */
00069 /*               this value, an unblocked routine should be used. */
00070 /*          = 3: the crossover point (in a block routine, for N less */
00071 /*               than this value, an unblocked routine should be used) */
00072 /*          = 4: the number of shifts, used in the nonsymmetric */
00073 /*               eigenvalue routines */
00074 /*          = 5: the minimum column dimension for blocking to be used; */
00075 /*               rectangular blocks must have dimension at least k by m, */
00076 /*               where k is given by ILAENV(2,...) and m by ILAENV(5,...) */
00077 /*          = 6: the crossover point for the SVD (when reducing an m by n */
00078 /*               matrix to bidiagonal form, if max(m,n)/min(m,n) exceeds */
00079 /*               this value, a QR factorization is used first to reduce */
00080 /*               the matrix to a triangular form.) */
00081 /*          = 7: the number of processors */
00082 /*          = 8: the crossover point for the multishift QR and QZ methods */
00083 /*               for nonsymmetric eigenvalue problems. */
00084 /*          = 9: maximum size of the subproblems at the bottom of the */
00085 /*               computation tree in the divide-and-conquer algorithm */
00086 /*          =10: ieee NaN arithmetic can be trusted not to trap */
00087 /*          =11: infinity arithmetic can be trusted not to trap */
00088 /*          12 <= ISPEC <= 16: */
00089 /*               xHSEQR or one of its subroutines, */
00090 /*               see IPARMQ for detailed explanation */
00091 
00092 /*          Other specifications (up to 100) can be added later. */
00093 
00094 /*  NAME    (input) CHARACTER*(*) */
00095 /*          The name of the calling subroutine. */
00096 
00097 /*  OPTS    (input) CHARACTER*(*) */
00098 /*          The character options to the subroutine NAME, concatenated */
00099 /*          into a single character string.  For example, UPLO = 'U', */
00100 /*          TRANS = 'T', and DIAG = 'N' for a triangular routine would */
00101 /*          be specified as OPTS = 'UTN'. */
00102 
00103 /*  N1      (input) INTEGER */
00104 /*  N2      (input) INTEGER */
00105 /*  N3      (input) INTEGER */
00106 /*  N4      (input) INTEGER */
00107 /*          Problem dimensions for the subroutine NAME; these may not all */
00108 /*          be required. */
00109 
00110 /* (ILAENV) (output) INTEGER */
00111 /*          >= 0: the value of the parameter specified by ISPEC */
00112 /*          < 0:  if ILAENV = -k, the k-th argument had an illegal value. */
00113 
00114 /*  Further Details */
00115 /*  =============== */
00116 
00117 /*  The following conventions have been used when calling ILAENV from the */
00118 /*  LAPACK routines: */
00119 /*  1)  OPTS is a concatenation of all of the character options to */
00120 /*      subroutine NAME, in the same order that they appear in the */
00121 /*      argument list for NAME, even if they are not used in determining */
00122 /*      the value of the parameter specified by ISPEC. */
00123 /*  2)  The problem dimensions N1, N2, N3, N4 are specified in the order */
00124 /*      that they appear in the argument list for NAME.  N1 is used */
00125 /*      first, N2 second, and so on, and unused problem dimensions are */
00126 /*      passed a value of -1. */
00127 /*  3)  The parameter value returned by ILAENV is checked for validity in */
00128 /*      the calling subroutine.  For example, ILAENV is used to retrieve */
00129 /*      the optimal blocksize for STRTRI as follows: */
00130 
00131 /*      NB = ILAENV( 1, 'STRTRI', UPLO // DIAG, N, -1, -1, -1 ) */
00132 /*      IF( NB.LE.1 ) NB = MAX( 1, N ) */
00133 
00134 /*  ===================================================================== */
00135 
00136 /*     .. Intrinsic Functions .. */
00137 /*     .. */
00138 /*     .. External Functions .. */
00139 /*     .. */
00140 /*     .. Arrays in Common .. */
00141 /*     .. */
00142 /*     .. Common blocks .. */
00143 /*     .. */
00144 /*     .. Save statement .. */
00145 /*     .. */
00146 /*     .. Executable Statements .. */
00147 
00148     if (*ispec >= 1 && *ispec <= 5) {
00149 
00150 /*        Return a value from the common block. */
00151 
00152         ret_val = claenv_1.iparms[*ispec - 1];
00153 
00154     } else if (*ispec == 6) {
00155 
00156 /*        Compute SVD crossover point. */
00157 
00158         ret_val = (integer) ((real) min(*n1,*n2) * 1.6f);
00159 
00160     } else if (*ispec >= 7 && *ispec <= 9) {
00161 
00162 /*        Return a value from the common block. */
00163 
00164         ret_val = claenv_1.iparms[*ispec - 1];
00165 
00166     } else if (*ispec == 10) {
00167 
00168 /*        IEEE NaN arithmetic can be trusted not to trap */
00169 
00170 /*        ILAENV = 0 */
00171         ret_val = 1;
00172         if (ret_val == 1) {
00173             ret_val = ieeeck_(&c__1, &c_b3, &c_b4);
00174         }
00175 
00176     } else if (*ispec == 11) {
00177 
00178 /*        Infinity arithmetic can be trusted not to trap */
00179 
00180 /*        ILAENV = 0 */
00181         ret_val = 1;
00182         if (ret_val == 1) {
00183             ret_val = ieeeck_(&c__0, &c_b3, &c_b4);
00184         }
00185 
00186     } else if (*ispec >= 12 && *ispec <= 16) {
00187 
00188 /*     12 <= ISPEC <= 16: xHSEQR or one of its subroutines. */
00189 
00190         ret_val = claenv_1.iparms[*ispec - 1];
00191 /*         WRITE(*,*) 'ISPEC = ',ISPEC,' ILAENV =',ILAENV */
00192 /*         ILAENV = IPARMQ( ISPEC, NAME, OPTS, N1, N2, N3, N4 ) */
00193 
00194     } else {
00195 
00196 /*        Invalid value for ISPEC */
00197 
00198         ret_val = -1;
00199     }
00200 
00201     return ret_val;
00202 
00203 /*     End of ILAENV */
00204 
00205 } /* ilaenv_ */
00206 
00207 integer iparmq_(integer *ispec, char *name__, char *opts, integer *n, integer 
00208         *ilo, integer *ihi, integer *lwork)
00209 {
00210     /* System generated locals */
00211     integer ret_val, i__1, i__2;
00212     real r__1;
00213 
00214     /* Builtin functions */
00215     double log(doublereal);
00216     integer i_nint(real *);
00217 
00218     /* Local variables */
00219     integer nh, ns;
00220 
00221 
00222 /*     .. */
00223 /*     .. Scalar Arguments .. */
00224 /*     .. */
00225 /*     .. Local Scalars .. */
00226 /*     .. */
00227 /*     .. Intrinsic Functions .. */
00228 /*     .. */
00229 /*     .. Executable Statements .. */
00230     if (*ispec == 15 || *ispec == 13 || *ispec == 16) {
00231 
00232 /*        ==== Set the number simultaneous shifts ==== */
00233 
00234         nh = *ihi - *ilo + 1;
00235         ns = 2;
00236         if (nh >= 30) {
00237             ns = 4;
00238         }
00239         if (nh >= 60) {
00240             ns = 10;
00241         }
00242         if (nh >= 150) {
00243 /* Computing MAX */
00244             r__1 = log((real) nh) / log(2.f);
00245             i__1 = 10, i__2 = nh / i_nint(&r__1);
00246             ns = max(i__1,i__2);
00247         }
00248         if (nh >= 590) {
00249             ns = 64;
00250         }
00251         if (nh >= 3000) {
00252             ns = 128;
00253         }
00254         if (nh >= 6000) {
00255             ns = 256;
00256         }
00257 /* Computing MAX */
00258         i__1 = 2, i__2 = ns - ns % 2;
00259         ns = max(i__1,i__2);
00260     }
00261 
00262     if (*ispec == 12) {
00263 
00264 
00265 /*        ===== Matrices of order smaller than NMIN get sent */
00266 /*        .     to LAHQR, the classic double shift algorithm. */
00267 /*        .     This must be at least 11. ==== */
00268 
00269         ret_val = 11;
00270 
00271     } else if (*ispec == 14) {
00272 
00273 /*        ==== INIBL: skip a multi-shift qr iteration and */
00274 /*        .    whenever aggressive early deflation finds */
00275 /*        .    at least (NIBBLE*(window size)/100) deflations. ==== */
00276 
00277         ret_val = 14;
00278 
00279     } else if (*ispec == 15) {
00280 
00281 /*        ==== NSHFTS: The number of simultaneous shifts ===== */
00282 
00283         ret_val = ns;
00284 
00285     } else if (*ispec == 13) {
00286 
00287 /*        ==== NW: deflation window size.  ==== */
00288 
00289         if (nh <= 500) {
00290             ret_val = ns;
00291         } else {
00292             ret_val = ns * 3 / 2;
00293         }
00294 
00295     } else if (*ispec == 16) {
00296 
00297 /*        ==== IACC22: Whether to accumulate reflections */
00298 /*        .     before updating the far-from-diagonal elements */
00299 /*        .     and whether to use 2-by-2 block structure while */
00300 /*        .     doing it.  A small amount of work could be saved */
00301 /*        .     by making this choice dependent also upon the */
00302 /*        .     NH=IHI-ILO+1. */
00303 
00304         ret_val = 0;
00305         if (ns >= 14) {
00306             ret_val = 1;
00307         }
00308         if (ns >= 14) {
00309             ret_val = 2;
00310         }
00311 
00312     } else {
00313 /*        ===== invalid value of ispec ===== */
00314         ret_val = -1;
00315 
00316     }
00317 
00318 /*     ==== End of IPARMQ ==== */
00319 
00320     return ret_val;
00321 } /* iparmq_ */


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:55:50