1: *> \brief \b ZLAHEF_RK computes a partial factorization of a complex Hermitian indefinite matrix using bounded Bunch-Kaufman (rook) diagonal pivoting method.
2: *
3: * =========== DOCUMENTATION ===========
4: *
5: * Online html documentation available at
6: * http://www.netlib.org/lapack/explore-html/
7: *
8: *> \htmlonly
9: *> Download ZLAHEF_RK + dependencies
10: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zlahef_rk.f">
11: *> [TGZ]</a>
12: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zlahef_rk.f">
13: *> [ZIP]</a>
14: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zlahef_rk.f">
15: *> [TXT]</a>
16: *> \endhtmlonly
17: *
18: * Definition:
19: * ===========
20: *
21: * SUBROUTINE ZLAHEF_RK( UPLO, N, NB, KB, A, LDA, E, IPIV, W, LDW,
22: * INFO )
23: *
24: * .. Scalar Arguments ..
25: * CHARACTER UPLO
26: * INTEGER INFO, KB, LDA, LDW, N, NB
27: * ..
28: * .. Array Arguments ..
29: * INTEGER IPIV( * )
30: * COMPLEX*16 A( LDA, * ), E( * ), W( LDW, * )
31: * ..
32: *
33: *
34: *> \par Purpose:
35: * =============
36: *>
37: *> \verbatim
38: *> ZLAHEF_RK computes a partial factorization of a complex Hermitian
39: *> matrix A using the bounded Bunch-Kaufman (rook) diagonal
40: *> pivoting method. The partial factorization has the form:
41: *>
42: *> A = ( I U12 ) ( A11 0 ) ( I 0 ) if UPLO = 'U', or:
43: *> ( 0 U22 ) ( 0 D ) ( U12**H U22**H )
44: *>
45: *> A = ( L11 0 ) ( D 0 ) ( L11**H L21**H ) if UPLO = 'L',
46: *> ( L21 I ) ( 0 A22 ) ( 0 I )
47: *>
48: *> where the order of D is at most NB. The actual order is returned in
49: *> the argument KB, and is either NB or NB-1, or N if N <= NB.
50: *>
51: *> ZLAHEF_RK is an auxiliary routine called by ZHETRF_RK. It uses
52: *> blocked code (calling Level 3 BLAS) to update the submatrix
53: *> A11 (if UPLO = 'U') or A22 (if UPLO = 'L').
54: *> \endverbatim
55: *
56: * Arguments:
57: * ==========
58: *
59: *> \param[in] UPLO
60: *> \verbatim
61: *> UPLO is CHARACTER*1
62: *> Specifies whether the upper or lower triangular part of the
63: *> Hermitian matrix A is stored:
64: *> = 'U': Upper triangular
65: *> = 'L': Lower triangular
66: *> \endverbatim
67: *>
68: *> \param[in] N
69: *> \verbatim
70: *> N is INTEGER
71: *> The order of the matrix A. N >= 0.
72: *> \endverbatim
73: *>
74: *> \param[in] NB
75: *> \verbatim
76: *> NB is INTEGER
77: *> The maximum number of columns of the matrix A that should be
78: *> factored. NB should be at least 2 to allow for 2-by-2 pivot
79: *> blocks.
80: *> \endverbatim
81: *>
82: *> \param[out] KB
83: *> \verbatim
84: *> KB is INTEGER
85: *> The number of columns of A that were actually factored.
86: *> KB is either NB-1 or NB, or N if N <= NB.
87: *> \endverbatim
88: *>
89: *> \param[in,out] A
90: *> \verbatim
91: *> A is COMPLEX*16 array, dimension (LDA,N)
92: *> On entry, the Hermitian matrix A.
93: *> If UPLO = 'U': the leading N-by-N upper triangular part
94: *> of A contains the upper triangular part of the matrix A,
95: *> and the strictly lower triangular part of A is not
96: *> referenced.
97: *>
98: *> If UPLO = 'L': the leading N-by-N lower triangular part
99: *> of A contains the lower triangular part of the matrix A,
100: *> and the strictly upper triangular part of A is not
101: *> referenced.
102: *>
103: *> On exit, contains:
104: *> a) ONLY diagonal elements of the Hermitian block diagonal
105: *> matrix D on the diagonal of A, i.e. D(k,k) = A(k,k);
106: *> (superdiagonal (or subdiagonal) elements of D
107: *> are stored on exit in array E), and
108: *> b) If UPLO = 'U': factor U in the superdiagonal part of A.
109: *> If UPLO = 'L': factor L in the subdiagonal part of A.
110: *> \endverbatim
111: *>
112: *> \param[in] LDA
113: *> \verbatim
114: *> LDA is INTEGER
115: *> The leading dimension of the array A. LDA >= max(1,N).
116: *> \endverbatim
117: *>
118: *> \param[out] E
119: *> \verbatim
120: *> E is COMPLEX*16 array, dimension (N)
121: *> On exit, contains the superdiagonal (or subdiagonal)
122: *> elements of the Hermitian block diagonal matrix D
123: *> with 1-by-1 or 2-by-2 diagonal blocks, where
124: *> If UPLO = 'U': E(i) = D(i-1,i), i=2:N, E(1) is set to 0;
125: *> If UPLO = 'L': E(i) = D(i+1,i), i=1:N-1, E(N) is set to 0.
126: *>
127: *> NOTE: For 1-by-1 diagonal block D(k), where
128: *> 1 <= k <= N, the element E(k) is set to 0 in both
129: *> UPLO = 'U' or UPLO = 'L' cases.
130: *> \endverbatim
131: *>
132: *> \param[out] IPIV
133: *> \verbatim
134: *> IPIV is INTEGER array, dimension (N)
135: *> IPIV describes the permutation matrix P in the factorization
136: *> of matrix A as follows. The absolute value of IPIV(k)
137: *> represents the index of row and column that were
138: *> interchanged with the k-th row and column. The value of UPLO
139: *> describes the order in which the interchanges were applied.
140: *> Also, the sign of IPIV represents the block structure of
141: *> the Hermitian block diagonal matrix D with 1-by-1 or 2-by-2
142: *> diagonal blocks which correspond to 1 or 2 interchanges
143: *> at each factorization step.
144: *>
145: *> If UPLO = 'U',
146: *> ( in factorization order, k decreases from N to 1 ):
147: *> a) A single positive entry IPIV(k) > 0 means:
148: *> D(k,k) is a 1-by-1 diagonal block.
149: *> If IPIV(k) != k, rows and columns k and IPIV(k) were
150: *> interchanged in the submatrix A(1:N,N-KB+1:N);
151: *> If IPIV(k) = k, no interchange occurred.
152: *>
153: *>
154: *> b) A pair of consecutive negative entries
155: *> IPIV(k) < 0 and IPIV(k-1) < 0 means:
156: *> D(k-1:k,k-1:k) is a 2-by-2 diagonal block.
157: *> (NOTE: negative entries in IPIV appear ONLY in pairs).
158: *> 1) If -IPIV(k) != k, rows and columns
159: *> k and -IPIV(k) were interchanged
160: *> in the matrix A(1:N,N-KB+1:N).
161: *> If -IPIV(k) = k, no interchange occurred.
162: *> 2) If -IPIV(k-1) != k-1, rows and columns
163: *> k-1 and -IPIV(k-1) were interchanged
164: *> in the submatrix A(1:N,N-KB+1:N).
165: *> If -IPIV(k-1) = k-1, no interchange occurred.
166: *>
167: *> c) In both cases a) and b) is always ABS( IPIV(k) ) <= k.
168: *>
169: *> d) NOTE: Any entry IPIV(k) is always NONZERO on output.
170: *>
171: *> If UPLO = 'L',
172: *> ( in factorization order, k increases from 1 to N ):
173: *> a) A single positive entry IPIV(k) > 0 means:
174: *> D(k,k) is a 1-by-1 diagonal block.
175: *> If IPIV(k) != k, rows and columns k and IPIV(k) were
176: *> interchanged in the submatrix A(1:N,1:KB).
177: *> If IPIV(k) = k, no interchange occurred.
178: *>
179: *> b) A pair of consecutive negative entries
180: *> IPIV(k) < 0 and IPIV(k+1) < 0 means:
181: *> D(k:k+1,k:k+1) is a 2-by-2 diagonal block.
182: *> (NOTE: negative entries in IPIV appear ONLY in pairs).
183: *> 1) If -IPIV(k) != k, rows and columns
184: *> k and -IPIV(k) were interchanged
185: *> in the submatrix A(1:N,1:KB).
186: *> If -IPIV(k) = k, no interchange occurred.
187: *> 2) If -IPIV(k+1) != k+1, rows and columns
188: *> k-1 and -IPIV(k-1) were interchanged
189: *> in the submatrix A(1:N,1:KB).
190: *> If -IPIV(k+1) = k+1, no interchange occurred.
191: *>
192: *> c) In both cases a) and b) is always ABS( IPIV(k) ) >= k.
193: *>
194: *> d) NOTE: Any entry IPIV(k) is always NONZERO on output.
195: *> \endverbatim
196: *>
197: *> \param[out] W
198: *> \verbatim
199: *> W is COMPLEX*16 array, dimension (LDW,NB)
200: *> \endverbatim
201: *>
202: *> \param[in] LDW
203: *> \verbatim
204: *> LDW is INTEGER
205: *> The leading dimension of the array W. LDW >= max(1,N).
206: *> \endverbatim
207: *>
208: *> \param[out] INFO
209: *> \verbatim
210: *> INFO is INTEGER
211: *> = 0: successful exit
212: *>
213: *> < 0: If INFO = -k, the k-th argument had an illegal value
214: *>
215: *> > 0: If INFO = k, the matrix A is singular, because:
216: *> If UPLO = 'U': column k in the upper
217: *> triangular part of A contains all zeros.
218: *> If UPLO = 'L': column k in the lower
219: *> triangular part of A contains all zeros.
220: *>
221: *> Therefore D(k,k) is exactly zero, and superdiagonal
222: *> elements of column k of U (or subdiagonal elements of
223: *> column k of L ) are all zeros. The factorization has
224: *> been completed, but the block diagonal matrix D is
225: *> exactly singular, and division by zero will occur if
226: *> it is used to solve a system of equations.
227: *>
228: *> NOTE: INFO only stores the first occurrence of
229: *> a singularity, any subsequent occurrence of singularity
230: *> is not stored in INFO even though the factorization
231: *> always completes.
232: *> \endverbatim
233: *
234: * Authors:
235: * ========
236: *
237: *> \author Univ. of Tennessee
238: *> \author Univ. of California Berkeley
239: *> \author Univ. of Colorado Denver
240: *> \author NAG Ltd.
241: *
242: *> \date December 2016
243: *
244: *> \ingroup complex16HEcomputational
245: *
246: *> \par Contributors:
247: * ==================
248: *>
249: *> \verbatim
250: *>
251: *> December 2016, Igor Kozachenko,
252: *> Computer Science Division,
253: *> University of California, Berkeley
254: *>
255: *> September 2007, Sven Hammarling, Nicholas J. Higham, Craig Lucas,
256: *> School of Mathematics,
257: *> University of Manchester
258: *>
259: *> \endverbatim
260: *
261: * =====================================================================
262: SUBROUTINE ZLAHEF_RK( UPLO, N, NB, KB, A, LDA, E, IPIV, W, LDW,
263: $ INFO )
264: *
265: * -- LAPACK computational routine (version 3.7.0) --
266: * -- LAPACK is a software package provided by Univ. of Tennessee, --
267: * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
268: * December 2016
269: *
270: * .. Scalar Arguments ..
271: CHARACTER UPLO
272: INTEGER INFO, KB, LDA, LDW, N, NB
273: * ..
274: * .. Array Arguments ..
275: INTEGER IPIV( * )
276: COMPLEX*16 A( LDA, * ), W( LDW, * ), E( * )
277: * ..
278: *
279: * =====================================================================
280: *
281: * .. Parameters ..
282: DOUBLE PRECISION ZERO, ONE
283: PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0 )
284: COMPLEX*16 CONE
285: PARAMETER ( CONE = ( 1.0D+0, 0.0D+0 ) )
286: DOUBLE PRECISION EIGHT, SEVTEN
287: PARAMETER ( EIGHT = 8.0D+0, SEVTEN = 17.0D+0 )
288: COMPLEX*16 CZERO
289: PARAMETER ( CZERO = ( 0.0D+0, 0.0D+0 ) )
290: * ..
291: * .. Local Scalars ..
292: LOGICAL DONE
293: INTEGER IMAX, ITEMP, II, J, JB, JJ, JMAX, K, KK, KKW,
294: $ KP, KSTEP, KW, P
295: DOUBLE PRECISION ABSAKK, ALPHA, COLMAX, DTEMP, R1, ROWMAX, T,
296: $ SFMIN
297: COMPLEX*16 D11, D21, D22, Z
298: * ..
299: * .. External Functions ..
300: LOGICAL LSAME
301: INTEGER IZAMAX
302: DOUBLE PRECISION DLAMCH
303: EXTERNAL LSAME, IZAMAX, DLAMCH
304: * ..
305: * .. External Subroutines ..
306: EXTERNAL ZCOPY, ZDSCAL, ZGEMM, ZGEMV, ZLACGV, ZSWAP
307: * ..
308: * .. Intrinsic Functions ..
309: INTRINSIC ABS, DBLE, DCONJG, DIMAG, MAX, MIN, SQRT
310: * ..
311: * .. Statement Functions ..
312: DOUBLE PRECISION CABS1
313: * ..
314: * .. Statement Function definitions ..
315: CABS1( Z ) = ABS( DBLE( Z ) ) + ABS( DIMAG( Z ) )
316: * ..
317: * .. Executable Statements ..
318: *
319: INFO = 0
320: *
321: * Initialize ALPHA for use in choosing pivot block size.
322: *
323: ALPHA = ( ONE+SQRT( SEVTEN ) ) / EIGHT
324: *
325: * Compute machine safe minimum
326: *
327: SFMIN = DLAMCH( 'S' )
328: *
329: IF( LSAME( UPLO, 'U' ) ) THEN
330: *
331: * Factorize the trailing columns of A using the upper triangle
332: * of A and working backwards, and compute the matrix W = U12*D
333: * for use in updating A11 (note that conjg(W) is actually stored)
334: * Initilize the first entry of array E, where superdiagonal
335: * elements of D are stored
336: *
337: E( 1 ) = CZERO
338: *
339: * K is the main loop index, decreasing from N in steps of 1 or 2
340: *
341: K = N
342: 10 CONTINUE
343: *
344: * KW is the column of W which corresponds to column K of A
345: *
346: KW = NB + K - N
347: *
348: * Exit from loop
349: *
350: IF( ( K.LE.N-NB+1 .AND. NB.LT.N ) .OR. K.LT.1 )
351: $ GO TO 30
352: *
353: KSTEP = 1
354: P = K
355: *
356: * Copy column K of A to column KW of W and update it
357: *
358: IF( K.GT.1 )
359: $ CALL ZCOPY( K-1, A( 1, K ), 1, W( 1, KW ), 1 )
360: W( K, KW ) = DBLE( A( K, K ) )
361: IF( K.LT.N ) THEN
362: CALL ZGEMV( 'No transpose', K, N-K, -CONE, A( 1, K+1 ), LDA,
363: $ W( K, KW+1 ), LDW, CONE, W( 1, KW ), 1 )
364: W( K, KW ) = DBLE( W( K, KW ) )
365: END IF
366: *
367: * Determine rows and columns to be interchanged and whether
368: * a 1-by-1 or 2-by-2 pivot block will be used
369: *
370: ABSAKK = ABS( DBLE( W( K, KW ) ) )
371: *
372: * IMAX is the row-index of the largest off-diagonal element in
373: * column K, and COLMAX is its absolute value.
374: * Determine both COLMAX and IMAX.
375: *
376: IF( K.GT.1 ) THEN
377: IMAX = IZAMAX( K-1, W( 1, KW ), 1 )
378: COLMAX = CABS1( W( IMAX, KW ) )
379: ELSE
380: COLMAX = ZERO
381: END IF
382: *
383: IF( MAX( ABSAKK, COLMAX ).EQ.ZERO ) THEN
384: *
385: * Column K is zero or underflow: set INFO and continue
386: *
387: IF( INFO.EQ.0 )
388: $ INFO = K
389: KP = K
390: A( K, K ) = DBLE( W( K, KW ) )
391: IF( K.GT.1 )
392: $ CALL ZCOPY( K-1, W( 1, KW ), 1, A( 1, K ), 1 )
393: *
394: * Set E( K ) to zero
395: *
396: IF( K.GT.1 )
397: $ E( K ) = CZERO
398: *
399: ELSE
400: *
401: * ============================================================
402: *
403: * BEGIN pivot search
404: *
405: * Case(1)
406: * Equivalent to testing for ABSAKK.GE.ALPHA*COLMAX
407: * (used to handle NaN and Inf)
408: IF( .NOT.( ABSAKK.LT.ALPHA*COLMAX ) ) THEN
409: *
410: * no interchange, use 1-by-1 pivot block
411: *
412: KP = K
413: *
414: ELSE
415: *
416: * Lop until pivot found
417: *
418: DONE = .FALSE.
419: *
420: 12 CONTINUE
421: *
422: * BEGIN pivot search loop body
423: *
424: *
425: * Copy column IMAX to column KW-1 of W and update it
426: *
427: IF( IMAX.GT.1 )
428: $ CALL ZCOPY( IMAX-1, A( 1, IMAX ), 1, W( 1, KW-1 ),
429: $ 1 )
430: W( IMAX, KW-1 ) = DBLE( A( IMAX, IMAX ) )
431: *
432: CALL ZCOPY( K-IMAX, A( IMAX, IMAX+1 ), LDA,
433: $ W( IMAX+1, KW-1 ), 1 )
434: CALL ZLACGV( K-IMAX, W( IMAX+1, KW-1 ), 1 )
435: *
436: IF( K.LT.N ) THEN
437: CALL ZGEMV( 'No transpose', K, N-K, -CONE,
438: $ A( 1, K+1 ), LDA, W( IMAX, KW+1 ), LDW,
439: $ CONE, W( 1, KW-1 ), 1 )
440: W( IMAX, KW-1 ) = DBLE( W( IMAX, KW-1 ) )
441: END IF
442: *
443: * JMAX is the column-index of the largest off-diagonal
444: * element in row IMAX, and ROWMAX is its absolute value.
445: * Determine both ROWMAX and JMAX.
446: *
447: IF( IMAX.NE.K ) THEN
448: JMAX = IMAX + IZAMAX( K-IMAX, W( IMAX+1, KW-1 ),
449: $ 1 )
450: ROWMAX = CABS1( W( JMAX, KW-1 ) )
451: ELSE
452: ROWMAX = ZERO
453: END IF
454: *
455: IF( IMAX.GT.1 ) THEN
456: ITEMP = IZAMAX( IMAX-1, W( 1, KW-1 ), 1 )
457: DTEMP = CABS1( W( ITEMP, KW-1 ) )
458: IF( DTEMP.GT.ROWMAX ) THEN
459: ROWMAX = DTEMP
460: JMAX = ITEMP
461: END IF
462: END IF
463: *
464: * Case(2)
465: * Equivalent to testing for
466: * ABS( REAL( W( IMAX,KW-1 ) ) ).GE.ALPHA*ROWMAX
467: * (used to handle NaN and Inf)
468: *
469: IF( .NOT.( ABS( DBLE( W( IMAX,KW-1 ) ) )
470: $ .LT.ALPHA*ROWMAX ) ) THEN
471: *
472: * interchange rows and columns K and IMAX,
473: * use 1-by-1 pivot block
474: *
475: KP = IMAX
476: *
477: * copy column KW-1 of W to column KW of W
478: *
479: CALL ZCOPY( K, W( 1, KW-1 ), 1, W( 1, KW ), 1 )
480: *
481: DONE = .TRUE.
482: *
483: * Case(3)
484: * Equivalent to testing for ROWMAX.EQ.COLMAX,
485: * (used to handle NaN and Inf)
486: *
487: ELSE IF( ( P.EQ.JMAX ) .OR. ( ROWMAX.LE.COLMAX ) )
488: $ THEN
489: *
490: * interchange rows and columns K-1 and IMAX,
491: * use 2-by-2 pivot block
492: *
493: KP = IMAX
494: KSTEP = 2
495: DONE = .TRUE.
496: *
497: * Case(4)
498: ELSE
499: *
500: * Pivot not found: set params and repeat
501: *
502: P = IMAX
503: COLMAX = ROWMAX
504: IMAX = JMAX
505: *
506: * Copy updated JMAXth (next IMAXth) column to Kth of W
507: *
508: CALL ZCOPY( K, W( 1, KW-1 ), 1, W( 1, KW ), 1 )
509: *
510: END IF
511: *
512: *
513: * END pivot search loop body
514: *
515: IF( .NOT.DONE ) GOTO 12
516: *
517: END IF
518: *
519: * END pivot search
520: *
521: * ============================================================
522: *
523: * KK is the column of A where pivoting step stopped
524: *
525: KK = K - KSTEP + 1
526: *
527: * KKW is the column of W which corresponds to column KK of A
528: *
529: KKW = NB + KK - N
530: *
531: * Interchange rows and columns P and K.
532: * Updated column P is already stored in column KW of W.
533: *
534: IF( ( KSTEP.EQ.2 ) .AND. ( P.NE.K ) ) THEN
535: *
536: * Copy non-updated column K to column P of submatrix A
537: * at step K. No need to copy element into columns
538: * K and K-1 of A for 2-by-2 pivot, since these columns
539: * will be later overwritten.
540: *
541: A( P, P ) = DBLE( A( K, K ) )
542: CALL ZCOPY( K-1-P, A( P+1, K ), 1, A( P, P+1 ),
543: $ LDA )
544: CALL ZLACGV( K-1-P, A( P, P+1 ), LDA )
545: IF( P.GT.1 )
546: $ CALL ZCOPY( P-1, A( 1, K ), 1, A( 1, P ), 1 )
547: *
548: * Interchange rows K and P in the last K+1 to N columns of A
549: * (columns K and K-1 of A for 2-by-2 pivot will be
550: * later overwritten). Interchange rows K and P
551: * in last KKW to NB columns of W.
552: *
553: IF( K.LT.N )
554: $ CALL ZSWAP( N-K, A( K, K+1 ), LDA, A( P, K+1 ),
555: $ LDA )
556: CALL ZSWAP( N-KK+1, W( K, KKW ), LDW, W( P, KKW ),
557: $ LDW )
558: END IF
559: *
560: * Interchange rows and columns KP and KK.
561: * Updated column KP is already stored in column KKW of W.
562: *
563: IF( KP.NE.KK ) THEN
564: *
565: * Copy non-updated column KK to column KP of submatrix A
566: * at step K. No need to copy element into column K
567: * (or K and K-1 for 2-by-2 pivot) of A, since these columns
568: * will be later overwritten.
569: *
570: A( KP, KP ) = DBLE( A( KK, KK ) )
571: CALL ZCOPY( KK-1-KP, A( KP+1, KK ), 1, A( KP, KP+1 ),
572: $ LDA )
573: CALL ZLACGV( KK-1-KP, A( KP, KP+1 ), LDA )
574: IF( KP.GT.1 )
575: $ CALL ZCOPY( KP-1, A( 1, KK ), 1, A( 1, KP ), 1 )
576: *
577: * Interchange rows KK and KP in last K+1 to N columns of A
578: * (columns K (or K and K-1 for 2-by-2 pivot) of A will be
579: * later overwritten). Interchange rows KK and KP
580: * in last KKW to NB columns of W.
581: *
582: IF( K.LT.N )
583: $ CALL ZSWAP( N-K, A( KK, K+1 ), LDA, A( KP, K+1 ),
584: $ LDA )
585: CALL ZSWAP( N-KK+1, W( KK, KKW ), LDW, W( KP, KKW ),
586: $ LDW )
587: END IF
588: *
589: IF( KSTEP.EQ.1 ) THEN
590: *
591: * 1-by-1 pivot block D(k): column kw of W now holds
592: *
593: * W(kw) = U(k)*D(k),
594: *
595: * where U(k) is the k-th column of U
596: *
597: * (1) Store subdiag. elements of column U(k)
598: * and 1-by-1 block D(k) in column k of A.
599: * (NOTE: Diagonal element U(k,k) is a UNIT element
600: * and not stored)
601: * A(k,k) := D(k,k) = W(k,kw)
602: * A(1:k-1,k) := U(1:k-1,k) = W(1:k-1,kw)/D(k,k)
603: *
604: * (NOTE: No need to use for Hermitian matrix
605: * A( K, K ) = REAL( W( K, K) ) to separately copy diagonal
606: * element D(k,k) from W (potentially saves only one load))
607: CALL ZCOPY( K, W( 1, KW ), 1, A( 1, K ), 1 )
608: IF( K.GT.1 ) THEN
609: *
610: * (NOTE: No need to check if A(k,k) is NOT ZERO,
611: * since that was ensured earlier in pivot search:
612: * case A(k,k) = 0 falls into 2x2 pivot case(3))
613: *
614: * Handle division by a small number
615: *
616: T = DBLE( A( K, K ) )
617: IF( ABS( T ).GE.SFMIN ) THEN
618: R1 = ONE / T
619: CALL ZDSCAL( K-1, R1, A( 1, K ), 1 )
620: ELSE
621: DO 14 II = 1, K-1
622: A( II, K ) = A( II, K ) / T
623: 14 CONTINUE
624: END IF
625: *
626: * (2) Conjugate column W(kw)
627: *
628: CALL ZLACGV( K-1, W( 1, KW ), 1 )
629: *
630: * Store the superdiagonal element of D in array E
631: *
632: E( K ) = CZERO
633: *
634: END IF
635: *
636: ELSE
637: *
638: * 2-by-2 pivot block D(k): columns kw and kw-1 of W now hold
639: *
640: * ( W(kw-1) W(kw) ) = ( U(k-1) U(k) )*D(k)
641: *
642: * where U(k) and U(k-1) are the k-th and (k-1)-th columns
643: * of U
644: *
645: * (1) Store U(1:k-2,k-1) and U(1:k-2,k) and 2-by-2
646: * block D(k-1:k,k-1:k) in columns k-1 and k of A.
647: * (NOTE: 2-by-2 diagonal block U(k-1:k,k-1:k) is a UNIT
648: * block and not stored)
649: * A(k-1:k,k-1:k) := D(k-1:k,k-1:k) = W(k-1:k,kw-1:kw)
650: * A(1:k-2,k-1:k) := U(1:k-2,k:k-1:k) =
651: * = W(1:k-2,kw-1:kw) * ( D(k-1:k,k-1:k)**(-1) )
652: *
653: IF( K.GT.2 ) THEN
654: *
655: * Factor out the columns of the inverse of 2-by-2 pivot
656: * block D, so that each column contains 1, to reduce the
657: * number of FLOPS when we multiply panel
658: * ( W(kw-1) W(kw) ) by this inverse, i.e. by D**(-1).
659: *
660: * D**(-1) = ( d11 cj(d21) )**(-1) =
661: * ( d21 d22 )
662: *
663: * = 1/(d11*d22-|d21|**2) * ( ( d22) (-cj(d21) ) ) =
664: * ( (-d21) ( d11 ) )
665: *
666: * = 1/(|d21|**2) * 1/((d11/cj(d21))*(d22/d21)-1) *
667: *
668: * * ( d21*( d22/d21 ) conj(d21)*( - 1 ) ) =
669: * ( ( -1 ) ( d11/conj(d21) ) )
670: *
671: * = 1/(|d21|**2) * 1/(D22*D11-1) *
672: *
673: * * ( d21*( D11 ) conj(d21)*( -1 ) ) =
674: * ( ( -1 ) ( D22 ) )
675: *
676: * = (1/|d21|**2) * T * ( d21*( D11 ) conj(d21)*( -1 ) ) =
677: * ( ( -1 ) ( D22 ) )
678: *
679: * = ( (T/conj(d21))*( D11 ) (T/d21)*( -1 ) ) =
680: * ( ( -1 ) ( D22 ) )
681: *
682: * Handle division by a small number. (NOTE: order of
683: * operations is important)
684: *
685: * = ( T*(( D11 )/conj(D21)) T*(( -1 )/D21 ) )
686: * ( (( -1 ) ) (( D22 ) ) ),
687: *
688: * where D11 = d22/d21,
689: * D22 = d11/conj(d21),
690: * D21 = d21,
691: * T = 1/(D22*D11-1).
692: *
693: * (NOTE: No need to check for division by ZERO,
694: * since that was ensured earlier in pivot search:
695: * (a) d21 != 0 in 2x2 pivot case(4),
696: * since |d21| should be larger than |d11| and |d22|;
697: * (b) (D22*D11 - 1) != 0, since from (a),
698: * both |D11| < 1, |D22| < 1, hence |D22*D11| << 1.)
699: *
700: D21 = W( K-1, KW )
701: D11 = W( K, KW ) / DCONJG( D21 )
702: D22 = W( K-1, KW-1 ) / D21
703: T = ONE / ( DBLE( D11*D22 )-ONE )
704: *
705: * Update elements in columns A(k-1) and A(k) as
706: * dot products of rows of ( W(kw-1) W(kw) ) and columns
707: * of D**(-1)
708: *
709: DO 20 J = 1, K - 2
710: A( J, K-1 ) = T*( ( D11*W( J, KW-1 )-W( J, KW ) ) /
711: $ D21 )
712: A( J, K ) = T*( ( D22*W( J, KW )-W( J, KW-1 ) ) /
713: $ DCONJG( D21 ) )
714: 20 CONTINUE
715: END IF
716: *
717: * Copy diagonal elements of D(K) to A,
718: * copy superdiagonal element of D(K) to E(K) and
719: * ZERO out superdiagonal entry of A
720: *
721: A( K-1, K-1 ) = W( K-1, KW-1 )
722: A( K-1, K ) = CZERO
723: A( K, K ) = W( K, KW )
724: E( K ) = W( K-1, KW )
725: E( K-1 ) = CZERO
726: *
727: * (2) Conjugate columns W(kw) and W(kw-1)
728: *
729: CALL ZLACGV( K-1, W( 1, KW ), 1 )
730: CALL ZLACGV( K-2, W( 1, KW-1 ), 1 )
731: *
732: END IF
733: *
734: * End column K is nonsingular
735: *
736: END IF
737: *
738: * Store details of the interchanges in IPIV
739: *
740: IF( KSTEP.EQ.1 ) THEN
741: IPIV( K ) = KP
742: ELSE
743: IPIV( K ) = -P
744: IPIV( K-1 ) = -KP
745: END IF
746: *
747: * Decrease K and return to the start of the main loop
748: *
749: K = K - KSTEP
750: GO TO 10
751: *
752: 30 CONTINUE
753: *
754: * Update the upper triangle of A11 (= A(1:k,1:k)) as
755: *
756: * A11 := A11 - U12*D*U12**H = A11 - U12*W**H
757: *
758: * computing blocks of NB columns at a time (note that conjg(W) is
759: * actually stored)
760: *
761: DO 50 J = ( ( K-1 ) / NB )*NB + 1, 1, -NB
762: JB = MIN( NB, K-J+1 )
763: *
764: * Update the upper triangle of the diagonal block
765: *
766: DO 40 JJ = J, J + JB - 1
767: A( JJ, JJ ) = DBLE( A( JJ, JJ ) )
768: CALL ZGEMV( 'No transpose', JJ-J+1, N-K, -CONE,
769: $ A( J, K+1 ), LDA, W( JJ, KW+1 ), LDW, CONE,
770: $ A( J, JJ ), 1 )
771: A( JJ, JJ ) = DBLE( A( JJ, JJ ) )
772: 40 CONTINUE
773: *
774: * Update the rectangular superdiagonal block
775: *
776: IF( J.GE.2 )
777: $ CALL ZGEMM( 'No transpose', 'Transpose', J-1, JB, N-K,
778: $ -CONE, A( 1, K+1 ), LDA, W( J, KW+1 ), LDW,
779: $ CONE, A( 1, J ), LDA )
780: 50 CONTINUE
781: *
782: * Set KB to the number of columns factorized
783: *
784: KB = N - K
785: *
786: ELSE
787: *
788: * Factorize the leading columns of A using the lower triangle
789: * of A and working forwards, and compute the matrix W = L21*D
790: * for use in updating A22 (note that conjg(W) is actually stored)
791: *
792: * Initilize the unused last entry of the subdiagonal array E.
793: *
794: E( N ) = CZERO
795: *
796: * K is the main loop index, increasing from 1 in steps of 1 or 2
797: *
798: K = 1
799: 70 CONTINUE
800: *
801: * Exit from loop
802: *
803: IF( ( K.GE.NB .AND. NB.LT.N ) .OR. K.GT.N )
804: $ GO TO 90
805: *
806: KSTEP = 1
807: P = K
808: *
809: * Copy column K of A to column K of W and update column K of W
810: *
811: W( K, K ) = DBLE( A( K, K ) )
812: IF( K.LT.N )
813: $ CALL ZCOPY( N-K, A( K+1, K ), 1, W( K+1, K ), 1 )
814: IF( K.GT.1 ) THEN
815: CALL ZGEMV( 'No transpose', N-K+1, K-1, -CONE, A( K, 1 ),
816: $ LDA, W( K, 1 ), LDW, CONE, W( K, K ), 1 )
817: W( K, K ) = DBLE( W( K, K ) )
818: END IF
819: *
820: * Determine rows and columns to be interchanged and whether
821: * a 1-by-1 or 2-by-2 pivot block will be used
822: *
823: ABSAKK = ABS( DBLE( W( K, K ) ) )
824: *
825: * IMAX is the row-index of the largest off-diagonal element in
826: * column K, and COLMAX is its absolute value.
827: * Determine both COLMAX and IMAX.
828: *
829: IF( K.LT.N ) THEN
830: IMAX = K + IZAMAX( N-K, W( K+1, K ), 1 )
831: COLMAX = CABS1( W( IMAX, K ) )
832: ELSE
833: COLMAX = ZERO
834: END IF
835: *
836: IF( MAX( ABSAKK, COLMAX ).EQ.ZERO ) THEN
837: *
838: * Column K is zero or underflow: set INFO and continue
839: *
840: IF( INFO.EQ.0 )
841: $ INFO = K
842: KP = K
843: A( K, K ) = DBLE( W( K, K ) )
844: IF( K.LT.N )
845: $ CALL ZCOPY( N-K, W( K+1, K ), 1, A( K+1, K ), 1 )
846: *
847: * Set E( K ) to zero
848: *
849: IF( K.LT.N )
850: $ E( K ) = CZERO
851: *
852: ELSE
853: *
854: * ============================================================
855: *
856: * BEGIN pivot search
857: *
858: * Case(1)
859: * Equivalent to testing for ABSAKK.GE.ALPHA*COLMAX
860: * (used to handle NaN and Inf)
861: *
862: IF( .NOT.( ABSAKK.LT.ALPHA*COLMAX ) ) THEN
863: *
864: * no interchange, use 1-by-1 pivot block
865: *
866: KP = K
867: *
868: ELSE
869: *
870: DONE = .FALSE.
871: *
872: * Loop until pivot found
873: *
874: 72 CONTINUE
875: *
876: * BEGIN pivot search loop body
877: *
878: *
879: * Copy column IMAX to column k+1 of W and update it
880: *
881: CALL ZCOPY( IMAX-K, A( IMAX, K ), LDA, W( K, K+1 ), 1)
882: CALL ZLACGV( IMAX-K, W( K, K+1 ), 1 )
883: W( IMAX, K+1 ) = DBLE( A( IMAX, IMAX ) )
884: *
885: IF( IMAX.LT.N )
886: $ CALL ZCOPY( N-IMAX, A( IMAX+1, IMAX ), 1,
887: $ W( IMAX+1, K+1 ), 1 )
888: *
889: IF( K.GT.1 ) THEN
890: CALL ZGEMV( 'No transpose', N-K+1, K-1, -CONE,
891: $ A( K, 1 ), LDA, W( IMAX, 1 ), LDW,
892: $ CONE, W( K, K+1 ), 1 )
893: W( IMAX, K+1 ) = DBLE( W( IMAX, K+1 ) )
894: END IF
895: *
896: * JMAX is the column-index of the largest off-diagonal
897: * element in row IMAX, and ROWMAX is its absolute value.
898: * Determine both ROWMAX and JMAX.
899: *
900: IF( IMAX.NE.K ) THEN
901: JMAX = K - 1 + IZAMAX( IMAX-K, W( K, K+1 ), 1 )
902: ROWMAX = CABS1( W( JMAX, K+1 ) )
903: ELSE
904: ROWMAX = ZERO
905: END IF
906: *
907: IF( IMAX.LT.N ) THEN
908: ITEMP = IMAX + IZAMAX( N-IMAX, W( IMAX+1, K+1 ), 1)
909: DTEMP = CABS1( W( ITEMP, K+1 ) )
910: IF( DTEMP.GT.ROWMAX ) THEN
911: ROWMAX = DTEMP
912: JMAX = ITEMP
913: END IF
914: END IF
915: *
916: * Case(2)
917: * Equivalent to testing for
918: * ABS( REAL( W( IMAX,K+1 ) ) ).GE.ALPHA*ROWMAX
919: * (used to handle NaN and Inf)
920: *
921: IF( .NOT.( ABS( DBLE( W( IMAX,K+1 ) ) )
922: $ .LT.ALPHA*ROWMAX ) ) THEN
923: *
924: * interchange rows and columns K and IMAX,
925: * use 1-by-1 pivot block
926: *
927: KP = IMAX
928: *
929: * copy column K+1 of W to column K of W
930: *
931: CALL ZCOPY( N-K+1, W( K, K+1 ), 1, W( K, K ), 1 )
932: *
933: DONE = .TRUE.
934: *
935: * Case(3)
936: * Equivalent to testing for ROWMAX.EQ.COLMAX,
937: * (used to handle NaN and Inf)
938: *
939: ELSE IF( ( P.EQ.JMAX ) .OR. ( ROWMAX.LE.COLMAX ) )
940: $ THEN
941: *
942: * interchange rows and columns K+1 and IMAX,
943: * use 2-by-2 pivot block
944: *
945: KP = IMAX
946: KSTEP = 2
947: DONE = .TRUE.
948: *
949: * Case(4)
950: ELSE
951: *
952: * Pivot not found: set params and repeat
953: *
954: P = IMAX
955: COLMAX = ROWMAX
956: IMAX = JMAX
957: *
958: * Copy updated JMAXth (next IMAXth) column to Kth of W
959: *
960: CALL ZCOPY( N-K+1, W( K, K+1 ), 1, W( K, K ), 1 )
961: *
962: END IF
963: *
964: *
965: * End pivot search loop body
966: *
967: IF( .NOT.DONE ) GOTO 72
968: *
969: END IF
970: *
971: * END pivot search
972: *
973: * ============================================================
974: *
975: * KK is the column of A where pivoting step stopped
976: *
977: KK = K + KSTEP - 1
978: *
979: * Interchange rows and columns P and K (only for 2-by-2 pivot).
980: * Updated column P is already stored in column K of W.
981: *
982: IF( ( KSTEP.EQ.2 ) .AND. ( P.NE.K ) ) THEN
983: *
984: * Copy non-updated column KK-1 to column P of submatrix A
985: * at step K. No need to copy element into columns
986: * K and K+1 of A for 2-by-2 pivot, since these columns
987: * will be later overwritten.
988: *
989: A( P, P ) = DBLE( A( K, K ) )
990: CALL ZCOPY( P-K-1, A( K+1, K ), 1, A( P, K+1 ), LDA )
991: CALL ZLACGV( P-K-1, A( P, K+1 ), LDA )
992: IF( P.LT.N )
993: $ CALL ZCOPY( N-P, A( P+1, K ), 1, A( P+1, P ), 1 )
994: *
995: * Interchange rows K and P in first K-1 columns of A
996: * (columns K and K+1 of A for 2-by-2 pivot will be
997: * later overwritten). Interchange rows K and P
998: * in first KK columns of W.
999: *
1000: IF( K.GT.1 )
1001: $ CALL ZSWAP( K-1, A( K, 1 ), LDA, A( P, 1 ), LDA )
1002: CALL ZSWAP( KK, W( K, 1 ), LDW, W( P, 1 ), LDW )
1003: END IF
1004: *
1005: * Interchange rows and columns KP and KK.
1006: * Updated column KP is already stored in column KK of W.
1007: *
1008: IF( KP.NE.KK ) THEN
1009: *
1010: * Copy non-updated column KK to column KP of submatrix A
1011: * at step K. No need to copy element into column K
1012: * (or K and K+1 for 2-by-2 pivot) of A, since these columns
1013: * will be later overwritten.
1014: *
1015: A( KP, KP ) = DBLE( A( KK, KK ) )
1016: CALL ZCOPY( KP-KK-1, A( KK+1, KK ), 1, A( KP, KK+1 ),
1017: $ LDA )
1018: CALL ZLACGV( KP-KK-1, A( KP, KK+1 ), LDA )
1019: IF( KP.LT.N )
1020: $ CALL ZCOPY( N-KP, A( KP+1, KK ), 1, A( KP+1, KP ), 1 )
1021: *
1022: * Interchange rows KK and KP in first K-1 columns of A
1023: * (column K (or K and K+1 for 2-by-2 pivot) of A will be
1024: * later overwritten). Interchange rows KK and KP
1025: * in first KK columns of W.
1026: *
1027: IF( K.GT.1 )
1028: $ CALL ZSWAP( K-1, A( KK, 1 ), LDA, A( KP, 1 ), LDA )
1029: CALL ZSWAP( KK, W( KK, 1 ), LDW, W( KP, 1 ), LDW )
1030: END IF
1031: *
1032: IF( KSTEP.EQ.1 ) THEN
1033: *
1034: * 1-by-1 pivot block D(k): column k of W now holds
1035: *
1036: * W(k) = L(k)*D(k),
1037: *
1038: * where L(k) is the k-th column of L
1039: *
1040: * (1) Store subdiag. elements of column L(k)
1041: * and 1-by-1 block D(k) in column k of A.
1042: * (NOTE: Diagonal element L(k,k) is a UNIT element
1043: * and not stored)
1044: * A(k,k) := D(k,k) = W(k,k)
1045: * A(k+1:N,k) := L(k+1:N,k) = W(k+1:N,k)/D(k,k)
1046: *
1047: * (NOTE: No need to use for Hermitian matrix
1048: * A( K, K ) = REAL( W( K, K) ) to separately copy diagonal
1049: * element D(k,k) from W (potentially saves only one load))
1050: CALL ZCOPY( N-K+1, W( K, K ), 1, A( K, K ), 1 )
1051: IF( K.LT.N ) THEN
1052: *
1053: * (NOTE: No need to check if A(k,k) is NOT ZERO,
1054: * since that was ensured earlier in pivot search:
1055: * case A(k,k) = 0 falls into 2x2 pivot case(3))
1056: *
1057: * Handle division by a small number
1058: *
1059: T = DBLE( A( K, K ) )
1060: IF( ABS( T ).GE.SFMIN ) THEN
1061: R1 = ONE / T
1062: CALL ZDSCAL( N-K, R1, A( K+1, K ), 1 )
1063: ELSE
1064: DO 74 II = K + 1, N
1065: A( II, K ) = A( II, K ) / T
1066: 74 CONTINUE
1067: END IF
1068: *
1069: * (2) Conjugate column W(k)
1070: *
1071: CALL ZLACGV( N-K, W( K+1, K ), 1 )
1072: *
1073: * Store the subdiagonal element of D in array E
1074: *
1075: E( K ) = CZERO
1076: *
1077: END IF
1078: *
1079: ELSE
1080: *
1081: * 2-by-2 pivot block D(k): columns k and k+1 of W now hold
1082: *
1083: * ( W(k) W(k+1) ) = ( L(k) L(k+1) )*D(k)
1084: *
1085: * where L(k) and L(k+1) are the k-th and (k+1)-th columns
1086: * of L
1087: *
1088: * (1) Store L(k+2:N,k) and L(k+2:N,k+1) and 2-by-2
1089: * block D(k:k+1,k:k+1) in columns k and k+1 of A.
1090: * NOTE: 2-by-2 diagonal block L(k:k+1,k:k+1) is a UNIT
1091: * block and not stored.
1092: * A(k:k+1,k:k+1) := D(k:k+1,k:k+1) = W(k:k+1,k:k+1)
1093: * A(k+2:N,k:k+1) := L(k+2:N,k:k+1) =
1094: * = W(k+2:N,k:k+1) * ( D(k:k+1,k:k+1)**(-1) )
1095: *
1096: IF( K.LT.N-1 ) THEN
1097: *
1098: * Factor out the columns of the inverse of 2-by-2 pivot
1099: * block D, so that each column contains 1, to reduce the
1100: * number of FLOPS when we multiply panel
1101: * ( W(kw-1) W(kw) ) by this inverse, i.e. by D**(-1).
1102: *
1103: * D**(-1) = ( d11 cj(d21) )**(-1) =
1104: * ( d21 d22 )
1105: *
1106: * = 1/(d11*d22-|d21|**2) * ( ( d22) (-cj(d21) ) ) =
1107: * ( (-d21) ( d11 ) )
1108: *
1109: * = 1/(|d21|**2) * 1/((d11/cj(d21))*(d22/d21)-1) *
1110: *
1111: * * ( d21*( d22/d21 ) conj(d21)*( - 1 ) ) =
1112: * ( ( -1 ) ( d11/conj(d21) ) )
1113: *
1114: * = 1/(|d21|**2) * 1/(D22*D11-1) *
1115: *
1116: * * ( d21*( D11 ) conj(d21)*( -1 ) ) =
1117: * ( ( -1 ) ( D22 ) )
1118: *
1119: * = (1/|d21|**2) * T * ( d21*( D11 ) conj(d21)*( -1 ) ) =
1120: * ( ( -1 ) ( D22 ) )
1121: *
1122: * = ( (T/conj(d21))*( D11 ) (T/d21)*( -1 ) ) =
1123: * ( ( -1 ) ( D22 ) )
1124: *
1125: * Handle division by a small number. (NOTE: order of
1126: * operations is important)
1127: *
1128: * = ( T*(( D11 )/conj(D21)) T*(( -1 )/D21 ) )
1129: * ( (( -1 ) ) (( D22 ) ) ),
1130: *
1131: * where D11 = d22/d21,
1132: * D22 = d11/conj(d21),
1133: * D21 = d21,
1134: * T = 1/(D22*D11-1).
1135: *
1136: * (NOTE: No need to check for division by ZERO,
1137: * since that was ensured earlier in pivot search:
1138: * (a) d21 != 0 in 2x2 pivot case(4),
1139: * since |d21| should be larger than |d11| and |d22|;
1140: * (b) (D22*D11 - 1) != 0, since from (a),
1141: * both |D11| < 1, |D22| < 1, hence |D22*D11| << 1.)
1142: *
1143: D21 = W( K+1, K )
1144: D11 = W( K+1, K+1 ) / D21
1145: D22 = W( K, K ) / DCONJG( D21 )
1146: T = ONE / ( DBLE( D11*D22 )-ONE )
1147: *
1148: * Update elements in columns A(k) and A(k+1) as
1149: * dot products of rows of ( W(k) W(k+1) ) and columns
1150: * of D**(-1)
1151: *
1152: DO 80 J = K + 2, N
1153: A( J, K ) = T*( ( D11*W( J, K )-W( J, K+1 ) ) /
1154: $ DCONJG( D21 ) )
1155: A( J, K+1 ) = T*( ( D22*W( J, K+1 )-W( J, K ) ) /
1156: $ D21 )
1157: 80 CONTINUE
1158: END IF
1159: *
1160: * Copy diagonal elements of D(K) to A,
1161: * copy subdiagonal element of D(K) to E(K) and
1162: * ZERO out subdiagonal entry of A
1163: *
1164: A( K, K ) = W( K, K )
1165: A( K+1, K ) = CZERO
1166: A( K+1, K+1 ) = W( K+1, K+1 )
1167: E( K ) = W( K+1, K )
1168: E( K+1 ) = CZERO
1169: *
1170: * (2) Conjugate columns W(k) and W(k+1)
1171: *
1172: CALL ZLACGV( N-K, W( K+1, K ), 1 )
1173: CALL ZLACGV( N-K-1, W( K+2, K+1 ), 1 )
1174: *
1175: END IF
1176: *
1177: * End column K is nonsingular
1178: *
1179: END IF
1180: *
1181: * Store details of the interchanges in IPIV
1182: *
1183: IF( KSTEP.EQ.1 ) THEN
1184: IPIV( K ) = KP
1185: ELSE
1186: IPIV( K ) = -P
1187: IPIV( K+1 ) = -KP
1188: END IF
1189: *
1190: * Increase K and return to the start of the main loop
1191: *
1192: K = K + KSTEP
1193: GO TO 70
1194: *
1195: 90 CONTINUE
1196: *
1197: * Update the lower triangle of A22 (= A(k:n,k:n)) as
1198: *
1199: * A22 := A22 - L21*D*L21**H = A22 - L21*W**H
1200: *
1201: * computing blocks of NB columns at a time (note that conjg(W) is
1202: * actually stored)
1203: *
1204: DO 110 J = K, N, NB
1205: JB = MIN( NB, N-J+1 )
1206: *
1207: * Update the lower triangle of the diagonal block
1208: *
1209: DO 100 JJ = J, J + JB - 1
1210: A( JJ, JJ ) = DBLE( A( JJ, JJ ) )
1211: CALL ZGEMV( 'No transpose', J+JB-JJ, K-1, -CONE,
1212: $ A( JJ, 1 ), LDA, W( JJ, 1 ), LDW, CONE,
1213: $ A( JJ, JJ ), 1 )
1214: A( JJ, JJ ) = DBLE( A( JJ, JJ ) )
1215: 100 CONTINUE
1216: *
1217: * Update the rectangular subdiagonal block
1218: *
1219: IF( J+JB.LE.N )
1220: $ CALL ZGEMM( 'No transpose', 'Transpose', N-J-JB+1, JB,
1221: $ K-1, -CONE, A( J+JB, 1 ), LDA, W( J, 1 ),
1222: $ LDW, CONE, A( J+JB, J ), LDA )
1223: 110 CONTINUE
1224: *
1225: * Set KB to the number of columns factorized
1226: *
1227: KB = K - 1
1228: *
1229: END IF
1230: RETURN
1231: *
1232: * End of ZLAHEF_RK
1233: *
1234: END
CVSweb interface <joel.bertrand@systella.fr>