You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

dchkst.f 68 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975
  1. *> \brief \b DCHKST
  2. *
  3. * =========== DOCUMENTATION ===========
  4. *
  5. * Online html documentation available at
  6. * http://www.netlib.org/lapack/explore-html/
  7. *
  8. * Definition:
  9. * ===========
  10. *
  11. * SUBROUTINE DCHKST( NSIZES, NN, NTYPES, DOTYPE, ISEED, THRESH,
  12. * NOUNIT, A, LDA, AP, SD, SE, D1, D2, D3, D4, D5,
  13. * WA1, WA2, WA3, WR, U, LDU, V, VP, TAU, Z, WORK,
  14. * LWORK, IWORK, LIWORK, RESULT, INFO )
  15. *
  16. * .. Scalar Arguments ..
  17. * INTEGER INFO, LDA, LDU, LIWORK, LWORK, NOUNIT, NSIZES,
  18. * $ NTYPES
  19. * DOUBLE PRECISION THRESH
  20. * ..
  21. * .. Array Arguments ..
  22. * LOGICAL DOTYPE( * )
  23. * INTEGER ISEED( 4 ), IWORK( * ), NN( * )
  24. * DOUBLE PRECISION A( LDA, * ), AP( * ), D1( * ), D2( * ),
  25. * $ D3( * ), D4( * ), D5( * ), RESULT( * ),
  26. * $ SD( * ), SE( * ), TAU( * ), U( LDU, * ),
  27. * $ V( LDU, * ), VP( * ), WA1( * ), WA2( * ),
  28. * $ WA3( * ), WORK( * ), WR( * ), Z( LDU, * )
  29. * ..
  30. *
  31. *
  32. *> \par Purpose:
  33. * =============
  34. *>
  35. *> \verbatim
  36. *>
  37. *> DCHKST checks the symmetric eigenvalue problem routines.
  38. *>
  39. *> DSYTRD factors A as U S U' , where ' means transpose,
  40. *> S is symmetric tridiagonal, and U is orthogonal.
  41. *> DSYTRD can use either just the lower or just the upper triangle
  42. *> of A; DCHKST checks both cases.
  43. *> U is represented as a product of Householder
  44. *> transformations, whose vectors are stored in the first
  45. *> n-1 columns of V, and whose scale factors are in TAU.
  46. *>
  47. *> DSPTRD does the same as DSYTRD, except that A and V are stored
  48. *> in "packed" format.
  49. *>
  50. *> DORGTR constructs the matrix U from the contents of V and TAU.
  51. *>
  52. *> DOPGTR constructs the matrix U from the contents of VP and TAU.
  53. *>
  54. *> DSTEQR factors S as Z D1 Z' , where Z is the orthogonal
  55. *> matrix of eigenvectors and D1 is a diagonal matrix with
  56. *> the eigenvalues on the diagonal. D2 is the matrix of
  57. *> eigenvalues computed when Z is not computed.
  58. *>
  59. *> DSTERF computes D3, the matrix of eigenvalues, by the
  60. *> PWK method, which does not yield eigenvectors.
  61. *>
  62. *> DPTEQR factors S as Z4 D4 Z4' , for a
  63. *> symmetric positive definite tridiagonal matrix.
  64. *> D5 is the matrix of eigenvalues computed when Z is not
  65. *> computed.
  66. *>
  67. *> DSTEBZ computes selected eigenvalues. WA1, WA2, and
  68. *> WA3 will denote eigenvalues computed to high
  69. *> absolute accuracy, with different range options.
  70. *> WR will denote eigenvalues computed to high relative
  71. *> accuracy.
  72. *>
  73. *> DSTEIN computes Y, the eigenvectors of S, given the
  74. *> eigenvalues.
  75. *>
  76. *> DSTEDC factors S as Z D1 Z' , where Z is the orthogonal
  77. *> matrix of eigenvectors and D1 is a diagonal matrix with
  78. *> the eigenvalues on the diagonal ('I' option). It may also
  79. *> update an input orthogonal matrix, usually the output
  80. *> from DSYTRD/DORGTR or DSPTRD/DOPGTR ('V' option). It may
  81. *> also just compute eigenvalues ('N' option).
  82. *>
  83. *> DSTEMR factors S as Z D1 Z' , where Z is the orthogonal
  84. *> matrix of eigenvectors and D1 is a diagonal matrix with
  85. *> the eigenvalues on the diagonal ('I' option). DSTEMR
  86. *> uses the Relatively Robust Representation whenever possible.
  87. *>
  88. *> When DCHKST is called, a number of matrix "sizes" ("n's") and a
  89. *> number of matrix "types" are specified. For each size ("n")
  90. *> and each type of matrix, one matrix will be generated and used
  91. *> to test the symmetric eigenroutines. For each matrix, a number
  92. *> of tests will be performed:
  93. *>
  94. *> (1) | A - V S V' | / ( |A| n ulp ) DSYTRD( UPLO='U', ... )
  95. *>
  96. *> (2) | I - UV' | / ( n ulp ) DORGTR( UPLO='U', ... )
  97. *>
  98. *> (3) | A - V S V' | / ( |A| n ulp ) DSYTRD( UPLO='L', ... )
  99. *>
  100. *> (4) | I - UV' | / ( n ulp ) DORGTR( UPLO='L', ... )
  101. *>
  102. *> (5-8) Same as 1-4, but for DSPTRD and DOPGTR.
  103. *>
  104. *> (9) | S - Z D Z' | / ( |S| n ulp ) DSTEQR('V',...)
  105. *>
  106. *> (10) | I - ZZ' | / ( n ulp ) DSTEQR('V',...)
  107. *>
  108. *> (11) | D1 - D2 | / ( |D1| ulp ) DSTEQR('N',...)
  109. *>
  110. *> (12) | D1 - D3 | / ( |D1| ulp ) DSTERF
  111. *>
  112. *> (13) 0 if the true eigenvalues (computed by sturm count)
  113. *> of S are within THRESH of
  114. *> those in D1. 2*THRESH if they are not. (Tested using
  115. *> DSTECH)
  116. *>
  117. *> For S positive definite,
  118. *>
  119. *> (14) | S - Z4 D4 Z4' | / ( |S| n ulp ) DPTEQR('V',...)
  120. *>
  121. *> (15) | I - Z4 Z4' | / ( n ulp ) DPTEQR('V',...)
  122. *>
  123. *> (16) | D4 - D5 | / ( 100 |D4| ulp ) DPTEQR('N',...)
  124. *>
  125. *> When S is also diagonally dominant by the factor gamma < 1,
  126. *>
  127. *> (17) max | D4(i) - WR(i) | / ( |D4(i)| omega ) ,
  128. *> i
  129. *> omega = 2 (2n-1) ULP (1 + 8 gamma**2) / (1 - gamma)**4
  130. *> DSTEBZ( 'A', 'E', ...)
  131. *>
  132. *> (18) | WA1 - D3 | / ( |D3| ulp ) DSTEBZ( 'A', 'E', ...)
  133. *>
  134. *> (19) ( max { min | WA2(i)-WA3(j) | } +
  135. *> i j
  136. *> max { min | WA3(i)-WA2(j) | } ) / ( |D3| ulp )
  137. *> i j
  138. *> DSTEBZ( 'I', 'E', ...)
  139. *>
  140. *> (20) | S - Y WA1 Y' | / ( |S| n ulp ) DSTEBZ, SSTEIN
  141. *>
  142. *> (21) | I - Y Y' | / ( n ulp ) DSTEBZ, SSTEIN
  143. *>
  144. *> (22) | S - Z D Z' | / ( |S| n ulp ) DSTEDC('I')
  145. *>
  146. *> (23) | I - ZZ' | / ( n ulp ) DSTEDC('I')
  147. *>
  148. *> (24) | S - Z D Z' | / ( |S| n ulp ) DSTEDC('V')
  149. *>
  150. *> (25) | I - ZZ' | / ( n ulp ) DSTEDC('V')
  151. *>
  152. *> (26) | D1 - D2 | / ( |D1| ulp ) DSTEDC('V') and
  153. *> DSTEDC('N')
  154. *>
  155. *> Test 27 is disabled at the moment because DSTEMR does not
  156. *> guarantee high relatvie accuracy.
  157. *>
  158. *> (27) max | D6(i) - WR(i) | / ( |D6(i)| omega ) ,
  159. *> i
  160. *> omega = 2 (2n-1) ULP (1 + 8 gamma**2) / (1 - gamma)**4
  161. *> DSTEMR('V', 'A')
  162. *>
  163. *> (28) max | D6(i) - WR(i) | / ( |D6(i)| omega ) ,
  164. *> i
  165. *> omega = 2 (2n-1) ULP (1 + 8 gamma**2) / (1 - gamma)**4
  166. *> DSTEMR('V', 'I')
  167. *>
  168. *> Tests 29 through 34 are disable at present because DSTEMR
  169. *> does not handle partial spectrum requests.
  170. *>
  171. *> (29) | S - Z D Z' | / ( |S| n ulp ) DSTEMR('V', 'I')
  172. *>
  173. *> (30) | I - ZZ' | / ( n ulp ) DSTEMR('V', 'I')
  174. *>
  175. *> (31) ( max { min | WA2(i)-WA3(j) | } +
  176. *> i j
  177. *> max { min | WA3(i)-WA2(j) | } ) / ( |D3| ulp )
  178. *> i j
  179. *> DSTEMR('N', 'I') vs. SSTEMR('V', 'I')
  180. *>
  181. *> (32) | S - Z D Z' | / ( |S| n ulp ) DSTEMR('V', 'V')
  182. *>
  183. *> (33) | I - ZZ' | / ( n ulp ) DSTEMR('V', 'V')
  184. *>
  185. *> (34) ( max { min | WA2(i)-WA3(j) | } +
  186. *> i j
  187. *> max { min | WA3(i)-WA2(j) | } ) / ( |D3| ulp )
  188. *> i j
  189. *> DSTEMR('N', 'V') vs. SSTEMR('V', 'V')
  190. *>
  191. *> (35) | S - Z D Z' | / ( |S| n ulp ) DSTEMR('V', 'A')
  192. *>
  193. *> (36) | I - ZZ' | / ( n ulp ) DSTEMR('V', 'A')
  194. *>
  195. *> (37) ( max { min | WA2(i)-WA3(j) | } +
  196. *> i j
  197. *> max { min | WA3(i)-WA2(j) | } ) / ( |D3| ulp )
  198. *> i j
  199. *> DSTEMR('N', 'A') vs. SSTEMR('V', 'A')
  200. *>
  201. *> The "sizes" are specified by an array NN(1:NSIZES); the value of
  202. *> each element NN(j) specifies one size.
  203. *> The "types" are specified by a logical array DOTYPE( 1:NTYPES );
  204. *> if DOTYPE(j) is .TRUE., then matrix type "j" will be generated.
  205. *> Currently, the list of possible types is:
  206. *>
  207. *> (1) The zero matrix.
  208. *> (2) The identity matrix.
  209. *>
  210. *> (3) A diagonal matrix with evenly spaced entries
  211. *> 1, ..., ULP and random signs.
  212. *> (ULP = (first number larger than 1) - 1 )
  213. *> (4) A diagonal matrix with geometrically spaced entries
  214. *> 1, ..., ULP and random signs.
  215. *> (5) A diagonal matrix with "clustered" entries 1, ULP, ..., ULP
  216. *> and random signs.
  217. *>
  218. *> (6) Same as (4), but multiplied by SQRT( overflow threshold )
  219. *> (7) Same as (4), but multiplied by SQRT( underflow threshold )
  220. *>
  221. *> (8) A matrix of the form U' D U, where U is orthogonal and
  222. *> D has evenly spaced entries 1, ..., ULP with random signs
  223. *> on the diagonal.
  224. *>
  225. *> (9) A matrix of the form U' D U, where U is orthogonal and
  226. *> D has geometrically spaced entries 1, ..., ULP with random
  227. *> signs on the diagonal.
  228. *>
  229. *> (10) A matrix of the form U' D U, where U is orthogonal and
  230. *> D has "clustered" entries 1, ULP,..., ULP with random
  231. *> signs on the diagonal.
  232. *>
  233. *> (11) Same as (8), but multiplied by SQRT( overflow threshold )
  234. *> (12) Same as (8), but multiplied by SQRT( underflow threshold )
  235. *>
  236. *> (13) Symmetric matrix with random entries chosen from (-1,1).
  237. *> (14) Same as (13), but multiplied by SQRT( overflow threshold )
  238. *> (15) Same as (13), but multiplied by SQRT( underflow threshold )
  239. *> (16) Same as (8), but diagonal elements are all positive.
  240. *> (17) Same as (9), but diagonal elements are all positive.
  241. *> (18) Same as (10), but diagonal elements are all positive.
  242. *> (19) Same as (16), but multiplied by SQRT( overflow threshold )
  243. *> (20) Same as (16), but multiplied by SQRT( underflow threshold )
  244. *> (21) A diagonally dominant tridiagonal matrix with geometrically
  245. *> spaced diagonal entries 1, ..., ULP.
  246. *> \endverbatim
  247. *
  248. * Arguments:
  249. * ==========
  250. *
  251. *> \param[in] NSIZES
  252. *> \verbatim
  253. *> NSIZES is INTEGER
  254. *> The number of sizes of matrices to use. If it is zero,
  255. *> DCHKST does nothing. It must be at least zero.
  256. *> \endverbatim
  257. *>
  258. *> \param[in] NN
  259. *> \verbatim
  260. *> NN is INTEGER array, dimension (NSIZES)
  261. *> An array containing the sizes to be used for the matrices.
  262. *> Zero values will be skipped. The values must be at least
  263. *> zero.
  264. *> \endverbatim
  265. *>
  266. *> \param[in] NTYPES
  267. *> \verbatim
  268. *> NTYPES is INTEGER
  269. *> The number of elements in DOTYPE. If it is zero, DCHKST
  270. *> does nothing. It must be at least zero. If it is MAXTYP+1
  271. *> and NSIZES is 1, then an additional type, MAXTYP+1 is
  272. *> defined, which is to use whatever matrix is in A. This
  273. *> is only useful if DOTYPE(1:MAXTYP) is .FALSE. and
  274. *> DOTYPE(MAXTYP+1) is .TRUE. .
  275. *> \endverbatim
  276. *>
  277. *> \param[in] DOTYPE
  278. *> \verbatim
  279. *> DOTYPE is LOGICAL array, dimension (NTYPES)
  280. *> If DOTYPE(j) is .TRUE., then for each size in NN a
  281. *> matrix of that size and of type j will be generated.
  282. *> If NTYPES is smaller than the maximum number of types
  283. *> defined (PARAMETER MAXTYP), then types NTYPES+1 through
  284. *> MAXTYP will not be generated. If NTYPES is larger
  285. *> than MAXTYP, DOTYPE(MAXTYP+1) through DOTYPE(NTYPES)
  286. *> will be ignored.
  287. *> \endverbatim
  288. *>
  289. *> \param[in,out] ISEED
  290. *> \verbatim
  291. *> ISEED is INTEGER array, dimension (4)
  292. *> On entry ISEED specifies the seed of the random number
  293. *> generator. The array elements should be between 0 and 4095;
  294. *> if not they will be reduced mod 4096. Also, ISEED(4) must
  295. *> be odd. The random number generator uses a linear
  296. *> congruential sequence limited to small integers, and so
  297. *> should produce machine independent random numbers. The
  298. *> values of ISEED are changed on exit, and can be used in the
  299. *> next call to DCHKST to continue the same random number
  300. *> sequence.
  301. *> \endverbatim
  302. *>
  303. *> \param[in] THRESH
  304. *> \verbatim
  305. *> THRESH is DOUBLE PRECISION
  306. *> A test will count as "failed" if the "error", computed as
  307. *> described above, exceeds THRESH. Note that the error
  308. *> is scaled to be O(1), so THRESH should be a reasonably
  309. *> small multiple of 1, e.g., 10 or 100. In particular,
  310. *> it should not depend on the precision (single vs. double)
  311. *> or the size of the matrix. It must be at least zero.
  312. *> \endverbatim
  313. *>
  314. *> \param[in] NOUNIT
  315. *> \verbatim
  316. *> NOUNIT is INTEGER
  317. *> The FORTRAN unit number for printing out error messages
  318. *> (e.g., if a routine returns IINFO not equal to 0.)
  319. *> \endverbatim
  320. *>
  321. *> \param[in,out] A
  322. *> \verbatim
  323. *> A is DOUBLE PRECISION array of
  324. *> dimension ( LDA , max(NN) )
  325. *> Used to hold the matrix whose eigenvalues are to be
  326. *> computed. On exit, A contains the last matrix actually
  327. *> used.
  328. *> \endverbatim
  329. *>
  330. *> \param[in] LDA
  331. *> \verbatim
  332. *> LDA is INTEGER
  333. *> The leading dimension of A. It must be at
  334. *> least 1 and at least max( NN ).
  335. *> \endverbatim
  336. *>
  337. *> \param[out] AP
  338. *> \verbatim
  339. *> AP is DOUBLE PRECISION array of
  340. *> dimension( max(NN)*max(NN+1)/2 )
  341. *> The matrix A stored in packed format.
  342. *> \endverbatim
  343. *>
  344. *> \param[out] SD
  345. *> \verbatim
  346. *> SD is DOUBLE PRECISION array of
  347. *> dimension( max(NN) )
  348. *> The diagonal of the tridiagonal matrix computed by DSYTRD.
  349. *> On exit, SD and SE contain the tridiagonal form of the
  350. *> matrix in A.
  351. *> \endverbatim
  352. *>
  353. *> \param[out] SE
  354. *> \verbatim
  355. *> SE is DOUBLE PRECISION array of
  356. *> dimension( max(NN) )
  357. *> The off-diagonal of the tridiagonal matrix computed by
  358. *> DSYTRD. On exit, SD and SE contain the tridiagonal form of
  359. *> the matrix in A.
  360. *> \endverbatim
  361. *>
  362. *> \param[out] D1
  363. *> \verbatim
  364. *> D1 is DOUBLE PRECISION array of
  365. *> dimension( max(NN) )
  366. *> The eigenvalues of A, as computed by DSTEQR simultaneously
  367. *> with Z. On exit, the eigenvalues in D1 correspond with the
  368. *> matrix in A.
  369. *> \endverbatim
  370. *>
  371. *> \param[out] D2
  372. *> \verbatim
  373. *> D2 is DOUBLE PRECISION array of
  374. *> dimension( max(NN) )
  375. *> The eigenvalues of A, as computed by DSTEQR if Z is not
  376. *> computed. On exit, the eigenvalues in D2 correspond with
  377. *> the matrix in A.
  378. *> \endverbatim
  379. *>
  380. *> \param[out] D3
  381. *> \verbatim
  382. *> D3 is DOUBLE PRECISION array of
  383. *> dimension( max(NN) )
  384. *> The eigenvalues of A, as computed by DSTERF. On exit, the
  385. *> eigenvalues in D3 correspond with the matrix in A.
  386. *> \endverbatim
  387. *>
  388. *> \param[out] D4
  389. *> \verbatim
  390. *> D4 is DOUBLE PRECISION array of
  391. *> dimension( max(NN) )
  392. *> The eigenvalues of A, as computed by DPTEQR(V).
  393. *> DPTEQR factors S as Z4 D4 Z4*
  394. *> On exit, the eigenvalues in D4 correspond with the matrix in A.
  395. *> \endverbatim
  396. *>
  397. *> \param[out] D5
  398. *> \verbatim
  399. *> D5 is DOUBLE PRECISION array of
  400. *> dimension( max(NN) )
  401. *> The eigenvalues of A, as computed by DPTEQR(N)
  402. *> when Z is not computed. On exit, the
  403. *> eigenvalues in D4 correspond with the matrix in A.
  404. *> \endverbatim
  405. *>
  406. *> \param[out] WA1
  407. *> \verbatim
  408. *> WA1 is DOUBLE PRECISION array of
  409. *> dimension( max(NN) )
  410. *> All eigenvalues of A, computed to high
  411. *> absolute accuracy, with different range options.
  412. *> as computed by DSTEBZ.
  413. *> \endverbatim
  414. *>
  415. *> \param[out] WA2
  416. *> \verbatim
  417. *> WA2 is DOUBLE PRECISION array of
  418. *> dimension( max(NN) )
  419. *> Selected eigenvalues of A, computed to high
  420. *> absolute accuracy, with different range options.
  421. *> as computed by DSTEBZ.
  422. *> Choose random values for IL and IU, and ask for the
  423. *> IL-th through IU-th eigenvalues.
  424. *> \endverbatim
  425. *>
  426. *> \param[out] WA3
  427. *> \verbatim
  428. *> WA3 is DOUBLE PRECISION array of
  429. *> dimension( max(NN) )
  430. *> Selected eigenvalues of A, computed to high
  431. *> absolute accuracy, with different range options.
  432. *> as computed by DSTEBZ.
  433. *> Determine the values VL and VU of the IL-th and IU-th
  434. *> eigenvalues and ask for all eigenvalues in this range.
  435. *> \endverbatim
  436. *>
  437. *> \param[out] WR
  438. *> \verbatim
  439. *> WR is DOUBLE PRECISION array of
  440. *> dimension( max(NN) )
  441. *> All eigenvalues of A, computed to high
  442. *> absolute accuracy, with different options.
  443. *> as computed by DSTEBZ.
  444. *> \endverbatim
  445. *>
  446. *> \param[out] U
  447. *> \verbatim
  448. *> U is DOUBLE PRECISION array of
  449. *> dimension( LDU, max(NN) ).
  450. *> The orthogonal matrix computed by DSYTRD + DORGTR.
  451. *> \endverbatim
  452. *>
  453. *> \param[in] LDU
  454. *> \verbatim
  455. *> LDU is INTEGER
  456. *> The leading dimension of U, Z, and V. It must be at least 1
  457. *> and at least max( NN ).
  458. *> \endverbatim
  459. *>
  460. *> \param[out] V
  461. *> \verbatim
  462. *> V is DOUBLE PRECISION array of
  463. *> dimension( LDU, max(NN) ).
  464. *> The Housholder vectors computed by DSYTRD in reducing A to
  465. *> tridiagonal form. The vectors computed with UPLO='U' are
  466. *> in the upper triangle, and the vectors computed with UPLO='L'
  467. *> are in the lower triangle. (As described in DSYTRD, the
  468. *> sub- and superdiagonal are not set to 1, although the
  469. *> true Householder vector has a 1 in that position. The
  470. *> routines that use V, such as DORGTR, set those entries to
  471. *> 1 before using them, and then restore them later.)
  472. *> \endverbatim
  473. *>
  474. *> \param[out] VP
  475. *> \verbatim
  476. *> VP is DOUBLE PRECISION array of
  477. *> dimension( max(NN)*max(NN+1)/2 )
  478. *> The matrix V stored in packed format.
  479. *> \endverbatim
  480. *>
  481. *> \param[out] TAU
  482. *> \verbatim
  483. *> TAU is DOUBLE PRECISION array of
  484. *> dimension( max(NN) )
  485. *> The Householder factors computed by DSYTRD in reducing A
  486. *> to tridiagonal form.
  487. *> \endverbatim
  488. *>
  489. *> \param[out] Z
  490. *> \verbatim
  491. *> Z is DOUBLE PRECISION array of
  492. *> dimension( LDU, max(NN) ).
  493. *> The orthogonal matrix of eigenvectors computed by DSTEQR,
  494. *> DPTEQR, and DSTEIN.
  495. *> \endverbatim
  496. *>
  497. *> \param[out] WORK
  498. *> \verbatim
  499. *> WORK is DOUBLE PRECISION array of
  500. *> dimension( LWORK )
  501. *> \endverbatim
  502. *>
  503. *> \param[in] LWORK
  504. *> \verbatim
  505. *> LWORK is INTEGER
  506. *> The number of entries in WORK. This must be at least
  507. *> 1 + 4 * Nmax + 2 * Nmax * lg Nmax + 3 * Nmax**2
  508. *> where Nmax = max( NN(j), 2 ) and lg = log base 2.
  509. *> \endverbatim
  510. *>
  511. *> \param[out] IWORK
  512. *> \verbatim
  513. *> IWORK is INTEGER array,
  514. *> Workspace.
  515. *> \endverbatim
  516. *>
  517. *> \param[out] LIWORK
  518. *> \verbatim
  519. *> LIWORK is INTEGER
  520. *> The number of entries in IWORK. This must be at least
  521. *> 6 + 6*Nmax + 5 * Nmax * lg Nmax
  522. *> where Nmax = max( NN(j), 2 ) and lg = log base 2.
  523. *> \endverbatim
  524. *>
  525. *> \param[out] RESULT
  526. *> \verbatim
  527. *> RESULT is DOUBLE PRECISION array, dimension (26)
  528. *> The values computed by the tests described above.
  529. *> The values are currently limited to 1/ulp, to avoid
  530. *> overflow.
  531. *> \endverbatim
  532. *>
  533. *> \param[out] INFO
  534. *> \verbatim
  535. *> INFO is INTEGER
  536. *> If 0, then everything ran OK.
  537. *> -1: NSIZES < 0
  538. *> -2: Some NN(j) < 0
  539. *> -3: NTYPES < 0
  540. *> -5: THRESH < 0
  541. *> -9: LDA < 1 or LDA < NMAX, where NMAX is max( NN(j) ).
  542. *> -23: LDU < 1 or LDU < NMAX.
  543. *> -29: LWORK too small.
  544. *> If DLATMR, SLATMS, DSYTRD, DORGTR, DSTEQR, SSTERF,
  545. *> or DORMC2 returns an error code, the
  546. *> absolute value of it is returned.
  547. *>
  548. *>-----------------------------------------------------------------------
  549. *>
  550. *> Some Local Variables and Parameters:
  551. *> ---- ----- --------- --- ----------
  552. *> ZERO, ONE Real 0 and 1.
  553. *> MAXTYP The number of types defined.
  554. *> NTEST The number of tests performed, or which can
  555. *> be performed so far, for the current matrix.
  556. *> NTESTT The total number of tests performed so far.
  557. *> NBLOCK Blocksize as returned by ENVIR.
  558. *> NMAX Largest value in NN.
  559. *> NMATS The number of matrices generated so far.
  560. *> NERRS The number of tests which have exceeded THRESH
  561. *> so far.
  562. *> COND, IMODE Values to be passed to the matrix generators.
  563. *> ANORM Norm of A; passed to matrix generators.
  564. *>
  565. *> OVFL, UNFL Overflow and underflow thresholds.
  566. *> ULP, ULPINV Finest relative precision and its inverse.
  567. *> RTOVFL, RTUNFL Square roots of the previous 2 values.
  568. *> The following four arrays decode JTYPE:
  569. *> KTYPE(j) The general type (1-10) for type "j".
  570. *> KMODE(j) The MODE value to be passed to the matrix
  571. *> generator for type "j".
  572. *> KMAGN(j) The order of magnitude ( O(1),
  573. *> O(overflow^(1/2) ), O(underflow^(1/2) )
  574. *> \endverbatim
  575. *
  576. * Authors:
  577. * ========
  578. *
  579. *> \author Univ. of Tennessee
  580. *> \author Univ. of California Berkeley
  581. *> \author Univ. of Colorado Denver
  582. *> \author NAG Ltd.
  583. *
  584. *> \ingroup double_eig
  585. *
  586. * =====================================================================
  587. SUBROUTINE DCHKST( NSIZES, NN, NTYPES, DOTYPE, ISEED, THRESH,
  588. $ NOUNIT, A, LDA, AP, SD, SE, D1, D2, D3, D4, D5,
  589. $ WA1, WA2, WA3, WR, U, LDU, V, VP, TAU, Z, WORK,
  590. $ LWORK, IWORK, LIWORK, RESULT, INFO )
  591. *
  592. * -- LAPACK test routine --
  593. * -- LAPACK is a software package provided by Univ. of Tennessee, --
  594. * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  595. *
  596. * .. Scalar Arguments ..
  597. INTEGER INFO, LDA, LDU, LIWORK, LWORK, NOUNIT, NSIZES,
  598. $ NTYPES
  599. DOUBLE PRECISION THRESH
  600. * ..
  601. * .. Array Arguments ..
  602. LOGICAL DOTYPE( * )
  603. INTEGER ISEED( 4 ), IWORK( * ), NN( * )
  604. DOUBLE PRECISION A( LDA, * ), AP( * ), D1( * ), D2( * ),
  605. $ D3( * ), D4( * ), D5( * ), RESULT( * ),
  606. $ SD( * ), SE( * ), TAU( * ), U( LDU, * ),
  607. $ V( LDU, * ), VP( * ), WA1( * ), WA2( * ),
  608. $ WA3( * ), WORK( * ), WR( * ), Z( LDU, * )
  609. * ..
  610. *
  611. * =====================================================================
  612. *
  613. * .. Parameters ..
  614. DOUBLE PRECISION ZERO, ONE, TWO, EIGHT, TEN, HUN
  615. PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0, TWO = 2.0D0,
  616. $ EIGHT = 8.0D0, TEN = 10.0D0, HUN = 100.0D0 )
  617. DOUBLE PRECISION HALF
  618. PARAMETER ( HALF = ONE / TWO )
  619. INTEGER MAXTYP
  620. PARAMETER ( MAXTYP = 21 )
  621. LOGICAL SRANGE
  622. PARAMETER ( SRANGE = .FALSE. )
  623. LOGICAL SREL
  624. PARAMETER ( SREL = .FALSE. )
  625. * ..
  626. * .. Local Scalars ..
  627. LOGICAL BADNN, TRYRAC
  628. INTEGER I, IINFO, IL, IMODE, ITEMP, ITYPE, IU, J, JC,
  629. $ JR, JSIZE, JTYPE, LGN, LIWEDC, LOG2UI, LWEDC,
  630. $ M, M2, M3, MTYPES, N, NAP, NBLOCK, NERRS,
  631. $ NMATS, NMAX, NSPLIT, NTEST, NTESTT
  632. DOUBLE PRECISION ABSTOL, ANINV, ANORM, COND, OVFL, RTOVFL,
  633. $ RTUNFL, TEMP1, TEMP2, TEMP3, TEMP4, ULP,
  634. $ ULPINV, UNFL, VL, VU
  635. * ..
  636. * .. Local Arrays ..
  637. INTEGER IDUMMA( 1 ), IOLDSD( 4 ), ISEED2( 4 ),
  638. $ KMAGN( MAXTYP ), KMODE( MAXTYP ),
  639. $ KTYPE( MAXTYP )
  640. DOUBLE PRECISION DUMMA( 1 )
  641. * ..
  642. * .. External Functions ..
  643. INTEGER ILAENV
  644. DOUBLE PRECISION DLAMCH, DLARND, DSXT1
  645. EXTERNAL ILAENV, DLAMCH, DLARND, DSXT1
  646. * ..
  647. * .. External Subroutines ..
  648. EXTERNAL DCOPY, DLACPY, DLASET, DLASUM, DLATMR, DLATMS,
  649. $ DOPGTR, DORGTR, DPTEQR, DSPT21, DSPTRD, DSTEBZ,
  650. $ DSTECH, DSTEDC, DSTEMR, DSTEIN, DSTEQR, DSTERF,
  651. $ DSTT21, DSTT22, DSYT21, DSYTRD, XERBLA
  652. * ..
  653. * .. Intrinsic Functions ..
  654. INTRINSIC ABS, DBLE, INT, LOG, MAX, MIN, SQRT
  655. * ..
  656. * .. Data statements ..
  657. DATA KTYPE / 1, 2, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 8,
  658. $ 8, 8, 9, 9, 9, 9, 9, 10 /
  659. DATA KMAGN / 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 2, 3, 1,
  660. $ 2, 3, 1, 1, 1, 2, 3, 1 /
  661. DATA KMODE / 0, 0, 4, 3, 1, 4, 4, 4, 3, 1, 4, 4, 0,
  662. $ 0, 0, 4, 3, 1, 4, 4, 3 /
  663. * ..
  664. * .. Executable Statements ..
  665. *
  666. * Keep ftnchek happy
  667. IDUMMA( 1 ) = 1
  668. *
  669. * Check for errors
  670. *
  671. NTESTT = 0
  672. INFO = 0
  673. *
  674. * Important constants
  675. *
  676. BADNN = .FALSE.
  677. TRYRAC = .TRUE.
  678. NMAX = 1
  679. DO 10 J = 1, NSIZES
  680. NMAX = MAX( NMAX, NN( J ) )
  681. IF( NN( J ).LT.0 )
  682. $ BADNN = .TRUE.
  683. 10 CONTINUE
  684. *
  685. NBLOCK = ILAENV( 1, 'DSYTRD', 'L', NMAX, -1, -1, -1 )
  686. NBLOCK = MIN( NMAX, MAX( 1, NBLOCK ) )
  687. *
  688. * Check for errors
  689. *
  690. IF( NSIZES.LT.0 ) THEN
  691. INFO = -1
  692. ELSE IF( BADNN ) THEN
  693. INFO = -2
  694. ELSE IF( NTYPES.LT.0 ) THEN
  695. INFO = -3
  696. ELSE IF( LDA.LT.NMAX ) THEN
  697. INFO = -9
  698. ELSE IF( LDU.LT.NMAX ) THEN
  699. INFO = -23
  700. ELSE IF( 2*MAX( 2, NMAX )**2.GT.LWORK ) THEN
  701. INFO = -29
  702. END IF
  703. *
  704. IF( INFO.NE.0 ) THEN
  705. CALL XERBLA( 'DCHKST', -INFO )
  706. RETURN
  707. END IF
  708. *
  709. * Quick return if possible
  710. *
  711. IF( NSIZES.EQ.0 .OR. NTYPES.EQ.0 )
  712. $ RETURN
  713. *
  714. * More Important constants
  715. *
  716. UNFL = DLAMCH( 'Safe minimum' )
  717. OVFL = ONE / UNFL
  718. ULP = DLAMCH( 'Epsilon' )*DLAMCH( 'Base' )
  719. ULPINV = ONE / ULP
  720. LOG2UI = INT( LOG( ULPINV ) / LOG( TWO ) )
  721. RTUNFL = SQRT( UNFL )
  722. RTOVFL = SQRT( OVFL )
  723. *
  724. * Loop over sizes, types
  725. *
  726. DO 20 I = 1, 4
  727. ISEED2( I ) = ISEED( I )
  728. 20 CONTINUE
  729. NERRS = 0
  730. NMATS = 0
  731. *
  732. DO 310 JSIZE = 1, NSIZES
  733. N = NN( JSIZE )
  734. IF( N.GT.0 ) THEN
  735. LGN = INT( LOG( DBLE( N ) ) / LOG( TWO ) )
  736. IF( 2**LGN.LT.N )
  737. $ LGN = LGN + 1
  738. IF( 2**LGN.LT.N )
  739. $ LGN = LGN + 1
  740. LWEDC = 1 + 4*N + 2*N*LGN + 4*N**2
  741. LIWEDC = 6 + 6*N + 5*N*LGN
  742. ELSE
  743. LWEDC = 8
  744. LIWEDC = 12
  745. END IF
  746. NAP = ( N*( N+1 ) ) / 2
  747. ANINV = ONE / DBLE( MAX( 1, N ) )
  748. *
  749. IF( NSIZES.NE.1 ) THEN
  750. MTYPES = MIN( MAXTYP, NTYPES )
  751. ELSE
  752. MTYPES = MIN( MAXTYP+1, NTYPES )
  753. END IF
  754. *
  755. DO 300 JTYPE = 1, MTYPES
  756. IF( .NOT.DOTYPE( JTYPE ) )
  757. $ GO TO 300
  758. NMATS = NMATS + 1
  759. NTEST = 0
  760. *
  761. DO 30 J = 1, 4
  762. IOLDSD( J ) = ISEED( J )
  763. 30 CONTINUE
  764. *
  765. * Compute "A"
  766. *
  767. * Control parameters:
  768. *
  769. * KMAGN KMODE KTYPE
  770. * =1 O(1) clustered 1 zero
  771. * =2 large clustered 2 identity
  772. * =3 small exponential (none)
  773. * =4 arithmetic diagonal, (w/ eigenvalues)
  774. * =5 random log symmetric, w/ eigenvalues
  775. * =6 random (none)
  776. * =7 random diagonal
  777. * =8 random symmetric
  778. * =9 positive definite
  779. * =10 diagonally dominant tridiagonal
  780. *
  781. IF( MTYPES.GT.MAXTYP )
  782. $ GO TO 100
  783. *
  784. ITYPE = KTYPE( JTYPE )
  785. IMODE = KMODE( JTYPE )
  786. *
  787. * Compute norm
  788. *
  789. GO TO ( 40, 50, 60 )KMAGN( JTYPE )
  790. *
  791. 40 CONTINUE
  792. ANORM = ONE
  793. GO TO 70
  794. *
  795. 50 CONTINUE
  796. ANORM = ( RTOVFL*ULP )*ANINV
  797. GO TO 70
  798. *
  799. 60 CONTINUE
  800. ANORM = RTUNFL*N*ULPINV
  801. GO TO 70
  802. *
  803. 70 CONTINUE
  804. *
  805. CALL DLASET( 'Full', LDA, N, ZERO, ZERO, A, LDA )
  806. IINFO = 0
  807. IF( JTYPE.LE.15 ) THEN
  808. COND = ULPINV
  809. ELSE
  810. COND = ULPINV*ANINV / TEN
  811. END IF
  812. *
  813. * Special Matrices -- Identity & Jordan block
  814. *
  815. * Zero
  816. *
  817. IF( ITYPE.EQ.1 ) THEN
  818. IINFO = 0
  819. *
  820. ELSE IF( ITYPE.EQ.2 ) THEN
  821. *
  822. * Identity
  823. *
  824. DO 80 JC = 1, N
  825. A( JC, JC ) = ANORM
  826. 80 CONTINUE
  827. *
  828. ELSE IF( ITYPE.EQ.4 ) THEN
  829. *
  830. * Diagonal Matrix, [Eigen]values Specified
  831. *
  832. CALL DLATMS( N, N, 'S', ISEED, 'S', WORK, IMODE, COND,
  833. $ ANORM, 0, 0, 'N', A, LDA, WORK( N+1 ),
  834. $ IINFO )
  835. *
  836. *
  837. ELSE IF( ITYPE.EQ.5 ) THEN
  838. *
  839. * Symmetric, eigenvalues specified
  840. *
  841. CALL DLATMS( N, N, 'S', ISEED, 'S', WORK, IMODE, COND,
  842. $ ANORM, N, N, 'N', A, LDA, WORK( N+1 ),
  843. $ IINFO )
  844. *
  845. ELSE IF( ITYPE.EQ.7 ) THEN
  846. *
  847. * Diagonal, random eigenvalues
  848. *
  849. CALL DLATMR( N, N, 'S', ISEED, 'S', WORK, 6, ONE, ONE,
  850. $ 'T', 'N', WORK( N+1 ), 1, ONE,
  851. $ WORK( 2*N+1 ), 1, ONE, 'N', IDUMMA, 0, 0,
  852. $ ZERO, ANORM, 'NO', A, LDA, IWORK, IINFO )
  853. *
  854. ELSE IF( ITYPE.EQ.8 ) THEN
  855. *
  856. * Symmetric, random eigenvalues
  857. *
  858. CALL DLATMR( N, N, 'S', ISEED, 'S', WORK, 6, ONE, ONE,
  859. $ 'T', 'N', WORK( N+1 ), 1, ONE,
  860. $ WORK( 2*N+1 ), 1, ONE, 'N', IDUMMA, N, N,
  861. $ ZERO, ANORM, 'NO', A, LDA, IWORK, IINFO )
  862. *
  863. ELSE IF( ITYPE.EQ.9 ) THEN
  864. *
  865. * Positive definite, eigenvalues specified.
  866. *
  867. CALL DLATMS( N, N, 'S', ISEED, 'P', WORK, IMODE, COND,
  868. $ ANORM, N, N, 'N', A, LDA, WORK( N+1 ),
  869. $ IINFO )
  870. *
  871. ELSE IF( ITYPE.EQ.10 ) THEN
  872. *
  873. * Positive definite tridiagonal, eigenvalues specified.
  874. *
  875. CALL DLATMS( N, N, 'S', ISEED, 'P', WORK, IMODE, COND,
  876. $ ANORM, 1, 1, 'N', A, LDA, WORK( N+1 ),
  877. $ IINFO )
  878. DO 90 I = 2, N
  879. TEMP1 = ABS( A( I-1, I ) ) /
  880. $ SQRT( ABS( A( I-1, I-1 )*A( I, I ) ) )
  881. IF( TEMP1.GT.HALF ) THEN
  882. A( I-1, I ) = HALF*SQRT( ABS( A( I-1, I-1 )*A( I,
  883. $ I ) ) )
  884. A( I, I-1 ) = A( I-1, I )
  885. END IF
  886. 90 CONTINUE
  887. *
  888. ELSE
  889. *
  890. IINFO = 1
  891. END IF
  892. *
  893. IF( IINFO.NE.0 ) THEN
  894. WRITE( NOUNIT, FMT = 9999 )'Generator', IINFO, N, JTYPE,
  895. $ IOLDSD
  896. INFO = ABS( IINFO )
  897. RETURN
  898. END IF
  899. *
  900. 100 CONTINUE
  901. *
  902. * Call DSYTRD and DORGTR to compute S and U from
  903. * upper triangle.
  904. *
  905. CALL DLACPY( 'U', N, N, A, LDA, V, LDU )
  906. *
  907. NTEST = 1
  908. CALL DSYTRD( 'U', N, V, LDU, SD, SE, TAU, WORK, LWORK,
  909. $ IINFO )
  910. *
  911. IF( IINFO.NE.0 ) THEN
  912. WRITE( NOUNIT, FMT = 9999 )'DSYTRD(U)', IINFO, N, JTYPE,
  913. $ IOLDSD
  914. INFO = ABS( IINFO )
  915. IF( IINFO.LT.0 ) THEN
  916. RETURN
  917. ELSE
  918. RESULT( 1 ) = ULPINV
  919. GO TO 280
  920. END IF
  921. END IF
  922. *
  923. CALL DLACPY( 'U', N, N, V, LDU, U, LDU )
  924. *
  925. NTEST = 2
  926. CALL DORGTR( 'U', N, U, LDU, TAU, WORK, LWORK, IINFO )
  927. IF( IINFO.NE.0 ) THEN
  928. WRITE( NOUNIT, FMT = 9999 )'DORGTR(U)', IINFO, N, JTYPE,
  929. $ IOLDSD
  930. INFO = ABS( IINFO )
  931. IF( IINFO.LT.0 ) THEN
  932. RETURN
  933. ELSE
  934. RESULT( 2 ) = ULPINV
  935. GO TO 280
  936. END IF
  937. END IF
  938. *
  939. * Do tests 1 and 2
  940. *
  941. CALL DSYT21( 2, 'Upper', N, 1, A, LDA, SD, SE, U, LDU, V,
  942. $ LDU, TAU, WORK, RESULT( 1 ) )
  943. CALL DSYT21( 3, 'Upper', N, 1, A, LDA, SD, SE, U, LDU, V,
  944. $ LDU, TAU, WORK, RESULT( 2 ) )
  945. *
  946. * Call DSYTRD and DORGTR to compute S and U from
  947. * lower triangle, do tests.
  948. *
  949. CALL DLACPY( 'L', N, N, A, LDA, V, LDU )
  950. *
  951. NTEST = 3
  952. CALL DSYTRD( 'L', N, V, LDU, SD, SE, TAU, WORK, LWORK,
  953. $ IINFO )
  954. *
  955. IF( IINFO.NE.0 ) THEN
  956. WRITE( NOUNIT, FMT = 9999 )'DSYTRD(L)', IINFO, N, JTYPE,
  957. $ IOLDSD
  958. INFO = ABS( IINFO )
  959. IF( IINFO.LT.0 ) THEN
  960. RETURN
  961. ELSE
  962. RESULT( 3 ) = ULPINV
  963. GO TO 280
  964. END IF
  965. END IF
  966. *
  967. CALL DLACPY( 'L', N, N, V, LDU, U, LDU )
  968. *
  969. NTEST = 4
  970. CALL DORGTR( 'L', N, U, LDU, TAU, WORK, LWORK, IINFO )
  971. IF( IINFO.NE.0 ) THEN
  972. WRITE( NOUNIT, FMT = 9999 )'DORGTR(L)', IINFO, N, JTYPE,
  973. $ IOLDSD
  974. INFO = ABS( IINFO )
  975. IF( IINFO.LT.0 ) THEN
  976. RETURN
  977. ELSE
  978. RESULT( 4 ) = ULPINV
  979. GO TO 280
  980. END IF
  981. END IF
  982. *
  983. CALL DSYT21( 2, 'Lower', N, 1, A, LDA, SD, SE, U, LDU, V,
  984. $ LDU, TAU, WORK, RESULT( 3 ) )
  985. CALL DSYT21( 3, 'Lower', N, 1, A, LDA, SD, SE, U, LDU, V,
  986. $ LDU, TAU, WORK, RESULT( 4 ) )
  987. *
  988. * Store the upper triangle of A in AP
  989. *
  990. I = 0
  991. DO 120 JC = 1, N
  992. DO 110 JR = 1, JC
  993. I = I + 1
  994. AP( I ) = A( JR, JC )
  995. 110 CONTINUE
  996. 120 CONTINUE
  997. *
  998. * Call DSPTRD and DOPGTR to compute S and U from AP
  999. *
  1000. CALL DCOPY( NAP, AP, 1, VP, 1 )
  1001. *
  1002. NTEST = 5
  1003. CALL DSPTRD( 'U', N, VP, SD, SE, TAU, IINFO )
  1004. *
  1005. IF( IINFO.NE.0 ) THEN
  1006. WRITE( NOUNIT, FMT = 9999 )'DSPTRD(U)', IINFO, N, JTYPE,
  1007. $ IOLDSD
  1008. INFO = ABS( IINFO )
  1009. IF( IINFO.LT.0 ) THEN
  1010. RETURN
  1011. ELSE
  1012. RESULT( 5 ) = ULPINV
  1013. GO TO 280
  1014. END IF
  1015. END IF
  1016. *
  1017. NTEST = 6
  1018. CALL DOPGTR( 'U', N, VP, TAU, U, LDU, WORK, IINFO )
  1019. IF( IINFO.NE.0 ) THEN
  1020. WRITE( NOUNIT, FMT = 9999 )'DOPGTR(U)', IINFO, N, JTYPE,
  1021. $ IOLDSD
  1022. INFO = ABS( IINFO )
  1023. IF( IINFO.LT.0 ) THEN
  1024. RETURN
  1025. ELSE
  1026. RESULT( 6 ) = ULPINV
  1027. GO TO 280
  1028. END IF
  1029. END IF
  1030. *
  1031. * Do tests 5 and 6
  1032. *
  1033. CALL DSPT21( 2, 'Upper', N, 1, AP, SD, SE, U, LDU, VP, TAU,
  1034. $ WORK, RESULT( 5 ) )
  1035. CALL DSPT21( 3, 'Upper', N, 1, AP, SD, SE, U, LDU, VP, TAU,
  1036. $ WORK, RESULT( 6 ) )
  1037. *
  1038. * Store the lower triangle of A in AP
  1039. *
  1040. I = 0
  1041. DO 140 JC = 1, N
  1042. DO 130 JR = JC, N
  1043. I = I + 1
  1044. AP( I ) = A( JR, JC )
  1045. 130 CONTINUE
  1046. 140 CONTINUE
  1047. *
  1048. * Call DSPTRD and DOPGTR to compute S and U from AP
  1049. *
  1050. CALL DCOPY( NAP, AP, 1, VP, 1 )
  1051. *
  1052. NTEST = 7
  1053. CALL DSPTRD( 'L', N, VP, SD, SE, TAU, IINFO )
  1054. *
  1055. IF( IINFO.NE.0 ) THEN
  1056. WRITE( NOUNIT, FMT = 9999 )'DSPTRD(L)', IINFO, N, JTYPE,
  1057. $ IOLDSD
  1058. INFO = ABS( IINFO )
  1059. IF( IINFO.LT.0 ) THEN
  1060. RETURN
  1061. ELSE
  1062. RESULT( 7 ) = ULPINV
  1063. GO TO 280
  1064. END IF
  1065. END IF
  1066. *
  1067. NTEST = 8
  1068. CALL DOPGTR( 'L', N, VP, TAU, U, LDU, WORK, IINFO )
  1069. IF( IINFO.NE.0 ) THEN
  1070. WRITE( NOUNIT, FMT = 9999 )'DOPGTR(L)', IINFO, N, JTYPE,
  1071. $ IOLDSD
  1072. INFO = ABS( IINFO )
  1073. IF( IINFO.LT.0 ) THEN
  1074. RETURN
  1075. ELSE
  1076. RESULT( 8 ) = ULPINV
  1077. GO TO 280
  1078. END IF
  1079. END IF
  1080. *
  1081. CALL DSPT21( 2, 'Lower', N, 1, AP, SD, SE, U, LDU, VP, TAU,
  1082. $ WORK, RESULT( 7 ) )
  1083. CALL DSPT21( 3, 'Lower', N, 1, AP, SD, SE, U, LDU, VP, TAU,
  1084. $ WORK, RESULT( 8 ) )
  1085. *
  1086. * Call DSTEQR to compute D1, D2, and Z, do tests.
  1087. *
  1088. * Compute D1 and Z
  1089. *
  1090. CALL DCOPY( N, SD, 1, D1, 1 )
  1091. IF( N.GT.0 )
  1092. $ CALL DCOPY( N-1, SE, 1, WORK, 1 )
  1093. CALL DLASET( 'Full', N, N, ZERO, ONE, Z, LDU )
  1094. *
  1095. NTEST = 9
  1096. CALL DSTEQR( 'V', N, D1, WORK, Z, LDU, WORK( N+1 ), IINFO )
  1097. IF( IINFO.NE.0 ) THEN
  1098. WRITE( NOUNIT, FMT = 9999 )'DSTEQR(V)', IINFO, N, JTYPE,
  1099. $ IOLDSD
  1100. INFO = ABS( IINFO )
  1101. IF( IINFO.LT.0 ) THEN
  1102. RETURN
  1103. ELSE
  1104. RESULT( 9 ) = ULPINV
  1105. GO TO 280
  1106. END IF
  1107. END IF
  1108. *
  1109. * Compute D2
  1110. *
  1111. CALL DCOPY( N, SD, 1, D2, 1 )
  1112. IF( N.GT.0 )
  1113. $ CALL DCOPY( N-1, SE, 1, WORK, 1 )
  1114. *
  1115. NTEST = 11
  1116. CALL DSTEQR( 'N', N, D2, WORK, WORK( N+1 ), LDU,
  1117. $ WORK( N+1 ), IINFO )
  1118. IF( IINFO.NE.0 ) THEN
  1119. WRITE( NOUNIT, FMT = 9999 )'DSTEQR(N)', IINFO, N, JTYPE,
  1120. $ IOLDSD
  1121. INFO = ABS( IINFO )
  1122. IF( IINFO.LT.0 ) THEN
  1123. RETURN
  1124. ELSE
  1125. RESULT( 11 ) = ULPINV
  1126. GO TO 280
  1127. END IF
  1128. END IF
  1129. *
  1130. * Compute D3 (using PWK method)
  1131. *
  1132. CALL DCOPY( N, SD, 1, D3, 1 )
  1133. IF( N.GT.0 )
  1134. $ CALL DCOPY( N-1, SE, 1, WORK, 1 )
  1135. *
  1136. NTEST = 12
  1137. CALL DSTERF( N, D3, WORK, IINFO )
  1138. IF( IINFO.NE.0 ) THEN
  1139. WRITE( NOUNIT, FMT = 9999 )'DSTERF', IINFO, N, JTYPE,
  1140. $ IOLDSD
  1141. INFO = ABS( IINFO )
  1142. IF( IINFO.LT.0 ) THEN
  1143. RETURN
  1144. ELSE
  1145. RESULT( 12 ) = ULPINV
  1146. GO TO 280
  1147. END IF
  1148. END IF
  1149. *
  1150. * Do Tests 9 and 10
  1151. *
  1152. CALL DSTT21( N, 0, SD, SE, D1, DUMMA, Z, LDU, WORK,
  1153. $ RESULT( 9 ) )
  1154. *
  1155. * Do Tests 11 and 12
  1156. *
  1157. TEMP1 = ZERO
  1158. TEMP2 = ZERO
  1159. TEMP3 = ZERO
  1160. TEMP4 = ZERO
  1161. *
  1162. DO 150 J = 1, N
  1163. TEMP1 = MAX( TEMP1, ABS( D1( J ) ), ABS( D2( J ) ) )
  1164. TEMP2 = MAX( TEMP2, ABS( D1( J )-D2( J ) ) )
  1165. TEMP3 = MAX( TEMP3, ABS( D1( J ) ), ABS( D3( J ) ) )
  1166. TEMP4 = MAX( TEMP4, ABS( D1( J )-D3( J ) ) )
  1167. 150 CONTINUE
  1168. *
  1169. RESULT( 11 ) = TEMP2 / MAX( UNFL, ULP*MAX( TEMP1, TEMP2 ) )
  1170. RESULT( 12 ) = TEMP4 / MAX( UNFL, ULP*MAX( TEMP3, TEMP4 ) )
  1171. *
  1172. * Do Test 13 -- Sturm Sequence Test of Eigenvalues
  1173. * Go up by factors of two until it succeeds
  1174. *
  1175. NTEST = 13
  1176. TEMP1 = THRESH*( HALF-ULP )
  1177. *
  1178. DO 160 J = 0, LOG2UI
  1179. CALL DSTECH( N, SD, SE, D1, TEMP1, WORK, IINFO )
  1180. IF( IINFO.EQ.0 )
  1181. $ GO TO 170
  1182. TEMP1 = TEMP1*TWO
  1183. 160 CONTINUE
  1184. *
  1185. 170 CONTINUE
  1186. RESULT( 13 ) = TEMP1
  1187. *
  1188. * For positive definite matrices ( JTYPE.GT.15 ) call DPTEQR
  1189. * and do tests 14, 15, and 16 .
  1190. *
  1191. IF( JTYPE.GT.15 ) THEN
  1192. *
  1193. * Compute D4 and Z4
  1194. *
  1195. CALL DCOPY( N, SD, 1, D4, 1 )
  1196. IF( N.GT.0 )
  1197. $ CALL DCOPY( N-1, SE, 1, WORK, 1 )
  1198. CALL DLASET( 'Full', N, N, ZERO, ONE, Z, LDU )
  1199. *
  1200. NTEST = 14
  1201. CALL DPTEQR( 'V', N, D4, WORK, Z, LDU, WORK( N+1 ),
  1202. $ IINFO )
  1203. IF( IINFO.NE.0 ) THEN
  1204. WRITE( NOUNIT, FMT = 9999 )'DPTEQR(V)', IINFO, N,
  1205. $ JTYPE, IOLDSD
  1206. INFO = ABS( IINFO )
  1207. IF( IINFO.LT.0 ) THEN
  1208. RETURN
  1209. ELSE
  1210. RESULT( 14 ) = ULPINV
  1211. GO TO 280
  1212. END IF
  1213. END IF
  1214. *
  1215. * Do Tests 14 and 15
  1216. *
  1217. CALL DSTT21( N, 0, SD, SE, D4, DUMMA, Z, LDU, WORK,
  1218. $ RESULT( 14 ) )
  1219. *
  1220. * Compute D5
  1221. *
  1222. CALL DCOPY( N, SD, 1, D5, 1 )
  1223. IF( N.GT.0 )
  1224. $ CALL DCOPY( N-1, SE, 1, WORK, 1 )
  1225. *
  1226. NTEST = 16
  1227. CALL DPTEQR( 'N', N, D5, WORK, Z, LDU, WORK( N+1 ),
  1228. $ IINFO )
  1229. IF( IINFO.NE.0 ) THEN
  1230. WRITE( NOUNIT, FMT = 9999 )'DPTEQR(N)', IINFO, N,
  1231. $ JTYPE, IOLDSD
  1232. INFO = ABS( IINFO )
  1233. IF( IINFO.LT.0 ) THEN
  1234. RETURN
  1235. ELSE
  1236. RESULT( 16 ) = ULPINV
  1237. GO TO 280
  1238. END IF
  1239. END IF
  1240. *
  1241. * Do Test 16
  1242. *
  1243. TEMP1 = ZERO
  1244. TEMP2 = ZERO
  1245. DO 180 J = 1, N
  1246. TEMP1 = MAX( TEMP1, ABS( D4( J ) ), ABS( D5( J ) ) )
  1247. TEMP2 = MAX( TEMP2, ABS( D4( J )-D5( J ) ) )
  1248. 180 CONTINUE
  1249. *
  1250. RESULT( 16 ) = TEMP2 / MAX( UNFL,
  1251. $ HUN*ULP*MAX( TEMP1, TEMP2 ) )
  1252. ELSE
  1253. RESULT( 14 ) = ZERO
  1254. RESULT( 15 ) = ZERO
  1255. RESULT( 16 ) = ZERO
  1256. END IF
  1257. *
  1258. * Call DSTEBZ with different options and do tests 17-18.
  1259. *
  1260. * If S is positive definite and diagonally dominant,
  1261. * ask for all eigenvalues with high relative accuracy.
  1262. *
  1263. VL = ZERO
  1264. VU = ZERO
  1265. IL = 0
  1266. IU = 0
  1267. IF( JTYPE.EQ.21 ) THEN
  1268. NTEST = 17
  1269. ABSTOL = UNFL + UNFL
  1270. CALL DSTEBZ( 'A', 'E', N, VL, VU, IL, IU, ABSTOL, SD, SE,
  1271. $ M, NSPLIT, WR, IWORK( 1 ), IWORK( N+1 ),
  1272. $ WORK, IWORK( 2*N+1 ), IINFO )
  1273. IF( IINFO.NE.0 ) THEN
  1274. WRITE( NOUNIT, FMT = 9999 )'DSTEBZ(A,rel)', IINFO, N,
  1275. $ JTYPE, IOLDSD
  1276. INFO = ABS( IINFO )
  1277. IF( IINFO.LT.0 ) THEN
  1278. RETURN
  1279. ELSE
  1280. RESULT( 17 ) = ULPINV
  1281. GO TO 280
  1282. END IF
  1283. END IF
  1284. *
  1285. * Do test 17
  1286. *
  1287. TEMP2 = TWO*( TWO*N-ONE )*ULP*( ONE+EIGHT*HALF**2 ) /
  1288. $ ( ONE-HALF )**4
  1289. *
  1290. TEMP1 = ZERO
  1291. DO 190 J = 1, N
  1292. TEMP1 = MAX( TEMP1, ABS( D4( J )-WR( N-J+1 ) ) /
  1293. $ ( ABSTOL+ABS( D4( J ) ) ) )
  1294. 190 CONTINUE
  1295. *
  1296. RESULT( 17 ) = TEMP1 / TEMP2
  1297. ELSE
  1298. RESULT( 17 ) = ZERO
  1299. END IF
  1300. *
  1301. * Now ask for all eigenvalues with high absolute accuracy.
  1302. *
  1303. NTEST = 18
  1304. ABSTOL = UNFL + UNFL
  1305. CALL DSTEBZ( 'A', 'E', N, VL, VU, IL, IU, ABSTOL, SD, SE, M,
  1306. $ NSPLIT, WA1, IWORK( 1 ), IWORK( N+1 ), WORK,
  1307. $ IWORK( 2*N+1 ), IINFO )
  1308. IF( IINFO.NE.0 ) THEN
  1309. WRITE( NOUNIT, FMT = 9999 )'DSTEBZ(A)', IINFO, N, JTYPE,
  1310. $ IOLDSD
  1311. INFO = ABS( IINFO )
  1312. IF( IINFO.LT.0 ) THEN
  1313. RETURN
  1314. ELSE
  1315. RESULT( 18 ) = ULPINV
  1316. GO TO 280
  1317. END IF
  1318. END IF
  1319. *
  1320. * Do test 18
  1321. *
  1322. TEMP1 = ZERO
  1323. TEMP2 = ZERO
  1324. DO 200 J = 1, N
  1325. TEMP1 = MAX( TEMP1, ABS( D3( J ) ), ABS( WA1( J ) ) )
  1326. TEMP2 = MAX( TEMP2, ABS( D3( J )-WA1( J ) ) )
  1327. 200 CONTINUE
  1328. *
  1329. RESULT( 18 ) = TEMP2 / MAX( UNFL, ULP*MAX( TEMP1, TEMP2 ) )
  1330. *
  1331. * Choose random values for IL and IU, and ask for the
  1332. * IL-th through IU-th eigenvalues.
  1333. *
  1334. NTEST = 19
  1335. IF( N.LE.1 ) THEN
  1336. IL = 1
  1337. IU = N
  1338. ELSE
  1339. IL = 1 + ( N-1 )*INT( DLARND( 1, ISEED2 ) )
  1340. IU = 1 + ( N-1 )*INT( DLARND( 1, ISEED2 ) )
  1341. IF( IU.LT.IL ) THEN
  1342. ITEMP = IU
  1343. IU = IL
  1344. IL = ITEMP
  1345. END IF
  1346. END IF
  1347. *
  1348. CALL DSTEBZ( 'I', 'E', N, VL, VU, IL, IU, ABSTOL, SD, SE,
  1349. $ M2, NSPLIT, WA2, IWORK( 1 ), IWORK( N+1 ),
  1350. $ WORK, IWORK( 2*N+1 ), IINFO )
  1351. IF( IINFO.NE.0 ) THEN
  1352. WRITE( NOUNIT, FMT = 9999 )'DSTEBZ(I)', IINFO, N, JTYPE,
  1353. $ IOLDSD
  1354. INFO = ABS( IINFO )
  1355. IF( IINFO.LT.0 ) THEN
  1356. RETURN
  1357. ELSE
  1358. RESULT( 19 ) = ULPINV
  1359. GO TO 280
  1360. END IF
  1361. END IF
  1362. *
  1363. * Determine the values VL and VU of the IL-th and IU-th
  1364. * eigenvalues and ask for all eigenvalues in this range.
  1365. *
  1366. IF( N.GT.0 ) THEN
  1367. IF( IL.NE.1 ) THEN
  1368. VL = WA1( IL ) - MAX( HALF*( WA1( IL )-WA1( IL-1 ) ),
  1369. $ ULP*ANORM, TWO*RTUNFL )
  1370. ELSE
  1371. VL = WA1( 1 ) - MAX( HALF*( WA1( N )-WA1( 1 ) ),
  1372. $ ULP*ANORM, TWO*RTUNFL )
  1373. END IF
  1374. IF( IU.NE.N ) THEN
  1375. VU = WA1( IU ) + MAX( HALF*( WA1( IU+1 )-WA1( IU ) ),
  1376. $ ULP*ANORM, TWO*RTUNFL )
  1377. ELSE
  1378. VU = WA1( N ) + MAX( HALF*( WA1( N )-WA1( 1 ) ),
  1379. $ ULP*ANORM, TWO*RTUNFL )
  1380. END IF
  1381. ELSE
  1382. VL = ZERO
  1383. VU = ONE
  1384. END IF
  1385. *
  1386. CALL DSTEBZ( 'V', 'E', N, VL, VU, IL, IU, ABSTOL, SD, SE,
  1387. $ M3, NSPLIT, WA3, IWORK( 1 ), IWORK( N+1 ),
  1388. $ WORK, IWORK( 2*N+1 ), IINFO )
  1389. IF( IINFO.NE.0 ) THEN
  1390. WRITE( NOUNIT, FMT = 9999 )'DSTEBZ(V)', IINFO, N, JTYPE,
  1391. $ IOLDSD
  1392. INFO = ABS( IINFO )
  1393. IF( IINFO.LT.0 ) THEN
  1394. RETURN
  1395. ELSE
  1396. RESULT( 19 ) = ULPINV
  1397. GO TO 280
  1398. END IF
  1399. END IF
  1400. *
  1401. IF( M3.EQ.0 .AND. N.NE.0 ) THEN
  1402. RESULT( 19 ) = ULPINV
  1403. GO TO 280
  1404. END IF
  1405. *
  1406. * Do test 19
  1407. *
  1408. TEMP1 = DSXT1( 1, WA2, M2, WA3, M3, ABSTOL, ULP, UNFL )
  1409. TEMP2 = DSXT1( 1, WA3, M3, WA2, M2, ABSTOL, ULP, UNFL )
  1410. IF( N.GT.0 ) THEN
  1411. TEMP3 = MAX( ABS( WA1( N ) ), ABS( WA1( 1 ) ) )
  1412. ELSE
  1413. TEMP3 = ZERO
  1414. END IF
  1415. *
  1416. RESULT( 19 ) = ( TEMP1+TEMP2 ) / MAX( UNFL, TEMP3*ULP )
  1417. *
  1418. * Call DSTEIN to compute eigenvectors corresponding to
  1419. * eigenvalues in WA1. (First call DSTEBZ again, to make sure
  1420. * it returns these eigenvalues in the correct order.)
  1421. *
  1422. NTEST = 21
  1423. CALL DSTEBZ( 'A', 'B', N, VL, VU, IL, IU, ABSTOL, SD, SE, M,
  1424. $ NSPLIT, WA1, IWORK( 1 ), IWORK( N+1 ), WORK,
  1425. $ IWORK( 2*N+1 ), IINFO )
  1426. IF( IINFO.NE.0 ) THEN
  1427. WRITE( NOUNIT, FMT = 9999 )'DSTEBZ(A,B)', IINFO, N,
  1428. $ JTYPE, IOLDSD
  1429. INFO = ABS( IINFO )
  1430. IF( IINFO.LT.0 ) THEN
  1431. RETURN
  1432. ELSE
  1433. RESULT( 20 ) = ULPINV
  1434. RESULT( 21 ) = ULPINV
  1435. GO TO 280
  1436. END IF
  1437. END IF
  1438. *
  1439. CALL DSTEIN( N, SD, SE, M, WA1, IWORK( 1 ), IWORK( N+1 ), Z,
  1440. $ LDU, WORK, IWORK( 2*N+1 ), IWORK( 3*N+1 ),
  1441. $ IINFO )
  1442. IF( IINFO.NE.0 ) THEN
  1443. WRITE( NOUNIT, FMT = 9999 )'DSTEIN', IINFO, N, JTYPE,
  1444. $ IOLDSD
  1445. INFO = ABS( IINFO )
  1446. IF( IINFO.LT.0 ) THEN
  1447. RETURN
  1448. ELSE
  1449. RESULT( 20 ) = ULPINV
  1450. RESULT( 21 ) = ULPINV
  1451. GO TO 280
  1452. END IF
  1453. END IF
  1454. *
  1455. * Do tests 20 and 21
  1456. *
  1457. CALL DSTT21( N, 0, SD, SE, WA1, DUMMA, Z, LDU, WORK,
  1458. $ RESULT( 20 ) )
  1459. *
  1460. * Call DSTEDC(I) to compute D1 and Z, do tests.
  1461. *
  1462. * Compute D1 and Z
  1463. *
  1464. CALL DCOPY( N, SD, 1, D1, 1 )
  1465. IF( N.GT.0 )
  1466. $ CALL DCOPY( N-1, SE, 1, WORK, 1 )
  1467. CALL DLASET( 'Full', N, N, ZERO, ONE, Z, LDU )
  1468. *
  1469. NTEST = 22
  1470. CALL DSTEDC( 'I', N, D1, WORK, Z, LDU, WORK( N+1 ), LWEDC-N,
  1471. $ IWORK, LIWEDC, IINFO )
  1472. IF( IINFO.NE.0 ) THEN
  1473. WRITE( NOUNIT, FMT = 9999 )'DSTEDC(I)', IINFO, N, JTYPE,
  1474. $ IOLDSD
  1475. INFO = ABS( IINFO )
  1476. IF( IINFO.LT.0 ) THEN
  1477. RETURN
  1478. ELSE
  1479. RESULT( 22 ) = ULPINV
  1480. GO TO 280
  1481. END IF
  1482. END IF
  1483. *
  1484. * Do Tests 22 and 23
  1485. *
  1486. CALL DSTT21( N, 0, SD, SE, D1, DUMMA, Z, LDU, WORK,
  1487. $ RESULT( 22 ) )
  1488. *
  1489. * Call DSTEDC(V) to compute D1 and Z, do tests.
  1490. *
  1491. * Compute D1 and Z
  1492. *
  1493. CALL DCOPY( N, SD, 1, D1, 1 )
  1494. IF( N.GT.0 )
  1495. $ CALL DCOPY( N-1, SE, 1, WORK, 1 )
  1496. CALL DLASET( 'Full', N, N, ZERO, ONE, Z, LDU )
  1497. *
  1498. NTEST = 24
  1499. CALL DSTEDC( 'V', N, D1, WORK, Z, LDU, WORK( N+1 ), LWEDC-N,
  1500. $ IWORK, LIWEDC, IINFO )
  1501. IF( IINFO.NE.0 ) THEN
  1502. WRITE( NOUNIT, FMT = 9999 )'DSTEDC(V)', IINFO, N, JTYPE,
  1503. $ IOLDSD
  1504. INFO = ABS( IINFO )
  1505. IF( IINFO.LT.0 ) THEN
  1506. RETURN
  1507. ELSE
  1508. RESULT( 24 ) = ULPINV
  1509. GO TO 280
  1510. END IF
  1511. END IF
  1512. *
  1513. * Do Tests 24 and 25
  1514. *
  1515. CALL DSTT21( N, 0, SD, SE, D1, DUMMA, Z, LDU, WORK,
  1516. $ RESULT( 24 ) )
  1517. *
  1518. * Call DSTEDC(N) to compute D2, do tests.
  1519. *
  1520. * Compute D2
  1521. *
  1522. CALL DCOPY( N, SD, 1, D2, 1 )
  1523. IF( N.GT.0 )
  1524. $ CALL DCOPY( N-1, SE, 1, WORK, 1 )
  1525. CALL DLASET( 'Full', N, N, ZERO, ONE, Z, LDU )
  1526. *
  1527. NTEST = 26
  1528. CALL DSTEDC( 'N', N, D2, WORK, Z, LDU, WORK( N+1 ), LWEDC-N,
  1529. $ IWORK, LIWEDC, IINFO )
  1530. IF( IINFO.NE.0 ) THEN
  1531. WRITE( NOUNIT, FMT = 9999 )'DSTEDC(N)', IINFO, N, JTYPE,
  1532. $ IOLDSD
  1533. INFO = ABS( IINFO )
  1534. IF( IINFO.LT.0 ) THEN
  1535. RETURN
  1536. ELSE
  1537. RESULT( 26 ) = ULPINV
  1538. GO TO 280
  1539. END IF
  1540. END IF
  1541. *
  1542. * Do Test 26
  1543. *
  1544. TEMP1 = ZERO
  1545. TEMP2 = ZERO
  1546. *
  1547. DO 210 J = 1, N
  1548. TEMP1 = MAX( TEMP1, ABS( D1( J ) ), ABS( D2( J ) ) )
  1549. TEMP2 = MAX( TEMP2, ABS( D1( J )-D2( J ) ) )
  1550. 210 CONTINUE
  1551. *
  1552. RESULT( 26 ) = TEMP2 / MAX( UNFL, ULP*MAX( TEMP1, TEMP2 ) )
  1553. *
  1554. * Only test DSTEMR if IEEE compliant
  1555. *
  1556. IF( ILAENV( 10, 'DSTEMR', 'VA', 1, 0, 0, 0 ).EQ.1 .AND.
  1557. $ ILAENV( 11, 'DSTEMR', 'VA', 1, 0, 0, 0 ).EQ.1 ) THEN
  1558. *
  1559. * Call DSTEMR, do test 27 (relative eigenvalue accuracy)
  1560. *
  1561. * If S is positive definite and diagonally dominant,
  1562. * ask for all eigenvalues with high relative accuracy.
  1563. *
  1564. VL = ZERO
  1565. VU = ZERO
  1566. IL = 0
  1567. IU = 0
  1568. IF( JTYPE.EQ.21 .AND. SREL ) THEN
  1569. NTEST = 27
  1570. ABSTOL = UNFL + UNFL
  1571. CALL DSTEMR( 'V', 'A', N, SD, SE, VL, VU, IL, IU,
  1572. $ M, WR, Z, LDU, N, IWORK( 1 ), TRYRAC,
  1573. $ WORK, LWORK, IWORK( 2*N+1 ), LWORK-2*N,
  1574. $ IINFO )
  1575. IF( IINFO.NE.0 ) THEN
  1576. WRITE( NOUNIT, FMT = 9999 )'DSTEMR(V,A,rel)',
  1577. $ IINFO, N, JTYPE, IOLDSD
  1578. INFO = ABS( IINFO )
  1579. IF( IINFO.LT.0 ) THEN
  1580. RETURN
  1581. ELSE
  1582. RESULT( 27 ) = ULPINV
  1583. GO TO 270
  1584. END IF
  1585. END IF
  1586. *
  1587. * Do test 27
  1588. *
  1589. TEMP2 = TWO*( TWO*N-ONE )*ULP*( ONE+EIGHT*HALF**2 ) /
  1590. $ ( ONE-HALF )**4
  1591. *
  1592. TEMP1 = ZERO
  1593. DO 220 J = 1, N
  1594. TEMP1 = MAX( TEMP1, ABS( D4( J )-WR( N-J+1 ) ) /
  1595. $ ( ABSTOL+ABS( D4( J ) ) ) )
  1596. 220 CONTINUE
  1597. *
  1598. RESULT( 27 ) = TEMP1 / TEMP2
  1599. *
  1600. IL = 1 + ( N-1 )*INT( DLARND( 1, ISEED2 ) )
  1601. IU = 1 + ( N-1 )*INT( DLARND( 1, ISEED2 ) )
  1602. IF( IU.LT.IL ) THEN
  1603. ITEMP = IU
  1604. IU = IL
  1605. IL = ITEMP
  1606. END IF
  1607. *
  1608. IF( SRANGE ) THEN
  1609. NTEST = 28
  1610. ABSTOL = UNFL + UNFL
  1611. CALL DSTEMR( 'V', 'I', N, SD, SE, VL, VU, IL, IU,
  1612. $ M, WR, Z, LDU, N, IWORK( 1 ), TRYRAC,
  1613. $ WORK, LWORK, IWORK( 2*N+1 ),
  1614. $ LWORK-2*N, IINFO )
  1615. *
  1616. IF( IINFO.NE.0 ) THEN
  1617. WRITE( NOUNIT, FMT = 9999 )'DSTEMR(V,I,rel)',
  1618. $ IINFO, N, JTYPE, IOLDSD
  1619. INFO = ABS( IINFO )
  1620. IF( IINFO.LT.0 ) THEN
  1621. RETURN
  1622. ELSE
  1623. RESULT( 28 ) = ULPINV
  1624. GO TO 270
  1625. END IF
  1626. END IF
  1627. *
  1628. *
  1629. * Do test 28
  1630. *
  1631. TEMP2 = TWO*( TWO*N-ONE )*ULP*
  1632. $ ( ONE+EIGHT*HALF**2 ) / ( ONE-HALF )**4
  1633. *
  1634. TEMP1 = ZERO
  1635. DO 230 J = IL, IU
  1636. TEMP1 = MAX( TEMP1, ABS( WR( J-IL+1 )-D4( N-J+
  1637. $ 1 ) ) / ( ABSTOL+ABS( WR( J-IL+1 ) ) ) )
  1638. 230 CONTINUE
  1639. *
  1640. RESULT( 28 ) = TEMP1 / TEMP2
  1641. ELSE
  1642. RESULT( 28 ) = ZERO
  1643. END IF
  1644. ELSE
  1645. RESULT( 27 ) = ZERO
  1646. RESULT( 28 ) = ZERO
  1647. END IF
  1648. *
  1649. * Call DSTEMR(V,I) to compute D1 and Z, do tests.
  1650. *
  1651. * Compute D1 and Z
  1652. *
  1653. CALL DCOPY( N, SD, 1, D5, 1 )
  1654. IF( N.GT.0 )
  1655. $ CALL DCOPY( N-1, SE, 1, WORK, 1 )
  1656. CALL DLASET( 'Full', N, N, ZERO, ONE, Z, LDU )
  1657. *
  1658. IF( SRANGE ) THEN
  1659. NTEST = 29
  1660. IL = 1 + ( N-1 )*INT( DLARND( 1, ISEED2 ) )
  1661. IU = 1 + ( N-1 )*INT( DLARND( 1, ISEED2 ) )
  1662. IF( IU.LT.IL ) THEN
  1663. ITEMP = IU
  1664. IU = IL
  1665. IL = ITEMP
  1666. END IF
  1667. CALL DSTEMR( 'V', 'I', N, D5, WORK, VL, VU, IL, IU,
  1668. $ M, D1, Z, LDU, N, IWORK( 1 ), TRYRAC,
  1669. $ WORK( N+1 ), LWORK-N, IWORK( 2*N+1 ),
  1670. $ LIWORK-2*N, IINFO )
  1671. IF( IINFO.NE.0 ) THEN
  1672. WRITE( NOUNIT, FMT = 9999 )'DSTEMR(V,I)', IINFO,
  1673. $ N, JTYPE, IOLDSD
  1674. INFO = ABS( IINFO )
  1675. IF( IINFO.LT.0 ) THEN
  1676. RETURN
  1677. ELSE
  1678. RESULT( 29 ) = ULPINV
  1679. GO TO 280
  1680. END IF
  1681. END IF
  1682. *
  1683. * Do Tests 29 and 30
  1684. *
  1685. CALL DSTT22( N, M, 0, SD, SE, D1, DUMMA, Z, LDU, WORK,
  1686. $ M, RESULT( 29 ) )
  1687. *
  1688. * Call DSTEMR to compute D2, do tests.
  1689. *
  1690. * Compute D2
  1691. *
  1692. CALL DCOPY( N, SD, 1, D5, 1 )
  1693. IF( N.GT.0 )
  1694. $ CALL DCOPY( N-1, SE, 1, WORK, 1 )
  1695. *
  1696. NTEST = 31
  1697. CALL DSTEMR( 'N', 'I', N, D5, WORK, VL, VU, IL, IU,
  1698. $ M, D2, Z, LDU, N, IWORK( 1 ), TRYRAC,
  1699. $ WORK( N+1 ), LWORK-N, IWORK( 2*N+1 ),
  1700. $ LIWORK-2*N, IINFO )
  1701. IF( IINFO.NE.0 ) THEN
  1702. WRITE( NOUNIT, FMT = 9999 )'DSTEMR(N,I)', IINFO,
  1703. $ N, JTYPE, IOLDSD
  1704. INFO = ABS( IINFO )
  1705. IF( IINFO.LT.0 ) THEN
  1706. RETURN
  1707. ELSE
  1708. RESULT( 31 ) = ULPINV
  1709. GO TO 280
  1710. END IF
  1711. END IF
  1712. *
  1713. * Do Test 31
  1714. *
  1715. TEMP1 = ZERO
  1716. TEMP2 = ZERO
  1717. *
  1718. DO 240 J = 1, IU - IL + 1
  1719. TEMP1 = MAX( TEMP1, ABS( D1( J ) ),
  1720. $ ABS( D2( J ) ) )
  1721. TEMP2 = MAX( TEMP2, ABS( D1( J )-D2( J ) ) )
  1722. 240 CONTINUE
  1723. *
  1724. RESULT( 31 ) = TEMP2 / MAX( UNFL,
  1725. $ ULP*MAX( TEMP1, TEMP2 ) )
  1726. *
  1727. *
  1728. * Call DSTEMR(V,V) to compute D1 and Z, do tests.
  1729. *
  1730. * Compute D1 and Z
  1731. *
  1732. CALL DCOPY( N, SD, 1, D5, 1 )
  1733. IF( N.GT.0 )
  1734. $ CALL DCOPY( N-1, SE, 1, WORK, 1 )
  1735. CALL DLASET( 'Full', N, N, ZERO, ONE, Z, LDU )
  1736. *
  1737. NTEST = 32
  1738. *
  1739. IF( N.GT.0 ) THEN
  1740. IF( IL.NE.1 ) THEN
  1741. VL = D2( IL ) - MAX( HALF*
  1742. $ ( D2( IL )-D2( IL-1 ) ), ULP*ANORM,
  1743. $ TWO*RTUNFL )
  1744. ELSE
  1745. VL = D2( 1 ) - MAX( HALF*( D2( N )-D2( 1 ) ),
  1746. $ ULP*ANORM, TWO*RTUNFL )
  1747. END IF
  1748. IF( IU.NE.N ) THEN
  1749. VU = D2( IU ) + MAX( HALF*
  1750. $ ( D2( IU+1 )-D2( IU ) ), ULP*ANORM,
  1751. $ TWO*RTUNFL )
  1752. ELSE
  1753. VU = D2( N ) + MAX( HALF*( D2( N )-D2( 1 ) ),
  1754. $ ULP*ANORM, TWO*RTUNFL )
  1755. END IF
  1756. ELSE
  1757. VL = ZERO
  1758. VU = ONE
  1759. END IF
  1760. *
  1761. CALL DSTEMR( 'V', 'V', N, D5, WORK, VL, VU, IL, IU,
  1762. $ M, D1, Z, LDU, N, IWORK( 1 ), TRYRAC,
  1763. $ WORK( N+1 ), LWORK-N, IWORK( 2*N+1 ),
  1764. $ LIWORK-2*N, IINFO )
  1765. IF( IINFO.NE.0 ) THEN
  1766. WRITE( NOUNIT, FMT = 9999 )'DSTEMR(V,V)', IINFO,
  1767. $ N, JTYPE, IOLDSD
  1768. INFO = ABS( IINFO )
  1769. IF( IINFO.LT.0 ) THEN
  1770. RETURN
  1771. ELSE
  1772. RESULT( 32 ) = ULPINV
  1773. GO TO 280
  1774. END IF
  1775. END IF
  1776. *
  1777. * Do Tests 32 and 33
  1778. *
  1779. CALL DSTT22( N, M, 0, SD, SE, D1, DUMMA, Z, LDU, WORK,
  1780. $ M, RESULT( 32 ) )
  1781. *
  1782. * Call DSTEMR to compute D2, do tests.
  1783. *
  1784. * Compute D2
  1785. *
  1786. CALL DCOPY( N, SD, 1, D5, 1 )
  1787. IF( N.GT.0 )
  1788. $ CALL DCOPY( N-1, SE, 1, WORK, 1 )
  1789. *
  1790. NTEST = 34
  1791. CALL DSTEMR( 'N', 'V', N, D5, WORK, VL, VU, IL, IU,
  1792. $ M, D2, Z, LDU, N, IWORK( 1 ), TRYRAC,
  1793. $ WORK( N+1 ), LWORK-N, IWORK( 2*N+1 ),
  1794. $ LIWORK-2*N, IINFO )
  1795. IF( IINFO.NE.0 ) THEN
  1796. WRITE( NOUNIT, FMT = 9999 )'DSTEMR(N,V)', IINFO,
  1797. $ N, JTYPE, IOLDSD
  1798. INFO = ABS( IINFO )
  1799. IF( IINFO.LT.0 ) THEN
  1800. RETURN
  1801. ELSE
  1802. RESULT( 34 ) = ULPINV
  1803. GO TO 280
  1804. END IF
  1805. END IF
  1806. *
  1807. * Do Test 34
  1808. *
  1809. TEMP1 = ZERO
  1810. TEMP2 = ZERO
  1811. *
  1812. DO 250 J = 1, IU - IL + 1
  1813. TEMP1 = MAX( TEMP1, ABS( D1( J ) ),
  1814. $ ABS( D2( J ) ) )
  1815. TEMP2 = MAX( TEMP2, ABS( D1( J )-D2( J ) ) )
  1816. 250 CONTINUE
  1817. *
  1818. RESULT( 34 ) = TEMP2 / MAX( UNFL,
  1819. $ ULP*MAX( TEMP1, TEMP2 ) )
  1820. ELSE
  1821. RESULT( 29 ) = ZERO
  1822. RESULT( 30 ) = ZERO
  1823. RESULT( 31 ) = ZERO
  1824. RESULT( 32 ) = ZERO
  1825. RESULT( 33 ) = ZERO
  1826. RESULT( 34 ) = ZERO
  1827. END IF
  1828. *
  1829. *
  1830. * Call DSTEMR(V,A) to compute D1 and Z, do tests.
  1831. *
  1832. * Compute D1 and Z
  1833. *
  1834. CALL DCOPY( N, SD, 1, D5, 1 )
  1835. IF( N.GT.0 )
  1836. $ CALL DCOPY( N-1, SE, 1, WORK, 1 )
  1837. *
  1838. NTEST = 35
  1839. *
  1840. CALL DSTEMR( 'V', 'A', N, D5, WORK, VL, VU, IL, IU,
  1841. $ M, D1, Z, LDU, N, IWORK( 1 ), TRYRAC,
  1842. $ WORK( N+1 ), LWORK-N, IWORK( 2*N+1 ),
  1843. $ LIWORK-2*N, IINFO )
  1844. IF( IINFO.NE.0 ) THEN
  1845. WRITE( NOUNIT, FMT = 9999 )'DSTEMR(V,A)', IINFO, N,
  1846. $ JTYPE, IOLDSD
  1847. INFO = ABS( IINFO )
  1848. IF( IINFO.LT.0 ) THEN
  1849. RETURN
  1850. ELSE
  1851. RESULT( 35 ) = ULPINV
  1852. GO TO 280
  1853. END IF
  1854. END IF
  1855. *
  1856. * Do Tests 35 and 36
  1857. *
  1858. CALL DSTT22( N, M, 0, SD, SE, D1, DUMMA, Z, LDU, WORK, M,
  1859. $ RESULT( 35 ) )
  1860. *
  1861. * Call DSTEMR to compute D2, do tests.
  1862. *
  1863. * Compute D2
  1864. *
  1865. CALL DCOPY( N, SD, 1, D5, 1 )
  1866. IF( N.GT.0 )
  1867. $ CALL DCOPY( N-1, SE, 1, WORK, 1 )
  1868. *
  1869. NTEST = 37
  1870. CALL DSTEMR( 'N', 'A', N, D5, WORK, VL, VU, IL, IU,
  1871. $ M, D2, Z, LDU, N, IWORK( 1 ), TRYRAC,
  1872. $ WORK( N+1 ), LWORK-N, IWORK( 2*N+1 ),
  1873. $ LIWORK-2*N, IINFO )
  1874. IF( IINFO.NE.0 ) THEN
  1875. WRITE( NOUNIT, FMT = 9999 )'DSTEMR(N,A)', IINFO, N,
  1876. $ JTYPE, IOLDSD
  1877. INFO = ABS( IINFO )
  1878. IF( IINFO.LT.0 ) THEN
  1879. RETURN
  1880. ELSE
  1881. RESULT( 37 ) = ULPINV
  1882. GO TO 280
  1883. END IF
  1884. END IF
  1885. *
  1886. * Do Test 34
  1887. *
  1888. TEMP1 = ZERO
  1889. TEMP2 = ZERO
  1890. *
  1891. DO 260 J = 1, N
  1892. TEMP1 = MAX( TEMP1, ABS( D1( J ) ), ABS( D2( J ) ) )
  1893. TEMP2 = MAX( TEMP2, ABS( D1( J )-D2( J ) ) )
  1894. 260 CONTINUE
  1895. *
  1896. RESULT( 37 ) = TEMP2 / MAX( UNFL,
  1897. $ ULP*MAX( TEMP1, TEMP2 ) )
  1898. END IF
  1899. 270 CONTINUE
  1900. 280 CONTINUE
  1901. NTESTT = NTESTT + NTEST
  1902. *
  1903. * End of Loop -- Check for RESULT(j) > THRESH
  1904. *
  1905. *
  1906. * Print out tests which fail.
  1907. *
  1908. DO 290 JR = 1, NTEST
  1909. IF( RESULT( JR ).GE.THRESH ) THEN
  1910. *
  1911. * If this is the first test to fail,
  1912. * print a header to the data file.
  1913. *
  1914. IF( NERRS.EQ.0 ) THEN
  1915. WRITE( NOUNIT, FMT = 9998 )'DST'
  1916. WRITE( NOUNIT, FMT = 9997 )
  1917. WRITE( NOUNIT, FMT = 9996 )
  1918. WRITE( NOUNIT, FMT = 9995 )'Symmetric'
  1919. WRITE( NOUNIT, FMT = 9994 )
  1920. *
  1921. * Tests performed
  1922. *
  1923. WRITE( NOUNIT, FMT = 9988 )
  1924. END IF
  1925. NERRS = NERRS + 1
  1926. WRITE( NOUNIT, FMT = 9990 )N, IOLDSD, JTYPE, JR,
  1927. $ RESULT( JR )
  1928. END IF
  1929. 290 CONTINUE
  1930. 300 CONTINUE
  1931. 310 CONTINUE
  1932. *
  1933. * Summary
  1934. *
  1935. CALL DLASUM( 'DST', NOUNIT, NERRS, NTESTT )
  1936. RETURN
  1937. *
  1938. 9999 FORMAT( ' DCHKST: ', A, ' returned INFO=', I6, '.', / 9X, 'N=',
  1939. $ I6, ', JTYPE=', I6, ', ISEED=(', 3( I5, ',' ), I5, ')' )
  1940. *
  1941. 9998 FORMAT( / 1X, A3, ' -- Real Symmetric eigenvalue problem' )
  1942. 9997 FORMAT( ' Matrix types (see DCHKST for details): ' )
  1943. *
  1944. 9996 FORMAT( / ' Special Matrices:',
  1945. $ / ' 1=Zero matrix. ',
  1946. $ ' 5=Diagonal: clustered entries.',
  1947. $ / ' 2=Identity matrix. ',
  1948. $ ' 6=Diagonal: large, evenly spaced.',
  1949. $ / ' 3=Diagonal: evenly spaced entries. ',
  1950. $ ' 7=Diagonal: small, evenly spaced.',
  1951. $ / ' 4=Diagonal: geometr. spaced entries.' )
  1952. 9995 FORMAT( ' Dense ', A, ' Matrices:',
  1953. $ / ' 8=Evenly spaced eigenvals. ',
  1954. $ ' 12=Small, evenly spaced eigenvals.',
  1955. $ / ' 9=Geometrically spaced eigenvals. ',
  1956. $ ' 13=Matrix with random O(1) entries.',
  1957. $ / ' 10=Clustered eigenvalues. ',
  1958. $ ' 14=Matrix with large random entries.',
  1959. $ / ' 11=Large, evenly spaced eigenvals. ',
  1960. $ ' 15=Matrix with small random entries.' )
  1961. 9994 FORMAT( ' 16=Positive definite, evenly spaced eigenvalues',
  1962. $ / ' 17=Positive definite, geometrically spaced eigenvlaues',
  1963. $ / ' 18=Positive definite, clustered eigenvalues',
  1964. $ / ' 19=Positive definite, small evenly spaced eigenvalues',
  1965. $ / ' 20=Positive definite, large evenly spaced eigenvalues',
  1966. $ / ' 21=Diagonally dominant tridiagonal, geometrically',
  1967. $ ' spaced eigenvalues' )
  1968. *
  1969. 9990 FORMAT( ' N=', I5, ', seed=', 4( I4, ',' ), ' type ', I2,
  1970. $ ', test(', I2, ')=', G10.3 )
  1971. *
  1972. 9988 FORMAT( / 'Test performed: see DCHKST for details.', / )
  1973. * End of DCHKST
  1974. *
  1975. END