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.

zchkst2stg.f 73 kB

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