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.

cchksy_rk.f 28 kB

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