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.

zchksy_rook.f 28 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860
  1. *> \brief \b ZCHKSY_ROOK
  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 ZCHKSY_ROOK( DOTYPE, NN, NVAL, NNB, NBVAL, NNS, NSVAL,
  12. * THRESH, TSTERR, NMAX, A, AFAC, AINV, B, X,
  13. * XACT, WORK, RWORK, IWORK, NOUT )
  14. *
  15. * .. Scalar Arguments ..
  16. * LOGICAL TSTERR
  17. * INTEGER NMAX, NN, NNB, NNS, NOUT
  18. * DOUBLE PRECISION THRESH
  19. * ..
  20. * .. Array Arguments ..
  21. * LOGICAL DOTYPE( * )
  22. * INTEGER IWORK( * ), NBVAL( * ), NSVAL( * ), NVAL( * )
  23. * DOUBLE PRECISION RWORK( * )
  24. * COMPLEX*16 A( * ), AFAC( * ), AINV( * ), B( * ),
  25. * $ WORK( * ), X( * ), XACT( * )
  26. * ..
  27. *
  28. *
  29. *> \par Purpose:
  30. * =============
  31. *>
  32. *> \verbatim
  33. *>
  34. *> ZCHKSY_ROOK tests ZSYTRF_ROOK, -TRI_ROOK, -TRS_ROOK,
  35. *> and -CON_ROOK.
  36. *> \endverbatim
  37. *
  38. * Arguments:
  39. * ==========
  40. *
  41. *> \param[in] DOTYPE
  42. *> \verbatim
  43. *> DOTYPE is LOGICAL array, dimension (NTYPES)
  44. *> The matrix types to be used for testing. Matrices of type j
  45. *> (for 1 <= j <= NTYPES) are used for testing if DOTYPE(j) =
  46. *> .TRUE.; if DOTYPE(j) = .FALSE., then type j is not used.
  47. *> \endverbatim
  48. *>
  49. *> \param[in] NN
  50. *> \verbatim
  51. *> NN is INTEGER
  52. *> The number of values of N contained in the vector NVAL.
  53. *> \endverbatim
  54. *>
  55. *> \param[in] NVAL
  56. *> \verbatim
  57. *> NVAL is INTEGER array, dimension (NN)
  58. *> The values of the matrix dimension N.
  59. *> \endverbatim
  60. *>
  61. *> \param[in] NNB
  62. *> \verbatim
  63. *> NNB is INTEGER
  64. *> The number of values of NB contained in the vector NBVAL.
  65. *> \endverbatim
  66. *>
  67. *> \param[in] NBVAL
  68. *> \verbatim
  69. *> NBVAL is INTEGER array, dimension (NBVAL)
  70. *> The values of the blocksize NB.
  71. *> \endverbatim
  72. *>
  73. *> \param[in] NNS
  74. *> \verbatim
  75. *> NNS is INTEGER
  76. *> The number of values of NRHS contained in the vector NSVAL.
  77. *> \endverbatim
  78. *>
  79. *> \param[in] NSVAL
  80. *> \verbatim
  81. *> NSVAL is INTEGER array, dimension (NNS)
  82. *> The values of the number of right hand sides NRHS.
  83. *> \endverbatim
  84. *>
  85. *> \param[in] THRESH
  86. *> \verbatim
  87. *> THRESH is DOUBLE PRECISION
  88. *> The threshold value for the test ratios. A result is
  89. *> included in the output file if RESULT >= THRESH. To have
  90. *> every test ratio printed, use THRESH = 0.
  91. *> \endverbatim
  92. *>
  93. *> \param[in] TSTERR
  94. *> \verbatim
  95. *> TSTERR is LOGICAL
  96. *> Flag that indicates whether error exits are to be tested.
  97. *> \endverbatim
  98. *>
  99. *> \param[in] NMAX
  100. *> \verbatim
  101. *> NMAX is INTEGER
  102. *> The maximum value permitted for N, used in dimensioning the
  103. *> work arrays.
  104. *> \endverbatim
  105. *>
  106. *> \param[out] A
  107. *> \verbatim
  108. *> A is COMPLEX*16 array, dimension (NMAX*NMAX)
  109. *> \endverbatim
  110. *>
  111. *> \param[out] AFAC
  112. *> \verbatim
  113. *> AFAC is COMPLEX*16 array, dimension (NMAX*NMAX)
  114. *> \endverbatim
  115. *>
  116. *> \param[out] AINV
  117. *> \verbatim
  118. *> AINV is COMPLEX*16 array, dimension (NMAX*NMAX)
  119. *> \endverbatim
  120. *>
  121. *> \param[out] B
  122. *> \verbatim
  123. *> B is COMPLEX*16 array, dimension (NMAX*NSMAX)
  124. *> where NSMAX is the largest entry in NSVAL.
  125. *> \endverbatim
  126. *>
  127. *> \param[out] X
  128. *> \verbatim
  129. *> X is COMPLEX*16 array, dimension (NMAX*NSMAX)
  130. *> \endverbatim
  131. *>
  132. *> \param[out] XACT
  133. *> \verbatim
  134. *> XACT is COMPLEX*16 array, dimension (NMAX*NSMAX)
  135. *> \endverbatim
  136. *>
  137. *> \param[out] WORK
  138. *> \verbatim
  139. *> WORK is COMPLEX*16 array, dimension (NMAX*max(3,NSMAX))
  140. *> \endverbatim
  141. *>
  142. *> \param[out] RWORK
  143. *> \verbatim
  144. *> RWORK is DOUBLE PRECISION array, dimension (max(NMAX,2*NSMAX))
  145. *> \endverbatim
  146. *>
  147. *> \param[out] IWORK
  148. *> \verbatim
  149. *> IWORK is INTEGER array, dimension (2*NMAX)
  150. *> \endverbatim
  151. *>
  152. *> \param[in] NOUT
  153. *> \verbatim
  154. *> NOUT is INTEGER
  155. *> The unit number for output.
  156. *> \endverbatim
  157. *
  158. * Authors:
  159. * ========
  160. *
  161. *> \author Univ. of Tennessee
  162. *> \author Univ. of California Berkeley
  163. *> \author Univ. of Colorado Denver
  164. *> \author NAG Ltd.
  165. *
  166. *> \date November 2013
  167. *
  168. *> \ingroup complex16_lin
  169. *
  170. * =====================================================================
  171. SUBROUTINE ZCHKSY_ROOK( DOTYPE, NN, NVAL, NNB, NBVAL, NNS, NSVAL,
  172. $ THRESH, TSTERR, NMAX, A, AFAC, AINV, B, X,
  173. $ XACT, WORK, RWORK, IWORK, NOUT )
  174. *
  175. * -- LAPACK test routine (version 3.5.0) --
  176. * -- LAPACK is a software package provided by Univ. of Tennessee, --
  177. * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  178. * November 2013
  179. *
  180. * .. Scalar Arguments ..
  181. LOGICAL TSTERR
  182. INTEGER NMAX, NN, NNB, NNS, NOUT
  183. DOUBLE PRECISION THRESH
  184. * ..
  185. * .. Array Arguments ..
  186. LOGICAL DOTYPE( * )
  187. INTEGER IWORK( * ), NBVAL( * ), NSVAL( * ), NVAL( * )
  188. DOUBLE PRECISION RWORK( * )
  189. COMPLEX*16 A( * ), AFAC( * ), AINV( * ), B( * ),
  190. $ WORK( * ), X( * ), XACT( * )
  191. * ..
  192. *
  193. * =====================================================================
  194. *
  195. * .. Parameters ..
  196. DOUBLE PRECISION ZERO, ONE
  197. PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0 )
  198. DOUBLE PRECISION ONEHALF
  199. PARAMETER ( ONEHALF = 0.5D+0 )
  200. DOUBLE PRECISION EIGHT, SEVTEN
  201. PARAMETER ( EIGHT = 8.0D+0, SEVTEN = 17.0D+0 )
  202. COMPLEX*16 CZERO
  203. PARAMETER ( CZERO = ( 0.0D+0, 0.0D+0 ) )
  204. INTEGER NTYPES
  205. PARAMETER ( NTYPES = 11 )
  206. INTEGER NTESTS
  207. PARAMETER ( NTESTS = 7 )
  208. * ..
  209. * .. Local Scalars ..
  210. LOGICAL TRFCON, ZEROT
  211. CHARACTER DIST, TYPE, UPLO, XTYPE
  212. CHARACTER*3 PATH, MATPATH
  213. INTEGER I, I1, I2, IMAT, IN, INB, INFO, IOFF, IRHS,
  214. $ ITEMP, ITEMP2, IUPLO, IZERO, J, K, KL, KU, LDA,
  215. $ LWORK, MODE, N, NB, NERRS, NFAIL, NIMAT, NRHS,
  216. $ NRUN, NT
  217. DOUBLE PRECISION ALPHA, ANORM, CNDNUM, CONST, DTEMP, LAM_MAX,
  218. $ LAM_MIN, RCOND, RCONDC
  219. * ..
  220. * .. Local Arrays ..
  221. CHARACTER UPLOS( 2 )
  222. INTEGER ISEED( 4 ), ISEEDY( 4 )
  223. DOUBLE PRECISION RESULT( NTESTS )
  224. COMPLEX*16 BLOCK( 2, 2 ), ZDUMMY( 1 )
  225. * ..
  226. * .. External Functions ..
  227. DOUBLE PRECISION DGET06, ZLANGE, ZLANSY
  228. EXTERNAL DGET06, ZLANGE, ZLANSY
  229. * ..
  230. * .. External Subroutines ..
  231. EXTERNAL ALAERH, ALAHD, ALASUM, ZERRSY, ZGEEVX, ZGET04,
  232. $ ZLACPY, ZLARHS, ZLATB4, ZLATMS, ZLATSY,ZSYT02,
  233. $ ZSYT03, ZSYCON_ROOK, ZSYT01_ROOK, ZSYTRF_ROOK,
  234. $ ZSYTRI_ROOK, ZSYTRS_ROOK, XLAENV
  235. * ..
  236. * .. Intrinsic Functions ..
  237. INTRINSIC ABS, MAX, MIN, SQRT
  238. * ..
  239. * .. Scalars in Common ..
  240. LOGICAL LERR, OK
  241. CHARACTER*32 SRNAMT
  242. INTEGER INFOT, NUNIT
  243. * ..
  244. * .. Common blocks ..
  245. COMMON / INFOC / INFOT, NUNIT, OK, LERR
  246. COMMON / SRNAMC / SRNAMT
  247. * ..
  248. * .. Data statements ..
  249. DATA ISEEDY / 1988, 1989, 1990, 1991 /
  250. DATA UPLOS / 'U', 'L' /
  251. * ..
  252. * .. Executable Statements ..
  253. *
  254. * Initialize constants and the random number seed.
  255. *
  256. ALPHA = ( ONE+SQRT( SEVTEN ) ) / EIGHT
  257. *
  258. * Test path
  259. *
  260. PATH( 1: 1 ) = 'Zomplex precision'
  261. PATH( 2: 3 ) = 'SR'
  262. *
  263. * Path to generate matrices
  264. *
  265. MATPATH( 1: 1 ) = 'Zomplex precision'
  266. MATPATH( 2: 3 ) = 'SY'
  267. *
  268. NRUN = 0
  269. NFAIL = 0
  270. NERRS = 0
  271. DO 10 I = 1, 4
  272. ISEED( I ) = ISEEDY( I )
  273. 10 CONTINUE
  274. *
  275. * Test the error exits
  276. *
  277. IF( TSTERR )
  278. $ CALL ZERRSY( PATH, NOUT )
  279. INFOT = 0
  280. *
  281. * Set the minimum block size for which the block routine should
  282. * be used, which will be later returned by ILAENV
  283. *
  284. CALL XLAENV( 2, 2 )
  285. *
  286. * Do for each value of N in NVAL
  287. *
  288. DO 270 IN = 1, NN
  289. N = NVAL( IN )
  290. LDA = MAX( N, 1 )
  291. XTYPE = 'N'
  292. NIMAT = NTYPES
  293. IF( N.LE.0 )
  294. $ NIMAT = 1
  295. *
  296. IZERO = 0
  297. *
  298. * Do for each value of matrix type IMAT
  299. *
  300. DO 260 IMAT = 1, NIMAT
  301. *
  302. * Do the tests only if DOTYPE( IMAT ) is true.
  303. *
  304. IF( .NOT.DOTYPE( IMAT ) )
  305. $ GO TO 260
  306. *
  307. * Skip types 3, 4, 5, or 6 if the matrix size is too small.
  308. *
  309. ZEROT = IMAT.GE.3 .AND. IMAT.LE.6
  310. IF( ZEROT .AND. N.LT.IMAT-2 )
  311. $ GO TO 260
  312. *
  313. * Do first for UPLO = 'U', then for UPLO = 'L'
  314. *
  315. DO 250 IUPLO = 1, 2
  316. UPLO = UPLOS( IUPLO )
  317. *
  318. * Begin generate test matrix A.
  319. *
  320. IF( IMAT.NE.NTYPES ) THEN
  321. *
  322. * Set up parameters with ZLATB4 for the matrix generator
  323. * based on the type of matrix to be generated.
  324. *
  325. CALL ZLATB4( MATPATH, IMAT, N, N, TYPE, KL, KU, ANORM,
  326. $ MODE, CNDNUM, DIST )
  327. *
  328. * Generate a matrix with ZLATMS.
  329. *
  330. SRNAMT = 'ZLATMS'
  331. CALL ZLATMS( N, N, DIST, ISEED, TYPE, RWORK, MODE,
  332. $ CNDNUM, ANORM, KL, KU, UPLO, A, LDA,
  333. $ WORK, INFO )
  334. *
  335. * Check error code from ZLATMS and handle error.
  336. *
  337. IF( INFO.NE.0 ) THEN
  338. CALL ALAERH( PATH, 'ZLATMS', INFO, 0, UPLO, N, N,
  339. $ -1, -1, -1, IMAT, NFAIL, NERRS, NOUT )
  340. *
  341. * Skip all tests for this generated matrix
  342. *
  343. GO TO 250
  344. END IF
  345. *
  346. * For matrix types 3-6, zero one or more rows and
  347. * columns of the matrix to test that INFO is returned
  348. * correctly.
  349. *
  350. IF( ZEROT ) THEN
  351. IF( IMAT.EQ.3 ) THEN
  352. IZERO = 1
  353. ELSE IF( IMAT.EQ.4 ) THEN
  354. IZERO = N
  355. ELSE
  356. IZERO = N / 2 + 1
  357. END IF
  358. *
  359. IF( IMAT.LT.6 ) THEN
  360. *
  361. * Set row and column IZERO to zero.
  362. *
  363. IF( IUPLO.EQ.1 ) THEN
  364. IOFF = ( IZERO-1 )*LDA
  365. DO 20 I = 1, IZERO - 1
  366. A( IOFF+I ) = CZERO
  367. 20 CONTINUE
  368. IOFF = IOFF + IZERO
  369. DO 30 I = IZERO, N
  370. A( IOFF ) = CZERO
  371. IOFF = IOFF + LDA
  372. 30 CONTINUE
  373. ELSE
  374. IOFF = IZERO
  375. DO 40 I = 1, IZERO - 1
  376. A( IOFF ) = CZERO
  377. IOFF = IOFF + LDA
  378. 40 CONTINUE
  379. IOFF = IOFF - IZERO
  380. DO 50 I = IZERO, N
  381. A( IOFF+I ) = CZERO
  382. 50 CONTINUE
  383. END IF
  384. ELSE
  385. IF( IUPLO.EQ.1 ) THEN
  386. *
  387. * Set the first IZERO rows and columns to zero.
  388. *
  389. IOFF = 0
  390. DO 70 J = 1, N
  391. I2 = MIN( J, IZERO )
  392. DO 60 I = 1, I2
  393. A( IOFF+I ) = CZERO
  394. 60 CONTINUE
  395. IOFF = IOFF + LDA
  396. 70 CONTINUE
  397. ELSE
  398. *
  399. * Set the last IZERO rows and columns to zero.
  400. *
  401. IOFF = 0
  402. DO 90 J = 1, N
  403. I1 = MAX( J, IZERO )
  404. DO 80 I = I1, N
  405. A( IOFF+I ) = CZERO
  406. 80 CONTINUE
  407. IOFF = IOFF + LDA
  408. 90 CONTINUE
  409. END IF
  410. END IF
  411. ELSE
  412. IZERO = 0
  413. END IF
  414. *
  415. ELSE
  416. *
  417. * For matrix kind IMAT = 11, generate special block
  418. * diagonal matrix to test alternate code
  419. * for the 2 x 2 blocks.
  420. *
  421. CALL ZLATSY( UPLO, N, A, LDA, ISEED )
  422. *
  423. END IF
  424. *
  425. * End generate test matrix A.
  426. *
  427. *
  428. * Do for each value of NB in NBVAL
  429. *
  430. DO 240 INB = 1, NNB
  431. *
  432. * Set the optimal blocksize, which will be later
  433. * returned by ILAENV.
  434. *
  435. NB = NBVAL( INB )
  436. CALL XLAENV( 1, NB )
  437. *
  438. * Copy the test matrix A into matrix AFAC which
  439. * will be factorized in place. This is needed to
  440. * preserve the test matrix A for subsequent tests.
  441. *
  442. CALL ZLACPY( UPLO, N, N, A, LDA, AFAC, LDA )
  443. *
  444. * Compute the L*D*L**T or U*D*U**T factorization of the
  445. * matrix. IWORK stores details of the interchanges and
  446. * the block structure of D. AINV is a work array for
  447. * block factorization, LWORK is the length of AINV.
  448. *
  449. LWORK = MAX( 2, NB )*LDA
  450. SRNAMT = 'ZSYTRF_ROOK'
  451. CALL ZSYTRF_ROOK( UPLO, N, AFAC, LDA, IWORK, AINV,
  452. $ LWORK, INFO )
  453. *
  454. * Adjust the expected value of INFO to account for
  455. * pivoting.
  456. *
  457. K = IZERO
  458. IF( K.GT.0 ) THEN
  459. 100 CONTINUE
  460. IF( IWORK( K ).LT.0 ) THEN
  461. IF( IWORK( K ).NE.-K ) THEN
  462. K = -IWORK( K )
  463. GO TO 100
  464. END IF
  465. ELSE IF( IWORK( K ).NE.K ) THEN
  466. K = IWORK( K )
  467. GO TO 100
  468. END IF
  469. END IF
  470. *
  471. * Check error code from ZSYTRF_ROOK and handle error.
  472. *
  473. IF( INFO.NE.K)
  474. $ CALL ALAERH( PATH, 'ZSYTRF_ROOK', INFO, K,
  475. $ UPLO, N, N, -1, -1, NB, IMAT,
  476. $ NFAIL, NERRS, NOUT )
  477. *
  478. * Set the condition estimate flag if the INFO is not 0.
  479. *
  480. IF( INFO.NE.0 ) THEN
  481. TRFCON = .TRUE.
  482. ELSE
  483. TRFCON = .FALSE.
  484. END IF
  485. *
  486. *+ TEST 1
  487. * Reconstruct matrix from factors and compute residual.
  488. *
  489. CALL ZSYT01_ROOK( UPLO, N, A, LDA, AFAC, LDA, IWORK,
  490. $ AINV, LDA, RWORK, RESULT( 1 ) )
  491. NT = 1
  492. *
  493. *+ TEST 2
  494. * Form the inverse and compute the residual,
  495. * if the factorization was competed without INFO > 0
  496. * (i.e. there is no zero rows and columns).
  497. * Do it only for the first block size.
  498. *
  499. IF( INB.EQ.1 .AND. .NOT.TRFCON ) THEN
  500. CALL ZLACPY( UPLO, N, N, AFAC, LDA, AINV, LDA )
  501. SRNAMT = 'ZSYTRI_ROOK'
  502. CALL ZSYTRI_ROOK( UPLO, N, AINV, LDA, IWORK, WORK,
  503. $ INFO )
  504. *
  505. * Check error code from ZSYTRI_ROOK and handle error.
  506. *
  507. IF( INFO.NE.0 )
  508. $ CALL ALAERH( PATH, 'ZSYTRI_ROOK', INFO, -1,
  509. $ UPLO, N, N, -1, -1, -1, IMAT,
  510. $ NFAIL, NERRS, NOUT )
  511. *
  512. * Compute the residual for a symmetric matrix times
  513. * its inverse.
  514. *
  515. CALL ZSYT03( UPLO, N, A, LDA, AINV, LDA, WORK, LDA,
  516. $ RWORK, RCONDC, RESULT( 2 ) )
  517. NT = 2
  518. END IF
  519. *
  520. * Print information about the tests that did not pass
  521. * the threshold.
  522. *
  523. DO 110 K = 1, NT
  524. IF( RESULT( K ).GE.THRESH ) THEN
  525. IF( NFAIL.EQ.0 .AND. NERRS.EQ.0 )
  526. $ CALL ALAHD( NOUT, PATH )
  527. WRITE( NOUT, FMT = 9999 )UPLO, N, NB, IMAT, K,
  528. $ RESULT( K )
  529. NFAIL = NFAIL + 1
  530. END IF
  531. 110 CONTINUE
  532. NRUN = NRUN + NT
  533. *
  534. *+ TEST 3
  535. * Compute largest element in U or L
  536. *
  537. RESULT( 3 ) = ZERO
  538. DTEMP = ZERO
  539. *
  540. CONST = ( ( ALPHA**2-ONE ) / ( ALPHA**2-ONEHALF ) ) /
  541. $ ( ONE-ALPHA )
  542. *
  543. IF( IUPLO.EQ.1 ) THEN
  544. *
  545. * Compute largest element in U
  546. *
  547. K = N
  548. 120 CONTINUE
  549. IF( K.LE.1 )
  550. $ GO TO 130
  551. *
  552. IF( IWORK( K ).GT.ZERO ) THEN
  553. *
  554. * Get max absolute value from elements
  555. * in column k in in U
  556. *
  557. DTEMP = ZLANGE( 'M', K-1, 1,
  558. $ AFAC( ( K-1 )*LDA+1 ), LDA, RWORK )
  559. ELSE
  560. *
  561. * Get max absolute value from elements
  562. * in columns k and k-1 in U
  563. *
  564. DTEMP = ZLANGE( 'M', K-2, 2,
  565. $ AFAC( ( K-2 )*LDA+1 ), LDA, RWORK )
  566. K = K - 1
  567. *
  568. END IF
  569. *
  570. * DTEMP should be bounded by CONST
  571. *
  572. DTEMP = DTEMP - CONST + THRESH
  573. IF( DTEMP.GT.RESULT( 3 ) )
  574. $ RESULT( 3 ) = DTEMP
  575. *
  576. K = K - 1
  577. *
  578. GO TO 120
  579. 130 CONTINUE
  580. *
  581. ELSE
  582. *
  583. * Compute largest element in L
  584. *
  585. K = 1
  586. 140 CONTINUE
  587. IF( K.GE.N )
  588. $ GO TO 150
  589. *
  590. IF( IWORK( K ).GT.ZERO ) THEN
  591. *
  592. * Get max absolute value from elements
  593. * in column k in in L
  594. *
  595. DTEMP = ZLANGE( 'M', N-K, 1,
  596. $ AFAC( ( K-1 )*LDA+K+1 ), LDA, RWORK )
  597. ELSE
  598. *
  599. * Get max absolute value from elements
  600. * in columns k and k+1 in L
  601. *
  602. DTEMP = ZLANGE( 'M', N-K-1, 2,
  603. $ AFAC( ( K-1 )*LDA+K+2 ), LDA, RWORK )
  604. K = K + 1
  605. *
  606. END IF
  607. *
  608. * DTEMP should be bounded by CONST
  609. *
  610. DTEMP = DTEMP - CONST + THRESH
  611. IF( DTEMP.GT.RESULT( 3 ) )
  612. $ RESULT( 3 ) = DTEMP
  613. *
  614. K = K + 1
  615. *
  616. GO TO 140
  617. 150 CONTINUE
  618. END IF
  619. *
  620. *
  621. *+ TEST 4
  622. * Compute largest 2-Norm of 2-by-2 diag blocks
  623. *
  624. RESULT( 4 ) = ZERO
  625. DTEMP = ZERO
  626. *
  627. CONST = ( ( ALPHA**2-ONE ) / ( ALPHA**2-ONEHALF ) )*
  628. $ ( ( ONE + ALPHA ) / ( ONE - ALPHA ) )
  629. *
  630. IF( IUPLO.EQ.1 ) THEN
  631. *
  632. * Loop backward for UPLO = 'U'
  633. *
  634. K = N
  635. 160 CONTINUE
  636. IF( K.LE.1 )
  637. $ GO TO 170
  638. *
  639. IF( IWORK( K ).LT.ZERO ) THEN
  640. *
  641. * Get the two eigenvalues of a 2-by-2 block,
  642. * store them in WORK array
  643. *
  644. BLOCK( 1, 1 ) = AFAC( ( K-2 )*LDA+K-1 )
  645. BLOCK( 2, 1 ) = AFAC( ( K-2 )*LDA+K )
  646. BLOCK( 1, 2 ) = BLOCK( 2, 1 )
  647. BLOCK( 2, 2 ) = AFAC( (K-1)*LDA+K )
  648. *
  649. CALL ZGEEVX( 'N', 'N', 'N', 'N', 2, BLOCK,
  650. $ 2, WORK, ZDUMMY, 1, ZDUMMY, 1,
  651. $ ITEMP, ITEMP2, RWORK, DTEMP,
  652. $ RWORK( 3 ), RWORK( 5 ), WORK( 3 ),
  653. $ 4, RWORK( 7 ), INFO )
  654. *
  655. LAM_MAX = MAX( ABS( WORK( 1 ) ),
  656. $ ABS( WORK( 2 ) ) )
  657. LAM_MIN = MIN( ABS( WORK( 1 ) ),
  658. $ ABS( WORK( 2 ) ) )
  659. *
  660. DTEMP = LAM_MAX / LAM_MIN
  661. *
  662. * DTEMP should be bounded by CONST
  663. *
  664. DTEMP = ABS( DTEMP ) - CONST + THRESH
  665. IF( DTEMP.GT.RESULT( 4 ) )
  666. $ RESULT( 4 ) = DTEMP
  667. K = K - 1
  668. *
  669. END IF
  670. *
  671. K = K - 1
  672. *
  673. GO TO 160
  674. 170 CONTINUE
  675. *
  676. ELSE
  677. *
  678. * Loop forward for UPLO = 'L'
  679. *
  680. K = 1
  681. 180 CONTINUE
  682. IF( K.GE.N )
  683. $ GO TO 190
  684. *
  685. IF( IWORK( K ).LT.ZERO ) THEN
  686. *
  687. * Get the two eigenvalues of a 2-by-2 block,
  688. * store them in WORK array
  689. *
  690. BLOCK( 1, 1 ) = AFAC( ( K-1 )*LDA+K )
  691. BLOCK( 2, 1 ) = AFAC( ( K-1 )*LDA+K+1 )
  692. BLOCK( 1, 2 ) = BLOCK( 2, 1 )
  693. BLOCK( 2, 2 ) = AFAC( K*LDA+K+1 )
  694. *
  695. CALL ZGEEVX( 'N', 'N', 'N', 'N', 2, BLOCK,
  696. $ 2, WORK, ZDUMMY, 1, ZDUMMY, 1,
  697. $ ITEMP, ITEMP2, RWORK, DTEMP,
  698. $ RWORK( 3 ), RWORK( 5 ), WORK( 3 ),
  699. $ 4, RWORK( 7 ), INFO )
  700. *
  701. LAM_MAX = MAX( ABS( WORK( 1 ) ),
  702. $ ABS( WORK( 2 ) ) )
  703. LAM_MIN = MIN( ABS( WORK( 1 ) ),
  704. $ ABS( WORK( 2 ) ) )
  705. *
  706. DTEMP = LAM_MAX / LAM_MIN
  707. *
  708. * DTEMP should be bounded by CONST
  709. *
  710. DTEMP = ABS( DTEMP ) - CONST + THRESH
  711. IF( DTEMP.GT.RESULT( 4 ) )
  712. $ RESULT( 4 ) = DTEMP
  713. K = K + 1
  714. *
  715. END IF
  716. *
  717. K = K + 1
  718. *
  719. GO TO 180
  720. 190 CONTINUE
  721. END IF
  722. *
  723. * Print information about the tests that did not pass
  724. * the threshold.
  725. *
  726. DO 200 K = 3, 4
  727. IF( RESULT( K ).GE.THRESH ) THEN
  728. IF( NFAIL.EQ.0 .AND. NERRS.EQ.0 )
  729. $ CALL ALAHD( NOUT, PATH )
  730. WRITE( NOUT, FMT = 9999 )UPLO, N, NB, IMAT, K,
  731. $ RESULT( K )
  732. NFAIL = NFAIL + 1
  733. END IF
  734. 200 CONTINUE
  735. NRUN = NRUN + 2
  736. *
  737. * Skip the other tests if this is not the first block
  738. * size.
  739. *
  740. IF( INB.GT.1 )
  741. $ GO TO 240
  742. *
  743. * Do only the condition estimate if INFO is not 0.
  744. *
  745. IF( TRFCON ) THEN
  746. RCONDC = ZERO
  747. GO TO 230
  748. END IF
  749. *
  750. * Do for each value of NRHS in NSVAL.
  751. *
  752. DO 220 IRHS = 1, NNS
  753. NRHS = NSVAL( IRHS )
  754. *
  755. *+ TEST 5 ( Using TRS_ROOK)
  756. * Solve and compute residual for A * X = B.
  757. *
  758. * Choose a set of NRHS random solution vectors
  759. * stored in XACT and set up the right hand side B
  760. *
  761. SRNAMT = 'ZLARHS'
  762. CALL ZLARHS( MATPATH, XTYPE, UPLO, ' ', N, N,
  763. $ KL, KU, NRHS, A, LDA, XACT, LDA,
  764. $ B, LDA, ISEED, INFO )
  765. CALL ZLACPY( 'Full', N, NRHS, B, LDA, X, LDA )
  766. *
  767. SRNAMT = 'ZSYTRS_ROOK'
  768. CALL ZSYTRS_ROOK( UPLO, N, NRHS, AFAC, LDA, IWORK,
  769. $ X, LDA, INFO )
  770. *
  771. * Check error code from ZSYTRS_ROOK and handle error.
  772. *
  773. IF( INFO.NE.0 )
  774. $ CALL ALAERH( PATH, 'ZSYTRS_ROOK', INFO, 0,
  775. $ UPLO, N, N, -1, -1, NRHS, IMAT,
  776. $ NFAIL, NERRS, NOUT )
  777. *
  778. CALL ZLACPY( 'Full', N, NRHS, B, LDA, WORK, LDA )
  779. *
  780. * Compute the residual for the solution
  781. *
  782. CALL ZSYT02( UPLO, N, NRHS, A, LDA, X, LDA, WORK,
  783. $ LDA, RWORK, RESULT( 5 ) )
  784. *
  785. *+ TEST 6
  786. * Check solution from generated exact solution.
  787. *
  788. CALL ZGET04( N, NRHS, X, LDA, XACT, LDA, RCONDC,
  789. $ RESULT( 6 ) )
  790. *
  791. * Print information about the tests that did not pass
  792. * the threshold.
  793. *
  794. DO 210 K = 5, 6
  795. IF( RESULT( K ).GE.THRESH ) THEN
  796. IF( NFAIL.EQ.0 .AND. NERRS.EQ.0 )
  797. $ CALL ALAHD( NOUT, PATH )
  798. WRITE( NOUT, FMT = 9998 )UPLO, N, NRHS,
  799. $ IMAT, K, RESULT( K )
  800. NFAIL = NFAIL + 1
  801. END IF
  802. 210 CONTINUE
  803. NRUN = NRUN + 2
  804. *
  805. * End do for each value of NRHS in NSVAL.
  806. *
  807. 220 CONTINUE
  808. *
  809. *+ TEST 7
  810. * Get an estimate of RCOND = 1/CNDNUM.
  811. *
  812. 230 CONTINUE
  813. ANORM = ZLANSY( '1', UPLO, N, A, LDA, RWORK )
  814. SRNAMT = 'ZSYCON_ROOK'
  815. CALL ZSYCON_ROOK( UPLO, N, AFAC, LDA, IWORK, ANORM,
  816. $ RCOND, WORK, INFO )
  817. *
  818. * Check error code from ZSYCON_ROOK and handle error.
  819. *
  820. IF( INFO.NE.0 )
  821. $ CALL ALAERH( PATH, 'ZSYCON_ROOK', INFO, 0,
  822. $ UPLO, N, N, -1, -1, -1, IMAT,
  823. $ NFAIL, NERRS, NOUT )
  824. *
  825. * Compute the test ratio to compare values of RCOND
  826. *
  827. RESULT( 7 ) = DGET06( RCOND, RCONDC )
  828. *
  829. * Print information about the tests that did not pass
  830. * the threshold.
  831. *
  832. IF( RESULT( 7 ).GE.THRESH ) THEN
  833. IF( NFAIL.EQ.0 .AND. NERRS.EQ.0 )
  834. $ CALL ALAHD( NOUT, PATH )
  835. WRITE( NOUT, FMT = 9997 )UPLO, N, IMAT, 7,
  836. $ RESULT( 7 )
  837. NFAIL = NFAIL + 1
  838. END IF
  839. NRUN = NRUN + 1
  840. 240 CONTINUE
  841. *
  842. 250 CONTINUE
  843. 260 CONTINUE
  844. 270 CONTINUE
  845. *
  846. * Print a summary of the results.
  847. *
  848. CALL ALASUM( PATH, NOUT, NFAIL, NRUN, NERRS )
  849. *
  850. 9999 FORMAT( ' UPLO = ''', A1, ''', N =', I5, ', NB =', I4, ', type ',
  851. $ I2, ', test ', I2, ', ratio =', G12.5 )
  852. 9998 FORMAT( ' UPLO = ''', A1, ''', N =', I5, ', NRHS=', I3, ', type ',
  853. $ I2, ', test(', I2, ') =', G12.5 )
  854. 9997 FORMAT( ' UPLO = ''', A1, ''', N =', I5, ',', 10X, ' type ', I2,
  855. $ ', test(', I2, ') =', G12.5 )
  856. RETURN
  857. *
  858. * End of ZCHKSY_ROOK
  859. *
  860. END