LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
zlasyf.f
Go to the documentation of this file.
1*> \brief \b ZLASYF computes a partial factorization of a complex symmetric matrix using the Bunch-Kaufman diagonal pivoting method.
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download ZLASYF + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zlasyf.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zlasyf.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zlasyf.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE ZLASYF( UPLO, N, NB, KB, A, LDA, IPIV, W, LDW, INFO )
20*
21* .. Scalar Arguments ..
22* CHARACTER UPLO
23* INTEGER INFO, KB, LDA, LDW, N, NB
24* ..
25* .. Array Arguments ..
26* INTEGER IPIV( * )
27* COMPLEX*16 A( LDA, * ), W( LDW, * )
28* ..
29*
30*
31*> \par Purpose:
32* =============
33*>
34*> \verbatim
35*>
36*> ZLASYF computes a partial factorization of a complex symmetric matrix
37*> A using the Bunch-Kaufman diagonal pivoting method. The partial
38*> factorization has the form:
39*>
40*> A = ( I U12 ) ( A11 0 ) ( I 0 ) if UPLO = 'U', or:
41*> ( 0 U22 ) ( 0 D ) ( U12**T U22**T )
42*>
43*> A = ( L11 0 ) ( D 0 ) ( L11**T L21**T ) if UPLO = 'L'
44*> ( L21 I ) ( 0 A22 ) ( 0 I )
45*>
46*> where the order of D is at most NB. The actual order is returned in
47*> the argument KB, and is either NB or NB-1, or N if N <= NB.
48*> Note that U**T denotes the transpose of U.
49*>
50*> ZLASYF is an auxiliary routine called by ZSYTRF. It uses blocked code
51*> (calling Level 3 BLAS) to update the submatrix A11 (if UPLO = 'U') or
52*> A22 (if UPLO = 'L').
53*> \endverbatim
54*
55* Arguments:
56* ==========
57*
58*> \param[in] UPLO
59*> \verbatim
60*> UPLO is CHARACTER*1
61*> Specifies whether the upper or lower triangular part of the
62*> symmetric matrix A is stored:
63*> = 'U': Upper triangular
64*> = 'L': Lower triangular
65*> \endverbatim
66*>
67*> \param[in] N
68*> \verbatim
69*> N is INTEGER
70*> The order of the matrix A. N >= 0.
71*> \endverbatim
72*>
73*> \param[in] NB
74*> \verbatim
75*> NB is INTEGER
76*> The maximum number of columns of the matrix A that should be
77*> factored. NB should be at least 2 to allow for 2-by-2 pivot
78*> blocks.
79*> \endverbatim
80*>
81*> \param[out] KB
82*> \verbatim
83*> KB is INTEGER
84*> The number of columns of A that were actually factored.
85*> KB is either NB-1 or NB, or N if N <= NB.
86*> \endverbatim
87*>
88*> \param[in,out] A
89*> \verbatim
90*> A is COMPLEX*16 array, dimension (LDA,N)
91*> On entry, the symmetric matrix A. If UPLO = 'U', the leading
92*> n-by-n upper triangular part of A contains the upper
93*> triangular part of the matrix A, and the strictly lower
94*> triangular part of A is not referenced. If UPLO = 'L', the
95*> leading n-by-n lower triangular part of A contains the lower
96*> triangular part of the matrix A, and the strictly upper
97*> triangular part of A is not referenced.
98*> On exit, A contains details of the partial factorization.
99*> \endverbatim
100*>
101*> \param[in] LDA
102*> \verbatim
103*> LDA is INTEGER
104*> The leading dimension of the array A. LDA >= max(1,N).
105*> \endverbatim
106*>
107*> \param[out] IPIV
108*> \verbatim
109*> IPIV is INTEGER array, dimension (N)
110*> Details of the interchanges and the block structure of D.
111*>
112*> If UPLO = 'U':
113*> Only the last KB elements of IPIV are set.
114*>
115*> If IPIV(k) > 0, then rows and columns k and IPIV(k) were
116*> interchanged and D(k,k) is a 1-by-1 diagonal block.
117*>
118*> If IPIV(k) = IPIV(k-1) < 0, then rows and columns
119*> k-1 and -IPIV(k) were interchanged and D(k-1:k,k-1:k)
120*> is a 2-by-2 diagonal block.
121*>
122*> If UPLO = 'L':
123*> Only the first KB elements of IPIV are set.
124*>
125*> If IPIV(k) > 0, then rows and columns k and IPIV(k) were
126*> interchanged and D(k,k) is a 1-by-1 diagonal block.
127*>
128*> If IPIV(k) = IPIV(k+1) < 0, then rows and columns
129*> k+1 and -IPIV(k) were interchanged and D(k:k+1,k:k+1)
130*> is a 2-by-2 diagonal block.
131*> \endverbatim
132*>
133*> \param[out] W
134*> \verbatim
135*> W is COMPLEX*16 array, dimension (LDW,NB)
136*> \endverbatim
137*>
138*> \param[in] LDW
139*> \verbatim
140*> LDW is INTEGER
141*> The leading dimension of the array W. LDW >= max(1,N).
142*> \endverbatim
143*>
144*> \param[out] INFO
145*> \verbatim
146*> INFO is INTEGER
147*> = 0: successful exit
148*> > 0: if INFO = k, D(k,k) is exactly zero. The factorization
149*> has been completed, but the block diagonal matrix D is
150*> exactly singular.
151*> \endverbatim
152*
153* Authors:
154* ========
155*
156*> \author Univ. of Tennessee
157*> \author Univ. of California Berkeley
158*> \author Univ. of Colorado Denver
159*> \author NAG Ltd.
160*
161*> \ingroup lahef
162*
163*> \par Contributors:
164* ==================
165*>
166*> \verbatim
167*>
168*> November 2013, Igor Kozachenko,
169*> Computer Science Division,
170*> University of California, Berkeley
171*> \endverbatim
172*
173* =====================================================================
174 SUBROUTINE zlasyf( UPLO, N, NB, KB, A, LDA, IPIV, W, LDW,
175 $ INFO )
176*
177* -- LAPACK computational routine --
178* -- LAPACK is a software package provided by Univ. of Tennessee, --
179* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
180*
181* .. Scalar Arguments ..
182 CHARACTER UPLO
183 INTEGER INFO, KB, LDA, LDW, N, NB
184* ..
185* .. Array Arguments ..
186 INTEGER IPIV( * )
187 COMPLEX*16 A( LDA, * ), W( LDW, * )
188* ..
189*
190* =====================================================================
191*
192* .. Parameters ..
193 DOUBLE PRECISION ZERO, ONE
194 parameter( zero = 0.0d+0, one = 1.0d+0 )
195 DOUBLE PRECISION EIGHT, SEVTEN
196 parameter( eight = 8.0d+0, sevten = 17.0d+0 )
197 COMPLEX*16 CONE
198 parameter( cone = ( 1.0d+0, 0.0d+0 ) )
199* ..
200* .. Local Scalars ..
201 INTEGER IMAX, J, JJ, JMAX, JP, K, KK, KKW, KP,
202 $ kstep, kw
203 DOUBLE PRECISION ABSAKK, ALPHA, COLMAX, ROWMAX
204 COMPLEX*16 D11, D21, D22, R1, T, Z
205* ..
206* .. External Functions ..
207 LOGICAL LSAME
208 INTEGER IZAMAX
209 EXTERNAL lsame, izamax
210* ..
211* .. External Subroutines ..
212 EXTERNAL zcopy, zgemmtr, zgemv, zscal, zswap
213* ..
214* .. Intrinsic Functions ..
215 INTRINSIC abs, dble, dimag, max, min, sqrt
216* ..
217* .. Statement Functions ..
218 DOUBLE PRECISION CABS1
219* ..
220* .. Statement Function definitions ..
221 cabs1( z ) = abs( dble( z ) ) + abs( dimag( z ) )
222* ..
223* .. Executable Statements ..
224*
225 info = 0
226*
227* Initialize ALPHA for use in choosing pivot block size.
228*
229 alpha = ( one+sqrt( sevten ) ) / eight
230*
231 IF( lsame( uplo, 'U' ) ) THEN
232*
233* Factorize the trailing columns of A using the upper triangle
234* of A and working backwards, and compute the matrix W = U12*D
235* for use in updating A11
236*
237* K is the main loop index, decreasing from N in steps of 1 or 2
238*
239* KW is the column of W which corresponds to column K of A
240*
241 k = n
242 10 CONTINUE
243 kw = nb + k - n
244*
245* Exit from loop
246*
247 IF( ( k.LE.n-nb+1 .AND. nb.LT.n ) .OR. k.LT.1 )
248 $ GO TO 30
249*
250* Copy column K of A to column KW of W and update it
251*
252 CALL zcopy( k, a( 1, k ), 1, w( 1, kw ), 1 )
253 IF( k.LT.n )
254 $ CALL zgemv( 'No transpose', k, n-k, -cone, a( 1, k+1 ),
255 $ lda,
256 $ w( k, kw+1 ), ldw, cone, w( 1, kw ), 1 )
257*
258 kstep = 1
259*
260* Determine rows and columns to be interchanged and whether
261* a 1-by-1 or 2-by-2 pivot block will be used
262*
263 absakk = cabs1( w( k, kw ) )
264*
265* IMAX is the row-index of the largest off-diagonal element in
266
267*
268 IF( k.GT.1 ) THEN
269 imax = izamax( k-1, w( 1, kw ), 1 )
270 colmax = cabs1( w( imax, kw ) )
271 ELSE
272 colmax = zero
273 END IF
274*
275 IF( max( absakk, colmax ).EQ.zero ) THEN
276*
277* Column K is zero or underflow: set INFO and continue
278*
279 IF( info.EQ.0 )
280 $ info = k
281 kp = k
282 ELSE
283 IF( absakk.GE.alpha*colmax ) THEN
284*
285* no interchange, use 1-by-1 pivot block
286*
287 kp = k
288 ELSE
289*
290* Copy column IMAX to column KW-1 of W and update it
291*
292 CALL zcopy( imax, a( 1, imax ), 1, w( 1, kw-1 ), 1 )
293 CALL zcopy( k-imax, a( imax, imax+1 ), lda,
294 $ w( imax+1, kw-1 ), 1 )
295 IF( k.LT.n )
296 $ CALL zgemv( 'No transpose', k, n-k, -cone,
297 $ a( 1, k+1 ), lda, w( imax, kw+1 ), ldw,
298 $ cone, w( 1, kw-1 ), 1 )
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 + izamax( k-imax, w( imax+1, kw-1 ), 1 )
304 rowmax = cabs1( w( jmax, kw-1 ) )
305 IF( imax.GT.1 ) THEN
306 jmax = izamax( imax-1, w( 1, kw-1 ), 1 )
307 rowmax = max( rowmax, cabs1( w( jmax, kw-1 ) ) )
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( w( imax, kw-1 ) ).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*
322* copy column KW-1 of W to column KW of W
323*
324 CALL zcopy( k, w( 1, kw-1 ), 1, w( 1, kw ), 1 )
325 ELSE
326*
327* interchange rows and columns K-1 and IMAX, use 2-by-2
328* pivot block
329*
330 kp = imax
331 kstep = 2
332 END IF
333 END IF
334*
335* ============================================================
336*
337* KK is the column of A where pivoting step stopped
338*
339 kk = k - kstep + 1
340*
341* KKW is the column of W which corresponds to column KK of A
342*
343 kkw = nb + kk - n
344*
345* Interchange rows and columns KP and KK.
346* Updated column KP is already stored in column KKW of W.
347*
348 IF( kp.NE.kk ) THEN
349*
350* Copy non-updated column KK to column KP of submatrix A
351* at step K. No need to copy element into column K
352* (or K and K-1 for 2-by-2 pivot) of A, since these columns
353* will be later overwritten.
354*
355 a( kp, kp ) = a( kk, kk )
356 CALL zcopy( kk-1-kp, a( kp+1, kk ), 1, a( kp, kp+1 ),
357 $ lda )
358 IF( kp.GT.1 )
359 $ CALL zcopy( kp-1, a( 1, kk ), 1, a( 1, kp ), 1 )
360*
361* Interchange rows KK and KP in last K+1 to N columns of A
362* (columns K (or K and K-1 for 2-by-2 pivot) of A will be
363* later overwritten). Interchange rows KK and KP
364* in last KKW to NB columns of W.
365*
366 IF( k.LT.n )
367 $ CALL zswap( n-k, a( kk, k+1 ), lda, a( kp, k+1 ),
368 $ lda )
369 CALL zswap( n-kk+1, w( kk, kkw ), ldw, w( kp, kkw ),
370 $ ldw )
371 END IF
372*
373 IF( kstep.EQ.1 ) THEN
374*
375* 1-by-1 pivot block D(k): column kw of W now holds
376*
377* W(kw) = U(k)*D(k),
378*
379* where U(k) is the k-th column of U
380*
381* Store subdiag. elements of column U(k)
382* and 1-by-1 block D(k) in column k of A.
383* NOTE: Diagonal element U(k,k) is a UNIT element
384* and not stored.
385* A(k,k) := D(k,k) = W(k,kw)
386* A(1:k-1,k) := U(1:k-1,k) = W(1:k-1,kw)/D(k,k)
387*
388 CALL zcopy( k, w( 1, kw ), 1, a( 1, k ), 1 )
389 r1 = cone / a( k, k )
390 CALL zscal( k-1, r1, a( 1, k ), 1 )
391*
392 ELSE
393*
394* 2-by-2 pivot block D(k): columns kw and kw-1 of W now hold
395*
396* ( W(kw-1) W(kw) ) = ( U(k-1) U(k) )*D(k)
397*
398* where U(k) and U(k-1) are the k-th and (k-1)-th columns
399* of U
400*
401* Store U(1:k-2,k-1) and U(1:k-2,k) and 2-by-2
402* block D(k-1:k,k-1:k) in columns k-1 and k of A.
403* NOTE: 2-by-2 diagonal block U(k-1:k,k-1:k) is a UNIT
404* block and not stored.
405* A(k-1:k,k-1:k) := D(k-1:k,k-1:k) = W(k-1:k,kw-1:kw)
406* A(1:k-2,k-1:k) := U(1:k-2,k:k-1:k) =
407* = W(1:k-2,kw-1:kw) * ( D(k-1:k,k-1:k)**(-1) )
408*
409 IF( k.GT.2 ) THEN
410*
411* Compose the columns of the inverse of 2-by-2 pivot
412* block D in the following way to reduce the number
413* of FLOPS when we myltiply panel ( W(kw-1) W(kw) ) by
414* this inverse
415*
416* D**(-1) = ( d11 d21 )**(-1) =
417* ( d21 d22 )
418*
419* = 1/(d11*d22-d21**2) * ( ( d22 ) (-d21 ) ) =
420* ( (-d21 ) ( d11 ) )
421*
422* = 1/d21 * 1/((d11/d21)*(d22/d21)-1) *
423*
424* * ( ( d22/d21 ) ( -1 ) ) =
425* ( ( -1 ) ( d11/d21 ) )
426*
427* = 1/d21 * 1/(D22*D11-1) * ( ( D11 ) ( -1 ) ) =
428* ( ( -1 ) ( D22 ) )
429*
430* = 1/d21 * T * ( ( D11 ) ( -1 ) )
431* ( ( -1 ) ( D22 ) )
432*
433* = D21 * ( ( D11 ) ( -1 ) )
434* ( ( -1 ) ( D22 ) )
435*
436 d21 = w( k-1, kw )
437 d11 = w( k, kw ) / d21
438 d22 = w( k-1, kw-1 ) / d21
439 t = cone / ( d11*d22-cone )
440 d21 = t / d21
441*
442* Update elements in columns A(k-1) and A(k) as
443* dot products of rows of ( W(kw-1) W(kw) ) and columns
444* of D**(-1)
445*
446 DO 20 j = 1, k - 2
447 a( j, k-1 ) = d21*( d11*w( j, kw-1 )-w( j, kw ) )
448 a( j, k ) = d21*( d22*w( j, kw )-w( j, kw-1 ) )
449 20 CONTINUE
450 END IF
451*
452* Copy D(k) to A
453*
454 a( k-1, k-1 ) = w( k-1, kw-1 )
455 a( k-1, k ) = w( k-1, kw )
456 a( k, k ) = w( k, kw )
457*
458 END IF
459*
460 END IF
461*
462* Store details of the interchanges in IPIV
463*
464 IF( kstep.EQ.1 ) THEN
465 ipiv( k ) = kp
466 ELSE
467 ipiv( k ) = -kp
468 ipiv( k-1 ) = -kp
469 END IF
470*
471* Decrease K and return to the start of the main loop
472*
473 k = k - kstep
474 GO TO 10
475*
476 30 CONTINUE
477*
478* Update the upper triangle of A11 (= A(1:k,1:k)) as
479*
480* A11 := A11 - U12*D*U12**T = A11 - U12*W**T
481*
482 CALL zgemmtr( 'Upper', 'No transpose', 'Transpose', k, n-k,
483 $ -cone, a( 1, k+1 ), lda, w( 1, kw+1 ), ldw,
484 $ cone, a( 1, 1 ), lda )
485*
486* Put U12 in standard form by partially undoing the interchanges
487* in columns k+1:n looping backwards from k+1 to n
488*
489 j = k + 1
490 60 CONTINUE
491*
492* Undo the interchanges (if any) of rows JJ and JP at each
493* step J
494*
495* (Here, J is a diagonal index)
496 jj = j
497 jp = ipiv( j )
498 IF( jp.LT.0 ) THEN
499 jp = -jp
500* (Here, J is a diagonal index)
501 j = j + 1
502 END IF
503* (NOTE: Here, J is used to determine row length. Length N-J+1
504* of the rows to swap back doesn't include diagonal element)
505 j = j + 1
506 IF( jp.NE.jj .AND. j.LE.n )
507 $ CALL zswap( n-j+1, a( jp, j ), lda, a( jj, j ), lda )
508 IF( j.LT.n )
509 $ GO TO 60
510*
511* Set KB to the number of columns factorized
512*
513 kb = n - k
514*
515 ELSE
516*
517* Factorize the leading columns of A using the lower triangle
518* of A and working forwards, and compute the matrix W = L21*D
519* for use in updating A22
520*
521* K is the main loop index, increasing from 1 in steps of 1 or 2
522*
523 k = 1
524 70 CONTINUE
525*
526* Exit from loop
527*
528 IF( ( k.GE.nb .AND. nb.LT.n ) .OR. k.GT.n )
529 $ GO TO 90
530*
531* Copy column K of A to column K of W and update it
532*
533 CALL zcopy( n-k+1, a( k, k ), 1, w( k, k ), 1 )
534 CALL zgemv( 'No transpose', n-k+1, k-1, -cone, a( k, 1 ),
535 $ lda,
536 $ w( k, 1 ), ldw, cone, w( k, k ), 1 )
537*
538 kstep = 1
539*
540* Determine rows and columns to be interchanged and whether
541* a 1-by-1 or 2-by-2 pivot block will be used
542*
543 absakk = cabs1( w( k, k ) )
544*
545* IMAX is the row-index of the largest off-diagonal element in
546
547*
548 IF( k.LT.n ) THEN
549 imax = k + izamax( n-k, w( k+1, k ), 1 )
550 colmax = cabs1( w( imax, k ) )
551 ELSE
552 colmax = zero
553 END IF
554*
555 IF( max( absakk, colmax ).EQ.zero ) THEN
556*
557* Column K is zero or underflow: set INFO and continue
558*
559 IF( info.EQ.0 )
560 $ info = k
561 kp = k
562 ELSE
563 IF( absakk.GE.alpha*colmax ) THEN
564*
565* no interchange, use 1-by-1 pivot block
566*
567 kp = k
568 ELSE
569*
570* Copy column IMAX to column K+1 of W and update it
571*
572 CALL zcopy( imax-k, a( imax, k ), lda, w( k, k+1 ),
573 $ 1 )
574 CALL zcopy( n-imax+1, a( imax, imax ), 1, w( imax,
575 $ k+1 ),
576 $ 1 )
577 CALL zgemv( 'No transpose', n-k+1, k-1, -cone, a( k,
578 $ 1 ),
579 $ lda, w( imax, 1 ), ldw, cone, w( k, k+1 ),
580 $ 1 )
581*
582* JMAX is the column-index of the largest off-diagonal
583* element in row IMAX, and ROWMAX is its absolute value
584*
585 jmax = k - 1 + izamax( imax-k, w( k, k+1 ), 1 )
586 rowmax = cabs1( w( jmax, k+1 ) )
587 IF( imax.LT.n ) THEN
588 jmax = imax + izamax( n-imax, w( imax+1, k+1 ), 1 )
589 rowmax = max( rowmax, cabs1( w( jmax, k+1 ) ) )
590 END IF
591*
592 IF( absakk.GE.alpha*colmax*( colmax / rowmax ) ) THEN
593*
594* no interchange, use 1-by-1 pivot block
595*
596 kp = k
597 ELSE IF( cabs1( w( imax, k+1 ) ).GE.alpha*rowmax ) THEN
598*
599* interchange rows and columns K and IMAX, use 1-by-1
600* pivot block
601*
602 kp = imax
603*
604* copy column K+1 of W to column K of W
605*
606 CALL zcopy( n-k+1, w( k, k+1 ), 1, w( k, k ), 1 )
607 ELSE
608*
609* interchange rows and columns K+1 and IMAX, use 2-by-2
610* pivot block
611*
612 kp = imax
613 kstep = 2
614 END IF
615 END IF
616*
617* ============================================================
618*
619* KK is the column of A where pivoting step stopped
620*
621 kk = k + kstep - 1
622*
623* Interchange rows and columns KP and KK.
624* Updated column KP is already stored in column KK of W.
625*
626 IF( kp.NE.kk ) THEN
627*
628* Copy non-updated column KK to column KP of submatrix A
629* at step K. No need to copy element into column K
630* (or K and K+1 for 2-by-2 pivot) of A, since these columns
631* will be later overwritten.
632*
633 a( kp, kp ) = a( kk, kk )
634 CALL zcopy( kp-kk-1, a( kk+1, kk ), 1, a( kp, kk+1 ),
635 $ lda )
636 IF( kp.LT.n )
637 $ CALL zcopy( n-kp, a( kp+1, kk ), 1, a( kp+1, kp ),
638 $ 1 )
639*
640* Interchange rows KK and KP in first K-1 columns of A
641* (columns K (or K and K+1 for 2-by-2 pivot) of A will be
642* later overwritten). Interchange rows KK and KP
643* in first KK columns of W.
644*
645 IF( k.GT.1 )
646 $ CALL zswap( k-1, a( kk, 1 ), lda, a( kp, 1 ), lda )
647 CALL zswap( kk, w( kk, 1 ), ldw, w( kp, 1 ), ldw )
648 END IF
649*
650 IF( kstep.EQ.1 ) THEN
651*
652* 1-by-1 pivot block D(k): column k of W now holds
653*
654* W(k) = L(k)*D(k),
655*
656* where L(k) is the k-th column of L
657*
658* Store subdiag. elements of column L(k)
659* and 1-by-1 block D(k) in column k of A.
660* (NOTE: Diagonal element L(k,k) is a UNIT element
661* and not stored)
662* A(k,k) := D(k,k) = W(k,k)
663* A(k+1:N,k) := L(k+1:N,k) = W(k+1:N,k)/D(k,k)
664*
665 CALL zcopy( n-k+1, w( k, k ), 1, a( k, k ), 1 )
666 IF( k.LT.n ) THEN
667 r1 = cone / a( k, k )
668 CALL zscal( n-k, r1, a( k+1, k ), 1 )
669 END IF
670*
671 ELSE
672*
673* 2-by-2 pivot block D(k): columns k and k+1 of W now hold
674*
675* ( W(k) W(k+1) ) = ( L(k) L(k+1) )*D(k)
676*
677* where L(k) and L(k+1) are the k-th and (k+1)-th columns
678* of L
679*
680* Store L(k+2:N,k) and L(k+2:N,k+1) and 2-by-2
681* block D(k:k+1,k:k+1) in columns k and k+1 of A.
682* (NOTE: 2-by-2 diagonal block L(k:k+1,k:k+1) is a UNIT
683* block and not stored)
684* A(k:k+1,k:k+1) := D(k:k+1,k:k+1) = W(k:k+1,k:k+1)
685* A(k+2:N,k:k+1) := L(k+2:N,k:k+1) =
686* = W(k+2:N,k:k+1) * ( D(k:k+1,k:k+1)**(-1) )
687*
688 IF( k.LT.n-1 ) THEN
689*
690* Compose the columns of the inverse of 2-by-2 pivot
691* block D in the following way to reduce the number
692* of FLOPS when we myltiply panel ( W(k) W(k+1) ) by
693* this inverse
694*
695* D**(-1) = ( d11 d21 )**(-1) =
696* ( d21 d22 )
697*
698* = 1/(d11*d22-d21**2) * ( ( d22 ) (-d21 ) ) =
699* ( (-d21 ) ( d11 ) )
700*
701* = 1/d21 * 1/((d11/d21)*(d22/d21)-1) *
702*
703* * ( ( d22/d21 ) ( -1 ) ) =
704* ( ( -1 ) ( d11/d21 ) )
705*
706* = 1/d21 * 1/(D22*D11-1) * ( ( D11 ) ( -1 ) ) =
707* ( ( -1 ) ( D22 ) )
708*
709* = 1/d21 * T * ( ( D11 ) ( -1 ) )
710* ( ( -1 ) ( D22 ) )
711*
712* = D21 * ( ( D11 ) ( -1 ) )
713* ( ( -1 ) ( D22 ) )
714*
715 d21 = w( k+1, k )
716 d11 = w( k+1, k+1 ) / d21
717 d22 = w( k, k ) / d21
718 t = cone / ( d11*d22-cone )
719 d21 = t / d21
720*
721* Update elements in columns A(k) and A(k+1) as
722* dot products of rows of ( W(k) W(k+1) ) and columns
723* of D**(-1)
724*
725 DO 80 j = k + 2, n
726 a( j, k ) = d21*( d11*w( j, k )-w( j, k+1 ) )
727 a( j, k+1 ) = d21*( d22*w( j, k+1 )-w( j, k ) )
728 80 CONTINUE
729 END IF
730*
731* Copy D(k) to A
732*
733 a( k, k ) = w( k, k )
734 a( k+1, k ) = w( k+1, k )
735 a( k+1, k+1 ) = w( k+1, k+1 )
736*
737 END IF
738*
739 END IF
740*
741* Store details of the interchanges in IPIV
742*
743 IF( kstep.EQ.1 ) THEN
744 ipiv( k ) = kp
745 ELSE
746 ipiv( k ) = -kp
747 ipiv( k+1 ) = -kp
748 END IF
749*
750* Increase K and return to the start of the main loop
751*
752 k = k + kstep
753 GO TO 70
754*
755 90 CONTINUE
756*
757* Update the lower triangle of A22 (= A(k:n,k:n)) as
758*
759* A22 := A22 - L21*D*L21**T = A22 - L21*W**T
760*
761 CALL zgemmtr( 'Lower', 'No transpose', 'Transpose', n-k+1,
762 $ k-1, -cone, a( k, 1 ), lda, w( k, 1 ), ldw,
763 $ cone, a( k, k ), lda )
764*
765* Put L21 in standard form by partially undoing the interchanges
766* of rows in columns 1:k-1 looping backwards from k-1 to 1
767*
768 j = k - 1
769 120 CONTINUE
770*
771* Undo the interchanges (if any) of rows JJ and JP at each
772* step J
773*
774* (Here, J is a diagonal index)
775 jj = j
776 jp = ipiv( j )
777 IF( jp.LT.0 ) THEN
778 jp = -jp
779* (Here, J is a diagonal index)
780 j = j - 1
781 END IF
782* (NOTE: Here, J is used to determine row length. Length J
783* of the rows to swap back doesn't include diagonal element)
784 j = j - 1
785 IF( jp.NE.jj .AND. j.GE.1 )
786 $ CALL zswap( j, a( jp, 1 ), lda, a( jj, 1 ), lda )
787 IF( j.GT.1 )
788 $ GO TO 120
789*
790* Set KB to the number of columns factorized
791*
792 kb = k - 1
793*
794 END IF
795 RETURN
796*
797* End of ZLASYF
798*
799 END
subroutine zcopy(n, zx, incx, zy, incy)
ZCOPY
Definition zcopy.f:81
subroutine zgemmtr(uplo, transa, transb, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
ZGEMMTR
Definition zgemmtr.f:191
subroutine zgemv(trans, m, n, alpha, a, lda, x, incx, beta, y, incy)
ZGEMV
Definition zgemv.f:160
subroutine zlasyf(uplo, n, nb, kb, a, lda, ipiv, w, ldw, info)
ZLASYF computes a partial factorization of a complex symmetric matrix using the Bunch-Kaufman diagona...
Definition zlasyf.f:176
subroutine zscal(n, za, zx, incx)
ZSCAL
Definition zscal.f:78
subroutine zswap(n, zx, incx, zy, incy)
ZSWAP
Definition zswap.f:81