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.

dchkgg.f 45 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241
  1. *> \brief \b DCHKGG
  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 DCHKGG( NSIZES, NN, NTYPES, DOTYPE, ISEED, THRESH,
  12. * TSTDIF, THRSHN, NOUNIT, A, LDA, B, H, T, S1,
  13. * S2, P1, P2, U, LDU, V, Q, Z, ALPHR1, ALPHI1,
  14. * BETA1, ALPHR3, ALPHI3, BETA3, EVECTL, EVECTR,
  15. * WORK, LWORK, LLWORK, RESULT, INFO )
  16. *
  17. * .. Scalar Arguments ..
  18. * LOGICAL TSTDIF
  19. * INTEGER INFO, LDA, LDU, LWORK, NOUNIT, NSIZES, NTYPES
  20. * DOUBLE PRECISION THRESH, THRSHN
  21. * ..
  22. * .. Array Arguments ..
  23. * LOGICAL DOTYPE( * ), LLWORK( * )
  24. * INTEGER ISEED( 4 ), NN( * )
  25. * DOUBLE PRECISION A( LDA, * ), ALPHI1( * ), ALPHI3( * ),
  26. * $ ALPHR1( * ), ALPHR3( * ), B( LDA, * ),
  27. * $ BETA1( * ), BETA3( * ), EVECTL( LDU, * ),
  28. * $ EVECTR( LDU, * ), H( LDA, * ), P1( LDA, * ),
  29. * $ P2( LDA, * ), Q( LDU, * ), RESULT( 15 ),
  30. * $ S1( LDA, * ), S2( LDA, * ), T( LDA, * ),
  31. * $ U( LDU, * ), V( LDU, * ), WORK( * ),
  32. * $ Z( LDU, * )
  33. * ..
  34. *
  35. *
  36. *> \par Purpose:
  37. * =============
  38. *>
  39. *> \verbatim
  40. *>
  41. *> DCHKGG checks the nonsymmetric generalized eigenvalue problem
  42. *> routines.
  43. *> T T T
  44. *> DGGHRD factors A and B as U H V and U T V , where means
  45. *> transpose, H is hessenberg, T is triangular and U and V are
  46. *> orthogonal.
  47. *> T T
  48. *> DHGEQZ factors H and T as Q S Z and Q P Z , where P is upper
  49. *> triangular, S is in generalized Schur form (block upper triangular,
  50. *> with 1x1 and 2x2 blocks on the diagonal, the 2x2 blocks
  51. *> corresponding to complex conjugate pairs of generalized
  52. *> eigenvalues), and Q and Z are orthogonal. It also computes the
  53. *> generalized eigenvalues (alpha(1),beta(1)),...,(alpha(n),beta(n)),
  54. *> where alpha(j)=S(j,j) and beta(j)=P(j,j) -- thus,
  55. *> w(j) = alpha(j)/beta(j) is a root of the generalized eigenvalue
  56. *> problem
  57. *>
  58. *> det( A - w(j) B ) = 0
  59. *>
  60. *> and m(j) = beta(j)/alpha(j) is a root of the essentially equivalent
  61. *> problem
  62. *>
  63. *> det( m(j) A - B ) = 0
  64. *>
  65. *> DTGEVC computes the matrix L of left eigenvectors and the matrix R
  66. *> of right eigenvectors for the matrix pair ( S, P ). In the
  67. *> description below, l and r are left and right eigenvectors
  68. *> corresponding to the generalized eigenvalues (alpha,beta).
  69. *>
  70. *> When DCHKGG is called, a number of matrix "sizes" ("n's") and a
  71. *> number of matrix "types" are specified. For each size ("n")
  72. *> and each type of matrix, one matrix will be generated and used
  73. *> to test the nonsymmetric eigenroutines. For each matrix, 15
  74. *> tests will be performed. The first twelve "test ratios" should be
  75. *> small -- O(1). They will be compared with the threshold THRESH:
  76. *>
  77. *> T
  78. *> (1) | A - U H V | / ( |A| n ulp )
  79. *>
  80. *> T
  81. *> (2) | B - U T V | / ( |B| n ulp )
  82. *>
  83. *> T
  84. *> (3) | I - UU | / ( n ulp )
  85. *>
  86. *> T
  87. *> (4) | I - VV | / ( n ulp )
  88. *>
  89. *> T
  90. *> (5) | H - Q S Z | / ( |H| n ulp )
  91. *>
  92. *> T
  93. *> (6) | T - Q P Z | / ( |T| n ulp )
  94. *>
  95. *> T
  96. *> (7) | I - QQ | / ( n ulp )
  97. *>
  98. *> T
  99. *> (8) | I - ZZ | / ( n ulp )
  100. *>
  101. *> (9) max over all left eigenvalue/-vector pairs (beta/alpha,l) of
  102. *>
  103. *> | l**H * (beta S - alpha P) | / ( ulp max( |beta S|, |alpha P| ) )
  104. *>
  105. *> (10) max over all left eigenvalue/-vector pairs (beta/alpha,l') of
  106. *> T
  107. *> | l'**H * (beta H - alpha T) | / ( ulp max( |beta H|, |alpha T| ) )
  108. *>
  109. *> where the eigenvectors l' are the result of passing Q to
  110. *> DTGEVC and back transforming (HOWMNY='B').
  111. *>
  112. *> (11) max over all right eigenvalue/-vector pairs (beta/alpha,r) of
  113. *>
  114. *> | (beta S - alpha T) r | / ( ulp max( |beta S|, |alpha T| ) )
  115. *>
  116. *> (12) max over all right eigenvalue/-vector pairs (beta/alpha,r') of
  117. *>
  118. *> | (beta H - alpha T) r' | / ( ulp max( |beta H|, |alpha T| ) )
  119. *>
  120. *> where the eigenvectors r' are the result of passing Z to
  121. *> DTGEVC and back transforming (HOWMNY='B').
  122. *>
  123. *> The last three test ratios will usually be small, but there is no
  124. *> mathematical requirement that they be so. They are therefore
  125. *> compared with THRESH only if TSTDIF is .TRUE.
  126. *>
  127. *> (13) | S(Q,Z computed) - S(Q,Z not computed) | / ( |S| ulp )
  128. *>
  129. *> (14) | P(Q,Z computed) - P(Q,Z not computed) | / ( |P| ulp )
  130. *>
  131. *> (15) max( |alpha(Q,Z computed) - alpha(Q,Z not computed)|/|S| ,
  132. *> |beta(Q,Z computed) - beta(Q,Z not computed)|/|P| ) / ulp
  133. *>
  134. *> In addition, the normalization of L and R are checked, and compared
  135. *> with the threshold THRSHN.
  136. *>
  137. *> Test Matrices
  138. *> ---- --------
  139. *>
  140. *> The sizes of the test matrices are specified by an array
  141. *> NN(1:NSIZES); the value of each element NN(j) specifies one size.
  142. *> The "types" are specified by a logical array DOTYPE( 1:NTYPES ); if
  143. *> DOTYPE(j) is .TRUE., then matrix type "j" will be generated.
  144. *> Currently, the list of possible types is:
  145. *>
  146. *> (1) ( 0, 0 ) (a pair of zero matrices)
  147. *>
  148. *> (2) ( I, 0 ) (an identity and a zero matrix)
  149. *>
  150. *> (3) ( 0, I ) (an identity and a zero matrix)
  151. *>
  152. *> (4) ( I, I ) (a pair of identity matrices)
  153. *>
  154. *> t t
  155. *> (5) ( J , J ) (a pair of transposed Jordan blocks)
  156. *>
  157. *> t ( I 0 )
  158. *> (6) ( X, Y ) where X = ( J 0 ) and Y = ( t )
  159. *> ( 0 I ) ( 0 J )
  160. *> and I is a k x k identity and J a (k+1)x(k+1)
  161. *> Jordan block; k=(N-1)/2
  162. *>
  163. *> (7) ( D, I ) where D is diag( 0, 1,..., N-1 ) (a diagonal
  164. *> matrix with those diagonal entries.)
  165. *> (8) ( I, D )
  166. *>
  167. *> (9) ( big*D, small*I ) where "big" is near overflow and small=1/big
  168. *>
  169. *> (10) ( small*D, big*I )
  170. *>
  171. *> (11) ( big*I, small*D )
  172. *>
  173. *> (12) ( small*I, big*D )
  174. *>
  175. *> (13) ( big*D, big*I )
  176. *>
  177. *> (14) ( small*D, small*I )
  178. *>
  179. *> (15) ( D1, D2 ) where D1 is diag( 0, 0, 1, ..., N-3, 0 ) and
  180. *> D2 is diag( 0, N-3, N-4,..., 1, 0, 0 )
  181. *> t t
  182. *> (16) U ( J , J ) V where U and V are random orthogonal matrices.
  183. *>
  184. *> (17) U ( T1, T2 ) V where T1 and T2 are upper triangular matrices
  185. *> with random O(1) entries above the diagonal
  186. *> and diagonal entries diag(T1) =
  187. *> ( 0, 0, 1, ..., N-3, 0 ) and diag(T2) =
  188. *> ( 0, N-3, N-4,..., 1, 0, 0 )
  189. *>
  190. *> (18) U ( T1, T2 ) V diag(T1) = ( 0, 0, 1, 1, s, ..., s, 0 )
  191. *> diag(T2) = ( 0, 1, 0, 1,..., 1, 0 )
  192. *> s = machine precision.
  193. *>
  194. *> (19) U ( T1, T2 ) V diag(T1)=( 0,0,1,1, 1-d, ..., 1-(N-5)*d=s, 0 )
  195. *> diag(T2) = ( 0, 1, 0, 1, ..., 1, 0 )
  196. *>
  197. *> N-5
  198. *> (20) U ( T1, T2 ) V diag(T1)=( 0, 0, 1, 1, a, ..., a =s, 0 )
  199. *> diag(T2) = ( 0, 1, 0, 1, ..., 1, 0, 0 )
  200. *>
  201. *> (21) U ( T1, T2 ) V diag(T1)=( 0, 0, 1, r1, r2, ..., r(N-4), 0 )
  202. *> diag(T2) = ( 0, 1, 0, 1, ..., 1, 0, 0 )
  203. *> where r1,..., r(N-4) are random.
  204. *>
  205. *> (22) U ( big*T1, small*T2 ) V diag(T1) = ( 0, 0, 1, ..., N-3, 0 )
  206. *> diag(T2) = ( 0, 1, ..., 1, 0, 0 )
  207. *>
  208. *> (23) U ( small*T1, big*T2 ) V diag(T1) = ( 0, 0, 1, ..., N-3, 0 )
  209. *> diag(T2) = ( 0, 1, ..., 1, 0, 0 )
  210. *>
  211. *> (24) U ( small*T1, small*T2 ) V diag(T1) = ( 0, 0, 1, ..., N-3, 0 )
  212. *> diag(T2) = ( 0, 1, ..., 1, 0, 0 )
  213. *>
  214. *> (25) U ( big*T1, big*T2 ) V diag(T1) = ( 0, 0, 1, ..., N-3, 0 )
  215. *> diag(T2) = ( 0, 1, ..., 1, 0, 0 )
  216. *>
  217. *> (26) U ( T1, T2 ) V where T1 and T2 are random upper-triangular
  218. *> matrices.
  219. *> \endverbatim
  220. *
  221. * Arguments:
  222. * ==========
  223. *
  224. *> \param[in] NSIZES
  225. *> \verbatim
  226. *> NSIZES is INTEGER
  227. *> The number of sizes of matrices to use. If it is zero,
  228. *> DCHKGG does nothing. It must be at least zero.
  229. *> \endverbatim
  230. *>
  231. *> \param[in] NN
  232. *> \verbatim
  233. *> NN is INTEGER array, dimension (NSIZES)
  234. *> An array containing the sizes to be used for the matrices.
  235. *> Zero values will be skipped. The values must be at least
  236. *> zero.
  237. *> \endverbatim
  238. *>
  239. *> \param[in] NTYPES
  240. *> \verbatim
  241. *> NTYPES is INTEGER
  242. *> The number of elements in DOTYPE. If it is zero, DCHKGG
  243. *> does nothing. It must be at least zero. If it is MAXTYP+1
  244. *> and NSIZES is 1, then an additional type, MAXTYP+1 is
  245. *> defined, which is to use whatever matrix is in A. This
  246. *> is only useful if DOTYPE(1:MAXTYP) is .FALSE. and
  247. *> DOTYPE(MAXTYP+1) is .TRUE. .
  248. *> \endverbatim
  249. *>
  250. *> \param[in] DOTYPE
  251. *> \verbatim
  252. *> DOTYPE is LOGICAL array, dimension (NTYPES)
  253. *> If DOTYPE(j) is .TRUE., then for each size in NN a
  254. *> matrix of that size and of type j will be generated.
  255. *> If NTYPES is smaller than the maximum number of types
  256. *> defined (PARAMETER MAXTYP), then types NTYPES+1 through
  257. *> MAXTYP will not be generated. If NTYPES is larger
  258. *> than MAXTYP, DOTYPE(MAXTYP+1) through DOTYPE(NTYPES)
  259. *> will be ignored.
  260. *> \endverbatim
  261. *>
  262. *> \param[in,out] ISEED
  263. *> \verbatim
  264. *> ISEED is INTEGER array, dimension (4)
  265. *> On entry ISEED specifies the seed of the random number
  266. *> generator. The array elements should be between 0 and 4095;
  267. *> if not they will be reduced mod 4096. Also, ISEED(4) must
  268. *> be odd. The random number generator uses a linear
  269. *> congruential sequence limited to small integers, and so
  270. *> should produce machine independent random numbers. The
  271. *> values of ISEED are changed on exit, and can be used in the
  272. *> next call to DCHKGG to continue the same random number
  273. *> sequence.
  274. *> \endverbatim
  275. *>
  276. *> \param[in] THRESH
  277. *> \verbatim
  278. *> THRESH is DOUBLE PRECISION
  279. *> A test will count as "failed" if the "error", computed as
  280. *> described above, exceeds THRESH. Note that the error is
  281. *> scaled to be O(1), so THRESH should be a reasonably small
  282. *> multiple of 1, e.g., 10 or 100. In particular, it should
  283. *> not depend on the precision (single vs. double) or the size
  284. *> of the matrix. It must be at least zero.
  285. *> \endverbatim
  286. *>
  287. *> \param[in] TSTDIF
  288. *> \verbatim
  289. *> TSTDIF is LOGICAL
  290. *> Specifies whether test ratios 13-15 will be computed and
  291. *> compared with THRESH.
  292. *> = .FALSE.: Only test ratios 1-12 will be computed and tested.
  293. *> Ratios 13-15 will be set to zero.
  294. *> = .TRUE.: All the test ratios 1-15 will be computed and
  295. *> tested.
  296. *> \endverbatim
  297. *>
  298. *> \param[in] THRSHN
  299. *> \verbatim
  300. *> THRSHN is DOUBLE PRECISION
  301. *> Threshold for reporting eigenvector normalization error.
  302. *> If the normalization of any eigenvector differs from 1 by
  303. *> more than THRSHN*ulp, then a special error message will be
  304. *> printed. (This is handled separately from the other tests,
  305. *> since only a compiler or programming error should cause an
  306. *> error message, at least if THRSHN is at least 5--10.)
  307. *> \endverbatim
  308. *>
  309. *> \param[in] NOUNIT
  310. *> \verbatim
  311. *> NOUNIT is INTEGER
  312. *> The FORTRAN unit number for printing out error messages
  313. *> (e.g., if a routine returns IINFO not equal to 0.)
  314. *> \endverbatim
  315. *>
  316. *> \param[in,out] A
  317. *> \verbatim
  318. *> A is DOUBLE PRECISION array, dimension
  319. *> (LDA, max(NN))
  320. *> Used to hold the original A matrix. Used as input only
  321. *> if NTYPES=MAXTYP+1, DOTYPE(1:MAXTYP)=.FALSE., and
  322. *> DOTYPE(MAXTYP+1)=.TRUE.
  323. *> \endverbatim
  324. *>
  325. *> \param[in] LDA
  326. *> \verbatim
  327. *> LDA is INTEGER
  328. *> The leading dimension of A, B, H, T, S1, P1, S2, and P2.
  329. *> It must be at least 1 and at least max( NN ).
  330. *> \endverbatim
  331. *>
  332. *> \param[in,out] B
  333. *> \verbatim
  334. *> B is DOUBLE PRECISION array, dimension
  335. *> (LDA, max(NN))
  336. *> Used to hold the original B matrix. Used as input only
  337. *> if NTYPES=MAXTYP+1, DOTYPE(1:MAXTYP)=.FALSE., and
  338. *> DOTYPE(MAXTYP+1)=.TRUE.
  339. *> \endverbatim
  340. *>
  341. *> \param[out] H
  342. *> \verbatim
  343. *> H is DOUBLE PRECISION array, dimension (LDA, max(NN))
  344. *> The upper Hessenberg matrix computed from A by DGGHRD.
  345. *> \endverbatim
  346. *>
  347. *> \param[out] T
  348. *> \verbatim
  349. *> T is DOUBLE PRECISION array, dimension (LDA, max(NN))
  350. *> The upper triangular matrix computed from B by DGGHRD.
  351. *> \endverbatim
  352. *>
  353. *> \param[out] S1
  354. *> \verbatim
  355. *> S1 is DOUBLE PRECISION array, dimension (LDA, max(NN))
  356. *> The Schur (block upper triangular) matrix computed from H by
  357. *> DHGEQZ when Q and Z are also computed.
  358. *> \endverbatim
  359. *>
  360. *> \param[out] S2
  361. *> \verbatim
  362. *> S2 is DOUBLE PRECISION array, dimension (LDA, max(NN))
  363. *> The Schur (block upper triangular) matrix computed from H by
  364. *> DHGEQZ when Q and Z are not computed.
  365. *> \endverbatim
  366. *>
  367. *> \param[out] P1
  368. *> \verbatim
  369. *> P1 is DOUBLE PRECISION array, dimension (LDA, max(NN))
  370. *> The upper triangular matrix computed from T by DHGEQZ
  371. *> when Q and Z are also computed.
  372. *> \endverbatim
  373. *>
  374. *> \param[out] P2
  375. *> \verbatim
  376. *> P2 is DOUBLE PRECISION array, dimension (LDA, max(NN))
  377. *> The upper triangular matrix computed from T by DHGEQZ
  378. *> when Q and Z are not computed.
  379. *> \endverbatim
  380. *>
  381. *> \param[out] U
  382. *> \verbatim
  383. *> U is DOUBLE PRECISION array, dimension (LDU, max(NN))
  384. *> The (left) orthogonal matrix computed by DGGHRD.
  385. *> \endverbatim
  386. *>
  387. *> \param[in] LDU
  388. *> \verbatim
  389. *> LDU is INTEGER
  390. *> The leading dimension of U, V, Q, Z, EVECTL, and EVEZTR. It
  391. *> must be at least 1 and at least max( NN ).
  392. *> \endverbatim
  393. *>
  394. *> \param[out] V
  395. *> \verbatim
  396. *> V is DOUBLE PRECISION array, dimension (LDU, max(NN))
  397. *> The (right) orthogonal matrix computed by DGGHRD.
  398. *> \endverbatim
  399. *>
  400. *> \param[out] Q
  401. *> \verbatim
  402. *> Q is DOUBLE PRECISION array, dimension (LDU, max(NN))
  403. *> The (left) orthogonal matrix computed by DHGEQZ.
  404. *> \endverbatim
  405. *>
  406. *> \param[out] Z
  407. *> \verbatim
  408. *> Z is DOUBLE PRECISION array, dimension (LDU, max(NN))
  409. *> The (left) orthogonal matrix computed by DHGEQZ.
  410. *> \endverbatim
  411. *>
  412. *> \param[out] ALPHR1
  413. *> \verbatim
  414. *> ALPHR1 is DOUBLE PRECISION array, dimension (max(NN))
  415. *> \endverbatim
  416. *>
  417. *> \param[out] ALPHI1
  418. *> \verbatim
  419. *> ALPHI1 is DOUBLE PRECISION array, dimension (max(NN))
  420. *> \endverbatim
  421. *>
  422. *> \param[out] BETA1
  423. *> \verbatim
  424. *> BETA1 is DOUBLE PRECISION array, dimension (max(NN))
  425. *>
  426. *> The generalized eigenvalues of (A,B) computed by DHGEQZ
  427. *> when Q, Z, and the full Schur matrices are computed.
  428. *> On exit, ( ALPHR1(k)+ALPHI1(k)*i ) / BETA1(k) is the k-th
  429. *> generalized eigenvalue of the matrices in A and B.
  430. *> \endverbatim
  431. *>
  432. *> \param[out] ALPHR3
  433. *> \verbatim
  434. *> ALPHR3 is DOUBLE PRECISION array, dimension (max(NN))
  435. *> \endverbatim
  436. *>
  437. *> \param[out] ALPHI3
  438. *> \verbatim
  439. *> ALPHI3 is DOUBLE PRECISION array, dimension (max(NN))
  440. *> \endverbatim
  441. *>
  442. *> \param[out] BETA3
  443. *> \verbatim
  444. *> BETA3 is DOUBLE PRECISION array, dimension (max(NN))
  445. *> \endverbatim
  446. *>
  447. *> \param[out] EVECTL
  448. *> \verbatim
  449. *> EVECTL is DOUBLE PRECISION array, dimension (LDU, max(NN))
  450. *> The (block lower triangular) left eigenvector matrix for
  451. *> the matrices in S1 and P1. (See DTGEVC for the format.)
  452. *> \endverbatim
  453. *>
  454. *> \param[out] EVECTR
  455. *> \verbatim
  456. *> EVECTR is DOUBLE PRECISION array, dimension (LDU, max(NN))
  457. *> The (block upper triangular) right eigenvector matrix for
  458. *> the matrices in S1 and P1. (See DTGEVC for the format.)
  459. *> \endverbatim
  460. *>
  461. *> \param[out] WORK
  462. *> \verbatim
  463. *> WORK is DOUBLE PRECISION array, dimension (LWORK)
  464. *> \endverbatim
  465. *>
  466. *> \param[in] LWORK
  467. *> \verbatim
  468. *> LWORK is INTEGER
  469. *> The number of entries in WORK. This must be at least
  470. *> max( 2 * N**2, 6*N, 1 ), for all N=NN(j).
  471. *> \endverbatim
  472. *>
  473. *> \param[out] LLWORK
  474. *> \verbatim
  475. *> LLWORK is LOGICAL array, dimension (max(NN))
  476. *> \endverbatim
  477. *>
  478. *> \param[out] RESULT
  479. *> \verbatim
  480. *> RESULT is DOUBLE PRECISION array, dimension (15)
  481. *> The values computed by the tests described above.
  482. *> The values are currently limited to 1/ulp, to avoid
  483. *> overflow.
  484. *> \endverbatim
  485. *>
  486. *> \param[out] INFO
  487. *> \verbatim
  488. *> INFO is INTEGER
  489. *> = 0: successful exit
  490. *> < 0: if INFO = -i, the i-th argument had an illegal value
  491. *> > 0: A routine returned an error code. INFO is the
  492. *> absolute value of the INFO value returned.
  493. *> \endverbatim
  494. *
  495. * Authors:
  496. * ========
  497. *
  498. *> \author Univ. of Tennessee
  499. *> \author Univ. of California Berkeley
  500. *> \author Univ. of Colorado Denver
  501. *> \author NAG Ltd.
  502. *
  503. *> \ingroup double_eig
  504. *
  505. * =====================================================================
  506. SUBROUTINE DCHKGG( NSIZES, NN, NTYPES, DOTYPE, ISEED, THRESH,
  507. $ TSTDIF, THRSHN, NOUNIT, A, LDA, B, H, T, S1,
  508. $ S2, P1, P2, U, LDU, V, Q, Z, ALPHR1, ALPHI1,
  509. $ BETA1, ALPHR3, ALPHI3, BETA3, EVECTL, EVECTR,
  510. $ WORK, LWORK, LLWORK, RESULT, INFO )
  511. *
  512. * -- LAPACK test routine --
  513. * -- LAPACK is a software package provided by Univ. of Tennessee, --
  514. * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  515. *
  516. * .. Scalar Arguments ..
  517. LOGICAL TSTDIF
  518. INTEGER INFO, LDA, LDU, LWORK, NOUNIT, NSIZES, NTYPES
  519. DOUBLE PRECISION THRESH, THRSHN
  520. * ..
  521. * .. Array Arguments ..
  522. LOGICAL DOTYPE( * ), LLWORK( * )
  523. INTEGER ISEED( 4 ), NN( * )
  524. DOUBLE PRECISION A( LDA, * ), ALPHI1( * ), ALPHI3( * ),
  525. $ ALPHR1( * ), ALPHR3( * ), B( LDA, * ),
  526. $ BETA1( * ), BETA3( * ), EVECTL( LDU, * ),
  527. $ EVECTR( LDU, * ), H( LDA, * ), P1( LDA, * ),
  528. $ P2( LDA, * ), Q( LDU, * ), RESULT( 15 ),
  529. $ S1( LDA, * ), S2( LDA, * ), T( LDA, * ),
  530. $ U( LDU, * ), V( LDU, * ), WORK( * ),
  531. $ Z( LDU, * )
  532. * ..
  533. *
  534. * =====================================================================
  535. *
  536. * .. Parameters ..
  537. DOUBLE PRECISION ZERO, ONE
  538. PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0 )
  539. INTEGER MAXTYP
  540. PARAMETER ( MAXTYP = 26 )
  541. * ..
  542. * .. Local Scalars ..
  543. LOGICAL BADNN
  544. INTEGER I1, IADD, IINFO, IN, J, JC, JR, JSIZE, JTYPE,
  545. $ LWKOPT, MTYPES, N, N1, NERRS, NMATS, NMAX,
  546. $ NTEST, NTESTT
  547. DOUBLE PRECISION ANORM, BNORM, SAFMAX, SAFMIN, TEMP1, TEMP2,
  548. $ ULP, ULPINV
  549. * ..
  550. * .. Local Arrays ..
  551. INTEGER IASIGN( MAXTYP ), IBSIGN( MAXTYP ),
  552. $ IOLDSD( 4 ), KADD( 6 ), KAMAGN( MAXTYP ),
  553. $ KATYPE( MAXTYP ), KAZERO( MAXTYP ),
  554. $ KBMAGN( MAXTYP ), KBTYPE( MAXTYP ),
  555. $ KBZERO( MAXTYP ), KCLASS( MAXTYP ),
  556. $ KTRIAN( MAXTYP ), KZ1( 6 ), KZ2( 6 )
  557. DOUBLE PRECISION DUMMA( 4 ), RMAGN( 0: 3 )
  558. * ..
  559. * .. External Functions ..
  560. DOUBLE PRECISION DLAMCH, DLANGE, DLARND
  561. EXTERNAL DLAMCH, DLANGE, DLARND
  562. * ..
  563. * .. External Subroutines ..
  564. EXTERNAL DGEQR2, DGET51, DGET52, DGGHRD, DHGEQZ, DLABAD,
  565. $ DLACPY, DLARFG, DLASET, DLASUM, DLATM4, DORM2R,
  566. $ DTGEVC, XERBLA
  567. * ..
  568. * .. Intrinsic Functions ..
  569. INTRINSIC ABS, DBLE, MAX, MIN, SIGN
  570. * ..
  571. * .. Data statements ..
  572. DATA KCLASS / 15*1, 10*2, 1*3 /
  573. DATA KZ1 / 0, 1, 2, 1, 3, 3 /
  574. DATA KZ2 / 0, 0, 1, 2, 1, 1 /
  575. DATA KADD / 0, 0, 0, 0, 3, 2 /
  576. DATA KATYPE / 0, 1, 0, 1, 2, 3, 4, 1, 4, 4, 1, 1, 4,
  577. $ 4, 4, 2, 4, 5, 8, 7, 9, 4*4, 0 /
  578. DATA KBTYPE / 0, 0, 1, 1, 2, -3, 1, 4, 1, 1, 4, 4,
  579. $ 1, 1, -4, 2, -4, 8*8, 0 /
  580. DATA KAZERO / 6*1, 2, 1, 2*2, 2*1, 2*2, 3, 1, 3,
  581. $ 4*5, 4*3, 1 /
  582. DATA KBZERO / 6*1, 1, 2, 2*1, 2*2, 2*1, 4, 1, 4,
  583. $ 4*6, 4*4, 1 /
  584. DATA KAMAGN / 8*1, 2, 3, 2, 3, 2, 3, 7*1, 2, 3, 3,
  585. $ 2, 1 /
  586. DATA KBMAGN / 8*1, 3, 2, 3, 2, 2, 3, 7*1, 3, 2, 3,
  587. $ 2, 1 /
  588. DATA KTRIAN / 16*0, 10*1 /
  589. DATA IASIGN / 6*0, 2, 0, 2*2, 2*0, 3*2, 0, 2, 3*0,
  590. $ 5*2, 0 /
  591. DATA IBSIGN / 7*0, 2, 2*0, 2*2, 2*0, 2, 0, 2, 9*0 /
  592. * ..
  593. * .. Executable Statements ..
  594. *
  595. * Check for errors
  596. *
  597. INFO = 0
  598. *
  599. BADNN = .FALSE.
  600. NMAX = 1
  601. DO 10 J = 1, NSIZES
  602. NMAX = MAX( NMAX, NN( J ) )
  603. IF( NN( J ).LT.0 )
  604. $ BADNN = .TRUE.
  605. 10 CONTINUE
  606. *
  607. * Maximum blocksize and shift -- we assume that blocksize and number
  608. * of shifts are monotone increasing functions of N.
  609. *
  610. LWKOPT = MAX( 6*NMAX, 2*NMAX*NMAX, 1 )
  611. *
  612. * Check for errors
  613. *
  614. IF( NSIZES.LT.0 ) THEN
  615. INFO = -1
  616. ELSE IF( BADNN ) THEN
  617. INFO = -2
  618. ELSE IF( NTYPES.LT.0 ) THEN
  619. INFO = -3
  620. ELSE IF( THRESH.LT.ZERO ) THEN
  621. INFO = -6
  622. ELSE IF( LDA.LE.1 .OR. LDA.LT.NMAX ) THEN
  623. INFO = -10
  624. ELSE IF( LDU.LE.1 .OR. LDU.LT.NMAX ) THEN
  625. INFO = -19
  626. ELSE IF( LWKOPT.GT.LWORK ) THEN
  627. INFO = -30
  628. END IF
  629. *
  630. IF( INFO.NE.0 ) THEN
  631. CALL XERBLA( 'DCHKGG', -INFO )
  632. RETURN
  633. END IF
  634. *
  635. * Quick return if possible
  636. *
  637. IF( NSIZES.EQ.0 .OR. NTYPES.EQ.0 )
  638. $ RETURN
  639. *
  640. SAFMIN = DLAMCH( 'Safe minimum' )
  641. ULP = DLAMCH( 'Epsilon' )*DLAMCH( 'Base' )
  642. SAFMIN = SAFMIN / ULP
  643. SAFMAX = ONE / SAFMIN
  644. CALL DLABAD( SAFMIN, SAFMAX )
  645. ULPINV = ONE / ULP
  646. *
  647. * The values RMAGN(2:3) depend on N, see below.
  648. *
  649. RMAGN( 0 ) = ZERO
  650. RMAGN( 1 ) = ONE
  651. *
  652. * Loop over sizes, types
  653. *
  654. NTESTT = 0
  655. NERRS = 0
  656. NMATS = 0
  657. *
  658. DO 240 JSIZE = 1, NSIZES
  659. N = NN( JSIZE )
  660. N1 = MAX( 1, N )
  661. RMAGN( 2 ) = SAFMAX*ULP / DBLE( N1 )
  662. RMAGN( 3 ) = SAFMIN*ULPINV*N1
  663. *
  664. IF( NSIZES.NE.1 ) THEN
  665. MTYPES = MIN( MAXTYP, NTYPES )
  666. ELSE
  667. MTYPES = MIN( MAXTYP+1, NTYPES )
  668. END IF
  669. *
  670. DO 230 JTYPE = 1, MTYPES
  671. IF( .NOT.DOTYPE( JTYPE ) )
  672. $ GO TO 230
  673. NMATS = NMATS + 1
  674. NTEST = 0
  675. *
  676. * Save ISEED in case of an error.
  677. *
  678. DO 20 J = 1, 4
  679. IOLDSD( J ) = ISEED( J )
  680. 20 CONTINUE
  681. *
  682. * Initialize RESULT
  683. *
  684. DO 30 J = 1, 15
  685. RESULT( J ) = ZERO
  686. 30 CONTINUE
  687. *
  688. * Compute A and B
  689. *
  690. * Description of control parameters:
  691. *
  692. * KZLASS: =1 means w/o rotation, =2 means w/ rotation,
  693. * =3 means random.
  694. * KATYPE: the "type" to be passed to DLATM4 for computing A.
  695. * KAZERO: the pattern of zeros on the diagonal for A:
  696. * =1: ( xxx ), =2: (0, xxx ) =3: ( 0, 0, xxx, 0 ),
  697. * =4: ( 0, xxx, 0, 0 ), =5: ( 0, 0, 1, xxx, 0 ),
  698. * =6: ( 0, 1, 0, xxx, 0 ). (xxx means a string of
  699. * non-zero entries.)
  700. * KAMAGN: the magnitude of the matrix: =0: zero, =1: O(1),
  701. * =2: large, =3: small.
  702. * IASIGN: 1 if the diagonal elements of A are to be
  703. * multiplied by a random magnitude 1 number, =2 if
  704. * randomly chosen diagonal blocks are to be rotated
  705. * to form 2x2 blocks.
  706. * KBTYPE, KBZERO, KBMAGN, IBSIGN: the same, but for B.
  707. * KTRIAN: =0: don't fill in the upper triangle, =1: do.
  708. * KZ1, KZ2, KADD: used to implement KAZERO and KBZERO.
  709. * RMAGN: used to implement KAMAGN and KBMAGN.
  710. *
  711. IF( MTYPES.GT.MAXTYP )
  712. $ GO TO 110
  713. IINFO = 0
  714. IF( KCLASS( JTYPE ).LT.3 ) THEN
  715. *
  716. * Generate A (w/o rotation)
  717. *
  718. IF( ABS( KATYPE( JTYPE ) ).EQ.3 ) THEN
  719. IN = 2*( ( N-1 ) / 2 ) + 1
  720. IF( IN.NE.N )
  721. $ CALL DLASET( 'Full', N, N, ZERO, ZERO, A, LDA )
  722. ELSE
  723. IN = N
  724. END IF
  725. CALL DLATM4( KATYPE( JTYPE ), IN, KZ1( KAZERO( JTYPE ) ),
  726. $ KZ2( KAZERO( JTYPE ) ), IASIGN( JTYPE ),
  727. $ RMAGN( KAMAGN( JTYPE ) ), ULP,
  728. $ RMAGN( KTRIAN( JTYPE )*KAMAGN( JTYPE ) ), 2,
  729. $ ISEED, A, LDA )
  730. IADD = KADD( KAZERO( JTYPE ) )
  731. IF( IADD.GT.0 .AND. IADD.LE.N )
  732. $ A( IADD, IADD ) = RMAGN( KAMAGN( JTYPE ) )
  733. *
  734. * Generate B (w/o rotation)
  735. *
  736. IF( ABS( KBTYPE( JTYPE ) ).EQ.3 ) THEN
  737. IN = 2*( ( N-1 ) / 2 ) + 1
  738. IF( IN.NE.N )
  739. $ CALL DLASET( 'Full', N, N, ZERO, ZERO, B, LDA )
  740. ELSE
  741. IN = N
  742. END IF
  743. CALL DLATM4( KBTYPE( JTYPE ), IN, KZ1( KBZERO( JTYPE ) ),
  744. $ KZ2( KBZERO( JTYPE ) ), IBSIGN( JTYPE ),
  745. $ RMAGN( KBMAGN( JTYPE ) ), ONE,
  746. $ RMAGN( KTRIAN( JTYPE )*KBMAGN( JTYPE ) ), 2,
  747. $ ISEED, B, LDA )
  748. IADD = KADD( KBZERO( JTYPE ) )
  749. IF( IADD.NE.0 .AND. IADD.LE.N )
  750. $ B( IADD, IADD ) = RMAGN( KBMAGN( JTYPE ) )
  751. *
  752. IF( KCLASS( JTYPE ).EQ.2 .AND. N.GT.0 ) THEN
  753. *
  754. * Include rotations
  755. *
  756. * Generate U, V as Householder transformations times
  757. * a diagonal matrix.
  758. *
  759. DO 50 JC = 1, N - 1
  760. DO 40 JR = JC, N
  761. U( JR, JC ) = DLARND( 3, ISEED )
  762. V( JR, JC ) = DLARND( 3, ISEED )
  763. 40 CONTINUE
  764. CALL DLARFG( N+1-JC, U( JC, JC ), U( JC+1, JC ), 1,
  765. $ WORK( JC ) )
  766. WORK( 2*N+JC ) = SIGN( ONE, U( JC, JC ) )
  767. U( JC, JC ) = ONE
  768. CALL DLARFG( N+1-JC, V( JC, JC ), V( JC+1, JC ), 1,
  769. $ WORK( N+JC ) )
  770. WORK( 3*N+JC ) = SIGN( ONE, V( JC, JC ) )
  771. V( JC, JC ) = ONE
  772. 50 CONTINUE
  773. U( N, N ) = ONE
  774. WORK( N ) = ZERO
  775. WORK( 3*N ) = SIGN( ONE, DLARND( 2, ISEED ) )
  776. V( N, N ) = ONE
  777. WORK( 2*N ) = ZERO
  778. WORK( 4*N ) = SIGN( ONE, DLARND( 2, ISEED ) )
  779. *
  780. * Apply the diagonal matrices
  781. *
  782. DO 70 JC = 1, N
  783. DO 60 JR = 1, N
  784. A( JR, JC ) = WORK( 2*N+JR )*WORK( 3*N+JC )*
  785. $ A( JR, JC )
  786. B( JR, JC ) = WORK( 2*N+JR )*WORK( 3*N+JC )*
  787. $ B( JR, JC )
  788. 60 CONTINUE
  789. 70 CONTINUE
  790. CALL DORM2R( 'L', 'N', N, N, N-1, U, LDU, WORK, A,
  791. $ LDA, WORK( 2*N+1 ), IINFO )
  792. IF( IINFO.NE.0 )
  793. $ GO TO 100
  794. CALL DORM2R( 'R', 'T', N, N, N-1, V, LDU, WORK( N+1 ),
  795. $ A, LDA, WORK( 2*N+1 ), IINFO )
  796. IF( IINFO.NE.0 )
  797. $ GO TO 100
  798. CALL DORM2R( 'L', 'N', N, N, N-1, U, LDU, WORK, B,
  799. $ LDA, WORK( 2*N+1 ), IINFO )
  800. IF( IINFO.NE.0 )
  801. $ GO TO 100
  802. CALL DORM2R( 'R', 'T', N, N, N-1, V, LDU, WORK( N+1 ),
  803. $ B, LDA, WORK( 2*N+1 ), IINFO )
  804. IF( IINFO.NE.0 )
  805. $ GO TO 100
  806. END IF
  807. ELSE
  808. *
  809. * Random matrices
  810. *
  811. DO 90 JC = 1, N
  812. DO 80 JR = 1, N
  813. A( JR, JC ) = RMAGN( KAMAGN( JTYPE ) )*
  814. $ DLARND( 2, ISEED )
  815. B( JR, JC ) = RMAGN( KBMAGN( JTYPE ) )*
  816. $ DLARND( 2, ISEED )
  817. 80 CONTINUE
  818. 90 CONTINUE
  819. END IF
  820. *
  821. ANORM = DLANGE( '1', N, N, A, LDA, WORK )
  822. BNORM = DLANGE( '1', N, N, B, LDA, WORK )
  823. *
  824. 100 CONTINUE
  825. *
  826. IF( IINFO.NE.0 ) THEN
  827. WRITE( NOUNIT, FMT = 9999 )'Generator', IINFO, N, JTYPE,
  828. $ IOLDSD
  829. INFO = ABS( IINFO )
  830. RETURN
  831. END IF
  832. *
  833. 110 CONTINUE
  834. *
  835. * Call DGEQR2, DORM2R, and DGGHRD to compute H, T, U, and V
  836. *
  837. CALL DLACPY( ' ', N, N, A, LDA, H, LDA )
  838. CALL DLACPY( ' ', N, N, B, LDA, T, LDA )
  839. NTEST = 1
  840. RESULT( 1 ) = ULPINV
  841. *
  842. CALL DGEQR2( N, N, T, LDA, WORK, WORK( N+1 ), IINFO )
  843. IF( IINFO.NE.0 ) THEN
  844. WRITE( NOUNIT, FMT = 9999 )'DGEQR2', IINFO, N, JTYPE,
  845. $ IOLDSD
  846. INFO = ABS( IINFO )
  847. GO TO 210
  848. END IF
  849. *
  850. CALL DORM2R( 'L', 'T', N, N, N, T, LDA, WORK, H, LDA,
  851. $ WORK( N+1 ), IINFO )
  852. IF( IINFO.NE.0 ) THEN
  853. WRITE( NOUNIT, FMT = 9999 )'DORM2R', IINFO, N, JTYPE,
  854. $ IOLDSD
  855. INFO = ABS( IINFO )
  856. GO TO 210
  857. END IF
  858. *
  859. CALL DLASET( 'Full', N, N, ZERO, ONE, U, LDU )
  860. CALL DORM2R( 'R', 'N', N, N, N, T, LDA, WORK, U, LDU,
  861. $ WORK( N+1 ), IINFO )
  862. IF( IINFO.NE.0 ) THEN
  863. WRITE( NOUNIT, FMT = 9999 )'DORM2R', IINFO, N, JTYPE,
  864. $ IOLDSD
  865. INFO = ABS( IINFO )
  866. GO TO 210
  867. END IF
  868. *
  869. CALL DGGHRD( 'V', 'I', N, 1, N, H, LDA, T, LDA, U, LDU, V,
  870. $ LDU, IINFO )
  871. IF( IINFO.NE.0 ) THEN
  872. WRITE( NOUNIT, FMT = 9999 )'DGGHRD', IINFO, N, JTYPE,
  873. $ IOLDSD
  874. INFO = ABS( IINFO )
  875. GO TO 210
  876. END IF
  877. NTEST = 4
  878. *
  879. * Do tests 1--4
  880. *
  881. CALL DGET51( 1, N, A, LDA, H, LDA, U, LDU, V, LDU, WORK,
  882. $ RESULT( 1 ) )
  883. CALL DGET51( 1, N, B, LDA, T, LDA, U, LDU, V, LDU, WORK,
  884. $ RESULT( 2 ) )
  885. CALL DGET51( 3, N, B, LDA, T, LDA, U, LDU, U, LDU, WORK,
  886. $ RESULT( 3 ) )
  887. CALL DGET51( 3, N, B, LDA, T, LDA, V, LDU, V, LDU, WORK,
  888. $ RESULT( 4 ) )
  889. *
  890. * Call DHGEQZ to compute S1, P1, S2, P2, Q, and Z, do tests.
  891. *
  892. * Compute T1 and UZ
  893. *
  894. * Eigenvalues only
  895. *
  896. CALL DLACPY( ' ', N, N, H, LDA, S2, LDA )
  897. CALL DLACPY( ' ', N, N, T, LDA, P2, LDA )
  898. NTEST = 5
  899. RESULT( 5 ) = ULPINV
  900. *
  901. CALL DHGEQZ( 'E', 'N', 'N', N, 1, N, S2, LDA, P2, LDA,
  902. $ ALPHR3, ALPHI3, BETA3, Q, LDU, Z, LDU, WORK,
  903. $ LWORK, IINFO )
  904. IF( IINFO.NE.0 ) THEN
  905. WRITE( NOUNIT, FMT = 9999 )'DHGEQZ(E)', IINFO, N, JTYPE,
  906. $ IOLDSD
  907. INFO = ABS( IINFO )
  908. GO TO 210
  909. END IF
  910. *
  911. * Eigenvalues and Full Schur Form
  912. *
  913. CALL DLACPY( ' ', N, N, H, LDA, S2, LDA )
  914. CALL DLACPY( ' ', N, N, T, LDA, P2, LDA )
  915. *
  916. CALL DHGEQZ( 'S', 'N', 'N', N, 1, N, S2, LDA, P2, LDA,
  917. $ ALPHR1, ALPHI1, BETA1, Q, LDU, Z, LDU, WORK,
  918. $ LWORK, IINFO )
  919. IF( IINFO.NE.0 ) THEN
  920. WRITE( NOUNIT, FMT = 9999 )'DHGEQZ(S)', IINFO, N, JTYPE,
  921. $ IOLDSD
  922. INFO = ABS( IINFO )
  923. GO TO 210
  924. END IF
  925. *
  926. * Eigenvalues, Schur Form, and Schur Vectors
  927. *
  928. CALL DLACPY( ' ', N, N, H, LDA, S1, LDA )
  929. CALL DLACPY( ' ', N, N, T, LDA, P1, LDA )
  930. *
  931. CALL DHGEQZ( 'S', 'I', 'I', N, 1, N, S1, LDA, P1, LDA,
  932. $ ALPHR1, ALPHI1, BETA1, Q, LDU, Z, LDU, WORK,
  933. $ LWORK, IINFO )
  934. IF( IINFO.NE.0 ) THEN
  935. WRITE( NOUNIT, FMT = 9999 )'DHGEQZ(V)', IINFO, N, JTYPE,
  936. $ IOLDSD
  937. INFO = ABS( IINFO )
  938. GO TO 210
  939. END IF
  940. *
  941. NTEST = 8
  942. *
  943. * Do Tests 5--8
  944. *
  945. CALL DGET51( 1, N, H, LDA, S1, LDA, Q, LDU, Z, LDU, WORK,
  946. $ RESULT( 5 ) )
  947. CALL DGET51( 1, N, T, LDA, P1, LDA, Q, LDU, Z, LDU, WORK,
  948. $ RESULT( 6 ) )
  949. CALL DGET51( 3, N, T, LDA, P1, LDA, Q, LDU, Q, LDU, WORK,
  950. $ RESULT( 7 ) )
  951. CALL DGET51( 3, N, T, LDA, P1, LDA, Z, LDU, Z, LDU, WORK,
  952. $ RESULT( 8 ) )
  953. *
  954. * Compute the Left and Right Eigenvectors of (S1,P1)
  955. *
  956. * 9: Compute the left eigenvector Matrix without
  957. * back transforming:
  958. *
  959. NTEST = 9
  960. RESULT( 9 ) = ULPINV
  961. *
  962. * To test "SELECT" option, compute half of the eigenvectors
  963. * in one call, and half in another
  964. *
  965. I1 = N / 2
  966. DO 120 J = 1, I1
  967. LLWORK( J ) = .TRUE.
  968. 120 CONTINUE
  969. DO 130 J = I1 + 1, N
  970. LLWORK( J ) = .FALSE.
  971. 130 CONTINUE
  972. *
  973. CALL DTGEVC( 'L', 'S', LLWORK, N, S1, LDA, P1, LDA, EVECTL,
  974. $ LDU, DUMMA, LDU, N, IN, WORK, IINFO )
  975. IF( IINFO.NE.0 ) THEN
  976. WRITE( NOUNIT, FMT = 9999 )'DTGEVC(L,S1)', IINFO, N,
  977. $ JTYPE, IOLDSD
  978. INFO = ABS( IINFO )
  979. GO TO 210
  980. END IF
  981. *
  982. I1 = IN
  983. DO 140 J = 1, I1
  984. LLWORK( J ) = .FALSE.
  985. 140 CONTINUE
  986. DO 150 J = I1 + 1, N
  987. LLWORK( J ) = .TRUE.
  988. 150 CONTINUE
  989. *
  990. CALL DTGEVC( 'L', 'S', LLWORK, N, S1, LDA, P1, LDA,
  991. $ EVECTL( 1, I1+1 ), LDU, DUMMA, LDU, N, IN,
  992. $ WORK, IINFO )
  993. IF( IINFO.NE.0 ) THEN
  994. WRITE( NOUNIT, FMT = 9999 )'DTGEVC(L,S2)', IINFO, N,
  995. $ JTYPE, IOLDSD
  996. INFO = ABS( IINFO )
  997. GO TO 210
  998. END IF
  999. *
  1000. CALL DGET52( .TRUE., N, S1, LDA, P1, LDA, EVECTL, LDU,
  1001. $ ALPHR1, ALPHI1, BETA1, WORK, DUMMA( 1 ) )
  1002. RESULT( 9 ) = DUMMA( 1 )
  1003. IF( DUMMA( 2 ).GT.THRSHN ) THEN
  1004. WRITE( NOUNIT, FMT = 9998 )'Left', 'DTGEVC(HOWMNY=S)',
  1005. $ DUMMA( 2 ), N, JTYPE, IOLDSD
  1006. END IF
  1007. *
  1008. * 10: Compute the left eigenvector Matrix with
  1009. * back transforming:
  1010. *
  1011. NTEST = 10
  1012. RESULT( 10 ) = ULPINV
  1013. CALL DLACPY( 'F', N, N, Q, LDU, EVECTL, LDU )
  1014. CALL DTGEVC( 'L', 'B', LLWORK, N, S1, LDA, P1, LDA, EVECTL,
  1015. $ LDU, DUMMA, LDU, N, IN, WORK, IINFO )
  1016. IF( IINFO.NE.0 ) THEN
  1017. WRITE( NOUNIT, FMT = 9999 )'DTGEVC(L,B)', IINFO, N,
  1018. $ JTYPE, IOLDSD
  1019. INFO = ABS( IINFO )
  1020. GO TO 210
  1021. END IF
  1022. *
  1023. CALL DGET52( .TRUE., N, H, LDA, T, LDA, EVECTL, LDU, ALPHR1,
  1024. $ ALPHI1, BETA1, WORK, DUMMA( 1 ) )
  1025. RESULT( 10 ) = DUMMA( 1 )
  1026. IF( DUMMA( 2 ).GT.THRSHN ) THEN
  1027. WRITE( NOUNIT, FMT = 9998 )'Left', 'DTGEVC(HOWMNY=B)',
  1028. $ DUMMA( 2 ), N, JTYPE, IOLDSD
  1029. END IF
  1030. *
  1031. * 11: Compute the right eigenvector Matrix without
  1032. * back transforming:
  1033. *
  1034. NTEST = 11
  1035. RESULT( 11 ) = ULPINV
  1036. *
  1037. * To test "SELECT" option, compute half of the eigenvectors
  1038. * in one call, and half in another
  1039. *
  1040. I1 = N / 2
  1041. DO 160 J = 1, I1
  1042. LLWORK( J ) = .TRUE.
  1043. 160 CONTINUE
  1044. DO 170 J = I1 + 1, N
  1045. LLWORK( J ) = .FALSE.
  1046. 170 CONTINUE
  1047. *
  1048. CALL DTGEVC( 'R', 'S', LLWORK, N, S1, LDA, P1, LDA, DUMMA,
  1049. $ LDU, EVECTR, LDU, N, IN, WORK, IINFO )
  1050. IF( IINFO.NE.0 ) THEN
  1051. WRITE( NOUNIT, FMT = 9999 )'DTGEVC(R,S1)', IINFO, N,
  1052. $ JTYPE, IOLDSD
  1053. INFO = ABS( IINFO )
  1054. GO TO 210
  1055. END IF
  1056. *
  1057. I1 = IN
  1058. DO 180 J = 1, I1
  1059. LLWORK( J ) = .FALSE.
  1060. 180 CONTINUE
  1061. DO 190 J = I1 + 1, N
  1062. LLWORK( J ) = .TRUE.
  1063. 190 CONTINUE
  1064. *
  1065. CALL DTGEVC( 'R', 'S', LLWORK, N, S1, LDA, P1, LDA, DUMMA,
  1066. $ LDU, EVECTR( 1, I1+1 ), LDU, N, IN, WORK,
  1067. $ IINFO )
  1068. IF( IINFO.NE.0 ) THEN
  1069. WRITE( NOUNIT, FMT = 9999 )'DTGEVC(R,S2)', IINFO, N,
  1070. $ JTYPE, IOLDSD
  1071. INFO = ABS( IINFO )
  1072. GO TO 210
  1073. END IF
  1074. *
  1075. CALL DGET52( .FALSE., N, S1, LDA, P1, LDA, EVECTR, LDU,
  1076. $ ALPHR1, ALPHI1, BETA1, WORK, DUMMA( 1 ) )
  1077. RESULT( 11 ) = DUMMA( 1 )
  1078. IF( DUMMA( 2 ).GT.THRESH ) THEN
  1079. WRITE( NOUNIT, FMT = 9998 )'Right', 'DTGEVC(HOWMNY=S)',
  1080. $ DUMMA( 2 ), N, JTYPE, IOLDSD
  1081. END IF
  1082. *
  1083. * 12: Compute the right eigenvector Matrix with
  1084. * back transforming:
  1085. *
  1086. NTEST = 12
  1087. RESULT( 12 ) = ULPINV
  1088. CALL DLACPY( 'F', N, N, Z, LDU, EVECTR, LDU )
  1089. CALL DTGEVC( 'R', 'B', LLWORK, N, S1, LDA, P1, LDA, DUMMA,
  1090. $ LDU, EVECTR, LDU, N, IN, WORK, IINFO )
  1091. IF( IINFO.NE.0 ) THEN
  1092. WRITE( NOUNIT, FMT = 9999 )'DTGEVC(R,B)', IINFO, N,
  1093. $ JTYPE, IOLDSD
  1094. INFO = ABS( IINFO )
  1095. GO TO 210
  1096. END IF
  1097. *
  1098. CALL DGET52( .FALSE., N, H, LDA, T, LDA, EVECTR, LDU,
  1099. $ ALPHR1, ALPHI1, BETA1, WORK, DUMMA( 1 ) )
  1100. RESULT( 12 ) = DUMMA( 1 )
  1101. IF( DUMMA( 2 ).GT.THRESH ) THEN
  1102. WRITE( NOUNIT, FMT = 9998 )'Right', 'DTGEVC(HOWMNY=B)',
  1103. $ DUMMA( 2 ), N, JTYPE, IOLDSD
  1104. END IF
  1105. *
  1106. * Tests 13--15 are done only on request
  1107. *
  1108. IF( TSTDIF ) THEN
  1109. *
  1110. * Do Tests 13--14
  1111. *
  1112. CALL DGET51( 2, N, S1, LDA, S2, LDA, Q, LDU, Z, LDU,
  1113. $ WORK, RESULT( 13 ) )
  1114. CALL DGET51( 2, N, P1, LDA, P2, LDA, Q, LDU, Z, LDU,
  1115. $ WORK, RESULT( 14 ) )
  1116. *
  1117. * Do Test 15
  1118. *
  1119. TEMP1 = ZERO
  1120. TEMP2 = ZERO
  1121. DO 200 J = 1, N
  1122. TEMP1 = MAX( TEMP1, ABS( ALPHR1( J )-ALPHR3( J ) )+
  1123. $ ABS( ALPHI1( J )-ALPHI3( J ) ) )
  1124. TEMP2 = MAX( TEMP2, ABS( BETA1( J )-BETA3( J ) ) )
  1125. 200 CONTINUE
  1126. *
  1127. TEMP1 = TEMP1 / MAX( SAFMIN, ULP*MAX( TEMP1, ANORM ) )
  1128. TEMP2 = TEMP2 / MAX( SAFMIN, ULP*MAX( TEMP2, BNORM ) )
  1129. RESULT( 15 ) = MAX( TEMP1, TEMP2 )
  1130. NTEST = 15
  1131. ELSE
  1132. RESULT( 13 ) = ZERO
  1133. RESULT( 14 ) = ZERO
  1134. RESULT( 15 ) = ZERO
  1135. NTEST = 12
  1136. END IF
  1137. *
  1138. * End of Loop -- Check for RESULT(j) > THRESH
  1139. *
  1140. 210 CONTINUE
  1141. *
  1142. NTESTT = NTESTT + NTEST
  1143. *
  1144. * Print out tests which fail.
  1145. *
  1146. DO 220 JR = 1, NTEST
  1147. IF( RESULT( JR ).GE.THRESH ) THEN
  1148. *
  1149. * If this is the first test to fail,
  1150. * print a header to the data file.
  1151. *
  1152. IF( NERRS.EQ.0 ) THEN
  1153. WRITE( NOUNIT, FMT = 9997 )'DGG'
  1154. *
  1155. * Matrix types
  1156. *
  1157. WRITE( NOUNIT, FMT = 9996 )
  1158. WRITE( NOUNIT, FMT = 9995 )
  1159. WRITE( NOUNIT, FMT = 9994 )'Orthogonal'
  1160. *
  1161. * Tests performed
  1162. *
  1163. WRITE( NOUNIT, FMT = 9993 )'orthogonal', '''',
  1164. $ 'transpose', ( '''', J = 1, 10 )
  1165. *
  1166. END IF
  1167. NERRS = NERRS + 1
  1168. IF( RESULT( JR ).LT.10000.0D0 ) THEN
  1169. WRITE( NOUNIT, FMT = 9992 )N, JTYPE, IOLDSD, JR,
  1170. $ RESULT( JR )
  1171. ELSE
  1172. WRITE( NOUNIT, FMT = 9991 )N, JTYPE, IOLDSD, JR,
  1173. $ RESULT( JR )
  1174. END IF
  1175. END IF
  1176. 220 CONTINUE
  1177. *
  1178. 230 CONTINUE
  1179. 240 CONTINUE
  1180. *
  1181. * Summary
  1182. *
  1183. CALL DLASUM( 'DGG', NOUNIT, NERRS, NTESTT )
  1184. RETURN
  1185. *
  1186. 9999 FORMAT( ' DCHKGG: ', A, ' returned INFO=', I6, '.', / 9X, 'N=',
  1187. $ I6, ', JTYPE=', I6, ', ISEED=(', 3( I5, ',' ), I5, ')' )
  1188. *
  1189. 9998 FORMAT( ' DCHKGG: ', A, ' Eigenvectors from ', A, ' incorrectly ',
  1190. $ 'normalized.', / ' Bits of error=', 0P, G10.3, ',', 9X,
  1191. $ 'N=', I6, ', JTYPE=', I6, ', ISEED=(', 3( I5, ',' ), I5,
  1192. $ ')' )
  1193. *
  1194. 9997 FORMAT( / 1X, A3, ' -- Real Generalized eigenvalue problem' )
  1195. *
  1196. 9996 FORMAT( ' Matrix types (see DCHKGG for details): ' )
  1197. *
  1198. 9995 FORMAT( ' Special Matrices:', 23X,
  1199. $ '(J''=transposed Jordan block)',
  1200. $ / ' 1=(0,0) 2=(I,0) 3=(0,I) 4=(I,I) 5=(J'',J'') ',
  1201. $ '6=(diag(J'',I), diag(I,J''))', / ' Diagonal Matrices: ( ',
  1202. $ 'D=diag(0,1,2,...) )', / ' 7=(D,I) 9=(large*D, small*I',
  1203. $ ') 11=(large*I, small*D) 13=(large*D, large*I)', /
  1204. $ ' 8=(I,D) 10=(small*D, large*I) 12=(small*I, large*D) ',
  1205. $ ' 14=(small*D, small*I)', / ' 15=(D, reversed D)' )
  1206. 9994 FORMAT( ' Matrices Rotated by Random ', A, ' Matrices U, V:',
  1207. $ / ' 16=Transposed Jordan Blocks 19=geometric ',
  1208. $ 'alpha, beta=0,1', / ' 17=arithm. alpha&beta ',
  1209. $ ' 20=arithmetic alpha, beta=0,1', / ' 18=clustered ',
  1210. $ 'alpha, beta=0,1 21=random alpha, beta=0,1',
  1211. $ / ' Large & Small Matrices:', / ' 22=(large, small) ',
  1212. $ '23=(small,large) 24=(small,small) 25=(large,large)',
  1213. $ / ' 26=random O(1) matrices.' )
  1214. *
  1215. 9993 FORMAT( / ' Tests performed: (H is Hessenberg, S is Schur, B, ',
  1216. $ 'T, P are triangular,', / 20X, 'U, V, Q, and Z are ', A,
  1217. $ ', l and r are the', / 20X,
  1218. $ 'appropriate left and right eigenvectors, resp., a is',
  1219. $ / 20X, 'alpha, b is beta, and ', A, ' means ', A, '.)',
  1220. $ / ' 1 = | A - U H V', A,
  1221. $ ' | / ( |A| n ulp ) 2 = | B - U T V', A,
  1222. $ ' | / ( |B| n ulp )', / ' 3 = | I - UU', A,
  1223. $ ' | / ( n ulp ) 4 = | I - VV', A,
  1224. $ ' | / ( n ulp )', / ' 5 = | H - Q S Z', A,
  1225. $ ' | / ( |H| n ulp )', 6X, '6 = | T - Q P Z', A,
  1226. $ ' | / ( |T| n ulp )', / ' 7 = | I - QQ', A,
  1227. $ ' | / ( n ulp ) 8 = | I - ZZ', A,
  1228. $ ' | / ( n ulp )', / ' 9 = max | ( b S - a P )', A,
  1229. $ ' l | / const. 10 = max | ( b H - a T )', A,
  1230. $ ' l | / const.', /
  1231. $ ' 11= max | ( b S - a P ) r | / const. 12 = max | ( b H',
  1232. $ ' - a T ) r | / const.', / 1X )
  1233. *
  1234. 9992 FORMAT( ' Matrix order=', I5, ', type=', I2, ', seed=',
  1235. $ 4( I4, ',' ), ' result ', I2, ' is', 0P, F8.2 )
  1236. 9991 FORMAT( ' Matrix order=', I5, ', type=', I2, ', seed=',
  1237. $ 4( I4, ',' ), ' result ', I2, ' is', 1P, D10.3 )
  1238. *
  1239. * End of DCHKGG
  1240. *
  1241. END