LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
cgegv.f
Go to the documentation of this file.
1*> \brief <b> CGEGV computes the eigenvalues and, optionally, the left and/or right eigenvectors of a complex matrix pair (A,B).</b>
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download CGEGV + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/cgegv.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/cgegv.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgegv.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE CGEGV( JOBVL, JOBVR, N, A, LDA, B, LDB, ALPHA, BETA,
20* VL, LDVL, VR, LDVR, WORK, LWORK, RWORK, INFO )
21*
22* .. Scalar Arguments ..
23* CHARACTER JOBVL, JOBVR
24* INTEGER INFO, LDA, LDB, LDVL, LDVR, LWORK, N
25* ..
26* .. Array Arguments ..
27* REAL RWORK( * )
28* COMPLEX A( LDA, * ), ALPHA( * ), B( LDB, * ),
29* $ BETA( * ), VL( LDVL, * ), VR( LDVR, * ),
30* $ WORK( * )
31* ..
32*
33*
34*> \par Purpose:
35* =============
36*>
37*> \verbatim
38*>
39*> This routine is deprecated and has been replaced by routine CGGEV.
40*>
41*> CGEGV computes the eigenvalues and, optionally, the left and/or right
42*> eigenvectors of a complex matrix pair (A,B).
43*> Given two square matrices A and B,
44*> the generalized nonsymmetric eigenvalue problem (GNEP) is to find the
45*> eigenvalues lambda and corresponding (non-zero) eigenvectors x such
46*> that
47*> A*x = lambda*B*x.
48*>
49*> An alternate form is to find the eigenvalues mu and corresponding
50*> eigenvectors y such that
51*> mu*A*y = B*y.
52*>
53*> These two forms are equivalent with mu = 1/lambda and x = y if
54*> neither lambda nor mu is zero. In order to deal with the case that
55*> lambda or mu is zero or small, two values alpha and beta are returned
56*> for each eigenvalue, such that lambda = alpha/beta and
57*> mu = beta/alpha.
58*>
59*> The vectors x and y in the above equations are right eigenvectors of
60*> the matrix pair (A,B). Vectors u and v satisfying
61*> u**H*A = lambda*u**H*B or mu*v**H*A = v**H*B
62*> are left eigenvectors of (A,B).
63*>
64*> Note: this routine performs "full balancing" on A and B
65*> \endverbatim
66*
67* Arguments:
68* ==========
69*
70*> \param[in] JOBVL
71*> \verbatim
72*> JOBVL is CHARACTER*1
73*> = 'N': do not compute the left generalized eigenvectors;
74*> = 'V': compute the left generalized eigenvectors (returned
75*> in VL).
76*> \endverbatim
77*>
78*> \param[in] JOBVR
79*> \verbatim
80*> JOBVR is CHARACTER*1
81*> = 'N': do not compute the right generalized eigenvectors;
82*> = 'V': compute the right generalized eigenvectors (returned
83*> in VR).
84*> \endverbatim
85*>
86*> \param[in] N
87*> \verbatim
88*> N is INTEGER
89*> The order of the matrices A, B, VL, and VR. N >= 0.
90*> \endverbatim
91*>
92*> \param[in,out] A
93*> \verbatim
94*> A is COMPLEX array, dimension (LDA, N)
95*> On entry, the matrix A.
96*> If JOBVL = 'V' or JOBVR = 'V', then on exit A
97*> contains the Schur form of A from the generalized Schur
98*> factorization of the pair (A,B) after balancing. If no
99*> eigenvectors were computed, then only the diagonal elements
100*> of the Schur form will be correct. See CGGHRD and CHGEQZ
101*> for details.
102*> \endverbatim
103*>
104*> \param[in] LDA
105*> \verbatim
106*> LDA is INTEGER
107*> The leading dimension of A. LDA >= max(1,N).
108*> \endverbatim
109*>
110*> \param[in,out] B
111*> \verbatim
112*> B is COMPLEX array, dimension (LDB, N)
113*> On entry, the matrix B.
114*> If JOBVL = 'V' or JOBVR = 'V', then on exit B contains the
115*> upper triangular matrix obtained from B in the generalized
116*> Schur factorization of the pair (A,B) after balancing.
117*> If no eigenvectors were computed, then only the diagonal
118*> elements of B will be correct. See CGGHRD and CHGEQZ for
119*> details.
120*> \endverbatim
121*>
122*> \param[in] LDB
123*> \verbatim
124*> LDB is INTEGER
125*> The leading dimension of B. LDB >= max(1,N).
126*> \endverbatim
127*>
128*> \param[out] ALPHA
129*> \verbatim
130*> ALPHA is COMPLEX array, dimension (N)
131*> The complex scalars alpha that define the eigenvalues of
132*> GNEP.
133*> \endverbatim
134*>
135*> \param[out] BETA
136*> \verbatim
137*> BETA is COMPLEX array, dimension (N)
138*> The complex scalars beta that define the eigenvalues of GNEP.
139*>
140*> Together, the quantities alpha = ALPHA(j) and beta = BETA(j)
141*> represent the j-th eigenvalue of the matrix pair (A,B), in
142*> one of the forms lambda = alpha/beta or mu = beta/alpha.
143*> Since either lambda or mu may overflow, they should not,
144*> in general, be computed.
145*> \endverbatim
146*>
147*> \param[out] VL
148*> \verbatim
149*> VL is COMPLEX array, dimension (LDVL,N)
150*> If JOBVL = 'V', the left eigenvectors u(j) are stored
151*> in the columns of VL, in the same order as their eigenvalues.
152*> Each eigenvector is scaled so that its largest component has
153*> abs(real part) + abs(imag. part) = 1, except for eigenvectors
154*> corresponding to an eigenvalue with alpha = beta = 0, which
155*> are set to zero.
156*> Not referenced if JOBVL = 'N'.
157*> \endverbatim
158*>
159*> \param[in] LDVL
160*> \verbatim
161*> LDVL is INTEGER
162*> The leading dimension of the matrix VL. LDVL >= 1, and
163*> if JOBVL = 'V', LDVL >= N.
164*> \endverbatim
165*>
166*> \param[out] VR
167*> \verbatim
168*> VR is COMPLEX array, dimension (LDVR,N)
169*> If JOBVR = 'V', the right eigenvectors x(j) are stored
170*> in the columns of VR, in the same order as their eigenvalues.
171*> Each eigenvector is scaled so that its largest component has
172*> abs(real part) + abs(imag. part) = 1, except for eigenvectors
173*> corresponding to an eigenvalue with alpha = beta = 0, which
174*> are set to zero.
175*> Not referenced if JOBVR = 'N'.
176*> \endverbatim
177*>
178*> \param[in] LDVR
179*> \verbatim
180*> LDVR is INTEGER
181*> The leading dimension of the matrix VR. LDVR >= 1, and
182*> if JOBVR = 'V', LDVR >= N.
183*> \endverbatim
184*>
185*> \param[out] WORK
186*> \verbatim
187*> WORK is COMPLEX array, dimension (MAX(1,LWORK))
188*> On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
189*> \endverbatim
190*>
191*> \param[in] LWORK
192*> \verbatim
193*> LWORK is INTEGER
194*> The dimension of the array WORK. LWORK >= max(1,2*N).
195*> For good performance, LWORK must generally be larger.
196*> To compute the optimal value of LWORK, call ILAENV to get
197*> blocksizes (for CGEQRF, CUNMQR, and CUNGQR.) Then compute:
198*> NB -- MAX of the blocksizes for CGEQRF, CUNMQR, and CUNGQR;
199*> The optimal LWORK is MAX( 2*N, N*(NB+1) ).
200*>
201*> If LWORK = -1, then a workspace query is assumed; the routine
202*> only calculates the optimal size of the WORK array, returns
203*> this value as the first entry of the WORK array, and no error
204*> message related to LWORK is issued by XERBLA.
205*> \endverbatim
206*>
207*> \param[out] RWORK
208*> \verbatim
209*> RWORK is REAL array, dimension (8*N)
210*> \endverbatim
211*>
212*> \param[out] INFO
213*> \verbatim
214*> INFO is INTEGER
215*> = 0: successful exit
216*> < 0: if INFO = -i, the i-th argument had an illegal value.
217*> =1,...,N:
218*> The QZ iteration failed. No eigenvectors have been
219*> calculated, but ALPHA(j) and BETA(j) should be
220*> correct for j=INFO+1,...,N.
221*> > N: errors that usually indicate LAPACK problems:
222*> =N+1: error return from CGGBAL
223*> =N+2: error return from CGEQRF
224*> =N+3: error return from CUNMQR
225*> =N+4: error return from CUNGQR
226*> =N+5: error return from CGGHRD
227*> =N+6: error return from CHGEQZ (other than failed
228*> iteration)
229*> =N+7: error return from CTGEVC
230*> =N+8: error return from CGGBAK (computing VL)
231*> =N+9: error return from CGGBAK (computing VR)
232*> =N+10: error return from CLASCL (various calls)
233*> \endverbatim
234*
235* Authors:
236* ========
237*
238*> \author Univ. of Tennessee
239*> \author Univ. of California Berkeley
240*> \author Univ. of Colorado Denver
241*> \author NAG Ltd.
242*
243*> \ingroup complexGEeigen
244*
245*> \par Further Details:
246* =====================
247*>
248*> \verbatim
249*>
250*> Balancing
251*> ---------
252*>
253*> This driver calls CGGBAL to both permute and scale rows and columns
254*> of A and B. The permutations PL and PR are chosen so that PL*A*PR
255*> and PL*B*R will be upper triangular except for the diagonal blocks
256*> A(i:j,i:j) and B(i:j,i:j), with i and j as close together as
257*> possible. The diagonal scaling matrices DL and DR are chosen so
258*> that the pair DL*PL*A*PR*DR, DL*PL*B*PR*DR have elements close to
259*> one (except for the elements that start out zero.)
260*>
261*> After the eigenvalues and eigenvectors of the balanced matrices
262*> have been computed, CGGBAK transforms the eigenvectors back to what
263*> they would have been (in perfect arithmetic) if they had not been
264*> balanced.
265*>
266*> Contents of A and B on Exit
267*> -------- -- - --- - -- ----
268*>
269*> If any eigenvectors are computed (either JOBVL='V' or JOBVR='V' or
270*> both), then on exit the arrays A and B will contain the complex Schur
271*> form[*] of the "balanced" versions of A and B. If no eigenvectors
272*> are computed, then only the diagonal blocks will be correct.
273*>
274*> [*] In other words, upper triangular form.
275*> \endverbatim
276*>
277* =====================================================================
278 SUBROUTINE cgegv( JOBVL, JOBVR, N, A, LDA, B, LDB, ALPHA, BETA,
279 $ VL, LDVL, VR, LDVR, WORK, LWORK, RWORK, INFO )
280*
281* -- LAPACK driver routine --
282* -- LAPACK is a software package provided by Univ. of Tennessee, --
283* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
284*
285* .. Scalar Arguments ..
286 CHARACTER JOBVL, JOBVR
287 INTEGER INFO, LDA, LDB, LDVL, LDVR, LWORK, N
288* ..
289* .. Array Arguments ..
290 REAL RWORK( * )
291 COMPLEX A( LDA, * ), ALPHA( * ), B( LDB, * ),
292 $ beta( * ), vl( ldvl, * ), vr( ldvr, * ),
293 $ work( * )
294* ..
295*
296* =====================================================================
297*
298* .. Parameters ..
299 REAL ZERO, ONE
300 parameter( zero = 0.0e0, one = 1.0e0 )
301 COMPLEX CZERO, CONE
302 parameter( czero = ( 0.0e0, 0.0e0 ),
303 $ cone = ( 1.0e0, 0.0e0 ) )
304* ..
305* .. Local Scalars ..
306 LOGICAL ILIMIT, ILV, ILVL, ILVR, LQUERY
307 CHARACTER CHTEMP
308 INTEGER ICOLS, IHI, IINFO, IJOBVL, IJOBVR, ILEFT, ILO,
309 $ in, iright, irows, irwork, itau, iwork, jc, jr,
310 $ lopt, lwkmin, lwkopt, nb, nb1, nb2, nb3
311 REAL ABSAI, ABSAR, ABSB, ANRM, ANRM1, ANRM2, BNRM,
312 $ bnrm1, bnrm2, eps, safmax, safmin, salfai,
313 $ salfar, sbeta, scale, temp
314 COMPLEX X
315* ..
316* .. Local Arrays ..
317 LOGICAL LDUMMA( 1 )
318* ..
319* .. External Subroutines ..
320 EXTERNAL cgeqrf, cggbak, cggbal, cgghrd, chgeqz, clacpy,
322* ..
323* .. External Functions ..
324 LOGICAL LSAME
325 INTEGER ILAENV
326 REAL CLANGE, SLAMCH
327 EXTERNAL ilaenv, lsame, clange, slamch
328* ..
329* .. Intrinsic Functions ..
330 INTRINSIC abs, aimag, cmplx, int, max, real
331* ..
332* .. Statement Functions ..
333 REAL ABS1
334* ..
335* .. Statement Function definitions ..
336 abs1( x ) = abs( real( x ) ) + abs( aimag( x ) )
337* ..
338* .. Executable Statements ..
339*
340* Decode the input arguments
341*
342 IF( lsame( jobvl, 'N' ) ) THEN
343 ijobvl = 1
344 ilvl = .false.
345 ELSE IF( lsame( jobvl, 'V' ) ) THEN
346 ijobvl = 2
347 ilvl = .true.
348 ELSE
349 ijobvl = -1
350 ilvl = .false.
351 END IF
352*
353 IF( lsame( jobvr, 'N' ) ) THEN
354 ijobvr = 1
355 ilvr = .false.
356 ELSE IF( lsame( jobvr, 'V' ) ) THEN
357 ijobvr = 2
358 ilvr = .true.
359 ELSE
360 ijobvr = -1
361 ilvr = .false.
362 END IF
363 ilv = ilvl .OR. ilvr
364*
365* Test the input arguments
366*
367 lwkmin = max( 2*n, 1 )
368 lwkopt = lwkmin
369 work( 1 ) = lwkopt
370 lquery = ( lwork.EQ.-1 )
371 info = 0
372 IF( ijobvl.LE.0 ) THEN
373 info = -1
374 ELSE IF( ijobvr.LE.0 ) THEN
375 info = -2
376 ELSE IF( n.LT.0 ) THEN
377 info = -3
378 ELSE IF( lda.LT.max( 1, n ) ) THEN
379 info = -5
380 ELSE IF( ldb.LT.max( 1, n ) ) THEN
381 info = -7
382 ELSE IF( ldvl.LT.1 .OR. ( ilvl .AND. ldvl.LT.n ) ) THEN
383 info = -11
384 ELSE IF( ldvr.LT.1 .OR. ( ilvr .AND. ldvr.LT.n ) ) THEN
385 info = -13
386 ELSE IF( lwork.LT.lwkmin .AND. .NOT.lquery ) THEN
387 info = -15
388 END IF
389*
390 IF( info.EQ.0 ) THEN
391 nb1 = ilaenv( 1, 'CGEQRF', ' ', n, n, -1, -1 )
392 nb2 = ilaenv( 1, 'CUNMQR', ' ', n, n, n, -1 )
393 nb3 = ilaenv( 1, 'CUNGQR', ' ', n, n, n, -1 )
394 nb = max( nb1, nb2, nb3 )
395 lopt = max( 2*n, n*(nb+1) )
396 work( 1 ) = lopt
397 END IF
398*
399 IF( info.NE.0 ) THEN
400 CALL xerbla( 'CGEGV ', -info )
401 RETURN
402 ELSE IF( lquery ) THEN
403 RETURN
404 END IF
405*
406* Quick return if possible
407*
408 IF( n.EQ.0 )
409 $ RETURN
410*
411* Get machine constants
412*
413 eps = slamch( 'E' )*slamch( 'B' )
414 safmin = slamch( 'S' )
415 safmin = safmin + safmin
416 safmax = one / safmin
417*
418* Scale A
419*
420 anrm = clange( 'M', n, n, a, lda, rwork )
421 anrm1 = anrm
422 anrm2 = one
423 IF( anrm.LT.one ) THEN
424 IF( safmax*anrm.LT.one ) THEN
425 anrm1 = safmin
426 anrm2 = safmax*anrm
427 END IF
428 END IF
429*
430 IF( anrm.GT.zero ) THEN
431 CALL clascl( 'G', -1, -1, anrm, one, n, n, a, lda, iinfo )
432 IF( iinfo.NE.0 ) THEN
433 info = n + 10
434 RETURN
435 END IF
436 END IF
437*
438* Scale B
439*
440 bnrm = clange( 'M', n, n, b, ldb, rwork )
441 bnrm1 = bnrm
442 bnrm2 = one
443 IF( bnrm.LT.one ) THEN
444 IF( safmax*bnrm.LT.one ) THEN
445 bnrm1 = safmin
446 bnrm2 = safmax*bnrm
447 END IF
448 END IF
449*
450 IF( bnrm.GT.zero ) THEN
451 CALL clascl( 'G', -1, -1, bnrm, one, n, n, b, ldb, iinfo )
452 IF( iinfo.NE.0 ) THEN
453 info = n + 10
454 RETURN
455 END IF
456 END IF
457*
458* Permute the matrix to make it more nearly triangular
459* Also "balance" the matrix.
460*
461 ileft = 1
462 iright = n + 1
463 irwork = iright + n
464 CALL cggbal( 'P', n, a, lda, b, ldb, ilo, ihi, rwork( ileft ),
465 $ rwork( iright ), rwork( irwork ), iinfo )
466 IF( iinfo.NE.0 ) THEN
467 info = n + 1
468 GO TO 80
469 END IF
470*
471* Reduce B to triangular form, and initialize VL and/or VR
472*
473 irows = ihi + 1 - ilo
474 IF( ilv ) THEN
475 icols = n + 1 - ilo
476 ELSE
477 icols = irows
478 END IF
479 itau = 1
480 iwork = itau + irows
481 CALL cgeqrf( irows, icols, b( ilo, ilo ), ldb, work( itau ),
482 $ work( iwork ), lwork+1-iwork, iinfo )
483 IF( iinfo.GE.0 )
484 $ lwkopt = max( lwkopt, int( work( iwork ) )+iwork-1 )
485 IF( iinfo.NE.0 ) THEN
486 info = n + 2
487 GO TO 80
488 END IF
489*
490 CALL cunmqr( 'L', 'C', irows, icols, irows, b( ilo, ilo ), ldb,
491 $ work( itau ), a( ilo, ilo ), lda, work( iwork ),
492 $ lwork+1-iwork, iinfo )
493 IF( iinfo.GE.0 )
494 $ lwkopt = max( lwkopt, int( work( iwork ) )+iwork-1 )
495 IF( iinfo.NE.0 ) THEN
496 info = n + 3
497 GO TO 80
498 END IF
499*
500 IF( ilvl ) THEN
501 CALL claset( 'Full', n, n, czero, cone, vl, ldvl )
502 CALL clacpy( 'L', irows-1, irows-1, b( ilo+1, ilo ), ldb,
503 $ vl( ilo+1, ilo ), ldvl )
504 CALL cungqr( irows, irows, irows, vl( ilo, ilo ), ldvl,
505 $ work( itau ), work( iwork ), lwork+1-iwork,
506 $ iinfo )
507 IF( iinfo.GE.0 )
508 $ lwkopt = max( lwkopt, int( work( iwork ) )+iwork-1 )
509 IF( iinfo.NE.0 ) THEN
510 info = n + 4
511 GO TO 80
512 END IF
513 END IF
514*
515 IF( ilvr )
516 $ CALL claset( 'Full', n, n, czero, cone, vr, ldvr )
517*
518* Reduce to generalized Hessenberg form
519*
520 IF( ilv ) THEN
521*
522* Eigenvectors requested -- work on whole matrix.
523*
524 CALL cgghrd( jobvl, jobvr, n, ilo, ihi, a, lda, b, ldb, vl,
525 $ ldvl, vr, ldvr, iinfo )
526 ELSE
527 CALL cgghrd( 'N', 'N', irows, 1, irows, a( ilo, ilo ), lda,
528 $ b( ilo, ilo ), ldb, vl, ldvl, vr, ldvr, iinfo )
529 END IF
530 IF( iinfo.NE.0 ) THEN
531 info = n + 5
532 GO TO 80
533 END IF
534*
535* Perform QZ algorithm
536*
537 iwork = itau
538 IF( ilv ) THEN
539 chtemp = 'S'
540 ELSE
541 chtemp = 'E'
542 END IF
543 CALL chgeqz( chtemp, jobvl, jobvr, n, ilo, ihi, a, lda, b, ldb,
544 $ alpha, beta, vl, ldvl, vr, ldvr, work( iwork ),
545 $ lwork+1-iwork, rwork( irwork ), iinfo )
546 IF( iinfo.GE.0 )
547 $ lwkopt = max( lwkopt, int( work( iwork ) )+iwork-1 )
548 IF( iinfo.NE.0 ) THEN
549 IF( iinfo.GT.0 .AND. iinfo.LE.n ) THEN
550 info = iinfo
551 ELSE IF( iinfo.GT.n .AND. iinfo.LE.2*n ) THEN
552 info = iinfo - n
553 ELSE
554 info = n + 6
555 END IF
556 GO TO 80
557 END IF
558*
559 IF( ilv ) THEN
560*
561* Compute Eigenvectors
562*
563 IF( ilvl ) THEN
564 IF( ilvr ) THEN
565 chtemp = 'B'
566 ELSE
567 chtemp = 'L'
568 END IF
569 ELSE
570 chtemp = 'R'
571 END IF
572*
573 CALL ctgevc( chtemp, 'B', ldumma, n, a, lda, b, ldb, vl, ldvl,
574 $ vr, ldvr, n, in, work( iwork ), rwork( irwork ),
575 $ iinfo )
576 IF( iinfo.NE.0 ) THEN
577 info = n + 7
578 GO TO 80
579 END IF
580*
581* Undo balancing on VL and VR, rescale
582*
583 IF( ilvl ) THEN
584 CALL cggbak( 'P', 'L', n, ilo, ihi, rwork( ileft ),
585 $ rwork( iright ), n, vl, ldvl, iinfo )
586 IF( iinfo.NE.0 ) THEN
587 info = n + 8
588 GO TO 80
589 END IF
590 DO 30 jc = 1, n
591 temp = zero
592 DO 10 jr = 1, n
593 temp = max( temp, abs1( vl( jr, jc ) ) )
594 10 CONTINUE
595 IF( temp.LT.safmin )
596 $ GO TO 30
597 temp = one / temp
598 DO 20 jr = 1, n
599 vl( jr, jc ) = vl( jr, jc )*temp
600 20 CONTINUE
601 30 CONTINUE
602 END IF
603 IF( ilvr ) THEN
604 CALL cggbak( 'P', 'R', n, ilo, ihi, rwork( ileft ),
605 $ rwork( iright ), n, vr, ldvr, iinfo )
606 IF( iinfo.NE.0 ) THEN
607 info = n + 9
608 GO TO 80
609 END IF
610 DO 60 jc = 1, n
611 temp = zero
612 DO 40 jr = 1, n
613 temp = max( temp, abs1( vr( jr, jc ) ) )
614 40 CONTINUE
615 IF( temp.LT.safmin )
616 $ GO TO 60
617 temp = one / temp
618 DO 50 jr = 1, n
619 vr( jr, jc ) = vr( jr, jc )*temp
620 50 CONTINUE
621 60 CONTINUE
622 END IF
623*
624* End of eigenvector calculation
625*
626 END IF
627*
628* Undo scaling in alpha, beta
629*
630* Note: this does not give the alpha and beta for the unscaled
631* problem.
632*
633* Un-scaling is limited to avoid underflow in alpha and beta
634* if they are significant.
635*
636 DO 70 jc = 1, n
637 absar = abs( real( alpha( jc ) ) )
638 absai = abs( aimag( alpha( jc ) ) )
639 absb = abs( real( beta( jc ) ) )
640 salfar = anrm*real( alpha( jc ) )
641 salfai = anrm*aimag( alpha( jc ) )
642 sbeta = bnrm*real( beta( jc ) )
643 ilimit = .false.
644 scale = one
645*
646* Check for significant underflow in imaginary part of ALPHA
647*
648 IF( abs( salfai ).LT.safmin .AND. absai.GE.
649 $ max( safmin, eps*absar, eps*absb ) ) THEN
650 ilimit = .true.
651 scale = ( safmin / anrm1 ) / max( safmin, anrm2*absai )
652 END IF
653*
654* Check for significant underflow in real part of ALPHA
655*
656 IF( abs( salfar ).LT.safmin .AND. absar.GE.
657 $ max( safmin, eps*absai, eps*absb ) ) THEN
658 ilimit = .true.
659 scale = max( scale, ( safmin / anrm1 ) /
660 $ max( safmin, anrm2*absar ) )
661 END IF
662*
663* Check for significant underflow in BETA
664*
665 IF( abs( sbeta ).LT.safmin .AND. absb.GE.
666 $ max( safmin, eps*absar, eps*absai ) ) THEN
667 ilimit = .true.
668 scale = max( scale, ( safmin / bnrm1 ) /
669 $ max( safmin, bnrm2*absb ) )
670 END IF
671*
672* Check for possible overflow when limiting scaling
673*
674 IF( ilimit ) THEN
675 temp = ( scale*safmin )*max( abs( salfar ), abs( salfai ),
676 $ abs( sbeta ) )
677 IF( temp.GT.one )
678 $ scale = scale / temp
679 IF( scale.LT.one )
680 $ ilimit = .false.
681 END IF
682*
683* Recompute un-scaled ALPHA, BETA if necessary.
684*
685 IF( ilimit ) THEN
686 salfar = ( scale*real( alpha( jc ) ) )*anrm
687 salfai = ( scale*aimag( alpha( jc ) ) )*anrm
688 sbeta = ( scale*beta( jc ) )*bnrm
689 END IF
690 alpha( jc ) = cmplx( salfar, salfai )
691 beta( jc ) = sbeta
692 70 CONTINUE
693*
694 80 CONTINUE
695 work( 1 ) = lwkopt
696*
697 RETURN
698*
699* End of CGEGV
700*
701 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine cgegv(jobvl, jobvr, n, a, lda, b, ldb, alpha, beta, vl, ldvl, vr, ldvr, work, lwork, rwork, info)
CGEGV computes the eigenvalues and, optionally, the left and/or right eigenvectors of a complex matri...
Definition cgegv.f:280
subroutine cgeqrf(m, n, a, lda, tau, work, lwork, info)
CGEQRF
Definition cgeqrf.f:144
subroutine cggbak(job, side, n, ilo, ihi, lscale, rscale, m, v, ldv, info)
CGGBAK
Definition cggbak.f:147
subroutine cggbal(job, n, a, lda, b, ldb, ilo, ihi, lscale, rscale, work, info)
CGGBAL
Definition cggbal.f:175
subroutine cgghrd(compq, compz, n, ilo, ihi, a, lda, b, ldb, q, ldq, z, ldz, info)
CGGHRD
Definition cgghrd.f:203
subroutine chgeqz(job, compq, compz, n, ilo, ihi, h, ldh, t, ldt, alpha, beta, q, ldq, z, ldz, work, lwork, rwork, info)
CHGEQZ
Definition chgeqz.f:283
subroutine clacpy(uplo, m, n, a, lda, b, ldb)
CLACPY copies all or part of one two-dimensional array to another.
Definition clacpy.f:101
subroutine clascl(type, kl, ku, cfrom, cto, m, n, a, lda, info)
CLASCL multiplies a general rectangular matrix by a real scalar defined as cto/cfrom.
Definition clascl.f:142
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.
Definition claset.f:104
subroutine ctgevc(side, howmny, select, n, s, lds, p, ldp, vl, ldvl, vr, ldvr, mm, m, work, rwork, info)
CTGEVC
Definition ctgevc.f:217
subroutine cungqr(m, n, k, a, lda, tau, work, lwork, info)
CUNGQR
Definition cungqr.f:126
subroutine cunmqr(side, trans, m, n, k, a, lda, tau, c, ldc, work, lwork, info)
CUNMQR
Definition cunmqr.f:166