PageRenderTime 164ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 1ms

/specs/lapack/lapack-20010525.patch

https://github.com/dfateyev/rpms
Patch | 12261 lines | 12261 code | 0 blank | 0 comment | 0 complexity | cd0e9eb45b508c610a2f84b421ec52a7 MD5 | raw file
Possible License(s): AGPL-3.0, GPL-2.0, CC0-1.0
  1. diff -uNr LAPACK.orig/BLAS/TESTING/cblat2.f LAPACK/BLAS/TESTING/cblat2.f
  2. --- LAPACK.orig/BLAS/TESTING/cblat2.f Thu Nov 4 14:23:26 1999
  3. +++ LAPACK/BLAS/TESTING/cblat2.f Fri May 25 15:57:46 2001
  4. @@ -64,6 +64,10 @@
  5. * Richard Hanson, Sandia National Labs.
  6. * Jeremy Du Croz, NAG Central Office.
  7. *
  8. +* 10-9-00: Change STATUS='NEW' to 'UNKNOWN' so that the testers
  9. +* can be run multiple times without deleting generated
  10. +* output files (susan)
  11. +*
  12. * .. Parameters ..
  13. INTEGER NIN
  14. PARAMETER ( NIN = 5 )
  15. @@ -126,7 +130,7 @@
  16. *
  17. READ( NIN, FMT = * )SUMMRY
  18. READ( NIN, FMT = * )NOUT
  19. - OPEN( NOUT, FILE = SUMMRY, STATUS = 'NEW' )
  20. + OPEN( NOUT, FILE = SUMMRY, STATUS = 'UNKNOWN' )
  21. NOUTC = NOUT
  22. *
  23. * Read name and unit number for snapshot output file and open file.
  24. @@ -135,7 +139,7 @@
  25. READ( NIN, FMT = * )NTRA
  26. TRACE = NTRA.GE.0
  27. IF( TRACE )THEN
  28. - OPEN( NTRA, FILE = SNAPS, STATUS = 'NEW' )
  29. + OPEN( NTRA, FILE = SNAPS, STATUS = 'UNKNOWN' )
  30. END IF
  31. * Read the flag that directs rewinding of the snapshot file.
  32. READ( NIN, FMT = * )REWI
  33. diff -uNr LAPACK.orig/BLAS/TESTING/cblat3.f LAPACK/BLAS/TESTING/cblat3.f
  34. --- LAPACK.orig/BLAS/TESTING/cblat3.f Thu Nov 4 14:23:26 1999
  35. +++ LAPACK/BLAS/TESTING/cblat3.f Fri May 25 15:58:08 2001
  36. @@ -46,6 +46,10 @@
  37. * Jeremy Du Croz, Numerical Algorithms Group Ltd.
  38. * Sven Hammarling, Numerical Algorithms Group Ltd.
  39. *
  40. +* 10-9-00: Change STATUS='NEW' to 'UNKNOWN' so that the testers
  41. +* can be run multiple times without deleting generated
  42. +* output files (susan)
  43. +*
  44. * .. Parameters ..
  45. INTEGER NIN
  46. PARAMETER ( NIN = 5 )
  47. diff -uNr LAPACK.orig/BLAS/TESTING/dblat2.f LAPACK/BLAS/TESTING/dblat2.f
  48. --- LAPACK.orig/BLAS/TESTING/dblat2.f Thu Nov 4 14:23:27 1999
  49. +++ LAPACK/BLAS/TESTING/dblat2.f Fri May 25 15:57:41 2001
  50. @@ -63,6 +63,10 @@
  51. * Richard Hanson, Sandia National Labs.
  52. * Jeremy Du Croz, NAG Central Office.
  53. *
  54. +* 10-9-00: Change STATUS='NEW' to 'UNKNOWN' so that the testers
  55. +* can be run multiple times without deleting generated
  56. +* output files (susan)
  57. +*
  58. * .. Parameters ..
  59. INTEGER NIN
  60. PARAMETER ( NIN = 5 )
  61. @@ -121,7 +125,7 @@
  62. *
  63. READ( NIN, FMT = * )SUMMRY
  64. READ( NIN, FMT = * )NOUT
  65. - OPEN( NOUT, FILE = SUMMRY, STATUS = 'NEW' )
  66. + OPEN( NOUT, FILE = SUMMRY, STATUS = 'UNKNOWN' )
  67. NOUTC = NOUT
  68. *
  69. * Read name and unit number for snapshot output file and open file.
  70. @@ -130,7 +134,7 @@
  71. READ( NIN, FMT = * )NTRA
  72. TRACE = NTRA.GE.0
  73. IF( TRACE )THEN
  74. - OPEN( NTRA, FILE = SNAPS, STATUS = 'NEW' )
  75. + OPEN( NTRA, FILE = SNAPS, STATUS = 'UNKNOWN' )
  76. END IF
  77. * Read the flag that directs rewinding of the snapshot file.
  78. READ( NIN, FMT = * )REWI
  79. diff -uNr LAPACK.orig/BLAS/TESTING/dblat3.f LAPACK/BLAS/TESTING/dblat3.f
  80. --- LAPACK.orig/BLAS/TESTING/dblat3.f Thu Nov 4 14:23:27 1999
  81. +++ LAPACK/BLAS/TESTING/dblat3.f Fri May 25 15:58:04 2001
  82. @@ -43,6 +43,10 @@
  83. * Jeremy Du Croz, Numerical Algorithms Group Ltd.
  84. * Sven Hammarling, Numerical Algorithms Group Ltd.
  85. *
  86. +* 10-9-00: Change STATUS='NEW' to 'UNKNOWN' so that the testers
  87. +* can be run multiple times without deleting generated
  88. +* output files (susan)
  89. +*
  90. * .. Parameters ..
  91. INTEGER NIN
  92. PARAMETER ( NIN = 5 )
  93. @@ -96,7 +100,7 @@
  94. *
  95. READ( NIN, FMT = * )SUMMRY
  96. READ( NIN, FMT = * )NOUT
  97. - OPEN( NOUT, FILE = SUMMRY, STATUS = 'NEW' )
  98. + OPEN( NOUT, FILE = SUMMRY, STATUS = 'UNKNOWN' )
  99. NOUTC = NOUT
  100. *
  101. * Read name and unit number for snapshot output file and open file.
  102. @@ -105,7 +109,7 @@
  103. READ( NIN, FMT = * )NTRA
  104. TRACE = NTRA.GE.0
  105. IF( TRACE )THEN
  106. - OPEN( NTRA, FILE = SNAPS, STATUS = 'NEW' )
  107. + OPEN( NTRA, FILE = SNAPS, STATUS = 'UNKNOWN' )
  108. END IF
  109. * Read the flag that directs rewinding of the snapshot file.
  110. READ( NIN, FMT = * )REWI
  111. diff -uNr LAPACK.orig/BLAS/TESTING/sblat2.f LAPACK/BLAS/TESTING/sblat2.f
  112. --- LAPACK.orig/BLAS/TESTING/sblat2.f Thu Nov 4 14:23:26 1999
  113. +++ LAPACK/BLAS/TESTING/sblat2.f Fri May 25 15:57:34 2001
  114. @@ -63,6 +63,10 @@
  115. * Richard Hanson, Sandia National Labs.
  116. * Jeremy Du Croz, NAG Central Office.
  117. *
  118. +* 10-9-00: Change STATUS='NEW' to 'UNKNOWN' so that the testers
  119. +* can be run multiple times without deleting generated
  120. +* output files (susan)
  121. +*
  122. * .. Parameters ..
  123. INTEGER NIN
  124. PARAMETER ( NIN = 5 )
  125. @@ -121,7 +125,7 @@
  126. *
  127. READ( NIN, FMT = * )SUMMRY
  128. READ( NIN, FMT = * )NOUT
  129. - OPEN( NOUT, FILE = SUMMRY, STATUS = 'NEW' )
  130. + OPEN( NOUT, FILE = SUMMRY, STATUS = 'UNKNOWN' )
  131. NOUTC = NOUT
  132. *
  133. * Read name and unit number for snapshot output file and open file.
  134. @@ -130,7 +134,7 @@
  135. READ( NIN, FMT = * )NTRA
  136. TRACE = NTRA.GE.0
  137. IF( TRACE )THEN
  138. - OPEN( NTRA, FILE = SNAPS, STATUS = 'NEW' )
  139. + OPEN( NTRA, FILE = SNAPS, STATUS = 'UNKNOWN' )
  140. END IF
  141. * Read the flag that directs rewinding of the snapshot file.
  142. READ( NIN, FMT = * )REWI
  143. diff -uNr LAPACK.orig/BLAS/TESTING/sblat3.f LAPACK/BLAS/TESTING/sblat3.f
  144. --- LAPACK.orig/BLAS/TESTING/sblat3.f Thu Nov 4 14:23:26 1999
  145. +++ LAPACK/BLAS/TESTING/sblat3.f Fri May 25 15:58:00 2001
  146. @@ -43,6 +43,10 @@
  147. * Jeremy Du Croz, Numerical Algorithms Group Ltd.
  148. * Sven Hammarling, Numerical Algorithms Group Ltd.
  149. *
  150. +* 10-9-00: Change STATUS='NEW' to 'UNKNOWN' so that the testers
  151. +* can be run multiple times without deleting generated
  152. +* output files (susan)
  153. +*
  154. * .. Parameters ..
  155. INTEGER NIN
  156. PARAMETER ( NIN = 5 )
  157. diff -uNr LAPACK.orig/BLAS/TESTING/zblat2.f LAPACK/BLAS/TESTING/zblat2.f
  158. --- LAPACK.orig/BLAS/TESTING/zblat2.f Thu Nov 4 14:23:27 1999
  159. +++ LAPACK/BLAS/TESTING/zblat2.f Fri May 25 15:57:52 2001
  160. @@ -64,6 +64,10 @@
  161. * Richard Hanson, Sandia National Labs.
  162. * Jeremy Du Croz, NAG Central Office.
  163. *
  164. +* 10-9-00: Change STATUS='NEW' to 'UNKNOWN' so that the testers
  165. +* can be run multiple times without deleting generated
  166. +* output files (susan)
  167. +*
  168. * .. Parameters ..
  169. INTEGER NIN
  170. PARAMETER ( NIN = 5 )
  171. @@ -127,7 +131,7 @@
  172. *
  173. READ( NIN, FMT = * )SUMMRY
  174. READ( NIN, FMT = * )NOUT
  175. - OPEN( NOUT, FILE = SUMMRY, STATUS = 'NEW' )
  176. + OPEN( NOUT, FILE = SUMMRY, STATUS = 'UNKNOWN' )
  177. NOUTC = NOUT
  178. *
  179. * Read name and unit number for snapshot output file and open file.
  180. @@ -136,7 +140,7 @@
  181. READ( NIN, FMT = * )NTRA
  182. TRACE = NTRA.GE.0
  183. IF( TRACE )THEN
  184. - OPEN( NTRA, FILE = SNAPS, STATUS = 'NEW' )
  185. + OPEN( NTRA, FILE = SNAPS, STATUS = 'UNKNOWN' )
  186. END IF
  187. * Read the flag that directs rewinding of the snapshot file.
  188. READ( NIN, FMT = * )REWI
  189. diff -uNr LAPACK.orig/BLAS/TESTING/zblat3.f LAPACK/BLAS/TESTING/zblat3.f
  190. --- LAPACK.orig/BLAS/TESTING/zblat3.f Thu Nov 4 14:23:27 1999
  191. +++ LAPACK/BLAS/TESTING/zblat3.f Fri May 25 15:58:16 2001
  192. @@ -46,6 +46,10 @@
  193. * Jeremy Du Croz, Numerical Algorithms Group Ltd.
  194. * Sven Hammarling, Numerical Algorithms Group Ltd.
  195. *
  196. +* 10-9-00: Change STATUS='NEW' to 'UNKNOWN' so that the testers
  197. +* can be run multiple times without deleting generated
  198. +* output files (susan)
  199. +*
  200. * .. Parameters ..
  201. INTEGER NIN
  202. PARAMETER ( NIN = 5 )
  203. @@ -104,7 +108,7 @@
  204. *
  205. READ( NIN, FMT = * )SUMMRY
  206. READ( NIN, FMT = * )NOUT
  207. - OPEN( NOUT, FILE = SUMMRY, STATUS = 'NEW' )
  208. + OPEN( NOUT, FILE = SUMMRY, STATUS = 'UNKNOWN' )
  209. NOUTC = NOUT
  210. *
  211. * Read name and unit number for snapshot output file and open file.
  212. @@ -113,7 +117,7 @@
  213. READ( NIN, FMT = * )NTRA
  214. TRACE = NTRA.GE.0
  215. IF( TRACE )THEN
  216. - OPEN( NTRA, FILE = SNAPS, STATUS = 'NEW' )
  217. + OPEN( NTRA, FILE = SNAPS, STATUS = 'UNKNOWN' )
  218. END IF
  219. * Read the flag that directs rewinding of the snapshot file.
  220. READ( NIN, FMT = * )REWI
  221. @@ -1962,6 +1966,7 @@
  222. * 3-19-92: Initialize ALPHA, BETA, RALPHA, and RBETA (eca)
  223. * 3-19-92: Fix argument 12 in calls to ZSYMM and ZHEMM
  224. * with INFOT = 9 (eca)
  225. +* 10-9-00: Declared INTRINSIC DCMPLX (susan)
  226. *
  227. * .. Scalar Arguments ..
  228. INTEGER ISNUM, NOUT
  229. @@ -1980,6 +1985,8 @@
  230. * .. External Subroutines ..
  231. EXTERNAL ZGEMM, ZHEMM, ZHER2K, ZHERK, CHKXER, ZSYMM,
  232. $ ZSYR2K, ZSYRK, ZTRMM, ZTRSM
  233. +* .. Intrinsic Functions ..
  234. + INTRINSIC DCMPLX
  235. * .. Common blocks ..
  236. COMMON /INFOC/INFOT, NOUTC, OK, LERR
  237. * .. Executable Statements ..
  238. diff -uNr LAPACK.orig/INSTALL/make.inc.LINUX LAPACK/INSTALL/make.inc.LINUX
  239. --- LAPACK.orig/INSTALL/make.inc.LINUX Thu Nov 4 14:23:30 1999
  240. +++ LAPACK/INSTALL/make.inc.LINUX Fri May 25 15:58:36 2001
  241. @@ -17,7 +17,7 @@
  242. # desired load options for your machine.
  243. #
  244. FORTRAN = g77
  245. -OPTS = -funroll-all-loops -fno-f2c -O3
  246. +OPTS = -funroll-all-loops -O3
  247. DRVOPTS = $(OPTS)
  248. NOOPT =
  249. LOADER = g77
  250. diff -uNr LAPACK.orig/SRC/cbdsqr.f LAPACK/SRC/cbdsqr.f
  251. --- LAPACK.orig/SRC/cbdsqr.f Thu Nov 4 14:23:31 1999
  252. +++ LAPACK/SRC/cbdsqr.f Fri May 25 15:59:05 2001
  253. @@ -4,7 +4,7 @@
  254. * -- LAPACK routine (version 3.0) --
  255. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  256. * Courant Institute, Argonne National Lab, and Rice University
  257. -* October 31, 1999
  258. +* April 25, 2001
  259. *
  260. * .. Scalar Arguments ..
  261. CHARACTER UPLO
  262. @@ -18,14 +18,26 @@
  263. * Purpose
  264. * =======
  265. *
  266. -* CBDSQR computes the singular value decomposition (SVD) of a real
  267. -* N-by-N (upper or lower) bidiagonal matrix B: B = Q * S * P' (P'
  268. -* denotes the transpose of P), where S is a diagonal matrix with
  269. -* non-negative diagonal elements (the singular values of B), and Q
  270. -* and P are orthogonal matrices.
  271. -*
  272. -* The routine computes S, and optionally computes U * Q, P' * VT,
  273. -* or Q' * C, for given complex input matrices U, VT, and C.
  274. +* CBDSQR computes the singular values and, optionally, the right and/or
  275. +* left singular vectors from the singular value decomposition (SVD) of
  276. +* a real N-by-N (upper or lower) bidiagonal matrix B using the implicit
  277. +* zero-shift QR algorithm. The SVD of B has the form
  278. +*
  279. +* B = Q * S * P**H
  280. +*
  281. +* where S is the diagonal matrix of singular values, Q is an orthogonal
  282. +* matrix of left singular vectors, and P is an orthogonal matrix of
  283. +* right singular vectors. If left singular vectors are requested, this
  284. +* subroutine actually returns U*Q instead of Q, and, if right singular
  285. +* vectors are requested, this subroutine returns P**H*VT instead of
  286. +* P**H, for given complex input matrices U and VT. When U and VT are
  287. +* the unitary matrices that reduce a general matrix A to bidiagonal
  288. +* form: A = U*B*VT, as computed by CGEBRD, then
  289. +*
  290. +* A = (U*Q) * S * (P**H*VT)
  291. +*
  292. +* is the SVD of A. Optionally, the subroutine may also compute Q**H*C
  293. +* for a given complex input matrix C.
  294. *
  295. * See "Computing Small Singular Values of Bidiagonal Matrices With
  296. * Guaranteed High Relative Accuracy," by J. Demmel and W. Kahan,
  297. @@ -61,18 +73,17 @@
  298. * order.
  299. *
  300. * E (input/output) REAL array, dimension (N)
  301. -* On entry, the elements of E contain the
  302. -* offdiagonal elements of of the bidiagonal matrix whose SVD
  303. -* is desired. On normal exit (INFO = 0), E is destroyed.
  304. -* If the algorithm does not converge (INFO > 0), D and E
  305. +* On entry, the N-1 offdiagonal elements of the bidiagonal
  306. +* matrix B.
  307. +* On exit, if INFO = 0, E is destroyed; if INFO > 0, D and E
  308. * will contain the diagonal and superdiagonal elements of a
  309. * bidiagonal matrix orthogonally equivalent to the one given
  310. * as input. E(N) is used for workspace.
  311. *
  312. * VT (input/output) COMPLEX array, dimension (LDVT, NCVT)
  313. * On entry, an N-by-NCVT matrix VT.
  314. -* On exit, VT is overwritten by P' * VT.
  315. -* VT is not referenced if NCVT = 0.
  316. +* On exit, VT is overwritten by P**H * VT.
  317. +* Not referenced if NCVT = 0.
  318. *
  319. * LDVT (input) INTEGER
  320. * The leading dimension of the array VT.
  321. @@ -81,21 +92,22 @@
  322. * U (input/output) COMPLEX array, dimension (LDU, N)
  323. * On entry, an NRU-by-N matrix U.
  324. * On exit, U is overwritten by U * Q.
  325. -* U is not referenced if NRU = 0.
  326. +* Not referenced if NRU = 0.
  327. *
  328. * LDU (input) INTEGER
  329. * The leading dimension of the array U. LDU >= max(1,NRU).
  330. *
  331. * C (input/output) COMPLEX array, dimension (LDC, NCC)
  332. * On entry, an N-by-NCC matrix C.
  333. -* On exit, C is overwritten by Q' * C.
  334. -* C is not referenced if NCC = 0.
  335. +* On exit, C is overwritten by Q**H * C.
  336. +* Not referenced if NCC = 0.
  337. *
  338. * LDC (input) INTEGER
  339. * The leading dimension of the array C.
  340. * LDC >= max(1,N) if NCC > 0; LDC >=1 if NCC = 0.
  341. *
  342. -* RWORK (workspace) REAL array, dimension (4*N)
  343. +* RWORK (workspace) REAL array, dimension (2*N)
  344. +* if NCVT = NRU = NCC = 0, (max(1, 4*N-4)) otherwise
  345. *
  346. * INFO (output) INTEGER
  347. * = 0: successful exit
  348. diff -uNr LAPACK.orig/SRC/cgebd2.f LAPACK/SRC/cgebd2.f
  349. --- LAPACK.orig/SRC/cgebd2.f Thu Nov 4 14:24:07 1999
  350. +++ LAPACK/SRC/cgebd2.f Fri May 25 15:59:27 2001
  351. @@ -3,7 +3,7 @@
  352. * -- LAPACK routine (version 3.0) --
  353. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  354. * Courant Institute, Argonne National Lab, and Rice University
  355. -* September 30, 1994
  356. +* May 7, 2001
  357. *
  358. * .. Scalar Arguments ..
  359. INTEGER INFO, LDA, M, N
  360. @@ -172,8 +172,9 @@
  361. *
  362. * Apply H(i)' to A(i:m,i+1:n) from the left
  363. *
  364. - CALL CLARF( 'Left', M-I+1, N-I, A( I, I ), 1,
  365. - $ CONJG( TAUQ( I ) ), A( I, I+1 ), LDA, WORK )
  366. + IF( I.LT.N )
  367. + $ CALL CLARF( 'Left', M-I+1, N-I, A( I, I ), 1,
  368. + $ CONJG( TAUQ( I ) ), A( I, I+1 ), LDA, WORK )
  369. A( I, I ) = D( I )
  370. *
  371. IF( I.LT.N ) THEN
  372. @@ -215,8 +216,9 @@
  373. *
  374. * Apply G(i) to A(i+1:m,i:n) from the right
  375. *
  376. - CALL CLARF( 'Right', M-I, N-I+1, A( I, I ), LDA, TAUP( I ),
  377. - $ A( MIN( I+1, M ), I ), LDA, WORK )
  378. + IF( I.LT.M )
  379. + $ CALL CLARF( 'Right', M-I, N-I+1, A( I, I ), LDA,
  380. + $ TAUP( I ), A( MIN( I+1, M ), I ), LDA, WORK )
  381. CALL CLACGV( N-I+1, A( I, I ), LDA )
  382. A( I, I ) = D( I )
  383. *
  384. diff -uNr LAPACK.orig/SRC/cgees.f LAPACK/SRC/cgees.f
  385. --- LAPACK.orig/SRC/cgees.f Thu Nov 4 14:24:08 1999
  386. +++ LAPACK/SRC/cgees.f Fri May 25 15:59:55 2001
  387. @@ -5,6 +5,7 @@
  388. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  389. * Courant Institute, Argonne National Lab, and Rice University
  390. * June 30, 1999
  391. +* 8-15-00: Improve consistency of WS calculations (eca)
  392. *
  393. * .. Scalar Arguments ..
  394. CHARACTER JOBVS, SORT
  395. @@ -89,10 +90,9 @@
  396. * The dimension of the array WORK. LWORK >= max(1,2*N).
  397. * For good performance, LWORK must generally be larger.
  398. *
  399. -* If LWORK = -1, then a workspace query is assumed; the routine
  400. -* only calculates the optimal size of the WORK array, returns
  401. -* this value as the first entry of the WORK array, and no error
  402. -* message related to LWORK is issued by XERBLA.
  403. +* If LWORK = -1, a workspace query is assumed. The optimal
  404. +* size for the WORK array is calculated and stored in WORK(1),
  405. +* and no other work except argument checking is performed.
  406. *
  407. * RWORK (workspace) REAL array, dimension (N)
  408. *
  409. @@ -120,11 +120,13 @@
  410. * =====================================================================
  411. *
  412. * .. Parameters ..
  413. + INTEGER LQUERV
  414. + PARAMETER ( LQUERV = -1 )
  415. REAL ZERO, ONE
  416. PARAMETER ( ZERO = 0.0E0, ONE = 1.0E0 )
  417. * ..
  418. * .. Local Scalars ..
  419. - LOGICAL LQUERY, SCALEA, WANTST, WANTVS
  420. + LOGICAL SCALEA, WANTST, WANTVS
  421. INTEGER HSWORK, I, IBAL, ICOND, IERR, IEVAL, IHI, ILO,
  422. $ ITAU, IWRK, K, MAXB, MAXWRK, MINWRK
  423. REAL ANRM, BIGNUM, CSCALE, EPS, S, SEP, SMLNUM
  424. @@ -150,7 +152,6 @@
  425. * Test the input arguments
  426. *
  427. INFO = 0
  428. - LQUERY = ( LWORK.EQ.-1 )
  429. WANTVS = LSAME( JOBVS, 'V' )
  430. WANTST = LSAME( SORT, 'S' )
  431. IF( ( .NOT.WANTVS ) .AND. ( .NOT.LSAME( JOBVS, 'N' ) ) ) THEN
  432. @@ -177,7 +178,7 @@
  433. * the worst case.)
  434. *
  435. MINWRK = 1
  436. - IF( INFO.EQ.0 .AND. ( LWORK.GE.1 .OR. LQUERY ) ) THEN
  437. + IF( INFO.EQ.0 ) THEN
  438. MAXWRK = N + N*ILAENV( 1, 'CGEHRD', ' ', N, 1, N, 0 )
  439. MINWRK = MAX( 1, 2*N )
  440. IF( .NOT.WANTVS ) THEN
  441. @@ -196,19 +197,17 @@
  442. MAXWRK = MAX( MAXWRK, HSWORK, 1 )
  443. END IF
  444. WORK( 1 ) = MAXWRK
  445. + IF( LWORK.LT.MINWRK .AND. LWORK.NE.LQUERV )
  446. + $ INFO = -12
  447. END IF
  448. - IF( LWORK.LT.MINWRK .AND. .NOT.LQUERY ) THEN
  449. - INFO = -12
  450. - END IF
  451. +*
  452. +* Quick returns
  453. +*
  454. IF( INFO.NE.0 ) THEN
  455. CALL XERBLA( 'CGEES ', -INFO )
  456. RETURN
  457. - ELSE IF( LQUERY ) THEN
  458. - RETURN
  459. END IF
  460. -*
  461. -* Quick return if possible
  462. -*
  463. + IF( LWORK.EQ.LQUERV ) RETURN
  464. IF( N.EQ.0 ) THEN
  465. SDIM = 0
  466. RETURN
  467. diff -uNr LAPACK.orig/SRC/cgeesx.f LAPACK/SRC/cgeesx.f
  468. --- LAPACK.orig/SRC/cgeesx.f Thu Nov 4 14:24:08 1999
  469. +++ LAPACK/SRC/cgeesx.f Fri May 25 16:00:18 2001
  470. @@ -6,6 +6,7 @@
  471. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  472. * Courant Institute, Argonne National Lab, and Rice University
  473. * June 30, 1999
  474. +* 8-15-00: Do WS calculations if LWORK = -1 (eca)
  475. *
  476. * .. Scalar Arguments ..
  477. CHARACTER JOBVS, SENSE, SORT
  478. @@ -119,6 +120,10 @@
  479. * this routine. Note that 2*SDIM*(N-SDIM) <= N*N/2.
  480. * For good performance, LWORK must generally be larger.
  481. *
  482. +* If LWORK = -1, a workspace query is assumed. The optimal
  483. +* size for the WORK array is calculated and stored in WORK(1),
  484. +* and no other work except argument checking is performed.
  485. +*
  486. * RWORK (workspace) REAL array, dimension (N)
  487. *
  488. * BWORK (workspace) LOGICAL array, dimension (N)
  489. @@ -144,6 +149,8 @@
  490. * =====================================================================
  491. *
  492. * .. Parameters ..
  493. + INTEGER LQUERV
  494. + PARAMETER ( LQUERV = -1 )
  495. REAL ZERO, ONE
  496. PARAMETER ( ZERO = 0.0E0, ONE = 1.0E0 )
  497. * ..
  498. @@ -211,7 +218,7 @@
  499. * in the code.)
  500. *
  501. MINWRK = 1
  502. - IF( INFO.EQ.0 .AND. ( LWORK.GE.1 ) ) THEN
  503. + IF( INFO.EQ.0 ) THEN
  504. MAXWRK = N + N*ILAENV( 1, 'CGEHRD', ' ', N, 1, N, 0 )
  505. MINWRK = MAX( 1, 2*N )
  506. IF( .NOT.WANTVS ) THEN
  507. @@ -229,18 +236,24 @@
  508. HSWORK = MAX( K*( K+2 ), 2*N )
  509. MAXWRK = MAX( MAXWRK, HSWORK, 1 )
  510. END IF
  511. +*
  512. +* Estimate the workspace needed by CTRSEN.
  513. +*
  514. + IF( WANTST ) THEN
  515. + MAXWRK = MAX( MAXWRK, (N*N+1)/2 )
  516. + END IF
  517. WORK( 1 ) = MAXWRK
  518. + IF( LWORK.LT.MINWRK .AND. LWORK.NE.LQUERV )
  519. + & INFO = -15
  520. END IF
  521. - IF( LWORK.LT.MINWRK ) THEN
  522. - INFO = -15
  523. - END IF
  524. +*
  525. +* Quick returns
  526. +*
  527. IF( INFO.NE.0 ) THEN
  528. CALL XERBLA( 'CGEESX', -INFO )
  529. RETURN
  530. END IF
  531. -*
  532. -* Quick return if possible
  533. -*
  534. + IF( LWORK.EQ.LQUERV ) RETURN
  535. IF( N.EQ.0 ) THEN
  536. SDIM = 0
  537. RETURN
  538. diff -uNr LAPACK.orig/SRC/cgeev.f LAPACK/SRC/cgeev.f
  539. --- LAPACK.orig/SRC/cgeev.f Thu Nov 4 14:24:08 1999
  540. +++ LAPACK/SRC/cgeev.f Fri May 25 16:00:48 2001
  541. @@ -5,6 +5,7 @@
  542. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  543. * Courant Institute, Argonne National Lab, and Rice University
  544. * June 30, 1999
  545. +* 8-15-00: Improve consistency of WS calculations (eca)
  546. *
  547. * .. Scalar Arguments ..
  548. CHARACTER JOBVL, JOBVR
  549. @@ -85,10 +86,9 @@
  550. * The dimension of the array WORK. LWORK >= max(1,2*N).
  551. * For good performance, LWORK must generally be larger.
  552. *
  553. -* If LWORK = -1, then a workspace query is assumed; the routine
  554. -* only calculates the optimal size of the WORK array, returns
  555. -* this value as the first entry of the WORK array, and no error
  556. -* message related to LWORK is issued by XERBLA.
  557. +* If LWORK = -1, a workspace query is assumed. The optimal
  558. +* size for the WORK array is calculated and stored in WORK(1),
  559. +* and no other work except argument checking is performed.
  560. *
  561. * RWORK (workspace) REAL array, dimension (2*N)
  562. *
  563. @@ -103,11 +103,13 @@
  564. * =====================================================================
  565. *
  566. * .. Parameters ..
  567. + INTEGER LQUERV
  568. + PARAMETER ( LQUERV = -1 )
  569. REAL ZERO, ONE
  570. PARAMETER ( ZERO = 0.0E0, ONE = 1.0E0 )
  571. * ..
  572. * .. Local Scalars ..
  573. - LOGICAL LQUERY, SCALEA, WANTVL, WANTVR
  574. + LOGICAL SCALEA, WANTVL, WANTVR
  575. CHARACTER SIDE
  576. INTEGER HSWORK, I, IBAL, IERR, IHI, ILO, IRWORK, ITAU,
  577. $ IWRK, K, MAXB, MAXWRK, MINWRK, NOUT
  578. @@ -136,7 +138,6 @@
  579. * Test the input arguments
  580. *
  581. INFO = 0
  582. - LQUERY = ( LWORK.EQ.-1 )
  583. WANTVL = LSAME( JOBVL, 'V' )
  584. WANTVR = LSAME( JOBVR, 'V' )
  585. IF( ( .NOT.WANTVL ) .AND. ( .NOT.LSAME( JOBVL, 'N' ) ) ) THEN
  586. @@ -165,7 +166,7 @@
  587. * the worst case.)
  588. *
  589. MINWRK = 1
  590. - IF( INFO.EQ.0 .AND. ( LWORK.GE.1 .OR. LQUERY ) ) THEN
  591. + IF( INFO.EQ.0 ) THEN
  592. MAXWRK = N + N*ILAENV( 1, 'CGEHRD', ' ', N, 1, N, 0 )
  593. IF( ( .NOT.WANTVL ) .AND. ( .NOT.WANTVR ) ) THEN
  594. MINWRK = MAX( 1, 2*N )
  595. @@ -185,19 +186,17 @@
  596. MAXWRK = MAX( MAXWRK, HSWORK, 2*N )
  597. END IF
  598. WORK( 1 ) = MAXWRK
  599. + IF( LWORK.LT.MINWRK .AND. LWORK.NE.LQUERV )
  600. + $ INFO = -12
  601. END IF
  602. - IF( LWORK.LT.MINWRK .AND. .NOT.LQUERY ) THEN
  603. - INFO = -12
  604. - END IF
  605. +*
  606. +* Quick returns
  607. +*
  608. IF( INFO.NE.0 ) THEN
  609. CALL XERBLA( 'CGEEV ', -INFO )
  610. RETURN
  611. - ELSE IF( LQUERY ) THEN
  612. - RETURN
  613. END IF
  614. -*
  615. -* Quick return if possible
  616. -*
  617. + IF( LWORK.EQ.LQUERV ) RETURN
  618. IF( N.EQ.0 )
  619. $ RETURN
  620. *
  621. diff -uNr LAPACK.orig/SRC/cgeevx.f LAPACK/SRC/cgeevx.f
  622. --- LAPACK.orig/SRC/cgeevx.f Thu Nov 4 14:24:08 1999
  623. +++ LAPACK/SRC/cgeevx.f Fri May 25 16:01:10 2001
  624. @@ -6,6 +6,7 @@
  625. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  626. * Courant Institute, Argonne National Lab, and Rice University
  627. * June 30, 1999
  628. +* 8-15-00: Improve consistency of WS calculations (eca)
  629. *
  630. * .. Scalar Arguments ..
  631. CHARACTER BALANC, JOBVL, JOBVR, SENSE
  632. @@ -166,10 +167,9 @@
  633. * LWORK >= N*N+2*N.
  634. * For good performance, LWORK must generally be larger.
  635. *
  636. -* If LWORK = -1, then a workspace query is assumed; the routine
  637. -* only calculates the optimal size of the WORK array, returns
  638. -* this value as the first entry of the WORK array, and no error
  639. -* message related to LWORK is issued by XERBLA.
  640. +* If LWORK = -1, a workspace query is assumed. The optimal
  641. +* size for the WORK array is calculated and stored in WORK(1),
  642. +* and no other work except argument checking is performed.
  643. *
  644. * RWORK (workspace) REAL array, dimension (2*N)
  645. *
  646. @@ -184,12 +184,14 @@
  647. * =====================================================================
  648. *
  649. * .. Parameters ..
  650. + INTEGER LQUERV
  651. + PARAMETER ( LQUERV = -1 )
  652. REAL ZERO, ONE
  653. PARAMETER ( ZERO = 0.0E0, ONE = 1.0E0 )
  654. * ..
  655. * .. Local Scalars ..
  656. - LOGICAL LQUERY, SCALEA, WANTVL, WANTVR, WNTSNB, WNTSNE,
  657. - $ WNTSNN, WNTSNV
  658. + LOGICAL SCALEA, WANTVL, WANTVR, WNTSNB, WNTSNE, WNTSNN,
  659. + $ WNTSNV
  660. CHARACTER JOB, SIDE
  661. INTEGER HSWORK, I, ICOND, IERR, ITAU, IWRK, K, MAXB,
  662. $ MAXWRK, MINWRK, NOUT
  663. @@ -219,7 +221,6 @@
  664. * Test the input arguments
  665. *
  666. INFO = 0
  667. - LQUERY = ( LWORK.EQ.-1 )
  668. WANTVL = LSAME( JOBVL, 'V' )
  669. WANTVR = LSAME( JOBVR, 'V' )
  670. WNTSNN = LSAME( SENSE, 'N' )
  671. @@ -259,7 +260,7 @@
  672. * the worst case.)
  673. *
  674. MINWRK = 1
  675. - IF( INFO.EQ.0 .AND. ( LWORK.GE.1 .OR. LQUERY ) ) THEN
  676. + IF( INFO.EQ.0 ) THEN
  677. MAXWRK = N + N*ILAENV( 1, 'CGEHRD', ' ', N, 1, N, 0 )
  678. IF( ( .NOT.WANTVL ) .AND. ( .NOT.WANTVR ) ) THEN
  679. MINWRK = MAX( 1, 2*N )
  680. @@ -293,19 +294,17 @@
  681. MAXWRK = MAX( MAXWRK, 2*N, 1 )
  682. END IF
  683. WORK( 1 ) = MAXWRK
  684. + IF( LWORK.LT.MINWRK .AND. LWORK.NE.LQUERV )
  685. + $ INFO = -20
  686. END IF
  687. - IF( LWORK.LT.MINWRK .AND. .NOT.LQUERY ) THEN
  688. - INFO = -20
  689. - END IF
  690. +*
  691. +* Quick returns
  692. +*
  693. IF( INFO.NE.0 ) THEN
  694. CALL XERBLA( 'CGEEVX', -INFO )
  695. RETURN
  696. - ELSE IF( LQUERY ) THEN
  697. - RETURN
  698. END IF
  699. -*
  700. -* Quick return if possible
  701. -*
  702. + IF( LWORK.EQ.LQUERV ) RETURN
  703. IF( N.EQ.0 )
  704. $ RETURN
  705. *
  706. diff -uNr LAPACK.orig/SRC/cgegs.f LAPACK/SRC/cgegs.f
  707. --- LAPACK.orig/SRC/cgegs.f Thu Nov 4 14:24:08 1999
  708. +++ LAPACK/SRC/cgegs.f Fri May 25 16:01:59 2001
  709. @@ -5,7 +5,7 @@
  710. * -- LAPACK driver routine (version 3.0) --
  711. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  712. * Courant Institute, Argonne National Lab, and Rice University
  713. -* June 30, 1999
  714. +* April 26, 2001
  715. *
  716. * .. Scalar Arguments ..
  717. CHARACTER JOBVSL, JOBVSR
  718. @@ -23,83 +23,70 @@
  719. *
  720. * This routine is deprecated and has been replaced by routine CGGES.
  721. *
  722. -* CGEGS computes for a pair of N-by-N complex nonsymmetric matrices A,
  723. -* B: the generalized eigenvalues (alpha, beta), the complex Schur
  724. -* form (A, B), and optionally left and/or right Schur vectors
  725. -* (VSL and VSR).
  726. -*
  727. -* (If only the generalized eigenvalues are needed, use the driver CGEGV
  728. -* instead.)
  729. -*
  730. -* A generalized eigenvalue for a pair of matrices (A,B) is, roughly
  731. -* speaking, a scalar w or a ratio alpha/beta = w, such that A - w*B
  732. -* is singular. It is usually represented as the pair (alpha,beta),
  733. -* as there is a reasonable interpretation for beta=0, and even for
  734. -* both being zero. A good beginning reference is the book, "Matrix
  735. -* Computations", by G. Golub & C. van Loan (Johns Hopkins U. Press)
  736. -*
  737. -* The (generalized) Schur form of a pair of matrices is the result of
  738. -* multiplying both matrices on the left by one unitary matrix and
  739. -* both on the right by another unitary matrix, these two unitary
  740. -* matrices being chosen so as to bring the pair of matrices into
  741. -* upper triangular form with the diagonal elements of B being
  742. -* non-negative real numbers (this is also called complex Schur form.)
  743. -*
  744. -* The left and right Schur vectors are the columns of VSL and VSR,
  745. -* respectively, where VSL and VSR are the unitary matrices
  746. -* which reduce A and B to Schur form:
  747. -*
  748. -* Schur form of (A,B) = ( (VSL)**H A (VSR), (VSL)**H B (VSR) )
  749. +* CGEGS computes the eigenvalues, Schur form, and, optionally, the
  750. +* left and or/right Schur vectors of a complex matrix pair (A,B).
  751. +* Given two square matrices A and B, the generalized Schur
  752. +* factorization has the form
  753. +*
  754. +* A = Q*S*Z**H, B = Q*T*Z**H
  755. +*
  756. +* where Q and Z are unitary matrices and S and T are upper triangular.
  757. +* The columns of Q are the left Schur vectors
  758. +* and the columns of Z are the right Schur vectors.
  759. +*
  760. +* If only the eigenvalues of (A,B) are needed, the driver routine
  761. +* CGEGV should be used instead. See CGEGV for a description of the
  762. +* eigenvalues of the generalized nonsymmetric eigenvalue problem
  763. +* (GNEP).
  764. *
  765. * Arguments
  766. * =========
  767. *
  768. * JOBVSL (input) CHARACTER*1
  769. * = 'N': do not compute the left Schur vectors;
  770. -* = 'V': compute the left Schur vectors.
  771. +* = 'V': compute the left Schur vectors (returned in VSL).
  772. *
  773. * JOBVSR (input) CHARACTER*1
  774. * = 'N': do not compute the right Schur vectors;
  775. -* = 'V': compute the right Schur vectors.
  776. +* = 'V': compute the right Schur vectors (returned in VSR).
  777. *
  778. * N (input) INTEGER
  779. * The order of the matrices A, B, VSL, and VSR. N >= 0.
  780. *
  781. * A (input/output) COMPLEX array, dimension (LDA, N)
  782. -* On entry, the first of the pair of matrices whose generalized
  783. -* eigenvalues and (optionally) Schur vectors are to be
  784. -* computed.
  785. -* On exit, the generalized Schur form of A.
  786. +* On entry, the matrix A.
  787. +* On exit, the upper triangular matrix S from the generalized
  788. +* Schur factorization.
  789. *
  790. * LDA (input) INTEGER
  791. * The leading dimension of A. LDA >= max(1,N).
  792. *
  793. * B (input/output) COMPLEX array, dimension (LDB, N)
  794. -* On entry, the second of the pair of matrices whose
  795. -* generalized eigenvalues and (optionally) Schur vectors are
  796. -* to be computed.
  797. -* On exit, the generalized Schur form of B.
  798. +* On entry, the matrix B.
  799. +* On exit, the upper triangular matrix T from the generalized
  800. +* Schur factorization.
  801. *
  802. * LDB (input) INTEGER
  803. * The leading dimension of B. LDB >= max(1,N).
  804. *
  805. * ALPHA (output) COMPLEX array, dimension (N)
  806. +* The complex scalars alpha that define the eigenvalues of
  807. +* GNEP. ALPHA(j) = S(j,j), the diagonal element of the Schur
  808. +* form of A.
  809. +*
  810. * BETA (output) COMPLEX array, dimension (N)
  811. -* On exit, ALPHA(j)/BETA(j), j=1,...,N, will be the
  812. -* generalized eigenvalues. ALPHA(j), j=1,...,N and BETA(j),
  813. -* j=1,...,N are the diagonals of the complex Schur form (A,B)
  814. -* output by CGEGS. The BETA(j) will be non-negative real.
  815. -*
  816. -* Note: the quotients ALPHA(j)/BETA(j) may easily over- or
  817. -* underflow, and BETA(j) may even be zero. Thus, the user
  818. -* should avoid naively computing the ratio alpha/beta.
  819. -* However, ALPHA will be always less than and usually
  820. -* comparable with norm(A) in magnitude, and BETA always less
  821. -* than and usually comparable with norm(B).
  822. +* The non-negative real scalars beta that define the
  823. +* eigenvalues of GNEP. BETA(j) = T(j,j), the diagonal element
  824. +* of the triangular factor T.
  825. +*
  826. +* Together, the quantities alpha = ALPHA(j) and beta = BETA(j)
  827. +* represent the j-th eigenvalue of the matrix pair (A,B), in
  828. +* one of the forms lambda = alpha/beta or mu = beta/alpha.
  829. +* Since either lambda or mu may overflow, they should not,
  830. +* in general, be computed.
  831. *
  832. * VSL (output) COMPLEX array, dimension (LDVSL,N)
  833. -* If JOBVSL = 'V', VSL will contain the left Schur vectors.
  834. -* (See "Purpose", above.)
  835. +* If JOBVSL = 'V', the matrix of left Schur vectors Q.
  836. * Not referenced if JOBVSL = 'N'.
  837. *
  838. * LDVSL (input) INTEGER
  839. @@ -107,8 +94,7 @@
  840. * if JOBVSL = 'V', LDVSL >= N.
  841. *
  842. * VSR (output) COMPLEX array, dimension (LDVSR,N)
  843. -* If JOBVSR = 'V', VSR will contain the right Schur vectors.
  844. -* (See "Purpose", above.)
  845. +* If JOBVSR = 'V', the matrix of right Schur vectors Z.
  846. * Not referenced if JOBVSR = 'N'.
  847. *
  848. * LDVSR (input) INTEGER
  849. diff -uNr LAPACK.orig/SRC/cgegv.f LAPACK/SRC/cgegv.f
  850. --- LAPACK.orig/SRC/cgegv.f Thu Nov 4 14:24:08 1999
  851. +++ LAPACK/SRC/cgegv.f Fri May 25 16:02:21 2001
  852. @@ -4,7 +4,7 @@
  853. * -- LAPACK driver routine (version 3.0) --
  854. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  855. * Courant Institute, Argonne National Lab, and Rice University
  856. -* June 30, 1999
  857. +* April 26, 2001
  858. *
  859. * .. Scalar Arguments ..
  860. CHARACTER JOBVL, JOBVR
  861. @@ -22,22 +22,28 @@
  862. *
  863. * This routine is deprecated and has been replaced by routine CGGEV.
  864. *
  865. -* CGEGV computes for a pair of N-by-N complex nonsymmetric matrices A
  866. -* and B, the generalized eigenvalues (alpha, beta), and optionally,
  867. -* the left and/or right generalized eigenvectors (VL and VR).
  868. -*
  869. -* A generalized eigenvalue for a pair of matrices (A,B) is, roughly
  870. -* speaking, a scalar w or a ratio alpha/beta = w, such that A - w*B
  871. -* is singular. It is usually represented as the pair (alpha,beta),
  872. -* as there is a reasonable interpretation for beta=0, and even for
  873. -* both being zero. A good beginning reference is the book, "Matrix
  874. -* Computations", by G. Golub & C. van Loan (Johns Hopkins U. Press)
  875. -*
  876. -* A right generalized eigenvector corresponding to a generalized
  877. -* eigenvalue w for a pair of matrices (A,B) is a vector r such
  878. -* that (A - w B) r = 0 . A left generalized eigenvector is a vector
  879. -* l such that l**H * (A - w B) = 0, where l**H is the
  880. -* conjugate-transpose of l.
  881. +* CGEGV computes the eigenvalues and, optionally, the left and/or right
  882. +* eigenvectors of a complex matrix pair (A,B).
  883. +* Given two square matrices A and B,
  884. +* the generalized nonsymmetric eigenvalue problem (GNEP) is to find the
  885. +* eigenvalues lambda and corresponding (non-zero) eigenvectors x such
  886. +* that
  887. +* A*x = lambda*B*x.
  888. +*
  889. +* An alternate form is to find the eigenvalues mu and corresponding
  890. +* eigenvectors y such that
  891. +* mu*A*y = B*y.
  892. +*
  893. +* These two forms are equivalent with mu = 1/lambda and x = y if
  894. +* neither lambda nor mu is zero. In order to deal with the case that
  895. +* lambda or mu is zero or small, two values alpha and beta are returned
  896. +* for each eigenvalue, such that lambda = alpha/beta and
  897. +* mu = beta/alpha.
  898. +*
  899. +* The vectors x and y in the above equations are right eigenvectors of
  900. +* the matrix pair (A,B). Vectors u and v satisfying
  901. +* u**H*A = lambda*u**H*B or mu*v**H*A = v**H*B
  902. +* are left eigenvectors of (A,B).
  903. *
  904. * Note: this routine performs "full balancing" on A and B -- see
  905. * "Further Details", below.
  906. @@ -47,56 +53,62 @@
  907. *
  908. * JOBVL (input) CHARACTER*1
  909. * = 'N': do not compute the left generalized eigenvectors;
  910. -* = 'V': compute the left generalized eigenvectors.
  911. +* = 'V': compute the left generalized eigenvectors (returned
  912. +* in VL).
  913. *
  914. * JOBVR (input) CHARACTER*1
  915. * = 'N': do not compute the right generalized eigenvectors;
  916. -* = 'V': compute the right generalized eigenvectors.
  917. +* = 'V': compute the right generalized eigenvectors (returned
  918. +* in VR).
  919. *
  920. * N (input) INTEGER
  921. * The order of the matrices A, B, VL, and VR. N >= 0.
  922. *
  923. * A (input/output) COMPLEX array, dimension (LDA, N)
  924. -* On entry, the first of the pair of matrices whose
  925. -* generalized eigenvalues and (optionally) generalized
  926. -* eigenvectors are to be computed.
  927. -* On exit, the contents will have been destroyed. (For a
  928. -* description of the contents of A on exit, see "Further
  929. -* Details", below.)
  930. +* On entry, the matrix A.
  931. +* If JOBVL = 'V' or JOBVR = 'V', then on exit A
  932. +* contains the Schur form of A from the generalized Schur
  933. +* factorization of the pair (A,B) after balancing. If no
  934. +* eigenvectors were computed, then only the diagonal elements
  935. +* of the Schur form will be correct. See CGGHRD and CHGEQZ
  936. +* for details.
  937. *
  938. * LDA (input) INTEGER
  939. * The leading dimension of A. LDA >= max(1,N).
  940. *
  941. * B (input/output) COMPLEX array, dimension (LDB, N)
  942. -* On entry, the second of the pair of matrices whose
  943. -* generalized eigenvalues and (optionally) generalized
  944. -* eigenvectors are to be computed.
  945. -* On exit, the contents will have been destroyed. (For a
  946. -* description of the contents of B on exit, see "Further
  947. -* Details", below.)
  948. +* On entry, the matrix B.
  949. +* If JOBVL = 'V' or JOBVR = 'V', then on exit B contains the
  950. +* upper triangular matrix obtained from B in the generalized
  951. +* Schur factorization of the pair (A,B) after balancing.
  952. +* If no eigenvectors were computed, then only the diagonal
  953. +* elements of B will be correct. See CGGHRD and CHGEQZ for
  954. +* details.
  955. *
  956. * LDB (input) INTEGER
  957. * The leading dimension of B. LDB >= max(1,N).
  958. *
  959. * ALPHA (output) COMPLEX array, dimension (N)
  960. -* BETA (output) COMPLEX array, dimension (N)
  961. -* On exit, ALPHA(j)/BETA(j), j=1,...,N, will be the
  962. -* generalized eigenvalues.
  963. +* The complex scalars alpha that define the eigenvalues of
  964. +* GNEP.
  965. *
  966. -* Note: the quotients ALPHA(j)/BETA(j) may easily over- or
  967. -* underflow, and BETA(j) may even be zero. Thus, the user
  968. -* should avoid naively computing the ratio alpha/beta.
  969. -* However, ALPHA will be always less than and usually
  970. -* comparable with norm(A) in magnitude, and BETA always less
  971. -* than and usually comparable with norm(B).
  972. +* BETA (output) COMPLEX array, dimension (N)
  973. +* The complex scalars beta that define the eigenvalues of GNEP.
  974. +*
  975. +* Together, the quantities alpha = ALPHA(j) and beta = BETA(j)
  976. +* represent the j-th eigenvalue of the matrix pair (A,B), in
  977. +* one of the forms lambda = alpha/beta or mu = beta/alpha.
  978. +* Since either lambda or mu may overflow, they should not,
  979. +* in general, be computed.
  980. +
  981. *
  982. * VL (output) COMPLEX array, dimension (LDVL,N)
  983. -* If JOBVL = 'V', the left generalized eigenvectors. (See
  984. -* "Purpose", above.)
  985. -* Each eigenvector will be scaled so the largest component
  986. -* will have abs(real part) + abs(imag. part) = 1, *except*
  987. -* that for eigenvalues with alpha=beta=0, a zero vector will
  988. -* be returned as the corresponding eigenvector.
  989. +* If JOBVL = 'V', the left eigenvectors u(j) are stored
  990. +* in the columns of VL, in the same order as their eigenvalues.
  991. +* Each eigenvector is scaled so that its largest component has
  992. +* abs(real part) + abs(imag. part) = 1, except for eigenvectors
  993. +* corresponding to an eigenvalue with alpha = beta = 0, which
  994. +* are set to zero.
  995. * Not referenced if JOBVL = 'N'.
  996. *
  997. * LDVL (input) INTEGER
  998. @@ -104,12 +116,12 @@
  999. * if JOBVL = 'V', LDVL >= N.
  1000. *
  1001. * VR (output) COMPLEX array, dimension (LDVR,N)
  1002. -* If JOBVR = 'V', the right generalized eigenvectors. (See
  1003. -* "Purpose", above.)
  1004. -* Each eigenvector will be scaled so the largest component
  1005. -* will have abs(real part) + abs(imag. part) = 1, *except*
  1006. -* that for eigenvalues with alpha=beta=0, a zero vector will
  1007. -* be returned as the corresponding eigenvector.
  1008. +* If JOBVR = 'V', the right eigenvectors x(j) are stored
  1009. +* in the columns of VR, in the same order as their eigenvalues.
  1010. +* Each eigenvector is scaled so that its largest component has
  1011. +* abs(real part) + abs(imag. part) = 1, except for eigenvectors
  1012. +* corresponding to an eigenvalue with alpha = beta = 0, which
  1013. +* are set to zero.
  1014. * Not referenced if JOBVR = 'N'.
  1015. *
  1016. * LDVR (input) INTEGER
  1017. diff -uNr LAPACK.orig/SRC/cgelsd.f LAPACK/SRC/cgelsd.f
  1018. --- LAPACK.orig/SRC/cgelsd.f Thu Nov 4 14:26:25 1999
  1019. +++ LAPACK/SRC/cgelsd.f Fri May 25 16:03:27 2001
  1020. @@ -4,7 +4,8 @@
  1021. * -- LAPACK driver routine (version 3.0) --
  1022. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  1023. * Courant Institute, Argonne National Lab, and Rice University
  1024. -* October 31, 1999
  1025. +* June 30, 1999
  1026. +* 8-15-00: Improve consistency of WS calculations (eca)
  1027. *
  1028. * .. Scalar Arguments ..
  1029. INTEGER INFO, LDA, LDB, LWORK, M, N, NRHS, RANK
  1030. @@ -64,7 +65,8 @@
  1031. *
  1032. * A (input/output) COMPLEX array, dimension (LDA,N)
  1033. * On entry, the M-by-N matrix A.
  1034. -* On exit, A has been destroyed.
  1035. +* On exit, the first min(m,n) rows of A are overwritten with
  1036. +* its right singular vectors, stored rowwise.
  1037. *
  1038. * LDA (input) INTEGER
  1039. * The leading dimension of the array A. LDA >= max(1,M).
  1040. @@ -96,32 +98,24 @@
  1041. * On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
  1042. *
  1043. * LWORK (input) INTEGER
  1044. -* The dimension of the array WORK. LWORK must be at least 1.
  1045. +* The dimension of the array WORK. LWORK >= 1.
  1046. * The exact minimum amount of workspace needed depends on M,
  1047. -* N and NRHS. As long as LWORK is at least
  1048. -* 2 * N + N * NRHS
  1049. -* if M is greater than or equal to N or
  1050. -* 2 * M + M * NRHS
  1051. -* if M is less than N, the code will execute correctly.
  1052. +* N and NRHS.
  1053. +* If M >= N, LWORK >= 2*N + N*NRHS.
  1054. +* If M < N, LWORK >= 2*M + M*NRHS.
  1055. * For good performance, LWORK should generally be larger.
  1056. *
  1057. -* If LWORK = -1, then a workspace query is assumed; the routine
  1058. -* only calculates the optimal size of the WORK array, returns
  1059. -* this value as the first entry of the WORK array, and no error
  1060. -* message related to LWORK is issued by XERBLA.
  1061. -*
  1062. -*
  1063. -* RWORK (workspace) REAL array, dimension at least
  1064. -* 10*N + 2*N*SMLSIZ + 8*N*NLVL + 3*SMLSIZ*NRHS +
  1065. -* (SMLSIZ+1)**2
  1066. -* if M is greater than or equal to N or
  1067. -* 10*M + 2*M*SMLSIZ + 8*M*NLVL + 3*SMLSIZ*NRHS +
  1068. -* (SMLSIZ+1)**2
  1069. -* if M is less than N, the code will execute correctly.
  1070. +* If LWORK = -1, a workspace query is assumed. The optimal
  1071. +* size for the WORK array is calculated and stored in WORK(1),
  1072. +* and no other work except argument checking is performed.
  1073. +*
  1074. +* RWORK (workspace) REAL array, dimension (LRWORK)
  1075. +* If M >= N, LRWORK >= 8*N + 2*N*SMLSIZ + 8*N*NLVL + N*NRHS.
  1076. +* If M < N, LRWORK >= 8*M + 2*M*SMLSIZ + 8*M*NLVL + M*NRHS.
  1077. * SMLSIZ is returned by ILAENV and is equal to the maximum
  1078. * size of the subproblems at the bottom of the computation
  1079. * tree (usually about 25), and
  1080. -* NLVL = MAX( 0, INT( LOG_2( MIN( M,N )/(SMLSIZ+1) ) ) + 1 )
  1081. +* NLVL = INT( LOG_2( MIN( M,N )/(SMLSIZ+1) ) ) + 1
  1082. *
  1083. * IWORK (workspace) INTEGER array, dimension (LIWORK)
  1084. * LIWORK >= 3 * MINMN * NLVL + 11 * MINMN,
  1085. @@ -145,13 +139,14 @@
  1086. * =====================================================================
  1087. *
  1088. * .. Parameters ..
  1089. + INTEGER LQUERV
  1090. + PARAMETER ( LQUERV = -1 )
  1091. REAL ZERO, ONE
  1092. PARAMETER ( ZERO = 0.0E+0, ONE = 1.0E+0 )
  1093. COMPLEX CZERO
  1094. PARAMETER ( CZERO = ( 0.0E+0, 0.0E+0 ) )
  1095. * ..
  1096. * .. Local Scalars ..
  1097. - LOGICAL LQUERY
  1098. INTEGER IASCL, IBSCL, IE, IL, ITAU, ITAUP, ITAUQ,
  1099. $ LDWORK, MAXMN, MAXWRK, MINMN, MINWRK, MM,
  1100. $ MNTHR, NRWORK, NWORK, SMLSIZ
  1101. @@ -179,7 +174,6 @@
  1102. MINMN = MIN( M, N )
  1103. MAXMN = MAX( M, N )
  1104. MNTHR = ILAENV( 6, 'CGELSD', ' ', M, N, NRHS, -1 )
  1105. - LQUERY = ( LWORK.EQ.-1 )
  1106. IF( M.LT.0 ) THEN
  1107. INFO = -1
  1108. ELSE IF( N.LT.0 ) THEN
  1109. @@ -263,20 +257,17 @@
  1110. END IF
  1111. MINWRK = MIN( MINWRK, MAXWRK )
  1112. WORK( 1 ) = CMPLX( MAXWRK, 0 )
  1113. - IF( LWORK.LT.MINWRK .AND. .NOT.LQUERY ) THEN
  1114. - INFO = -12
  1115. - END IF
  1116. + IF( LWORK.LT.MINWRK .AND. LWORK.NE.LQUERV )
  1117. + $ INFO = -12
  1118. END IF
  1119. *
  1120. +* Quick returns
  1121. +*
  1122. IF( INFO.NE.0 ) THEN
  1123. CALL XERBLA( 'CGELSD', -INFO )
  1124. RETURN
  1125. - ELSE IF( LQUERY ) THEN
  1126. - GO TO 10
  1127. END IF
  1128. -*
  1129. -* Quick return if possible.
  1130. -*
  1131. + IF( LWORK.EQ.LQUERV ) RETURN
  1132. IF( M.EQ.0 .OR. N.EQ.0 ) THEN
  1133. RANK = 0
  1134. RETURN
  1135. diff -uNr LAPACK.orig/SRC/cgelss.f LAPACK/SRC/cgelss.f
  1136. --- LAPACK.orig/SRC/cgelss.f Thu Nov 4 14:24:09 1999
  1137. +++ LAPACK/SRC/cgelss.f Fri May 25 16:03:50 2001
  1138. @@ -4,7 +4,7 @@
  1139. * -- LAPACK driver routine (version 3.0) --
  1140. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  1141. * Courant Institute, Argonne National Lab, and Rice University
  1142. -* October 31, 1999
  1143. +* April 25, 2001
  1144. *
  1145. * .. Scalar Arguments ..
  1146. INTEGER INFO, LDA, LDB, LWORK, M, N, NRHS, RANK
  1147. @@ -87,10 +87,9 @@
  1148. * LWORK >= 2*min(M,N) + max(M,N,NRHS)
  1149. * For good performance, LWORK should generally be larger.
  1150. *
  1151. -* If LWORK = -1, then a workspace query is assumed; the routine
  1152. -* only calculates the optimal size of the WORK array, returns
  1153. -* this value as the first entry of the WORK array, and no error
  1154. -* message related to LWORK is issued by XERBLA.
  1155. +* If LWORK = -1, a workspace query is assumed. The optimal
  1156. +* size for the WORK array is calculated and stored in WORK(1),
  1157. +* and no other work except argument checking is performed.
  1158. *
  1159. * RWORK (workspace) REAL array, dimension (5*min(M,N))
  1160. *
  1161. @@ -164,7 +163,7 @@
  1162. * immediately following subroutine, as returned by ILAENV.)
  1163. *
  1164. MINWRK = 1
  1165. - IF( INFO.EQ.0 .AND. ( LWORK.GE.1 .OR. LQUERY ) ) THEN
  1166. + IF( INFO.EQ.0 ) THEN
  1167. MAXWRK = 0
  1168. MM = M
  1169. IF( M.GE.N .AND. M.GE.MNTHR ) THEN
  1170. @@ -235,19 +234,18 @@
  1171. MINWRK = MAX( MINWRK, 1 )
  1172. MAXWRK = MAX( MINWRK, MAXWRK )
  1173. WORK( 1 ) = MAXWRK
  1174. + IF( LWORK.LT.MINWRK .AND. .NOT.LQUERY )
  1175. + $ INFO = -12
  1176. END IF
  1177. *
  1178. - IF( LWORK.LT.MINWRK .AND. .NOT.LQUERY )
  1179. - $ INFO = -12
  1180. +* Quick returns
  1181. +*
  1182. IF( INFO.NE.0 ) THEN
  1183. CALL XERBLA( 'CGELSS', -INFO )
  1184. RETURN
  1185. ELSE IF( LQUERY ) THEN
  1186. RETURN
  1187. END IF
  1188. -*
  1189. -* Quick return if possible
  1190. -*
  1191. IF( M.EQ.0 .OR. N.EQ.0 ) THEN
  1192. RANK = 0
  1193. RETURN
  1194. @@ -512,8 +510,8 @@
  1195. DO 40 I = 1, NRHS, CHUNK
  1196. BL = MIN( NRHS-I+1, CHUNK )
  1197. CALL CGEMM( 'C', 'N', M, BL, M, CONE, WORK( IL ), LDWORK,
  1198. - $ B( 1, I ), LDB, CZERO, WORK( IWORK ), N )
  1199. - CALL CLACPY( 'G', M, BL, WORK( IWORK ), N, B( 1, I ),
  1200. + $ B( 1, I ), LDB, CZERO, WORK( IWORK ), M )
  1201. + CALL CLACPY( 'G', M, BL, WORK( IWORK ), M, B( 1, I ),
  1202. $ LDB )
  1203. 40 CONTINUE
  1204. ELSE
  1205. diff -uNr LAPACK.orig/SRC/cgesdd.f LAPACK/SRC/cgesdd.f
  1206. --- LAPACK.orig/SRC/cgesdd.f Thu Nov 11 20:32:54 1999
  1207. +++ LAPACK/SRC/cgesdd.f Fri May 25 16:08:03 2001
  1208. @@ -1,10 +1,11 @@
  1209. - SUBROUTINE CGESDD( JOBZ, M, N, A, LDA, S, U, LDU, VT, LDVT, WORK,
  1210. - $ LWORK, RWORK, IWORK, INFO )
  1211. + SUBROUTINE CGESDD( JOBZ, M, N, A, LDA, S, U, LDU, VT, LDVT,
  1212. + $ WORK, LWORK, RWORK, IWORK, INFO )
  1213. *
  1214. * -- LAPACK driver routine (version 3.0) --
  1215. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  1216. * Courant Institute, Argonne National Lab, and Rice University
  1217. -* October 31, 1999
  1218. +* June 30, 1999
  1219. +* 8-15-00: Improve consistency of WS calculations (eca)
  1220. *
  1221. * .. Scalar Arguments ..
  1222. CHARACTER JOBZ
  1223. @@ -119,12 +120,14 @@
  1224. * if JOBZ = 'S' or 'A',
  1225. * LWORK >= min(M,N)*min(M,N)+2*min(M,N)+max(M,N).
  1226. * For good performance, LWORK should generally be larger.
  1227. -* If LWORK < 0 but other input arguments are legal, WORK(1)
  1228. -* returns the optimal LWORK.
  1229. +*
  1230. +* If LWORK = -1, a workspace query is assumed. The optimal
  1231. +* size for the WORK array is calculated and stored in WORK(1),
  1232. +* and no other work except argument checking is performed.
  1233. *
  1234. * RWORK (workspace) REAL array, dimension (LRWORK)
  1235. -* If JOBZ = 'N', LRWORK >= 7*min(M,N).
  1236. -* Otherwise, LRWORK >= 5*min(M,N)*min(M,N) + 5*min(M,N)
  1237. +* If JOBZ = 'N', LRWORK >= 5*min(M,N).
  1238. +* Otherwise, LRWORK >= 5*min(M,N)*min(M,N) + 7*min(M,N)
  1239. *
  1240. * IWORK (workspace) INTEGER array, dimension (8*min(M,N))
  1241. *
  1242. @@ -143,14 +146,16 @@
  1243. * =====================================================================
  1244. *
  1245. * .. Parameters ..
  1246. + INTEGER LQUERV
  1247. + PARAMETER ( LQUERV = -1 )
  1248. COMPLEX CZERO, CONE
  1249. - PARAMETER ( CZERO = ( 0.0E0, 0.0E0 ),
  1250. - $ CONE = ( 1.0E0, 0.0E0 ) )
  1251. + PARAMETER ( CZERO = ( 0.0E+0, 0.0E+0 ),
  1252. + $ CONE = ( 1.0E+0, 0.0E+0 ) )
  1253. REAL ZERO, ONE
  1254. - PARAMETER ( ZERO = 0.0E0, ONE = 1.0E0 )
  1255. + PARAMETER ( ZERO = 0.0E+0, ONE = 1.0E+0 )
  1256. * ..
  1257. * .. Local Scalars ..
  1258. - LOGICAL LQUERY, WNTQA, WNTQAS, WNTQN, WNTQO, WNTQS
  1259. + LOGICAL WNTQA, WNTQAS, WNTQN, WNTQO, WNTQS
  1260. INTEGER BLK, CHUNK, I, IE, IERR, IL, IR, IRU, IRVT,
  1261. $ ISCL, ITAU, ITAUP, ITAUQ, IU, IVT, LDWKVT,
  1262. $ LDWRKL, LDWRKR, LDWRKU, MAXWRK, MINMN, MINWRK,
  1263. @@ -162,15 +167,17 @@
  1264. REAL DUM( 1 )
  1265. * ..
  1266. * .. External Subroutines ..
  1267. - EXTERNAL CGEBRD, CGELQF, CGEMM, CGEQRF, CLACP2, CLACPY,
  1268. - $ CLACRM, CLARCM, CLASCL, CLASET, CUNGBR, CUNGLQ,
  1269. - $ CUNGQR, CUNMBR, SBDSDC, SLASCL, XERBLA
  1270. + EXTERNAL CGEBRD, CGELQF, CGEMM, CGEQRF,
  1271. + $ CLACP2, CLACPY, CLACRM, CLARCM,
  1272. + $ CLASCL, CLASET, CUNGBR, CUNGLQ,
  1273. + $ CUNGQR, CUNMBR, SBDSDC, SLASCL,
  1274. + $ XERBLA
  1275. * ..
  1276. * .. External Functions ..
  1277. LOGICAL LSAME
  1278. INTEGER ILAENV
  1279. REAL CLANGE, SLAMCH
  1280. - EXTERNAL CLANGE, ILAENV, LSAME, SLAMCH
  1281. + EXTERNAL CLANGE, SLAMCH, ILAENV, LSAME
  1282. * ..
  1283. * .. Intrinsic Functions ..
  1284. INTRINSIC INT, MAX, MIN, SQRT
  1285. @@ -181,8 +188,8 @@
  1286. *
  1287. INFO = 0
  1288. MINMN = MIN( M, N )
  1289. - MNTHR1 = INT( MINMN*17.0E0 / 9.0E0 )
  1290. - MNTHR2 = INT( MINMN*5.0E0 / 3.0E0 )
  1291. + MNTHR1 = INT( MINMN*17.0 / 9.0 )
  1292. + MNTHR2 = INT( MINMN*5.0 / 3.0 )
  1293. WNTQA = LSAME( JOBZ, 'A' )
  1294. WNTQS = LSAME( JOBZ, 'S' )
  1295. WNTQAS = WNTQA .OR. WNTQS
  1296. @@ -190,7 +197,6 @@
  1297. WNTQN = LSAME( JOBZ, 'N' )
  1298. MINWRK = 1
  1299. MAXWRK = 1
  1300. - LQUERY = ( LWORK.EQ.-1 )
  1301. *
  1302. IF( .NOT.( WNTQA .OR. WNTQS .OR. WNTQO .OR. WNTQN ) ) THEN
  1303. INFO = -1
  1304. @@ -221,19 +227,21 @@
  1305. IF( M.GE.N ) THEN
  1306. *
  1307. * There is no complex work space needed for bidiagonal SVD
  1308. -* The real work space needed for bidiagonal SVD is BDSPAC,
  1309. -* BDSPAC = 3*N*N + 4*N
  1310. +* The real work space needed for bidiagonal SVD is BDSPAC
  1311. +* for computing singular values and singular vectors; BDSPAN
  1312. +* for computing singular values only.
  1313. +* BDSPAC = 5*N*N + 7*N
  1314. +* BDSPAN = MAX(7*N+4, 3*N+2+SMLSIZ*(SMLSIZ+8))
  1315. *
  1316. IF( M.GE.MNTHR1 ) THEN
  1317. IF( WNTQN ) THEN
  1318. *
  1319. * Path 1 (M much larger than N, JOBZ='N')
  1320. *
  1321. - WRKBL = N + N*ILAENV( 1, 'CGEQRF', ' ', M, N, -1,
  1322. - $ -1 )
  1323. - WRKBL = MAX( WRKBL, 2*N+2*N*
  1324. - $ ILAENV( 1, 'CGEBRD', ' ', N, N, -1, -1 ) )
  1325. - MAXWRK = WRKBL
  1326. + MAXWRK = N + N*ILAENV( 1, 'CGEQRF', ' ', M, N, -1,
  1327. + $ -1 )
  1328. + MAXWRK = MAX( MAXWRK, 2*N+2*N*
  1329. + $ ILAENV( 1, 'CGEBRD', ' ', N, N, -1, -1 ) )
  1330. MINWRK = 3*N
  1331. ELSE IF( WNTQO ) THEN
  1332. *
  1333. @@ -335,8 +343,11 @@
  1334. ELSE
  1335. *
  1336. * There is no complex work space needed for bidiagonal SVD
  1337. -* The real work space needed for bidiagonal SVD is BDSPAC,
  1338. -* BDSPAC = 3*M*M + 4*M
  1339. +* The real work space needed for bidiagonal SVD is BDSPAC
  1340. +* for computing singular values and singular vectors; BDSPAN
  1341. +* for computing singular values only.
  1342. +* BDSPAC = 5*M*M + 7*M
  1343. +* BDSPAN = MAX(7*M+4, 3*M+2+SMLSIZ*(SMLSIZ+8))
  1344. *
  1345. IF( N.GE.MNTHR1 ) THEN
  1346. IF( WNTQN ) THEN
  1347. @@ -447,24 +458,21 @@
  1348. END IF
  1349. END IF
  1350. MAXWRK = MAX( MAXWRK, MINWRK )
  1351. + END IF
  1352. + IF( INFO.EQ.0 ) THEN
  1353. WORK( 1 ) = MAXWRK
  1354. + IF( LWORK.LT.MINWRK .AND. LWORK.NE.LQUERV )
  1355. + $ INFO = -13
  1356. END IF
  1357. *
  1358. - IF( LWORK.LT.MINWRK .AND. .NOT.LQUERY ) THEN
  1359. - INFO = -13
  1360. - END IF
  1361. +* Quick returns
  1362. +*
  1363. IF( INFO.NE.0 ) THEN
  1364. CALL XERBLA( 'CGESDD', -INFO )
  1365. RETURN
  1366. - ELSE IF( LQUERY ) THEN
  1367. - RETURN
  1368. END IF
  1369. -*
  1370. -* Quick return if possible
  1371. -*
  1372. + IF( LWORK.EQ.LQUERV ) RETURN
  1373. IF( M.EQ.0 .OR. N.EQ.0 ) THEN
  1374. - IF( LWORK.GE.1 )
  1375. - $ WORK( 1 ) = ONE
  1376. RETURN
  1377. END IF
  1378. *
  1379. @@ -529,7 +537,7 @@
  1380. *
  1381. * Perform bidiagonal SVD, compute singular values only
  1382. * (CWorkspace: 0)
  1383. -* (RWorkspace: need BDSPAC)
  1384. +* (RWorkspace: need BDSPAN)
  1385. *
  1386. CALL SBDSDC( 'U', 'N', N, S, RWORK( IE ), DUM, 1, DUM, 1,
  1387. $ DUM, IDUM, RWORK( NRWORK ), IWORK, INFO )
  1388. @@ -844,7 +852,7 @@
  1389. *
  1390. * Compute singular values only
  1391. * (Cworkspace: 0)
  1392. -* (Rworkspace: need BDSPAC)
  1393. +* (Rworkspace: need BDSPAN)
  1394. *
  1395. CALL SBDSDC( 'U', 'N', N, S, RWORK( IE ), DUM, 1, DUM, 1,
  1396. $ DUM, IDUM, RWORK( NRWORK ), IWORK, INFO )
  1397. @@ -1040,7 +1048,7 @@
  1398. *
  1399. * Compute singular values only
  1400. * (Cworkspace: 0)
  1401. -* (Rworkspace: need BDSPAC)
  1402. +* (Rworkspace: need BDSPAN)
  1403. *
  1404. CALL SBDSDC( 'U', 'N', N, S, RWORK( IE ), DUM, 1, DUM, 1,
  1405. $ DUM, IDUM, RWORK( NRWORK ), IWORK, INFO )
  1406. @@ -1205,8 +1213,8 @@
  1407. ELSE
  1408. *
  1409. * A has more columns than rows. If A has sufficiently more
  1410. -* columns than rows, first reduce using the LQ decomposition
  1411. -* (if sufficient workspace available)
  1412. +* columns than rows, first reduce using the LQ decomposition (if
  1413. +* sufficient workspace available)
  1414. *
  1415. IF( N.GE.MNTHR1 ) THEN
  1416. *
  1417. @@ -1245,7 +1253,7 @@
  1418. *
  1419. * Perform bidiagonal SVD, compute singular values only
  1420. * (CWorkspace: 0)
  1421. -* (RWorkspace: need BDSPAC)
  1422. +* (RWorkspace: need BDSPAN)
  1423. *
  1424. CALL SBDSDC( 'U', 'N', M, S, RWORK( IE ), DUM, 1, DUM, 1,
  1425. $ DUM, IDUM, RWORK( NRWORK ), IWORK, INFO )
  1426. @@ -1531,8 +1539,8 @@
  1427. * (CWorkspace: need M*M)
  1428. * (RWorkspace: 0)
  1429. *
  1430. - CALL CGEMM( 'N', 'N', M, N, M, CONE, WORK( IVT ), LDWKVT,
  1431. - $ VT, LDVT, CZERO, A, LDA )
  1432. + CALL CGEMM( 'N', 'N', M, N, M, CONE, WORK( IVT ),
  1433. + $ LDWKVT, VT, LDVT, CZERO, A, LDA )
  1434. *
  1435. * Copy right singular vectors of A from A to VT
  1436. *
  1437. @@ -1567,7 +1575,7 @@
  1438. *
  1439. * Compute singular values only
  1440. * (Cworkspace: 0)
  1441. -* (Rworkspace: need BDSPAC)
  1442. +* (Rworkspace: need BDSPAN)
  1443. *
  1444. CALL SBDSDC( 'L', 'N', M, S, RWORK( IE ), DUM, 1, DUM, 1,
  1445. $ DUM, IDUM, RWORK( NRWORK ), IWORK, INFO )
  1446. @@ -1763,7 +1771,7 @@
  1447. *
  1448. * Compute singular values only
  1449. * (Cworkspace: 0)
  1450. -* (Rworkspace: need BDSPAC)
  1451. +* (Rworkspace: need BDSPAN)
  1452. *
  1453. CALL SBDSDC( 'L', 'N', M, S, RWORK( IE ), DUM, 1, DUM, 1,
  1454. $ DUM, IDUM, RWORK( NRWORK ), IWORK, INFO )
  1455. @@ -1934,9 +1942,15 @@
  1456. IF( ANRM.GT.BIGNUM )
  1457. $ CALL SLASCL( 'G', 0, 0, BIGNUM, ANRM, MINMN, 1, S, MINMN,
  1458. $ IERR )
  1459. + IF( INFO.NE.0 .AND. ANRM.GT.BIGNUM )
  1460. + $ CALL SLASCL( 'G', 0, 0, BIGNUM, ANRM, MINMN-1, 1,
  1461. + $ RWORK( IE ), MINMN, IERR )
  1462. IF( ANRM.LT.SMLNUM )
  1463. $ CALL SLASCL( 'G', 0, 0, SMLNUM, ANRM, MINMN, 1, S, MINMN,
  1464. $ IERR )
  1465. + IF( INFO.NE.0 .AND. ANRM.LT.SMLNUM )
  1466. + $ CALL SLASCL( 'G', 0, 0, SMLNUM, ANRM, MINMN-1, 1,
  1467. + $ RWORK( IE ), MINMN, IERR )
  1468. END IF
  1469. *
  1470. * Return optimal workspace in WORK(1)
  1471. diff -uNr LAPACK.orig/SRC/cgesvd.f LAPACK/SRC/cgesvd.f
  1472. --- LAPACK.orig/SRC/cgesvd.f Thu Nov 4 14:24:09 1999
  1473. +++ LAPACK/SRC/cgesvd.f Fri May 25 16:08:29 2001
  1474. @@ -4,7 +4,8 @@
  1475. * -- LAPACK driver routine (version 3.0) --
  1476. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  1477. * Courant Institute, Argonne National Lab, and Rice University
  1478. -* October 31, 1999
  1479. +* June 30, 1999
  1480. +* 8-15-00: Improve consistency of WS calculations (eca)
  1481. *
  1482. * .. Scalar Arguments ..
  1483. CHARACTER JOBU, JOBVT
  1484. @@ -114,12 +115,12 @@
  1485. * LWORK >= 2*MIN(M,N)+MAX(M,N).
  1486. * For good performance, LWORK should generally be larger.
  1487. *
  1488. -* If LWORK = -1, then a workspace query is assumed; the routine
  1489. -* only calculates the optimal size of the WORK array, returns
  1490. -* this value as the first entry of the WORK array, and no error
  1491. -* message related to LWORK is issued by XERBLA.
  1492. +* If LWORK = -1, a workspace query is assumed. The optimal
  1493. +* size for the WORK array is calculated and stored in WORK(1),
  1494. +* and no other work except argument checking is performed.
  1495. *
  1496. -* RWORK (workspace) REAL array, dimension (5*min(M,N))
  1497. +* RWORK (workspace) REAL array, dimension
  1498. +* (5*min(M,N))
  1499. * On exit, if INFO > 0, RWORK(1:MIN(M,N)-1) contains the
  1500. * unconverged superdiagonal elements of an upper bidiagonal
  1501. * matrix B whose diagonal is in S (not necessarily sorted).
  1502. @@ -137,6 +138,8 @@
  1503. * =====================================================================
  1504. *
  1505. * .. Parameters ..
  1506. + INTEGER LQUERV
  1507. + PARAMETER ( LQUERV = -1 )
  1508. COMPLEX CZERO, CONE
  1509. PARAMETER ( CZERO = ( 0.0E0, 0.0E0 ),
  1510. $ CONE = ( 1.0E0, 0.0E0 ) )
  1511. @@ -144,8 +147,8 @@
  1512. PARAMETER ( ZERO = 0.0E0, ONE = 1.0E0 )
  1513. * ..
  1514. * .. Local Scalars ..
  1515. - LOGICAL LQUERY, WNTUA, WNTUAS, WNTUN, WNTUO, WNTUS,
  1516. - $ WNTVA, WNTVAS, WNTVN, WNTVO, WNTVS
  1517. + LOGICAL WNTUA, WNTUAS, WNTUN, WNTUO, WNTUS, WNTVA,
  1518. + $ WNTVAS, WNTVN, WNTVO, WNTVS
  1519. INTEGER BLK, CHUNK, I, IE, IERR, IR, IRWORK, ISCL,
  1520. $ ITAU, ITAUP, ITAUQ, IU, IWORK, LDWRKR, LDWRKU,
  1521. $ MAXWRK, MINMN, MINWRK, MNTHR, NCU, NCVT, NRU,
  1522. @@ -188,7 +191,7 @@
  1523. WNTVO = LSAME( JOBVT, 'O' )
  1524. WNTVN = LSAME( JOBVT, 'N' )
  1525. MINWRK = 1
  1526. - LQUERY = ( LWORK.EQ.-1 )
  1527. + MAXWRK = 1
  1528. *
  1529. IF( .NOT.( WNTUA .OR. WNTUS .OR. WNTUO .OR. WNTUN ) ) THEN
  1530. INFO = -1
  1531. @@ -216,8 +219,7 @@
  1532. * real workspace. NB refers to the optimal block size for the
  1533. * immediately following subroutine, as returned by ILAENV.)
  1534. *
  1535. - IF( INFO.EQ.0 .AND. ( LWORK.GE.1 .OR. LQUERY ) .AND. M.GT.0 .AND.
  1536. - $ N.GT.0 ) THEN
  1537. + IF( INFO.EQ.0 .AND. M.GT.0 .AND. N.GT.0 ) THEN
  1538. IF( M.GE.N ) THEN
  1539. *
  1540. * Space needed for CBDSQR is BDSPAC = 5*N
  1541. @@ -543,24 +545,21 @@
  1542. MAXWRK = MAX( MINWRK, MAXWRK )
  1543. END IF
  1544. END IF
  1545. + END IF
  1546. + IF( INFO.EQ.0 ) THEN
  1547. WORK( 1 ) = MAXWRK
  1548. + IF( LWORK.LT.MINWRK .AND. LWORK.NE.LQUERV )
  1549. + $ INFO = -13
  1550. END IF
  1551. *
  1552. - IF( LWORK.LT.MINWRK .AND. .NOT.LQUERY ) THEN
  1553. - INFO = -13
  1554. - END IF
  1555. +* Quick returns
  1556. +*
  1557. IF( INFO.NE.0 ) THEN
  1558. CALL XERBLA( 'CGESVD', -INFO )
  1559. RETURN
  1560. - ELSE IF( LQUERY ) THEN
  1561. - RETURN
  1562. END IF
  1563. -*
  1564. -* Quick return if possible
  1565. -*
  1566. + IF( LWORK.EQ.LQUERV ) RETURN
  1567. IF( M.EQ.0 .OR. N.EQ.0 ) THEN
  1568. - IF( LWORK.GE.1 )
  1569. - $ WORK( 1 ) = ONE
  1570. RETURN
  1571. END IF
  1572. *
  1573. diff -uNr LAPACK.orig/SRC/cggbak.f LAPACK/SRC/cggbak.f
  1574. --- LAPACK.orig/SRC/cggbak.f Thu Nov 4 14:24:10 1999
  1575. +++ LAPACK/SRC/cggbak.f Fri May 25 16:09:01 2001
  1576. @@ -4,7 +4,7 @@
  1577. * -- LAPACK routine (version 3.0) --
  1578. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  1579. * Courant Institute, Argonne National Lab, and Rice University
  1580. -* September 30, 1994
  1581. +* February 1, 2001
  1582. *
  1583. * .. Scalar Arguments ..
  1584. CHARACTER JOB, SIDE
  1585. @@ -109,10 +109,15 @@
  1586. INFO = -3
  1587. ELSE IF( ILO.LT.1 ) THEN
  1588. INFO = -4
  1589. - ELSE IF( IHI.LT.ILO .OR. IHI.GT.MAX( 1, N ) ) THEN
  1590. + ELSE IF( N.EQ.0 .AND. IHI.EQ.0 .AND. ILO.NE.1 ) THEN
  1591. + INFO = -4
  1592. + ELSE IF( N.GT.0 .AND. ( IHI.LT.ILO .OR. IHI.GT.MAX( 1, N ) ) )
  1593. + $ THEN
  1594. + INFO = -5
  1595. + ELSE IF( N.EQ.0 .AND. ILO.EQ.1 .AND. IHI.NE.0 ) THEN
  1596. INFO = -5
  1597. ELSE IF( M.LT.0 ) THEN
  1598. - INFO = -6
  1599. + INFO = -8
  1600. ELSE IF( LDV.LT.MAX( 1, N ) ) THEN
  1601. INFO = -10
  1602. END IF
  1603. diff -uNr LAPACK.orig/SRC/cggbal.f LAPACK/SRC/cggbal.f
  1604. --- LAPACK.orig/SRC/cggbal.f Thu Nov 4 14:24:10 1999
  1605. +++ LAPACK/SRC/cggbal.f Fri May 25 16:09:22 2001
  1606. @@ -4,7 +4,7 @@
  1607. * -- LAPACK routine (version 3.0) --
  1608. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  1609. * Courant Institute, Argonne National Lab, and Rice University
  1610. -* September 30, 1994
  1611. +* April 12, 2001
  1612. *
  1613. * .. Scalar Arguments ..
  1614. CHARACTER JOB
  1615. @@ -150,7 +150,7 @@
  1616. ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
  1617. INFO = -4
  1618. ELSE IF( LDB.LT.MAX( 1, N ) ) THEN
  1619. - INFO = -5
  1620. + INFO = -6
  1621. END IF
  1622. IF( INFO.NE.0 ) THEN
  1623. CALL XERBLA( 'CGGBAL', -INFO )
  1624. @@ -197,8 +197,8 @@
  1625. IF( L.NE.1 )
  1626. $ GO TO 30
  1627. *
  1628. - RSCALE( 1 ) = 1
  1629. - LSCALE( 1 ) = 1
  1630. + RSCALE( 1 ) = ONE
  1631. + LSCALE( 1 ) = ONE
  1632. GO TO 190
  1633. *
  1634. 30 CONTINUE
  1635. @@ -256,7 +256,7 @@
  1636. * Permute rows M and I
  1637. *
  1638. 160 CONTINUE
  1639. - LSCALE( M ) = I
  1640. + LSCALE( M ) = REAL( I )
  1641. IF( I.EQ.M )
  1642. $ GO TO 170
  1643. CALL CSWAP( N-K+1, A( I, K ), LDA, A( M, K ), LDA )
  1644. @@ -265,7 +265,7 @@
  1645. * Permute columns M and J
  1646. *
  1647. 170 CONTINUE
  1648. - RSCALE( M ) = J
  1649. + RSCALE( M ) = REAL( J )
  1650. IF( J.EQ.M )
  1651. $ GO TO 180
  1652. CALL CSWAP( L, A( 1, J ), 1, A( 1, M ), 1 )
  1653. @@ -437,7 +437,7 @@
  1654. DO 360 I = ILO, IHI
  1655. IRAB = ICAMAX( N-ILO+1, A( I, ILO ), LDA )
  1656. RAB = ABS( A( I, IRAB+ILO-1 ) )
  1657. - IRAB = ICAMAX( N-ILO+1, B( I, ILO ), LDA )
  1658. + IRAB = ICAMAX( N-ILO+1, B( I, ILO ), LDB )
  1659. RAB = MAX( RAB, ABS( B( I, IRAB+ILO-1 ) ) )
  1660. LRAB = INT( LOG10( RAB+SFMIN ) / BASL+ONE )
  1661. IR = LSCALE( I ) + SIGN( HALF, LSCALE( I ) )
  1662. diff -uNr LAPACK.orig/SRC/cgges.f LAPACK/SRC/cgges.f
  1663. --- LAPACK.orig/SRC/cgges.f Thu Nov 4 14:26:17 1999
  1664. +++ LAPACK/SRC/cgges.f Fri May 25 16:09:43 2001
  1665. @@ -6,6 +6,7 @@
  1666. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  1667. * Courant Institute, Argonne National Lab, and Rice University
  1668. * June 30, 1999
  1669. +* 8-15-00: Improve consistency of WS calculations (eca)
  1670. *
  1671. * .. Scalar Arguments ..
  1672. CHARACTER JOBVSL, JOBVSR, SORT
  1673. @@ -145,10 +146,9 @@
  1674. * The dimension of the array WORK. LWORK >= max(1,2*N).
  1675. * For good performance, LWORK must generally be larger.
  1676. *
  1677. -* If LWORK = -1, then a workspace query is assumed; the routine
  1678. -* only calculates the optimal size of the WORK array, returns
  1679. -* this value as the first entry of the WORK array, and no error
  1680. -* message related to LWORK is issued by XERBLA.
  1681. +* If LWORK = -1, a workspace query is assumed. The optimal
  1682. +* size for the WORK array is calculated and stored in WORK(1),
  1683. +* and no other work except argument checking is performed.
  1684. *
  1685. * RWORK (workspace) REAL array, dimension (8*N)
  1686. *
  1687. @@ -173,6 +173,8 @@
  1688. * =====================================================================
  1689. *
  1690. * .. Parameters ..
  1691. + INTEGER LQUERV
  1692. + PARAMETER ( LQUERV = -1 )
  1693. REAL ZERO, ONE
  1694. PARAMETER ( ZERO = 0.0E0, ONE = 1.0E0 )
  1695. COMPLEX CZERO, CONE
  1696. @@ -181,7 +183,7 @@
  1697. * ..
  1698. * .. Local Scalars ..
  1699. LOGICAL CURSL, ILASCL, ILBSCL, ILVSL, ILVSR, LASTSL,
  1700. - $ LQUERY, WANTST
  1701. + $ WANTST
  1702. INTEGER I, ICOLS, IERR, IHI, IJOBVL, IJOBVR, ILEFT,
  1703. $ ILO, IRIGHT, IROWS, IRWRK, ITAU, IWRK, LWKMIN,
  1704. $ LWKOPT
  1705. @@ -237,7 +239,6 @@
  1706. * Test the input arguments
  1707. *
  1708. INFO = 0
  1709. - LQUERY = ( LWORK.EQ.-1 )
  1710. IF( IJOBVL.LE.0 ) THEN
  1711. INFO = -1
  1712. ELSE IF( IJOBVR.LE.0 ) THEN
  1713. @@ -264,7 +265,7 @@
  1714. * following subroutine, as returned by ILAENV.)
  1715. *
  1716. LWKMIN = 1
  1717. - IF( INFO.EQ.0 .AND. ( LWORK.GE.1 .OR. LQUERY ) ) THEN
  1718. + IF( INFO.EQ.0 ) THEN
  1719. LWKMIN = MAX( 1, 2*N )
  1720. LWKOPT = N + N*ILAENV( 1, 'CGEQRF', ' ', N, 1, N, 0 )
  1721. IF( ILVSL ) THEN
  1722. @@ -272,21 +273,17 @@
  1723. $ -1 ) )
  1724. END IF
  1725. WORK( 1 ) = LWKOPT
  1726. + IF( LWORK.LT.LWKMIN .AND. LWORK.NE.LQUERV )
  1727. + $ INFO = -18
  1728. END IF
  1729. *
  1730. - IF( LWORK.LT.LWKMIN .AND. .NOT.LQUERY )
  1731. - $ INFO = -18
  1732. +* Quick return if possible
  1733. *
  1734. IF( INFO.NE.0 ) THEN
  1735. CALL XERBLA( 'CGGES ', -INFO )
  1736. RETURN
  1737. - ELSE IF( LQUERY ) THEN
  1738. - RETURN
  1739. END IF
  1740. -*
  1741. -* Quick return if possible
  1742. -*
  1743. - WORK( 1 ) = LWKOPT
  1744. + IF( LWORK.EQ.LQUERV ) RETURN
  1745. IF( N.EQ.0 ) THEN
  1746. SDIM = 0
  1747. RETURN
  1748. diff -uNr LAPACK.orig/SRC/cggesx.f LAPACK/SRC/cggesx.f
  1749. --- LAPACK.orig/SRC/cggesx.f Thu Nov 4 14:26:17 1999
  1750. +++ LAPACK/SRC/cggesx.f Fri May 25 16:10:00 2001
  1751. @@ -7,6 +7,7 @@
  1752. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  1753. * Courant Institute, Argonne National Lab, and Rice University
  1754. * June 30, 1999
  1755. +* 8-15-00: Do WS calculations if LWORK = -1 (eca)
  1756. *
  1757. * .. Scalar Arguments ..
  1758. CHARACTER JOBVSL, JOBVSR, SENSE, SORT
  1759. @@ -167,6 +168,10 @@
  1760. * If SENSE = 'E', 'V', or 'B',
  1761. * LWORK >= MAX(2*N, 2*SDIM*(N-SDIM)).
  1762. *
  1763. +* If LWORK = -1, a workspace query is assumed. The optimal
  1764. +* size for the WORK array is calculated and stored in WORK(1),
  1765. +* and no other work except argument checking is performed.
  1766. +*
  1767. * RWORK (workspace) REAL array, dimension ( 8*N )
  1768. * Real workspace.
  1769. *
  1770. @@ -198,6 +203,8 @@
  1771. * =====================================================================
  1772. *
  1773. * .. Parameters ..
  1774. + INTEGER LQUERV
  1775. + PARAMETER ( LQUERV = -1 )
  1776. REAL ZERO, ONE
  1777. PARAMETER ( ZERO = 0.0E+0, ONE = 1.0E+0 )
  1778. COMPLEX CZERO, CONE
  1779. @@ -304,14 +311,22 @@
  1780. * following subroutine, as returned by ILAENV.)
  1781. *
  1782. MINWRK = 1
  1783. - IF( INFO.EQ.0 .AND. LWORK.GE.1 ) THEN
  1784. + IF( INFO.EQ.0 ) THEN
  1785. MINWRK = MAX( 1, 2*N )
  1786. MAXWRK = N + N*ILAENV( 1, 'CGEQRF', ' ', N, 1, N, 0 )
  1787. IF( ILVSL ) THEN
  1788. MAXWRK = MAX( MAXWRK, N+N*ILAENV( 1, 'CUNGQR', ' ', N, 1, N,
  1789. $ -1 ) )
  1790. END IF
  1791. +*
  1792. +* Estimate the workspace needed by CTGSEN.
  1793. +*
  1794. + IF( WANTST ) THEN
  1795. + MAXWRK = MAX( MAXWRK, (N*N+1)/2 )
  1796. + END IF
  1797. WORK( 1 ) = MAXWRK
  1798. + IF( LWORK.LT.MINWRK .AND. LWORK.NE.LQUERV )
  1799. + $ INFO = -21
  1800. END IF
  1801. IF( .NOT.WANTSN ) THEN
  1802. LIWMIN = N+2
  1803. @@ -319,21 +334,18 @@
  1804. LIWMIN = 1
  1805. END IF
  1806. IWORK( 1 ) = LIWMIN
  1807. -*
  1808. - IF( INFO.EQ.0 .AND. LWORK.LT.MINWRK ) THEN
  1809. - INFO = -21
  1810. - ELSE IF( INFO.EQ.0 .AND. IJOB.GE.1 ) THEN
  1811. + IF( INFO.EQ.0 .AND. IJOB.GE.1 ) THEN
  1812. IF( LIWORK.LT.LIWMIN )
  1813. $ INFO = -24
  1814. END IF
  1815. *
  1816. +* Quick returns
  1817. +*
  1818. IF( INFO.NE.0 ) THEN
  1819. CALL XERBLA( 'CGGESX', -INFO )
  1820. RETURN
  1821. END IF
  1822. -*
  1823. -* Quick return if possible
  1824. -*
  1825. + IF( LWORK.EQ.LQUERV ) RETURN
  1826. IF( N.EQ.0 ) THEN
  1827. SDIM = 0
  1828. RETURN
  1829. diff -uNr LAPACK.orig/SRC/cggev.f LAPACK/SRC/cggev.f
  1830. --- LAPACK.orig/SRC/cggev.f Thu Nov 4 14:26:17 1999
  1831. +++ LAPACK/SRC/cggev.f Fri May 25 16:10:19 2001
  1832. @@ -5,6 +5,7 @@
  1833. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  1834. * Courant Institute, Argonne National Lab, and Rice University
  1835. * June 30, 1999
  1836. +* 8-15-00: Improve consistency of WS calculations (eca)
  1837. *
  1838. * .. Scalar Arguments ..
  1839. CHARACTER JOBVL, JOBVR
  1840. @@ -113,10 +114,9 @@
  1841. * The dimension of the array WORK. LWORK >= max(1,2*N).
  1842. * For good performance, LWORK must generally be larger.
  1843. *
  1844. -* If LWORK = -1, then a workspace query is assumed; the routine
  1845. -* only calculates the optimal size of the WORK array, returns
  1846. -* this value as the first entry of the WORK array, and no error
  1847. -* message related to LWORK is issued by XERBLA.
  1848. +* If LWORK = -1, a workspace query is assumed. The optimal
  1849. +* size for the WORK array is calculated and stored in WORK(1),
  1850. +* and no other work except argument checking is performed.
  1851. *
  1852. * RWORK (workspace/output) REAL array, dimension (8*N)
  1853. *
  1854. @@ -133,6 +133,8 @@
  1855. * =====================================================================
  1856. *
  1857. * .. Parameters ..
  1858. + INTEGER LQUERV
  1859. + PARAMETER ( LQUERV = -1 )
  1860. REAL ZERO, ONE
  1861. PARAMETER ( ZERO = 0.0E0, ONE = 1.0E0 )
  1862. COMPLEX CZERO, CONE
  1863. @@ -140,7 +142,7 @@
  1864. $ CONE = ( 1.0E0, 0.0E0 ) )
  1865. * ..
  1866. * .. Local Scalars ..
  1867. - LOGICAL ILASCL, ILBSCL, ILV, ILVL, ILVR, LQUERY
  1868. + LOGICAL ILASCL, ILBSCL, ILV, ILVL, ILVR
  1869. CHARACTER CHTEMP
  1870. INTEGER ICOLS, IERR, IHI, IJOBVL, IJOBVR, ILEFT, ILO,
  1871. $ IN, IRIGHT, IROWS, IRWRK, ITAU, IWRK, JC, JR,
  1872. @@ -202,7 +204,6 @@
  1873. * Test the input arguments
  1874. *
  1875. INFO = 0
  1876. - LQUERY = ( LWORK.EQ.-1 )
  1877. IF( IJOBVL.LE.0 ) THEN
  1878. INFO = -1
  1879. ELSE IF( IJOBVR.LE.0 ) THEN
  1880. @@ -228,25 +229,21 @@
  1881. * computed assuming ILO = 1 and IHI = N, the worst case.)
  1882. *
  1883. LWKMIN = 1
  1884. - IF( INFO.EQ.0 .AND. ( LWORK.GE.1 .OR. LQUERY ) ) THEN
  1885. + IF( INFO.EQ.0 ) THEN
  1886. LWKOPT = N + N*ILAENV( 1, 'CGEQRF', ' ', N, 1, N, 0 )
  1887. LWKMIN = MAX( 1, 2*N )
  1888. WORK( 1 ) = LWKOPT
  1889. + IF( LWORK.LT.LWKMIN .AND. LWORK.NE.LQUERV )
  1890. + $ INFO = -15
  1891. END IF
  1892. *
  1893. - IF( LWORK.LT.LWKMIN .AND. .NOT.LQUERY )
  1894. - $ INFO = -15
  1895. +* Quick returns
  1896. *
  1897. IF( INFO.NE.0 ) THEN
  1898. CALL XERBLA( 'CGGEV ', -INFO )
  1899. RETURN
  1900. - ELSE IF( LQUERY ) THEN
  1901. - RETURN
  1902. END IF
  1903. -*
  1904. -* Quick return if possible
  1905. -*
  1906. - WORK( 1 ) = LWKOPT
  1907. + IF( LWORK.EQ.LQUERV ) RETURN
  1908. IF( N.EQ.0 )
  1909. $ RETURN
  1910. *
  1911. diff -uNr LAPACK.orig/SRC/cggevx.f LAPACK/SRC/cggevx.f
  1912. --- LAPACK.orig/SRC/cggevx.f Thu Nov 4 14:26:17 1999
  1913. +++ LAPACK/SRC/cggevx.f Fri May 25 16:11:36 2001
  1914. @@ -7,6 +7,7 @@
  1915. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  1916. * Courant Institute, Argonne National Lab, and Rice University
  1917. * June 30, 1999
  1918. +* 8-15-00: Improve consistency of WS calculations (eca)
  1919. *
  1920. * .. Scalar Arguments ..
  1921. CHARACTER BALANC, JOBVL, JOBVR, SENSE
  1922. @@ -194,10 +195,9 @@
  1923. * If SENSE = 'N' or 'E', LWORK >= 2*N.
  1924. * If SENSE = 'V' or 'B', LWORK >= 2*N*N+2*N.
  1925. *
  1926. -* If LWORK = -1, then a workspace query is assumed; the routine
  1927. -* only calculates the optimal size of the WORK array, returns
  1928. -* this value as the first entry of the WORK array, and no error
  1929. -* message related to LWORK is issued by XERBLA.
  1930. +* If LWORK = -1, a workspace query is assumed. The optimal
  1931. +* size for the WORK array is calculated and stored in WORK(1),
  1932. +* and no other work except argument checking is performed.
  1933. *
  1934. * RWORK (workspace) REAL array, dimension (6*N)
  1935. * Real workspace.
  1936. @@ -247,6 +247,8 @@
  1937. * =====================================================================
  1938. *
  1939. * .. Parameters ..
  1940. + INTEGER LQUERV
  1941. + PARAMETER ( LQUERV = -1 )
  1942. REAL ZERO, ONE
  1943. PARAMETER ( ZERO = 0.0E+0, ONE = 1.0E+0 )
  1944. COMPLEX CZERO, CONE
  1945. @@ -254,8 +256,8 @@
  1946. $ CONE = ( 1.0E+0, 0.0E+0 ) )
  1947. * ..
  1948. * .. Local Scalars ..
  1949. - LOGICAL ILASCL, ILBSCL, ILV, ILVL, ILVR, LQUERY,
  1950. - $ WANTSB, WANTSE, WANTSN, WANTSV
  1951. + LOGICAL ILASCL, ILBSCL, ILV, ILVL, ILVR, WANTSB,
  1952. + $ WANTSE, WANTSN, WANTSV
  1953. CHARACTER CHTEMP
  1954. INTEGER I, ICOLS, IERR, IJOBVL, IJOBVR, IN, IROWS,
  1955. $ ITAU, IWRK, IWRK1, J, JC, JR, M, MAXWRK, MINWRK
  1956. @@ -321,7 +323,6 @@
  1957. * Test the input arguments
  1958. *
  1959. INFO = 0
  1960. - LQUERY = ( LWORK.EQ.-1 )
  1961. IF( .NOT.( LSAME( BALANC, 'N' ) .OR. LSAME( BALANC,
  1962. $ 'S' ) .OR. LSAME( BALANC, 'P' ) .OR. LSAME( BALANC, 'B' ) ) )
  1963. $ THEN
  1964. @@ -354,7 +355,7 @@
  1965. * computed assuming ILO = 1 and IHI = N, the worst case.)
  1966. *
  1967. MINWRK = 1
  1968. - IF( INFO.EQ.0 .AND. ( LWORK.GE.1 .OR. LQUERY ) ) THEN
  1969. + IF( INFO.EQ.0 ) THEN
  1970. MAXWRK = N + N*ILAENV( 1, 'CGEQRF', ' ', N, 1, N, 0 )
  1971. IF( WANTSE ) THEN
  1972. MINWRK = MAX( 1, 2*N )
  1973. @@ -363,21 +364,17 @@
  1974. MAXWRK = MAX( MAXWRK, 2*N*N+2*N )
  1975. END IF
  1976. WORK( 1 ) = MAXWRK
  1977. + IF( LWORK.LT.MINWRK .AND. LWORK.NE.LQUERV )
  1978. + $ INFO = -25
  1979. END IF
  1980. *
  1981. - IF( LWORK.LT.MINWRK .AND. .NOT.LQUERY ) THEN
  1982. - INFO = -25
  1983. - END IF
  1984. +* Quick returns
  1985. *
  1986. IF( INFO.NE.0 ) THEN
  1987. CALL XERBLA( 'CGGEVX', -INFO )
  1988. RETURN
  1989. - ELSE IF( LQUERY ) THEN
  1990. - RETURN
  1991. END IF
  1992. -*
  1993. -* Quick return if possible
  1994. -*
  1995. + IF( LWORK.EQ.LQUERV ) RETURN
  1996. IF( N.EQ.0 )
  1997. $ RETURN
  1998. *
  1999. diff -uNr LAPACK.orig/SRC/cgghrd.f LAPACK/SRC/cgghrd.f
  2000. --- LAPACK.orig/SRC/cgghrd.f Thu Nov 4 14:25:42 1999
  2001. +++ LAPACK/SRC/cgghrd.f Fri May 25 16:11:54 2001
  2002. @@ -4,7 +4,7 @@
  2003. * -- LAPACK routine (version 3.0) --
  2004. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  2005. * Courant Institute, Argonne National Lab, and Rice University
  2006. -* September 30, 1994
  2007. +* April 26, 2001
  2008. *
  2009. * .. Scalar Arguments ..
  2010. CHARACTER COMPQ, COMPZ
  2011. @@ -20,16 +20,29 @@
  2012. *
  2013. * CGGHRD reduces a pair of complex matrices (A,B) to generalized upper
  2014. * Hessenberg form using unitary transformations, where A is a
  2015. -* general matrix and B is upper triangular: Q' * A * Z = H and
  2016. -* Q' * B * Z = T, where H is upper Hessenberg, T is upper triangular,
  2017. -* and Q and Z are unitary, and ' means conjugate transpose.
  2018. +* general matrix and B is upper triangular. The form of the generalized
  2019. +* eigenvalue problem is
  2020. +* A*x = lambda*B*x,
  2021. +* and B is typically made upper triangular by computing its QR
  2022. +* factorization and moving the unitary matrix Q to the left side
  2023. +* of the equation.
  2024. +*
  2025. +* This subroutine simultaneously reduces A to a Hessenberg matrix H:
  2026. +* Q**H*A*Z = H
  2027. +* and transforms B to another upper triangular matrix T:
  2028. +* Q**H*B*Z = T
  2029. +* in order to reduce the problem to its standard form
  2030. +* H*y = lambda*T*y
  2031. +* where y = Z**H*x.
  2032. *
  2033. * The unitary matrices Q and Z are determined as products of Givens
  2034. * rotations. They may either be formed explicitly, or they may be
  2035. * postmultiplied into input matrices Q1 and Z1, so that
  2036. -*
  2037. -* Q1 * A * Z1' = (Q1*Q) * H * (Z1*Z)'
  2038. -* Q1 * B * Z1' = (Q1*Q) * T * (Z1*Z)'
  2039. +* Q1 * A * Z1**H = (Q1*Q) * H * (Z1*Z)**H
  2040. +* Q1 * B * Z1**H = (Q1*Q) * T * (Z1*Z)**H
  2041. +* If Q1 is the unitary matrix from the QR factorization of B in the
  2042. +* original equation A*x = lambda*B*x, then CGGHRD reduces the original
  2043. +* problem to generalized Hessenberg form.
  2044. *
  2045. * Arguments
  2046. * =========
  2047. @@ -53,10 +66,11 @@
  2048. *
  2049. * ILO (input) INTEGER
  2050. * IHI (input) INTEGER
  2051. -* It is assumed that A is already upper triangular in rows and
  2052. -* columns 1:ILO-1 and IHI+1:N. ILO and IHI are normally set
  2053. -* by a previous call to CGGBAL; otherwise they should be set
  2054. -* to 1 and N respectively.
  2055. +* ILO and IHI mark the rows and columns of A which are to be
  2056. +* reduced. It is assumed that A is already upper triangular
  2057. +* in rows and columns 1:ILO-1 and IHI+1:N. ILO and IHI are
  2058. +* normally set by a previous call to CGGBAL; otherwise they
  2059. +* should be set to 1 and N respectively.
  2060. * 1 <= ILO <= IHI <= N, if N > 0; ILO=1 and IHI=0, if N=0.
  2061. *
  2062. * A (input/output) COMPLEX array, dimension (LDA, N)
  2063. @@ -70,33 +84,28 @@
  2064. *
  2065. * B (input/output) COMPLEX array, dimension (LDB, N)
  2066. * On entry, the N-by-N upper triangular matrix B.
  2067. -* On exit, the upper triangular matrix T = Q' B Z. The
  2068. +* On exit, the upper triangular matrix T = Q**H B Z. The
  2069. * elements below the diagonal are set to zero.
  2070. *
  2071. * LDB (input) INTEGER
  2072. * The leading dimension of the array B. LDB >= max(1,N).
  2073. *
  2074. * Q (input/output) COMPLEX array, dimension (LDQ, N)
  2075. -* If COMPQ='N': Q is not referenced.
  2076. -* If COMPQ='I': on entry, Q need not be set, and on exit it
  2077. -* contains the unitary matrix Q, where Q'
  2078. -* is the product of the Givens transformations
  2079. -* which are applied to A and B on the left.
  2080. -* If COMPQ='V': on entry, Q must contain a unitary matrix
  2081. -* Q1, and on exit this is overwritten by Q1*Q.
  2082. +* On entry, if COMPQ = 'V', the unitary matrix Q1, typically
  2083. +* from the QR factorization of B.
  2084. +* On exit, if COMPQ='I', the unitary matrix Q, and if
  2085. +* COMPQ = 'V', the product Q1*Q.
  2086. +* Not referenced if COMPQ='N'.
  2087. *
  2088. * LDQ (input) INTEGER
  2089. * The leading dimension of the array Q.
  2090. * LDQ >= N if COMPQ='V' or 'I'; LDQ >= 1 otherwise.
  2091. *
  2092. * Z (input/output) COMPLEX array, dimension (LDZ, N)
  2093. -* If COMPZ='N': Z is not referenced.
  2094. -* If COMPZ='I': on entry, Z need not be set, and on exit it
  2095. -* contains the unitary matrix Z, which is
  2096. -* the product of the Givens transformations
  2097. -* which are applied to A and B on the right.
  2098. -* If COMPZ='V': on entry, Z must contain a unitary matrix
  2099. -* Z1, and on exit this is overwritten by Z1*Z.
  2100. +* On entry, if COMPZ = 'V', the unitary matrix Z1.
  2101. +* On exit, if COMPZ='I', the unitary matrix Z, and if
  2102. +* COMPZ = 'V', the product Z1*Z.
  2103. +* Not referenced if COMPZ='N'.
  2104. *
  2105. * LDZ (input) INTEGER
  2106. * The leading dimension of the array Z.
  2107. diff -uNr LAPACK.orig/SRC/chbgst.f LAPACK/SRC/chbgst.f
  2108. --- LAPACK.orig/SRC/chbgst.f Thu Nov 4 14:23:31 1999
  2109. +++ LAPACK/SRC/chbgst.f Fri May 25 16:12:55 2001
  2110. @@ -4,7 +4,7 @@
  2111. * -- LAPACK routine (version 3.0) --
  2112. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  2113. * Courant Institute, Argonne National Lab, and Rice University
  2114. -* June 30, 1999
  2115. +* January 9, 2001
  2116. *
  2117. * .. Scalar Arguments ..
  2118. CHARACTER UPLO, VECT
  2119. @@ -131,7 +131,7 @@
  2120. INFO = -3
  2121. ELSE IF( KA.LT.0 ) THEN
  2122. INFO = -4
  2123. - ELSE IF( KB.LT.0 ) THEN
  2124. + ELSE IF( KB.LT.0 .OR. KB.GT.KA ) THEN
  2125. INFO = -5
  2126. ELSE IF( LDAB.LT.KA+1 ) THEN
  2127. INFO = -7
  2128. diff -uNr LAPACK.orig/SRC/chgeqz.f LAPACK/SRC/chgeqz.f
  2129. --- LAPACK.orig/SRC/chgeqz.f Thu Nov 4 14:24:13 1999
  2130. +++ LAPACK/SRC/chgeqz.f Fri May 25 16:12:16 2001
  2131. @@ -1,43 +1,64 @@
  2132. - SUBROUTINE CHGEQZ( JOB, COMPQ, COMPZ, N, ILO, IHI, A, LDA, B, LDB,
  2133. + SUBROUTINE CHGEQZ( JOB, COMPQ, COMPZ, N, ILO, IHI, H, LDH, T, LDT,
  2134. $ ALPHA, BETA, Q, LDQ, Z, LDZ, WORK, LWORK,
  2135. $ RWORK, INFO )
  2136. *
  2137. * -- LAPACK routine (version 3.0) --
  2138. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  2139. * Courant Institute, Argonne National Lab, and Rice University
  2140. -* June 30, 1999
  2141. +* May 3, 2001
  2142. *
  2143. * .. Scalar Arguments ..
  2144. CHARACTER COMPQ, COMPZ, JOB
  2145. - INTEGER IHI, ILO, INFO, LDA, LDB, LDQ, LDZ, LWORK, N
  2146. + INTEGER IHI, ILO, INFO, LDH, LDQ, LDT, LDZ, LWORK, N
  2147. * ..
  2148. * .. Array Arguments ..
  2149. REAL RWORK( * )
  2150. - COMPLEX A( LDA, * ), ALPHA( * ), B( LDB, * ),
  2151. - $ BETA( * ), Q( LDQ, * ), WORK( * ), Z( LDZ, * )
  2152. + COMPLEX ALPHA( * ), BETA( * ), H( LDH, * ),
  2153. + $ Q( LDQ, * ), T( LDT, * ), WORK( * ),
  2154. + $ Z( LDZ, * )
  2155. * ..
  2156. *
  2157. * Purpose
  2158. * =======
  2159. *
  2160. -* CHGEQZ implements a single-shift version of the QZ
  2161. -* method for finding the generalized eigenvalues w(i)=ALPHA(i)/BETA(i)
  2162. -* of the equation
  2163. -*
  2164. -* det( A - w(i) B ) = 0
  2165. -*
  2166. -* If JOB='S', then the pair (A,B) is simultaneously
  2167. -* reduced to Schur form (i.e., A and B are both upper triangular) by
  2168. -* applying one unitary tranformation (usually called Q) on the left and
  2169. -* another (usually called Z) on the right. The diagonal elements of
  2170. -* A are then ALPHA(1),...,ALPHA(N), and of B are BETA(1),...,BETA(N).
  2171. -*
  2172. -* If JOB='S' and COMPQ and COMPZ are 'V' or 'I', then the unitary
  2173. -* transformations used to reduce (A,B) are accumulated into the arrays
  2174. -* Q and Z s.t.:
  2175. -*
  2176. -* Q(in) A(in) Z(in)* = Q(out) A(out) Z(out)*
  2177. -* Q(in) B(in) Z(in)* = Q(out) B(out) Z(out)*
  2178. +* CHGEQZ computes the eigenvalues of a complex matrix pair (H,T),
  2179. +* where H is an upper Hessenberg matrix and T is upper triangular,
  2180. +* using the single-shift QZ method.
  2181. +* Matrix pairs of this type are produced by the reduction to
  2182. +* generalized upper Hessenberg form of a complex matrix pair (A,B):
  2183. +*
  2184. +* A = Q1*H*Z1**H, B = Q1*T*Z1**H,
  2185. +*
  2186. +* as computed by CGGHRD.
  2187. +*
  2188. +* If JOB='S', then the Hessenberg-triangular pair (H,T) is
  2189. +* also reduced to generalized Schur form,
  2190. +*
  2191. +* H = Q*S*Z**H, T = Q*P*Z**H,
  2192. +*
  2193. +* where Q and Z are unitary matrices and S and P are upper triangular.
  2194. +*
  2195. +* Optionally, the unitary matrix Q from the generalized Schur
  2196. +* factorization may be postmultiplied into an input matrix Q1, and the
  2197. +* unitary matrix Z may be postmultiplied into an input matrix Z1.
  2198. +* If Q1 and Z1 are the unitary matrices from CGGHRD that reduced
  2199. +* the matrix pair (A,B) to generalized Hessenberg form, then the output
  2200. +* matrices Q1*Q and Z1*Z are the unitary factors from the generalized
  2201. +* Schur factorization of (A,B):
  2202. +*
  2203. +* A = (Q1*Q)*S*(Z1*Z)**H, B = (Q1*Q)*P*(Z1*Z)**H.
  2204. +*
  2205. +* To avoid overflow, eigenvalues of the matrix pair (H,T)
  2206. +* (equivalently, of (A,B)) are computed as a pair of complex values
  2207. +* (alpha,beta). If beta is nonzero, lambda = alpha / beta is an
  2208. +* eigenvalue of the generalized nonsymmetric eigenvalue problem (GNEP)
  2209. +* A*x = lambda*B*x
  2210. +* and if alpha is nonzero, mu = beta / alpha is an eigenvalue of the
  2211. +* alternate form of the GNEP
  2212. +* mu*A*y = B*y.
  2213. +* The values of alpha and beta for the i-th eigenvalue can be read
  2214. +* directly from the generalized Schur form: alpha = S(i,i),
  2215. +* beta = P(i,i).
  2216. *
  2217. * Ref: C.B. Moler & G.W. Stewart, "An Algorithm for Generalized Matrix
  2218. * Eigenvalue Problems", SIAM J. Numer. Anal., 10(1973),
  2219. @@ -47,83 +68,88 @@
  2220. * =========
  2221. *
  2222. * JOB (input) CHARACTER*1
  2223. -* = 'E': compute only ALPHA and BETA. A and B will not
  2224. -* necessarily be put into generalized Schur form.
  2225. -* = 'S': put A and B into generalized Schur form, as well
  2226. -* as computing ALPHA and BETA.
  2227. +* = 'E': Compute eigenvalues only;
  2228. +* = 'S': Computer eigenvalues and the Schur form.
  2229. *
  2230. * COMPQ (input) CHARACTER*1
  2231. -* = 'N': do not modify Q.
  2232. -* = 'V': multiply the array Q on the right by the conjugate
  2233. -* transpose of the unitary tranformation that is
  2234. -* applied to the left side of A and B to reduce them
  2235. -* to Schur form.
  2236. -* = 'I': like COMPQ='V', except that Q will be initialized to
  2237. -* the identity first.
  2238. +* = 'N': Left Schur vectors (Q) are not computed;
  2239. +* = 'I': Q is initialized to the unit matrix and the matrix Q
  2240. +* of left Schur vectors of (H,T) is returned;
  2241. +* = 'V': Q must contain a unitary matrix Q1 on entry and
  2242. +* the product Q1*Q is returned.
  2243. *
  2244. * COMPZ (input) CHARACTER*1
  2245. -* = 'N': do not modify Z.
  2246. -* = 'V': multiply the array Z on the right by the unitary
  2247. -* tranformation that is applied to the right side of
  2248. -* A and B to reduce them to Schur form.
  2249. -* = 'I': like COMPZ='V', except that Z will be initialized to
  2250. -* the identity first.
  2251. +* = 'N': Right Schur vectors (Z) are not computed;
  2252. +* = 'I': Q is initialized to the unit matrix and the matrix Z
  2253. +* of right Schur vectors of (H,T) is returned;
  2254. +* = 'V': Z must contain a unitary matrix Z1 on entry and
  2255. +* the product Z1*Z is returned.
  2256. *
  2257. * N (input) INTEGER
  2258. -* The order of the matrices A, B, Q, and Z. N >= 0.
  2259. +* The order of the matrices H, T, Q, and Z. N >= 0.
  2260. *
  2261. * ILO (input) INTEGER
  2262. * IHI (input) INTEGER
  2263. -* It is assumed that A is already upper triangular in rows and
  2264. -* columns 1:ILO-1 and IHI+1:N.
  2265. -* 1 <= ILO <= IHI <= N, if N > 0; ILO=1 and IHI=0, if N=0.
  2266. -*
  2267. -* A (input/output) COMPLEX array, dimension (LDA, N)
  2268. -* On entry, the N-by-N upper Hessenberg matrix A. Elements
  2269. -* below the subdiagonal must be zero.
  2270. -* If JOB='S', then on exit A and B will have been
  2271. -* simultaneously reduced to upper triangular form.
  2272. -* If JOB='E', then on exit A will have been destroyed.
  2273. -*
  2274. -* LDA (input) INTEGER
  2275. -* The leading dimension of the array A. LDA >= max( 1, N ).
  2276. -*
  2277. -* B (input/output) COMPLEX array, dimension (LDB, N)
  2278. -* On entry, the N-by-N upper triangular matrix B. Elements
  2279. -* below the diagonal must be zero.
  2280. -* If JOB='S', then on exit A and B will have been
  2281. -* simultaneously reduced to upper triangular form.
  2282. -* If JOB='E', then on exit B will have been destroyed.
  2283. +* ILO and IHI mark the rows and columns of H which are in
  2284. +* Hessenberg form. It is assumed that A is already upper
  2285. +* triangular in rows and columns 1:ILO-1 and IHI+1:N.
  2286. +* If N > 0, 1 <= ILO <= IHI <= N; if N = 0, ILO=1 and IHI=0.
  2287. +*
  2288. +* H (input/output) COMPLEX array, dimension (LDH, N)
  2289. +* On entry, the N-by-N upper Hessenberg matrix H.
  2290. +* On exit, if JOB = 'S', H contains the upper triangular
  2291. +* matrix S from the generalized Schur factorization.
  2292. +* If JOB = 'E', the diagonal of H matches that of S, but
  2293. +* the rest of H is unspecified.
  2294. +*
  2295. +* LDH (input) INTEGER
  2296. +* The leading dimension of the array H. LDH >= max( 1, N ).
  2297. +*
  2298. +* T (input/output) COMPLEX array, dimension (LDT, N)
  2299. +* On entry, the N-by-N upper triangular matrix T.
  2300. +* On exit, if JOB = 'S', T contains the upper triangular
  2301. +* matrix P from the generalized Schur factorization.
  2302. +* If JOB = 'E', the diagonal of T matches that of P, but
  2303. +* the rest of T is unspecified.
  2304. *
  2305. -* LDB (input) INTEGER
  2306. -* The leading dimension of the array B. LDB >= max( 1, N ).
  2307. +* LDT (input) INTEGER
  2308. +* The leading dimension of the array T. LDT >= max( 1, N ).
  2309. *
  2310. * ALPHA (output) COMPLEX array, dimension (N)
  2311. -* The diagonal elements of A when the pair (A,B) has been
  2312. -* reduced to Schur form. ALPHA(i)/BETA(i) i=1,...,N
  2313. -* are the generalized eigenvalues.
  2314. +* The complex scalars alpha that define the eigenvalues of
  2315. +* GNEP. ALPHA(i) = S(i,i) in the generalized Schur
  2316. +* factorization.
  2317. *
  2318. * BETA (output) COMPLEX array, dimension (N)
  2319. -* The diagonal elements of B when the pair (A,B) has been
  2320. -* reduced to Schur form. ALPHA(i)/BETA(i) i=1,...,N
  2321. -* are the generalized eigenvalues. A and B are normalized
  2322. -* so that BETA(1),...,BETA(N) are non-negative real numbers.
  2323. +* The real non-negative scalars beta that define the
  2324. +* eigenvalues of GNEP. BETA(i) = P(i,i) in the generalized
  2325. +* Schur factorization.
  2326. +*
  2327. +* Together, the quantities alpha = ALPHA(j) and beta = BETA(j)
  2328. +* represent the j-th eigenvalue of the matrix pair (A,B), in
  2329. +* one of the forms lambda = alpha/beta or mu = beta/alpha.
  2330. +* Since either lambda or mu may overflow, they should not,
  2331. +* in general, be computed.
  2332. *
  2333. * Q (input/output) COMPLEX array, dimension (LDQ, N)
  2334. -* If COMPQ='N', then Q will not be referenced.
  2335. -* If COMPQ='V' or 'I', then the conjugate transpose of the
  2336. -* unitary transformations which are applied to A and B on
  2337. -* the left will be applied to the array Q on the right.
  2338. +* On entry, if COMPZ = 'V', the unitary matrix Q1 used in the
  2339. +* reduction of (A,B) to generalized Hessenberg form.
  2340. +* On exit, if COMPZ = 'I', the unitary matrix of left Schur
  2341. +* vectors of (H,T), and if COMPZ = 'V', the unitary matrix of
  2342. +* left Schur vectors of (A,B).
  2343. +* Not referenced if COMPZ = 'N'.
  2344. *
  2345. * LDQ (input) INTEGER
  2346. * The leading dimension of the array Q. LDQ >= 1.
  2347. * If COMPQ='V' or 'I', then LDQ >= N.
  2348. *
  2349. * Z (input/output) COMPLEX array, dimension (LDZ, N)
  2350. -* If COMPZ='N', then Z will not be referenced.
  2351. -* If COMPZ='V' or 'I', then the unitary transformations which
  2352. -* are applied to A and B on the right will be applied to the
  2353. -* array Z on the right.
  2354. +* On entry, if COMPZ = 'V', the unitary matrix Z1 used in the
  2355. +* reduction of (A,B) to generalized Hessenberg form.
  2356. +* On exit, if COMPZ = 'I', the unitary matrix of right Schur
  2357. +* vectors of (H,T), and if COMPZ = 'V', the unitary matrix of
  2358. +* right Schur vectors of (A,B).
  2359. +* Not referenced if COMPZ = 'N'.
  2360. *
  2361. * LDZ (input) INTEGER
  2362. * The leading dimension of the array Z. LDZ >= 1.
  2363. @@ -145,13 +171,12 @@
  2364. * INFO (output) INTEGER
  2365. * = 0: successful exit
  2366. * < 0: if INFO = -i, the i-th argument had an illegal value
  2367. -* = 1,...,N: the QZ iteration did not converge. (A,B) is not
  2368. +* = 1,...,N: the QZ iteration did not converge. (H,T) is not
  2369. * in Schur form, but ALPHA(i) and BETA(i),
  2370. * i=INFO+1,...,N should be correct.
  2371. -* = N+1,...,2*N: the shift calculation failed. (A,B) is not
  2372. +* = N+1,...,2*N: the shift calculation failed. (H,T) is not
  2373. * in Schur form, but ALPHA(i) and BETA(i),
  2374. * i=INFO-N+1,...,N should be correct.
  2375. -* > 2*N: various "impossible" errors.
  2376. *
  2377. * Further Details
  2378. * ===============
  2379. @@ -178,7 +203,7 @@
  2380. REAL ABSB, ANORM, ASCALE, ATOL, BNORM, BSCALE, BTOL,
  2381. $ C, SAFMIN, TEMP, TEMP2, TEMPR, ULP
  2382. COMPLEX ABI22, AD11, AD12, AD21, AD22, CTEMP, CTEMP2,
  2383. - $ CTEMP3, ESHIFT, RTDISC, S, SHIFT, SIGNBC, T,
  2384. + $ CTEMP3, ESHIFT, RTDISC, S, SHIFT, SIGNBC, T1,
  2385. $ U12, X
  2386. * ..
  2387. * .. External Functions ..
  2388. @@ -255,9 +280,9 @@
  2389. INFO = -5
  2390. ELSE IF( IHI.GT.N .OR. IHI.LT.ILO-1 ) THEN
  2391. INFO = -6
  2392. - ELSE IF( LDA.LT.N ) THEN
  2393. + ELSE IF( LDH.LT.N ) THEN
  2394. INFO = -8
  2395. - ELSE IF( LDB.LT.N ) THEN
  2396. + ELSE IF( LDT.LT.N ) THEN
  2397. INFO = -10
  2398. ELSE IF( LDQ.LT.1 .OR. ( ILQ .AND. LDQ.LT.N ) ) THEN
  2399. INFO = -14
  2400. @@ -293,8 +318,8 @@
  2401. IN = IHI + 1 - ILO
  2402. SAFMIN = SLAMCH( 'S' )
  2403. ULP = SLAMCH( 'E' )*SLAMCH( 'B' )
  2404. - ANORM = CLANHS( 'F', IN, A( ILO, ILO ), LDA, RWORK )
  2405. - BNORM = CLANHS( 'F', IN, B( ILO, ILO ), LDB, RWORK )
  2406. + ANORM = CLANHS( 'F', IN, H( ILO, ILO ), LDH, RWORK )
  2407. + BNORM = CLANHS( 'F', IN, T( ILO, ILO ), LDT, RWORK )
  2408. ATOL = MAX( SAFMIN, ULP*ANORM )
  2409. BTOL = MAX( SAFMIN, ULP*BNORM )
  2410. ASCALE = ONE / MAX( SAFMIN, ANORM )
  2411. @@ -304,23 +329,23 @@
  2412. * Set Eigenvalues IHI+1:N
  2413. *
  2414. DO 10 J = IHI + 1, N
  2415. - ABSB = ABS( B( J, J ) )
  2416. + ABSB = ABS( T( J, J ) )
  2417. IF( ABSB.GT.SAFMIN ) THEN
  2418. - SIGNBC = CONJG( B( J, J ) / ABSB )
  2419. - B( J, J ) = ABSB
  2420. + SIGNBC = CONJG( T( J, J ) / ABSB )
  2421. + T( J, J ) = ABSB
  2422. IF( ILSCHR ) THEN
  2423. - CALL CSCAL( J-1, SIGNBC, B( 1, J ), 1 )
  2424. - CALL CSCAL( J, SIGNBC, A( 1, J ), 1 )
  2425. + CALL CSCAL( J-1, SIGNBC, T( 1, J ), 1 )
  2426. + CALL CSCAL( J, SIGNBC, H( 1, J ), 1 )
  2427. ELSE
  2428. - A( J, J ) = A( J, J )*SIGNBC
  2429. + H( J, J ) = H( J, J )*SIGNBC
  2430. END IF
  2431. IF( ILZ )
  2432. $ CALL CSCAL( N, SIGNBC, Z( 1, J ), 1 )
  2433. ELSE
  2434. - B( J, J ) = CZERO
  2435. + T( J, J ) = CZERO
  2436. END IF
  2437. - ALPHA( J ) = A( J, J )
  2438. - BETA( J ) = B( J, J )
  2439. + ALPHA( J ) = H( J, J )
  2440. + BETA( J ) = T( J, J )
  2441. 10 CONTINUE
  2442. *
  2443. * If IHI < ILO, skip QZ steps
  2444. @@ -365,22 +390,22 @@
  2445. * Split the matrix if possible.
  2446. *
  2447. * Two tests:
  2448. -* 1: A(j,j-1)=0 or j=ILO
  2449. -* 2: B(j,j)=0
  2450. +* 1: H(j,j-1)=0 or j=ILO
  2451. +* 2: T(j,j)=0
  2452. *
  2453. * Special case: j=ILAST
  2454. *
  2455. IF( ILAST.EQ.ILO ) THEN
  2456. GO TO 60
  2457. ELSE
  2458. - IF( ABS1( A( ILAST, ILAST-1 ) ).LE.ATOL ) THEN
  2459. - A( ILAST, ILAST-1 ) = CZERO
  2460. + IF( ABS1( H( ILAST, ILAST-1 ) ).LE.ATOL ) THEN
  2461. + H( ILAST, ILAST-1 ) = CZERO
  2462. GO TO 60
  2463. END IF
  2464. END IF
  2465. *
  2466. - IF( ABS( B( ILAST, ILAST ) ).LE.BTOL ) THEN
  2467. - B( ILAST, ILAST ) = CZERO
  2468. + IF( ABS( T( ILAST, ILAST ) ).LE.BTOL ) THEN
  2469. + T( ILAST, ILAST ) = CZERO
  2470. GO TO 50
  2471. END IF
  2472. *
  2473. @@ -388,30 +413,30 @@
  2474. *
  2475. DO 40 J = ILAST - 1, ILO, -1
  2476. *
  2477. -* Test 1: for A(j,j-1)=0 or j=ILO
  2478. +* Test 1: for H(j,j-1)=0 or j=ILO
  2479. *
  2480. IF( J.EQ.ILO ) THEN
  2481. ILAZRO = .TRUE.
  2482. ELSE
  2483. - IF( ABS1( A( J, J-1 ) ).LE.ATOL ) THEN
  2484. - A( J, J-1 ) = CZERO
  2485. + IF( ABS1( H( J, J-1 ) ).LE.ATOL ) THEN
  2486. + H( J, J-1 ) = CZERO
  2487. ILAZRO = .TRUE.
  2488. ELSE
  2489. ILAZRO = .FALSE.
  2490. END IF
  2491. END IF
  2492. *
  2493. -* Test 2: for B(j,j)=0
  2494. +* Test 2: for T(j,j)=0
  2495. *
  2496. - IF( ABS( B( J, J ) ).LT.BTOL ) THEN
  2497. - B( J, J ) = CZERO
  2498. + IF( ABS( T( J, J ) ).LT.BTOL ) THEN
  2499. + T( J, J ) = CZERO
  2500. *
  2501. * Test 1a: Check for 2 consecutive small subdiagonals in A
  2502. *
  2503. ILAZR2 = .FALSE.
  2504. IF( .NOT.ILAZRO ) THEN
  2505. - IF( ABS1( A( J, J-1 ) )*( ASCALE*ABS1( A( J+1,
  2506. - $ J ) ) ).LE.ABS1( A( J, J ) )*( ASCALE*ATOL ) )
  2507. + IF( ABS1( H( J, J-1 ) )*( ASCALE*ABS1( H( J+1,
  2508. + $ J ) ) ).LE.ABS1( H( J, J ) )*( ASCALE*ATOL ) )
  2509. $ ILAZR2 = .TRUE.
  2510. END IF
  2511. *
  2512. @@ -423,21 +448,21 @@
  2513. *
  2514. IF( ILAZRO .OR. ILAZR2 ) THEN
  2515. DO 20 JCH = J, ILAST - 1
  2516. - CTEMP = A( JCH, JCH )
  2517. - CALL CLARTG( CTEMP, A( JCH+1, JCH ), C, S,
  2518. - $ A( JCH, JCH ) )
  2519. - A( JCH+1, JCH ) = CZERO
  2520. - CALL CROT( ILASTM-JCH, A( JCH, JCH+1 ), LDA,
  2521. - $ A( JCH+1, JCH+1 ), LDA, C, S )
  2522. - CALL CROT( ILASTM-JCH, B( JCH, JCH+1 ), LDB,
  2523. - $ B( JCH+1, JCH+1 ), LDB, C, S )
  2524. + CTEMP = H( JCH, JCH )
  2525. + CALL CLARTG( CTEMP, H( JCH+1, JCH ), C, S,
  2526. + $ H( JCH, JCH ) )
  2527. + H( JCH+1, JCH ) = CZERO
  2528. + CALL CROT( ILASTM-JCH, H( JCH, JCH+1 ), LDH,
  2529. + $ H( JCH+1, JCH+1 ), LDH, C, S )
  2530. + CALL CROT( ILASTM-JCH, T( JCH, JCH+1 ), LDT,
  2531. + $ T( JCH+1, JCH+1 ), LDT, C, S )
  2532. IF( ILQ )
  2533. $ CALL CROT( N, Q( 1, JCH ), 1, Q( 1, JCH+1 ), 1,
  2534. $ C, CONJG( S ) )
  2535. IF( ILAZR2 )
  2536. - $ A( JCH, JCH-1 ) = A( JCH, JCH-1 )*C
  2537. + $ H( JCH, JCH-1 ) = H( JCH, JCH-1 )*C
  2538. ILAZR2 = .FALSE.
  2539. - IF( ABS1( B( JCH+1, JCH+1 ) ).GE.BTOL ) THEN
  2540. + IF( ABS1( T( JCH+1, JCH+1 ) ).GE.BTOL ) THEN
  2541. IF( JCH+1.GE.ILAST ) THEN
  2542. GO TO 60
  2543. ELSE
  2544. @@ -445,35 +470,35 @@
  2545. GO TO 70
  2546. END IF
  2547. END IF
  2548. - B( JCH+1, JCH+1 ) = CZERO
  2549. + T( JCH+1, JCH+1 ) = CZERO
  2550. 20 CONTINUE
  2551. GO TO 50
  2552. ELSE
  2553. *
  2554. -* Only test 2 passed -- chase the zero to B(ILAST,ILAST)
  2555. -* Then process as in the case B(ILAST,ILAST)=0
  2556. +* Only test 2 passed -- chase the zero to T(ILAST,ILAST)
  2557. +* Then process as in the case T(ILAST,ILAST)=0
  2558. *
  2559. DO 30 JCH = J, ILAST - 1
  2560. - CTEMP = B( JCH, JCH+1 )
  2561. - CALL CLARTG( CTEMP, B( JCH+1, JCH+1 ), C, S,
  2562. - $ B( JCH, JCH+1 ) )
  2563. - B( JCH+1, JCH+1 ) = CZERO
  2564. + CTEMP = T( JCH, JCH+1 )
  2565. + CALL CLARTG( CTEMP, T( JCH+1, JCH+1 ), C, S,
  2566. + $ T( JCH, JCH+1 ) )
  2567. + T( JCH+1, JCH+1 ) = CZERO
  2568. IF( JCH.LT.ILASTM-1 )
  2569. - $ CALL CROT( ILASTM-JCH-1, B( JCH, JCH+2 ), LDB,
  2570. - $ B( JCH+1, JCH+2 ), LDB, C, S )
  2571. - CALL CROT( ILASTM-JCH+2, A( JCH, JCH-1 ), LDA,
  2572. - $ A( JCH+1, JCH-1 ), LDA, C, S )
  2573. + $ CALL CROT( ILASTM-JCH-1, T( JCH, JCH+2 ), LDT,
  2574. + $ T( JCH+1, JCH+2 ), LDT, C, S )
  2575. + CALL CROT( ILASTM-JCH+2, H( JCH, JCH-1 ), LDH,
  2576. + $ H( JCH+1, JCH-1 ), LDH, C, S )
  2577. IF( ILQ )
  2578. $ CALL CROT( N, Q( 1, JCH ), 1, Q( 1, JCH+1 ), 1,
  2579. $ C, CONJG( S ) )
  2580. - CTEMP = A( JCH+1, JCH )
  2581. - CALL CLARTG( CTEMP, A( JCH+1, JCH-1 ), C, S,
  2582. - $ A( JCH+1, JCH ) )
  2583. - A( JCH+1, JCH-1 ) = CZERO
  2584. - CALL CROT( JCH+1-IFRSTM, A( IFRSTM, JCH ), 1,
  2585. - $ A( IFRSTM, JCH-1 ), 1, C, S )
  2586. - CALL CROT( JCH-IFRSTM, B( IFRSTM, JCH ), 1,
  2587. - $ B( IFRSTM, JCH-1 ), 1, C, S )
  2588. + CTEMP = H( JCH+1, JCH )
  2589. + CALL CLARTG( CTEMP, H( JCH+1, JCH-1 ), C, S,
  2590. + $ H( JCH+1, JCH ) )
  2591. + H( JCH+1, JCH-1 ) = CZERO
  2592. + CALL CROT( JCH+1-IFRSTM, H( IFRSTM, JCH ), 1,
  2593. + $ H( IFRSTM, JCH-1 ), 1, C, S )
  2594. + CALL CROT( JCH-IFRSTM, T( IFRSTM, JCH ), 1,
  2595. + $ T( IFRSTM, JCH-1 ), 1, C, S )
  2596. IF( ILZ )
  2597. $ CALL CROT( N, Z( 1, JCH ), 1, Z( 1, JCH-1 ), 1,
  2598. $ C, S )
  2599. @@ -497,42 +522,42 @@
  2600. INFO = 2*N + 1
  2601. GO TO 210
  2602. *
  2603. -* B(ILAST,ILAST)=0 -- clear A(ILAST,ILAST-1) to split off a
  2604. +* T(ILAST,ILAST)=0 -- clear H(ILAST,ILAST-1) to split off a
  2605. * 1x1 block.
  2606. *
  2607. 50 CONTINUE
  2608. - CTEMP = A( ILAST, ILAST )
  2609. - CALL CLARTG( CTEMP, A( ILAST, ILAST-1 ), C, S,
  2610. - $ A( ILAST, ILAST ) )
  2611. - A( ILAST, ILAST-1 ) = CZERO
  2612. - CALL CROT( ILAST-IFRSTM, A( IFRSTM, ILAST ), 1,
  2613. - $ A( IFRSTM, ILAST-1 ), 1, C, S )
  2614. - CALL CROT( ILAST-IFRSTM, B( IFRSTM, ILAST ), 1,
  2615. - $ B( IFRSTM, ILAST-1 ), 1, C, S )
  2616. + CTEMP = H( ILAST, ILAST )
  2617. + CALL CLARTG( CTEMP, H( ILAST, ILAST-1 ), C, S,
  2618. + $ H( ILAST, ILAST ) )
  2619. + H( ILAST, ILAST-1 ) = CZERO
  2620. + CALL CROT( ILAST-IFRSTM, H( IFRSTM, ILAST ), 1,
  2621. + $ H( IFRSTM, ILAST-1 ), 1, C, S )
  2622. + CALL CROT( ILAST-IFRSTM, T( IFRSTM, ILAST ), 1,
  2623. + $ T( IFRSTM, ILAST-1 ), 1, C, S )
  2624. IF( ILZ )
  2625. $ CALL CROT( N, Z( 1, ILAST ), 1, Z( 1, ILAST-1 ), 1, C, S )
  2626. *
  2627. -* A(ILAST,ILAST-1)=0 -- Standardize B, set ALPHA and BETA
  2628. +* H(ILAST,ILAST-1)=0 -- Standardize B, set ALPHA and BETA
  2629. *
  2630. 60 CONTINUE
  2631. - ABSB = ABS( B( ILAST, ILAST ) )
  2632. + ABSB = ABS( T( ILAST, ILAST ) )
  2633. IF( ABSB.GT.SAFMIN ) THEN
  2634. - SIGNBC = CONJG( B( ILAST, ILAST ) / ABSB )
  2635. - B( ILAST, ILAST ) = ABSB
  2636. + SIGNBC = CONJG( T( ILAST, ILAST ) / ABSB )
  2637. + T( ILAST, ILAST ) = ABSB
  2638. IF( ILSCHR ) THEN
  2639. - CALL CSCAL( ILAST-IFRSTM, SIGNBC, B( IFRSTM, ILAST ), 1 )
  2640. - CALL CSCAL( ILAST+1-IFRSTM, SIGNBC, A( IFRSTM, ILAST ),
  2641. + CALL CSCAL( ILAST-IFRSTM, SIGNBC, T( IFRSTM, ILAST ), 1 )
  2642. + CALL CSCAL( ILAST+1-IFRSTM, SIGNBC, H( IFRSTM, ILAST ),
  2643. $ 1 )
  2644. ELSE
  2645. - A( ILAST, ILAST ) = A( ILAST, ILAST )*SIGNBC
  2646. + H( ILAST, ILAST ) = H( ILAST, ILAST )*SIGNBC
  2647. END IF
  2648. IF( ILZ )
  2649. $ CALL CSCAL( N, SIGNBC, Z( 1, ILAST ), 1 )
  2650. ELSE
  2651. - B( ILAST, ILAST ) = CZERO
  2652. + T( ILAST, ILAST ) = CZERO
  2653. END IF
  2654. - ALPHA( ILAST ) = A( ILAST, ILAST )
  2655. - BETA( ILAST ) = B( ILAST, ILAST )
  2656. + ALPHA( ILAST ) = H( ILAST, ILAST )
  2657. + BETA( ILAST ) = T( ILAST, ILAST )
  2658. *
  2659. * Go to next block -- exit if finished.
  2660. *
  2661. @@ -565,7 +590,7 @@
  2662. * Compute the Shift.
  2663. *
  2664. * At this point, IFIRST < ILAST, and the diagonal elements of
  2665. -* B(IFIRST:ILAST,IFIRST,ILAST) are larger than BTOL (in
  2666. +* T(IFIRST:ILAST,IFIRST,ILAST) are larger than BTOL (in
  2667. * magnitude)
  2668. *
  2669. IF( ( IITER / 10 )*10.NE.IITER ) THEN
  2670. @@ -577,33 +602,33 @@
  2671. * We factor B as U*D, where U has unit diagonals, and
  2672. * compute (A*inv(D))*inv(U).
  2673. *
  2674. - U12 = ( BSCALE*B( ILAST-1, ILAST ) ) /
  2675. - $ ( BSCALE*B( ILAST, ILAST ) )
  2676. - AD11 = ( ASCALE*A( ILAST-1, ILAST-1 ) ) /
  2677. - $ ( BSCALE*B( ILAST-1, ILAST-1 ) )
  2678. - AD21 = ( ASCALE*A( ILAST, ILAST-1 ) ) /
  2679. - $ ( BSCALE*B( ILAST-1, ILAST-1 ) )
  2680. - AD12 = ( ASCALE*A( ILAST-1, ILAST ) ) /
  2681. - $ ( BSCALE*B( ILAST, ILAST ) )
  2682. - AD22 = ( ASCALE*A( ILAST, ILAST ) ) /
  2683. - $ ( BSCALE*B( ILAST, ILAST ) )
  2684. + U12 = ( BSCALE*T( ILAST-1, ILAST ) ) /
  2685. + $ ( BSCALE*T( ILAST, ILAST ) )
  2686. + AD11 = ( ASCALE*H( ILAST-1, ILAST-1 ) ) /
  2687. + $ ( BSCALE*T( ILAST-1, ILAST-1 ) )
  2688. + AD21 = ( ASCALE*H( ILAST, ILAST-1 ) ) /
  2689. + $ ( BSCALE*T( ILAST-1, ILAST-1 ) )
  2690. + AD12 = ( ASCALE*H( ILAST-1, ILAST ) ) /
  2691. + $ ( BSCALE*T( ILAST, ILAST ) )
  2692. + AD22 = ( ASCALE*H( ILAST, ILAST ) ) /
  2693. + $ ( BSCALE*T( ILAST, ILAST ) )
  2694. ABI22 = AD22 - U12*AD21
  2695. *
  2696. - T = HALF*( AD11+ABI22 )
  2697. - RTDISC = SQRT( T**2+AD12*AD21-AD11*AD22 )
  2698. - TEMP = REAL( T-ABI22 )*REAL( RTDISC ) +
  2699. - $ AIMAG( T-ABI22 )*AIMAG( RTDISC )
  2700. + T1 = HALF*( AD11+ABI22 )
  2701. + RTDISC = SQRT( T1**2+AD12*AD21-AD11*AD22 )
  2702. + TEMP = REAL( T1-ABI22 )*REAL( RTDISC ) +
  2703. + $ AIMAG( T1-ABI22 )*AIMAG( RTDISC )
  2704. IF( TEMP.LE.ZERO ) THEN
  2705. - SHIFT = T + RTDISC
  2706. + SHIFT = T1 + RTDISC
  2707. ELSE
  2708. - SHIFT = T - RTDISC
  2709. + SHIFT = T1 - RTDISC
  2710. END IF
  2711. ELSE
  2712. *
  2713. * Exceptional shift. Chosen for no particularly good reason.
  2714. *
  2715. - ESHIFT = ESHIFT + CONJG( ( ASCALE*A( ILAST-1, ILAST ) ) /
  2716. - $ ( BSCALE*B( ILAST-1, ILAST-1 ) ) )
  2717. + ESHIFT = ESHIFT + CONJG( ( ASCALE*H( ILAST-1, ILAST ) ) /
  2718. + $ ( BSCALE*T( ILAST-1, ILAST-1 ) ) )
  2719. SHIFT = ESHIFT
  2720. END IF
  2721. *
  2722. @@ -611,46 +636,46 @@
  2723. *
  2724. DO 80 J = ILAST - 1, IFIRST + 1, -1
  2725. ISTART = J
  2726. - CTEMP = ASCALE*A( J, J ) - SHIFT*( BSCALE*B( J, J ) )
  2727. + CTEMP = ASCALE*H( J, J ) - SHIFT*( BSCALE*T( J, J ) )
  2728. TEMP = ABS1( CTEMP )
  2729. - TEMP2 = ASCALE*ABS1( A( J+1, J ) )
  2730. + TEMP2 = ASCALE*ABS1( H( J+1, J ) )
  2731. TEMPR = MAX( TEMP, TEMP2 )
  2732. IF( TEMPR.LT.ONE .AND. TEMPR.NE.ZERO ) THEN
  2733. TEMP = TEMP / TEMPR
  2734. TEMP2 = TEMP2 / TEMPR
  2735. END IF
  2736. - IF( ABS1( A( J, J-1 ) )*TEMP2.LE.TEMP*ATOL )
  2737. + IF( ABS1( H( J, J-1 ) )*TEMP2.LE.TEMP*ATOL )
  2738. $ GO TO 90
  2739. 80 CONTINUE
  2740. *
  2741. ISTART = IFIRST
  2742. - CTEMP = ASCALE*A( IFIRST, IFIRST ) -
  2743. - $ SHIFT*( BSCALE*B( IFIRST, IFIRST ) )
  2744. + CTEMP = ASCALE*H( IFIRST, IFIRST ) -
  2745. + $ SHIFT*( BSCALE*T( IFIRST, IFIRST ) )
  2746. 90 CONTINUE
  2747. *
  2748. * Do an implicit-shift QZ sweep.
  2749. *
  2750. * Initial Q
  2751. *
  2752. - CTEMP2 = ASCALE*A( ISTART+1, ISTART )
  2753. + CTEMP2 = ASCALE*H( ISTART+1, ISTART )
  2754. CALL CLARTG( CTEMP, CTEMP2, C, S, CTEMP3 )
  2755. *
  2756. * Sweep
  2757. *
  2758. DO 150 J = ISTART, ILAST - 1
  2759. IF( J.GT.ISTART ) THEN
  2760. - CTEMP = A( J, J-1 )
  2761. - CALL CLARTG( CTEMP, A( J+1, J-1 ), C, S, A( J, J-1 ) )
  2762. - A( J+1, J-1 ) = CZERO
  2763. + CTEMP = H( J, J-1 )
  2764. + CALL CLARTG( CTEMP, H( J+1, J-1 ), C, S, H( J, J-1 ) )
  2765. + H( J+1, J-1 ) = CZERO
  2766. END IF
  2767. *
  2768. DO 100 JC = J, ILASTM
  2769. - CTEMP = C*A( J, JC ) + S*A( J+1, JC )
  2770. - A( J+1, JC ) = -CONJG( S )*A( J, JC ) + C*A( J+1, JC )
  2771. - A( J, JC ) = CTEMP
  2772. - CTEMP2 = C*B( J, JC ) + S*B( J+1, JC )
  2773. - B( J+1, JC ) = -CONJG( S )*B( J, JC ) + C*B( J+1, JC )
  2774. - B( J, JC ) = CTEMP2
  2775. + CTEMP = C*H( J, JC ) + S*H( J+1, JC )
  2776. + H( J+1, JC ) = -CONJG( S )*H( J, JC ) + C*H( J+1, JC )
  2777. + H( J, JC ) = CTEMP
  2778. + CTEMP2 = C*T( J, JC ) + S*T( J+1, JC )
  2779. + T( J+1, JC ) = -CONJG( S )*T( J, JC ) + C*T( J+1, JC )
  2780. + T( J, JC ) = CTEMP2
  2781. 100 CONTINUE
  2782. IF( ILQ ) THEN
  2783. DO 110 JR = 1, N
  2784. @@ -660,19 +685,19 @@
  2785. 110 CONTINUE
  2786. END IF
  2787. *
  2788. - CTEMP = B( J+1, J+1 )
  2789. - CALL CLARTG( CTEMP, B( J+1, J ), C, S, B( J+1, J+1 ) )
  2790. - B( J+1, J ) = CZERO
  2791. + CTEMP = T( J+1, J+1 )
  2792. + CALL CLARTG( CTEMP, T( J+1, J ), C, S, T( J+1, J+1 ) )
  2793. + T( J+1, J ) = CZERO
  2794. *
  2795. DO 120 JR = IFRSTM, MIN( J+2, ILAST )
  2796. - CTEMP = C*A( JR, J+1 ) + S*A( JR, J )
  2797. - A( JR, J ) = -CONJG( S )*A( JR, J+1 ) + C*A( JR, J )
  2798. - A( JR, J+1 ) = CTEMP
  2799. + CTEMP = C*H( JR, J+1 ) + S*H( JR, J )
  2800. + H( JR, J ) = -CONJG( S )*H( JR, J+1 ) + C*H( JR, J )
  2801. + H( JR, J+1 ) = CTEMP
  2802. 120 CONTINUE
  2803. DO 130 JR = IFRSTM, J
  2804. - CTEMP = C*B( JR, J+1 ) + S*B( JR, J )
  2805. - B( JR, J ) = -CONJG( S )*B( JR, J+1 ) + C*B( JR, J )
  2806. - B( JR, J+1 ) = CTEMP
  2807. + CTEMP = C*T( JR, J+1 ) + S*T( JR, J )
  2808. + T( JR, J ) = -CONJG( S )*T( JR, J+1 ) + C*T( JR, J )
  2809. + T( JR, J+1 ) = CTEMP
  2810. 130 CONTINUE
  2811. IF( ILZ ) THEN
  2812. DO 140 JR = 1, N
  2813. @@ -700,23 +725,23 @@
  2814. * Set Eigenvalues 1:ILO-1
  2815. *
  2816. DO 200 J = 1, ILO - 1
  2817. - ABSB = ABS( B( J, J ) )
  2818. + ABSB = ABS( T( J, J ) )
  2819. IF( ABSB.GT.SAFMIN ) THEN
  2820. - SIGNBC = CONJG( B( J, J ) / ABSB )
  2821. - B( J, J ) = ABSB
  2822. + SIGNBC = CONJG( T( J, J ) / ABSB )
  2823. + T( J, J ) = ABSB
  2824. IF( ILSCHR ) THEN
  2825. - CALL CSCAL( J-1, SIGNBC, B( 1, J ), 1 )
  2826. - CALL CSCAL( J, SIGNBC, A( 1, J ), 1 )
  2827. + CALL CSCAL( J-1, SIGNBC, T( 1, J ), 1 )
  2828. + CALL CSCAL( J, SIGNBC, H( 1, J ), 1 )
  2829. ELSE
  2830. - A( J, J ) = A( J, J )*SIGNBC
  2831. + H( J, J ) = H( J, J )*SIGNBC
  2832. END IF
  2833. IF( ILZ )
  2834. $ CALL CSCAL( N, SIGNBC, Z( 1, J ), 1 )
  2835. ELSE
  2836. - B( J, J ) = CZERO
  2837. + T( J, J ) = CZERO
  2838. END IF
  2839. - ALPHA( J ) = A( J, J )
  2840. - BETA( J ) = B( J, J )
  2841. + ALPHA( J ) = H( J, J )
  2842. + BETA( J ) = T( J, J )
  2843. 200 CONTINUE
  2844. *
  2845. * Normal Termination
  2846. diff -uNr LAPACK.orig/SRC/clasr.f LAPACK/SRC/clasr.f
  2847. --- LAPACK.orig/SRC/clasr.f Thu Nov 4 14:24:17 1999
  2848. +++ LAPACK/SRC/clasr.f Fri May 25 16:12:37 2001
  2849. @@ -3,7 +3,7 @@
  2850. * -- LAPACK auxiliary routine (version 3.0) --
  2851. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  2852. * Courant Institute, Argonne National Lab, and Rice University
  2853. -* October 31, 1992
  2854. +* May 3, 2001
  2855. *
  2856. * .. Scalar Arguments ..
  2857. CHARACTER DIRECT, PIVOT, SIDE
  2858. @@ -17,42 +17,77 @@
  2859. * Purpose
  2860. * =======
  2861. *
  2862. -* CLASR performs the transformation
  2863. +* CLASR applies a sequence of real plane rotations to a complex matrix
  2864. +* A, from either the left or the right.
  2865. *
  2866. -* A := P*A, when SIDE = 'L' or 'l' ( Left-hand side )
  2867. +* When SIDE = 'L', the transformation takes the form
  2868. *
  2869. -* A := A*P', when SIDE = 'R' or 'r' ( Right-hand side )
  2870. +* A := P*A
  2871. *
  2872. -* where A is an m by n complex matrix and P is an orthogonal matrix,
  2873. -* consisting of a sequence of plane rotations determined by the
  2874. -* parameters PIVOT and DIRECT as follows ( z = m when SIDE = 'L' or 'l'
  2875. -* and z = n when SIDE = 'R' or 'r' ):
  2876. +* and when SIDE = 'R', the transformation takes the form
  2877. *
  2878. -* When DIRECT = 'F' or 'f' ( Forward sequence ) then
  2879. -*
  2880. -* P = P( z - 1 )*...*P( 2 )*P( 1 ),
  2881. -*
  2882. -* and when DIRECT = 'B' or 'b' ( Backward sequence ) then
  2883. -*
  2884. -* P = P( 1 )*P( 2 )*...*P( z - 1 ),
  2885. -*
  2886. -* where P( k ) is a plane rotation matrix for the following planes:
  2887. -*
  2888. -* when PIVOT = 'V' or 'v' ( Variable pivot ),
  2889. -* the plane ( k, k + 1 )
  2890. -*
  2891. -* when PIVOT = 'T' or 't' ( Top pivot ),
  2892. -* the plane ( 1, k + 1 )
  2893. -*
  2894. -* when PIVOT = 'B' or 'b' ( Bottom pivot ),
  2895. -* the plane ( k, z )
  2896. -*
  2897. -* c( k ) and s( k ) must contain the cosine and sine that define the
  2898. -* matrix P( k ). The two by two plane rotation part of the matrix
  2899. -* P( k ), R( k ), is assumed to be of the form
  2900. -*
  2901. -* R( k ) = ( c( k ) s( k ) ).
  2902. -* ( -s( k ) c( k ) )
  2903. +* A := A*P**T
  2904. +*
  2905. +* where P is an orthogonal matrix consisting of a sequence of z plane
  2906. +* rotations, with z = M when SIDE = 'L' and z = N when SIDE = 'R',
  2907. +* and P**T is the transpose of P.
  2908. +*
  2909. +* When DIRECT = 'F' (Forward sequence), then
  2910. +*
  2911. +* P = P(z-1) * ... * P(2) * P(1)
  2912. +*
  2913. +* and when DIRECT = 'B' (Backward sequence), then
  2914. +*
  2915. +* P = P(1) * P(2) * ... * P(z-1)
  2916. +*
  2917. +* where P(k) is a plane rotation matrix defined by the 2-by-2 rotation
  2918. +*
  2919. +* R(k) = ( c(k) s(k) )
  2920. +* = ( -s(k) c(k) ).
  2921. +*
  2922. +* When PIVOT = 'V' (Variable pivot), the rotation is performed
  2923. +* for the plane (k,k+1), i.e., P(k) has the form
  2924. +*
  2925. +* P(k) = ( 1 )
  2926. +* ( ... )
  2927. +* ( 1 )
  2928. +* ( c(k) s(k) )
  2929. +* ( -s(k) c(k) )
  2930. +* ( 1 )
  2931. +* ( ... )
  2932. +* ( 1 )
  2933. +*
  2934. +* where R(k) appears as a rank-2 modification to the identity matrix in
  2935. +* rows and columns k and k+1.
  2936. +*
  2937. +* When PIVOT = 'T' (Top pivot), the rotation is performed for the
  2938. +* plane (1,k+1), so P(k) has the form
  2939. +*
  2940. +* P(k) = ( c(k) s(k) )
  2941. +* ( 1 )
  2942. +* ( ... )
  2943. +* ( 1 )
  2944. +* ( -s(k) c(k) )
  2945. +* ( 1 )
  2946. +* ( ... )
  2947. +* ( 1 )
  2948. +*
  2949. +* where R(k) appears in rows and columns 1 and k+1.
  2950. +*
  2951. +* Similarly, when PIVOT = 'B' (Bottom pivot), the rotation is
  2952. +* performed for the plane (k,z), giving P(k) the form
  2953. +*
  2954. +* P(k) = ( 1 )
  2955. +* ( ... )
  2956. +* ( 1 )
  2957. +* ( c(k) s(k) )
  2958. +* ( 1 )
  2959. +* ( ... )
  2960. +* ( 1 )
  2961. +* ( -s(k) c(k) )
  2962. +*
  2963. +* where R(k) appears in rows and columns k and z. The rotations are
  2964. +* performed without ever forming P(k) explicitly.
  2965. *
  2966. * Arguments
  2967. * =========
  2968. @@ -61,13 +96,13 @@
  2969. * Specifies whether the plane rotation matrix P is applied to
  2970. * A on the left or the right.
  2971. * = 'L': Left, compute A := P*A
  2972. -* = 'R': Right, compute A:= A*P'
  2973. +* = 'R': Right, compute A:= A*P**T
  2974. *
  2975. * DIRECT (input) CHARACTER*1
  2976. * Specifies whether P is a forward or backward sequence of
  2977. * plane rotations.
  2978. -* = 'F': Forward, P = P( z - 1 )*...*P( 2 )*P( 1 )
  2979. -* = 'B': Backward, P = P( 1 )*P( 2 )*...*P( z - 1 )
  2980. +* = 'F': Forward, P = P(z-1)*...*P(2)*P(1)
  2981. +* = 'B': Backward, P = P(1)*P(2)*...*P(z-1)
  2982. *
  2983. * PIVOT (input) CHARACTER*1
  2984. * Specifies the plane for which P(k) is a plane rotation
  2985. @@ -84,18 +119,22 @@
  2986. * The number of columns of the matrix A. If n <= 1, an
  2987. * immediate return is effected.
  2988. *
  2989. -* C, S (input) REAL arrays, dimension
  2990. +* C (input) REAL array, dimension
  2991. +* (M-1) if SIDE = 'L'
  2992. +* (N-1) if SIDE = 'R'
  2993. +* The cosines c(k) of the plane rotations.
  2994. +*
  2995. +* S (input) REAL array, dimension
  2996. * (M-1) if SIDE = 'L'
  2997. * (N-1) if SIDE = 'R'
  2998. -* c(k) and s(k) contain the cosine and sine that define the
  2999. -* matrix P(k). The two by two plane rotation part of the
  3000. -* matrix P(k), R(k), is assumed to be of the form
  3001. -* R( k ) = ( c( k ) s( k ) ).
  3002. -* ( -s( k ) c( k ) )
  3003. +* The sines s(k) of the plane rotations. The 2-by-2 plane
  3004. +* rotation part of the matrix P(k), R(k), has the form
  3005. +* R(k) = ( c(k) s(k) )
  3006. +* ( -s(k) c(k) ).
  3007. *
  3008. * A (input/output) COMPLEX array, dimension (LDA,N)
  3009. -* The m by n matrix A. On exit, A is overwritten by P*A if
  3010. -* SIDE = 'R' or by A*P' if SIDE = 'L'.
  3011. +* The M-by-N matrix A. On exit, A is overwritten by P*A if
  3012. +* SIDE = 'R' or by A*P**T if SIDE = 'L'.
  3013. *
  3014. * LDA (input) INTEGER
  3015. * The leading dimension of the array A. LDA >= max(1,M).
  3016. diff -uNr LAPACK.orig/SRC/ctgevc.f LAPACK/SRC/ctgevc.f
  3017. --- LAPACK.orig/SRC/ctgevc.f Thu Nov 4 14:26:09 1999
  3018. +++ LAPACK/SRC/ctgevc.f Fri May 25 16:13:37 2001
  3019. @@ -1,19 +1,19 @@
  3020. - SUBROUTINE CTGEVC( SIDE, HOWMNY, SELECT, N, A, LDA, B, LDB, VL,
  3021. + SUBROUTINE CTGEVC( SIDE, HOWMNY, SELECT, N, S, LDS, P, LDP, VL,
  3022. $ LDVL, VR, LDVR, MM, M, WORK, RWORK, INFO )
  3023. *
  3024. * -- LAPACK routine (version 3.0) --
  3025. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  3026. * Courant Institute, Argonne National Lab, and Rice University
  3027. -* June 30, 1999
  3028. +* May 4, 2001
  3029. *
  3030. * .. Scalar Arguments ..
  3031. CHARACTER HOWMNY, SIDE
  3032. - INTEGER INFO, LDA, LDB, LDVL, LDVR, M, MM, N
  3033. + INTEGER INFO, LDP, LDS, LDVL, LDVR, M, MM, N
  3034. * ..
  3035. * .. Array Arguments ..
  3036. LOGICAL SELECT( * )
  3037. REAL RWORK( * )
  3038. - COMPLEX A( LDA, * ), B( LDB, * ), VL( LDVL, * ),
  3039. + COMPLEX P( LDP, * ), S( LDS, * ), VL( LDVL, * ),
  3040. $ VR( LDVR, * ), WORK( * )
  3041. * ..
  3042. *
  3043. @@ -21,28 +21,30 @@
  3044. * Purpose
  3045. * =======
  3046. *
  3047. -* CTGEVC computes some or all of the right and/or left generalized
  3048. -* eigenvectors of a pair of complex upper triangular matrices (A,B).
  3049. -*
  3050. -* The right generalized eigenvector x and the left generalized
  3051. -* eigenvector y of (A,B) corresponding to a generalized eigenvalue
  3052. -* w are defined by:
  3053. -*
  3054. -* (A - wB) * x = 0 and y**H * (A - wB) = 0
  3055. -*
  3056. +* CTGEVC computes some or all of the right and/or left eigenvectors of
  3057. +* a pair of complex matrices (S,P), where S and P are upper triangular.
  3058. +* Matrix pairs of this type are produced by the generalized Schur
  3059. +* factorization of a complex matrix pair (A,B):
  3060. +*
  3061. +* A = Q*S*Z**H, B = Q*P*Z**H
  3062. +*
  3063. +* as computed by CGGHRD + CHGEQZ.
  3064. +*
  3065. +* The right eigenvector x and the left eigenvector y of (S,P)
  3066. +* corresponding to an eigenvalue w are defined by:
  3067. +*
  3068. +* S*x = w*P*x, (y**H)*S = w*(y**H)*P,
  3069. +*
  3070. * where y**H denotes the conjugate tranpose of y.
  3071. -*
  3072. -* If an eigenvalue w is determined by zero diagonal elements of both A
  3073. -* and B, a unit vector is returned as the corresponding eigenvector.
  3074. -*
  3075. -* If all eigenvectors are requested, the routine may either return
  3076. -* the matrices X and/or Y of right or left eigenvectors of (A,B), or
  3077. -* the products Z*X and/or Q*Y, where Z and Q are input unitary
  3078. -* matrices. If (A,B) was obtained from the generalized Schur
  3079. -* factorization of an original pair of matrices
  3080. -* (A0,B0) = (Q*A*Z**H,Q*B*Z**H),
  3081. -* then Z*X and Q*Y are the matrices of right or left eigenvectors of
  3082. -* A.
  3083. +* The eigenvalues are not input to this routine, but are computed
  3084. +* directly from the diagonal elements of S and P.
  3085. +*
  3086. +* This routine returns the matrices X and/or Y of right and left
  3087. +* eigenvectors of (S,P), or the products Z*X and/or Q*Y,
  3088. +* where Z and Q are input matrices.
  3089. +* If Q and Z are the unitary factors from the generalized Schur
  3090. +* factorization of a matrix pair (A,B), then Z*X and Q*Y
  3091. +* are the matrices of right and left eigenvectors of (A,B).
  3092. *
  3093. * Arguments
  3094. * =========
  3095. @@ -54,66 +56,66 @@
  3096. *
  3097. * HOWMNY (input) CHARACTER*1
  3098. * = 'A': compute all right and/or left eigenvectors;
  3099. -* = 'B': compute all right and/or left eigenvectors, and
  3100. -* backtransform them using the input matrices supplied
  3101. -* in VR and/or VL;
  3102. +* = 'B': compute all right and/or left eigenvectors,
  3103. +* backtransformed by the matrices in VR and/or VL;
  3104. * = 'S': compute selected right and/or left eigenvectors,
  3105. * specified by the logical array SELECT.
  3106. *
  3107. * SELECT (input) LOGICAL array, dimension (N)
  3108. * If HOWMNY='S', SELECT specifies the eigenvectors to be
  3109. -* computed.
  3110. -* If HOWMNY='A' or 'B', SELECT is not referenced.
  3111. -* To select the eigenvector corresponding to the j-th
  3112. -* eigenvalue, SELECT(j) must be set to .TRUE..
  3113. +* computed. The eigenvector corresponding to the j-th
  3114. +* eigenvalue is computed if SELECT(j) = .TRUE..
  3115. +* Not referenced if HOWMNY = 'A' or 'B'.
  3116. *
  3117. * N (input) INTEGER
  3118. -* The order of the matrices A and B. N >= 0.
  3119. -*
  3120. -* A (input) COMPLEX array, dimension (LDA,N)
  3121. -* The upper triangular matrix A.
  3122. -*
  3123. -* LDA (input) INTEGER
  3124. -* The leading dimension of array A. LDA >= max(1,N).
  3125. +* The order of the matrices S and P. N >= 0.
  3126. *
  3127. -* B (input) COMPLEX array, dimension (LDB,N)
  3128. -* The upper triangular matrix B. B must have real diagonal
  3129. -* elements.
  3130. +* S (input) COMPLEX array, dimension (LDS,N)
  3131. +* The upper triangular matrix S from a generalized Schur
  3132. +* factorization, as computed by CHGEQZ.
  3133. +*
  3134. +* LDS (input) INTEGER
  3135. +* The leading dimension of array S. LDS >= max(1,N).
  3136. +*
  3137. +* P (input) COMPLEX array, dimension (LDP,N)
  3138. +* The upper triangular matrix P from a generalized Schur
  3139. +* factorization, as computed by CHGEQZ. P must have real
  3140. +* diagonal elements.
  3141. *
  3142. -* LDB (input) INTEGER
  3143. -* The leading dimension of array B. LDB >= max(1,N).
  3144. +* LDP (input) INTEGER
  3145. +* The leading dimension of array P. LDP >= max(1,N).
  3146. *
  3147. * VL (input/output) COMPLEX array, dimension (LDVL,MM)
  3148. * On entry, if SIDE = 'L' or 'B' and HOWMNY = 'B', VL must
  3149. * contain an N-by-N matrix Q (usually the unitary matrix Q
  3150. * of left Schur vectors returned by CHGEQZ).
  3151. * On exit, if SIDE = 'L' or 'B', VL contains:
  3152. -* if HOWMNY = 'A', the matrix Y of left eigenvectors of (A,B);
  3153. +* if HOWMNY = 'A', the matrix Y of left eigenvectors of (S,P);
  3154. * if HOWMNY = 'B', the matrix Q*Y;
  3155. -* if HOWMNY = 'S', the left eigenvectors of (A,B) specified by
  3156. +* if HOWMNY = 'S', the left eigenvectors of (S,P) specified by
  3157. * SELECT, stored consecutively in the columns of
  3158. * VL, in the same order as their eigenvalues.
  3159. -* If SIDE = 'R', VL is not referenced.
  3160. +* Not referenced if SIDE = 'R'.
  3161. *
  3162. * LDVL (input) INTEGER
  3163. -* The leading dimension of array VL.
  3164. -* LDVL >= max(1,N) if SIDE = 'L' or 'B'; LDVL >= 1 otherwise.
  3165. +* The leading dimension of array VL. LDVL >= 1, and if
  3166. +* SIDE = 'L' or 'l' or 'B' or 'b', LDVL >= N.
  3167. *
  3168. * VR (input/output) COMPLEX array, dimension (LDVR,MM)
  3169. * On entry, if SIDE = 'R' or 'B' and HOWMNY = 'B', VR must
  3170. * contain an N-by-N matrix Q (usually the unitary matrix Z
  3171. * of right Schur vectors returned by CHGEQZ).
  3172. * On exit, if SIDE = 'R' or 'B', VR contains:
  3173. -* if HOWMNY = 'A', the matrix X of right eigenvectors of (A,B);
  3174. +* if HOWMNY = 'A', the matrix X of right eigenvectors of (S,P);
  3175. * if HOWMNY = 'B', the matrix Z*X;
  3176. -* if HOWMNY = 'S', the right eigenvectors of (A,B) specified by
  3177. +* if HOWMNY = 'S', the right eigenvectors of (S,P) specified by
  3178. * SELECT, stored consecutively in the columns of
  3179. * VR, in the same order as their eigenvalues.
  3180. -* If SIDE = 'L', VR is not referenced.
  3181. +* Not referenced if SIDE = 'L'.
  3182. *
  3183. * LDVR (input) INTEGER
  3184. -* The leading dimension of the array VR.
  3185. -* LDVR >= max(1,N) if SIDE = 'R' or 'B'; LDVR >= 1 otherwise.
  3186. +* The leading dimension of the array VR. LDVR >= 1, and if
  3187. +* SIDE = 'R' or 'B', LDVR >= N.
  3188. *
  3189. * MM (input) INTEGER
  3190. * The number of columns in the arrays VL and/or VR. MM >= M.
  3191. @@ -180,7 +182,7 @@
  3192. IHWMNY = 2
  3193. ILALL = .FALSE.
  3194. ILBACK = .FALSE.
  3195. - ELSE IF( LSAME( HOWMNY, 'B' ) .OR. LSAME( HOWMNY, 'T' ) ) THEN
  3196. + ELSE IF( LSAME( HOWMNY, 'B' ) ) THEN
  3197. IHWMNY = 3
  3198. ILALL = .TRUE.
  3199. ILBACK = .TRUE.
  3200. @@ -211,9 +213,9 @@
  3201. INFO = -2
  3202. ELSE IF( N.LT.0 ) THEN
  3203. INFO = -4
  3204. - ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
  3205. + ELSE IF( LDS.LT.MAX( 1, N ) ) THEN
  3206. INFO = -6
  3207. - ELSE IF( LDB.LT.MAX( 1, N ) ) THEN
  3208. + ELSE IF( LDP.LT.MAX( 1, N ) ) THEN
  3209. INFO = -8
  3210. END IF
  3211. IF( INFO.NE.0 ) THEN
  3212. @@ -237,7 +239,7 @@
  3213. *
  3214. ILBBAD = .FALSE.
  3215. DO 20 J = 1, N
  3216. - IF( AIMAG( B( J, J ) ).NE.ZERO )
  3217. + IF( AIMAG( P( J, J ) ).NE.ZERO )
  3218. $ ILBBAD = .TRUE.
  3219. 20 CONTINUE
  3220. *
  3221. @@ -275,19 +277,19 @@
  3222. * part of A and B to check for possible overflow in the triangular
  3223. * solver.
  3224. *
  3225. - ANORM = ABS1( A( 1, 1 ) )
  3226. - BNORM = ABS1( B( 1, 1 ) )
  3227. + ANORM = ABS1( S( 1, 1 ) )
  3228. + BNORM = ABS1( P( 1, 1 ) )
  3229. RWORK( 1 ) = ZERO
  3230. RWORK( N+1 ) = ZERO
  3231. DO 40 J = 2, N
  3232. RWORK( J ) = ZERO
  3233. RWORK( N+J ) = ZERO
  3234. DO 30 I = 1, J - 1
  3235. - RWORK( J ) = RWORK( J ) + ABS1( A( I, J ) )
  3236. - RWORK( N+J ) = RWORK( N+J ) + ABS1( B( I, J ) )
  3237. + RWORK( J ) = RWORK( J ) + ABS1( S( I, J ) )
  3238. + RWORK( N+J ) = RWORK( N+J ) + ABS1( P( I, J ) )
  3239. 30 CONTINUE
  3240. - ANORM = MAX( ANORM, RWORK( J )+ABS1( A( J, J ) ) )
  3241. - BNORM = MAX( BNORM, RWORK( N+J )+ABS1( B( J, J ) ) )
  3242. + ANORM = MAX( ANORM, RWORK( J )+ABS1( S( J, J ) ) )
  3243. + BNORM = MAX( BNORM, RWORK( N+J )+ABS1( P( J, J ) ) )
  3244. 40 CONTINUE
  3245. *
  3246. ASCALE = ONE / MAX( ANORM, SAFMIN )
  3247. @@ -309,8 +311,8 @@
  3248. IF( ILCOMP ) THEN
  3249. IEIG = IEIG + 1
  3250. *
  3251. - IF( ABS1( A( JE, JE ) ).LE.SAFMIN .AND.
  3252. - $ ABS( REAL( B( JE, JE ) ) ).LE.SAFMIN ) THEN
  3253. + IF( ABS1( S( JE, JE ) ).LE.SAFMIN .AND.
  3254. + $ ABS( REAL( P( JE, JE ) ) ).LE.SAFMIN ) THEN
  3255. *
  3256. * Singular matrix pencil -- return unit eigenvector
  3257. *
  3258. @@ -326,10 +328,10 @@
  3259. * H
  3260. * y ( a A - b B ) = 0
  3261. *
  3262. - TEMP = ONE / MAX( ABS1( A( JE, JE ) )*ASCALE,
  3263. - $ ABS( REAL( B( JE, JE ) ) )*BSCALE, SAFMIN )
  3264. - SALPHA = ( TEMP*A( JE, JE ) )*ASCALE
  3265. - SBETA = ( TEMP*REAL( B( JE, JE ) ) )*BSCALE
  3266. + TEMP = ONE / MAX( ABS1( S( JE, JE ) )*ASCALE,
  3267. + $ ABS( REAL( P( JE, JE ) ) )*BSCALE, SAFMIN )
  3268. + SALPHA = ( TEMP*S( JE, JE ) )*ASCALE
  3269. + SBETA = ( TEMP*REAL( P( JE, JE ) ) )*BSCALE
  3270. ACOEFF = SBETA*ASCALE
  3271. BCOEFF = SALPHA*BSCALE
  3272. *
  3273. @@ -380,7 +382,7 @@
  3274. *
  3275. * Compute
  3276. * j-1
  3277. -* SUM = sum conjg( a*A(k,j) - b*B(k,j) )*x(k)
  3278. +* SUM = sum conjg( a*S(k,j) - b*P(k,j) )*x(k)
  3279. * k=je
  3280. * (Scale if necessary)
  3281. *
  3282. @@ -396,16 +398,16 @@
  3283. SUMB = CZERO
  3284. *
  3285. DO 80 JR = JE, J - 1
  3286. - SUMA = SUMA + CONJG( A( JR, J ) )*WORK( JR )
  3287. - SUMB = SUMB + CONJG( B( JR, J ) )*WORK( JR )
  3288. + SUMA = SUMA + CONJG( S( JR, J ) )*WORK( JR )
  3289. + SUMB = SUMB + CONJG( P( JR, J ) )*WORK( JR )
  3290. 80 CONTINUE
  3291. SUM = ACOEFF*SUMA - CONJG( BCOEFF )*SUMB
  3292. *
  3293. -* Form x(j) = - SUM / conjg( a*A(j,j) - b*B(j,j) )
  3294. +* Form x(j) = - SUM / conjg( a*S(j,j) - b*P(j,j) )
  3295. *
  3296. * with scaling and perturbation of the denominator
  3297. *
  3298. - D = CONJG( ACOEFF*A( J, J )-BCOEFF*B( J, J ) )
  3299. + D = CONJG( ACOEFF*S( J, J )-BCOEFF*P( J, J ) )
  3300. IF( ABS1( D ).LE.DMIN )
  3301. $ D = CMPLX( DMIN )
  3302. *
  3303. @@ -475,8 +477,8 @@
  3304. IF( ILCOMP ) THEN
  3305. IEIG = IEIG - 1
  3306. *
  3307. - IF( ABS1( A( JE, JE ) ).LE.SAFMIN .AND.
  3308. - $ ABS( REAL( B( JE, JE ) ) ).LE.SAFMIN ) THEN
  3309. + IF( ABS1( S( JE, JE ) ).LE.SAFMIN .AND.
  3310. + $ ABS( REAL( P( JE, JE ) ) ).LE.SAFMIN ) THEN
  3311. *
  3312. * Singular matrix pencil -- return unit eigenvector
  3313. *
  3314. @@ -492,10 +494,10 @@
  3315. *
  3316. * ( a A - b B ) x = 0
  3317. *
  3318. - TEMP = ONE / MAX( ABS1( A( JE, JE ) )*ASCALE,
  3319. - $ ABS( REAL( B( JE, JE ) ) )*BSCALE, SAFMIN )
  3320. - SALPHA = ( TEMP*A( JE, JE ) )*ASCALE
  3321. - SBETA = ( TEMP*REAL( B( JE, JE ) ) )*BSCALE
  3322. + TEMP = ONE / MAX( ABS1( S( JE, JE ) )*ASCALE,
  3323. + $ ABS( REAL( P( JE, JE ) ) )*BSCALE, SAFMIN )
  3324. + SALPHA = ( TEMP*S( JE, JE ) )*ASCALE
  3325. + SBETA = ( TEMP*REAL( P( JE, JE ) ) )*BSCALE
  3326. ACOEFF = SBETA*ASCALE
  3327. BCOEFF = SALPHA*BSCALE
  3328. *
  3329. @@ -542,7 +544,7 @@
  3330. * WORK(j+1:JE) contains x
  3331. *
  3332. DO 170 JR = 1, JE - 1
  3333. - WORK( JR ) = ACOEFF*A( JR, JE ) - BCOEFF*B( JR, JE )
  3334. + WORK( JR ) = ACOEFF*S( JR, JE ) - BCOEFF*P( JR, JE )
  3335. 170 CONTINUE
  3336. WORK( JE ) = CONE
  3337. *
  3338. @@ -551,7 +553,7 @@
  3339. * Form x(j) := - w(j) / d
  3340. * with scaling and perturbation of the denominator
  3341. *
  3342. - D = ACOEFF*A( J, J ) - BCOEFF*B( J, J )
  3343. + D = ACOEFF*S( J, J ) - BCOEFF*P( J, J )
  3344. IF( ABS1( D ).LE.DMIN )
  3345. $ D = CMPLX( DMIN )
  3346. *
  3347. @@ -568,7 +570,7 @@
  3348. *
  3349. IF( J.GT.1 ) THEN
  3350. *
  3351. -* w = w + x(j)*(a A(*,j) - b B(*,j) ) with scaling
  3352. +* w = w + x(j)*(a S(*,j) - b P(*,j) ) with scaling
  3353. *
  3354. IF( ABS1( WORK( J ) ).GT.ONE ) THEN
  3355. TEMP = ONE / ABS1( WORK( J ) )
  3356. @@ -583,8 +585,8 @@
  3357. CA = ACOEFF*WORK( J )
  3358. CB = BCOEFF*WORK( J )
  3359. DO 200 JR = 1, J - 1
  3360. - WORK( JR ) = WORK( JR ) + CA*A( JR, J ) -
  3361. - $ CB*B( JR, J )
  3362. + WORK( JR ) = WORK( JR ) + CA*S( JR, J ) -
  3363. + $ CB*P( JR, J )
  3364. 200 CONTINUE
  3365. END IF
  3366. 210 CONTINUE
  3367. diff -uNr LAPACK.orig/SRC/ctrevc.f LAPACK/SRC/ctrevc.f
  3368. --- LAPACK.orig/SRC/ctrevc.f Thu Nov 4 14:24:23 1999
  3369. +++ LAPACK/SRC/ctrevc.f Fri May 25 16:13:56 2001
  3370. @@ -4,7 +4,7 @@
  3371. * -- LAPACK routine (version 3.0) --
  3372. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  3373. * Courant Institute, Argonne National Lab, and Rice University
  3374. -* June 30, 1999
  3375. +* May 7, 2001
  3376. *
  3377. * .. Scalar Arguments ..
  3378. CHARACTER HOWMNY, SIDE
  3379. @@ -22,20 +22,23 @@
  3380. *
  3381. * CTREVC computes some or all of the right and/or left eigenvectors of
  3382. * a complex upper triangular matrix T.
  3383. -*
  3384. +* Matrices of this type are produced by the Schur factorization of
  3385. +* a complex general matrix: A = Q*T*Q**H, as computed by CHSEQR.
  3386. +*
  3387. * The right eigenvector x and the left eigenvector y of T corresponding
  3388. * to an eigenvalue w are defined by:
  3389. -*
  3390. -* T*x = w*x, y'*T = w*y'
  3391. -*
  3392. -* where y' denotes the conjugate transpose of the vector y.
  3393. -*
  3394. -* If all eigenvectors are requested, the routine may either return the
  3395. -* matrices X and/or Y of right or left eigenvectors of T, or the
  3396. -* products Q*X and/or Q*Y, where Q is an input unitary
  3397. -* matrix. If T was obtained from the Schur factorization of an
  3398. -* original matrix A = Q*T*Q', then Q*X and Q*Y are the matrices of
  3399. -* right or left eigenvectors of A.
  3400. +*
  3401. +* T*x = w*x, (y**H)*T = w*(y**H)
  3402. +*
  3403. +* where y**H denotes the conjugate transpose of the vector y.
  3404. +* The eigenvalues are not input to this routine, but are read directly
  3405. +* from the diagonal of T.
  3406. +*
  3407. +* This routine returns the matrices X and/or Y of right and left
  3408. +* eigenvectors of T, or the products Q*X and/or Q*Y, where Q is an
  3409. +* input matrix. If Q is the unitary factor that reduces a matrix A to
  3410. +* Schur form T, then Q*X and Q*Y are the matrices of right and left
  3411. +* eigenvectors of A.
  3412. *
  3413. * Arguments
  3414. * =========
  3415. @@ -48,17 +51,17 @@
  3416. * HOWMNY (input) CHARACTER*1
  3417. * = 'A': compute all right and/or left eigenvectors;
  3418. * = 'B': compute all right and/or left eigenvectors,
  3419. -* and backtransform them using the input matrices
  3420. -* supplied in VR and/or VL;
  3421. +* backtransformed using the matrices supplied in
  3422. +* VR and/or VL;
  3423. * = 'S': compute selected right and/or left eigenvectors,
  3424. -* specified by the logical array SELECT.
  3425. +* as indicated by the logical array SELECT.
  3426. *
  3427. * SELECT (input) LOGICAL array, dimension (N)
  3428. * If HOWMNY = 'S', SELECT specifies the eigenvectors to be
  3429. * computed.
  3430. -* If HOWMNY = 'A' or 'B', SELECT is not referenced.
  3431. -* To select the eigenvector corresponding to the j-th
  3432. -* eigenvalue, SELECT(j) must be set to .TRUE..
  3433. +* The eigenvector corresponding to the j-th eigenvalue is
  3434. +* computed if SELECT(j) = .TRUE..
  3435. +* Not referenced if HOWMNY = 'A' or 'B'.
  3436. *
  3437. * N (input) INTEGER
  3438. * The order of the matrix T. N >= 0.
  3439. @@ -76,19 +79,16 @@
  3440. * Schur vectors returned by CHSEQR).
  3441. * On exit, if SIDE = 'L' or 'B', VL contains:
  3442. * if HOWMNY = 'A', the matrix Y of left eigenvectors of T;
  3443. -* VL is lower triangular. The i-th column
  3444. -* VL(i) of VL is the eigenvector corresponding
  3445. -* to T(i,i).
  3446. * if HOWMNY = 'B', the matrix Q*Y;
  3447. * if HOWMNY = 'S', the left eigenvectors of T specified by
  3448. * SELECT, stored consecutively in the columns
  3449. * of VL, in the same order as their
  3450. * eigenvalues.
  3451. -* If SIDE = 'R', VL is not referenced.
  3452. +* Not referenced if SIDE = 'R'.
  3453. *
  3454. * LDVL (input) INTEGER
  3455. -* The leading dimension of the array VL. LDVL >= max(1,N) if
  3456. -* SIDE = 'L' or 'B'; LDVL >= 1 otherwise.
  3457. +* The leading dimension of the array VL. LDVL >= 1, and if
  3458. +* SIDE = 'L' or 'B', LDVL >= N.
  3459. *
  3460. * VR (input/output) COMPLEX array, dimension (LDVR,MM)
  3461. * On entry, if SIDE = 'R' or 'B' and HOWMNY = 'B', VR must
  3462. @@ -96,19 +96,16 @@
  3463. * Schur vectors returned by CHSEQR).
  3464. * On exit, if SIDE = 'R' or 'B', VR contains:
  3465. * if HOWMNY = 'A', the matrix X of right eigenvectors of T;
  3466. -* VR is upper triangular. The i-th column
  3467. -* VR(i) of VR is the eigenvector corresponding
  3468. -* to T(i,i).
  3469. * if HOWMNY = 'B', the matrix Q*X;
  3470. * if HOWMNY = 'S', the right eigenvectors of T specified by
  3471. * SELECT, stored consecutively in the columns
  3472. * of VR, in the same order as their
  3473. * eigenvalues.
  3474. -* If SIDE = 'L', VR is not referenced.
  3475. +* Not referenced if SIDE = 'L'.
  3476. *
  3477. * LDVR (input) INTEGER
  3478. -* The leading dimension of the array VR. LDVR >= max(1,N) if
  3479. -* SIDE = 'R' or 'B'; LDVR >= 1 otherwise.
  3480. +* The leading dimension of the array VR. LDVR >= 1, and if
  3481. +* SIDE = 'R' or 'B'; LDVR >= N.
  3482. *
  3483. * MM (input) INTEGER
  3484. * The number of columns in the arrays VL and/or VR. MM >= M.
  3485. diff -uNr LAPACK.orig/SRC/ctrsen.f LAPACK/SRC/ctrsen.f
  3486. --- LAPACK.orig/SRC/ctrsen.f Thu Nov 4 14:24:24 1999
  3487. +++ LAPACK/SRC/ctrsen.f Fri May 25 16:14:15 2001
  3488. @@ -4,7 +4,7 @@
  3489. * -- LAPACK routine (version 3.0) --
  3490. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  3491. * Courant Institute, Argonne National Lab, and Rice University
  3492. -* June 30, 1999
  3493. +* January 3, 2001
  3494. *
  3495. * .. Scalar Arguments ..
  3496. CHARACTER COMPQ, JOB
  3497. @@ -93,14 +93,13 @@
  3498. * If JOB = 'N' or 'E', SEP is not referenced.
  3499. *
  3500. * WORK (workspace/output) COMPLEX array, dimension (LWORK)
  3501. -* If JOB = 'N', WORK is not referenced. Otherwise,
  3502. -* on exit, if INFO = 0, WORK(1) returns the optimal LWORK.
  3503. +* On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
  3504. *
  3505. * LWORK (input) INTEGER
  3506. * The dimension of the array WORK.
  3507. * If JOB = 'N', LWORK >= 1;
  3508. -* if JOB = 'E', LWORK = M*(N-M);
  3509. -* if JOB = 'V' or 'B', LWORK >= 2*M*(N-M).
  3510. +* if JOB = 'E', LWORK = max(1,M*(N-M));
  3511. +* if JOB = 'V' or 'B', LWORK >= max(1,2*M*(N-M)).
  3512. *
  3513. * If LWORK = -1, then a workspace query is assumed; the routine
  3514. * only calculates the optimal size of the WORK array, returns
  3515. diff -uNr LAPACK.orig/SRC/ctrsyl.f LAPACK/SRC/ctrsyl.f
  3516. --- LAPACK.orig/SRC/ctrsyl.f Thu Nov 4 14:24:24 1999
  3517. +++ LAPACK/SRC/ctrsyl.f Fri May 25 16:14:25 2001
  3518. @@ -4,7 +4,7 @@
  3519. * -- LAPACK routine (version 3.0) --
  3520. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  3521. * Courant Institute, Argonne National Lab, and Rice University
  3522. -* June 30, 1999
  3523. +* January 9, 2001
  3524. *
  3525. * .. Scalar Arguments ..
  3526. CHARACTER TRANA, TRANB
  3527. @@ -119,11 +119,9 @@
  3528. NOTRNB = LSAME( TRANB, 'N' )
  3529. *
  3530. INFO = 0
  3531. - IF( .NOT.NOTRNA .AND. .NOT.LSAME( TRANA, 'T' ) .AND. .NOT.
  3532. - $ LSAME( TRANA, 'C' ) ) THEN
  3533. + IF( .NOT.NOTRNA .AND. .NOT.LSAME( TRANA, 'C' ) ) THEN
  3534. INFO = -1
  3535. - ELSE IF( .NOT.NOTRNB .AND. .NOT.LSAME( TRANB, 'T' ) .AND. .NOT.
  3536. - $ LSAME( TRANB, 'C' ) ) THEN
  3537. + ELSE IF( .NOT.NOTRNB .AND. .NOT.LSAME( TRANB, 'C' ) ) THEN
  3538. INFO = -2
  3539. ELSE IF( ISGN.NE.1 .AND. ISGN.NE.-1 ) THEN
  3540. INFO = -3
  3541. diff -uNr LAPACK.orig/SRC/dbdsqr.f LAPACK/SRC/dbdsqr.f
  3542. --- LAPACK.orig/SRC/dbdsqr.f Thu Nov 4 14:24:42 1999
  3543. +++ LAPACK/SRC/dbdsqr.f Fri May 25 15:59:00 2001
  3544. @@ -4,7 +4,7 @@
  3545. * -- LAPACK routine (version 3.0) --
  3546. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  3547. * Courant Institute, Argonne National Lab, and Rice University
  3548. -* October 31, 1999
  3549. +* April 25, 2001
  3550. *
  3551. * .. Scalar Arguments ..
  3552. CHARACTER UPLO
  3553. @@ -18,14 +18,26 @@
  3554. * Purpose
  3555. * =======
  3556. *
  3557. -* DBDSQR computes the singular value decomposition (SVD) of a real
  3558. -* N-by-N (upper or lower) bidiagonal matrix B: B = Q * S * P' (P'
  3559. -* denotes the transpose of P), where S is a diagonal matrix with
  3560. -* non-negative diagonal elements (the singular values of B), and Q
  3561. -* and P are orthogonal matrices.
  3562. +* DBDSQR computes the singular values and, optionally, the right and/or
  3563. +* left singular vectors from the singular value decomposition (SVD) of
  3564. +* a real N-by-N (upper or lower) bidiagonal matrix B using the implicit
  3565. +* zero-shift QR algorithm. The SVD of B has the form
  3566. +*
  3567. +* B = Q * S * P**T
  3568. +*
  3569. +* where S is the diagonal matrix of singular values, Q is an orthogonal
  3570. +* matrix of left singular vectors, and P is an orthogonal matrix of
  3571. +* right singular vectors. If left singular vectors are requested, this
  3572. +* subroutine actually returns U*Q instead of Q, and, if right singular
  3573. +* vectors are requested, this subroutine returns P**T*VT instead of
  3574. +* P**T, for given real input matrices U and VT. When U and VT are the
  3575. +* orthogonal matrices that reduce a general matrix A to bidiagonal
  3576. +* form: A = U*B*VT, as computed by DGEBRD, then
  3577. *
  3578. -* The routine computes S, and optionally computes U * Q, P' * VT,
  3579. -* or Q' * C, for given real input matrices U, VT, and C.
  3580. +* A = (U*Q) * S * (P**T*VT)
  3581. +*
  3582. +* is the SVD of A. Optionally, the subroutine may also compute Q**T*C
  3583. +* for a given real input matrix C.
  3584. *
  3585. * See "Computing Small Singular Values of Bidiagonal Matrices With
  3586. * Guaranteed High Relative Accuracy," by J. Demmel and W. Kahan,
  3587. @@ -61,18 +73,17 @@
  3588. * order.
  3589. *
  3590. * E (input/output) DOUBLE PRECISION array, dimension (N)
  3591. -* On entry, the elements of E contain the
  3592. -* offdiagonal elements of the bidiagonal matrix whose SVD
  3593. -* is desired. On normal exit (INFO = 0), E is destroyed.
  3594. -* If the algorithm does not converge (INFO > 0), D and E
  3595. +* On entry, the N-1 offdiagonal elements of the bidiagonal
  3596. +* matrix B.
  3597. +* On exit, if INFO = 0, E is destroyed; if INFO > 0, D and E
  3598. * will contain the diagonal and superdiagonal elements of a
  3599. * bidiagonal matrix orthogonally equivalent to the one given
  3600. * as input. E(N) is used for workspace.
  3601. *
  3602. * VT (input/output) DOUBLE PRECISION array, dimension (LDVT, NCVT)
  3603. * On entry, an N-by-NCVT matrix VT.
  3604. -* On exit, VT is overwritten by P' * VT.
  3605. -* VT is not referenced if NCVT = 0.
  3606. +* On exit, VT is overwritten by P**T * VT.
  3607. +* Not referenced if NCVT = 0.
  3608. *
  3609. * LDVT (input) INTEGER
  3610. * The leading dimension of the array VT.
  3611. @@ -81,21 +92,22 @@
  3612. * U (input/output) DOUBLE PRECISION array, dimension (LDU, N)
  3613. * On entry, an NRU-by-N matrix U.
  3614. * On exit, U is overwritten by U * Q.
  3615. -* U is not referenced if NRU = 0.
  3616. +* Not referenced if NRU = 0.
  3617. *
  3618. * LDU (input) INTEGER
  3619. * The leading dimension of the array U. LDU >= max(1,NRU).
  3620. *
  3621. * C (input/output) DOUBLE PRECISION array, dimension (LDC, NCC)
  3622. * On entry, an N-by-NCC matrix C.
  3623. -* On exit, C is overwritten by Q' * C.
  3624. -* C is not referenced if NCC = 0.
  3625. +* On exit, C is overwritten by Q**T * C.
  3626. +* Not referenced if NCC = 0.
  3627. *
  3628. * LDC (input) INTEGER
  3629. * The leading dimension of the array C.
  3630. * LDC >= max(1,N) if NCC > 0; LDC >=1 if NCC = 0.
  3631. *
  3632. -* WORK (workspace) DOUBLE PRECISION array, dimension (4*N)
  3633. +* WORK (workspace) DOUBLE PRECISION array, dimension (2*N)
  3634. +* if NCVT = NRU = NCC = 0, (max(1, 4*N-4)) otherwise
  3635. *
  3636. * INFO (output) INTEGER
  3637. * = 0: successful exit
  3638. diff -uNr LAPACK.orig/SRC/dgebd2.f LAPACK/SRC/dgebd2.f
  3639. --- LAPACK.orig/SRC/dgebd2.f Thu Nov 4 14:24:42 1999
  3640. +++ LAPACK/SRC/dgebd2.f Fri May 25 15:59:22 2001
  3641. @@ -3,7 +3,7 @@
  3642. * -- LAPACK routine (version 3.0) --
  3643. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  3644. * Courant Institute, Argonne National Lab, and Rice University
  3645. -* February 29, 1992
  3646. +* May 7, 2001
  3647. *
  3648. * .. Scalar Arguments ..
  3649. INTEGER INFO, LDA, M, N
  3650. @@ -169,8 +169,9 @@
  3651. *
  3652. * Apply H(i) to A(i:m,i+1:n) from the left
  3653. *
  3654. - CALL DLARF( 'Left', M-I+1, N-I, A( I, I ), 1, TAUQ( I ),
  3655. - $ A( I, I+1 ), LDA, WORK )
  3656. + IF( I.LT.N )
  3657. + $ CALL DLARF( 'Left', M-I+1, N-I, A( I, I ), 1, TAUQ( I ),
  3658. + $ A( I, I+1 ), LDA, WORK )
  3659. A( I, I ) = D( I )
  3660. *
  3661. IF( I.LT.N ) THEN
  3662. @@ -207,8 +208,9 @@
  3663. *
  3664. * Apply G(i) to A(i+1:m,i:n) from the right
  3665. *
  3666. - CALL DLARF( 'Right', M-I, N-I+1, A( I, I ), LDA, TAUP( I ),
  3667. - $ A( MIN( I+1, M ), I ), LDA, WORK )
  3668. + IF( I.LT.M )
  3669. + $ CALL DLARF( 'Right', M-I, N-I+1, A( I, I ), LDA,
  3670. + $ TAUP( I ), A( MIN( I+1, M ), I ), LDA, WORK )
  3671. A( I, I ) = D( I )
  3672. *
  3673. IF( I.LT.M ) THEN
  3674. diff -uNr LAPACK.orig/SRC/dgees.f LAPACK/SRC/dgees.f
  3675. --- LAPACK.orig/SRC/dgees.f Thu Nov 4 14:24:43 1999
  3676. +++ LAPACK/SRC/dgees.f Fri May 25 15:59:50 2001
  3677. @@ -5,6 +5,7 @@
  3678. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  3679. * Courant Institute, Argonne National Lab, and Rice University
  3680. * June 30, 1999
  3681. +* 8-15-00: Improve consistency of WS calculations (eca)
  3682. *
  3683. * .. Scalar Arguments ..
  3684. CHARACTER JOBVS, SORT
  3685. @@ -110,10 +111,9 @@
  3686. * The dimension of the array WORK. LWORK >= max(1,3*N).
  3687. * For good performance, LWORK must generally be larger.
  3688. *
  3689. -* If LWORK = -1, then a workspace query is assumed; the routine
  3690. -* only calculates the optimal size of the WORK array, returns
  3691. -* this value as the first entry of the WORK array, and no error
  3692. -* message related to LWORK is issued by XERBLA.
  3693. +* If LWORK = -1, a workspace query is assumed. The optimal
  3694. +* size for the WORK array is calculated and stored in WORK(1),
  3695. +* and no other work except argument checking is performed.
  3696. *
  3697. * BWORK (workspace) LOGICAL array, dimension (N)
  3698. * Not referenced if SORT = 'N'.
  3699. @@ -138,12 +138,13 @@
  3700. * =====================================================================
  3701. *
  3702. * .. Parameters ..
  3703. + INTEGER LQUERV
  3704. + PARAMETER ( LQUERV = -1 )
  3705. DOUBLE PRECISION ZERO, ONE
  3706. PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0 )
  3707. * ..
  3708. * .. Local Scalars ..
  3709. - LOGICAL CURSL, LASTSL, LQUERY, LST2SL, SCALEA, WANTST,
  3710. - $ WANTVS
  3711. + LOGICAL CURSL, LASTSL, LST2SL, SCALEA, WANTST, WANTVS
  3712. INTEGER HSWORK, I, I1, I2, IBAL, ICOND, IERR, IEVAL,
  3713. $ IHI, ILO, INXT, IP, ITAU, IWRK, K, MAXB,
  3714. $ MAXWRK, MINWRK
  3715. @@ -154,8 +155,8 @@
  3716. DOUBLE PRECISION DUM( 1 )
  3717. * ..
  3718. * .. External Subroutines ..
  3719. - EXTERNAL DCOPY, DGEBAK, DGEBAL, DGEHRD, DHSEQR, DLACPY,
  3720. - $ DLASCL, DORGHR, DSWAP, DTRSEN, XERBLA
  3721. + EXTERNAL DCOPY, DGEBAK, DGEBAL, DGEHRD, DHSEQR, DLABAD,
  3722. + $ DLACPY, DLASCL, DORGHR, DSWAP, DTRSEN, XERBLA
  3723. * ..
  3724. * .. External Functions ..
  3725. LOGICAL LSAME
  3726. @@ -171,7 +172,6 @@
  3727. * Test the input arguments
  3728. *
  3729. INFO = 0
  3730. - LQUERY = ( LWORK.EQ.-1 )
  3731. WANTVS = LSAME( JOBVS, 'V' )
  3732. WANTST = LSAME( SORT, 'S' )
  3733. IF( ( .NOT.WANTVS ) .AND. ( .NOT.LSAME( JOBVS, 'N' ) ) ) THEN
  3734. @@ -197,7 +197,7 @@
  3735. * the worst case.)
  3736. *
  3737. MINWRK = 1
  3738. - IF( INFO.EQ.0 .AND. ( LWORK.GE.1 .OR. LQUERY ) ) THEN
  3739. + IF( INFO.EQ.0 ) THEN
  3740. MAXWRK = 2*N + N*ILAENV( 1, 'DGEHRD', ' ', N, 1, N, 0 )
  3741. MINWRK = MAX( 1, 3*N )
  3742. IF( .NOT.WANTVS ) THEN
  3743. @@ -216,19 +216,18 @@
  3744. MAXWRK = MAX( MAXWRK, N+HSWORK, 1 )
  3745. END IF
  3746. WORK( 1 ) = MAXWRK
  3747. + IF( LWORK.LT.MINWRK .AND. LWORK.NE.LQUERV )
  3748. + $ INFO = -13
  3749. END IF
  3750. - IF( LWORK.LT.MINWRK .AND. .NOT.LQUERY ) THEN
  3751. - INFO = -13
  3752. - END IF
  3753. +*
  3754. +* Quick returns
  3755. +*
  3756. IF( INFO.NE.0 ) THEN
  3757. CALL XERBLA( 'DGEES ', -INFO )
  3758. RETURN
  3759. - ELSE IF( LQUERY ) THEN
  3760. - RETURN
  3761. END IF
  3762. -*
  3763. -* Quick return if possible
  3764. -*
  3765. + IF( LWORK.EQ.LQUERV )
  3766. + $ RETURN
  3767. IF( N.EQ.0 ) THEN
  3768. SDIM = 0
  3769. RETURN
  3770. diff -uNr LAPACK.orig/SRC/dgeesx.f LAPACK/SRC/dgeesx.f
  3771. --- LAPACK.orig/SRC/dgeesx.f Thu Nov 4 14:24:43 1999
  3772. +++ LAPACK/SRC/dgeesx.f Fri May 25 16:00:13 2001
  3773. @@ -6,6 +6,7 @@
  3774. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  3775. * Courant Institute, Argonne National Lab, and Rice University
  3776. * June 30, 1999
  3777. +* 8-15-00: Do WS calculations if LWORK = -1 (eca)
  3778. *
  3779. * .. Scalar Arguments ..
  3780. CHARACTER JOBVS, SENSE, SORT
  3781. @@ -140,6 +141,10 @@
  3782. * N+2*SDIM*(N-SDIM) <= N+N*N/2.
  3783. * For good performance, LWORK must generally be larger.
  3784. *
  3785. +* If LWORK = -1, a workspace query is assumed. The optimal
  3786. +* size for the WORK array is calculated and stored in WORK(1),
  3787. +* and no other work except argument checking is performed.
  3788. +*
  3789. * IWORK (workspace/output) INTEGER array, dimension (LIWORK)
  3790. * Not referenced if SENSE = 'N' or 'E'.
  3791. * On exit, if INFO = 0, IWORK(1) returns the optimal LIWORK.
  3792. @@ -171,6 +176,8 @@
  3793. * =====================================================================
  3794. *
  3795. * .. Parameters ..
  3796. + INTEGER LQUERV
  3797. + PARAMETER ( LQUERV = -1 )
  3798. DOUBLE PRECISION ZERO, ONE
  3799. PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0 )
  3800. * ..
  3801. @@ -186,8 +193,8 @@
  3802. DOUBLE PRECISION DUM( 1 )
  3803. * ..
  3804. * .. External Subroutines ..
  3805. - EXTERNAL DCOPY, DGEBAK, DGEBAL, DGEHRD, DHSEQR, DLACPY,
  3806. - $ DLASCL, DORGHR, DSWAP, DTRSEN, XERBLA
  3807. + EXTERNAL DCOPY, DGEBAK, DGEBAL, DGEHRD, DHSEQR, DLABAD,
  3808. + $ DLACPY, DLASCL, DORGHR, DSWAP, DTRSEN, XERBLA
  3809. * ..
  3810. * .. External Functions ..
  3811. LOGICAL LSAME
  3812. @@ -239,7 +246,7 @@
  3813. * in the code.)
  3814. *
  3815. MINWRK = 1
  3816. - IF( INFO.EQ.0 .AND. LWORK.GE.1 ) THEN
  3817. + IF( INFO.EQ.0 ) THEN
  3818. MAXWRK = 2*N + N*ILAENV( 1, 'DGEHRD', ' ', N, 1, N, 0 )
  3819. MINWRK = MAX( 1, 3*N )
  3820. IF( .NOT.WANTVS ) THEN
  3821. @@ -257,21 +264,25 @@
  3822. HSWORK = MAX( K*( K+2 ), 2*N )
  3823. MAXWRK = MAX( MAXWRK, N+HSWORK, 1 )
  3824. END IF
  3825. +*
  3826. +* Estimate the workspace needed by DTRSEN.
  3827. +*
  3828. + IF( WANTST ) THEN
  3829. + MAXWRK = MAX( MAXWRK, N+( N*N+1 ) / 2 )
  3830. + END IF
  3831. WORK( 1 ) = MAXWRK
  3832. + IF( LWORK.LT.MINWRK .AND. LWORK.NE.LQUERV )
  3833. + $ INFO = -16
  3834. END IF
  3835. - IF( LWORK.LT.MINWRK ) THEN
  3836. - INFO = -16
  3837. - END IF
  3838. - IF( LIWORK.LT.1 ) THEN
  3839. - INFO = -18
  3840. - END IF
  3841. +*
  3842. +* Quick returns
  3843. +*
  3844. IF( INFO.NE.0 ) THEN
  3845. CALL XERBLA( 'DGEESX', -INFO )
  3846. RETURN
  3847. END IF
  3848. -*
  3849. -* Quick return if possible
  3850. -*
  3851. + IF( LWORK.EQ.LQUERV )
  3852. + $ RETURN
  3853. IF( N.EQ.0 ) THEN
  3854. SDIM = 0
  3855. RETURN
  3856. diff -uNr LAPACK.orig/SRC/dgeev.f LAPACK/SRC/dgeev.f
  3857. --- LAPACK.orig/SRC/dgeev.f Wed Dec 8 16:00:35 1999
  3858. +++ LAPACK/SRC/dgeev.f Fri May 25 16:00:43 2001
  3859. @@ -4,7 +4,8 @@
  3860. * -- LAPACK driver routine (version 3.0) --
  3861. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  3862. * Courant Institute, Argonne National Lab, and Rice University
  3863. -* December 8, 1999
  3864. +* June 30, 1999
  3865. +* 8-15-00: Improve consistency of WS calculations (eca)
  3866. *
  3867. * .. Scalar Arguments ..
  3868. CHARACTER JOBVL, JOBVR
  3869. @@ -98,10 +99,9 @@
  3870. * if JOBVL = 'V' or JOBVR = 'V', LWORK >= 4*N. For good
  3871. * performance, LWORK must generally be larger.
  3872. *
  3873. -* If LWORK = -1, then a workspace query is assumed; the routine
  3874. -* only calculates the optimal size of the WORK array, returns
  3875. -* this value as the first entry of the WORK array, and no error
  3876. -* message related to LWORK is issued by XERBLA.
  3877. +* If LWORK = -1, a workspace query is assumed. The optimal
  3878. +* size for the WORK array is calculated and stored in WORK(1),
  3879. +* and no other work except argument checking is performed.
  3880. *
  3881. * INFO (output) INTEGER
  3882. * = 0: successful exit
  3883. @@ -114,11 +114,13 @@
  3884. * =====================================================================
  3885. *
  3886. * .. Parameters ..
  3887. + INTEGER LQUERV
  3888. + PARAMETER ( LQUERV = -1 )
  3889. DOUBLE PRECISION ZERO, ONE
  3890. PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0 )
  3891. * ..
  3892. * .. Local Scalars ..
  3893. - LOGICAL LQUERY, SCALEA, WANTVL, WANTVR
  3894. + LOGICAL SCALEA, WANTVL, WANTVR
  3895. CHARACTER SIDE
  3896. INTEGER HSWORK, I, IBAL, IERR, IHI, ILO, ITAU, IWRK, K,
  3897. $ MAXB, MAXWRK, MINWRK, NOUT
  3898. @@ -130,8 +132,9 @@
  3899. DOUBLE PRECISION DUM( 1 )
  3900. * ..
  3901. * .. External Subroutines ..
  3902. - EXTERNAL DGEBAK, DGEBAL, DGEHRD, DHSEQR, DLACPY, DLARTG,
  3903. - $ DLASCL, DORGHR, DROT, DSCAL, DTREVC, XERBLA
  3904. + EXTERNAL DGEBAK, DGEBAL, DGEHRD, DHSEQR, DLABAD, DLACPY,
  3905. + $ DLARTG, DLASCL, DORGHR, DROT, DSCAL, DTREVC,
  3906. + $ XERBLA
  3907. * ..
  3908. * .. External Functions ..
  3909. LOGICAL LSAME
  3910. @@ -148,7 +151,6 @@
  3911. * Test the input arguments
  3912. *
  3913. INFO = 0
  3914. - LQUERY = ( LWORK.EQ.-1 )
  3915. WANTVL = LSAME( JOBVL, 'V' )
  3916. WANTVR = LSAME( JOBVR, 'V' )
  3917. IF( ( .NOT.WANTVL ) .AND. ( .NOT.LSAME( JOBVL, 'N' ) ) ) THEN
  3918. @@ -176,7 +178,7 @@
  3919. * the worst case.)
  3920. *
  3921. MINWRK = 1
  3922. - IF( INFO.EQ.0 .AND. ( LWORK.GE.1 .OR. LQUERY ) ) THEN
  3923. + IF( INFO.EQ.0 ) THEN
  3924. MAXWRK = 2*N + N*ILAENV( 1, 'DGEHRD', ' ', N, 1, N, 0 )
  3925. IF( ( .NOT.WANTVL ) .AND. ( .NOT.WANTVR ) ) THEN
  3926. MINWRK = MAX( 1, 3*N )
  3927. @@ -197,19 +199,18 @@
  3928. MAXWRK = MAX( MAXWRK, 4*N )
  3929. END IF
  3930. WORK( 1 ) = MAXWRK
  3931. + IF( LWORK.LT.MINWRK .AND. LWORK.NE.LQUERV )
  3932. + $ INFO = -13
  3933. END IF
  3934. - IF( LWORK.LT.MINWRK .AND. .NOT.LQUERY ) THEN
  3935. - INFO = -13
  3936. - END IF
  3937. +*
  3938. +* Quick returns
  3939. +*
  3940. IF( INFO.NE.0 ) THEN
  3941. CALL XERBLA( 'DGEEV ', -INFO )
  3942. RETURN
  3943. - ELSE IF( LQUERY ) THEN
  3944. - RETURN
  3945. END IF
  3946. -*
  3947. -* Quick return if possible
  3948. -*
  3949. + IF( LWORK.EQ.LQUERV )
  3950. + $ RETURN
  3951. IF( N.EQ.0 )
  3952. $ RETURN
  3953. *
  3954. diff -uNr LAPACK.orig/SRC/dgeevx.f LAPACK/SRC/dgeevx.f
  3955. --- LAPACK.orig/SRC/dgeevx.f Thu Nov 4 14:24:43 1999
  3956. +++ LAPACK/SRC/dgeevx.f Fri May 25 16:01:05 2001
  3957. @@ -6,6 +6,7 @@
  3958. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  3959. * Courant Institute, Argonne National Lab, and Rice University
  3960. * June 30, 1999
  3961. +* 8-15-00: Improve consistency of WS calculations (eca)
  3962. *
  3963. * .. Scalar Arguments ..
  3964. CHARACTER BALANC, JOBVL, JOBVR, SENSE
  3965. @@ -179,10 +180,9 @@
  3966. * LWORK >= 3*N. If SENSE = 'V' or 'B', LWORK >= N*(N+6).
  3967. * For good performance, LWORK must generally be larger.
  3968. *
  3969. -* If LWORK = -1, then a workspace query is assumed; the routine
  3970. -* only calculates the optimal size of the WORK array, returns
  3971. -* this value as the first entry of the WORK array, and no error
  3972. -* message related to LWORK is issued by XERBLA.
  3973. +* If LWORK = -1, a workspace query is assumed. The optimal
  3974. +* size for the WORK array is calculated and stored in WORK(1),
  3975. +* and no other work except argument checking is performed.
  3976. *
  3977. * IWORK (workspace) INTEGER array, dimension (2*N-2)
  3978. * If SENSE = 'N' or 'E', not referenced.
  3979. @@ -198,12 +198,14 @@
  3980. * =====================================================================
  3981. *
  3982. * .. Parameters ..
  3983. + INTEGER LQUERV
  3984. + PARAMETER ( LQUERV = -1 )
  3985. DOUBLE PRECISION ZERO, ONE
  3986. PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0 )
  3987. * ..
  3988. * .. Local Scalars ..
  3989. - LOGICAL LQUERY, SCALEA, WANTVL, WANTVR, WNTSNB, WNTSNE,
  3990. - $ WNTSNN, WNTSNV
  3991. + LOGICAL SCALEA, WANTVL, WANTVR, WNTSNB, WNTSNE, WNTSNN,
  3992. + $ WNTSNV
  3993. CHARACTER JOB, SIDE
  3994. INTEGER HSWORK, I, ICOND, IERR, ITAU, IWRK, K, MAXB,
  3995. $ MAXWRK, MINWRK, NOUT
  3996. @@ -215,9 +217,9 @@
  3997. DOUBLE PRECISION DUM( 1 )
  3998. * ..
  3999. * .. External Subroutines ..
  4000. - EXTERNAL DGEBAK, DGEBAL, DGEHRD, DHSEQR, DLACPY, DLARTG,
  4001. - $ DLASCL, DORGHR, DROT, DSCAL, DTREVC, DTRSNA,
  4002. - $ XERBLA
  4003. + EXTERNAL DGEBAK, DGEBAL, DGEHRD, DHSEQR, DLABAD, DLACPY,
  4004. + $ DLARTG, DLASCL, DORGHR, DROT, DSCAL, DTREVC,
  4005. + $ DTRSNA, XERBLA
  4006. * ..
  4007. * .. External Functions ..
  4008. LOGICAL LSAME
  4009. @@ -234,7 +236,6 @@
  4010. * Test the input arguments
  4011. *
  4012. INFO = 0
  4013. - LQUERY = ( LWORK.EQ.-1 )
  4014. WANTVL = LSAME( JOBVL, 'V' )
  4015. WANTVR = LSAME( JOBVR, 'V' )
  4016. WNTSNN = LSAME( SENSE, 'N' )
  4017. @@ -274,7 +275,7 @@
  4018. * the worst case.)
  4019. *
  4020. MINWRK = 1
  4021. - IF( INFO.EQ.0 .AND. ( LWORK.GE.1 .OR. LQUERY ) ) THEN
  4022. + IF( INFO.EQ.0 ) THEN
  4023. MAXWRK = N + N*ILAENV( 1, 'DGEHRD', ' ', N, 1, N, 0 )
  4024. IF( ( .NOT.WANTVL ) .AND. ( .NOT.WANTVR ) ) THEN
  4025. MINWRK = MAX( 1, 2*N )
  4026. @@ -308,19 +309,18 @@
  4027. MAXWRK = MAX( MAXWRK, 3*N, 1 )
  4028. END IF
  4029. WORK( 1 ) = MAXWRK
  4030. + IF( LWORK.LT.MINWRK .AND. LWORK.NE.LQUERV )
  4031. + $ INFO = -21
  4032. END IF
  4033. - IF( LWORK.LT.MINWRK .AND. .NOT.LQUERY ) THEN
  4034. - INFO = -21
  4035. - END IF
  4036. +*
  4037. +* Quick returns
  4038. +*
  4039. IF( INFO.NE.0 ) THEN
  4040. CALL XERBLA( 'DGEEVX', -INFO )
  4041. RETURN
  4042. - ELSE IF( LQUERY ) THEN
  4043. - RETURN
  4044. END IF
  4045. -*
  4046. -* Quick return if possible
  4047. -*
  4048. + IF( LWORK.EQ.LQUERV )
  4049. + $ RETURN
  4050. IF( N.EQ.0 )
  4051. $ RETURN
  4052. *
  4053. diff -uNr LAPACK.orig/SRC/dgegs.f LAPACK/SRC/dgegs.f
  4054. --- LAPACK.orig/SRC/dgegs.f Thu Nov 4 14:24:43 1999
  4055. +++ LAPACK/SRC/dgegs.f Fri May 25 16:01:53 2001
  4056. @@ -5,7 +5,7 @@
  4057. * -- LAPACK driver routine (version 3.0) --
  4058. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  4059. * Courant Institute, Argonne National Lab, and Rice University
  4060. -* June 30, 1999
  4061. +* April 26, 2001
  4062. *
  4063. * .. Scalar Arguments ..
  4064. CHARACTER JOBVSL, JOBVSR
  4065. @@ -22,105 +22,75 @@
  4066. *
  4067. * This routine is deprecated and has been replaced by routine DGGES.
  4068. *
  4069. -* DGEGS computes for a pair of N-by-N real nonsymmetric matrices A, B:
  4070. -* the generalized eigenvalues (alphar +/- alphai*i, beta), the real
  4071. -* Schur form (A, B), and optionally left and/or right Schur vectors
  4072. -* (VSL and VSR).
  4073. -*
  4074. -* (If only the generalized eigenvalues are needed, use the driver DGEGV
  4075. -* instead.)
  4076. -*
  4077. -* A generalized eigenvalue for a pair of matrices (A,B) is, roughly
  4078. -* speaking, a scalar w or a ratio alpha/beta = w, such that A - w*B
  4079. -* is singular. It is usually represented as the pair (alpha,beta),
  4080. -* as there is a reasonable interpretation for beta=0, and even for
  4081. -* both being zero. A good beginning reference is the book, "Matrix
  4082. -* Computations", by G. Golub & C. van Loan (Johns Hopkins U. Press)
  4083. -*
  4084. -* The (generalized) Schur form of a pair of matrices is the result of
  4085. -* multiplying both matrices on the left by one orthogonal matrix and
  4086. -* both on the right by another orthogonal matrix, these two orthogonal
  4087. -* matrices being chosen so as to bring the pair of matrices into
  4088. -* (real) Schur form.
  4089. -*
  4090. -* A pair of matrices A, B is in generalized real Schur form if B is
  4091. -* upper triangular with non-negative diagonal and A is block upper
  4092. -* triangular with 1-by-1 and 2-by-2 blocks. 1-by-1 blocks correspond
  4093. -* to real generalized eigenvalues, while 2-by-2 blocks of A will be
  4094. -* "standardized" by making the corresponding elements of B have the
  4095. -* form:
  4096. -* [ a 0 ]
  4097. -* [ 0 b ]
  4098. -*
  4099. -* and the pair of corresponding 2-by-2 blocks in A and B will
  4100. -* have a complex conjugate pair of generalized eigenvalues.
  4101. -*
  4102. -* The left and right Schur vectors are the columns of VSL and VSR,
  4103. -* respectively, where VSL and VSR are the orthogonal matrices
  4104. -* which reduce A and B to Schur form:
  4105. -*
  4106. -* Schur form of (A,B) = ( (VSL)**T A (VSR), (VSL)**T B (VSR) )
  4107. +* DGEGS computes the eigenvalues, real Schur form, and, optionally,
  4108. +* left and or/right Schur vectors of a real matrix pair (A,B).
  4109. +* Given two square matrices A and B, the generalized real Schur
  4110. +* factorization has the form
  4111. +*
  4112. +* A = Q*S*Z**T, B = Q*T*Z**T
  4113. +*
  4114. +* where Q and Z are orthogonal matrices, T is upper triangular, and S
  4115. +* is an upper quasi-triangular matrix with 1-by-1 and 2-by-2 diagonal
  4116. +* blocks, the 2-by-2 blocks corresponding to complex conjugate pairs
  4117. +* of eigenvalues of (A,B). The columns of Q are the left Schur vectors
  4118. +* and the columns of Z are the right Schur vectors.
  4119. +*
  4120. +* If only the eigenvalues of (A,B) are needed, the driver routine
  4121. +* DGEGV should be used instead. See DGEGV for a description of the
  4122. +* eigenvalues of the generalized nonsymmetric eigenvalue problem
  4123. +* (GNEP).
  4124. *
  4125. * Arguments
  4126. * =========
  4127. *
  4128. * JOBVSL (input) CHARACTER*1
  4129. * = 'N': do not compute the left Schur vectors;
  4130. -* = 'V': compute the left Schur vectors.
  4131. +* = 'V': compute the left Schur vectors (returned in VSL).
  4132. *
  4133. * JOBVSR (input) CHARACTER*1
  4134. * = 'N': do not compute the right Schur vectors;
  4135. -* = 'V': compute the right Schur vectors.
  4136. +* = 'V': compute the right Schur vectors (returned in VSR).
  4137. *
  4138. * N (input) INTEGER
  4139. * The order of the matrices A, B, VSL, and VSR. N >= 0.
  4140. *
  4141. * A (input/output) DOUBLE PRECISION array, dimension (LDA, N)
  4142. -* On entry, the first of the pair of matrices whose generalized
  4143. -* eigenvalues and (optionally) Schur vectors are to be
  4144. -* computed.
  4145. -* On exit, the generalized Schur form of A.
  4146. -* Note: to avoid overflow, the Frobenius norm of the matrix
  4147. -* A should be less than the overflow threshold.
  4148. +* On entry, the matrix A.
  4149. +* On exit, the upper quasi-triangular matrix S from the
  4150. +* generalized real Schur factorization.
  4151. *
  4152. * LDA (input) INTEGER
  4153. * The leading dimension of A. LDA >= max(1,N).
  4154. *
  4155. * B (input/output) DOUBLE PRECISION array, dimension (LDB, N)
  4156. -* On entry, the second of the pair of matrices whose
  4157. -* generalized eigenvalues and (optionally) Schur vectors are
  4158. -* to be computed.
  4159. -* On exit, the generalized Schur form of B.
  4160. -* Note: to avoid overflow, the Frobenius norm of the matrix
  4161. -* B should be less than the overflow threshold.
  4162. +* On entry, the matrix B.
  4163. +* On exit, the upper triangular matrix T from the generalized
  4164. +* real Schur factorization.
  4165. *
  4166. * LDB (input) INTEGER
  4167. * The leading dimension of B. LDB >= max(1,N).
  4168. *
  4169. * ALPHAR (output) DOUBLE PRECISION array, dimension (N)
  4170. +* The real parts of each scalar alpha defining an eigenvalue
  4171. +* of GNEP.
  4172. +*
  4173. * ALPHAI (output) DOUBLE PRECISION array, dimension (N)
  4174. -* BETA (output) DOUBLE PRECISION array, dimension (N)
  4175. -* On exit, (ALPHAR(j) + ALPHAI(j)*i)/BETA(j), j=1,...,N, will
  4176. -* be the generalized eigenvalues. ALPHAR(j) + ALPHAI(j)*i,
  4177. -* j=1,...,N and BETA(j),j=1,...,N are the diagonals of the
  4178. -* complex Schur form (A,B) that would result if the 2-by-2
  4179. -* diagonal blocks of the real Schur form of (A,B) were further
  4180. -* reduced to triangular form using 2-by-2 complex unitary
  4181. -* transformations. If ALPHAI(j) is zero, then the j-th
  4182. +* The imaginary parts of each scalar alpha defining an
  4183. +* eigenvalue of GNEP. If ALPHAI(j) is zero, then the j-th
  4184. * eigenvalue is real; if positive, then the j-th and (j+1)-st
  4185. -* eigenvalues are a complex conjugate pair, with ALPHAI(j+1)
  4186. -* negative.
  4187. +* eigenvalues are a complex conjugate pair, with
  4188. +* ALPHAI(j+1) = -ALPHAI(j).
  4189. *
  4190. -* Note: the quotients ALPHAR(j)/BETA(j) and ALPHAI(j)/BETA(j)
  4191. -* may easily over- or underflow, and BETA(j) may even be zero.
  4192. -* Thus, the user should avoid naively computing the ratio
  4193. -* alpha/beta. However, ALPHAR and ALPHAI will be always less
  4194. -* than and usually comparable with norm(A) in magnitude, and
  4195. -* BETA always less than and usually comparable with norm(B).
  4196. +* BETA (output) DOUBLE PRECISION array, dimension (N)
  4197. +* The scalars beta that define the eigenvalues of GNEP.
  4198. +* Together, the quantities alpha = (ALPHAR(j),ALPHAI(j)) and
  4199. +* beta = BETA(j) represent the j-th eigenvalue of the matrix
  4200. +* pair (A,B), in one of the forms lambda = alpha/beta or
  4201. +* mu = beta/alpha. Since either lambda or mu may overflow,
  4202. +* they should not, in general, be computed.
  4203. *
  4204. * VSL (output) DOUBLE PRECISION array, dimension (LDVSL,N)
  4205. -* If JOBVSL = 'V', VSL will contain the left Schur vectors.
  4206. -* (See "Purpose", above.)
  4207. +* If JOBVSL = 'V', the matrix of left Schur vectors Q.
  4208. * Not referenced if JOBVSL = 'N'.
  4209. *
  4210. * LDVSL (input) INTEGER
  4211. @@ -128,8 +98,7 @@
  4212. * if JOBVSL = 'V', LDVSL >= N.
  4213. *
  4214. * VSR (output) DOUBLE PRECISION array, dimension (LDVSR,N)
  4215. -* If JOBVSR = 'V', VSR will contain the right Schur vectors.
  4216. -* (See "Purpose", above.)
  4217. +* If JOBVSR = 'V', the matrix of right Schur vectors Z.
  4218. * Not referenced if JOBVSR = 'N'.
  4219. *
  4220. * LDVSR (input) INTEGER
  4221. diff -uNr LAPACK.orig/SRC/dgegv.f LAPACK/SRC/dgegv.f
  4222. --- LAPACK.orig/SRC/dgegv.f Thu Nov 4 14:25:43 1999
  4223. +++ LAPACK/SRC/dgegv.f Fri May 25 16:02:16 2001
  4224. @@ -4,7 +4,7 @@
  4225. * -- LAPACK driver routine (version 3.0) --
  4226. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  4227. * Courant Institute, Argonne National Lab, and Rice University
  4228. -* June 30, 1999
  4229. +* April 26, 2001
  4230. *
  4231. * .. Scalar Arguments ..
  4232. CHARACTER JOBVL, JOBVR
  4233. @@ -21,23 +21,32 @@
  4234. *
  4235. * This routine is deprecated and has been replaced by routine DGGEV.
  4236. *
  4237. -* DGEGV computes for a pair of n-by-n real nonsymmetric matrices A and
  4238. -* B, the generalized eigenvalues (alphar +/- alphai*i, beta), and
  4239. -* optionally, the left and/or right generalized eigenvectors (VL and
  4240. -* VR).
  4241. -*
  4242. -* A generalized eigenvalue for a pair of matrices (A,B) is, roughly
  4243. -* speaking, a scalar w or a ratio alpha/beta = w, such that A - w*B
  4244. -* is singular. It is usually represented as the pair (alpha,beta),
  4245. -* as there is a reasonable interpretation for beta=0, and even for
  4246. -* both being zero. A good beginning reference is the book, "Matrix
  4247. -* Computations", by G. Golub & C. van Loan (Johns Hopkins U. Press)
  4248. -*
  4249. -* A right generalized eigenvector corresponding to a generalized
  4250. -* eigenvalue w for a pair of matrices (A,B) is a vector r such
  4251. -* that (A - w B) r = 0 . A left generalized eigenvector is a vector
  4252. -* l such that l**H * (A - w B) = 0, where l**H is the
  4253. -* conjugate-transpose of l.
  4254. +* DGEGV computes the eigenvalues and, optionally, the left and/or right
  4255. +* eigenvectors of a real matrix pair (A,B).
  4256. +* Given two square matrices A and B,
  4257. +* the generalized nonsymmetric eigenvalue problem (GNEP) is to find the
  4258. +* eigenvalues lambda and corresponding (non-zero) eigenvectors x such
  4259. +* that
  4260. +*
  4261. +* A*x = lambda*B*x.
  4262. +*
  4263. +* An alternate form is to find the eigenvalues mu and corresponding
  4264. +* eigenvectors y such that
  4265. +*
  4266. +* mu*A*y = B*y.
  4267. +*
  4268. +* These two forms are equivalent with mu = 1/lambda and x = y if
  4269. +* neither lambda nor mu is zero. In order to deal with the case that
  4270. +* lambda or mu is zero or small, two values alpha and beta are returned
  4271. +* for each eigenvalue, such that lambda = alpha/beta and
  4272. +* mu = beta/alpha.
  4273. +*
  4274. +* The vectors x and y in the above equations are right eigenvectors of
  4275. +* the matrix pair (A,B). Vectors u and v satisfying
  4276. +*
  4277. +* u**H*A = lambda*u**H*B or mu*v**H*A = v**H*B
  4278. +*
  4279. +* are left eigenvectors of (A,B).
  4280. *
  4281. * Note: this routine performs "full balancing" on A and B -- see
  4282. * "Further Details", below.
  4283. @@ -47,63 +56,75 @@
  4284. *
  4285. * JOBVL (input) CHARACTER*1
  4286. * = 'N': do not compute the left generalized eigenvectors;
  4287. -* = 'V': compute the left generalized eigenvectors.
  4288. +* = 'V': compute the left generalized eigenvectors (returned
  4289. +* in VL).
  4290. *
  4291. * JOBVR (input) CHARACTER*1
  4292. * = 'N': do not compute the right generalized eigenvectors;
  4293. -* = 'V': compute the right generalized eigenvectors.
  4294. +* = 'V': compute the right generalized eigenvectors (returned
  4295. +* in VR).
  4296. *
  4297. * N (input) INTEGER
  4298. * The order of the matrices A, B, VL, and VR. N >= 0.
  4299. *
  4300. * A (input/output) DOUBLE PRECISION array, dimension (LDA, N)
  4301. -* On entry, the first of the pair of matrices whose
  4302. -* generalized eigenvalues and (optionally) generalized
  4303. -* eigenvectors are to be computed.
  4304. -* On exit, the contents will have been destroyed. (For a
  4305. -* description of the contents of A on exit, see "Further
  4306. -* Details", below.)
  4307. +* On entry, the matrix A.
  4308. +* If JOBVL = 'V' or JOBVR = 'V', then on exit A
  4309. +* contains the real Schur form of A from the generalized Schur
  4310. +* factorization of the pair (A,B) after balancing.
  4311. +* If no eigenvectors were computed, then only the diagonal
  4312. +* blocks from the Schur form will be correct. See DGGHRD and
  4313. +* DHGEQZ for details.
  4314. *
  4315. * LDA (input) INTEGER
  4316. * The leading dimension of A. LDA >= max(1,N).
  4317. *
  4318. * B (input/output) DOUBLE PRECISION array, dimension (LDB, N)
  4319. -* On entry, the second of the pair of matrices whose
  4320. -* generalized eigenvalues and (optionally) generalized
  4321. -* eigenvectors are to be computed.
  4322. -* On exit, the contents will have been destroyed. (For a
  4323. -* description of the contents of B on exit, see "Further
  4324. -* Details", below.)
  4325. +* On entry, the matrix B.
  4326. +* If JOBVL = 'V' or JOBVR = 'V', then on exit B contains the
  4327. +* upper triangular matrix obtained from B in the generalized
  4328. +* Schur factorization of the pair (A,B) after balancing.
  4329. +* If no eigenvectors were computed, then only those elements of
  4330. +* B corresponding to the diagonal blocks from the Schur form of
  4331. +* A will be correct. See DGGHRD and DHGEQZ for details.
  4332. *
  4333. * LDB (input) INTEGER
  4334. * The leading dimension of B. LDB >= max(1,N).
  4335. *
  4336. * ALPHAR (output) DOUBLE PRECISION array, dimension (N)
  4337. +* The real parts of each scalar alpha defining an eigenvalue of
  4338. +* GNEP.
  4339. +*
  4340. * ALPHAI (output) DOUBLE PRECISION array, dimension (N)
  4341. -* BETA (output) DOUBLE PRECISION array, dimension (N)
  4342. -* On exit, (ALPHAR(j) + ALPHAI(j)*i)/BETA(j), j=1,...,N, will
  4343. -* be the generalized eigenvalues. If ALPHAI(j) is zero, then
  4344. -* the j-th eigenvalue is real; if positive, then the j-th and
  4345. +* The imaginary parts of each scalar alpha defining an
  4346. +* eigenvalue of GNEP. If ALPHAI(j) is zero, then the j-th
  4347. +* eigenvalue is real; if positive, then the j-th and
  4348. * (j+1)-st eigenvalues are a complex conjugate pair, with
  4349. -* ALPHAI(j+1) negative.
  4350. +* ALPHAI(j+1) = -ALPHAI(j).
  4351. *
  4352. -* Note: the quotients ALPHAR(j)/BETA(j) and ALPHAI(j)/BETA(j)
  4353. -* may easily over- or underflow, and BETA(j) may even be zero.
  4354. -* Thus, the user should avoid naively computing the ratio
  4355. -* alpha/beta. However, ALPHAR and ALPHAI will be always less
  4356. -* than and usually comparable with norm(A) in magnitude, and
  4357. -* BETA always less than and usually comparable with norm(B).
  4358. +* BETA (output) DOUBLE PRECISION array, dimension (N)
  4359. +* The scalars beta that define the eigenvalues of GNEP.
  4360. +*
  4361. +* Together, the quantities alpha = (ALPHAR(j),ALPHAI(j)) and
  4362. +* beta = BETA(j) represent the j-th eigenvalue of the matrix
  4363. +* pair (A,B), in one of the forms lambda = alpha/beta or
  4364. +* mu = beta/alpha. Since either lambda or mu may overflow,
  4365. +* they should not, in general, be computed.
  4366. *
  4367. * VL (output) DOUBLE PRECISION array, dimension (LDVL,N)
  4368. -* If JOBVL = 'V', the left generalized eigenvectors. (See
  4369. -* "Purpose", above.) Real eigenvectors take one column,
  4370. -* complex take two columns, the first for the real part and
  4371. -* the second for the imaginary part. Complex eigenvectors
  4372. -* correspond to an eigenvalue with positive imaginary part.
  4373. -* Each eigenvector will be scaled so the largest component
  4374. -* will have abs(real part) + abs(imag. part) = 1, *except*
  4375. -* that for eigenvalues with alpha=beta=0, a zero vector will
  4376. -* be returned as the corresponding eigenvector.
  4377. +* If JOBVL = 'V', the left eigenvectors u(j) are stored
  4378. +* in the columns of VL, in the same order as their eigenvalues.
  4379. +* If the j-th eigenvalue is real, then u(j) = VL(:,j).
  4380. +* If the j-th and (j+1)-st eigenvalues form a complex conjugate
  4381. +* pair, then
  4382. +* u(j) = VL(:,j) + i*VL(:,j+1)
  4383. +* and
  4384. +* u(j+1) = VL(:,j) - i*VL(:,j+1).
  4385. +*
  4386. +* Each eigenvector is scaled so that its largest component has
  4387. +* abs(real part) + abs(imag. part) = 1, except for eigenvectors
  4388. +* corresponding to an eigenvalue with alpha = beta = 0, which
  4389. +* are set to zero.
  4390. * Not referenced if JOBVL = 'N'.
  4391. *
  4392. * LDVL (input) INTEGER
  4393. @@ -111,15 +132,19 @@
  4394. * if JOBVL = 'V', LDVL >= N.
  4395. *
  4396. * VR (output) DOUBLE PRECISION array, dimension (LDVR,N)
  4397. -* If JOBVR = 'V', the right generalized eigenvectors. (See
  4398. -* "Purpose", above.) Real eigenvectors take one column,
  4399. -* complex take two columns, the first for the real part and
  4400. -* the second for the imaginary part. Complex eigenvectors
  4401. -* correspond to an eigenvalue with positive imaginary part.
  4402. -* Each eigenvector will be scaled so the largest component
  4403. -* will have abs(real part) + abs(imag. part) = 1, *except*
  4404. -* that for eigenvalues with alpha=beta=0, a zero vector will
  4405. -* be returned as the corresponding eigenvector.
  4406. +* If JOBVR = 'V', the right eigenvectors x(j) are stored
  4407. +* in the columns of VR, in the same order as their eigenvalues.
  4408. +* If the j-th eigenvalue is real, then x(j) = VR(:,j).
  4409. +* If the j-th and (j+1)-st eigenvalues form a complex conjugate
  4410. +* pair, then
  4411. +* x(j) = VR(:,j) + i*VR(:,j+1)
  4412. +* and
  4413. +* x(j+1) = VR(:,j) - i*VR(:,j+1).
  4414. +*
  4415. +* Each eigenvector is scaled so that its largest component has
  4416. +* abs(real part) + abs(imag. part) = 1, except for eigenvalues
  4417. +* corresponding to an eigenvalue with alpha = beta = 0, which
  4418. +* are set to zero.
  4419. * Not referenced if JOBVR = 'N'.
  4420. *
  4421. * LDVR (input) INTEGER
  4422. diff -uNr LAPACK.orig/SRC/dgelsd.f LAPACK/SRC/dgelsd.f
  4423. --- LAPACK.orig/SRC/dgelsd.f Thu Nov 4 14:26:25 1999
  4424. +++ LAPACK/SRC/dgelsd.f Fri May 25 16:03:10 2001
  4425. @@ -4,7 +4,8 @@
  4426. * -- LAPACK driver routine (version 3.0) --
  4427. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  4428. * Courant Institute, Argonne National Lab, and Rice University
  4429. -* October 31, 1999
  4430. +* June 30, 1999
  4431. +* 8-15-00: Improve consistency of WS calculations (eca)
  4432. *
  4433. * .. Scalar Arguments ..
  4434. INTEGER INFO, LDA, LDB, LWORK, M, N, NRHS, RANK
  4435. @@ -61,9 +62,10 @@
  4436. * The number of right hand sides, i.e., the number of columns
  4437. * of the matrices B and X. NRHS >= 0.
  4438. *
  4439. -* A (input) DOUBLE PRECISION array, dimension (LDA,N)
  4440. +* A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
  4441. * On entry, the M-by-N matrix A.
  4442. -* On exit, A has been destroyed.
  4443. +* On exit, the first min(m,n) rows of A are overwritten with
  4444. +* its right singular vectors, stored rowwise.
  4445. *
  4446. * LDA (input) INTEGER
  4447. * The leading dimension of the array A. LDA >= max(1,M).
  4448. @@ -95,23 +97,20 @@
  4449. * On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
  4450. *
  4451. * LWORK (input) INTEGER
  4452. -* The dimension of the array WORK. LWORK must be at least 1.
  4453. +* The dimension of the array WORK. LWORK >= 1.
  4454. * The exact minimum amount of workspace needed depends on M,
  4455. -* N and NRHS. As long as LWORK is at least
  4456. -* 12*N + 2*N*SMLSIZ + 8*N*NLVL + N*NRHS + (SMLSIZ+1)**2,
  4457. -* if M is greater than or equal to N or
  4458. -* 12*M + 2*M*SMLSIZ + 8*M*NLVL + M*NRHS + (SMLSIZ+1)**2,
  4459. -* if M is less than N, the code will execute correctly.
  4460. +* N and NRHS.
  4461. +* If M >= N, LWORK >= 11*N + 2*N*SMLSIZ + 8*N*NLVL + N*NRHS.
  4462. +* If M < N, LWORK >= 11*M + 2*M*SMLSIZ + 8*M*NLVL + M*NRHS.
  4463. * SMLSIZ is returned by ILAENV and is equal to the maximum
  4464. * size of the subproblems at the bottom of the computation
  4465. * tree (usually about 25), and
  4466. -* NLVL = MAX( 0, INT( LOG_2( MIN( M,N )/(SMLSIZ+1) ) ) + 1 )
  4467. +* NLVL = INT( LOG_2( MIN( M,N )/(SMLSIZ+1) ) ) + 1
  4468. * For good performance, LWORK should generally be larger.
  4469. *
  4470. -* If LWORK = -1, then a workspace query is assumed; the routine
  4471. -* only calculates the optimal size of the WORK array, returns
  4472. -* this value as the first entry of the WORK array, and no error
  4473. -* message related to LWORK is issued by XERBLA.
  4474. +* If LWORK = -1, a workspace query is assumed. The optimal
  4475. +* size for the WORK array is calculated and stored in WORK(1),
  4476. +* and no other work except argument checking is performed.
  4477. *
  4478. * IWORK (workspace) INTEGER array, dimension (LIWORK)
  4479. * LIWORK >= 3 * MINMN * NLVL + 11 * MINMN,
  4480. @@ -135,14 +134,15 @@
  4481. * =====================================================================
  4482. *
  4483. * .. Parameters ..
  4484. + INTEGER LQUERV
  4485. + PARAMETER ( LQUERV = -1 )
  4486. DOUBLE PRECISION ZERO, ONE, TWO
  4487. PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0, TWO = 2.0D0 )
  4488. * ..
  4489. * .. Local Scalars ..
  4490. - LOGICAL LQUERY
  4491. INTEGER IASCL, IBSCL, IE, IL, ITAU, ITAUP, ITAUQ,
  4492. $ LDWORK, MAXMN, MAXWRK, MINMN, MINWRK, MM,
  4493. - $ MNTHR, NLVL, NWORK, SMLSIZ, WLALSD
  4494. + $ MNTHR, NLVL, NWORK, SMLSIZ
  4495. DOUBLE PRECISION ANRM, BIGNUM, BNRM, EPS, SFMIN, SMLNUM
  4496. * ..
  4497. * .. External Subroutines ..
  4498. @@ -165,7 +165,6 @@
  4499. MINMN = MIN( M, N )
  4500. MAXMN = MAX( M, N )
  4501. MNTHR = ILAENV( 6, 'DGELSD', ' ', M, N, NRHS, -1 )
  4502. - LQUERY = ( LWORK.EQ.-1 )
  4503. IF( M.LT.0 ) THEN
  4504. INFO = -1
  4505. ELSE IF( N.LT.0 ) THEN
  4506. @@ -189,8 +188,8 @@
  4507. *
  4508. MINWRK = 1
  4509. MINMN = MAX( 1, MINMN )
  4510. - NLVL = MAX( INT( LOG( DBLE( MINMN ) / DBLE( SMLSIZ+1 ) ) /
  4511. - $ LOG( TWO ) ) + 1, 0 )
  4512. + NLVL = INT( LOG( DBLE( MINMN ) / DBLE( SMLSIZ+1 ) ) / LOG( TWO ) )
  4513. + $ + 1
  4514. *
  4515. IF( INFO.EQ.0 ) THEN
  4516. MAXWRK = 0
  4517. @@ -215,12 +214,11 @@
  4518. $ ILAENV( 1, 'DORMBR', 'QLT', MM, NRHS, N, -1 ) )
  4519. MAXWRK = MAX( MAXWRK, 3*N+( N-1 )*
  4520. $ ILAENV( 1, 'DORMBR', 'PLN', N, NRHS, N, -1 ) )
  4521. - WLALSD = 9*N+2*N*SMLSIZ+8*N*NLVL+N*NRHS+(SMLSIZ+1)**2
  4522. - MAXWRK = MAX( MAXWRK, 3*N+WLALSD )
  4523. - MINWRK = MAX( 3*N+MM, 3*N+NRHS, 3*N+WLALSD )
  4524. + MAXWRK = MAX( MAXWRK, 3*N+8*N+2*N*SMLSIZ+8*N*NLVL+N*NRHS )
  4525. + MINWRK = MAX( 3*N+MM, 3*N+NRHS,
  4526. + $ 3*N+8*N+2*N*SMLSIZ+8*N*NLVL+N*NRHS )
  4527. END IF
  4528. IF( N.GT.M ) THEN
  4529. - WLALSD = 9*M+2*M*SMLSIZ+8*M*NLVL+M*NRHS+(SMLSIZ+1)**2
  4530. IF( N.GE.MNTHR ) THEN
  4531. *
  4532. * Path 2a - underdetermined, with many more columns
  4533. @@ -240,7 +238,8 @@
  4534. END IF
  4535. MAXWRK = MAX( MAXWRK, M+NRHS*
  4536. $ ILAENV( 1, 'DORMLQ', 'LT', N, NRHS, M, -1 ) )
  4537. - MAXWRK = MAX( MAXWRK, M*M+4*M+WLALSD )
  4538. + MAXWRK = MAX( MAXWRK, M*M+4*M+8*M+2*M*SMLSIZ+8*M*NLVL+M*
  4539. + $ NRHS )
  4540. ELSE
  4541. *
  4542. * Path 2 - remaining underdetermined cases.
  4543. @@ -251,26 +250,26 @@
  4544. $ ILAENV( 1, 'DORMBR', 'QLT', M, NRHS, N, -1 ) )
  4545. MAXWRK = MAX( MAXWRK, 3*M+M*
  4546. $ ILAENV( 1, 'DORMBR', 'PLN', N, NRHS, M, -1 ) )
  4547. - MAXWRK = MAX( MAXWRK, 3*M+WLALSD )
  4548. + MAXWRK = MAX( MAXWRK, 3*M+8*M+2*M*SMLSIZ+8*M*NLVL+M*
  4549. + $ NRHS )
  4550. END IF
  4551. - MINWRK = MAX( 3*M+NRHS, 3*M+M, 3*M+WLALSD )
  4552. + MINWRK = MAX( 3*M+NRHS, 3*M+M,
  4553. + $ 3*M+8*M+2*M*SMLSIZ+8*M*NLVL+M*NRHS )
  4554. END IF
  4555. MINWRK = MIN( MINWRK, MAXWRK )
  4556. WORK( 1 ) = MAXWRK
  4557. - IF( LWORK.LT.MINWRK .AND. .NOT.LQUERY ) THEN
  4558. - INFO = -12
  4559. - END IF
  4560. + IF( LWORK.LT.MINWRK .AND. LWORK.NE.LQUERV )
  4561. + $ INFO = -12
  4562. END IF
  4563. *
  4564. +* Quick returns
  4565. +*
  4566. IF( INFO.NE.0 ) THEN
  4567. CALL XERBLA( 'DGELSD', -INFO )
  4568. RETURN
  4569. - ELSE IF( LQUERY ) THEN
  4570. - GO TO 10
  4571. END IF
  4572. -*
  4573. -* Quick return if possible.
  4574. -*
  4575. + IF( LWORK.EQ.LQUERV )
  4576. + $ RETURN
  4577. IF( M.EQ.0 .OR. N.EQ.0 ) THEN
  4578. RANK = 0
  4579. RETURN
  4580. diff -uNr LAPACK.orig/SRC/dgelss.f LAPACK/SRC/dgelss.f
  4581. --- LAPACK.orig/SRC/dgelss.f Thu Nov 4 14:24:44 1999
  4582. +++ LAPACK/SRC/dgelss.f Fri May 25 16:03:46 2001
  4583. @@ -4,7 +4,7 @@
  4584. * -- LAPACK driver routine (version 3.0) --
  4585. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  4586. * Courant Institute, Argonne National Lab, and Rice University
  4587. -* October 31, 1999
  4588. +* April 25, 2001
  4589. *
  4590. * .. Scalar Arguments ..
  4591. INTEGER INFO, LDA, LDB, LWORK, M, N, NRHS, RANK
  4592. @@ -86,10 +86,9 @@
  4593. * LWORK >= 3*min(M,N) + max( 2*min(M,N), max(M,N), NRHS )
  4594. * For good performance, LWORK should generally be larger.
  4595. *
  4596. -* If LWORK = -1, then a workspace query is assumed; the routine
  4597. -* only calculates the optimal size of the WORK array, returns
  4598. -* this value as the first entry of the WORK array, and no error
  4599. -* message related to LWORK is issued by XERBLA.
  4600. +* If LWORK = -1, a workspace query is assumed. The optimal
  4601. +* size for the WORK array is calculated and stored in WORK(1),
  4602. +* and no other work except argument checking is performed.
  4603. *
  4604. * INFO (output) INTEGER
  4605. * = 0: successful exit
  4606. @@ -156,7 +155,7 @@
  4607. * following subroutine, as returned by ILAENV.)
  4608. *
  4609. MINWRK = 1
  4610. - IF( INFO.EQ.0 .AND. ( LWORK.GE.1 .OR. LQUERY ) ) THEN
  4611. + IF( INFO.EQ.0 ) THEN
  4612. MAXWRK = 0
  4613. MM = M
  4614. IF( M.GE.N .AND. M.GE.MNTHR ) THEN
  4615. @@ -229,20 +228,18 @@
  4616. END IF
  4617. MAXWRK = MAX( MINWRK, MAXWRK )
  4618. WORK( 1 ) = MAXWRK
  4619. + IF( LWORK.LT.MINWRK .AND. .NOT.LQUERY )
  4620. + $ INFO = -12
  4621. END IF
  4622. *
  4623. - MINWRK = MAX( MINWRK, 1 )
  4624. - IF( LWORK.LT.MINWRK .AND. .NOT.LQUERY )
  4625. - $ INFO = -12
  4626. +* Quick returns
  4627. +*
  4628. IF( INFO.NE.0 ) THEN
  4629. CALL XERBLA( 'DGELSS', -INFO )
  4630. RETURN
  4631. ELSE IF( LQUERY ) THEN
  4632. RETURN
  4633. END IF
  4634. -*
  4635. -* Quick return if possible
  4636. -*
  4637. IF( M.EQ.0 .OR. N.EQ.0 ) THEN
  4638. RANK = 0
  4639. RETURN
  4640. @@ -491,8 +488,8 @@
  4641. DO 40 I = 1, NRHS, CHUNK
  4642. BL = MIN( NRHS-I+1, CHUNK )
  4643. CALL DGEMM( 'T', 'N', M, BL, M, ONE, WORK( IL ), LDWORK,
  4644. - $ B( 1, I ), LDB, ZERO, WORK( IWORK ), N )
  4645. - CALL DLACPY( 'G', M, BL, WORK( IWORK ), N, B( 1, I ),
  4646. + $ B( 1, I ), LDB, ZERO, WORK( IWORK ), M )
  4647. + CALL DLACPY( 'G', M, BL, WORK( IWORK ), M, B( 1, I ),
  4648. $ LDB )
  4649. 40 CONTINUE
  4650. ELSE
  4651. diff -uNr LAPACK.orig/SRC/dgesdd.f LAPACK/SRC/dgesdd.f
  4652. --- LAPACK.orig/SRC/dgesdd.f Thu Nov 11 20:32:31 1999
  4653. +++ LAPACK/SRC/dgesdd.f Fri May 25 16:07:58 2001
  4654. @@ -4,7 +4,8 @@
  4655. * -- LAPACK driver routine (version 3.0) --
  4656. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  4657. * Courant Institute, Argonne National Lab, and Rice University
  4658. -* October 31, 1999
  4659. +* June 30, 1999
  4660. +* 8-15-00: Improve consistency of WS calculations (eca)
  4661. *
  4662. * .. Scalar Arguments ..
  4663. CHARACTER JOBZ
  4664. @@ -116,16 +117,20 @@
  4665. * LWORK (input) INTEGER
  4666. * The dimension of the array WORK. LWORK >= 1.
  4667. * If JOBZ = 'N',
  4668. -* LWORK >= 3*min(M,N) + max(max(M,N),6*min(M,N)).
  4669. +* LWORK >= max(14*min(M,N)+4, 10*min(M,N)+2+
  4670. +* SMLSIZ*(SMLSIZ+8)) + max(M,N)
  4671. +* where SMLSIZ is returned by ILAENV and is equal to the
  4672. +* maximum size of the subproblems at the bottom of the
  4673. +* computation tree (usually about 25).
  4674. * If JOBZ = 'O',
  4675. -* LWORK >= 3*min(M,N)*min(M,N) +
  4676. -* max(max(M,N),5*min(M,N)*min(M,N)+4*min(M,N)).
  4677. +* LWORK >= 5*min(M,N)*min(M,N) + max(M,N) + 9*min(M,N).
  4678. * If JOBZ = 'S' or 'A'
  4679. -* LWORK >= 3*min(M,N)*min(M,N) +
  4680. -* max(max(M,N),4*min(M,N)*min(M,N)+4*min(M,N)).
  4681. +* LWORK >= 4*min(M,N)*min(M,N) + max(M,N) + 9*min(M,N).
  4682. * For good performance, LWORK should generally be larger.
  4683. -* If LWORK < 0 but other input arguments are legal, WORK(1)
  4684. -* returns the optimal LWORK.
  4685. +*
  4686. +* If LWORK = -1, a workspace query is assumed. The optimal
  4687. +* size for the WORK array is calculated and stored in WORK(1),
  4688. +* and no other work except argument checking is performed.
  4689. *
  4690. * IWORK (workspace) INTEGER array, dimension (8*min(M,N))
  4691. *
  4692. @@ -144,15 +149,17 @@
  4693. * =====================================================================
  4694. *
  4695. * .. Parameters ..
  4696. + INTEGER LQUERV
  4697. + PARAMETER ( LQUERV = -1 )
  4698. DOUBLE PRECISION ZERO, ONE
  4699. - PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0 )
  4700. + PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0 )
  4701. * ..
  4702. * .. Local Scalars ..
  4703. - LOGICAL LQUERY, WNTQA, WNTQAS, WNTQN, WNTQO, WNTQS
  4704. - INTEGER BDSPAC, BLK, CHUNK, I, IE, IERR, IL,
  4705. + LOGICAL WNTQA, WNTQAS, WNTQN, WNTQO, WNTQS
  4706. + INTEGER BDSPAC, BDSPAN, BLK, CHUNK, I, IE, IERR, IL,
  4707. $ IR, ISCL, ITAU, ITAUP, ITAUQ, IU, IVT, LDWKVT,
  4708. $ LDWRKL, LDWRKR, LDWRKU, MAXWRK, MINMN, MINWRK,
  4709. - $ MNTHR, NWORK, WRKBL
  4710. + $ MNTHR, NWORK, SMLSIZ, WRKBL
  4711. DOUBLE PRECISION ANRM, BIGNUM, EPS, SMLNUM
  4712. * ..
  4713. * .. Local Arrays ..
  4714. @@ -168,7 +175,7 @@
  4715. LOGICAL LSAME
  4716. INTEGER ILAENV
  4717. DOUBLE PRECISION DLAMCH, DLANGE
  4718. - EXTERNAL DLAMCH, DLANGE, ILAENV, LSAME
  4719. + EXTERNAL LSAME, ILAENV, DLAMCH, DLANGE
  4720. * ..
  4721. * .. Intrinsic Functions ..
  4722. INTRINSIC DBLE, INT, MAX, MIN, SQRT
  4723. @@ -187,7 +194,6 @@
  4724. WNTQN = LSAME( JOBZ, 'N' )
  4725. MINWRK = 1
  4726. MAXWRK = 1
  4727. - LQUERY = ( LWORK.EQ.-1 )
  4728. *
  4729. IF( .NOT.( WNTQA .OR. WNTQS .OR. WNTQO .OR. WNTQN ) ) THEN
  4730. INFO = -1
  4731. @@ -206,6 +212,8 @@
  4732. INFO = -10
  4733. END IF
  4734. *
  4735. + SMLSIZ = ILAENV( 9, 'DGESDD', ' ', 0, 0, 0, 0 )
  4736. +*
  4737. * Compute workspace
  4738. * (Note: Comments in the code beginning "Workspace:" describe the
  4739. * minimal amount of workspace needed at that point in the code,
  4740. @@ -218,22 +226,19 @@
  4741. *
  4742. * Compute space needed for DBDSDC
  4743. *
  4744. - IF( WNTQN ) THEN
  4745. - BDSPAC = 7*N
  4746. - ELSE
  4747. - BDSPAC = 3*N*N + 4*N
  4748. - END IF
  4749. + BDSPAC = 3*N*N + 7*N
  4750. + BDSPAN = MAX( 12*N+4, 8*N+2+SMLSIZ*( SMLSIZ+8 ) )
  4751. IF( M.GE.MNTHR ) THEN
  4752. IF( WNTQN ) THEN
  4753. *
  4754. * Path 1 (M much larger than N, JOBZ='N')
  4755. *
  4756. - WRKBL = N + N*ILAENV( 1, 'DGEQRF', ' ', M, N, -1,
  4757. - $ -1 )
  4758. - WRKBL = MAX( WRKBL, 3*N+2*N*
  4759. - $ ILAENV( 1, 'DGEBRD', ' ', N, N, -1, -1 ) )
  4760. - MAXWRK = MAX( WRKBL, BDSPAC+N )
  4761. - MINWRK = BDSPAC + N
  4762. + MAXWRK = N + N*ILAENV( 1, 'DGEQRF', ' ', M, N, -1,
  4763. + $ -1 )
  4764. + MAXWRK = MAX( MAXWRK, 3*N+2*N*
  4765. + $ ILAENV( 1, 'DGEBRD', ' ', N, N, -1, -1 ) )
  4766. + MAXWRK = MAX( MAXWRK, BDSPAC )
  4767. + MINWRK = BDSPAC
  4768. ELSE IF( WNTQO ) THEN
  4769. *
  4770. * Path 2 (M much larger than N, JOBZ='O')
  4771. @@ -247,9 +252,9 @@
  4772. $ ILAENV( 1, 'DORMBR', 'QLN', N, N, N, -1 ) )
  4773. WRKBL = MAX( WRKBL, 3*N+N*
  4774. $ ILAENV( 1, 'DORMBR', 'PRT', N, N, N, -1 ) )
  4775. - WRKBL = MAX( WRKBL, BDSPAC+3*N )
  4776. + WRKBL = MAX( WRKBL, BDSPAC+2*N )
  4777. MAXWRK = WRKBL + 2*N*N
  4778. - MINWRK = BDSPAC + 2*N*N + 3*N
  4779. + MINWRK = BDSPAC + 2*N*N + 2*N
  4780. ELSE IF( WNTQS ) THEN
  4781. *
  4782. * Path 3 (M much larger than N, JOBZ='S')
  4783. @@ -263,9 +268,9 @@
  4784. $ ILAENV( 1, 'DORMBR', 'QLN', N, N, N, -1 ) )
  4785. WRKBL = MAX( WRKBL, 3*N+N*
  4786. $ ILAENV( 1, 'DORMBR', 'PRT', N, N, N, -1 ) )
  4787. - WRKBL = MAX( WRKBL, BDSPAC+3*N )
  4788. + WRKBL = MAX( WRKBL, BDSPAC+2*N )
  4789. MAXWRK = WRKBL + N*N
  4790. - MINWRK = BDSPAC + N*N + 3*N
  4791. + MINWRK = BDSPAC + N*N + 2*N
  4792. ELSE IF( WNTQA ) THEN
  4793. *
  4794. * Path 4 (M much larger than N, JOBZ='A')
  4795. @@ -279,9 +284,9 @@
  4796. $ ILAENV( 1, 'DORMBR', 'QLN', N, N, N, -1 ) )
  4797. WRKBL = MAX( WRKBL, 3*N+N*
  4798. $ ILAENV( 1, 'DORMBR', 'PRT', N, N, N, -1 ) )
  4799. - WRKBL = MAX( WRKBL, BDSPAC+3*N )
  4800. - MAXWRK = WRKBL + N*N
  4801. - MINWRK = BDSPAC + N*N + 3*N
  4802. + WRKBL = MAX( WRKBL, BDSPAC+2*N )
  4803. + MAXWRK = N*N + WRKBL
  4804. + MINWRK = BDSPAC + N*N + M + N
  4805. END IF
  4806. ELSE
  4807. *
  4808. @@ -289,53 +294,47 @@
  4809. *
  4810. WRKBL = 3*N + ( M+N )*ILAENV( 1, 'DGEBRD', ' ', M, N, -1,
  4811. $ -1 )
  4812. - IF( WNTQN ) THEN
  4813. - MAXWRK = MAX( WRKBL, BDSPAC+3*N )
  4814. - MINWRK = 3*N + MAX( M, BDSPAC )
  4815. - ELSE IF( WNTQO ) THEN
  4816. + IF( WNTQO ) THEN
  4817. WRKBL = MAX( WRKBL, 3*N+N*
  4818. $ ILAENV( 1, 'DORMBR', 'QLN', M, N, N, -1 ) )
  4819. WRKBL = MAX( WRKBL, 3*N+N*
  4820. $ ILAENV( 1, 'DORMBR', 'PRT', N, N, N, -1 ) )
  4821. - WRKBL = MAX( WRKBL, BDSPAC+3*N )
  4822. + WRKBL = MAX( WRKBL, BDSPAC+2*N+M )
  4823. MAXWRK = WRKBL + M*N
  4824. - MINWRK = 3*N + MAX( M, N*N+BDSPAC )
  4825. + MINWRK = BDSPAC + N*N + 2*N + M
  4826. ELSE IF( WNTQS ) THEN
  4827. - WRKBL = MAX( WRKBL, 3*N+N*
  4828. - $ ILAENV( 1, 'DORMBR', 'QLN', M, N, N, -1 ) )
  4829. - WRKBL = MAX( WRKBL, 3*N+N*
  4830. - $ ILAENV( 1, 'DORMBR', 'PRT', N, N, N, -1 ) )
  4831. - MAXWRK = MAX( WRKBL, BDSPAC+3*N )
  4832. - MINWRK = 3*N + MAX( M, BDSPAC )
  4833. + MAXWRK = MAX( MAXWRK, 3*N+N*
  4834. + $ ILAENV( 1, 'DORMBR', 'QLN', M, N, N, -1 ) )
  4835. + MAXWRK = MAX( MAXWRK, 3*N+N*
  4836. + $ ILAENV( 1, 'DORMBR', 'PRT', N, N, N, -1 ) )
  4837. + MAXWRK = MAX( MAXWRK, BDSPAC+2*N+M )
  4838. + MINWRK = BDSPAC + 2*N + M
  4839. ELSE IF( WNTQA ) THEN
  4840. - WRKBL = MAX( WRKBL, 3*N+M*
  4841. - $ ILAENV( 1, 'DORMBR', 'QLN', M, M, N, -1 ) )
  4842. - WRKBL = MAX( WRKBL, 3*N+N*
  4843. - $ ILAENV( 1, 'DORMBR', 'PRT', N, N, N, -1 ) )
  4844. - MAXWRK = MAX( MAXWRK, BDSPAC+3*N )
  4845. - MINWRK = 3*N + MAX( M, BDSPAC )
  4846. + MAXWRK = MAX( MAXWRK, 3*N+M*
  4847. + $ ILAENV( 1, 'DORMBR', 'QLN', M, M, N, -1 ) )
  4848. + MAXWRK = MAX( MAXWRK, 3*N+N*
  4849. + $ ILAENV( 1, 'DORMBR', 'PRT', N, N, N, -1 ) )
  4850. + MAXWRK = MAX( MAXWRK, BDSPAC+2*N+M )
  4851. + MINWRK = BDSPAC + 2*N + M
  4852. END IF
  4853. END IF
  4854. ELSE
  4855. *
  4856. * Compute space needed for DBDSDC
  4857. *
  4858. - IF( WNTQN ) THEN
  4859. - BDSPAC = 7*M
  4860. - ELSE
  4861. - BDSPAC = 3*M*M + 4*M
  4862. - END IF
  4863. + BDSPAC = 3*M*M + 7*M
  4864. + BDSPAN = MAX( 12*M+4, 8*M+2+SMLSIZ*( SMLSIZ+8 ) )
  4865. IF( N.GE.MNTHR ) THEN
  4866. IF( WNTQN ) THEN
  4867. *
  4868. * Path 1t (N much larger than M, JOBZ='N')
  4869. *
  4870. - WRKBL = M + M*ILAENV( 1, 'DGELQF', ' ', M, N, -1,
  4871. - $ -1 )
  4872. - WRKBL = MAX( WRKBL, 3*M+2*M*
  4873. - $ ILAENV( 1, 'DGEBRD', ' ', M, M, -1, -1 ) )
  4874. - MAXWRK = MAX( WRKBL, BDSPAC+M )
  4875. - MINWRK = BDSPAC + M
  4876. + MAXWRK = M + M*ILAENV( 1, 'DGELQF', ' ', M, N, -1,
  4877. + $ -1 )
  4878. + MAXWRK = MAX( MAXWRK, 3*M+2*M*
  4879. + $ ILAENV( 1, 'DGEBRD', ' ', M, M, -1, -1 ) )
  4880. + MAXWRK = MAX( MAXWRK, BDSPAC )
  4881. + MINWRK = BDSPAC
  4882. ELSE IF( WNTQO ) THEN
  4883. *
  4884. * Path 2t (N much larger than M, JOBZ='O')
  4885. @@ -349,9 +348,9 @@
  4886. $ ILAENV( 1, 'DORMBR', 'QLN', M, M, M, -1 ) )
  4887. WRKBL = MAX( WRKBL, 3*M+M*
  4888. $ ILAENV( 1, 'DORMBR', 'PRT', M, M, M, -1 ) )
  4889. - WRKBL = MAX( WRKBL, BDSPAC+3*M )
  4890. + WRKBL = MAX( WRKBL, BDSPAC+2*M )
  4891. MAXWRK = WRKBL + 2*M*M
  4892. - MINWRK = BDSPAC + 2*M*M + 3*M
  4893. + MINWRK = BDSPAC + 2*M*M + 2*M
  4894. ELSE IF( WNTQS ) THEN
  4895. *
  4896. * Path 3t (N much larger than M, JOBZ='S')
  4897. @@ -365,9 +364,9 @@
  4898. $ ILAENV( 1, 'DORMBR', 'QLN', M, M, M, -1 ) )
  4899. WRKBL = MAX( WRKBL, 3*M+M*
  4900. $ ILAENV( 1, 'DORMBR', 'PRT', M, M, M, -1 ) )
  4901. - WRKBL = MAX( WRKBL, BDSPAC+3*M )
  4902. + WRKBL = MAX( WRKBL, BDSPAC+2*M )
  4903. MAXWRK = WRKBL + M*M
  4904. - MINWRK = BDSPAC + M*M + 3*M
  4905. + MINWRK = BDSPAC + M*M + 2*M
  4906. ELSE IF( WNTQA ) THEN
  4907. *
  4908. * Path 4t (N much larger than M, JOBZ='A')
  4909. @@ -381,9 +380,9 @@
  4910. $ ILAENV( 1, 'DORMBR', 'QLN', M, M, M, -1 ) )
  4911. WRKBL = MAX( WRKBL, 3*M+M*
  4912. $ ILAENV( 1, 'DORMBR', 'PRT', M, M, M, -1 ) )
  4913. - WRKBL = MAX( WRKBL, BDSPAC+3*M )
  4914. + WRKBL = MAX( WRKBL, BDSPAC+2*M )
  4915. MAXWRK = WRKBL + M*M
  4916. - MINWRK = BDSPAC + M*M + 3*M
  4917. + MINWRK = BDSPAC + M*M + M + N
  4918. END IF
  4919. ELSE
  4920. *
  4921. @@ -391,52 +390,47 @@
  4922. *
  4923. WRKBL = 3*M + ( M+N )*ILAENV( 1, 'DGEBRD', ' ', M, N, -1,
  4924. $ -1 )
  4925. - IF( WNTQN ) THEN
  4926. - MAXWRK = MAX( WRKBL, BDSPAC+3*M )
  4927. - MINWRK = 3*M + MAX( N, BDSPAC )
  4928. - ELSE IF( WNTQO ) THEN
  4929. + IF( WNTQO ) THEN
  4930. WRKBL = MAX( WRKBL, 3*M+M*
  4931. $ ILAENV( 1, 'DORMBR', 'QLN', M, M, N, -1 ) )
  4932. WRKBL = MAX( WRKBL, 3*M+M*
  4933. $ ILAENV( 1, 'DORMBR', 'PRT', M, N, M, -1 ) )
  4934. - WRKBL = MAX( WRKBL, BDSPAC+3*M )
  4935. + WRKBL = MAX( WRKBL, BDSPAC+2*M )
  4936. MAXWRK = WRKBL + M*N
  4937. - MINWRK = 3*M + MAX( N, M*M+BDSPAC )
  4938. + MINWRK = BDSPAC + M*M + 2*M + N
  4939. ELSE IF( WNTQS ) THEN
  4940. - WRKBL = MAX( WRKBL, 3*M+M*
  4941. - $ ILAENV( 1, 'DORMBR', 'QLN', M, M, N, -1 ) )
  4942. - WRKBL = MAX( WRKBL, 3*M+M*
  4943. - $ ILAENV( 1, 'DORMBR', 'PRT', M, N, M, -1 ) )
  4944. - MAXWRK = MAX( WRKBL, BDSPAC+3*M )
  4945. - MINWRK = 3*M + MAX( N, BDSPAC )
  4946. + MAXWRK = MAX( MAXWRK, 3*M+M*
  4947. + $ ILAENV( 1, 'DORMBR', 'QLN', M, M, N, -1 ) )
  4948. + MAXWRK = MAX( MAXWRK, 3*M+M*
  4949. + $ ILAENV( 1, 'DORMBR', 'PRT', M, N, M, -1 ) )
  4950. + MAXWRK = MAX( MAXWRK, BDSPAC+2*M )
  4951. + MINWRK = BDSPAC + 2*M + N
  4952. ELSE IF( WNTQA ) THEN
  4953. - WRKBL = MAX( WRKBL, 3*M+M*
  4954. - $ ILAENV( 1, 'DORMBR', 'QLN', M, M, N, -1 ) )
  4955. - WRKBL = MAX( WRKBL, 3*M+M*
  4956. - $ ILAENV( 1, 'DORMBR', 'PRT', N, N, M, -1 ) )
  4957. - MAXWRK = MAX( WRKBL, BDSPAC+3*M )
  4958. - MINWRK = 3*M + MAX( N, BDSPAC )
  4959. + MAXWRK = MAX( MAXWRK, 3*M+M*
  4960. + $ ILAENV( 1, 'DORMBR', 'QLN', M, M, N, -1 ) )
  4961. + MAXWRK = MAX( MAXWRK, 3*M+N*
  4962. + $ ILAENV( 1, 'DORMBR', 'PRT', N, N, M, -1 ) )
  4963. + MAXWRK = MAX( MAXWRK, BDSPAC+2*M )
  4964. + MINWRK = BDSPAC + 2*M + N
  4965. END IF
  4966. END IF
  4967. END IF
  4968. + END IF
  4969. + IF( INFO.EQ.0 ) THEN
  4970. WORK( 1 ) = MAXWRK
  4971. + IF( LWORK.LT.MINWRK .AND. LWORK.NE.LQUERV )
  4972. + $ INFO = -12
  4973. END IF
  4974. *
  4975. - IF( LWORK.LT.MINWRK .AND. .NOT.LQUERY ) THEN
  4976. - INFO = -12
  4977. - END IF
  4978. +* Quick returns
  4979. +*
  4980. IF( INFO.NE.0 ) THEN
  4981. CALL XERBLA( 'DGESDD', -INFO )
  4982. RETURN
  4983. - ELSE IF( LQUERY ) THEN
  4984. - RETURN
  4985. END IF
  4986. -*
  4987. -* Quick return if possible
  4988. -*
  4989. + IF( LWORK.EQ.LQUERV )
  4990. + $ RETURN
  4991. IF( M.EQ.0 .OR. N.EQ.0 ) THEN
  4992. - IF( LWORK.GE.1 )
  4993. - $ WORK( 1 ) = ONE
  4994. RETURN
  4995. END IF
  4996. *
  4997. @@ -497,7 +491,7 @@
  4998. NWORK = IE + N
  4999. *
  5000. * Perform bidiagonal SVD, computing singular values only
  5001. -* (Workspace: need N+BDSPAC)
  5002. +* (Workspace: need BDSPAN)
  5003. *
  5004. CALL DBDSDC( 'U', 'N', N, S, WORK( IE ), DUM, 1, DUM, 1,
  5005. $ DUM, IDUM, WORK( NWORK ), IWORK, INFO )
  5006. @@ -512,10 +506,10 @@
  5007. *
  5008. * WORK(IR) is LDWRKR by N
  5009. *
  5010. - IF( LWORK.GE.LDA*N+N*N+3*N+BDSPAC ) THEN
  5011. + IF( LWORK.GE.LDA*N+4*N*N+9*N ) THEN
  5012. LDWRKR = LDA
  5013. ELSE
  5014. - LDWRKR = ( LWORK-N*N-3*N-BDSPAC ) / N
  5015. + LDWRKR = ( LWORK-4*N*N-9*N ) / N
  5016. END IF
  5017. ITAU = IR + LDWRKR*N
  5018. NWORK = ITAU + N
  5019. @@ -557,7 +551,7 @@
  5020. * Perform bidiagonal SVD, computing left singular vectors
  5021. * of bidiagonal matrix in WORK(IU) and computing right
  5022. * singular vectors of bidiagonal matrix in VT
  5023. -* (Workspace: need N+N*N+BDSPAC)
  5024. +* (Workspace: need 2*N*N+BDSPAC)
  5025. *
  5026. CALL DBDSDC( 'U', 'I', N, S, WORK( IE ), WORK( IU ), N,
  5027. $ VT, LDVT, DUM, IDUM, WORK( NWORK ), IWORK,
  5028. @@ -633,7 +627,7 @@
  5029. * Perform bidiagonal SVD, computing left singular vectors
  5030. * of bidiagoal matrix in U and computing right singular
  5031. * vectors of bidiagonal matrix in VT
  5032. -* (Workspace: need N+BDSPAC)
  5033. +* (Workspace: need N*N+BDSPAC)
  5034. *
  5035. CALL DBDSDC( 'U', 'I', N, S, WORK( IE ), U, LDU, VT,
  5036. $ LDVT, DUM, IDUM, WORK( NWORK ), IWORK,
  5037. @@ -681,7 +675,7 @@
  5038. CALL DLACPY( 'L', M, N, A, LDA, U, LDU )
  5039. *
  5040. * Generate Q in U
  5041. -* (Workspace: need N*N+2*N, prefer N*N+N+N*NB)
  5042. +* (Workspace: need N*N+N+M, prefer N*N+N+M*NB)
  5043. CALL DORGQR( M, M, N, U, LDU, WORK( ITAU ),
  5044. $ WORK( NWORK ), LWORK-NWORK+1, IERR )
  5045. *
  5046. @@ -703,7 +697,7 @@
  5047. * Perform bidiagonal SVD, computing left singular vectors
  5048. * of bidiagonal matrix in WORK(IU) and computing right
  5049. * singular vectors of bidiagonal matrix in VT
  5050. -* (Workspace: need N+N*N+BDSPAC)
  5051. +* (Workspace: need N*N+BDSPAC)
  5052. *
  5053. CALL DBDSDC( 'U', 'I', N, S, WORK( IE ), WORK( IU ), N,
  5054. $ VT, LDVT, DUM, IDUM, WORK( NWORK ), IWORK,
  5055. @@ -754,13 +748,13 @@
  5056. IF( WNTQN ) THEN
  5057. *
  5058. * Perform bidiagonal SVD, only computing singular values
  5059. -* (Workspace: need N+BDSPAC)
  5060. +* (Workspace: need BDSPAN)
  5061. *
  5062. CALL DBDSDC( 'U', 'N', N, S, WORK( IE ), DUM, 1, DUM, 1,
  5063. $ DUM, IDUM, WORK( NWORK ), IWORK, INFO )
  5064. ELSE IF( WNTQO ) THEN
  5065. IU = NWORK
  5066. - IF( LWORK.GE.M*N+3*N+BDSPAC ) THEN
  5067. + IF( LWORK.GE.M*N+3*N*N+9*N ) THEN
  5068. *
  5069. * WORK( IU ) is M by N
  5070. *
  5071. @@ -785,7 +779,7 @@
  5072. * Perform bidiagonal SVD, computing left singular vectors
  5073. * of bidiagonal matrix in WORK(IU) and computing right
  5074. * singular vectors of bidiagonal matrix in VT
  5075. -* (Workspace: need N+N*N+BDSPAC)
  5076. +* (Workspace: need N*N+BDSPAC)
  5077. *
  5078. CALL DBDSDC( 'U', 'I', N, S, WORK( IE ), WORK( IU ),
  5079. $ LDWRKU, VT, LDVT, DUM, IDUM, WORK( NWORK ),
  5080. @@ -798,7 +792,7 @@
  5081. $ WORK( ITAUP ), VT, LDVT, WORK( NWORK ),
  5082. $ LWORK-NWORK+1, IERR )
  5083. *
  5084. - IF( LWORK.GE.M*N+3*N+BDSPAC ) THEN
  5085. + IF( LWORK.GE.M*N+3*N*N+9*N ) THEN
  5086. *
  5087. * Overwrite WORK(IU) by left singular vectors of A
  5088. * (Workspace: need N*N+2*N, prefer N*N+N+N*NB)
  5089. @@ -838,7 +832,7 @@
  5090. * Perform bidiagonal SVD, computing left singular vectors
  5091. * of bidiagonal matrix in U and computing right singular
  5092. * vectors of bidiagonal matrix in VT
  5093. -* (Workspace: need N+BDSPAC)
  5094. +* (Workspace: need BDSPAC)
  5095. *
  5096. CALL DLASET( 'F', M, N, ZERO, ZERO, U, LDU )
  5097. CALL DBDSDC( 'U', 'I', N, S, WORK( IE ), U, LDU, VT,
  5098. @@ -855,12 +849,12 @@
  5099. CALL DORMBR( 'P', 'R', 'T', N, N, N, A, LDA,
  5100. $ WORK( ITAUP ), VT, LDVT, WORK( NWORK ),
  5101. $ LWORK-NWORK+1, IERR )
  5102. - ELSE IF( WNTQA ) THEN
  5103. + ELSE
  5104. *
  5105. * Perform bidiagonal SVD, computing left singular vectors
  5106. * of bidiagonal matrix in U and computing right singular
  5107. * vectors of bidiagonal matrix in VT
  5108. -* (Workspace: need N+BDSPAC)
  5109. +* (Workspace: need BDSPAC)
  5110. *
  5111. CALL DLASET( 'F', M, M, ZERO, ZERO, U, LDU )
  5112. CALL DBDSDC( 'U', 'I', N, S, WORK( IE ), U, LDU, VT,
  5113. @@ -925,7 +919,7 @@
  5114. NWORK = IE + M
  5115. *
  5116. * Perform bidiagonal SVD, computing singular values only
  5117. -* (Workspace: need M+BDSPAC)
  5118. +* (Workspace: need BDSPAN)
  5119. *
  5120. CALL DBDSDC( 'U', 'N', M, S, WORK( IE ), DUM, 1, DUM, 1,
  5121. $ DUM, IDUM, WORK( NWORK ), IWORK, INFO )
  5122. @@ -941,7 +935,7 @@
  5123. * IVT is M by M
  5124. *
  5125. IL = IVT + M*M
  5126. - IF( LWORK.GE.M*N+M*M+3*M+BDSPAC ) THEN
  5127. + IF( LWORK.GE.M*N+4*M*M+9*M ) THEN
  5128. *
  5129. * WORK(IL) is M by N
  5130. *
  5131. @@ -986,7 +980,7 @@
  5132. * Perform bidiagonal SVD, computing left singular vectors
  5133. * of bidiagonal matrix in U, and computing right singular
  5134. * vectors of bidiagonal matrix in WORK(IVT)
  5135. -* (Workspace: need M+M*M+BDSPAC)
  5136. +* (Workspace: need 2*M*M+BDSPAC)
  5137. *
  5138. CALL DBDSDC( 'U', 'I', M, S, WORK( IE ), U, LDU,
  5139. $ WORK( IVT ), M, DUM, IDUM, WORK( NWORK ),
  5140. @@ -1061,7 +1055,7 @@
  5141. * Perform bidiagonal SVD, computing left singular vectors
  5142. * of bidiagonal matrix in U and computing right singular
  5143. * vectors of bidiagonal matrix in VT
  5144. -* (Workspace: need M+BDSPAC)
  5145. +* (Workspace: need M*M+BDSPAC)
  5146. *
  5147. CALL DBDSDC( 'U', 'I', M, S, WORK( IE ), U, LDU, VT,
  5148. $ LDVT, DUM, IDUM, WORK( NWORK ), IWORK,
  5149. @@ -1108,7 +1102,7 @@
  5150. CALL DLACPY( 'U', M, N, A, LDA, VT, LDVT )
  5151. *
  5152. * Generate Q in VT
  5153. -* (Workspace: need M*M+2*M, prefer M*M+M+M*NB)
  5154. +* (Workspace: need M*M+M+N, prefer M*M+M+N*NB)
  5155. *
  5156. CALL DORGLQ( N, N, M, VT, LDVT, WORK( ITAU ),
  5157. $ WORK( NWORK ), LWORK-NWORK+1, IERR )
  5158. @@ -1131,7 +1125,7 @@
  5159. * Perform bidiagonal SVD, computing left singular vectors
  5160. * of bidiagonal matrix in U and computing right singular
  5161. * vectors of bidiagonal matrix in WORK(IVT)
  5162. -* (Workspace: need M+M*M+BDSPAC)
  5163. +* (Workspace: need M*M+BDSPAC)
  5164. *
  5165. CALL DBDSDC( 'U', 'I', M, S, WORK( IE ), U, LDU,
  5166. $ WORK( IVT ), LDWKVT, DUM, IDUM,
  5167. @@ -1182,14 +1176,14 @@
  5168. IF( WNTQN ) THEN
  5169. *
  5170. * Perform bidiagonal SVD, only computing singular values
  5171. -* (Workspace: need M+BDSPAC)
  5172. +* (Workspace: need BDSPAN)
  5173. *
  5174. CALL DBDSDC( 'L', 'N', M, S, WORK( IE ), DUM, 1, DUM, 1,
  5175. $ DUM, IDUM, WORK( NWORK ), IWORK, INFO )
  5176. ELSE IF( WNTQO ) THEN
  5177. LDWKVT = M
  5178. IVT = NWORK
  5179. - IF( LWORK.GE.M*N+3*M+BDSPAC ) THEN
  5180. + IF( LWORK.GE.M*N+3*M*M+9*M ) THEN
  5181. *
  5182. * WORK( IVT ) is M by N
  5183. *
  5184. @@ -1224,7 +1218,7 @@
  5185. $ WORK( ITAUQ ), U, LDU, WORK( NWORK ),
  5186. $ LWORK-NWORK+1, IERR )
  5187. *
  5188. - IF( LWORK.GE.M*N+3*M+BDSPAC ) THEN
  5189. + IF( LWORK.GE.M*N+3*M*M+9*M ) THEN
  5190. *
  5191. * Overwrite WORK(IVT) by left singular vectors of A
  5192. * (Workspace: need M*M+2*M, prefer M*M+M+M*NB)
  5193. @@ -1263,7 +1257,7 @@
  5194. * Perform bidiagonal SVD, computing left singular vectors
  5195. * of bidiagonal matrix in U and computing right singular
  5196. * vectors of bidiagonal matrix in VT
  5197. -* (Workspace: need M+BDSPAC)
  5198. +* (Workspace: need BDSPAC)
  5199. *
  5200. CALL DLASET( 'F', M, N, ZERO, ZERO, VT, LDVT )
  5201. CALL DBDSDC( 'L', 'I', M, S, WORK( IE ), U, LDU, VT,
  5202. @@ -1280,12 +1274,12 @@
  5203. CALL DORMBR( 'P', 'R', 'T', M, N, M, A, LDA,
  5204. $ WORK( ITAUP ), VT, LDVT, WORK( NWORK ),
  5205. $ LWORK-NWORK+1, IERR )
  5206. - ELSE IF( WNTQA ) THEN
  5207. + ELSE
  5208. *
  5209. * Perform bidiagonal SVD, computing left singular vectors
  5210. * of bidiagonal matrix in U and computing right singular
  5211. * vectors of bidiagonal matrix in VT
  5212. -* (Workspace: need M+BDSPAC)
  5213. +* (Workspace: need BDSPAC)
  5214. *
  5215. CALL DLASET( 'F', N, N, ZERO, ZERO, VT, LDVT )
  5216. CALL DBDSDC( 'L', 'I', M, S, WORK( IE ), U, LDU, VT,
  5217. @@ -1319,9 +1313,15 @@
  5218. IF( ANRM.GT.BIGNUM )
  5219. $ CALL DLASCL( 'G', 0, 0, BIGNUM, ANRM, MINMN, 1, S, MINMN,
  5220. $ IERR )
  5221. + IF( INFO.NE.0 .AND. ANRM.GT.BIGNUM )
  5222. + $ CALL DLASCL( 'G', 0, 0, BIGNUM, ANRM, MINMN-1, 1, WORK( 2 ),
  5223. + $ MINMN, IERR )
  5224. IF( ANRM.LT.SMLNUM )
  5225. $ CALL DLASCL( 'G', 0, 0, SMLNUM, ANRM, MINMN, 1, S, MINMN,
  5226. $ IERR )
  5227. + IF( INFO.NE.0 .AND. ANRM.LT.SMLNUM )
  5228. + $ CALL DLASCL( 'G', 0, 0, SMLNUM, ANRM, MINMN-1, 1, WORK( 2 ),
  5229. + $ MINMN, IERR )
  5230. END IF
  5231. *
  5232. * Return optimal workspace in WORK(1)
  5233. diff -uNr LAPACK.orig/SRC/dgesvd.f LAPACK/SRC/dgesvd.f
  5234. --- LAPACK.orig/SRC/dgesvd.f Thu Nov 4 14:24:44 1999
  5235. +++ LAPACK/SRC/dgesvd.f Fri May 25 16:08:25 2001
  5236. @@ -4,7 +4,8 @@
  5237. * -- LAPACK driver routine (version 3.0) --
  5238. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  5239. * Courant Institute, Argonne National Lab, and Rice University
  5240. -* October 31, 1999
  5241. +* June 30, 1999
  5242. +* 8-15-00: Improve consistency of WS calculations (eca)
  5243. *
  5244. * .. Scalar Arguments ..
  5245. CHARACTER JOBU, JOBVT
  5246. @@ -118,10 +119,9 @@
  5247. * LWORK >= MAX(3*MIN(M,N)+MAX(M,N),5*MIN(M,N)).
  5248. * For good performance, LWORK should generally be larger.
  5249. *
  5250. -* If LWORK = -1, then a workspace query is assumed; the routine
  5251. -* only calculates the optimal size of the WORK array, returns
  5252. -* this value as the first entry of the WORK array, and no error
  5253. -* message related to LWORK is issued by XERBLA.
  5254. +* If LWORK = -1, a workspace query is assumed. The optimal
  5255. +* size for the WORK array is calculated and stored in WORK(1),
  5256. +* and no other work except argument checking is performed.
  5257. *
  5258. * INFO (output) INTEGER
  5259. * = 0: successful exit.
  5260. @@ -134,12 +134,14 @@
  5261. * =====================================================================
  5262. *
  5263. * .. Parameters ..
  5264. + INTEGER LQUERV
  5265. + PARAMETER ( LQUERV = -1 )
  5266. DOUBLE PRECISION ZERO, ONE
  5267. PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0 )
  5268. * ..
  5269. * .. Local Scalars ..
  5270. - LOGICAL LQUERY, WNTUA, WNTUAS, WNTUN, WNTUO, WNTUS,
  5271. - $ WNTVA, WNTVAS, WNTVN, WNTVO, WNTVS
  5272. + LOGICAL WNTUA, WNTUAS, WNTUN, WNTUO, WNTUS, WNTVA,
  5273. + $ WNTVAS, WNTVN, WNTVO, WNTVS
  5274. INTEGER BDSPAC, BLK, CHUNK, I, IE, IERR, IR, ISCL,
  5275. $ ITAU, ITAUP, ITAUQ, IU, IWORK, LDWRKR, LDWRKU,
  5276. $ MAXWRK, MINMN, MINWRK, MNTHR, NCU, NCVT, NRU,
  5277. @@ -181,7 +183,7 @@
  5278. WNTVO = LSAME( JOBVT, 'O' )
  5279. WNTVN = LSAME( JOBVT, 'N' )
  5280. MINWRK = 1
  5281. - LQUERY = ( LWORK.EQ.-1 )
  5282. + MAXWRK = 1
  5283. *
  5284. IF( .NOT.( WNTUA .OR. WNTUS .OR. WNTUO .OR. WNTUN ) ) THEN
  5285. INFO = -1
  5286. @@ -208,8 +210,7 @@
  5287. * NB refers to the optimal block size for the immediately
  5288. * following subroutine, as returned by ILAENV.)
  5289. *
  5290. - IF( INFO.EQ.0 .AND. ( LWORK.GE.1 .OR. LQUERY ) .AND. M.GT.0 .AND.
  5291. - $ N.GT.0 ) THEN
  5292. + IF( INFO.EQ.0 .AND. M.GT.0 .AND. N.GT.0 ) THEN
  5293. IF( M.GE.N ) THEN
  5294. *
  5295. * Compute space needed for DBDSQR
  5296. @@ -557,24 +558,22 @@
  5297. MAXWRK = MAX( MAXWRK, MINWRK )
  5298. END IF
  5299. END IF
  5300. + END IF
  5301. + IF( INFO.EQ.0 ) THEN
  5302. WORK( 1 ) = MAXWRK
  5303. + IF( LWORK.LT.MINWRK .AND. LWORK.NE.LQUERV )
  5304. + $ INFO = -13
  5305. END IF
  5306. *
  5307. - IF( LWORK.LT.MINWRK .AND. .NOT.LQUERY ) THEN
  5308. - INFO = -13
  5309. - END IF
  5310. +* Quick returns
  5311. +*
  5312. IF( INFO.NE.0 ) THEN
  5313. CALL XERBLA( 'DGESVD', -INFO )
  5314. RETURN
  5315. - ELSE IF( LQUERY ) THEN
  5316. - RETURN
  5317. END IF
  5318. -*
  5319. -* Quick return if possible
  5320. -*
  5321. + IF( LWORK.EQ.LQUERV )
  5322. + $ RETURN
  5323. IF( M.EQ.0 .OR. N.EQ.0 ) THEN
  5324. - IF( LWORK.GE.1 )
  5325. - $ WORK( 1 ) = ONE
  5326. RETURN
  5327. END IF
  5328. *
  5329. diff -uNr LAPACK.orig/SRC/dggbak.f LAPACK/SRC/dggbak.f
  5330. --- LAPACK.orig/SRC/dggbak.f Thu Nov 4 14:24:45 1999
  5331. +++ LAPACK/SRC/dggbak.f Fri May 25 16:08:56 2001
  5332. @@ -4,7 +4,7 @@
  5333. * -- LAPACK routine (version 3.0) --
  5334. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  5335. * Courant Institute, Argonne National Lab, and Rice University
  5336. -* September 30, 1994
  5337. +* February 1, 2001
  5338. *
  5339. * .. Scalar Arguments ..
  5340. CHARACTER JOB, SIDE
  5341. @@ -108,10 +108,15 @@
  5342. INFO = -3
  5343. ELSE IF( ILO.LT.1 ) THEN
  5344. INFO = -4
  5345. - ELSE IF( IHI.LT.ILO .OR. IHI.GT.MAX( 1, N ) ) THEN
  5346. + ELSE IF( N.EQ.0 .AND. IHI.EQ.0 .AND. ILO.NE.1 ) THEN
  5347. + INFO = -4
  5348. + ELSE IF( N.GT.0 .AND. ( IHI.LT.ILO .OR. IHI.GT.MAX( 1, N ) ) )
  5349. + $ THEN
  5350. + INFO = -5
  5351. + ELSE IF( N.EQ.0 .AND. ILO.EQ.1 .AND. IHI.NE.0 ) THEN
  5352. INFO = -5
  5353. ELSE IF( M.LT.0 ) THEN
  5354. - INFO = -6
  5355. + INFO = -8
  5356. ELSE IF( LDV.LT.MAX( 1, N ) ) THEN
  5357. INFO = -10
  5358. END IF
  5359. diff -uNr LAPACK.orig/SRC/dggbal.f LAPACK/SRC/dggbal.f
  5360. --- LAPACK.orig/SRC/dggbal.f Thu Nov 4 14:25:44 1999
  5361. +++ LAPACK/SRC/dggbal.f Fri May 25 16:09:17 2001
  5362. @@ -4,7 +4,7 @@
  5363. * -- LAPACK routine (version 3.0) --
  5364. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  5365. * Courant Institute, Argonne National Lab, and Rice University
  5366. -* September 30, 1994
  5367. +* April 12, 2001
  5368. *
  5369. * .. Scalar Arguments ..
  5370. CHARACTER JOB
  5371. @@ -141,7 +141,7 @@
  5372. ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
  5373. INFO = -4
  5374. ELSE IF( LDB.LT.MAX( 1, N ) ) THEN
  5375. - INFO = -5
  5376. + INFO = -6
  5377. END IF
  5378. IF( INFO.NE.0 ) THEN
  5379. CALL XERBLA( 'DGGBAL', -INFO )
  5380. @@ -188,8 +188,8 @@
  5381. IF( L.NE.1 )
  5382. $ GO TO 30
  5383. *
  5384. - RSCALE( 1 ) = 1
  5385. - LSCALE( 1 ) = 1
  5386. + RSCALE( 1 ) = ONE
  5387. + LSCALE( 1 ) = ONE
  5388. GO TO 190
  5389. *
  5390. 30 CONTINUE
  5391. @@ -247,7 +247,7 @@
  5392. * Permute rows M and I
  5393. *
  5394. 160 CONTINUE
  5395. - LSCALE( M ) = I
  5396. + LSCALE( M ) = DBLE( I )
  5397. IF( I.EQ.M )
  5398. $ GO TO 170
  5399. CALL DSWAP( N-K+1, A( I, K ), LDA, A( M, K ), LDA )
  5400. @@ -256,7 +256,7 @@
  5401. * Permute columns M and J
  5402. *
  5403. 170 CONTINUE
  5404. - RSCALE( M ) = J
  5405. + RSCALE( M ) = DBLE( J )
  5406. IF( J.EQ.M )
  5407. $ GO TO 180
  5408. CALL DSWAP( L, A( 1, J ), 1, A( 1, M ), 1 )
  5409. @@ -424,7 +424,7 @@
  5410. DO 360 I = ILO, IHI
  5411. IRAB = IDAMAX( N-ILO+1, A( I, ILO ), LDA )
  5412. RAB = ABS( A( I, IRAB+ILO-1 ) )
  5413. - IRAB = IDAMAX( N-ILO+1, B( I, ILO ), LDA )
  5414. + IRAB = IDAMAX( N-ILO+1, B( I, ILO ), LDB )
  5415. RAB = MAX( RAB, ABS( B( I, IRAB+ILO-1 ) ) )
  5416. LRAB = INT( LOG10( RAB+SFMIN ) / BASL+ONE )
  5417. IR = LSCALE( I ) + SIGN( HALF, LSCALE( I ) )
  5418. diff -uNr LAPACK.orig/SRC/dgges.f LAPACK/SRC/dgges.f
  5419. --- LAPACK.orig/SRC/dgges.f Thu Nov 4 14:26:18 1999
  5420. +++ LAPACK/SRC/dgges.f Fri May 25 16:09:38 2001
  5421. @@ -6,6 +6,7 @@
  5422. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  5423. * Courant Institute, Argonne National Lab, and Rice University
  5424. * June 30, 1999
  5425. +* 8-15-00: Improve consistency of WS calculations (eca)
  5426. *
  5427. * .. Scalar Arguments ..
  5428. CHARACTER JOBVSL, JOBVSR, SORT
  5429. @@ -158,10 +159,9 @@
  5430. * LWORK (input) INTEGER
  5431. * The dimension of the array WORK. LWORK >= 8*N+16.
  5432. *
  5433. -* If LWORK = -1, then a workspace query is assumed; the routine
  5434. -* only calculates the optimal size of the WORK array, returns
  5435. -* this value as the first entry of the WORK array, and no error
  5436. -* message related to LWORK is issued by XERBLA.
  5437. +* If LWORK = -1, a workspace query is assumed. The optimal
  5438. +* size for the WORK array is calculated and stored in WORK(1),
  5439. +* and no other work except argument checking is performed.
  5440. *
  5441. * BWORK (workspace) LOGICAL array, dimension (N)
  5442. * Not referenced if SORT = 'N'.
  5443. @@ -184,12 +184,14 @@
  5444. * =====================================================================
  5445. *
  5446. * .. Parameters ..
  5447. + INTEGER LQUERV
  5448. + PARAMETER ( LQUERV = -1 )
  5449. DOUBLE PRECISION ZERO, ONE
  5450. PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0 )
  5451. * ..
  5452. * .. Local Scalars ..
  5453. LOGICAL CURSL, ILASCL, ILBSCL, ILVSL, ILVSR, LASTSL,
  5454. - $ LQUERY, LST2SL, WANTST
  5455. + $ LST2SL, WANTST
  5456. INTEGER I, ICOLS, IERR, IHI, IJOBVL, IJOBVR, ILEFT,
  5457. $ ILO, IP, IRIGHT, IROWS, ITAU, IWRK, MAXWRK,
  5458. $ MINWRK
  5459. @@ -245,7 +247,6 @@
  5460. * Test the input arguments
  5461. *
  5462. INFO = 0
  5463. - LQUERY = ( LWORK.EQ.-1 )
  5464. IF( IJOBVL.LE.0 ) THEN
  5465. INFO = -1
  5466. ELSE IF( IJOBVR.LE.0 ) THEN
  5467. @@ -272,7 +273,7 @@
  5468. * following subroutine, as returned by ILAENV.)
  5469. *
  5470. MINWRK = 1
  5471. - IF( INFO.EQ.0 .AND. ( LWORK.GE.1 .OR. LQUERY ) ) THEN
  5472. + IF( INFO.EQ.0 ) THEN
  5473. MINWRK = 7*( N+1 ) + 16
  5474. MAXWRK = 7*( N+1 ) + N*ILAENV( 1, 'DGEQRF', ' ', N, 1, N, 0 ) +
  5475. $ 16
  5476. @@ -281,19 +282,18 @@
  5477. $ ILAENV( 1, 'DORGQR', ' ', N, 1, N, -1 ) )
  5478. END IF
  5479. WORK( 1 ) = MAXWRK
  5480. + IF( LWORK.LT.MINWRK .AND. LWORK.NE.LQUERV )
  5481. + $ INFO = -19
  5482. END IF
  5483. *
  5484. - IF( LWORK.LT.MINWRK .AND. .NOT.LQUERY )
  5485. - $ INFO = -19
  5486. +* Quick returns
  5487. +*
  5488. IF( INFO.NE.0 ) THEN
  5489. CALL XERBLA( 'DGGES ', -INFO )
  5490. RETURN
  5491. - ELSE IF( LQUERY ) THEN
  5492. - RETURN
  5493. END IF
  5494. -*
  5495. -* Quick return if possible
  5496. -*
  5497. + IF( LWORK.EQ.LQUERV )
  5498. + $ RETURN
  5499. IF( N.EQ.0 ) THEN
  5500. SDIM = 0
  5501. RETURN
  5502. diff -uNr LAPACK.orig/SRC/dggesx.f LAPACK/SRC/dggesx.f
  5503. --- LAPACK.orig/SRC/dggesx.f Thu Nov 4 14:26:18 1999
  5504. +++ LAPACK/SRC/dggesx.f Fri May 25 16:09:56 2001
  5505. @@ -7,6 +7,7 @@
  5506. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  5507. * Courant Institute, Argonne National Lab, and Rice University
  5508. * June 30, 1999
  5509. +* 8-15-00: Do WS calculations if LWORK = -1 (eca)
  5510. *
  5511. * .. Scalar Arguments ..
  5512. CHARACTER JOBVSL, JOBVSR, SENSE, SORT
  5513. @@ -185,6 +186,10 @@
  5514. * If SENSE = 'E', 'V', or 'B',
  5515. * LWORK >= MAX( 8*(N+1)+16, 2*SDIM*(N-SDIM) ).
  5516. *
  5517. +* If LWORK = -1, a workspace query is assumed. The optimal
  5518. +* size for the WORK array is calculated and stored in WORK(1),
  5519. +* and no other work except argument checking is performed.
  5520. +*
  5521. * IWORK (workspace) INTEGER array, dimension (LIWORK)
  5522. * Not referenced if SENSE = 'N'.
  5523. *
  5524. @@ -227,6 +232,8 @@
  5525. * =====================================================================
  5526. *
  5527. * .. Parameters ..
  5528. + INTEGER LQUERV
  5529. + PARAMETER ( LQUERV = -1 )
  5530. DOUBLE PRECISION ZERO, ONE
  5531. PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0 )
  5532. * ..
  5533. @@ -330,7 +337,7 @@
  5534. * following subroutine, as returned by ILAENV.)
  5535. *
  5536. MINWRK = 1
  5537. - IF( INFO.EQ.0 .AND. LWORK.GE.1 ) THEN
  5538. + IF( INFO.EQ.0 ) THEN
  5539. MINWRK = 8*( N+1 ) + 16
  5540. MAXWRK = 7*( N+1 ) + N*ILAENV( 1, 'DGEQRF', ' ', N, 1, N, 0 ) +
  5541. $ 16
  5542. @@ -338,7 +345,15 @@
  5543. MAXWRK = MAX( MAXWRK, 8*( N+1 )+N*
  5544. $ ILAENV( 1, 'DORGQR', ' ', N, 1, N, -1 )+16 )
  5545. END IF
  5546. +*
  5547. +* Estimate the workspace needed by DTGSEN.
  5548. +*
  5549. + IF( WANTST ) THEN
  5550. + MAXWRK = MAX( MAXWRK, 2*N+( N*N+1 ) / 2 )
  5551. + END IF
  5552. WORK( 1 ) = MAXWRK
  5553. + IF( LWORK.LT.MINWRK .AND. LWORK.NE.LQUERV )
  5554. + $ INFO = -22
  5555. END IF
  5556. IF( .NOT.WANTSN ) THEN
  5557. LIWMIN = 1
  5558. @@ -346,21 +361,19 @@
  5559. LIWMIN = N + 6
  5560. END IF
  5561. IWORK( 1 ) = LIWMIN
  5562. -*
  5563. - IF( INFO.EQ.0 .AND. LWORK.LT.MINWRK ) THEN
  5564. - INFO = -22
  5565. - ELSE IF( INFO.EQ.0 .AND. IJOB.GE.1 ) THEN
  5566. + IF( INFO.EQ.0 .AND. IJOB.GE.1 ) THEN
  5567. IF( LIWORK.LT.LIWMIN )
  5568. $ INFO = -24
  5569. END IF
  5570. *
  5571. +* Quick returns
  5572. +*
  5573. IF( INFO.NE.0 ) THEN
  5574. CALL XERBLA( 'DGGESX', -INFO )
  5575. RETURN
  5576. END IF
  5577. -*
  5578. -* Quick return if possible
  5579. -*
  5580. + IF( LWORK.EQ.LQUERV )
  5581. + $ RETURN
  5582. IF( N.EQ.0 ) THEN
  5583. SDIM = 0
  5584. RETURN
  5585. diff -uNr LAPACK.orig/SRC/dggev.f LAPACK/SRC/dggev.f
  5586. --- LAPACK.orig/SRC/dggev.f Thu Nov 4 14:26:18 1999
  5587. +++ LAPACK/SRC/dggev.f Fri May 25 16:10:14 2001
  5588. @@ -5,6 +5,7 @@
  5589. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  5590. * Courant Institute, Argonne National Lab, and Rice University
  5591. * June 30, 1999
  5592. +* 8-15-00: Improve consistency of WS calculations (eca)
  5593. *
  5594. * .. Scalar Arguments ..
  5595. CHARACTER JOBVL, JOBVR
  5596. @@ -123,10 +124,9 @@
  5597. * The dimension of the array WORK. LWORK >= max(1,8*N).
  5598. * For good performance, LWORK must generally be larger.
  5599. *
  5600. -* If LWORK = -1, then a workspace query is assumed; the routine
  5601. -* only calculates the optimal size of the WORK array, returns
  5602. -* this value as the first entry of the WORK array, and no error
  5603. -* message related to LWORK is issued by XERBLA.
  5604. +* If LWORK = -1, a workspace query is assumed. The optimal
  5605. +* size for the WORK array is calculated and stored in WORK(1),
  5606. +* and no other work except argument checking is performed.
  5607. *
  5608. * INFO (output) INTEGER
  5609. * = 0: successful exit
  5610. @@ -141,11 +141,13 @@
  5611. * =====================================================================
  5612. *
  5613. * .. Parameters ..
  5614. + INTEGER LQUERV
  5615. + PARAMETER ( LQUERV = -1 )
  5616. DOUBLE PRECISION ZERO, ONE
  5617. PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0 )
  5618. * ..
  5619. * .. Local Scalars ..
  5620. - LOGICAL ILASCL, ILBSCL, ILV, ILVL, ILVR, LQUERY
  5621. + LOGICAL ILASCL, ILBSCL, ILV, ILVL, ILVR
  5622. CHARACTER CHTEMP
  5623. INTEGER ICOLS, IERR, IHI, IJOBVL, IJOBVR, ILEFT, ILO,
  5624. $ IN, IRIGHT, IROWS, ITAU, IWRK, JC, JR, MAXWRK,
  5625. @@ -157,8 +159,9 @@
  5626. LOGICAL LDUMMA( 1 )
  5627. * ..
  5628. * .. External Subroutines ..
  5629. - EXTERNAL DGEQRF, DGGBAK, DGGBAL, DGGHRD, DHGEQZ, DLACPY,
  5630. - $ DLASCL, DLASET, DORGQR, DORMQR, DTGEVC, XERBLA
  5631. + EXTERNAL DGEQRF, DGGBAK, DGGBAL, DGGHRD, DHGEQZ, DLABAD,
  5632. + $ DLACPY, DLASCL, DLASET, DORGQR, DORMQR, DTGEVC,
  5633. + $ XERBLA
  5634. * ..
  5635. * .. External Functions ..
  5636. LOGICAL LSAME
  5637. @@ -199,7 +202,6 @@
  5638. * Test the input arguments
  5639. *
  5640. INFO = 0
  5641. - LQUERY = ( LWORK.EQ.-1 )
  5642. IF( IJOBVL.LE.0 ) THEN
  5643. INFO = -1
  5644. ELSE IF( IJOBVR.LE.0 ) THEN
  5645. @@ -225,24 +227,22 @@
  5646. * computed assuming ILO = 1 and IHI = N, the worst case.)
  5647. *
  5648. MINWRK = 1
  5649. - IF( INFO.EQ.0 .AND. ( LWORK.GE.1 .OR. LQUERY ) ) THEN
  5650. + IF( INFO.EQ.0 ) THEN
  5651. MAXWRK = 7*N + N*ILAENV( 1, 'DGEQRF', ' ', N, 1, N, 0 )
  5652. MINWRK = MAX( 1, 8*N )
  5653. WORK( 1 ) = MAXWRK
  5654. + IF( LWORK.LT.MINWRK .AND. LWORK.NE.LQUERV )
  5655. + $ INFO = -16
  5656. END IF
  5657. *
  5658. - IF( LWORK.LT.MINWRK .AND. .NOT.LQUERY )
  5659. - $ INFO = -16
  5660. +* Quick returns
  5661. *
  5662. IF( INFO.NE.0 ) THEN
  5663. CALL XERBLA( 'DGGEV ', -INFO )
  5664. RETURN
  5665. - ELSE IF( LQUERY ) THEN
  5666. - RETURN
  5667. END IF
  5668. -*
  5669. -* Quick return if possible
  5670. -*
  5671. + IF( LWORK.EQ.LQUERV )
  5672. + $ RETURN
  5673. IF( N.EQ.0 )
  5674. $ RETURN
  5675. *
  5676. diff -uNr LAPACK.orig/SRC/dggevx.f LAPACK/SRC/dggevx.f
  5677. --- LAPACK.orig/SRC/dggevx.f Thu Nov 4 14:26:18 1999
  5678. +++ LAPACK/SRC/dggevx.f Fri May 25 16:11:31 2001
  5679. @@ -7,6 +7,7 @@
  5680. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  5681. * Courant Institute, Argonne National Lab, and Rice University
  5682. * June 30, 1999
  5683. +* 8-15-00: Improve consistency of WS calculations (eca)
  5684. *
  5685. * .. Scalar Arguments ..
  5686. CHARACTER BALANC, JOBVL, JOBVR, SENSE
  5687. @@ -212,10 +213,9 @@
  5688. * If SENSE = 'E', LWORK >= 12*N.
  5689. * If SENSE = 'V' or 'B', LWORK >= 2*N*N+12*N+16.
  5690. *
  5691. -* If LWORK = -1, then a workspace query is assumed; the routine
  5692. -* only calculates the optimal size of the WORK array, returns
  5693. -* this value as the first entry of the WORK array, and no error
  5694. -* message related to LWORK is issued by XERBLA.
  5695. +* If LWORK = -1, a workspace query is assumed. The optimal
  5696. +* size for the WORK array is calculated and stored in WORK(1),
  5697. +* and no other work except argument checking is performed.
  5698. *
  5699. * IWORK (workspace) INTEGER array, dimension (N+6)
  5700. * If SENSE = 'E', IWORK is not referenced.
  5701. @@ -262,12 +262,14 @@
  5702. * =====================================================================
  5703. *
  5704. * .. Parameters ..
  5705. + INTEGER LQUERV
  5706. + PARAMETER ( LQUERV = -1 )
  5707. DOUBLE PRECISION ZERO, ONE
  5708. PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0 )
  5709. * ..
  5710. * .. Local Scalars ..
  5711. - LOGICAL ILASCL, ILBSCL, ILV, ILVL, ILVR, LQUERY, PAIR,
  5712. - $ WANTSB, WANTSE, WANTSN, WANTSV
  5713. + LOGICAL ILASCL, ILBSCL, ILV, ILVL, ILVR, PAIR, WANTSB,
  5714. + $ WANTSE, WANTSN, WANTSV
  5715. CHARACTER CHTEMP
  5716. INTEGER I, ICOLS, IERR, IJOBVL, IJOBVR, IN, IROWS,
  5717. $ ITAU, IWRK, IWRK1, J, JC, JR, M, MAXWRK,
  5718. @@ -279,9 +281,9 @@
  5719. LOGICAL LDUMMA( 1 )
  5720. * ..
  5721. * .. External Subroutines ..
  5722. - EXTERNAL DGEQRF, DGGBAK, DGGBAL, DGGHRD, DHGEQZ, DLACPY,
  5723. - $ DLASCL, DLASET, DORGQR, DORMQR, DTGEVC, DTGSNA,
  5724. - $ XERBLA
  5725. + EXTERNAL DGEQRF, DGGBAK, DGGBAL, DGGHRD, DHGEQZ, DLABAD,
  5726. + $ DLACPY, DLASCL, DLASET, DORGQR, DORMQR, DTGEVC,
  5727. + $ DTGSNA, XERBLA
  5728. * ..
  5729. * .. External Functions ..
  5730. LOGICAL LSAME
  5731. @@ -327,7 +329,6 @@
  5732. * Test the input arguments
  5733. *
  5734. INFO = 0
  5735. - LQUERY = ( LWORK.EQ.-1 )
  5736. IF( .NOT.( LSAME( BALANC, 'N' ) .OR. LSAME( BALANC,
  5737. $ 'S' ) .OR. LSAME( BALANC, 'P' ) .OR. LSAME( BALANC, 'B' ) ) )
  5738. $ THEN
  5739. @@ -360,7 +361,7 @@
  5740. * computed assuming ILO = 1 and IHI = N, the worst case.)
  5741. *
  5742. MINWRK = 1
  5743. - IF( INFO.EQ.0 .AND. ( LWORK.GE.1 .OR. LQUERY ) ) THEN
  5744. + IF( INFO.EQ.0 ) THEN
  5745. MAXWRK = 5*N + N*ILAENV( 1, 'DGEQRF', ' ', N, 1, N, 0 )
  5746. MINWRK = MAX( 1, 6*N )
  5747. IF( WANTSE ) THEN
  5748. @@ -370,24 +371,20 @@
  5749. MAXWRK = MAX( MAXWRK, 2*N*N+12*N+16 )
  5750. END IF
  5751. WORK( 1 ) = MAXWRK
  5752. + IF( LWORK.LT.MINWRK .AND. LWORK.NE.LQUERV )
  5753. + $ INFO = -26
  5754. END IF
  5755. *
  5756. - IF( LWORK.LT.MINWRK .AND. .NOT.LQUERY ) THEN
  5757. - INFO = -26
  5758. - END IF
  5759. +* Quick returns
  5760. *
  5761. IF( INFO.NE.0 ) THEN
  5762. CALL XERBLA( 'DGGEVX', -INFO )
  5763. RETURN
  5764. - ELSE IF( LQUERY ) THEN
  5765. - RETURN
  5766. END IF
  5767. -*
  5768. -* Quick return if possible
  5769. -*
  5770. + IF( LWORK.EQ.LQUERV )
  5771. + $ RETURN
  5772. IF( N.EQ.0 )
  5773. $ RETURN
  5774. -*
  5775. *
  5776. * Get machine constants
  5777. *
  5778. diff -uNr LAPACK.orig/SRC/dgghrd.f LAPACK/SRC/dgghrd.f
  5779. --- LAPACK.orig/SRC/dgghrd.f Thu Nov 4 14:25:43 1999
  5780. +++ LAPACK/SRC/dgghrd.f Fri May 25 16:11:50 2001
  5781. @@ -4,7 +4,7 @@
  5782. * -- LAPACK routine (version 3.0) --
  5783. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  5784. * Courant Institute, Argonne National Lab, and Rice University
  5785. -* September 30, 1994
  5786. +* April 26, 2001
  5787. *
  5788. * .. Scalar Arguments ..
  5789. CHARACTER COMPQ, COMPZ
  5790. @@ -20,16 +20,32 @@
  5791. *
  5792. * DGGHRD reduces a pair of real matrices (A,B) to generalized upper
  5793. * Hessenberg form using orthogonal transformations, where A is a
  5794. -* general matrix and B is upper triangular: Q' * A * Z = H and
  5795. -* Q' * B * Z = T, where H is upper Hessenberg, T is upper triangular,
  5796. -* and Q and Z are orthogonal, and ' means transpose.
  5797. +* general matrix and B is upper triangular. The form of the
  5798. +* generalized eigenvalue problem is
  5799. +* A*x = lambda*B*x,
  5800. +* and B is typically made upper triangular by computing its QR
  5801. +* factorization and moving the orthogonal matrix Q to the left side
  5802. +* of the equation.
  5803. +*
  5804. +* This subroutine simultaneously reduces A to a Hessenberg matrix H:
  5805. +* Q**T*A*Z = H
  5806. +* and transforms B to another upper triangular matrix T:
  5807. +* Q**T*B*Z = T
  5808. +* in order to reduce the problem to its standard form
  5809. +* H*y = lambda*T*y
  5810. +* where y = Z**T*x.
  5811. *
  5812. * The orthogonal matrices Q and Z are determined as products of Givens
  5813. * rotations. They may either be formed explicitly, or they may be
  5814. * postmultiplied into input matrices Q1 and Z1, so that
  5815. *
  5816. -* Q1 * A * Z1' = (Q1*Q) * H * (Z1*Z)'
  5817. -* Q1 * B * Z1' = (Q1*Q) * T * (Z1*Z)'
  5818. +* Q1 * A * Z1**T = (Q1*Q) * H * (Z1*Z)**T
  5819. +*
  5820. +* Q1 * B * Z1**T = (Q1*Q) * T * (Z1*Z)**T
  5821. +*
  5822. +* If Q1 is the orthogonal matrix from the QR factorization of B in the
  5823. +* original equation A*x = lambda*B*x, then DGGHRD reduces the original
  5824. +* problem to generalized Hessenberg form.
  5825. *
  5826. * Arguments
  5827. * =========
  5828. @@ -53,10 +69,11 @@
  5829. *
  5830. * ILO (input) INTEGER
  5831. * IHI (input) INTEGER
  5832. -* It is assumed that A is already upper triangular in rows and
  5833. -* columns 1:ILO-1 and IHI+1:N. ILO and IHI are normally set
  5834. -* by a previous call to DGGBAL; otherwise they should be set
  5835. -* to 1 and N respectively.
  5836. +* ILO and IHI mark the rows and columns of A which are to be
  5837. +* reduced. It is assumed that A is already upper triangular
  5838. +* in rows and columns 1:ILO-1 and IHI+1:N. ILO and IHI are
  5839. +* normally set by a previous call to SGGBAL; otherwise they
  5840. +* should be set to 1 and N respectively.
  5841. * 1 <= ILO <= IHI <= N, if N > 0; ILO=1 and IHI=0, if N=0.
  5842. *
  5843. * A (input/output) DOUBLE PRECISION array, dimension (LDA, N)
  5844. @@ -70,33 +87,28 @@
  5845. *
  5846. * B (input/output) DOUBLE PRECISION array, dimension (LDB, N)
  5847. * On entry, the N-by-N upper triangular matrix B.
  5848. -* On exit, the upper triangular matrix T = Q' B Z. The
  5849. +* On exit, the upper triangular matrix T = Q**T B Z. The
  5850. * elements below the diagonal are set to zero.
  5851. *
  5852. * LDB (input) INTEGER
  5853. * The leading dimension of the array B. LDB >= max(1,N).
  5854. *
  5855. * Q (input/output) DOUBLE PRECISION array, dimension (LDQ, N)
  5856. -* If COMPQ='N': Q is not referenced.
  5857. -* If COMPQ='I': on entry, Q need not be set, and on exit it
  5858. -* contains the orthogonal matrix Q, where Q'
  5859. -* is the product of the Givens transformations
  5860. -* which are applied to A and B on the left.
  5861. -* If COMPQ='V': on entry, Q must contain an orthogonal matrix
  5862. -* Q1, and on exit this is overwritten by Q1*Q.
  5863. +* On entry, if COMPQ = 'V', the orthogonal matrix Q1,
  5864. +* typically from the QR factorization of B.
  5865. +* On exit, if COMPQ='I', the orthogonal matrix Q, and if
  5866. +* COMPQ = 'V', the product Q1*Q.
  5867. +* Not referenced if COMPQ='N'.
  5868. *
  5869. * LDQ (input) INTEGER
  5870. * The leading dimension of the array Q.
  5871. * LDQ >= N if COMPQ='V' or 'I'; LDQ >= 1 otherwise.
  5872. *
  5873. * Z (input/output) DOUBLE PRECISION array, dimension (LDZ, N)
  5874. -* If COMPZ='N': Z is not referenced.
  5875. -* If COMPZ='I': on entry, Z need not be set, and on exit it
  5876. -* contains the orthogonal matrix Z, which is
  5877. -* the product of the Givens transformations
  5878. -* which are applied to A and B on the right.
  5879. -* If COMPZ='V': on entry, Z must contain an orthogonal matrix
  5880. -* Z1, and on exit this is overwritten by Z1*Z.
  5881. +* On entry, if COMPZ = 'V', the orthogonal matrix Z1.
  5882. +* On exit, if COMPZ='I', the orthogonal matrix Z, and if
  5883. +* COMPZ = 'V', the product Z1*Z.
  5884. +* Not referenced if COMPZ='N'.
  5885. *
  5886. * LDZ (input) INTEGER
  5887. * The leading dimension of the array Z.
  5888. diff -uNr LAPACK.orig/SRC/dhgeqz.f LAPACK/SRC/dhgeqz.f
  5889. --- LAPACK.orig/SRC/dhgeqz.f Thu Nov 4 14:24:45 1999
  5890. +++ LAPACK/SRC/dhgeqz.f Fri May 25 16:12:11 2001
  5891. @@ -1,56 +1,75 @@
  5892. - SUBROUTINE DHGEQZ( JOB, COMPQ, COMPZ, N, ILO, IHI, A, LDA, B, LDB,
  5893. + SUBROUTINE DHGEQZ( JOB, COMPQ, COMPZ, N, ILO, IHI, H, LDH, T, LDT,
  5894. $ ALPHAR, ALPHAI, BETA, Q, LDQ, Z, LDZ, WORK,
  5895. $ LWORK, INFO )
  5896. *
  5897. * -- LAPACK routine (version 3.0) --
  5898. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  5899. * Courant Institute, Argonne National Lab, and Rice University
  5900. -* June 30, 1999
  5901. +* May 3, 2001
  5902. *
  5903. * .. Scalar Arguments ..
  5904. CHARACTER COMPQ, COMPZ, JOB
  5905. - INTEGER IHI, ILO, INFO, LDA, LDB, LDQ, LDZ, LWORK, N
  5906. + INTEGER IHI, ILO, INFO, LDH, LDQ, LDT, LDZ, LWORK, N
  5907. * ..
  5908. * .. Array Arguments ..
  5909. - DOUBLE PRECISION A( LDA, * ), ALPHAI( * ), ALPHAR( * ),
  5910. - $ B( LDB, * ), BETA( * ), Q( LDQ, * ), WORK( * ),
  5911. - $ Z( LDZ, * )
  5912. + DOUBLE PRECISION ALPHAI( * ), ALPHAR( * ), BETA( * ),
  5913. + $ H( LDH, * ), Q( LDQ, * ), T( LDT, * ),
  5914. + $ WORK( * ), Z( LDZ, * )
  5915. * ..
  5916. *
  5917. * Purpose
  5918. * =======
  5919. *
  5920. -* DHGEQZ implements a single-/double-shift version of the QZ method for
  5921. -* finding the generalized eigenvalues
  5922. -*
  5923. -* w(j)=(ALPHAR(j) + i*ALPHAI(j))/BETAR(j) of the equation
  5924. -*
  5925. -* det( A - w(i) B ) = 0
  5926. -*
  5927. -* In addition, the pair A,B may be reduced to generalized Schur form:
  5928. -* B is upper triangular, and A is block upper triangular, where the
  5929. -* diagonal blocks are either 1-by-1 or 2-by-2, the 2-by-2 blocks having
  5930. -* complex generalized eigenvalues (see the description of the argument
  5931. -* JOB.)
  5932. -*
  5933. -* If JOB='S', then the pair (A,B) is simultaneously reduced to Schur
  5934. -* form by applying one orthogonal tranformation (usually called Q) on
  5935. -* the left and another (usually called Z) on the right. The 2-by-2
  5936. -* upper-triangular diagonal blocks of B corresponding to 2-by-2 blocks
  5937. -* of A will be reduced to positive diagonal matrices. (I.e.,
  5938. -* if A(j+1,j) is non-zero, then B(j+1,j)=B(j,j+1)=0 and B(j,j) and
  5939. -* B(j+1,j+1) will be positive.)
  5940. -*
  5941. -* If JOB='E', then at each iteration, the same transformations
  5942. -* are computed, but they are only applied to those parts of A and B
  5943. -* which are needed to compute ALPHAR, ALPHAI, and BETAR.
  5944. -*
  5945. -* If JOB='S' and COMPQ and COMPZ are 'V' or 'I', then the orthogonal
  5946. -* transformations used to reduce (A,B) are accumulated into the arrays
  5947. -* Q and Z s.t.:
  5948. -*
  5949. -* Q(in) A(in) Z(in)* = Q(out) A(out) Z(out)*
  5950. -* Q(in) B(in) Z(in)* = Q(out) B(out) Z(out)*
  5951. +* DHGEQZ computes the eigenvalues of a real matrix pair (H,T),
  5952. +* where H is an upper Hessenberg matrix and T is upper triangular,
  5953. +* using the double-shift QZ method.
  5954. +* Matrix pairs of this type are produced by the reduction to
  5955. +* generalized upper Hessenberg form of a real matrix pair (A,B):
  5956. +*
  5957. +* A = Q1*H*Z1**T, B = Q1*T*Z1**T,
  5958. +*
  5959. +* as computed by DGGHRD.
  5960. +*
  5961. +* If JOB='S', then the Hessenberg-triangular pair (H,T) is
  5962. +* also reduced to generalized Schur form,
  5963. +*
  5964. +* H = Q*S*Z**T, T = Q*P*Z**T,
  5965. +*
  5966. +* where Q and Z are orthogonal matrices, P is an upper triangular
  5967. +* matrix, and S is a quasi-triangular matrix with 1-by-1 and 2-by-2
  5968. +* diagonal blocks.
  5969. +*
  5970. +* The 1-by-1 blocks correspond to real eigenvalues of the matrix pair
  5971. +* (H,T) and the 2-by-2 blocks correspond to complex conjugate pairs of
  5972. +* eigenvalues.
  5973. +*
  5974. +* Additionally, the 2-by-2 upper triangular diagonal blocks of P
  5975. +* corresponding to 2-by-2 blocks of S are reduced to positive diagonal
  5976. +* form, i.e., if S(j+1,j) is non-zero, then P(j+1,j) = P(j,j+1) = 0,
  5977. +* P(j,j) > 0, and P(j+1,j+1) > 0.
  5978. +*
  5979. +* Optionally, the orthogonal matrix Q from the generalized Schur
  5980. +* factorization may be postmultiplied into an input matrix Q1, and the
  5981. +* orthogonal matrix Z may be postmultiplied into an input matrix Z1.
  5982. +* If Q1 and Z1 are the orthogonal matrices from DGGHRD that reduced
  5983. +* the matrix pair (A,B) to generalized upper Hessenberg form, then the
  5984. +* output matrices Q1*Q and Z1*Z are the orthogonal factors from the
  5985. +* generalized Schur factorization of (A,B):
  5986. +*
  5987. +* A = (Q1*Q)*S*(Z1*Z)**T, B = (Q1*Q)*P*(Z1*Z)**T.
  5988. +*
  5989. +* To avoid overflow, eigenvalues of the matrix pair (H,T) (equivalently,
  5990. +* of (A,B)) are computed as a pair of values (alpha,beta), where alpha is
  5991. +* complex and beta real.
  5992. +* If beta is nonzero, lambda = alpha / beta is an eigenvalue of the
  5993. +* generalized nonsymmetric eigenvalue problem (GNEP)
  5994. +* A*x = lambda*B*x
  5995. +* and if alpha is nonzero, mu = beta / alpha is an eigenvalue of the
  5996. +* alternate form of the GNEP
  5997. +* mu*A*y = B*y.
  5998. +* Real eigenvalues can be read directly from the generalized Schur
  5999. +* form:
  6000. +* alpha = S(i,i), beta = P(i,i).
  6001. *
  6002. * Ref: C.B. Moler & G.W. Stewart, "An Algorithm for Generalized Matrix
  6003. * Eigenvalue Problems", SIAM J. Numer. Anal., 10(1973),
  6004. @@ -60,114 +79,98 @@
  6005. * =========
  6006. *
  6007. * JOB (input) CHARACTER*1
  6008. -* = 'E': compute only ALPHAR, ALPHAI, and BETA. A and B will
  6009. -* not necessarily be put into generalized Schur form.
  6010. -* = 'S': put A and B into generalized Schur form, as well
  6011. -* as computing ALPHAR, ALPHAI, and BETA.
  6012. +* = 'E': Compute eigenvalues only;
  6013. +* = 'S': Compute eigenvalues and the Schur form.
  6014. *
  6015. * COMPQ (input) CHARACTER*1
  6016. -* = 'N': do not modify Q.
  6017. -* = 'V': multiply the array Q on the right by the transpose of
  6018. -* the orthogonal tranformation that is applied to the
  6019. -* left side of A and B to reduce them to Schur form.
  6020. -* = 'I': like COMPQ='V', except that Q will be initialized to
  6021. -* the identity first.
  6022. +* = 'N': Left Schur vectors (Q) are not computed;
  6023. +* = 'I': Q is initialized to the unit matrix and the matrix Q
  6024. +* of left Schur vectors of (H,T) is returned;
  6025. +* = 'V': Q must contain an orthogonal matrix Q1 on entry and
  6026. +* the product Q1*Q is returned.
  6027. *
  6028. * COMPZ (input) CHARACTER*1
  6029. -* = 'N': do not modify Z.
  6030. -* = 'V': multiply the array Z on the right by the orthogonal
  6031. -* tranformation that is applied to the right side of
  6032. -* A and B to reduce them to Schur form.
  6033. -* = 'I': like COMPZ='V', except that Z will be initialized to
  6034. -* the identity first.
  6035. +* = 'N': Right Schur vectors (Z) are not computed;
  6036. +* = 'I': Z is initialized to the unit matrix and the matrix Z
  6037. +* of right Schur vectors of (H,T) is returned;
  6038. +* = 'V': Z must contain an orthogonal matrix Z1 on entry and
  6039. +* the product Z1*Z is returned.
  6040. *
  6041. * N (input) INTEGER
  6042. -* The order of the matrices A, B, Q, and Z. N >= 0.
  6043. +* The order of the matrices H, T, Q, and Z. N >= 0.
  6044. *
  6045. * ILO (input) INTEGER
  6046. * IHI (input) INTEGER
  6047. -* It is assumed that A is already upper triangular in rows and
  6048. -* columns 1:ILO-1 and IHI+1:N.
  6049. -* 1 <= ILO <= IHI <= N, if N > 0; ILO=1 and IHI=0, if N=0.
  6050. -*
  6051. -* A (input/output) DOUBLE PRECISION array, dimension (LDA, N)
  6052. -* On entry, the N-by-N upper Hessenberg matrix A. Elements
  6053. -* below the subdiagonal must be zero.
  6054. -* If JOB='S', then on exit A and B will have been
  6055. -* simultaneously reduced to generalized Schur form.
  6056. -* If JOB='E', then on exit A will have been destroyed.
  6057. -* The diagonal blocks will be correct, but the off-diagonal
  6058. -* portion will be meaningless.
  6059. -*
  6060. -* LDA (input) INTEGER
  6061. -* The leading dimension of the array A. LDA >= max( 1, N ).
  6062. -*
  6063. -* B (input/output) DOUBLE PRECISION array, dimension (LDB, N)
  6064. -* On entry, the N-by-N upper triangular matrix B. Elements
  6065. -* below the diagonal must be zero. 2-by-2 blocks in B
  6066. -* corresponding to 2-by-2 blocks in A will be reduced to
  6067. -* positive diagonal form. (I.e., if A(j+1,j) is non-zero,
  6068. -* then B(j+1,j)=B(j,j+1)=0 and B(j,j) and B(j+1,j+1) will be
  6069. -* positive.)
  6070. -* If JOB='S', then on exit A and B will have been
  6071. -* simultaneously reduced to Schur form.
  6072. -* If JOB='E', then on exit B will have been destroyed.
  6073. -* Elements corresponding to diagonal blocks of A will be
  6074. -* correct, but the off-diagonal portion will be meaningless.
  6075. +* ILO and IHI mark the rows and columns of H which are in
  6076. +* Hessenberg form. It is assumed that A is already upper
  6077. +* triangular in rows and columns 1:ILO-1 and IHI+1:N.
  6078. +* If N > 0, 1 <= ILO <= IHI <= N; if N = 0, ILO=1 and IHI=0.
  6079. +*
  6080. +* H (input/output) DOUBLE PRECISION array, dimension (LDH, N)
  6081. +* On entry, the N-by-N upper Hessenberg matrix H.
  6082. +* On exit, if JOB = 'S', H contains the upper quasi-triangular
  6083. +* matrix S from the generalized Schur factorization;
  6084. +* 2-by-2 diagonal blocks (corresponding to complex conjugate
  6085. +* pairs of eigenvalues) are returned in standard form, with
  6086. +* H(i,i) = H(i+1,i+1) and H(i+1,i)*H(i,i+1) < 0.
  6087. +* If JOB = 'E', the diagonal blocks of H match those of S, but
  6088. +* the rest of H is unspecified.
  6089. +*
  6090. +* LDH (input) INTEGER
  6091. +* The leading dimension of the array H. LDH >= max( 1, N ).
  6092. +*
  6093. +* T (input/output) DOUBLE PRECISION array, dimension (LDT, N)
  6094. +* On entry, the N-by-N upper triangular matrix T.
  6095. +* On exit, if JOB = 'S', T contains the upper triangular
  6096. +* matrix P from the generalized Schur factorization;
  6097. +* 2-by-2 diagonal blocks of P corresponding to 2-by-2 blocks of S
  6098. +* are reduced to positive diagonal form, i.e., if H(j+1,j) is
  6099. +* non-zero, then T(j+1,j) = T(j,j+1) = 0, T(j,j) > 0, and
  6100. +* T(j+1,j+1) > 0.
  6101. +* If JOB = 'E', the diagonal blocks of T match those of P, but
  6102. +* the rest of T is unspecified.
  6103. *
  6104. -* LDB (input) INTEGER
  6105. -* The leading dimension of the array B. LDB >= max( 1, N ).
  6106. +* LDT (input) INTEGER
  6107. +* The leading dimension of the array T. LDT >= max( 1, N ).
  6108. *
  6109. * ALPHAR (output) DOUBLE PRECISION array, dimension (N)
  6110. -* ALPHAR(1:N) will be set to real parts of the diagonal
  6111. -* elements of A that would result from reducing A and B to
  6112. -* Schur form and then further reducing them both to triangular
  6113. -* form using unitary transformations s.t. the diagonal of B
  6114. -* was non-negative real. Thus, if A(j,j) is in a 1-by-1 block
  6115. -* (i.e., A(j+1,j)=A(j,j+1)=0), then ALPHAR(j)=A(j,j).
  6116. -* Note that the (real or complex) values
  6117. -* (ALPHAR(j) + i*ALPHAI(j))/BETA(j), j=1,...,N, are the
  6118. -* generalized eigenvalues of the matrix pencil A - wB.
  6119. +* The real parts of each scalar alpha defining an eigenvalue
  6120. +* of GNEP.
  6121. *
  6122. * ALPHAI (output) DOUBLE PRECISION array, dimension (N)
  6123. -* ALPHAI(1:N) will be set to imaginary parts of the diagonal
  6124. -* elements of A that would result from reducing A and B to
  6125. -* Schur form and then further reducing them both to triangular
  6126. -* form using unitary transformations s.t. the diagonal of B
  6127. -* was non-negative real. Thus, if A(j,j) is in a 1-by-1 block
  6128. -* (i.e., A(j+1,j)=A(j,j+1)=0), then ALPHAR(j)=0.
  6129. -* Note that the (real or complex) values
  6130. -* (ALPHAR(j) + i*ALPHAI(j))/BETA(j), j=1,...,N, are the
  6131. -* generalized eigenvalues of the matrix pencil A - wB.
  6132. +* The imaginary parts of each scalar alpha defining an
  6133. +* eigenvalue of GNEP.
  6134. +* If ALPHAI(j) is zero, then the j-th eigenvalue is real; if
  6135. +* positive, then the j-th and (j+1)-st eigenvalues are a
  6136. +* complex conjugate pair, with ALPHAI(j+1) = -ALPHAI(j).
  6137. *
  6138. * BETA (output) DOUBLE PRECISION array, dimension (N)
  6139. -* BETA(1:N) will be set to the (real) diagonal elements of B
  6140. -* that would result from reducing A and B to Schur form and
  6141. -* then further reducing them both to triangular form using
  6142. -* unitary transformations s.t. the diagonal of B was
  6143. -* non-negative real. Thus, if A(j,j) is in a 1-by-1 block
  6144. -* (i.e., A(j+1,j)=A(j,j+1)=0), then BETA(j)=B(j,j).
  6145. -* Note that the (real or complex) values
  6146. -* (ALPHAR(j) + i*ALPHAI(j))/BETA(j), j=1,...,N, are the
  6147. -* generalized eigenvalues of the matrix pencil A - wB.
  6148. -* (Note that BETA(1:N) will always be non-negative, and no
  6149. -* BETAI is necessary.)
  6150. +* The scalars beta that define the eigenvalues of GNEP.
  6151. +* Together, the quantities alpha = (ALPHAR(j),ALPHAI(j)) and
  6152. +* beta = BETA(j) represent the j-th eigenvalue of the matrix
  6153. +* pair (A,B), in one of the forms lambda = alpha/beta or
  6154. +* mu = beta/alpha. Since either lambda or mu may overflow,
  6155. +* they should not, in general, be computed.
  6156. *
  6157. * Q (input/output) DOUBLE PRECISION array, dimension (LDQ, N)
  6158. -* If COMPQ='N', then Q will not be referenced.
  6159. -* If COMPQ='V' or 'I', then the transpose of the orthogonal
  6160. -* transformations which are applied to A and B on the left
  6161. -* will be applied to the array Q on the right.
  6162. +* On entry, if COMPZ = 'V', the orthogonal matrix Q1 used in
  6163. +* the reduction of (A,B) to generalized Hessenberg form.
  6164. +* On exit, if COMPZ = 'I', the orthogonal matrix of left Schur
  6165. +* vectors of (H,T), and if COMPZ = 'V', the orthogonal matrix
  6166. +* of left Schur vectors of (A,B).
  6167. +* Not referenced if COMPZ = 'N'.
  6168. *
  6169. * LDQ (input) INTEGER
  6170. * The leading dimension of the array Q. LDQ >= 1.
  6171. * If COMPQ='V' or 'I', then LDQ >= N.
  6172. *
  6173. * Z (input/output) DOUBLE PRECISION array, dimension (LDZ, N)
  6174. -* If COMPZ='N', then Z will not be referenced.
  6175. -* If COMPZ='V' or 'I', then the orthogonal transformations
  6176. -* which are applied to A and B on the right will be applied
  6177. -* to the array Z on the right.
  6178. +* On entry, if COMPZ = 'V', the orthogonal matrix Z1 used in
  6179. +* the reduction of (A,B) to generalized Hessenberg form.
  6180. +* On exit, if COMPZ = 'I', the orthogonal matrix of
  6181. +* right Schur vectors of (H,T), and if COMPZ = 'V', the
  6182. +* orthogonal matrix of right Schur vectors of (A,B).
  6183. +* Not referenced if COMPZ = 'N'.
  6184. *
  6185. * LDZ (input) INTEGER
  6186. * The leading dimension of the array Z. LDZ >= 1.
  6187. @@ -187,13 +190,12 @@
  6188. * INFO (output) INTEGER
  6189. * = 0: successful exit
  6190. * < 0: if INFO = -i, the i-th argument had an illegal value
  6191. -* = 1,...,N: the QZ iteration did not converge. (A,B) is not
  6192. +* = 1,...,N: the QZ iteration did not converge. (H,T) is not
  6193. * in Schur form, but ALPHAR(i), ALPHAI(i), and
  6194. * BETA(i), i=INFO+1,...,N should be correct.
  6195. -* = N+1,...,2*N: the shift calculation failed. (A,B) is not
  6196. +* = N+1,...,2*N: the shift calculation failed. (H,T) is not
  6197. * in Schur form, but ALPHAR(i), ALPHAI(i), and
  6198. * BETA(i), i=INFO-N+1,...,N should be correct.
  6199. -* > 2*N: various "impossible" errors.
  6200. *
  6201. * Further Details
  6202. * ===============
  6203. @@ -225,7 +227,7 @@
  6204. $ B1R, B22, B2A, B2I, B2R, BN, BNORM, BSCALE,
  6205. $ BTOL, C, C11I, C11R, C12, C21, C22I, C22R, CL,
  6206. $ CQ, CR, CZ, ESHIFT, S, S1, S1INV, S2, SAFMAX,
  6207. - $ SAFMIN, SCALE, SL, SQI, SQR, SR, SZI, SZR, T,
  6208. + $ SAFMIN, SCALE, SL, SQI, SQR, SR, SZI, SZR, T1,
  6209. $ TAU, TEMP, TEMP2, TEMPI, TEMPR, U1, U12, U12L,
  6210. $ U2, ULP, VS, W11, W12, W21, W22, WABS, WI, WR,
  6211. $ WR2
  6212. @@ -302,9 +304,9 @@
  6213. INFO = -5
  6214. ELSE IF( IHI.GT.N .OR. IHI.LT.ILO-1 ) THEN
  6215. INFO = -6
  6216. - ELSE IF( LDA.LT.N ) THEN
  6217. + ELSE IF( LDH.LT.N ) THEN
  6218. INFO = -8
  6219. - ELSE IF( LDB.LT.N ) THEN
  6220. + ELSE IF( LDT.LT.N ) THEN
  6221. INFO = -10
  6222. ELSE IF( LDQ.LT.1 .OR. ( ILQ .AND. LDQ.LT.N ) ) THEN
  6223. INFO = -15
  6224. @@ -340,8 +342,8 @@
  6225. SAFMIN = DLAMCH( 'S' )
  6226. SAFMAX = ONE / SAFMIN
  6227. ULP = DLAMCH( 'E' )*DLAMCH( 'B' )
  6228. - ANORM = DLANHS( 'F', IN, A( ILO, ILO ), LDA, WORK )
  6229. - BNORM = DLANHS( 'F', IN, B( ILO, ILO ), LDB, WORK )
  6230. + ANORM = DLANHS( 'F', IN, H( ILO, ILO ), LDH, WORK )
  6231. + BNORM = DLANHS( 'F', IN, T( ILO, ILO ), LDT, WORK )
  6232. ATOL = MAX( SAFMIN, ULP*ANORM )
  6233. BTOL = MAX( SAFMIN, ULP*BNORM )
  6234. ASCALE = ONE / MAX( SAFMIN, ANORM )
  6235. @@ -350,15 +352,15 @@
  6236. * Set Eigenvalues IHI+1:N
  6237. *
  6238. DO 30 J = IHI + 1, N
  6239. - IF( B( J, J ).LT.ZERO ) THEN
  6240. + IF( T( J, J ).LT.ZERO ) THEN
  6241. IF( ILSCHR ) THEN
  6242. DO 10 JR = 1, J
  6243. - A( JR, J ) = -A( JR, J )
  6244. - B( JR, J ) = -B( JR, J )
  6245. + H( JR, J ) = -H( JR, J )
  6246. + T( JR, J ) = -T( JR, J )
  6247. 10 CONTINUE
  6248. ELSE
  6249. - A( J, J ) = -A( J, J )
  6250. - B( J, J ) = -B( J, J )
  6251. + H( J, J ) = -H( J, J )
  6252. + T( J, J ) = -T( J, J )
  6253. END IF
  6254. IF( ILZ ) THEN
  6255. DO 20 JR = 1, N
  6256. @@ -366,9 +368,9 @@
  6257. 20 CONTINUE
  6258. END IF
  6259. END IF
  6260. - ALPHAR( J ) = A( J, J )
  6261. + ALPHAR( J ) = H( J, J )
  6262. ALPHAI( J ) = ZERO
  6263. - BETA( J ) = B( J, J )
  6264. + BETA( J ) = T( J, J )
  6265. 30 CONTINUE
  6266. *
  6267. * If IHI < ILO, skip QZ steps
  6268. @@ -408,8 +410,8 @@
  6269. * Split the matrix if possible.
  6270. *
  6271. * Two tests:
  6272. -* 1: A(j,j-1)=0 or j=ILO
  6273. -* 2: B(j,j)=0
  6274. +* 1: H(j,j-1)=0 or j=ILO
  6275. +* 2: T(j,j)=0
  6276. *
  6277. IF( ILAST.EQ.ILO ) THEN
  6278. *
  6279. @@ -417,14 +419,14 @@
  6280. *
  6281. GO TO 80
  6282. ELSE
  6283. - IF( ABS( A( ILAST, ILAST-1 ) ).LE.ATOL ) THEN
  6284. - A( ILAST, ILAST-1 ) = ZERO
  6285. + IF( ABS( H( ILAST, ILAST-1 ) ).LE.ATOL ) THEN
  6286. + H( ILAST, ILAST-1 ) = ZERO
  6287. GO TO 80
  6288. END IF
  6289. END IF
  6290. *
  6291. - IF( ABS( B( ILAST, ILAST ) ).LE.BTOL ) THEN
  6292. - B( ILAST, ILAST ) = ZERO
  6293. + IF( ABS( T( ILAST, ILAST ) ).LE.BTOL ) THEN
  6294. + T( ILAST, ILAST ) = ZERO
  6295. GO TO 70
  6296. END IF
  6297. *
  6298. @@ -432,36 +434,36 @@
  6299. *
  6300. DO 60 J = ILAST - 1, ILO, -1
  6301. *
  6302. -* Test 1: for A(j,j-1)=0 or j=ILO
  6303. +* Test 1: for H(j,j-1)=0 or j=ILO
  6304. *
  6305. IF( J.EQ.ILO ) THEN
  6306. ILAZRO = .TRUE.
  6307. ELSE
  6308. - IF( ABS( A( J, J-1 ) ).LE.ATOL ) THEN
  6309. - A( J, J-1 ) = ZERO
  6310. + IF( ABS( H( J, J-1 ) ).LE.ATOL ) THEN
  6311. + H( J, J-1 ) = ZERO
  6312. ILAZRO = .TRUE.
  6313. ELSE
  6314. ILAZRO = .FALSE.
  6315. END IF
  6316. END IF
  6317. *
  6318. -* Test 2: for B(j,j)=0
  6319. +* Test 2: for T(j,j)=0
  6320. *
  6321. - IF( ABS( B( J, J ) ).LT.BTOL ) THEN
  6322. - B( J, J ) = ZERO
  6323. + IF( ABS( T( J, J ) ).LT.BTOL ) THEN
  6324. + T( J, J ) = ZERO
  6325. *
  6326. * Test 1a: Check for 2 consecutive small subdiagonals in A
  6327. *
  6328. ILAZR2 = .FALSE.
  6329. IF( .NOT.ILAZRO ) THEN
  6330. - TEMP = ABS( A( J, J-1 ) )
  6331. - TEMP2 = ABS( A( J, J ) )
  6332. + TEMP = ABS( H( J, J-1 ) )
  6333. + TEMP2 = ABS( H( J, J ) )
  6334. TEMPR = MAX( TEMP, TEMP2 )
  6335. IF( TEMPR.LT.ONE .AND. TEMPR.NE.ZERO ) THEN
  6336. TEMP = TEMP / TEMPR
  6337. TEMP2 = TEMP2 / TEMPR
  6338. END IF
  6339. - IF( TEMP*( ASCALE*ABS( A( J+1, J ) ) ).LE.TEMP2*
  6340. + IF( TEMP*( ASCALE*ABS( H( J+1, J ) ) ).LE.TEMP2*
  6341. $ ( ASCALE*ATOL ) )ILAZR2 = .TRUE.
  6342. END IF
  6343. *
  6344. @@ -473,21 +475,21 @@
  6345. *
  6346. IF( ILAZRO .OR. ILAZR2 ) THEN
  6347. DO 40 JCH = J, ILAST - 1
  6348. - TEMP = A( JCH, JCH )
  6349. - CALL DLARTG( TEMP, A( JCH+1, JCH ), C, S,
  6350. - $ A( JCH, JCH ) )
  6351. - A( JCH+1, JCH ) = ZERO
  6352. - CALL DROT( ILASTM-JCH, A( JCH, JCH+1 ), LDA,
  6353. - $ A( JCH+1, JCH+1 ), LDA, C, S )
  6354. - CALL DROT( ILASTM-JCH, B( JCH, JCH+1 ), LDB,
  6355. - $ B( JCH+1, JCH+1 ), LDB, C, S )
  6356. + TEMP = H( JCH, JCH )
  6357. + CALL DLARTG( TEMP, H( JCH+1, JCH ), C, S,
  6358. + $ H( JCH, JCH ) )
  6359. + H( JCH+1, JCH ) = ZERO
  6360. + CALL DROT( ILASTM-JCH, H( JCH, JCH+1 ), LDH,
  6361. + $ H( JCH+1, JCH+1 ), LDH, C, S )
  6362. + CALL DROT( ILASTM-JCH, T( JCH, JCH+1 ), LDT,
  6363. + $ T( JCH+1, JCH+1 ), LDT, C, S )
  6364. IF( ILQ )
  6365. $ CALL DROT( N, Q( 1, JCH ), 1, Q( 1, JCH+1 ), 1,
  6366. $ C, S )
  6367. IF( ILAZR2 )
  6368. - $ A( JCH, JCH-1 ) = A( JCH, JCH-1 )*C
  6369. + $ H( JCH, JCH-1 ) = H( JCH, JCH-1 )*C
  6370. ILAZR2 = .FALSE.
  6371. - IF( ABS( B( JCH+1, JCH+1 ) ).GE.BTOL ) THEN
  6372. + IF( ABS( T( JCH+1, JCH+1 ) ).GE.BTOL ) THEN
  6373. IF( JCH+1.GE.ILAST ) THEN
  6374. GO TO 80
  6375. ELSE
  6376. @@ -495,35 +497,35 @@
  6377. GO TO 110
  6378. END IF
  6379. END IF
  6380. - B( JCH+1, JCH+1 ) = ZERO
  6381. + T( JCH+1, JCH+1 ) = ZERO
  6382. 40 CONTINUE
  6383. GO TO 70
  6384. ELSE
  6385. *
  6386. -* Only test 2 passed -- chase the zero to B(ILAST,ILAST)
  6387. -* Then process as in the case B(ILAST,ILAST)=0
  6388. +* Only test 2 passed -- chase the zero to T(ILAST,ILAST)
  6389. +* Then process as in the case T(ILAST,ILAST)=0
  6390. *
  6391. DO 50 JCH = J, ILAST - 1
  6392. - TEMP = B( JCH, JCH+1 )
  6393. - CALL DLARTG( TEMP, B( JCH+1, JCH+1 ), C, S,
  6394. - $ B( JCH, JCH+1 ) )
  6395. - B( JCH+1, JCH+1 ) = ZERO
  6396. + TEMP = T( JCH, JCH+1 )
  6397. + CALL DLARTG( TEMP, T( JCH+1, JCH+1 ), C, S,
  6398. + $ T( JCH, JCH+1 ) )
  6399. + T( JCH+1, JCH+1 ) = ZERO
  6400. IF( JCH.LT.ILASTM-1 )
  6401. - $ CALL DROT( ILASTM-JCH-1, B( JCH, JCH+2 ), LDB,
  6402. - $ B( JCH+1, JCH+2 ), LDB, C, S )
  6403. - CALL DROT( ILASTM-JCH+2, A( JCH, JCH-1 ), LDA,
  6404. - $ A( JCH+1, JCH-1 ), LDA, C, S )
  6405. + $ CALL DROT( ILASTM-JCH-1, T( JCH, JCH+2 ), LDT,
  6406. + $ T( JCH+1, JCH+2 ), LDT, C, S )
  6407. + CALL DROT( ILASTM-JCH+2, H( JCH, JCH-1 ), LDH,
  6408. + $ H( JCH+1, JCH-1 ), LDH, C, S )
  6409. IF( ILQ )
  6410. $ CALL DROT( N, Q( 1, JCH ), 1, Q( 1, JCH+1 ), 1,
  6411. $ C, S )
  6412. - TEMP = A( JCH+1, JCH )
  6413. - CALL DLARTG( TEMP, A( JCH+1, JCH-1 ), C, S,
  6414. - $ A( JCH+1, JCH ) )
  6415. - A( JCH+1, JCH-1 ) = ZERO
  6416. - CALL DROT( JCH+1-IFRSTM, A( IFRSTM, JCH ), 1,
  6417. - $ A( IFRSTM, JCH-1 ), 1, C, S )
  6418. - CALL DROT( JCH-IFRSTM, B( IFRSTM, JCH ), 1,
  6419. - $ B( IFRSTM, JCH-1 ), 1, C, S )
  6420. + TEMP = H( JCH+1, JCH )
  6421. + CALL DLARTG( TEMP, H( JCH+1, JCH-1 ), C, S,
  6422. + $ H( JCH+1, JCH ) )
  6423. + H( JCH+1, JCH-1 ) = ZERO
  6424. + CALL DROT( JCH+1-IFRSTM, H( IFRSTM, JCH ), 1,
  6425. + $ H( IFRSTM, JCH-1 ), 1, C, S )
  6426. + CALL DROT( JCH-IFRSTM, T( IFRSTM, JCH ), 1,
  6427. + $ T( IFRSTM, JCH-1 ), 1, C, S )
  6428. IF( ILZ )
  6429. $ CALL DROT( N, Z( 1, JCH ), 1, Z( 1, JCH-1 ), 1,
  6430. $ C, S )
  6431. @@ -547,34 +549,34 @@
  6432. INFO = N + 1
  6433. GO TO 420
  6434. *
  6435. -* B(ILAST,ILAST)=0 -- clear A(ILAST,ILAST-1) to split off a
  6436. +* T(ILAST,ILAST)=0 -- clear H(ILAST,ILAST-1) to split off a
  6437. * 1x1 block.
  6438. *
  6439. 70 CONTINUE
  6440. - TEMP = A( ILAST, ILAST )
  6441. - CALL DLARTG( TEMP, A( ILAST, ILAST-1 ), C, S,
  6442. - $ A( ILAST, ILAST ) )
  6443. - A( ILAST, ILAST-1 ) = ZERO
  6444. - CALL DROT( ILAST-IFRSTM, A( IFRSTM, ILAST ), 1,
  6445. - $ A( IFRSTM, ILAST-1 ), 1, C, S )
  6446. - CALL DROT( ILAST-IFRSTM, B( IFRSTM, ILAST ), 1,
  6447. - $ B( IFRSTM, ILAST-1 ), 1, C, S )
  6448. + TEMP = H( ILAST, ILAST )
  6449. + CALL DLARTG( TEMP, H( ILAST, ILAST-1 ), C, S,
  6450. + $ H( ILAST, ILAST ) )
  6451. + H( ILAST, ILAST-1 ) = ZERO
  6452. + CALL DROT( ILAST-IFRSTM, H( IFRSTM, ILAST ), 1,
  6453. + $ H( IFRSTM, ILAST-1 ), 1, C, S )
  6454. + CALL DROT( ILAST-IFRSTM, T( IFRSTM, ILAST ), 1,
  6455. + $ T( IFRSTM, ILAST-1 ), 1, C, S )
  6456. IF( ILZ )
  6457. $ CALL DROT( N, Z( 1, ILAST ), 1, Z( 1, ILAST-1 ), 1, C, S )
  6458. *
  6459. -* A(ILAST,ILAST-1)=0 -- Standardize B, set ALPHAR, ALPHAI,
  6460. +* H(ILAST,ILAST-1)=0 -- Standardize B, set ALPHAR, ALPHAI,
  6461. * and BETA
  6462. *
  6463. 80 CONTINUE
  6464. - IF( B( ILAST, ILAST ).LT.ZERO ) THEN
  6465. + IF( T( ILAST, ILAST ).LT.ZERO ) THEN
  6466. IF( ILSCHR ) THEN
  6467. DO 90 J = IFRSTM, ILAST
  6468. - A( J, ILAST ) = -A( J, ILAST )
  6469. - B( J, ILAST ) = -B( J, ILAST )
  6470. + H( J, ILAST ) = -H( J, ILAST )
  6471. + T( J, ILAST ) = -T( J, ILAST )
  6472. 90 CONTINUE
  6473. ELSE
  6474. - A( ILAST, ILAST ) = -A( ILAST, ILAST )
  6475. - B( ILAST, ILAST ) = -B( ILAST, ILAST )
  6476. + H( ILAST, ILAST ) = -H( ILAST, ILAST )
  6477. + T( ILAST, ILAST ) = -T( ILAST, ILAST )
  6478. END IF
  6479. IF( ILZ ) THEN
  6480. DO 100 J = 1, N
  6481. @@ -582,9 +584,9 @@
  6482. 100 CONTINUE
  6483. END IF
  6484. END IF
  6485. - ALPHAR( ILAST ) = A( ILAST, ILAST )
  6486. + ALPHAR( ILAST ) = H( ILAST, ILAST )
  6487. ALPHAI( ILAST ) = ZERO
  6488. - BETA( ILAST ) = B( ILAST, ILAST )
  6489. + BETA( ILAST ) = T( ILAST, ILAST )
  6490. *
  6491. * Go to next block -- exit if finished.
  6492. *
  6493. @@ -617,7 +619,7 @@
  6494. * Compute single shifts.
  6495. *
  6496. * At this point, IFIRST < ILAST, and the diagonal elements of
  6497. -* B(IFIRST:ILAST,IFIRST,ILAST) are larger than BTOL (in
  6498. +* T(IFIRST:ILAST,IFIRST,ILAST) are larger than BTOL (in
  6499. * magnitude)
  6500. *
  6501. IF( ( IITER / 10 )*10.EQ.IITER ) THEN
  6502. @@ -625,10 +627,10 @@
  6503. * Exceptional shift. Chosen for no particularly good reason.
  6504. * (Single shift only.)
  6505. *
  6506. - IF( ( DBLE( MAXIT )*SAFMIN )*ABS( A( ILAST-1, ILAST ) ).LT.
  6507. - $ ABS( B( ILAST-1, ILAST-1 ) ) ) THEN
  6508. - ESHIFT = ESHIFT + A( ILAST-1, ILAST ) /
  6509. - $ B( ILAST-1, ILAST-1 )
  6510. + IF( ( DBLE( MAXIT )*SAFMIN )*ABS( H( ILAST-1, ILAST ) ).LT.
  6511. + $ ABS( T( ILAST-1, ILAST-1 ) ) ) THEN
  6512. + ESHIFT = ESHIFT + H( ILAST-1, ILAST ) /
  6513. + $ T( ILAST-1, ILAST-1 )
  6514. ELSE
  6515. ESHIFT = ESHIFT + ONE / ( SAFMIN*DBLE( MAXIT ) )
  6516. END IF
  6517. @@ -641,8 +643,8 @@
  6518. * bottom-right 2x2 block of A and B. The first eigenvalue
  6519. * returned by DLAG2 is the Wilkinson shift (AEP p.512),
  6520. *
  6521. - CALL DLAG2( A( ILAST-1, ILAST-1 ), LDA,
  6522. - $ B( ILAST-1, ILAST-1 ), LDB, SAFMIN*SAFETY, S1,
  6523. + CALL DLAG2( H( ILAST-1, ILAST-1 ), LDH,
  6524. + $ T( ILAST-1, ILAST-1 ), LDT, SAFMIN*SAFETY, S1,
  6525. $ S2, WR, WR2, WI )
  6526. *
  6527. TEMP = MAX( S1, SAFMIN*MAX( ONE, ABS( WR ), ABS( WI ) ) )
  6528. @@ -669,14 +671,14 @@
  6529. *
  6530. DO 120 J = ILAST - 1, IFIRST + 1, -1
  6531. ISTART = J
  6532. - TEMP = ABS( S1*A( J, J-1 ) )
  6533. - TEMP2 = ABS( S1*A( J, J )-WR*B( J, J ) )
  6534. + TEMP = ABS( S1*H( J, J-1 ) )
  6535. + TEMP2 = ABS( S1*H( J, J )-WR*T( J, J ) )
  6536. TEMPR = MAX( TEMP, TEMP2 )
  6537. IF( TEMPR.LT.ONE .AND. TEMPR.NE.ZERO ) THEN
  6538. TEMP = TEMP / TEMPR
  6539. TEMP2 = TEMP2 / TEMPR
  6540. END IF
  6541. - IF( ABS( ( ASCALE*A( J+1, J ) )*TEMP ).LE.( ASCALE*ATOL )*
  6542. + IF( ABS( ( ASCALE*H( J+1, J ) )*TEMP ).LE.( ASCALE*ATOL )*
  6543. $ TEMP2 )GO TO 130
  6544. 120 CONTINUE
  6545. *
  6546. @@ -687,26 +689,26 @@
  6547. *
  6548. * Initial Q
  6549. *
  6550. - TEMP = S1*A( ISTART, ISTART ) - WR*B( ISTART, ISTART )
  6551. - TEMP2 = S1*A( ISTART+1, ISTART )
  6552. + TEMP = S1*H( ISTART, ISTART ) - WR*T( ISTART, ISTART )
  6553. + TEMP2 = S1*H( ISTART+1, ISTART )
  6554. CALL DLARTG( TEMP, TEMP2, C, S, TEMPR )
  6555. *
  6556. * Sweep
  6557. *
  6558. DO 190 J = ISTART, ILAST - 1
  6559. IF( J.GT.ISTART ) THEN
  6560. - TEMP = A( J, J-1 )
  6561. - CALL DLARTG( TEMP, A( J+1, J-1 ), C, S, A( J, J-1 ) )
  6562. - A( J+1, J-1 ) = ZERO
  6563. + TEMP = H( J, J-1 )
  6564. + CALL DLARTG( TEMP, H( J+1, J-1 ), C, S, H( J, J-1 ) )
  6565. + H( J+1, J-1 ) = ZERO
  6566. END IF
  6567. *
  6568. DO 140 JC = J, ILASTM
  6569. - TEMP = C*A( J, JC ) + S*A( J+1, JC )
  6570. - A( J+1, JC ) = -S*A( J, JC ) + C*A( J+1, JC )
  6571. - A( J, JC ) = TEMP
  6572. - TEMP2 = C*B( J, JC ) + S*B( J+1, JC )
  6573. - B( J+1, JC ) = -S*B( J, JC ) + C*B( J+1, JC )
  6574. - B( J, JC ) = TEMP2
  6575. + TEMP = C*H( J, JC ) + S*H( J+1, JC )
  6576. + H( J+1, JC ) = -S*H( J, JC ) + C*H( J+1, JC )
  6577. + H( J, JC ) = TEMP
  6578. + TEMP2 = C*T( J, JC ) + S*T( J+1, JC )
  6579. + T( J+1, JC ) = -S*T( J, JC ) + C*T( J+1, JC )
  6580. + T( J, JC ) = TEMP2
  6581. 140 CONTINUE
  6582. IF( ILQ ) THEN
  6583. DO 150 JR = 1, N
  6584. @@ -716,19 +718,19 @@
  6585. 150 CONTINUE
  6586. END IF
  6587. *
  6588. - TEMP = B( J+1, J+1 )
  6589. - CALL DLARTG( TEMP, B( J+1, J ), C, S, B( J+1, J+1 ) )
  6590. - B( J+1, J ) = ZERO
  6591. + TEMP = T( J+1, J+1 )
  6592. + CALL DLARTG( TEMP, T( J+1, J ), C, S, T( J+1, J+1 ) )
  6593. + T( J+1, J ) = ZERO
  6594. *
  6595. DO 160 JR = IFRSTM, MIN( J+2, ILAST )
  6596. - TEMP = C*A( JR, J+1 ) + S*A( JR, J )
  6597. - A( JR, J ) = -S*A( JR, J+1 ) + C*A( JR, J )
  6598. - A( JR, J+1 ) = TEMP
  6599. + TEMP = C*H( JR, J+1 ) + S*H( JR, J )
  6600. + H( JR, J ) = -S*H( JR, J+1 ) + C*H( JR, J )
  6601. + H( JR, J+1 ) = TEMP
  6602. 160 CONTINUE
  6603. DO 170 JR = IFRSTM, J
  6604. - TEMP = C*B( JR, J+1 ) + S*B( JR, J )
  6605. - B( JR, J ) = -S*B( JR, J+1 ) + C*B( JR, J )
  6606. - B( JR, J+1 ) = TEMP
  6607. + TEMP = C*T( JR, J+1 ) + S*T( JR, J )
  6608. + T( JR, J ) = -S*T( JR, J+1 ) + C*T( JR, J )
  6609. + T( JR, J+1 ) = TEMP
  6610. 170 CONTINUE
  6611. IF( ILZ ) THEN
  6612. DO 180 JR = 1, N
  6613. @@ -759,8 +761,8 @@
  6614. * B = ( ) with B11 non-negative.
  6615. * ( 0 B22 )
  6616. *
  6617. - CALL DLASV2( B( ILAST-1, ILAST-1 ), B( ILAST-1, ILAST ),
  6618. - $ B( ILAST, ILAST ), B22, B11, SR, CR, SL, CL )
  6619. + CALL DLASV2( T( ILAST-1, ILAST-1 ), T( ILAST-1, ILAST ),
  6620. + $ T( ILAST, ILAST ), B22, B11, SR, CR, SL, CL )
  6621. *
  6622. IF( B11.LT.ZERO ) THEN
  6623. CR = -CR
  6624. @@ -769,17 +771,17 @@
  6625. B22 = -B22
  6626. END IF
  6627. *
  6628. - CALL DROT( ILASTM+1-IFIRST, A( ILAST-1, ILAST-1 ), LDA,
  6629. - $ A( ILAST, ILAST-1 ), LDA, CL, SL )
  6630. - CALL DROT( ILAST+1-IFRSTM, A( IFRSTM, ILAST-1 ), 1,
  6631. - $ A( IFRSTM, ILAST ), 1, CR, SR )
  6632. + CALL DROT( ILASTM+1-IFIRST, H( ILAST-1, ILAST-1 ), LDH,
  6633. + $ H( ILAST, ILAST-1 ), LDH, CL, SL )
  6634. + CALL DROT( ILAST+1-IFRSTM, H( IFRSTM, ILAST-1 ), 1,
  6635. + $ H( IFRSTM, ILAST ), 1, CR, SR )
  6636. *
  6637. IF( ILAST.LT.ILASTM )
  6638. - $ CALL DROT( ILASTM-ILAST, B( ILAST-1, ILAST+1 ), LDB,
  6639. - $ B( ILAST, ILAST+1 ), LDA, CL, SL )
  6640. + $ CALL DROT( ILASTM-ILAST, T( ILAST-1, ILAST+1 ), LDT,
  6641. + $ T( ILAST, ILAST+1 ), LDH, CL, SL )
  6642. IF( IFRSTM.LT.ILAST-1 )
  6643. - $ CALL DROT( IFIRST-IFRSTM, B( IFRSTM, ILAST-1 ), 1,
  6644. - $ B( IFRSTM, ILAST ), 1, CR, SR )
  6645. + $ CALL DROT( IFIRST-IFRSTM, T( IFRSTM, ILAST-1 ), 1,
  6646. + $ T( IFRSTM, ILAST ), 1, CR, SR )
  6647. *
  6648. IF( ILQ )
  6649. $ CALL DROT( N, Q( 1, ILAST-1 ), 1, Q( 1, ILAST ), 1, CL,
  6650. @@ -788,17 +790,17 @@
  6651. $ CALL DROT( N, Z( 1, ILAST-1 ), 1, Z( 1, ILAST ), 1, CR,
  6652. $ SR )
  6653. *
  6654. - B( ILAST-1, ILAST-1 ) = B11
  6655. - B( ILAST-1, ILAST ) = ZERO
  6656. - B( ILAST, ILAST-1 ) = ZERO
  6657. - B( ILAST, ILAST ) = B22
  6658. + T( ILAST-1, ILAST-1 ) = B11
  6659. + T( ILAST-1, ILAST ) = ZERO
  6660. + T( ILAST, ILAST-1 ) = ZERO
  6661. + T( ILAST, ILAST ) = B22
  6662. *
  6663. * If B22 is negative, negate column ILAST
  6664. *
  6665. IF( B22.LT.ZERO ) THEN
  6666. DO 210 J = IFRSTM, ILAST
  6667. - A( J, ILAST ) = -A( J, ILAST )
  6668. - B( J, ILAST ) = -B( J, ILAST )
  6669. + H( J, ILAST ) = -H( J, ILAST )
  6670. + T( J, ILAST ) = -T( J, ILAST )
  6671. 210 CONTINUE
  6672. *
  6673. IF( ILZ ) THEN
  6674. @@ -812,8 +814,8 @@
  6675. *
  6676. * Recompute shift
  6677. *
  6678. - CALL DLAG2( A( ILAST-1, ILAST-1 ), LDA,
  6679. - $ B( ILAST-1, ILAST-1 ), LDB, SAFMIN*SAFETY, S1,
  6680. + CALL DLAG2( H( ILAST-1, ILAST-1 ), LDH,
  6681. + $ T( ILAST-1, ILAST-1 ), LDT, SAFMIN*SAFETY, S1,
  6682. $ TEMP, WR, TEMP2, WI )
  6683. *
  6684. * If standardization has perturbed the shift onto real line,
  6685. @@ -825,10 +827,10 @@
  6686. *
  6687. * Do EISPACK (QZVAL) computation of alpha and beta
  6688. *
  6689. - A11 = A( ILAST-1, ILAST-1 )
  6690. - A21 = A( ILAST, ILAST-1 )
  6691. - A12 = A( ILAST-1, ILAST )
  6692. - A22 = A( ILAST, ILAST )
  6693. + A11 = H( ILAST-1, ILAST-1 )
  6694. + A21 = H( ILAST, ILAST-1 )
  6695. + A12 = H( ILAST-1, ILAST )
  6696. + A22 = H( ILAST, ILAST )
  6697. *
  6698. * Compute complex Givens rotation on right
  6699. * (Assume some element of C = (sA - wB) > unfl )
  6700. @@ -845,10 +847,10 @@
  6701. *
  6702. IF( ABS( C11R )+ABS( C11I )+ABS( C12 ).GT.ABS( C21 )+
  6703. $ ABS( C22R )+ABS( C22I ) ) THEN
  6704. - T = DLAPY3( C12, C11R, C11I )
  6705. - CZ = C12 / T
  6706. - SZR = -C11R / T
  6707. - SZI = -C11I / T
  6708. + T1 = DLAPY3( C12, C11R, C11I )
  6709. + CZ = C12 / T1
  6710. + SZR = -C11R / T1
  6711. + SZI = -C11I / T1
  6712. ELSE
  6713. CZ = DLAPY2( C22R, C22I )
  6714. IF( CZ.LE.SAFMIN ) THEN
  6715. @@ -858,10 +860,10 @@
  6716. ELSE
  6717. TEMPR = C22R / CZ
  6718. TEMPI = C22I / CZ
  6719. - T = DLAPY2( CZ, C21 )
  6720. - CZ = CZ / T
  6721. - SZR = -C21*TEMPR / T
  6722. - SZI = C21*TEMPI / T
  6723. + T1 = DLAPY2( CZ, C21 )
  6724. + CZ = CZ / T1
  6725. + SZR = -C21*TEMPR / T1
  6726. + SZI = C21*TEMPI / T1
  6727. END IF
  6728. END IF
  6729. *
  6730. @@ -895,10 +897,10 @@
  6731. SQI = TEMPI*A2R - TEMPR*A2I
  6732. END IF
  6733. END IF
  6734. - T = DLAPY3( CQ, SQR, SQI )
  6735. - CQ = CQ / T
  6736. - SQR = SQR / T
  6737. - SQI = SQI / T
  6738. + T1 = DLAPY3( CQ, SQR, SQI )
  6739. + CQ = CQ / T1
  6740. + SQR = SQR / T1
  6741. + SQI = SQI / T1
  6742. *
  6743. * Compute diagonal elements of QBZ
  6744. *
  6745. @@ -950,26 +952,26 @@
  6746. *
  6747. * We assume that the block is at least 3x3
  6748. *
  6749. - AD11 = ( ASCALE*A( ILAST-1, ILAST-1 ) ) /
  6750. - $ ( BSCALE*B( ILAST-1, ILAST-1 ) )
  6751. - AD21 = ( ASCALE*A( ILAST, ILAST-1 ) ) /
  6752. - $ ( BSCALE*B( ILAST-1, ILAST-1 ) )
  6753. - AD12 = ( ASCALE*A( ILAST-1, ILAST ) ) /
  6754. - $ ( BSCALE*B( ILAST, ILAST ) )
  6755. - AD22 = ( ASCALE*A( ILAST, ILAST ) ) /
  6756. - $ ( BSCALE*B( ILAST, ILAST ) )
  6757. - U12 = B( ILAST-1, ILAST ) / B( ILAST, ILAST )
  6758. - AD11L = ( ASCALE*A( IFIRST, IFIRST ) ) /
  6759. - $ ( BSCALE*B( IFIRST, IFIRST ) )
  6760. - AD21L = ( ASCALE*A( IFIRST+1, IFIRST ) ) /
  6761. - $ ( BSCALE*B( IFIRST, IFIRST ) )
  6762. - AD12L = ( ASCALE*A( IFIRST, IFIRST+1 ) ) /
  6763. - $ ( BSCALE*B( IFIRST+1, IFIRST+1 ) )
  6764. - AD22L = ( ASCALE*A( IFIRST+1, IFIRST+1 ) ) /
  6765. - $ ( BSCALE*B( IFIRST+1, IFIRST+1 ) )
  6766. - AD32L = ( ASCALE*A( IFIRST+2, IFIRST+1 ) ) /
  6767. - $ ( BSCALE*B( IFIRST+1, IFIRST+1 ) )
  6768. - U12L = B( IFIRST, IFIRST+1 ) / B( IFIRST+1, IFIRST+1 )
  6769. + AD11 = ( ASCALE*H( ILAST-1, ILAST-1 ) ) /
  6770. + $ ( BSCALE*T( ILAST-1, ILAST-1 ) )
  6771. + AD21 = ( ASCALE*H( ILAST, ILAST-1 ) ) /
  6772. + $ ( BSCALE*T( ILAST-1, ILAST-1 ) )
  6773. + AD12 = ( ASCALE*H( ILAST-1, ILAST ) ) /
  6774. + $ ( BSCALE*T( ILAST, ILAST ) )
  6775. + AD22 = ( ASCALE*H( ILAST, ILAST ) ) /
  6776. + $ ( BSCALE*T( ILAST, ILAST ) )
  6777. + U12 = T( ILAST-1, ILAST ) / T( ILAST, ILAST )
  6778. + AD11L = ( ASCALE*H( IFIRST, IFIRST ) ) /
  6779. + $ ( BSCALE*T( IFIRST, IFIRST ) )
  6780. + AD21L = ( ASCALE*H( IFIRST+1, IFIRST ) ) /
  6781. + $ ( BSCALE*T( IFIRST, IFIRST ) )
  6782. + AD12L = ( ASCALE*H( IFIRST, IFIRST+1 ) ) /
  6783. + $ ( BSCALE*T( IFIRST+1, IFIRST+1 ) )
  6784. + AD22L = ( ASCALE*H( IFIRST+1, IFIRST+1 ) ) /
  6785. + $ ( BSCALE*T( IFIRST+1, IFIRST+1 ) )
  6786. + AD32L = ( ASCALE*H( IFIRST+2, IFIRST+1 ) ) /
  6787. + $ ( BSCALE*T( IFIRST+1, IFIRST+1 ) )
  6788. + U12L = T( IFIRST, IFIRST+1 ) / T( IFIRST+1, IFIRST+1 )
  6789. *
  6790. V( 1 ) = ( AD11-AD11L )*( AD22-AD11L ) - AD12*AD21 +
  6791. $ AD21*U12*AD11L + ( AD12L-AD11L*U12L )*AD21L
  6792. @@ -991,27 +993,27 @@
  6793. * Zero (j-1)st column of A
  6794. *
  6795. IF( J.GT.ISTART ) THEN
  6796. - V( 1 ) = A( J, J-1 )
  6797. - V( 2 ) = A( J+1, J-1 )
  6798. - V( 3 ) = A( J+2, J-1 )
  6799. + V( 1 ) = H( J, J-1 )
  6800. + V( 2 ) = H( J+1, J-1 )
  6801. + V( 3 ) = H( J+2, J-1 )
  6802. *
  6803. - CALL DLARFG( 3, A( J, J-1 ), V( 2 ), 1, TAU )
  6804. + CALL DLARFG( 3, H( J, J-1 ), V( 2 ), 1, TAU )
  6805. V( 1 ) = ONE
  6806. - A( J+1, J-1 ) = ZERO
  6807. - A( J+2, J-1 ) = ZERO
  6808. + H( J+1, J-1 ) = ZERO
  6809. + H( J+2, J-1 ) = ZERO
  6810. END IF
  6811. *
  6812. DO 230 JC = J, ILASTM
  6813. - TEMP = TAU*( A( J, JC )+V( 2 )*A( J+1, JC )+V( 3 )*
  6814. - $ A( J+2, JC ) )
  6815. - A( J, JC ) = A( J, JC ) - TEMP
  6816. - A( J+1, JC ) = A( J+1, JC ) - TEMP*V( 2 )
  6817. - A( J+2, JC ) = A( J+2, JC ) - TEMP*V( 3 )
  6818. - TEMP2 = TAU*( B( J, JC )+V( 2 )*B( J+1, JC )+V( 3 )*
  6819. - $ B( J+2, JC ) )
  6820. - B( J, JC ) = B( J, JC ) - TEMP2
  6821. - B( J+1, JC ) = B( J+1, JC ) - TEMP2*V( 2 )
  6822. - B( J+2, JC ) = B( J+2, JC ) - TEMP2*V( 3 )
  6823. + TEMP = TAU*( H( J, JC )+V( 2 )*H( J+1, JC )+V( 3 )*
  6824. + $ H( J+2, JC ) )
  6825. + H( J, JC ) = H( J, JC ) - TEMP
  6826. + H( J+1, JC ) = H( J+1, JC ) - TEMP*V( 2 )
  6827. + H( J+2, JC ) = H( J+2, JC ) - TEMP*V( 3 )
  6828. + TEMP2 = TAU*( T( J, JC )+V( 2 )*T( J+1, JC )+V( 3 )*
  6829. + $ T( J+2, JC ) )
  6830. + T( J, JC ) = T( J, JC ) - TEMP2
  6831. + T( J+1, JC ) = T( J+1, JC ) - TEMP2*V( 2 )
  6832. + T( J+2, JC ) = T( J+2, JC ) - TEMP2*V( 3 )
  6833. 230 CONTINUE
  6834. IF( ILQ ) THEN
  6835. DO 240 JR = 1, N
  6836. @@ -1028,27 +1030,27 @@
  6837. * Swap rows to pivot
  6838. *
  6839. ILPIVT = .FALSE.
  6840. - TEMP = MAX( ABS( B( J+1, J+1 ) ), ABS( B( J+1, J+2 ) ) )
  6841. - TEMP2 = MAX( ABS( B( J+2, J+1 ) ), ABS( B( J+2, J+2 ) ) )
  6842. + TEMP = MAX( ABS( T( J+1, J+1 ) ), ABS( T( J+1, J+2 ) ) )
  6843. + TEMP2 = MAX( ABS( T( J+2, J+1 ) ), ABS( T( J+2, J+2 ) ) )
  6844. IF( MAX( TEMP, TEMP2 ).LT.SAFMIN ) THEN
  6845. SCALE = ZERO
  6846. U1 = ONE
  6847. U2 = ZERO
  6848. GO TO 250
  6849. ELSE IF( TEMP.GE.TEMP2 ) THEN
  6850. - W11 = B( J+1, J+1 )
  6851. - W21 = B( J+2, J+1 )
  6852. - W12 = B( J+1, J+2 )
  6853. - W22 = B( J+2, J+2 )
  6854. - U1 = B( J+1, J )
  6855. - U2 = B( J+2, J )
  6856. + W11 = T( J+1, J+1 )
  6857. + W21 = T( J+2, J+1 )
  6858. + W12 = T( J+1, J+2 )
  6859. + W22 = T( J+2, J+2 )
  6860. + U1 = T( J+1, J )
  6861. + U2 = T( J+2, J )
  6862. ELSE
  6863. - W21 = B( J+1, J+1 )
  6864. - W11 = B( J+2, J+1 )
  6865. - W22 = B( J+1, J+2 )
  6866. - W12 = B( J+2, J+2 )
  6867. - U2 = B( J+1, J )
  6868. - U1 = B( J+2, J )
  6869. + W21 = T( J+1, J+1 )
  6870. + W11 = T( J+2, J+1 )
  6871. + W22 = T( J+1, J+2 )
  6872. + W12 = T( J+2, J+2 )
  6873. + U2 = T( J+1, J )
  6874. + U1 = T( J+2, J )
  6875. END IF
  6876. *
  6877. * Swap columns if nec.
  6878. @@ -1098,9 +1100,9 @@
  6879. *
  6880. * Compute Householder Vector
  6881. *
  6882. - T = SQRT( SCALE**2+U1**2+U2**2 )
  6883. - TAU = ONE + SCALE / T
  6884. - VS = -ONE / ( SCALE+T )
  6885. + T1 = SQRT( SCALE**2+U1**2+U2**2 )
  6886. + TAU = ONE + SCALE / T1
  6887. + VS = -ONE / ( SCALE+T1 )
  6888. V( 1 ) = ONE
  6889. V( 2 ) = VS*U1
  6890. V( 3 ) = VS*U2
  6891. @@ -1108,18 +1110,18 @@
  6892. * Apply transformations from the right.
  6893. *
  6894. DO 260 JR = IFRSTM, MIN( J+3, ILAST )
  6895. - TEMP = TAU*( A( JR, J )+V( 2 )*A( JR, J+1 )+V( 3 )*
  6896. - $ A( JR, J+2 ) )
  6897. - A( JR, J ) = A( JR, J ) - TEMP
  6898. - A( JR, J+1 ) = A( JR, J+1 ) - TEMP*V( 2 )
  6899. - A( JR, J+2 ) = A( JR, J+2 ) - TEMP*V( 3 )
  6900. + TEMP = TAU*( H( JR, J )+V( 2 )*H( JR, J+1 )+V( 3 )*
  6901. + $ H( JR, J+2 ) )
  6902. + H( JR, J ) = H( JR, J ) - TEMP
  6903. + H( JR, J+1 ) = H( JR, J+1 ) - TEMP*V( 2 )
  6904. + H( JR, J+2 ) = H( JR, J+2 ) - TEMP*V( 3 )
  6905. 260 CONTINUE
  6906. DO 270 JR = IFRSTM, J + 2
  6907. - TEMP = TAU*( B( JR, J )+V( 2 )*B( JR, J+1 )+V( 3 )*
  6908. - $ B( JR, J+2 ) )
  6909. - B( JR, J ) = B( JR, J ) - TEMP
  6910. - B( JR, J+1 ) = B( JR, J+1 ) - TEMP*V( 2 )
  6911. - B( JR, J+2 ) = B( JR, J+2 ) - TEMP*V( 3 )
  6912. + TEMP = TAU*( T( JR, J )+V( 2 )*T( JR, J+1 )+V( 3 )*
  6913. + $ T( JR, J+2 ) )
  6914. + T( JR, J ) = T( JR, J ) - TEMP
  6915. + T( JR, J+1 ) = T( JR, J+1 ) - TEMP*V( 2 )
  6916. + T( JR, J+2 ) = T( JR, J+2 ) - TEMP*V( 3 )
  6917. 270 CONTINUE
  6918. IF( ILZ ) THEN
  6919. DO 280 JR = 1, N
  6920. @@ -1130,8 +1132,8 @@
  6921. Z( JR, J+2 ) = Z( JR, J+2 ) - TEMP*V( 3 )
  6922. 280 CONTINUE
  6923. END IF
  6924. - B( J+1, J ) = ZERO
  6925. - B( J+2, J ) = ZERO
  6926. + T( J+1, J ) = ZERO
  6927. + T( J+2, J ) = ZERO
  6928. 290 CONTINUE
  6929. *
  6930. * Last elements: Use Givens rotations
  6931. @@ -1139,17 +1141,17 @@
  6932. * Rotations from the left
  6933. *
  6934. J = ILAST - 1
  6935. - TEMP = A( J, J-1 )
  6936. - CALL DLARTG( TEMP, A( J+1, J-1 ), C, S, A( J, J-1 ) )
  6937. - A( J+1, J-1 ) = ZERO
  6938. + TEMP = H( J, J-1 )
  6939. + CALL DLARTG( TEMP, H( J+1, J-1 ), C, S, H( J, J-1 ) )
  6940. + H( J+1, J-1 ) = ZERO
  6941. *
  6942. DO 300 JC = J, ILASTM
  6943. - TEMP = C*A( J, JC ) + S*A( J+1, JC )
  6944. - A( J+1, JC ) = -S*A( J, JC ) + C*A( J+1, JC )
  6945. - A( J, JC ) = TEMP
  6946. - TEMP2 = C*B( J, JC ) + S*B( J+1, JC )
  6947. - B( J+1, JC ) = -S*B( J, JC ) + C*B( J+1, JC )
  6948. - B( J, JC ) = TEMP2
  6949. + TEMP = C*H( J, JC ) + S*H( J+1, JC )
  6950. + H( J+1, JC ) = -S*H( J, JC ) + C*H( J+1, JC )
  6951. + H( J, JC ) = TEMP
  6952. + TEMP2 = C*T( J, JC ) + S*T( J+1, JC )
  6953. + T( J+1, JC ) = -S*T( J, JC ) + C*T( J+1, JC )
  6954. + T( J, JC ) = TEMP2
  6955. 300 CONTINUE
  6956. IF( ILQ ) THEN
  6957. DO 310 JR = 1, N
  6958. @@ -1161,19 +1163,19 @@
  6959. *
  6960. * Rotations from the right.
  6961. *
  6962. - TEMP = B( J+1, J+1 )
  6963. - CALL DLARTG( TEMP, B( J+1, J ), C, S, B( J+1, J+1 ) )
  6964. - B( J+1, J ) = ZERO
  6965. + TEMP = T( J+1, J+1 )
  6966. + CALL DLARTG( TEMP, T( J+1, J ), C, S, T( J+1, J+1 ) )
  6967. + T( J+1, J ) = ZERO
  6968. *
  6969. DO 320 JR = IFRSTM, ILAST
  6970. - TEMP = C*A( JR, J+1 ) + S*A( JR, J )
  6971. - A( JR, J ) = -S*A( JR, J+1 ) + C*A( JR, J )
  6972. - A( JR, J+1 ) = TEMP
  6973. + TEMP = C*H( JR, J+1 ) + S*H( JR, J )
  6974. + H( JR, J ) = -S*H( JR, J+1 ) + C*H( JR, J )
  6975. + H( JR, J+1 ) = TEMP
  6976. 320 CONTINUE
  6977. DO 330 JR = IFRSTM, ILAST - 1
  6978. - TEMP = C*B( JR, J+1 ) + S*B( JR, J )
  6979. - B( JR, J ) = -S*B( JR, J+1 ) + C*B( JR, J )
  6980. - B( JR, J+1 ) = TEMP
  6981. + TEMP = C*T( JR, J+1 ) + S*T( JR, J )
  6982. + T( JR, J ) = -S*T( JR, J+1 ) + C*T( JR, J )
  6983. + T( JR, J+1 ) = TEMP
  6984. 330 CONTINUE
  6985. IF( ILZ ) THEN
  6986. DO 340 JR = 1, N
  6987. @@ -1207,15 +1209,15 @@
  6988. * Set Eigenvalues 1:ILO-1
  6989. *
  6990. DO 410 J = 1, ILO - 1
  6991. - IF( B( J, J ).LT.ZERO ) THEN
  6992. + IF( T( J, J ).LT.ZERO ) THEN
  6993. IF( ILSCHR ) THEN
  6994. DO 390 JR = 1, J
  6995. - A( JR, J ) = -A( JR, J )
  6996. - B( JR, J ) = -B( JR, J )
  6997. + H( JR, J ) = -H( JR, J )
  6998. + T( JR, J ) = -T( JR, J )
  6999. 390 CONTINUE
  7000. ELSE
  7001. - A( J, J ) = -A( J, J )
  7002. - B( J, J ) = -B( J, J )
  7003. + H( J, J ) = -H( J, J )
  7004. + T( J, J ) = -T( J, J )
  7005. END IF
  7006. IF( ILZ ) THEN
  7007. DO 400 JR = 1, N
  7008. @@ -1223,9 +1225,9 @@
  7009. 400 CONTINUE
  7010. END IF
  7011. END IF
  7012. - ALPHAR( J ) = A( J, J )
  7013. + ALPHAR( J ) = H( J, J )
  7014. ALPHAI( J ) = ZERO
  7015. - BETA( J ) = B( J, J )
  7016. + BETA( J ) = T( J, J )
  7017. 410 CONTINUE
  7018. *
  7019. * Normal Termination
  7020. diff -uNr LAPACK.orig/SRC/dlasr.f LAPACK/SRC/dlasr.f
  7021. --- LAPACK.orig/SRC/dlasr.f Thu Nov 4 14:24:50 1999
  7022. +++ LAPACK/SRC/dlasr.f Fri May 25 16:12:31 2001
  7023. @@ -3,7 +3,7 @@
  7024. * -- LAPACK auxiliary routine (version 3.0) --
  7025. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  7026. * Courant Institute, Argonne National Lab, and Rice University
  7027. -* October 31, 1992
  7028. +* May 3, 2001
  7029. *
  7030. * .. Scalar Arguments ..
  7031. CHARACTER DIRECT, PIVOT, SIDE
  7032. @@ -16,44 +16,77 @@
  7033. * Purpose
  7034. * =======
  7035. *
  7036. -* DLASR performs the transformation
  7037. -*
  7038. -* A := P*A, when SIDE = 'L' or 'l' ( Left-hand side )
  7039. -*
  7040. -* A := A*P', when SIDE = 'R' or 'r' ( Right-hand side )
  7041. -*
  7042. -* where A is an m by n real matrix and P is an orthogonal matrix,
  7043. -* consisting of a sequence of plane rotations determined by the
  7044. -* parameters PIVOT and DIRECT as follows ( z = m when SIDE = 'L' or 'l'
  7045. -* and z = n when SIDE = 'R' or 'r' ):
  7046. -*
  7047. -* When DIRECT = 'F' or 'f' ( Forward sequence ) then
  7048. -*
  7049. -* P = P( z - 1 )*...*P( 2 )*P( 1 ),
  7050. -*
  7051. -* and when DIRECT = 'B' or 'b' ( Backward sequence ) then
  7052. -*
  7053. -* P = P( 1 )*P( 2 )*...*P( z - 1 ),
  7054. -*
  7055. -* where P( k ) is a plane rotation matrix for the following planes:
  7056. -*
  7057. -* when PIVOT = 'V' or 'v' ( Variable pivot ),
  7058. -* the plane ( k, k + 1 )
  7059. -*
  7060. -* when PIVOT = 'T' or 't' ( Top pivot ),
  7061. -* the plane ( 1, k + 1 )
  7062. -*
  7063. -* when PIVOT = 'B' or 'b' ( Bottom pivot ),
  7064. -* the plane ( k, z )
  7065. -*
  7066. -* c( k ) and s( k ) must contain the cosine and sine that define the
  7067. -* matrix P( k ). The two by two plane rotation part of the matrix
  7068. -* P( k ), R( k ), is assumed to be of the form
  7069. -*
  7070. -* R( k ) = ( c( k ) s( k ) ).
  7071. -* ( -s( k ) c( k ) )
  7072. -*
  7073. -* This version vectorises across rows of the array A when SIDE = 'L'.
  7074. +* DLASR applies a sequence of plane rotations to a real matrix A,
  7075. +* from either the left or the right.
  7076. +*
  7077. +* When SIDE = 'L', the transformation takes the form
  7078. +*
  7079. +* A := P*A
  7080. +*
  7081. +* and when SIDE = 'R', the transformation takes the form
  7082. +*
  7083. +* A := A*P**T
  7084. +*
  7085. +* where P is an orthogonal matrix consisting of a sequence of z plane
  7086. +* rotations, with z = M when SIDE = 'L' and z = N when SIDE = 'R',
  7087. +* and P**T is the transpose of P.
  7088. +*
  7089. +* When DIRECT = 'F' (Forward sequence), then
  7090. +*
  7091. +* P = P(z-1) * ... * P(2) * P(1)
  7092. +*
  7093. +* and when DIRECT = 'B' (Backward sequence), then
  7094. +*
  7095. +* P = P(1) * P(2) * ... * P(z-1)
  7096. +*
  7097. +* where P(k) is a plane rotation matrix defined by the 2-by-2 rotation
  7098. +*
  7099. +* R(k) = ( c(k) s(k) )
  7100. +* = ( -s(k) c(k) ).
  7101. +*
  7102. +* When PIVOT = 'V' (Variable pivot), the rotation is performed
  7103. +* for the plane (k,k+1), i.e., P(k) has the form
  7104. +*
  7105. +* P(k) = ( 1 )
  7106. +* ( ... )
  7107. +* ( 1 )
  7108. +* ( c(k) s(k) )
  7109. +* ( -s(k) c(k) )
  7110. +* ( 1 )
  7111. +* ( ... )
  7112. +* ( 1 )
  7113. +*
  7114. +* where R(k) appears as a rank-2 modification to the identity matrix in
  7115. +* rows and columns k and k+1.
  7116. +*
  7117. +* When PIVOT = 'T' (Top pivot), the rotation is performed for the
  7118. +* plane (1,k+1), so P(k) has the form
  7119. +*
  7120. +* P(k) = ( c(k) s(k) )
  7121. +* ( 1 )
  7122. +* ( ... )
  7123. +* ( 1 )
  7124. +* ( -s(k) c(k) )
  7125. +* ( 1 )
  7126. +* ( ... )
  7127. +* ( 1 )
  7128. +*
  7129. +* where R(k) appears in rows and columns 1 and k+1.
  7130. +*
  7131. +* Similarly, when PIVOT = 'B' (Bottom pivot), the rotation is
  7132. +* performed for the plane (k,z), giving P(k) the form
  7133. +*
  7134. +* P(k) = ( 1 )
  7135. +* ( ... )
  7136. +* ( 1 )
  7137. +* ( c(k) s(k) )
  7138. +* ( 1 )
  7139. +* ( ... )
  7140. +* ( 1 )
  7141. +* ( -s(k) c(k) )
  7142. +*
  7143. +* where R(k) appears in rows and columns k and z. The rotations are
  7144. +* performed without ever forming P(k) explicitly.
  7145. *
  7146. * Arguments
  7147. * =========
  7148. @@ -62,13 +95,13 @@
  7149. * Specifies whether the plane rotation matrix P is applied to
  7150. * A on the left or the right.
  7151. * = 'L': Left, compute A := P*A
  7152. -* = 'R': Right, compute A:= A*P'
  7153. +* = 'R': Right, compute A:= A*P**T
  7154. *
  7155. * DIRECT (input) CHARACTER*1
  7156. * Specifies whether P is a forward or backward sequence of
  7157. * plane rotations.
  7158. -* = 'F': Forward, P = P( z - 1 )*...*P( 2 )*P( 1 )
  7159. -* = 'B': Backward, P = P( 1 )*P( 2 )*...*P( z - 1 )
  7160. +* = 'F': Forward, P = P(z-1)*...*P(2)*P(1)
  7161. +* = 'B': Backward, P = P(1)*P(2)*...*P(z-1)
  7162. *
  7163. * PIVOT (input) CHARACTER*1
  7164. * Specifies the plane for which P(k) is a plane rotation
  7165. @@ -85,18 +118,22 @@
  7166. * The number of columns of the matrix A. If n <= 1, an
  7167. * immediate return is effected.
  7168. *
  7169. -* C, S (input) DOUBLE PRECISION arrays, dimension
  7170. +* C (input) DOUBLE PRECISION array, dimension
  7171. +* (M-1) if SIDE = 'L'
  7172. +* (N-1) if SIDE = 'R'
  7173. +* The cosines c(k) of the plane rotations.
  7174. +*
  7175. +* S (input) DOUBLE PRECISION array, dimension
  7176. * (M-1) if SIDE = 'L'
  7177. * (N-1) if SIDE = 'R'
  7178. -* c(k) and s(k) contain the cosine and sine that define the
  7179. -* matrix P(k). The two by two plane rotation part of the
  7180. -* matrix P(k), R(k), is assumed to be of the form
  7181. -* R( k ) = ( c( k ) s( k ) ).
  7182. -* ( -s( k ) c( k ) )
  7183. +* The sines s(k) of the plane rotations. The 2-by-2 plane
  7184. +* rotation part of the matrix P(k), R(k), has the form
  7185. +* R(k) = ( c(k) s(k) )
  7186. +* ( -s(k) c(k) ).
  7187. *
  7188. * A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
  7189. -* The m by n matrix A. On exit, A is overwritten by P*A if
  7190. -* SIDE = 'R' or by A*P' if SIDE = 'L'.
  7191. +* The M-by-N matrix A. On exit, A is overwritten by P*A if
  7192. +* SIDE = 'R' or by A*P**T if SIDE = 'L'.
  7193. *
  7194. * LDA (input) INTEGER
  7195. * The leading dimension of the array A. LDA >= max(1,M).
  7196. diff -uNr LAPACK.orig/SRC/dsbgst.f LAPACK/SRC/dsbgst.f
  7197. --- LAPACK.orig/SRC/dsbgst.f Thu Nov 4 14:23:31 1999
  7198. +++ LAPACK/SRC/dsbgst.f Fri May 25 16:12:50 2001
  7199. @@ -4,7 +4,7 @@
  7200. * -- LAPACK routine (version 3.0) --
  7201. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  7202. * Courant Institute, Argonne National Lab, and Rice University
  7203. -* June 30, 1999
  7204. +* January 9, 2001
  7205. *
  7206. * .. Scalar Arguments ..
  7207. CHARACTER UPLO, VECT
  7208. @@ -125,7 +125,7 @@
  7209. INFO = -3
  7210. ELSE IF( KA.LT.0 ) THEN
  7211. INFO = -4
  7212. - ELSE IF( KB.LT.0 ) THEN
  7213. + ELSE IF( KB.LT.0 .OR. KB.GT.KA ) THEN
  7214. INFO = -5
  7215. ELSE IF( LDAB.LT.KA+1 ) THEN
  7216. INFO = -7
  7217. diff -uNr LAPACK.orig/SRC/dstebz.f LAPACK/SRC/dstebz.f
  7218. --- LAPACK.orig/SRC/dstebz.f Thu Nov 4 14:24:57 1999
  7219. +++ LAPACK/SRC/dstebz.f Fri May 25 16:13:23 2001
  7220. @@ -6,6 +6,7 @@
  7221. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  7222. * Courant Institute, Argonne National Lab, and Rice University
  7223. * June 30, 1999
  7224. +* 8-18-00: Increase FUDGE factor for T3E (eca)
  7225. *
  7226. * .. Scalar Arguments ..
  7227. CHARACTER ORDER, RANGE
  7228. @@ -175,7 +176,7 @@
  7229. PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0, TWO = 2.0D0,
  7230. $ HALF = 1.0D0 / TWO )
  7231. DOUBLE PRECISION FUDGE, RELFAC
  7232. - PARAMETER ( FUDGE = 2.0D0, RELFAC = 2.0D0 )
  7233. + PARAMETER ( FUDGE = 2.1D0, RELFAC = 2.0D0 )
  7234. * ..
  7235. * .. Local Scalars ..
  7236. LOGICAL NCNVRG, TOOFEW
  7237. diff -uNr LAPACK.orig/SRC/dtgevc.f LAPACK/SRC/dtgevc.f
  7238. --- LAPACK.orig/SRC/dtgevc.f Thu Nov 4 14:26:09 1999
  7239. +++ LAPACK/SRC/dtgevc.f Fri May 25 16:13:33 2001
  7240. @@ -1,18 +1,18 @@
  7241. - SUBROUTINE DTGEVC( SIDE, HOWMNY, SELECT, N, A, LDA, B, LDB, VL,
  7242. + SUBROUTINE DTGEVC( SIDE, HOWMNY, SELECT, N, S, LDS, P, LDP, VL,
  7243. $ LDVL, VR, LDVR, MM, M, WORK, INFO )
  7244. *
  7245. * -- LAPACK routine (version 3.0) --
  7246. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  7247. * Courant Institute, Argonne National Lab, and Rice University
  7248. -* June 30, 1999
  7249. +* May 4, 2001
  7250. *
  7251. * .. Scalar Arguments ..
  7252. CHARACTER HOWMNY, SIDE
  7253. - INTEGER INFO, LDA, LDB, LDVL, LDVR, M, MM, N
  7254. + INTEGER INFO, LDP, LDS, LDVL, LDVR, M, MM, N
  7255. * ..
  7256. * .. Array Arguments ..
  7257. LOGICAL SELECT( * )
  7258. - DOUBLE PRECISION A( LDA, * ), B( LDB, * ), VL( LDVL, * ),
  7259. + DOUBLE PRECISION P( LDP, * ), S( LDS, * ), VL( LDVL, * ),
  7260. $ VR( LDVR, * ), WORK( * )
  7261. * ..
  7262. *
  7263. @@ -20,35 +20,31 @@
  7264. * Purpose
  7265. * =======
  7266. *
  7267. -* DTGEVC computes some or all of the right and/or left generalized
  7268. -* eigenvectors of a pair of real upper triangular matrices (A,B).
  7269. -*
  7270. -* The right generalized eigenvector x and the left generalized
  7271. -* eigenvector y of (A,B) corresponding to a generalized eigenvalue
  7272. -* w are defined by:
  7273. -*
  7274. -* (A - wB) * x = 0 and y**H * (A - wB) = 0
  7275. -*
  7276. +* DTGEVC computes some or all of the right and/or left eigenvectors of
  7277. +* a pair of real matrices (S,P), where S is a quasi-triangular matrix
  7278. +* and P is upper triangular. Matrix pairs of this type are produced by
  7279. +* the generalized Schur factorization of a matrix pair (A,B):
  7280. +*
  7281. +* A = Q*S*Z**T, B = Q*P*Z**T
  7282. +*
  7283. +* as computed by DGGHRD + DHGEQZ.
  7284. +*
  7285. +* The right eigenvector x and the left eigenvector y of (S,P)
  7286. +* corresponding to an eigenvalue w are defined by:
  7287. +*
  7288. +* S*x = w*P*x, (y**H)*S = w*(y**H)*P,
  7289. +*
  7290. * where y**H denotes the conjugate tranpose of y.
  7291. -*
  7292. -* If an eigenvalue w is determined by zero diagonal elements of both A
  7293. -* and B, a unit vector is returned as the corresponding eigenvector.
  7294. -*
  7295. -* If all eigenvectors are requested, the routine may either return
  7296. -* the matrices X and/or Y of right or left eigenvectors of (A,B), or
  7297. -* the products Z*X and/or Q*Y, where Z and Q are input orthogonal
  7298. -* matrices. If (A,B) was obtained from the generalized real-Schur
  7299. -* factorization of an original pair of matrices
  7300. -* (A0,B0) = (Q*A*Z**H,Q*B*Z**H),
  7301. -* then Z*X and Q*Y are the matrices of right or left eigenvectors of
  7302. -* A.
  7303. -*
  7304. -* A must be block upper triangular, with 1-by-1 and 2-by-2 diagonal
  7305. -* blocks. Corresponding to each 2-by-2 diagonal block is a complex
  7306. -* conjugate pair of eigenvalues and eigenvectors; only one
  7307. -* eigenvector of the pair is computed, namely the one corresponding
  7308. -* to the eigenvalue with positive imaginary part.
  7309. -*
  7310. +* The eigenvalues are not input to this routine, but are computed
  7311. +* directly from the diagonal blocks of S and P.
  7312. +*
  7313. +* This routine returns the matrices X and/or Y of right and left
  7314. +* eigenvectors of (S,P), or the products Z*X and/or Q*Y,
  7315. +* where Z and Q are input matrices.
  7316. +* If Q and Z are the orthogonal factors from the generalized Schur
  7317. +* factorization of a matrix pair (A,B), then Z*X and Q*Y
  7318. +* are the matrices of right and left eigenvectors of (A,B).
  7319. +*
  7320. * Arguments
  7321. * =========
  7322. *
  7323. @@ -59,78 +55,84 @@
  7324. *
  7325. * HOWMNY (input) CHARACTER*1
  7326. * = 'A': compute all right and/or left eigenvectors;
  7327. -* = 'B': compute all right and/or left eigenvectors, and
  7328. -* backtransform them using the input matrices supplied
  7329. -* in VR and/or VL;
  7330. +* = 'B': compute all right and/or left eigenvectors,
  7331. +* backtransformed by the matrices in VR and/or VL;
  7332. * = 'S': compute selected right and/or left eigenvectors,
  7333. * specified by the logical array SELECT.
  7334. *
  7335. * SELECT (input) LOGICAL array, dimension (N)
  7336. * If HOWMNY='S', SELECT specifies the eigenvectors to be
  7337. -* computed.
  7338. -* If HOWMNY='A' or 'B', SELECT is not referenced.
  7339. -* To select the real eigenvector corresponding to the real
  7340. -* eigenvalue w(j), SELECT(j) must be set to .TRUE. To select
  7341. -* the complex eigenvector corresponding to a complex conjugate
  7342. -* pair w(j) and w(j+1), either SELECT(j) or SELECT(j+1) must
  7343. -* be set to .TRUE..
  7344. +* computed. If w(j) is a real eigenvalue, the corresponding
  7345. +* real eigenvector is computed if SELECT(j) is .TRUE..
  7346. +* If w(j) and w(j+1) are the real and imaginary parts of a
  7347. +* complex eigenvalue, the corresponding complex eigenvector
  7348. +* is computed if either SELECT(j) or SELECT(j+1) is .TRUE.,
  7349. +* and on exit SELECT(j) is set to .TRUE. and SELECT(j+1) is
  7350. +* set to .FALSE..
  7351. +* Not referenced if HOWMNY = 'A' or 'B'.
  7352. *
  7353. * N (input) INTEGER
  7354. -* The order of the matrices A and B. N >= 0.
  7355. +* The order of the matrices S and P. N >= 0.
  7356. *
  7357. -* A (input) DOUBLE PRECISION array, dimension (LDA,N)
  7358. -* The upper quasi-triangular matrix A.
  7359. +* S (input) DOUBLE PRECISION array, dimension (LDS,N)
  7360. +* The upper quasi-triangular matrix S from a generalized Schur
  7361. +* factorization, as computed by DHGEQZ.
  7362. +*
  7363. +* LDS (input) INTEGER
  7364. +* The leading dimension of array S. LDS >= max(1,N).
  7365. +*
  7366. +* P (input) DOUBLE PRECISION array, dimension (LDP,N)
  7367. +* The upper triangular matrix P from a generalized Schur
  7368. +* factorization, as computed by DHGEQZ.
  7369. +* 2-by-2 diagonal blocks of P corresponding to 2-by-2 blocks
  7370. +* of S must be in positive diagonal form.
  7371. *
  7372. -* LDA (input) INTEGER
  7373. -* The leading dimension of array A. LDA >= max(1, N).
  7374. -*
  7375. -* B (input) DOUBLE PRECISION array, dimension (LDB,N)
  7376. -* The upper triangular matrix B. If A has a 2-by-2 diagonal
  7377. -* block, then the corresponding 2-by-2 block of B must be
  7378. -* diagonal with positive elements.
  7379. -*
  7380. -* LDB (input) INTEGER
  7381. -* The leading dimension of array B. LDB >= max(1,N).
  7382. +* LDP (input) INTEGER
  7383. +* The leading dimension of array P. LDP >= max(1,N).
  7384. *
  7385. * VL (input/output) DOUBLE PRECISION array, dimension (LDVL,MM)
  7386. * On entry, if SIDE = 'L' or 'B' and HOWMNY = 'B', VL must
  7387. * contain an N-by-N matrix Q (usually the orthogonal matrix Q
  7388. * of left Schur vectors returned by DHGEQZ).
  7389. * On exit, if SIDE = 'L' or 'B', VL contains:
  7390. -* if HOWMNY = 'A', the matrix Y of left eigenvectors of (A,B);
  7391. +* if HOWMNY = 'A', the matrix Y of left eigenvectors of (S,P);
  7392. * if HOWMNY = 'B', the matrix Q*Y;
  7393. -* if HOWMNY = 'S', the left eigenvectors of (A,B) specified by
  7394. +* if HOWMNY = 'S', the left eigenvectors of (S,P) specified by
  7395. * SELECT, stored consecutively in the columns of
  7396. * VL, in the same order as their eigenvalues.
  7397. -* If SIDE = 'R', VL is not referenced.
  7398. *
  7399. * A complex eigenvector corresponding to a complex eigenvalue
  7400. * is stored in two consecutive columns, the first holding the
  7401. * real part, and the second the imaginary part.
  7402. *
  7403. +* Not referenced if SIDE = 'R'.
  7404. +*
  7405. * LDVL (input) INTEGER
  7406. -* The leading dimension of array VL.
  7407. -* LDVL >= max(1,N) if SIDE = 'L' or 'B'; LDVL >= 1 otherwise.
  7408. +* The leading dimension of array VL. LDVL >= 1, and if
  7409. +* SIDE = 'L' or 'B', LDVL >= N.
  7410. *
  7411. * VR (input/output) DOUBLE PRECISION array, dimension (LDVR,MM)
  7412. * On entry, if SIDE = 'R' or 'B' and HOWMNY = 'B', VR must
  7413. -* contain an N-by-N matrix Q (usually the orthogonal matrix Z
  7414. +* contain an N-by-N matrix Z (usually the orthogonal matrix Z
  7415. * of right Schur vectors returned by DHGEQZ).
  7416. +*
  7417. * On exit, if SIDE = 'R' or 'B', VR contains:
  7418. -* if HOWMNY = 'A', the matrix X of right eigenvectors of (A,B);
  7419. -* if HOWMNY = 'B', the matrix Z*X;
  7420. -* if HOWMNY = 'S', the right eigenvectors of (A,B) specified by
  7421. -* SELECT, stored consecutively in the columns of
  7422. -* VR, in the same order as their eigenvalues.
  7423. -* If SIDE = 'L', VR is not referenced.
  7424. +* if HOWMNY = 'A', the matrix X of right eigenvectors of (S,P);
  7425. +* if HOWMNY = 'B' or 'b', the matrix Z*X;
  7426. +* if HOWMNY = 'S' or 's', the right eigenvectors of (S,P)
  7427. +* specified by SELECT, stored consecutively in the
  7428. +* columns of VR, in the same order as their
  7429. +* eigenvalues.
  7430. *
  7431. * A complex eigenvector corresponding to a complex eigenvalue
  7432. * is stored in two consecutive columns, the first holding the
  7433. * real part and the second the imaginary part.
  7434. +*
  7435. +* Not referenced if SIDE = 'L'.
  7436. *
  7437. * LDVR (input) INTEGER
  7438. -* The leading dimension of the array VR.
  7439. -* LDVR >= max(1,N) if SIDE = 'R' or 'B'; LDVR >= 1 otherwise.
  7440. +* The leading dimension of the array VR. LDVR >= 1, and if
  7441. +* SIDE = 'R' or 'B', LDVR >= N.
  7442. *
  7443. * MM (input) INTEGER
  7444. * The number of columns in the arrays VL and/or VR. MM >= M.
  7445. @@ -199,7 +201,7 @@
  7446. * partial sums. Since FORTRAN arrays are stored columnwise, this has
  7447. * the advantage that at each step, the elements of C that are accessed
  7448. * are adjacent to one another, whereas with the rowwise method, the
  7449. -* elements accessed at a step are spaced LDA (and LDB) words apart.
  7450. +* elements accessed at a step are spaced LDS (and LDP) words apart.
  7451. *
  7452. * When finding left eigenvectors, the matrix in question is the
  7453. * transpose of the one in storage, so the rowwise method then
  7454. @@ -226,8 +228,8 @@
  7455. $ XSCALE
  7456. * ..
  7457. * .. Local Arrays ..
  7458. - DOUBLE PRECISION BDIAG( 2 ), SUM( 2, 2 ), SUMA( 2, 2 ),
  7459. - $ SUMB( 2, 2 )
  7460. + DOUBLE PRECISION BDIAG( 2 ), SUM( 2, 2 ), SUMS( 2, 2 ),
  7461. + $ SUMP( 2, 2 )
  7462. * ..
  7463. * .. External Functions ..
  7464. LOGICAL LSAME
  7465. @@ -235,7 +237,7 @@
  7466. EXTERNAL LSAME, DLAMCH
  7467. * ..
  7468. * .. External Subroutines ..
  7469. - EXTERNAL DGEMV, DLACPY, DLAG2, DLALN2, XERBLA
  7470. + EXTERNAL DGEMV, DLABAD, DLACPY, DLAG2, DLALN2, XERBLA
  7471. * ..
  7472. * .. Intrinsic Functions ..
  7473. INTRINSIC ABS, MAX, MIN
  7474. @@ -252,7 +254,7 @@
  7475. IHWMNY = 2
  7476. ILALL = .FALSE.
  7477. ILBACK = .FALSE.
  7478. - ELSE IF( LSAME( HOWMNY, 'B' ) .OR. LSAME( HOWMNY, 'T' ) ) THEN
  7479. + ELSE IF( LSAME( HOWMNY, 'B' ) ) THEN
  7480. IHWMNY = 3
  7481. ILALL = .TRUE.
  7482. ILBACK = .TRUE.
  7483. @@ -284,9 +286,9 @@
  7484. INFO = -2
  7485. ELSE IF( N.LT.0 ) THEN
  7486. INFO = -4
  7487. - ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
  7488. + ELSE IF( LDS.LT.MAX( 1, N ) ) THEN
  7489. INFO = -6
  7490. - ELSE IF( LDB.LT.MAX( 1, N ) ) THEN
  7491. + ELSE IF( LDP.LT.MAX( 1, N ) ) THEN
  7492. INFO = -8
  7493. END IF
  7494. IF( INFO.NE.0 ) THEN
  7495. @@ -305,7 +307,7 @@
  7496. GO TO 10
  7497. END IF
  7498. IF( J.LT.N ) THEN
  7499. - IF( A( J+1, J ).NE.ZERO )
  7500. + IF( S( J+1, J ).NE.ZERO )
  7501. $ ILCPLX = .TRUE.
  7502. END IF
  7503. IF( ILCPLX ) THEN
  7504. @@ -325,11 +327,11 @@
  7505. ILABAD = .FALSE.
  7506. ILBBAD = .FALSE.
  7507. DO 20 J = 1, N - 1
  7508. - IF( A( J+1, J ).NE.ZERO ) THEN
  7509. - IF( B( J, J ).EQ.ZERO .OR. B( J+1, J+1 ).EQ.ZERO .OR.
  7510. - $ B( J, J+1 ).NE.ZERO )ILBBAD = .TRUE.
  7511. + IF( S( J+1, J ).NE.ZERO ) THEN
  7512. + IF( P( J, J ).EQ.ZERO .OR. P( J+1, J+1 ).EQ.ZERO .OR.
  7513. + $ P( J, J+1 ).NE.ZERO )ILBBAD = .TRUE.
  7514. IF( J.LT.N-1 ) THEN
  7515. - IF( A( J+2, J+1 ).NE.ZERO )
  7516. + IF( S( J+2, J+1 ).NE.ZERO )
  7517. $ ILABAD = .TRUE.
  7518. END IF
  7519. END IF
  7520. @@ -372,30 +374,30 @@
  7521. * blocks) of A and B to check for possible overflow in the
  7522. * triangular solver.
  7523. *
  7524. - ANORM = ABS( A( 1, 1 ) )
  7525. + ANORM = ABS( S( 1, 1 ) )
  7526. IF( N.GT.1 )
  7527. - $ ANORM = ANORM + ABS( A( 2, 1 ) )
  7528. - BNORM = ABS( B( 1, 1 ) )
  7529. + $ ANORM = ANORM + ABS( S( 2, 1 ) )
  7530. + BNORM = ABS( P( 1, 1 ) )
  7531. WORK( 1 ) = ZERO
  7532. WORK( N+1 ) = ZERO
  7533. *
  7534. DO 50 J = 2, N
  7535. TEMP = ZERO
  7536. TEMP2 = ZERO
  7537. - IF( A( J, J-1 ).EQ.ZERO ) THEN
  7538. + IF( S( J, J-1 ).EQ.ZERO ) THEN
  7539. IEND = J - 1
  7540. ELSE
  7541. IEND = J - 2
  7542. END IF
  7543. DO 30 I = 1, IEND
  7544. - TEMP = TEMP + ABS( A( I, J ) )
  7545. - TEMP2 = TEMP2 + ABS( B( I, J ) )
  7546. + TEMP = TEMP + ABS( S( I, J ) )
  7547. + TEMP2 = TEMP2 + ABS( P( I, J ) )
  7548. 30 CONTINUE
  7549. WORK( J ) = TEMP
  7550. WORK( N+J ) = TEMP2
  7551. DO 40 I = IEND + 1, MIN( J+1, N )
  7552. - TEMP = TEMP + ABS( A( I, J ) )
  7553. - TEMP2 = TEMP2 + ABS( B( I, J ) )
  7554. + TEMP = TEMP + ABS( S( I, J ) )
  7555. + TEMP2 = TEMP2 + ABS( P( I, J ) )
  7556. 40 CONTINUE
  7557. ANORM = MAX( ANORM, TEMP )
  7558. BNORM = MAX( BNORM, TEMP2 )
  7559. @@ -425,7 +427,7 @@
  7560. END IF
  7561. NW = 1
  7562. IF( JE.LT.N ) THEN
  7563. - IF( A( JE+1, JE ).NE.ZERO ) THEN
  7564. + IF( S( JE+1, JE ).NE.ZERO ) THEN
  7565. ILCPLX = .TRUE.
  7566. NW = 2
  7567. END IF
  7568. @@ -444,8 +446,8 @@
  7569. * (c) complex eigenvalue.
  7570. *
  7571. IF( .NOT.ILCPLX ) THEN
  7572. - IF( ABS( A( JE, JE ) ).LE.SAFMIN .AND.
  7573. - $ ABS( B( JE, JE ) ).LE.SAFMIN ) THEN
  7574. + IF( ABS( S( JE, JE ) ).LE.SAFMIN .AND.
  7575. + $ ABS( P( JE, JE ) ).LE.SAFMIN ) THEN
  7576. *
  7577. * Singular matrix pencil -- return unit eigenvector
  7578. *
  7579. @@ -472,10 +474,10 @@
  7580. *
  7581. * Real eigenvalue
  7582. *
  7583. - TEMP = ONE / MAX( ABS( A( JE, JE ) )*ASCALE,
  7584. - $ ABS( B( JE, JE ) )*BSCALE, SAFMIN )
  7585. - SALFAR = ( TEMP*A( JE, JE ) )*ASCALE
  7586. - SBETA = ( TEMP*B( JE, JE ) )*BSCALE
  7587. + TEMP = ONE / MAX( ABS( S( JE, JE ) )*ASCALE,
  7588. + $ ABS( P( JE, JE ) )*BSCALE, SAFMIN )
  7589. + SALFAR = ( TEMP*S( JE, JE ) )*ASCALE
  7590. + SBETA = ( TEMP*P( JE, JE ) )*BSCALE
  7591. ACOEF = SBETA*ASCALE
  7592. BCOEFR = SALFAR*BSCALE
  7593. BCOEFI = ZERO
  7594. @@ -517,7 +519,7 @@
  7595. *
  7596. * Complex eigenvalue
  7597. *
  7598. - CALL DLAG2( A( JE, JE ), LDA, B( JE, JE ), LDB,
  7599. + CALL DLAG2( S( JE, JE ), LDS, P( JE, JE ), LDP,
  7600. $ SAFMIN*SAFETY, ACOEF, TEMP, BCOEFR, TEMP2,
  7601. $ BCOEFI )
  7602. BCOEFI = -BCOEFI
  7603. @@ -549,9 +551,9 @@
  7604. *
  7605. * Compute first two components of eigenvector
  7606. *
  7607. - TEMP = ACOEF*A( JE+1, JE )
  7608. - TEMP2R = ACOEF*A( JE, JE ) - BCOEFR*B( JE, JE )
  7609. - TEMP2I = -BCOEFI*B( JE, JE )
  7610. + TEMP = ACOEF*S( JE+1, JE )
  7611. + TEMP2R = ACOEF*S( JE, JE ) - BCOEFR*P( JE, JE )
  7612. + TEMP2I = -BCOEFI*P( JE, JE )
  7613. IF( ABS( TEMP ).GT.ABS( TEMP2R )+ABS( TEMP2I ) ) THEN
  7614. WORK( 2*N+JE ) = ONE
  7615. WORK( 3*N+JE ) = ZERO
  7616. @@ -560,10 +562,10 @@
  7617. ELSE
  7618. WORK( 2*N+JE+1 ) = ONE
  7619. WORK( 3*N+JE+1 ) = ZERO
  7620. - TEMP = ACOEF*A( JE, JE+1 )
  7621. - WORK( 2*N+JE ) = ( BCOEFR*B( JE+1, JE+1 )-ACOEF*
  7622. - $ A( JE+1, JE+1 ) ) / TEMP
  7623. - WORK( 3*N+JE ) = BCOEFI*B( JE+1, JE+1 ) / TEMP
  7624. + TEMP = ACOEF*S( JE, JE+1 )
  7625. + WORK( 2*N+JE ) = ( BCOEFR*P( JE+1, JE+1 )-ACOEF*
  7626. + $ S( JE+1, JE+1 ) ) / TEMP
  7627. + WORK( 3*N+JE ) = BCOEFI*P( JE+1, JE+1 ) / TEMP
  7628. END IF
  7629. XMAX = MAX( ABS( WORK( 2*N+JE ) )+ABS( WORK( 3*N+JE ) ),
  7630. $ ABS( WORK( 2*N+JE+1 ) )+ABS( WORK( 3*N+JE+1 ) ) )
  7631. @@ -586,11 +588,11 @@
  7632. END IF
  7633. *
  7634. NA = 1
  7635. - BDIAG( 1 ) = B( J, J )
  7636. + BDIAG( 1 ) = P( J, J )
  7637. IF( J.LT.N ) THEN
  7638. - IF( A( J+1, J ).NE.ZERO ) THEN
  7639. + IF( S( J+1, J ).NE.ZERO ) THEN
  7640. IL2BY2 = .TRUE.
  7641. - BDIAG( 2 ) = B( J+1, J+1 )
  7642. + BDIAG( 2 ) = P( J+1, J+1 )
  7643. NA = 2
  7644. END IF
  7645. END IF
  7646. @@ -616,13 +618,13 @@
  7647. * Compute dot products
  7648. *
  7649. * j-1
  7650. -* SUM = sum conjg( a*A(k,j) - b*B(k,j) )*x(k)
  7651. +* SUM = sum conjg( a*S(k,j) - b*P(k,j) )*x(k)
  7652. * k=je
  7653. *
  7654. * To reduce the op count, this is done as
  7655. *
  7656. * _ j-1 _ j-1
  7657. -* a*conjg( sum A(k,j)*x(k) ) - b*conjg( sum B(k,j)*x(k) )
  7658. +* a*conjg( sum S(k,j)*x(k) ) - b*conjg( sum P(k,j)*x(k) )
  7659. * k=je k=je
  7660. *
  7661. * which may cause underflow problems if A or B are close
  7662. @@ -659,15 +661,15 @@
  7663. *$PL$ CMCHAR='*'
  7664. *
  7665. DO 110 JA = 1, NA
  7666. - SUMA( JA, JW ) = ZERO
  7667. - SUMB( JA, JW ) = ZERO
  7668. + SUMS( JA, JW ) = ZERO
  7669. + SUMP( JA, JW ) = ZERO
  7670. *
  7671. DO 100 JR = JE, J - 1
  7672. - SUMA( JA, JW ) = SUMA( JA, JW ) +
  7673. - $ A( JR, J+JA-1 )*
  7674. + SUMS( JA, JW ) = SUMS( JA, JW ) +
  7675. + $ S( JR, J+JA-1 )*
  7676. $ WORK( ( JW+1 )*N+JR )
  7677. - SUMB( JA, JW ) = SUMB( JA, JW ) +
  7678. - $ B( JR, J+JA-1 )*
  7679. + SUMP( JA, JW ) = SUMP( JA, JW ) +
  7680. + $ P( JR, J+JA-1 )*
  7681. $ WORK( ( JW+1 )*N+JR )
  7682. 100 CONTINUE
  7683. 110 CONTINUE
  7684. @@ -687,15 +689,15 @@
  7685. *
  7686. DO 130 JA = 1, NA
  7687. IF( ILCPLX ) THEN
  7688. - SUM( JA, 1 ) = -ACOEF*SUMA( JA, 1 ) +
  7689. - $ BCOEFR*SUMB( JA, 1 ) -
  7690. - $ BCOEFI*SUMB( JA, 2 )
  7691. - SUM( JA, 2 ) = -ACOEF*SUMA( JA, 2 ) +
  7692. - $ BCOEFR*SUMB( JA, 2 ) +
  7693. - $ BCOEFI*SUMB( JA, 1 )
  7694. + SUM( JA, 1 ) = -ACOEF*SUMS( JA, 1 ) +
  7695. + $ BCOEFR*SUMP( JA, 1 ) -
  7696. + $ BCOEFI*SUMP( JA, 2 )
  7697. + SUM( JA, 2 ) = -ACOEF*SUMS( JA, 2 ) +
  7698. + $ BCOEFR*SUMP( JA, 2 ) +
  7699. + $ BCOEFI*SUMP( JA, 1 )
  7700. ELSE
  7701. - SUM( JA, 1 ) = -ACOEF*SUMA( JA, 1 ) +
  7702. - $ BCOEFR*SUMB( JA, 1 )
  7703. + SUM( JA, 1 ) = -ACOEF*SUMS( JA, 1 ) +
  7704. + $ BCOEFR*SUMP( JA, 1 )
  7705. END IF
  7706. 130 CONTINUE
  7707. *
  7708. @@ -703,7 +705,7 @@
  7709. * Solve ( a A - b B ) y = SUM(,)
  7710. * with scaling and perturbation of the denominator
  7711. *
  7712. - CALL DLALN2( .TRUE., NA, NW, DMIN, ACOEF, A( J, J ), LDA,
  7713. + CALL DLALN2( .TRUE., NA, NW, DMIN, ACOEF, S( J, J ), LDS,
  7714. $ BDIAG( 1 ), BDIAG( 2 ), SUM, 2, BCOEFR,
  7715. $ BCOEFI, WORK( 2*N+J ), N, SCALE, TEMP,
  7716. $ IINFO )
  7717. @@ -790,7 +792,7 @@
  7718. END IF
  7719. NW = 1
  7720. IF( JE.GT.1 ) THEN
  7721. - IF( A( JE, JE-1 ).NE.ZERO ) THEN
  7722. + IF( S( JE, JE-1 ).NE.ZERO ) THEN
  7723. ILCPLX = .TRUE.
  7724. NW = 2
  7725. END IF
  7726. @@ -809,8 +811,8 @@
  7727. * (c) complex eigenvalue.
  7728. *
  7729. IF( .NOT.ILCPLX ) THEN
  7730. - IF( ABS( A( JE, JE ) ).LE.SAFMIN .AND.
  7731. - $ ABS( B( JE, JE ) ).LE.SAFMIN ) THEN
  7732. + IF( ABS( S( JE, JE ) ).LE.SAFMIN .AND.
  7733. + $ ABS( P( JE, JE ) ).LE.SAFMIN ) THEN
  7734. *
  7735. * Singular matrix pencil -- unit eigenvector
  7736. *
  7737. @@ -839,10 +841,10 @@
  7738. *
  7739. * Real eigenvalue
  7740. *
  7741. - TEMP = ONE / MAX( ABS( A( JE, JE ) )*ASCALE,
  7742. - $ ABS( B( JE, JE ) )*BSCALE, SAFMIN )
  7743. - SALFAR = ( TEMP*A( JE, JE ) )*ASCALE
  7744. - SBETA = ( TEMP*B( JE, JE ) )*BSCALE
  7745. + TEMP = ONE / MAX( ABS( S( JE, JE ) )*ASCALE,
  7746. + $ ABS( P( JE, JE ) )*BSCALE, SAFMIN )
  7747. + SALFAR = ( TEMP*S( JE, JE ) )*ASCALE
  7748. + SBETA = ( TEMP*P( JE, JE ) )*BSCALE
  7749. ACOEF = SBETA*ASCALE
  7750. BCOEFR = SALFAR*BSCALE
  7751. BCOEFI = ZERO
  7752. @@ -885,14 +887,14 @@
  7753. * (See "Further Details", above.)
  7754. *
  7755. DO 260 JR = 1, JE - 1
  7756. - WORK( 2*N+JR ) = BCOEFR*B( JR, JE ) -
  7757. - $ ACOEF*A( JR, JE )
  7758. + WORK( 2*N+JR ) = BCOEFR*P( JR, JE ) -
  7759. + $ ACOEF*S( JR, JE )
  7760. 260 CONTINUE
  7761. ELSE
  7762. *
  7763. * Complex eigenvalue
  7764. *
  7765. - CALL DLAG2( A( JE-1, JE-1 ), LDA, B( JE-1, JE-1 ), LDB,
  7766. + CALL DLAG2( S( JE-1, JE-1 ), LDS, P( JE-1, JE-1 ), LDP,
  7767. $ SAFMIN*SAFETY, ACOEF, TEMP, BCOEFR, TEMP2,
  7768. $ BCOEFI )
  7769. IF( BCOEFI.EQ.ZERO ) THEN
  7770. @@ -924,9 +926,9 @@
  7771. * Compute first two components of eigenvector
  7772. * and contribution to sums
  7773. *
  7774. - TEMP = ACOEF*A( JE, JE-1 )
  7775. - TEMP2R = ACOEF*A( JE, JE ) - BCOEFR*B( JE, JE )
  7776. - TEMP2I = -BCOEFI*B( JE, JE )
  7777. + TEMP = ACOEF*S( JE, JE-1 )
  7778. + TEMP2R = ACOEF*S( JE, JE ) - BCOEFR*P( JE, JE )
  7779. + TEMP2I = -BCOEFI*P( JE, JE )
  7780. IF( ABS( TEMP ).GE.ABS( TEMP2R )+ABS( TEMP2I ) ) THEN
  7781. WORK( 2*N+JE ) = ONE
  7782. WORK( 3*N+JE ) = ZERO
  7783. @@ -935,10 +937,10 @@
  7784. ELSE
  7785. WORK( 2*N+JE-1 ) = ONE
  7786. WORK( 3*N+JE-1 ) = ZERO
  7787. - TEMP = ACOEF*A( JE-1, JE )
  7788. - WORK( 2*N+JE ) = ( BCOEFR*B( JE-1, JE-1 )-ACOEF*
  7789. - $ A( JE-1, JE-1 ) ) / TEMP
  7790. - WORK( 3*N+JE ) = BCOEFI*B( JE-1, JE-1 ) / TEMP
  7791. + TEMP = ACOEF*S( JE-1, JE )
  7792. + WORK( 2*N+JE ) = ( BCOEFR*P( JE-1, JE-1 )-ACOEF*
  7793. + $ S( JE-1, JE-1 ) ) / TEMP
  7794. + WORK( 3*N+JE ) = BCOEFI*P( JE-1, JE-1 ) / TEMP
  7795. END IF
  7796. *
  7797. XMAX = MAX( ABS( WORK( 2*N+JE ) )+ABS( WORK( 3*N+JE ) ),
  7798. @@ -958,12 +960,12 @@
  7799. CRE2B = BCOEFR*WORK( 2*N+JE ) - BCOEFI*WORK( 3*N+JE )
  7800. CIM2B = BCOEFI*WORK( 2*N+JE ) + BCOEFR*WORK( 3*N+JE )
  7801. DO 270 JR = 1, JE - 2
  7802. - WORK( 2*N+JR ) = -CREALA*A( JR, JE-1 ) +
  7803. - $ CREALB*B( JR, JE-1 ) -
  7804. - $ CRE2A*A( JR, JE ) + CRE2B*B( JR, JE )
  7805. - WORK( 3*N+JR ) = -CIMAGA*A( JR, JE-1 ) +
  7806. - $ CIMAGB*B( JR, JE-1 ) -
  7807. - $ CIM2A*A( JR, JE ) + CIM2B*B( JR, JE )
  7808. + WORK( 2*N+JR ) = -CREALA*S( JR, JE-1 ) +
  7809. + $ CREALB*P( JR, JE-1 ) -
  7810. + $ CRE2A*S( JR, JE ) + CRE2B*P( JR, JE )
  7811. + WORK( 3*N+JR ) = -CIMAGA*S( JR, JE-1 ) +
  7812. + $ CIMAGB*P( JR, JE-1 ) -
  7813. + $ CIM2A*S( JR, JE ) + CIM2B*P( JR, JE )
  7814. 270 CONTINUE
  7815. END IF
  7816. *
  7817. @@ -978,23 +980,23 @@
  7818. * next iteration to process it (when it will be j:j+1)
  7819. *
  7820. IF( .NOT.IL2BY2 .AND. J.GT.1 ) THEN
  7821. - IF( A( J, J-1 ).NE.ZERO ) THEN
  7822. + IF( S( J, J-1 ).NE.ZERO ) THEN
  7823. IL2BY2 = .TRUE.
  7824. GO TO 370
  7825. END IF
  7826. END IF
  7827. - BDIAG( 1 ) = B( J, J )
  7828. + BDIAG( 1 ) = P( J, J )
  7829. IF( IL2BY2 ) THEN
  7830. NA = 2
  7831. - BDIAG( 2 ) = B( J+1, J+1 )
  7832. + BDIAG( 2 ) = P( J+1, J+1 )
  7833. ELSE
  7834. NA = 1
  7835. END IF
  7836. *
  7837. * Compute x(j) (and x(j+1), if 2-by-2 block)
  7838. *
  7839. - CALL DLALN2( .FALSE., NA, NW, DMIN, ACOEF, A( J, J ),
  7840. - $ LDA, BDIAG( 1 ), BDIAG( 2 ), WORK( 2*N+J ),
  7841. + CALL DLALN2( .FALSE., NA, NW, DMIN, ACOEF, S( J, J ),
  7842. + $ LDS, BDIAG( 1 ), BDIAG( 2 ), WORK( 2*N+J ),
  7843. $ N, BCOEFR, BCOEFI, SUM, 2, SCALE, TEMP,
  7844. $ IINFO )
  7845. IF( SCALE.LT.ONE ) THEN
  7846. @@ -1014,7 +1016,7 @@
  7847. 300 CONTINUE
  7848. 310 CONTINUE
  7849. *
  7850. -* w = w + x(j)*(a A(*,j) - b B(*,j) ) with scaling
  7851. +* w = w + x(j)*(a S(*,j) - b P(*,j) ) with scaling
  7852. *
  7853. IF( J.GT.1 ) THEN
  7854. *
  7855. @@ -1052,19 +1054,19 @@
  7856. $ BCOEFR*WORK( 3*N+J+JA-1 )
  7857. DO 340 JR = 1, J - 1
  7858. WORK( 2*N+JR ) = WORK( 2*N+JR ) -
  7859. - $ CREALA*A( JR, J+JA-1 ) +
  7860. - $ CREALB*B( JR, J+JA-1 )
  7861. + $ CREALA*S( JR, J+JA-1 ) +
  7862. + $ CREALB*P( JR, J+JA-1 )
  7863. WORK( 3*N+JR ) = WORK( 3*N+JR ) -
  7864. - $ CIMAGA*A( JR, J+JA-1 ) +
  7865. - $ CIMAGB*B( JR, J+JA-1 )
  7866. + $ CIMAGA*S( JR, J+JA-1 ) +
  7867. + $ CIMAGB*P( JR, J+JA-1 )
  7868. 340 CONTINUE
  7869. ELSE
  7870. CREALA = ACOEF*WORK( 2*N+J+JA-1 )
  7871. CREALB = BCOEFR*WORK( 2*N+J+JA-1 )
  7872. DO 350 JR = 1, J - 1
  7873. WORK( 2*N+JR ) = WORK( 2*N+JR ) -
  7874. - $ CREALA*A( JR, J+JA-1 ) +
  7875. - $ CREALB*B( JR, J+JA-1 )
  7876. + $ CREALA*S( JR, J+JA-1 ) +
  7877. + $ CREALB*P( JR, J+JA-1 )
  7878. 350 CONTINUE
  7879. END IF
  7880. 360 CONTINUE
  7881. diff -uNr LAPACK.orig/SRC/dtrevc.f LAPACK/SRC/dtrevc.f
  7882. --- LAPACK.orig/SRC/dtrevc.f Thu Nov 4 14:24:59 1999
  7883. +++ LAPACK/SRC/dtrevc.f Fri May 25 16:13:52 2001
  7884. @@ -4,7 +4,7 @@
  7885. * -- LAPACK routine (version 3.0) --
  7886. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  7887. * Courant Institute, Argonne National Lab, and Rice University
  7888. -* June 30, 1999
  7889. +* May 7, 2001
  7890. *
  7891. * .. Scalar Arguments ..
  7892. CHARACTER HOWMNY, SIDE
  7893. @@ -21,28 +21,23 @@
  7894. *
  7895. * DTREVC computes some or all of the right and/or left eigenvectors of
  7896. * a real upper quasi-triangular matrix T.
  7897. -*
  7898. +* Matrices of this type are produced by the Schur factorization of
  7899. +* a real general matrix: A = Q*T*Q**T, as computed by DHSEQR.
  7900. +*
  7901. * The right eigenvector x and the left eigenvector y of T corresponding
  7902. * to an eigenvalue w are defined by:
  7903. -*
  7904. -* T*x = w*x, y'*T = w*y'
  7905. -*
  7906. -* where y' denotes the conjugate transpose of the vector y.
  7907. -*
  7908. -* If all eigenvectors are requested, the routine may either return the
  7909. -* matrices X and/or Y of right or left eigenvectors of T, or the
  7910. -* products Q*X and/or Q*Y, where Q is an input orthogonal
  7911. -* matrix. If T was obtained from the real-Schur factorization of an
  7912. -* original matrix A = Q*T*Q', then Q*X and Q*Y are the matrices of
  7913. -* right or left eigenvectors of A.
  7914. -*
  7915. -* T must be in Schur canonical form (as returned by DHSEQR), that is,
  7916. -* block upper triangular with 1-by-1 and 2-by-2 diagonal blocks; each
  7917. -* 2-by-2 diagonal block has its diagonal elements equal and its
  7918. -* off-diagonal elements of opposite sign. Corresponding to each 2-by-2
  7919. -* diagonal block is a complex conjugate pair of eigenvalues and
  7920. -* eigenvectors; only one eigenvector of the pair is computed, namely
  7921. -* the one corresponding to the eigenvalue with positive imaginary part.
  7922. +*
  7923. +* T*x = w*x, (y**H)*T = w*(y**H)
  7924. +*
  7925. +* where y**H denotes the conjugate transpose of y.
  7926. +* The eigenvalues are not input to this routine, but are read directly
  7927. +* from the diagonal blocks of T.
  7928. +*
  7929. +* This routine returns the matrices X and/or Y of right and left
  7930. +* eigenvectors of T, or the products Q*X and/or Q*Y, where Q is an
  7931. +* input matrix. If Q is the orthogonal factor that reduces a matrix
  7932. +* A to Schur form T, then Q*X and Q*Y are the matrices of right and
  7933. +* left eigenvectors of A.
  7934. *
  7935. * Arguments
  7936. * =========
  7937. @@ -55,21 +50,21 @@
  7938. * HOWMNY (input) CHARACTER*1
  7939. * = 'A': compute all right and/or left eigenvectors;
  7940. * = 'B': compute all right and/or left eigenvectors,
  7941. -* and backtransform them using the input matrices
  7942. -* supplied in VR and/or VL;
  7943. +* backtransformed by the matrices in VR and/or VL;
  7944. * = 'S': compute selected right and/or left eigenvectors,
  7945. -* specified by the logical array SELECT.
  7946. +* as indicated by the logical array SELECT.
  7947. *
  7948. * SELECT (input/output) LOGICAL array, dimension (N)
  7949. * If HOWMNY = 'S', SELECT specifies the eigenvectors to be
  7950. * computed.
  7951. -* If HOWMNY = 'A' or 'B', SELECT is not referenced.
  7952. -* To select the real eigenvector corresponding to a real
  7953. -* eigenvalue w(j), SELECT(j) must be set to .TRUE.. To select
  7954. -* the complex eigenvector corresponding to a complex conjugate
  7955. -* pair w(j) and w(j+1), either SELECT(j) or SELECT(j+1) must be
  7956. -* set to .TRUE.; then on exit SELECT(j) is .TRUE. and
  7957. -* SELECT(j+1) is .FALSE..
  7958. +* If w(j) is a real eigenvalue, the corresponding real
  7959. +* eigenvector is computed if SELECT(j) is .TRUE..
  7960. +* If w(j) and w(j+1) are the real and imaginary parts of a
  7961. +* complex eigenvalue, the corresponding complex eigenvector is
  7962. +* computed if either SELECT(j) or SELECT(j+1) is .TRUE., and
  7963. +* on exit SELECT(j) is set to .TRUE. and SELECT(j+1) is set to
  7964. +* .FALSE..
  7965. +* Not referenced if HOWMNY = 'A' or 'B'.
  7966. *
  7967. * N (input) INTEGER
  7968. * The order of the matrix T. N >= 0.
  7969. @@ -86,15 +81,6 @@
  7970. * of Schur vectors returned by DHSEQR).
  7971. * On exit, if SIDE = 'L' or 'B', VL contains:
  7972. * if HOWMNY = 'A', the matrix Y of left eigenvectors of T;
  7973. -* VL has the same quasi-lower triangular form
  7974. -* as T'. If T(i,i) is a real eigenvalue, then
  7975. -* the i-th column VL(i) of VL is its
  7976. -* corresponding eigenvector. If T(i:i+1,i:i+1)
  7977. -* is a 2-by-2 block whose eigenvalues are
  7978. -* complex-conjugate eigenvalues of T, then
  7979. -* VL(i)+sqrt(-1)*VL(i+1) is the complex
  7980. -* eigenvector corresponding to the eigenvalue
  7981. -* with positive real part.
  7982. * if HOWMNY = 'B', the matrix Q*Y;
  7983. * if HOWMNY = 'S', the left eigenvectors of T specified by
  7984. * SELECT, stored consecutively in the columns
  7985. @@ -103,11 +89,11 @@
  7986. * A complex eigenvector corresponding to a complex eigenvalue
  7987. * is stored in two consecutive columns, the first holding the
  7988. * real part, and the second the imaginary part.
  7989. -* If SIDE = 'R', VL is not referenced.
  7990. +* Not referenced if SIDE = 'R'.
  7991. *
  7992. * LDVL (input) INTEGER
  7993. -* The leading dimension of the array VL. LDVL >= max(1,N) if
  7994. -* SIDE = 'L' or 'B'; LDVL >= 1 otherwise.
  7995. +* The leading dimension of the array VL. LDVL >= 1, and if
  7996. +* SIDE = 'L' or 'B', LDVL >= N.
  7997. *
  7998. * VR (input/output) DOUBLE PRECISION array, dimension (LDVR,MM)
  7999. * On entry, if SIDE = 'R' or 'B' and HOWMNY = 'B', VR must
  8000. @@ -115,15 +101,6 @@
  8001. * of Schur vectors returned by DHSEQR).
  8002. * On exit, if SIDE = 'R' or 'B', VR contains:
  8003. * if HOWMNY = 'A', the matrix X of right eigenvectors of T;
  8004. -* VR has the same quasi-upper triangular form
  8005. -* as T. If T(i,i) is a real eigenvalue, then
  8006. -* the i-th column VR(i) of VR is its
  8007. -* corresponding eigenvector. If T(i:i+1,i:i+1)
  8008. -* is a 2-by-2 block whose eigenvalues are
  8009. -* complex-conjugate eigenvalues of T, then
  8010. -* VR(i)+sqrt(-1)*VR(i+1) is the complex
  8011. -* eigenvector corresponding to the eigenvalue
  8012. -* with positive real part.
  8013. * if HOWMNY = 'B', the matrix Q*X;
  8014. * if HOWMNY = 'S', the right eigenvectors of T specified by
  8015. * SELECT, stored consecutively in the columns
  8016. @@ -132,11 +109,11 @@
  8017. * A complex eigenvector corresponding to a complex eigenvalue
  8018. * is stored in two consecutive columns, the first holding the
  8019. * real part and the second the imaginary part.
  8020. -* If SIDE = 'L', VR is not referenced.
  8021. +* Not referenced if SIDE = 'L'.
  8022. *
  8023. * LDVR (input) INTEGER
  8024. -* The leading dimension of the array VR. LDVR >= max(1,N) if
  8025. -* SIDE = 'R' or 'B'; LDVR >= 1 otherwise.
  8026. +* The leading dimension of the array VR. LDVR >= 1, and if
  8027. +* SIDE = 'R' or 'B', LDVR >= N.
  8028. *
  8029. * MM (input) INTEGER
  8030. * The number of columns in the arrays VL and/or VR. MM >= M.
  8031. diff -uNr LAPACK.orig/SRC/dtrsen.f LAPACK/SRC/dtrsen.f
  8032. --- LAPACK.orig/SRC/dtrsen.f Thu Nov 4 14:24:59 1999
  8033. +++ LAPACK/SRC/dtrsen.f Fri May 25 16:14:10 2001
  8034. @@ -4,7 +4,7 @@
  8035. * -- LAPACK routine (version 3.0) --
  8036. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  8037. * Courant Institute, Argonne National Lab, and Rice University
  8038. -* June 30, 1999
  8039. +* January 3, 2001
  8040. *
  8041. * .. Scalar Arguments ..
  8042. CHARACTER COMPQ, JOB
  8043. @@ -118,8 +118,8 @@
  8044. * LWORK (input) INTEGER
  8045. * The dimension of the array WORK.
  8046. * If JOB = 'N', LWORK >= max(1,N);
  8047. -* if JOB = 'E', LWORK >= M*(N-M);
  8048. -* if JOB = 'V' or 'B', LWORK >= 2*M*(N-M).
  8049. +* if JOB = 'E', LWORK >= max(1,M*(N-M));
  8050. +* if JOB = 'V' or 'B', LWORK >= max(1,2*M*(N-M)).
  8051. *
  8052. * If LWORK = -1, then a workspace query is assumed; the routine
  8053. * only calculates the optimal size of the WORK array, returns
  8054. @@ -127,12 +127,12 @@
  8055. * message related to LWORK is issued by XERBLA.
  8056. *
  8057. * IWORK (workspace) INTEGER array, dimension (LIWORK)
  8058. -* IF JOB = 'N' or 'E', IWORK is not referenced.
  8059. +* On exit, if INFO = 0, IWORK(1) returns the optimal LIWORK.
  8060. *
  8061. * LIWORK (input) INTEGER
  8062. * The dimension of the array IWORK.
  8063. * If JOB = 'N' or 'E', LIWORK >= 1;
  8064. -* if JOB = 'V' or 'B', LIWORK >= M*(N-M).
  8065. +* if JOB = 'V' or 'B', LIWORK >= max(1,M*(N-M)).
  8066. *
  8067. * If LIWORK = -1, then a workspace query is assumed; the
  8068. * routine only calculates the optimal size of the IWORK array,
  8069. diff -uNr LAPACK.orig/SRC/sbdsqr.f LAPACK/SRC/sbdsqr.f
  8070. --- LAPACK.orig/SRC/sbdsqr.f Thu Nov 4 14:25:42 1999
  8071. +++ LAPACK/SRC/sbdsqr.f Fri May 25 15:58:54 2001
  8072. @@ -4,7 +4,7 @@
  8073. * -- LAPACK routine (version 3.0) --
  8074. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  8075. * Courant Institute, Argonne National Lab, and Rice University
  8076. -* October 31, 1999
  8077. +* April 25, 2001
  8078. *
  8079. * .. Scalar Arguments ..
  8080. CHARACTER UPLO
  8081. @@ -18,14 +18,26 @@
  8082. * Purpose
  8083. * =======
  8084. *
  8085. -* SBDSQR computes the singular value decomposition (SVD) of a real
  8086. -* N-by-N (upper or lower) bidiagonal matrix B: B = Q * S * P' (P'
  8087. -* denotes the transpose of P), where S is a diagonal matrix with
  8088. -* non-negative diagonal elements (the singular values of B), and Q
  8089. -* and P are orthogonal matrices.
  8090. -*
  8091. -* The routine computes S, and optionally computes U * Q, P' * VT,
  8092. -* or Q' * C, for given real input matrices U, VT, and C.
  8093. +* SBDSQR computes the singular values and, optionally, the right and/or
  8094. +* left singular vectors from the singular value decomposition (SVD) of
  8095. +* a real N-by-N (upper or lower) bidiagonal matrix B using the implicit
  8096. +* zero-shift QR algorithm. The SVD of B has the form
  8097. +*
  8098. +* B = Q * S * P**T
  8099. +*
  8100. +* where S is the diagonal matrix of singular values, Q is an orthogonal
  8101. +* matrix of left singular vectors, and P is an orthogonal matrix of
  8102. +* right singular vectors. If left singular vectors are requested, this
  8103. +* subroutine actually returns U*Q instead of Q, and, if right singular
  8104. +* vectors are requested, this subroutine returns P**T*VT instead of
  8105. +* P**T, for given real input matrices U and VT. When U and VT are the
  8106. +* orthogonal matrices that reduce a general matrix A to bidiagonal
  8107. +* form: A = U*B*VT, as computed by SGEBRD, then
  8108. +*
  8109. +* A = (U*Q) * S * (P**T*VT)
  8110. +*
  8111. +* is the SVD of A. Optionally, the subroutine may also compute Q**T*C
  8112. +* for a given real input matrix C.
  8113. *
  8114. * See "Computing Small Singular Values of Bidiagonal Matrices With
  8115. * Guaranteed High Relative Accuracy," by J. Demmel and W. Kahan,
  8116. @@ -61,18 +73,17 @@
  8117. * order.
  8118. *
  8119. * E (input/output) REAL array, dimension (N)
  8120. -* On entry, the elements of E contain the
  8121. -* offdiagonal elements of the bidiagonal matrix whose SVD
  8122. -* is desired. On normal exit (INFO = 0), E is destroyed.
  8123. -* If the algorithm does not converge (INFO > 0), D and E
  8124. +* On entry, the N-1 offdiagonal elements of the bidiagonal
  8125. +* matrix B.
  8126. +* On exit, if INFO = 0, E is destroyed; if INFO > 0, D and E
  8127. * will contain the diagonal and superdiagonal elements of a
  8128. * bidiagonal matrix orthogonally equivalent to the one given
  8129. * as input. E(N) is used for workspace.
  8130. *
  8131. * VT (input/output) REAL array, dimension (LDVT, NCVT)
  8132. * On entry, an N-by-NCVT matrix VT.
  8133. -* On exit, VT is overwritten by P' * VT.
  8134. -* VT is not referenced if NCVT = 0.
  8135. +* On exit, VT is overwritten by P**T * VT.
  8136. +* Not referenced if NCVT = 0.
  8137. *
  8138. * LDVT (input) INTEGER
  8139. * The leading dimension of the array VT.
  8140. @@ -81,21 +92,22 @@
  8141. * U (input/output) REAL array, dimension (LDU, N)
  8142. * On entry, an NRU-by-N matrix U.
  8143. * On exit, U is overwritten by U * Q.
  8144. -* U is not referenced if NRU = 0.
  8145. +* Not referenced if NRU = 0.
  8146. *
  8147. * LDU (input) INTEGER
  8148. * The leading dimension of the array U. LDU >= max(1,NRU).
  8149. *
  8150. * C (input/output) REAL array, dimension (LDC, NCC)
  8151. * On entry, an N-by-NCC matrix C.
  8152. -* On exit, C is overwritten by Q' * C.
  8153. -* C is not referenced if NCC = 0.
  8154. +* On exit, C is overwritten by Q**T * C.
  8155. +* Not referenced if NCC = 0.
  8156. *
  8157. * LDC (input) INTEGER
  8158. * The leading dimension of the array C.
  8159. * LDC >= max(1,N) if NCC > 0; LDC >=1 if NCC = 0.
  8160. *
  8161. -* WORK (workspace) REAL array, dimension (4*N)
  8162. +* WORK (workspace) REAL array, dimension (2*N)
  8163. +* if NCVT = NRU = NCC = 0, (max(1, 4*N-4)) otherwise
  8164. *
  8165. * INFO (output) INTEGER
  8166. * = 0: successful exit
  8167. diff -uNr LAPACK.orig/SRC/sgebd2.f LAPACK/SRC/sgebd2.f
  8168. --- LAPACK.orig/SRC/sgebd2.f Thu Nov 4 14:23:33 1999
  8169. +++ LAPACK/SRC/sgebd2.f Fri May 25 15:59:24 2001
  8170. @@ -3,7 +3,7 @@
  8171. * -- LAPACK routine (version 3.0) --
  8172. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  8173. * Courant Institute, Argonne National Lab, and Rice University
  8174. -* February 29, 1992
  8175. +* May 7, 2001
  8176. *
  8177. * .. Scalar Arguments ..
  8178. INTEGER INFO, LDA, M, N
  8179. @@ -169,8 +169,9 @@
  8180. *
  8181. * Apply H(i) to A(i:m,i+1:n) from the left
  8182. *
  8183. - CALL SLARF( 'Left', M-I+1, N-I, A( I, I ), 1, TAUQ( I ),
  8184. - $ A( I, I+1 ), LDA, WORK )
  8185. + IF( I.LT.N )
  8186. + $ CALL SLARF( 'Left', M-I+1, N-I, A( I, I ), 1, TAUQ( I ),
  8187. + $ A( I, I+1 ), LDA, WORK )
  8188. A( I, I ) = D( I )
  8189. *
  8190. IF( I.LT.N ) THEN
  8191. @@ -207,8 +208,9 @@
  8192. *
  8193. * Apply G(i) to A(i+1:m,i:n) from the right
  8194. *
  8195. - CALL SLARF( 'Right', M-I, N-I+1, A( I, I ), LDA, TAUP( I ),
  8196. - $ A( MIN( I+1, M ), I ), LDA, WORK )
  8197. + IF( I.LT.M )
  8198. + $ CALL SLARF( 'Right', M-I, N-I+1, A( I, I ), LDA,
  8199. + $ TAUP( I ), A( MIN( I+1, M ), I ), LDA, WORK )
  8200. A( I, I ) = D( I )
  8201. *
  8202. IF( I.LT.M ) THEN
  8203. diff -uNr LAPACK.orig/SRC/sgees.f LAPACK/SRC/sgees.f
  8204. --- LAPACK.orig/SRC/sgees.f Thu Nov 4 14:23:33 1999
  8205. +++ LAPACK/SRC/sgees.f Fri May 25 15:59:45 2001
  8206. @@ -5,6 +5,7 @@
  8207. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  8208. * Courant Institute, Argonne National Lab, and Rice University
  8209. * June 30, 1999
  8210. +* 8-15-00: Improve consistency of WS calculations (eca)
  8211. *
  8212. * .. Scalar Arguments ..
  8213. CHARACTER JOBVS, SORT
  8214. @@ -110,10 +111,9 @@
  8215. * The dimension of the array WORK. LWORK >= max(1,3*N).
  8216. * For good performance, LWORK must generally be larger.
  8217. *
  8218. -* If LWORK = -1, then a workspace query is assumed; the routine
  8219. -* only calculates the optimal size of the WORK array, returns
  8220. -* this value as the first entry of the WORK array, and no error
  8221. -* message related to LWORK is issued by XERBLA.
  8222. +* If LWORK = -1, a workspace query is assumed. The optimal
  8223. +* size for the WORK array is calculated and stored in WORK(1),
  8224. +* and no other work except argument checking is performed.
  8225. *
  8226. * BWORK (workspace) LOGICAL array, dimension (N)
  8227. * Not referenced if SORT = 'N'.
  8228. @@ -138,12 +138,13 @@
  8229. * =====================================================================
  8230. *
  8231. * .. Parameters ..
  8232. + INTEGER LQUERV
  8233. + PARAMETER ( LQUERV = -1 )
  8234. REAL ZERO, ONE
  8235. PARAMETER ( ZERO = 0.0E0, ONE = 1.0E0 )
  8236. * ..
  8237. * .. Local Scalars ..
  8238. - LOGICAL CURSL, LASTSL, LQUERY, LST2SL, SCALEA, WANTST,
  8239. - $ WANTVS
  8240. + LOGICAL CURSL, LASTSL, LST2SL, SCALEA, WANTST, WANTVS
  8241. INTEGER HSWORK, I, I1, I2, IBAL, ICOND, IERR, IEVAL,
  8242. $ IHI, ILO, INXT, IP, ITAU, IWRK, K, MAXB,
  8243. $ MAXWRK, MINWRK
  8244. @@ -171,7 +172,6 @@
  8245. * Test the input arguments
  8246. *
  8247. INFO = 0
  8248. - LQUERY = ( LWORK.EQ.-1 )
  8249. WANTVS = LSAME( JOBVS, 'V' )
  8250. WANTST = LSAME( SORT, 'S' )
  8251. IF( ( .NOT.WANTVS ) .AND. ( .NOT.LSAME( JOBVS, 'N' ) ) ) THEN
  8252. @@ -197,7 +197,7 @@
  8253. * the worst case.)
  8254. *
  8255. MINWRK = 1
  8256. - IF( INFO.EQ.0 .AND. ( LWORK.GE.1 .OR. LQUERY ) ) THEN
  8257. + IF( INFO.EQ.0 ) THEN
  8258. MAXWRK = 2*N + N*ILAENV( 1, 'SGEHRD', ' ', N, 1, N, 0 )
  8259. MINWRK = MAX( 1, 3*N )
  8260. IF( .NOT.WANTVS ) THEN
  8261. @@ -216,19 +216,17 @@
  8262. MAXWRK = MAX( MAXWRK, N+HSWORK, 1 )
  8263. END IF
  8264. WORK( 1 ) = MAXWRK
  8265. + IF( LWORK.LT.MINWRK .AND. LWORK.NE.LQUERV )
  8266. + $ INFO = -13
  8267. END IF
  8268. - IF( LWORK.LT.MINWRK .AND. .NOT.LQUERY ) THEN
  8269. - INFO = -13
  8270. - END IF
  8271. +*
  8272. +* Quick returns
  8273. +*
  8274. IF( INFO.NE.0 ) THEN
  8275. CALL XERBLA( 'SGEES ', -INFO )
  8276. RETURN
  8277. - ELSE IF( LQUERY ) THEN
  8278. - RETURN
  8279. END IF
  8280. -*
  8281. -* Quick return if possible
  8282. -*
  8283. + IF( LWORK.EQ.LQUERV ) RETURN
  8284. IF( N.EQ.0 ) THEN
  8285. SDIM = 0
  8286. RETURN
  8287. diff -uNr LAPACK.orig/SRC/sgeesx.f LAPACK/SRC/sgeesx.f
  8288. --- LAPACK.orig/SRC/sgeesx.f Thu Nov 4 14:23:34 1999
  8289. +++ LAPACK/SRC/sgeesx.f Fri May 25 16:00:09 2001
  8290. @@ -6,6 +6,7 @@
  8291. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  8292. * Courant Institute, Argonne National Lab, and Rice University
  8293. * June 30, 1999
  8294. +* 8-15-00: Do WS calculations if LWORK = -1 (eca)
  8295. *
  8296. * .. Scalar Arguments ..
  8297. CHARACTER JOBVS, SENSE, SORT
  8298. @@ -140,6 +141,10 @@
  8299. * N+2*SDIM*(N-SDIM) <= N+N*N/2.
  8300. * For good performance, LWORK must generally be larger.
  8301. *
  8302. +* If LWORK = -1, a workspace query is assumed. The optimal
  8303. +* size for the WORK array is calculated and stored in WORK(1),
  8304. +* and no other work except argument checking is performed.
  8305. +*
  8306. * IWORK (workspace/output) INTEGER array, dimension (LIWORK)
  8307. * Not referenced if SENSE = 'N' or 'E'.
  8308. * On exit, if INFO = 0, IWORK(1) returns the optimal LIWORK.
  8309. @@ -171,6 +176,8 @@
  8310. * =====================================================================
  8311. *
  8312. * .. Parameters ..
  8313. + INTEGER LQUERV
  8314. + PARAMETER ( LQUERV = -1 )
  8315. REAL ZERO, ONE
  8316. PARAMETER ( ZERO = 0.0E0, ONE = 1.0E0 )
  8317. * ..
  8318. @@ -239,7 +246,7 @@
  8319. * in the code.)
  8320. *
  8321. MINWRK = 1
  8322. - IF( INFO.EQ.0 .AND. LWORK.GE.1 ) THEN
  8323. + IF( INFO.EQ.0 ) THEN
  8324. MAXWRK = 2*N + N*ILAENV( 1, 'SGEHRD', ' ', N, 1, N, 0 )
  8325. MINWRK = MAX( 1, 3*N )
  8326. IF( .NOT.WANTVS ) THEN
  8327. @@ -257,21 +264,24 @@
  8328. HSWORK = MAX( K*( K+2 ), 2*N )
  8329. MAXWRK = MAX( MAXWRK, N+HSWORK, 1 )
  8330. END IF
  8331. +*
  8332. +* Estimate the workspace needed by STRSEN.
  8333. +*
  8334. + IF( WANTST ) THEN
  8335. + MAXWRK = MAX( MAXWRK, N+(N*N+1)/2 )
  8336. + END IF
  8337. WORK( 1 ) = MAXWRK
  8338. + IF( LWORK.LT.MINWRK .AND. LWORK.NE.LQUERV )
  8339. + $ INFO = -16
  8340. END IF
  8341. - IF( LWORK.LT.MINWRK ) THEN
  8342. - INFO = -16
  8343. - END IF
  8344. - IF( LIWORK.LT.1 ) THEN
  8345. - INFO = -18
  8346. - END IF
  8347. +*
  8348. +* Quick returns
  8349. +*
  8350. IF( INFO.NE.0 ) THEN
  8351. CALL XERBLA( 'SGEESX', -INFO )
  8352. RETURN
  8353. END IF
  8354. -*
  8355. -* Quick return if possible
  8356. -*
  8357. + IF( LWORK.EQ.LQUERV ) RETURN
  8358. IF( N.EQ.0 ) THEN
  8359. SDIM = 0
  8360. RETURN
  8361. diff -uNr LAPACK.orig/SRC/sgeev.f LAPACK/SRC/sgeev.f
  8362. --- LAPACK.orig/SRC/sgeev.f Wed Dec 8 16:00:09 1999
  8363. +++ LAPACK/SRC/sgeev.f Fri May 25 16:00:38 2001
  8364. @@ -4,7 +4,8 @@
  8365. * -- LAPACK driver routine (version 3.0) --
  8366. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  8367. * Courant Institute, Argonne National Lab, and Rice University
  8368. -* December 8, 1999
  8369. +* June 30, 1999
  8370. +* 8-15-00: Improve consistency of WS calculations (eca)
  8371. *
  8372. * .. Scalar Arguments ..
  8373. CHARACTER JOBVL, JOBVR
  8374. @@ -98,10 +99,9 @@
  8375. * if JOBVL = 'V' or JOBVR = 'V', LWORK >= 4*N. For good
  8376. * performance, LWORK must generally be larger.
  8377. *
  8378. -* If LWORK = -1, then a workspace query is assumed; the routine
  8379. -* only calculates the optimal size of the WORK array, returns
  8380. -* this value as the first entry of the WORK array, and no error
  8381. -* message related to LWORK is issued by XERBLA.
  8382. +* If LWORK = -1, a workspace query is assumed. The optimal
  8383. +* size for the WORK array is calculated and stored in WORK(1),
  8384. +* and no other work except argument checking is performed.
  8385. *
  8386. * INFO (output) INTEGER
  8387. * = 0: successful exit
  8388. @@ -114,11 +114,13 @@
  8389. * =====================================================================
  8390. *
  8391. * .. Parameters ..
  8392. + INTEGER LQUERV
  8393. + PARAMETER ( LQUERV = -1 )
  8394. REAL ZERO, ONE
  8395. PARAMETER ( ZERO = 0.0E0, ONE = 1.0E0 )
  8396. * ..
  8397. * .. Local Scalars ..
  8398. - LOGICAL LQUERY, SCALEA, WANTVL, WANTVR
  8399. + LOGICAL SCALEA, WANTVL, WANTVR
  8400. CHARACTER SIDE
  8401. INTEGER HSWORK, I, IBAL, IERR, IHI, ILO, ITAU, IWRK, K,
  8402. $ MAXB, MAXWRK, MINWRK, NOUT
  8403. @@ -149,7 +151,6 @@
  8404. * Test the input arguments
  8405. *
  8406. INFO = 0
  8407. - LQUERY = ( LWORK.EQ.-1 )
  8408. WANTVL = LSAME( JOBVL, 'V' )
  8409. WANTVR = LSAME( JOBVR, 'V' )
  8410. IF( ( .NOT.WANTVL ) .AND. ( .NOT.LSAME( JOBVL, 'N' ) ) ) THEN
  8411. @@ -177,7 +178,7 @@
  8412. * the worst case.)
  8413. *
  8414. MINWRK = 1
  8415. - IF( INFO.EQ.0 .AND. ( LWORK.GE.1 .OR. LQUERY ) ) THEN
  8416. + IF( INFO.EQ.0 ) THEN
  8417. MAXWRK = 2*N + N*ILAENV( 1, 'SGEHRD', ' ', N, 1, N, 0 )
  8418. IF( ( .NOT.WANTVL ) .AND. ( .NOT.WANTVR ) ) THEN
  8419. MINWRK = MAX( 1, 3*N )
  8420. @@ -198,19 +199,17 @@
  8421. MAXWRK = MAX( MAXWRK, 4*N )
  8422. END IF
  8423. WORK( 1 ) = MAXWRK
  8424. + IF( LWORK.LT.MINWRK .AND. LWORK.NE.LQUERV )
  8425. + $ INFO = -13
  8426. END IF
  8427. - IF( LWORK.LT.MINWRK .AND. .NOT.LQUERY ) THEN
  8428. - INFO = -13
  8429. - END IF
  8430. +*
  8431. +* Quick returns
  8432. +*
  8433. IF( INFO.NE.0 ) THEN
  8434. CALL XERBLA( 'SGEEV ', -INFO )
  8435. RETURN
  8436. - ELSE IF( LQUERY ) THEN
  8437. - RETURN
  8438. END IF
  8439. -*
  8440. -* Quick return if possible
  8441. -*
  8442. + IF( LWORK.EQ.LQUERV ) RETURN
  8443. IF( N.EQ.0 )
  8444. $ RETURN
  8445. *
  8446. diff -uNr LAPACK.orig/SRC/sgeevx.f LAPACK/SRC/sgeevx.f
  8447. --- LAPACK.orig/SRC/sgeevx.f Thu Nov 4 14:23:34 1999
  8448. +++ LAPACK/SRC/sgeevx.f Fri May 25 16:00:59 2001
  8449. @@ -6,6 +6,7 @@
  8450. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  8451. * Courant Institute, Argonne National Lab, and Rice University
  8452. * June 30, 1999
  8453. +* 8-15-00: Improve consistency of WS calculations (eca)
  8454. *
  8455. * .. Scalar Arguments ..
  8456. CHARACTER BALANC, JOBVL, JOBVR, SENSE
  8457. @@ -179,10 +180,9 @@
  8458. * LWORK >= 3*N. If SENSE = 'V' or 'B', LWORK >= N*(N+6).
  8459. * For good performance, LWORK must generally be larger.
  8460. *
  8461. -* If LWORK = -1, then a workspace query is assumed; the routine
  8462. -* only calculates the optimal size of the WORK array, returns
  8463. -* this value as the first entry of the WORK array, and no error
  8464. -* message related to LWORK is issued by XERBLA.
  8465. +* If LWORK = -1, a workspace query is assumed. The optimal
  8466. +* size for the WORK array is calculated and stored in WORK(1),
  8467. +* and no other work except argument checking is performed.
  8468. *
  8469. * IWORK (workspace) INTEGER array, dimension (2*N-2)
  8470. * If SENSE = 'N' or 'E', not referenced.
  8471. @@ -198,12 +198,14 @@
  8472. * =====================================================================
  8473. *
  8474. * .. Parameters ..
  8475. + INTEGER LQUERV
  8476. + PARAMETER ( LQUERV = -1 )
  8477. REAL ZERO, ONE
  8478. PARAMETER ( ZERO = 0.0E0, ONE = 1.0E0 )
  8479. * ..
  8480. * .. Local Scalars ..
  8481. - LOGICAL LQUERY, SCALEA, WANTVL, WANTVR, WNTSNB, WNTSNE,
  8482. - $ WNTSNN, WNTSNV
  8483. + LOGICAL SCALEA, WANTVL, WANTVR, WNTSNB, WNTSNE, WNTSNN,
  8484. + $ WNTSNV
  8485. CHARACTER JOB, SIDE
  8486. INTEGER HSWORK, I, ICOND, IERR, ITAU, IWRK, K, MAXB,
  8487. $ MAXWRK, MINWRK, NOUT
  8488. @@ -234,7 +236,6 @@
  8489. * Test the input arguments
  8490. *
  8491. INFO = 0
  8492. - LQUERY = ( LWORK.EQ.-1 )
  8493. WANTVL = LSAME( JOBVL, 'V' )
  8494. WANTVR = LSAME( JOBVR, 'V' )
  8495. WNTSNN = LSAME( SENSE, 'N' )
  8496. @@ -273,7 +274,7 @@
  8497. * the worst case.)
  8498. *
  8499. MINWRK = 1
  8500. - IF( INFO.EQ.0 .AND. ( LWORK.GE.1 .OR. LQUERY ) ) THEN
  8501. + IF( INFO.EQ.0 ) THEN
  8502. MAXWRK = N + N*ILAENV( 1, 'SGEHRD', ' ', N, 1, N, 0 )
  8503. IF( ( .NOT.WANTVL ) .AND. ( .NOT.WANTVR ) ) THEN
  8504. MINWRK = MAX( 1, 2*N )
  8505. @@ -307,19 +308,17 @@
  8506. MAXWRK = MAX( MAXWRK, 3*N, 1 )
  8507. END IF
  8508. WORK( 1 ) = MAXWRK
  8509. + IF( LWORK.LT.MINWRK .AND. LWORK.NE.LQUERV )
  8510. + $ INFO = -21
  8511. END IF
  8512. - IF( LWORK.LT.MINWRK .AND. .NOT.LQUERY ) THEN
  8513. - INFO = -21
  8514. - END IF
  8515. +*
  8516. +* Quick returns
  8517. +*
  8518. IF( INFO.NE.0 ) THEN
  8519. CALL XERBLA( 'SGEEVX', -INFO )
  8520. RETURN
  8521. - ELSE IF( LQUERY ) THEN
  8522. - RETURN
  8523. END IF
  8524. -*
  8525. -* Quick return if possible
  8526. -*
  8527. + IF( LWORK.EQ.LQUERV ) RETURN
  8528. IF( N.EQ.0 )
  8529. $ RETURN
  8530. *
  8531. diff -uNr LAPACK.orig/SRC/sgegs.f LAPACK/SRC/sgegs.f
  8532. --- LAPACK.orig/SRC/sgegs.f Thu Nov 4 14:23:34 1999
  8533. +++ LAPACK/SRC/sgegs.f Fri May 25 16:01:48 2001
  8534. @@ -5,7 +5,7 @@
  8535. * -- LAPACK driver routine (version 3.0) --
  8536. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  8537. * Courant Institute, Argonne National Lab, and Rice University
  8538. -* June 30, 1999
  8539. +* April 26, 2001
  8540. *
  8541. * .. Scalar Arguments ..
  8542. CHARACTER JOBVSL, JOBVSR
  8543. @@ -22,105 +22,75 @@
  8544. *
  8545. * This routine is deprecated and has been replaced by routine SGGES.
  8546. *
  8547. -* SGEGS computes for a pair of N-by-N real nonsymmetric matrices A, B:
  8548. -* the generalized eigenvalues (alphar +/- alphai*i, beta), the real
  8549. -* Schur form (A, B), and optionally left and/or right Schur vectors
  8550. -* (VSL and VSR).
  8551. -*
  8552. -* (If only the generalized eigenvalues are needed, use the driver SGEGV
  8553. -* instead.)
  8554. -*
  8555. -* A generalized eigenvalue for a pair of matrices (A,B) is, roughly
  8556. -* speaking, a scalar w or a ratio alpha/beta = w, such that A - w*B
  8557. -* is singular. It is usually represented as the pair (alpha,beta),
  8558. -* as there is a reasonable interpretation for beta=0, and even for
  8559. -* both being zero. A good beginning reference is the book, "Matrix
  8560. -* Computations", by G. Golub & C. van Loan (Johns Hopkins U. Press)
  8561. -*
  8562. -* The (generalized) Schur form of a pair of matrices is the result of
  8563. -* multiplying both matrices on the left by one orthogonal matrix and
  8564. -* both on the right by another orthogonal matrix, these two orthogonal
  8565. -* matrices being chosen so as to bring the pair of matrices into
  8566. -* (real) Schur form.
  8567. -*
  8568. -* A pair of matrices A, B is in generalized real Schur form if B is
  8569. -* upper triangular with non-negative diagonal and A is block upper
  8570. -* triangular with 1-by-1 and 2-by-2 blocks. 1-by-1 blocks correspond
  8571. -* to real generalized eigenvalues, while 2-by-2 blocks of A will be
  8572. -* "standardized" by making the corresponding elements of B have the
  8573. -* form:
  8574. -* [ a 0 ]
  8575. -* [ 0 b ]
  8576. -*
  8577. -* and the pair of corresponding 2-by-2 blocks in A and B will
  8578. -* have a complex conjugate pair of generalized eigenvalues.
  8579. -*
  8580. -* The left and right Schur vectors are the columns of VSL and VSR,
  8581. -* respectively, where VSL and VSR are the orthogonal matrices
  8582. -* which reduce A and B to Schur form:
  8583. -*
  8584. -* Schur form of (A,B) = ( (VSL)**T A (VSR), (VSL)**T B (VSR) )
  8585. +* SGEGS computes the eigenvalues, real Schur form, and, optionally,
  8586. +* left and or/right Schur vectors of a real matrix pair (A,B).
  8587. +* Given two square matrices A and B, the generalized real Schur
  8588. +* factorization has the form
  8589. +*
  8590. +* A = Q*S*Z**T, B = Q*T*Z**T
  8591. +*
  8592. +* where Q and Z are orthogonal matrices, T is upper triangular, and S
  8593. +* is an upper quasi-triangular matrix with 1-by-1 and 2-by-2 diagonal
  8594. +* blocks, the 2-by-2 blocks corresponding to complex conjugate pairs
  8595. +* of eigenvalues of (A,B). The columns of Q are the left Schur vectors
  8596. +* and the columns of Z are the right Schur vectors.
  8597. +*
  8598. +* If only the eigenvalues of (A,B) are needed, the driver routine
  8599. +* SGEGV should be used instead. See SGEGV for a description of the
  8600. +* eigenvalues of the generalized nonsymmetric eigenvalue problem
  8601. +* (GNEP).
  8602. *
  8603. * Arguments
  8604. * =========
  8605. *
  8606. * JOBVSL (input) CHARACTER*1
  8607. * = 'N': do not compute the left Schur vectors;
  8608. -* = 'V': compute the left Schur vectors.
  8609. +* = 'V': compute the left Schur vectors (returned in VSL).
  8610. *
  8611. * JOBVSR (input) CHARACTER*1
  8612. * = 'N': do not compute the right Schur vectors;
  8613. -* = 'V': compute the right Schur vectors.
  8614. +* = 'V': compute the right Schur vectors (returned in VSR).
  8615. *
  8616. * N (input) INTEGER
  8617. * The order of the matrices A, B, VSL, and VSR. N >= 0.
  8618. *
  8619. * A (input/output) REAL array, dimension (LDA, N)
  8620. -* On entry, the first of the pair of matrices whose generalized
  8621. -* eigenvalues and (optionally) Schur vectors are to be
  8622. -* computed.
  8623. -* On exit, the generalized Schur form of A.
  8624. -* Note: to avoid overflow, the Frobenius norm of the matrix
  8625. -* A should be less than the overflow threshold.
  8626. +* On entry, the matrix A.
  8627. +* On exit, the upper quasi-triangular matrix S from the
  8628. +* generalized real Schur factorization.
  8629. *
  8630. * LDA (input) INTEGER
  8631. * The leading dimension of A. LDA >= max(1,N).
  8632. *
  8633. * B (input/output) REAL array, dimension (LDB, N)
  8634. -* On entry, the second of the pair of matrices whose
  8635. -* generalized eigenvalues and (optionally) Schur vectors are
  8636. -* to be computed.
  8637. -* On exit, the generalized Schur form of B.
  8638. -* Note: to avoid overflow, the Frobenius norm of the matrix
  8639. -* B should be less than the overflow threshold.
  8640. +* On entry, the matrix B.
  8641. +* On exit, the upper triangular matrix T from the generalized
  8642. +* real Schur factorization.
  8643. *
  8644. * LDB (input) INTEGER
  8645. * The leading dimension of B. LDB >= max(1,N).
  8646. *
  8647. * ALPHAR (output) REAL array, dimension (N)
  8648. +* The real parts of each scalar alpha defining an eigenvalue
  8649. +* of GNEP.
  8650. +*
  8651. * ALPHAI (output) REAL array, dimension (N)
  8652. -* BETA (output) REAL array, dimension (N)
  8653. -* On exit, (ALPHAR(j) + ALPHAI(j)*i)/BETA(j), j=1,...,N, will
  8654. -* be the generalized eigenvalues. ALPHAR(j) + ALPHAI(j)*i,
  8655. -* j=1,...,N and BETA(j),j=1,...,N are the diagonals of the
  8656. -* complex Schur form (A,B) that would result if the 2-by-2
  8657. -* diagonal blocks of the real Schur form of (A,B) were further
  8658. -* reduced to triangular form using 2-by-2 complex unitary
  8659. -* transformations. If ALPHAI(j) is zero, then the j-th
  8660. +* The imaginary parts of each scalar alpha defining an
  8661. +* eigenvalue of GNEP. If ALPHAI(j) is zero, then the j-th
  8662. * eigenvalue is real; if positive, then the j-th and (j+1)-st
  8663. -* eigenvalues are a complex conjugate pair, with ALPHAI(j+1)
  8664. -* negative.
  8665. +* eigenvalues are a complex conjugate pair, with
  8666. +* ALPHAI(j+1) = -ALPHAI(j).
  8667. *
  8668. -* Note: the quotients ALPHAR(j)/BETA(j) and ALPHAI(j)/BETA(j)
  8669. -* may easily over- or underflow, and BETA(j) may even be zero.
  8670. -* Thus, the user should avoid naively computing the ratio
  8671. -* alpha/beta. However, ALPHAR and ALPHAI will be always less
  8672. -* than and usually comparable with norm(A) in magnitude, and
  8673. -* BETA always less than and usually comparable with norm(B).
  8674. +* BETA (output) REAL array, dimension (N)
  8675. +* The scalars beta that define the eigenvalues of GNEP.
  8676. +* Together, the quantities alpha = (ALPHAR(j),ALPHAI(j)) and
  8677. +* beta = BETA(j) represent the j-th eigenvalue of the matrix
  8678. +* pair (A,B), in one of the forms lambda = alpha/beta or
  8679. +* mu = beta/alpha. Since either lambda or mu may overflow,
  8680. +* they should not, in general, be computed.
  8681. *
  8682. * VSL (output) REAL array, dimension (LDVSL,N)
  8683. -* If JOBVSL = 'V', VSL will contain the left Schur vectors.
  8684. -* (See "Purpose", above.)
  8685. +* If JOBVSL = 'V', the matrix of left Schur vectors Q.
  8686. * Not referenced if JOBVSL = 'N'.
  8687. *
  8688. * LDVSL (input) INTEGER
  8689. @@ -128,8 +98,7 @@
  8690. * if JOBVSL = 'V', LDVSL >= N.
  8691. *
  8692. * VSR (output) REAL array, dimension (LDVSR,N)
  8693. -* If JOBVSR = 'V', VSR will contain the right Schur vectors.
  8694. -* (See "Purpose", above.)
  8695. +* If JOBVSR = 'V', the matrix of right Schur vectors Z.
  8696. * Not referenced if JOBVSR = 'N'.
  8697. *
  8698. * LDVSR (input) INTEGER
  8699. diff -uNr LAPACK.orig/SRC/sgegv.f LAPACK/SRC/sgegv.f
  8700. --- LAPACK.orig/SRC/sgegv.f Thu Nov 4 14:25:42 1999
  8701. +++ LAPACK/SRC/sgegv.f Fri May 25 16:02:12 2001
  8702. @@ -4,7 +4,7 @@
  8703. * -- LAPACK driver routine (version 3.0) --
  8704. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  8705. * Courant Institute, Argonne National Lab, and Rice University
  8706. -* June 30, 1999
  8707. +* April 26, 2001
  8708. *
  8709. * .. Scalar Arguments ..
  8710. CHARACTER JOBVL, JOBVR
  8711. @@ -21,23 +21,32 @@
  8712. *
  8713. * This routine is deprecated and has been replaced by routine SGGEV.
  8714. *
  8715. -* SGEGV computes for a pair of n-by-n real nonsymmetric matrices A and
  8716. -* B, the generalized eigenvalues (alphar +/- alphai*i, beta), and
  8717. -* optionally, the left and/or right generalized eigenvectors (VL and
  8718. -* VR).
  8719. -*
  8720. -* A generalized eigenvalue for a pair of matrices (A,B) is, roughly
  8721. -* speaking, a scalar w or a ratio alpha/beta = w, such that A - w*B
  8722. -* is singular. It is usually represented as the pair (alpha,beta),
  8723. -* as there is a reasonable interpretation for beta=0, and even for
  8724. -* both being zero. A good beginning reference is the book, "Matrix
  8725. -* Computations", by G. Golub & C. van Loan (Johns Hopkins U. Press)
  8726. -*
  8727. -* A right generalized eigenvector corresponding to a generalized
  8728. -* eigenvalue w for a pair of matrices (A,B) is a vector r such
  8729. -* that (A - w B) r = 0 . A left generalized eigenvector is a vector
  8730. -* l such that l**H * (A - w B) = 0, where l**H is the
  8731. -* conjugate-transpose of l.
  8732. +* SGEGV computes the eigenvalues and, optionally, the left and/or right
  8733. +* eigenvectors of a real matrix pair (A,B).
  8734. +* Given two square matrices A and B,
  8735. +* the generalized nonsymmetric eigenvalue problem (GNEP) is to find the
  8736. +* eigenvalues lambda and corresponding (non-zero) eigenvectors x such
  8737. +* that
  8738. +*
  8739. +* A*x = lambda*B*x.
  8740. +*
  8741. +* An alternate form is to find the eigenvalues mu and corresponding
  8742. +* eigenvectors y such that
  8743. +*
  8744. +* mu*A*y = B*y.
  8745. +*
  8746. +* These two forms are equivalent with mu = 1/lambda and x = y if
  8747. +* neither lambda nor mu is zero. In order to deal with the case that
  8748. +* lambda or mu is zero or small, two values alpha and beta are returned
  8749. +* for each eigenvalue, such that lambda = alpha/beta and
  8750. +* mu = beta/alpha.
  8751. +*
  8752. +* The vectors x and y in the above equations are right eigenvectors of
  8753. +* the matrix pair (A,B). Vectors u and v satisfying
  8754. +*
  8755. +* u**H*A = lambda*u**H*B or mu*v**H*A = v**H*B
  8756. +*
  8757. +* are left eigenvectors of (A,B).
  8758. *
  8759. * Note: this routine performs "full balancing" on A and B -- see
  8760. * "Further Details", below.
  8761. @@ -47,63 +56,75 @@
  8762. *
  8763. * JOBVL (input) CHARACTER*1
  8764. * = 'N': do not compute the left generalized eigenvectors;
  8765. -* = 'V': compute the left generalized eigenvectors.
  8766. +* = 'V': compute the left generalized eigenvectors (returned
  8767. +* in VL).
  8768. *
  8769. * JOBVR (input) CHARACTER*1
  8770. * = 'N': do not compute the right generalized eigenvectors;
  8771. -* = 'V': compute the right generalized eigenvectors.
  8772. +* = 'V': compute the right generalized eigenvectors (returned
  8773. +* in VR).
  8774. *
  8775. * N (input) INTEGER
  8776. * The order of the matrices A, B, VL, and VR. N >= 0.
  8777. *
  8778. * A (input/output) REAL array, dimension (LDA, N)
  8779. -* On entry, the first of the pair of matrices whose
  8780. -* generalized eigenvalues and (optionally) generalized
  8781. -* eigenvectors are to be computed.
  8782. -* On exit, the contents will have been destroyed. (For a
  8783. -* description of the contents of A on exit, see "Further
  8784. -* Details", below.)
  8785. +* On entry, the matrix A.
  8786. +* If JOBVL = 'V' or JOBVR = 'V', then on exit A
  8787. +* contains the real Schur form of A from the generalized Schur
  8788. +* factorization of the pair (A,B) after balancing.
  8789. +* If no eigenvectors were computed, then only the diagonal
  8790. +* blocks from the Schur form will be correct. See SGGHRD and
  8791. +* SHGEQZ for details.
  8792. *
  8793. * LDA (input) INTEGER
  8794. * The leading dimension of A. LDA >= max(1,N).
  8795. *
  8796. * B (input/output) REAL array, dimension (LDB, N)
  8797. -* On entry, the second of the pair of matrices whose
  8798. -* generalized eigenvalues and (optionally) generalized
  8799. -* eigenvectors are to be computed.
  8800. -* On exit, the contents will have been destroyed. (For a
  8801. -* description of the contents of B on exit, see "Further
  8802. -* Details", below.)
  8803. +* On entry, the matrix B.
  8804. +* If JOBVL = 'V' or JOBVR = 'V', then on exit B contains the
  8805. +* upper triangular matrix obtained from B in the generalized
  8806. +* Schur factorization of the pair (A,B) after balancing.
  8807. +* If no eigenvectors were computed, then only those elements of
  8808. +* B corresponding to the diagonal blocks from the Schur form of
  8809. +* A will be correct. See SGGHRD and SHGEQZ for details.
  8810. *
  8811. * LDB (input) INTEGER
  8812. * The leading dimension of B. LDB >= max(1,N).
  8813. *
  8814. * ALPHAR (output) REAL array, dimension (N)
  8815. +* The real parts of each scalar alpha defining an eigenvalue of
  8816. +* GNEP.
  8817. +*
  8818. * ALPHAI (output) REAL array, dimension (N)
  8819. -* BETA (output) REAL array, dimension (N)
  8820. -* On exit, (ALPHAR(j) + ALPHAI(j)*i)/BETA(j), j=1,...,N, will
  8821. -* be the generalized eigenvalues. If ALPHAI(j) is zero, then
  8822. -* the j-th eigenvalue is real; if positive, then the j-th and
  8823. +* The imaginary parts of each scalar alpha defining an
  8824. +* eigenvalue of GNEP. If ALPHAI(j) is zero, then the j-th
  8825. +* eigenvalue is real; if positive, then the j-th and
  8826. * (j+1)-st eigenvalues are a complex conjugate pair, with
  8827. -* ALPHAI(j+1) negative.
  8828. +* ALPHAI(j+1) = -ALPHAI(j).
  8829. *
  8830. -* Note: the quotients ALPHAR(j)/BETA(j) and ALPHAI(j)/BETA(j)
  8831. -* may easily over- or underflow, and BETA(j) may even be zero.
  8832. -* Thus, the user should avoid naively computing the ratio
  8833. -* alpha/beta. However, ALPHAR and ALPHAI will be always less
  8834. -* than and usually comparable with norm(A) in magnitude, and
  8835. -* BETA always less than and usually comparable with norm(B).
  8836. +* BETA (output) REAL array, dimension (N)
  8837. +* The scalars beta that define the eigenvalues of GNEP.
  8838. +*
  8839. +* Together, the quantities alpha = (ALPHAR(j),ALPHAI(j)) and
  8840. +* beta = BETA(j) represent the j-th eigenvalue of the matrix
  8841. +* pair (A,B), in one of the forms lambda = alpha/beta or
  8842. +* mu = beta/alpha. Since either lambda or mu may overflow,
  8843. +* they should not, in general, be computed.
  8844. *
  8845. * VL (output) REAL array, dimension (LDVL,N)
  8846. -* If JOBVL = 'V', the left generalized eigenvectors. (See
  8847. -* "Purpose", above.) Real eigenvectors take one column,
  8848. -* complex take two columns, the first for the real part and
  8849. -* the second for the imaginary part. Complex eigenvectors
  8850. -* correspond to an eigenvalue with positive imaginary part.
  8851. -* Each eigenvector will be scaled so the largest component
  8852. -* will have abs(real part) + abs(imag. part) = 1, *except*
  8853. -* that for eigenvalues with alpha=beta=0, a zero vector will
  8854. -* be returned as the corresponding eigenvector.
  8855. +* If JOBVL = 'V', the left eigenvectors u(j) are stored
  8856. +* in the columns of VL, in the same order as their eigenvalues.
  8857. +* If the j-th eigenvalue is real, then u(j) = VL(:,j).
  8858. +* If the j-th and (j+1)-st eigenvalues form a complex conjugate
  8859. +* pair, then
  8860. +* u(j) = VL(:,j) + i*VL(:,j+1)
  8861. +* and
  8862. +* u(j+1) = VL(:,j) - i*VL(:,j+1).
  8863. +*
  8864. +* Each eigenvector is scaled so that its largest component has
  8865. +* abs(real part) + abs(imag. part) = 1, except for eigenvectors
  8866. +* corresponding to an eigenvalue with alpha = beta = 0, which
  8867. +* are set to zero.
  8868. * Not referenced if JOBVL = 'N'.
  8869. *
  8870. * LDVL (input) INTEGER
  8871. @@ -111,15 +132,19 @@
  8872. * if JOBVL = 'V', LDVL >= N.
  8873. *
  8874. * VR (output) REAL array, dimension (LDVR,N)
  8875. -* If JOBVR = 'V', the right generalized eigenvectors. (See
  8876. -* "Purpose", above.) Real eigenvectors take one column,
  8877. -* complex take two columns, the first for the real part and
  8878. -* the second for the imaginary part. Complex eigenvectors
  8879. -* correspond to an eigenvalue with positive imaginary part.
  8880. -* Each eigenvector will be scaled so the largest component
  8881. -* will have abs(real part) + abs(imag. part) = 1, *except*
  8882. -* that for eigenvalues with alpha=beta=0, a zero vector will
  8883. -* be returned as the corresponding eigenvector.
  8884. +* If JOBVR = 'V', the right eigenvectors x(j) are stored
  8885. +* in the columns of VR, in the same order as their eigenvalues.
  8886. +* If the j-th eigenvalue is real, then x(j) = VR(:,j).
  8887. +* If the j-th and (j+1)-st eigenvalues form a complex conjugate
  8888. +* pair, then
  8889. +* x(j) = VR(:,j) + i*VR(:,j+1)
  8890. +* and
  8891. +* x(j+1) = VR(:,j) - i*VR(:,j+1).
  8892. +*
  8893. +* Each eigenvector is scaled so that its largest component has
  8894. +* abs(real part) + abs(imag. part) = 1, except for eigenvalues
  8895. +* corresponding to an eigenvalue with alpha = beta = 0, which
  8896. +* are set to zero.
  8897. * Not referenced if JOBVR = 'N'.
  8898. *
  8899. * LDVR (input) INTEGER
  8900. diff -uNr LAPACK.orig/SRC/sgelsd.f LAPACK/SRC/sgelsd.f
  8901. --- LAPACK.orig/SRC/sgelsd.f Thu Nov 4 14:26:24 1999
  8902. +++ LAPACK/SRC/sgelsd.f Fri May 25 16:03:05 2001
  8903. @@ -4,7 +4,8 @@
  8904. * -- LAPACK driver routine (version 3.0) --
  8905. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  8906. * Courant Institute, Argonne National Lab, and Rice University
  8907. -* October 31, 1999
  8908. +* June 30, 1999
  8909. +* 8-15-00: Improve consistency of WS calculations (eca)
  8910. *
  8911. * .. Scalar Arguments ..
  8912. INTEGER INFO, LDA, LDB, LWORK, M, N, NRHS, RANK
  8913. @@ -61,9 +62,10 @@
  8914. * The number of right hand sides, i.e., the number of columns
  8915. * of the matrices B and X. NRHS >= 0.
  8916. *
  8917. -* A (input) REAL array, dimension (LDA,N)
  8918. +* A (input/output) REAL array, dimension (LDA,N)
  8919. * On entry, the M-by-N matrix A.
  8920. -* On exit, A has been destroyed.
  8921. +* On exit, the first min(m,n) rows of A are overwritten with
  8922. +* its right singular vectors, stored rowwise.
  8923. *
  8924. * LDA (input) INTEGER
  8925. * The leading dimension of the array A. LDA >= max(1,M).
  8926. @@ -95,24 +97,20 @@
  8927. * On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
  8928. *
  8929. * LWORK (input) INTEGER
  8930. -* The dimension of the array WORK. LWORK must be at least 1.
  8931. +* The dimension of the array WORK. LWORK >= 1.
  8932. * The exact minimum amount of workspace needed depends on M,
  8933. -* N and NRHS. As long as LWORK is at least
  8934. -* 12*N + 2*N*SMLSIZ + 8*N*NLVL + N*NRHS + (SMLSIZ+1)**2,
  8935. -* if M is greater than or equal to N or
  8936. -* 12*M + 2*M*SMLSIZ + 8*M*NLVL + M*NRHS + (SMLSIZ+1)**2,
  8937. -* if M is less than N, the code will execute correctly.
  8938. +* N and NRHS.
  8939. +* If M >= N, LWORK >= 11*N + 2*N*SMLSIZ + 8*N*NLVL + N*NRHS.
  8940. +* If M < N, LWORK >= 11*M + 2*M*SMLSIZ + 8*M*NLVL + M*NRHS.
  8941. * SMLSIZ is returned by ILAENV and is equal to the maximum
  8942. * size of the subproblems at the bottom of the computation
  8943. * tree (usually about 25), and
  8944. -* NLVL = MAX( 0, INT( LOG_2( MIN( M,N )/(SMLSIZ+1) ) ) + 1 )
  8945. +* NLVL = INT( LOG_2( MIN( M,N )/(SMLSIZ+1) ) ) + 1
  8946. * For good performance, LWORK should generally be larger.
  8947. *
  8948. -* If LWORK = -1, then a workspace query is assumed; the routine
  8949. -* only calculates the optimal size of the WORK array, returns
  8950. -* this value as the first entry of the WORK array, and no error
  8951. -* message related to LWORK is issued by XERBLA.
  8952. -*
  8953. +* If LWORK = -1, a workspace query is assumed. The optimal
  8954. +* size for the WORK array is calculated and stored in WORK(1),
  8955. +* and no other work except argument checking is performed.
  8956. *
  8957. * IWORK (workspace) INTEGER array, dimension (LIWORK)
  8958. * LIWORK >= 3 * MINMN * NLVL + 11 * MINMN,
  8959. @@ -136,14 +134,15 @@
  8960. * =====================================================================
  8961. *
  8962. * .. Parameters ..
  8963. + INTEGER LQUERV
  8964. + PARAMETER ( LQUERV = -1 )
  8965. REAL ZERO, ONE, TWO
  8966. PARAMETER ( ZERO = 0.0E0, ONE = 1.0E0, TWO = 2.0E0 )
  8967. * ..
  8968. * .. Local Scalars ..
  8969. - LOGICAL LQUERY
  8970. INTEGER IASCL, IBSCL, IE, IL, ITAU, ITAUP, ITAUQ,
  8971. $ LDWORK, MAXMN, MAXWRK, MINMN, MINWRK, MM,
  8972. - $ MNTHR, NLVL, NWORK, SMLSIZ, WLALSD
  8973. + $ MNTHR, NLVL, NWORK, SMLSIZ
  8974. REAL ANRM, BIGNUM, BNRM, EPS, SFMIN, SMLNUM
  8975. * ..
  8976. * .. External Subroutines ..
  8977. @@ -166,7 +165,6 @@
  8978. MINMN = MIN( M, N )
  8979. MAXMN = MAX( M, N )
  8980. MNTHR = ILAENV( 6, 'SGELSD', ' ', M, N, NRHS, -1 )
  8981. - LQUERY = ( LWORK.EQ.-1 )
  8982. IF( M.LT.0 ) THEN
  8983. INFO = -1
  8984. ELSE IF( N.LT.0 ) THEN
  8985. @@ -190,8 +188,8 @@
  8986. *
  8987. MINWRK = 1
  8988. MINMN = MAX( 1, MINMN )
  8989. - NLVL = MAX( INT( LOG( REAL( MINMN ) / REAL( SMLSIZ+1 ) ) /
  8990. - $ LOG( TWO ) ) + 1, 0 )
  8991. + NLVL = INT( LOG( REAL( MINMN ) / REAL( SMLSIZ+1 ) ) /
  8992. + $ LOG( TWO ) ) + 1
  8993. *
  8994. IF( INFO.EQ.0 ) THEN
  8995. MAXWRK = 0
  8996. @@ -216,12 +214,11 @@
  8997. $ ILAENV( 1, 'SORMBR', 'QLT', MM, NRHS, N, -1 ) )
  8998. MAXWRK = MAX( MAXWRK, 3*N+( N-1 )*
  8999. $ ILAENV( 1, 'SORMBR', 'PLN', N, NRHS, N, -1 ) )
  9000. - WLALSD = 9*N+2*N*SMLSIZ+8*N*NLVL+N*NRHS+(SMLSIZ+1)**2
  9001. - MAXWRK = MAX( MAXWRK, 3*N+WLALSD )
  9002. - MINWRK = MAX( 3*N+MM, 3*N+NRHS, 3*N+WLALSD )
  9003. + MAXWRK = MAX( MAXWRK, 3*N+8*N+2*N*SMLSIZ+8*N*NLVL+N*NRHS )
  9004. + MINWRK = MAX( 3*N+MM, 3*N+NRHS,
  9005. + $ 3*N+8*N+2*N*SMLSIZ+8*N*NLVL+N*NRHS )
  9006. END IF
  9007. IF( N.GT.M ) THEN
  9008. - WLALSD = 9*M+2*M*SMLSIZ+8*M*NLVL+M*NRHS+(SMLSIZ+1)**2
  9009. IF( N.GE.MNTHR ) THEN
  9010. *
  9011. * Path 2a - underdetermined, with many more columns
  9012. @@ -241,7 +238,8 @@
  9013. END IF
  9014. MAXWRK = MAX( MAXWRK, M+NRHS*
  9015. $ ILAENV( 1, 'SORMLQ', 'LT', N, NRHS, M, -1 ) )
  9016. - MAXWRK = MAX( MAXWRK, M*M+4*M+WLALSD )
  9017. + MAXWRK = MAX( MAXWRK, M*M+4*M+8*M+2*M*SMLSIZ+8*M*NLVL+M*
  9018. + $ NRHS )
  9019. ELSE
  9020. *
  9021. * Path 2 - remaining underdetermined cases.
  9022. @@ -252,26 +250,25 @@
  9023. $ ILAENV( 1, 'SORMBR', 'QLT', M, NRHS, N, -1 ) )
  9024. MAXWRK = MAX( MAXWRK, 3*M+M*
  9025. $ ILAENV( 1, 'SORMBR', 'PLN', N, NRHS, M, -1 ) )
  9026. - MAXWRK = MAX( MAXWRK, 3*M+WLALSD )
  9027. + MAXWRK = MAX( MAXWRK, 3*M+8*M+2*M*SMLSIZ+8*M*NLVL+M*
  9028. + $ NRHS )
  9029. END IF
  9030. - MINWRK = MAX( 3*M+NRHS, 3*M+M, 3*M+WLALSD )
  9031. + MINWRK = MAX( 3*M+NRHS, 3*M+M,
  9032. + $ 3*M+8*M+2*M*SMLSIZ+8*M*NLVL+M*NRHS )
  9033. END IF
  9034. MINWRK = MIN( MINWRK, MAXWRK )
  9035. WORK( 1 ) = MAXWRK
  9036. - IF( LWORK.LT.MINWRK .AND. .NOT.LQUERY ) THEN
  9037. - INFO = -12
  9038. - END IF
  9039. + IF( LWORK.LT.MINWRK .AND. LWORK.NE.LQUERV )
  9040. + $ INFO = -12
  9041. END IF
  9042. *
  9043. +* Quick returns
  9044. +*
  9045. IF( INFO.NE.0 ) THEN
  9046. CALL XERBLA( 'SGELSD', -INFO )
  9047. RETURN
  9048. - ELSE IF( LQUERY ) THEN
  9049. - GO TO 10
  9050. END IF
  9051. -*
  9052. -* Quick return if possible.
  9053. -*
  9054. + IF( LWORK.EQ.LQUERV ) RETURN
  9055. IF( M.EQ.0 .OR. N.EQ.0 ) THEN
  9056. RANK = 0
  9057. RETURN
  9058. diff -uNr LAPACK.orig/SRC/sgelss.f LAPACK/SRC/sgelss.f
  9059. --- LAPACK.orig/SRC/sgelss.f Thu Nov 4 14:23:34 1999
  9060. +++ LAPACK/SRC/sgelss.f Fri May 25 16:03:41 2001
  9061. @@ -4,7 +4,7 @@
  9062. * -- LAPACK driver routine (version 3.0) --
  9063. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  9064. * Courant Institute, Argonne National Lab, and Rice University
  9065. -* October 31, 1999
  9066. +* April 25, 2001
  9067. *
  9068. * .. Scalar Arguments ..
  9069. INTEGER INFO, LDA, LDB, LWORK, M, N, NRHS, RANK
  9070. @@ -86,10 +86,9 @@
  9071. * LWORK >= 3*min(M,N) + max( 2*min(M,N), max(M,N), NRHS )
  9072. * For good performance, LWORK should generally be larger.
  9073. *
  9074. -* If LWORK = -1, then a workspace query is assumed; the routine
  9075. -* only calculates the optimal size of the WORK array, returns
  9076. -* this value as the first entry of the WORK array, and no error
  9077. -* message related to LWORK is issued by XERBLA.
  9078. +* If LWORK = -1, a workspace query is assumed. The optimal
  9079. +* size for the WORK array is calculated and stored in WORK(1),
  9080. +* and no other work except argument checking is performed.
  9081. *
  9082. * INFO (output) INTEGER
  9083. * = 0: successful exit
  9084. @@ -156,7 +155,7 @@
  9085. * following subroutine, as returned by ILAENV.)
  9086. *
  9087. MINWRK = 1
  9088. - IF( INFO.EQ.0 .AND. ( LWORK.GE.1 .OR. LQUERY ) ) THEN
  9089. + IF( INFO.EQ.0 ) THEN
  9090. MAXWRK = 0
  9091. MM = M
  9092. IF( M.GE.N .AND. M.GE.MNTHR ) THEN
  9093. @@ -229,20 +228,18 @@
  9094. END IF
  9095. MAXWRK = MAX( MINWRK, MAXWRK )
  9096. WORK( 1 ) = MAXWRK
  9097. + IF( LWORK.LT.MINWRK .AND. .NOT.LQUERY )
  9098. + $ INFO = -12
  9099. END IF
  9100. *
  9101. - MINWRK = MAX( MINWRK, 1 )
  9102. - IF( LWORK.LT.MINWRK .AND. .NOT.LQUERY )
  9103. - $ INFO = -12
  9104. +* Quick returns
  9105. +*
  9106. IF( INFO.NE.0 ) THEN
  9107. CALL XERBLA( 'SGELSS', -INFO )
  9108. RETURN
  9109. ELSE IF( LQUERY ) THEN
  9110. RETURN
  9111. END IF
  9112. -*
  9113. -* Quick return if possible
  9114. -*
  9115. IF( M.EQ.0 .OR. N.EQ.0 ) THEN
  9116. RANK = 0
  9117. RETURN
  9118. @@ -491,8 +488,8 @@
  9119. DO 40 I = 1, NRHS, CHUNK
  9120. BL = MIN( NRHS-I+1, CHUNK )
  9121. CALL SGEMM( 'T', 'N', M, BL, M, ONE, WORK( IL ), LDWORK,
  9122. - $ B( 1, I ), LDB, ZERO, WORK( IWORK ), N )
  9123. - CALL SLACPY( 'G', M, BL, WORK( IWORK ), N, B( 1, I ),
  9124. + $ B( 1, I ), LDB, ZERO, WORK( IWORK ), M )
  9125. + CALL SLACPY( 'G', M, BL, WORK( IWORK ), M, B( 1, I ),
  9126. $ LDB )
  9127. 40 CONTINUE
  9128. ELSE
  9129. diff -uNr LAPACK.orig/SRC/sgesdd.f LAPACK/SRC/sgesdd.f
  9130. --- LAPACK.orig/SRC/sgesdd.f Thu Nov 11 20:32:10 1999
  9131. +++ LAPACK/SRC/sgesdd.f Fri May 25 16:07:52 2001
  9132. @@ -1,10 +1,11 @@
  9133. - SUBROUTINE SGESDD( JOBZ, M, N, A, LDA, S, U, LDU, VT, LDVT, WORK,
  9134. - $ LWORK, IWORK, INFO )
  9135. + SUBROUTINE SGESDD( JOBZ, M, N, A, LDA, S, U, LDU, VT, LDVT,
  9136. + $ WORK, LWORK, IWORK, INFO )
  9137. *
  9138. * -- LAPACK driver routine (version 3.0) --
  9139. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  9140. * Courant Institute, Argonne National Lab, and Rice University
  9141. -* October 31, 1999
  9142. +* June 30, 1999
  9143. +* 8-15-00: Improve consistency of WS calculations (eca)
  9144. *
  9145. * .. Scalar Arguments ..
  9146. CHARACTER JOBZ
  9147. @@ -116,16 +117,20 @@
  9148. * LWORK (input) INTEGER
  9149. * The dimension of the array WORK. LWORK >= 1.
  9150. * If JOBZ = 'N',
  9151. -* LWORK >= 3*min(M,N) + max(max(M,N),6*min(M,N)).
  9152. +* LWORK >= max(14*min(M,N)+4, 10*min(M,N)+2+
  9153. +* SMLSIZ*(SMLSIZ+8)) + max(M,N)
  9154. +* where SMLSIZ is returned by ILAENV and is equal to the
  9155. +* maximum size of the subproblems at the bottom of the
  9156. +* computation tree (usually about 25).
  9157. * If JOBZ = 'O',
  9158. -* LWORK >= 3*min(M,N)*min(M,N) +
  9159. -* max(max(M,N),5*min(M,N)*min(M,N)+4*min(M,N)).
  9160. +* LWORK >= 5*min(M,N)*min(M,N) + max(M,N) + 9*min(M,N).
  9161. * If JOBZ = 'S' or 'A'
  9162. -* LWORK >= 3*min(M,N)*min(M,N) +
  9163. -* max(max(M,N),4*min(M,N)*min(M,N)+4*min(M,N)).
  9164. +* LWORK >= 4*min(M,N)*min(M,N) + max(M,N) + 9*min(M,N).
  9165. * For good performance, LWORK should generally be larger.
  9166. -* If LWORK < 0 but other input arguments are legal, WORK(1)
  9167. -* returns the optimal LWORK.
  9168. +*
  9169. +* If LWORK = -1, a workspace query is assumed. The optimal
  9170. +* size for the WORK array is calculated and stored in WORK(1),
  9171. +* and no other work except argument checking is performed.
  9172. *
  9173. * IWORK (workspace) INTEGER array, dimension (8*min(M,N))
  9174. *
  9175. @@ -144,15 +149,17 @@
  9176. * =====================================================================
  9177. *
  9178. * .. Parameters ..
  9179. + INTEGER LQUERV
  9180. + PARAMETER ( LQUERV = -1 )
  9181. REAL ZERO, ONE
  9182. - PARAMETER ( ZERO = 0.0E0, ONE = 1.0E0 )
  9183. + PARAMETER ( ZERO = 0.0E+0, ONE = 1.0E+0 )
  9184. * ..
  9185. * .. Local Scalars ..
  9186. - LOGICAL LQUERY, WNTQA, WNTQAS, WNTQN, WNTQO, WNTQS
  9187. - INTEGER BDSPAC, BLK, CHUNK, I, IE, IERR, IL,
  9188. + LOGICAL WNTQA, WNTQAS, WNTQN, WNTQO, WNTQS
  9189. + INTEGER BDSPAC, BDSPAN, BLK, CHUNK, I, IE, IERR, IL,
  9190. $ IR, ISCL, ITAU, ITAUP, ITAUQ, IU, IVT, LDWKVT,
  9191. $ LDWRKL, LDWRKR, LDWRKU, MAXWRK, MINMN, MINWRK,
  9192. - $ MNTHR, NWORK, WRKBL
  9193. + $ MNTHR, NWORK, SMLSIZ, WRKBL
  9194. REAL ANRM, BIGNUM, EPS, SMLNUM
  9195. * ..
  9196. * .. Local Arrays ..
  9197. @@ -168,10 +175,10 @@
  9198. LOGICAL LSAME
  9199. INTEGER ILAENV
  9200. REAL SLAMCH, SLANGE
  9201. - EXTERNAL ILAENV, LSAME, SLAMCH, SLANGE
  9202. + EXTERNAL SLAMCH, SLANGE, ILAENV, LSAME
  9203. * ..
  9204. * .. Intrinsic Functions ..
  9205. - INTRINSIC INT, MAX, MIN, REAL, SQRT
  9206. + INTRINSIC REAL, INT, MAX, MIN, SQRT
  9207. * ..
  9208. * .. Executable Statements ..
  9209. *
  9210. @@ -179,7 +186,7 @@
  9211. *
  9212. INFO = 0
  9213. MINMN = MIN( M, N )
  9214. - MNTHR = INT( MINMN*11.0E0 / 6.0E0 )
  9215. + MNTHR = INT( MINMN*11.0 / 6.0 )
  9216. WNTQA = LSAME( JOBZ, 'A' )
  9217. WNTQS = LSAME( JOBZ, 'S' )
  9218. WNTQAS = WNTQA .OR. WNTQS
  9219. @@ -187,7 +194,6 @@
  9220. WNTQN = LSAME( JOBZ, 'N' )
  9221. MINWRK = 1
  9222. MAXWRK = 1
  9223. - LQUERY = ( LWORK.EQ.-1 )
  9224. *
  9225. IF( .NOT.( WNTQA .OR. WNTQS .OR. WNTQO .OR. WNTQN ) ) THEN
  9226. INFO = -1
  9227. @@ -206,6 +212,8 @@
  9228. INFO = -10
  9229. END IF
  9230. *
  9231. + SMLSIZ = ILAENV( 9, 'SGESDD', ' ', 0, 0, 0, 0 )
  9232. +*
  9233. * Compute workspace
  9234. * (Note: Comments in the code beginning "Workspace:" describe the
  9235. * minimal amount of workspace needed at that point in the code,
  9236. @@ -218,22 +226,19 @@
  9237. *
  9238. * Compute space needed for SBDSDC
  9239. *
  9240. - IF( WNTQN ) THEN
  9241. - BDSPAC = 7*N
  9242. - ELSE
  9243. - BDSPAC = 3*N*N + 4*N
  9244. - END IF
  9245. + BDSPAC = 3*N*N + 7*N
  9246. + BDSPAN = MAX( 12*N+4, 8*N+2+SMLSIZ*( SMLSIZ+8 ) )
  9247. IF( M.GE.MNTHR ) THEN
  9248. IF( WNTQN ) THEN
  9249. *
  9250. * Path 1 (M much larger than N, JOBZ='N')
  9251. *
  9252. - WRKBL = N + N*ILAENV( 1, 'SGEQRF', ' ', M, N, -1,
  9253. - $ -1 )
  9254. - WRKBL = MAX( WRKBL, 3*N+2*N*
  9255. - $ ILAENV( 1, 'SGEBRD', ' ', N, N, -1, -1 ) )
  9256. - MAXWRK = MAX( WRKBL, BDSPAC+N )
  9257. - MINWRK = BDSPAC + N
  9258. + MAXWRK = N + N*ILAENV( 1, 'SGEQRF', ' ', M, N, -1,
  9259. + $ -1 )
  9260. + MAXWRK = MAX( MAXWRK, 3*N+2*N*
  9261. + $ ILAENV( 1, 'SGEBRD', ' ', N, N, -1, -1 ) )
  9262. + MAXWRK = MAX( MAXWRK, BDSPAC )
  9263. + MINWRK = BDSPAC
  9264. ELSE IF( WNTQO ) THEN
  9265. *
  9266. * Path 2 (M much larger than N, JOBZ='O')
  9267. @@ -247,9 +252,9 @@
  9268. $ ILAENV( 1, 'SORMBR', 'QLN', N, N, N, -1 ) )
  9269. WRKBL = MAX( WRKBL, 3*N+N*
  9270. $ ILAENV( 1, 'SORMBR', 'PRT', N, N, N, -1 ) )
  9271. - WRKBL = MAX( WRKBL, BDSPAC+3*N )
  9272. + WRKBL = MAX( WRKBL, BDSPAC+2*N )
  9273. MAXWRK = WRKBL + 2*N*N
  9274. - MINWRK = BDSPAC + 2*N*N + 3*N
  9275. + MINWRK = BDSPAC + 2*N*N + 2*N
  9276. ELSE IF( WNTQS ) THEN
  9277. *
  9278. * Path 3 (M much larger than N, JOBZ='S')
  9279. @@ -263,9 +268,9 @@
  9280. $ ILAENV( 1, 'SORMBR', 'QLN', N, N, N, -1 ) )
  9281. WRKBL = MAX( WRKBL, 3*N+N*
  9282. $ ILAENV( 1, 'SORMBR', 'PRT', N, N, N, -1 ) )
  9283. - WRKBL = MAX( WRKBL, BDSPAC+3*N )
  9284. + WRKBL = MAX( WRKBL, BDSPAC+2*N )
  9285. MAXWRK = WRKBL + N*N
  9286. - MINWRK = BDSPAC + N*N + 3*N
  9287. + MINWRK = BDSPAC + N*N + 2*N
  9288. ELSE IF( WNTQA ) THEN
  9289. *
  9290. * Path 4 (M much larger than N, JOBZ='A')
  9291. @@ -279,9 +284,9 @@
  9292. $ ILAENV( 1, 'SORMBR', 'QLN', N, N, N, -1 ) )
  9293. WRKBL = MAX( WRKBL, 3*N+N*
  9294. $ ILAENV( 1, 'SORMBR', 'PRT', N, N, N, -1 ) )
  9295. - WRKBL = MAX( WRKBL, BDSPAC+3*N )
  9296. - MAXWRK = WRKBL + N*N
  9297. - MINWRK = BDSPAC + N*N + 3*N
  9298. + WRKBL = MAX( WRKBL, BDSPAC+2*N )
  9299. + MAXWRK = N*N + WRKBL
  9300. + MINWRK = BDSPAC + N*N + M + N
  9301. END IF
  9302. ELSE
  9303. *
  9304. @@ -289,53 +294,47 @@
  9305. *
  9306. WRKBL = 3*N + ( M+N )*ILAENV( 1, 'SGEBRD', ' ', M, N, -1,
  9307. $ -1 )
  9308. - IF( WNTQN ) THEN
  9309. - MAXWRK = MAX( WRKBL, BDSPAC+3*N )
  9310. - MINWRK = 3*N + MAX( M, BDSPAC )
  9311. - ELSE IF( WNTQO ) THEN
  9312. + IF( WNTQO ) THEN
  9313. WRKBL = MAX( WRKBL, 3*N+N*
  9314. $ ILAENV( 1, 'SORMBR', 'QLN', M, N, N, -1 ) )
  9315. WRKBL = MAX( WRKBL, 3*N+N*
  9316. $ ILAENV( 1, 'SORMBR', 'PRT', N, N, N, -1 ) )
  9317. - WRKBL = MAX( WRKBL, BDSPAC+3*N )
  9318. + WRKBL = MAX( WRKBL, BDSPAC+2*N+M )
  9319. MAXWRK = WRKBL + M*N
  9320. - MINWRK = 3*N + MAX( M, N*N+BDSPAC )
  9321. + MINWRK = BDSPAC + N*N + 2*N + M
  9322. ELSE IF( WNTQS ) THEN
  9323. - WRKBL = MAX( WRKBL, 3*N+N*
  9324. - $ ILAENV( 1, 'SORMBR', 'QLN', M, N, N, -1 ) )
  9325. - WRKBL = MAX( WRKBL, 3*N+N*
  9326. - $ ILAENV( 1, 'SORMBR', 'PRT', N, N, N, -1 ) )
  9327. - MAXWRK = MAX( WRKBL, BDSPAC+3*N )
  9328. - MINWRK = 3*N + MAX( M, BDSPAC )
  9329. + MAXWRK = MAX( MAXWRK, 3*N+N*
  9330. + $ ILAENV( 1, 'SORMBR', 'QLN', M, N, N, -1 ) )
  9331. + MAXWRK = MAX( MAXWRK, 3*N+N*
  9332. + $ ILAENV( 1, 'SORMBR', 'PRT', N, N, N, -1 ) )
  9333. + MAXWRK = MAX( MAXWRK, BDSPAC+2*N+M )
  9334. + MINWRK = BDSPAC + 2*N + M
  9335. ELSE IF( WNTQA ) THEN
  9336. - WRKBL = MAX( WRKBL, 3*N+M*
  9337. - $ ILAENV( 1, 'SORMBR', 'QLN', M, M, N, -1 ) )
  9338. - WRKBL = MAX( WRKBL, 3*N+N*
  9339. - $ ILAENV( 1, 'SORMBR', 'PRT', N, N, N, -1 ) )
  9340. - MAXWRK = MAX( MAXWRK, BDSPAC+3*N )
  9341. - MINWRK = 3*N + MAX( M, BDSPAC )
  9342. + MAXWRK = MAX( MAXWRK, 3*N+M*
  9343. + $ ILAENV( 1, 'SORMBR', 'QLN', M, M, N, -1 ) )
  9344. + MAXWRK = MAX( MAXWRK, 3*N+N*
  9345. + $ ILAENV( 1, 'SORMBR', 'PRT', N, N, N, -1 ) )
  9346. + MAXWRK = MAX( MAXWRK, BDSPAC+2*N+M )
  9347. + MINWRK = BDSPAC + 2*N + M
  9348. END IF
  9349. END IF
  9350. ELSE
  9351. *
  9352. * Compute space needed for SBDSDC
  9353. *
  9354. - IF( WNTQN ) THEN
  9355. - BDSPAC = 7*M
  9356. - ELSE
  9357. - BDSPAC = 3*M*M + 4*M
  9358. - END IF
  9359. + BDSPAC = 3*M*M + 7*M
  9360. + BDSPAN = MAX( 12*M+4, 8*M+2+SMLSIZ*( SMLSIZ+8 ) )
  9361. IF( N.GE.MNTHR ) THEN
  9362. IF( WNTQN ) THEN
  9363. *
  9364. * Path 1t (N much larger than M, JOBZ='N')
  9365. *
  9366. - WRKBL = M + M*ILAENV( 1, 'SGELQF', ' ', M, N, -1,
  9367. - $ -1 )
  9368. - WRKBL = MAX( WRKBL, 3*M+2*M*
  9369. - $ ILAENV( 1, 'SGEBRD', ' ', M, M, -1, -1 ) )
  9370. - MAXWRK = MAX( WRKBL, BDSPAC+M )
  9371. - MINWRK = BDSPAC + M
  9372. + MAXWRK = M + M*ILAENV( 1, 'SGELQF', ' ', M, N, -1,
  9373. + $ -1 )
  9374. + MAXWRK = MAX( MAXWRK, 3*M+2*M*
  9375. + $ ILAENV( 1, 'SGEBRD', ' ', M, M, -1, -1 ) )
  9376. + MAXWRK = MAX( MAXWRK, BDSPAC )
  9377. + MINWRK = BDSPAC
  9378. ELSE IF( WNTQO ) THEN
  9379. *
  9380. * Path 2t (N much larger than M, JOBZ='O')
  9381. @@ -349,9 +348,9 @@
  9382. $ ILAENV( 1, 'SORMBR', 'QLN', M, M, M, -1 ) )
  9383. WRKBL = MAX( WRKBL, 3*M+M*
  9384. $ ILAENV( 1, 'SORMBR', 'PRT', M, M, M, -1 ) )
  9385. - WRKBL = MAX( WRKBL, BDSPAC+3*M )
  9386. + WRKBL = MAX( WRKBL, BDSPAC+2*M )
  9387. MAXWRK = WRKBL + 2*M*M
  9388. - MINWRK = BDSPAC + 2*M*M + 3*M
  9389. + MINWRK = BDSPAC + 2*M*M + 2*M
  9390. ELSE IF( WNTQS ) THEN
  9391. *
  9392. * Path 3t (N much larger than M, JOBZ='S')
  9393. @@ -365,9 +364,9 @@
  9394. $ ILAENV( 1, 'SORMBR', 'QLN', M, M, M, -1 ) )
  9395. WRKBL = MAX( WRKBL, 3*M+M*
  9396. $ ILAENV( 1, 'SORMBR', 'PRT', M, M, M, -1 ) )
  9397. - WRKBL = MAX( WRKBL, BDSPAC+3*M )
  9398. + WRKBL = MAX( WRKBL, BDSPAC+2*M )
  9399. MAXWRK = WRKBL + M*M
  9400. - MINWRK = BDSPAC + M*M + 3*M
  9401. + MINWRK = BDSPAC + M*M + 2*M
  9402. ELSE IF( WNTQA ) THEN
  9403. *
  9404. * Path 4t (N much larger than M, JOBZ='A')
  9405. @@ -381,9 +380,9 @@
  9406. $ ILAENV( 1, 'SORMBR', 'QLN', M, M, M, -1 ) )
  9407. WRKBL = MAX( WRKBL, 3*M+M*
  9408. $ ILAENV( 1, 'SORMBR', 'PRT', M, M, M, -1 ) )
  9409. - WRKBL = MAX( WRKBL, BDSPAC+3*M )
  9410. + WRKBL = MAX( WRKBL, BDSPAC+2*M )
  9411. MAXWRK = WRKBL + M*M
  9412. - MINWRK = BDSPAC + M*M + 3*M
  9413. + MINWRK = BDSPAC + M*M + M + N
  9414. END IF
  9415. ELSE
  9416. *
  9417. @@ -391,52 +390,46 @@
  9418. *
  9419. WRKBL = 3*M + ( M+N )*ILAENV( 1, 'SGEBRD', ' ', M, N, -1,
  9420. $ -1 )
  9421. - IF( WNTQN ) THEN
  9422. - MAXWRK = MAX( WRKBL, BDSPAC+3*M )
  9423. - MINWRK = 3*M + MAX( N, BDSPAC )
  9424. - ELSE IF( WNTQO ) THEN
  9425. + IF( WNTQO ) THEN
  9426. WRKBL = MAX( WRKBL, 3*M+M*
  9427. $ ILAENV( 1, 'SORMBR', 'QLN', M, M, N, -1 ) )
  9428. WRKBL = MAX( WRKBL, 3*M+M*
  9429. $ ILAENV( 1, 'SORMBR', 'PRT', M, N, M, -1 ) )
  9430. - WRKBL = MAX( WRKBL, BDSPAC+3*M )
  9431. + WRKBL = MAX( WRKBL, BDSPAC+2*M )
  9432. MAXWRK = WRKBL + M*N
  9433. - MINWRK = 3*M + MAX( N, M*M+BDSPAC )
  9434. + MINWRK = BDSPAC + M*M + 2*M + N
  9435. ELSE IF( WNTQS ) THEN
  9436. - WRKBL = MAX( WRKBL, 3*M+M*
  9437. - $ ILAENV( 1, 'SORMBR', 'QLN', M, M, N, -1 ) )
  9438. - WRKBL = MAX( WRKBL, 3*M+M*
  9439. - $ ILAENV( 1, 'SORMBR', 'PRT', M, N, M, -1 ) )
  9440. - MAXWRK = MAX( WRKBL, BDSPAC+3*M )
  9441. - MINWRK = 3*M + MAX( N, BDSPAC )
  9442. + MAXWRK = MAX( MAXWRK, 3*M+M*
  9443. + $ ILAENV( 1, 'SORMBR', 'QLN', M, M, N, -1 ) )
  9444. + MAXWRK = MAX( MAXWRK, 3*M+M*
  9445. + $ ILAENV( 1, 'SORMBR', 'PRT', M, N, M, -1 ) )
  9446. + MAXWRK = MAX( MAXWRK, BDSPAC+2*M )
  9447. + MINWRK = BDSPAC + 2*M + N
  9448. ELSE IF( WNTQA ) THEN
  9449. - WRKBL = MAX( WRKBL, 3*M+M*
  9450. - $ ILAENV( 1, 'SORMBR', 'QLN', M, M, N, -1 ) )
  9451. - WRKBL = MAX( WRKBL, 3*M+M*
  9452. - $ ILAENV( 1, 'SORMBR', 'PRT', N, N, M, -1 ) )
  9453. - MAXWRK = MAX( WRKBL, BDSPAC+3*M )
  9454. - MINWRK = 3*M + MAX( N, BDSPAC )
  9455. + MAXWRK = MAX( MAXWRK, 3*M+M*
  9456. + $ ILAENV( 1, 'SORMBR', 'QLN', M, M, N, -1 ) )
  9457. + MAXWRK = MAX( MAXWRK, 3*M+N*
  9458. + $ ILAENV( 1, 'SORMBR', 'PRT', N, N, M, -1 ) )
  9459. + MAXWRK = MAX( MAXWRK, BDSPAC+2*M )
  9460. + MINWRK = BDSPAC + 2*M + N
  9461. END IF
  9462. END IF
  9463. END IF
  9464. + END IF
  9465. + IF( INFO.EQ.0 ) THEN
  9466. WORK( 1 ) = MAXWRK
  9467. + IF( LWORK.LT.MINWRK .AND. LWORK.NE.LQUERV )
  9468. + $ INFO = -12
  9469. END IF
  9470. *
  9471. - IF( LWORK.LT.MINWRK .AND. .NOT.LQUERY ) THEN
  9472. - INFO = -12
  9473. - END IF
  9474. +* Quick returns
  9475. +*
  9476. IF( INFO.NE.0 ) THEN
  9477. CALL XERBLA( 'SGESDD', -INFO )
  9478. RETURN
  9479. - ELSE IF( LQUERY ) THEN
  9480. - RETURN
  9481. END IF
  9482. -*
  9483. -* Quick return if possible
  9484. -*
  9485. + IF( LWORK.EQ.LQUERV ) RETURN
  9486. IF( M.EQ.0 .OR. N.EQ.0 ) THEN
  9487. - IF( LWORK.GE.1 )
  9488. - $ WORK( 1 ) = ONE
  9489. RETURN
  9490. END IF
  9491. *
  9492. @@ -497,7 +490,7 @@
  9493. NWORK = IE + N
  9494. *
  9495. * Perform bidiagonal SVD, computing singular values only
  9496. -* (Workspace: need N+BDSPAC)
  9497. +* (Workspace: need BDSPAN)
  9498. *
  9499. CALL SBDSDC( 'U', 'N', N, S, WORK( IE ), DUM, 1, DUM, 1,
  9500. $ DUM, IDUM, WORK( NWORK ), IWORK, INFO )
  9501. @@ -512,10 +505,10 @@
  9502. *
  9503. * WORK(IR) is LDWRKR by N
  9504. *
  9505. - IF( LWORK.GE.LDA*N+N*N+3*N+BDSPAC ) THEN
  9506. + IF( LWORK.GE.LDA*N+4*N*N+9*N ) THEN
  9507. LDWRKR = LDA
  9508. ELSE
  9509. - LDWRKR = ( LWORK-N*N-3*N-BDSPAC ) / N
  9510. + LDWRKR = ( LWORK-4*N*N-9*N ) / N
  9511. END IF
  9512. ITAU = IR + LDWRKR*N
  9513. NWORK = ITAU + N
  9514. @@ -557,7 +550,7 @@
  9515. * Perform bidiagonal SVD, computing left singular vectors
  9516. * of bidiagonal matrix in WORK(IU) and computing right
  9517. * singular vectors of bidiagonal matrix in VT
  9518. -* (Workspace: need N+N*N+BDSPAC)
  9519. +* (Workspace: need 2*N*N+BDSPAC)
  9520. *
  9521. CALL SBDSDC( 'U', 'I', N, S, WORK( IE ), WORK( IU ), N,
  9522. $ VT, LDVT, DUM, IDUM, WORK( NWORK ), IWORK,
  9523. @@ -633,7 +626,7 @@
  9524. * Perform bidiagonal SVD, computing left singular vectors
  9525. * of bidiagoal matrix in U and computing right singular
  9526. * vectors of bidiagonal matrix in VT
  9527. -* (Workspace: need N+BDSPAC)
  9528. +* (Workspace: need N*N+BDSPAC)
  9529. *
  9530. CALL SBDSDC( 'U', 'I', N, S, WORK( IE ), U, LDU, VT,
  9531. $ LDVT, DUM, IDUM, WORK( NWORK ), IWORK,
  9532. @@ -681,7 +674,7 @@
  9533. CALL SLACPY( 'L', M, N, A, LDA, U, LDU )
  9534. *
  9535. * Generate Q in U
  9536. -* (Workspace: need N*N+2*N, prefer N*N+N+N*NB)
  9537. +* (Workspace: need N*N+N+M, prefer N*N+N+M*NB)
  9538. CALL SORGQR( M, M, N, U, LDU, WORK( ITAU ),
  9539. $ WORK( NWORK ), LWORK-NWORK+1, IERR )
  9540. *
  9541. @@ -703,7 +696,7 @@
  9542. * Perform bidiagonal SVD, computing left singular vectors
  9543. * of bidiagonal matrix in WORK(IU) and computing right
  9544. * singular vectors of bidiagonal matrix in VT
  9545. -* (Workspace: need N+N*N+BDSPAC)
  9546. +* (Workspace: need N*N+BDSPAC)
  9547. *
  9548. CALL SBDSDC( 'U', 'I', N, S, WORK( IE ), WORK( IU ), N,
  9549. $ VT, LDVT, DUM, IDUM, WORK( NWORK ), IWORK,
  9550. @@ -754,13 +747,13 @@
  9551. IF( WNTQN ) THEN
  9552. *
  9553. * Perform bidiagonal SVD, only computing singular values
  9554. -* (Workspace: need N+BDSPAC)
  9555. +* (Workspace: need BDSPAN)
  9556. *
  9557. CALL SBDSDC( 'U', 'N', N, S, WORK( IE ), DUM, 1, DUM, 1,
  9558. $ DUM, IDUM, WORK( NWORK ), IWORK, INFO )
  9559. ELSE IF( WNTQO ) THEN
  9560. IU = NWORK
  9561. - IF( LWORK.GE.M*N+3*N+BDSPAC ) THEN
  9562. + IF( LWORK.GE.M*N+3*N*N+9*N ) THEN
  9563. *
  9564. * WORK( IU ) is M by N
  9565. *
  9566. @@ -785,7 +778,7 @@
  9567. * Perform bidiagonal SVD, computing left singular vectors
  9568. * of bidiagonal matrix in WORK(IU) and computing right
  9569. * singular vectors of bidiagonal matrix in VT
  9570. -* (Workspace: need N+N*N+BDSPAC)
  9571. +* (Workspace: need N*N+BDSPAC)
  9572. *
  9573. CALL SBDSDC( 'U', 'I', N, S, WORK( IE ), WORK( IU ),
  9574. $ LDWRKU, VT, LDVT, DUM, IDUM, WORK( NWORK ),
  9575. @@ -798,7 +791,7 @@
  9576. $ WORK( ITAUP ), VT, LDVT, WORK( NWORK ),
  9577. $ LWORK-NWORK+1, IERR )
  9578. *
  9579. - IF( LWORK.GE.M*N+3*N+BDSPAC ) THEN
  9580. + IF( LWORK.GE.M*N+3*N*N+9*N ) THEN
  9581. *
  9582. * Overwrite WORK(IU) by left singular vectors of A
  9583. * (Workspace: need N*N+2*N, prefer N*N+N+N*NB)
  9584. @@ -838,7 +831,7 @@
  9585. * Perform bidiagonal SVD, computing left singular vectors
  9586. * of bidiagonal matrix in U and computing right singular
  9587. * vectors of bidiagonal matrix in VT
  9588. -* (Workspace: need N+BDSPAC)
  9589. +* (Workspace: need BDSPAC)
  9590. *
  9591. CALL SLASET( 'F', M, N, ZERO, ZERO, U, LDU )
  9592. CALL SBDSDC( 'U', 'I', N, S, WORK( IE ), U, LDU, VT,
  9593. @@ -855,12 +848,12 @@
  9594. CALL SORMBR( 'P', 'R', 'T', N, N, N, A, LDA,
  9595. $ WORK( ITAUP ), VT, LDVT, WORK( NWORK ),
  9596. $ LWORK-NWORK+1, IERR )
  9597. - ELSE IF( WNTQA ) THEN
  9598. + ELSE
  9599. *
  9600. * Perform bidiagonal SVD, computing left singular vectors
  9601. * of bidiagonal matrix in U and computing right singular
  9602. * vectors of bidiagonal matrix in VT
  9603. -* (Workspace: need N+BDSPAC)
  9604. +* (Workspace: need BDSPAC)
  9605. *
  9606. CALL SLASET( 'F', M, M, ZERO, ZERO, U, LDU )
  9607. CALL SBDSDC( 'U', 'I', N, S, WORK( IE ), U, LDU, VT,
  9608. @@ -925,7 +918,7 @@
  9609. NWORK = IE + M
  9610. *
  9611. * Perform bidiagonal SVD, computing singular values only
  9612. -* (Workspace: need M+BDSPAC)
  9613. +* (Workspace: need BDSPAN)
  9614. *
  9615. CALL SBDSDC( 'U', 'N', M, S, WORK( IE ), DUM, 1, DUM, 1,
  9616. $ DUM, IDUM, WORK( NWORK ), IWORK, INFO )
  9617. @@ -941,7 +934,7 @@
  9618. * IVT is M by M
  9619. *
  9620. IL = IVT + M*M
  9621. - IF( LWORK.GE.M*N+M*M+3*M+BDSPAC ) THEN
  9622. + IF( LWORK.GE.M*N+4*M*M+9*M ) THEN
  9623. *
  9624. * WORK(IL) is M by N
  9625. *
  9626. @@ -986,7 +979,7 @@
  9627. * Perform bidiagonal SVD, computing left singular vectors
  9628. * of bidiagonal matrix in U, and computing right singular
  9629. * vectors of bidiagonal matrix in WORK(IVT)
  9630. -* (Workspace: need M+M*M+BDSPAC)
  9631. +* (Workspace: need 2*M*M+BDSPAC)
  9632. *
  9633. CALL SBDSDC( 'U', 'I', M, S, WORK( IE ), U, LDU,
  9634. $ WORK( IVT ), M, DUM, IDUM, WORK( NWORK ),
  9635. @@ -1061,7 +1054,7 @@
  9636. * Perform bidiagonal SVD, computing left singular vectors
  9637. * of bidiagonal matrix in U and computing right singular
  9638. * vectors of bidiagonal matrix in VT
  9639. -* (Workspace: need M+BDSPAC)
  9640. +* (Workspace: need M*M+BDSPAC)
  9641. *
  9642. CALL SBDSDC( 'U', 'I', M, S, WORK( IE ), U, LDU, VT,
  9643. $ LDVT, DUM, IDUM, WORK( NWORK ), IWORK,
  9644. @@ -1108,7 +1101,7 @@
  9645. CALL SLACPY( 'U', M, N, A, LDA, VT, LDVT )
  9646. *
  9647. * Generate Q in VT
  9648. -* (Workspace: need M*M+2*M, prefer M*M+M+M*NB)
  9649. +* (Workspace: need M*M+M+N, prefer M*M+M+N*NB)
  9650. *
  9651. CALL SORGLQ( N, N, M, VT, LDVT, WORK( ITAU ),
  9652. $ WORK( NWORK ), LWORK-NWORK+1, IERR )
  9653. @@ -1131,7 +1124,7 @@
  9654. * Perform bidiagonal SVD, computing left singular vectors
  9655. * of bidiagonal matrix in U and computing right singular
  9656. * vectors of bidiagonal matrix in WORK(IVT)
  9657. -* (Workspace: need M+M*M+BDSPAC)
  9658. +* (Workspace: need M*M+BDSPAC)
  9659. *
  9660. CALL SBDSDC( 'U', 'I', M, S, WORK( IE ), U, LDU,
  9661. $ WORK( IVT ), LDWKVT, DUM, IDUM,
  9662. @@ -1182,14 +1175,14 @@
  9663. IF( WNTQN ) THEN
  9664. *
  9665. * Perform bidiagonal SVD, only computing singular values
  9666. -* (Workspace: need M+BDSPAC)
  9667. +* (Workspace: need BDSPAN)
  9668. *
  9669. CALL SBDSDC( 'L', 'N', M, S, WORK( IE ), DUM, 1, DUM, 1,
  9670. $ DUM, IDUM, WORK( NWORK ), IWORK, INFO )
  9671. ELSE IF( WNTQO ) THEN
  9672. LDWKVT = M
  9673. IVT = NWORK
  9674. - IF( LWORK.GE.M*N+3*M+BDSPAC ) THEN
  9675. + IF( LWORK.GE.M*N+3*M*M+9*M ) THEN
  9676. *
  9677. * WORK( IVT ) is M by N
  9678. *
  9679. @@ -1224,7 +1217,7 @@
  9680. $ WORK( ITAUQ ), U, LDU, WORK( NWORK ),
  9681. $ LWORK-NWORK+1, IERR )
  9682. *
  9683. - IF( LWORK.GE.M*N+3*M+BDSPAC ) THEN
  9684. + IF( LWORK.GE.M*N+3*M*M+9*M ) THEN
  9685. *
  9686. * Overwrite WORK(IVT) by left singular vectors of A
  9687. * (Workspace: need M*M+2*M, prefer M*M+M+M*NB)
  9688. @@ -1263,7 +1256,7 @@
  9689. * Perform bidiagonal SVD, computing left singular vectors
  9690. * of bidiagonal matrix in U and computing right singular
  9691. * vectors of bidiagonal matrix in VT
  9692. -* (Workspace: need M+BDSPAC)
  9693. +* (Workspace: need BDSPAC)
  9694. *
  9695. CALL SLASET( 'F', M, N, ZERO, ZERO, VT, LDVT )
  9696. CALL SBDSDC( 'L', 'I', M, S, WORK( IE ), U, LDU, VT,
  9697. @@ -1280,12 +1273,12 @@
  9698. CALL SORMBR( 'P', 'R', 'T', M, N, M, A, LDA,
  9699. $ WORK( ITAUP ), VT, LDVT, WORK( NWORK ),
  9700. $ LWORK-NWORK+1, IERR )
  9701. - ELSE IF( WNTQA ) THEN
  9702. + ELSE
  9703. *
  9704. * Perform bidiagonal SVD, computing left singular vectors
  9705. * of bidiagonal matrix in U and computing right singular
  9706. * vectors of bidiagonal matrix in VT
  9707. -* (Workspace: need M+BDSPAC)
  9708. +* (Workspace: need BDSPAC)
  9709. *
  9710. CALL SLASET( 'F', N, N, ZERO, ZERO, VT, LDVT )
  9711. CALL SBDSDC( 'L', 'I', M, S, WORK( IE ), U, LDU, VT,
  9712. @@ -1319,9 +1312,15 @@
  9713. IF( ANRM.GT.BIGNUM )
  9714. $ CALL SLASCL( 'G', 0, 0, BIGNUM, ANRM, MINMN, 1, S, MINMN,
  9715. $ IERR )
  9716. + IF( INFO.NE.0 .AND. ANRM.GT.BIGNUM )
  9717. + $ CALL SLASCL( 'G', 0, 0, BIGNUM, ANRM, MINMN-1, 1, WORK( 2 ),
  9718. + $ MINMN, IERR )
  9719. IF( ANRM.LT.SMLNUM )
  9720. $ CALL SLASCL( 'G', 0, 0, SMLNUM, ANRM, MINMN, 1, S, MINMN,
  9721. $ IERR )
  9722. + IF( INFO.NE.0 .AND. ANRM.LT.SMLNUM )
  9723. + $ CALL SLASCL( 'G', 0, 0, SMLNUM, ANRM, MINMN-1, 1, WORK( 2 ),
  9724. + $ MINMN, IERR )
  9725. END IF
  9726. *
  9727. * Return optimal workspace in WORK(1)
  9728. diff -uNr LAPACK.orig/SRC/sgesvd.f LAPACK/SRC/sgesvd.f
  9729. --- LAPACK.orig/SRC/sgesvd.f Thu Nov 4 14:23:35 1999
  9730. +++ LAPACK/SRC/sgesvd.f Fri May 25 16:08:20 2001
  9731. @@ -4,7 +4,8 @@
  9732. * -- LAPACK driver routine (version 3.0) --
  9733. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  9734. * Courant Institute, Argonne National Lab, and Rice University
  9735. -* October 31, 1999
  9736. +* June 30, 1999
  9737. +* 8-15-00: Improve consistency of WS calculations (eca)
  9738. *
  9739. * .. Scalar Arguments ..
  9740. CHARACTER JOBU, JOBVT
  9741. @@ -118,10 +119,9 @@
  9742. * LWORK >= MAX(3*MIN(M,N)+MAX(M,N),5*MIN(M,N)).
  9743. * For good performance, LWORK should generally be larger.
  9744. *
  9745. -* If LWORK = -1, then a workspace query is assumed; the routine
  9746. -* only calculates the optimal size of the WORK array, returns
  9747. -* this value as the first entry of the WORK array, and no error
  9748. -* message related to LWORK is issued by XERBLA.
  9749. +* If LWORK = -1, a workspace query is assumed. The optimal
  9750. +* size for the WORK array is calculated and stored in WORK(1),
  9751. +* and no other work except argument checking is performed.
  9752. *
  9753. * INFO (output) INTEGER
  9754. * = 0: successful exit.
  9755. @@ -134,12 +134,14 @@
  9756. * =====================================================================
  9757. *
  9758. * .. Parameters ..
  9759. + INTEGER LQUERV
  9760. + PARAMETER ( LQUERV = -1 )
  9761. REAL ZERO, ONE
  9762. PARAMETER ( ZERO = 0.0E0, ONE = 1.0E0 )
  9763. * ..
  9764. * .. Local Scalars ..
  9765. - LOGICAL LQUERY, WNTUA, WNTUAS, WNTUN, WNTUO, WNTUS,
  9766. - $ WNTVA, WNTVAS, WNTVN, WNTVO, WNTVS
  9767. + LOGICAL WNTUA, WNTUAS, WNTUN, WNTUO, WNTUS, WNTVA,
  9768. + $ WNTVAS, WNTVN, WNTVO, WNTVS
  9769. INTEGER BDSPAC, BLK, CHUNK, I, IE, IERR, IR, ISCL,
  9770. $ ITAU, ITAUP, ITAUQ, IU, IWORK, LDWRKR, LDWRKU,
  9771. $ MAXWRK, MINMN, MINWRK, MNTHR, NCU, NCVT, NRU,
  9772. @@ -181,7 +183,7 @@
  9773. WNTVO = LSAME( JOBVT, 'O' )
  9774. WNTVN = LSAME( JOBVT, 'N' )
  9775. MINWRK = 1
  9776. - LQUERY = ( LWORK.EQ.-1 )
  9777. + MAXWRK = 1
  9778. *
  9779. IF( .NOT.( WNTUA .OR. WNTUS .OR. WNTUO .OR. WNTUN ) ) THEN
  9780. INFO = -1
  9781. @@ -208,8 +210,7 @@
  9782. * NB refers to the optimal block size for the immediately
  9783. * following subroutine, as returned by ILAENV.)
  9784. *
  9785. - IF( INFO.EQ.0 .AND. ( LWORK.GE.1 .OR. LQUERY ) .AND. M.GT.0 .AND.
  9786. - $ N.GT.0 ) THEN
  9787. + IF( INFO.EQ.0 .AND. M.GT.0 .AND. N.GT.0 ) THEN
  9788. IF( M.GE.N ) THEN
  9789. *
  9790. * Compute space needed for SBDSQR
  9791. @@ -557,24 +558,21 @@
  9792. MAXWRK = MAX( MAXWRK, MINWRK )
  9793. END IF
  9794. END IF
  9795. + END IF
  9796. + IF( INFO.EQ.0 ) THEN
  9797. WORK( 1 ) = MAXWRK
  9798. + IF( LWORK.LT.MINWRK .AND. LWORK.NE.LQUERV )
  9799. + $ INFO = -13
  9800. END IF
  9801. *
  9802. - IF( LWORK.LT.MINWRK .AND. .NOT.LQUERY ) THEN
  9803. - INFO = -13
  9804. - END IF
  9805. +* Quick returns
  9806. +*
  9807. IF( INFO.NE.0 ) THEN
  9808. CALL XERBLA( 'SGESVD', -INFO )
  9809. RETURN
  9810. - ELSE IF( LQUERY ) THEN
  9811. - RETURN
  9812. END IF
  9813. -*
  9814. -* Quick return if possible
  9815. -*
  9816. + IF( LWORK.EQ.LQUERV ) RETURN
  9817. IF( M.EQ.0 .OR. N.EQ.0 ) THEN
  9818. - IF( LWORK.GE.1 )
  9819. - $ WORK( 1 ) = ONE
  9820. RETURN
  9821. END IF
  9822. *
  9823. diff -uNr LAPACK.orig/SRC/sggbak.f LAPACK/SRC/sggbak.f
  9824. --- LAPACK.orig/SRC/sggbak.f Thu Nov 4 14:23:36 1999
  9825. +++ LAPACK/SRC/sggbak.f Fri May 25 16:08:51 2001
  9826. @@ -4,7 +4,7 @@
  9827. * -- LAPACK routine (version 3.0) --
  9828. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  9829. * Courant Institute, Argonne National Lab, and Rice University
  9830. -* September 30, 1994
  9831. +* February 1, 2001
  9832. *
  9833. * .. Scalar Arguments ..
  9834. CHARACTER JOB, SIDE
  9835. @@ -108,10 +108,15 @@
  9836. INFO = -3
  9837. ELSE IF( ILO.LT.1 ) THEN
  9838. INFO = -4
  9839. - ELSE IF( IHI.LT.ILO .OR. IHI.GT.MAX( 1, N ) ) THEN
  9840. + ELSE IF( N.EQ.0 .AND. IHI.EQ.0 .AND. ILO.NE.1 ) THEN
  9841. + INFO = -4
  9842. + ELSE IF( N.GT.0 .AND. ( IHI.LT.ILO .OR. IHI.GT.MAX( 1, N ) ) )
  9843. + $ THEN
  9844. + INFO = -5
  9845. + ELSE IF( N.EQ.0 .AND. ILO.EQ.1 .AND. IHI.NE.0 ) THEN
  9846. INFO = -5
  9847. ELSE IF( M.LT.0 ) THEN
  9848. - INFO = -6
  9849. + INFO = -8
  9850. ELSE IF( LDV.LT.MAX( 1, N ) ) THEN
  9851. INFO = -10
  9852. END IF
  9853. diff -uNr LAPACK.orig/SRC/sggbal.f LAPACK/SRC/sggbal.f
  9854. --- LAPACK.orig/SRC/sggbal.f Thu Nov 4 14:25:42 1999
  9855. +++ LAPACK/SRC/sggbal.f Fri May 25 16:09:11 2001
  9856. @@ -4,7 +4,7 @@
  9857. * -- LAPACK routine (version 3.0) --
  9858. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  9859. * Courant Institute, Argonne National Lab, and Rice University
  9860. -* September 30, 1994
  9861. +* April 12, 2001
  9862. *
  9863. * .. Scalar Arguments ..
  9864. CHARACTER JOB
  9865. @@ -141,7 +141,7 @@
  9866. ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
  9867. INFO = -4
  9868. ELSE IF( LDB.LT.MAX( 1, N ) ) THEN
  9869. - INFO = -5
  9870. + INFO = -6
  9871. END IF
  9872. IF( INFO.NE.0 ) THEN
  9873. CALL XERBLA( 'SGGBAL', -INFO )
  9874. @@ -188,8 +188,8 @@
  9875. IF( L.NE.1 )
  9876. $ GO TO 30
  9877. *
  9878. - RSCALE( 1 ) = 1
  9879. - LSCALE( 1 ) = 1
  9880. + RSCALE( 1 ) = ONE
  9881. + LSCALE( 1 ) = ONE
  9882. GO TO 190
  9883. *
  9884. 30 CONTINUE
  9885. @@ -247,7 +247,7 @@
  9886. * Permute rows M and I
  9887. *
  9888. 160 CONTINUE
  9889. - LSCALE( M ) = I
  9890. + LSCALE( M ) = REAL( I )
  9891. IF( I.EQ.M )
  9892. $ GO TO 170
  9893. CALL SSWAP( N-K+1, A( I, K ), LDA, A( M, K ), LDA )
  9894. @@ -256,7 +256,7 @@
  9895. * Permute columns M and J
  9896. *
  9897. 170 CONTINUE
  9898. - RSCALE( M ) = J
  9899. + RSCALE( M ) = REAL( J )
  9900. IF( J.EQ.M )
  9901. $ GO TO 180
  9902. CALL SSWAP( L, A( 1, J ), 1, A( 1, M ), 1 )
  9903. @@ -424,7 +424,7 @@
  9904. DO 360 I = ILO, IHI
  9905. IRAB = ISAMAX( N-ILO+1, A( I, ILO ), LDA )
  9906. RAB = ABS( A( I, IRAB+ILO-1 ) )
  9907. - IRAB = ISAMAX( N-ILO+1, B( I, ILO ), LDA )
  9908. + IRAB = ISAMAX( N-ILO+1, B( I, ILO ), LDB )
  9909. RAB = MAX( RAB, ABS( B( I, IRAB+ILO-1 ) ) )
  9910. LRAB = INT( LOG10( RAB+SFMIN ) / BASL+ONE )
  9911. IR = LSCALE( I ) + SIGN( HALF, LSCALE( I ) )
  9912. diff -uNr LAPACK.orig/SRC/sgges.f LAPACK/SRC/sgges.f
  9913. --- LAPACK.orig/SRC/sgges.f Thu Nov 4 14:26:20 1999
  9914. +++ LAPACK/SRC/sgges.f Fri May 25 16:09:33 2001
  9915. @@ -6,6 +6,7 @@
  9916. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  9917. * Courant Institute, Argonne National Lab, and Rice University
  9918. * June 30, 1999
  9919. +* 8-15-00: Improve consistency of WS calculations (eca)
  9920. *
  9921. * .. Scalar Arguments ..
  9922. CHARACTER JOBVSL, JOBVSR, SORT
  9923. @@ -158,10 +159,9 @@
  9924. * LWORK (input) INTEGER
  9925. * The dimension of the array WORK. LWORK >= 8*N+16.
  9926. *
  9927. -* If LWORK = -1, then a workspace query is assumed; the routine
  9928. -* only calculates the optimal size of the WORK array, returns
  9929. -* this value as the first entry of the WORK array, and no error
  9930. -* message related to LWORK is issued by XERBLA.
  9931. +* If LWORK = -1, a workspace query is assumed. The optimal
  9932. +* size for the WORK array is calculated and stored in WORK(1),
  9933. +* and no other work except argument checking is performed.
  9934. *
  9935. * BWORK (workspace) LOGICAL array, dimension (N)
  9936. * Not referenced if SORT = 'N'.
  9937. @@ -184,12 +184,14 @@
  9938. * =====================================================================
  9939. *
  9940. * .. Parameters ..
  9941. + INTEGER LQUERV
  9942. + PARAMETER ( LQUERV = -1 )
  9943. REAL ZERO, ONE
  9944. PARAMETER ( ZERO = 0.0E+0, ONE = 1.0E+0 )
  9945. * ..
  9946. * .. Local Scalars ..
  9947. LOGICAL CURSL, ILASCL, ILBSCL, ILVSL, ILVSR, LASTSL,
  9948. - $ LQUERY, LST2SL, WANTST
  9949. + $ LST2SL, WANTST
  9950. INTEGER I, ICOLS, IERR, IHI, IJOBVL, IJOBVR, ILEFT,
  9951. $ ILO, IP, IRIGHT, IROWS, ITAU, IWRK, MAXWRK,
  9952. $ MINWRK
  9953. @@ -245,7 +247,6 @@
  9954. * Test the input arguments
  9955. *
  9956. INFO = 0
  9957. - LQUERY = ( LWORK.EQ.-1 )
  9958. IF( IJOBVL.LE.0 ) THEN
  9959. INFO = -1
  9960. ELSE IF( IJOBVR.LE.0 ) THEN
  9961. @@ -272,7 +273,7 @@
  9962. * following subroutine, as returned by ILAENV.)
  9963. *
  9964. MINWRK = 1
  9965. - IF( INFO.EQ.0 .AND. ( LWORK.GE.1 .OR. LQUERY ) ) THEN
  9966. + IF( INFO.EQ.0 ) THEN
  9967. MINWRK = 7*( N+1 ) + 16
  9968. MAXWRK = 7*( N+1 ) + N*ILAENV( 1, 'SGEQRF', ' ', N, 1, N, 0 ) +
  9969. $ 16
  9970. @@ -281,19 +282,17 @@
  9971. $ ILAENV( 1, 'SORGQR', ' ', N, 1, N, -1 ) )
  9972. END IF
  9973. WORK( 1 ) = MAXWRK
  9974. + IF( LWORK.LT.MINWRK .AND. LWORK.NE.LQUERV )
  9975. + $ INFO = -19
  9976. END IF
  9977. *
  9978. - IF( LWORK.LT.MINWRK .AND. .NOT.LQUERY )
  9979. - $ INFO = -19
  9980. +* Quick returns
  9981. +*
  9982. IF( INFO.NE.0 ) THEN
  9983. CALL XERBLA( 'SGGES ', -INFO )
  9984. RETURN
  9985. - ELSE IF( LQUERY ) THEN
  9986. - RETURN
  9987. END IF
  9988. -*
  9989. -* Quick return if possible
  9990. -*
  9991. + IF( LWORK.EQ.LQUERV ) RETURN
  9992. IF( N.EQ.0 ) THEN
  9993. SDIM = 0
  9994. RETURN
  9995. diff -uNr LAPACK.orig/SRC/sggesx.f LAPACK/SRC/sggesx.f
  9996. --- LAPACK.orig/SRC/sggesx.f Thu Nov 4 14:26:20 1999
  9997. +++ LAPACK/SRC/sggesx.f Fri May 25 16:09:52 2001
  9998. @@ -7,6 +7,7 @@
  9999. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  10000. * Courant Institute, Argonne National Lab, and Rice University
  10001. * June 30, 1999
  10002. +* 8-15-00: Do WS calculations if LWORK = -1 (eca)
  10003. *
  10004. * .. Scalar Arguments ..
  10005. CHARACTER JOBVSL, JOBVSR, SENSE, SORT
  10006. @@ -185,6 +186,10 @@
  10007. * If SENSE = 'E', 'V', or 'B',
  10008. * LWORK >= MAX( 8*(N+1)+16, 2*SDIM*(N-SDIM) ).
  10009. *
  10010. +* If LWORK = -1, a workspace query is assumed. The optimal
  10011. +* size for the WORK array is calculated and stored in WORK(1),
  10012. +* and no other work except argument checking is performed.
  10013. +*
  10014. * IWORK (workspace) INTEGER array, dimension (LIWORK)
  10015. * Not referenced if SENSE = 'N'.
  10016. *
  10017. @@ -227,6 +232,8 @@
  10018. * =====================================================================
  10019. *
  10020. * .. Parameters ..
  10021. + INTEGER LQUERV
  10022. + PARAMETER ( LQUERV = -1 )
  10023. REAL ZERO, ONE
  10024. PARAMETER ( ZERO = 0.0E+0, ONE = 1.0E+0 )
  10025. * ..
  10026. @@ -330,7 +337,7 @@
  10027. * following subroutine, as returned by ILAENV.)
  10028. *
  10029. MINWRK = 1
  10030. - IF( INFO.EQ.0 .AND. LWORK.GE.1 ) THEN
  10031. + IF( INFO.EQ.0 ) THEN
  10032. MINWRK = 8*( N+1 ) + 16
  10033. MAXWRK = 7*( N+1 ) + N*ILAENV( 1, 'SGEQRF', ' ', N, 1, N, 0 ) +
  10034. $ 16
  10035. @@ -338,7 +345,15 @@
  10036. MAXWRK = MAX( MAXWRK, 8*( N+1 )+N*
  10037. $ ILAENV( 1, 'SORGQR', ' ', N, 1, N, -1 )+16 )
  10038. END IF
  10039. +*
  10040. +* Estimate the workspace needed by STGSEN.
  10041. +*
  10042. + IF( WANTST ) THEN
  10043. + MAXWRK = MAX( MAXWRK, 2*N+(N*N+1)/2 )
  10044. + END IF
  10045. WORK( 1 ) = MAXWRK
  10046. + IF( LWORK.LT.MINWRK .AND. LWORK.NE.LQUERV )
  10047. + $ INFO = -22
  10048. END IF
  10049. IF( .NOT.WANTSN ) THEN
  10050. LIWMIN = 1
  10051. @@ -346,21 +361,18 @@
  10052. LIWMIN = N + 6
  10053. END IF
  10054. IWORK( 1 ) = LIWMIN
  10055. -*
  10056. - IF( INFO.EQ.0 .AND. LWORK.LT.MINWRK ) THEN
  10057. - INFO = -22
  10058. - ELSE IF( INFO.EQ.0 .AND. IJOB.GE.1 ) THEN
  10059. + IF( INFO.EQ.0 .AND. IJOB.GE.1 ) THEN
  10060. IF( LIWORK.LT.LIWMIN )
  10061. $ INFO = -24
  10062. END IF
  10063. *
  10064. +* Quick returns
  10065. +*
  10066. IF( INFO.NE.0 ) THEN
  10067. CALL XERBLA( 'SGGESX', -INFO )
  10068. RETURN
  10069. END IF
  10070. -*
  10071. -* Quick return if possible
  10072. -*
  10073. + IF( LWORK.EQ.LQUERV ) RETURN
  10074. IF( N.EQ.0 ) THEN
  10075. SDIM = 0
  10076. RETURN
  10077. diff -uNr LAPACK.orig/SRC/sggev.f LAPACK/SRC/sggev.f
  10078. --- LAPACK.orig/SRC/sggev.f Thu Nov 4 14:26:20 1999
  10079. +++ LAPACK/SRC/sggev.f Fri May 25 16:10:10 2001
  10080. @@ -5,6 +5,7 @@
  10081. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  10082. * Courant Institute, Argonne National Lab, and Rice University
  10083. * June 30, 1999
  10084. +* 8-15-00: Improve consistency of WS calculations (eca)
  10085. *
  10086. * .. Scalar Arguments ..
  10087. CHARACTER JOBVL, JOBVR
  10088. @@ -123,10 +124,9 @@
  10089. * The dimension of the array WORK. LWORK >= max(1,8*N).
  10090. * For good performance, LWORK must generally be larger.
  10091. *
  10092. -* If LWORK = -1, then a workspace query is assumed; the routine
  10093. -* only calculates the optimal size of the WORK array, returns
  10094. -* this value as the first entry of the WORK array, and no error
  10095. -* message related to LWORK is issued by XERBLA.
  10096. +* If LWORK = -1, a workspace query is assumed. The optimal
  10097. +* size for the WORK array is calculated and stored in WORK(1),
  10098. +* and no other work except argument checking is performed.
  10099. *
  10100. * INFO (output) INTEGER
  10101. * = 0: successful exit
  10102. @@ -141,11 +141,13 @@
  10103. * =====================================================================
  10104. *
  10105. * .. Parameters ..
  10106. + INTEGER LQUERV
  10107. + PARAMETER ( LQUERV = -1 )
  10108. REAL ZERO, ONE
  10109. PARAMETER ( ZERO = 0.0E+0, ONE = 1.0E+0 )
  10110. * ..
  10111. * .. Local Scalars ..
  10112. - LOGICAL ILASCL, ILBSCL, ILV, ILVL, ILVR, LQUERY
  10113. + LOGICAL ILASCL, ILBSCL, ILV, ILVL, ILVR
  10114. CHARACTER CHTEMP
  10115. INTEGER ICOLS, IERR, IHI, IJOBVL, IJOBVR, ILEFT, ILO,
  10116. $ IN, IRIGHT, IROWS, ITAU, IWRK, JC, JR, MAXWRK,
  10117. @@ -200,7 +202,6 @@
  10118. * Test the input arguments
  10119. *
  10120. INFO = 0
  10121. - LQUERY = ( LWORK.EQ.-1 )
  10122. IF( IJOBVL.LE.0 ) THEN
  10123. INFO = -1
  10124. ELSE IF( IJOBVR.LE.0 ) THEN
  10125. @@ -226,24 +227,21 @@
  10126. * computed assuming ILO = 1 and IHI = N, the worst case.)
  10127. *
  10128. MINWRK = 1
  10129. - IF( INFO.EQ.0 .AND. ( LWORK.GE.1 .OR. LQUERY ) ) THEN
  10130. + IF( INFO.EQ.0 ) THEN
  10131. MAXWRK = 7*N + N*ILAENV( 1, 'SGEQRF', ' ', N, 1, N, 0 )
  10132. MINWRK = MAX( 1, 8*N )
  10133. WORK( 1 ) = MAXWRK
  10134. + IF( LWORK.LT.MINWRK .AND. LWORK.NE.LQUERV )
  10135. + $ INFO = -16
  10136. END IF
  10137. *
  10138. - IF( LWORK.LT.MINWRK .AND. .NOT.LQUERY )
  10139. - $ INFO = -16
  10140. +* Quick returns
  10141. *
  10142. IF( INFO.NE.0 ) THEN
  10143. CALL XERBLA( 'SGGEV ', -INFO )
  10144. RETURN
  10145. - ELSE IF( LQUERY ) THEN
  10146. - RETURN
  10147. END IF
  10148. -*
  10149. -* Quick return if possible
  10150. -*
  10151. + IF( LWORK.EQ.LQUERV ) RETURN
  10152. IF( N.EQ.0 )
  10153. $ RETURN
  10154. *
  10155. diff -uNr LAPACK.orig/SRC/sggevx.f LAPACK/SRC/sggevx.f
  10156. --- LAPACK.orig/SRC/sggevx.f Thu Nov 4 14:26:20 1999
  10157. +++ LAPACK/SRC/sggevx.f Fri May 25 16:11:25 2001
  10158. @@ -7,6 +7,7 @@
  10159. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  10160. * Courant Institute, Argonne National Lab, and Rice University
  10161. * June 30, 1999
  10162. +* 8-15-00: Improve consistency of WS calculations (eca)
  10163. *
  10164. * .. Scalar Arguments ..
  10165. CHARACTER BALANC, JOBVL, JOBVR, SENSE
  10166. @@ -212,10 +213,9 @@
  10167. * If SENSE = 'E', LWORK >= 12*N.
  10168. * If SENSE = 'V' or 'B', LWORK >= 2*N*N+12*N+16.
  10169. *
  10170. -* If LWORK = -1, then a workspace query is assumed; the routine
  10171. -* only calculates the optimal size of the WORK array, returns
  10172. -* this value as the first entry of the WORK array, and no error
  10173. -* message related to LWORK is issued by XERBLA.
  10174. +* If LWORK = -1, a workspace query is assumed. The optimal
  10175. +* size for the WORK array is calculated and stored in WORK(1),
  10176. +* and no other work except argument checking is performed.
  10177. *
  10178. * IWORK (workspace) INTEGER array, dimension (N+6)
  10179. * If SENSE = 'E', IWORK is not referenced.
  10180. @@ -262,12 +262,14 @@
  10181. * =====================================================================
  10182. *
  10183. * .. Parameters ..
  10184. + INTEGER LQUERV
  10185. + PARAMETER ( LQUERV = -1 )
  10186. REAL ZERO, ONE
  10187. PARAMETER ( ZERO = 0.0E+0, ONE = 1.0E+0 )
  10188. * ..
  10189. * .. Local Scalars ..
  10190. - LOGICAL ILASCL, ILBSCL, ILV, ILVL, ILVR, LQUERY, PAIR,
  10191. - $ WANTSB, WANTSE, WANTSN, WANTSV
  10192. + LOGICAL ILASCL, ILBSCL, ILV, ILVL, ILVR, PAIR, WANTSB,
  10193. + $ WANTSE, WANTSN, WANTSV
  10194. CHARACTER CHTEMP
  10195. INTEGER I, ICOLS, IERR, IJOBVL, IJOBVR, IN, IROWS,
  10196. $ ITAU, IWRK, IWRK1, J, JC, JR, M, MAXWRK,
  10197. @@ -327,7 +329,6 @@
  10198. * Test the input arguments
  10199. *
  10200. INFO = 0
  10201. - LQUERY = ( LWORK.EQ.-1 )
  10202. IF( .NOT.( LSAME( BALANC, 'N' ) .OR. LSAME( BALANC,
  10203. $ 'S' ) .OR. LSAME( BALANC, 'P' ) .OR. LSAME( BALANC, 'B' ) ) )
  10204. $ THEN
  10205. @@ -360,7 +361,7 @@
  10206. * computed assuming ILO = 1 and IHI = N, the worst case.)
  10207. *
  10208. MINWRK = 1
  10209. - IF( INFO.EQ.0 .AND. ( LWORK.GE.1 .OR. LQUERY ) ) THEN
  10210. + IF( INFO.EQ.0 ) THEN
  10211. MAXWRK = 5*N + N*ILAENV( 1, 'SGEQRF', ' ', N, 1, N, 0 )
  10212. MINWRK = MAX( 1, 6*N )
  10213. IF( WANTSE ) THEN
  10214. @@ -370,24 +371,19 @@
  10215. MAXWRK = MAX( MAXWRK, 2*N*N+12*N+16 )
  10216. END IF
  10217. WORK( 1 ) = MAXWRK
  10218. + IF( LWORK.LT.MINWRK .AND. LWORK.NE.LQUERV )
  10219. + $ INFO = -26
  10220. END IF
  10221. *
  10222. - IF( LWORK.LT.MINWRK .AND. .NOT.LQUERY ) THEN
  10223. - INFO = -26
  10224. - END IF
  10225. +* Quick returns
  10226. *
  10227. IF( INFO.NE.0 ) THEN
  10228. CALL XERBLA( 'SGGEVX', -INFO )
  10229. RETURN
  10230. - ELSE IF( LQUERY ) THEN
  10231. - RETURN
  10232. END IF
  10233. -*
  10234. -* Quick return if possible
  10235. -*
  10236. + IF( LWORK.EQ.LQUERV ) RETURN
  10237. IF( N.EQ.0 )
  10238. $ RETURN
  10239. -*
  10240. *
  10241. * Get machine constants
  10242. *
  10243. diff -uNr LAPACK.orig/SRC/sgghrd.f LAPACK/SRC/sgghrd.f
  10244. --- LAPACK.orig/SRC/sgghrd.f Thu Nov 4 14:25:44 1999
  10245. +++ LAPACK/SRC/sgghrd.f Fri May 25 16:11:45 2001
  10246. @@ -4,7 +4,7 @@
  10247. * -- LAPACK routine (version 3.0) --
  10248. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  10249. * Courant Institute, Argonne National Lab, and Rice University
  10250. -* September 30, 1994
  10251. +* April 26, 2001
  10252. *
  10253. * .. Scalar Arguments ..
  10254. CHARACTER COMPQ, COMPZ
  10255. @@ -20,16 +20,32 @@
  10256. *
  10257. * SGGHRD reduces a pair of real matrices (A,B) to generalized upper
  10258. * Hessenberg form using orthogonal transformations, where A is a
  10259. -* general matrix and B is upper triangular: Q' * A * Z = H and
  10260. -* Q' * B * Z = T, where H is upper Hessenberg, T is upper triangular,
  10261. -* and Q and Z are orthogonal, and ' means transpose.
  10262. +* general matrix and B is upper triangular. The form of the
  10263. +* generalized eigenvalue problem is
  10264. +* A*x = lambda*B*x,
  10265. +* and B is typically made upper triangular by computing its QR
  10266. +* factorization and moving the orthogonal matrix Q to the left side
  10267. +* of the equation.
  10268. +*
  10269. +* This subroutine simultaneously reduces A to a Hessenberg matrix H:
  10270. +* Q**T*A*Z = H
  10271. +* and transforms B to another upper triangular matrix T:
  10272. +* Q**T*B*Z = T
  10273. +* in order to reduce the problem to its standard form
  10274. +* H*y = lambda*T*y
  10275. +* where y = Z**T*x.
  10276. *
  10277. * The orthogonal matrices Q and Z are determined as products of Givens
  10278. * rotations. They may either be formed explicitly, or they may be
  10279. -* postmultiplied into input matrices Q1 and Z1, so that
  10280. +* postmultiplied into input matrices Q1 and Z1, so that
  10281. *
  10282. -* Q1 * A * Z1' = (Q1*Q) * H * (Z1*Z)'
  10283. -* Q1 * B * Z1' = (Q1*Q) * T * (Z1*Z)'
  10284. +* Q1 * A * Z1**T = (Q1*Q) * H * (Z1*Z)**T
  10285. +*
  10286. +* Q1 * B * Z1**T = (Q1*Q) * T * (Z1*Z)**T
  10287. +*
  10288. +* If Q1 is the orthogonal matrix from the QR factorization of B in the
  10289. +* original equation A*x = lambda*B*x, then SGGHRD reduces the original
  10290. +* problem to generalized Hessenberg form.
  10291. *
  10292. * Arguments
  10293. * =========
  10294. @@ -53,10 +69,11 @@
  10295. *
  10296. * ILO (input) INTEGER
  10297. * IHI (input) INTEGER
  10298. -* It is assumed that A is already upper triangular in rows and
  10299. -* columns 1:ILO-1 and IHI+1:N. ILO and IHI are normally set
  10300. -* by a previous call to SGGBAL; otherwise they should be set
  10301. -* to 1 and N respectively.
  10302. +* ILO and IHI mark the rows and columns of A which are to be
  10303. +* reduced. It is assumed that A is already upper triangular
  10304. +* in rows and columns 1:ILO-1 and IHI+1:N. ILO and IHI are
  10305. +* normally set by a previous call to SGGBAL; otherwise they
  10306. +* should be set to 1 and N respectively.
  10307. * 1 <= ILO <= IHI <= N, if N > 0; ILO=1 and IHI=0, if N=0.
  10308. *
  10309. * A (input/output) REAL array, dimension (LDA, N)
  10310. @@ -70,33 +87,28 @@
  10311. *
  10312. * B (input/output) REAL array, dimension (LDB, N)
  10313. * On entry, the N-by-N upper triangular matrix B.
  10314. -* On exit, the upper triangular matrix T = Q' B Z. The
  10315. +* On exit, the upper triangular matrix T = Q**T B Z. The
  10316. * elements below the diagonal are set to zero.
  10317. *
  10318. * LDB (input) INTEGER
  10319. * The leading dimension of the array B. LDB >= max(1,N).
  10320. *
  10321. * Q (input/output) REAL array, dimension (LDQ, N)
  10322. -* If COMPQ='N': Q is not referenced.
  10323. -* If COMPQ='I': on entry, Q need not be set, and on exit it
  10324. -* contains the orthogonal matrix Q, where Q'
  10325. -* is the product of the Givens transformations
  10326. -* which are applied to A and B on the left.
  10327. -* If COMPQ='V': on entry, Q must contain an orthogonal matrix
  10328. -* Q1, and on exit this is overwritten by Q1*Q.
  10329. +* On entry, if COMPQ = 'V', the orthogonal matrix Q1,
  10330. +* typically from the QR factorization of B.
  10331. +* On exit, if COMPQ='I', the orthogonal matrix Q, and if
  10332. +* COMPQ = 'V', the product Q1*Q.
  10333. +* Not referenced if COMPQ='N'.
  10334. *
  10335. * LDQ (input) INTEGER
  10336. * The leading dimension of the array Q.
  10337. * LDQ >= N if COMPQ='V' or 'I'; LDQ >= 1 otherwise.
  10338. *
  10339. * Z (input/output) REAL array, dimension (LDZ, N)
  10340. -* If COMPZ='N': Z is not referenced.
  10341. -* If COMPZ='I': on entry, Z need not be set, and on exit it
  10342. -* contains the orthogonal matrix Z, which is
  10343. -* the product of the Givens transformations
  10344. -* which are applied to A and B on the right.
  10345. -* If COMPZ='V': on entry, Z must contain an orthogonal matrix
  10346. -* Z1, and on exit this is overwritten by Z1*Z.
  10347. +* On entry, if COMPZ = 'V', the orthogonal matrix Z1.
  10348. +* On exit, if COMPZ='I', the orthogonal matrix Z, and if
  10349. +* COMPZ = 'V', the product Z1*Z.
  10350. +* Not referenced if COMPZ='N'.
  10351. *
  10352. * LDZ (input) INTEGER
  10353. * The leading dimension of the array Z.
  10354. diff -uNr LAPACK.orig/SRC/shgeqz.f LAPACK/SRC/shgeqz.f
  10355. --- LAPACK.orig/SRC/shgeqz.f Thu Nov 4 14:23:36 1999
  10356. +++ LAPACK/SRC/shgeqz.f Fri May 25 16:12:05 2001
  10357. @@ -1,56 +1,75 @@
  10358. - SUBROUTINE SHGEQZ( JOB, COMPQ, COMPZ, N, ILO, IHI, A, LDA, B, LDB,
  10359. + SUBROUTINE SHGEQZ( JOB, COMPQ, COMPZ, N, ILO, IHI, H, LDH, T, LDT,
  10360. $ ALPHAR, ALPHAI, BETA, Q, LDQ, Z, LDZ, WORK,
  10361. $ LWORK, INFO )
  10362. *
  10363. * -- LAPACK routine (version 3.0) --
  10364. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  10365. * Courant Institute, Argonne National Lab, and Rice University
  10366. -* June 30, 1999
  10367. +* May 3, 2001
  10368. *
  10369. * .. Scalar Arguments ..
  10370. CHARACTER COMPQ, COMPZ, JOB
  10371. - INTEGER IHI, ILO, INFO, LDA, LDB, LDQ, LDZ, LWORK, N
  10372. + INTEGER IHI, ILO, INFO, LDH, LDQ, LDT, LDZ, LWORK, N
  10373. * ..
  10374. * .. Array Arguments ..
  10375. - REAL A( LDA, * ), ALPHAI( * ), ALPHAR( * ),
  10376. - $ B( LDB, * ), BETA( * ), Q( LDQ, * ), WORK( * ),
  10377. - $ Z( LDZ, * )
  10378. + REAL ALPHAI( * ), ALPHAR( * ), BETA( * ),
  10379. + $ H( LDH, * ), Q( LDQ, * ), T( LDT, * ),
  10380. + $ WORK( * ), Z( LDZ, * )
  10381. * ..
  10382. *
  10383. * Purpose
  10384. * =======
  10385. *
  10386. -* SHGEQZ implements a single-/double-shift version of the QZ method for
  10387. -* finding the generalized eigenvalues
  10388. -*
  10389. -* w(j)=(ALPHAR(j) + i*ALPHAI(j))/BETAR(j) of the equation
  10390. -*
  10391. -* det( A - w(i) B ) = 0
  10392. -*
  10393. -* In addition, the pair A,B may be reduced to generalized Schur form:
  10394. -* B is upper triangular, and A is block upper triangular, where the
  10395. -* diagonal blocks are either 1-by-1 or 2-by-2, the 2-by-2 blocks having
  10396. -* complex generalized eigenvalues (see the description of the argument
  10397. -* JOB.)
  10398. -*
  10399. -* If JOB='S', then the pair (A,B) is simultaneously reduced to Schur
  10400. -* form by applying one orthogonal tranformation (usually called Q) on
  10401. -* the left and another (usually called Z) on the right. The 2-by-2
  10402. -* upper-triangular diagonal blocks of B corresponding to 2-by-2 blocks
  10403. -* of A will be reduced to positive diagonal matrices. (I.e.,
  10404. -* if A(j+1,j) is non-zero, then B(j+1,j)=B(j,j+1)=0 and B(j,j) and
  10405. -* B(j+1,j+1) will be positive.)
  10406. -*
  10407. -* If JOB='E', then at each iteration, the same transformations
  10408. -* are computed, but they are only applied to those parts of A and B
  10409. -* which are needed to compute ALPHAR, ALPHAI, and BETAR.
  10410. -*
  10411. -* If JOB='S' and COMPQ and COMPZ are 'V' or 'I', then the orthogonal
  10412. -* transformations used to reduce (A,B) are accumulated into the arrays
  10413. -* Q and Z s.t.:
  10414. -*
  10415. -* Q(in) A(in) Z(in)* = Q(out) A(out) Z(out)*
  10416. -* Q(in) B(in) Z(in)* = Q(out) B(out) Z(out)*
  10417. +* SHGEQZ computes the eigenvalues of a real matrix pair (H,T),
  10418. +* where H is an upper Hessenberg matrix and T is upper triangular,
  10419. +* using the double-shift QZ method.
  10420. +* Matrix pairs of this type are produced by the reduction to
  10421. +* generalized upper Hessenberg form of a real matrix pair (A,B):
  10422. +*
  10423. +* A = Q1*H*Z1**T, B = Q1*T*Z1**T,
  10424. +*
  10425. +* as computed by SGGHRD.
  10426. +*
  10427. +* If JOB='S', then the Hessenberg-triangular pair (H,T) is
  10428. +* also reduced to generalized Schur form,
  10429. +*
  10430. +* H = Q*S*Z**T, T = Q*P*Z**T,
  10431. +*
  10432. +* where Q and Z are orthogonal matrices, P is an upper triangular
  10433. +* matrix, and S is a quasi-triangular matrix with 1-by-1 and 2-by-2
  10434. +* diagonal blocks.
  10435. +*
  10436. +* The 1-by-1 blocks correspond to real eigenvalues of the matrix pair
  10437. +* (H,T) and the 2-by-2 blocks correspond to complex conjugate pairs of
  10438. +* eigenvalues.
  10439. +*
  10440. +* Additionally, the 2-by-2 upper triangular diagonal blocks of P
  10441. +* corresponding to 2-by-2 blocks of S are reduced to positive diagonal
  10442. +* form, i.e., if S(j+1,j) is non-zero, then P(j+1,j) = P(j,j+1) = 0,
  10443. +* P(j,j) > 0, and P(j+1,j+1) > 0.
  10444. +*
  10445. +* Optionally, the orthogonal matrix Q from the generalized Schur
  10446. +* factorization may be postmultiplied into an input matrix Q1, and the
  10447. +* orthogonal matrix Z may be postmultiplied into an input matrix Z1.
  10448. +* If Q1 and Z1 are the orthogonal matrices from SGGHRD that reduced
  10449. +* the matrix pair (A,B) to generalized upper Hessenberg form, then the
  10450. +* output matrices Q1*Q and Z1*Z are the orthogonal factors from the
  10451. +* generalized Schur factorization of (A,B):
  10452. +*
  10453. +* A = (Q1*Q)*S*(Z1*Z)**T, B = (Q1*Q)*P*(Z1*Z)**T.
  10454. +*
  10455. +* To avoid overflow, eigenvalues of the matrix pair (H,T) (equivalently,
  10456. +* of (A,B)) are computed as a pair of values (alpha,beta), where alpha is
  10457. +* complex and beta real.
  10458. +* If beta is nonzero, lambda = alpha / beta is an eigenvalue of the
  10459. +* generalized nonsymmetric eigenvalue problem (GNEP)
  10460. +* A*x = lambda*B*x
  10461. +* and if alpha is nonzero, mu = beta / alpha is an eigenvalue of the
  10462. +* alternate form of the GNEP
  10463. +* mu*A*y = B*y.
  10464. +* Real eigenvalues can be read directly from the generalized Schur
  10465. +* form:
  10466. +* alpha = S(i,i), beta = P(i,i).
  10467. *
  10468. * Ref: C.B. Moler & G.W. Stewart, "An Algorithm for Generalized Matrix
  10469. * Eigenvalue Problems", SIAM J. Numer. Anal., 10(1973),
  10470. @@ -60,114 +79,98 @@
  10471. * =========
  10472. *
  10473. * JOB (input) CHARACTER*1
  10474. -* = 'E': compute only ALPHAR, ALPHAI, and BETA. A and B will
  10475. -* not necessarily be put into generalized Schur form.
  10476. -* = 'S': put A and B into generalized Schur form, as well
  10477. -* as computing ALPHAR, ALPHAI, and BETA.
  10478. +* = 'E': Compute eigenvalues only;
  10479. +* = 'S': Compute eigenvalues and the Schur form.
  10480. *
  10481. * COMPQ (input) CHARACTER*1
  10482. -* = 'N': do not modify Q.
  10483. -* = 'V': multiply the array Q on the right by the transpose of
  10484. -* the orthogonal tranformation that is applied to the
  10485. -* left side of A and B to reduce them to Schur form.
  10486. -* = 'I': like COMPQ='V', except that Q will be initialized to
  10487. -* the identity first.
  10488. +* = 'N': Left Schur vectors (Q) are not computed;
  10489. +* = 'I': Q is initialized to the unit matrix and the matrix Q
  10490. +* of left Schur vectors of (H,T) is returned;
  10491. +* = 'V': Q must contain an orthogonal matrix Q1 on entry and
  10492. +* the product Q1*Q is returned.
  10493. *
  10494. * COMPZ (input) CHARACTER*1
  10495. -* = 'N': do not modify Z.
  10496. -* = 'V': multiply the array Z on the right by the orthogonal
  10497. -* tranformation that is applied to the right side of
  10498. -* A and B to reduce them to Schur form.
  10499. -* = 'I': like COMPZ='V', except that Z will be initialized to
  10500. -* the identity first.
  10501. +* = 'N': Right Schur vectors (Z) are not computed;
  10502. +* = 'I': Z is initialized to the unit matrix and the matrix Z
  10503. +* of right Schur vectors of (H,T) is returned;
  10504. +* = 'V': Z must contain an orthogonal matrix Z1 on entry and
  10505. +* the product Z1*Z is returned.
  10506. *
  10507. * N (input) INTEGER
  10508. -* The order of the matrices A, B, Q, and Z. N >= 0.
  10509. +* The order of the matrices H, T, Q, and Z. N >= 0.
  10510. *
  10511. * ILO (input) INTEGER
  10512. * IHI (input) INTEGER
  10513. -* It is assumed that A is already upper triangular in rows and
  10514. -* columns 1:ILO-1 and IHI+1:N.
  10515. -* 1 <= ILO <= IHI <= N, if N > 0; ILO=1 and IHI=0, if N=0.
  10516. -*
  10517. -* A (input/output) REAL array, dimension (LDA, N)
  10518. -* On entry, the N-by-N upper Hessenberg matrix A. Elements
  10519. -* below the subdiagonal must be zero.
  10520. -* If JOB='S', then on exit A and B will have been
  10521. -* simultaneously reduced to generalized Schur form.
  10522. -* If JOB='E', then on exit A will have been destroyed.
  10523. -* The diagonal blocks will be correct, but the off-diagonal
  10524. -* portion will be meaningless.
  10525. -*
  10526. -* LDA (input) INTEGER
  10527. -* The leading dimension of the array A. LDA >= max( 1, N ).
  10528. -*
  10529. -* B (input/output) REAL array, dimension (LDB, N)
  10530. -* On entry, the N-by-N upper triangular matrix B. Elements
  10531. -* below the diagonal must be zero. 2-by-2 blocks in B
  10532. -* corresponding to 2-by-2 blocks in A will be reduced to
  10533. -* positive diagonal form. (I.e., if A(j+1,j) is non-zero,
  10534. -* then B(j+1,j)=B(j,j+1)=0 and B(j,j) and B(j+1,j+1) will be
  10535. -* positive.)
  10536. -* If JOB='S', then on exit A and B will have been
  10537. -* simultaneously reduced to Schur form.
  10538. -* If JOB='E', then on exit B will have been destroyed.
  10539. -* Elements corresponding to diagonal blocks of A will be
  10540. -* correct, but the off-diagonal portion will be meaningless.
  10541. +* ILO and IHI mark the rows and columns of H which are in
  10542. +* Hessenberg form. It is assumed that A is already upper
  10543. +* triangular in rows and columns 1:ILO-1 and IHI+1:N.
  10544. +* If N > 0, 1 <= ILO <= IHI <= N; if N = 0, ILO=1 and IHI=0.
  10545. +*
  10546. +* H (input/output) REAL array, dimension (LDH, N)
  10547. +* On entry, the N-by-N upper Hessenberg matrix H.
  10548. +* On exit, if JOB = 'S', H contains the upper quasi-triangular
  10549. +* matrix S from the generalized Schur factorization;
  10550. +* 2-by-2 diagonal blocks (corresponding to complex conjugate
  10551. +* pairs of eigenvalues) are returned in standard form, with
  10552. +* H(i,i) = H(i+1,i+1) and H(i+1,i)*H(i,i+1) < 0.
  10553. +* If JOB = 'E', the diagonal blocks of H match those of S, but
  10554. +* the rest of H is unspecified.
  10555. +*
  10556. +* LDH (input) INTEGER
  10557. +* The leading dimension of the array H. LDH >= max( 1, N ).
  10558. +*
  10559. +* T (input/output) REAL array, dimension (LDT, N)
  10560. +* On entry, the N-by-N upper triangular matrix T.
  10561. +* On exit, if JOB = 'S', T contains the upper triangular
  10562. +* matrix P from the generalized Schur factorization;
  10563. +* 2-by-2 diagonal blocks of P corresponding to 2-by-2 blocks of S
  10564. +* are reduced to positive diagonal form, i.e., if H(j+1,j) is
  10565. +* non-zero, then T(j+1,j) = T(j,j+1) = 0, T(j,j) > 0, and
  10566. +* T(j+1,j+1) > 0.
  10567. +* If JOB = 'E', the diagonal blocks of T match those of P, but
  10568. +* the rest of T is unspecified.
  10569. *
  10570. -* LDB (input) INTEGER
  10571. -* The leading dimension of the array B. LDB >= max( 1, N ).
  10572. +* LDT (input) INTEGER
  10573. +* The leading dimension of the array T. LDT >= max( 1, N ).
  10574. *
  10575. * ALPHAR (output) REAL array, dimension (N)
  10576. -* ALPHAR(1:N) will be set to real parts of the diagonal
  10577. -* elements of A that would result from reducing A and B to
  10578. -* Schur form and then further reducing them both to triangular
  10579. -* form using unitary transformations s.t. the diagonal of B
  10580. -* was non-negative real. Thus, if A(j,j) is in a 1-by-1 block
  10581. -* (i.e., A(j+1,j)=A(j,j+1)=0), then ALPHAR(j)=A(j,j).
  10582. -* Note that the (real or complex) values
  10583. -* (ALPHAR(j) + i*ALPHAI(j))/BETA(j), j=1,...,N, are the
  10584. -* generalized eigenvalues of the matrix pencil A - wB.
  10585. +* The real parts of each scalar alpha defining an eigenvalue
  10586. +* of GNEP.
  10587. *
  10588. * ALPHAI (output) REAL array, dimension (N)
  10589. -* ALPHAI(1:N) will be set to imaginary parts of the diagonal
  10590. -* elements of A that would result from reducing A and B to
  10591. -* Schur form and then further reducing them both to triangular
  10592. -* form using unitary transformations s.t. the diagonal of B
  10593. -* was non-negative real. Thus, if A(j,j) is in a 1-by-1 block
  10594. -* (i.e., A(j+1,j)=A(j,j+1)=0), then ALPHAR(j)=0.
  10595. -* Note that the (real or complex) values
  10596. -* (ALPHAR(j) + i*ALPHAI(j))/BETA(j), j=1,...,N, are the
  10597. -* generalized eigenvalues of the matrix pencil A - wB.
  10598. +* The imaginary parts of each scalar alpha defining an
  10599. +* eigenvalue of GNEP.
  10600. +* If ALPHAI(j) is zero, then the j-th eigenvalue is real; if
  10601. +* positive, then the j-th and (j+1)-st eigenvalues are a
  10602. +* complex conjugate pair, with ALPHAI(j+1) = -ALPHAI(j).
  10603. *
  10604. * BETA (output) REAL array, dimension (N)
  10605. -* BETA(1:N) will be set to the (real) diagonal elements of B
  10606. -* that would result from reducing A and B to Schur form and
  10607. -* then further reducing them both to triangular form using
  10608. -* unitary transformations s.t. the diagonal of B was
  10609. -* non-negative real. Thus, if A(j,j) is in a 1-by-1 block
  10610. -* (i.e., A(j+1,j)=A(j,j+1)=0), then BETA(j)=B(j,j).
  10611. -* Note that the (real or complex) values
  10612. -* (ALPHAR(j) + i*ALPHAI(j))/BETA(j), j=1,...,N, are the
  10613. -* generalized eigenvalues of the matrix pencil A - wB.
  10614. -* (Note that BETA(1:N) will always be non-negative, and no
  10615. -* BETAI is necessary.)
  10616. +* The scalars beta that define the eigenvalues of GNEP.
  10617. +* Together, the quantities alpha = (ALPHAR(j),ALPHAI(j)) and
  10618. +* beta = BETA(j) represent the j-th eigenvalue of the matrix
  10619. +* pair (A,B), in one of the forms lambda = alpha/beta or
  10620. +* mu = beta/alpha. Since either lambda or mu may overflow,
  10621. +* they should not, in general, be computed.
  10622. *
  10623. * Q (input/output) REAL array, dimension (LDQ, N)
  10624. -* If COMPQ='N', then Q will not be referenced.
  10625. -* If COMPQ='V' or 'I', then the transpose of the orthogonal
  10626. -* transformations which are applied to A and B on the left
  10627. -* will be applied to the array Q on the right.
  10628. +* On entry, if COMPZ = 'V', the orthogonal matrix Q1 used in
  10629. +* the reduction of (A,B) to generalized Hessenberg form.
  10630. +* On exit, if COMPZ = 'I', the orthogonal matrix of left Schur
  10631. +* vectors of (H,T), and if COMPZ = 'V', the orthogonal matrix
  10632. +* of left Schur vectors of (A,B).
  10633. +* Not referenced if COMPZ = 'N'.
  10634. *
  10635. * LDQ (input) INTEGER
  10636. * The leading dimension of the array Q. LDQ >= 1.
  10637. * If COMPQ='V' or 'I', then LDQ >= N.
  10638. *
  10639. * Z (input/output) REAL array, dimension (LDZ, N)
  10640. -* If COMPZ='N', then Z will not be referenced.
  10641. -* If COMPZ='V' or 'I', then the orthogonal transformations
  10642. -* which are applied to A and B on the right will be applied
  10643. -* to the array Z on the right.
  10644. +* On entry, if COMPZ = 'V', the orthogonal matrix Z1 used in
  10645. +* the reduction of (A,B) to generalized Hessenberg form.
  10646. +* On exit, if COMPZ = 'I', the orthogonal matrix of
  10647. +* right Schur vectors of (H,T), and if COMPZ = 'V', the
  10648. +* orthogonal matrix of right Schur vectors of (A,B).
  10649. +* Not referenced if COMPZ = 'N'.
  10650. *
  10651. * LDZ (input) INTEGER
  10652. * The leading dimension of the array Z. LDZ >= 1.
  10653. @@ -187,13 +190,12 @@
  10654. * INFO (output) INTEGER
  10655. * = 0: successful exit
  10656. * < 0: if INFO = -i, the i-th argument had an illegal value
  10657. -* = 1,...,N: the QZ iteration did not converge. (A,B) is not
  10658. +* = 1,...,N: the QZ iteration did not converge. (H,T) is not
  10659. * in Schur form, but ALPHAR(i), ALPHAI(i), and
  10660. * BETA(i), i=INFO+1,...,N should be correct.
  10661. -* = N+1,...,2*N: the shift calculation failed. (A,B) is not
  10662. +* = N+1,...,2*N: the shift calculation failed. (H,T) is not
  10663. * in Schur form, but ALPHAR(i), ALPHAI(i), and
  10664. * BETA(i), i=INFO-N+1,...,N should be correct.
  10665. -* > 2*N: various "impossible" errors.
  10666. *
  10667. * Further Details
  10668. * ===============
  10669. @@ -225,7 +227,7 @@
  10670. $ B1R, B22, B2A, B2I, B2R, BN, BNORM, BSCALE,
  10671. $ BTOL, C, C11I, C11R, C12, C21, C22I, C22R, CL,
  10672. $ CQ, CR, CZ, ESHIFT, S, S1, S1INV, S2, SAFMAX,
  10673. - $ SAFMIN, SCALE, SL, SQI, SQR, SR, SZI, SZR, T,
  10674. + $ SAFMIN, SCALE, SL, SQI, SQR, SR, SZI, SZR, T1,
  10675. $ TAU, TEMP, TEMP2, TEMPI, TEMPR, U1, U12, U12L,
  10676. $ U2, ULP, VS, W11, W12, W21, W22, WABS, WI, WR,
  10677. $ WR2
  10678. @@ -302,9 +304,9 @@
  10679. INFO = -5
  10680. ELSE IF( IHI.GT.N .OR. IHI.LT.ILO-1 ) THEN
  10681. INFO = -6
  10682. - ELSE IF( LDA.LT.N ) THEN
  10683. + ELSE IF( LDH.LT.N ) THEN
  10684. INFO = -8
  10685. - ELSE IF( LDB.LT.N ) THEN
  10686. + ELSE IF( LDT.LT.N ) THEN
  10687. INFO = -10
  10688. ELSE IF( LDQ.LT.1 .OR. ( ILQ .AND. LDQ.LT.N ) ) THEN
  10689. INFO = -15
  10690. @@ -340,8 +342,8 @@
  10691. SAFMIN = SLAMCH( 'S' )
  10692. SAFMAX = ONE / SAFMIN
  10693. ULP = SLAMCH( 'E' )*SLAMCH( 'B' )
  10694. - ANORM = SLANHS( 'F', IN, A( ILO, ILO ), LDA, WORK )
  10695. - BNORM = SLANHS( 'F', IN, B( ILO, ILO ), LDB, WORK )
  10696. + ANORM = SLANHS( 'F', IN, H( ILO, ILO ), LDH, WORK )
  10697. + BNORM = SLANHS( 'F', IN, T( ILO, ILO ), LDT, WORK )
  10698. ATOL = MAX( SAFMIN, ULP*ANORM )
  10699. BTOL = MAX( SAFMIN, ULP*BNORM )
  10700. ASCALE = ONE / MAX( SAFMIN, ANORM )
  10701. @@ -350,15 +352,15 @@
  10702. * Set Eigenvalues IHI+1:N
  10703. *
  10704. DO 30 J = IHI + 1, N
  10705. - IF( B( J, J ).LT.ZERO ) THEN
  10706. + IF( T( J, J ).LT.ZERO ) THEN
  10707. IF( ILSCHR ) THEN
  10708. DO 10 JR = 1, J
  10709. - A( JR, J ) = -A( JR, J )
  10710. - B( JR, J ) = -B( JR, J )
  10711. + H( JR, J ) = -H( JR, J )
  10712. + T( JR, J ) = -T( JR, J )
  10713. 10 CONTINUE
  10714. ELSE
  10715. - A( J, J ) = -A( J, J )
  10716. - B( J, J ) = -B( J, J )
  10717. + H( J, J ) = -H( J, J )
  10718. + T( J, J ) = -T( J, J )
  10719. END IF
  10720. IF( ILZ ) THEN
  10721. DO 20 JR = 1, N
  10722. @@ -366,9 +368,9 @@
  10723. 20 CONTINUE
  10724. END IF
  10725. END IF
  10726. - ALPHAR( J ) = A( J, J )
  10727. + ALPHAR( J ) = H( J, J )
  10728. ALPHAI( J ) = ZERO
  10729. - BETA( J ) = B( J, J )
  10730. + BETA( J ) = T( J, J )
  10731. 30 CONTINUE
  10732. *
  10733. * If IHI < ILO, skip QZ steps
  10734. @@ -408,8 +410,8 @@
  10735. * Split the matrix if possible.
  10736. *
  10737. * Two tests:
  10738. -* 1: A(j,j-1)=0 or j=ILO
  10739. -* 2: B(j,j)=0
  10740. +* 1: H(j,j-1)=0 or j=ILO
  10741. +* 2: T(j,j)=0
  10742. *
  10743. IF( ILAST.EQ.ILO ) THEN
  10744. *
  10745. @@ -417,14 +419,14 @@
  10746. *
  10747. GO TO 80
  10748. ELSE
  10749. - IF( ABS( A( ILAST, ILAST-1 ) ).LE.ATOL ) THEN
  10750. - A( ILAST, ILAST-1 ) = ZERO
  10751. + IF( ABS( H( ILAST, ILAST-1 ) ).LE.ATOL ) THEN
  10752. + H( ILAST, ILAST-1 ) = ZERO
  10753. GO TO 80
  10754. END IF
  10755. END IF
  10756. *
  10757. - IF( ABS( B( ILAST, ILAST ) ).LE.BTOL ) THEN
  10758. - B( ILAST, ILAST ) = ZERO
  10759. + IF( ABS( T( ILAST, ILAST ) ).LE.BTOL ) THEN
  10760. + T( ILAST, ILAST ) = ZERO
  10761. GO TO 70
  10762. END IF
  10763. *
  10764. @@ -432,36 +434,36 @@
  10765. *
  10766. DO 60 J = ILAST - 1, ILO, -1
  10767. *
  10768. -* Test 1: for A(j,j-1)=0 or j=ILO
  10769. +* Test 1: for H(j,j-1)=0 or j=ILO
  10770. *
  10771. IF( J.EQ.ILO ) THEN
  10772. ILAZRO = .TRUE.
  10773. ELSE
  10774. - IF( ABS( A( J, J-1 ) ).LE.ATOL ) THEN
  10775. - A( J, J-1 ) = ZERO
  10776. + IF( ABS( H( J, J-1 ) ).LE.ATOL ) THEN
  10777. + H( J, J-1 ) = ZERO
  10778. ILAZRO = .TRUE.
  10779. ELSE
  10780. ILAZRO = .FALSE.
  10781. END IF
  10782. END IF
  10783. *
  10784. -* Test 2: for B(j,j)=0
  10785. +* Test 2: for T(j,j)=0
  10786. *
  10787. - IF( ABS( B( J, J ) ).LT.BTOL ) THEN
  10788. - B( J, J ) = ZERO
  10789. + IF( ABS( T( J, J ) ).LT.BTOL ) THEN
  10790. + T( J, J ) = ZERO
  10791. *
  10792. * Test 1a: Check for 2 consecutive small subdiagonals in A
  10793. *
  10794. ILAZR2 = .FALSE.
  10795. IF( .NOT.ILAZRO ) THEN
  10796. - TEMP = ABS( A( J, J-1 ) )
  10797. - TEMP2 = ABS( A( J, J ) )
  10798. + TEMP = ABS( H( J, J-1 ) )
  10799. + TEMP2 = ABS( H( J, J ) )
  10800. TEMPR = MAX( TEMP, TEMP2 )
  10801. IF( TEMPR.LT.ONE .AND. TEMPR.NE.ZERO ) THEN
  10802. TEMP = TEMP / TEMPR
  10803. TEMP2 = TEMP2 / TEMPR
  10804. END IF
  10805. - IF( TEMP*( ASCALE*ABS( A( J+1, J ) ) ).LE.TEMP2*
  10806. + IF( TEMP*( ASCALE*ABS( H( J+1, J ) ) ).LE.TEMP2*
  10807. $ ( ASCALE*ATOL ) )ILAZR2 = .TRUE.
  10808. END IF
  10809. *
  10810. @@ -473,21 +475,21 @@
  10811. *
  10812. IF( ILAZRO .OR. ILAZR2 ) THEN
  10813. DO 40 JCH = J, ILAST - 1
  10814. - TEMP = A( JCH, JCH )
  10815. - CALL SLARTG( TEMP, A( JCH+1, JCH ), C, S,
  10816. - $ A( JCH, JCH ) )
  10817. - A( JCH+1, JCH ) = ZERO
  10818. - CALL SROT( ILASTM-JCH, A( JCH, JCH+1 ), LDA,
  10819. - $ A( JCH+1, JCH+1 ), LDA, C, S )
  10820. - CALL SROT( ILASTM-JCH, B( JCH, JCH+1 ), LDB,
  10821. - $ B( JCH+1, JCH+1 ), LDB, C, S )
  10822. + TEMP = H( JCH, JCH )
  10823. + CALL SLARTG( TEMP, H( JCH+1, JCH ), C, S,
  10824. + $ H( JCH, JCH ) )
  10825. + H( JCH+1, JCH ) = ZERO
  10826. + CALL SROT( ILASTM-JCH, H( JCH, JCH+1 ), LDH,
  10827. + $ H( JCH+1, JCH+1 ), LDH, C, S )
  10828. + CALL SROT( ILASTM-JCH, T( JCH, JCH+1 ), LDT,
  10829. + $ T( JCH+1, JCH+1 ), LDT, C, S )
  10830. IF( ILQ )
  10831. $ CALL SROT( N, Q( 1, JCH ), 1, Q( 1, JCH+1 ), 1,
  10832. $ C, S )
  10833. IF( ILAZR2 )
  10834. - $ A( JCH, JCH-1 ) = A( JCH, JCH-1 )*C
  10835. + $ H( JCH, JCH-1 ) = H( JCH, JCH-1 )*C
  10836. ILAZR2 = .FALSE.
  10837. - IF( ABS( B( JCH+1, JCH+1 ) ).GE.BTOL ) THEN
  10838. + IF( ABS( T( JCH+1, JCH+1 ) ).GE.BTOL ) THEN
  10839. IF( JCH+1.GE.ILAST ) THEN
  10840. GO TO 80
  10841. ELSE
  10842. @@ -495,35 +497,35 @@
  10843. GO TO 110
  10844. END IF
  10845. END IF
  10846. - B( JCH+1, JCH+1 ) = ZERO
  10847. + T( JCH+1, JCH+1 ) = ZERO
  10848. 40 CONTINUE
  10849. GO TO 70
  10850. ELSE
  10851. *
  10852. -* Only test 2 passed -- chase the zero to B(ILAST,ILAST)
  10853. -* Then process as in the case B(ILAST,ILAST)=0
  10854. +* Only test 2 passed -- chase the zero to T(ILAST,ILAST)
  10855. +* Then process as in the case T(ILAST,ILAST)=0
  10856. *
  10857. DO 50 JCH = J, ILAST - 1
  10858. - TEMP = B( JCH, JCH+1 )
  10859. - CALL SLARTG( TEMP, B( JCH+1, JCH+1 ), C, S,
  10860. - $ B( JCH, JCH+1 ) )
  10861. - B( JCH+1, JCH+1 ) = ZERO
  10862. + TEMP = T( JCH, JCH+1 )
  10863. + CALL SLARTG( TEMP, T( JCH+1, JCH+1 ), C, S,
  10864. + $ T( JCH, JCH+1 ) )
  10865. + T( JCH+1, JCH+1 ) = ZERO
  10866. IF( JCH.LT.ILASTM-1 )
  10867. - $ CALL SROT( ILASTM-JCH-1, B( JCH, JCH+2 ), LDB,
  10868. - $ B( JCH+1, JCH+2 ), LDB, C, S )
  10869. - CALL SROT( ILASTM-JCH+2, A( JCH, JCH-1 ), LDA,
  10870. - $ A( JCH+1, JCH-1 ), LDA, C, S )
  10871. + $ CALL SROT( ILASTM-JCH-1, T( JCH, JCH+2 ), LDT,
  10872. + $ T( JCH+1, JCH+2 ), LDT, C, S )
  10873. + CALL SROT( ILASTM-JCH+2, H( JCH, JCH-1 ), LDH,
  10874. + $ H( JCH+1, JCH-1 ), LDH, C, S )
  10875. IF( ILQ )
  10876. $ CALL SROT( N, Q( 1, JCH ), 1, Q( 1, JCH+1 ), 1,
  10877. $ C, S )
  10878. - TEMP = A( JCH+1, JCH )
  10879. - CALL SLARTG( TEMP, A( JCH+1, JCH-1 ), C, S,
  10880. - $ A( JCH+1, JCH ) )
  10881. - A( JCH+1, JCH-1 ) = ZERO
  10882. - CALL SROT( JCH+1-IFRSTM, A( IFRSTM, JCH ), 1,
  10883. - $ A( IFRSTM, JCH-1 ), 1, C, S )
  10884. - CALL SROT( JCH-IFRSTM, B( IFRSTM, JCH ), 1,
  10885. - $ B( IFRSTM, JCH-1 ), 1, C, S )
  10886. + TEMP = H( JCH+1, JCH )
  10887. + CALL SLARTG( TEMP, H( JCH+1, JCH-1 ), C, S,
  10888. + $ H( JCH+1, JCH ) )
  10889. + H( JCH+1, JCH-1 ) = ZERO
  10890. + CALL SROT( JCH+1-IFRSTM, H( IFRSTM, JCH ), 1,
  10891. + $ H( IFRSTM, JCH-1 ), 1, C, S )
  10892. + CALL SROT( JCH-IFRSTM, T( IFRSTM, JCH ), 1,
  10893. + $ T( IFRSTM, JCH-1 ), 1, C, S )
  10894. IF( ILZ )
  10895. $ CALL SROT( N, Z( 1, JCH ), 1, Z( 1, JCH-1 ), 1,
  10896. $ C, S )
  10897. @@ -547,34 +549,34 @@
  10898. INFO = N + 1
  10899. GO TO 420
  10900. *
  10901. -* B(ILAST,ILAST)=0 -- clear A(ILAST,ILAST-1) to split off a
  10902. +* T(ILAST,ILAST)=0 -- clear H(ILAST,ILAST-1) to split off a
  10903. * 1x1 block.
  10904. *
  10905. 70 CONTINUE
  10906. - TEMP = A( ILAST, ILAST )
  10907. - CALL SLARTG( TEMP, A( ILAST, ILAST-1 ), C, S,
  10908. - $ A( ILAST, ILAST ) )
  10909. - A( ILAST, ILAST-1 ) = ZERO
  10910. - CALL SROT( ILAST-IFRSTM, A( IFRSTM, ILAST ), 1,
  10911. - $ A( IFRSTM, ILAST-1 ), 1, C, S )
  10912. - CALL SROT( ILAST-IFRSTM, B( IFRSTM, ILAST ), 1,
  10913. - $ B( IFRSTM, ILAST-1 ), 1, C, S )
  10914. + TEMP = H( ILAST, ILAST )
  10915. + CALL SLARTG( TEMP, H( ILAST, ILAST-1 ), C, S,
  10916. + $ H( ILAST, ILAST ) )
  10917. + H( ILAST, ILAST-1 ) = ZERO
  10918. + CALL SROT( ILAST-IFRSTM, H( IFRSTM, ILAST ), 1,
  10919. + $ H( IFRSTM, ILAST-1 ), 1, C, S )
  10920. + CALL SROT( ILAST-IFRSTM, T( IFRSTM, ILAST ), 1,
  10921. + $ T( IFRSTM, ILAST-1 ), 1, C, S )
  10922. IF( ILZ )
  10923. $ CALL SROT( N, Z( 1, ILAST ), 1, Z( 1, ILAST-1 ), 1, C, S )
  10924. *
  10925. -* A(ILAST,ILAST-1)=0 -- Standardize B, set ALPHAR, ALPHAI,
  10926. +* H(ILAST,ILAST-1)=0 -- Standardize B, set ALPHAR, ALPHAI,
  10927. * and BETA
  10928. *
  10929. 80 CONTINUE
  10930. - IF( B( ILAST, ILAST ).LT.ZERO ) THEN
  10931. + IF( T( ILAST, ILAST ).LT.ZERO ) THEN
  10932. IF( ILSCHR ) THEN
  10933. DO 90 J = IFRSTM, ILAST
  10934. - A( J, ILAST ) = -A( J, ILAST )
  10935. - B( J, ILAST ) = -B( J, ILAST )
  10936. + H( J, ILAST ) = -H( J, ILAST )
  10937. + T( J, ILAST ) = -T( J, ILAST )
  10938. 90 CONTINUE
  10939. ELSE
  10940. - A( ILAST, ILAST ) = -A( ILAST, ILAST )
  10941. - B( ILAST, ILAST ) = -B( ILAST, ILAST )
  10942. + H( ILAST, ILAST ) = -H( ILAST, ILAST )
  10943. + T( ILAST, ILAST ) = -T( ILAST, ILAST )
  10944. END IF
  10945. IF( ILZ ) THEN
  10946. DO 100 J = 1, N
  10947. @@ -582,9 +584,9 @@
  10948. 100 CONTINUE
  10949. END IF
  10950. END IF
  10951. - ALPHAR( ILAST ) = A( ILAST, ILAST )
  10952. + ALPHAR( ILAST ) = H( ILAST, ILAST )
  10953. ALPHAI( ILAST ) = ZERO
  10954. - BETA( ILAST ) = B( ILAST, ILAST )
  10955. + BETA( ILAST ) = T( ILAST, ILAST )
  10956. *
  10957. * Go to next block -- exit if finished.
  10958. *
  10959. @@ -617,7 +619,7 @@
  10960. * Compute single shifts.
  10961. *
  10962. * At this point, IFIRST < ILAST, and the diagonal elements of
  10963. -* B(IFIRST:ILAST,IFIRST,ILAST) are larger than BTOL (in
  10964. +* T(IFIRST:ILAST,IFIRST,ILAST) are larger than BTOL (in
  10965. * magnitude)
  10966. *
  10967. IF( ( IITER / 10 )*10.EQ.IITER ) THEN
  10968. @@ -625,10 +627,10 @@
  10969. * Exceptional shift. Chosen for no particularly good reason.
  10970. * (Single shift only.)
  10971. *
  10972. - IF( ( REAL( MAXIT )*SAFMIN )*ABS( A( ILAST-1, ILAST ) ).LT.
  10973. - $ ABS( B( ILAST-1, ILAST-1 ) ) ) THEN
  10974. - ESHIFT = ESHIFT + A( ILAST-1, ILAST ) /
  10975. - $ B( ILAST-1, ILAST-1 )
  10976. + IF( ( REAL( MAXIT )*SAFMIN )*ABS( H( ILAST-1, ILAST ) ).LT.
  10977. + $ ABS( T( ILAST-1, ILAST-1 ) ) ) THEN
  10978. + ESHIFT = ESHIFT + H( ILAST-1, ILAST ) /
  10979. + $ T( ILAST-1, ILAST-1 )
  10980. ELSE
  10981. ESHIFT = ESHIFT + ONE / ( SAFMIN*REAL( MAXIT ) )
  10982. END IF
  10983. @@ -641,8 +643,8 @@
  10984. * bottom-right 2x2 block of A and B. The first eigenvalue
  10985. * returned by SLAG2 is the Wilkinson shift (AEP p.512),
  10986. *
  10987. - CALL SLAG2( A( ILAST-1, ILAST-1 ), LDA,
  10988. - $ B( ILAST-1, ILAST-1 ), LDB, SAFMIN*SAFETY, S1,
  10989. + CALL SLAG2( H( ILAST-1, ILAST-1 ), LDH,
  10990. + $ T( ILAST-1, ILAST-1 ), LDT, SAFMIN*SAFETY, S1,
  10991. $ S2, WR, WR2, WI )
  10992. *
  10993. TEMP = MAX( S1, SAFMIN*MAX( ONE, ABS( WR ), ABS( WI ) ) )
  10994. @@ -669,14 +671,14 @@
  10995. *
  10996. DO 120 J = ILAST - 1, IFIRST + 1, -1
  10997. ISTART = J
  10998. - TEMP = ABS( S1*A( J, J-1 ) )
  10999. - TEMP2 = ABS( S1*A( J, J )-WR*B( J, J ) )
  11000. + TEMP = ABS( S1*H( J, J-1 ) )
  11001. + TEMP2 = ABS( S1*H( J, J )-WR*T( J, J ) )
  11002. TEMPR = MAX( TEMP, TEMP2 )
  11003. IF( TEMPR.LT.ONE .AND. TEMPR.NE.ZERO ) THEN
  11004. TEMP = TEMP / TEMPR
  11005. TEMP2 = TEMP2 / TEMPR
  11006. END IF
  11007. - IF( ABS( ( ASCALE*A( J+1, J ) )*TEMP ).LE.( ASCALE*ATOL )*
  11008. + IF( ABS( ( ASCALE*H( J+1, J ) )*TEMP ).LE.( ASCALE*ATOL )*
  11009. $ TEMP2 )GO TO 130
  11010. 120 CONTINUE
  11011. *
  11012. @@ -687,26 +689,26 @@
  11013. *
  11014. * Initial Q
  11015. *
  11016. - TEMP = S1*A( ISTART, ISTART ) - WR*B( ISTART, ISTART )
  11017. - TEMP2 = S1*A( ISTART+1, ISTART )
  11018. + TEMP = S1*H( ISTART, ISTART ) - WR*T( ISTART, ISTART )
  11019. + TEMP2 = S1*H( ISTART+1, ISTART )
  11020. CALL SLARTG( TEMP, TEMP2, C, S, TEMPR )
  11021. *
  11022. * Sweep
  11023. *
  11024. DO 190 J = ISTART, ILAST - 1
  11025. IF( J.GT.ISTART ) THEN
  11026. - TEMP = A( J, J-1 )
  11027. - CALL SLARTG( TEMP, A( J+1, J-1 ), C, S, A( J, J-1 ) )
  11028. - A( J+1, J-1 ) = ZERO
  11029. + TEMP = H( J, J-1 )
  11030. + CALL SLARTG( TEMP, H( J+1, J-1 ), C, S, H( J, J-1 ) )
  11031. + H( J+1, J-1 ) = ZERO
  11032. END IF
  11033. *
  11034. DO 140 JC = J, ILASTM
  11035. - TEMP = C*A( J, JC ) + S*A( J+1, JC )
  11036. - A( J+1, JC ) = -S*A( J, JC ) + C*A( J+1, JC )
  11037. - A( J, JC ) = TEMP
  11038. - TEMP2 = C*B( J, JC ) + S*B( J+1, JC )
  11039. - B( J+1, JC ) = -S*B( J, JC ) + C*B( J+1, JC )
  11040. - B( J, JC ) = TEMP2
  11041. + TEMP = C*H( J, JC ) + S*H( J+1, JC )
  11042. + H( J+1, JC ) = -S*H( J, JC ) + C*H( J+1, JC )
  11043. + H( J, JC ) = TEMP
  11044. + TEMP2 = C*T( J, JC ) + S*T( J+1, JC )
  11045. + T( J+1, JC ) = -S*T( J, JC ) + C*T( J+1, JC )
  11046. + T( J, JC ) = TEMP2
  11047. 140 CONTINUE
  11048. IF( ILQ ) THEN
  11049. DO 150 JR = 1, N
  11050. @@ -716,19 +718,19 @@
  11051. 150 CONTINUE
  11052. END IF
  11053. *
  11054. - TEMP = B( J+1, J+1 )
  11055. - CALL SLARTG( TEMP, B( J+1, J ), C, S, B( J+1, J+1 ) )
  11056. - B( J+1, J ) = ZERO
  11057. + TEMP = T( J+1, J+1 )
  11058. + CALL SLARTG( TEMP, T( J+1, J ), C, S, T( J+1, J+1 ) )
  11059. + T( J+1, J ) = ZERO
  11060. *
  11061. DO 160 JR = IFRSTM, MIN( J+2, ILAST )
  11062. - TEMP = C*A( JR, J+1 ) + S*A( JR, J )
  11063. - A( JR, J ) = -S*A( JR, J+1 ) + C*A( JR, J )
  11064. - A( JR, J+1 ) = TEMP
  11065. + TEMP = C*H( JR, J+1 ) + S*H( JR, J )
  11066. + H( JR, J ) = -S*H( JR, J+1 ) + C*H( JR, J )
  11067. + H( JR, J+1 ) = TEMP
  11068. 160 CONTINUE
  11069. DO 170 JR = IFRSTM, J
  11070. - TEMP = C*B( JR, J+1 ) + S*B( JR, J )
  11071. - B( JR, J ) = -S*B( JR, J+1 ) + C*B( JR, J )
  11072. - B( JR, J+1 ) = TEMP
  11073. + TEMP = C*T( JR, J+1 ) + S*T( JR, J )
  11074. + T( JR, J ) = -S*T( JR, J+1 ) + C*T( JR, J )
  11075. + T( JR, J+1 ) = TEMP
  11076. 170 CONTINUE
  11077. IF( ILZ ) THEN
  11078. DO 180 JR = 1, N
  11079. @@ -759,8 +761,8 @@
  11080. * B = ( ) with B11 non-negative.
  11081. * ( 0 B22 )
  11082. *
  11083. - CALL SLASV2( B( ILAST-1, ILAST-1 ), B( ILAST-1, ILAST ),
  11084. - $ B( ILAST, ILAST ), B22, B11, SR, CR, SL, CL )
  11085. + CALL SLASV2( T( ILAST-1, ILAST-1 ), T( ILAST-1, ILAST ),
  11086. + $ T( ILAST, ILAST ), B22, B11, SR, CR, SL, CL )
  11087. *
  11088. IF( B11.LT.ZERO ) THEN
  11089. CR = -CR
  11090. @@ -769,17 +771,17 @@
  11091. B22 = -B22
  11092. END IF
  11093. *
  11094. - CALL SROT( ILASTM+1-IFIRST, A( ILAST-1, ILAST-1 ), LDA,
  11095. - $ A( ILAST, ILAST-1 ), LDA, CL, SL )
  11096. - CALL SROT( ILAST+1-IFRSTM, A( IFRSTM, ILAST-1 ), 1,
  11097. - $ A( IFRSTM, ILAST ), 1, CR, SR )
  11098. + CALL SROT( ILASTM+1-IFIRST, H( ILAST-1, ILAST-1 ), LDH,
  11099. + $ H( ILAST, ILAST-1 ), LDH, CL, SL )
  11100. + CALL SROT( ILAST+1-IFRSTM, H( IFRSTM, ILAST-1 ), 1,
  11101. + $ H( IFRSTM, ILAST ), 1, CR, SR )
  11102. *
  11103. IF( ILAST.LT.ILASTM )
  11104. - $ CALL SROT( ILASTM-ILAST, B( ILAST-1, ILAST+1 ), LDB,
  11105. - $ B( ILAST, ILAST+1 ), LDA, CL, SL )
  11106. + $ CALL SROT( ILASTM-ILAST, T( ILAST-1, ILAST+1 ), LDT,
  11107. + $ T( ILAST, ILAST+1 ), LDH, CL, SL )
  11108. IF( IFRSTM.LT.ILAST-1 )
  11109. - $ CALL SROT( IFIRST-IFRSTM, B( IFRSTM, ILAST-1 ), 1,
  11110. - $ B( IFRSTM, ILAST ), 1, CR, SR )
  11111. + $ CALL SROT( IFIRST-IFRSTM, T( IFRSTM, ILAST-1 ), 1,
  11112. + $ T( IFRSTM, ILAST ), 1, CR, SR )
  11113. *
  11114. IF( ILQ )
  11115. $ CALL SROT( N, Q( 1, ILAST-1 ), 1, Q( 1, ILAST ), 1, CL,
  11116. @@ -788,17 +790,17 @@
  11117. $ CALL SROT( N, Z( 1, ILAST-1 ), 1, Z( 1, ILAST ), 1, CR,
  11118. $ SR )
  11119. *
  11120. - B( ILAST-1, ILAST-1 ) = B11
  11121. - B( ILAST-1, ILAST ) = ZERO
  11122. - B( ILAST, ILAST-1 ) = ZERO
  11123. - B( ILAST, ILAST ) = B22
  11124. + T( ILAST-1, ILAST-1 ) = B11
  11125. + T( ILAST-1, ILAST ) = ZERO
  11126. + T( ILAST, ILAST-1 ) = ZERO
  11127. + T( ILAST, ILAST ) = B22
  11128. *
  11129. * If B22 is negative, negate column ILAST
  11130. *
  11131. IF( B22.LT.ZERO ) THEN
  11132. DO 210 J = IFRSTM, ILAST
  11133. - A( J, ILAST ) = -A( J, ILAST )
  11134. - B( J, ILAST ) = -B( J, ILAST )
  11135. + H( J, ILAST ) = -H( J, ILAST )
  11136. + T( J, ILAST ) = -T( J, ILAST )
  11137. 210 CONTINUE
  11138. *
  11139. IF( ILZ ) THEN
  11140. @@ -812,8 +814,8 @@
  11141. *
  11142. * Recompute shift
  11143. *
  11144. - CALL SLAG2( A( ILAST-1, ILAST-1 ), LDA,
  11145. - $ B( ILAST-1, ILAST-1 ), LDB, SAFMIN*SAFETY, S1,
  11146. + CALL SLAG2( H( ILAST-1, ILAST-1 ), LDH,
  11147. + $ T( ILAST-1, ILAST-1 ), LDT, SAFMIN*SAFETY, S1,
  11148. $ TEMP, WR, TEMP2, WI )
  11149. *
  11150. * If standardization has perturbed the shift onto real line,
  11151. @@ -825,10 +827,10 @@
  11152. *
  11153. * Do EISPACK (QZVAL) computation of alpha and beta
  11154. *
  11155. - A11 = A( ILAST-1, ILAST-1 )
  11156. - A21 = A( ILAST, ILAST-1 )
  11157. - A12 = A( ILAST-1, ILAST )
  11158. - A22 = A( ILAST, ILAST )
  11159. + A11 = H( ILAST-1, ILAST-1 )
  11160. + A21 = H( ILAST, ILAST-1 )
  11161. + A12 = H( ILAST-1, ILAST )
  11162. + A22 = H( ILAST, ILAST )
  11163. *
  11164. * Compute complex Givens rotation on right
  11165. * (Assume some element of C = (sA - wB) > unfl )
  11166. @@ -845,10 +847,10 @@
  11167. *
  11168. IF( ABS( C11R )+ABS( C11I )+ABS( C12 ).GT.ABS( C21 )+
  11169. $ ABS( C22R )+ABS( C22I ) ) THEN
  11170. - T = SLAPY3( C12, C11R, C11I )
  11171. - CZ = C12 / T
  11172. - SZR = -C11R / T
  11173. - SZI = -C11I / T
  11174. + T1 = SLAPY3( C12, C11R, C11I )
  11175. + CZ = C12 / T1
  11176. + SZR = -C11R / T1
  11177. + SZI = -C11I / T1
  11178. ELSE
  11179. CZ = SLAPY2( C22R, C22I )
  11180. IF( CZ.LE.SAFMIN ) THEN
  11181. @@ -858,10 +860,10 @@
  11182. ELSE
  11183. TEMPR = C22R / CZ
  11184. TEMPI = C22I / CZ
  11185. - T = SLAPY2( CZ, C21 )
  11186. - CZ = CZ / T
  11187. - SZR = -C21*TEMPR / T
  11188. - SZI = C21*TEMPI / T
  11189. + T1 = SLAPY2( CZ, C21 )
  11190. + CZ = CZ / T1
  11191. + SZR = -C21*TEMPR / T1
  11192. + SZI = C21*TEMPI / T1
  11193. END IF
  11194. END IF
  11195. *
  11196. @@ -895,10 +897,10 @@
  11197. SQI = TEMPI*A2R - TEMPR*A2I
  11198. END IF
  11199. END IF
  11200. - T = SLAPY3( CQ, SQR, SQI )
  11201. - CQ = CQ / T
  11202. - SQR = SQR / T
  11203. - SQI = SQI / T
  11204. + T1 = SLAPY3( CQ, SQR, SQI )
  11205. + CQ = CQ / T1
  11206. + SQR = SQR / T1
  11207. + SQI = SQI / T1
  11208. *
  11209. * Compute diagonal elements of QBZ
  11210. *
  11211. @@ -950,26 +952,26 @@
  11212. *
  11213. * We assume that the block is at least 3x3
  11214. *
  11215. - AD11 = ( ASCALE*A( ILAST-1, ILAST-1 ) ) /
  11216. - $ ( BSCALE*B( ILAST-1, ILAST-1 ) )
  11217. - AD21 = ( ASCALE*A( ILAST, ILAST-1 ) ) /
  11218. - $ ( BSCALE*B( ILAST-1, ILAST-1 ) )
  11219. - AD12 = ( ASCALE*A( ILAST-1, ILAST ) ) /
  11220. - $ ( BSCALE*B( ILAST, ILAST ) )
  11221. - AD22 = ( ASCALE*A( ILAST, ILAST ) ) /
  11222. - $ ( BSCALE*B( ILAST, ILAST ) )
  11223. - U12 = B( ILAST-1, ILAST ) / B( ILAST, ILAST )
  11224. - AD11L = ( ASCALE*A( IFIRST, IFIRST ) ) /
  11225. - $ ( BSCALE*B( IFIRST, IFIRST ) )
  11226. - AD21L = ( ASCALE*A( IFIRST+1, IFIRST ) ) /
  11227. - $ ( BSCALE*B( IFIRST, IFIRST ) )
  11228. - AD12L = ( ASCALE*A( IFIRST, IFIRST+1 ) ) /
  11229. - $ ( BSCALE*B( IFIRST+1, IFIRST+1 ) )
  11230. - AD22L = ( ASCALE*A( IFIRST+1, IFIRST+1 ) ) /
  11231. - $ ( BSCALE*B( IFIRST+1, IFIRST+1 ) )
  11232. - AD32L = ( ASCALE*A( IFIRST+2, IFIRST+1 ) ) /
  11233. - $ ( BSCALE*B( IFIRST+1, IFIRST+1 ) )
  11234. - U12L = B( IFIRST, IFIRST+1 ) / B( IFIRST+1, IFIRST+1 )
  11235. + AD11 = ( ASCALE*H( ILAST-1, ILAST-1 ) ) /
  11236. + $ ( BSCALE*T( ILAST-1, ILAST-1 ) )
  11237. + AD21 = ( ASCALE*H( ILAST, ILAST-1 ) ) /
  11238. + $ ( BSCALE*T( ILAST-1, ILAST-1 ) )
  11239. + AD12 = ( ASCALE*H( ILAST-1, ILAST ) ) /
  11240. + $ ( BSCALE*T( ILAST, ILAST ) )
  11241. + AD22 = ( ASCALE*H( ILAST, ILAST ) ) /
  11242. + $ ( BSCALE*T( ILAST, ILAST ) )
  11243. + U12 = T( ILAST-1, ILAST ) / T( ILAST, ILAST )
  11244. + AD11L = ( ASCALE*H( IFIRST, IFIRST ) ) /
  11245. + $ ( BSCALE*T( IFIRST, IFIRST ) )
  11246. + AD21L = ( ASCALE*H( IFIRST+1, IFIRST ) ) /
  11247. + $ ( BSCALE*T( IFIRST, IFIRST ) )
  11248. + AD12L = ( ASCALE*H( IFIRST, IFIRST+1 ) ) /
  11249. + $ ( BSCALE*T( IFIRST+1, IFIRST+1 ) )
  11250. + AD22L = ( ASCALE*H( IFIRST+1, IFIRST+1 ) ) /
  11251. + $ ( BSCALE*T( IFIRST+1, IFIRST+1 ) )
  11252. + AD32L = ( ASCALE*H( IFIRST+2, IFIRST+1 ) ) /
  11253. + $ ( BSCALE*T( IFIRST+1, IFIRST+1 ) )
  11254. + U12L = T( IFIRST, IFIRST+1 ) / T( IFIRST+1, IFIRST+1 )
  11255. *
  11256. V( 1 ) = ( AD11-AD11L )*( AD22-AD11L ) - AD12*AD21 +
  11257. $ AD21*U12*AD11L + ( AD12L-AD11L*U12L )*AD21L
  11258. @@ -991,27 +993,27 @@
  11259. * Zero (j-1)st column of A
  11260. *
  11261. IF( J.GT.ISTART ) THEN
  11262. - V( 1 ) = A( J, J-1 )
  11263. - V( 2 ) = A( J+1, J-1 )
  11264. - V( 3 ) = A( J+2, J-1 )
  11265. + V( 1 ) = H( J, J-1 )
  11266. + V( 2 ) = H( J+1, J-1 )
  11267. + V( 3 ) = H( J+2, J-1 )
  11268. *
  11269. - CALL SLARFG( 3, A( J, J-1 ), V( 2 ), 1, TAU )
  11270. + CALL SLARFG( 3, H( J, J-1 ), V( 2 ), 1, TAU )
  11271. V( 1 ) = ONE
  11272. - A( J+1, J-1 ) = ZERO
  11273. - A( J+2, J-1 ) = ZERO
  11274. + H( J+1, J-1 ) = ZERO
  11275. + H( J+2, J-1 ) = ZERO
  11276. END IF
  11277. *
  11278. DO 230 JC = J, ILASTM
  11279. - TEMP = TAU*( A( J, JC )+V( 2 )*A( J+1, JC )+V( 3 )*
  11280. - $ A( J+2, JC ) )
  11281. - A( J, JC ) = A( J, JC ) - TEMP
  11282. - A( J+1, JC ) = A( J+1, JC ) - TEMP*V( 2 )
  11283. - A( J+2, JC ) = A( J+2, JC ) - TEMP*V( 3 )
  11284. - TEMP2 = TAU*( B( J, JC )+V( 2 )*B( J+1, JC )+V( 3 )*
  11285. - $ B( J+2, JC ) )
  11286. - B( J, JC ) = B( J, JC ) - TEMP2
  11287. - B( J+1, JC ) = B( J+1, JC ) - TEMP2*V( 2 )
  11288. - B( J+2, JC ) = B( J+2, JC ) - TEMP2*V( 3 )
  11289. + TEMP = TAU*( H( J, JC )+V( 2 )*H( J+1, JC )+V( 3 )*
  11290. + $ H( J+2, JC ) )
  11291. + H( J, JC ) = H( J, JC ) - TEMP
  11292. + H( J+1, JC ) = H( J+1, JC ) - TEMP*V( 2 )
  11293. + H( J+2, JC ) = H( J+2, JC ) - TEMP*V( 3 )
  11294. + TEMP2 = TAU*( T( J, JC )+V( 2 )*T( J+1, JC )+V( 3 )*
  11295. + $ T( J+2, JC ) )
  11296. + T( J, JC ) = T( J, JC ) - TEMP2
  11297. + T( J+1, JC ) = T( J+1, JC ) - TEMP2*V( 2 )
  11298. + T( J+2, JC ) = T( J+2, JC ) - TEMP2*V( 3 )
  11299. 230 CONTINUE
  11300. IF( ILQ ) THEN
  11301. DO 240 JR = 1, N
  11302. @@ -1028,27 +1030,27 @@
  11303. * Swap rows to pivot
  11304. *
  11305. ILPIVT = .FALSE.
  11306. - TEMP = MAX( ABS( B( J+1, J+1 ) ), ABS( B( J+1, J+2 ) ) )
  11307. - TEMP2 = MAX( ABS( B( J+2, J+1 ) ), ABS( B( J+2, J+2 ) ) )
  11308. + TEMP = MAX( ABS( T( J+1, J+1 ) ), ABS( T( J+1, J+2 ) ) )
  11309. + TEMP2 = MAX( ABS( T( J+2, J+1 ) ), ABS( T( J+2, J+2 ) ) )
  11310. IF( MAX( TEMP, TEMP2 ).LT.SAFMIN ) THEN
  11311. SCALE = ZERO
  11312. U1 = ONE
  11313. U2 = ZERO
  11314. GO TO 250
  11315. ELSE IF( TEMP.GE.TEMP2 ) THEN
  11316. - W11 = B( J+1, J+1 )
  11317. - W21 = B( J+2, J+1 )
  11318. - W12 = B( J+1, J+2 )
  11319. - W22 = B( J+2, J+2 )
  11320. - U1 = B( J+1, J )
  11321. - U2 = B( J+2, J )
  11322. + W11 = T( J+1, J+1 )
  11323. + W21 = T( J+2, J+1 )
  11324. + W12 = T( J+1, J+2 )
  11325. + W22 = T( J+2, J+2 )
  11326. + U1 = T( J+1, J )
  11327. + U2 = T( J+2, J )
  11328. ELSE
  11329. - W21 = B( J+1, J+1 )
  11330. - W11 = B( J+2, J+1 )
  11331. - W22 = B( J+1, J+2 )
  11332. - W12 = B( J+2, J+2 )
  11333. - U2 = B( J+1, J )
  11334. - U1 = B( J+2, J )
  11335. + W21 = T( J+1, J+1 )
  11336. + W11 = T( J+2, J+1 )
  11337. + W22 = T( J+1, J+2 )
  11338. + W12 = T( J+2, J+2 )
  11339. + U2 = T( J+1, J )
  11340. + U1 = T( J+2, J )
  11341. END IF
  11342. *
  11343. * Swap columns if nec.
  11344. @@ -1098,9 +1100,9 @@
  11345. *
  11346. * Compute Householder Vector
  11347. *
  11348. - T = SQRT( SCALE**2+U1**2+U2**2 )
  11349. - TAU = ONE + SCALE / T
  11350. - VS = -ONE / ( SCALE+T )
  11351. + T1 = SQRT( SCALE**2+U1**2+U2**2 )
  11352. + TAU = ONE + SCALE / T1
  11353. + VS = -ONE / ( SCALE+T1 )
  11354. V( 1 ) = ONE
  11355. V( 2 ) = VS*U1
  11356. V( 3 ) = VS*U2
  11357. @@ -1108,18 +1110,18 @@
  11358. * Apply transformations from the right.
  11359. *
  11360. DO 260 JR = IFRSTM, MIN( J+3, ILAST )
  11361. - TEMP = TAU*( A( JR, J )+V( 2 )*A( JR, J+1 )+V( 3 )*
  11362. - $ A( JR, J+2 ) )
  11363. - A( JR, J ) = A( JR, J ) - TEMP
  11364. - A( JR, J+1 ) = A( JR, J+1 ) - TEMP*V( 2 )
  11365. - A( JR, J+2 ) = A( JR, J+2 ) - TEMP*V( 3 )
  11366. + TEMP = TAU*( H( JR, J )+V( 2 )*H( JR, J+1 )+V( 3 )*
  11367. + $ H( JR, J+2 ) )
  11368. + H( JR, J ) = H( JR, J ) - TEMP
  11369. + H( JR, J+1 ) = H( JR, J+1 ) - TEMP*V( 2 )
  11370. + H( JR, J+2 ) = H( JR, J+2 ) - TEMP*V( 3 )
  11371. 260 CONTINUE
  11372. DO 270 JR = IFRSTM, J + 2
  11373. - TEMP = TAU*( B( JR, J )+V( 2 )*B( JR, J+1 )+V( 3 )*
  11374. - $ B( JR, J+2 ) )
  11375. - B( JR, J ) = B( JR, J ) - TEMP
  11376. - B( JR, J+1 ) = B( JR, J+1 ) - TEMP*V( 2 )
  11377. - B( JR, J+2 ) = B( JR, J+2 ) - TEMP*V( 3 )
  11378. + TEMP = TAU*( T( JR, J )+V( 2 )*T( JR, J+1 )+V( 3 )*
  11379. + $ T( JR, J+2 ) )
  11380. + T( JR, J ) = T( JR, J ) - TEMP
  11381. + T( JR, J+1 ) = T( JR, J+1 ) - TEMP*V( 2 )
  11382. + T( JR, J+2 ) = T( JR, J+2 ) - TEMP*V( 3 )
  11383. 270 CONTINUE
  11384. IF( ILZ ) THEN
  11385. DO 280 JR = 1, N
  11386. @@ -1130,8 +1132,8 @@
  11387. Z( JR, J+2 ) = Z( JR, J+2 ) - TEMP*V( 3 )
  11388. 280 CONTINUE
  11389. END IF
  11390. - B( J+1, J ) = ZERO
  11391. - B( J+2, J ) = ZERO
  11392. + T( J+1, J ) = ZERO
  11393. + T( J+2, J ) = ZERO
  11394. 290 CONTINUE
  11395. *
  11396. * Last elements: Use Givens rotations
  11397. @@ -1139,17 +1141,17 @@
  11398. * Rotations from the left
  11399. *
  11400. J = ILAST - 1
  11401. - TEMP = A( J, J-1 )
  11402. - CALL SLARTG( TEMP, A( J+1, J-1 ), C, S, A( J, J-1 ) )
  11403. - A( J+1, J-1 ) = ZERO
  11404. + TEMP = H( J, J-1 )
  11405. + CALL SLARTG( TEMP, H( J+1, J-1 ), C, S, H( J, J-1 ) )
  11406. + H( J+1, J-1 ) = ZERO
  11407. *
  11408. DO 300 JC = J, ILASTM
  11409. - TEMP = C*A( J, JC ) + S*A( J+1, JC )
  11410. - A( J+1, JC ) = -S*A( J, JC ) + C*A( J+1, JC )
  11411. - A( J, JC ) = TEMP
  11412. - TEMP2 = C*B( J, JC ) + S*B( J+1, JC )
  11413. - B( J+1, JC ) = -S*B( J, JC ) + C*B( J+1, JC )
  11414. - B( J, JC ) = TEMP2
  11415. + TEMP = C*H( J, JC ) + S*H( J+1, JC )
  11416. + H( J+1, JC ) = -S*H( J, JC ) + C*H( J+1, JC )
  11417. + H( J, JC ) = TEMP
  11418. + TEMP2 = C*T( J, JC ) + S*T( J+1, JC )
  11419. + T( J+1, JC ) = -S*T( J, JC ) + C*T( J+1, JC )
  11420. + T( J, JC ) = TEMP2
  11421. 300 CONTINUE
  11422. IF( ILQ ) THEN
  11423. DO 310 JR = 1, N
  11424. @@ -1161,19 +1163,19 @@
  11425. *
  11426. * Rotations from the right.
  11427. *
  11428. - TEMP = B( J+1, J+1 )
  11429. - CALL SLARTG( TEMP, B( J+1, J ), C, S, B( J+1, J+1 ) )
  11430. - B( J+1, J ) = ZERO
  11431. + TEMP = T( J+1, J+1 )
  11432. + CALL SLARTG( TEMP, T( J+1, J ), C, S, T( J+1, J+1 ) )
  11433. + T( J+1, J ) = ZERO
  11434. *
  11435. DO 320 JR = IFRSTM, ILAST
  11436. - TEMP = C*A( JR, J+1 ) + S*A( JR, J )
  11437. - A( JR, J ) = -S*A( JR, J+1 ) + C*A( JR, J )
  11438. - A( JR, J+1 ) = TEMP
  11439. + TEMP = C*H( JR, J+1 ) + S*H( JR, J )
  11440. + H( JR, J ) = -S*H( JR, J+1 ) + C*H( JR, J )
  11441. + H( JR, J+1 ) = TEMP
  11442. 320 CONTINUE
  11443. DO 330 JR = IFRSTM, ILAST - 1
  11444. - TEMP = C*B( JR, J+1 ) + S*B( JR, J )
  11445. - B( JR, J ) = -S*B( JR, J+1 ) + C*B( JR, J )
  11446. - B( JR, J+1 ) = TEMP
  11447. + TEMP = C*T( JR, J+1 ) + S*T( JR, J )
  11448. + T( JR, J ) = -S*T( JR, J+1 ) + C*T( JR, J )
  11449. + T( JR, J+1 ) = TEMP
  11450. 330 CONTINUE
  11451. IF( ILZ ) THEN
  11452. DO 340 JR = 1, N
  11453. @@ -1207,15 +1209,15 @@
  11454. * Set Eigenvalues 1:ILO-1
  11455. *
  11456. DO 410 J = 1, ILO - 1
  11457. - IF( B( J, J ).LT.ZERO ) THEN
  11458. + IF( T( J, J ).LT.ZERO ) THEN
  11459. IF( ILSCHR ) THEN
  11460. DO 390 JR = 1, J
  11461. - A( JR, J ) = -A( JR, J )
  11462. - B( JR, J ) = -B( JR, J )
  11463. + H( JR, J ) = -H( JR, J )
  11464. + T( JR, J ) = -T( JR, J )
  11465. 390 CONTINUE
  11466. ELSE
  11467. - A( J, J ) = -A( J, J )
  11468. - B( J, J ) = -B( J, J )
  11469. + H( J, J ) = -H( J, J )
  11470. + T( J, J ) = -T( J, J )
  11471. END IF
  11472. IF( ILZ ) THEN
  11473. DO 400 JR = 1, N
  11474. @@ -1223,9 +1225,9 @@
  11475. 400 CONTINUE
  11476. END IF
  11477. END IF
  11478. - ALPHAR( J ) = A( J, J )
  11479. + ALPHAR( J ) = H( J, J )
  11480. ALPHAI( J ) = ZERO
  11481. - BETA( J ) = B( J, J )
  11482. + BETA( J ) = T( J, J )
  11483. 410 CONTINUE
  11484. *
  11485. * Normal Termination
  11486. diff -uNr LAPACK.orig/SRC/slasr.f LAPACK/SRC/slasr.f
  11487. --- LAPACK.orig/SRC/slasr.f Thu Nov 4 14:23:40 1999
  11488. +++ LAPACK/SRC/slasr.f Fri May 25 16:12:26 2001
  11489. @@ -3,7 +3,7 @@
  11490. * -- LAPACK auxiliary routine (version 3.0) --
  11491. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  11492. * Courant Institute, Argonne National Lab, and Rice University
  11493. -* October 31, 1992
  11494. +* May 3, 2001
  11495. *
  11496. * .. Scalar Arguments ..
  11497. CHARACTER DIRECT, PIVOT, SIDE
  11498. @@ -16,44 +16,77 @@
  11499. * Purpose
  11500. * =======
  11501. *
  11502. -* SLASR performs the transformation
  11503. -*
  11504. -* A := P*A, when SIDE = 'L' or 'l' ( Left-hand side )
  11505. -*
  11506. -* A := A*P', when SIDE = 'R' or 'r' ( Right-hand side )
  11507. -*
  11508. -* where A is an m by n real matrix and P is an orthogonal matrix,
  11509. -* consisting of a sequence of plane rotations determined by the
  11510. -* parameters PIVOT and DIRECT as follows ( z = m when SIDE = 'L' or 'l'
  11511. -* and z = n when SIDE = 'R' or 'r' ):
  11512. -*
  11513. -* When DIRECT = 'F' or 'f' ( Forward sequence ) then
  11514. -*
  11515. -* P = P( z - 1 )*...*P( 2 )*P( 1 ),
  11516. -*
  11517. -* and when DIRECT = 'B' or 'b' ( Backward sequence ) then
  11518. -*
  11519. -* P = P( 1 )*P( 2 )*...*P( z - 1 ),
  11520. -*
  11521. -* where P( k ) is a plane rotation matrix for the following planes:
  11522. -*
  11523. -* when PIVOT = 'V' or 'v' ( Variable pivot ),
  11524. -* the plane ( k, k + 1 )
  11525. -*
  11526. -* when PIVOT = 'T' or 't' ( Top pivot ),
  11527. -* the plane ( 1, k + 1 )
  11528. -*
  11529. -* when PIVOT = 'B' or 'b' ( Bottom pivot ),
  11530. -* the plane ( k, z )
  11531. -*
  11532. -* c( k ) and s( k ) must contain the cosine and sine that define the
  11533. -* matrix P( k ). The two by two plane rotation part of the matrix
  11534. -* P( k ), R( k ), is assumed to be of the form
  11535. -*
  11536. -* R( k ) = ( c( k ) s( k ) ).
  11537. -* ( -s( k ) c( k ) )
  11538. -*
  11539. -* This version vectorises across rows of the array A when SIDE = 'L'.
  11540. +* SLASR applies a sequence of plane rotations to a real matrix A,
  11541. +* from either the left or the right.
  11542. +*
  11543. +* When SIDE = 'L', the transformation takes the form
  11544. +*
  11545. +* A := P*A
  11546. +*
  11547. +* and when SIDE = 'R', the transformation takes the form
  11548. +*
  11549. +* A := A*P**T
  11550. +*
  11551. +* where P is an orthogonal matrix consisting of a sequence of z plane
  11552. +* rotations, with z = M when SIDE = 'L' and z = N when SIDE = 'R',
  11553. +* and P**T is the transpose of P.
  11554. +*
  11555. +* When DIRECT = 'F' (Forward sequence), then
  11556. +*
  11557. +* P = P(z-1) * ... * P(2) * P(1)
  11558. +*
  11559. +* and when DIRECT = 'B' (Backward sequence), then
  11560. +*
  11561. +* P = P(1) * P(2) * ... * P(z-1)
  11562. +*
  11563. +* where P(k) is a plane rotation matrix defined by the 2-by-2 rotation
  11564. +*
  11565. +* R(k) = ( c(k) s(k) )
  11566. +* = ( -s(k) c(k) ).
  11567. +*
  11568. +* When PIVOT = 'V' (Variable pivot), the rotation is performed
  11569. +* for the plane (k,k+1), i.e., P(k) has the form
  11570. +*
  11571. +* P(k) = ( 1 )
  11572. +* ( ... )
  11573. +* ( 1 )
  11574. +* ( c(k) s(k) )
  11575. +* ( -s(k) c(k) )
  11576. +* ( 1 )
  11577. +* ( ... )
  11578. +* ( 1 )
  11579. +*
  11580. +* where R(k) appears as a rank-2 modification to the identity matrix in
  11581. +* rows and columns k and k+1.
  11582. +*
  11583. +* When PIVOT = 'T' (Top pivot), the rotation is performed for the
  11584. +* plane (1,k+1), so P(k) has the form
  11585. +*
  11586. +* P(k) = ( c(k) s(k) )
  11587. +* ( 1 )
  11588. +* ( ... )
  11589. +* ( 1 )
  11590. +* ( -s(k) c(k) )
  11591. +* ( 1 )
  11592. +* ( ... )
  11593. +* ( 1 )
  11594. +*
  11595. +* where R(k) appears in rows and columns 1 and k+1.
  11596. +*
  11597. +* Similarly, when PIVOT = 'B' (Bottom pivot), the rotation is
  11598. +* performed for the plane (k,z), giving P(k) the form
  11599. +*
  11600. +* P(k) = ( 1 )
  11601. +* ( ... )
  11602. +* ( 1 )
  11603. +* ( c(k) s(k) )
  11604. +* ( 1 )
  11605. +* ( ... )
  11606. +* ( 1 )
  11607. +* ( -s(k) c(k) )
  11608. +*
  11609. +* where R(k) appears in rows and columns k and z. The rotations are
  11610. +* performed without ever forming P(k) explicitly.
  11611. *
  11612. * Arguments
  11613. * =========
  11614. @@ -62,13 +95,13 @@
  11615. * Specifies whether the plane rotation matrix P is applied to
  11616. * A on the left or the right.
  11617. * = 'L': Left, compute A := P*A
  11618. -* = 'R': Right, compute A:= A*P'
  11619. +* = 'R': Right, compute A:= A*P**T
  11620. *
  11621. * DIRECT (input) CHARACTER*1
  11622. * Specifies whether P is a forward or backward sequence of
  11623. * plane rotations.
  11624. -* = 'F': Forward, P = P( z - 1 )*...*P( 2 )*P( 1 )
  11625. -* = 'B': Backward, P = P( 1 )*P( 2 )*...*P( z - 1 )
  11626. +* = 'F': Forward, P = P(z-1)*...*P(2)*P(1)
  11627. +* = 'B': Backward, P = P(1)*P(2)*...*P(z-1)
  11628. *
  11629. * PIVOT (input) CHARACTER*1
  11630. * Specifies the plane for which P(k) is a plane rotation
  11631. @@ -85,18 +118,22 @@
  11632. * The number of columns of the matrix A. If n <= 1, an
  11633. * immediate return is effected.
  11634. *
  11635. -* C, S (input) REAL arrays, dimension
  11636. +* C (input) REAL array, dimension
  11637. +* (M-1) if SIDE = 'L'
  11638. +* (N-1) if SIDE = 'R'
  11639. +* The cosines c(k) of the plane rotations.
  11640. +*
  11641. +* S (input) REAL array, dimension
  11642. * (M-1) if SIDE = 'L'
  11643. * (N-1) if SIDE = 'R'
  11644. -* c(k) and s(k) contain the cosine and sine that define the
  11645. -* matrix P(k). The two by two plane rotation part of the
  11646. -* matrix P(k), R(k), is assumed to be of the form
  11647. -* R( k ) = ( c( k ) s( k ) ).
  11648. -* ( -s( k ) c( k ) )
  11649. +* The sines s(k) of the plane rotations. The 2-by-2 plane
  11650. +* rotation part of the matrix P(k), R(k), has the form
  11651. +* R(k) = ( c(k) s(k) )
  11652. +* ( -s(k) c(k) ).
  11653. *
  11654. * A (input/output) REAL array, dimension (LDA,N)
  11655. -* The m by n matrix A. On exit, A is overwritten by P*A if
  11656. -* SIDE = 'R' or by A*P' if SIDE = 'L'.
  11657. +* The M-by-N matrix A. On exit, A is overwritten by P*A if
  11658. +* SIDE = 'R' or by A*P**T if SIDE = 'L'.
  11659. *
  11660. * LDA (input) INTEGER
  11661. * The leading dimension of the array A. LDA >= max(1,M).
  11662. diff -uNr LAPACK.orig/SRC/ssbgst.f LAPACK/SRC/ssbgst.f
  11663. --- LAPACK.orig/SRC/ssbgst.f Thu Nov 4 14:23:32 1999
  11664. +++ LAPACK/SRC/ssbgst.f Fri May 25 16:12:46 2001
  11665. @@ -4,7 +4,7 @@
  11666. * -- LAPACK routine (version 3.0) --
  11667. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  11668. * Courant Institute, Argonne National Lab, and Rice University
  11669. -* June 30, 1999
  11670. +* January 9, 2001
  11671. *
  11672. * .. Scalar Arguments ..
  11673. CHARACTER UPLO, VECT
  11674. @@ -125,7 +125,7 @@
  11675. INFO = -3
  11676. ELSE IF( KA.LT.0 ) THEN
  11677. INFO = -4
  11678. - ELSE IF( KB.LT.0 ) THEN
  11679. + ELSE IF( KB.LT.0 .OR. KB.GT.KA ) THEN
  11680. INFO = -5
  11681. ELSE IF( LDAB.LT.KA+1 ) THEN
  11682. INFO = -7
  11683. diff -uNr LAPACK.orig/SRC/sstebz.f LAPACK/SRC/sstebz.f
  11684. --- LAPACK.orig/SRC/sstebz.f Thu Nov 4 14:24:00 1999
  11685. +++ LAPACK/SRC/sstebz.f Fri May 25 16:13:18 2001
  11686. @@ -6,6 +6,7 @@
  11687. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  11688. * Courant Institute, Argonne National Lab, and Rice University
  11689. * June 30, 1999
  11690. +* 8-18-00: Increase FUDGE factor for T3E (eca)
  11691. *
  11692. * .. Scalar Arguments ..
  11693. CHARACTER ORDER, RANGE
  11694. @@ -175,7 +176,7 @@
  11695. PARAMETER ( ZERO = 0.0E0, ONE = 1.0E0, TWO = 2.0E0,
  11696. $ HALF = 1.0E0 / TWO )
  11697. REAL FUDGE, RELFAC
  11698. - PARAMETER ( FUDGE = 2.0E0, RELFAC = 2.0E0 )
  11699. + PARAMETER ( FUDGE = 2.1E0, RELFAC = 2.0E0 )
  11700. * ..
  11701. * .. Local Scalars ..
  11702. LOGICAL NCNVRG, TOOFEW
  11703. diff -uNr LAPACK.orig/SRC/stgevc.f LAPACK/SRC/stgevc.f
  11704. --- LAPACK.orig/SRC/stgevc.f Thu Nov 4 14:26:09 1999
  11705. +++ LAPACK/SRC/stgevc.f Fri May 25 16:13:28 2001
  11706. @@ -1,18 +1,18 @@
  11707. - SUBROUTINE STGEVC( SIDE, HOWMNY, SELECT, N, A, LDA, B, LDB, VL,
  11708. + SUBROUTINE STGEVC( SIDE, HOWMNY, SELECT, N, S, LDS, P, LDP, VL,
  11709. $ LDVL, VR, LDVR, MM, M, WORK, INFO )
  11710. *
  11711. * -- LAPACK routine (version 3.0) --
  11712. * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  11713. * Courant Institute, Argonne National Lab, and Rice University
  11714. -* June 30, 1999
  11715. +* May 4, 2001
  11716. *
  11717. * .. Scalar Arguments ..
  11718. CHARACTER HOWMNY, SIDE
  11719. - INTEGER INFO, LDA, LDB, LDVL, LDVR, M, MM, N
  11720. + INTEGER INFO, LDP, LDS, LDVL, LDVR, M, MM, N
  11721. * ..
  11722. * .. Array Arguments ..
  11723. LOGICAL SELECT( * )
  11724. - REAL A( LDA, * ), B( LDB, * ), VL( LDVL, * ),
  11725. + REAL P( LDP, * ), S( LDS, * ), VL( LDVL, * ),
  11726. $ VR( LDVR, * ), WORK( * )
  11727. * ..
  11728. *
  11729. @@ -20,34 +20,30 @@
  11730. * Purpose
  11731. * =======
  11732. *
  11733. -* STGEVC computes some or all of the right and/or left generalized
  11734. -* eigenvectors of a pair of real upper triangular matrices (A,B).
  11735. -*
  11736. -* The right generalized eigenvector x and the left generalized
  11737. -* eigenvector y of (A,B) corresponding to a generalized eigenvalue
  11738. -* w are defined by:
  11739. -*
  11740. -* (A - wB) * x = 0 and y**H * (A - wB) = 0
  11741. -*
  11742. +* STGEVC computes some or all of the right and/or left eigenvectors of
  11743. +* a pair of real matrices (S,P), where S is a quasi-triangular matrix
  11744. +* and P is upper triangular. Matrix pairs of this type are produced by
  11745. +* the generalized Schur factorization of a matrix pair (A,B):
  11746. +*
  11747. +* A = Q*S*Z**T, B = Q*P*Z**T
  11748. +*
  11749. +* as computed by SGGHRD + SHGEQZ.
  11750. +*
  11751. +* The right eigenvector x and the left eigenvector y of (S,P)
  11752. +* corresponding to an eigenvalue w are defined by:
  11753. +*
  11754. +* S*x = w*P*x, (y**H)*S = w*(y**H)*P,
  11755. +*
  11756. * where y**H denotes the conjugate tranpose of y.
  11757. -*
  11758. -* If an eigenvalue w is determined by zero diagonal elements of both A
  11759. -* and B, a unit vector is returned as the corresponding eigenvector.
  11760. -*
  11761. -* If all eigenvectors are requested, the routine may either return
  11762. -* the matrices X and/or Y of right or left eigenvectors of (A,B), or
  11763. -* the products Z*X and/or Q*Y, where Z and Q are input orthogonal
  11764. -* matrices. If (A,B) was obtained from the generalized real-Schur
  11765. -* factorization of an original pair of matrices
  11766. -* (A0,B0) = (Q*A*Z**H,Q*B*Z**H),
  11767. -* then Z*X and Q*Y are the matrices of right or left eigenvectors of
  11768. -* A.
  11769. -*
  11770. -* A must be block upper triangular, with 1-by-1 and 2-by-2 diagonal
  11771. -* blocks. Corresponding to each 2-by-2 diagonal block is a complex
  11772. -* conjugate pair of eigenvalues and eigenvectors; only one
  11773. -* eigenvector of the pair is computed, namely the one corresponding
  11774. -* to the eigenvalue with positive imaginary part.
  11775. +* The eigenvalues are not input to this routine, but are computed
  11776. +* directly from the diagonal blocks of S and P.
  11777. +*
  11778. +* This routine returns the matrices X and/or Y of right and left
  11779. +* eigenvectors of (S,P), or the products Z*X and/or Q*Y,
  11780. +* where Z and Q are input matrices.
  11781. +* If Q and Z are the orthogonal factors from the generalized Schur
  11782. +* factorization of a matrix pair (A,B), then Z*X and Q*Y
  11783. +* are the matrices of right and left eigenvectors of (A,B).
  11784. *
  11785. * Arguments
  11786. * =========
  11787. @@ -59,78 +55,84 @@
  11788. *
  11789. * HOWMNY (input) CHARACTER*1
  11790. * = 'A': compute all right and/or left eigenvectors;
  11791. -* = 'B': compute all right and/or left eigenvectors, and
  11792. -* backtransform them using the input matrices supplied
  11793. -* in VR and/or VL;
  11794. +* = 'B': compute all right and/or left eigenvectors,
  11795. +* backtransformed by the matrices in VR and/or VL;
  11796. * = 'S': compute selected right and/or left eigenvectors,
  11797. * specified by the logical array SELECT.
  11798. *
  11799. * SELECT (input) LOGICAL array, dimension (N)
  11800. * If HOWMNY='S', SELECT specifies the eigenvectors to be
  11801. -* computed.
  11802. -* If HOWMNY='A' or 'B', SELECT is not referenced.
  11803. -* To select the real eigenvector corresponding to the real
  11804. -* eigenvalue w(j), SELECT(j) must be set to .TRUE. To select
  11805. -* the complex eigenvector corresponding to a complex conjugate
  11806. -* pair w(j) and w(j+1), either SELECT(j) or SELECT(j+1) must
  11807. -* be set to .TRUE..
  11808. +* computed. If w(j) is a real eigenvalue, the corresponding
  11809. +* real eigenvector is computed if SELECT(j) is .TRUE..
  11810. +* If w(j) and w(j+1) are the real and imaginary parts of a
  11811. +* complex eigenvalue, the corresponding complex eigenvector
  11812. +* is computed if either SELECT(j) or SELECT(j+1) is .TRUE.,
  11813. +* and on exit SELECT(j) is set to .TRUE. and SELECT(j+1) is
  11814. +* set to .FALSE..
  11815. +* Not referenced if HOWMNY = 'A' or 'B'.
  11816. *
  11817. * N (input) INTEGER
  11818. -* The order of the matrices A and B. N >= 0.
  11819. +* The order of the matrices S and P. N >= 0.
  11820. *
  11821. -* A (input) REAL array, dimension (LDA,N)
  11822. -* The upper quasi-triangular matrix A.
  11823. +* S (input) REAL array, dimension (LDS,N)
  11824. +* The upper quasi-triangular matrix S from a generalized Schur
  11825. +* factorization, as computed by SHGEQZ.
  11826. +*
  11827. +* LDS (input) INTEGER
  11828. +* The leading dimension of array S. LDS >= max(1,N).
  11829. +*
  11830. +* P (input) REAL array, dimension (LDP,N)
  11831. +* The upper triangular matrix P from a generalized Schur
  11832. +* factorization, as computed by SHGEQZ.
  11833. +* 2-by-2 diagonal blocks of P corresponding to 2-by-2 blocks
  11834. +* of S must be in positive diagonal form.
  11835. *
  11836. -* LDA (input) INTEGER
  11837. -* The leading dimension of array A. LDA >= max(1, N).
  11838. -*
  11839. -* B (input) REAL array, dimension (LDB,N)
  11840. -* The upper triangular matrix B. If A has a 2-by-2 diagonal
  11841. -* block, then the corresponding 2-by-2 block of B must be
  11842. -* diagonal with positive elements.
  11843. -*
  11844. -* LDB (input) INTEGER
  11845. -* The leading dimension of array B. LDB >= max(1,N).
  11846. +* LDP (input) INTEGER
  11847. +* The leading dimension of array P. LDP >= max(1,N).
  11848. *
  11849. * VL (input/output) REAL array, dimension (LDVL,MM)
  11850. * On entry, if SIDE = 'L' or 'B' and HOWMNY = 'B', VL must
  11851. * contain an N-by-N matrix Q (usually the orthogonal matrix Q
  11852. * of left Schur vectors returned by SHGEQZ).
  11853. * On exit, if SIDE = 'L' or 'B', VL contains:
  11854. -* if HOWMNY = 'A', the matrix Y of left eigenvectors of (A,B);
  11855. +* if HOWMNY = 'A', the matrix Y of left eigenvectors of (S,P);
  11856. * if HOWMNY = 'B', the matrix Q*Y;
  11857. -* if HOWMNY = 'S', the left eigenvectors of (A,B) specified by
  11858. +* if HOWMNY = 'S', the left eigenvectors of (S,P) specified by
  11859. * SELECT, stored consecutively in the columns of
  11860. * VL, in the same order as their eigenvalues.
  11861. -* If SIDE = 'R', VL is not referenced.
  11862. *
  11863. * A complex eigenvector corresponding to a complex eigenvalue
  11864. * is stored in two consecutive columns, the first holding the
  11865. * real part, and the second the imaginary part.
  11866. *
  11867. +* Not referenced if SIDE = 'R'.
  11868. +*
  11869. * LDVL (input) INTEGER
  11870. -* The leading dimension of array VL.
  11871. -* LDVL >= max(1,N) if SIDE = 'L' or 'B'; LDVL >= 1 otherwise.
  11872. +* The leading dimension of array VL. LDVL >= 1, and if
  11873. +* SIDE = 'L' or 'B', LDVL >= N.
  11874. *
  11875. * VR (input/output) REAL array, dimension (LDVR,MM)
  11876. * On entry, if SIDE = 'R' or 'B' and HOWMNY = 'B', VR must
  11877. -* contain an N-by-N matrix Q (usually the orthogonal matrix Z
  11878. +* contain an N-by-N matrix Z (usually the orthogonal matrix Z
  11879. * of right Schur vectors returned by SHGEQZ).
  11880. +*
  11881. * On exit, if SIDE = 'R' or 'B', VR contains:
  11882. -* if HOWMNY = 'A', the matrix X of right eigenvectors of (A,B);
  11883. -* if HOWMNY = 'B', the matrix Z*X;
  11884. -* if HOWMNY = 'S', the right eigenvectors of (A,B) specified by
  11885. -* SELECT, stored consecutively in the columns of
  11886. -* VR, in the same order as their eigenvalues.
  11887. -* If SIDE = 'L', VR is not referenced.
  11888. +* if HOWMNY = 'A', the matrix X of right eigenvectors of (S,P);
  11889. +* if HOWMNY = 'B' or 'b', the matrix Z*X;
  11890. +* if HOWMNY = 'S' or 's', the right eigenvectors of (S,P)
  11891. +* specified by SELECT, stored consecutively in the
  11892. +* columns of VR, in the same order as their
  11893. +* eigenvalues.
  11894. *
  11895. * A complex eigenvector corresponding to a complex eigenvalue
  11896. * is stored in two consecutive columns, the first holding the
  11897. * real part and the second the imaginary part.
  11898. +*
  11899. +* Not referenced if SIDE = 'L'.
  11900. *
  11901. * LDVR (input) INTEGER
  11902. -* The leading dimension of the array VR.
  11903. -* LDVR >= max(1,N) if SIDE = 'R' or 'B'; LDVR >= 1 otherwise.
  11904. +* The leading dimension of the array VR. LDVR >= 1, and if
  11905. +* SIDE = 'R' or 'B', LDVR >= N.
  11906. *
  11907. * MM (input) INTEGER
  11908. * The number of columns in the arrays VL and/or VR. MM >= M.
  11909. @@ -199,7 +201,7 @@
  11910. * partial sums. Since FORTRAN arrays are stored columnwise, this has
  11911. * the advantage that at each step, the elements of C that are accessed
  11912. * are adjacent to one another, whereas with the rowwise method, the
  11913. -* elements accessed at a step are spaced LDA (and LDB) words apart.
  11914. +* elements accessed at a step are spaced LDS (and LDP) words apart.
  11915. *
  11916. * When finding left eigenvectors, the matrix in question is the
  11917. * transpose of the one in storage, so the rowwise method then
  11918. @@ -226,8 +228,8 @@
  11919. $ XSCALE
  11920. * ..
  11921. * .. Local Arrays ..
  11922. - REAL BDIAG( 2 ), SUM( 2, 2 ), SUMA( 2, 2 ),
  11923. - $ SUMB( 2, 2 )
  11924. + REAL BDIAG( 2 ), SUM( 2, 2 ), SUMS( 2, 2 ),
  11925. + $ SUMP( 2, 2 )
  11926. * ..
  11927. * .. External Functions ..
  11928. LOGICAL LSAME
  11929. @@ -252,7 +254,7 @@
  11930. IHWMNY = 2
  11931. ILALL = .FALSE.
  11932. ILBACK = .FALSE.
  11933. - ELSE IF( LSAME( HOWMNY, 'B' ) .OR. LSAME( HOWMNY, 'T' ) ) THEN
  11934. + ELSE IF( LSAME( HOWMNY, 'B' ) ) THEN
  11935. IHWMNY = 3
  11936. ILALL = .TRUE.
  11937. ILBACK = .TRUE.
  11938. @@ -284,9 +286,9 @@
  11939. INFO = -2
  11940. ELSE IF( N.LT.0 ) THEN
  11941. INFO = -4
  11942. - ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
  11943. + ELSE IF( LDS.LT.MAX( 1, N ) ) THEN
  11944. INFO = -6
  11945. - ELSE IF( LDB.LT.MAX( 1, N ) ) THEN
  11946. + ELSE IF( LDP.LT.MAX( 1, N ) ) THEN
  11947. INFO = -8
  11948. END IF
  11949. IF( INFO.NE.0 ) THEN
  11950. @@ -305,7 +307,7 @@
  11951. GO TO 10
  11952. END IF
  11953. IF( J.LT.N ) THEN
  11954. - IF( A( J+1, J ).NE.ZERO )
  11955. + IF( S( J+1, J ).NE.ZERO )
  11956. $ ILCPLX = .TRUE.
  11957. END IF
  11958. IF( ILCPLX ) THEN
  11959. @@ -325,11 +327,11 @@
  11960. ILABAD = .FALSE.
  11961. ILBBAD = .FALSE.
  11962. DO 20 J = 1, N - 1
  11963. - IF( A( J+1, J ).NE.ZERO ) THEN
  11964. - IF( B( J, J ).EQ.ZERO .OR. B( J+1, J+1 ).EQ.ZERO .OR.
  11965. - $ B( J, J+1 ).NE.ZERO )ILBBAD = .TRUE.
  11966. + IF( S( J+1, J ).NE.ZERO ) THEN
  11967. + IF( P( J, J ).EQ.ZERO .OR. P( J+1, J+1 ).EQ.ZERO .OR.
  11968. + $ P( J, J+1 ).NE.ZERO )ILBBAD = .TRUE.
  11969. IF( J.LT.N-1 ) THEN
  11970. - IF( A( J+2, J+1 ).NE.ZERO )
  11971. + IF( S( J+2, J+1 ).NE.ZERO )
  11972. $ ILABAD = .TRUE.
  11973. END IF
  11974. END IF
  11975. @@ -372,30 +374,30 @@
  11976. * blocks) of A and B to check for possible overflow in the
  11977. * triangular solver.
  11978. *
  11979. - ANORM = ABS( A( 1, 1 ) )
  11980. + ANORM = ABS( S( 1, 1 ) )
  11981. IF( N.GT.1 )
  11982. - $ ANORM = ANORM + ABS( A( 2, 1 ) )
  11983. - BNORM = ABS( B( 1, 1 ) )
  11984. + $ ANORM = ANORM + ABS( S( 2, 1 ) )
  11985. + BNORM = ABS( P( 1, 1 ) )
  11986. WORK( 1 ) = ZERO
  11987. WORK( N+1 ) = ZERO
  11988. *
  11989. DO 50 J = 2, N
  11990. TEMP = ZERO
  11991. TEMP2 = ZERO
  11992. - IF( A( J, J-1 ).EQ.ZERO ) THEN
  11993. + IF( S( J, J-1 ).EQ.ZERO ) THEN
  11994. IEND = J - 1
  11995. ELSE
  11996. IEND = J - 2
  11997. END IF
  11998. DO 30 I = 1, IEND
  11999. - TEMP = TEMP + ABS( A( I, J ) )
  12000. - TEMP2 = TEMP2 + ABS( B( I, J ) )
  12001. + TEMP = TEMP + ABS( S( I, J ) )
  12002. + TEMP2 = TEMP2 + ABS( P( I, J ) )
  12003. 30 CONTINUE
  12004. WORK( J ) = TEMP
  12005. WORK( N+J ) = TEMP2
  12006. DO 40 I = IEND + 1, MIN( J+1, N )
  12007. - TEMP = TEMP + ABS( A( I, J ) )
  12008. - TEMP2 = TEMP2 + ABS( B( I, J ) )
  12009. + TEMP = TEMP + ABS( S( I, J ) )
  12010. + TEMP2 = TEMP2 + ABS( P( I, J ) )
  12011. 40 CONTINUE
  12012. ANORM = MAX( ANORM, TEMP )
  12013. BNORM = MAX( BNORM, TEMP2 )
  12014. @@ -425,7 +427,7 @@
  12015. END IF
  12016. NW = 1
  12017. IF( JE.LT.N ) THEN
  12018. - IF( A( JE+1, JE ).NE.ZERO ) THEN
  12019. + IF( S( JE+1, JE ).NE.ZERO ) THEN
  12020. ILCPLX = .TRUE.
  12021. NW = 2
  12022. END IF
  12023. @@ -444,8 +446,8 @@
  12024. * (c) complex eigenvalue.
  12025. *
  12026. IF( .NOT.ILCPLX ) THEN
  12027. - IF( ABS( A( JE, JE ) ).LE.SAFMIN .AND.
  12028. - $ ABS( B( JE, JE ) ).LE.SAFMIN ) THEN
  12029. + IF( ABS( S( JE, JE ) ).LE.SAFMIN .AND.
  12030. + $ ABS( P( JE, JE ) ).LE.SAFMIN ) THEN
  12031. *
  12032. * Singular matrix pencil -- return unit eigenvector
  12033. *
  12034. @@ -472,10 +474,10 @@
  12035. *
  12036. * Real eigenvalue
  12037. *
  12038. - TEMP = ONE / MAX( ABS( A( JE, JE ) )*ASCALE,
  12039. - $ ABS( B( JE, JE ) )*BSCALE, SAFMIN )
  12040. - SALFAR = ( TEMP*A( JE, JE ) )*ASCALE
  12041. - SBETA = ( TEMP*B( JE, JE ) )*BSCALE
  12042. + TEMP = ONE / MAX( ABS( S( JE, JE ) )*ASCALE,
  12043. + $ ABS( P( JE, JE ) )*BSCALE, SAFMIN )
  12044. + SALFAR = ( TEMP*S( JE, JE ) )*ASCALE
  12045. + SBETA = ( TEMP*P( JE, JE ) )*BSCALE
  12046. ACOEF = SBETA*ASCALE
  12047. BCOEFR = SALFAR*BSCALE
  12048. BCOEFI = ZERO
  12049. @@ -517,7 +519,7 @@
  12050. *
  12051. * Complex eigenvalue
  12052. *
  12053. - CALL SLAG2( A( JE, JE ), LDA, B( JE, JE ), LDB,
  12054. + CALL SLAG2( S( JE, JE ), LDS, P( JE, JE ), LDP,
  12055. $ SAFMIN*SAFETY, ACOEF, TEMP, BCOEFR, TEMP2,
  12056. $ BCOEFI )
  12057. BCOEFI = -BCOEFI
  12058. @@ -549,9 +551,9 @@
  12059. *
  12060. * Compute first two components of eigenvector
  12061. *
  12062. - TEMP = ACOEF*A( JE+1, JE )
  12063. - TEMP2R = ACOEF*A( JE, JE ) - BCOEFR*B( JE, JE )
  12064. - TEMP2I = -BCOEFI*B( JE, JE )
  12065. + TEMP = ACOEF*S( JE+1, JE )
  12066. + TEMP2R = ACOEF*S( JE, JE ) - BCOEFR*P( JE, JE )
  12067. + TEMP2I = -BCOEFI*P( JE, JE )
  12068. IF( ABS( TEMP ).GT.ABS( TEMP2R )+ABS( TEMP2I ) ) THEN
  12069. WORK( 2*N+JE ) = ONE
  12070. WORK( 3*N+JE ) = ZERO
  12071. @@ -560,10 +562,10 @@
  12072. ELSE
  12073. WORK( 2*N+JE+1 ) = ONE
  12074. WORK( 3*N+JE+1 ) = ZERO
  12075. - TEMP = ACOEF*A( JE, JE+1 )
  12076. - WORK( 2*N+JE ) = ( BCOEFR*B( JE+1, JE+1 )-ACOEF*
  12077. - $ A( JE+1, JE+1 ) ) / TEMP
  12078. - WORK( 3*N+JE ) = BCOEFI*B( JE+1, JE+1 ) / TEMP
  12079. + TEMP = ACOEF*S( JE, JE+1 )
  12080. + WORK( 2*N+JE ) = ( BCOEFR*P( JE+1, JE+1 )-ACOEF*
  12081. + $ S( JE+1, JE+1 ) ) / TEMP
  12082. + WORK( 3*N+JE ) = BCOEFI*P( JE+1, JE+1 ) / TEMP
  12083. END IF
  12084. XMAX = MAX( ABS( WORK( 2*N+JE ) )+ABS( WORK( 3*N+JE ) ),
  12085. $ ABS( WORK( 2*N+JE+1 ) )+ABS( WORK( 3*N+JE+1 ) ) )
  12086. @@ -586,11 +588,11 @@
  12087. END IF
  12088. *
  12089. NA = 1
  12090. - BDIAG( 1 ) = B( J, J )
  12091. + BDIAG( 1 ) = P( J, J )
  12092. IF( J.LT.N ) THEN
  12093. - IF( A( J+1, J ).NE.ZERO ) THEN
  12094. + IF( S( J+1, J ).NE.ZERO ) THEN
  12095. IL2BY2 = .TRUE.
  12096. - BDIAG( 2 ) = B( J+1, J+1 )
  12097. + BDIAG( 2 ) = P( J+1, J+1 )
  12098. NA = 2
  12099. END IF
  12100. END IF
  12101. @@ -616,13 +618,13 @@
  12102. * Compute dot products
  12103. *
  12104. * j-1
  12105. -* SUM = sum conjg( a*A(k,j) - b*B(k,j) )*x(k)
  12106. +* SUM = sum conjg( a*S(k,j) - b*P(k,j) )*x(k)
  12107. * k=je
  12108. *
  12109. * To reduce the op count, this is done as
  12110. *
  12111. * _ j-1 _ j-1
  12112. -* a*conjg( sum A(k,j)*x(k) ) - b*conjg( sum B(k,j)*x(k) )
  12113. +* a*conjg( sum S(k,j)*x(k) ) - b*conjg( sum P(k,j)*x(k) )
  12114. * k=je k=je
  12115. *
  12116. * which may cause underflow problems if A or B are close
  12117. @@ -659,15 +661,15 @@
  12118. *$PL$ CMCHAR='*'
  12119. *
  12120. DO 110 JA = 1, NA
  12121. - SUMA( JA, JW ) = ZERO
  12122. - SUMB( JA, JW ) = ZERO
  12123. + SUMS( JA, JW ) = ZERO
  12124. + SUMP( JA, JW ) = ZERO
  12125. *
  12126. DO 100 JR = JE, J - 1
  12127. - SUMA( JA, JW ) = SUMA( JA, JW ) +
  12128. - $ A( JR, J+JA-1 )*
  12129. + SUMS( JA, JW ) = SUMS( JA, JW ) +
  12130. + $ S( JR, J+JA-1 )*
  12131. $ WORK( ( JW+1 )*N+JR )
  12132. - SUMB( JA, JW ) = SUMB( JA, JW ) +
  12133. - $ B( JR, J+JA-1 )*
  12134. + SUMP( JA, JW ) = SUMP( JA, JW ) +
  12135. + $ P( JR, J+JA-1 )*
  12136. $ WORK( ( JW+1 )*N+JR )
  12137. 100 CONTINUE
  12138. 110 CONTINUE
  12139. @@ -687,15 +689,15 @@
  12140. *
  12141. DO 130 JA = 1, NA
  12142. IF( ILCPLX ) THEN
  12143. - SUM( JA, 1 ) = -ACOEF*SUMA( JA, 1 ) +
  12144. - $ BCOEFR*SUMB( JA, 1 ) -
  12145. - $ BCOEFI*SUMB( JA, 2 )
  12146. - SUM( JA, 2 ) = -ACOEF*SUMA( JA, 2 ) +
  12147. - $ BCOEFR*SUMB( JA, 2 ) +
  12148. - $ BCOEFI*SUMB( JA, 1 )
  12149. + SUM( JA, 1 ) = -ACOEF*SUMS( JA, 1 ) +
  12150. + $ BCOEFR*SUMP( JA, 1 ) -
  12151. + $ BCOEFI*SUMP( JA, 2 )
  12152. + SUM( JA, 2 ) = -ACOEF*SUMS( JA, 2 ) +
  12153. + $ BCOEFR*SUMP( JA, 2 ) +
  12154. + $ BCOEFI*SUMP( JA, 1 )
  12155. ELSE
  12156. - SUM( JA, 1 ) = -ACOEF*SUMA( JA, 1 ) +
  12157. - $ BCOEFR*SUMB( JA, 1 )
  12158. + SUM( JA, 1 ) = -ACOEF*SUMS( JA, 1 ) +
  12159. + $ BCOEFR*SUMP( JA, 1 )
  12160. END IF
  12161. 130 CONTINUE
  12162. *
  12163. @@ -703,7 +705,7 @@
  12164. * Solve ( a A - b B ) y = SUM(,)
  12165. * with scaling and perturbation of the denominator
  12166. *
  12167. - CALL SLALN2( .TRUE., NA, NW, DMIN, ACOEF, A( J, J ), LDA,
  12168. + CALL SLALN2( .TRUE., NA, NW, DMIN, ACOEF, S( J, J ), LDS,
  12169. $ BDIAG( 1 ), BDIAG( 2 ), SUM, 2, BCOEFR,
  12170. $ BCOEFI, WORK( 2*N+J ), N, SCALE, TEMP,
  12171. $ IINFO )
  12172. @@ -790,7 +792,7 @@
  12173. END IF
  12174. NW = 1
  12175. IF( JE.GT.1 ) THEN
  12176. - IF( A( JE, JE-1 ).NE.ZERO ) THEN
  12177. + IF( S( JE, JE-1 ).NE.ZERO ) THEN
  12178. ILCPLX = .TRUE.
  12179. NW = 2
  12180. END IF
  12181. @@ -809,8 +811,8 @@
  12182. * (c) complex eigenvalue.
  12183. *
  12184. IF( .NOT.ILCPLX ) THEN
  12185. - IF( ABS( A( JE, JE ) ).LE.SAFMIN .AND.
  12186. - $ ABS( B( JE, JE ) ).LE.SAFMIN ) THEN
  12187. + IF( ABS( S( JE, JE ) ).LE.SAFMIN .AND.
  12188. + $ ABS( P( JE, JE ) ).LE.SAFMIN ) THEN
  12189. *
  12190. * Singular matrix pencil -- unit eigenvector
  12191. *
  12192. @@ -839,10 +841,10 @@
  12193. *
  12194. * Real eigenvalue
  12195. *
  12196. - TEMP = ONE / MAX( ABS( A( JE, JE ) )*ASCALE,
  12197. - $ ABS( B( JE, JE ) )*BSCALE, SAFMIN )
  12198. - SALFAR = ( TEMP*A( JE, JE ) )*ASCALE
  12199. - SBETA = ( TEMP*B( JE, JE ) )*BSCALE
  12200. + TEMP = ONE / MAX( ABS( S( JE, JE ) )*ASCALE,
  12201. + $ ABS( P( JE, JE ) )*BSCALE, SAFMIN )
  12202. + SALFAR = ( TEMP*S( JE, JE ) )*ASCALE
  12203. + SBETA = ( TEMP*P( JE, JE ) )*BSCALE
  12204. ACOEF = SBETA*ASCALE
  12205. BCOEFR = SALFAR*BSCALE
  12206. BCOEFI = ZERO
  12207. @@ -885,14 +887,14 @@
  12208. * (See "Further Details", above.)
  12209. *
  12210. DO 260 JR = 1, JE - 1
  12211. - WORK( 2*N+JR ) = BCOEFR*B( JR, JE ) -
  12212. - $ ACOEF*A( JR, JE )
  12213. + WORK( 2*N+JR ) = BCOEFR*P( JR, JE ) -
  12214. + $ ACOEF*S( JR, JE )
  12215. 260 CONTINUE
  12216. ELSE
  12217. *
  12218. * Complex eigenvalue
  12219. *
  12220. - CALL SLAG2( A( JE-1, JE-1 ), LDA, B( JE-1, JE-1 ), LDB,
  12221. + CALL SLAG2( S( JE-1, JE-1 ), LDS, P( JE-1, JE-1 ), LDP,
  12222. $ SAFMIN*SAFETY, ACOEF, TEMP, BCOEFR, TEMP2,
  12223. $ BCOEFI )
  12224. IF( BCOEFI.EQ.ZERO ) THEN
  12225. @@ -924,9 +926,9 @@
  12226. * Compute first two components of eigenvector
  12227. * and contribution to sums
  12228. *
  12229. - TEMP = ACOEF*A( JE, JE-1 )
  12230. - TEMP2R = ACOEF*A( JE, JE ) - BCOEFR*B( JE, JE )
  12231. - TEMP2I = -BCOEFI*B( JE, JE )
  12232. + TEMP = ACOEF*S( JE, JE-1 )
  12233. + TEMP2R = ACOEF*S( JE, JE ) - BCOEFR*P( JE, JE )
  12234. + TEMP2I = -BCOEFI*P( JE, JE )
  12235. IF( ABS( TEMP ).GE.ABS( TEMP2R )+ABS( TEMP2I ) ) THEN
  12236. WORK( 2*N+JE ) = ONE
  12237. WORK( 3*N+JE ) = ZERO
  12238. @@ -935,10 +937,10 @@
  12239. ELSE
  12240. WORK( 2*N+JE-1 ) = ONE
  12241. WORK( 3*N+JE-1 ) = ZERO
  12242. - TEMP = ACOEF*A( JE-1, JE )
  12243. - WORK( 2*N+JE ) = ( BCOEFR*B( JE-1, JE-1 )-ACOEF*
  12244. - $ A( JE-1, JE-1 ) ) / TEMP
  12245. - WORK( 3*N+JE ) = BCOEFI*B( JE-1, JE-1 ) / TEMP
  12246. + TEMP = ACOEF*S( JE-1, JE )
  12247. + WORK( 2*N+JE ) = ( BCOEFR*P( JE-1, JE-1 )-ACOEF*
  12248. + $ S( JE-1, JE-1 ) ) / TEMP
  12249. + WORK( 3*N+JE ) = BCOEFI*P( JE-1, JE-1 ) / TEMP
  12250. END IF
  12251. *
  12252. XMAX = MAX( ABS( WORK( 2*N+JE ) )+ABS( WORK( 3*N+JE ) ),
  12253. @@ -958,12 +960,12 @@
  12254. CRE2B = BCOEFR*WORK( 2*N+JE ) - BCOEFI*WORK( 3*N+JE )
  12255. CIM2B = BCOEFI*WORK( 2*N+JE ) + BCOEFR*WORK( 3*N+JE )
  12256. DO 270 JR = 1, JE - 2
  12257. - WORK( 2*N+JR ) = -CREALA*A( JR, JE-1 ) +
  12258. - $ CREALB*B( JR, JE-1 ) -
  12259. - $ CRE2A*A( JR, JE ) + CRE2B*B( JR, JE )
  12260. - WORK( 3*N+JR ) = -CIMAGA*A( JR, JE-1 ) +
  12261. - $ CIMAGB*B( JR, J