You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

ssytf2.f 18 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611
  1. *> \brief \b SSYTF2 computes the factorization of a real symmetric indefinite matrix, using the diagonal pivoting method (unblocked algorithm).
  2. *
  3. * =========== DOCUMENTATION ===========
  4. *
  5. * Online html documentation available at
  6. * http://www.netlib.org/lapack/explore-html/
  7. *
  8. *> \htmlonly
  9. *> Download SSYTF2 + dependencies
  10. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/ssytf2.f">
  11. *> [TGZ]</a>
  12. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/ssytf2.f">
  13. *> [ZIP]</a>
  14. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/ssytf2.f">
  15. *> [TXT]</a>
  16. *> \endhtmlonly
  17. *
  18. * Definition:
  19. * ===========
  20. *
  21. * SUBROUTINE SSYTF2( UPLO, N, A, LDA, IPIV, INFO )
  22. *
  23. * .. Scalar Arguments ..
  24. * CHARACTER UPLO
  25. * INTEGER INFO, LDA, N
  26. * ..
  27. * .. Array Arguments ..
  28. * INTEGER IPIV( * )
  29. * REAL A( LDA, * )
  30. * ..
  31. *
  32. *
  33. *> \par Purpose:
  34. * =============
  35. *>
  36. *> \verbatim
  37. *>
  38. *> SSYTF2 computes the factorization of a real symmetric matrix A using
  39. *> the Bunch-Kaufman diagonal pivoting method:
  40. *>
  41. *> A = U*D*U**T or A = L*D*L**T
  42. *>
  43. *> where U (or L) is a product of permutation and unit upper (lower)
  44. *> triangular matrices, U**T is the transpose of U, and D is symmetric and
  45. *> block diagonal with 1-by-1 and 2-by-2 diagonal blocks.
  46. *>
  47. *> This is the unblocked version of the algorithm, calling Level 2 BLAS.
  48. *> \endverbatim
  49. *
  50. * Arguments:
  51. * ==========
  52. *
  53. *> \param[in] UPLO
  54. *> \verbatim
  55. *> UPLO is CHARACTER*1
  56. *> Specifies whether the upper or lower triangular part of the
  57. *> symmetric matrix A is stored:
  58. *> = 'U': Upper triangular
  59. *> = 'L': Lower triangular
  60. *> \endverbatim
  61. *>
  62. *> \param[in] N
  63. *> \verbatim
  64. *> N is INTEGER
  65. *> The order of the matrix A. N >= 0.
  66. *> \endverbatim
  67. *>
  68. *> \param[in,out] A
  69. *> \verbatim
  70. *> A is REAL array, dimension (LDA,N)
  71. *> On entry, the symmetric matrix A. If UPLO = 'U', the leading
  72. *> n-by-n upper triangular part of A contains the upper
  73. *> triangular part of the matrix A, and the strictly lower
  74. *> triangular part of A is not referenced. If UPLO = 'L', the
  75. *> leading n-by-n lower triangular part of A contains the lower
  76. *> triangular part of the matrix A, and the strictly upper
  77. *> triangular part of A is not referenced.
  78. *>
  79. *> On exit, the block diagonal matrix D and the multipliers used
  80. *> to obtain the factor U or L (see below for further details).
  81. *> \endverbatim
  82. *>
  83. *> \param[in] LDA
  84. *> \verbatim
  85. *> LDA is INTEGER
  86. *> The leading dimension of the array A. LDA >= max(1,N).
  87. *> \endverbatim
  88. *>
  89. *> \param[out] IPIV
  90. *> \verbatim
  91. *> IPIV is INTEGER array, dimension (N)
  92. *> Details of the interchanges and the block structure of D.
  93. *>
  94. *> If UPLO = 'U':
  95. *> If IPIV(k) > 0, then rows and columns k and IPIV(k) were
  96. *> interchanged and D(k,k) is a 1-by-1 diagonal block.
  97. *>
  98. *> If IPIV(k) = IPIV(k-1) < 0, then rows and columns
  99. *> k-1 and -IPIV(k) were interchanged and D(k-1:k,k-1:k)
  100. *> is a 2-by-2 diagonal block.
  101. *>
  102. *> If UPLO = 'L':
  103. *> If IPIV(k) > 0, then rows and columns k and IPIV(k) were
  104. *> interchanged and D(k,k) is a 1-by-1 diagonal block.
  105. *>
  106. *> If IPIV(k) = IPIV(k+1) < 0, then rows and columns
  107. *> k+1 and -IPIV(k) were interchanged and D(k:k+1,k:k+1)
  108. *> is a 2-by-2 diagonal block.
  109. *> \endverbatim
  110. *>
  111. *> \param[out] INFO
  112. *> \verbatim
  113. *> INFO is INTEGER
  114. *> = 0: successful exit
  115. *> < 0: if INFO = -k, the k-th argument had an illegal value
  116. *> > 0: if INFO = k, D(k,k) is exactly zero. The factorization
  117. *> has been completed, but the block diagonal matrix D is
  118. *> exactly singular, and division by zero will occur if it
  119. *> is used to solve a system of equations.
  120. *> \endverbatim
  121. *
  122. * Authors:
  123. * ========
  124. *
  125. *> \author Univ. of Tennessee
  126. *> \author Univ. of California Berkeley
  127. *> \author Univ. of Colorado Denver
  128. *> \author NAG Ltd.
  129. *
  130. *> \date December 2016
  131. *
  132. *> \ingroup realSYcomputational
  133. *
  134. *> \par Further Details:
  135. * =====================
  136. *>
  137. *> \verbatim
  138. *>
  139. *> If UPLO = 'U', then A = U*D*U**T, where
  140. *> U = P(n)*U(n)* ... *P(k)U(k)* ...,
  141. *> i.e., U is a product of terms P(k)*U(k), where k decreases from n to
  142. *> 1 in steps of 1 or 2, and D is a block diagonal matrix with 1-by-1
  143. *> and 2-by-2 diagonal blocks D(k). P(k) is a permutation matrix as
  144. *> defined by IPIV(k), and U(k) is a unit upper triangular matrix, such
  145. *> that if the diagonal block D(k) is of order s (s = 1 or 2), then
  146. *>
  147. *> ( I v 0 ) k-s
  148. *> U(k) = ( 0 I 0 ) s
  149. *> ( 0 0 I ) n-k
  150. *> k-s s n-k
  151. *>
  152. *> If s = 1, D(k) overwrites A(k,k), and v overwrites A(1:k-1,k).
  153. *> If s = 2, the upper triangle of D(k) overwrites A(k-1,k-1), A(k-1,k),
  154. *> and A(k,k), and v overwrites A(1:k-2,k-1:k).
  155. *>
  156. *> If UPLO = 'L', then A = L*D*L**T, where
  157. *> L = P(1)*L(1)* ... *P(k)*L(k)* ...,
  158. *> i.e., L is a product of terms P(k)*L(k), where k increases from 1 to
  159. *> n in steps of 1 or 2, and D is a block diagonal matrix with 1-by-1
  160. *> and 2-by-2 diagonal blocks D(k). P(k) is a permutation matrix as
  161. *> defined by IPIV(k), and L(k) is a unit lower triangular matrix, such
  162. *> that if the diagonal block D(k) is of order s (s = 1 or 2), then
  163. *>
  164. *> ( I 0 0 ) k-1
  165. *> L(k) = ( 0 I 0 ) s
  166. *> ( 0 v I ) n-k-s+1
  167. *> k-1 s n-k-s+1
  168. *>
  169. *> If s = 1, D(k) overwrites A(k,k), and v overwrites A(k+1:n,k).
  170. *> If s = 2, the lower triangle of D(k) overwrites A(k,k), A(k+1,k),
  171. *> and A(k+1,k+1), and v overwrites A(k+2:n,k:k+1).
  172. *> \endverbatim
  173. *
  174. *> \par Contributors:
  175. * ==================
  176. *>
  177. *> \verbatim
  178. *>
  179. *> 09-29-06 - patch from
  180. *> Bobby Cheng, MathWorks
  181. *>
  182. *> Replace l.204 and l.372
  183. *> IF( MAX( ABSAKK, COLMAX ).EQ.ZERO ) THEN
  184. *> by
  185. *> IF( (MAX( ABSAKK, COLMAX ).EQ.ZERO) .OR. SISNAN(ABSAKK) ) THEN
  186. *>
  187. *> 01-01-96 - Based on modifications by
  188. *> J. Lewis, Boeing Computer Services Company
  189. *> A. Petitet, Computer Science Dept., Univ. of Tenn., Knoxville, USA
  190. *> 1-96 - Based on modifications by J. Lewis, Boeing Computer Services
  191. *> Company
  192. *>
  193. *> \endverbatim
  194. *
  195. * =====================================================================
  196. SUBROUTINE SSYTF2( UPLO, N, A, LDA, IPIV, INFO )
  197. *
  198. * -- LAPACK computational routine (version 3.7.0) --
  199. * -- LAPACK is a software package provided by Univ. of Tennessee, --
  200. * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  201. * December 2016
  202. *
  203. * .. Scalar Arguments ..
  204. CHARACTER UPLO
  205. INTEGER INFO, LDA, N
  206. * ..
  207. * .. Array Arguments ..
  208. INTEGER IPIV( * )
  209. REAL A( LDA, * )
  210. * ..
  211. *
  212. * =====================================================================
  213. *
  214. * .. Parameters ..
  215. REAL ZERO, ONE
  216. PARAMETER ( ZERO = 0.0E+0, ONE = 1.0E+0 )
  217. REAL EIGHT, SEVTEN
  218. PARAMETER ( EIGHT = 8.0E+0, SEVTEN = 17.0E+0 )
  219. * ..
  220. * .. Local Scalars ..
  221. LOGICAL UPPER
  222. INTEGER I, IMAX, J, JMAX, K, KK, KP, KSTEP
  223. REAL ABSAKK, ALPHA, COLMAX, D11, D12, D21, D22, R1,
  224. $ ROWMAX, T, WK, WKM1, WKP1
  225. * ..
  226. * .. External Functions ..
  227. LOGICAL LSAME, SISNAN
  228. INTEGER ISAMAX
  229. EXTERNAL LSAME, ISAMAX, SISNAN
  230. * ..
  231. * .. External Subroutines ..
  232. EXTERNAL SSCAL, SSWAP, SSYR, XERBLA
  233. * ..
  234. * .. Intrinsic Functions ..
  235. INTRINSIC ABS, MAX, SQRT
  236. * ..
  237. * .. Executable Statements ..
  238. *
  239. * Test the input parameters.
  240. *
  241. INFO = 0
  242. UPPER = LSAME( UPLO, 'U' )
  243. IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
  244. INFO = -1
  245. ELSE IF( N.LT.0 ) THEN
  246. INFO = -2
  247. ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
  248. INFO = -4
  249. END IF
  250. IF( INFO.NE.0 ) THEN
  251. CALL XERBLA( 'SSYTF2', -INFO )
  252. RETURN
  253. END IF
  254. *
  255. * Initialize ALPHA for use in choosing pivot block size.
  256. *
  257. ALPHA = ( ONE+SQRT( SEVTEN ) ) / EIGHT
  258. *
  259. IF( UPPER ) THEN
  260. *
  261. * Factorize A as U*D*U**T using the upper triangle of A
  262. *
  263. * K is the main loop index, decreasing from N to 1 in steps of
  264. * 1 or 2
  265. *
  266. K = N
  267. 10 CONTINUE
  268. *
  269. * If K < 1, exit from loop
  270. *
  271. IF( K.LT.1 )
  272. $ GO TO 70
  273. KSTEP = 1
  274. *
  275. * Determine rows and columns to be interchanged and whether
  276. * a 1-by-1 or 2-by-2 pivot block will be used
  277. *
  278. ABSAKK = ABS( A( K, K ) )
  279. *
  280. * IMAX is the row-index of the largest off-diagonal element in
  281. * column K, and COLMAX is its absolute value.
  282. * Determine both COLMAX and IMAX.
  283. *
  284. IF( K.GT.1 ) THEN
  285. IMAX = ISAMAX( K-1, A( 1, K ), 1 )
  286. COLMAX = ABS( A( IMAX, K ) )
  287. ELSE
  288. COLMAX = ZERO
  289. END IF
  290. *
  291. IF( (MAX( ABSAKK, COLMAX ).EQ.ZERO) .OR. SISNAN(ABSAKK) ) THEN
  292. *
  293. * Column K is zero or underflow, or contains a NaN:
  294. * set INFO and continue
  295. *
  296. IF( INFO.EQ.0 )
  297. $ INFO = K
  298. KP = K
  299. ELSE
  300. IF( ABSAKK.GE.ALPHA*COLMAX ) THEN
  301. *
  302. * no interchange, use 1-by-1 pivot block
  303. *
  304. KP = K
  305. ELSE
  306. *
  307. * JMAX is the column-index of the largest off-diagonal
  308. * element in row IMAX, and ROWMAX is its absolute value
  309. *
  310. JMAX = IMAX + ISAMAX( K-IMAX, A( IMAX, IMAX+1 ), LDA )
  311. ROWMAX = ABS( A( IMAX, JMAX ) )
  312. IF( IMAX.GT.1 ) THEN
  313. JMAX = ISAMAX( IMAX-1, A( 1, IMAX ), 1 )
  314. ROWMAX = MAX( ROWMAX, ABS( A( JMAX, IMAX ) ) )
  315. END IF
  316. *
  317. IF( ABSAKK.GE.ALPHA*COLMAX*( COLMAX / ROWMAX ) ) THEN
  318. *
  319. * no interchange, use 1-by-1 pivot block
  320. *
  321. KP = K
  322. ELSE IF( ABS( A( IMAX, IMAX ) ).GE.ALPHA*ROWMAX ) THEN
  323. *
  324. * interchange rows and columns K and IMAX, use 1-by-1
  325. * pivot block
  326. *
  327. KP = IMAX
  328. ELSE
  329. *
  330. * interchange rows and columns K-1 and IMAX, use 2-by-2
  331. * pivot block
  332. *
  333. KP = IMAX
  334. KSTEP = 2
  335. END IF
  336. END IF
  337. *
  338. KK = K - KSTEP + 1
  339. IF( KP.NE.KK ) THEN
  340. *
  341. * Interchange rows and columns KK and KP in the leading
  342. * submatrix A(1:k,1:k)
  343. *
  344. CALL SSWAP( KP-1, A( 1, KK ), 1, A( 1, KP ), 1 )
  345. CALL SSWAP( KK-KP-1, A( KP+1, KK ), 1, A( KP, KP+1 ),
  346. $ LDA )
  347. T = A( KK, KK )
  348. A( KK, KK ) = A( KP, KP )
  349. A( KP, KP ) = T
  350. IF( KSTEP.EQ.2 ) THEN
  351. T = A( K-1, K )
  352. A( K-1, K ) = A( KP, K )
  353. A( KP, K ) = T
  354. END IF
  355. END IF
  356. *
  357. * Update the leading submatrix
  358. *
  359. IF( KSTEP.EQ.1 ) THEN
  360. *
  361. * 1-by-1 pivot block D(k): column k now holds
  362. *
  363. * W(k) = U(k)*D(k)
  364. *
  365. * where U(k) is the k-th column of U
  366. *
  367. * Perform a rank-1 update of A(1:k-1,1:k-1) as
  368. *
  369. * A := A - U(k)*D(k)*U(k)**T = A - W(k)*1/D(k)*W(k)**T
  370. *
  371. R1 = ONE / A( K, K )
  372. CALL SSYR( UPLO, K-1, -R1, A( 1, K ), 1, A, LDA )
  373. *
  374. * Store U(k) in column k
  375. *
  376. CALL SSCAL( K-1, R1, A( 1, K ), 1 )
  377. ELSE
  378. *
  379. * 2-by-2 pivot block D(k): columns k and k-1 now hold
  380. *
  381. * ( W(k-1) W(k) ) = ( U(k-1) U(k) )*D(k)
  382. *
  383. * where U(k) and U(k-1) are the k-th and (k-1)-th columns
  384. * of U
  385. *
  386. * Perform a rank-2 update of A(1:k-2,1:k-2) as
  387. *
  388. * A := A - ( U(k-1) U(k) )*D(k)*( U(k-1) U(k) )**T
  389. * = A - ( W(k-1) W(k) )*inv(D(k))*( W(k-1) W(k) )**T
  390. *
  391. IF( K.GT.2 ) THEN
  392. *
  393. D12 = A( K-1, K )
  394. D22 = A( K-1, K-1 ) / D12
  395. D11 = A( K, K ) / D12
  396. T = ONE / ( D11*D22-ONE )
  397. D12 = T / D12
  398. *
  399. DO 30 J = K - 2, 1, -1
  400. WKM1 = D12*( D11*A( J, K-1 )-A( J, K ) )
  401. WK = D12*( D22*A( J, K )-A( J, K-1 ) )
  402. DO 20 I = J, 1, -1
  403. A( I, J ) = A( I, J ) - A( I, K )*WK -
  404. $ A( I, K-1 )*WKM1
  405. 20 CONTINUE
  406. A( J, K ) = WK
  407. A( J, K-1 ) = WKM1
  408. 30 CONTINUE
  409. *
  410. END IF
  411. *
  412. END IF
  413. END IF
  414. *
  415. * Store details of the interchanges in IPIV
  416. *
  417. IF( KSTEP.EQ.1 ) THEN
  418. IPIV( K ) = KP
  419. ELSE
  420. IPIV( K ) = -KP
  421. IPIV( K-1 ) = -KP
  422. END IF
  423. *
  424. * Decrease K and return to the start of the main loop
  425. *
  426. K = K - KSTEP
  427. GO TO 10
  428. *
  429. ELSE
  430. *
  431. * Factorize A as L*D*L**T using the lower triangle of A
  432. *
  433. * K is the main loop index, increasing from 1 to N in steps of
  434. * 1 or 2
  435. *
  436. K = 1
  437. 40 CONTINUE
  438. *
  439. * If K > N, exit from loop
  440. *
  441. IF( K.GT.N )
  442. $ GO TO 70
  443. KSTEP = 1
  444. *
  445. * Determine rows and columns to be interchanged and whether
  446. * a 1-by-1 or 2-by-2 pivot block will be used
  447. *
  448. ABSAKK = ABS( A( K, K ) )
  449. *
  450. * IMAX is the row-index of the largest off-diagonal element in
  451. * column K, and COLMAX is its absolute value.
  452. * Determine both COLMAX and IMAX.
  453. *
  454. IF( K.LT.N ) THEN
  455. IMAX = K + ISAMAX( N-K, A( K+1, K ), 1 )
  456. COLMAX = ABS( A( IMAX, K ) )
  457. ELSE
  458. COLMAX = ZERO
  459. END IF
  460. *
  461. IF( (MAX( ABSAKK, COLMAX ).EQ.ZERO) .OR. SISNAN(ABSAKK) ) THEN
  462. *
  463. * Column K is zero or underflow, or contains a NaN:
  464. * set INFO and continue
  465. *
  466. IF( INFO.EQ.0 )
  467. $ INFO = K
  468. KP = K
  469. ELSE
  470. IF( ABSAKK.GE.ALPHA*COLMAX ) THEN
  471. *
  472. * no interchange, use 1-by-1 pivot block
  473. *
  474. KP = K
  475. ELSE
  476. *
  477. * JMAX is the column-index of the largest off-diagonal
  478. * element in row IMAX, and ROWMAX is its absolute value
  479. *
  480. JMAX = K - 1 + ISAMAX( IMAX-K, A( IMAX, K ), LDA )
  481. ROWMAX = ABS( A( IMAX, JMAX ) )
  482. IF( IMAX.LT.N ) THEN
  483. JMAX = IMAX + ISAMAX( N-IMAX, A( IMAX+1, IMAX ), 1 )
  484. ROWMAX = MAX( ROWMAX, ABS( A( JMAX, IMAX ) ) )
  485. END IF
  486. *
  487. IF( ABSAKK.GE.ALPHA*COLMAX*( COLMAX / ROWMAX ) ) THEN
  488. *
  489. * no interchange, use 1-by-1 pivot block
  490. *
  491. KP = K
  492. ELSE IF( ABS( A( IMAX, IMAX ) ).GE.ALPHA*ROWMAX ) THEN
  493. *
  494. * interchange rows and columns K and IMAX, use 1-by-1
  495. * pivot block
  496. *
  497. KP = IMAX
  498. ELSE
  499. *
  500. * interchange rows and columns K+1 and IMAX, use 2-by-2
  501. * pivot block
  502. *
  503. KP = IMAX
  504. KSTEP = 2
  505. END IF
  506. END IF
  507. *
  508. KK = K + KSTEP - 1
  509. IF( KP.NE.KK ) THEN
  510. *
  511. * Interchange rows and columns KK and KP in the trailing
  512. * submatrix A(k:n,k:n)
  513. *
  514. IF( KP.LT.N )
  515. $ CALL SSWAP( N-KP, A( KP+1, KK ), 1, A( KP+1, KP ), 1 )
  516. CALL SSWAP( KP-KK-1, A( KK+1, KK ), 1, A( KP, KK+1 ),
  517. $ LDA )
  518. T = A( KK, KK )
  519. A( KK, KK ) = A( KP, KP )
  520. A( KP, KP ) = T
  521. IF( KSTEP.EQ.2 ) THEN
  522. T = A( K+1, K )
  523. A( K+1, K ) = A( KP, K )
  524. A( KP, K ) = T
  525. END IF
  526. END IF
  527. *
  528. * Update the trailing submatrix
  529. *
  530. IF( KSTEP.EQ.1 ) THEN
  531. *
  532. * 1-by-1 pivot block D(k): column k now holds
  533. *
  534. * W(k) = L(k)*D(k)
  535. *
  536. * where L(k) is the k-th column of L
  537. *
  538. IF( K.LT.N ) THEN
  539. *
  540. * Perform a rank-1 update of A(k+1:n,k+1:n) as
  541. *
  542. * A := A - L(k)*D(k)*L(k)**T = A - W(k)*(1/D(k))*W(k)**T
  543. *
  544. D11 = ONE / A( K, K )
  545. CALL SSYR( UPLO, N-K, -D11, A( K+1, K ), 1,
  546. $ A( K+1, K+1 ), LDA )
  547. *
  548. * Store L(k) in column K
  549. *
  550. CALL SSCAL( N-K, D11, A( K+1, K ), 1 )
  551. END IF
  552. ELSE
  553. *
  554. * 2-by-2 pivot block D(k)
  555. *
  556. IF( K.LT.N-1 ) THEN
  557. *
  558. * Perform a rank-2 update of A(k+2:n,k+2:n) as
  559. *
  560. * A := A - ( (A(k) A(k+1))*D(k)**(-1) ) * (A(k) A(k+1))**T
  561. *
  562. * where L(k) and L(k+1) are the k-th and (k+1)-th
  563. * columns of L
  564. *
  565. D21 = A( K+1, K )
  566. D11 = A( K+1, K+1 ) / D21
  567. D22 = A( K, K ) / D21
  568. T = ONE / ( D11*D22-ONE )
  569. D21 = T / D21
  570. *
  571. DO 60 J = K + 2, N
  572. *
  573. WK = D21*( D11*A( J, K )-A( J, K+1 ) )
  574. WKP1 = D21*( D22*A( J, K+1 )-A( J, K ) )
  575. *
  576. DO 50 I = J, N
  577. A( I, J ) = A( I, J ) - A( I, K )*WK -
  578. $ A( I, K+1 )*WKP1
  579. 50 CONTINUE
  580. *
  581. A( J, K ) = WK
  582. A( J, K+1 ) = WKP1
  583. *
  584. 60 CONTINUE
  585. END IF
  586. END IF
  587. END IF
  588. *
  589. * Store details of the interchanges in IPIV
  590. *
  591. IF( KSTEP.EQ.1 ) THEN
  592. IPIV( K ) = KP
  593. ELSE
  594. IPIV( K ) = -KP
  595. IPIV( K+1 ) = -KP
  596. END IF
  597. *
  598. * Increase K and return to the start of the main loop
  599. *
  600. K = K + KSTEP
  601. GO TO 40
  602. *
  603. END IF
  604. *
  605. 70 CONTINUE
  606. *
  607. RETURN
  608. *
  609. * End of SSYTF2
  610. *
  611. END