242 $ WORK, LWORK, INFO )
252 INTEGER INFO, LDA, LDAB, LWORK, N, KD
255 COMPLEX A( LDA, * ), AB( LDAB, * ),
256 $ tau( * ), work( * )
263 COMPLEX ZERO, ONE, HALF
264 parameter( rone = 1.0e+0,
265 $ zero = ( 0.0e+0, 0.0e+0 ),
266 $ one = ( 1.0e+0, 0.0e+0 ),
267 $ half = ( 0.5e+0, 0.0e+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, sroundup_lwork
295 upper = lsame( uplo,
'U' )
296 lquery = ( lwork.EQ.-1 )
297 lwmin = ilaenv2stage( 4,
'CHETRD_HE2HB',
'', n, kd, -1, -1 )
299 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
301 ELSE IF( n.LT.0 )
THEN
303 ELSE IF( kd.LT.0 )
THEN
305 ELSE IF( lda.LT.max( 1, n ) )
THEN
307 ELSE IF( ldab.LT.max( 1, kd+1 ) )
THEN
309 ELSE IF( lwork.LT.lwmin .AND. .NOT.lquery )
THEN
314 CALL xerbla(
'CHETRD_HE2HB', -info )
316 ELSE IF( lquery )
THEN
317 work( 1 ) = sroundup_lwork(lwmin)
328 CALL ccopy( lk, a( i-lk+1, i ), 1,
329 $ ab( kd+1-lk+1, i ), 1 )
333 lk = min( kd+1, n-i+1 )
334 CALL ccopy( lk, a( i, i ), 1, ab( 1, i ), 1 )
348 ls2 = lwmin - lt - lw - ls1
366 CALL claset(
"A", ldt, kd, zero, zero, work( tpos ), ldt )
369 DO 10 i = 1, n - kd, kd
371 pk = min( n-i-kd+1, kd )
375 CALL cgelqf( kd, pn, a( i, i+kd ), lda,
376 $ tau( i ), work( s2pos ), ls2, iinfo )
381 lk = min( kd, n-j ) + 1
382 CALL ccopy( lk, a( j, j ), lda, ab( kd+1, j ), ldab-1 )
385 CALL claset(
'Lower', pk, pk, zero, one,
386 $ a( i, i+kd ), lda )
390 CALL clarft(
'Forward',
'Rowwise', pn, pk,
391 $ a( i, i+kd ), lda, tau( i ),
392 $ work( tpos ), ldt )
396 CALL cgemm(
'Conjugate',
'No transpose', pk, pn, pk,
397 $ one, work( tpos ), ldt,
399 $ zero, work( s2pos ), lds2 )
401 CALL chemm(
'Right', uplo, pk, pn,
402 $ one, a( i+kd, i+kd ), lda,
403 $ work( s2pos ), lds2,
404 $ zero, work( wpos ), ldw )
406 CALL cgemm(
'No transpose',
'Conjugate', pk, pk, pn,
407 $ one, work( wpos ), ldw,
408 $ work( s2pos ), lds2,
409 $ zero, work( s1pos ), lds1 )
411 CALL cgemm(
'No transpose',
'No transpose', pk, pn, pk,
412 $ -half, work( s1pos ), lds1,
414 $ one, work( wpos ), ldw )
420 CALL cher2k( uplo,
'Conjugate', pn, pk,
421 $ -one, a( i, i+kd ), lda,
423 $ rone, a( i+kd, i+kd ), lda )
429 lk = min(kd, n-j) + 1
430 CALL ccopy( lk, a( j, j ), lda, ab( kd+1, j ), ldab-1 )
437 DO 40 i = 1, n - kd, kd
439 pk = min( n-i-kd+1, kd )
443 CALL cgeqrf( pn, kd, a( i+kd, i ), lda,
444 $ tau( i ), work( s2pos ), ls2, iinfo )
449 lk = min( kd, n-j ) + 1
450 CALL ccopy( lk, a( j, j ), 1, ab( 1, j ), 1 )
453 CALL claset(
'Upper', pk, pk, zero, one,
454 $ a( i+kd, i ), lda )
458 CALL clarft(
'Forward',
'Columnwise', pn, pk,
459 $ a( i+kd, i ), lda, tau( i ),
460 $ work( tpos ), ldt )
464 CALL cgemm(
'No transpose',
'No transpose', pn, pk, pk,
465 $ one, a( i+kd, i ), lda,
467 $ zero, work( s2pos ), lds2 )
469 CALL chemm(
'Left', uplo, pn, pk,
470 $ one, a( i+kd, i+kd ), lda,
471 $ work( s2pos ), lds2,
472 $ zero, work( wpos ), ldw )
474 CALL cgemm(
'Conjugate',
'No transpose', pk, pk, pn,
475 $ one, work( s2pos ), lds2,
477 $ zero, work( s1pos ), lds1 )
479 CALL cgemm(
'No transpose',
'No transpose', pn, pk, pk,
480 $ -half, a( i+kd, i ), lda,
481 $ work( s1pos ), lds1,
482 $ one, work( wpos ), ldw )
488 CALL cher2k( uplo,
'No transpose', pn, pk,
489 $ -one, a( i+kd, i ), lda,
491 $ rone, a( i+kd, i+kd ), lda )
504 lk = min(kd, n-j) + 1
505 CALL ccopy( lk, a( j, j ), 1, ab( 1, j ), 1 )
510 work( 1 ) = sroundup_lwork(lwmin)
subroutine xerbla(srname, info)
subroutine ccopy(n, cx, incx, cy, incy)
CCOPY
subroutine cgelqf(m, n, a, lda, tau, work, lwork, info)
CGELQF
subroutine cgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
CGEMM
subroutine cgeqrf(m, n, a, lda, tau, work, lwork, info)
CGEQRF
subroutine chemm(side, uplo, m, n, alpha, a, lda, b, ldb, beta, c, ldc)
CHEMM
subroutine cher2k(uplo, trans, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
CHER2K
subroutine chetrd_he2hb(uplo, n, kd, a, lda, ab, ldab, tau, work, lwork, info)
CHETRD_HE2HB
subroutine clarft(direct, storev, n, k, v, ldv, tau, t, ldt)
CLARFT forms the triangular factor T of a block reflector H = I - vtvH
subroutine claset(uplo, m, n, alpha, beta, a, lda)
CLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.