001:       SUBROUTINE CGEEVX( BALANC, JOBVL, JOBVR, SENSE, N, A, LDA, W, VL,
002:      $                   LDVL, VR, LDVR, ILO, IHI, SCALE, ABNRM, RCONDE,
003:      $                   RCONDV, WORK, LWORK, RWORK, INFO )
004: *
005: *  -- LAPACK driver routine (version 3.2) --
006: *     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
007: *     November 2006
008: *
009: *     .. Scalar Arguments ..
010:       CHARACTER          BALANC, JOBVL, JOBVR, SENSE
011:       INTEGER            IHI, ILO, INFO, LDA, LDVL, LDVR, LWORK, N
012:       REAL               ABNRM
013: *     ..
014: *     .. Array Arguments ..
015:       REAL               RCONDE( * ), RCONDV( * ), RWORK( * ),
016:      $                   SCALE( * )
017:       COMPLEX            A( LDA, * ), VL( LDVL, * ), VR( LDVR, * ),
018:      $                   W( * ), WORK( * )
019: *     ..
020: *
021: *  Purpose
022: *  =======
023: *
024: *  CGEEVX computes for an N-by-N complex nonsymmetric matrix A, the
025: *  eigenvalues and, optionally, the left and/or right eigenvectors.
026: *
027: *  Optionally also, it computes a balancing transformation to improve
028: *  the conditioning of the eigenvalues and eigenvectors (ILO, IHI,
029: *  SCALE, and ABNRM), reciprocal condition numbers for the eigenvalues
030: *  (RCONDE), and reciprocal condition numbers for the right
031: *  eigenvectors (RCONDV).
032: *
033: *  The right eigenvector v(j) of A satisfies
034: *                   A * v(j) = lambda(j) * v(j)
035: *  where lambda(j) is its eigenvalue.
036: *  The left eigenvector u(j) of A satisfies
037: *                u(j)**H * A = lambda(j) * u(j)**H
038: *  where u(j)**H denotes the conjugate transpose of u(j).
039: *
040: *  The computed eigenvectors are normalized to have Euclidean norm
041: *  equal to 1 and largest component real.
042: *
043: *  Balancing a matrix means permuting the rows and columns to make it
044: *  more nearly upper triangular, and applying a diagonal similarity
045: *  transformation D * A * D**(-1), where D is a diagonal matrix, to
046: *  make its rows and columns closer in norm and the condition numbers
047: *  of its eigenvalues and eigenvectors smaller.  The computed
048: *  reciprocal condition numbers correspond to the balanced matrix.
049: *  Permuting rows and columns will not change the condition numbers
050: *  (in exact arithmetic) but diagonal scaling will.  For further
051: *  explanation of balancing, see section 4.10.2 of the LAPACK
052: *  Users' Guide.
053: *
054: *  Arguments
055: *  =========
056: *
057: *  BALANC  (input) CHARACTER*1
058: *          Indicates how the input matrix should be diagonally scaled
059: *          and/or permuted to improve the conditioning of its
060: *          eigenvalues.
061: *          = 'N': Do not diagonally scale or permute;
062: *          = 'P': Perform permutations to make the matrix more nearly
063: *                 upper triangular. Do not diagonally scale;
064: *          = 'S': Diagonally scale the matrix, ie. replace A by
065: *                 D*A*D**(-1), where D is a diagonal matrix chosen
066: *                 to make the rows and columns of A more equal in
067: *                 norm. Do not permute;
068: *          = 'B': Both diagonally scale and permute A.
069: *
070: *          Computed reciprocal condition numbers will be for the matrix
071: *          after balancing and/or permuting. Permuting does not change
072: *          condition numbers (in exact arithmetic), but balancing does.
073: *
074: *  JOBVL   (input) CHARACTER*1
075: *          = 'N': left eigenvectors of A are not computed;
076: *          = 'V': left eigenvectors of A are computed.
077: *          If SENSE = 'E' or 'B', JOBVL must = 'V'.
078: *
079: *  JOBVR   (input) CHARACTER*1
080: *          = 'N': right eigenvectors of A are not computed;
081: *          = 'V': right eigenvectors of A are computed.
082: *          If SENSE = 'E' or 'B', JOBVR must = 'V'.
083: *
084: *  SENSE   (input) CHARACTER*1
085: *          Determines which reciprocal condition numbers are computed.
086: *          = 'N': None are computed;
087: *          = 'E': Computed for eigenvalues only;
088: *          = 'V': Computed for right eigenvectors only;
089: *          = 'B': Computed for eigenvalues and right eigenvectors.
090: *
091: *          If SENSE = 'E' or 'B', both left and right eigenvectors
092: *          must also be computed (JOBVL = 'V' and JOBVR = 'V').
093: *
094: *  N       (input) INTEGER
095: *          The order of the matrix A. N >= 0.
096: *
097: *  A       (input/output) COMPLEX array, dimension (LDA,N)
098: *          On entry, the N-by-N matrix A.
099: *          On exit, A has been overwritten.  If JOBVL = 'V' or
100: *          JOBVR = 'V', A contains the Schur form of the balanced 
101: *          version of the matrix A.
102: *
103: *  LDA     (input) INTEGER
104: *          The leading dimension of the array A.  LDA >= max(1,N).
105: *
106: *  W       (output) COMPLEX array, dimension (N)
107: *          W contains the computed eigenvalues.
108: *
109: *  VL      (output) COMPLEX array, dimension (LDVL,N)
110: *          If JOBVL = 'V', the left eigenvectors u(j) are stored one
111: *          after another in the columns of VL, in the same order
112: *          as their eigenvalues.
113: *          If JOBVL = 'N', VL is not referenced.
114: *          u(j) = VL(:,j), the j-th column of VL.
115: *
116: *  LDVL    (input) INTEGER
117: *          The leading dimension of the array VL.  LDVL >= 1; if
118: *          JOBVL = 'V', LDVL >= N.
119: *
120: *  VR      (output) COMPLEX array, dimension (LDVR,N)
121: *          If JOBVR = 'V', the right eigenvectors v(j) are stored one
122: *          after another in the columns of VR, in the same order
123: *          as their eigenvalues.
124: *          If JOBVR = 'N', VR is not referenced.
125: *          v(j) = VR(:,j), the j-th column of VR.
126: *
127: *  LDVR    (input) INTEGER
128: *          The leading dimension of the array VR.  LDVR >= 1; if
129: *          JOBVR = 'V', LDVR >= N.
130: *
131: *  ILO     (output) INTEGER
132: *  IHI     (output) INTEGER
133: *          ILO and IHI are integer values determined when A was
134: *          balanced.  The balanced A(i,j) = 0 if I > J and
135: *          J = 1,...,ILO-1 or I = IHI+1,...,N.
136: *
137: *  SCALE   (output) REAL array, dimension (N)
138: *          Details of the permutations and scaling factors applied
139: *          when balancing A.  If P(j) is the index of the row and column
140: *          interchanged with row and column j, and D(j) is the scaling
141: *          factor applied to row and column j, then
142: *          SCALE(J) = P(J),    for J = 1,...,ILO-1
143: *                   = D(J),    for J = ILO,...,IHI
144: *                   = P(J)     for J = IHI+1,...,N.
145: *          The order in which the interchanges are made is N to IHI+1,
146: *          then 1 to ILO-1.
147: *
148: *  ABNRM   (output) REAL
149: *          The one-norm of the balanced matrix (the maximum
150: *          of the sum of absolute values of elements of any column).
151: *
152: *  RCONDE  (output) REAL array, dimension (N)
153: *          RCONDE(j) is the reciprocal condition number of the j-th
154: *          eigenvalue.
155: *
156: *  RCONDV  (output) REAL array, dimension (N)
157: *          RCONDV(j) is the reciprocal condition number of the j-th
158: *          right eigenvector.
159: *
160: *  WORK    (workspace/output) COMPLEX array, dimension (MAX(1,LWORK))
161: *          On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
162: *
163: *  LWORK   (input) INTEGER
164: *          The dimension of the array WORK.  If SENSE = 'N' or 'E',
165: *          LWORK >= max(1,2*N), and if SENSE = 'V' or 'B',
166: *          LWORK >= N*N+2*N.
167: *          For good performance, LWORK must generally be larger.
168: *
169: *          If LWORK = -1, then a workspace query is assumed; the routine
170: *          only calculates the optimal size of the WORK array, returns
171: *          this value as the first entry of the WORK array, and no error
172: *          message related to LWORK is issued by XERBLA.
173: *
174: *  RWORK   (workspace) REAL array, dimension (2*N)
175: *
176: *  INFO    (output) INTEGER
177: *          = 0:  successful exit
178: *          < 0:  if INFO = -i, the i-th argument had an illegal value.
179: *          > 0:  if INFO = i, the QR algorithm failed to compute all the
180: *                eigenvalues, and no eigenvectors or condition numbers
181: *                have been computed; elements 1:ILO-1 and i+1:N of W
182: *                contain eigenvalues which have converged.
183: *
184: *  =====================================================================
185: *
186: *     .. Parameters ..
187:       REAL               ZERO, ONE
188:       PARAMETER          ( ZERO = 0.0E0, ONE = 1.0E0 )
189: *     ..
190: *     .. Local Scalars ..
191:       LOGICAL            LQUERY, SCALEA, WANTVL, WANTVR, WNTSNB, WNTSNE,
192:      $                   WNTSNN, WNTSNV
193:       CHARACTER          JOB, SIDE
194:       INTEGER            HSWORK, I, ICOND, IERR, ITAU, IWRK, K, MAXWRK,
195:      $                   MINWRK, NOUT
196:       REAL               ANRM, BIGNUM, CSCALE, EPS, SCL, SMLNUM
197:       COMPLEX            TMP
198: *     ..
199: *     .. Local Arrays ..
200:       LOGICAL            SELECT( 1 )
201:       REAL               DUM( 1 )
202: *     ..
203: *     .. External Subroutines ..
204:       EXTERNAL           CGEBAK, CGEBAL, CGEHRD, CHSEQR, CLACPY, CLASCL,
205:      $                   CSCAL, CSSCAL, CTREVC, CTRSNA, CUNGHR, SLABAD,
206:      $                   SLASCL, XERBLA
207: *     ..
208: *     .. External Functions ..
209:       LOGICAL            LSAME
210:       INTEGER            ILAENV, ISAMAX
211:       REAL               CLANGE, SCNRM2, SLAMCH
212:       EXTERNAL           LSAME, ILAENV, ISAMAX, CLANGE, SCNRM2, SLAMCH
213: *     ..
214: *     .. Intrinsic Functions ..
215:       INTRINSIC          AIMAG, CMPLX, CONJG, MAX, REAL, SQRT
216: *     ..
217: *     .. Executable Statements ..
218: *
219: *     Test the input arguments
220: *
221:       INFO = 0
222:       LQUERY = ( LWORK.EQ.-1 )
223:       WANTVL = LSAME( JOBVL, 'V' )
224:       WANTVR = LSAME( JOBVR, 'V' )
225:       WNTSNN = LSAME( SENSE, 'N' )
226:       WNTSNE = LSAME( SENSE, 'E' )
227:       WNTSNV = LSAME( SENSE, 'V' )
228:       WNTSNB = LSAME( SENSE, 'B' )
229:       IF( .NOT.( LSAME( BALANC, 'N' ) .OR. LSAME( BALANC, 'S' ) .OR.
230:      $    LSAME( BALANC, 'P' ) .OR. LSAME( BALANC, 'B' ) ) ) THEN
231:          INFO = -1
232:       ELSE IF( ( .NOT.WANTVL ) .AND. ( .NOT.LSAME( JOBVL, 'N' ) ) ) THEN
233:          INFO = -2
234:       ELSE IF( ( .NOT.WANTVR ) .AND. ( .NOT.LSAME( JOBVR, 'N' ) ) ) THEN
235:          INFO = -3
236:       ELSE IF( .NOT.( WNTSNN .OR. WNTSNE .OR. WNTSNB .OR. WNTSNV ) .OR.
237:      $         ( ( WNTSNE .OR. WNTSNB ) .AND. .NOT.( WANTVL .AND.
238:      $         WANTVR ) ) ) THEN
239:          INFO = -4
240:       ELSE IF( N.LT.0 ) THEN
241:          INFO = -5
242:       ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
243:          INFO = -7
244:       ELSE IF( LDVL.LT.1 .OR. ( WANTVL .AND. LDVL.LT.N ) ) THEN
245:          INFO = -10
246:       ELSE IF( LDVR.LT.1 .OR. ( WANTVR .AND. LDVR.LT.N ) ) THEN
247:          INFO = -12
248:       END IF
249: *
250: *     Compute workspace
251: *      (Note: Comments in the code beginning "Workspace:" describe the
252: *       minimal amount of workspace needed at that point in the code,
253: *       as well as the preferred amount for good performance.
254: *       CWorkspace refers to complex workspace, and RWorkspace to real
255: *       workspace. NB refers to the optimal block size for the
256: *       immediately following subroutine, as returned by ILAENV.
257: *       HSWORK refers to the workspace preferred by CHSEQR, as
258: *       calculated below. HSWORK is computed assuming ILO=1 and IHI=N,
259: *       the worst case.)
260: *
261:       IF( INFO.EQ.0 ) THEN
262:          IF( N.EQ.0 ) THEN
263:             MINWRK = 1
264:             MAXWRK = 1
265:          ELSE
266:             MAXWRK = N + N*ILAENV( 1, 'CGEHRD', ' ', N, 1, N, 0 )
267: *
268:             IF( WANTVL ) THEN
269:                CALL CHSEQR( 'S', 'V', N, 1, N, A, LDA, W, VL, LDVL,
270:      $                WORK, -1, INFO )
271:             ELSE IF( WANTVR ) THEN
272:                CALL CHSEQR( 'S', 'V', N, 1, N, A, LDA, W, VR, LDVR,
273:      $                WORK, -1, INFO )
274:             ELSE
275:                IF( WNTSNN ) THEN
276:                   CALL CHSEQR( 'E', 'N', N, 1, N, A, LDA, W, VR, LDVR,
277:      $                WORK, -1, INFO )
278:                ELSE
279:                   CALL CHSEQR( 'S', 'N', N, 1, N, A, LDA, W, VR, LDVR,
280:      $                WORK, -1, INFO )
281:                END IF
282:             END IF
283:             HSWORK = WORK( 1 )
284: *
285:             IF( ( .NOT.WANTVL ) .AND. ( .NOT.WANTVR ) ) THEN
286:                MINWRK = 2*N
287:                IF( .NOT.( WNTSNN .OR. WNTSNE ) )
288:      $            MINWRK = MAX( MINWRK, N*N + 2*N )
289:                MAXWRK = MAX( MAXWRK, HSWORK )
290:                IF( .NOT.( WNTSNN .OR. WNTSNE ) )
291:      $            MAXWRK = MAX( MAXWRK, N*N + 2*N )
292:             ELSE
293:                MINWRK = 2*N
294:                IF( .NOT.( WNTSNN .OR. WNTSNE ) )
295:      $            MINWRK = MAX( MINWRK, N*N + 2*N )
296:                MAXWRK = MAX( MAXWRK, HSWORK )
297:                MAXWRK = MAX( MAXWRK, N + ( N - 1 )*ILAENV( 1, 'CUNGHR',
298:      $                       ' ', N, 1, N, -1 ) )
299:                IF( .NOT.( WNTSNN .OR. WNTSNE ) )
300:      $            MAXWRK = MAX( MAXWRK, N*N + 2*N )
301:                MAXWRK = MAX( MAXWRK, 2*N )
302:             END IF
303:             MAXWRK = MAX( MAXWRK, MINWRK )
304:          END IF
305:          WORK( 1 ) = MAXWRK
306: *
307:          IF( LWORK.LT.MINWRK .AND. .NOT.LQUERY ) THEN
308:             INFO = -20
309:          END IF
310:       END IF
311: *
312:       IF( INFO.NE.0 ) THEN
313:          CALL XERBLA( 'CGEEVX', -INFO )
314:          RETURN
315:       ELSE IF( LQUERY ) THEN
316:          RETURN
317:       END IF
318: *
319: *     Quick return if possible
320: *
321:       IF( N.EQ.0 )
322:      $   RETURN
323: *
324: *     Get machine constants
325: *
326:       EPS = SLAMCH( 'P' )
327:       SMLNUM = SLAMCH( 'S' )
328:       BIGNUM = ONE / SMLNUM
329:       CALL SLABAD( SMLNUM, BIGNUM )
330:       SMLNUM = SQRT( SMLNUM ) / EPS
331:       BIGNUM = ONE / SMLNUM
332: *
333: *     Scale A if max element outside range [SMLNUM,BIGNUM]
334: *
335:       ICOND = 0
336:       ANRM = CLANGE( 'M', N, N, A, LDA, DUM )
337:       SCALEA = .FALSE.
338:       IF( ANRM.GT.ZERO .AND. ANRM.LT.SMLNUM ) THEN
339:          SCALEA = .TRUE.
340:          CSCALE = SMLNUM
341:       ELSE IF( ANRM.GT.BIGNUM ) THEN
342:          SCALEA = .TRUE.
343:          CSCALE = BIGNUM
344:       END IF
345:       IF( SCALEA )
346:      $   CALL CLASCL( 'G', 0, 0, ANRM, CSCALE, N, N, A, LDA, IERR )
347: *
348: *     Balance the matrix and compute ABNRM
349: *
350:       CALL CGEBAL( BALANC, N, A, LDA, ILO, IHI, SCALE, IERR )
351:       ABNRM = CLANGE( '1', N, N, A, LDA, DUM )
352:       IF( SCALEA ) THEN
353:          DUM( 1 ) = ABNRM
354:          CALL SLASCL( 'G', 0, 0, CSCALE, ANRM, 1, 1, DUM, 1, IERR )
355:          ABNRM = DUM( 1 )
356:       END IF
357: *
358: *     Reduce to upper Hessenberg form
359: *     (CWorkspace: need 2*N, prefer N+N*NB)
360: *     (RWorkspace: none)
361: *
362:       ITAU = 1
363:       IWRK = ITAU + N
364:       CALL CGEHRD( N, ILO, IHI, A, LDA, WORK( ITAU ), WORK( IWRK ),
365:      $             LWORK-IWRK+1, IERR )
366: *
367:       IF( WANTVL ) THEN
368: *
369: *        Want left eigenvectors
370: *        Copy Householder vectors to VL
371: *
372:          SIDE = 'L'
373:          CALL CLACPY( 'L', N, N, A, LDA, VL, LDVL )
374: *
375: *        Generate unitary matrix in VL
376: *        (CWorkspace: need 2*N-1, prefer N+(N-1)*NB)
377: *        (RWorkspace: none)
378: *
379:          CALL CUNGHR( N, ILO, IHI, VL, LDVL, WORK( ITAU ), WORK( IWRK ),
380:      $                LWORK-IWRK+1, IERR )
381: *
382: *        Perform QR iteration, accumulating Schur vectors in VL
383: *        (CWorkspace: need 1, prefer HSWORK (see comments) )
384: *        (RWorkspace: none)
385: *
386:          IWRK = ITAU
387:          CALL CHSEQR( 'S', 'V', N, ILO, IHI, A, LDA, W, VL, LDVL,
388:      $                WORK( IWRK ), LWORK-IWRK+1, INFO )
389: *
390:          IF( WANTVR ) THEN
391: *
392: *           Want left and right eigenvectors
393: *           Copy Schur vectors to VR
394: *
395:             SIDE = 'B'
396:             CALL CLACPY( 'F', N, N, VL, LDVL, VR, LDVR )
397:          END IF
398: *
399:       ELSE IF( WANTVR ) THEN
400: *
401: *        Want right eigenvectors
402: *        Copy Householder vectors to VR
403: *
404:          SIDE = 'R'
405:          CALL CLACPY( 'L', N, N, A, LDA, VR, LDVR )
406: *
407: *        Generate unitary matrix in VR
408: *        (CWorkspace: need 2*N-1, prefer N+(N-1)*NB)
409: *        (RWorkspace: none)
410: *
411:          CALL CUNGHR( N, ILO, IHI, VR, LDVR, WORK( ITAU ), WORK( IWRK ),
412:      $                LWORK-IWRK+1, IERR )
413: *
414: *        Perform QR iteration, accumulating Schur vectors in VR
415: *        (CWorkspace: need 1, prefer HSWORK (see comments) )
416: *        (RWorkspace: none)
417: *
418:          IWRK = ITAU
419:          CALL CHSEQR( 'S', 'V', N, ILO, IHI, A, LDA, W, VR, LDVR,
420:      $                WORK( IWRK ), LWORK-IWRK+1, INFO )
421: *
422:       ELSE
423: *
424: *        Compute eigenvalues only
425: *        If condition numbers desired, compute Schur form
426: *
427:          IF( WNTSNN ) THEN
428:             JOB = 'E'
429:          ELSE
430:             JOB = 'S'
431:          END IF
432: *
433: *        (CWorkspace: need 1, prefer HSWORK (see comments) )
434: *        (RWorkspace: none)
435: *
436:          IWRK = ITAU
437:          CALL CHSEQR( JOB, 'N', N, ILO, IHI, A, LDA, W, VR, LDVR,
438:      $                WORK( IWRK ), LWORK-IWRK+1, INFO )
439:       END IF
440: *
441: *     If INFO > 0 from CHSEQR, then quit
442: *
443:       IF( INFO.GT.0 )
444:      $   GO TO 50
445: *
446:       IF( WANTVL .OR. WANTVR ) THEN
447: *
448: *        Compute left and/or right eigenvectors
449: *        (CWorkspace: need 2*N)
450: *        (RWorkspace: need N)
451: *
452:          CALL CTREVC( SIDE, 'B', SELECT, N, A, LDA, VL, LDVL, VR, LDVR,
453:      $                N, NOUT, WORK( IWRK ), RWORK, IERR )
454:       END IF
455: *
456: *     Compute condition numbers if desired
457: *     (CWorkspace: need N*N+2*N unless SENSE = 'E')
458: *     (RWorkspace: need 2*N unless SENSE = 'E')
459: *
460:       IF( .NOT.WNTSNN ) THEN
461:          CALL CTRSNA( SENSE, 'A', SELECT, N, A, LDA, VL, LDVL, VR, LDVR,
462:      $                RCONDE, RCONDV, N, NOUT, WORK( IWRK ), N, RWORK,
463:      $                ICOND )
464:       END IF
465: *
466:       IF( WANTVL ) THEN
467: *
468: *        Undo balancing of left eigenvectors
469: *
470:          CALL CGEBAK( BALANC, 'L', N, ILO, IHI, SCALE, N, VL, LDVL,
471:      $                IERR )
472: *
473: *        Normalize left eigenvectors and make largest component real
474: *
475:          DO 20 I = 1, N
476:             SCL = ONE / SCNRM2( N, VL( 1, I ), 1 )
477:             CALL CSSCAL( N, SCL, VL( 1, I ), 1 )
478:             DO 10 K = 1, N
479:                RWORK( K ) = REAL( VL( K, I ) )**2 +
480:      $                      AIMAG( VL( K, I ) )**2
481:    10       CONTINUE
482:             K = ISAMAX( N, RWORK, 1 )
483:             TMP = CONJG( VL( K, I ) ) / SQRT( RWORK( K ) )
484:             CALL CSCAL( N, TMP, VL( 1, I ), 1 )
485:             VL( K, I ) = CMPLX( REAL( VL( K, I ) ), ZERO )
486:    20    CONTINUE
487:       END IF
488: *
489:       IF( WANTVR ) THEN
490: *
491: *        Undo balancing of right eigenvectors
492: *
493:          CALL CGEBAK( BALANC, 'R', N, ILO, IHI, SCALE, N, VR, LDVR,
494:      $                IERR )
495: *
496: *        Normalize right eigenvectors and make largest component real
497: *
498:          DO 40 I = 1, N
499:             SCL = ONE / SCNRM2( N, VR( 1, I ), 1 )
500:             CALL CSSCAL( N, SCL, VR( 1, I ), 1 )
501:             DO 30 K = 1, N
502:                RWORK( K ) = REAL( VR( K, I ) )**2 +
503:      $                      AIMAG( VR( K, I ) )**2
504:    30       CONTINUE
505:             K = ISAMAX( N, RWORK, 1 )
506:             TMP = CONJG( VR( K, I ) ) / SQRT( RWORK( K ) )
507:             CALL CSCAL( N, TMP, VR( 1, I ), 1 )
508:             VR( K, I ) = CMPLX( REAL( VR( K, I ) ), ZERO )
509:    40    CONTINUE
510:       END IF
511: *
512: *     Undo scaling if necessary
513: *
514:    50 CONTINUE
515:       IF( SCALEA ) THEN
516:          CALL CLASCL( 'G', 0, 0, CSCALE, ANRM, N-INFO, 1, W( INFO+1 ),
517:      $                MAX( N-INFO, 1 ), IERR )
518:          IF( INFO.EQ.0 ) THEN
519:             IF( ( WNTSNV .OR. WNTSNB ) .AND. ICOND.EQ.0 )
520:      $         CALL SLASCL( 'G', 0, 0, CSCALE, ANRM, N, 1, RCONDV, N,
521:      $                      IERR )
522:          ELSE
523:             CALL CLASCL( 'G', 0, 0, CSCALE, ANRM, ILO-1, 1, W, N, IERR )
524:          END IF
525:       END IF
526: *
527:       WORK( 1 ) = MAXWRK
528:       RETURN
529: *
530: *     End of CGEEVX
531: *
532:       END
533: