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.

csytf2.f 18 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598
  1. *> \brief \b CSYTF2 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 CSYTF2 + dependencies
  10. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/csytf2.f">
  11. *> [TGZ]</a>
  12. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/csytf2.f">
  13. *> [ZIP]</a>
  14. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/csytf2.f">
  15. *> [TXT]</a>
  16. *> \endhtmlonly
  17. *
  18. * Definition:
  19. * ===========
  20. *
  21. * SUBROUTINE CSYTF2( 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. * COMPLEX A( LDA, * )
  30. * ..
  31. *
  32. *
  33. *> \par Purpose:
  34. * =============
  35. *>
  36. *> \verbatim
  37. *>
  38. *> CSYTF2 computes the factorization of a complex symmetric matrix A
  39. *> using 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 COMPLEX 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 complexSYcomputational
  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.209 and l.377
  174. *> IF( MAX( ABSAKK, COLMAX ).EQ.ZERO ) THEN
  175. *> by
  176. *> IF( (MAX( ABSAKK, COLMAX ).EQ.ZERO) .OR. SISNAN(ABSAKK) ) THEN
  177. *>
  178. *> 1-96 - Based on modifications by J. Lewis, Boeing Computer Services
  179. *> Company
  180. *> \endverbatim
  181. *
  182. * =====================================================================
  183. SUBROUTINE CSYTF2( UPLO, N, A, LDA, IPIV, INFO )
  184. *
  185. * -- LAPACK computational routine (version 3.4.2) --
  186. * -- LAPACK is a software package provided by Univ. of Tennessee, --
  187. * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  188. * September 2012
  189. *
  190. * .. Scalar Arguments ..
  191. CHARACTER UPLO
  192. INTEGER INFO, LDA, N
  193. * ..
  194. * .. Array Arguments ..
  195. INTEGER IPIV( * )
  196. COMPLEX A( LDA, * )
  197. * ..
  198. *
  199. * =====================================================================
  200. *
  201. * .. Parameters ..
  202. REAL ZERO, ONE
  203. PARAMETER ( ZERO = 0.0E+0, ONE = 1.0E+0 )
  204. REAL EIGHT, SEVTEN
  205. PARAMETER ( EIGHT = 8.0E+0, SEVTEN = 17.0E+0 )
  206. COMPLEX CONE
  207. PARAMETER ( CONE = ( 1.0E+0, 0.0E+0 ) )
  208. * ..
  209. * .. Local Scalars ..
  210. LOGICAL UPPER
  211. INTEGER I, IMAX, J, JMAX, K, KK, KP, KSTEP
  212. REAL ABSAKK, ALPHA, COLMAX, ROWMAX
  213. COMPLEX D11, D12, D21, D22, R1, T, WK, WKM1, WKP1, Z
  214. * ..
  215. * .. External Functions ..
  216. LOGICAL LSAME, SISNAN
  217. INTEGER ICAMAX
  218. EXTERNAL LSAME, ICAMAX, SISNAN
  219. * ..
  220. * .. External Subroutines ..
  221. EXTERNAL CSCAL, CSWAP, CSYR, XERBLA
  222. * ..
  223. * .. Intrinsic Functions ..
  224. INTRINSIC ABS, AIMAG, MAX, REAL, SQRT
  225. * ..
  226. * .. Statement Functions ..
  227. REAL CABS1
  228. * ..
  229. * .. Statement Function definitions ..
  230. CABS1( Z ) = ABS( REAL( Z ) ) + ABS( AIMAG( Z ) )
  231. * ..
  232. * .. Executable Statements ..
  233. *
  234. * Test the input parameters.
  235. *
  236. INFO = 0
  237. UPPER = LSAME( UPLO, 'U' )
  238. IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
  239. INFO = -1
  240. ELSE IF( N.LT.0 ) THEN
  241. INFO = -2
  242. ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
  243. INFO = -4
  244. END IF
  245. IF( INFO.NE.0 ) THEN
  246. CALL XERBLA( 'CSYTF2', -INFO )
  247. RETURN
  248. END IF
  249. *
  250. * Initialize ALPHA for use in choosing pivot block size.
  251. *
  252. ALPHA = ( ONE+SQRT( SEVTEN ) ) / EIGHT
  253. *
  254. IF( UPPER ) THEN
  255. *
  256. * Factorize A as U*D*U**T using the upper triangle of A
  257. *
  258. * K is the main loop index, decreasing from N to 1 in steps of
  259. * 1 or 2
  260. *
  261. K = N
  262. 10 CONTINUE
  263. *
  264. * If K < 1, exit from loop
  265. *
  266. IF( K.LT.1 )
  267. $ GO TO 70
  268. KSTEP = 1
  269. *
  270. * Determine rows and columns to be interchanged and whether
  271. * a 1-by-1 or 2-by-2 pivot block will be used
  272. *
  273. ABSAKK = CABS1( A( K, K ) )
  274. *
  275. * IMAX is the row-index of the largest off-diagonal element in
  276. * column K, and COLMAX is its absolute value
  277. *
  278. IF( K.GT.1 ) THEN
  279. IMAX = ICAMAX( K-1, A( 1, K ), 1 )
  280. COLMAX = CABS1( A( IMAX, K ) )
  281. ELSE
  282. COLMAX = ZERO
  283. END IF
  284. *
  285. IF( MAX( ABSAKK, COLMAX ).EQ.ZERO .OR. SISNAN(ABSAKK) ) THEN
  286. *
  287. * Column K is zero or NaN: set INFO and continue
  288. *
  289. IF( INFO.EQ.0 )
  290. $ INFO = K
  291. KP = K
  292. ELSE
  293. IF( ABSAKK.GE.ALPHA*COLMAX ) THEN
  294. *
  295. * no interchange, use 1-by-1 pivot block
  296. *
  297. KP = K
  298. ELSE
  299. *
  300. * JMAX is the column-index of the largest off-diagonal
  301. * element in row IMAX, and ROWMAX is its absolute value
  302. *
  303. JMAX = IMAX + ICAMAX( K-IMAX, A( IMAX, IMAX+1 ), LDA )
  304. ROWMAX = CABS1( A( IMAX, JMAX ) )
  305. IF( IMAX.GT.1 ) THEN
  306. JMAX = ICAMAX( IMAX-1, A( 1, IMAX ), 1 )
  307. ROWMAX = MAX( ROWMAX, CABS1( A( JMAX, IMAX ) ) )
  308. END IF
  309. *
  310. IF( ABSAKK.GE.ALPHA*COLMAX*( COLMAX / ROWMAX ) ) THEN
  311. *
  312. * no interchange, use 1-by-1 pivot block
  313. *
  314. KP = K
  315. ELSE IF( CABS1( A( IMAX, IMAX ) ).GE.ALPHA*ROWMAX ) THEN
  316. *
  317. * interchange rows and columns K and IMAX, use 1-by-1
  318. * pivot block
  319. *
  320. KP = IMAX
  321. ELSE
  322. *
  323. * interchange rows and columns K-1 and IMAX, use 2-by-2
  324. * pivot block
  325. *
  326. KP = IMAX
  327. KSTEP = 2
  328. END IF
  329. END IF
  330. *
  331. KK = K - KSTEP + 1
  332. IF( KP.NE.KK ) THEN
  333. *
  334. * Interchange rows and columns KK and KP in the leading
  335. * submatrix A(1:k,1:k)
  336. *
  337. CALL CSWAP( KP-1, A( 1, KK ), 1, A( 1, KP ), 1 )
  338. CALL CSWAP( KK-KP-1, A( KP+1, KK ), 1, A( KP, KP+1 ),
  339. $ LDA )
  340. T = A( KK, KK )
  341. A( KK, KK ) = A( KP, KP )
  342. A( KP, KP ) = T
  343. IF( KSTEP.EQ.2 ) THEN
  344. T = A( K-1, K )
  345. A( K-1, K ) = A( KP, K )
  346. A( KP, K ) = T
  347. END IF
  348. END IF
  349. *
  350. * Update the leading submatrix
  351. *
  352. IF( KSTEP.EQ.1 ) THEN
  353. *
  354. * 1-by-1 pivot block D(k): column k now holds
  355. *
  356. * W(k) = U(k)*D(k)
  357. *
  358. * where U(k) is the k-th column of U
  359. *
  360. * Perform a rank-1 update of A(1:k-1,1:k-1) as
  361. *
  362. * A := A - U(k)*D(k)*U(k)**T = A - W(k)*1/D(k)*W(k)**T
  363. *
  364. R1 = CONE / A( K, K )
  365. CALL CSYR( UPLO, K-1, -R1, A( 1, K ), 1, A, LDA )
  366. *
  367. * Store U(k) in column k
  368. *
  369. CALL CSCAL( K-1, R1, A( 1, K ), 1 )
  370. ELSE
  371. *
  372. * 2-by-2 pivot block D(k): columns k and k-1 now hold
  373. *
  374. * ( W(k-1) W(k) ) = ( U(k-1) U(k) )*D(k)
  375. *
  376. * where U(k) and U(k-1) are the k-th and (k-1)-th columns
  377. * of U
  378. *
  379. * Perform a rank-2 update of A(1:k-2,1:k-2) as
  380. *
  381. * A := A - ( U(k-1) U(k) )*D(k)*( U(k-1) U(k) )**T
  382. * = A - ( W(k-1) W(k) )*inv(D(k))*( W(k-1) W(k) )**T
  383. *
  384. IF( K.GT.2 ) THEN
  385. *
  386. D12 = A( K-1, K )
  387. D22 = A( K-1, K-1 ) / D12
  388. D11 = A( K, K ) / D12
  389. T = CONE / ( D11*D22-CONE )
  390. D12 = T / D12
  391. *
  392. DO 30 J = K - 2, 1, -1
  393. WKM1 = D12*( D11*A( J, K-1 )-A( J, K ) )
  394. WK = D12*( D22*A( J, K )-A( J, K-1 ) )
  395. DO 20 I = J, 1, -1
  396. A( I, J ) = A( I, J ) - A( I, K )*WK -
  397. $ A( I, K-1 )*WKM1
  398. 20 CONTINUE
  399. A( J, K ) = WK
  400. A( J, K-1 ) = WKM1
  401. 30 CONTINUE
  402. *
  403. END IF
  404. *
  405. END IF
  406. END IF
  407. *
  408. * Store details of the interchanges in IPIV
  409. *
  410. IF( KSTEP.EQ.1 ) THEN
  411. IPIV( K ) = KP
  412. ELSE
  413. IPIV( K ) = -KP
  414. IPIV( K-1 ) = -KP
  415. END IF
  416. *
  417. * Decrease K and return to the start of the main loop
  418. *
  419. K = K - KSTEP
  420. GO TO 10
  421. *
  422. ELSE
  423. *
  424. * Factorize A as L*D*L**T using the lower triangle of A
  425. *
  426. * K is the main loop index, increasing from 1 to N in steps of
  427. * 1 or 2
  428. *
  429. K = 1
  430. 40 CONTINUE
  431. *
  432. * If K > N, exit from loop
  433. *
  434. IF( K.GT.N )
  435. $ GO TO 70
  436. KSTEP = 1
  437. *
  438. * Determine rows and columns to be interchanged and whether
  439. * a 1-by-1 or 2-by-2 pivot block will be used
  440. *
  441. ABSAKK = CABS1( A( K, K ) )
  442. *
  443. * IMAX is the row-index of the largest off-diagonal element in
  444. * column K, and COLMAX is its absolute value
  445. *
  446. IF( K.LT.N ) THEN
  447. IMAX = K + ICAMAX( N-K, A( K+1, K ), 1 )
  448. COLMAX = CABS1( A( IMAX, K ) )
  449. ELSE
  450. COLMAX = ZERO
  451. END IF
  452. *
  453. IF( MAX( ABSAKK, COLMAX ).EQ.ZERO .OR. SISNAN(ABSAKK) ) THEN
  454. *
  455. * Column K is zero or NaN: set INFO and continue
  456. *
  457. IF( INFO.EQ.0 )
  458. $ INFO = K
  459. KP = K
  460. ELSE
  461. IF( ABSAKK.GE.ALPHA*COLMAX ) THEN
  462. *
  463. * no interchange, use 1-by-1 pivot block
  464. *
  465. KP = K
  466. ELSE
  467. *
  468. * JMAX is the column-index of the largest off-diagonal
  469. * element in row IMAX, and ROWMAX is its absolute value
  470. *
  471. JMAX = K - 1 + ICAMAX( IMAX-K, A( IMAX, K ), LDA )
  472. ROWMAX = CABS1( A( IMAX, JMAX ) )
  473. IF( IMAX.LT.N ) THEN
  474. JMAX = IMAX + ICAMAX( N-IMAX, A( IMAX+1, IMAX ), 1 )
  475. ROWMAX = MAX( ROWMAX, CABS1( A( JMAX, IMAX ) ) )
  476. END IF
  477. *
  478. IF( ABSAKK.GE.ALPHA*COLMAX*( COLMAX / ROWMAX ) ) THEN
  479. *
  480. * no interchange, use 1-by-1 pivot block
  481. *
  482. KP = K
  483. ELSE IF( CABS1( A( IMAX, IMAX ) ).GE.ALPHA*ROWMAX ) THEN
  484. *
  485. * interchange rows and columns K and IMAX, use 1-by-1
  486. * pivot block
  487. *
  488. KP = IMAX
  489. ELSE
  490. *
  491. * interchange rows and columns K+1 and IMAX, use 2-by-2
  492. * pivot block
  493. *
  494. KP = IMAX
  495. KSTEP = 2
  496. END IF
  497. END IF
  498. *
  499. KK = K + KSTEP - 1
  500. IF( KP.NE.KK ) THEN
  501. *
  502. * Interchange rows and columns KK and KP in the trailing
  503. * submatrix A(k:n,k:n)
  504. *
  505. IF( KP.LT.N )
  506. $ CALL CSWAP( N-KP, A( KP+1, KK ), 1, A( KP+1, KP ), 1 )
  507. CALL CSWAP( KP-KK-1, A( KK+1, KK ), 1, A( KP, KK+1 ),
  508. $ LDA )
  509. T = A( KK, KK )
  510. A( KK, KK ) = A( KP, KP )
  511. A( KP, KP ) = T
  512. IF( KSTEP.EQ.2 ) THEN
  513. T = A( K+1, K )
  514. A( K+1, K ) = A( KP, K )
  515. A( KP, K ) = T
  516. END IF
  517. END IF
  518. *
  519. * Update the trailing submatrix
  520. *
  521. IF( KSTEP.EQ.1 ) THEN
  522. *
  523. * 1-by-1 pivot block D(k): column k now holds
  524. *
  525. * W(k) = L(k)*D(k)
  526. *
  527. * where L(k) is the k-th column of L
  528. *
  529. IF( K.LT.N ) THEN
  530. *
  531. * Perform a rank-1 update of A(k+1:n,k+1:n) as
  532. *
  533. * A := A - L(k)*D(k)*L(k)**T = A - W(k)*(1/D(k))*W(k)**T
  534. *
  535. R1 = CONE / A( K, K )
  536. CALL CSYR( UPLO, N-K, -R1, A( K+1, K ), 1,
  537. $ A( K+1, K+1 ), LDA )
  538. *
  539. * Store L(k) in column K
  540. *
  541. CALL CSCAL( N-K, R1, A( K+1, K ), 1 )
  542. END IF
  543. ELSE
  544. *
  545. * 2-by-2 pivot block D(k)
  546. *
  547. IF( K.LT.N-1 ) THEN
  548. *
  549. * Perform a rank-2 update of A(k+2:n,k+2:n) as
  550. *
  551. * A := A - ( L(k) L(k+1) )*D(k)*( L(k) L(k+1) )**T
  552. * = A - ( W(k) W(k+1) )*inv(D(k))*( W(k) W(k+1) )**T
  553. *
  554. * where L(k) and L(k+1) are the k-th and (k+1)-th
  555. * columns of L
  556. *
  557. D21 = A( K+1, K )
  558. D11 = A( K+1, K+1 ) / D21
  559. D22 = A( K, K ) / D21
  560. T = CONE / ( D11*D22-CONE )
  561. D21 = T / D21
  562. *
  563. DO 60 J = K + 2, N
  564. WK = D21*( D11*A( J, K )-A( J, K+1 ) )
  565. WKP1 = D21*( D22*A( J, K+1 )-A( J, K ) )
  566. DO 50 I = J, N
  567. A( I, J ) = A( I, J ) - A( I, K )*WK -
  568. $ A( I, K+1 )*WKP1
  569. 50 CONTINUE
  570. A( J, K ) = WK
  571. A( J, K+1 ) = WKP1
  572. 60 CONTINUE
  573. END IF
  574. END IF
  575. END IF
  576. *
  577. * Store details of the interchanges in IPIV
  578. *
  579. IF( KSTEP.EQ.1 ) THEN
  580. IPIV( K ) = KP
  581. ELSE
  582. IPIV( K ) = -KP
  583. IPIV( K+1 ) = -KP
  584. END IF
  585. *
  586. * Increase K and return to the start of the main loop
  587. *
  588. K = K + KSTEP
  589. GO TO 40
  590. *
  591. END IF
  592. *
  593. 70 CONTINUE
  594. RETURN
  595. *
  596. * End of CSYTF2
  597. *
  598. END