Télécharger iparmq.eso

Retour à la liste

Numérotation des lignes :

iparmq
  1. C IPARMQ SOURCE BP208322 22/09/16 21:15:10 11454
  2. *> \brief \b IPARMQ
  3. *
  4. * =========== DOCUMENTATION ===========
  5. *
  6. * Online html documentation available at
  7. * http://www.netlib.org/lapack/explore-html/
  8. *
  9. *> \htmlonly
  10. *> Download IPARMQ + dependencies
  11. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/iparmq.f">
  12. *> [TGZ]</a>
  13. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/iparmq.f">
  14. *> [ZIP]</a>
  15. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/iparmq.f">
  16. *> [TXT]</a>
  17. *> \endhtmlonly
  18. *
  19. * Definition:
  20. * ===========
  21. *
  22. * INTEGER FUNCTION IPARMQ( ISPEC, NAME, OPTS, N, ILO, IHI, LWORK )
  23. *
  24. * .. Scalar Arguments ..
  25. * INTEGER IHI, ILO, ISPEC, LWORK, N
  26. * CHARACTER NAME*( * ), OPTS*( * )
  27. *
  28. *
  29. *> \par Purpose:
  30. * =============
  31. *>
  32. *> \verbatim
  33. *>
  34. *> This program sets problem and machine dependent parameters
  35. *> useful for xHSEQR and related subroutines for eigenvalue
  36. *> problems. It is called whenever
  37. *> IPARMQ is called with 12 <= ISPEC <= 16
  38. *> \endverbatim
  39. *
  40. * Arguments:
  41. * ==========
  42. *
  43. *> \param[in] ISPEC
  44. *> \verbatim
  45. *> ISPEC is INTEGER
  46. *> ISPEC specifies which tunable parameter IPARMQ should
  47. *> return.
  48. *>
  49. *> ISPEC=12: (INMIN) Matrices of order nmin or less
  50. *> are sent directly to xLAHQR, the implicit
  51. *> double shift QR algorithm. NMIN must be
  52. *> at least 11.
  53. *>
  54. *> ISPEC=13: (INWIN) Size of the deflation window.
  55. *> This is best set greater than or equal to
  56. *> the number of simultaneous shifts NS.
  57. *> Larger matrices benefit from larger deflation
  58. *> windows.
  59. *>
  60. *> ISPEC=14: (INIBL) Determines when to stop nibbling and
  61. *> invest in an (expensive) multi-shift QR sweep.
  62. *> If the aggressive early deflation subroutine
  63. *> finds LD converged eigenvalues from an order
  64. *> NW deflation window and LD.GT.(NW*NIBBLE)/100,
  65. *> then the next QR sweep is skipped and early
  66. *> deflation is applied immediately to the
  67. *> remaining active diagonal block. Setting
  68. *> IPARMQ(ISPEC=14) = 0 causes TTQRE to skip a
  69. *> multi-shift QR sweep whenever early deflation
  70. *> finds a converged eigenvalue. Setting
  71. *> IPARMQ(ISPEC=14) greater than or equal to 100
  72. *> prevents TTQRE from skipping a multi-shift
  73. *> QR sweep.
  74. *>
  75. *> ISPEC=15: (NSHFTS) The number of simultaneous shifts in
  76. *> a multi-shift QR iteration.
  77. *>
  78. *> ISPEC=16: (IACC22) IPARMQ is set to 0, 1 or 2 with the
  79. *> following meanings.
  80. *> 0: During the multi-shift QR/QZ sweep,
  81. *> blocked eigenvalue reordering, blocked
  82. *> Hessenberg-triangular reduction,
  83. *> reflections and/or rotations are not
  84. *> accumulated when updating the
  85. *> far-from-diagonal matrix entries.
  86. *> 1: During the multi-shift QR/QZ sweep,
  87. *> blocked eigenvalue reordering, blocked
  88. *> Hessenberg-triangular reduction,
  89. *> reflections and/or rotations are
  90. *> accumulated, and matrix-matrix
  91. *> multiplication is used to update the
  92. *> far-from-diagonal matrix entries.
  93. *> 2: During the multi-shift QR/QZ sweep,
  94. *> blocked eigenvalue reordering, blocked
  95. *> Hessenberg-triangular reduction,
  96. *> reflections and/or rotations are
  97. *> accumulated, and 2-by-2 block structure
  98. *> is exploited during matrix-matrix
  99. *> multiplies.
  100. *> (If xTRMM is slower than xGEMM, then
  101. *> IPARMQ(ISPEC=16)=1 may be more efficient than
  102. *> IPARMQ(ISPEC=16)=2 despite the greater level of
  103. *> arithmetic work implied by the latter choice.)
  104. *> \endverbatim
  105. *>
  106. *> \param[in] NAME
  107. *> \verbatim
  108. *> NAME is character string
  109. *> Name of the calling subroutine
  110. *> \endverbatim
  111. *>
  112. *> \param[in] OPTS
  113. *> \verbatim
  114. *> OPTS is character string
  115. *> This is a concatenation of the string arguments to
  116. *> TTQRE.
  117. *> \endverbatim
  118. *>
  119. *> \param[in] N
  120. *> \verbatim
  121. *> N is INTEGER
  122. *> N is the order of the Hessenberg matrix H.
  123. *> \endverbatim
  124. *>
  125. *> \param[in] ILO
  126. *> \verbatim
  127. *> ILO is INTEGER
  128. *> \endverbatim
  129. *>
  130. *> \param[in] IHI
  131. *> \verbatim
  132. *> IHI is INTEGER
  133. *> It is assumed that H is already upper triangular
  134. *> in rows and columns 1:ILO-1 and IHI+1:N.
  135. *> \endverbatim
  136. *>
  137. *> \param[in] LWORK
  138. *> \verbatim
  139. *> LWORK is INTEGER
  140. *> The amount of workspace available.
  141. *> \endverbatim
  142. *
  143. * Authors:
  144. * ========
  145. *
  146. *> \author Univ. of Tennessee
  147. *> \author Univ. of California Berkeley
  148. *> \author Univ. of Colorado Denver
  149. *> \author NAG Ltd.
  150. *
  151. *> \date June 2017
  152. *
  153. *> \ingroup OTHERauxiliary
  154. *
  155. *> \par Further Details:
  156. * =====================
  157. *>
  158. *> \verbatim
  159. *>
  160. *> Little is known about how best to choose these parameters.
  161. *> It is possible to use different values of the parameters
  162. *> for each of CHSEQR, DHSEQR, SHSEQR and ZHSEQR.
  163. *>
  164. *> It is probably best to choose different parameters for
  165. *> different matrices and different parameters at different
  166. *> times during the iteration, but this has not been
  167. *> implemented --- yet.
  168. *>
  169. *>
  170. *> The best choices of most of the parameters depend
  171. *> in an ill-understood way on the relative execution
  172. *> rate of xLAQR3 and xLAQR5 and on the nature of each
  173. *> particular eigenvalue problem. Experiment may be the
  174. *> only practical way to determine which choices are most
  175. *> effective.
  176. *>
  177. *> Following is a list of default values supplied by IPARMQ.
  178. *> These defaults may be adjusted in order to attain better
  179. *> performance in any particular computational environment.
  180. *>
  181. *> IPARMQ(ISPEC=12) The xLAHQR vs xLAQR0 crossover point.
  182. *> Default: 75. (Must be at least 11.)
  183. *>
  184. *> IPARMQ(ISPEC=13) Recommended deflation window size.
  185. *> This depends on ILO, IHI and NS, the
  186. *> number of simultaneous shifts returned
  187. *> by IPARMQ(ISPEC=15). The default for
  188. *> (IHI-ILO+1).LE.500 is NS. The default
  189. *> for (IHI-ILO+1).GT.500 is 3*NS/2.
  190. *>
  191. *> IPARMQ(ISPEC=14) Nibble crossover point. Default: 14.
  192. *>
  193. *> IPARMQ(ISPEC=15) Number of simultaneous shifts, NS.
  194. *> a multi-shift QR iteration.
  195. *>
  196. *> If IHI-ILO+1 is ...
  197. *>
  198. *> greater than ...but less ... the
  199. *> or equal to ... than default is
  200. *>
  201. *> 0 30 NS = 2+
  202. *> 30 60 NS = 4+
  203. *> 60 150 NS = 10
  204. *> 150 590 NS = **
  205. *> 590 3000 NS = 64
  206. *> 3000 6000 NS = 128
  207. *> 6000 infinity NS = 256
  208. *>
  209. *> (+) By default matrices of this order are
  210. *> passed to the implicit double shift routine
  211. *> xLAHQR. See IPARMQ(ISPEC=12) above. These
  212. *> values of NS are used only in case of a rare
  213. *> xLAHQR failure.
  214. *>
  215. *> (**) The asterisks (**) indicate an ad-hoc
  216. *> function increasing from 10 to 64.
  217. *>
  218. *> IPARMQ(ISPEC=16) Select structured matrix multiply.
  219. *> (See ISPEC=16 above for details.)
  220. *> Default: 3.
  221. *>
  222. *> IPARMQ(ISPEC=17) Relative cost heuristic for blocksize selection.
  223. *> Expressed as a percentage.
  224. *> Default: 10.
  225. *> \endverbatim
  226. *>
  227. * =====================================================================
  228. INTEGER FUNCTION IPARMQ( ISPEC, NAME, OPTS, N, ILO, IHI, LWORK )
  229. *
  230. * -- LAPACK auxiliary routine --
  231. * -- LAPACK is a software package provided by Univ. of Tennessee, --
  232. * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  233.  
  234.  
  235. IMPLICIT INTEGER(I-N)
  236. IMPLICIT REAL*8(A-H,O-Z)
  237. *
  238. * .. Scalar Arguments ..
  239. INTEGER IHI, ILO, ISPEC, LWORK, N
  240. CHARACTER NAME*( * ), OPTS*( * )
  241. *
  242. * ================================================================
  243. * .. Parameters ..
  244. INTEGER INMIN, INWIN, INIBL, ISHFTS, IACC22, ICOST
  245. PARAMETER ( INMIN = 12, INWIN = 13, INIBL = 14,
  246. $ ISHFTS = 15, IACC22 = 16, ICOST = 17 )
  247. INTEGER NMIN, K22MIN, KACMIN, NIBBLE, KNWSWP, RCOST
  248. PARAMETER ( NMIN = 75, K22MIN = 14, KACMIN = 14,
  249. $ NIBBLE = 14, KNWSWP = 500, RCOST = 10 )
  250. REAL*8 TWO
  251. PARAMETER ( TWO = 2.0 )
  252. * ..
  253. * .. Local Scalars ..
  254. INTEGER NH, NS
  255. INTEGER I, IC, IZ
  256. CHARACTER SUBNAM*6
  257. * ..
  258. * .. Intrinsic Functions ..
  259. * INTRINSIC LOG, MAX, MOD, NINT, REAL
  260. * ..
  261. * .. Executable Statements ..
  262. IF ( ( ISPEC.EQ.ISHFTS ) .OR. ( ISPEC.EQ.INWIN ) .OR.
  263. & ( ISPEC.EQ.IACC22 ) ) THEN
  264. *
  265. * ==== Set the number simultaneous shifts ====
  266. *
  267. NH = IHI - ILO + 1
  268. NS = 2
  269. IF( NH.GE.30 )
  270. & NS = 4
  271. IF( NH.GE.60 )
  272. & NS = 10
  273. IF( NH.GE.150 )
  274. & NS = MAX( 10, NH / NINT( LOG( REAL( NH ) ) / LOG(TWO )))
  275. IF( NH.GE.590 )
  276. & NS = 64
  277. IF( NH.GE.3000 )
  278. & NS = 128
  279. IF( NH.GE.6000 )
  280. & NS = 256
  281. NS = MAX( 2, NS-MOD( NS, 2 ) )
  282. END IF
  283. *
  284. IF ( ISPEC.EQ.INMIN ) THEN
  285. *
  286. *
  287. * ===== Matrices of order smaller than NMIN get sent
  288. * . to xLAHQR, the classic double shift algorithm.
  289. * . This must be at least 11. ====
  290. *
  291. IPARMQ = NMIN
  292. *
  293. ELSE IF ( ISPEC.EQ.INIBL ) THEN
  294. *
  295. * ==== INIBL: skip a multi-shift qr iteration and
  296. * . whenever aggressive early deflation finds
  297. * . at least (NIBBLE*(window size)/100) deflations. ====
  298. *
  299. IPARMQ = NIBBLE
  300. *
  301. ELSE IF ( ISPEC.EQ.ISHFTS ) THEN
  302. *
  303. * ==== NSHFTS: The number of simultaneous shifts =====
  304. *
  305. IPARMQ = NS
  306. *
  307. ELSE IF ( ISPEC.EQ.INWIN ) THEN
  308. *
  309. * ==== NW: deflation window size. ====
  310. *
  311. IF ( NH.LE.KNWSWP ) THEN
  312. IPARMQ = NS
  313. ELSE
  314. IPARMQ = 3*NS / 2
  315. END IF
  316. *
  317. ELSE IF ( ISPEC.EQ.IACC22 ) THEN
  318. *
  319. * ==== IACC22: Whether to accumulate reflections
  320. * . before updating the far-from-diagonal elements
  321. * . and whether to use 2-by-2 block structure while
  322. * . doing it. A small amount of work could be saved
  323. * . by making this choice dependent also upon the
  324. * . NH=IHI-ILO+1.
  325. *
  326. *
  327. * Convert NAME to upper case if the first character is lower case.
  328. *
  329. IPARMQ = 0
  330. SUBNAM = NAME
  331. IC = ICHAR( SUBNAM( 1: 1 ) )
  332. IZ = ICHAR( 'Z' )
  333. IF( IZ.EQ.90 .OR. IZ.EQ.122 ) THEN
  334. *
  335. * ASCII character set
  336. *
  337. IF( IC.GE.97 .AND. IC.LE.122 ) THEN
  338. SUBNAM( 1: 1 ) = CHAR( IC-32 )
  339. DO I = 2, 6
  340. IC = ICHAR( SUBNAM( I: I ) )
  341. IF( IC.GE.97 .AND. IC.LE.122 )
  342. & SUBNAM( I: I ) = CHAR( IC-32 )
  343. END DO
  344. END IF
  345. *
  346. ELSE IF( IZ.EQ.233 .OR. IZ.EQ.169 ) THEN
  347. *
  348. * EBCDIC character set
  349. *
  350. IF( ( IC.GE.129 .AND. IC.LE.137 ) .OR.
  351. & ( IC.GE.145 .AND. IC.LE.153 ) .OR.
  352. & ( IC.GE.162 .AND. IC.LE.169 ) ) THEN
  353. SUBNAM( 1: 1 ) = CHAR( IC+64 )
  354. DO I = 2, 6
  355. IC = ICHAR( SUBNAM( I: I ) )
  356. IF( ( IC.GE.129 .AND. IC.LE.137 ) .OR.
  357. & ( IC.GE.145 .AND. IC.LE.153 ) .OR.
  358. & ( IC.GE.162 .AND. IC.LE.169 ) )SUBNAM( I:
  359. & I ) = CHAR( IC+64 )
  360. END DO
  361. END IF
  362. *
  363. ELSE IF( IZ.EQ.218 .OR. IZ.EQ.250 ) THEN
  364. *
  365. * Prime machines: ASCII+128
  366. *
  367. IF( IC.GE.225 .AND. IC.LE.250 ) THEN
  368. SUBNAM( 1: 1 ) = CHAR( IC-32 )
  369. DO I = 2, 6
  370. IC = ICHAR( SUBNAM( I: I ) )
  371. IF( IC.GE.225 .AND. IC.LE.250 )
  372. & SUBNAM( I: I ) = CHAR( IC-32 )
  373. END DO
  374. END IF
  375. END IF
  376. *
  377. IF( SUBNAM( 2:6 ).EQ.'GGHRD' .OR.
  378. & SUBNAM( 2:6 ).EQ.'GGHD3' ) THEN
  379. IPARMQ = 1
  380. IF( NH.GE.K22MIN )
  381. & IPARMQ = 2
  382. ELSE IF ( SUBNAM( 4:6 ).EQ.'EXC' ) THEN
  383. IF( NH.GE.KACMIN )
  384. & IPARMQ = 1
  385. IF( NH.GE.K22MIN )
  386. & IPARMQ = 2
  387. ELSE IF ( SUBNAM( 2:6 ).EQ.'HSEQR' .OR.
  388. & SUBNAM( 2:5 ).EQ.'LAQR' ) THEN
  389. IF( NS.GE.KACMIN )
  390. & IPARMQ = 1
  391. IF( NS.GE.K22MIN )
  392. & IPARMQ = 2
  393. END IF
  394. *
  395. ELSE IF( ISPEC.EQ.ICOST ) THEN
  396. *
  397. * === Relative cost of near-the-diagonal chase vs
  398. * BLAS updates ===
  399. *
  400. IPARMQ = RCOST
  401. ELSE
  402. * ===== invalid value of ispec =====
  403. IPARMQ = -1
  404. *
  405. END IF
  406. *
  407. * ==== End of IPARMQ ====
  408. *
  409. END
  410.  
  411.  
  412.  
  413.  

© Cast3M 2003 - Tous droits réservés.
Mentions légales