224 SUBROUTINE dgegs( JOBVSL, JOBVSR, N, A, LDA, B, LDB, ALPHAR,
225 $ ALPHAI, BETA, VSL, LDVSL, VSR, LDVSR, WORK,
233 CHARACTER JOBVSL, JOBVSR
234 INTEGER INFO, LDA, LDB, LDVSL, LDVSR, LWORK, N
237 DOUBLE PRECISION A( LDA, * ), ALPHAI( * ), ALPHAR( * ),
238 $ B( LDB, * ), BETA( * ), VSL( LDVSL, * ),
239 $ vsr( ldvsr, * ), work( * )
245 DOUBLE PRECISION ZERO, ONE
246 PARAMETER ( ZERO = 0.0d0, one = 1.0d0 )
249 LOGICAL ILASCL, ILBSCL, ILVSL, ILVSR, LQUERY
250 INTEGER ICOLS, IHI, IINFO, IJOBVL, IJOBVR, ILEFT, ILO,
251 $ iright, irows, itau, iwork, lopt, lwkmin,
252 $ lwkopt, nb, nb1, nb2, nb3
253 DOUBLE PRECISION ANRM, ANRMTO, BIGNUM, BNRM, BNRMTO, EPS,
263 DOUBLE PRECISION DLAMCH, DLANGE
264 EXTERNAL lsame, ilaenv, dlamch, dlange
273 IF( lsame( jobvsl,
'N' ) )
THEN
276 ELSE IF( lsame( jobvsl,
'V' ) )
THEN
284 IF( lsame( jobvsr,
'N' ) )
THEN
287 ELSE IF( lsame( jobvsr,
'V' ) )
THEN
297 lwkmin = max( 4*n, 1 )
300 lquery = ( lwork.EQ.-1 )
302 IF( ijobvl.LE.0 )
THEN
304 ELSE IF( ijobvr.LE.0 )
THEN
306 ELSE IF( n.LT.0 )
THEN
308 ELSE IF( lda.LT.max( 1, n ) )
THEN
310 ELSE IF( ldb.LT.max( 1, n ) )
THEN
312 ELSE IF( ldvsl.LT.1 .OR. ( ilvsl .AND. ldvsl.LT.n ) )
THEN
314 ELSE IF( ldvsr.LT.1 .OR. ( ilvsr .AND. ldvsr.LT.n ) )
THEN
316 ELSE IF( lwork.LT.lwkmin .AND. .NOT.lquery )
THEN
321 nb1 = ilaenv( 1,
'DGEQRF',
' ', n, n, -1, -1 )
322 nb2 = ilaenv( 1,
'DORMQR',
' ', n, n, n, -1 )
323 nb3 = ilaenv( 1,
'DORGQR',
' ', n, n, n, -1 )
324 nb = max( nb1, nb2, nb3 )
325 lopt = 2*n + n*( nb+1 )
330 CALL xerbla(
'DGEGS ', -info )
332 ELSE IF( lquery )
THEN
343 eps = dlamch(
'E' )*dlamch(
'B' )
344 safmin = dlamch(
'S' )
345 smlnum = n*safmin / eps
346 bignum = one / smlnum
350 anrm = dlange(
'M', n, n, a, lda, work )
352 IF( anrm.GT.zero .AND. anrm.LT.smlnum )
THEN
355 ELSE IF( anrm.GT.bignum )
THEN
361 CALL dlascl(
'G', -1, -1, anrm, anrmto, n, n, a, lda, iinfo )
362 IF( iinfo.NE.0 )
THEN
370 bnrm = dlange(
'M', n, n, b, ldb, work )
372 IF( bnrm.GT.zero .AND. bnrm.LT.smlnum )
THEN
375 ELSE IF( bnrm.GT.bignum )
THEN
381 CALL dlascl(
'G', -1, -1, bnrm, bnrmto, n, n, b, ldb, iinfo )
382 IF( iinfo.NE.0 )
THEN
395 CALL dggbal(
'P', n, a, lda, b, ldb, ilo, ihi, work( ileft ),
396 $ work( iright ), work( iwork ), iinfo )
397 IF( iinfo.NE.0 )
THEN
406 irows = ihi + 1 - ilo
410 CALL dgeqrf( irows, icols, b( ilo, ilo ), ldb, work( itau ),
411 $ work( iwork ), lwork+1-iwork, iinfo )
413 $ lwkopt = max( lwkopt, int( work( iwork ) )+iwork-1 )
414 IF( iinfo.NE.0 )
THEN
419 CALL dormqr(
'L',
'T', irows, icols, irows, b( ilo, ilo ), ldb,
420 $ work( itau ), a( ilo, ilo ), lda, work( iwork ),
421 $ lwork+1-iwork, iinfo )
423 $ lwkopt = max( lwkopt, int( work( iwork ) )+iwork-1 )
424 IF( iinfo.NE.0 )
THEN
430 CALL dlaset(
'Full', n, n, zero, one, vsl, ldvsl )
431 CALL dlacpy(
'L', irows-1, irows-1, b( ilo+1, ilo ), ldb,
432 $ vsl( ilo+1, ilo ), ldvsl )
433 CALL dorgqr( irows, irows, irows, vsl( ilo, ilo ), ldvsl,
434 $ work( itau ), work( iwork ), lwork+1-iwork,
437 $ lwkopt = max( lwkopt, int( work( iwork ) )+iwork-1 )
438 IF( iinfo.NE.0 )
THEN
445 $
CALL dlaset(
'Full', n, n, zero, one, vsr, ldvsr )
449 CALL dgghrd( jobvsl, jobvsr, n, ilo, ihi, a, lda, b, ldb, vsl,
450 $ ldvsl, vsr, ldvsr, iinfo )
451 IF( iinfo.NE.0 )
THEN
461 CALL dhgeqz(
'S', jobvsl, jobvsr, n, ilo, ihi, a, lda, b, ldb,
462 $ alphar, alphai, beta, vsl, ldvsl, vsr, ldvsr,
463 $ work( iwork ), lwork+1-iwork, iinfo )
465 $ lwkopt = max( lwkopt, int( work( iwork ) )+iwork-1 )
466 IF( iinfo.NE.0 )
THEN
467 IF( iinfo.GT.0 .AND. iinfo.LE.n )
THEN
469 ELSE IF( iinfo.GT.n .AND. iinfo.LE.2*n )
THEN
480 CALL dggbak(
'P',
'L', n, ilo, ihi, work( ileft ),
481 $ work( iright ), n, vsl, ldvsl, iinfo )
482 IF( iinfo.NE.0 )
THEN
488 CALL dggbak(
'P',
'R', n, ilo, ihi, work( ileft ),
489 $ work( iright ), n, vsr, ldvsr, iinfo )
490 IF( iinfo.NE.0 )
THEN
499 CALL dlascl(
'H', -1, -1, anrmto, anrm, n, n, a, lda, iinfo )
500 IF( iinfo.NE.0 )
THEN
504 CALL dlascl(
'G', -1, -1, anrmto, anrm, n, 1, alphar, n,
506 IF( iinfo.NE.0 )
THEN
510 CALL dlascl(
'G', -1, -1, anrmto, anrm, n, 1, alphai, n,
512 IF( iinfo.NE.0 )
THEN
519 CALL dlascl(
'U', -1, -1, bnrmto, bnrm, n, n, b, ldb, iinfo )
520 IF( iinfo.NE.0 )
THEN
524 CALL dlascl(
'G', -1, -1, bnrmto, bnrm, n, 1, beta, n, iinfo )
525 IF( iinfo.NE.0 )
THEN
subroutine xerbla(srname, info)
subroutine dgegs(jobvsl, jobvsr, n, a, lda, b, ldb, alphar, alphai, beta, vsl, ldvsl, vsr, ldvsr, work, lwork, info)
DGEGS computes the eigenvalues, real Schur form, and, optionally, the left and/or right Schur vectors...
subroutine dgeqrf(m, n, a, lda, tau, work, lwork, info)
DGEQRF
subroutine dggbak(job, side, n, ilo, ihi, lscale, rscale, m, v, ldv, info)
DGGBAK
subroutine dggbal(job, n, a, lda, b, ldb, ilo, ihi, lscale, rscale, work, info)
DGGBAL
subroutine dgghrd(compq, compz, n, ilo, ihi, a, lda, b, ldb, q, ldq, z, ldz, info)
DGGHRD
subroutine dhgeqz(job, compq, compz, n, ilo, ihi, h, ldh, t, ldt, alphar, alphai, beta, q, ldq, z, ldz, work, lwork, info)
DHGEQZ
subroutine dlacpy(uplo, m, n, a, lda, b, ldb)
DLACPY copies all or part of one two-dimensional array to another.
subroutine dlascl(type, kl, ku, cfrom, cto, m, n, a, lda, info)
DLASCL multiplies a general rectangular matrix by a real scalar defined as cto/cfrom.
subroutine dlaset(uplo, m, n, alpha, beta, a, lda)
DLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
subroutine dorgqr(m, n, k, a, lda, tau, work, lwork, info)
DORGQR
subroutine dormqr(side, trans, m, n, k, a, lda, tau, c, ldc, work, lwork, info)
DORMQR