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.

schksy_rook.f 27 kB

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