249 SUBROUTINE chegvd( ITYPE, JOBZ, UPLO, N, A, LDA, B, LDB, W, WORK,
250 $ lwork, rwork, lrwork, iwork, liwork, info )
259 INTEGER info, itype, lda, ldb, liwork, lrwork, lwork, n
263 REAL rwork( * ), w( * )
264 COMPLEX a( lda, * ), b( ldb, * ), work( * )
271 parameter( cone = ( 1.0e+0, 0.0e+0 ) )
274 LOGICAL lquery, upper, wantz
276 INTEGER liopt, liwmin, lopt, lropt, lrwmin, lwmin
292 wantz =
lsame( jobz,
'V' )
293 upper =
lsame( uplo,
'U' )
294 lquery = ( lwork.EQ.-1 .OR. lrwork.EQ.-1 .OR. liwork.EQ.-1 )
301 ELSE IF( wantz )
THEN
303 lrwmin = 1 + 5*n + 2*n*n
313 IF( itype.LT.1 .OR. itype.GT.3 )
THEN
315 ELSE IF( .NOT.( wantz .OR.
lsame( jobz,
'N' ) ) )
THEN
317 ELSE IF( .NOT.( upper .OR.
lsame( uplo,
'L' ) ) )
THEN
319 ELSE IF( n.LT.0 )
THEN
321 ELSE IF( lda.LT.max( 1, n ) )
THEN
323 ELSE IF( ldb.LT.max( 1, n ) )
THEN
332 IF( lwork.LT.lwmin .AND. .NOT.lquery )
THEN
334 ELSE IF( lrwork.LT.lrwmin .AND. .NOT.lquery )
THEN
336 ELSE IF( liwork.LT.liwmin .AND. .NOT.lquery )
THEN
342 CALL
xerbla(
'CHEGVD', -info )
344 ELSE IF( lquery )
THEN
355 CALL
cpotrf( uplo, n, b, ldb, info )
363 CALL
chegst( itype, uplo, n, a, lda, b, ldb, info )
364 CALL
cheevd( jobz, uplo, n, a, lda, w, work, lwork, rwork, lrwork,
365 $ iwork, liwork, info )
366 lopt = max(
REAL( LOPT ),
REAL( WORK( 1 ) ) )
367 lropt = max(
REAL( LROPT ),
REAL( RWORK( 1 ) ) )
368 liopt = max(
REAL( LIOPT ),
REAL( IWORK( 1 ) ) )
370 IF( wantz .AND. info.EQ.0 )
THEN
374 IF( itype.EQ.1 .OR. itype.EQ.2 )
THEN
385 CALL
ctrsm(
'Left', uplo, trans,
'Non-unit', n, n, cone,
388 ELSE IF( itype.EQ.3 )
THEN
399 CALL
ctrmm(
'Left', uplo, trans,
'Non-unit', n, n, cone,