lapack_agmg_win.f90
上传用户:qi_qi_qi_
上传日期:2021-11-15
资源大小:35k
文件大小:142k
源码类别:

网格计算

开发平台:

Windows_Unix

  1. !        RMIN as BASE**( EMIN - 1 ),  but some machines underflow during
  2. !        this computation.                                              
  3. !                                                                       
  4.          LRMIN = 1 
  5.          DO 30 I = 1, 1 - LEMIN 
  6.             LRMIN = DLAMC3( LRMIN*RBASE, ZERO ) 
  7.    30    CONTINUE 
  8. !                                                                       
  9. !        Finally, call DLAMC5 to compute EMAX and RMAX.                 
  10. !                                                                       
  11.          CALL DLAMC5( LBETA, LT, LEMIN, IEEE, LEMAX, LRMAX ) 
  12.       END IF 
  13. !                                                                       
  14.       BETA = LBETA 
  15.       T = LT 
  16.       RND = LRND 
  17.       EPS = LEPS 
  18.       EMIN = LEMIN 
  19.       RMIN = LRMIN 
  20.       EMAX = LEMAX 
  21.       RMAX = LRMAX 
  22. !                                                                       
  23.       RETURN 
  24. !                                                                       
  25.  9999 FORMAT( / / ' WARNING. The value EMIN may be incorrect:-',        &
  26.      &      '  EMIN = ', I8, /                                          &
  27.      &      ' If, after inspection, the value EMIN looks',              &
  28.      &      ' acceptable please comment out ',                          &
  29.      &      / ' the IF block as marked within the code of routine',     &
  30.      &      ' DLAMC2,', / ' otherwise supply EMIN explicitly.', / )     
  31. !                                                                       
  32. !     End of DLAMC2                                                     
  33. !                                                                       
  34.       END                                           
  35. !                                                                       
  36. !***********************************************************************
  37. !                                                                       
  38.       DOUBLE PRECISION FUNCTION DLAMC3( A, B ) 
  39. !                                                                       
  40. !  -- LAPACK auxiliary routine (version 3.1) --                         
  41. !     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..    
  42. !     November 2006                                                     
  43. !                                                                       
  44. !     .. Scalar Arguments ..                                            
  45.       DOUBLE PRECISION   A, B 
  46. !     ..                                                                
  47. !                                                                       
  48. !  Purpose                                                              
  49. !  =======                                                              
  50. !                                                                       
  51. !  DLAMC3  is intended to force  A  and  B  to be stored prior to doing 
  52. !  the addition of  A  and  B ,  for use in situations where optimizers 
  53. !  might hold one of these in a register.                               
  54. !                                                                       
  55. !  Arguments                                                            
  56. !  =========                                                            
  57. !                                                                       
  58. !  A       (input) DOUBLE PRECISION                                     
  59. !  B       (input) DOUBLE PRECISION                                     
  60. !          The values A and B.                                          
  61. !                                                                       
  62. ! ===================================================================== 
  63. !                                                                       
  64. !     .. Executable Statements ..                                       
  65. !                                                                       
  66.       DLAMC3 = A + B 
  67. !                                                                       
  68.       RETURN 
  69. !                                                                       
  70. !     End of DLAMC3                                                     
  71. !                                                                       
  72.       END                                           
  73. !                                                                       
  74. !***********************************************************************
  75. !                                                                       
  76.       SUBROUTINE DLAMC4( EMIN, START, BASE ) 
  77. !                                                                       
  78. !  -- LAPACK auxiliary routine (version 3.1) --                         
  79. !     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..    
  80. !     November 2006                                                     
  81. !                                                                       
  82. !     .. Scalar Arguments ..                                            
  83.       INTEGER            BASE, EMIN 
  84.       DOUBLE PRECISION   START 
  85. !     ..                                                                
  86. !                                                                       
  87. !  Purpose                                                              
  88. !  =======                                                              
  89. !                                                                       
  90. !  DLAMC4 is a service routine for DLAMC2.                              
  91. !                                                                       
  92. !  Arguments                                                            
  93. !  =========                                                            
  94. !                                                                       
  95. !  EMIN    (output) INTEGER                                             
  96. !          The minimum exponent before (gradual) underflow, computed by 
  97. !          setting A = START and dividing by BASE until the previous A  
  98. !          can not be recovered.                                        
  99. !                                                                       
  100. !  START   (input) DOUBLE PRECISION                                     
  101. !          The starting point for determining EMIN.                     
  102. !                                                                       
  103. !  BASE    (input) INTEGER                                              
  104. !          The base of the machine.                                     
  105. !                                                                       
  106. ! ===================================================================== 
  107. !                                                                       
  108. !     .. Local Scalars ..                                               
  109.       INTEGER            I 
  110.       DOUBLE PRECISION   A, B1, B2, C1, C2, D1, D2, ONE, RBASE, ZERO 
  111. !     ..                                                                
  112. !     .. External Functions ..                                          
  113.       DOUBLE PRECISION   DLAMC3 
  114.       EXTERNAL           DLAMC3 
  115. !     ..                                                                
  116. !     .. Executable Statements ..                                       
  117. !                                                                       
  118.       A = START 
  119.       ONE = 1 
  120.       RBASE = ONE / BASE 
  121.       ZERO = 0 
  122.       EMIN = 1 
  123.       B1 = DLAMC3( A*RBASE, ZERO ) 
  124.       C1 = A 
  125.       C2 = A 
  126.       D1 = A 
  127.       D2 = A 
  128. !+    WHILE( ( C1.EQ.A ).AND.( C2.EQ.A ).AND.                           
  129. !    $       ( D1.EQ.A ).AND.( D2.EQ.A )      )LOOP                     
  130.    10 CONTINUE 
  131.       IF( ( C1.EQ.A ) .AND. ( C2.EQ.A ) .AND. ( D1.EQ.A ) .AND.         &
  132.      &    ( D2.EQ.A ) ) THEN                                            
  133.          EMIN = EMIN - 1 
  134.          A = B1 
  135.          B1 = DLAMC3( A / BASE, ZERO ) 
  136.          C1 = DLAMC3( B1*BASE, ZERO ) 
  137.          D1 = ZERO 
  138.          DO 20 I = 1, BASE 
  139.             D1 = D1 + B1 
  140.    20    CONTINUE 
  141.          B2 = DLAMC3( A*RBASE, ZERO ) 
  142.          C2 = DLAMC3( B2 / RBASE, ZERO ) 
  143.          D2 = ZERO 
  144.          DO 30 I = 1, BASE 
  145.             D2 = D2 + B2 
  146.    30    CONTINUE 
  147.          GO TO 10 
  148.       END IF 
  149. !+    END WHILE                                                         
  150. !                                                                       
  151.       RETURN 
  152. !                                                                       
  153. !     End of DLAMC4                                                     
  154. !                                                                       
  155.       END                                           
  156. !                                                                       
  157. !***********************************************************************
  158. !                                                                       
  159.       SUBROUTINE DLAMC5( BETA, P, EMIN, IEEE, EMAX, RMAX ) 
  160. !                                                                       
  161. !  -- LAPACK auxiliary routine (version 3.1) --                         
  162. !     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..    
  163. !     November 2006                                                     
  164. !                                                                       
  165. !     .. Scalar Arguments ..                                            
  166.       LOGICAL            IEEE 
  167.       INTEGER            BETA, EMAX, EMIN, P 
  168.       DOUBLE PRECISION   RMAX 
  169. !     ..                                                                
  170. !                                                                       
  171. !  Purpose                                                              
  172. !  =======                                                              
  173. !                                                                       
  174. !  DLAMC5 attempts to compute RMAX, the largest machine floating-point  
  175. !  number, without overflow.  It assumes that EMAX + abs(EMIN) sum      
  176. !  approximately to a power of 2.  It will fail on machines where this  
  177. !  assumption does not hold, for example, the Cyber 205 (EMIN = -28625, 
  178. !  EMAX = 28718).  It will also fail if the value supplied for EMIN is  
  179. !  too large (i.e. too close to zero), probably with overflow.          
  180. !                                                                       
  181. !  Arguments                                                            
  182. !  =========                                                            
  183. !                                                                       
  184. !  BETA    (input) INTEGER                                              
  185. !          The base of floating-point arithmetic.                       
  186. !                                                                       
  187. !  P       (input) INTEGER                                              
  188. !          The number of base BETA digits in the mantissa of a          
  189. !          floating-point value.                                        
  190. !                                                                       
  191. !  EMIN    (input) INTEGER                                              
  192. !          The minimum exponent before (gradual) underflow.             
  193. !                                                                       
  194. !  IEEE    (input) LOGICAL                                              
  195. !          A logical flag specifying whether or not the arithmetic      
  196. !          system is thought to comply with the IEEE standard.          
  197. !                                                                       
  198. !  EMAX    (output) INTEGER                                             
  199. !          The largest exponent before overflow                         
  200. !                                                                       
  201. !  RMAX    (output) DOUBLE PRECISION                                    
  202. !          The largest machine floating-point number.                   
  203. !                                                                       
  204. ! ===================================================================== 
  205. !                                                                       
  206. !     .. Parameters ..                                                  
  207.       DOUBLE PRECISION   ZERO, ONE 
  208.       PARAMETER          ( ZERO = 0.0D0, ONE = 1.0D0 ) 
  209. !     ..                                                                
  210. !     .. Local Scalars ..                                               
  211.       INTEGER            EXBITS, EXPSUM, I, LEXP, NBITS, TRY, UEXP 
  212.       DOUBLE PRECISION   OLDY, RECBAS, Y, Z 
  213. !     ..                                                                
  214. !     .. External Functions ..                                          
  215.       DOUBLE PRECISION   DLAMC3 
  216.       EXTERNAL           DLAMC3 
  217. !     ..                                                                
  218. !     .. Intrinsic Functions ..                                         
  219.       INTRINSIC          MOD 
  220. !     ..                                                                
  221. !     .. Executable Statements ..                                       
  222. !                                                                       
  223. !     First compute LEXP and UEXP, two powers of 2 that bound           
  224. !     abs(EMIN). We then assume that EMAX + abs(EMIN) will sum          
  225. !     approximately to the bound that is closest to abs(EMIN).          
  226. !     (EMAX is the exponent of the required number RMAX).               
  227. !                                                                       
  228.       LEXP = 1 
  229.       EXBITS = 1 
  230.    10 CONTINUE 
  231.       TRY = LEXP*2 
  232.       IF( TRY.LE.( -EMIN ) ) THEN 
  233.          LEXP = TRY 
  234.          EXBITS = EXBITS + 1 
  235.          GO TO 10 
  236.       END IF 
  237.       IF( LEXP.EQ.-EMIN ) THEN 
  238.          UEXP = LEXP 
  239.       ELSE 
  240.          UEXP = TRY 
  241.          EXBITS = EXBITS + 1 
  242.       END IF 
  243. !                                                                       
  244. !     Now -LEXP is less than or equal to EMIN, and -UEXP is greater     
  245. !     than or equal to EMIN. EXBITS is the number of bits needed to     
  246. !     store the exponent.                                               
  247. !                                                                       
  248.       IF( ( UEXP+EMIN ).GT.( -LEXP-EMIN ) ) THEN 
  249.          EXPSUM = 2*LEXP 
  250.       ELSE 
  251.          EXPSUM = 2*UEXP 
  252.       END IF 
  253. !                                                                       
  254. !     EXPSUM is the exponent range, approximately equal to              
  255. !     EMAX - EMIN + 1 .                                                 
  256. !                                                                       
  257.       EMAX = EXPSUM + EMIN - 1 
  258.       NBITS = 1 + EXBITS + P 
  259. !                                                                       
  260. !     NBITS is the total number of bits needed to store a               
  261. !     floating-point number.                                            
  262. !                                                                       
  263.       IF( ( MOD( NBITS, 2 ).EQ.1 ) .AND. ( BETA.EQ.2 ) ) THEN 
  264. !                                                                       
  265. !        Either there are an odd number of bits used to store a         
  266. !        floating-point number, which is unlikely, or some bits are     
  267. !        not used in the representation of numbers, which is possible,  
  268. !        (e.g. Cray machines) or the mantissa has an implicit bit,      
  269. !        (e.g. IEEE machines, Dec Vax machines), which is perhaps the   
  270. !        most likely. We have to assume the last alternative.           
  271. !        If this is true, then we need to reduce EMAX by one because    
  272. !        there must be some way of representing zero in an implicit-bit 
  273. !        system. On machines like Cray, we are reducing EMAX by one     
  274. !        unnecessarily.                                                 
  275. !                                                                       
  276.          EMAX = EMAX - 1 
  277.       END IF 
  278. !                                                                       
  279.       IF( IEEE ) THEN 
  280. !                                                                       
  281. !        Assume we are on an IEEE machine which reserves one exponent   
  282. !        for infinity and NaN.                                          
  283. !                                                                       
  284.          EMAX = EMAX - 1 
  285.       END IF 
  286. !                                                                       
  287. !     Now create RMAX, the largest machine number, which should         
  288. !     be equal to (1.0 - BETA**(-P)) * BETA**EMAX .                     
  289. !                                                                       
  290. !     First compute 1.0 - BETA**(-P), being careful that the            
  291. !     result is less than 1.0 .                                         
  292. !                                                                       
  293.       RECBAS = ONE / BETA 
  294.       Z = BETA - ONE 
  295.       Y = ZERO 
  296.       DO 20 I = 1, P 
  297.          Z = Z*RECBAS 
  298.          IF( Y.LT.ONE )                                                 &
  299.      &      OLDY = Y                                                    
  300.          Y = DLAMC3( Y, Z ) 
  301.    20 END DO 
  302.       IF( Y.GE.ONE )                                                    &
  303.      &   Y = OLDY                                                       
  304. !                                                                       
  305. !     Now multiply by BETA**EMAX to get RMAX.                           
  306. !                                                                       
  307.       DO 30 I = 1, EMAX 
  308.          Y = DLAMC3( Y*BETA, ZERO ) 
  309.    30 END DO 
  310. !                                                                       
  311.       RMAX = Y 
  312.       RETURN 
  313. !                                                                       
  314. !     End of DLAMC5                                                     
  315. !                                                                       
  316.       END                                           
  317.       INTEGER FUNCTION ILAENV( ISPEC, NAME, OPTS, N1, N2, N3, N4 ) 
  318. !                                                                       
  319. !  -- LAPACK auxiliary routine (version 3.1) --                         
  320. !     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..    
  321. !     November 2006                                                     
  322. !                                                                       
  323. !     .. Scalar Arguments ..                                            
  324.       CHARACTER*( * )    NAME, OPTS 
  325.       INTEGER            ISPEC, N1, N2, N3, N4 
  326. !     ..                                                                
  327. !                                                                       
  328. !  Purpose                                                              
  329. !  =======                                                              
  330. !                                                                       
  331. !  ILAENV is called from the LAPACK routines to choose problem-dependent
  332. !  parameters for the local environment.  See ISPEC for a description of
  333. !  the parameters.                                                      
  334. !                                                                       
  335. !  This version provides a set of parameters which should give good,    
  336. !  but not optimal, performance on many of the currently available      
  337. !  computers.  Users are encouraged to modify this subroutine to set    
  338. !  the tuning parameters for their particular machine using the option  
  339. !  and problem size information in the arguments.                       
  340. !                                                                       
  341. !  This routine will not function correctly if it is converted to all   
  342. !  lower case.  Converting it to all upper case is allowed.             
  343. !                                                                       
  344. !  Arguments                                                            
  345. !  =========                                                            
  346. !                                                                       
  347. !  ISPEC   (input) INTEGER                                              
  348. !          Specifies the parameter to be returned as the value of       
  349. !          ILAENV.                                                      
  350. !          = 1: the optimal blocksize; if this value is 1, an unblocked 
  351. !               algorithm will give the best performance.               
  352. !          = 2: the minimum block size for which the block routine      
  353. !               should be used; if the usable block size is less than   
  354. !               this value, an unblocked routine should be used.        
  355. !          = 3: the crossover point (in a block routine, for N less     
  356. !               than this value, an unblocked routine should be used)   
  357. !          = 4: the number of shifts, used in the nonsymmetric          
  358. !               eigenvalue routines (DEPRECATED)                        
  359. !          = 5: the minimum column dimension for blocking to be used;   
  360. !               rectangular blocks must have dimension at least k by m, 
  361. !               where k is given by ILAENV(2,...) and m by ILAENV(5,...)
  362. !          = 6: the crossover point for the SVD (when reducing an m by n
  363. !               matrix to bidiagonal form, if max(m,n)/min(m,n) exceeds 
  364. !               this value, a QR factorization is used first to reduce  
  365. !               the matrix to a triangular form.)                       
  366. !          = 7: the number of processors                                
  367. !          = 8: the crossover point for the multishift QR method        
  368. !               for nonsymmetric eigenvalue problems (DEPRECATED)       
  369. !          = 9: maximum size of the subproblems at the bottom of the    
  370. !               computation tree in the divide-and-conquer algorithm    
  371. !               (used by xGELSD and xGESDD)                             
  372. !          =10: ieee NaN arithmetic can be trusted not to trap          
  373. !          =11: infinity arithmetic can be trusted not to trap          
  374. !          12 <= ISPEC <= 16:                                           
  375. !               xHSEQR or one of its subroutines,                       
  376. !               see IPARMQ for detailed explanation                     
  377. !                                                                       
  378. !  NAME    (input) CHARACTER*(*)                                        
  379. !          The name of the calling subroutine, in either upper case or  
  380. !          lower case.                                                  
  381. !                                                                       
  382. !  OPTS    (input) CHARACTER*(*)                                        
  383. !          The character options to the subroutine NAME, concatenated   
  384. !          into a single character string.  For example, UPLO = 'U',    
  385. !          TRANS = 'T', and DIAG = 'N' for a triangular routine would   
  386. !          be specified as OPTS = 'UTN'.                                
  387. !                                                                       
  388. !  N1      (input) INTEGER                                              
  389. !  N2      (input) INTEGER                                              
  390. !  N3      (input) INTEGER                                              
  391. !  N4      (input) INTEGER                                              
  392. !          Problem dimensions for the subroutine NAME; these may not all
  393. !          be required.                                                 
  394. !                                                                       
  395. ! (ILAENV) (output) INTEGER                                             
  396. !          >= 0: the value of the parameter specified by ISPEC          
  397. !          < 0:  if ILAENV = -k, the k-th argument had an illegal value.
  398. !                                                                       
  399. !  Further Details                                                      
  400. !  ===============                                                      
  401. !                                                                       
  402. !  The following conventions have been used when calling ILAENV from the
  403. !  LAPACK routines:                                                     
  404. !  1)  OPTS is a concatenation of all of the character options to       
  405. !      subroutine NAME, in the same order that they appear in the       
  406. !      argument list for NAME, even if they are not used in determining 
  407. !      the value of the parameter specified by ISPEC.                   
  408. !  2)  The problem dimensions N1, N2, N3, N4 are specified in the order 
  409. !      that they appear in the argument list for NAME.  N1 is used      
  410. !      first, N2 second, and so on, and unused problem dimensions are   
  411. !      passed a value of -1.                                            
  412. !  3)  The parameter value returned by ILAENV is checked for validity in
  413. !      the calling subroutine.  For example, ILAENV is used to retrieve 
  414. !      the optimal blocksize for STRTRI as follows:                     
  415. !                                                                       
  416. !      NB = ILAENV( 1, 'STRTRI', UPLO // DIAG, N, -1, -1, -1 )          
  417. !      IF( NB.LE.1 ) NB = MAX( 1, N )                                   
  418. !                                                                       
  419. !  =====================================================================
  420. !                                                                       
  421. !     .. Local Scalars ..                                               
  422.       INTEGER            I, IC, IZ, NB, NBMIN, NX 
  423.       LOGICAL            CNAME, SNAME 
  424.       CHARACTER          C1*1, C2*2, C4*2, C3*3, SUBNAM*6 
  425. !     ..                                                                
  426. !     .. Intrinsic Functions ..                                         
  427.       INTRINSIC          CHAR, ICHAR, INT, MIN, REAL 
  428. !     ..                                                                
  429. !     .. External Functions ..                                          
  430.       INTEGER            IEEECK, IPARMQ 
  431.       EXTERNAL           IEEECK, IPARMQ 
  432. !     ..                                                                
  433. !     .. Executable Statements ..                                       
  434. !                                                                       
  435.       GO TO ( 10, 10, 10, 80, 90, 100, 110, 120,                        &
  436.      &        130, 140, 150, 160, 160, 160, 160, 160 )ISPEC             
  437. !                                                                       
  438. !     Invalid value for ISPEC                                           
  439. !                                                                       
  440.       ILAENV = -1 
  441.       RETURN 
  442. !                                                                       
  443.    10 CONTINUE 
  444. !                                                                       
  445. !     Convert NAME to upper case if the first character is lower case.  
  446. !                                                                       
  447.       ILAENV = 1 
  448.       SUBNAM = NAME 
  449.       IC = ICHAR( SUBNAM( 1: 1 ) ) 
  450.       IZ = ICHAR( 'Z' ) 
  451.       IF( IZ.EQ.90 .OR. IZ.EQ.122 ) THEN 
  452. !                                                                       
  453. !        ASCII character set                                            
  454. !                                                                       
  455.          IF( IC.GE.97 .AND. IC.LE.122 ) THEN 
  456.             SUBNAM( 1: 1 ) = CHAR( IC-32 ) 
  457.             DO 20 I = 2, 6 
  458.                IC = ICHAR( SUBNAM( I: I ) ) 
  459.                IF( IC.GE.97 .AND. IC.LE.122 )                           &
  460.      &            SUBNAM( I: I ) = CHAR( IC-32 )                        
  461.    20       CONTINUE 
  462.          END IF 
  463. !                                                                       
  464.       ELSE IF( IZ.EQ.233 .OR. IZ.EQ.169 ) THEN 
  465. !                                                                       
  466. !        EBCDIC character set                                           
  467. !                                                                       
  468.          IF( ( IC.GE.129 .AND. IC.LE.137 ) .OR.                         &
  469.      &       ( IC.GE.145 .AND. IC.LE.153 ) .OR.                         &
  470.      &       ( IC.GE.162 .AND. IC.LE.169 ) ) THEN                       
  471.             SUBNAM( 1: 1 ) = CHAR( IC+64 ) 
  472.             DO 30 I = 2, 6 
  473.                IC = ICHAR( SUBNAM( I: I ) ) 
  474.                IF( ( IC.GE.129 .AND. IC.LE.137 ) .OR.                   &
  475.      &             ( IC.GE.145 .AND. IC.LE.153 ) .OR.                   &
  476.      &             ( IC.GE.162 .AND. IC.LE.169 ) )SUBNAM( I:            &
  477.      &             I ) = CHAR( IC+64 )                                  
  478.    30       CONTINUE 
  479.          END IF 
  480. !                                                                       
  481.       ELSE IF( IZ.EQ.218 .OR. IZ.EQ.250 ) THEN 
  482. !                                                                       
  483. !        Prime machines:  ASCII+128                                     
  484. !                                                                       
  485.          IF( IC.GE.225 .AND. IC.LE.250 ) THEN 
  486.             SUBNAM( 1: 1 ) = CHAR( IC-32 ) 
  487.             DO 40 I = 2, 6 
  488.                IC = ICHAR( SUBNAM( I: I ) ) 
  489.                IF( IC.GE.225 .AND. IC.LE.250 )                          &
  490.      &            SUBNAM( I: I ) = CHAR( IC-32 )                        
  491.    40       CONTINUE 
  492.          END IF 
  493.       END IF 
  494. !                                                                       
  495.       C1 = SUBNAM( 1: 1 ) 
  496.       SNAME = C1.EQ.'S' .OR. C1.EQ.'D' 
  497.       CNAME = C1.EQ.'C' .OR. C1.EQ.'Z' 
  498.       IF( .NOT.( CNAME .OR. SNAME ) )                                   &
  499.      &   RETURN                                                         
  500.       C2 = SUBNAM( 2: 3 ) 
  501.       C3 = SUBNAM( 4: 6 ) 
  502.       C4 = C3( 2: 3 ) 
  503. !                                                                       
  504.       GO TO ( 50, 60, 70 )ISPEC 
  505. !                                                                       
  506.    50 CONTINUE 
  507. !                                                                       
  508. !     ISPEC = 1:  block size                                            
  509. !                                                                       
  510. !     In these examples, separate code is provided for setting NB for   
  511. !     real and complex.  We assume that NB will take the same value in  
  512. !     single or double precision.                                       
  513. !                                                                       
  514.       NB = 1 
  515. !                                                                       
  516.       IF( C2.EQ.'GE' ) THEN 
  517.          IF( C3.EQ.'TRF' ) THEN 
  518.             IF( SNAME ) THEN 
  519.                NB = 64 
  520.             ELSE 
  521.                NB = 64 
  522.             END IF 
  523.          ELSE IF( C3.EQ.'QRF' .OR. C3.EQ.'RQF' .OR. C3.EQ.'LQF' .OR.    &
  524.      &            C3.EQ.'QLF' ) THEN                                    
  525.             IF( SNAME ) THEN 
  526.                NB = 32 
  527.             ELSE 
  528.                NB = 32 
  529.             END IF 
  530.          ELSE IF( C3.EQ.'HRD' ) THEN 
  531.             IF( SNAME ) THEN 
  532.                NB = 32 
  533.             ELSE 
  534.                NB = 32 
  535.             END IF 
  536.          ELSE IF( C3.EQ.'BRD' ) THEN 
  537.             IF( SNAME ) THEN 
  538.                NB = 32 
  539.             ELSE 
  540.                NB = 32 
  541.             END IF 
  542.          ELSE IF( C3.EQ.'TRI' ) THEN 
  543.             IF( SNAME ) THEN 
  544.                NB = 64 
  545.             ELSE 
  546.                NB = 64 
  547.             END IF 
  548.          END IF 
  549.       ELSE IF( C2.EQ.'PO' ) THEN 
  550.          IF( C3.EQ.'TRF' ) THEN 
  551.             IF( SNAME ) THEN 
  552.                NB = 64 
  553.             ELSE 
  554.                NB = 64 
  555.             END IF 
  556.          END IF 
  557.       ELSE IF( C2.EQ.'SY' ) THEN 
  558.          IF( C3.EQ.'TRF' ) THEN 
  559.             IF( SNAME ) THEN 
  560.                NB = 64 
  561.             ELSE 
  562.                NB = 64 
  563.             END IF 
  564.          ELSE IF( SNAME .AND. C3.EQ.'TRD' ) THEN 
  565.             NB = 32 
  566.          ELSE IF( SNAME .AND. C3.EQ.'GST' ) THEN 
  567.             NB = 64 
  568.          END IF 
  569.       ELSE IF( CNAME .AND. C2.EQ.'HE' ) THEN 
  570.          IF( C3.EQ.'TRF' ) THEN 
  571.             NB = 64 
  572.          ELSE IF( C3.EQ.'TRD' ) THEN 
  573.             NB = 32 
  574.          ELSE IF( C3.EQ.'GST' ) THEN 
  575.             NB = 64 
  576.          END IF 
  577.       ELSE IF( SNAME .AND. C2.EQ.'OR' ) THEN 
  578.          IF( C3( 1: 1 ).EQ.'G' ) THEN 
  579.             IF( C4.EQ.'QR' .OR. C4.EQ.'RQ' .OR. C4.EQ.'LQ' .OR. C4.EQ.  &
  580.      &          'QL' .OR. C4.EQ.'HR' .OR. C4.EQ.'TR' .OR. C4.EQ.'BR' )  &
  581.      &           THEN                                                   
  582.                NB = 32 
  583.             END IF 
  584.          ELSE IF( C3( 1: 1 ).EQ.'M' ) THEN 
  585.             IF( C4.EQ.'QR' .OR. C4.EQ.'RQ' .OR. C4.EQ.'LQ' .OR. C4.EQ.  &
  586.      &          'QL' .OR. C4.EQ.'HR' .OR. C4.EQ.'TR' .OR. C4.EQ.'BR' )  &
  587.      &           THEN                                                   
  588.                NB = 32 
  589.             END IF 
  590.          END IF 
  591.       ELSE IF( CNAME .AND. C2.EQ.'UN' ) THEN 
  592.          IF( C3( 1: 1 ).EQ.'G' ) THEN 
  593.             IF( C4.EQ.'QR' .OR. C4.EQ.'RQ' .OR. C4.EQ.'LQ' .OR. C4.EQ.  &
  594.      &          'QL' .OR. C4.EQ.'HR' .OR. C4.EQ.'TR' .OR. C4.EQ.'BR' )  &
  595.      &           THEN                                                   
  596.                NB = 32 
  597.             END IF 
  598.          ELSE IF( C3( 1: 1 ).EQ.'M' ) THEN 
  599.             IF( C4.EQ.'QR' .OR. C4.EQ.'RQ' .OR. C4.EQ.'LQ' .OR. C4.EQ.  &
  600.      &          'QL' .OR. C4.EQ.'HR' .OR. C4.EQ.'TR' .OR. C4.EQ.'BR' )  &
  601.      &           THEN                                                   
  602.                NB = 32 
  603.             END IF 
  604.          END IF 
  605.       ELSE IF( C2.EQ.'GB' ) THEN 
  606.          IF( C3.EQ.'TRF' ) THEN 
  607.             IF( SNAME ) THEN 
  608.                IF( N4.LE.64 ) THEN 
  609.                   NB = 1 
  610.                ELSE 
  611.                   NB = 32 
  612.                END IF 
  613.             ELSE 
  614.                IF( N4.LE.64 ) THEN 
  615.                   NB = 1 
  616.                ELSE 
  617.                   NB = 32 
  618.                END IF 
  619.             END IF 
  620.          END IF 
  621.       ELSE IF( C2.EQ.'PB' ) THEN 
  622.          IF( C3.EQ.'TRF' ) THEN 
  623.             IF( SNAME ) THEN 
  624.                IF( N2.LE.64 ) THEN 
  625.                   NB = 1 
  626.                ELSE 
  627.                   NB = 32 
  628.                END IF 
  629.             ELSE 
  630.                IF( N2.LE.64 ) THEN 
  631.                   NB = 1 
  632.                ELSE 
  633.                   NB = 32 
  634.                END IF 
  635.             END IF 
  636.          END IF 
  637.       ELSE IF( C2.EQ.'TR' ) THEN 
  638.          IF( C3.EQ.'TRI' ) THEN 
  639.             IF( SNAME ) THEN 
  640.                NB = 64 
  641.             ELSE 
  642.                NB = 64 
  643.             END IF 
  644.          END IF 
  645.       ELSE IF( C2.EQ.'LA' ) THEN 
  646.          IF( C3.EQ.'UUM' ) THEN 
  647.             IF( SNAME ) THEN 
  648.                NB = 64 
  649.             ELSE 
  650.                NB = 64 
  651.             END IF 
  652.          END IF 
  653.       ELSE IF( SNAME .AND. C2.EQ.'ST' ) THEN 
  654.          IF( C3.EQ.'EBZ' ) THEN 
  655.             NB = 1 
  656.          END IF 
  657.       END IF 
  658.       ILAENV = NB 
  659.       RETURN 
  660. !                                                                       
  661.    60 CONTINUE 
  662. !                                                                       
  663. !     ISPEC = 2:  minimum block size                                    
  664. !                                                                       
  665.       NBMIN = 2 
  666.       IF( C2.EQ.'GE' ) THEN 
  667.          IF( C3.EQ.'QRF' .OR. C3.EQ.'RQF' .OR. C3.EQ.'LQF' .OR. C3.EQ.  &
  668.      &       'QLF' ) THEN                                               
  669.             IF( SNAME ) THEN 
  670.                NBMIN = 2 
  671.             ELSE 
  672.                NBMIN = 2 
  673.             END IF 
  674.          ELSE IF( C3.EQ.'HRD' ) THEN 
  675.             IF( SNAME ) THEN 
  676.                NBMIN = 2 
  677.             ELSE 
  678.                NBMIN = 2 
  679.             END IF 
  680.          ELSE IF( C3.EQ.'BRD' ) THEN 
  681.             IF( SNAME ) THEN 
  682.                NBMIN = 2 
  683.             ELSE 
  684.                NBMIN = 2 
  685.             END IF 
  686.          ELSE IF( C3.EQ.'TRI' ) THEN 
  687.             IF( SNAME ) THEN 
  688.                NBMIN = 2 
  689.             ELSE 
  690.                NBMIN = 2 
  691.             END IF 
  692.          END IF 
  693.       ELSE IF( C2.EQ.'SY' ) THEN 
  694.          IF( C3.EQ.'TRF' ) THEN 
  695.             IF( SNAME ) THEN 
  696.                NBMIN = 8 
  697.             ELSE 
  698.                NBMIN = 8 
  699.             END IF 
  700.          ELSE IF( SNAME .AND. C3.EQ.'TRD' ) THEN 
  701.             NBMIN = 2 
  702.          END IF 
  703.       ELSE IF( CNAME .AND. C2.EQ.'HE' ) THEN 
  704.          IF( C3.EQ.'TRD' ) THEN 
  705.             NBMIN = 2 
  706.          END IF 
  707.       ELSE IF( SNAME .AND. C2.EQ.'OR' ) THEN 
  708.          IF( C3( 1: 1 ).EQ.'G' ) THEN 
  709.             IF( C4.EQ.'QR' .OR. C4.EQ.'RQ' .OR. C4.EQ.'LQ' .OR. C4.EQ.  &
  710.      &          'QL' .OR. C4.EQ.'HR' .OR. C4.EQ.'TR' .OR. C4.EQ.'BR' )  &
  711.      &           THEN                                                   
  712.                NBMIN = 2 
  713.             END IF 
  714.          ELSE IF( C3( 1: 1 ).EQ.'M' ) THEN 
  715.             IF( C4.EQ.'QR' .OR. C4.EQ.'RQ' .OR. C4.EQ.'LQ' .OR. C4.EQ.  &
  716.      &          'QL' .OR. C4.EQ.'HR' .OR. C4.EQ.'TR' .OR. C4.EQ.'BR' )  &
  717.      &           THEN                                                   
  718.                NBMIN = 2 
  719.             END IF 
  720.          END IF 
  721.       ELSE IF( CNAME .AND. C2.EQ.'UN' ) THEN 
  722.          IF( C3( 1: 1 ).EQ.'G' ) THEN 
  723.             IF( C4.EQ.'QR' .OR. C4.EQ.'RQ' .OR. C4.EQ.'LQ' .OR. C4.EQ.  &
  724.      &          'QL' .OR. C4.EQ.'HR' .OR. C4.EQ.'TR' .OR. C4.EQ.'BR' )  &
  725.      &           THEN                                                   
  726.                NBMIN = 2 
  727.             END IF 
  728.          ELSE IF( C3( 1: 1 ).EQ.'M' ) THEN 
  729.             IF( C4.EQ.'QR' .OR. C4.EQ.'RQ' .OR. C4.EQ.'LQ' .OR. C4.EQ.  &
  730.      &          'QL' .OR. C4.EQ.'HR' .OR. C4.EQ.'TR' .OR. C4.EQ.'BR' )  &
  731.      &           THEN                                                   
  732.                NBMIN = 2 
  733.             END IF 
  734.          END IF 
  735.       END IF 
  736.       ILAENV = NBMIN 
  737.       RETURN 
  738. !                                                                       
  739.    70 CONTINUE 
  740. !                                                                       
  741. !     ISPEC = 3:  crossover point                                       
  742. !                                                                       
  743.       NX = 0 
  744.       IF( C2.EQ.'GE' ) THEN 
  745.          IF( C3.EQ.'QRF' .OR. C3.EQ.'RQF' .OR. C3.EQ.'LQF' .OR. C3.EQ.  &
  746.      &       'QLF' ) THEN                                               
  747.             IF( SNAME ) THEN 
  748.                NX = 128 
  749.             ELSE 
  750.                NX = 128 
  751.             END IF 
  752.          ELSE IF( C3.EQ.'HRD' ) THEN 
  753.             IF( SNAME ) THEN 
  754.                NX = 128 
  755.             ELSE 
  756.                NX = 128 
  757.             END IF 
  758.          ELSE IF( C3.EQ.'BRD' ) THEN 
  759.             IF( SNAME ) THEN 
  760.                NX = 128 
  761.             ELSE 
  762.                NX = 128 
  763.             END IF 
  764.          END IF 
  765.       ELSE IF( C2.EQ.'SY' ) THEN 
  766.          IF( SNAME .AND. C3.EQ.'TRD' ) THEN 
  767.             NX = 32 
  768.          END IF 
  769.       ELSE IF( CNAME .AND. C2.EQ.'HE' ) THEN 
  770.          IF( C3.EQ.'TRD' ) THEN 
  771.             NX = 32 
  772.          END IF 
  773.       ELSE IF( SNAME .AND. C2.EQ.'OR' ) THEN 
  774.          IF( C3( 1: 1 ).EQ.'G' ) THEN 
  775.             IF( C4.EQ.'QR' .OR. C4.EQ.'RQ' .OR. C4.EQ.'LQ' .OR. C4.EQ.  &
  776.      &          'QL' .OR. C4.EQ.'HR' .OR. C4.EQ.'TR' .OR. C4.EQ.'BR' )  &
  777.      &           THEN                                                   
  778.                NX = 128 
  779.             END IF 
  780.          END IF 
  781.       ELSE IF( CNAME .AND. C2.EQ.'UN' ) THEN 
  782.          IF( C3( 1: 1 ).EQ.'G' ) THEN 
  783.             IF( C4.EQ.'QR' .OR. C4.EQ.'RQ' .OR. C4.EQ.'LQ' .OR. C4.EQ.  &
  784.      &          'QL' .OR. C4.EQ.'HR' .OR. C4.EQ.'TR' .OR. C4.EQ.'BR' )  &
  785.      &           THEN                                                   
  786.                NX = 128 
  787.             END IF 
  788.          END IF 
  789.       END IF 
  790.       ILAENV = NX 
  791.       RETURN 
  792. !                                                                       
  793.    80 CONTINUE 
  794. !                                                                       
  795. !     ISPEC = 4:  number of shifts (used by xHSEQR)                     
  796. !                                                                       
  797.       ILAENV = 6 
  798.       RETURN 
  799. !                                                                       
  800.    90 CONTINUE 
  801. !                                                                       
  802. !     ISPEC = 5:  minimum column dimension (not used)                   
  803. !                                                                       
  804.       ILAENV = 2 
  805.       RETURN 
  806. !                                                                       
  807.   100 CONTINUE 
  808. !                                                                       
  809. !     ISPEC = 6:  crossover point for SVD (used by xGELSS and xGESVD)   
  810. !                                                                       
  811.       ILAENV = INT( REAL( MIN( N1, N2 ) )*1.6E0 ) 
  812.       RETURN 
  813. !                                                                       
  814.   110 CONTINUE 
  815. !                                                                       
  816. !     ISPEC = 7:  number of processors (not used)                       
  817. !                                                                       
  818.       ILAENV = 1 
  819.       RETURN 
  820. !                                                                       
  821.   120 CONTINUE 
  822. !                                                                       
  823. !     ISPEC = 8:  crossover point for multishift (used by xHSEQR)       
  824. !                                                                       
  825.       ILAENV = 50 
  826.       RETURN 
  827. !                                                                       
  828.   130 CONTINUE 
  829. !                                                                       
  830. !     ISPEC = 9:  maximum size of the subproblems at the bottom of the  
  831. !                 computation tree in the divide-and-conquer algorithm  
  832. !                 (used by xGELSD and xGESDD)                           
  833. !                                                                       
  834.       ILAENV = 25 
  835.       RETURN 
  836. !                                                                       
  837.   140 CONTINUE 
  838. !                                                                       
  839. !     ISPEC = 10: ieee NaN arithmetic can be trusted not to trap        
  840. !                                                                       
  841. !     ILAENV = 0                                                        
  842.       ILAENV = 1 
  843.       IF( ILAENV.EQ.1 ) THEN 
  844.          ILAENV = IEEECK( 0, 0.0, 1.0 ) 
  845.       END IF 
  846.       RETURN 
  847. !                                                                       
  848.   150 CONTINUE 
  849. !                                                                       
  850. !     ISPEC = 11: infinity arithmetic can be trusted not to trap        
  851. !                                                                       
  852. !     ILAENV = 0                                                        
  853.       ILAENV = 1 
  854.       IF( ILAENV.EQ.1 ) THEN 
  855.          ILAENV = IEEECK( 1, 0.0, 1.0 ) 
  856.       END IF 
  857.       RETURN 
  858. !                                                                       
  859.   160 CONTINUE 
  860. !                                                                       
  861. !     12 <= ISPEC <= 16: xHSEQR or one of its subroutines.              
  862. !                                                                       
  863.       ILAENV = IPARMQ( ISPEC, NAME, OPTS, N1, N2, N3, N4 ) 
  864.       RETURN 
  865. !                                                                       
  866. !     End of ILAENV                                                     
  867. !                                                                       
  868.       END                                           
  869.       INTEGER          FUNCTION IEEECK( ISPEC, ZERO, ONE ) 
  870. !                                                                       
  871. !  -- LAPACK auxiliary routine (version 3.1) --                         
  872. !     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..    
  873. !     November 2006                                                     
  874. !                                                                       
  875. !     .. Scalar Arguments ..                                            
  876.       INTEGER            ISPEC 
  877.       REAL               ONE, ZERO 
  878. !     ..                                                                
  879. !                                                                       
  880. !  Purpose                                                              
  881. !  =======                                                              
  882. !                                                                       
  883. !  IEEECK is called from the ILAENV to verify that Infinity and         
  884. !  possibly NaN arithmetic is safe (i.e. will not trap).                
  885. !                                                                       
  886. !  Arguments                                                            
  887. !  =========                                                            
  888. !                                                                       
  889. !  ISPEC   (input) INTEGER                                              
  890. !          Specifies whether to test just for inifinity arithmetic      
  891. !          or whether to test for infinity and NaN arithmetic.          
  892. !          = 0: Verify infinity arithmetic only.                        
  893. !          = 1: Verify infinity and NaN arithmetic.                     
  894. !                                                                       
  895. !  ZERO    (input) REAL                                                 
  896. !          Must contain the value 0.0                                   
  897. !          This is passed to prevent the compiler from optimizing       
  898. !          away this code.                                              
  899. !                                                                       
  900. !  ONE     (input) REAL                                                 
  901. !          Must contain the value 1.0                                   
  902. !          This is passed to prevent the compiler from optimizing       
  903. !          away this code.                                              
  904. !                                                                       
  905. !  RETURN VALUE:  INTEGER                                               
  906. !          = 0:  Arithmetic failed to produce the correct answers       
  907. !          = 1:  Arithmetic produced the correct answers                
  908. !                                                                       
  909. !     .. Local Scalars ..                                               
  910.       REAL               NAN1, NAN2, NAN3, NAN4, NAN5, NAN6, NEGINF,    &
  911.      &                   NEGZRO, NEWZRO, POSINF                         
  912. !     ..                                                                
  913. !     .. Executable Statements ..                                       
  914.       IEEECK = 1 
  915. !                                                                       
  916.       POSINF = ONE / ZERO 
  917.       IF( POSINF.LE.ONE ) THEN 
  918.          IEEECK = 0 
  919.          RETURN 
  920.       END IF 
  921. !                                                                       
  922.       NEGINF = -ONE / ZERO 
  923.       IF( NEGINF.GE.ZERO ) THEN 
  924.          IEEECK = 0 
  925.          RETURN 
  926.       END IF 
  927. !                                                                       
  928.       NEGZRO = ONE / ( NEGINF+ONE ) 
  929.       IF( NEGZRO.NE.ZERO ) THEN 
  930.          IEEECK = 0 
  931.          RETURN 
  932.       END IF 
  933. !                                                                       
  934.       NEGINF = ONE / NEGZRO 
  935.       IF( NEGINF.GE.ZERO ) THEN 
  936.          IEEECK = 0 
  937.          RETURN 
  938.       END IF 
  939. !                                                                       
  940.       NEWZRO = NEGZRO + ZERO 
  941.       IF( NEWZRO.NE.ZERO ) THEN 
  942.          IEEECK = 0 
  943.          RETURN 
  944.       END IF 
  945. !                                                                       
  946.       POSINF = ONE / NEWZRO 
  947.       IF( POSINF.LE.ONE ) THEN 
  948.          IEEECK = 0 
  949.          RETURN 
  950.       END IF 
  951. !                                                                       
  952.       NEGINF = NEGINF*POSINF 
  953.       IF( NEGINF.GE.ZERO ) THEN 
  954.          IEEECK = 0 
  955.          RETURN 
  956.       END IF 
  957. !                                                                       
  958.       POSINF = POSINF*POSINF 
  959.       IF( POSINF.LE.ONE ) THEN 
  960.          IEEECK = 0 
  961.          RETURN 
  962.       END IF 
  963. !                                                                       
  964. !                                                                       
  965. !                                                                       
  966. !                                                                       
  967. !     Return if we were only asked to check infinity arithmetic         
  968. !                                                                       
  969.       IF( ISPEC.EQ.0 )                                                  &
  970.      &   RETURN                                                         
  971. !                                                                       
  972.       NAN1 = POSINF + NEGINF 
  973. !                                                                       
  974.       NAN2 = POSINF / NEGINF 
  975. !                                                                       
  976.       NAN3 = POSINF / POSINF 
  977. !                                                                       
  978.       NAN4 = POSINF*ZERO 
  979. !                                                                       
  980.       NAN5 = NEGINF*NEGZRO 
  981. !                                                                       
  982.       NAN6 = NAN5*0.0 
  983. !                                                                       
  984.       IF( NAN1.EQ.NAN1 ) THEN 
  985.          IEEECK = 0 
  986.          RETURN 
  987.       END IF 
  988. !                                                                       
  989.       IF( NAN2.EQ.NAN2 ) THEN 
  990.          IEEECK = 0 
  991.          RETURN 
  992.       END IF 
  993. !                                                                       
  994.       IF( NAN3.EQ.NAN3 ) THEN 
  995.          IEEECK = 0 
  996.          RETURN 
  997.       END IF 
  998. !                                                                       
  999.       IF( NAN4.EQ.NAN4 ) THEN 
  1000.          IEEECK = 0 
  1001.          RETURN 
  1002.       END IF 
  1003. !                                                                       
  1004.       IF( NAN5.EQ.NAN5 ) THEN 
  1005.          IEEECK = 0 
  1006.          RETURN 
  1007.       END IF 
  1008. !                                                                       
  1009.       IF( NAN6.EQ.NAN6 ) THEN 
  1010.          IEEECK = 0 
  1011.          RETURN 
  1012.       END IF 
  1013. !                                                                       
  1014.       RETURN 
  1015.       END                                           
  1016.       INTEGER FUNCTION IPARMQ( ISPEC, NAME, OPTS, N, ILO, IHI, LWORK ) 
  1017. !                                                                       
  1018. !  -- LAPACK auxiliary routine (version 3.1) --                         
  1019. !     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..    
  1020. !     November 2006                                                     
  1021. !                                                                       
  1022. !     .. Scalar Arguments ..                                            
  1023.       INTEGER            IHI, ILO, ISPEC, LWORK, N 
  1024.       CHARACTER          NAME*( * ), OPTS*( * ) 
  1025. !                                                                       
  1026. !  Purpose                                                              
  1027. !  =======                                                              
  1028. !                                                                       
  1029. !       This program sets problem and machine dependent parameters      
  1030. !       useful for xHSEQR and its subroutines. It is called whenever    
  1031. !       ILAENV is called with 12 <= ISPEC <= 16                         
  1032. !                                                                       
  1033. !  Arguments                                                            
  1034. !  =========                                                            
  1035. !                                                                       
  1036. !       ISPEC  (input) integer scalar                                   
  1037. !              ISPEC specifies which tunable parameter IPARMQ should    
  1038. !              return.                                                  
  1039. !                                                                       
  1040. !              ISPEC=12: (INMIN)  Matrices of order nmin or less        
  1041. !                        are sent directly to xLAHQR, the implicit      
  1042. !                        double shift QR algorithm.  NMIN must be       
  1043. !                        at least 11.                                   
  1044. !                                                                       
  1045. !              ISPEC=13: (INWIN)  Size of the deflation window.         
  1046. !                        This is best set greater than or equal to      
  1047. !                        the number of simultaneous shifts NS.          
  1048. !                        Larger matrices benefit from larger deflation  
  1049. !                        windows.                                       
  1050. !                                                                       
  1051. !              ISPEC=14: (INIBL) Determines when to stop nibbling and   
  1052. !                        invest in an (expensive) multi-shift QR sweep. 
  1053. !                        If the aggressive early deflation subroutine   
  1054. !                        finds LD converged eigenvalues from an order   
  1055. !                        NW deflation window and LD.GT.(NW*NIBBLE)/100, 
  1056. !                        then the next QR sweep is skipped and early    
  1057. !                        deflation is applied immediately to the        
  1058. !                        remaining active diagonal block.  Setting      
  1059. !                        IPARMQ(ISPEC=14) = 0 causes TTQRE to skip a    
  1060. !                        multi-shift QR sweep whenever early deflation  
  1061. !                        finds a converged eigenvalue.  Setting         
  1062. !                        IPARMQ(ISPEC=14) greater than or equal to 100  
  1063. !                        prevents TTQRE from skipping a multi-shift     
  1064. !                        QR sweep.                                      
  1065. !                                                                       
  1066. !              ISPEC=15: (NSHFTS) The number of simultaneous shifts in  
  1067. !                        a multi-shift QR iteration.                    
  1068. !                                                                       
  1069. !              ISPEC=16: (IACC22) IPARMQ is set to 0, 1 or 2 with the   
  1070. !                        following meanings.                            
  1071. !                        0:  During the multi-shift QR sweep,           
  1072. !                            xLAQR5 does not accumulate reflections and 
  1073. !                            does not use matrix-matrix multiply to     
  1074. !                            update the far-from-diagonal matrix        
  1075. !                            entries.                                   
  1076. !                        1:  During the multi-shift QR sweep,           
  1077. !                            xLAQR5 and/or xLAQRaccumulates reflections 
  1078. !                            matrix-matrix multiply to update the       
  1079. !                            far-from-diagonal matrix entries.          
  1080. !                        2:  During the multi-shift QR sweep.           
  1081. !                            xLAQR5 accumulates reflections and takes   
  1082. !                            advantage of 2-by-2 block structure during 
  1083. !                            matrix-matrix multiplies.                  
  1084. !                        (If xTRMM is slower than xGEMM, then           
  1085. !                        IPARMQ(ISPEC=16)=1 may be more efficient than  
  1086. !                        IPARMQ(ISPEC=16)=2 despite the greater level of
  1087. !                        arithmetic work implied by the latter choice.) 
  1088. !                                                                       
  1089. !       NAME    (input) character string                                
  1090. !               Name of the calling subroutine                          
  1091. !                                                                       
  1092. !       OPTS    (input) character string                                
  1093. !               This is a concatenation of the string arguments to      
  1094. !               TTQRE.                                                  
  1095. !                                                                       
  1096. !       N       (input) integer scalar                                  
  1097. !               N is the order of the Hessenberg matrix H.              
  1098. !                                                                       
  1099. !       ILO     (input) INTEGER                                         
  1100. !       IHI     (input) INTEGER                                         
  1101. !               It is assumed that H is already upper triangular        
  1102. !               in rows and columns 1:ILO-1 and IHI+1:N.                
  1103. !                                                                       
  1104. !       LWORK   (input) integer scalar                                  
  1105. !               The amount of workspace available.                      
  1106. !                                                                       
  1107. !  Further Details                                                      
  1108. !  ===============                                                      
  1109. !                                                                       
  1110. !       Little is known about how best to choose these parameters.      
  1111. !       It is possible to use different values of the parameters        
  1112. !       for each of CHSEQR, DHSEQR, SHSEQR and ZHSEQR.                  
  1113. !                                                                       
  1114. !       It is probably best to choose different parameters for          
  1115. !       different matrices and different parameters at different        
  1116. !       times during the iteration, but this has not been               
  1117. !       implemented --- yet.                                            
  1118. !                                                                       
  1119. !                                                                       
  1120. !       The best choices of most of the parameters depend               
  1121. !       in an ill-understood way on the relative execution              
  1122. !       rate of xLAQR3 and xLAQR5 and on the nature of each             
  1123. !       particular eigenvalue problem.  Experiment may be the           
  1124. !       only practical way to determine which choices are most          
  1125. !       effective.                                                      
  1126. !                                                                       
  1127. !       Following is a list of default values supplied by IPARMQ.       
  1128. !       These defaults may be adjusted in order to attain better        
  1129. !       performance in any particular computational environment.        
  1130. !                                                                       
  1131. !       IPARMQ(ISPEC=12) The xLAHQR vs xLAQR0 crossover point.          
  1132. !                        Default: 75. (Must be at least 11.)            
  1133. !                                                                       
  1134. !       IPARMQ(ISPEC=13) Recommended deflation window size.             
  1135. !                        This depends on ILO, IHI and NS, the           
  1136. !                        number of simultaneous shifts returned         
  1137. !                        by IPARMQ(ISPEC=15).  The default for          
  1138. !                        (IHI-ILO+1).LE.500 is NS.  The default         
  1139. !                        for (IHI-ILO+1).GT.500 is 3*NS/2.              
  1140. !                                                                       
  1141. !       IPARMQ(ISPEC=14) Nibble crossover point.  Default: 14.          
  1142. !                                                                       
  1143. !       IPARMQ(ISPEC=15) Number of simultaneous shifts, NS.             
  1144. !                        a multi-shift QR iteration.                    
  1145. !                                                                       
  1146. !                        If IHI-ILO+1 is ...                            
  1147. !                                                                       
  1148. !                        greater than      ...but less    ... the       
  1149. !                        or equal to ...      than        default is    
  1150. !                                                                       
  1151. !                                0               30       NS =   2+     
  1152. !                               30               60       NS =   4+     
  1153. !                               60              150       NS =  10      
  1154. !                              150              590       NS =  **      
  1155. !                              590             3000       NS =  64      
  1156. !                             3000             6000       NS = 128      
  1157. !                             6000             infinity   NS = 256      
  1158. !                                                                       
  1159. !                    (+)  By default matrices of this order are         
  1160. !                         passed to the implicit double shift routine   
  1161. !                         xLAHQR.  See IPARMQ(ISPEC=12) above.   These  
  1162. !                         values of NS are used only in case of a rare  
  1163. !                         xLAHQR failure.                               
  1164. !                                                                       
  1165. !                    (**) The asterisks (**) indicate an ad-hoc         
  1166. !                         function increasing from 10 to 64.            
  1167. !                                                                       
  1168. !       IPARMQ(ISPEC=16) Select structured matrix multiply.             
  1169. !                        (See ISPEC=16 above for details.)              
  1170. !                        Default: 3.                                    
  1171. !                                                                       
  1172. !     ================================================================  
  1173. !     .. Parameters ..                                                  
  1174.       INTEGER            INMIN, INWIN, INIBL, ISHFTS, IACC22 
  1175.       PARAMETER          ( INMIN = 12, INWIN = 13, INIBL = 14,          &
  1176.      &                   ISHFTS = 15, IACC22 = 16 )                     
  1177.       INTEGER            NMIN, K22MIN, KACMIN, NIBBLE, KNWSWP 
  1178.       PARAMETER          ( NMIN = 75, K22MIN = 14, KACMIN = 14,         &
  1179.      &                   NIBBLE = 14, KNWSWP = 500 )                    
  1180.       REAL               TWO 
  1181.       PARAMETER          ( TWO = 2.0 ) 
  1182. !     ..                                                                
  1183. !     .. Local Scalars ..                                               
  1184.       INTEGER            NH, NS 
  1185. !     ..                                                                
  1186. !     .. Intrinsic Functions ..                                         
  1187.       INTRINSIC          LOG, MAX, MOD, NINT, REAL 
  1188. !     ..                                                                
  1189. !     .. Executable Statements ..                                       
  1190.       IF( ( ISPEC.EQ.ISHFTS ) .OR. ( ISPEC.EQ.INWIN ) .OR.              &
  1191.      &    ( ISPEC.EQ.IACC22 ) ) THEN                                    
  1192. !                                                                       
  1193. !        ==== Set the number simultaneous shifts ====                   
  1194. !                                                                       
  1195.          NH = IHI - ILO + 1 
  1196.          NS = 2 
  1197.          IF( NH.GE.30 )                                                 &
  1198.      &      NS = 4                                                      
  1199.          IF( NH.GE.60 )                                                 &
  1200.      &      NS = 10                                                     
  1201.          IF( NH.GE.150 )                                                &
  1202.      &      NS = MAX( 10, NH / NINT( LOG( REAL( NH ) ) / LOG( TWO ) ) ) 
  1203.          IF( NH.GE.590 )                                                &
  1204.      &      NS = 64                                                     
  1205.          IF( NH.GE.3000 )                                               &
  1206.      &      NS = 128                                                    
  1207.          IF( NH.GE.6000 )                                               &
  1208.      &      NS = 256                                                    
  1209.          NS = MAX( 2, NS-MOD( NS, 2 ) ) 
  1210.       END IF 
  1211. !                                                                       
  1212.       IF( ISPEC.EQ.INMIN ) THEN 
  1213. !                                                                       
  1214. !                                                                       
  1215. !        ===== Matrices of order smaller than NMIN get sent             
  1216. !        .     to xLAHQR, the classic double shift algorithm.           
  1217. !        .     This must be at least 11. ====                           
  1218. !                                                                       
  1219.          IPARMQ = NMIN 
  1220. !                                                                       
  1221.       ELSE IF( ISPEC.EQ.INIBL ) THEN 
  1222. !                                                                       
  1223. !        ==== INIBL: skip a multi-shift qr iteration and                
  1224. !        .    whenever aggressive early deflation finds                 
  1225. !        .    at least (NIBBLE*(window size)/100) deflations. ====      
  1226. !                                                                       
  1227.          IPARMQ = NIBBLE 
  1228. !                                                                       
  1229.       ELSE IF( ISPEC.EQ.ISHFTS ) THEN 
  1230. !                                                                       
  1231. !        ==== NSHFTS: The number of simultaneous shifts =====           
  1232. !                                                                       
  1233.          IPARMQ = NS 
  1234. !                                                                       
  1235.       ELSE IF( ISPEC.EQ.INWIN ) THEN 
  1236. !                                                                       
  1237. !        ==== NW: deflation window size.  ====                          
  1238. !                                                                       
  1239.          IF( NH.LE.KNWSWP ) THEN 
  1240.             IPARMQ = NS 
  1241.          ELSE 
  1242.             IPARMQ = 3*NS / 2 
  1243.          END IF 
  1244. !                                                                       
  1245.       ELSE IF( ISPEC.EQ.IACC22 ) THEN 
  1246. !                                                                       
  1247. !        ==== IACC22: Whether to accumulate reflections                 
  1248. !        .     before updating the far-from-diagonal elements           
  1249. !        .     and whether to use 2-by-2 block structure while          
  1250. !        .     doing it.  A small amount of work could be saved         
  1251. !        .     by making this choice dependent also upon the            
  1252. !        .     NH=IHI-ILO+1.                                            
  1253. !                                                                       
  1254.          IPARMQ = 0 
  1255.          IF( NS.GE.KACMIN )                                             &
  1256.      &      IPARMQ = 1                                                  
  1257.          IF( NS.GE.K22MIN )                                             &
  1258.      &      IPARMQ = 2                                                  
  1259. !                                                                       
  1260.       ELSE 
  1261. !        ===== invalid value of ispec =====                             
  1262.          IPARMQ = -1 
  1263. !                                                                       
  1264.       END IF 
  1265. !                                                                       
  1266. !     ==== End of IPARMQ ====                                           
  1267. !                                                                       
  1268.       END