242 $ WORK, LWORK, INFO )
252 INTEGER INFO, LDA, LDAB, LWORK, N, KD
255 COMPLEX*16 A( LDA, * ), AB( LDAB, * ),
256 $ tau( * ), work( * )
262 DOUBLE PRECISION RONE
263 COMPLEX*16 ZERO, ONE, HALF
264 parameter( rone = 1.0d+0,
265 $ zero = ( 0.0d+0, 0.0d+0 ),
266 $ one = ( 1.0d+0, 0.0d+0 ),
267 $ half = ( 0.5d+0, 0.0d+0 ) )
270 LOGICAL LQUERY, UPPER
271 INTEGER I, J, IINFO, LWMIN, PN, PK, LK,
272 $ ldt, ldw, lds2, lds1,
274 $ tpos, wpos, s2pos, s1pos
287 EXTERNAL lsame, ilaenv2stage
295 upper = lsame( uplo,
'U' )
296 lquery = ( lwork.EQ.-1 )
300 lwmin = ilaenv2stage( 4,
'ZHETRD_HE2HB',
'', n, kd, -1, -1 )
303 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
305 ELSE IF( n.LT.0 )
THEN
307 ELSE IF( kd.LT.0 )
THEN
309 ELSE IF( lda.LT.max( 1, n ) )
THEN
311 ELSE IF( ldab.LT.max( 1, kd+1 ) )
THEN
313 ELSE IF( lwork.LT.lwmin .AND. .NOT.lquery )
THEN
318 CALL xerbla(
'ZHETRD_HE2HB', -info )
320 ELSE IF( lquery )
THEN
332 CALL zcopy( lk, a( i-lk+1, i ), 1,
333 $ ab( kd+1-lk+1, i ), 1 )
337 lk = min( kd+1, n-i+1 )
338 CALL zcopy( lk, a( i, i ), 1, ab( 1, i ), 1 )
352 ls2 = lwmin - lt - lw - ls1
370 CALL zlaset(
"A", ldt, kd, zero, zero, work( tpos ), ldt )
373 DO 10 i = 1, n - kd, kd
375 pk = min( n-i-kd+1, kd )
379 CALL zgelqf( kd, pn, a( i, i+kd ), lda,
380 $ tau( i ), work( s2pos ), ls2, iinfo )
385 lk = min( kd, n-j ) + 1
386 CALL zcopy( lk, a( j, j ), lda, ab( kd+1, j ),
390 CALL zlaset(
'Lower', pk, pk, zero, one,
391 $ a( i, i+kd ), lda )
395 CALL zlarft(
'Forward',
'Rowwise', pn, pk,
396 $ a( i, i+kd ), lda, tau( i ),
397 $ work( tpos ), ldt )
401 CALL zgemm(
'Conjugate',
'No transpose', pk, pn, pk,
402 $ one, work( tpos ), ldt,
404 $ zero, work( s2pos ), lds2 )
406 CALL zhemm(
'Right', uplo, pk, pn,
407 $ one, a( i+kd, i+kd ), lda,
408 $ work( s2pos ), lds2,
409 $ zero, work( wpos ), ldw )
411 CALL zgemm(
'No transpose',
'Conjugate', pk, pk, pn,
412 $ one, work( wpos ), ldw,
413 $ work( s2pos ), lds2,
414 $ zero, work( s1pos ), lds1 )
416 CALL zgemm(
'No transpose',
'No transpose', pk, pn, pk,
417 $ -half, work( s1pos ), lds1,
419 $ one, work( wpos ), ldw )
425 CALL zher2k( uplo,
'Conjugate', pn, pk,
426 $ -one, a( i, i+kd ), lda,
428 $ rone, a( i+kd, i+kd ), lda )
434 lk = min(kd, n-j) + 1
435 CALL zcopy( lk, a( j, j ), lda, ab( kd+1, j ), ldab-1 )
442 DO 40 i = 1, n - kd, kd
444 pk = min( n-i-kd+1, kd )
448 CALL zgeqrf( pn, kd, a( i+kd, i ), lda,
449 $ tau( i ), work( s2pos ), ls2, iinfo )
454 lk = min( kd, n-j ) + 1
455 CALL zcopy( lk, a( j, j ), 1, ab( 1, j ), 1 )
458 CALL zlaset(
'Upper', pk, pk, zero, one,
459 $ a( i+kd, i ), lda )
463 CALL zlarft(
'Forward',
'Columnwise', pn, pk,
464 $ a( i+kd, i ), lda, tau( i ),
465 $ work( tpos ), ldt )
469 CALL zgemm(
'No transpose',
'No transpose', pn, pk, pk,
470 $ one, a( i+kd, i ), lda,
472 $ zero, work( s2pos ), lds2 )
474 CALL zhemm(
'Left', uplo, pn, pk,
475 $ one, a( i+kd, i+kd ), lda,
476 $ work( s2pos ), lds2,
477 $ zero, work( wpos ), ldw )
479 CALL zgemm(
'Conjugate',
'No transpose', pk, pk, pn,
480 $ one, work( s2pos ), lds2,
482 $ zero, work( s1pos ), lds1 )
484 CALL zgemm(
'No transpose',
'No transpose', pn, pk, pk,
485 $ -half, a( i+kd, i ), lda,
486 $ work( s1pos ), lds1,
487 $ one, work( wpos ), ldw )
493 CALL zher2k( uplo,
'No transpose', pn, pk,
494 $ -one, a( i+kd, i ), lda,
496 $ rone, a( i+kd, i+kd ), lda )
509 lk = min(kd, n-j) + 1
510 CALL zcopy( lk, a( j, j ), 1, ab( 1, j ), 1 )