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.

dchkbd.f 53 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528
  1. *> \brief \b DCHKBD
  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 DCHKBD( NSIZES, MVAL, NVAL, NTYPES, DOTYPE, NRHS,
  12. * ISEED, THRESH, A, LDA, BD, BE, S1, S2, X, LDX,
  13. * Y, Z, Q, LDQ, PT, LDPT, U, VT, WORK, LWORK,
  14. * IWORK, NOUT, INFO )
  15. *
  16. * .. Scalar Arguments ..
  17. * INTEGER INFO, LDA, LDPT, LDQ, LDX, LWORK, NOUT, NRHS,
  18. * $ NSIZES, NTYPES
  19. * DOUBLE PRECISION THRESH
  20. * ..
  21. * .. Array Arguments ..
  22. * LOGICAL DOTYPE( * )
  23. * INTEGER ISEED( 4 ), IWORK( * ), MVAL( * ), NVAL( * )
  24. * DOUBLE PRECISION A( LDA, * ), BD( * ), BE( * ), PT( LDPT, * ),
  25. * $ Q( LDQ, * ), S1( * ), S2( * ), U( LDPT, * ),
  26. * $ VT( LDPT, * ), WORK( * ), X( LDX, * ),
  27. * $ Y( LDX, * ), Z( LDX, * )
  28. * ..
  29. *
  30. *
  31. *> \par Purpose:
  32. * =============
  33. *>
  34. *> \verbatim
  35. *>
  36. *> DCHKBD checks the singular value decomposition (SVD) routines.
  37. *>
  38. *> DGEBRD reduces a real general m by n matrix A to upper or lower
  39. *> bidiagonal form B by an orthogonal transformation: Q' * A * P = B
  40. *> (or A = Q * B * P'). The matrix B is upper bidiagonal if m >= n
  41. *> and lower bidiagonal if m < n.
  42. *>
  43. *> DORGBR generates the orthogonal matrices Q and P' from DGEBRD.
  44. *> Note that Q and P are not necessarily square.
  45. *>
  46. *> DBDSQR computes the singular value decomposition of the bidiagonal
  47. *> matrix B as B = U S V'. It is called three times to compute
  48. *> 1) B = U S1 V', where S1 is the diagonal matrix of singular
  49. *> values and the columns of the matrices U and V are the left
  50. *> and right singular vectors, respectively, of B.
  51. *> 2) Same as 1), but the singular values are stored in S2 and the
  52. *> singular vectors are not computed.
  53. *> 3) A = (UQ) S (P'V'), the SVD of the original matrix A.
  54. *> In addition, DBDSQR has an option to apply the left orthogonal matrix
  55. *> U to a matrix X, useful in least squares applications.
  56. *>
  57. *> DBDSDC computes the singular value decomposition of the bidiagonal
  58. *> matrix B as B = U S V' using divide-and-conquer. It is called twice
  59. *> to compute
  60. *> 1) B = U S1 V', where S1 is the diagonal matrix of singular
  61. *> values and the columns of the matrices U and V are the left
  62. *> and right singular vectors, respectively, of B.
  63. *> 2) Same as 1), but the singular values are stored in S2 and the
  64. *> singular vectors are not computed.
  65. *>
  66. *> DBDSVDX computes the singular value decomposition of the bidiagonal
  67. *> matrix B as B = U S V' using bisection and inverse iteration. It is
  68. *> called six times to compute
  69. *> 1) B = U S1 V', RANGE='A', where S1 is the diagonal matrix of singular
  70. *> values and the columns of the matrices U and V are the left
  71. *> and right singular vectors, respectively, of B.
  72. *> 2) Same as 1), but the singular values are stored in S2 and the
  73. *> singular vectors are not computed.
  74. *> 3) B = U S1 V', RANGE='I', with where S1 is the diagonal matrix of singular
  75. *> values and the columns of the matrices U and V are the left
  76. *> and right singular vectors, respectively, of B
  77. *> 4) Same as 3), but the singular values are stored in S2 and the
  78. *> singular vectors are not computed.
  79. *> 5) B = U S1 V', RANGE='V', with where S1 is the diagonal matrix of singular
  80. *> values and the columns of the matrices U and V are the left
  81. *> and right singular vectors, respectively, of B
  82. *> 6) Same as 5), but the singular values are stored in S2 and the
  83. *> singular vectors are not computed.
  84. *>
  85. *> For each pair of matrix dimensions (M,N) and each selected matrix
  86. *> type, an M by N matrix A and an M by NRHS matrix X are generated.
  87. *> The problem dimensions are as follows
  88. *> A: M x N
  89. *> Q: M x min(M,N) (but M x M if NRHS > 0)
  90. *> P: min(M,N) x N
  91. *> B: min(M,N) x min(M,N)
  92. *> U, V: min(M,N) x min(M,N)
  93. *> S1, S2 diagonal, order min(M,N)
  94. *> X: M x NRHS
  95. *>
  96. *> For each generated matrix, 14 tests are performed:
  97. *>
  98. *> Test DGEBRD and DORGBR
  99. *>
  100. *> (1) | A - Q B PT | / ( |A| max(M,N) ulp ), PT = P'
  101. *>
  102. *> (2) | I - Q' Q | / ( M ulp )
  103. *>
  104. *> (3) | I - PT PT' | / ( N ulp )
  105. *>
  106. *> Test DBDSQR on bidiagonal matrix B
  107. *>
  108. *> (4) | B - U S1 VT | / ( |B| min(M,N) ulp ), VT = V'
  109. *>
  110. *> (5) | Y - U Z | / ( |Y| max(min(M,N),k) ulp ), where Y = Q' X
  111. *> and Z = U' Y.
  112. *> (6) | I - U' U | / ( min(M,N) ulp )
  113. *>
  114. *> (7) | I - VT VT' | / ( min(M,N) ulp )
  115. *>
  116. *> (8) S1 contains min(M,N) nonnegative values in decreasing order.
  117. *> (Return 0 if true, 1/ULP if false.)
  118. *>
  119. *> (9) | S1 - S2 | / ( |S1| ulp ), where S2 is computed without
  120. *> computing U and V.
  121. *>
  122. *> (10) 0 if the true singular values of B are within THRESH of
  123. *> those in S1. 2*THRESH if they are not. (Tested using
  124. *> DSVDCH)
  125. *>
  126. *> Test DBDSQR on matrix A
  127. *>
  128. *> (11) | A - (QU) S (VT PT) | / ( |A| max(M,N) ulp )
  129. *>
  130. *> (12) | X - (QU) Z | / ( |X| max(M,k) ulp )
  131. *>
  132. *> (13) | I - (QU)'(QU) | / ( M ulp )
  133. *>
  134. *> (14) | I - (VT PT) (PT'VT') | / ( N ulp )
  135. *>
  136. *> Test DBDSDC on bidiagonal matrix B
  137. *>
  138. *> (15) | B - U S1 VT | / ( |B| min(M,N) ulp ), VT = V'
  139. *>
  140. *> (16) | I - U' U | / ( min(M,N) ulp )
  141. *>
  142. *> (17) | I - VT VT' | / ( min(M,N) ulp )
  143. *>
  144. *> (18) S1 contains min(M,N) nonnegative values in decreasing order.
  145. *> (Return 0 if true, 1/ULP if false.)
  146. *>
  147. *> (19) | S1 - S2 | / ( |S1| ulp ), where S2 is computed without
  148. *> computing U and V.
  149. *> Test DBDSVDX on bidiagonal matrix B
  150. *>
  151. *> (20) | B - U S1 VT | / ( |B| min(M,N) ulp ), VT = V'
  152. *>
  153. *> (21) | I - U' U | / ( min(M,N) ulp )
  154. *>
  155. *> (22) | I - VT VT' | / ( min(M,N) ulp )
  156. *>
  157. *> (23) S1 contains min(M,N) nonnegative values in decreasing order.
  158. *> (Return 0 if true, 1/ULP if false.)
  159. *>
  160. *> (24) | S1 - S2 | / ( |S1| ulp ), where S2 is computed without
  161. *> computing U and V.
  162. *>
  163. *> (25) | S1 - U' B VT' | / ( |S| n ulp ) DBDSVDX('V', 'I')
  164. *>
  165. *> (26) | I - U' U | / ( min(M,N) ulp )
  166. *>
  167. *> (27) | I - VT VT' | / ( min(M,N) ulp )
  168. *>
  169. *> (28) S1 contains min(M,N) nonnegative values in decreasing order.
  170. *> (Return 0 if true, 1/ULP if false.)
  171. *>
  172. *> (29) | S1 - S2 | / ( |S1| ulp ), where S2 is computed without
  173. *> computing U and V.
  174. *>
  175. *> (30) | S1 - U' B VT' | / ( |S1| n ulp ) DBDSVDX('V', 'V')
  176. *>
  177. *> (31) | I - U' U | / ( min(M,N) ulp )
  178. *>
  179. *> (32) | I - VT VT' | / ( min(M,N) ulp )
  180. *>
  181. *> (33) S1 contains min(M,N) nonnegative values in decreasing order.
  182. *> (Return 0 if true, 1/ULP if false.)
  183. *>
  184. *> (34) | S1 - S2 | / ( |S1| ulp ), where S2 is computed without
  185. *> computing U and V.
  186. *>
  187. *> The possible matrix types are
  188. *>
  189. *> (1) The zero matrix.
  190. *> (2) The identity matrix.
  191. *>
  192. *> (3) A diagonal matrix with evenly spaced entries
  193. *> 1, ..., ULP and random signs.
  194. *> (ULP = (first number larger than 1) - 1 )
  195. *> (4) A diagonal matrix with geometrically spaced entries
  196. *> 1, ..., ULP and random signs.
  197. *> (5) A diagonal matrix with "clustered" entries 1, ULP, ..., ULP
  198. *> and random signs.
  199. *>
  200. *> (6) Same as (3), but multiplied by SQRT( overflow threshold )
  201. *> (7) Same as (3), but multiplied by SQRT( underflow threshold )
  202. *>
  203. *> (8) A matrix of the form U D V, where U and V are orthogonal and
  204. *> D has evenly spaced entries 1, ..., ULP with random signs
  205. *> on the diagonal.
  206. *>
  207. *> (9) A matrix of the form U D V, where U and V are orthogonal and
  208. *> D has geometrically spaced entries 1, ..., ULP with random
  209. *> signs on the diagonal.
  210. *>
  211. *> (10) A matrix of the form U D V, where U and V are orthogonal and
  212. *> D has "clustered" entries 1, ULP,..., ULP with random
  213. *> signs on the diagonal.
  214. *>
  215. *> (11) Same as (8), but multiplied by SQRT( overflow threshold )
  216. *> (12) Same as (8), but multiplied by SQRT( underflow threshold )
  217. *>
  218. *> (13) Rectangular matrix with random entries chosen from (-1,1).
  219. *> (14) Same as (13), but multiplied by SQRT( overflow threshold )
  220. *> (15) Same as (13), but multiplied by SQRT( underflow threshold )
  221. *>
  222. *> Special case:
  223. *> (16) A bidiagonal matrix with random entries chosen from a
  224. *> logarithmic distribution on [ulp^2,ulp^(-2)] (I.e., each
  225. *> entry is e^x, where x is chosen uniformly on
  226. *> [ 2 log(ulp), -2 log(ulp) ] .) For *this* type:
  227. *> (a) DGEBRD is not called to reduce it to bidiagonal form.
  228. *> (b) the bidiagonal is min(M,N) x min(M,N); if M<N, the
  229. *> matrix will be lower bidiagonal, otherwise upper.
  230. *> (c) only tests 5--8 and 14 are performed.
  231. *>
  232. *> A subset of the full set of matrix types may be selected through
  233. *> the logical array DOTYPE.
  234. *> \endverbatim
  235. *
  236. * Arguments:
  237. * ==========
  238. *
  239. *> \param[in] NSIZES
  240. *> \verbatim
  241. *> NSIZES is INTEGER
  242. *> The number of values of M and N contained in the vectors
  243. *> MVAL and NVAL. The matrix sizes are used in pairs (M,N).
  244. *> \endverbatim
  245. *>
  246. *> \param[in] MVAL
  247. *> \verbatim
  248. *> MVAL is INTEGER array, dimension (NM)
  249. *> The values of the matrix row dimension M.
  250. *> \endverbatim
  251. *>
  252. *> \param[in] NVAL
  253. *> \verbatim
  254. *> NVAL is INTEGER array, dimension (NM)
  255. *> The values of the matrix column dimension N.
  256. *> \endverbatim
  257. *>
  258. *> \param[in] NTYPES
  259. *> \verbatim
  260. *> NTYPES is INTEGER
  261. *> The number of elements in DOTYPE. If it is zero, DCHKBD
  262. *> does nothing. It must be at least zero. If it is MAXTYP+1
  263. *> and NSIZES is 1, then an additional type, MAXTYP+1 is
  264. *> defined, which is to use whatever matrices are in A and B.
  265. *> This is only useful if DOTYPE(1:MAXTYP) is .FALSE. and
  266. *> DOTYPE(MAXTYP+1) is .TRUE. .
  267. *> \endverbatim
  268. *>
  269. *> \param[in] DOTYPE
  270. *> \verbatim
  271. *> DOTYPE is LOGICAL array, dimension (NTYPES)
  272. *> If DOTYPE(j) is .TRUE., then for each size (m,n), a matrix
  273. *> of type j will be generated. If NTYPES is smaller than the
  274. *> maximum number of types defined (PARAMETER MAXTYP), then
  275. *> types NTYPES+1 through MAXTYP will not be generated. If
  276. *> NTYPES is larger than MAXTYP, DOTYPE(MAXTYP+1) through
  277. *> DOTYPE(NTYPES) will be ignored.
  278. *> \endverbatim
  279. *>
  280. *> \param[in] NRHS
  281. *> \verbatim
  282. *> NRHS is INTEGER
  283. *> The number of columns in the "right-hand side" matrices X, Y,
  284. *> and Z, used in testing DBDSQR. If NRHS = 0, then the
  285. *> operations on the right-hand side will not be tested.
  286. *> NRHS must be at least 0.
  287. *> \endverbatim
  288. *>
  289. *> \param[in,out] ISEED
  290. *> \verbatim
  291. *> ISEED is INTEGER array, dimension (4)
  292. *> On entry ISEED specifies the seed of the random number
  293. *> generator. The array elements should be between 0 and 4095;
  294. *> if not they will be reduced mod 4096. Also, ISEED(4) must
  295. *> be odd. The values of ISEED are changed on exit, and can be
  296. *> used in the next call to DCHKBD to continue the same random
  297. *> number sequence.
  298. *> \endverbatim
  299. *>
  300. *> \param[in] THRESH
  301. *> \verbatim
  302. *> THRESH is DOUBLE PRECISION
  303. *> The threshold value for the test ratios. A result is
  304. *> included in the output file if RESULT >= THRESH. To have
  305. *> every test ratio printed, use THRESH = 0. Note that the
  306. *> expected value of the test ratios is O(1), so THRESH should
  307. *> be a reasonably small multiple of 1, e.g., 10 or 100.
  308. *> \endverbatim
  309. *>
  310. *> \param[out] A
  311. *> \verbatim
  312. *> A is DOUBLE PRECISION array, dimension (LDA,NMAX)
  313. *> where NMAX is the maximum value of N in NVAL.
  314. *> \endverbatim
  315. *>
  316. *> \param[in] LDA
  317. *> \verbatim
  318. *> LDA is INTEGER
  319. *> The leading dimension of the array A. LDA >= max(1,MMAX),
  320. *> where MMAX is the maximum value of M in MVAL.
  321. *> \endverbatim
  322. *>
  323. *> \param[out] BD
  324. *> \verbatim
  325. *> BD is DOUBLE PRECISION array, dimension
  326. *> (max(min(MVAL(j),NVAL(j))))
  327. *> \endverbatim
  328. *>
  329. *> \param[out] BE
  330. *> \verbatim
  331. *> BE is DOUBLE PRECISION array, dimension
  332. *> (max(min(MVAL(j),NVAL(j))))
  333. *> \endverbatim
  334. *>
  335. *> \param[out] S1
  336. *> \verbatim
  337. *> S1 is DOUBLE PRECISION array, dimension
  338. *> (max(min(MVAL(j),NVAL(j))))
  339. *> \endverbatim
  340. *>
  341. *> \param[out] S2
  342. *> \verbatim
  343. *> S2 is DOUBLE PRECISION array, dimension
  344. *> (max(min(MVAL(j),NVAL(j))))
  345. *> \endverbatim
  346. *>
  347. *> \param[out] X
  348. *> \verbatim
  349. *> X is DOUBLE PRECISION array, dimension (LDX,NRHS)
  350. *> \endverbatim
  351. *>
  352. *> \param[in] LDX
  353. *> \verbatim
  354. *> LDX is INTEGER
  355. *> The leading dimension of the arrays X, Y, and Z.
  356. *> LDX >= max(1,MMAX)
  357. *> \endverbatim
  358. *>
  359. *> \param[out] Y
  360. *> \verbatim
  361. *> Y is DOUBLE PRECISION array, dimension (LDX,NRHS)
  362. *> \endverbatim
  363. *>
  364. *> \param[out] Z
  365. *> \verbatim
  366. *> Z is DOUBLE PRECISION array, dimension (LDX,NRHS)
  367. *> \endverbatim
  368. *>
  369. *> \param[out] Q
  370. *> \verbatim
  371. *> Q is DOUBLE PRECISION array, dimension (LDQ,MMAX)
  372. *> \endverbatim
  373. *>
  374. *> \param[in] LDQ
  375. *> \verbatim
  376. *> LDQ is INTEGER
  377. *> The leading dimension of the array Q. LDQ >= max(1,MMAX).
  378. *> \endverbatim
  379. *>
  380. *> \param[out] PT
  381. *> \verbatim
  382. *> PT is DOUBLE PRECISION array, dimension (LDPT,NMAX)
  383. *> \endverbatim
  384. *>
  385. *> \param[in] LDPT
  386. *> \verbatim
  387. *> LDPT is INTEGER
  388. *> The leading dimension of the arrays PT, U, and V.
  389. *> LDPT >= max(1, max(min(MVAL(j),NVAL(j)))).
  390. *> \endverbatim
  391. *>
  392. *> \param[out] U
  393. *> \verbatim
  394. *> U is DOUBLE PRECISION array, dimension
  395. *> (LDPT,max(min(MVAL(j),NVAL(j))))
  396. *> \endverbatim
  397. *>
  398. *> \param[out] VT
  399. *> \verbatim
  400. *> VT is DOUBLE PRECISION array, dimension
  401. *> (LDPT,max(min(MVAL(j),NVAL(j))))
  402. *> \endverbatim
  403. *>
  404. *> \param[out] WORK
  405. *> \verbatim
  406. *> WORK is DOUBLE PRECISION array, dimension (LWORK)
  407. *> \endverbatim
  408. *>
  409. *> \param[in] LWORK
  410. *> \verbatim
  411. *> LWORK is INTEGER
  412. *> The number of entries in WORK. This must be at least
  413. *> 3(M+N) and M(M + max(M,N,k) + 1) + N*min(M,N) for all
  414. *> pairs (M,N)=(MM(j),NN(j))
  415. *> \endverbatim
  416. *>
  417. *> \param[out] IWORK
  418. *> \verbatim
  419. *> IWORK is INTEGER array, dimension at least 8*min(M,N)
  420. *> \endverbatim
  421. *>
  422. *> \param[in] NOUT
  423. *> \verbatim
  424. *> NOUT is INTEGER
  425. *> The FORTRAN unit number for printing out error messages
  426. *> (e.g., if a routine returns IINFO not equal to 0.)
  427. *> \endverbatim
  428. *>
  429. *> \param[out] INFO
  430. *> \verbatim
  431. *> INFO is INTEGER
  432. *> If 0, then everything ran OK.
  433. *> -1: NSIZES < 0
  434. *> -2: Some MM(j) < 0
  435. *> -3: Some NN(j) < 0
  436. *> -4: NTYPES < 0
  437. *> -6: NRHS < 0
  438. *> -8: THRESH < 0
  439. *> -11: LDA < 1 or LDA < MMAX, where MMAX is max( MM(j) ).
  440. *> -17: LDB < 1 or LDB < MMAX.
  441. *> -21: LDQ < 1 or LDQ < MMAX.
  442. *> -23: LDPT< 1 or LDPT< MNMAX.
  443. *> -27: LWORK too small.
  444. *> If DLATMR, SLATMS, DGEBRD, DORGBR, or DBDSQR,
  445. *> returns an error code, the
  446. *> absolute value of it is returned.
  447. *>
  448. *>-----------------------------------------------------------------------
  449. *>
  450. *> Some Local Variables and Parameters:
  451. *> ---- ----- --------- --- ----------
  452. *>
  453. *> ZERO, ONE Real 0 and 1.
  454. *> MAXTYP The number of types defined.
  455. *> NTEST The number of tests performed, or which can
  456. *> be performed so far, for the current matrix.
  457. *> MMAX Largest value in NN.
  458. *> NMAX Largest value in NN.
  459. *> MNMIN min(MM(j), NN(j)) (the dimension of the bidiagonal
  460. *> matrix.)
  461. *> MNMAX The maximum value of MNMIN for j=1,...,NSIZES.
  462. *> NFAIL The number of tests which have exceeded THRESH
  463. *> COND, IMODE Values to be passed to the matrix generators.
  464. *> ANORM Norm of A; passed to matrix generators.
  465. *>
  466. *> OVFL, UNFL Overflow and underflow thresholds.
  467. *> RTOVFL, RTUNFL Square roots of the previous 2 values.
  468. *> ULP, ULPINV Finest relative precision and its inverse.
  469. *>
  470. *> The following four arrays decode JTYPE:
  471. *> KTYPE(j) The general type (1-10) for type "j".
  472. *> KMODE(j) The MODE value to be passed to the matrix
  473. *> generator for type "j".
  474. *> KMAGN(j) The order of magnitude ( O(1),
  475. *> O(overflow^(1/2) ), O(underflow^(1/2) )
  476. *> \endverbatim
  477. *
  478. * Authors:
  479. * ========
  480. *
  481. *> \author Univ. of Tennessee
  482. *> \author Univ. of California Berkeley
  483. *> \author Univ. of Colorado Denver
  484. *> \author NAG Ltd.
  485. *
  486. *> \ingroup double_eig
  487. *
  488. * =====================================================================
  489. SUBROUTINE DCHKBD( NSIZES, MVAL, NVAL, NTYPES, DOTYPE, NRHS,
  490. $ ISEED, THRESH, A, LDA, BD, BE, S1, S2, X, LDX,
  491. $ Y, Z, Q, LDQ, PT, LDPT, U, VT, WORK, LWORK,
  492. $ IWORK, NOUT, INFO )
  493. *
  494. * -- LAPACK test routine --
  495. * -- LAPACK is a software package provided by Univ. of Tennessee, --
  496. * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  497. *
  498. * .. Scalar Arguments ..
  499. INTEGER INFO, LDA, LDPT, LDQ, LDX, LWORK, NOUT, NRHS,
  500. $ NSIZES, NTYPES
  501. DOUBLE PRECISION THRESH
  502. * ..
  503. * .. Array Arguments ..
  504. LOGICAL DOTYPE( * )
  505. INTEGER ISEED( 4 ), IWORK( * ), MVAL( * ), NVAL( * )
  506. DOUBLE PRECISION A( LDA, * ), BD( * ), BE( * ), PT( LDPT, * ),
  507. $ Q( LDQ, * ), S1( * ), S2( * ), U( LDPT, * ),
  508. $ VT( LDPT, * ), WORK( * ), X( LDX, * ),
  509. $ Y( LDX, * ), Z( LDX, * )
  510. * ..
  511. *
  512. * ======================================================================
  513. *
  514. * .. Parameters ..
  515. DOUBLE PRECISION ZERO, ONE, TWO, HALF
  516. PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0, TWO = 2.0D0,
  517. $ HALF = 0.5D0 )
  518. INTEGER MAXTYP
  519. PARAMETER ( MAXTYP = 16 )
  520. * ..
  521. * .. Local Scalars ..
  522. LOGICAL BADMM, BADNN, BIDIAG
  523. CHARACTER UPLO
  524. CHARACTER*3 PATH
  525. INTEGER I, IINFO, IL, IMODE, ITEMP, ITYPE, IU, IWBD,
  526. $ IWBE, IWBS, IWBZ, IWWORK, J, JCOL, JSIZE,
  527. $ JTYPE, LOG2UI, M, MINWRK, MMAX, MNMAX, MNMIN,
  528. $ MNMIN2, MQ, MTYPES, N, NFAIL, NMAX,
  529. $ NS1, NS2, NTEST
  530. DOUBLE PRECISION ABSTOL, AMNINV, ANORM, COND, OVFL, RTOVFL,
  531. $ RTUNFL, TEMP1, TEMP2, ULP, ULPINV, UNFL,
  532. $ VL, VU
  533. * ..
  534. * .. Local Arrays ..
  535. INTEGER IDUM( 1 ), IOLDSD( 4 ), ISEED2( 4 ),
  536. $ KMAGN( MAXTYP ), KMODE( MAXTYP ),
  537. $ KTYPE( MAXTYP )
  538. DOUBLE PRECISION DUM( 1 ), DUMMA( 1 ), RESULT( 40 )
  539. * ..
  540. * .. External Functions ..
  541. DOUBLE PRECISION DLAMCH, DLARND, DSXT1
  542. EXTERNAL DLAMCH, DLARND, DSXT1
  543. * ..
  544. * .. External Subroutines ..
  545. EXTERNAL ALASUM, DBDSDC, DBDSQR, DBDSVDX, DBDT01,
  546. $ DBDT02, DBDT03, DBDT04, DCOPY, DGEBRD,
  547. $ DGEMM, DLABAD, DLACPY, DLAHD2, DLASET,
  548. $ DLATMR, DLATMS, DORGBR, DORT01, XERBLA
  549. * ..
  550. * .. Intrinsic Functions ..
  551. INTRINSIC ABS, EXP, INT, LOG, MAX, MIN, SQRT
  552. * ..
  553. * .. Scalars in Common ..
  554. LOGICAL LERR, OK
  555. CHARACTER*32 SRNAMT
  556. INTEGER INFOT, NUNIT
  557. * ..
  558. * .. Common blocks ..
  559. COMMON / INFOC / INFOT, NUNIT, OK, LERR
  560. COMMON / SRNAMC / SRNAMT
  561. * ..
  562. * .. Data statements ..
  563. DATA KTYPE / 1, 2, 5*4, 5*6, 3*9, 10 /
  564. DATA KMAGN / 2*1, 3*1, 2, 3, 3*1, 2, 3, 1, 2, 3, 0 /
  565. DATA KMODE / 2*0, 4, 3, 1, 4, 4, 4, 3, 1, 4, 4, 0,
  566. $ 0, 0, 0 /
  567. * ..
  568. * .. Executable Statements ..
  569. *
  570. * Check for errors
  571. *
  572. INFO = 0
  573. *
  574. BADMM = .FALSE.
  575. BADNN = .FALSE.
  576. MMAX = 1
  577. NMAX = 1
  578. MNMAX = 1
  579. MINWRK = 1
  580. DO 10 J = 1, NSIZES
  581. MMAX = MAX( MMAX, MVAL( J ) )
  582. IF( MVAL( J ).LT.0 )
  583. $ BADMM = .TRUE.
  584. NMAX = MAX( NMAX, NVAL( J ) )
  585. IF( NVAL( J ).LT.0 )
  586. $ BADNN = .TRUE.
  587. MNMAX = MAX( MNMAX, MIN( MVAL( J ), NVAL( J ) ) )
  588. MINWRK = MAX( MINWRK, 3*( MVAL( J )+NVAL( J ) ),
  589. $ MVAL( J )*( MVAL( J )+MAX( MVAL( J ), NVAL( J ),
  590. $ NRHS )+1 )+NVAL( J )*MIN( NVAL( J ), MVAL( J ) ) )
  591. 10 CONTINUE
  592. *
  593. * Check for errors
  594. *
  595. IF( NSIZES.LT.0 ) THEN
  596. INFO = -1
  597. ELSE IF( BADMM ) THEN
  598. INFO = -2
  599. ELSE IF( BADNN ) THEN
  600. INFO = -3
  601. ELSE IF( NTYPES.LT.0 ) THEN
  602. INFO = -4
  603. ELSE IF( NRHS.LT.0 ) THEN
  604. INFO = -6
  605. ELSE IF( LDA.LT.MMAX ) THEN
  606. INFO = -11
  607. ELSE IF( LDX.LT.MMAX ) THEN
  608. INFO = -17
  609. ELSE IF( LDQ.LT.MMAX ) THEN
  610. INFO = -21
  611. ELSE IF( LDPT.LT.MNMAX ) THEN
  612. INFO = -23
  613. ELSE IF( MINWRK.GT.LWORK ) THEN
  614. INFO = -27
  615. END IF
  616. *
  617. IF( INFO.NE.0 ) THEN
  618. CALL XERBLA( 'DCHKBD', -INFO )
  619. RETURN
  620. END IF
  621. *
  622. * Initialize constants
  623. *
  624. PATH( 1: 1 ) = 'Double precision'
  625. PATH( 2: 3 ) = 'BD'
  626. NFAIL = 0
  627. NTEST = 0
  628. UNFL = DLAMCH( 'Safe minimum' )
  629. OVFL = DLAMCH( 'Overflow' )
  630. CALL DLABAD( UNFL, OVFL )
  631. ULP = DLAMCH( 'Precision' )
  632. ULPINV = ONE / ULP
  633. LOG2UI = INT( LOG( ULPINV ) / LOG( TWO ) )
  634. RTUNFL = SQRT( UNFL )
  635. RTOVFL = SQRT( OVFL )
  636. INFOT = 0
  637. ABSTOL = 2*UNFL
  638. *
  639. * Loop over sizes, types
  640. *
  641. DO 300 JSIZE = 1, NSIZES
  642. M = MVAL( JSIZE )
  643. N = NVAL( JSIZE )
  644. MNMIN = MIN( M, N )
  645. AMNINV = ONE / MAX( M, N, 1 )
  646. *
  647. IF( NSIZES.NE.1 ) THEN
  648. MTYPES = MIN( MAXTYP, NTYPES )
  649. ELSE
  650. MTYPES = MIN( MAXTYP+1, NTYPES )
  651. END IF
  652. *
  653. DO 290 JTYPE = 1, MTYPES
  654. IF( .NOT.DOTYPE( JTYPE ) )
  655. $ GO TO 290
  656. *
  657. DO 20 J = 1, 4
  658. IOLDSD( J ) = ISEED( J )
  659. 20 CONTINUE
  660. *
  661. DO 30 J = 1, 34
  662. RESULT( J ) = -ONE
  663. 30 CONTINUE
  664. *
  665. UPLO = ' '
  666. *
  667. * Compute "A"
  668. *
  669. * Control parameters:
  670. *
  671. * KMAGN KMODE KTYPE
  672. * =1 O(1) clustered 1 zero
  673. * =2 large clustered 2 identity
  674. * =3 small exponential (none)
  675. * =4 arithmetic diagonal, (w/ eigenvalues)
  676. * =5 random symmetric, w/ eigenvalues
  677. * =6 nonsymmetric, w/ singular values
  678. * =7 random diagonal
  679. * =8 random symmetric
  680. * =9 random nonsymmetric
  681. * =10 random bidiagonal (log. distrib.)
  682. *
  683. IF( MTYPES.GT.MAXTYP )
  684. $ GO TO 100
  685. *
  686. ITYPE = KTYPE( JTYPE )
  687. IMODE = KMODE( JTYPE )
  688. *
  689. * Compute norm
  690. *
  691. GO TO ( 40, 50, 60 )KMAGN( JTYPE )
  692. *
  693. 40 CONTINUE
  694. ANORM = ONE
  695. GO TO 70
  696. *
  697. 50 CONTINUE
  698. ANORM = ( RTOVFL*ULP )*AMNINV
  699. GO TO 70
  700. *
  701. 60 CONTINUE
  702. ANORM = RTUNFL*MAX( M, N )*ULPINV
  703. GO TO 70
  704. *
  705. 70 CONTINUE
  706. *
  707. CALL DLASET( 'Full', LDA, N, ZERO, ZERO, A, LDA )
  708. IINFO = 0
  709. COND = ULPINV
  710. *
  711. BIDIAG = .FALSE.
  712. IF( ITYPE.EQ.1 ) THEN
  713. *
  714. * Zero matrix
  715. *
  716. IINFO = 0
  717. *
  718. ELSE IF( ITYPE.EQ.2 ) THEN
  719. *
  720. * Identity
  721. *
  722. DO 80 JCOL = 1, MNMIN
  723. A( JCOL, JCOL ) = ANORM
  724. 80 CONTINUE
  725. *
  726. ELSE IF( ITYPE.EQ.4 ) THEN
  727. *
  728. * Diagonal Matrix, [Eigen]values Specified
  729. *
  730. CALL DLATMS( MNMIN, MNMIN, 'S', ISEED, 'N', WORK, IMODE,
  731. $ COND, ANORM, 0, 0, 'N', A, LDA,
  732. $ WORK( MNMIN+1 ), IINFO )
  733. *
  734. ELSE IF( ITYPE.EQ.5 ) THEN
  735. *
  736. * Symmetric, eigenvalues specified
  737. *
  738. CALL DLATMS( MNMIN, MNMIN, 'S', ISEED, 'S', WORK, IMODE,
  739. $ COND, ANORM, M, N, 'N', A, LDA,
  740. $ WORK( MNMIN+1 ), IINFO )
  741. *
  742. ELSE IF( ITYPE.EQ.6 ) THEN
  743. *
  744. * Nonsymmetric, singular values specified
  745. *
  746. CALL DLATMS( M, N, 'S', ISEED, 'N', WORK, IMODE, COND,
  747. $ ANORM, M, N, 'N', A, LDA, WORK( MNMIN+1 ),
  748. $ IINFO )
  749. *
  750. ELSE IF( ITYPE.EQ.7 ) THEN
  751. *
  752. * Diagonal, random entries
  753. *
  754. CALL DLATMR( MNMIN, MNMIN, 'S', ISEED, 'N', WORK, 6, ONE,
  755. $ ONE, 'T', 'N', WORK( MNMIN+1 ), 1, ONE,
  756. $ WORK( 2*MNMIN+1 ), 1, ONE, 'N', IWORK, 0, 0,
  757. $ ZERO, ANORM, 'NO', A, LDA, IWORK, IINFO )
  758. *
  759. ELSE IF( ITYPE.EQ.8 ) THEN
  760. *
  761. * Symmetric, random entries
  762. *
  763. CALL DLATMR( MNMIN, MNMIN, 'S', ISEED, 'S', WORK, 6, ONE,
  764. $ ONE, 'T', 'N', WORK( MNMIN+1 ), 1, ONE,
  765. $ WORK( M+MNMIN+1 ), 1, ONE, 'N', IWORK, M, N,
  766. $ ZERO, ANORM, 'NO', A, LDA, IWORK, IINFO )
  767. *
  768. ELSE IF( ITYPE.EQ.9 ) THEN
  769. *
  770. * Nonsymmetric, random entries
  771. *
  772. CALL DLATMR( M, N, 'S', ISEED, 'N', WORK, 6, ONE, ONE,
  773. $ 'T', 'N', WORK( MNMIN+1 ), 1, ONE,
  774. $ WORK( M+MNMIN+1 ), 1, ONE, 'N', IWORK, M, N,
  775. $ ZERO, ANORM, 'NO', A, LDA, IWORK, IINFO )
  776. *
  777. ELSE IF( ITYPE.EQ.10 ) THEN
  778. *
  779. * Bidiagonal, random entries
  780. *
  781. TEMP1 = -TWO*LOG( ULP )
  782. DO 90 J = 1, MNMIN
  783. BD( J ) = EXP( TEMP1*DLARND( 2, ISEED ) )
  784. IF( J.LT.MNMIN )
  785. $ BE( J ) = EXP( TEMP1*DLARND( 2, ISEED ) )
  786. 90 CONTINUE
  787. *
  788. IINFO = 0
  789. BIDIAG = .TRUE.
  790. IF( M.GE.N ) THEN
  791. UPLO = 'U'
  792. ELSE
  793. UPLO = 'L'
  794. END IF
  795. ELSE
  796. IINFO = 1
  797. END IF
  798. *
  799. IF( IINFO.EQ.0 ) THEN
  800. *
  801. * Generate Right-Hand Side
  802. *
  803. IF( BIDIAG ) THEN
  804. CALL DLATMR( MNMIN, NRHS, 'S', ISEED, 'N', WORK, 6,
  805. $ ONE, ONE, 'T', 'N', WORK( MNMIN+1 ), 1,
  806. $ ONE, WORK( 2*MNMIN+1 ), 1, ONE, 'N',
  807. $ IWORK, MNMIN, NRHS, ZERO, ONE, 'NO', Y,
  808. $ LDX, IWORK, IINFO )
  809. ELSE
  810. CALL DLATMR( M, NRHS, 'S', ISEED, 'N', WORK, 6, ONE,
  811. $ ONE, 'T', 'N', WORK( M+1 ), 1, ONE,
  812. $ WORK( 2*M+1 ), 1, ONE, 'N', IWORK, M,
  813. $ NRHS, ZERO, ONE, 'NO', X, LDX, IWORK,
  814. $ IINFO )
  815. END IF
  816. END IF
  817. *
  818. * Error Exit
  819. *
  820. IF( IINFO.NE.0 ) THEN
  821. WRITE( NOUT, FMT = 9998 )'Generator', IINFO, M, N,
  822. $ JTYPE, IOLDSD
  823. INFO = ABS( IINFO )
  824. RETURN
  825. END IF
  826. *
  827. 100 CONTINUE
  828. *
  829. * Call DGEBRD and DORGBR to compute B, Q, and P, do tests.
  830. *
  831. IF( .NOT.BIDIAG ) THEN
  832. *
  833. * Compute transformations to reduce A to bidiagonal form:
  834. * B := Q' * A * P.
  835. *
  836. CALL DLACPY( ' ', M, N, A, LDA, Q, LDQ )
  837. CALL DGEBRD( M, N, Q, LDQ, BD, BE, WORK, WORK( MNMIN+1 ),
  838. $ WORK( 2*MNMIN+1 ), LWORK-2*MNMIN, IINFO )
  839. *
  840. * Check error code from DGEBRD.
  841. *
  842. IF( IINFO.NE.0 ) THEN
  843. WRITE( NOUT, FMT = 9998 )'DGEBRD', IINFO, M, N,
  844. $ JTYPE, IOLDSD
  845. INFO = ABS( IINFO )
  846. RETURN
  847. END IF
  848. *
  849. CALL DLACPY( ' ', M, N, Q, LDQ, PT, LDPT )
  850. IF( M.GE.N ) THEN
  851. UPLO = 'U'
  852. ELSE
  853. UPLO = 'L'
  854. END IF
  855. *
  856. * Generate Q
  857. *
  858. MQ = M
  859. IF( NRHS.LE.0 )
  860. $ MQ = MNMIN
  861. CALL DORGBR( 'Q', M, MQ, N, Q, LDQ, WORK,
  862. $ WORK( 2*MNMIN+1 ), LWORK-2*MNMIN, IINFO )
  863. *
  864. * Check error code from DORGBR.
  865. *
  866. IF( IINFO.NE.0 ) THEN
  867. WRITE( NOUT, FMT = 9998 )'DORGBR(Q)', IINFO, M, N,
  868. $ JTYPE, IOLDSD
  869. INFO = ABS( IINFO )
  870. RETURN
  871. END IF
  872. *
  873. * Generate P'
  874. *
  875. CALL DORGBR( 'P', MNMIN, N, M, PT, LDPT, WORK( MNMIN+1 ),
  876. $ WORK( 2*MNMIN+1 ), LWORK-2*MNMIN, IINFO )
  877. *
  878. * Check error code from DORGBR.
  879. *
  880. IF( IINFO.NE.0 ) THEN
  881. WRITE( NOUT, FMT = 9998 )'DORGBR(P)', IINFO, M, N,
  882. $ JTYPE, IOLDSD
  883. INFO = ABS( IINFO )
  884. RETURN
  885. END IF
  886. *
  887. * Apply Q' to an M by NRHS matrix X: Y := Q' * X.
  888. *
  889. CALL DGEMM( 'Transpose', 'No transpose', M, NRHS, M, ONE,
  890. $ Q, LDQ, X, LDX, ZERO, Y, LDX )
  891. *
  892. * Test 1: Check the decomposition A := Q * B * PT
  893. * 2: Check the orthogonality of Q
  894. * 3: Check the orthogonality of PT
  895. *
  896. CALL DBDT01( M, N, 1, A, LDA, Q, LDQ, BD, BE, PT, LDPT,
  897. $ WORK, RESULT( 1 ) )
  898. CALL DORT01( 'Columns', M, MQ, Q, LDQ, WORK, LWORK,
  899. $ RESULT( 2 ) )
  900. CALL DORT01( 'Rows', MNMIN, N, PT, LDPT, WORK, LWORK,
  901. $ RESULT( 3 ) )
  902. END IF
  903. *
  904. * Use DBDSQR to form the SVD of the bidiagonal matrix B:
  905. * B := U * S1 * VT, and compute Z = U' * Y.
  906. *
  907. CALL DCOPY( MNMIN, BD, 1, S1, 1 )
  908. IF( MNMIN.GT.0 )
  909. $ CALL DCOPY( MNMIN-1, BE, 1, WORK, 1 )
  910. CALL DLACPY( ' ', M, NRHS, Y, LDX, Z, LDX )
  911. CALL DLASET( 'Full', MNMIN, MNMIN, ZERO, ONE, U, LDPT )
  912. CALL DLASET( 'Full', MNMIN, MNMIN, ZERO, ONE, VT, LDPT )
  913. *
  914. CALL DBDSQR( UPLO, MNMIN, MNMIN, MNMIN, NRHS, S1, WORK, VT,
  915. $ LDPT, U, LDPT, Z, LDX, WORK( MNMIN+1 ), IINFO )
  916. *
  917. * Check error code from DBDSQR.
  918. *
  919. IF( IINFO.NE.0 ) THEN
  920. WRITE( NOUT, FMT = 9998 )'DBDSQR(vects)', IINFO, M, N,
  921. $ JTYPE, IOLDSD
  922. INFO = ABS( IINFO )
  923. IF( IINFO.LT.0 ) THEN
  924. RETURN
  925. ELSE
  926. RESULT( 4 ) = ULPINV
  927. GO TO 270
  928. END IF
  929. END IF
  930. *
  931. * Use DBDSQR to compute only the singular values of the
  932. * bidiagonal matrix B; U, VT, and Z should not be modified.
  933. *
  934. CALL DCOPY( MNMIN, BD, 1, S2, 1 )
  935. IF( MNMIN.GT.0 )
  936. $ CALL DCOPY( MNMIN-1, BE, 1, WORK, 1 )
  937. *
  938. CALL DBDSQR( UPLO, MNMIN, 0, 0, 0, S2, WORK, VT, LDPT, U,
  939. $ LDPT, Z, LDX, WORK( MNMIN+1 ), IINFO )
  940. *
  941. * Check error code from DBDSQR.
  942. *
  943. IF( IINFO.NE.0 ) THEN
  944. WRITE( NOUT, FMT = 9998 )'DBDSQR(values)', IINFO, M, N,
  945. $ JTYPE, IOLDSD
  946. INFO = ABS( IINFO )
  947. IF( IINFO.LT.0 ) THEN
  948. RETURN
  949. ELSE
  950. RESULT( 9 ) = ULPINV
  951. GO TO 270
  952. END IF
  953. END IF
  954. *
  955. * Test 4: Check the decomposition B := U * S1 * VT
  956. * 5: Check the computation Z := U' * Y
  957. * 6: Check the orthogonality of U
  958. * 7: Check the orthogonality of VT
  959. *
  960. CALL DBDT03( UPLO, MNMIN, 1, BD, BE, U, LDPT, S1, VT, LDPT,
  961. $ WORK, RESULT( 4 ) )
  962. CALL DBDT02( MNMIN, NRHS, Y, LDX, Z, LDX, U, LDPT, WORK,
  963. $ RESULT( 5 ) )
  964. CALL DORT01( 'Columns', MNMIN, MNMIN, U, LDPT, WORK, LWORK,
  965. $ RESULT( 6 ) )
  966. CALL DORT01( 'Rows', MNMIN, MNMIN, VT, LDPT, WORK, LWORK,
  967. $ RESULT( 7 ) )
  968. *
  969. * Test 8: Check that the singular values are sorted in
  970. * non-increasing order and are non-negative
  971. *
  972. RESULT( 8 ) = ZERO
  973. DO 110 I = 1, MNMIN - 1
  974. IF( S1( I ).LT.S1( I+1 ) )
  975. $ RESULT( 8 ) = ULPINV
  976. IF( S1( I ).LT.ZERO )
  977. $ RESULT( 8 ) = ULPINV
  978. 110 CONTINUE
  979. IF( MNMIN.GE.1 ) THEN
  980. IF( S1( MNMIN ).LT.ZERO )
  981. $ RESULT( 8 ) = ULPINV
  982. END IF
  983. *
  984. * Test 9: Compare DBDSQR with and without singular vectors
  985. *
  986. TEMP2 = ZERO
  987. *
  988. DO 120 J = 1, MNMIN
  989. TEMP1 = ABS( S1( J )-S2( J ) ) /
  990. $ MAX( SQRT( UNFL )*MAX( S1( 1 ), ONE ),
  991. $ ULP*MAX( ABS( S1( J ) ), ABS( S2( J ) ) ) )
  992. TEMP2 = MAX( TEMP1, TEMP2 )
  993. 120 CONTINUE
  994. *
  995. RESULT( 9 ) = TEMP2
  996. *
  997. * Test 10: Sturm sequence test of singular values
  998. * Go up by factors of two until it succeeds
  999. *
  1000. TEMP1 = THRESH*( HALF-ULP )
  1001. *
  1002. DO 130 J = 0, LOG2UI
  1003. * CALL DSVDCH( MNMIN, BD, BE, S1, TEMP1, IINFO )
  1004. IF( IINFO.EQ.0 )
  1005. $ GO TO 140
  1006. TEMP1 = TEMP1*TWO
  1007. 130 CONTINUE
  1008. *
  1009. 140 CONTINUE
  1010. RESULT( 10 ) = TEMP1
  1011. *
  1012. * Use DBDSQR to form the decomposition A := (QU) S (VT PT)
  1013. * from the bidiagonal form A := Q B PT.
  1014. *
  1015. IF( .NOT.BIDIAG ) THEN
  1016. CALL DCOPY( MNMIN, BD, 1, S2, 1 )
  1017. IF( MNMIN.GT.0 )
  1018. $ CALL DCOPY( MNMIN-1, BE, 1, WORK, 1 )
  1019. *
  1020. CALL DBDSQR( UPLO, MNMIN, N, M, NRHS, S2, WORK, PT, LDPT,
  1021. $ Q, LDQ, Y, LDX, WORK( MNMIN+1 ), IINFO )
  1022. *
  1023. * Test 11: Check the decomposition A := Q*U * S2 * VT*PT
  1024. * 12: Check the computation Z := U' * Q' * X
  1025. * 13: Check the orthogonality of Q*U
  1026. * 14: Check the orthogonality of VT*PT
  1027. *
  1028. CALL DBDT01( M, N, 0, A, LDA, Q, LDQ, S2, DUMMA, PT,
  1029. $ LDPT, WORK, RESULT( 11 ) )
  1030. CALL DBDT02( M, NRHS, X, LDX, Y, LDX, Q, LDQ, WORK,
  1031. $ RESULT( 12 ) )
  1032. CALL DORT01( 'Columns', M, MQ, Q, LDQ, WORK, LWORK,
  1033. $ RESULT( 13 ) )
  1034. CALL DORT01( 'Rows', MNMIN, N, PT, LDPT, WORK, LWORK,
  1035. $ RESULT( 14 ) )
  1036. END IF
  1037. *
  1038. * Use DBDSDC to form the SVD of the bidiagonal matrix B:
  1039. * B := U * S1 * VT
  1040. *
  1041. CALL DCOPY( MNMIN, BD, 1, S1, 1 )
  1042. IF( MNMIN.GT.0 )
  1043. $ CALL DCOPY( MNMIN-1, BE, 1, WORK, 1 )
  1044. CALL DLASET( 'Full', MNMIN, MNMIN, ZERO, ONE, U, LDPT )
  1045. CALL DLASET( 'Full', MNMIN, MNMIN, ZERO, ONE, VT, LDPT )
  1046. *
  1047. CALL DBDSDC( UPLO, 'I', MNMIN, S1, WORK, U, LDPT, VT, LDPT,
  1048. $ DUM, IDUM, WORK( MNMIN+1 ), IWORK, IINFO )
  1049. *
  1050. * Check error code from DBDSDC.
  1051. *
  1052. IF( IINFO.NE.0 ) THEN
  1053. WRITE( NOUT, FMT = 9998 )'DBDSDC(vects)', IINFO, M, N,
  1054. $ JTYPE, IOLDSD
  1055. INFO = ABS( IINFO )
  1056. IF( IINFO.LT.0 ) THEN
  1057. RETURN
  1058. ELSE
  1059. RESULT( 15 ) = ULPINV
  1060. GO TO 270
  1061. END IF
  1062. END IF
  1063. *
  1064. * Use DBDSDC to compute only the singular values of the
  1065. * bidiagonal matrix B; U and VT should not be modified.
  1066. *
  1067. CALL DCOPY( MNMIN, BD, 1, S2, 1 )
  1068. IF( MNMIN.GT.0 )
  1069. $ CALL DCOPY( MNMIN-1, BE, 1, WORK, 1 )
  1070. *
  1071. CALL DBDSDC( UPLO, 'N', MNMIN, S2, WORK, DUM, 1, DUM, 1,
  1072. $ DUM, IDUM, WORK( MNMIN+1 ), IWORK, IINFO )
  1073. *
  1074. * Check error code from DBDSDC.
  1075. *
  1076. IF( IINFO.NE.0 ) THEN
  1077. WRITE( NOUT, FMT = 9998 )'DBDSDC(values)', IINFO, M, N,
  1078. $ JTYPE, IOLDSD
  1079. INFO = ABS( IINFO )
  1080. IF( IINFO.LT.0 ) THEN
  1081. RETURN
  1082. ELSE
  1083. RESULT( 18 ) = ULPINV
  1084. GO TO 270
  1085. END IF
  1086. END IF
  1087. *
  1088. * Test 15: Check the decomposition B := U * S1 * VT
  1089. * 16: Check the orthogonality of U
  1090. * 17: Check the orthogonality of VT
  1091. *
  1092. CALL DBDT03( UPLO, MNMIN, 1, BD, BE, U, LDPT, S1, VT, LDPT,
  1093. $ WORK, RESULT( 15 ) )
  1094. CALL DORT01( 'Columns', MNMIN, MNMIN, U, LDPT, WORK, LWORK,
  1095. $ RESULT( 16 ) )
  1096. CALL DORT01( 'Rows', MNMIN, MNMIN, VT, LDPT, WORK, LWORK,
  1097. $ RESULT( 17 ) )
  1098. *
  1099. * Test 18: Check that the singular values are sorted in
  1100. * non-increasing order and are non-negative
  1101. *
  1102. RESULT( 18 ) = ZERO
  1103. DO 150 I = 1, MNMIN - 1
  1104. IF( S1( I ).LT.S1( I+1 ) )
  1105. $ RESULT( 18 ) = ULPINV
  1106. IF( S1( I ).LT.ZERO )
  1107. $ RESULT( 18 ) = ULPINV
  1108. 150 CONTINUE
  1109. IF( MNMIN.GE.1 ) THEN
  1110. IF( S1( MNMIN ).LT.ZERO )
  1111. $ RESULT( 18 ) = ULPINV
  1112. END IF
  1113. *
  1114. * Test 19: Compare DBDSQR with and without singular vectors
  1115. *
  1116. TEMP2 = ZERO
  1117. *
  1118. DO 160 J = 1, MNMIN
  1119. TEMP1 = ABS( S1( J )-S2( J ) ) /
  1120. $ MAX( SQRT( UNFL )*MAX( S1( 1 ), ONE ),
  1121. $ ULP*MAX( ABS( S1( 1 ) ), ABS( S2( 1 ) ) ) )
  1122. TEMP2 = MAX( TEMP1, TEMP2 )
  1123. 160 CONTINUE
  1124. *
  1125. RESULT( 19 ) = TEMP2
  1126. *
  1127. *
  1128. * Use DBDSVDX to compute the SVD of the bidiagonal matrix B:
  1129. * B := U * S1 * VT
  1130. *
  1131. IF( JTYPE.EQ.10 .OR. JTYPE.EQ.16 ) THEN
  1132. * =================================
  1133. * Matrix types temporarily disabled
  1134. * =================================
  1135. RESULT( 20:34 ) = ZERO
  1136. GO TO 270
  1137. END IF
  1138. *
  1139. IWBS = 1
  1140. IWBD = IWBS + MNMIN
  1141. IWBE = IWBD + MNMIN
  1142. IWBZ = IWBE + MNMIN
  1143. IWWORK = IWBZ + 2*MNMIN*(MNMIN+1)
  1144. MNMIN2 = MAX( 1,MNMIN*2 )
  1145. *
  1146. CALL DCOPY( MNMIN, BD, 1, WORK( IWBD ), 1 )
  1147. IF( MNMIN.GT.0 )
  1148. $ CALL DCOPY( MNMIN-1, BE, 1, WORK( IWBE ), 1 )
  1149. *
  1150. CALL DBDSVDX( UPLO, 'V', 'A', MNMIN, WORK( IWBD ),
  1151. $ WORK( IWBE ), ZERO, ZERO, 0, 0, NS1, S1,
  1152. $ WORK( IWBZ ), MNMIN2, WORK( IWWORK ),
  1153. $ IWORK, IINFO)
  1154. *
  1155. * Check error code from DBDSVDX.
  1156. *
  1157. IF( IINFO.NE.0 ) THEN
  1158. WRITE( NOUT, FMT = 9998 )'DBDSVDX(vects,A)', IINFO, M, N,
  1159. $ JTYPE, IOLDSD
  1160. INFO = ABS( IINFO )
  1161. IF( IINFO.LT.0 ) THEN
  1162. RETURN
  1163. ELSE
  1164. RESULT( 20 ) = ULPINV
  1165. GO TO 270
  1166. END IF
  1167. END IF
  1168. *
  1169. J = IWBZ
  1170. DO 170 I = 1, NS1
  1171. CALL DCOPY( MNMIN, WORK( J ), 1, U( 1,I ), 1 )
  1172. J = J + MNMIN
  1173. CALL DCOPY( MNMIN, WORK( J ), 1, VT( I,1 ), LDPT )
  1174. J = J + MNMIN
  1175. 170 CONTINUE
  1176. *
  1177. * Use DBDSVDX to compute only the singular values of the
  1178. * bidiagonal matrix B; U and VT should not be modified.
  1179. *
  1180. IF( JTYPE.EQ.9 ) THEN
  1181. * =================================
  1182. * Matrix types temporarily disabled
  1183. * =================================
  1184. RESULT( 24 ) = ZERO
  1185. GO TO 270
  1186. END IF
  1187. *
  1188. CALL DCOPY( MNMIN, BD, 1, WORK( IWBD ), 1 )
  1189. IF( MNMIN.GT.0 )
  1190. $ CALL DCOPY( MNMIN-1, BE, 1, WORK( IWBE ), 1 )
  1191. *
  1192. CALL DBDSVDX( UPLO, 'N', 'A', MNMIN, WORK( IWBD ),
  1193. $ WORK( IWBE ), ZERO, ZERO, 0, 0, NS2, S2,
  1194. $ WORK( IWBZ ), MNMIN2, WORK( IWWORK ),
  1195. $ IWORK, IINFO )
  1196. *
  1197. * Check error code from DBDSVDX.
  1198. *
  1199. IF( IINFO.NE.0 ) THEN
  1200. WRITE( NOUT, FMT = 9998 )'DBDSVDX(values,A)', IINFO,
  1201. $ M, N, JTYPE, IOLDSD
  1202. INFO = ABS( IINFO )
  1203. IF( IINFO.LT.0 ) THEN
  1204. RETURN
  1205. ELSE
  1206. RESULT( 24 ) = ULPINV
  1207. GO TO 270
  1208. END IF
  1209. END IF
  1210. *
  1211. * Save S1 for tests 30-34.
  1212. *
  1213. CALL DCOPY( MNMIN, S1, 1, WORK( IWBS ), 1 )
  1214. *
  1215. * Test 20: Check the decomposition B := U * S1 * VT
  1216. * 21: Check the orthogonality of U
  1217. * 22: Check the orthogonality of VT
  1218. * 23: Check that the singular values are sorted in
  1219. * non-increasing order and are non-negative
  1220. * 24: Compare DBDSVDX with and without singular vectors
  1221. *
  1222. CALL DBDT03( UPLO, MNMIN, 1, BD, BE, U, LDPT, S1, VT,
  1223. $ LDPT, WORK( IWBS+MNMIN ), RESULT( 20 ) )
  1224. CALL DORT01( 'Columns', MNMIN, MNMIN, U, LDPT,
  1225. $ WORK( IWBS+MNMIN ), LWORK-MNMIN,
  1226. $ RESULT( 21 ) )
  1227. CALL DORT01( 'Rows', MNMIN, MNMIN, VT, LDPT,
  1228. $ WORK( IWBS+MNMIN ), LWORK-MNMIN,
  1229. $ RESULT( 22) )
  1230. *
  1231. RESULT( 23 ) = ZERO
  1232. DO 180 I = 1, MNMIN - 1
  1233. IF( S1( I ).LT.S1( I+1 ) )
  1234. $ RESULT( 23 ) = ULPINV
  1235. IF( S1( I ).LT.ZERO )
  1236. $ RESULT( 23 ) = ULPINV
  1237. 180 CONTINUE
  1238. IF( MNMIN.GE.1 ) THEN
  1239. IF( S1( MNMIN ).LT.ZERO )
  1240. $ RESULT( 23 ) = ULPINV
  1241. END IF
  1242. *
  1243. TEMP2 = ZERO
  1244. DO 190 J = 1, MNMIN
  1245. TEMP1 = ABS( S1( J )-S2( J ) ) /
  1246. $ MAX( SQRT( UNFL )*MAX( S1( 1 ), ONE ),
  1247. $ ULP*MAX( ABS( S1( 1 ) ), ABS( S2( 1 ) ) ) )
  1248. TEMP2 = MAX( TEMP1, TEMP2 )
  1249. 190 CONTINUE
  1250. RESULT( 24 ) = TEMP2
  1251. ANORM = S1( 1 )
  1252. *
  1253. * Use DBDSVDX with RANGE='I': choose random values for IL and
  1254. * IU, and ask for the IL-th through IU-th singular values
  1255. * and corresponding vectors.
  1256. *
  1257. DO 200 I = 1, 4
  1258. ISEED2( I ) = ISEED( I )
  1259. 200 CONTINUE
  1260. IF( MNMIN.LE.1 ) THEN
  1261. IL = 1
  1262. IU = MNMIN
  1263. ELSE
  1264. IL = 1 + INT( ( MNMIN-1 )*DLARND( 1, ISEED2 ) )
  1265. IU = 1 + INT( ( MNMIN-1 )*DLARND( 1, ISEED2 ) )
  1266. IF( IU.LT.IL ) THEN
  1267. ITEMP = IU
  1268. IU = IL
  1269. IL = ITEMP
  1270. END IF
  1271. END IF
  1272. *
  1273. CALL DCOPY( MNMIN, BD, 1, WORK( IWBD ), 1 )
  1274. IF( MNMIN.GT.0 )
  1275. $ CALL DCOPY( MNMIN-1, BE, 1, WORK( IWBE ), 1 )
  1276. *
  1277. CALL DBDSVDX( UPLO, 'V', 'I', MNMIN, WORK( IWBD ),
  1278. $ WORK( IWBE ), ZERO, ZERO, IL, IU, NS1, S1,
  1279. $ WORK( IWBZ ), MNMIN2, WORK( IWWORK ),
  1280. $ IWORK, IINFO)
  1281. *
  1282. * Check error code from DBDSVDX.
  1283. *
  1284. IF( IINFO.NE.0 ) THEN
  1285. WRITE( NOUT, FMT = 9998 )'DBDSVDX(vects,I)', IINFO,
  1286. $ M, N, JTYPE, IOLDSD
  1287. INFO = ABS( IINFO )
  1288. IF( IINFO.LT.0 ) THEN
  1289. RETURN
  1290. ELSE
  1291. RESULT( 25 ) = ULPINV
  1292. GO TO 270
  1293. END IF
  1294. END IF
  1295. *
  1296. J = IWBZ
  1297. DO 210 I = 1, NS1
  1298. CALL DCOPY( MNMIN, WORK( J ), 1, U( 1,I ), 1 )
  1299. J = J + MNMIN
  1300. CALL DCOPY( MNMIN, WORK( J ), 1, VT( I,1 ), LDPT )
  1301. J = J + MNMIN
  1302. 210 CONTINUE
  1303. *
  1304. * Use DBDSVDX to compute only the singular values of the
  1305. * bidiagonal matrix B; U and VT should not be modified.
  1306. *
  1307. CALL DCOPY( MNMIN, BD, 1, WORK( IWBD ), 1 )
  1308. IF( MNMIN.GT.0 )
  1309. $ CALL DCOPY( MNMIN-1, BE, 1, WORK( IWBE ), 1 )
  1310. *
  1311. CALL DBDSVDX( UPLO, 'N', 'I', MNMIN, WORK( IWBD ),
  1312. $ WORK( IWBE ), ZERO, ZERO, IL, IU, NS2, S2,
  1313. $ WORK( IWBZ ), MNMIN2, WORK( IWWORK ),
  1314. $ IWORK, IINFO )
  1315. *
  1316. * Check error code from DBDSVDX.
  1317. *
  1318. IF( IINFO.NE.0 ) THEN
  1319. WRITE( NOUT, FMT = 9998 )'DBDSVDX(values,I)', IINFO,
  1320. $ M, N, JTYPE, IOLDSD
  1321. INFO = ABS( IINFO )
  1322. IF( IINFO.LT.0 ) THEN
  1323. RETURN
  1324. ELSE
  1325. RESULT( 29 ) = ULPINV
  1326. GO TO 270
  1327. END IF
  1328. END IF
  1329. *
  1330. * Test 25: Check S1 - U' * B * VT'
  1331. * 26: Check the orthogonality of U
  1332. * 27: Check the orthogonality of VT
  1333. * 28: Check that the singular values are sorted in
  1334. * non-increasing order and are non-negative
  1335. * 29: Compare DBDSVDX with and without singular vectors
  1336. *
  1337. CALL DBDT04( UPLO, MNMIN, BD, BE, S1, NS1, U,
  1338. $ LDPT, VT, LDPT, WORK( IWBS+MNMIN ),
  1339. $ RESULT( 25 ) )
  1340. CALL DORT01( 'Columns', MNMIN, NS1, U, LDPT,
  1341. $ WORK( IWBS+MNMIN ), LWORK-MNMIN,
  1342. $ RESULT( 26 ) )
  1343. CALL DORT01( 'Rows', NS1, MNMIN, VT, LDPT,
  1344. $ WORK( IWBS+MNMIN ), LWORK-MNMIN,
  1345. $ RESULT( 27 ) )
  1346. *
  1347. RESULT( 28 ) = ZERO
  1348. DO 220 I = 1, NS1 - 1
  1349. IF( S1( I ).LT.S1( I+1 ) )
  1350. $ RESULT( 28 ) = ULPINV
  1351. IF( S1( I ).LT.ZERO )
  1352. $ RESULT( 28 ) = ULPINV
  1353. 220 CONTINUE
  1354. IF( NS1.GE.1 ) THEN
  1355. IF( S1( NS1 ).LT.ZERO )
  1356. $ RESULT( 28 ) = ULPINV
  1357. END IF
  1358. *
  1359. TEMP2 = ZERO
  1360. DO 230 J = 1, NS1
  1361. TEMP1 = ABS( S1( J )-S2( J ) ) /
  1362. $ MAX( SQRT( UNFL )*MAX( S1( 1 ), ONE ),
  1363. $ ULP*MAX( ABS( S1( 1 ) ), ABS( S2( 1 ) ) ) )
  1364. TEMP2 = MAX( TEMP1, TEMP2 )
  1365. 230 CONTINUE
  1366. RESULT( 29 ) = TEMP2
  1367. *
  1368. * Use DBDSVDX with RANGE='V': determine the values VL and VU
  1369. * of the IL-th and IU-th singular values and ask for all
  1370. * singular values in this range.
  1371. *
  1372. CALL DCOPY( MNMIN, WORK( IWBS ), 1, S1, 1 )
  1373. *
  1374. IF( MNMIN.GT.0 ) THEN
  1375. IF( IL.NE.1 ) THEN
  1376. VU = S1( IL ) + MAX( HALF*ABS( S1( IL )-S1( IL-1 ) ),
  1377. $ ULP*ANORM, TWO*RTUNFL )
  1378. ELSE
  1379. VU = S1( 1 ) + MAX( HALF*ABS( S1( MNMIN )-S1( 1 ) ),
  1380. $ ULP*ANORM, TWO*RTUNFL )
  1381. END IF
  1382. IF( IU.NE.NS1 ) THEN
  1383. VL = S1( IU ) - MAX( ULP*ANORM, TWO*RTUNFL,
  1384. $ HALF*ABS( S1( IU+1 )-S1( IU ) ) )
  1385. ELSE
  1386. VL = S1( NS1 ) - MAX( ULP*ANORM, TWO*RTUNFL,
  1387. $ HALF*ABS( S1( MNMIN )-S1( 1 ) ) )
  1388. END IF
  1389. VL = MAX( VL,ZERO )
  1390. VU = MAX( VU,ZERO )
  1391. IF( VL.GE.VU ) VU = MAX( VU*2, VU+VL+HALF )
  1392. ELSE
  1393. VL = ZERO
  1394. VU = ONE
  1395. END IF
  1396. *
  1397. CALL DCOPY( MNMIN, BD, 1, WORK( IWBD ), 1 )
  1398. IF( MNMIN.GT.0 )
  1399. $ CALL DCOPY( MNMIN-1, BE, 1, WORK( IWBE ), 1 )
  1400. *
  1401. CALL DBDSVDX( UPLO, 'V', 'V', MNMIN, WORK( IWBD ),
  1402. $ WORK( IWBE ), VL, VU, 0, 0, NS1, S1,
  1403. $ WORK( IWBZ ), MNMIN2, WORK( IWWORK ),
  1404. $ IWORK, IINFO )
  1405. *
  1406. * Check error code from DBDSVDX.
  1407. *
  1408. IF( IINFO.NE.0 ) THEN
  1409. WRITE( NOUT, FMT = 9998 )'DBDSVDX(vects,V)', IINFO,
  1410. $ M, N, JTYPE, IOLDSD
  1411. INFO = ABS( IINFO )
  1412. IF( IINFO.LT.0 ) THEN
  1413. RETURN
  1414. ELSE
  1415. RESULT( 30 ) = ULPINV
  1416. GO TO 270
  1417. END IF
  1418. END IF
  1419. *
  1420. J = IWBZ
  1421. DO 240 I = 1, NS1
  1422. CALL DCOPY( MNMIN, WORK( J ), 1, U( 1,I ), 1 )
  1423. J = J + MNMIN
  1424. CALL DCOPY( MNMIN, WORK( J ), 1, VT( I,1 ), LDPT )
  1425. J = J + MNMIN
  1426. 240 CONTINUE
  1427. *
  1428. * Use DBDSVDX to compute only the singular values of the
  1429. * bidiagonal matrix B; U and VT should not be modified.
  1430. *
  1431. CALL DCOPY( MNMIN, BD, 1, WORK( IWBD ), 1 )
  1432. IF( MNMIN.GT.0 )
  1433. $ CALL DCOPY( MNMIN-1, BE, 1, WORK( IWBE ), 1 )
  1434. *
  1435. CALL DBDSVDX( UPLO, 'N', 'V', MNMIN, WORK( IWBD ),
  1436. $ WORK( IWBE ), VL, VU, 0, 0, NS2, S2,
  1437. $ WORK( IWBZ ), MNMIN2, WORK( IWWORK ),
  1438. $ IWORK, IINFO )
  1439. *
  1440. * Check error code from DBDSVDX.
  1441. *
  1442. IF( IINFO.NE.0 ) THEN
  1443. WRITE( NOUT, FMT = 9998 )'DBDSVDX(values,V)', IINFO,
  1444. $ M, N, JTYPE, IOLDSD
  1445. INFO = ABS( IINFO )
  1446. IF( IINFO.LT.0 ) THEN
  1447. RETURN
  1448. ELSE
  1449. RESULT( 34 ) = ULPINV
  1450. GO TO 270
  1451. END IF
  1452. END IF
  1453. *
  1454. * Test 30: Check S1 - U' * B * VT'
  1455. * 31: Check the orthogonality of U
  1456. * 32: Check the orthogonality of VT
  1457. * 33: Check that the singular values are sorted in
  1458. * non-increasing order and are non-negative
  1459. * 34: Compare DBDSVDX with and without singular vectors
  1460. *
  1461. CALL DBDT04( UPLO, MNMIN, BD, BE, S1, NS1, U,
  1462. $ LDPT, VT, LDPT, WORK( IWBS+MNMIN ),
  1463. $ RESULT( 30 ) )
  1464. CALL DORT01( 'Columns', MNMIN, NS1, U, LDPT,
  1465. $ WORK( IWBS+MNMIN ), LWORK-MNMIN,
  1466. $ RESULT( 31 ) )
  1467. CALL DORT01( 'Rows', NS1, MNMIN, VT, LDPT,
  1468. $ WORK( IWBS+MNMIN ), LWORK-MNMIN,
  1469. $ RESULT( 32 ) )
  1470. *
  1471. RESULT( 33 ) = ZERO
  1472. DO 250 I = 1, NS1 - 1
  1473. IF( S1( I ).LT.S1( I+1 ) )
  1474. $ RESULT( 28 ) = ULPINV
  1475. IF( S1( I ).LT.ZERO )
  1476. $ RESULT( 28 ) = ULPINV
  1477. 250 CONTINUE
  1478. IF( NS1.GE.1 ) THEN
  1479. IF( S1( NS1 ).LT.ZERO )
  1480. $ RESULT( 28 ) = ULPINV
  1481. END IF
  1482. *
  1483. TEMP2 = ZERO
  1484. DO 260 J = 1, NS1
  1485. TEMP1 = ABS( S1( J )-S2( J ) ) /
  1486. $ MAX( SQRT( UNFL )*MAX( S1( 1 ), ONE ),
  1487. $ ULP*MAX( ABS( S1( 1 ) ), ABS( S2( 1 ) ) ) )
  1488. TEMP2 = MAX( TEMP1, TEMP2 )
  1489. 260 CONTINUE
  1490. RESULT( 34 ) = TEMP2
  1491. *
  1492. * End of Loop -- Check for RESULT(j) > THRESH
  1493. *
  1494. 270 CONTINUE
  1495. *
  1496. DO 280 J = 1, 34
  1497. IF( RESULT( J ).GE.THRESH ) THEN
  1498. IF( NFAIL.EQ.0 )
  1499. $ CALL DLAHD2( NOUT, PATH )
  1500. WRITE( NOUT, FMT = 9999 )M, N, JTYPE, IOLDSD, J,
  1501. $ RESULT( J )
  1502. NFAIL = NFAIL + 1
  1503. END IF
  1504. 280 CONTINUE
  1505. IF( .NOT.BIDIAG ) THEN
  1506. NTEST = NTEST + 34
  1507. ELSE
  1508. NTEST = NTEST + 30
  1509. END IF
  1510. *
  1511. 290 CONTINUE
  1512. 300 CONTINUE
  1513. *
  1514. * Summary
  1515. *
  1516. CALL ALASUM( PATH, NOUT, NFAIL, NTEST, 0 )
  1517. *
  1518. RETURN
  1519. *
  1520. * End of DCHKBD
  1521. *
  1522. 9999 FORMAT( ' M=', I5, ', N=', I5, ', type ', I2, ', seed=',
  1523. $ 4( I4, ',' ), ' test(', I2, ')=', G11.4 )
  1524. 9998 FORMAT( ' DCHKBD: ', A, ' returned INFO=', I6, '.', / 9X, 'M=',
  1525. $ I6, ', N=', I6, ', JTYPE=', I6, ', ISEED=(', 3( I5, ',' ),
  1526. $ I5, ')' )
  1527. *
  1528. END