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.

cchkhe.f 22 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682
  1. *> \brief \b CCHKHE
  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 CCHKHE( 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. * REAL THRESH
  19. * ..
  20. * .. Array Arguments ..
  21. * LOGICAL DOTYPE( * )
  22. * INTEGER IWORK( * ), NBVAL( * ), NSVAL( * ), NVAL( * )
  23. * REAL RWORK( * )
  24. * COMPLEX A( * ), AFAC( * ), AINV( * ), B( * ),
  25. * $ WORK( * ), X( * ), XACT( * )
  26. * ..
  27. *
  28. *
  29. *> \par Purpose:
  30. * =============
  31. *>
  32. *> \verbatim
  33. *>
  34. *> CCHKHE tests CHETRF, -TRI2, -TRS, -TRS2, -RFS, and -CON.
  35. *> \endverbatim
  36. *
  37. * Arguments:
  38. * ==========
  39. *
  40. *> \param[in] DOTYPE
  41. *> \verbatim
  42. *> DOTYPE is LOGICAL array, dimension (NTYPES)
  43. *> The matrix types to be used for testing. Matrices of type j
  44. *> (for 1 <= j <= NTYPES) are used for testing if DOTYPE(j) =
  45. *> .TRUE.; if DOTYPE(j) = .FALSE., then type j is not used.
  46. *> \endverbatim
  47. *>
  48. *> \param[in] NN
  49. *> \verbatim
  50. *> NN is INTEGER
  51. *> The number of values of N contained in the vector NVAL.
  52. *> \endverbatim
  53. *>
  54. *> \param[in] NVAL
  55. *> \verbatim
  56. *> NVAL is INTEGER array, dimension (NN)
  57. *> The values of the matrix dimension N.
  58. *> \endverbatim
  59. *>
  60. *> \param[in] NNB
  61. *> \verbatim
  62. *> NNB is INTEGER
  63. *> The number of values of NB contained in the vector NBVAL.
  64. *> \endverbatim
  65. *>
  66. *> \param[in] NBVAL
  67. *> \verbatim
  68. *> NBVAL is INTEGER array, dimension (NBVAL)
  69. *> The values of the blocksize NB.
  70. *> \endverbatim
  71. *>
  72. *> \param[in] NNS
  73. *> \verbatim
  74. *> NNS is INTEGER
  75. *> The number of values of NRHS contained in the vector NSVAL.
  76. *> \endverbatim
  77. *>
  78. *> \param[in] NSVAL
  79. *> \verbatim
  80. *> NSVAL is INTEGER array, dimension (NNS)
  81. *> The values of the number of right hand sides NRHS.
  82. *> \endverbatim
  83. *>
  84. *> \param[in] THRESH
  85. *> \verbatim
  86. *> THRESH is REAL
  87. *> The threshold value for the test ratios. A result is
  88. *> included in the output file if RESULT >= THRESH. To have
  89. *> every test ratio printed, use THRESH = 0.
  90. *> \endverbatim
  91. *>
  92. *> \param[in] TSTERR
  93. *> \verbatim
  94. *> TSTERR is LOGICAL
  95. *> Flag that indicates whether error exits are to be tested.
  96. *> \endverbatim
  97. *>
  98. *> \param[in] NMAX
  99. *> \verbatim
  100. *> NMAX is INTEGER
  101. *> The maximum value permitted for N, used in dimensioning the
  102. *> work arrays.
  103. *> \endverbatim
  104. *>
  105. *> \param[out] A
  106. *> \verbatim
  107. *> A is COMPLEX array, dimension (NMAX*NMAX)
  108. *> \endverbatim
  109. *>
  110. *> \param[out] AFAC
  111. *> \verbatim
  112. *> AFAC is COMPLEX array, dimension (NMAX*NMAX)
  113. *> \endverbatim
  114. *>
  115. *> \param[out] AINV
  116. *> \verbatim
  117. *> AINV is COMPLEX array, dimension (NMAX*NMAX)
  118. *> \endverbatim
  119. *>
  120. *> \param[out] B
  121. *> \verbatim
  122. *> B is COMPLEX array, dimension (NMAX*NSMAX)
  123. *> where NSMAX is the largest entry in NSVAL.
  124. *> \endverbatim
  125. *>
  126. *> \param[out] X
  127. *> \verbatim
  128. *> X is COMPLEX array, dimension (NMAX*NSMAX)
  129. *> \endverbatim
  130. *>
  131. *> \param[out] XACT
  132. *> \verbatim
  133. *> XACT is COMPLEX array, dimension (NMAX*NSMAX)
  134. *> \endverbatim
  135. *>
  136. *> \param[out] WORK
  137. *> \verbatim
  138. *> WORK is COMPLEX array, dimension (NMAX*max(3,NSMAX))
  139. *> \endverbatim
  140. *>
  141. *> \param[out] RWORK
  142. *> \verbatim
  143. *> RWORK is REAL array, dimension (max(NMAX,2*NSMAX))
  144. *> \endverbatim
  145. *>
  146. *> \param[out] IWORK
  147. *> \verbatim
  148. *> IWORK is INTEGER array, dimension (NMAX)
  149. *> \endverbatim
  150. *>
  151. *> \param[in] NOUT
  152. *> \verbatim
  153. *> NOUT is INTEGER
  154. *> The unit number for output.
  155. *> \endverbatim
  156. *
  157. * Authors:
  158. * ========
  159. *
  160. *> \author Univ. of Tennessee
  161. *> \author Univ. of California Berkeley
  162. *> \author Univ. of Colorado Denver
  163. *> \author NAG Ltd.
  164. *
  165. *> \date November 2013
  166. *
  167. *> \ingroup complex_lin
  168. *
  169. * =====================================================================
  170. SUBROUTINE CCHKHE( DOTYPE, NN, NVAL, NNB, NBVAL, NNS, NSVAL,
  171. $ THRESH, TSTERR, NMAX, A, AFAC, AINV, B, X,
  172. $ XACT, WORK, RWORK, IWORK, NOUT )
  173. *
  174. * -- LAPACK test routine (version 3.5.0) --
  175. * -- LAPACK is a software package provided by Univ. of Tennessee, --
  176. * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  177. * November 2013
  178. *
  179. * .. Scalar Arguments ..
  180. LOGICAL TSTERR
  181. INTEGER NMAX, NN, NNB, NNS, NOUT
  182. REAL THRESH
  183. * ..
  184. * .. Array Arguments ..
  185. LOGICAL DOTYPE( * )
  186. INTEGER IWORK( * ), NBVAL( * ), NSVAL( * ), NVAL( * )
  187. REAL RWORK( * )
  188. COMPLEX A( * ), AFAC( * ), AINV( * ), B( * ),
  189. $ WORK( * ), X( * ), XACT( * )
  190. * ..
  191. *
  192. * =====================================================================
  193. *
  194. * .. Parameters ..
  195. REAL ZERO
  196. PARAMETER ( ZERO = 0.0E+0 )
  197. COMPLEX CZERO
  198. PARAMETER ( CZERO = ( 0.0E+0, 0.0E+0 ) )
  199. INTEGER NTYPES
  200. PARAMETER ( NTYPES = 10 )
  201. INTEGER NTESTS
  202. PARAMETER ( NTESTS = 9 )
  203. * ..
  204. * .. Local Scalars ..
  205. LOGICAL TRFCON, ZEROT
  206. CHARACTER DIST, TYPE, UPLO, XTYPE
  207. CHARACTER*3 PATH
  208. INTEGER I, I1, I2, IMAT, IN, INB, INFO, IOFF, IRHS,
  209. $ IUPLO, IZERO, J, K, KL, KU, LDA, LWORK, MODE,
  210. $ N, NB, NERRS, NFAIL, NIMAT, NRHS, NRUN, NT
  211. REAL ANORM, CNDNUM, RCOND, RCONDC
  212. * ..
  213. * .. Local Arrays ..
  214. CHARACTER UPLOS( 2 )
  215. INTEGER ISEED( 4 ), ISEEDY( 4 )
  216. REAL RESULT( NTESTS )
  217. * ..
  218. * .. External Functions ..
  219. REAL CLANHE, SGET06
  220. EXTERNAL CLANHE, SGET06
  221. * ..
  222. * .. External Subroutines ..
  223. EXTERNAL ALAERH, ALAHD, ALASUM, CERRHE, CGET04, CHECON,
  224. $ CHERFS, CHET01, CHETRF, CHETRI2, CHETRS,
  225. $ CLACPY, CLAIPD, CLARHS, CLATB4, CLATMS, CPOT02,
  226. $ CPOT03, CPOT05, XLAENV
  227. * ..
  228. * .. Intrinsic Functions ..
  229. INTRINSIC MAX, MIN
  230. * ..
  231. * .. Scalars in Common ..
  232. LOGICAL LERR, OK
  233. CHARACTER*32 SRNAMT
  234. INTEGER INFOT, NUNIT
  235. * ..
  236. * .. Common blocks ..
  237. COMMON / INFOC / INFOT, NUNIT, OK, LERR
  238. COMMON / SRNAMC / SRNAMT
  239. * ..
  240. * .. Data statements ..
  241. DATA ISEEDY / 1988, 1989, 1990, 1991 /
  242. DATA UPLOS / 'U', 'L' /
  243. * ..
  244. * .. Executable Statements ..
  245. *
  246. * Initialize constants and the random number seed.
  247. *
  248. PATH( 1: 1 ) = 'Complex precision'
  249. PATH( 2: 3 ) = 'HE'
  250. NRUN = 0
  251. NFAIL = 0
  252. NERRS = 0
  253. DO 10 I = 1, 4
  254. ISEED( I ) = ISEEDY( I )
  255. 10 CONTINUE
  256. *
  257. * Test the error exits
  258. *
  259. IF( TSTERR )
  260. $ CALL CERRHE( PATH, NOUT )
  261. INFOT = 0
  262. *
  263. * Set the minimum block size for which the block routine should
  264. * be used, which will be later returned by ILAENV
  265. *
  266. CALL XLAENV( 2, 2 )
  267. *
  268. * Do for each value of N in NVAL
  269. *
  270. DO 180 IN = 1, NN
  271. N = NVAL( IN )
  272. LDA = MAX( N, 1 )
  273. XTYPE = 'N'
  274. NIMAT = NTYPES
  275. IF( N.LE.0 )
  276. $ NIMAT = 1
  277. *
  278. IZERO = 0
  279. *
  280. * Do for each value of matrix type IMAT
  281. *
  282. DO 170 IMAT = 1, NIMAT
  283. *
  284. * Do the tests only if DOTYPE( IMAT ) is true.
  285. *
  286. IF( .NOT.DOTYPE( IMAT ) )
  287. $ GO TO 170
  288. *
  289. * Skip types 3, 4, 5, or 6 if the matrix size is too small.
  290. *
  291. ZEROT = IMAT.GE.3 .AND. IMAT.LE.6
  292. IF( ZEROT .AND. N.LT.IMAT-2 )
  293. $ GO TO 170
  294. *
  295. * Do first for UPLO = 'U', then for UPLO = 'L'
  296. *
  297. DO 160 IUPLO = 1, 2
  298. UPLO = UPLOS( IUPLO )
  299. *
  300. * Begin generate test matrix A.
  301. *
  302. *
  303. * Set up parameters with CLATB4 for the matrix generator
  304. * based on the type of matrix to be generated.
  305. *
  306. CALL CLATB4( PATH, IMAT, N, N, TYPE, KL, KU, ANORM, MODE,
  307. $ CNDNUM, DIST )
  308. *
  309. * Generate a matrix with CLATMS.
  310. *
  311. SRNAMT = 'CLATMS'
  312. CALL CLATMS( N, N, DIST, ISEED, TYPE, RWORK, MODE,
  313. $ CNDNUM, ANORM, KL, KU, UPLO, A, LDA, WORK,
  314. $ INFO )
  315. *
  316. * Check error code from CLATMS and handle error.
  317. *
  318. IF( INFO.NE.0 ) THEN
  319. CALL ALAERH( PATH, 'CLATMS', INFO, 0, UPLO, N, N, -1,
  320. $ -1, -1, IMAT, NFAIL, NERRS, NOUT )
  321. *
  322. * Skip all tests for this generated matrix
  323. *
  324. GO TO 160
  325. END IF
  326. *
  327. * For matrix types 3-6, zero one or more rows and
  328. * columns of the matrix to test that INFO is returned
  329. * correctly.
  330. *
  331. IF( ZEROT ) THEN
  332. IF( IMAT.EQ.3 ) THEN
  333. IZERO = 1
  334. ELSE IF( IMAT.EQ.4 ) THEN
  335. IZERO = N
  336. ELSE
  337. IZERO = N / 2 + 1
  338. END IF
  339. *
  340. IF( IMAT.LT.6 ) THEN
  341. *
  342. * Set row and column IZERO to zero.
  343. *
  344. IF( IUPLO.EQ.1 ) THEN
  345. IOFF = ( IZERO-1 )*LDA
  346. DO 20 I = 1, IZERO - 1
  347. A( IOFF+I ) = CZERO
  348. 20 CONTINUE
  349. IOFF = IOFF + IZERO
  350. DO 30 I = IZERO, N
  351. A( IOFF ) = CZERO
  352. IOFF = IOFF + LDA
  353. 30 CONTINUE
  354. ELSE
  355. IOFF = IZERO
  356. DO 40 I = 1, IZERO - 1
  357. A( IOFF ) = CZERO
  358. IOFF = IOFF + LDA
  359. 40 CONTINUE
  360. IOFF = IOFF - IZERO
  361. DO 50 I = IZERO, N
  362. A( IOFF+I ) = CZERO
  363. 50 CONTINUE
  364. END IF
  365. ELSE
  366. IF( IUPLO.EQ.1 ) THEN
  367. *
  368. * Set the first IZERO rows and columns to zero.
  369. *
  370. IOFF = 0
  371. DO 70 J = 1, N
  372. I2 = MIN( J, IZERO )
  373. DO 60 I = 1, I2
  374. A( IOFF+I ) = CZERO
  375. 60 CONTINUE
  376. IOFF = IOFF + LDA
  377. 70 CONTINUE
  378. ELSE
  379. *
  380. * Set the last IZERO rows and columns to zero.
  381. *
  382. IOFF = 0
  383. DO 90 J = 1, N
  384. I1 = MAX( J, IZERO )
  385. DO 80 I = I1, N
  386. A( IOFF+I ) = CZERO
  387. 80 CONTINUE
  388. IOFF = IOFF + LDA
  389. 90 CONTINUE
  390. END IF
  391. END IF
  392. ELSE
  393. IZERO = 0
  394. END IF
  395. *
  396. * Set the imaginary part of the diagonals.
  397. *
  398. CALL CLAIPD( N, A, LDA+1, 0 )
  399. *
  400. * End generate test matrix A.
  401. *
  402. *
  403. * Do for each value of NB in NBVAL
  404. *
  405. DO 150 INB = 1, NNB
  406. *
  407. * Set the optimal blocksize, which will be later
  408. * returned by ILAENV.
  409. *
  410. NB = NBVAL( INB )
  411. CALL XLAENV( 1, NB )
  412. *
  413. * Copy the test matrix A into matrix AFAC which
  414. * will be factorized in place. This is needed to
  415. * preserve the test matrix A for subsequent tests.
  416. *
  417. CALL CLACPY( UPLO, N, N, A, LDA, AFAC, LDA )
  418. *
  419. * Compute the L*D*L**T or U*D*U**T factorization of the
  420. * matrix. IWORK stores details of the interchanges and
  421. * the block structure of D. AINV is a work array for
  422. * block factorization, LWORK is the length of AINV.
  423. *
  424. LWORK = MAX( 2, NB )*LDA
  425. SRNAMT = 'CHETRF'
  426. CALL CHETRF( UPLO, N, AFAC, LDA, IWORK, AINV, LWORK,
  427. $ INFO )
  428. *
  429. * Adjust the expected value of INFO to account for
  430. * pivoting.
  431. *
  432. K = IZERO
  433. IF( K.GT.0 ) THEN
  434. 100 CONTINUE
  435. IF( IWORK( K ).LT.0 ) THEN
  436. IF( IWORK( K ).NE.-K ) THEN
  437. K = -IWORK( K )
  438. GO TO 100
  439. END IF
  440. ELSE IF( IWORK( K ).NE.K ) THEN
  441. K = IWORK( K )
  442. GO TO 100
  443. END IF
  444. END IF
  445. *
  446. * Check error code from CHETRF and handle error.
  447. *
  448. IF( INFO.NE.K )
  449. $ CALL ALAERH( PATH, 'CHETRF', INFO, K, UPLO, N, N,
  450. $ -1, -1, NB, IMAT, NFAIL, NERRS, NOUT )
  451. *
  452. * Set the condition estimate flag if the INFO is not 0.
  453. *
  454. IF( INFO.NE.0 ) THEN
  455. TRFCON = .TRUE.
  456. ELSE
  457. TRFCON = .FALSE.
  458. END IF
  459. *
  460. *+ TEST 1
  461. * Reconstruct matrix from factors and compute residual.
  462. *
  463. CALL CHET01( UPLO, N, A, LDA, AFAC, LDA, IWORK, AINV,
  464. $ LDA, RWORK, RESULT( 1 ) )
  465. NT = 1
  466. *
  467. *+ TEST 2
  468. * Form the inverse and compute the residual,
  469. * if the factorization was competed without INFO > 0
  470. * (i.e. there is no zero rows and columns).
  471. * Do it only for the first block size.
  472. *
  473. IF( INB.EQ.1 .AND. .NOT.TRFCON ) THEN
  474. CALL CLACPY( UPLO, N, N, AFAC, LDA, AINV, LDA )
  475. SRNAMT = 'CHETRI2'
  476. LWORK = (N+NB+1)*(NB+3)
  477. CALL CHETRI2( UPLO, N, AINV, LDA, IWORK, WORK,
  478. $ LWORK, INFO )
  479. *
  480. * Check error code from CHETRI2 and handle error.
  481. *
  482. IF( INFO.NE.0 )
  483. $ CALL ALAERH( PATH, 'CHETRI2', INFO, -1, UPLO, N,
  484. $ N, -1, -1, -1, IMAT, NFAIL, NERRS,
  485. $ NOUT )
  486. *
  487. * Compute the residual for a symmetric matrix times
  488. * its inverse.
  489. *
  490. CALL CPOT03( UPLO, N, A, LDA, AINV, LDA, WORK, LDA,
  491. $ RWORK, RCONDC, RESULT( 2 ) )
  492. NT = 2
  493. END IF
  494. *
  495. * Print information about the tests that did not pass
  496. * the threshold.
  497. *
  498. DO 110 K = 1, NT
  499. IF( RESULT( K ).GE.THRESH ) THEN
  500. IF( NFAIL.EQ.0 .AND. NERRS.EQ.0 )
  501. $ CALL ALAHD( NOUT, PATH )
  502. WRITE( NOUT, FMT = 9999 )UPLO, N, NB, IMAT, K,
  503. $ RESULT( K )
  504. NFAIL = NFAIL + 1
  505. END IF
  506. 110 CONTINUE
  507. NRUN = NRUN + NT
  508. *
  509. * Skip the other tests if this is not the first block
  510. * size.
  511. *
  512. IF( INB.GT.1 )
  513. $ GO TO 150
  514. *
  515. * Do only the condition estimate if INFO is not 0.
  516. *
  517. IF( TRFCON ) THEN
  518. RCONDC = ZERO
  519. GO TO 140
  520. END IF
  521. *
  522. * Do for each value of NRHS in NSVAL.
  523. *
  524. DO 130 IRHS = 1, NNS
  525. NRHS = NSVAL( IRHS )
  526. *
  527. *+ TEST 3 (Using TRS)
  528. * Solve and compute residual for A * X = B.
  529. *
  530. * Choose a set of NRHS random solution vectors
  531. * stored in XACT and set up the right hand side B
  532. *
  533. SRNAMT = 'CLARHS'
  534. CALL CLARHS( PATH, XTYPE, UPLO, ' ', N, N, KL, KU,
  535. $ NRHS, A, LDA, XACT, LDA, B, LDA,
  536. $ ISEED, INFO )
  537. CALL CLACPY( 'Full', N, NRHS, B, LDA, X, LDA )
  538. *
  539. SRNAMT = 'CHETRS'
  540. CALL CHETRS( UPLO, N, NRHS, AFAC, LDA, IWORK, X,
  541. $ LDA, INFO )
  542. *
  543. * Check error code from CHETRS and handle error.
  544. *
  545. IF( INFO.NE.0 )
  546. $ CALL ALAERH( PATH, 'CHETRS', INFO, 0, UPLO, N,
  547. $ N, -1, -1, NRHS, IMAT, NFAIL,
  548. $ NERRS, NOUT )
  549. *
  550. CALL CLACPY( 'Full', N, NRHS, B, LDA, WORK, LDA )
  551. *
  552. * Compute the residual for the solution
  553. *
  554. CALL CPOT02( UPLO, N, NRHS, A, LDA, X, LDA, WORK,
  555. $ LDA, RWORK, RESULT( 3 ) )
  556. *
  557. *+ TEST 4 (Using TRS2)
  558. * Solve and compute residual for A * X = B.
  559. *
  560. * Choose a set of NRHS random solution vectors
  561. * stored in XACT and set up the right hand side B
  562. *
  563. SRNAMT = 'CLARHS'
  564. CALL CLARHS( PATH, XTYPE, UPLO, ' ', N, N, KL, KU,
  565. $ NRHS, A, LDA, XACT, LDA, B, LDA,
  566. $ ISEED, INFO )
  567. CALL CLACPY( 'Full', N, NRHS, B, LDA, X, LDA )
  568. *
  569. SRNAMT = 'CHETRS2'
  570. CALL CHETRS2( UPLO, N, NRHS, AFAC, LDA, IWORK, X,
  571. $ LDA, WORK, INFO )
  572. *
  573. * Check error code from CHETRS2 and handle error.
  574. *
  575. IF( INFO.NE.0 )
  576. $ CALL ALAERH( PATH, 'CHETRS2', INFO, 0, UPLO, N,
  577. $ N, -1, -1, NRHS, IMAT, NFAIL,
  578. $ NERRS, NOUT )
  579. *
  580. CALL CLACPY( 'Full', N, NRHS, B, LDA, WORK, LDA )
  581. *
  582. * Compute the residual for the solution
  583. *
  584. CALL CPOT02( UPLO, N, NRHS, A, LDA, X, LDA, WORK,
  585. $ LDA, RWORK, RESULT( 4 ) )
  586. *
  587. *+ TEST 5
  588. * Check solution from generated exact solution.
  589. *
  590. CALL CGET04( N, NRHS, X, LDA, XACT, LDA, RCONDC,
  591. $ RESULT( 5 ) )
  592. *
  593. *+ TESTS 6, 7, and 8
  594. * Use iterative refinement to improve the solution.
  595. *
  596. SRNAMT = 'CHERFS'
  597. CALL CHERFS( UPLO, N, NRHS, A, LDA, AFAC, LDA,
  598. $ IWORK, B, LDA, X, LDA, RWORK,
  599. $ RWORK( NRHS+1 ), WORK,
  600. $ RWORK( 2*NRHS+1 ), INFO )
  601. *
  602. * Check error code from CHERFS and handle error.
  603. *
  604. IF( INFO.NE.0 )
  605. $ CALL ALAERH( PATH, 'CHERFS', INFO, 0, UPLO, N,
  606. $ N, -1, -1, NRHS, IMAT, NFAIL,
  607. $ NERRS, NOUT )
  608. *
  609. CALL CGET04( N, NRHS, X, LDA, XACT, LDA, RCONDC,
  610. $ RESULT( 6 ) )
  611. CALL CPOT05( UPLO, N, NRHS, A, LDA, B, LDA, X, LDA,
  612. $ XACT, LDA, RWORK, RWORK( NRHS+1 ),
  613. $ RESULT( 7 ) )
  614. *
  615. * Print information about the tests that did not pass
  616. * the threshold.
  617. *
  618. DO 120 K = 3, 8
  619. IF( RESULT( K ).GE.THRESH ) THEN
  620. IF( NFAIL.EQ.0 .AND. NERRS.EQ.0 )
  621. $ CALL ALAHD( NOUT, PATH )
  622. WRITE( NOUT, FMT = 9998 )UPLO, N, NRHS,
  623. $ IMAT, K, RESULT( K )
  624. NFAIL = NFAIL + 1
  625. END IF
  626. 120 CONTINUE
  627. NRUN = NRUN + 6
  628. *
  629. * End do for each value of NRHS in NSVAL.
  630. *
  631. 130 CONTINUE
  632. *
  633. *+ TEST 9
  634. * Get an estimate of RCOND = 1/CNDNUM.
  635. *
  636. 140 CONTINUE
  637. ANORM = CLANHE( '1', UPLO, N, A, LDA, RWORK )
  638. SRNAMT = 'CHECON'
  639. CALL CHECON( UPLO, N, AFAC, LDA, IWORK, ANORM, RCOND,
  640. $ WORK, INFO )
  641. *
  642. * Check error code from CHECON and handle error.
  643. *
  644. IF( INFO.NE.0 )
  645. $ CALL ALAERH( PATH, 'CHECON', INFO, 0, UPLO, N, N,
  646. $ -1, -1, -1, IMAT, NFAIL, NERRS, NOUT )
  647. *
  648. * Compute the test ratio to compare values of RCOND
  649. *
  650. RESULT( 9 ) = SGET06( RCOND, RCONDC )
  651. *
  652. * Print information about the tests that did not pass
  653. * the threshold.
  654. *
  655. IF( RESULT( 9 ).GE.THRESH ) THEN
  656. IF( NFAIL.EQ.0 .AND. NERRS.EQ.0 )
  657. $ CALL ALAHD( NOUT, PATH )
  658. WRITE( NOUT, FMT = 9997 )UPLO, N, IMAT, 8,
  659. $ RESULT( 9 )
  660. NFAIL = NFAIL + 1
  661. END IF
  662. NRUN = NRUN + 1
  663. 150 CONTINUE
  664. 160 CONTINUE
  665. 170 CONTINUE
  666. 180 CONTINUE
  667. *
  668. * Print a summary of the results.
  669. *
  670. CALL ALASUM( PATH, NOUT, NFAIL, NRUN, NERRS )
  671. *
  672. 9999 FORMAT( ' UPLO = ''', A1, ''', N =', I5, ', NB =', I4, ', type ',
  673. $ I2, ', test ', I2, ', ratio =', G12.5 )
  674. 9998 FORMAT( ' UPLO = ''', A1, ''', N =', I5, ', NRHS=', I3, ', type ',
  675. $ I2, ', test(', I2, ') =', G12.5 )
  676. 9997 FORMAT( ' UPLO = ''', A1, ''', N =', I5, ',', 10X, ' type ', I2,
  677. $ ', test(', I2, ') =', G12.5 )
  678. RETURN
  679. *
  680. * End of CCHKHE
  681. *
  682. END