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

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