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.

dchksy_rook.f 27 kB

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