Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ElmerCSC
GitHub Repository: ElmerCSC/elmerfem
Path: blob/devel/mathlibs/src/lapack/cgegv.f
5224 views
1
SUBROUTINE CGEGV( JOBVL, JOBVR, N, A, LDA, B, LDB, ALPHA, BETA,
2
$ VL, LDVL, VR, LDVR, WORK, LWORK, RWORK, INFO )
3
*
4
* -- LAPACK driver routine (version 3.0) --
5
* Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
6
* Courant Institute, Argonne National Lab, and Rice University
7
* June 30, 1999
8
*
9
* .. Scalar Arguments ..
10
CHARACTER JOBVL, JOBVR
11
INTEGER INFO, LDA, LDB, LDVL, LDVR, LWORK, N
12
* ..
13
* .. Array Arguments ..
14
REAL RWORK( * )
15
COMPLEX A( LDA, * ), ALPHA( * ), B( LDB, * ),
16
$ BETA( * ), VL( LDVL, * ), VR( LDVR, * ),
17
$ WORK( * )
18
* ..
19
*
20
* Purpose
21
* =======
22
*
23
* This routine is deprecated and has been replaced by routine CGGEV.
24
*
25
* CGEGV computes for a pair of N-by-N complex nonsymmetric matrices A
26
* and B, the generalized eigenvalues (alpha, beta), and optionally,
27
* the left and/or right generalized eigenvectors (VL and VR).
28
*
29
* A generalized eigenvalue for a pair of matrices (A,B) is, roughly
30
* speaking, a scalar w or a ratio alpha/beta = w, such that A - w*B
31
* is singular. It is usually represented as the pair (alpha,beta),
32
* as there is a reasonable interpretation for beta=0, and even for
33
* both being zero. A good beginning reference is the book, "Matrix
34
* Computations", by G. Golub & C. van Loan (Johns Hopkins U. Press)
35
*
36
* A right generalized eigenvector corresponding to a generalized
37
* eigenvalue w for a pair of matrices (A,B) is a vector r such
38
* that (A - w B) r = 0 . A left generalized eigenvector is a vector
39
* l such that l**H * (A - w B) = 0, where l**H is the
40
* conjugate-transpose of l.
41
*
42
* Note: this routine performs "full balancing" on A and B -- see
43
* "Further Details", below.
44
*
45
* Arguments
46
* =========
47
*
48
* JOBVL (input) CHARACTER*1
49
* = 'N': do not compute the left generalized eigenvectors;
50
* = 'V': compute the left generalized eigenvectors.
51
*
52
* JOBVR (input) CHARACTER*1
53
* = 'N': do not compute the right generalized eigenvectors;
54
* = 'V': compute the right generalized eigenvectors.
55
*
56
* N (input) INTEGER
57
* The order of the matrices A, B, VL, and VR. N >= 0.
58
*
59
* A (input/output) COMPLEX array, dimension (LDA, N)
60
* On entry, the first of the pair of matrices whose
61
* generalized eigenvalues and (optionally) generalized
62
* eigenvectors are to be computed.
63
* On exit, the contents will have been destroyed. (For a
64
* description of the contents of A on exit, see "Further
65
* Details", below.)
66
*
67
* LDA (input) INTEGER
68
* The leading dimension of A. LDA >= max(1,N).
69
*
70
* B (input/output) COMPLEX array, dimension (LDB, N)
71
* On entry, the second of the pair of matrices whose
72
* generalized eigenvalues and (optionally) generalized
73
* eigenvectors are to be computed.
74
* On exit, the contents will have been destroyed. (For a
75
* description of the contents of B on exit, see "Further
76
* Details", below.)
77
*
78
* LDB (input) INTEGER
79
* The leading dimension of B. LDB >= max(1,N).
80
*
81
* ALPHA (output) COMPLEX array, dimension (N)
82
* BETA (output) COMPLEX array, dimension (N)
83
* On exit, ALPHA(j)/BETA(j), j=1,...,N, will be the
84
* generalized eigenvalues.
85
*
86
* Note: the quotients ALPHA(j)/BETA(j) may easily over- or
87
* underflow, and BETA(j) may even be zero. Thus, the user
88
* should avoid naively computing the ratio alpha/beta.
89
* However, ALPHA will be always less than and usually
90
* comparable with norm(A) in magnitude, and BETA always less
91
* than and usually comparable with norm(B).
92
*
93
* VL (output) COMPLEX array, dimension (LDVL,N)
94
* If JOBVL = 'V', the left generalized eigenvectors. (See
95
* "Purpose", above.)
96
* Each eigenvector will be scaled so the largest component
97
* will have abs(real part) + abs(imag. part) = 1, *except*
98
* that for eigenvalues with alpha=beta=0, a zero vector will
99
* be returned as the corresponding eigenvector.
100
* Not referenced if JOBVL = 'N'.
101
*
102
* LDVL (input) INTEGER
103
* The leading dimension of the matrix VL. LDVL >= 1, and
104
* if JOBVL = 'V', LDVL >= N.
105
*
106
* VR (output) COMPLEX array, dimension (LDVR,N)
107
* If JOBVR = 'V', the right generalized eigenvectors. (See
108
* "Purpose", above.)
109
* Each eigenvector will be scaled so the largest component
110
* will have abs(real part) + abs(imag. part) = 1, *except*
111
* that for eigenvalues with alpha=beta=0, a zero vector will
112
* be returned as the corresponding eigenvector.
113
* Not referenced if JOBVR = 'N'.
114
*
115
* LDVR (input) INTEGER
116
* The leading dimension of the matrix VR. LDVR >= 1, and
117
* if JOBVR = 'V', LDVR >= N.
118
*
119
* WORK (workspace/output) COMPLEX array, dimension (LWORK)
120
* On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
121
*
122
* LWORK (input) INTEGER
123
* The dimension of the array WORK. LWORK >= max(1,2*N).
124
* For good performance, LWORK must generally be larger.
125
* To compute the optimal value of LWORK, call ILAENV to get
126
* blocksizes (for CGEQRF, CUNMQR, and CUNGQR.) Then compute:
127
* NB -- MAX of the blocksizes for CGEQRF, CUNMQR, and CUNGQR;
128
* The optimal LWORK is MAX( 2*N, N*(NB+1) ).
129
*
130
* If LWORK = -1, then a workspace query is assumed; the routine
131
* only calculates the optimal size of the WORK array, returns
132
* this value as the first entry of the WORK array, and no error
133
* message related to LWORK is issued by XERBLA.
134
*
135
* RWORK (workspace/output) REAL array, dimension (8*N)
136
*
137
* INFO (output) INTEGER
138
* = 0: successful exit
139
* < 0: if INFO = -i, the i-th argument had an illegal value.
140
* =1,...,N:
141
* The QZ iteration failed. No eigenvectors have been
142
* calculated, but ALPHA(j) and BETA(j) should be
143
* correct for j=INFO+1,...,N.
144
* > N: errors that usually indicate LAPACK problems:
145
* =N+1: error return from CGGBAL
146
* =N+2: error return from CGEQRF
147
* =N+3: error return from CUNMQR
148
* =N+4: error return from CUNGQR
149
* =N+5: error return from CGGHRD
150
* =N+6: error return from CHGEQZ (other than failed
151
* iteration)
152
* =N+7: error return from CTGEVC
153
* =N+8: error return from CGGBAK (computing VL)
154
* =N+9: error return from CGGBAK (computing VR)
155
* =N+10: error return from CLASCL (various calls)
156
*
157
* Further Details
158
* ===============
159
*
160
* Balancing
161
* ---------
162
*
163
* This driver calls CGGBAL to both permute and scale rows and columns
164
* of A and B. The permutations PL and PR are chosen so that PL*A*PR
165
* and PL*B*R will be upper triangular except for the diagonal blocks
166
* A(i:j,i:j) and B(i:j,i:j), with i and j as close together as
167
* possible. The diagonal scaling matrices DL and DR are chosen so
168
* that the pair DL*PL*A*PR*DR, DL*PL*B*PR*DR have elements close to
169
* one (except for the elements that start out zero.)
170
*
171
* After the eigenvalues and eigenvectors of the balanced matrices
172
* have been computed, CGGBAK transforms the eigenvectors back to what
173
* they would have been (in perfect arithmetic) if they had not been
174
* balanced.
175
*
176
* Contents of A and B on Exit
177
* -------- -- - --- - -- ----
178
*
179
* If any eigenvectors are computed (either JOBVL='V' or JOBVR='V' or
180
* both), then on exit the arrays A and B will contain the complex Schur
181
* form[*] of the "balanced" versions of A and B. If no eigenvectors
182
* are computed, then only the diagonal blocks will be correct.
183
*
184
* [*] In other words, upper triangular form.
185
*
186
* =====================================================================
187
*
188
* .. Parameters ..
189
REAL ZERO, ONE
190
PARAMETER ( ZERO = 0.0E0, ONE = 1.0E0 )
191
COMPLEX CZERO, CONE
192
PARAMETER ( CZERO = ( 0.0E0, 0.0E0 ),
193
$ CONE = ( 1.0E0, 0.0E0 ) )
194
* ..
195
* .. Local Scalars ..
196
LOGICAL ILIMIT, ILV, ILVL, ILVR, LQUERY
197
CHARACTER CHTEMP
198
INTEGER ICOLS, IHI, IINFO, IJOBVL, IJOBVR, ILEFT, ILO,
199
$ IN, IRIGHT, IROWS, IRWORK, ITAU, IWORK, JC, JR,
200
$ LOPT, LWKMIN, LWKOPT, NB, NB1, NB2, NB3
201
REAL ABSAI, ABSAR, ABSB, ANRM, ANRM1, ANRM2, BNRM,
202
$ BNRM1, BNRM2, EPS, SAFMAX, SAFMIN, SALFAI,
203
$ SALFAR, SBETA, SCALE, TEMP
204
COMPLEX X
205
* ..
206
* .. Local Arrays ..
207
LOGICAL LDUMMA( 1 )
208
* ..
209
* .. External Subroutines ..
210
EXTERNAL CGEQRF, CGGBAK, CGGBAL, CGGHRD, CHGEQZ, CLACPY,
211
$ CLASCL, CLASET, CTGEVC, CUNGQR, CUNMQR, XERBLA
212
* ..
213
* .. External Functions ..
214
LOGICAL LSAME
215
INTEGER ILAENV
216
REAL CLANGE, SLAMCH
217
EXTERNAL ILAENV, LSAME, CLANGE, SLAMCH
218
* ..
219
* .. Intrinsic Functions ..
220
INTRINSIC ABS, AIMAG, CMPLX, INT, MAX, REAL
221
* ..
222
* .. Statement Functions ..
223
REAL ABS1
224
* ..
225
* .. Statement Function definitions ..
226
ABS1( X ) = ABS( REAL( X ) ) + ABS( AIMAG( X ) )
227
* ..
228
* .. Executable Statements ..
229
*
230
* Decode the input arguments
231
*
232
IF( LSAME( JOBVL, 'N' ) ) THEN
233
IJOBVL = 1
234
ILVL = .FALSE.
235
ELSE IF( LSAME( JOBVL, 'V' ) ) THEN
236
IJOBVL = 2
237
ILVL = .TRUE.
238
ELSE
239
IJOBVL = -1
240
ILVL = .FALSE.
241
END IF
242
*
243
IF( LSAME( JOBVR, 'N' ) ) THEN
244
IJOBVR = 1
245
ILVR = .FALSE.
246
ELSE IF( LSAME( JOBVR, 'V' ) ) THEN
247
IJOBVR = 2
248
ILVR = .TRUE.
249
ELSE
250
IJOBVR = -1
251
ILVR = .FALSE.
252
END IF
253
ILV = ILVL .OR. ILVR
254
*
255
* Test the input arguments
256
*
257
LWKMIN = MAX( 2*N, 1 )
258
LWKOPT = LWKMIN
259
WORK( 1 ) = LWKOPT
260
LQUERY = ( LWORK.EQ.-1 )
261
INFO = 0
262
IF( IJOBVL.LE.0 ) THEN
263
INFO = -1
264
ELSE IF( IJOBVR.LE.0 ) THEN
265
INFO = -2
266
ELSE IF( N.LT.0 ) THEN
267
INFO = -3
268
ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
269
INFO = -5
270
ELSE IF( LDB.LT.MAX( 1, N ) ) THEN
271
INFO = -7
272
ELSE IF( LDVL.LT.1 .OR. ( ILVL .AND. LDVL.LT.N ) ) THEN
273
INFO = -11
274
ELSE IF( LDVR.LT.1 .OR. ( ILVR .AND. LDVR.LT.N ) ) THEN
275
INFO = -13
276
ELSE IF( LWORK.LT.LWKMIN .AND. .NOT.LQUERY ) THEN
277
INFO = -15
278
END IF
279
*
280
IF( INFO.EQ.0 ) THEN
281
NB1 = ILAENV( 1, 'CGEQRF', ' ', N, N, -1, -1 )
282
NB2 = ILAENV( 1, 'CUNMQR', ' ', N, N, N, -1 )
283
NB3 = ILAENV( 1, 'CUNGQR', ' ', N, N, N, -1 )
284
NB = MAX( NB1, NB2, NB3 )
285
LOPT = MAX( 2*N, N*(NB+1) )
286
WORK( 1 ) = LOPT
287
END IF
288
*
289
IF( INFO.NE.0 ) THEN
290
CALL XERBLA( 'CGEGV ', -INFO )
291
RETURN
292
ELSE IF( LQUERY ) THEN
293
RETURN
294
END IF
295
*
296
* Quick return if possible
297
*
298
IF( N.EQ.0 )
299
$ RETURN
300
*
301
* Get machine constants
302
*
303
EPS = SLAMCH( 'E' )*SLAMCH( 'B' )
304
SAFMIN = SLAMCH( 'S' )
305
SAFMIN = SAFMIN + SAFMIN
306
SAFMAX = ONE / SAFMIN
307
*
308
* Scale A
309
*
310
ANRM = CLANGE( 'M', N, N, A, LDA, RWORK )
311
ANRM1 = ANRM
312
ANRM2 = ONE
313
IF( ANRM.LT.ONE ) THEN
314
IF( SAFMAX*ANRM.LT.ONE ) THEN
315
ANRM1 = SAFMIN
316
ANRM2 = SAFMAX*ANRM
317
END IF
318
END IF
319
*
320
IF( ANRM.GT.ZERO ) THEN
321
CALL CLASCL( 'G', -1, -1, ANRM, ONE, N, N, A, LDA, IINFO )
322
IF( IINFO.NE.0 ) THEN
323
INFO = N + 10
324
RETURN
325
END IF
326
END IF
327
*
328
* Scale B
329
*
330
BNRM = CLANGE( 'M', N, N, B, LDB, RWORK )
331
BNRM1 = BNRM
332
BNRM2 = ONE
333
IF( BNRM.LT.ONE ) THEN
334
IF( SAFMAX*BNRM.LT.ONE ) THEN
335
BNRM1 = SAFMIN
336
BNRM2 = SAFMAX*BNRM
337
END IF
338
END IF
339
*
340
IF( BNRM.GT.ZERO ) THEN
341
CALL CLASCL( 'G', -1, -1, BNRM, ONE, N, N, B, LDB, IINFO )
342
IF( IINFO.NE.0 ) THEN
343
INFO = N + 10
344
RETURN
345
END IF
346
END IF
347
*
348
* Permute the matrix to make it more nearly triangular
349
* Also "balance" the matrix.
350
*
351
ILEFT = 1
352
IRIGHT = N + 1
353
IRWORK = IRIGHT + N
354
CALL CGGBAL( 'P', N, A, LDA, B, LDB, ILO, IHI, RWORK( ILEFT ),
355
$ RWORK( IRIGHT ), RWORK( IRWORK ), IINFO )
356
IF( IINFO.NE.0 ) THEN
357
INFO = N + 1
358
GO TO 80
359
END IF
360
*
361
* Reduce B to triangular form, and initialize VL and/or VR
362
*
363
IROWS = IHI + 1 - ILO
364
IF( ILV ) THEN
365
ICOLS = N + 1 - ILO
366
ELSE
367
ICOLS = IROWS
368
END IF
369
ITAU = 1
370
IWORK = ITAU + IROWS
371
CALL CGEQRF( IROWS, ICOLS, B( ILO, ILO ), LDB, WORK( ITAU ),
372
$ WORK( IWORK ), LWORK+1-IWORK, IINFO )
373
IF( IINFO.GE.0 )
374
$ LWKOPT = MAX( LWKOPT, INT( WORK( IWORK ) )+IWORK-1 )
375
IF( IINFO.NE.0 ) THEN
376
INFO = N + 2
377
GO TO 80
378
END IF
379
*
380
CALL CUNMQR( 'L', 'C', IROWS, ICOLS, IROWS, B( ILO, ILO ), LDB,
381
$ WORK( ITAU ), A( ILO, ILO ), LDA, WORK( IWORK ),
382
$ LWORK+1-IWORK, IINFO )
383
IF( IINFO.GE.0 )
384
$ LWKOPT = MAX( LWKOPT, INT( WORK( IWORK ) )+IWORK-1 )
385
IF( IINFO.NE.0 ) THEN
386
INFO = N + 3
387
GO TO 80
388
END IF
389
*
390
IF( ILVL ) THEN
391
CALL CLASET( 'Full', N, N, CZERO, CONE, VL, LDVL )
392
CALL CLACPY( 'L', IROWS-1, IROWS-1, B( ILO+1, ILO ), LDB,
393
$ VL( ILO+1, ILO ), LDVL )
394
CALL CUNGQR( IROWS, IROWS, IROWS, VL( ILO, ILO ), LDVL,
395
$ WORK( ITAU ), WORK( IWORK ), LWORK+1-IWORK,
396
$ IINFO )
397
IF( IINFO.GE.0 )
398
$ LWKOPT = MAX( LWKOPT, INT( WORK( IWORK ) )+IWORK-1 )
399
IF( IINFO.NE.0 ) THEN
400
INFO = N + 4
401
GO TO 80
402
END IF
403
END IF
404
*
405
IF( ILVR )
406
$ CALL CLASET( 'Full', N, N, CZERO, CONE, VR, LDVR )
407
*
408
* Reduce to generalized Hessenberg form
409
*
410
IF( ILV ) THEN
411
*
412
* Eigenvectors requested -- work on whole matrix.
413
*
414
CALL CGGHRD( JOBVL, JOBVR, N, ILO, IHI, A, LDA, B, LDB, VL,
415
$ LDVL, VR, LDVR, IINFO )
416
ELSE
417
CALL CGGHRD( 'N', 'N', IROWS, 1, IROWS, A( ILO, ILO ), LDA,
418
$ B( ILO, ILO ), LDB, VL, LDVL, VR, LDVR, IINFO )
419
END IF
420
IF( IINFO.NE.0 ) THEN
421
INFO = N + 5
422
GO TO 80
423
END IF
424
*
425
* Perform QZ algorithm
426
*
427
IWORK = ITAU
428
IF( ILV ) THEN
429
CHTEMP = 'S'
430
ELSE
431
CHTEMP = 'E'
432
END IF
433
CALL CHGEQZ( CHTEMP, JOBVL, JOBVR, N, ILO, IHI, A, LDA, B, LDB,
434
$ ALPHA, BETA, VL, LDVL, VR, LDVR, WORK( IWORK ),
435
$ LWORK+1-IWORK, RWORK( IRWORK ), IINFO )
436
IF( IINFO.GE.0 )
437
$ LWKOPT = MAX( LWKOPT, INT( WORK( IWORK ) )+IWORK-1 )
438
IF( IINFO.NE.0 ) THEN
439
IF( IINFO.GT.0 .AND. IINFO.LE.N ) THEN
440
INFO = IINFO
441
ELSE IF( IINFO.GT.N .AND. IINFO.LE.2*N ) THEN
442
INFO = IINFO - N
443
ELSE
444
INFO = N + 6
445
END IF
446
GO TO 80
447
END IF
448
*
449
IF( ILV ) THEN
450
*
451
* Compute Eigenvectors
452
*
453
IF( ILVL ) THEN
454
IF( ILVR ) THEN
455
CHTEMP = 'B'
456
ELSE
457
CHTEMP = 'L'
458
END IF
459
ELSE
460
CHTEMP = 'R'
461
END IF
462
*
463
CALL CTGEVC( CHTEMP, 'B', LDUMMA, N, A, LDA, B, LDB, VL, LDVL,
464
$ VR, LDVR, N, IN, WORK( IWORK ), RWORK( IRWORK ),
465
$ IINFO )
466
IF( IINFO.NE.0 ) THEN
467
INFO = N + 7
468
GO TO 80
469
END IF
470
*
471
* Undo balancing on VL and VR, rescale
472
*
473
IF( ILVL ) THEN
474
CALL CGGBAK( 'P', 'L', N, ILO, IHI, RWORK( ILEFT ),
475
$ RWORK( IRIGHT ), N, VL, LDVL, IINFO )
476
IF( IINFO.NE.0 ) THEN
477
INFO = N + 8
478
GO TO 80
479
END IF
480
DO 30 JC = 1, N
481
TEMP = ZERO
482
DO 10 JR = 1, N
483
TEMP = MAX( TEMP, ABS1( VL( JR, JC ) ) )
484
10 CONTINUE
485
IF( TEMP.LT.SAFMIN )
486
$ GO TO 30
487
TEMP = ONE / TEMP
488
DO 20 JR = 1, N
489
VL( JR, JC ) = VL( JR, JC )*TEMP
490
20 CONTINUE
491
30 CONTINUE
492
END IF
493
IF( ILVR ) THEN
494
CALL CGGBAK( 'P', 'R', N, ILO, IHI, RWORK( ILEFT ),
495
$ RWORK( IRIGHT ), N, VR, LDVR, IINFO )
496
IF( IINFO.NE.0 ) THEN
497
INFO = N + 9
498
GO TO 80
499
END IF
500
DO 60 JC = 1, N
501
TEMP = ZERO
502
DO 40 JR = 1, N
503
TEMP = MAX( TEMP, ABS1( VR( JR, JC ) ) )
504
40 CONTINUE
505
IF( TEMP.LT.SAFMIN )
506
$ GO TO 60
507
TEMP = ONE / TEMP
508
DO 50 JR = 1, N
509
VR( JR, JC ) = VR( JR, JC )*TEMP
510
50 CONTINUE
511
60 CONTINUE
512
END IF
513
*
514
* End of eigenvector calculation
515
*
516
END IF
517
*
518
* Undo scaling in alpha, beta
519
*
520
* Note: this does not give the alpha and beta for the unscaled
521
* problem.
522
*
523
* Un-scaling is limited to avoid underflow in alpha and beta
524
* if they are significant.
525
*
526
DO 70 JC = 1, N
527
ABSAR = ABS( REAL( ALPHA( JC ) ) )
528
ABSAI = ABS( AIMAG( ALPHA( JC ) ) )
529
ABSB = ABS( REAL( BETA( JC ) ) )
530
SALFAR = ANRM*REAL( ALPHA( JC ) )
531
SALFAI = ANRM*AIMAG( ALPHA( JC ) )
532
SBETA = BNRM*REAL( BETA( JC ) )
533
ILIMIT = .FALSE.
534
SCALE = ONE
535
*
536
* Check for significant underflow in imaginary part of ALPHA
537
*
538
IF( ABS( SALFAI ).LT.SAFMIN .AND. ABSAI.GE.
539
$ MAX( SAFMIN, EPS*ABSAR, EPS*ABSB ) ) THEN
540
ILIMIT = .TRUE.
541
SCALE = ( SAFMIN / ANRM1 ) / MAX( SAFMIN, ANRM2*ABSAI )
542
END IF
543
*
544
* Check for significant underflow in real part of ALPHA
545
*
546
IF( ABS( SALFAR ).LT.SAFMIN .AND. ABSAR.GE.
547
$ MAX( SAFMIN, EPS*ABSAI, EPS*ABSB ) ) THEN
548
ILIMIT = .TRUE.
549
SCALE = MAX( SCALE, ( SAFMIN / ANRM1 ) /
550
$ MAX( SAFMIN, ANRM2*ABSAR ) )
551
END IF
552
*
553
* Check for significant underflow in BETA
554
*
555
IF( ABS( SBETA ).LT.SAFMIN .AND. ABSB.GE.
556
$ MAX( SAFMIN, EPS*ABSAR, EPS*ABSAI ) ) THEN
557
ILIMIT = .TRUE.
558
SCALE = MAX( SCALE, ( SAFMIN / BNRM1 ) /
559
$ MAX( SAFMIN, BNRM2*ABSB ) )
560
END IF
561
*
562
* Check for possible overflow when limiting scaling
563
*
564
IF( ILIMIT ) THEN
565
TEMP = ( SCALE*SAFMIN )*MAX( ABS( SALFAR ), ABS( SALFAI ),
566
$ ABS( SBETA ) )
567
IF( TEMP.GT.ONE )
568
$ SCALE = SCALE / TEMP
569
IF( SCALE.LT.ONE )
570
$ ILIMIT = .FALSE.
571
END IF
572
*
573
* Recompute un-scaled ALPHA, BETA if necessary.
574
*
575
IF( ILIMIT ) THEN
576
SALFAR = ( SCALE*REAL( ALPHA( JC ) ) )*ANRM
577
SALFAI = ( SCALE*AIMAG( ALPHA( JC ) ) )*ANRM
578
SBETA = ( SCALE*BETA( JC ) )*BNRM
579
END IF
580
ALPHA( JC ) = CMPLX( SALFAR, SALFAI )
581
BETA( JC ) = SBETA
582
70 CONTINUE
583
*
584
80 CONTINUE
585
WORK( 1 ) = LWKOPT
586
*
587
RETURN
588
*
589
* End of CGEGV
590
*
591
END
592
593