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.

ddrvvx.f 36 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017
  1. *> \brief \b DDRVVX
  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 DDRVVX( NSIZES, NN, NTYPES, DOTYPE, ISEED, THRESH,
  12. * NIUNIT, NOUNIT, A, LDA, H, WR, WI, WR1, WI1,
  13. * VL, LDVL, VR, LDVR, LRE, LDLRE, RCONDV, RCNDV1,
  14. * RCDVIN, RCONDE, RCNDE1, RCDEIN, SCALE, SCALE1,
  15. * RESULT, WORK, NWORK, IWORK, INFO )
  16. *
  17. * .. Scalar Arguments ..
  18. * INTEGER INFO, LDA, LDLRE, LDVL, LDVR, NIUNIT, NOUNIT,
  19. * $ NSIZES, NTYPES, NWORK
  20. * DOUBLE PRECISION THRESH
  21. * ..
  22. * .. Array Arguments ..
  23. * LOGICAL DOTYPE( * )
  24. * INTEGER ISEED( 4 ), IWORK( * ), NN( * )
  25. * DOUBLE PRECISION A( LDA, * ), H( LDA, * ), LRE( LDLRE, * ),
  26. * $ RCDEIN( * ), RCDVIN( * ), RCNDE1( * ),
  27. * $ RCNDV1( * ), RCONDE( * ), RCONDV( * ),
  28. * $ RESULT( 11 ), SCALE( * ), SCALE1( * ),
  29. * $ VL( LDVL, * ), VR( LDVR, * ), WI( * ),
  30. * $ WI1( * ), WORK( * ), WR( * ), WR1( * )
  31. * ..
  32. *
  33. *
  34. *> \par Purpose:
  35. * =============
  36. *>
  37. *> \verbatim
  38. *>
  39. *> DDRVVX checks the nonsymmetric eigenvalue problem expert driver
  40. *> DGEEVX.
  41. *>
  42. *> DDRVVX uses both test matrices generated randomly depending on
  43. *> data supplied in the calling sequence, as well as on data
  44. *> read from an input file and including precomputed condition
  45. *> numbers to which it compares the ones it computes.
  46. *>
  47. *> When DDRVVX is called, a number of matrix "sizes" ("n's") and a
  48. *> number of matrix "types" are specified in the calling sequence.
  49. *> For each size ("n") and each type of matrix, one matrix will be
  50. *> generated and used to test the nonsymmetric eigenroutines. For
  51. *> each matrix, 9 tests will be performed:
  52. *>
  53. *> (1) | A * VR - VR * W | / ( n |A| ulp )
  54. *>
  55. *> Here VR is the matrix of unit right eigenvectors.
  56. *> W is a block diagonal matrix, with a 1x1 block for each
  57. *> real eigenvalue and a 2x2 block for each complex conjugate
  58. *> pair. If eigenvalues j and j+1 are a complex conjugate pair,
  59. *> so WR(j) = WR(j+1) = wr and WI(j) = - WI(j+1) = wi, then the
  60. *> 2 x 2 block corresponding to the pair will be:
  61. *>
  62. *> ( wr wi )
  63. *> ( -wi wr )
  64. *>
  65. *> Such a block multiplying an n x 2 matrix ( ur ui ) on the
  66. *> right will be the same as multiplying ur + i*ui by wr + i*wi.
  67. *>
  68. *> (2) | A**H * VL - VL * W**H | / ( n |A| ulp )
  69. *>
  70. *> Here VL is the matrix of unit left eigenvectors, A**H is the
  71. *> conjugate transpose of A, and W is as above.
  72. *>
  73. *> (3) | |VR(i)| - 1 | / ulp and largest component real
  74. *>
  75. *> VR(i) denotes the i-th column of VR.
  76. *>
  77. *> (4) | |VL(i)| - 1 | / ulp and largest component real
  78. *>
  79. *> VL(i) denotes the i-th column of VL.
  80. *>
  81. *> (5) W(full) = W(partial)
  82. *>
  83. *> W(full) denotes the eigenvalues computed when VR, VL, RCONDV
  84. *> and RCONDE are also computed, and W(partial) denotes the
  85. *> eigenvalues computed when only some of VR, VL, RCONDV, and
  86. *> RCONDE are computed.
  87. *>
  88. *> (6) VR(full) = VR(partial)
  89. *>
  90. *> VR(full) denotes the right eigenvectors computed when VL, RCONDV
  91. *> and RCONDE are computed, and VR(partial) denotes the result
  92. *> when only some of VL and RCONDV are computed.
  93. *>
  94. *> (7) VL(full) = VL(partial)
  95. *>
  96. *> VL(full) denotes the left eigenvectors computed when VR, RCONDV
  97. *> and RCONDE are computed, and VL(partial) denotes the result
  98. *> when only some of VR and RCONDV are computed.
  99. *>
  100. *> (8) 0 if SCALE, ILO, IHI, ABNRM (full) =
  101. *> SCALE, ILO, IHI, ABNRM (partial)
  102. *> 1/ulp otherwise
  103. *>
  104. *> SCALE, ILO, IHI and ABNRM describe how the matrix is balanced.
  105. *> (full) is when VR, VL, RCONDE and RCONDV are also computed, and
  106. *> (partial) is when some are not computed.
  107. *>
  108. *> (9) RCONDV(full) = RCONDV(partial)
  109. *>
  110. *> RCONDV(full) denotes the reciprocal condition numbers of the
  111. *> right eigenvectors computed when VR, VL and RCONDE are also
  112. *> computed. RCONDV(partial) denotes the reciprocal condition
  113. *> numbers when only some of VR, VL and RCONDE are computed.
  114. *>
  115. *> The "sizes" are specified by an array NN(1:NSIZES); the value of
  116. *> each element NN(j) specifies one size.
  117. *> The "types" are specified by a logical array DOTYPE( 1:NTYPES );
  118. *> if DOTYPE(j) is .TRUE., then matrix type "j" will be generated.
  119. *> Currently, the list of possible types is:
  120. *>
  121. *> (1) The zero matrix.
  122. *> (2) The identity matrix.
  123. *> (3) A (transposed) Jordan block, with 1's on the diagonal.
  124. *>
  125. *> (4) A diagonal matrix with evenly spaced entries
  126. *> 1, ..., ULP and random signs.
  127. *> (ULP = (first number larger than 1) - 1 )
  128. *> (5) A diagonal matrix with geometrically spaced entries
  129. *> 1, ..., ULP and random signs.
  130. *> (6) A diagonal matrix with "clustered" entries 1, ULP, ..., ULP
  131. *> and random signs.
  132. *>
  133. *> (7) Same as (4), but multiplied by a constant near
  134. *> the overflow threshold
  135. *> (8) Same as (4), but multiplied by a constant near
  136. *> the underflow threshold
  137. *>
  138. *> (9) A matrix of the form U' T U, where U is orthogonal and
  139. *> T has evenly spaced entries 1, ..., ULP with random signs
  140. *> on the diagonal and random O(1) entries in the upper
  141. *> triangle.
  142. *>
  143. *> (10) A matrix of the form U' T U, where U is orthogonal and
  144. *> T has geometrically spaced entries 1, ..., ULP with random
  145. *> signs on the diagonal and random O(1) entries in the upper
  146. *> triangle.
  147. *>
  148. *> (11) A matrix of the form U' T U, where U is orthogonal and
  149. *> T has "clustered" entries 1, ULP,..., ULP with random
  150. *> signs on the diagonal and random O(1) entries in the upper
  151. *> triangle.
  152. *>
  153. *> (12) A matrix of the form U' T U, where U is orthogonal and
  154. *> T has real or complex conjugate paired eigenvalues randomly
  155. *> chosen from ( ULP, 1 ) and random O(1) entries in the upper
  156. *> triangle.
  157. *>
  158. *> (13) A matrix of the form X' T X, where X has condition
  159. *> SQRT( ULP ) and T has evenly spaced entries 1, ..., ULP
  160. *> with random signs on the diagonal and random O(1) entries
  161. *> in the upper triangle.
  162. *>
  163. *> (14) A matrix of the form X' T X, where X has condition
  164. *> SQRT( ULP ) and T has geometrically spaced entries
  165. *> 1, ..., ULP with random signs on the diagonal and random
  166. *> O(1) entries in the upper triangle.
  167. *>
  168. *> (15) A matrix of the form X' T X, where X has condition
  169. *> SQRT( ULP ) and T has "clustered" entries 1, ULP,..., ULP
  170. *> with random signs on the diagonal and random O(1) entries
  171. *> in the upper triangle.
  172. *>
  173. *> (16) A matrix of the form X' T X, where X has condition
  174. *> SQRT( ULP ) and T has real or complex conjugate paired
  175. *> eigenvalues randomly chosen from ( ULP, 1 ) and random
  176. *> O(1) entries in the upper triangle.
  177. *>
  178. *> (17) Same as (16), but multiplied by a constant
  179. *> near the overflow threshold
  180. *> (18) Same as (16), but multiplied by a constant
  181. *> near the underflow threshold
  182. *>
  183. *> (19) Nonsymmetric matrix with random entries chosen from (-1,1).
  184. *> If N is at least 4, all entries in first two rows and last
  185. *> row, and first column and last two columns are zero.
  186. *> (20) Same as (19), but multiplied by a constant
  187. *> near the overflow threshold
  188. *> (21) Same as (19), but multiplied by a constant
  189. *> near the underflow threshold
  190. *>
  191. *> In addition, an input file will be read from logical unit number
  192. *> NIUNIT. The file contains matrices along with precomputed
  193. *> eigenvalues and reciprocal condition numbers for the eigenvalues
  194. *> and right eigenvectors. For these matrices, in addition to tests
  195. *> (1) to (9) we will compute the following two tests:
  196. *>
  197. *> (10) |RCONDV - RCDVIN| / cond(RCONDV)
  198. *>
  199. *> RCONDV is the reciprocal right eigenvector condition number
  200. *> computed by DGEEVX and RCDVIN (the precomputed true value)
  201. *> is supplied as input. cond(RCONDV) is the condition number of
  202. *> RCONDV, and takes errors in computing RCONDV into account, so
  203. *> that the resulting quantity should be O(ULP). cond(RCONDV) is
  204. *> essentially given by norm(A)/RCONDE.
  205. *>
  206. *> (11) |RCONDE - RCDEIN| / cond(RCONDE)
  207. *>
  208. *> RCONDE is the reciprocal eigenvalue condition number
  209. *> computed by DGEEVX and RCDEIN (the precomputed true value)
  210. *> is supplied as input. cond(RCONDE) is the condition number
  211. *> of RCONDE, and takes errors in computing RCONDE into account,
  212. *> so that the resulting quantity should be O(ULP). cond(RCONDE)
  213. *> is essentially given by norm(A)/RCONDV.
  214. *> \endverbatim
  215. *
  216. * Arguments:
  217. * ==========
  218. *
  219. *> \param[in] NSIZES
  220. *> \verbatim
  221. *> NSIZES is INTEGER
  222. *> The number of sizes of matrices to use. NSIZES must be at
  223. *> least zero. If it is zero, no randomly generated matrices
  224. *> are tested, but any test matrices read from NIUNIT will be
  225. *> tested.
  226. *> \endverbatim
  227. *>
  228. *> \param[in] NN
  229. *> \verbatim
  230. *> NN is INTEGER array, dimension (NSIZES)
  231. *> An array containing the sizes to be used for the matrices.
  232. *> Zero values will be skipped. The values must be at least
  233. *> zero.
  234. *> \endverbatim
  235. *>
  236. *> \param[in] NTYPES
  237. *> \verbatim
  238. *> NTYPES is INTEGER
  239. *> The number of elements in DOTYPE. NTYPES must be at least
  240. *> zero. If it is zero, no randomly generated test matrices
  241. *> are tested, but and test matrices read from NIUNIT will be
  242. *> tested. If it is MAXTYP+1 and NSIZES is 1, then an
  243. *> additional type, MAXTYP+1 is defined, which is to use
  244. *> whatever matrix is in A. This is only useful if
  245. *> DOTYPE(1:MAXTYP) is .FALSE. and DOTYPE(MAXTYP+1) is .TRUE. .
  246. *> \endverbatim
  247. *>
  248. *> \param[in] DOTYPE
  249. *> \verbatim
  250. *> DOTYPE is LOGICAL array, dimension (NTYPES)
  251. *> If DOTYPE(j) is .TRUE., then for each size in NN a
  252. *> matrix of that size and of type j will be generated.
  253. *> If NTYPES is smaller than the maximum number of types
  254. *> defined (PARAMETER MAXTYP), then types NTYPES+1 through
  255. *> MAXTYP will not be generated. If NTYPES is larger
  256. *> than MAXTYP, DOTYPE(MAXTYP+1) through DOTYPE(NTYPES)
  257. *> will be ignored.
  258. *> \endverbatim
  259. *>
  260. *> \param[in,out] ISEED
  261. *> \verbatim
  262. *> ISEED is INTEGER array, dimension (4)
  263. *> On entry ISEED specifies the seed of the random number
  264. *> generator. The array elements should be between 0 and 4095;
  265. *> if not they will be reduced mod 4096. Also, ISEED(4) must
  266. *> be odd. The random number generator uses a linear
  267. *> congruential sequence limited to small integers, and so
  268. *> should produce machine independent random numbers. The
  269. *> values of ISEED are changed on exit, and can be used in the
  270. *> next call to DDRVVX to continue the same random number
  271. *> sequence.
  272. *> \endverbatim
  273. *>
  274. *> \param[in] THRESH
  275. *> \verbatim
  276. *> THRESH is DOUBLE PRECISION
  277. *> A test will count as "failed" if the "error", computed as
  278. *> described above, exceeds THRESH. Note that the error
  279. *> is scaled to be O(1), so THRESH should be a reasonably
  280. *> small multiple of 1, e.g., 10 or 100. In particular,
  281. *> it should not depend on the precision (single vs. double)
  282. *> or the size of the matrix. It must be at least zero.
  283. *> \endverbatim
  284. *>
  285. *> \param[in] NIUNIT
  286. *> \verbatim
  287. *> NIUNIT is INTEGER
  288. *> The FORTRAN unit number for reading in the data file of
  289. *> problems to solve.
  290. *> \endverbatim
  291. *>
  292. *> \param[in] NOUNIT
  293. *> \verbatim
  294. *> NOUNIT is INTEGER
  295. *> The FORTRAN unit number for printing out error messages
  296. *> (e.g., if a routine returns INFO not equal to 0.)
  297. *> \endverbatim
  298. *>
  299. *> \param[out] A
  300. *> \verbatim
  301. *> A is DOUBLE PRECISION array, dimension
  302. *> (LDA, max(NN,12))
  303. *> Used to hold the matrix whose eigenvalues are to be
  304. *> computed. On exit, A contains the last matrix actually used.
  305. *> \endverbatim
  306. *>
  307. *> \param[in] LDA
  308. *> \verbatim
  309. *> LDA is INTEGER
  310. *> The leading dimension of the arrays A and H.
  311. *> LDA >= max(NN,12), since 12 is the dimension of the largest
  312. *> matrix in the precomputed input file.
  313. *> \endverbatim
  314. *>
  315. *> \param[out] H
  316. *> \verbatim
  317. *> H is DOUBLE PRECISION array, dimension
  318. *> (LDA, max(NN,12))
  319. *> Another copy of the test matrix A, modified by DGEEVX.
  320. *> \endverbatim
  321. *>
  322. *> \param[out] WR
  323. *> \verbatim
  324. *> WR is DOUBLE PRECISION array, dimension (max(NN))
  325. *> \endverbatim
  326. *>
  327. *> \param[out] WI
  328. *> \verbatim
  329. *> WI is DOUBLE PRECISION array, dimension (max(NN))
  330. *>
  331. *> The real and imaginary parts of the eigenvalues of A.
  332. *> On exit, WR + WI*i are the eigenvalues of the matrix in A.
  333. *> \endverbatim
  334. *>
  335. *> \param[out] WR1
  336. *> \verbatim
  337. *> WR1 is DOUBLE PRECISION array, dimension (max(NN,12))
  338. *> \endverbatim
  339. *>
  340. *> \param[out] WI1
  341. *> \verbatim
  342. *> WI1 is DOUBLE PRECISION array, dimension (max(NN,12))
  343. *>
  344. *> Like WR, WI, these arrays contain the eigenvalues of A,
  345. *> but those computed when DGEEVX only computes a partial
  346. *> eigendecomposition, i.e. not the eigenvalues and left
  347. *> and right eigenvectors.
  348. *> \endverbatim
  349. *>
  350. *> \param[out] VL
  351. *> \verbatim
  352. *> VL is DOUBLE PRECISION array, dimension
  353. *> (LDVL, max(NN,12))
  354. *> VL holds the computed left eigenvectors.
  355. *> \endverbatim
  356. *>
  357. *> \param[in] LDVL
  358. *> \verbatim
  359. *> LDVL is INTEGER
  360. *> Leading dimension of VL. Must be at least max(1,max(NN,12)).
  361. *> \endverbatim
  362. *>
  363. *> \param[out] VR
  364. *> \verbatim
  365. *> VR is DOUBLE PRECISION array, dimension
  366. *> (LDVR, max(NN,12))
  367. *> VR holds the computed right eigenvectors.
  368. *> \endverbatim
  369. *>
  370. *> \param[in] LDVR
  371. *> \verbatim
  372. *> LDVR is INTEGER
  373. *> Leading dimension of VR. Must be at least max(1,max(NN,12)).
  374. *> \endverbatim
  375. *>
  376. *> \param[out] LRE
  377. *> \verbatim
  378. *> LRE is DOUBLE PRECISION array, dimension
  379. *> (LDLRE, max(NN,12))
  380. *> LRE holds the computed right or left eigenvectors.
  381. *> \endverbatim
  382. *>
  383. *> \param[in] LDLRE
  384. *> \verbatim
  385. *> LDLRE is INTEGER
  386. *> Leading dimension of LRE. Must be at least max(1,max(NN,12))
  387. *> \endverbatim
  388. *>
  389. *> \param[out] RCONDV
  390. *> \verbatim
  391. *> RCONDV is DOUBLE PRECISION array, dimension (N)
  392. *> RCONDV holds the computed reciprocal condition numbers
  393. *> for eigenvectors.
  394. *> \endverbatim
  395. *>
  396. *> \param[out] RCNDV1
  397. *> \verbatim
  398. *> RCNDV1 is DOUBLE PRECISION array, dimension (N)
  399. *> RCNDV1 holds more computed reciprocal condition numbers
  400. *> for eigenvectors.
  401. *> \endverbatim
  402. *>
  403. *> \param[out] RCDVIN
  404. *> \verbatim
  405. *> RCDVIN is DOUBLE PRECISION array, dimension (N)
  406. *> When COMP = .TRUE. RCDVIN holds the precomputed reciprocal
  407. *> condition numbers for eigenvectors to be compared with
  408. *> RCONDV.
  409. *> \endverbatim
  410. *>
  411. *> \param[out] RCONDE
  412. *> \verbatim
  413. *> RCONDE is DOUBLE PRECISION array, dimension (N)
  414. *> RCONDE holds the computed reciprocal condition numbers
  415. *> for eigenvalues.
  416. *> \endverbatim
  417. *>
  418. *> \param[out] RCNDE1
  419. *> \verbatim
  420. *> RCNDE1 is DOUBLE PRECISION array, dimension (N)
  421. *> RCNDE1 holds more computed reciprocal condition numbers
  422. *> for eigenvalues.
  423. *> \endverbatim
  424. *>
  425. *> \param[out] RCDEIN
  426. *> \verbatim
  427. *> RCDEIN is DOUBLE PRECISION array, dimension (N)
  428. *> When COMP = .TRUE. RCDEIN holds the precomputed reciprocal
  429. *> condition numbers for eigenvalues to be compared with
  430. *> RCONDE.
  431. *> \endverbatim
  432. *>
  433. *> \param[out] SCALE
  434. *> \verbatim
  435. *> SCALE is DOUBLE PRECISION array, dimension (N)
  436. *> Holds information describing balancing of matrix.
  437. *> \endverbatim
  438. *>
  439. *> \param[out] SCALE1
  440. *> \verbatim
  441. *> SCALE1 is DOUBLE PRECISION array, dimension (N)
  442. *> Holds information describing balancing of matrix.
  443. *> \endverbatim
  444. *>
  445. *> \param[out] RESULT
  446. *> \verbatim
  447. *> RESULT is DOUBLE PRECISION array, dimension (11)
  448. *> The values computed by the seven tests described above.
  449. *> The values are currently limited to 1/ulp, to avoid overflow.
  450. *> \endverbatim
  451. *>
  452. *> \param[out] WORK
  453. *> \verbatim
  454. *> WORK is DOUBLE PRECISION array, dimension (NWORK)
  455. *> \endverbatim
  456. *>
  457. *> \param[in] NWORK
  458. *> \verbatim
  459. *> NWORK is INTEGER
  460. *> The number of entries in WORK. This must be at least
  461. *> max(6*12+2*12**2,6*NN(j)+2*NN(j)**2) =
  462. *> max( 360 ,6*NN(j)+2*NN(j)**2) for all j.
  463. *> \endverbatim
  464. *>
  465. *> \param[out] IWORK
  466. *> \verbatim
  467. *> IWORK is INTEGER array, dimension (2*max(NN,12))
  468. *> \endverbatim
  469. *>
  470. *> \param[out] INFO
  471. *> \verbatim
  472. *> INFO is INTEGER
  473. *> If 0, then successful exit.
  474. *> If <0, then input parameter -INFO is incorrect.
  475. *> If >0, DLATMR, SLATMS, SLATME or DGET23 returned an error
  476. *> code, and INFO is its absolute value.
  477. *>
  478. *>-----------------------------------------------------------------------
  479. *>
  480. *> Some Local Variables and Parameters:
  481. *> ---- ----- --------- --- ----------
  482. *>
  483. *> ZERO, ONE Real 0 and 1.
  484. *> MAXTYP The number of types defined.
  485. *> NMAX Largest value in NN or 12.
  486. *> NERRS The number of tests which have exceeded THRESH
  487. *> COND, CONDS,
  488. *> IMODE Values to be passed to the matrix generators.
  489. *> ANORM Norm of A; passed to matrix generators.
  490. *>
  491. *> OVFL, UNFL Overflow and underflow thresholds.
  492. *> ULP, ULPINV Finest relative precision and its inverse.
  493. *> RTULP, RTULPI Square roots of the previous 4 values.
  494. *>
  495. *> The following four arrays decode JTYPE:
  496. *> KTYPE(j) The general type (1-10) for type "j".
  497. *> KMODE(j) The MODE value to be passed to the matrix
  498. *> generator for type "j".
  499. *> KMAGN(j) The order of magnitude ( O(1),
  500. *> O(overflow^(1/2) ), O(underflow^(1/2) )
  501. *> KCONDS(j) Selectw whether CONDS is to be 1 or
  502. *> 1/sqrt(ulp). (0 means irrelevant.)
  503. *> \endverbatim
  504. *
  505. * Authors:
  506. * ========
  507. *
  508. *> \author Univ. of Tennessee
  509. *> \author Univ. of California Berkeley
  510. *> \author Univ. of Colorado Denver
  511. *> \author NAG Ltd.
  512. *
  513. *> \ingroup double_eig
  514. *
  515. * =====================================================================
  516. SUBROUTINE DDRVVX( NSIZES, NN, NTYPES, DOTYPE, ISEED, THRESH,
  517. $ NIUNIT, NOUNIT, A, LDA, H, WR, WI, WR1, WI1,
  518. $ VL, LDVL, VR, LDVR, LRE, LDLRE, RCONDV, RCNDV1,
  519. $ RCDVIN, RCONDE, RCNDE1, RCDEIN, SCALE, SCALE1,
  520. $ RESULT, WORK, NWORK, IWORK, INFO )
  521. *
  522. * -- LAPACK test routine --
  523. * -- LAPACK is a software package provided by Univ. of Tennessee, --
  524. * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  525. *
  526. * .. Scalar Arguments ..
  527. INTEGER INFO, LDA, LDLRE, LDVL, LDVR, NIUNIT, NOUNIT,
  528. $ NSIZES, NTYPES, NWORK
  529. DOUBLE PRECISION THRESH
  530. * ..
  531. * .. Array Arguments ..
  532. LOGICAL DOTYPE( * )
  533. INTEGER ISEED( 4 ), IWORK( * ), NN( * )
  534. DOUBLE PRECISION A( LDA, * ), H( LDA, * ), LRE( LDLRE, * ),
  535. $ RCDEIN( * ), RCDVIN( * ), RCNDE1( * ),
  536. $ RCNDV1( * ), RCONDE( * ), RCONDV( * ),
  537. $ RESULT( 11 ), SCALE( * ), SCALE1( * ),
  538. $ VL( LDVL, * ), VR( LDVR, * ), WI( * ),
  539. $ WI1( * ), WORK( * ), WR( * ), WR1( * )
  540. * ..
  541. *
  542. * =====================================================================
  543. *
  544. * .. Parameters ..
  545. DOUBLE PRECISION ZERO, ONE
  546. PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0 )
  547. INTEGER MAXTYP
  548. PARAMETER ( MAXTYP = 21 )
  549. * ..
  550. * .. Local Scalars ..
  551. LOGICAL BADNN
  552. CHARACTER BALANC
  553. CHARACTER*3 PATH
  554. INTEGER I, IBAL, IINFO, IMODE, ITYPE, IWK, J, JCOL,
  555. $ JSIZE, JTYPE, MTYPES, N, NERRS, NFAIL, NMAX,
  556. $ NNWORK, NTEST, NTESTF, NTESTT
  557. DOUBLE PRECISION ANORM, COND, CONDS, OVFL, RTULP, RTULPI, ULP,
  558. $ ULPINV, UNFL
  559. * ..
  560. * .. Local Arrays ..
  561. CHARACTER ADUMMA( 1 ), BAL( 4 )
  562. INTEGER IDUMMA( 1 ), IOLDSD( 4 ), KCONDS( MAXTYP ),
  563. $ KMAGN( MAXTYP ), KMODE( MAXTYP ),
  564. $ KTYPE( MAXTYP )
  565. * ..
  566. * .. External Functions ..
  567. DOUBLE PRECISION DLAMCH
  568. EXTERNAL DLAMCH
  569. * ..
  570. * .. External Subroutines ..
  571. EXTERNAL DGET23, DLABAD, DLASET, DLASUM, DLATME, DLATMR,
  572. $ DLATMS, XERBLA
  573. * ..
  574. * .. Intrinsic Functions ..
  575. INTRINSIC ABS, MAX, MIN, SQRT
  576. * ..
  577. * .. Data statements ..
  578. DATA KTYPE / 1, 2, 3, 5*4, 4*6, 6*6, 3*9 /
  579. DATA KMAGN / 3*1, 1, 1, 1, 2, 3, 4*1, 1, 1, 1, 1, 2,
  580. $ 3, 1, 2, 3 /
  581. DATA KMODE / 3*0, 4, 3, 1, 4, 4, 4, 3, 1, 5, 4, 3,
  582. $ 1, 5, 5, 5, 4, 3, 1 /
  583. DATA KCONDS / 3*0, 5*0, 4*1, 6*2, 3*0 /
  584. DATA BAL / 'N', 'P', 'S', 'B' /
  585. * ..
  586. * .. Executable Statements ..
  587. *
  588. PATH( 1: 1 ) = 'Double precision'
  589. PATH( 2: 3 ) = 'VX'
  590. *
  591. * Check for errors
  592. *
  593. NTESTT = 0
  594. NTESTF = 0
  595. INFO = 0
  596. *
  597. * Important constants
  598. *
  599. BADNN = .FALSE.
  600. *
  601. * 12 is the largest dimension in the input file of precomputed
  602. * problems
  603. *
  604. NMAX = 12
  605. DO 10 J = 1, NSIZES
  606. NMAX = MAX( NMAX, NN( J ) )
  607. IF( NN( J ).LT.0 )
  608. $ BADNN = .TRUE.
  609. 10 CONTINUE
  610. *
  611. * Check for errors
  612. *
  613. IF( NSIZES.LT.0 ) THEN
  614. INFO = -1
  615. ELSE IF( BADNN ) THEN
  616. INFO = -2
  617. ELSE IF( NTYPES.LT.0 ) THEN
  618. INFO = -3
  619. ELSE IF( THRESH.LT.ZERO ) THEN
  620. INFO = -6
  621. ELSE IF( LDA.LT.1 .OR. LDA.LT.NMAX ) THEN
  622. INFO = -10
  623. ELSE IF( LDVL.LT.1 .OR. LDVL.LT.NMAX ) THEN
  624. INFO = -17
  625. ELSE IF( LDVR.LT.1 .OR. LDVR.LT.NMAX ) THEN
  626. INFO = -19
  627. ELSE IF( LDLRE.LT.1 .OR. LDLRE.LT.NMAX ) THEN
  628. INFO = -21
  629. ELSE IF( 6*NMAX+2*NMAX**2.GT.NWORK ) THEN
  630. INFO = -32
  631. END IF
  632. *
  633. IF( INFO.NE.0 ) THEN
  634. CALL XERBLA( 'DDRVVX', -INFO )
  635. RETURN
  636. END IF
  637. *
  638. * If nothing to do check on NIUNIT
  639. *
  640. IF( NSIZES.EQ.0 .OR. NTYPES.EQ.0 )
  641. $ GO TO 160
  642. *
  643. * More Important constants
  644. *
  645. UNFL = DLAMCH( 'Safe minimum' )
  646. OVFL = ONE / UNFL
  647. CALL DLABAD( UNFL, OVFL )
  648. ULP = DLAMCH( 'Precision' )
  649. ULPINV = ONE / ULP
  650. RTULP = SQRT( ULP )
  651. RTULPI = ONE / RTULP
  652. *
  653. * Loop over sizes, types
  654. *
  655. NERRS = 0
  656. *
  657. DO 150 JSIZE = 1, NSIZES
  658. N = NN( JSIZE )
  659. IF( NSIZES.NE.1 ) THEN
  660. MTYPES = MIN( MAXTYP, NTYPES )
  661. ELSE
  662. MTYPES = MIN( MAXTYP+1, NTYPES )
  663. END IF
  664. *
  665. DO 140 JTYPE = 1, MTYPES
  666. IF( .NOT.DOTYPE( JTYPE ) )
  667. $ GO TO 140
  668. *
  669. * Save ISEED in case of an error.
  670. *
  671. DO 20 J = 1, 4
  672. IOLDSD( J ) = ISEED( J )
  673. 20 CONTINUE
  674. *
  675. * Compute "A"
  676. *
  677. * Control parameters:
  678. *
  679. * KMAGN KCONDS KMODE KTYPE
  680. * =1 O(1) 1 clustered 1 zero
  681. * =2 large large clustered 2 identity
  682. * =3 small exponential Jordan
  683. * =4 arithmetic diagonal, (w/ eigenvalues)
  684. * =5 random log symmetric, w/ eigenvalues
  685. * =6 random general, w/ eigenvalues
  686. * =7 random diagonal
  687. * =8 random symmetric
  688. * =9 random general
  689. * =10 random triangular
  690. *
  691. IF( MTYPES.GT.MAXTYP )
  692. $ GO TO 90
  693. *
  694. ITYPE = KTYPE( JTYPE )
  695. IMODE = KMODE( JTYPE )
  696. *
  697. * Compute norm
  698. *
  699. GO TO ( 30, 40, 50 )KMAGN( JTYPE )
  700. *
  701. 30 CONTINUE
  702. ANORM = ONE
  703. GO TO 60
  704. *
  705. 40 CONTINUE
  706. ANORM = OVFL*ULP
  707. GO TO 60
  708. *
  709. 50 CONTINUE
  710. ANORM = UNFL*ULPINV
  711. GO TO 60
  712. *
  713. 60 CONTINUE
  714. *
  715. CALL DLASET( 'Full', LDA, N, ZERO, ZERO, A, LDA )
  716. IINFO = 0
  717. COND = ULPINV
  718. *
  719. * Special Matrices -- Identity & Jordan block
  720. *
  721. * Zero
  722. *
  723. IF( ITYPE.EQ.1 ) THEN
  724. IINFO = 0
  725. *
  726. ELSE IF( ITYPE.EQ.2 ) THEN
  727. *
  728. * Identity
  729. *
  730. DO 70 JCOL = 1, N
  731. A( JCOL, JCOL ) = ANORM
  732. 70 CONTINUE
  733. *
  734. ELSE IF( ITYPE.EQ.3 ) THEN
  735. *
  736. * Jordan Block
  737. *
  738. DO 80 JCOL = 1, N
  739. A( JCOL, JCOL ) = ANORM
  740. IF( JCOL.GT.1 )
  741. $ A( JCOL, JCOL-1 ) = ONE
  742. 80 CONTINUE
  743. *
  744. ELSE IF( ITYPE.EQ.4 ) THEN
  745. *
  746. * Diagonal Matrix, [Eigen]values Specified
  747. *
  748. CALL DLATMS( N, N, 'S', ISEED, 'S', WORK, IMODE, COND,
  749. $ ANORM, 0, 0, 'N', A, LDA, WORK( N+1 ),
  750. $ IINFO )
  751. *
  752. ELSE IF( ITYPE.EQ.5 ) THEN
  753. *
  754. * Symmetric, eigenvalues specified
  755. *
  756. CALL DLATMS( N, N, 'S', ISEED, 'S', WORK, IMODE, COND,
  757. $ ANORM, N, N, 'N', A, LDA, WORK( N+1 ),
  758. $ IINFO )
  759. *
  760. ELSE IF( ITYPE.EQ.6 ) THEN
  761. *
  762. * General, eigenvalues specified
  763. *
  764. IF( KCONDS( JTYPE ).EQ.1 ) THEN
  765. CONDS = ONE
  766. ELSE IF( KCONDS( JTYPE ).EQ.2 ) THEN
  767. CONDS = RTULPI
  768. ELSE
  769. CONDS = ZERO
  770. END IF
  771. *
  772. ADUMMA( 1 ) = ' '
  773. CALL DLATME( N, 'S', ISEED, WORK, IMODE, COND, ONE,
  774. $ ADUMMA, 'T', 'T', 'T', WORK( N+1 ), 4,
  775. $ CONDS, N, N, ANORM, A, LDA, WORK( 2*N+1 ),
  776. $ IINFO )
  777. *
  778. ELSE IF( ITYPE.EQ.7 ) THEN
  779. *
  780. * Diagonal, random eigenvalues
  781. *
  782. CALL DLATMR( N, N, 'S', ISEED, 'S', WORK, 6, ONE, ONE,
  783. $ 'T', 'N', WORK( N+1 ), 1, ONE,
  784. $ WORK( 2*N+1 ), 1, ONE, 'N', IDUMMA, 0, 0,
  785. $ ZERO, ANORM, 'NO', A, LDA, IWORK, IINFO )
  786. *
  787. ELSE IF( ITYPE.EQ.8 ) THEN
  788. *
  789. * Symmetric, random eigenvalues
  790. *
  791. CALL DLATMR( N, N, 'S', ISEED, 'S', WORK, 6, ONE, ONE,
  792. $ 'T', 'N', WORK( N+1 ), 1, ONE,
  793. $ WORK( 2*N+1 ), 1, ONE, 'N', IDUMMA, N, N,
  794. $ ZERO, ANORM, 'NO', A, LDA, IWORK, IINFO )
  795. *
  796. ELSE IF( ITYPE.EQ.9 ) THEN
  797. *
  798. * General, random eigenvalues
  799. *
  800. CALL DLATMR( N, N, 'S', ISEED, 'N', WORK, 6, ONE, ONE,
  801. $ 'T', 'N', WORK( N+1 ), 1, ONE,
  802. $ WORK( 2*N+1 ), 1, ONE, 'N', IDUMMA, N, N,
  803. $ ZERO, ANORM, 'NO', A, LDA, IWORK, IINFO )
  804. IF( N.GE.4 ) THEN
  805. CALL DLASET( 'Full', 2, N, ZERO, ZERO, A, LDA )
  806. CALL DLASET( 'Full', N-3, 1, ZERO, ZERO, A( 3, 1 ),
  807. $ LDA )
  808. CALL DLASET( 'Full', N-3, 2, ZERO, ZERO, A( 3, N-1 ),
  809. $ LDA )
  810. CALL DLASET( 'Full', 1, N, ZERO, ZERO, A( N, 1 ),
  811. $ LDA )
  812. END IF
  813. *
  814. ELSE IF( ITYPE.EQ.10 ) THEN
  815. *
  816. * Triangular, random eigenvalues
  817. *
  818. CALL DLATMR( N, N, 'S', ISEED, 'N', WORK, 6, ONE, ONE,
  819. $ 'T', 'N', WORK( N+1 ), 1, ONE,
  820. $ WORK( 2*N+1 ), 1, ONE, 'N', IDUMMA, N, 0,
  821. $ ZERO, ANORM, 'NO', A, LDA, IWORK, IINFO )
  822. *
  823. ELSE
  824. *
  825. IINFO = 1
  826. END IF
  827. *
  828. IF( IINFO.NE.0 ) THEN
  829. WRITE( NOUNIT, FMT = 9992 )'Generator', IINFO, N, JTYPE,
  830. $ IOLDSD
  831. INFO = ABS( IINFO )
  832. RETURN
  833. END IF
  834. *
  835. 90 CONTINUE
  836. *
  837. * Test for minimal and generous workspace
  838. *
  839. DO 130 IWK = 1, 3
  840. IF( IWK.EQ.1 ) THEN
  841. NNWORK = 3*N
  842. ELSE IF( IWK.EQ.2 ) THEN
  843. NNWORK = 6*N + N**2
  844. ELSE
  845. NNWORK = 6*N + 2*N**2
  846. END IF
  847. NNWORK = MAX( NNWORK, 1 )
  848. *
  849. * Test for all balancing options
  850. *
  851. DO 120 IBAL = 1, 4
  852. BALANC = BAL( IBAL )
  853. *
  854. * Perform tests
  855. *
  856. CALL DGET23( .FALSE., BALANC, JTYPE, THRESH, IOLDSD,
  857. $ NOUNIT, N, A, LDA, H, WR, WI, WR1, WI1,
  858. $ VL, LDVL, VR, LDVR, LRE, LDLRE, RCONDV,
  859. $ RCNDV1, RCDVIN, RCONDE, RCNDE1, RCDEIN,
  860. $ SCALE, SCALE1, RESULT, WORK, NNWORK,
  861. $ IWORK, INFO )
  862. *
  863. * Check for RESULT(j) > THRESH
  864. *
  865. NTEST = 0
  866. NFAIL = 0
  867. DO 100 J = 1, 9
  868. IF( RESULT( J ).GE.ZERO )
  869. $ NTEST = NTEST + 1
  870. IF( RESULT( J ).GE.THRESH )
  871. $ NFAIL = NFAIL + 1
  872. 100 CONTINUE
  873. *
  874. IF( NFAIL.GT.0 )
  875. $ NTESTF = NTESTF + 1
  876. IF( NTESTF.EQ.1 ) THEN
  877. WRITE( NOUNIT, FMT = 9999 )PATH
  878. WRITE( NOUNIT, FMT = 9998 )
  879. WRITE( NOUNIT, FMT = 9997 )
  880. WRITE( NOUNIT, FMT = 9996 )
  881. WRITE( NOUNIT, FMT = 9995 )THRESH
  882. NTESTF = 2
  883. END IF
  884. *
  885. DO 110 J = 1, 9
  886. IF( RESULT( J ).GE.THRESH ) THEN
  887. WRITE( NOUNIT, FMT = 9994 )BALANC, N, IWK,
  888. $ IOLDSD, JTYPE, J, RESULT( J )
  889. END IF
  890. 110 CONTINUE
  891. *
  892. NERRS = NERRS + NFAIL
  893. NTESTT = NTESTT + NTEST
  894. *
  895. 120 CONTINUE
  896. 130 CONTINUE
  897. 140 CONTINUE
  898. 150 CONTINUE
  899. *
  900. 160 CONTINUE
  901. *
  902. * Read in data from file to check accuracy of condition estimation.
  903. * Assume input eigenvalues are sorted lexicographically (increasing
  904. * by real part, then decreasing by imaginary part)
  905. *
  906. JTYPE = 0
  907. 170 CONTINUE
  908. READ( NIUNIT, FMT = *, END = 220 )N
  909. *
  910. * Read input data until N=0
  911. *
  912. IF( N.EQ.0 )
  913. $ GO TO 220
  914. JTYPE = JTYPE + 1
  915. ISEED( 1 ) = JTYPE
  916. DO 180 I = 1, N
  917. READ( NIUNIT, FMT = * )( A( I, J ), J = 1, N )
  918. 180 CONTINUE
  919. DO 190 I = 1, N
  920. READ( NIUNIT, FMT = * )WR1( I ), WI1( I ), RCDEIN( I ),
  921. $ RCDVIN( I )
  922. 190 CONTINUE
  923. CALL DGET23( .TRUE., 'N', 22, THRESH, ISEED, NOUNIT, N, A, LDA, H,
  924. $ WR, WI, WR1, WI1, VL, LDVL, VR, LDVR, LRE, LDLRE,
  925. $ RCONDV, RCNDV1, RCDVIN, RCONDE, RCNDE1, RCDEIN,
  926. $ SCALE, SCALE1, RESULT, WORK, 6*N+2*N**2, IWORK,
  927. $ INFO )
  928. *
  929. * Check for RESULT(j) > THRESH
  930. *
  931. NTEST = 0
  932. NFAIL = 0
  933. DO 200 J = 1, 11
  934. IF( RESULT( J ).GE.ZERO )
  935. $ NTEST = NTEST + 1
  936. IF( RESULT( J ).GE.THRESH )
  937. $ NFAIL = NFAIL + 1
  938. 200 CONTINUE
  939. *
  940. IF( NFAIL.GT.0 )
  941. $ NTESTF = NTESTF + 1
  942. IF( NTESTF.EQ.1 ) THEN
  943. WRITE( NOUNIT, FMT = 9999 )PATH
  944. WRITE( NOUNIT, FMT = 9998 )
  945. WRITE( NOUNIT, FMT = 9997 )
  946. WRITE( NOUNIT, FMT = 9996 )
  947. WRITE( NOUNIT, FMT = 9995 )THRESH
  948. NTESTF = 2
  949. END IF
  950. *
  951. DO 210 J = 1, 11
  952. IF( RESULT( J ).GE.THRESH ) THEN
  953. WRITE( NOUNIT, FMT = 9993 )N, JTYPE, J, RESULT( J )
  954. END IF
  955. 210 CONTINUE
  956. *
  957. NERRS = NERRS + NFAIL
  958. NTESTT = NTESTT + NTEST
  959. GO TO 170
  960. 220 CONTINUE
  961. *
  962. * Summary
  963. *
  964. CALL DLASUM( PATH, NOUNIT, NERRS, NTESTT )
  965. *
  966. 9999 FORMAT( / 1X, A3, ' -- Real Eigenvalue-Eigenvector Decomposition',
  967. $ ' Expert Driver', /
  968. $ ' Matrix types (see DDRVVX for details): ' )
  969. *
  970. 9998 FORMAT( / ' Special Matrices:', / ' 1=Zero matrix. ',
  971. $ ' ', ' 5=Diagonal: geometr. spaced entries.',
  972. $ / ' 2=Identity matrix. ', ' 6=Diagona',
  973. $ 'l: clustered entries.', / ' 3=Transposed Jordan block. ',
  974. $ ' ', ' 7=Diagonal: large, evenly spaced.', / ' ',
  975. $ '4=Diagonal: evenly spaced entries. ', ' 8=Diagonal: s',
  976. $ 'mall, evenly spaced.' )
  977. 9997 FORMAT( ' Dense, Non-Symmetric Matrices:', / ' 9=Well-cond., ev',
  978. $ 'enly spaced eigenvals.', ' 14=Ill-cond., geomet. spaced e',
  979. $ 'igenals.', / ' 10=Well-cond., geom. spaced eigenvals. ',
  980. $ ' 15=Ill-conditioned, clustered e.vals.', / ' 11=Well-cond',
  981. $ 'itioned, clustered e.vals. ', ' 16=Ill-cond., random comp',
  982. $ 'lex ', / ' 12=Well-cond., random complex ', ' ',
  983. $ ' 17=Ill-cond., large rand. complx ', / ' 13=Ill-condi',
  984. $ 'tioned, evenly spaced. ', ' 18=Ill-cond., small rand.',
  985. $ ' complx ' )
  986. 9996 FORMAT( ' 19=Matrix with random O(1) entries. ', ' 21=Matrix ',
  987. $ 'with small random entries.', / ' 20=Matrix with large ran',
  988. $ 'dom entries. ', ' 22=Matrix read from input file', / )
  989. 9995 FORMAT( ' Tests performed with test threshold =', F8.2,
  990. $ / / ' 1 = | A VR - VR W | / ( n |A| ulp ) ',
  991. $ / ' 2 = | transpose(A) VL - VL W | / ( n |A| ulp ) ',
  992. $ / ' 3 = | |VR(i)| - 1 | / ulp ',
  993. $ / ' 4 = | |VL(i)| - 1 | / ulp ',
  994. $ / ' 5 = 0 if W same no matter if VR or VL computed,',
  995. $ ' 1/ulp otherwise', /
  996. $ ' 6 = 0 if VR same no matter what else computed,',
  997. $ ' 1/ulp otherwise', /
  998. $ ' 7 = 0 if VL same no matter what else computed,',
  999. $ ' 1/ulp otherwise', /
  1000. $ ' 8 = 0 if RCONDV same no matter what else computed,',
  1001. $ ' 1/ulp otherwise', /
  1002. $ ' 9 = 0 if SCALE, ILO, IHI, ABNRM same no matter what else',
  1003. $ ' computed, 1/ulp otherwise',
  1004. $ / ' 10 = | RCONDV - RCONDV(precomputed) | / cond(RCONDV),',
  1005. $ / ' 11 = | RCONDE - RCONDE(precomputed) | / cond(RCONDE),' )
  1006. 9994 FORMAT( ' BALANC=''', A1, ''',N=', I4, ',IWK=', I1, ', seed=',
  1007. $ 4( I4, ',' ), ' type ', I2, ', test(', I2, ')=', G10.3 )
  1008. 9993 FORMAT( ' N=', I5, ', input example =', I3, ', test(', I2, ')=',
  1009. $ G10.3 )
  1010. 9992 FORMAT( ' DDRVVX: ', A, ' returned INFO=', I6, '.', / 9X, 'N=',
  1011. $ I6, ', JTYPE=', I6, ', ISEED=(', 3( I5, ',' ), I5, ')' )
  1012. *
  1013. RETURN
  1014. *
  1015. * End of DDRVVX
  1016. *
  1017. END