242 $ WORK, LWORK, INFO )
252 INTEGER INFO, LDA, LDAB, LWORK, N, KD
255 DOUBLE PRECISION A( LDA, * ), AB( LDAB, * ),
256 $ tau( * ), work( * )
262 DOUBLE PRECISION RONE
263 DOUBLE PRECISION ZERO, ONE, HALF
264 parameter( rone = 1.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,
'DSYTRD_SY2SB',
' ', n, kd, -1,
304 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
306 ELSE IF( n.LT.0 )
THEN
308 ELSE IF( kd.LT.0 )
THEN
310 ELSE IF( lda.LT.max( 1, n ) )
THEN
312 ELSE IF( ldab.LT.max( 1, kd+1 ) )
THEN
314 ELSE IF( lwork.LT.lwmin .AND. .NOT.lquery )
THEN
319 CALL xerbla(
'DSYTRD_SY2SB', -info )
321 ELSE IF( lquery )
THEN
333 CALL dcopy( lk, a( i-lk+1, i ), 1,
334 $ ab( kd+1-lk+1, i ), 1 )
338 lk = min( kd+1, n-i+1 )
339 CALL dcopy( lk, a( i, i ), 1, ab( 1, i ), 1 )
353 ls2 = lwmin - lt - lw - ls1
371 CALL dlaset(
"A", ldt, kd, zero, zero, work( tpos ), ldt )
374 DO 10 i = 1, n - kd, kd
376 pk = min( n-i-kd+1, kd )
380 CALL dgelqf( kd, pn, a( i, i+kd ), lda,
381 $ tau( i ), work( s2pos ), ls2, iinfo )
386 lk = min( kd, n-j ) + 1
387 CALL dcopy( lk, a( j, j ), lda, ab( kd+1, j ),
391 CALL dlaset(
'Lower', pk, pk, zero, one,
392 $ a( i, i+kd ), lda )
396 CALL dlarft(
'Forward',
'Rowwise', pn, pk,
397 $ a( i, i+kd ), lda, tau( i ),
398 $ work( tpos ), ldt )
402 CALL dgemm(
'Conjugate',
'No transpose', pk, pn, pk,
403 $ one, work( tpos ), ldt,
405 $ zero, work( s2pos ), lds2 )
407 CALL dsymm(
'Right', uplo, pk, pn,
408 $ one, a( i+kd, i+kd ), lda,
409 $ work( s2pos ), lds2,
410 $ zero, work( wpos ), ldw )
412 CALL dgemm(
'No transpose',
'Conjugate', pk, pk, pn,
413 $ one, work( wpos ), ldw,
414 $ work( s2pos ), lds2,
415 $ zero, work( s1pos ), lds1 )
417 CALL dgemm(
'No transpose',
'No transpose', pk, pn, pk,
418 $ -half, work( s1pos ), lds1,
420 $ one, work( wpos ), ldw )
426 CALL dsyr2k( uplo,
'Conjugate', pn, pk,
427 $ -one, a( i, i+kd ), lda,
429 $ rone, a( i+kd, i+kd ), lda )
435 lk = min(kd, n-j) + 1
436 CALL dcopy( lk, a( j, j ), lda, ab( kd+1, j ), ldab-1 )
443 DO 40 i = 1, n - kd, kd
445 pk = min( n-i-kd+1, kd )
449 CALL dgeqrf( pn, kd, a( i+kd, i ), lda,
450 $ tau( i ), work( s2pos ), ls2, iinfo )
455 lk = min( kd, n-j ) + 1
456 CALL dcopy( lk, a( j, j ), 1, ab( 1, j ), 1 )
459 CALL dlaset(
'Upper', pk, pk, zero, one,
460 $ a( i+kd, i ), lda )
464 CALL dlarft(
'Forward',
'Columnwise', pn, pk,
465 $ a( i+kd, i ), lda, tau( i ),
466 $ work( tpos ), ldt )
470 CALL dgemm(
'No transpose',
'No transpose', pn, pk, pk,
471 $ one, a( i+kd, i ), lda,
473 $ zero, work( s2pos ), lds2 )
475 CALL dsymm(
'Left', uplo, pn, pk,
476 $ one, a( i+kd, i+kd ), lda,
477 $ work( s2pos ), lds2,
478 $ zero, work( wpos ), ldw )
480 CALL dgemm(
'Conjugate',
'No transpose', pk, pk, pn,
481 $ one, work( s2pos ), lds2,
483 $ zero, work( s1pos ), lds1 )
485 CALL dgemm(
'No transpose',
'No transpose', pn, pk, pk,
486 $ -half, a( i+kd, i ), lda,
487 $ work( s1pos ), lds1,
488 $ one, work( wpos ), ldw )
494 CALL dsyr2k( uplo,
'No transpose', pn, pk,
495 $ -one, a( i+kd, i ), lda,
497 $ rone, a( i+kd, i+kd ), lda )
510 lk = min(kd, n-j) + 1
511 CALL dcopy( lk, a( j, j ), 1, ab( 1, j ), 1 )