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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084
  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 simultaneously
  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. *> \ingroup complex16_eig
  618. *
  619. * =====================================================================
  620. SUBROUTINE ZCHKST2STG( NSIZES, NN, NTYPES, DOTYPE, ISEED, THRESH,
  621. $ NOUNIT, A, LDA, AP, SD, SE, D1, D2, D3, D4, D5,
  622. $ WA1, WA2, WA3, WR, U, LDU, V, VP, TAU, Z, WORK,
  623. $ LWORK, RWORK, LRWORK, IWORK, LIWORK, RESULT,
  624. $ INFO )
  625. *
  626. * -- LAPACK test routine --
  627. * -- LAPACK is a software package provided by Univ. of Tennessee, --
  628. * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  629. *
  630. * .. Scalar Arguments ..
  631. INTEGER INFO, LDA, LDU, LIWORK, LRWORK, LWORK, NOUNIT,
  632. $ NSIZES, NTYPES
  633. DOUBLE PRECISION THRESH
  634. * ..
  635. * .. Array Arguments ..
  636. LOGICAL DOTYPE( * )
  637. INTEGER ISEED( 4 ), IWORK( * ), NN( * )
  638. DOUBLE PRECISION D1( * ), D2( * ), D3( * ), D4( * ), D5( * ),
  639. $ RESULT( * ), RWORK( * ), SD( * ), SE( * ),
  640. $ WA1( * ), WA2( * ), WA3( * ), WR( * )
  641. COMPLEX*16 A( LDA, * ), AP( * ), TAU( * ), U( LDU, * ),
  642. $ V( LDU, * ), VP( * ), WORK( * ), Z( LDU, * )
  643. * ..
  644. *
  645. * =====================================================================
  646. *
  647. * .. Parameters ..
  648. DOUBLE PRECISION ZERO, ONE, TWO, EIGHT, TEN, HUN
  649. PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0, TWO = 2.0D0,
  650. $ EIGHT = 8.0D0, TEN = 10.0D0, HUN = 100.0D0 )
  651. COMPLEX*16 CZERO, CONE
  652. PARAMETER ( CZERO = ( 0.0D+0, 0.0D+0 ),
  653. $ CONE = ( 1.0D+0, 0.0D+0 ) )
  654. DOUBLE PRECISION HALF
  655. PARAMETER ( HALF = ONE / TWO )
  656. INTEGER MAXTYP
  657. PARAMETER ( MAXTYP = 21 )
  658. LOGICAL CRANGE
  659. PARAMETER ( CRANGE = .FALSE. )
  660. LOGICAL CREL
  661. PARAMETER ( CREL = .FALSE. )
  662. * ..
  663. * .. Local Scalars ..
  664. LOGICAL BADNN, TRYRAC
  665. INTEGER I, IINFO, IL, IMODE, INDE, INDRWK, ITEMP,
  666. $ ITYPE, IU, J, JC, JR, JSIZE, JTYPE, LGN,
  667. $ LIWEDC, LOG2UI, LRWEDC, LWEDC, M, M2, M3,
  668. $ MTYPES, N, NAP, NBLOCK, NERRS, NMATS, NMAX,
  669. $ NSPLIT, NTEST, NTESTT, LH, LW
  670. DOUBLE PRECISION ABSTOL, ANINV, ANORM, COND, OVFL, RTOVFL,
  671. $ RTUNFL, TEMP1, TEMP2, TEMP3, TEMP4, ULP,
  672. $ ULPINV, UNFL, VL, VU
  673. * ..
  674. * .. Local Arrays ..
  675. INTEGER IDUMMA( 1 ), IOLDSD( 4 ), ISEED2( 4 ),
  676. $ KMAGN( MAXTYP ), KMODE( MAXTYP ),
  677. $ KTYPE( MAXTYP )
  678. DOUBLE PRECISION DUMMA( 1 )
  679. * ..
  680. * .. External Functions ..
  681. INTEGER ILAENV
  682. DOUBLE PRECISION DLAMCH, DLARND, DSXT1
  683. EXTERNAL ILAENV, DLAMCH, DLARND, DSXT1
  684. * ..
  685. * .. External Subroutines ..
  686. EXTERNAL DCOPY, DLASUM, DSTEBZ, DSTECH, DSTERF, XERBLA,
  687. $ ZCOPY, ZHET21, ZHETRD, ZHPT21, ZHPTRD, ZLACPY,
  688. $ ZLASET, ZLATMR, ZLATMS, ZPTEQR, ZSTEDC, ZSTEMR,
  689. $ ZSTEIN, ZSTEQR, ZSTT21, ZSTT22, ZUNGTR, ZUPGTR,
  690. $ ZHETRD_2STAGE, DLASET
  691. * ..
  692. * .. Intrinsic Functions ..
  693. INTRINSIC ABS, DBLE, DCONJG, INT, LOG, MAX, MIN, SQRT
  694. * ..
  695. * .. Data statements ..
  696. DATA KTYPE / 1, 2, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 8,
  697. $ 8, 8, 9, 9, 9, 9, 9, 10 /
  698. DATA KMAGN / 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 2, 3, 1,
  699. $ 2, 3, 1, 1, 1, 2, 3, 1 /
  700. DATA KMODE / 0, 0, 4, 3, 1, 4, 4, 4, 3, 1, 4, 4, 0,
  701. $ 0, 0, 4, 3, 1, 4, 4, 3 /
  702. * ..
  703. * .. Executable Statements ..
  704. *
  705. * Keep ftnchek happy
  706. IDUMMA( 1 ) = 1
  707. *
  708. * Check for errors
  709. *
  710. NTESTT = 0
  711. INFO = 0
  712. *
  713. * Important constants
  714. *
  715. BADNN = .FALSE.
  716. TRYRAC = .TRUE.
  717. NMAX = 1
  718. DO 10 J = 1, NSIZES
  719. NMAX = MAX( NMAX, NN( J ) )
  720. IF( NN( J ).LT.0 )
  721. $ BADNN = .TRUE.
  722. 10 CONTINUE
  723. *
  724. NBLOCK = ILAENV( 1, 'ZHETRD', 'L', NMAX, -1, -1, -1 )
  725. NBLOCK = MIN( NMAX, MAX( 1, NBLOCK ) )
  726. *
  727. * Check for errors
  728. *
  729. IF( NSIZES.LT.0 ) THEN
  730. INFO = -1
  731. ELSE IF( BADNN ) THEN
  732. INFO = -2
  733. ELSE IF( NTYPES.LT.0 ) THEN
  734. INFO = -3
  735. ELSE IF( LDA.LT.NMAX ) THEN
  736. INFO = -9
  737. ELSE IF( LDU.LT.NMAX ) THEN
  738. INFO = -23
  739. ELSE IF( 2*MAX( 2, NMAX )**2.GT.LWORK ) THEN
  740. INFO = -29
  741. END IF
  742. *
  743. IF( INFO.NE.0 ) THEN
  744. CALL XERBLA( 'ZCHKST2STG', -INFO )
  745. RETURN
  746. END IF
  747. *
  748. * Quick return if possible
  749. *
  750. IF( NSIZES.EQ.0 .OR. NTYPES.EQ.0 )
  751. $ RETURN
  752. *
  753. * More Important constants
  754. *
  755. UNFL = DLAMCH( 'Safe minimum' )
  756. OVFL = ONE / UNFL
  757. ULP = DLAMCH( 'Epsilon' )*DLAMCH( 'Base' )
  758. ULPINV = ONE / ULP
  759. LOG2UI = INT( LOG( ULPINV ) / LOG( TWO ) )
  760. RTUNFL = SQRT( UNFL )
  761. RTOVFL = SQRT( OVFL )
  762. *
  763. * Loop over sizes, types
  764. *
  765. DO 20 I = 1, 4
  766. ISEED2( I ) = ISEED( I )
  767. 20 CONTINUE
  768. NERRS = 0
  769. NMATS = 0
  770. *
  771. DO 310 JSIZE = 1, NSIZES
  772. N = NN( JSIZE )
  773. IF( N.GT.0 ) THEN
  774. LGN = INT( LOG( DBLE( N ) ) / LOG( TWO ) )
  775. IF( 2**LGN.LT.N )
  776. $ LGN = LGN + 1
  777. IF( 2**LGN.LT.N )
  778. $ LGN = LGN + 1
  779. LWEDC = 1 + 4*N + 2*N*LGN + 4*N**2
  780. LRWEDC = 1 + 3*N + 2*N*LGN + 4*N**2
  781. LIWEDC = 6 + 6*N + 5*N*LGN
  782. ELSE
  783. LWEDC = 8
  784. LRWEDC = 7
  785. LIWEDC = 12
  786. END IF
  787. NAP = ( N*( N+1 ) ) / 2
  788. ANINV = ONE / DBLE( MAX( 1, N ) )
  789. *
  790. IF( NSIZES.NE.1 ) THEN
  791. MTYPES = MIN( MAXTYP, NTYPES )
  792. ELSE
  793. MTYPES = MIN( MAXTYP+1, NTYPES )
  794. END IF
  795. *
  796. DO 300 JTYPE = 1, MTYPES
  797. IF( .NOT.DOTYPE( JTYPE ) )
  798. $ GO TO 300
  799. NMATS = NMATS + 1
  800. NTEST = 0
  801. *
  802. DO 30 J = 1, 4
  803. IOLDSD( J ) = ISEED( J )
  804. 30 CONTINUE
  805. *
  806. * Compute "A"
  807. *
  808. * Control parameters:
  809. *
  810. * KMAGN KMODE KTYPE
  811. * =1 O(1) clustered 1 zero
  812. * =2 large clustered 2 identity
  813. * =3 small exponential (none)
  814. * =4 arithmetic diagonal, (w/ eigenvalues)
  815. * =5 random log Hermitian, w/ eigenvalues
  816. * =6 random (none)
  817. * =7 random diagonal
  818. * =8 random Hermitian
  819. * =9 positive definite
  820. * =10 diagonally dominant tridiagonal
  821. *
  822. IF( MTYPES.GT.MAXTYP )
  823. $ GO TO 100
  824. *
  825. ITYPE = KTYPE( JTYPE )
  826. IMODE = KMODE( JTYPE )
  827. *
  828. * Compute norm
  829. *
  830. GO TO ( 40, 50, 60 )KMAGN( JTYPE )
  831. *
  832. 40 CONTINUE
  833. ANORM = ONE
  834. GO TO 70
  835. *
  836. 50 CONTINUE
  837. ANORM = ( RTOVFL*ULP )*ANINV
  838. GO TO 70
  839. *
  840. 60 CONTINUE
  841. ANORM = RTUNFL*N*ULPINV
  842. GO TO 70
  843. *
  844. 70 CONTINUE
  845. *
  846. CALL ZLASET( 'Full', LDA, N, CZERO, CZERO, A, LDA )
  847. IINFO = 0
  848. IF( JTYPE.LE.15 ) THEN
  849. COND = ULPINV
  850. ELSE
  851. COND = ULPINV*ANINV / TEN
  852. END IF
  853. *
  854. * Special Matrices -- Identity & Jordan block
  855. *
  856. * Zero
  857. *
  858. IF( ITYPE.EQ.1 ) THEN
  859. IINFO = 0
  860. *
  861. ELSE IF( ITYPE.EQ.2 ) THEN
  862. *
  863. * Identity
  864. *
  865. DO 80 JC = 1, N
  866. A( JC, JC ) = ANORM
  867. 80 CONTINUE
  868. *
  869. ELSE IF( ITYPE.EQ.4 ) THEN
  870. *
  871. * Diagonal Matrix, [Eigen]values Specified
  872. *
  873. CALL ZLATMS( N, N, 'S', ISEED, 'H', RWORK, IMODE, COND,
  874. $ ANORM, 0, 0, 'N', A, LDA, WORK, IINFO )
  875. *
  876. *
  877. ELSE IF( ITYPE.EQ.5 ) THEN
  878. *
  879. * Hermitian, eigenvalues specified
  880. *
  881. CALL ZLATMS( N, N, 'S', ISEED, 'H', RWORK, IMODE, COND,
  882. $ ANORM, N, N, 'N', A, LDA, WORK, IINFO )
  883. *
  884. ELSE IF( ITYPE.EQ.7 ) THEN
  885. *
  886. * Diagonal, random eigenvalues
  887. *
  888. CALL ZLATMR( N, N, 'S', ISEED, 'H', WORK, 6, ONE, CONE,
  889. $ 'T', 'N', WORK( N+1 ), 1, ONE,
  890. $ WORK( 2*N+1 ), 1, ONE, 'N', IDUMMA, 0, 0,
  891. $ ZERO, ANORM, 'NO', A, LDA, IWORK, IINFO )
  892. *
  893. ELSE IF( ITYPE.EQ.8 ) THEN
  894. *
  895. * Hermitian, random eigenvalues
  896. *
  897. CALL ZLATMR( N, N, 'S', ISEED, 'H', WORK, 6, ONE, CONE,
  898. $ 'T', 'N', WORK( N+1 ), 1, ONE,
  899. $ WORK( 2*N+1 ), 1, ONE, 'N', IDUMMA, N, N,
  900. $ ZERO, ANORM, 'NO', A, LDA, IWORK, IINFO )
  901. *
  902. ELSE IF( ITYPE.EQ.9 ) THEN
  903. *
  904. * Positive definite, eigenvalues specified.
  905. *
  906. CALL ZLATMS( N, N, 'S', ISEED, 'P', RWORK, IMODE, COND,
  907. $ ANORM, N, N, 'N', A, LDA, WORK, IINFO )
  908. *
  909. ELSE IF( ITYPE.EQ.10 ) THEN
  910. *
  911. * Positive definite tridiagonal, eigenvalues specified.
  912. *
  913. CALL ZLATMS( N, N, 'S', ISEED, 'P', RWORK, IMODE, COND,
  914. $ ANORM, 1, 1, 'N', A, LDA, WORK, IINFO )
  915. DO 90 I = 2, N
  916. TEMP1 = ABS( A( I-1, I ) )
  917. TEMP2 = SQRT( ABS( A( I-1, I-1 )*A( I, I ) ) )
  918. IF( TEMP1.GT.HALF*TEMP2 ) THEN
  919. A( I-1, I ) = A( I-1, I )*
  920. $ ( HALF*TEMP2 / ( UNFL+TEMP1 ) )
  921. A( I, I-1 ) = DCONJG( A( I-1, I ) )
  922. END IF
  923. 90 CONTINUE
  924. *
  925. ELSE
  926. *
  927. IINFO = 1
  928. END IF
  929. *
  930. IF( IINFO.NE.0 ) THEN
  931. WRITE( NOUNIT, FMT = 9999 )'Generator', IINFO, N, JTYPE,
  932. $ IOLDSD
  933. INFO = ABS( IINFO )
  934. RETURN
  935. END IF
  936. *
  937. 100 CONTINUE
  938. *
  939. * Call ZHETRD and ZUNGTR to compute S and U from
  940. * upper triangle.
  941. *
  942. CALL ZLACPY( 'U', N, N, A, LDA, V, LDU )
  943. *
  944. NTEST = 1
  945. CALL ZHETRD( 'U', N, V, LDU, SD, SE, TAU, WORK, LWORK,
  946. $ IINFO )
  947. *
  948. IF( IINFO.NE.0 ) THEN
  949. WRITE( NOUNIT, FMT = 9999 )'ZHETRD(U)', IINFO, N, JTYPE,
  950. $ IOLDSD
  951. INFO = ABS( IINFO )
  952. IF( IINFO.LT.0 ) THEN
  953. RETURN
  954. ELSE
  955. RESULT( 1 ) = ULPINV
  956. GO TO 280
  957. END IF
  958. END IF
  959. *
  960. CALL ZLACPY( 'U', N, N, V, LDU, U, LDU )
  961. *
  962. NTEST = 2
  963. CALL ZUNGTR( 'U', N, U, LDU, TAU, WORK, LWORK, IINFO )
  964. IF( IINFO.NE.0 ) THEN
  965. WRITE( NOUNIT, FMT = 9999 )'ZUNGTR(U)', IINFO, N, JTYPE,
  966. $ IOLDSD
  967. INFO = ABS( IINFO )
  968. IF( IINFO.LT.0 ) THEN
  969. RETURN
  970. ELSE
  971. RESULT( 2 ) = ULPINV
  972. GO TO 280
  973. END IF
  974. END IF
  975. *
  976. * Do tests 1 and 2
  977. *
  978. CALL ZHET21( 2, 'Upper', N, 1, A, LDA, SD, SE, U, LDU, V,
  979. $ LDU, TAU, WORK, RWORK, RESULT( 1 ) )
  980. CALL ZHET21( 3, 'Upper', N, 1, A, LDA, SD, SE, U, LDU, V,
  981. $ LDU, TAU, WORK, RWORK, RESULT( 2 ) )
  982. *
  983. * Compute D1 the eigenvalues resulting from the tridiagonal
  984. * form using the standard 1-stage algorithm and use it as a
  985. * reference to compare with the 2-stage technique
  986. *
  987. * Compute D1 from the 1-stage and used as reference for the
  988. * 2-stage
  989. *
  990. CALL DCOPY( N, SD, 1, D1, 1 )
  991. IF( N.GT.0 )
  992. $ CALL DCOPY( N-1, SE, 1, RWORK, 1 )
  993. *
  994. CALL ZSTEQR( 'N', N, D1, RWORK, WORK, LDU, RWORK( N+1 ),
  995. $ IINFO )
  996. IF( IINFO.NE.0 ) THEN
  997. WRITE( NOUNIT, FMT = 9999 )'ZSTEQR(N)', IINFO, N, JTYPE,
  998. $ IOLDSD
  999. INFO = ABS( IINFO )
  1000. IF( IINFO.LT.0 ) THEN
  1001. RETURN
  1002. ELSE
  1003. RESULT( 3 ) = ULPINV
  1004. GO TO 280
  1005. END IF
  1006. END IF
  1007. *
  1008. * 2-STAGE TRD Upper case is used to compute D2.
  1009. * Note to set SD and SE to zero to be sure not reusing
  1010. * the one from above. Compare it with D1 computed
  1011. * using the 1-stage.
  1012. *
  1013. CALL DLASET( 'Full', N, 1, ZERO, ZERO, SD, N )
  1014. CALL DLASET( 'Full', N, 1, ZERO, ZERO, SE, N )
  1015. CALL ZLACPY( 'U', N, N, A, LDA, V, LDU )
  1016. LH = MAX(1, 4*N)
  1017. LW = LWORK - LH
  1018. CALL ZHETRD_2STAGE( 'N', "U", N, V, LDU, SD, SE, TAU,
  1019. $ WORK, LH, WORK( LH+1 ), LW, IINFO )
  1020. *
  1021. * Compute D2 from the 2-stage Upper case
  1022. *
  1023. CALL DCOPY( N, SD, 1, D2, 1 )
  1024. IF( N.GT.0 )
  1025. $ CALL DCOPY( N-1, SE, 1, RWORK, 1 )
  1026. *
  1027. NTEST = 3
  1028. CALL ZSTEQR( 'N', N, D2, RWORK, WORK, LDU, RWORK( N+1 ),
  1029. $ IINFO )
  1030. IF( IINFO.NE.0 ) THEN
  1031. WRITE( NOUNIT, FMT = 9999 )'ZSTEQR(N)', IINFO, N, JTYPE,
  1032. $ IOLDSD
  1033. INFO = ABS( IINFO )
  1034. IF( IINFO.LT.0 ) THEN
  1035. RETURN
  1036. ELSE
  1037. RESULT( 3 ) = ULPINV
  1038. GO TO 280
  1039. END IF
  1040. END IF
  1041. *
  1042. * 2-STAGE TRD Lower case is used to compute D3.
  1043. * Note to set SD and SE to zero to be sure not reusing
  1044. * the one from above. Compare it with D1 computed
  1045. * using the 1-stage.
  1046. *
  1047. CALL DLASET( 'Full', N, 1, ZERO, ZERO, SD, N )
  1048. CALL DLASET( 'Full', N, 1, ZERO, ZERO, SE, N )
  1049. CALL ZLACPY( 'L', N, N, A, LDA, V, LDU )
  1050. CALL ZHETRD_2STAGE( 'N', "L", N, V, LDU, SD, SE, TAU,
  1051. $ WORK, LH, WORK( LH+1 ), LW, IINFO )
  1052. *
  1053. * Compute D3 from the 2-stage Upper case
  1054. *
  1055. CALL DCOPY( N, SD, 1, D3, 1 )
  1056. IF( N.GT.0 )
  1057. $ CALL DCOPY( N-1, SE, 1, RWORK, 1 )
  1058. *
  1059. NTEST = 4
  1060. CALL ZSTEQR( 'N', N, D3, RWORK, WORK, LDU, RWORK( N+1 ),
  1061. $ IINFO )
  1062. IF( IINFO.NE.0 ) THEN
  1063. WRITE( NOUNIT, FMT = 9999 )'ZSTEQR(N)', IINFO, N, JTYPE,
  1064. $ IOLDSD
  1065. INFO = ABS( IINFO )
  1066. IF( IINFO.LT.0 ) THEN
  1067. RETURN
  1068. ELSE
  1069. RESULT( 4 ) = ULPINV
  1070. GO TO 280
  1071. END IF
  1072. END IF
  1073. *
  1074. * Do Tests 3 and 4 which are similar to 11 and 12 but with the
  1075. * D1 computed using the standard 1-stage reduction as reference
  1076. *
  1077. NTEST = 4
  1078. TEMP1 = ZERO
  1079. TEMP2 = ZERO
  1080. TEMP3 = ZERO
  1081. TEMP4 = ZERO
  1082. *
  1083. DO 151 J = 1, N
  1084. TEMP1 = MAX( TEMP1, ABS( D1( J ) ), ABS( D2( J ) ) )
  1085. TEMP2 = MAX( TEMP2, ABS( D1( J )-D2( J ) ) )
  1086. TEMP3 = MAX( TEMP3, ABS( D1( J ) ), ABS( D3( J ) ) )
  1087. TEMP4 = MAX( TEMP4, ABS( D1( J )-D3( J ) ) )
  1088. 151 CONTINUE
  1089. *
  1090. RESULT( 3 ) = TEMP2 / MAX( UNFL, ULP*MAX( TEMP1, TEMP2 ) )
  1091. RESULT( 4 ) = TEMP4 / MAX( UNFL, ULP*MAX( TEMP3, TEMP4 ) )
  1092. *
  1093. * Store the upper triangle of A in AP
  1094. *
  1095. I = 0
  1096. DO 120 JC = 1, N
  1097. DO 110 JR = 1, JC
  1098. I = I + 1
  1099. AP( I ) = A( JR, JC )
  1100. 110 CONTINUE
  1101. 120 CONTINUE
  1102. *
  1103. * Call ZHPTRD and ZUPGTR to compute S and U from AP
  1104. *
  1105. CALL ZCOPY( NAP, AP, 1, VP, 1 )
  1106. *
  1107. NTEST = 5
  1108. CALL ZHPTRD( 'U', N, VP, SD, SE, TAU, IINFO )
  1109. *
  1110. IF( IINFO.NE.0 ) THEN
  1111. WRITE( NOUNIT, FMT = 9999 )'ZHPTRD(U)', IINFO, N, JTYPE,
  1112. $ IOLDSD
  1113. INFO = ABS( IINFO )
  1114. IF( IINFO.LT.0 ) THEN
  1115. RETURN
  1116. ELSE
  1117. RESULT( 5 ) = ULPINV
  1118. GO TO 280
  1119. END IF
  1120. END IF
  1121. *
  1122. NTEST = 6
  1123. CALL ZUPGTR( 'U', N, VP, TAU, U, LDU, WORK, IINFO )
  1124. IF( IINFO.NE.0 ) THEN
  1125. WRITE( NOUNIT, FMT = 9999 )'ZUPGTR(U)', IINFO, N, JTYPE,
  1126. $ IOLDSD
  1127. INFO = ABS( IINFO )
  1128. IF( IINFO.LT.0 ) THEN
  1129. RETURN
  1130. ELSE
  1131. RESULT( 6 ) = ULPINV
  1132. GO TO 280
  1133. END IF
  1134. END IF
  1135. *
  1136. * Do tests 5 and 6
  1137. *
  1138. CALL ZHPT21( 2, 'Upper', N, 1, AP, SD, SE, U, LDU, VP, TAU,
  1139. $ WORK, RWORK, RESULT( 5 ) )
  1140. CALL ZHPT21( 3, 'Upper', N, 1, AP, SD, SE, U, LDU, VP, TAU,
  1141. $ WORK, RWORK, RESULT( 6 ) )
  1142. *
  1143. * Store the lower triangle of A in AP
  1144. *
  1145. I = 0
  1146. DO 140 JC = 1, N
  1147. DO 130 JR = JC, N
  1148. I = I + 1
  1149. AP( I ) = A( JR, JC )
  1150. 130 CONTINUE
  1151. 140 CONTINUE
  1152. *
  1153. * Call ZHPTRD and ZUPGTR to compute S and U from AP
  1154. *
  1155. CALL ZCOPY( NAP, AP, 1, VP, 1 )
  1156. *
  1157. NTEST = 7
  1158. CALL ZHPTRD( 'L', N, VP, SD, SE, TAU, IINFO )
  1159. *
  1160. IF( IINFO.NE.0 ) THEN
  1161. WRITE( NOUNIT, FMT = 9999 )'ZHPTRD(L)', IINFO, N, JTYPE,
  1162. $ IOLDSD
  1163. INFO = ABS( IINFO )
  1164. IF( IINFO.LT.0 ) THEN
  1165. RETURN
  1166. ELSE
  1167. RESULT( 7 ) = ULPINV
  1168. GO TO 280
  1169. END IF
  1170. END IF
  1171. *
  1172. NTEST = 8
  1173. CALL ZUPGTR( 'L', N, VP, TAU, U, LDU, WORK, IINFO )
  1174. IF( IINFO.NE.0 ) THEN
  1175. WRITE( NOUNIT, FMT = 9999 )'ZUPGTR(L)', IINFO, N, JTYPE,
  1176. $ IOLDSD
  1177. INFO = ABS( IINFO )
  1178. IF( IINFO.LT.0 ) THEN
  1179. RETURN
  1180. ELSE
  1181. RESULT( 8 ) = ULPINV
  1182. GO TO 280
  1183. END IF
  1184. END IF
  1185. *
  1186. CALL ZHPT21( 2, 'Lower', N, 1, AP, SD, SE, U, LDU, VP, TAU,
  1187. $ WORK, RWORK, RESULT( 7 ) )
  1188. CALL ZHPT21( 3, 'Lower', N, 1, AP, SD, SE, U, LDU, VP, TAU,
  1189. $ WORK, RWORK, RESULT( 8 ) )
  1190. *
  1191. * Call ZSTEQR to compute D1, D2, and Z, do tests.
  1192. *
  1193. * Compute D1 and Z
  1194. *
  1195. CALL DCOPY( N, SD, 1, D1, 1 )
  1196. IF( N.GT.0 )
  1197. $ CALL DCOPY( N-1, SE, 1, RWORK, 1 )
  1198. CALL ZLASET( 'Full', N, N, CZERO, CONE, Z, LDU )
  1199. *
  1200. NTEST = 9
  1201. CALL ZSTEQR( 'V', N, D1, RWORK, Z, LDU, RWORK( N+1 ),
  1202. $ IINFO )
  1203. IF( IINFO.NE.0 ) THEN
  1204. WRITE( NOUNIT, FMT = 9999 )'ZSTEQR(V)', IINFO, N, JTYPE,
  1205. $ IOLDSD
  1206. INFO = ABS( IINFO )
  1207. IF( IINFO.LT.0 ) THEN
  1208. RETURN
  1209. ELSE
  1210. RESULT( 9 ) = ULPINV
  1211. GO TO 280
  1212. END IF
  1213. END IF
  1214. *
  1215. * Compute D2
  1216. *
  1217. CALL DCOPY( N, SD, 1, D2, 1 )
  1218. IF( N.GT.0 )
  1219. $ CALL DCOPY( N-1, SE, 1, RWORK, 1 )
  1220. *
  1221. NTEST = 11
  1222. CALL ZSTEQR( 'N', N, D2, RWORK, WORK, LDU, RWORK( N+1 ),
  1223. $ IINFO )
  1224. IF( IINFO.NE.0 ) THEN
  1225. WRITE( NOUNIT, FMT = 9999 )'ZSTEQR(N)', IINFO, N, JTYPE,
  1226. $ IOLDSD
  1227. INFO = ABS( IINFO )
  1228. IF( IINFO.LT.0 ) THEN
  1229. RETURN
  1230. ELSE
  1231. RESULT( 11 ) = ULPINV
  1232. GO TO 280
  1233. END IF
  1234. END IF
  1235. *
  1236. * Compute D3 (using PWK method)
  1237. *
  1238. CALL DCOPY( N, SD, 1, D3, 1 )
  1239. IF( N.GT.0 )
  1240. $ CALL DCOPY( N-1, SE, 1, RWORK, 1 )
  1241. *
  1242. NTEST = 12
  1243. CALL DSTERF( N, D3, RWORK, IINFO )
  1244. IF( IINFO.NE.0 ) THEN
  1245. WRITE( NOUNIT, FMT = 9999 )'DSTERF', IINFO, N, JTYPE,
  1246. $ IOLDSD
  1247. INFO = ABS( IINFO )
  1248. IF( IINFO.LT.0 ) THEN
  1249. RETURN
  1250. ELSE
  1251. RESULT( 12 ) = ULPINV
  1252. GO TO 280
  1253. END IF
  1254. END IF
  1255. *
  1256. * Do Tests 9 and 10
  1257. *
  1258. CALL ZSTT21( N, 0, SD, SE, D1, DUMMA, Z, LDU, WORK, RWORK,
  1259. $ RESULT( 9 ) )
  1260. *
  1261. * Do Tests 11 and 12
  1262. *
  1263. TEMP1 = ZERO
  1264. TEMP2 = ZERO
  1265. TEMP3 = ZERO
  1266. TEMP4 = ZERO
  1267. *
  1268. DO 150 J = 1, N
  1269. TEMP1 = MAX( TEMP1, ABS( D1( J ) ), ABS( D2( J ) ) )
  1270. TEMP2 = MAX( TEMP2, ABS( D1( J )-D2( J ) ) )
  1271. TEMP3 = MAX( TEMP3, ABS( D1( J ) ), ABS( D3( J ) ) )
  1272. TEMP4 = MAX( TEMP4, ABS( D1( J )-D3( J ) ) )
  1273. 150 CONTINUE
  1274. *
  1275. RESULT( 11 ) = TEMP2 / MAX( UNFL, ULP*MAX( TEMP1, TEMP2 ) )
  1276. RESULT( 12 ) = TEMP4 / MAX( UNFL, ULP*MAX( TEMP3, TEMP4 ) )
  1277. *
  1278. * Do Test 13 -- Sturm Sequence Test of Eigenvalues
  1279. * Go up by factors of two until it succeeds
  1280. *
  1281. NTEST = 13
  1282. TEMP1 = THRESH*( HALF-ULP )
  1283. *
  1284. DO 160 J = 0, LOG2UI
  1285. CALL DSTECH( N, SD, SE, D1, TEMP1, RWORK, IINFO )
  1286. IF( IINFO.EQ.0 )
  1287. $ GO TO 170
  1288. TEMP1 = TEMP1*TWO
  1289. 160 CONTINUE
  1290. *
  1291. 170 CONTINUE
  1292. RESULT( 13 ) = TEMP1
  1293. *
  1294. * For positive definite matrices ( JTYPE.GT.15 ) call ZPTEQR
  1295. * and do tests 14, 15, and 16 .
  1296. *
  1297. IF( JTYPE.GT.15 ) THEN
  1298. *
  1299. * Compute D4 and Z4
  1300. *
  1301. CALL DCOPY( N, SD, 1, D4, 1 )
  1302. IF( N.GT.0 )
  1303. $ CALL DCOPY( N-1, SE, 1, RWORK, 1 )
  1304. CALL ZLASET( 'Full', N, N, CZERO, CONE, Z, LDU )
  1305. *
  1306. NTEST = 14
  1307. CALL ZPTEQR( 'V', N, D4, RWORK, Z, LDU, RWORK( N+1 ),
  1308. $ IINFO )
  1309. IF( IINFO.NE.0 ) THEN
  1310. WRITE( NOUNIT, FMT = 9999 )'ZPTEQR(V)', IINFO, N,
  1311. $ JTYPE, IOLDSD
  1312. INFO = ABS( IINFO )
  1313. IF( IINFO.LT.0 ) THEN
  1314. RETURN
  1315. ELSE
  1316. RESULT( 14 ) = ULPINV
  1317. GO TO 280
  1318. END IF
  1319. END IF
  1320. *
  1321. * Do Tests 14 and 15
  1322. *
  1323. CALL ZSTT21( N, 0, SD, SE, D4, DUMMA, Z, LDU, WORK,
  1324. $ RWORK, RESULT( 14 ) )
  1325. *
  1326. * Compute D5
  1327. *
  1328. CALL DCOPY( N, SD, 1, D5, 1 )
  1329. IF( N.GT.0 )
  1330. $ CALL DCOPY( N-1, SE, 1, RWORK, 1 )
  1331. *
  1332. NTEST = 16
  1333. CALL ZPTEQR( 'N', N, D5, RWORK, Z, LDU, RWORK( N+1 ),
  1334. $ IINFO )
  1335. IF( IINFO.NE.0 ) THEN
  1336. WRITE( NOUNIT, FMT = 9999 )'ZPTEQR(N)', IINFO, N,
  1337. $ JTYPE, IOLDSD
  1338. INFO = ABS( IINFO )
  1339. IF( IINFO.LT.0 ) THEN
  1340. RETURN
  1341. ELSE
  1342. RESULT( 16 ) = ULPINV
  1343. GO TO 280
  1344. END IF
  1345. END IF
  1346. *
  1347. * Do Test 16
  1348. *
  1349. TEMP1 = ZERO
  1350. TEMP2 = ZERO
  1351. DO 180 J = 1, N
  1352. TEMP1 = MAX( TEMP1, ABS( D4( J ) ), ABS( D5( J ) ) )
  1353. TEMP2 = MAX( TEMP2, ABS( D4( J )-D5( J ) ) )
  1354. 180 CONTINUE
  1355. *
  1356. RESULT( 16 ) = TEMP2 / MAX( UNFL,
  1357. $ HUN*ULP*MAX( TEMP1, TEMP2 ) )
  1358. ELSE
  1359. RESULT( 14 ) = ZERO
  1360. RESULT( 15 ) = ZERO
  1361. RESULT( 16 ) = ZERO
  1362. END IF
  1363. *
  1364. * Call DSTEBZ with different options and do tests 17-18.
  1365. *
  1366. * If S is positive definite and diagonally dominant,
  1367. * ask for all eigenvalues with high relative accuracy.
  1368. *
  1369. VL = ZERO
  1370. VU = ZERO
  1371. IL = 0
  1372. IU = 0
  1373. IF( JTYPE.EQ.21 ) THEN
  1374. NTEST = 17
  1375. ABSTOL = UNFL + UNFL
  1376. CALL DSTEBZ( 'A', 'E', N, VL, VU, IL, IU, ABSTOL, SD, SE,
  1377. $ M, NSPLIT, WR, IWORK( 1 ), IWORK( N+1 ),
  1378. $ RWORK, IWORK( 2*N+1 ), IINFO )
  1379. IF( IINFO.NE.0 ) THEN
  1380. WRITE( NOUNIT, FMT = 9999 )'DSTEBZ(A,rel)', IINFO, N,
  1381. $ JTYPE, IOLDSD
  1382. INFO = ABS( IINFO )
  1383. IF( IINFO.LT.0 ) THEN
  1384. RETURN
  1385. ELSE
  1386. RESULT( 17 ) = ULPINV
  1387. GO TO 280
  1388. END IF
  1389. END IF
  1390. *
  1391. * Do test 17
  1392. *
  1393. TEMP2 = TWO*( TWO*N-ONE )*ULP*( ONE+EIGHT*HALF**2 ) /
  1394. $ ( ONE-HALF )**4
  1395. *
  1396. TEMP1 = ZERO
  1397. DO 190 J = 1, N
  1398. TEMP1 = MAX( TEMP1, ABS( D4( J )-WR( N-J+1 ) ) /
  1399. $ ( ABSTOL+ABS( D4( J ) ) ) )
  1400. 190 CONTINUE
  1401. *
  1402. RESULT( 17 ) = TEMP1 / TEMP2
  1403. ELSE
  1404. RESULT( 17 ) = ZERO
  1405. END IF
  1406. *
  1407. * Now ask for all eigenvalues with high absolute accuracy.
  1408. *
  1409. NTEST = 18
  1410. ABSTOL = UNFL + UNFL
  1411. CALL DSTEBZ( 'A', 'E', N, VL, VU, IL, IU, ABSTOL, SD, SE, M,
  1412. $ NSPLIT, WA1, IWORK( 1 ), IWORK( N+1 ), RWORK,
  1413. $ IWORK( 2*N+1 ), IINFO )
  1414. IF( IINFO.NE.0 ) THEN
  1415. WRITE( NOUNIT, FMT = 9999 )'DSTEBZ(A)', IINFO, N, JTYPE,
  1416. $ IOLDSD
  1417. INFO = ABS( IINFO )
  1418. IF( IINFO.LT.0 ) THEN
  1419. RETURN
  1420. ELSE
  1421. RESULT( 18 ) = ULPINV
  1422. GO TO 280
  1423. END IF
  1424. END IF
  1425. *
  1426. * Do test 18
  1427. *
  1428. TEMP1 = ZERO
  1429. TEMP2 = ZERO
  1430. DO 200 J = 1, N
  1431. TEMP1 = MAX( TEMP1, ABS( D3( J ) ), ABS( WA1( J ) ) )
  1432. TEMP2 = MAX( TEMP2, ABS( D3( J )-WA1( J ) ) )
  1433. 200 CONTINUE
  1434. *
  1435. RESULT( 18 ) = TEMP2 / MAX( UNFL, ULP*MAX( TEMP1, TEMP2 ) )
  1436. *
  1437. * Choose random values for IL and IU, and ask for the
  1438. * IL-th through IU-th eigenvalues.
  1439. *
  1440. NTEST = 19
  1441. IF( N.LE.1 ) THEN
  1442. IL = 1
  1443. IU = N
  1444. ELSE
  1445. IL = 1 + ( N-1 )*INT( DLARND( 1, ISEED2 ) )
  1446. IU = 1 + ( N-1 )*INT( DLARND( 1, ISEED2 ) )
  1447. IF( IU.LT.IL ) THEN
  1448. ITEMP = IU
  1449. IU = IL
  1450. IL = ITEMP
  1451. END IF
  1452. END IF
  1453. *
  1454. CALL DSTEBZ( 'I', 'E', N, VL, VU, IL, IU, ABSTOL, SD, SE,
  1455. $ M2, NSPLIT, WA2, IWORK( 1 ), IWORK( N+1 ),
  1456. $ RWORK, IWORK( 2*N+1 ), IINFO )
  1457. IF( IINFO.NE.0 ) THEN
  1458. WRITE( NOUNIT, FMT = 9999 )'DSTEBZ(I)', IINFO, N, JTYPE,
  1459. $ IOLDSD
  1460. INFO = ABS( IINFO )
  1461. IF( IINFO.LT.0 ) THEN
  1462. RETURN
  1463. ELSE
  1464. RESULT( 19 ) = ULPINV
  1465. GO TO 280
  1466. END IF
  1467. END IF
  1468. *
  1469. * Determine the values VL and VU of the IL-th and IU-th
  1470. * eigenvalues and ask for all eigenvalues in this range.
  1471. *
  1472. IF( N.GT.0 ) THEN
  1473. IF( IL.NE.1 ) THEN
  1474. VL = WA1( IL ) - MAX( HALF*( WA1( IL )-WA1( IL-1 ) ),
  1475. $ ULP*ANORM, TWO*RTUNFL )
  1476. ELSE
  1477. VL = WA1( 1 ) - MAX( HALF*( WA1( N )-WA1( 1 ) ),
  1478. $ ULP*ANORM, TWO*RTUNFL )
  1479. END IF
  1480. IF( IU.NE.N ) THEN
  1481. VU = WA1( IU ) + MAX( HALF*( WA1( IU+1 )-WA1( IU ) ),
  1482. $ ULP*ANORM, TWO*RTUNFL )
  1483. ELSE
  1484. VU = WA1( N ) + MAX( HALF*( WA1( N )-WA1( 1 ) ),
  1485. $ ULP*ANORM, TWO*RTUNFL )
  1486. END IF
  1487. ELSE
  1488. VL = ZERO
  1489. VU = ONE
  1490. END IF
  1491. *
  1492. CALL DSTEBZ( 'V', 'E', N, VL, VU, IL, IU, ABSTOL, SD, SE,
  1493. $ M3, NSPLIT, WA3, IWORK( 1 ), IWORK( N+1 ),
  1494. $ RWORK, IWORK( 2*N+1 ), IINFO )
  1495. IF( IINFO.NE.0 ) THEN
  1496. WRITE( NOUNIT, FMT = 9999 )'DSTEBZ(V)', IINFO, N, JTYPE,
  1497. $ IOLDSD
  1498. INFO = ABS( IINFO )
  1499. IF( IINFO.LT.0 ) THEN
  1500. RETURN
  1501. ELSE
  1502. RESULT( 19 ) = ULPINV
  1503. GO TO 280
  1504. END IF
  1505. END IF
  1506. *
  1507. IF( M3.EQ.0 .AND. N.NE.0 ) THEN
  1508. RESULT( 19 ) = ULPINV
  1509. GO TO 280
  1510. END IF
  1511. *
  1512. * Do test 19
  1513. *
  1514. TEMP1 = DSXT1( 1, WA2, M2, WA3, M3, ABSTOL, ULP, UNFL )
  1515. TEMP2 = DSXT1( 1, WA3, M3, WA2, M2, ABSTOL, ULP, UNFL )
  1516. IF( N.GT.0 ) THEN
  1517. TEMP3 = MAX( ABS( WA1( N ) ), ABS( WA1( 1 ) ) )
  1518. ELSE
  1519. TEMP3 = ZERO
  1520. END IF
  1521. *
  1522. RESULT( 19 ) = ( TEMP1+TEMP2 ) / MAX( UNFL, TEMP3*ULP )
  1523. *
  1524. * Call ZSTEIN to compute eigenvectors corresponding to
  1525. * eigenvalues in WA1. (First call DSTEBZ again, to make sure
  1526. * it returns these eigenvalues in the correct order.)
  1527. *
  1528. NTEST = 21
  1529. CALL DSTEBZ( 'A', 'B', N, VL, VU, IL, IU, ABSTOL, SD, SE, M,
  1530. $ NSPLIT, WA1, IWORK( 1 ), IWORK( N+1 ), RWORK,
  1531. $ IWORK( 2*N+1 ), IINFO )
  1532. IF( IINFO.NE.0 ) THEN
  1533. WRITE( NOUNIT, FMT = 9999 )'DSTEBZ(A,B)', IINFO, N,
  1534. $ JTYPE, IOLDSD
  1535. INFO = ABS( IINFO )
  1536. IF( IINFO.LT.0 ) THEN
  1537. RETURN
  1538. ELSE
  1539. RESULT( 20 ) = ULPINV
  1540. RESULT( 21 ) = ULPINV
  1541. GO TO 280
  1542. END IF
  1543. END IF
  1544. *
  1545. CALL ZSTEIN( N, SD, SE, M, WA1, IWORK( 1 ), IWORK( N+1 ), Z,
  1546. $ LDU, RWORK, IWORK( 2*N+1 ), IWORK( 3*N+1 ),
  1547. $ IINFO )
  1548. IF( IINFO.NE.0 ) THEN
  1549. WRITE( NOUNIT, FMT = 9999 )'ZSTEIN', IINFO, N, JTYPE,
  1550. $ IOLDSD
  1551. INFO = ABS( IINFO )
  1552. IF( IINFO.LT.0 ) THEN
  1553. RETURN
  1554. ELSE
  1555. RESULT( 20 ) = ULPINV
  1556. RESULT( 21 ) = ULPINV
  1557. GO TO 280
  1558. END IF
  1559. END IF
  1560. *
  1561. * Do tests 20 and 21
  1562. *
  1563. CALL ZSTT21( N, 0, SD, SE, WA1, DUMMA, Z, LDU, WORK, RWORK,
  1564. $ RESULT( 20 ) )
  1565. *
  1566. * Call ZSTEDC(I) to compute D1 and Z, do tests.
  1567. *
  1568. * Compute D1 and Z
  1569. *
  1570. INDE = 1
  1571. INDRWK = INDE + N
  1572. CALL DCOPY( N, SD, 1, D1, 1 )
  1573. IF( N.GT.0 )
  1574. $ CALL DCOPY( N-1, SE, 1, RWORK( INDE ), 1 )
  1575. CALL ZLASET( 'Full', N, N, CZERO, CONE, Z, LDU )
  1576. *
  1577. NTEST = 22
  1578. CALL ZSTEDC( 'I', N, D1, RWORK( INDE ), Z, LDU, WORK, LWEDC,
  1579. $ RWORK( INDRWK ), LRWEDC, IWORK, LIWEDC, IINFO )
  1580. IF( IINFO.NE.0 ) THEN
  1581. WRITE( NOUNIT, FMT = 9999 )'ZSTEDC(I)', IINFO, N, JTYPE,
  1582. $ IOLDSD
  1583. INFO = ABS( IINFO )
  1584. IF( IINFO.LT.0 ) THEN
  1585. RETURN
  1586. ELSE
  1587. RESULT( 22 ) = ULPINV
  1588. GO TO 280
  1589. END IF
  1590. END IF
  1591. *
  1592. * Do Tests 22 and 23
  1593. *
  1594. CALL ZSTT21( N, 0, SD, SE, D1, DUMMA, Z, LDU, WORK, RWORK,
  1595. $ RESULT( 22 ) )
  1596. *
  1597. * Call ZSTEDC(V) to compute D1 and Z, do tests.
  1598. *
  1599. * Compute D1 and Z
  1600. *
  1601. CALL DCOPY( N, SD, 1, D1, 1 )
  1602. IF( N.GT.0 )
  1603. $ CALL DCOPY( N-1, SE, 1, RWORK( INDE ), 1 )
  1604. CALL ZLASET( 'Full', N, N, CZERO, CONE, Z, LDU )
  1605. *
  1606. NTEST = 24
  1607. CALL ZSTEDC( 'V', N, D1, RWORK( INDE ), Z, LDU, WORK, LWEDC,
  1608. $ RWORK( INDRWK ), LRWEDC, IWORK, LIWEDC, IINFO )
  1609. IF( IINFO.NE.0 ) THEN
  1610. WRITE( NOUNIT, FMT = 9999 )'ZSTEDC(V)', IINFO, N, JTYPE,
  1611. $ IOLDSD
  1612. INFO = ABS( IINFO )
  1613. IF( IINFO.LT.0 ) THEN
  1614. RETURN
  1615. ELSE
  1616. RESULT( 24 ) = ULPINV
  1617. GO TO 280
  1618. END IF
  1619. END IF
  1620. *
  1621. * Do Tests 24 and 25
  1622. *
  1623. CALL ZSTT21( N, 0, SD, SE, D1, DUMMA, Z, LDU, WORK, RWORK,
  1624. $ RESULT( 24 ) )
  1625. *
  1626. * Call ZSTEDC(N) to compute D2, do tests.
  1627. *
  1628. * Compute D2
  1629. *
  1630. CALL DCOPY( N, SD, 1, D2, 1 )
  1631. IF( N.GT.0 )
  1632. $ CALL DCOPY( N-1, SE, 1, RWORK( INDE ), 1 )
  1633. CALL ZLASET( 'Full', N, N, CZERO, CONE, Z, LDU )
  1634. *
  1635. NTEST = 26
  1636. CALL ZSTEDC( 'N', N, D2, RWORK( INDE ), Z, LDU, WORK, LWEDC,
  1637. $ RWORK( INDRWK ), LRWEDC, IWORK, LIWEDC, IINFO )
  1638. IF( IINFO.NE.0 ) THEN
  1639. WRITE( NOUNIT, FMT = 9999 )'ZSTEDC(N)', IINFO, N, JTYPE,
  1640. $ IOLDSD
  1641. INFO = ABS( IINFO )
  1642. IF( IINFO.LT.0 ) THEN
  1643. RETURN
  1644. ELSE
  1645. RESULT( 26 ) = ULPINV
  1646. GO TO 280
  1647. END IF
  1648. END IF
  1649. *
  1650. * Do Test 26
  1651. *
  1652. TEMP1 = ZERO
  1653. TEMP2 = ZERO
  1654. *
  1655. DO 210 J = 1, N
  1656. TEMP1 = MAX( TEMP1, ABS( D1( J ) ), ABS( D2( J ) ) )
  1657. TEMP2 = MAX( TEMP2, ABS( D1( J )-D2( J ) ) )
  1658. 210 CONTINUE
  1659. *
  1660. RESULT( 26 ) = TEMP2 / MAX( UNFL, ULP*MAX( TEMP1, TEMP2 ) )
  1661. *
  1662. * Only test ZSTEMR if IEEE compliant
  1663. *
  1664. IF( ILAENV( 10, 'ZSTEMR', 'VA', 1, 0, 0, 0 ).EQ.1 .AND.
  1665. $ ILAENV( 11, 'ZSTEMR', 'VA', 1, 0, 0, 0 ).EQ.1 ) THEN
  1666. *
  1667. * Call ZSTEMR, do test 27 (relative eigenvalue accuracy)
  1668. *
  1669. * If S is positive definite and diagonally dominant,
  1670. * ask for all eigenvalues with high relative accuracy.
  1671. *
  1672. VL = ZERO
  1673. VU = ZERO
  1674. IL = 0
  1675. IU = 0
  1676. IF( JTYPE.EQ.21 .AND. CREL ) THEN
  1677. NTEST = 27
  1678. ABSTOL = UNFL + UNFL
  1679. CALL ZSTEMR( 'V', 'A', N, SD, SE, VL, VU, IL, IU,
  1680. $ M, WR, Z, LDU, N, IWORK( 1 ), TRYRAC,
  1681. $ RWORK, LRWORK, IWORK( 2*N+1 ), LWORK-2*N,
  1682. $ IINFO )
  1683. IF( IINFO.NE.0 ) THEN
  1684. WRITE( NOUNIT, FMT = 9999 )'ZSTEMR(V,A,rel)',
  1685. $ IINFO, N, JTYPE, IOLDSD
  1686. INFO = ABS( IINFO )
  1687. IF( IINFO.LT.0 ) THEN
  1688. RETURN
  1689. ELSE
  1690. RESULT( 27 ) = ULPINV
  1691. GO TO 270
  1692. END IF
  1693. END IF
  1694. *
  1695. * Do test 27
  1696. *
  1697. TEMP2 = TWO*( TWO*N-ONE )*ULP*( ONE+EIGHT*HALF**2 ) /
  1698. $ ( ONE-HALF )**4
  1699. *
  1700. TEMP1 = ZERO
  1701. DO 220 J = 1, N
  1702. TEMP1 = MAX( TEMP1, ABS( D4( J )-WR( N-J+1 ) ) /
  1703. $ ( ABSTOL+ABS( D4( J ) ) ) )
  1704. 220 CONTINUE
  1705. *
  1706. RESULT( 27 ) = TEMP1 / TEMP2
  1707. *
  1708. IL = 1 + ( N-1 )*INT( DLARND( 1, ISEED2 ) )
  1709. IU = 1 + ( N-1 )*INT( DLARND( 1, ISEED2 ) )
  1710. IF( IU.LT.IL ) THEN
  1711. ITEMP = IU
  1712. IU = IL
  1713. IL = ITEMP
  1714. END IF
  1715. *
  1716. IF( CRANGE ) THEN
  1717. NTEST = 28
  1718. ABSTOL = UNFL + UNFL
  1719. CALL ZSTEMR( 'V', 'I', N, SD, SE, VL, VU, IL, IU,
  1720. $ M, WR, Z, LDU, N, IWORK( 1 ), TRYRAC,
  1721. $ RWORK, LRWORK, IWORK( 2*N+1 ),
  1722. $ LWORK-2*N, IINFO )
  1723. *
  1724. IF( IINFO.NE.0 ) THEN
  1725. WRITE( NOUNIT, FMT = 9999 )'ZSTEMR(V,I,rel)',
  1726. $ IINFO, N, JTYPE, IOLDSD
  1727. INFO = ABS( IINFO )
  1728. IF( IINFO.LT.0 ) THEN
  1729. RETURN
  1730. ELSE
  1731. RESULT( 28 ) = ULPINV
  1732. GO TO 270
  1733. END IF
  1734. END IF
  1735. *
  1736. * Do test 28
  1737. *
  1738. TEMP2 = TWO*( TWO*N-ONE )*ULP*
  1739. $ ( ONE+EIGHT*HALF**2 ) / ( ONE-HALF )**4
  1740. *
  1741. TEMP1 = ZERO
  1742. DO 230 J = IL, IU
  1743. TEMP1 = MAX( TEMP1, ABS( WR( J-IL+1 )-D4( N-J+
  1744. $ 1 ) ) / ( ABSTOL+ABS( WR( J-IL+1 ) ) ) )
  1745. 230 CONTINUE
  1746. *
  1747. RESULT( 28 ) = TEMP1 / TEMP2
  1748. ELSE
  1749. RESULT( 28 ) = ZERO
  1750. END IF
  1751. ELSE
  1752. RESULT( 27 ) = ZERO
  1753. RESULT( 28 ) = ZERO
  1754. END IF
  1755. *
  1756. * Call ZSTEMR(V,I) to compute D1 and Z, do tests.
  1757. *
  1758. * Compute D1 and Z
  1759. *
  1760. CALL DCOPY( N, SD, 1, D5, 1 )
  1761. IF( N.GT.0 )
  1762. $ CALL DCOPY( N-1, SE, 1, RWORK, 1 )
  1763. CALL ZLASET( 'Full', N, N, CZERO, CONE, Z, LDU )
  1764. *
  1765. IF( CRANGE ) THEN
  1766. NTEST = 29
  1767. IL = 1 + ( N-1 )*INT( DLARND( 1, ISEED2 ) )
  1768. IU = 1 + ( N-1 )*INT( DLARND( 1, ISEED2 ) )
  1769. IF( IU.LT.IL ) THEN
  1770. ITEMP = IU
  1771. IU = IL
  1772. IL = ITEMP
  1773. END IF
  1774. CALL ZSTEMR( 'V', 'I', N, D5, RWORK, VL, VU, IL, IU,
  1775. $ M, D1, Z, LDU, N, IWORK( 1 ), TRYRAC,
  1776. $ RWORK( N+1 ), LRWORK-N, IWORK( 2*N+1 ),
  1777. $ LIWORK-2*N, IINFO )
  1778. IF( IINFO.NE.0 ) THEN
  1779. WRITE( NOUNIT, FMT = 9999 )'ZSTEMR(V,I)', IINFO,
  1780. $ N, JTYPE, IOLDSD
  1781. INFO = ABS( IINFO )
  1782. IF( IINFO.LT.0 ) THEN
  1783. RETURN
  1784. ELSE
  1785. RESULT( 29 ) = ULPINV
  1786. GO TO 280
  1787. END IF
  1788. END IF
  1789. *
  1790. * Do Tests 29 and 30
  1791. *
  1792. * Call ZSTEMR to compute D2, do tests.
  1793. *
  1794. * Compute D2
  1795. *
  1796. CALL DCOPY( N, SD, 1, D5, 1 )
  1797. IF( N.GT.0 )
  1798. $ CALL DCOPY( N-1, SE, 1, RWORK, 1 )
  1799. *
  1800. NTEST = 31
  1801. CALL ZSTEMR( 'N', 'I', N, D5, RWORK, VL, VU, IL, IU,
  1802. $ M, D2, Z, LDU, N, IWORK( 1 ), TRYRAC,
  1803. $ RWORK( N+1 ), LRWORK-N, IWORK( 2*N+1 ),
  1804. $ LIWORK-2*N, IINFO )
  1805. IF( IINFO.NE.0 ) THEN
  1806. WRITE( NOUNIT, FMT = 9999 )'ZSTEMR(N,I)', IINFO,
  1807. $ N, JTYPE, IOLDSD
  1808. INFO = ABS( IINFO )
  1809. IF( IINFO.LT.0 ) THEN
  1810. RETURN
  1811. ELSE
  1812. RESULT( 31 ) = ULPINV
  1813. GO TO 280
  1814. END IF
  1815. END IF
  1816. *
  1817. * Do Test 31
  1818. *
  1819. TEMP1 = ZERO
  1820. TEMP2 = ZERO
  1821. *
  1822. DO 240 J = 1, IU - IL + 1
  1823. TEMP1 = MAX( TEMP1, ABS( D1( J ) ),
  1824. $ ABS( D2( J ) ) )
  1825. TEMP2 = MAX( TEMP2, ABS( D1( J )-D2( J ) ) )
  1826. 240 CONTINUE
  1827. *
  1828. RESULT( 31 ) = TEMP2 / MAX( UNFL,
  1829. $ ULP*MAX( TEMP1, TEMP2 ) )
  1830. *
  1831. * Call ZSTEMR(V,V) to compute D1 and Z, do tests.
  1832. *
  1833. * Compute D1 and Z
  1834. *
  1835. CALL DCOPY( N, SD, 1, D5, 1 )
  1836. IF( N.GT.0 )
  1837. $ CALL DCOPY( N-1, SE, 1, RWORK, 1 )
  1838. CALL ZLASET( 'Full', N, N, CZERO, CONE, Z, LDU )
  1839. *
  1840. NTEST = 32
  1841. *
  1842. IF( N.GT.0 ) THEN
  1843. IF( IL.NE.1 ) THEN
  1844. VL = D2( IL ) - MAX( HALF*
  1845. $ ( D2( IL )-D2( IL-1 ) ), ULP*ANORM,
  1846. $ TWO*RTUNFL )
  1847. ELSE
  1848. VL = D2( 1 ) - MAX( HALF*( D2( N )-D2( 1 ) ),
  1849. $ ULP*ANORM, TWO*RTUNFL )
  1850. END IF
  1851. IF( IU.NE.N ) THEN
  1852. VU = D2( IU ) + MAX( HALF*
  1853. $ ( D2( IU+1 )-D2( IU ) ), ULP*ANORM,
  1854. $ TWO*RTUNFL )
  1855. ELSE
  1856. VU = D2( N ) + MAX( HALF*( D2( N )-D2( 1 ) ),
  1857. $ ULP*ANORM, TWO*RTUNFL )
  1858. END IF
  1859. ELSE
  1860. VL = ZERO
  1861. VU = ONE
  1862. END IF
  1863. *
  1864. CALL ZSTEMR( 'V', 'V', N, D5, RWORK, VL, VU, IL, IU,
  1865. $ M, D1, Z, LDU, M, IWORK( 1 ), TRYRAC,
  1866. $ RWORK( N+1 ), LRWORK-N, IWORK( 2*N+1 ),
  1867. $ LIWORK-2*N, IINFO )
  1868. IF( IINFO.NE.0 ) THEN
  1869. WRITE( NOUNIT, FMT = 9999 )'ZSTEMR(V,V)', IINFO,
  1870. $ N, JTYPE, IOLDSD
  1871. INFO = ABS( IINFO )
  1872. IF( IINFO.LT.0 ) THEN
  1873. RETURN
  1874. ELSE
  1875. RESULT( 32 ) = ULPINV
  1876. GO TO 280
  1877. END IF
  1878. END IF
  1879. *
  1880. * Do Tests 32 and 33
  1881. *
  1882. CALL ZSTT22( N, M, 0, SD, SE, D1, DUMMA, Z, LDU, WORK,
  1883. $ M, RWORK, RESULT( 32 ) )
  1884. *
  1885. * Call ZSTEMR to compute D2, do tests.
  1886. *
  1887. * Compute D2
  1888. *
  1889. CALL DCOPY( N, SD, 1, D5, 1 )
  1890. IF( N.GT.0 )
  1891. $ CALL DCOPY( N-1, SE, 1, RWORK, 1 )
  1892. *
  1893. NTEST = 34
  1894. CALL ZSTEMR( 'N', 'V', N, D5, RWORK, VL, VU, IL, IU,
  1895. $ M, D2, Z, LDU, N, IWORK( 1 ), TRYRAC,
  1896. $ RWORK( N+1 ), LRWORK-N, IWORK( 2*N+1 ),
  1897. $ LIWORK-2*N, IINFO )
  1898. IF( IINFO.NE.0 ) THEN
  1899. WRITE( NOUNIT, FMT = 9999 )'ZSTEMR(N,V)', IINFO,
  1900. $ N, JTYPE, IOLDSD
  1901. INFO = ABS( IINFO )
  1902. IF( IINFO.LT.0 ) THEN
  1903. RETURN
  1904. ELSE
  1905. RESULT( 34 ) = ULPINV
  1906. GO TO 280
  1907. END IF
  1908. END IF
  1909. *
  1910. * Do Test 34
  1911. *
  1912. TEMP1 = ZERO
  1913. TEMP2 = ZERO
  1914. *
  1915. DO 250 J = 1, IU - IL + 1
  1916. TEMP1 = MAX( TEMP1, ABS( D1( J ) ),
  1917. $ ABS( D2( J ) ) )
  1918. TEMP2 = MAX( TEMP2, ABS( D1( J )-D2( J ) ) )
  1919. 250 CONTINUE
  1920. *
  1921. RESULT( 34 ) = TEMP2 / MAX( UNFL,
  1922. $ ULP*MAX( TEMP1, TEMP2 ) )
  1923. ELSE
  1924. RESULT( 29 ) = ZERO
  1925. RESULT( 30 ) = ZERO
  1926. RESULT( 31 ) = ZERO
  1927. RESULT( 32 ) = ZERO
  1928. RESULT( 33 ) = ZERO
  1929. RESULT( 34 ) = ZERO
  1930. END IF
  1931. *
  1932. * Call ZSTEMR(V,A) to compute D1 and Z, do tests.
  1933. *
  1934. * Compute D1 and Z
  1935. *
  1936. CALL DCOPY( N, SD, 1, D5, 1 )
  1937. IF( N.GT.0 )
  1938. $ CALL DCOPY( N-1, SE, 1, RWORK, 1 )
  1939. *
  1940. NTEST = 35
  1941. *
  1942. CALL ZSTEMR( 'V', 'A', N, D5, RWORK, VL, VU, IL, IU,
  1943. $ M, D1, Z, LDU, N, IWORK( 1 ), TRYRAC,
  1944. $ RWORK( N+1 ), LRWORK-N, IWORK( 2*N+1 ),
  1945. $ LIWORK-2*N, IINFO )
  1946. IF( IINFO.NE.0 ) THEN
  1947. WRITE( NOUNIT, FMT = 9999 )'ZSTEMR(V,A)', IINFO, N,
  1948. $ JTYPE, IOLDSD
  1949. INFO = ABS( IINFO )
  1950. IF( IINFO.LT.0 ) THEN
  1951. RETURN
  1952. ELSE
  1953. RESULT( 35 ) = ULPINV
  1954. GO TO 280
  1955. END IF
  1956. END IF
  1957. *
  1958. * Do Tests 35 and 36
  1959. *
  1960. CALL ZSTT22( N, M, 0, SD, SE, D1, DUMMA, Z, LDU, WORK, M,
  1961. $ RWORK, RESULT( 35 ) )
  1962. *
  1963. * Call ZSTEMR to compute D2, do tests.
  1964. *
  1965. * Compute D2
  1966. *
  1967. CALL DCOPY( N, SD, 1, D5, 1 )
  1968. IF( N.GT.0 )
  1969. $ CALL DCOPY( N-1, SE, 1, RWORK, 1 )
  1970. *
  1971. NTEST = 37
  1972. CALL ZSTEMR( 'N', 'A', N, D5, RWORK, VL, VU, IL, IU,
  1973. $ M, D2, Z, LDU, N, IWORK( 1 ), TRYRAC,
  1974. $ RWORK( N+1 ), LRWORK-N, IWORK( 2*N+1 ),
  1975. $ LIWORK-2*N, IINFO )
  1976. IF( IINFO.NE.0 ) THEN
  1977. WRITE( NOUNIT, FMT = 9999 )'ZSTEMR(N,A)', IINFO, N,
  1978. $ JTYPE, IOLDSD
  1979. INFO = ABS( IINFO )
  1980. IF( IINFO.LT.0 ) THEN
  1981. RETURN
  1982. ELSE
  1983. RESULT( 37 ) = ULPINV
  1984. GO TO 280
  1985. END IF
  1986. END IF
  1987. *
  1988. * Do Test 37
  1989. *
  1990. TEMP1 = ZERO
  1991. TEMP2 = ZERO
  1992. *
  1993. DO 260 J = 1, N
  1994. TEMP1 = MAX( TEMP1, ABS( D1( J ) ), ABS( D2( J ) ) )
  1995. TEMP2 = MAX( TEMP2, ABS( D1( J )-D2( J ) ) )
  1996. 260 CONTINUE
  1997. *
  1998. RESULT( 37 ) = TEMP2 / MAX( UNFL,
  1999. $ ULP*MAX( TEMP1, TEMP2 ) )
  2000. END IF
  2001. 270 CONTINUE
  2002. 280 CONTINUE
  2003. NTESTT = NTESTT + NTEST
  2004. *
  2005. * End of Loop -- Check for RESULT(j) > THRESH
  2006. *
  2007. * Print out tests which fail.
  2008. *
  2009. DO 290 JR = 1, NTEST
  2010. IF( RESULT( JR ).GE.THRESH ) THEN
  2011. *
  2012. * If this is the first test to fail,
  2013. * print a header to the data file.
  2014. *
  2015. IF( NERRS.EQ.0 ) THEN
  2016. WRITE( NOUNIT, FMT = 9998 )'ZST'
  2017. WRITE( NOUNIT, FMT = 9997 )
  2018. WRITE( NOUNIT, FMT = 9996 )
  2019. WRITE( NOUNIT, FMT = 9995 )'Hermitian'
  2020. WRITE( NOUNIT, FMT = 9994 )
  2021. *
  2022. * Tests performed
  2023. *
  2024. WRITE( NOUNIT, FMT = 9987 )
  2025. END IF
  2026. NERRS = NERRS + 1
  2027. IF( RESULT( JR ).LT.10000.0D0 ) THEN
  2028. WRITE( NOUNIT, FMT = 9989 )N, JTYPE, IOLDSD, JR,
  2029. $ RESULT( JR )
  2030. ELSE
  2031. WRITE( NOUNIT, FMT = 9988 )N, JTYPE, IOLDSD, JR,
  2032. $ RESULT( JR )
  2033. END IF
  2034. END IF
  2035. 290 CONTINUE
  2036. 300 CONTINUE
  2037. 310 CONTINUE
  2038. *
  2039. * Summary
  2040. *
  2041. CALL DLASUM( 'ZST', NOUNIT, NERRS, NTESTT )
  2042. RETURN
  2043. *
  2044. 9999 FORMAT( ' ZCHKST2STG: ', A, ' returned INFO=', I6, '.', / 9X,
  2045. $ 'N=', I6, ', JTYPE=', I6, ', ISEED=(', 3( I5, ',' ), I5, ')' )
  2046. *
  2047. 9998 FORMAT( / 1X, A3, ' -- Complex Hermitian eigenvalue problem' )
  2048. 9997 FORMAT( ' Matrix types (see ZCHKST2STG for details): ' )
  2049. *
  2050. 9996 FORMAT( / ' Special Matrices:',
  2051. $ / ' 1=Zero matrix. ',
  2052. $ ' 5=Diagonal: clustered entries.',
  2053. $ / ' 2=Identity matrix. ',
  2054. $ ' 6=Diagonal: large, evenly spaced.',
  2055. $ / ' 3=Diagonal: evenly spaced entries. ',
  2056. $ ' 7=Diagonal: small, evenly spaced.',
  2057. $ / ' 4=Diagonal: geometr. spaced entries.' )
  2058. 9995 FORMAT( ' Dense ', A, ' Matrices:',
  2059. $ / ' 8=Evenly spaced eigenvals. ',
  2060. $ ' 12=Small, evenly spaced eigenvals.',
  2061. $ / ' 9=Geometrically spaced eigenvals. ',
  2062. $ ' 13=Matrix with random O(1) entries.',
  2063. $ / ' 10=Clustered eigenvalues. ',
  2064. $ ' 14=Matrix with large random entries.',
  2065. $ / ' 11=Large, evenly spaced eigenvals. ',
  2066. $ ' 15=Matrix with small random entries.' )
  2067. 9994 FORMAT( ' 16=Positive definite, evenly spaced eigenvalues',
  2068. $ / ' 17=Positive definite, geometrically spaced eigenvlaues',
  2069. $ / ' 18=Positive definite, clustered eigenvalues',
  2070. $ / ' 19=Positive definite, small evenly spaced eigenvalues',
  2071. $ / ' 20=Positive definite, large evenly spaced eigenvalues',
  2072. $ / ' 21=Diagonally dominant tridiagonal, geometrically',
  2073. $ ' spaced eigenvalues' )
  2074. *
  2075. 9989 FORMAT( ' Matrix order=', I5, ', type=', I2, ', seed=',
  2076. $ 4( I4, ',' ), ' result ', I3, ' is', 0P, F8.2 )
  2077. 9988 FORMAT( ' Matrix order=', I5, ', type=', I2, ', seed=',
  2078. $ 4( I4, ',' ), ' result ', I3, ' is', 1P, D10.3 )
  2079. *
  2080. 9987 FORMAT( / 'Test performed: see ZCHKST2STG for details.', / )
  2081. *
  2082. * End of ZCHKST2STG
  2083. *
  2084. END