LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
zsytf2_rook.f
Go to the documentation of this file.
1*> \brief \b ZSYTF2_ROOK computes the factorization of a complex symmetric indefinite matrix using the bounded Bunch-Kaufman ("rook") 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 ZSYTF2_ROOK + dependencies
10*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zsytf2_rook.f">
11*> [TGZ]</a>
12*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zsytf2_rook.f">
13*> [ZIP]</a>
14*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zsytf2_rook.f">
15*> [TXT]</a>
16*> \endhtmlonly
17*
18* Definition:
19* ===========
20*
21* SUBROUTINE ZSYTF2_ROOK( 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*16 A( LDA, * )
30* ..
31*
32*
33*> \par Purpose:
34* =============
35*>
36*> \verbatim
37*>
38*> ZSYTF2_ROOK computes the factorization of a complex symmetric matrix A
39*> using the bounded Bunch-Kaufman ("rook") 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*16 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)
96*> were interchanged and D(k,k) is a 1-by-1 diagonal block.
97*>
98*> If IPIV(k) < 0 and IPIV(k-1) < 0, then rows and
99*> columns k and -IPIV(k) were interchanged and rows and
100*> columns k-1 and -IPIV(k-1) were inerchaged,
101*> D(k-1:k,k-1:k) is a 2-by-2 diagonal block.
102*>
103*> If UPLO = 'L':
104*> If IPIV(k) > 0, then rows and columns k and IPIV(k)
105*> were interchanged and D(k,k) is a 1-by-1 diagonal block.
106*>
107*> If IPIV(k) < 0 and IPIV(k+1) < 0, then rows and
108*> columns k and -IPIV(k) were interchanged and rows and
109*> columns k+1 and -IPIV(k+1) were inerchaged,
110*> D(k:k+1,k:k+1) is a 2-by-2 diagonal block.
111*> \endverbatim
112*>
113*> \param[out] INFO
114*> \verbatim
115*> INFO is INTEGER
116*> = 0: successful exit
117*> < 0: if INFO = -k, the k-th argument had an illegal value
118*> > 0: if INFO = k, D(k,k) is exactly zero. The factorization
119*> has been completed, but the block diagonal matrix D is
120*> exactly singular, and division by zero will occur if it
121*> is used to solve a system of equations.
122*> \endverbatim
123*
124* Authors:
125* ========
126*
127*> \author Univ. of Tennessee
128*> \author Univ. of California Berkeley
129*> \author Univ. of Colorado Denver
130*> \author NAG Ltd.
131*
132*> \ingroup hetf2_rook
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*> November 2013, Igor Kozachenko,
180*> Computer Science Division,
181*> University of California, Berkeley
182*>
183*> September 2007, Sven Hammarling, Nicholas J. Higham, Craig Lucas,
184*> School of Mathematics,
185*> University of Manchester
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 abd , USA
190*> \endverbatim
191*
192* =====================================================================
193 SUBROUTINE zsytf2_rook( UPLO, N, A, LDA, IPIV, INFO )
194*
195* -- LAPACK computational routine --
196* -- LAPACK is a software package provided by Univ. of Tennessee, --
197* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
198*
199* .. Scalar Arguments ..
200 CHARACTER UPLO
201 INTEGER INFO, LDA, N
202* ..
203* .. Array Arguments ..
204 INTEGER IPIV( * )
205 COMPLEX*16 A( LDA, * )
206* ..
207*
208* =====================================================================
209*
210* .. Parameters ..
211 DOUBLE PRECISION ZERO, ONE
212 parameter( zero = 0.0d+0, one = 1.0d+0 )
213 DOUBLE PRECISION EIGHT, SEVTEN
214 parameter( eight = 8.0d+0, sevten = 17.0d+0 )
215 COMPLEX*16 CONE
216 parameter( cone = ( 1.0d+0, 0.0d+0 ) )
217* ..
218* .. Local Scalars ..
219 LOGICAL UPPER, DONE
220 INTEGER I, IMAX, J, JMAX, ITEMP, K, KK, KP, KSTEP,
221 $ P, II
222 DOUBLE PRECISION ABSAKK, ALPHA, COLMAX, ROWMAX, DTEMP, SFMIN
223 COMPLEX*16 D11, D12, D21, D22, T, WK, WKM1, WKP1, Z
224* ..
225* .. External Functions ..
226 LOGICAL LSAME
227 INTEGER IZAMAX
228 DOUBLE PRECISION DLAMCH
229 EXTERNAL lsame, izamax, dlamch
230* ..
231* .. External Subroutines ..
232 EXTERNAL zscal, zswap, zsyr, xerbla
233* ..
234* .. Intrinsic Functions ..
235 INTRINSIC abs, max, sqrt, dimag, dble
236* ..
237* .. Statement Functions ..
238 DOUBLE PRECISION CABS1
239* ..
240* .. Statement Function definitions ..
241 cabs1( z ) = abs( dble( z ) ) + abs( dimag( z ) )
242* ..
243* .. Executable Statements ..
244*
245* Test the input parameters.
246*
247 info = 0
248 upper = lsame( uplo, 'U' )
249 IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
250 info = -1
251 ELSE IF( n.LT.0 ) THEN
252 info = -2
253 ELSE IF( lda.LT.max( 1, n ) ) THEN
254 info = -4
255 END IF
256 IF( info.NE.0 ) THEN
257 CALL xerbla( 'ZSYTF2_ROOK', -info )
258 RETURN
259 END IF
260*
261* Initialize ALPHA for use in choosing pivot block size.
262*
263 alpha = ( one+sqrt( sevten ) ) / eight
264*
265* Compute machine safe minimum
266*
267 sfmin = dlamch( 'S' )
268*
269 IF( upper ) THEN
270*
271* Factorize A as U*D*U**T using the upper triangle of A
272*
273* K is the main loop index, decreasing from N to 1 in steps of
274* 1 or 2
275*
276 k = n
277 10 CONTINUE
278*
279* If K < 1, exit from loop
280*
281 IF( k.LT.1 )
282 $ GO TO 70
283 kstep = 1
284 p = k
285*
286* Determine rows and columns to be interchanged and whether
287* a 1-by-1 or 2-by-2 pivot block will be used
288*
289 absakk = cabs1( a( k, k ) )
290*
291* IMAX is the row-index of the largest off-diagonal element in
292* column K, and COLMAX is its absolute value.
293* Determine both COLMAX and IMAX.
294*
295 IF( k.GT.1 ) THEN
296 imax = izamax( k-1, a( 1, k ), 1 )
297 colmax = cabs1( a( imax, k ) )
298 ELSE
299 colmax = zero
300 END IF
301*
302 IF( (max( absakk, colmax ).EQ.zero) ) THEN
303*
304* Column K is zero or underflow: set INFO and continue
305*
306 IF( info.EQ.0 )
307 $ info = k
308 kp = k
309 ELSE
310*
311* Test for interchange
312*
313* Equivalent to testing for (used to handle NaN and Inf)
314* ABSAKK.GE.ALPHA*COLMAX
315*
316 IF( .NOT.( absakk.LT.alpha*colmax ) ) THEN
317*
318* no interchange,
319* use 1-by-1 pivot block
320*
321 kp = k
322 ELSE
323*
324 done = .false.
325*
326* Loop until pivot found
327*
328 12 CONTINUE
329*
330* Begin pivot search loop body
331*
332* JMAX is the column-index of the largest off-diagonal
333* element in row IMAX, and ROWMAX is its absolute value.
334* Determine both ROWMAX and JMAX.
335*
336 IF( imax.NE.k ) THEN
337 jmax = imax + izamax( k-imax, a( imax, imax+1 ),
338 $ lda )
339 rowmax = cabs1( a( imax, jmax ) )
340 ELSE
341 rowmax = zero
342 END IF
343*
344 IF( imax.GT.1 ) THEN
345 itemp = izamax( imax-1, a( 1, imax ), 1 )
346 dtemp = cabs1( a( itemp, imax ) )
347 IF( dtemp.GT.rowmax ) THEN
348 rowmax = dtemp
349 jmax = itemp
350 END IF
351 END IF
352*
353* Equivalent to testing for (used to handle NaN and Inf)
354* CABS1( A( IMAX, IMAX ) ).GE.ALPHA*ROWMAX
355*
356 IF( .NOT.( cabs1(a( imax, imax )).LT.alpha*rowmax ) )
357 $ THEN
358*
359* interchange rows and columns K and IMAX,
360* use 1-by-1 pivot block
361*
362 kp = imax
363 done = .true.
364*
365* Equivalent to testing for ROWMAX .EQ. COLMAX,
366* used to handle NaN and Inf
367*
368 ELSE IF( ( p.EQ.jmax ).OR.( rowmax.LE.colmax ) ) THEN
369*
370* interchange rows and columns K+1 and IMAX,
371* use 2-by-2 pivot block
372*
373 kp = imax
374 kstep = 2
375 done = .true.
376 ELSE
377*
378* Pivot NOT found, set variables and repeat
379*
380 p = imax
381 colmax = rowmax
382 imax = jmax
383 END IF
384*
385* End pivot search loop body
386*
387 IF( .NOT. done ) GOTO 12
388*
389 END IF
390*
391* Swap TWO rows and TWO columns
392*
393* First swap
394*
395 IF( ( kstep.EQ.2 ) .AND. ( p.NE.k ) ) THEN
396*
397* Interchange rows and column K and P in the leading
398* submatrix A(1:k,1:k) if we have a 2-by-2 pivot
399*
400 IF( p.GT.1 )
401 $ CALL zswap( p-1, a( 1, k ), 1, a( 1, p ), 1 )
402 IF( p.LT.(k-1) )
403 $ CALL zswap( k-p-1, a( p+1, k ), 1, a( p, p+1 ),
404 $ lda )
405 t = a( k, k )
406 a( k, k ) = a( p, p )
407 a( p, p ) = t
408 END IF
409*
410* Second swap
411*
412 kk = k - kstep + 1
413 IF( kp.NE.kk ) THEN
414*
415* Interchange rows and columns KK and KP in the leading
416* submatrix A(1:k,1:k)
417*
418 IF( kp.GT.1 )
419 $ CALL zswap( kp-1, a( 1, kk ), 1, a( 1, kp ), 1 )
420 IF( ( kk.GT.1 ) .AND. ( kp.LT.(kk-1) ) )
421 $ CALL zswap( kk-kp-1, a( kp+1, kk ), 1, a( kp, kp+1 ),
422 $ lda )
423 t = a( kk, kk )
424 a( kk, kk ) = a( kp, kp )
425 a( kp, kp ) = t
426 IF( kstep.EQ.2 ) THEN
427 t = a( k-1, k )
428 a( k-1, k ) = a( kp, k )
429 a( kp, k ) = t
430 END IF
431 END IF
432*
433* Update the leading submatrix
434*
435 IF( kstep.EQ.1 ) THEN
436*
437* 1-by-1 pivot block D(k): column k now holds
438*
439* W(k) = U(k)*D(k)
440*
441* where U(k) is the k-th column of U
442*
443 IF( k.GT.1 ) THEN
444*
445* Perform a rank-1 update of A(1:k-1,1:k-1) and
446* store U(k) in column k
447*
448 IF( cabs1( a( k, k ) ).GE.sfmin ) THEN
449*
450* Perform a rank-1 update of A(1:k-1,1:k-1) as
451* A := A - U(k)*D(k)*U(k)**T
452* = A - W(k)*1/D(k)*W(k)**T
453*
454 d11 = cone / a( k, k )
455 CALL zsyr( uplo, k-1, -d11, a( 1, k ), 1, a, lda )
456*
457* Store U(k) in column k
458*
459 CALL zscal( k-1, d11, a( 1, k ), 1 )
460 ELSE
461*
462* Store L(k) in column K
463*
464 d11 = a( k, k )
465 DO 16 ii = 1, k - 1
466 a( ii, k ) = a( ii, k ) / d11
467 16 CONTINUE
468*
469* Perform a rank-1 update of A(k+1:n,k+1:n) as
470* A := A - U(k)*D(k)*U(k)**T
471* = A - W(k)*(1/D(k))*W(k)**T
472* = A - (W(k)/D(k))*(D(k))*(W(k)/D(K))**T
473*
474 CALL zsyr( uplo, k-1, -d11, a( 1, k ), 1, a, lda )
475 END IF
476 END IF
477*
478 ELSE
479*
480* 2-by-2 pivot block D(k): columns k and k-1 now hold
481*
482* ( W(k-1) W(k) ) = ( U(k-1) U(k) )*D(k)
483*
484* where U(k) and U(k-1) are the k-th and (k-1)-th columns
485* of U
486*
487* Perform a rank-2 update of A(1:k-2,1:k-2) as
488*
489* A := A - ( U(k-1) U(k) )*D(k)*( U(k-1) U(k) )**T
490* = A - ( ( A(k-1)A(k) )*inv(D(k)) ) * ( A(k-1)A(k) )**T
491*
492* and store L(k) and L(k+1) in columns k and k+1
493*
494 IF( k.GT.2 ) THEN
495*
496 d12 = a( k-1, k )
497 d22 = a( k-1, k-1 ) / d12
498 d11 = a( k, k ) / d12
499 t = cone / ( d11*d22-cone )
500*
501 DO 30 j = k - 2, 1, -1
502*
503 wkm1 = t*( d11*a( j, k-1 )-a( j, k ) )
504 wk = t*( d22*a( j, k )-a( j, k-1 ) )
505*
506 DO 20 i = j, 1, -1
507 a( i, j ) = a( i, j ) - (a( i, k ) / d12 )*wk -
508 $ ( a( i, k-1 ) / d12 )*wkm1
509 20 CONTINUE
510*
511* Store U(k) and U(k-1) in cols k and k-1 for row J
512*
513 a( j, k ) = wk / d12
514 a( j, k-1 ) = wkm1 / d12
515*
516 30 CONTINUE
517*
518 END IF
519*
520 END IF
521 END IF
522*
523* Store details of the interchanges in IPIV
524*
525 IF( kstep.EQ.1 ) THEN
526 ipiv( k ) = kp
527 ELSE
528 ipiv( k ) = -p
529 ipiv( k-1 ) = -kp
530 END IF
531*
532* Decrease K and return to the start of the main loop
533*
534 k = k - kstep
535 GO TO 10
536*
537 ELSE
538*
539* Factorize A as L*D*L**T using the lower triangle of A
540*
541* K is the main loop index, increasing from 1 to N in steps of
542* 1 or 2
543*
544 k = 1
545 40 CONTINUE
546*
547* If K > N, exit from loop
548*
549 IF( k.GT.n )
550 $ GO TO 70
551 kstep = 1
552 p = k
553*
554* Determine rows and columns to be interchanged and whether
555* a 1-by-1 or 2-by-2 pivot block will be used
556*
557 absakk = cabs1( a( k, k ) )
558*
559* IMAX is the row-index of the largest off-diagonal element in
560* column K, and COLMAX is its absolute value.
561* Determine both COLMAX and IMAX.
562*
563 IF( k.LT.n ) THEN
564 imax = k + izamax( n-k, a( k+1, k ), 1 )
565 colmax = cabs1( a( imax, k ) )
566 ELSE
567 colmax = zero
568 END IF
569*
570 IF( ( max( absakk, colmax ).EQ.zero ) ) THEN
571*
572* Column K is zero or underflow: set INFO and continue
573*
574 IF( info.EQ.0 )
575 $ info = k
576 kp = k
577 ELSE
578*
579* Test for interchange
580*
581* Equivalent to testing for (used to handle NaN and Inf)
582* ABSAKK.GE.ALPHA*COLMAX
583*
584 IF( .NOT.( absakk.LT.alpha*colmax ) ) THEN
585*
586* no interchange, use 1-by-1 pivot block
587*
588 kp = k
589 ELSE
590*
591 done = .false.
592*
593* Loop until pivot found
594*
595 42 CONTINUE
596*
597* Begin pivot search loop body
598*
599* JMAX is the column-index of the largest off-diagonal
600* element in row IMAX, and ROWMAX is its absolute value.
601* Determine both ROWMAX and JMAX.
602*
603 IF( imax.NE.k ) THEN
604 jmax = k - 1 + izamax( imax-k, a( imax, k ), lda )
605 rowmax = cabs1( a( imax, jmax ) )
606 ELSE
607 rowmax = zero
608 END IF
609*
610 IF( imax.LT.n ) THEN
611 itemp = imax + izamax( n-imax, a( imax+1, imax ),
612 $ 1 )
613 dtemp = cabs1( a( itemp, imax ) )
614 IF( dtemp.GT.rowmax ) THEN
615 rowmax = dtemp
616 jmax = itemp
617 END IF
618 END IF
619*
620* Equivalent to testing for (used to handle NaN and Inf)
621* CABS1( A( IMAX, IMAX ) ).GE.ALPHA*ROWMAX
622*
623 IF( .NOT.( cabs1(a( imax, imax )).LT.alpha*rowmax ) )
624 $ THEN
625*
626* interchange rows and columns K and IMAX,
627* use 1-by-1 pivot block
628*
629 kp = imax
630 done = .true.
631*
632* Equivalent to testing for ROWMAX .EQ. COLMAX,
633* used to handle NaN and Inf
634*
635 ELSE IF( ( p.EQ.jmax ).OR.( rowmax.LE.colmax ) ) THEN
636*
637* interchange rows and columns K+1 and IMAX,
638* use 2-by-2 pivot block
639*
640 kp = imax
641 kstep = 2
642 done = .true.
643 ELSE
644*
645* Pivot NOT found, set variables and repeat
646*
647 p = imax
648 colmax = rowmax
649 imax = jmax
650 END IF
651*
652* End pivot search loop body
653*
654 IF( .NOT. done ) GOTO 42
655*
656 END IF
657*
658* Swap TWO rows and TWO columns
659*
660* First swap
661*
662 IF( ( kstep.EQ.2 ) .AND. ( p.NE.k ) ) THEN
663*
664* Interchange rows and column K and P in the trailing
665* submatrix A(k:n,k:n) if we have a 2-by-2 pivot
666*
667 IF( p.LT.n )
668 $ CALL zswap( n-p, a( p+1, k ), 1, a( p+1, p ), 1 )
669 IF( p.GT.(k+1) )
670 $ CALL zswap( p-k-1, a( k+1, k ), 1, a( p, k+1 ), lda )
671 t = a( k, k )
672 a( k, k ) = a( p, p )
673 a( p, p ) = t
674 END IF
675*
676* Second swap
677*
678 kk = k + kstep - 1
679 IF( kp.NE.kk ) THEN
680*
681* Interchange rows and columns KK and KP in the trailing
682* submatrix A(k:n,k:n)
683*
684 IF( kp.LT.n )
685 $ CALL zswap( n-kp, a( kp+1, kk ), 1, a( kp+1, kp ), 1 )
686 IF( ( kk.LT.n ) .AND. ( kp.GT.(kk+1) ) )
687 $ CALL zswap( kp-kk-1, a( kk+1, kk ), 1, a( kp, kk+1 ),
688 $ lda )
689 t = a( kk, kk )
690 a( kk, kk ) = a( kp, kp )
691 a( kp, kp ) = t
692 IF( kstep.EQ.2 ) THEN
693 t = a( k+1, k )
694 a( k+1, k ) = a( kp, k )
695 a( kp, k ) = t
696 END IF
697 END IF
698*
699* Update the trailing submatrix
700*
701 IF( kstep.EQ.1 ) THEN
702*
703* 1-by-1 pivot block D(k): column k now holds
704*
705* W(k) = L(k)*D(k)
706*
707* where L(k) is the k-th column of L
708*
709 IF( k.LT.n ) THEN
710*
711* Perform a rank-1 update of A(k+1:n,k+1:n) and
712* store L(k) in column k
713*
714 IF( cabs1( a( k, k ) ).GE.sfmin ) THEN
715*
716* Perform a rank-1 update of A(k+1:n,k+1:n) as
717* A := A - L(k)*D(k)*L(k)**T
718* = A - W(k)*(1/D(k))*W(k)**T
719*
720 d11 = cone / a( k, k )
721 CALL zsyr( uplo, n-k, -d11, a( k+1, k ), 1,
722 $ a( k+1, k+1 ), lda )
723*
724* Store L(k) in column k
725*
726 CALL zscal( n-k, d11, a( k+1, k ), 1 )
727 ELSE
728*
729* Store L(k) in column k
730*
731 d11 = a( k, k )
732 DO 46 ii = k + 1, n
733 a( ii, k ) = a( ii, k ) / d11
734 46 CONTINUE
735*
736* Perform a rank-1 update of A(k+1:n,k+1:n) as
737* A := A - L(k)*D(k)*L(k)**T
738* = A - W(k)*(1/D(k))*W(k)**T
739* = A - (W(k)/D(k))*(D(k))*(W(k)/D(K))**T
740*
741 CALL zsyr( uplo, n-k, -d11, a( k+1, k ), 1,
742 $ a( k+1, k+1 ), lda )
743 END IF
744 END IF
745*
746 ELSE
747*
748* 2-by-2 pivot block D(k): columns k and k+1 now hold
749*
750* ( W(k) W(k+1) ) = ( L(k) L(k+1) )*D(k)
751*
752* where L(k) and L(k+1) are the k-th and (k+1)-th columns
753* of L
754*
755*
756* Perform a rank-2 update of A(k+2:n,k+2:n) as
757*
758* A := A - ( L(k) L(k+1) ) * D(k) * ( L(k) L(k+1) )**T
759* = A - ( ( A(k)A(k+1) )*inv(D(k) ) * ( A(k)A(k+1) )**T
760*
761* and store L(k) and L(k+1) in columns k and k+1
762*
763 IF( k.LT.n-1 ) THEN
764*
765 d21 = a( k+1, k )
766 d11 = a( k+1, k+1 ) / d21
767 d22 = a( k, k ) / d21
768 t = cone / ( d11*d22-cone )
769*
770 DO 60 j = k + 2, n
771*
772* Compute D21 * ( W(k)W(k+1) ) * inv(D(k)) for row J
773*
774 wk = t*( d11*a( j, k )-a( j, k+1 ) )
775 wkp1 = t*( d22*a( j, k+1 )-a( j, k ) )
776*
777* Perform a rank-2 update of A(k+2:n,k+2:n)
778*
779 DO 50 i = j, n
780 a( i, j ) = a( i, j ) - ( a( i, k ) / d21 )*wk -
781 $ ( a( i, k+1 ) / d21 )*wkp1
782 50 CONTINUE
783*
784* Store L(k) and L(k+1) in cols k and k+1 for row J
785*
786 a( j, k ) = wk / d21
787 a( j, k+1 ) = wkp1 / d21
788*
789 60 CONTINUE
790*
791 END IF
792*
793 END IF
794 END IF
795*
796* Store details of the interchanges in IPIV
797*
798 IF( kstep.EQ.1 ) THEN
799 ipiv( k ) = kp
800 ELSE
801 ipiv( k ) = -p
802 ipiv( k+1 ) = -kp
803 END IF
804*
805* Increase K and return to the start of the main loop
806*
807 k = k + kstep
808 GO TO 40
809*
810 END IF
811*
812 70 CONTINUE
813*
814 RETURN
815*
816* End of ZSYTF2_ROOK
817*
818 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine zsyr(uplo, n, alpha, x, incx, a, lda)
ZSYR performs the symmetric rank-1 update of a complex symmetric matrix.
Definition zsyr.f:135
subroutine zsytf2_rook(uplo, n, a, lda, ipiv, info)
ZSYTF2_ROOK computes the factorization of a complex symmetric indefinite matrix using the bounded Bun...
subroutine zscal(n, za, zx, incx)
ZSCAL
Definition zscal.f:78
subroutine zswap(n, zx, incx, zy, incy)
ZSWAP
Definition zswap.f:81