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_rk.f 28 kB

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