1 SUBROUTINE dgeev( JOBVL, JOBVR, N, A, LDA, WR, WI, VL, LDVL, VR,
2 $ LDVR, WORK, LWORK, INFO )
10 CHARACTER JOBVL, JOBVR
11 INTEGER INFO, LDA, LDVL, LDVR, LWORK, N
14 DOUBLE PRECISION A( LDA, * ), VL( LDVL, * ), VR( LDVR, * ),
15 $ wi( * ), work( * ), wr( * )
117 DOUBLE PRECISION ZERO, ONE
118 parameter( zero = 0.0d0, one = 1.0d0 )
121 LOGICAL LQUERY, SCALEA, WANTVL, WANTVR
123 INTEGER HSWORK, I, IBAL, IERR, IHI, ILO, ITAU, IWRK, K,
124 $ maxb, maxwrk, minwrk, nout
125 DOUBLE PRECISION ANRM, BIGNUM, CS, CSCALE, EPS, R, SCL, SMLNUM,
130 DOUBLE PRECISION DUM( 1 )
138 INTEGER IDAMAX, ILAENV
139 DOUBLE PRECISION DLAMCH, DLANGE, DLAPY2, DNRM2
140 EXTERNAL lsame, idamax, ilaenv, dlamch, dlange, dlapy2,
144 INTRINSIC max, min, sqrt
151 lquery = ( lwork.EQ.-1 )
152 wantvl = lsame( jobvl,
'V' )
153 wantvr = lsame( jobvr,
'V' )
154 IF( ( .NOT.wantvl ) .AND. ( .NOT.lsame( jobvl,
'N' ) ) )
THEN
156 ELSE IF( ( .NOT.wantvr ) .AND. ( .NOT.lsame( jobvr,
'N' ) ) )
THEN
158 ELSE IF( n.LT.0 )
THEN
160 ELSE IF( lda.LT.max( 1, n ) )
THEN
162 ELSE IF( ldvl.LT.1 .OR. ( wantvl .AND. ldvl.LT.n ) )
THEN
164 ELSE IF( ldvr.LT.1 .OR. ( wantvr .AND. ldvr.LT.n ) )
THEN
179 IF( info.EQ.0 .AND. ( lwork.GE.1 .OR. lquery ) )
THEN
180 maxwrk = 2*n + n*ilaenv( 1,
'DGEHRD',
' ', n, 1, n, 0 )
181 IF( ( .NOT.wantvl ) .AND. ( .NOT.wantvr ) )
THEN
182 minwrk = max( 1, 3*n )
183 maxb = max( ilaenv( 8,
'DHSEQR',
'EN', n, 1, n, -1 ), 2 )
184 k = min( maxb, n, max( 2, ilaenv( 4,
'DHSEQR',
'EN', n, 1,
186 hswork = max( k*( k+2 ), 2*n )
187 maxwrk = max( maxwrk, n+1, n+hswork )
189 minwrk = max( 1, 4*n )
190 maxwrk = max( maxwrk, 2*n+( n-1 )*
191 $ ilaenv( 1,
'DORGHR',
' ', n, 1, n, -1 ) )
192 maxb = max( ilaenv( 8,
'DHSEQR',
'SV', n, 1, n, -1 ), 2 )
193 k = min( maxb, n, max( 2, ilaenv( 4,
'DHSEQR',
'SV', n, 1,
195 hswork = max( k*( k+2 ), 2*n )
196 maxwrk = max( maxwrk, n+1, n+hswork )
197 maxwrk = max( maxwrk, 4*n )
201 IF( lwork.LT.minwrk .AND. .NOT.lquery )
THEN
205 CALL xerbla(
'DGEEV ', -info )
207 ELSE IF( lquery )
THEN
219 smlnum = dlamch(
'S' )
220 bignum = one / smlnum
221 CALL dlabad( smlnum, bignum )
222 smlnum = sqrt( smlnum ) / eps
223 bignum = one / smlnum
227 anrm = dlange(
'M', n, n, a, lda, dum )
229 IF( anrm.GT.zero .AND. anrm.LT.smlnum )
THEN
232 ELSE IF( anrm.GT.bignum )
THEN
237 $
CALL dlascl(
'G', 0, 0, anrm, cscale, n, n, a, lda, ierr )
243 CALL dgebal(
'B', n, a, lda, ilo, ihi, work( ibal ), ierr )
250 CALL dgehrd( n, ilo, ihi, a, lda, work( itau ), work( iwrk ),
251 $ lwork-iwrk+1, ierr )
259 CALL dlacpy(
'L', n, n, a, lda, vl, ldvl )
264 CALL dorghr( n, ilo, ihi, vl, ldvl, work( itau ), work( iwrk ),
265 $ lwork-iwrk+1, ierr )
271 CALL dhseqr(
'S',
'V', n, ilo, ihi, a, lda, wr, wi, vl, ldvl,
272 $ work( iwrk ), lwork-iwrk+1, info )
280 CALL dlacpy(
'F', n, n, vl, ldvl, vr, ldvr )
283 ELSE IF( wantvr )
THEN
289 CALL dlacpy(
'L', n, n, a, lda, vr, ldvr )
294 CALL dorghr( n, ilo, ihi, vr, ldvr, work( itau ), work( iwrk ),
295 $ lwork-iwrk+1, ierr )
301 CALL dhseqr(
'S',
'V', n, ilo, ihi, a, lda, wr, wi, vr, ldvr,
302 $ work( iwrk ), lwork-iwrk+1, info )
310 CALL dhseqr(
'E',
'N', n, ilo, ihi, a, lda, wr, wi, vr, ldvr,
311 $ work( iwrk ), lwork-iwrk+1, info )
319 IF( wantvl .OR. wantvr )
THEN
324 CALL dtrevc( side,
'B',
SELECT, n, a, lda, vl, ldvl, vr, ldvr,
325 $ n, nout, work( iwrk ), ierr )
333 CALL dgebak(
'B',
'L', n, ilo, ihi, work( ibal ), n, vl, ldvl,
339 IF( wi( i ).EQ.zero )
THEN
340 scl = one / dnrm2( n, vl( 1, i ), 1 )
341 CALL dscal( n, scl, vl( 1, i ), 1 )
342 ELSE IF( wi( i ).GT.zero )
THEN
343 scl = one / dlapy2( dnrm2( n, vl( 1, i ), 1 ),
344 $ dnrm2( n, vl( 1, i+1 ), 1 ) )
345 CALL dscal( n, scl, vl( 1, i ), 1 )
346 CALL dscal( n, scl, vl( 1, i+1 ), 1 )
348 work( iwrk+k-1 ) = vl( k, i )**2 + vl( k, i+1 )**2
350 k = idamax( n, work( iwrk ), 1 )
351 CALL dlartg( vl( k, i ), vl( k, i+1 ), cs, sn, r )
352 CALL drot( n, vl( 1, i ), 1, vl( 1, i+1 ), 1, cs, sn )
363 CALL dgebak(
'B',
'R', n, ilo, ihi, work( ibal ), n, vr, ldvr,
369 IF( wi( i ).EQ.zero )
THEN
370 scl = one / dnrm2( n, vr( 1, i ), 1 )
371 CALL dscal( n, scl, vr( 1, i ), 1 )
372 ELSE IF( wi( i ).GT.zero )
THEN
373 scl = one / dlapy2( dnrm2( n, vr( 1, i ), 1 ),
374 $ dnrm2( n, vr( 1, i+1 ), 1 ) )
375 CALL dscal( n, scl, vr( 1, i ), 1 )
376 CALL dscal( n, scl, vr( 1, i+1 ), 1 )
378 work( iwrk+k-1 ) = vr( k, i )**2 + vr( k, i+1 )**2
380 k = idamax( n, work( iwrk ), 1 )
381 CALL dlartg( vr( k, i ), vr( k, i+1 ), cs, sn, r )
382 CALL drot( n, vr( 1, i ), 1, vr( 1, i+1 ), 1, cs, sn )
392 CALL dlascl(
'G', 0, 0, cscale, anrm, n-info, 1, wr( info+1 ),
393 $ max( n-info, 1 ), ierr )
394 CALL dlascl(
'G', 0, 0, cscale, anrm, n-info, 1, wi( info+1 ),
395 $ max( n-info, 1 ), ierr )
397 CALL dlascl(
'G', 0, 0, cscale, anrm, ilo-1, 1, wr, n,
399 CALL dlascl(
'G', 0, 0, cscale, anrm, ilo-1, 1, wi, n,
subroutine dgebak(JOB, SIDE, N, ILO, IHI, SCALE, M, V, LDV, INFO)
subroutine dgebal(JOB, N, A, LDA, ILO, IHI, SCALE, INFO)
subroutine dgeev(JOBVL, JOBVR, N, A, LDA, WR, WI, VL, LDVL, VR, LDVR, WORK, LWORK, INFO)
subroutine dgehrd(N, ILO, IHI, A, LDA, TAU, WORK, LWORK, INFO)
subroutine dhseqr(JOB, COMPZ, N, ILO, IHI, H, LDH, WR, WI, Z, LDZ, WORK, LWORK, INFO)
subroutine dlabad(SMALL, LARGE)
subroutine dlacpy(UPLO, M, N, A, LDA, B, LDB)
subroutine dlartg(F, G, CS, SN, R)
subroutine dlascl(TYPE, KL, KU, CFROM, CTO, M, N, A, LDA, INFO)
subroutine dorghr(N, ILO, IHI, A, LDA, TAU, WORK, LWORK, INFO)
subroutine drot(n, dx, incx, dy, incy, c, s)
subroutine dscal(n, da, dx, incx)
subroutine dtrevc(SIDE, HOWMNY, SELECT, N, T, LDT, VL, LDVL, VR, LDVR, MM, M, WORK, INFO)
subroutine xerbla(SRNAME, INFO)