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

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