LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages

◆ ztrevc()

subroutine ztrevc ( character side,
character howmny,
logical, dimension( * ) select,
integer n,
complex*16, dimension( ldt, * ) t,
integer ldt,
complex*16, dimension( ldvl, * ) vl,
integer ldvl,
complex*16, dimension( ldvr, * ) vr,
integer ldvr,
integer mm,
integer m,
complex*16, dimension( * ) work,
double precision, dimension( * ) rwork,
integer info )

ZTREVC

Download ZTREVC + dependencies [TGZ] [ZIP] [TXT]

Purpose:
!> !> ZTREVC computes some or all of the right and/or left eigenvectors of !> a complex upper triangular matrix T. !> Matrices of this type are produced by the Schur factorization of !> a complex general matrix: A = Q*T*Q**H, as computed by ZHSEQR. !> !> The right eigenvector x and the left eigenvector y of T corresponding !> to an eigenvalue w are defined by: !> !> T*x = w*x, (y**H)*T = w*(y**H) !> !> where y**H denotes the conjugate transpose of the vector y. !> The eigenvalues are not input to this routine, but are read directly !> from the diagonal of T. !> !> This routine returns the matrices X and/or Y of right and left !> eigenvectors of T, or the products Q*X and/or Q*Y, where Q is an !> input matrix. If Q is the unitary factor that reduces a matrix A to !> Schur form T, then Q*X and Q*Y are the matrices of right and left !> eigenvectors of A. !>
Parameters
[in]SIDE
!> SIDE is CHARACTER*1 !> = 'R': compute right eigenvectors only; !> = 'L': compute left eigenvectors only; !> = 'B': compute both right and left eigenvectors. !>
[in]HOWMNY
!> HOWMNY is CHARACTER*1 !> = 'A': compute all right and/or left eigenvectors; !> = 'B': compute all right and/or left eigenvectors, !> backtransformed using the matrices supplied in !> VR and/or VL; !> = 'S': compute selected right and/or left eigenvectors, !> as indicated by the logical array SELECT. !>
[in]SELECT
!> SELECT is LOGICAL array, dimension (N) !> If HOWMNY = 'S', SELECT specifies the eigenvectors to be !> computed. !> The eigenvector corresponding to the j-th eigenvalue is !> computed if SELECT(j) = .TRUE.. !> Not referenced if HOWMNY = 'A' or 'B'. !>
[in]N
!> N is INTEGER !> The order of the matrix T. N >= 0. !>
[in,out]T
!> T is COMPLEX*16 array, dimension (LDT,N) !> The upper triangular matrix T. T is modified, but restored !> on exit. !>
[in]LDT
!> LDT is INTEGER !> The leading dimension of the array T. LDT >= max(1,N). !>
[in,out]VL
!> VL is COMPLEX*16 array, dimension (LDVL,MM) !> On entry, if SIDE = 'L' or 'B' and HOWMNY = 'B', VL must !> contain an N-by-N matrix Q (usually the unitary matrix Q of !> Schur vectors returned by ZHSEQR). !> On exit, if SIDE = 'L' or 'B', VL contains: !> if HOWMNY = 'A', the matrix Y of left eigenvectors of T; !> if HOWMNY = 'B', the matrix Q*Y; !> if HOWMNY = 'S', the left eigenvectors of T specified by !> SELECT, stored consecutively in the columns !> of VL, in the same order as their !> eigenvalues. !> Not referenced if SIDE = 'R'. !>
[in]LDVL
!> LDVL is INTEGER !> The leading dimension of the array VL. LDVL >= 1, and if !> SIDE = 'L' or 'B', LDVL >= N. !>
[in,out]VR
!> VR is COMPLEX*16 array, dimension (LDVR,MM) !> On entry, if SIDE = 'R' or 'B' and HOWMNY = 'B', VR must !> contain an N-by-N matrix Q (usually the unitary matrix Q of !> Schur vectors returned by ZHSEQR). !> On exit, if SIDE = 'R' or 'B', VR contains: !> if HOWMNY = 'A', the matrix X of right eigenvectors of T; !> if HOWMNY = 'B', the matrix Q*X; !> if HOWMNY = 'S', the right eigenvectors of T specified by !> SELECT, stored consecutively in the columns !> of VR, in the same order as their !> eigenvalues. !> Not referenced if SIDE = 'L'. !>
[in]LDVR
!> LDVR is INTEGER !> The leading dimension of the array VR. LDVR >= 1, and if !> SIDE = 'R' or 'B'; LDVR >= N. !>
[in]MM
!> MM is INTEGER !> The number of columns in the arrays VL and/or VR. MM >= M. !>
[out]M
!> M is INTEGER !> The number of columns in the arrays VL and/or VR actually !> used to store the eigenvectors. If HOWMNY = 'A' or 'B', M !> is set to N. Each selected eigenvector occupies one !> column. !>
[out]WORK
!> WORK is COMPLEX*16 array, dimension (2*N) !>
[out]RWORK
!> RWORK is DOUBLE PRECISION array, dimension (N) !>
[out]INFO
!> INFO is INTEGER !> = 0: successful exit !> < 0: if INFO = -i, the i-th argument had an illegal value !>
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Further Details:
!> !> The algorithm used in this program is basically backward (forward) !> substitution, with scaling to make the the code robust against !> possible overflow. !> !> Each eigenvector is normalized so that the element of largest !> magnitude has magnitude 1; here the magnitude of a complex number !> (x,y) is taken to be |x| + |y|. !>

Definition at line 214 of file ztrevc.f.

217*
218* -- LAPACK computational routine --
219* -- LAPACK is a software package provided by Univ. of Tennessee, --
220* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
221*
222* .. Scalar Arguments ..
223 CHARACTER HOWMNY, SIDE
224 INTEGER INFO, LDT, LDVL, LDVR, M, MM, N
225* ..
226* .. Array Arguments ..
227 LOGICAL SELECT( * )
228 DOUBLE PRECISION RWORK( * )
229 COMPLEX*16 T( LDT, * ), VL( LDVL, * ), VR( LDVR, * ),
230 $ WORK( * )
231* ..
232*
233* =====================================================================
234*
235* .. Parameters ..
236 DOUBLE PRECISION ZERO, ONE
237 parameter( zero = 0.0d+0, one = 1.0d+0 )
238 COMPLEX*16 CMZERO, CMONE
239 parameter( cmzero = ( 0.0d+0, 0.0d+0 ),
240 $ cmone = ( 1.0d+0, 0.0d+0 ) )
241* ..
242* .. Local Scalars ..
243 LOGICAL ALLV, BOTHV, LEFTV, OVER, RIGHTV, SOMEV
244 INTEGER I, II, IS, J, K, KI
245 DOUBLE PRECISION OVFL, REMAX, SCALE, SMIN, SMLNUM, ULP, UNFL
246 COMPLEX*16 CDUM
247* ..
248* .. External Functions ..
249 LOGICAL LSAME
250 INTEGER IZAMAX
251 DOUBLE PRECISION DLAMCH, DZASUM
252 EXTERNAL lsame, izamax, dlamch, dzasum
253* ..
254* .. External Subroutines ..
255 EXTERNAL xerbla, zcopy, zdscal, zgemv,
256 $ zlatrs
257* ..
258* .. Intrinsic Functions ..
259 INTRINSIC abs, dble, dcmplx, dconjg, dimag, max
260* ..
261* .. Statement Functions ..
262 DOUBLE PRECISION CABS1
263* ..
264* .. Statement Function definitions ..
265 cabs1( cdum ) = abs( dble( cdum ) ) + abs( dimag( cdum ) )
266* ..
267* .. Executable Statements ..
268*
269* Decode and test the input parameters
270*
271 bothv = lsame( side, 'B' )
272 rightv = lsame( side, 'R' ) .OR. bothv
273 leftv = lsame( side, 'L' ) .OR. bothv
274*
275 allv = lsame( howmny, 'A' )
276 over = lsame( howmny, 'B' )
277 somev = lsame( howmny, 'S' )
278*
279* Set M to the number of columns required to store the selected
280* eigenvectors.
281*
282 IF( somev ) THEN
283 m = 0
284 DO 10 j = 1, n
285 IF( SELECT( j ) )
286 $ m = m + 1
287 10 CONTINUE
288 ELSE
289 m = n
290 END IF
291*
292 info = 0
293 IF( .NOT.rightv .AND. .NOT.leftv ) THEN
294 info = -1
295 ELSE IF( .NOT.allv .AND. .NOT.over .AND. .NOT.somev ) THEN
296 info = -2
297 ELSE IF( n.LT.0 ) THEN
298 info = -4
299 ELSE IF( ldt.LT.max( 1, n ) ) THEN
300 info = -6
301 ELSE IF( ldvl.LT.1 .OR. ( leftv .AND. ldvl.LT.n ) ) THEN
302 info = -8
303 ELSE IF( ldvr.LT.1 .OR. ( rightv .AND. ldvr.LT.n ) ) THEN
304 info = -10
305 ELSE IF( mm.LT.m ) THEN
306 info = -11
307 END IF
308 IF( info.NE.0 ) THEN
309 CALL xerbla( 'ZTREVC', -info )
310 RETURN
311 END IF
312*
313* Quick return if possible.
314*
315 IF( n.EQ.0 )
316 $ RETURN
317*
318* Set the constants to control overflow.
319*
320 unfl = dlamch( 'Safe minimum' )
321 ovfl = one / unfl
322 ulp = dlamch( 'Precision' )
323 smlnum = unfl*( n / ulp )
324*
325* Store the diagonal elements of T in working array WORK.
326*
327 DO 20 i = 1, n
328 work( i+n ) = t( i, i )
329 20 CONTINUE
330*
331* Compute 1-norm of each column of strictly upper triangular
332* part of T to control overflow in triangular solver.
333*
334 rwork( 1 ) = zero
335 DO 30 j = 2, n
336 rwork( j ) = dzasum( j-1, t( 1, j ), 1 )
337 30 CONTINUE
338*
339 IF( rightv ) THEN
340*
341* Compute right eigenvectors.
342*
343 is = m
344 DO 80 ki = n, 1, -1
345*
346 IF( somev ) THEN
347 IF( .NOT.SELECT( ki ) )
348 $ GO TO 80
349 END IF
350 smin = max( ulp*( cabs1( t( ki, ki ) ) ), smlnum )
351*
352 work( 1 ) = cmone
353*
354* Form right-hand side.
355*
356 DO 40 k = 1, ki - 1
357 work( k ) = -t( k, ki )
358 40 CONTINUE
359*
360* Solve the triangular system:
361* (T(1:KI-1,1:KI-1) - T(KI,KI))*X = SCALE*WORK.
362*
363 DO 50 k = 1, ki - 1
364 t( k, k ) = t( k, k ) - t( ki, ki )
365 IF( cabs1( t( k, k ) ).LT.smin )
366 $ t( k, k ) = smin
367 50 CONTINUE
368*
369 IF( ki.GT.1 ) THEN
370 CALL zlatrs( 'Upper', 'No transpose', 'Non-unit', 'Y',
371 $ ki-1, t, ldt, work( 1 ), scale, rwork,
372 $ info )
373 work( ki ) = scale
374 END IF
375*
376* Copy the vector x or Q*x to VR and normalize.
377*
378 IF( .NOT.over ) THEN
379 CALL zcopy( ki, work( 1 ), 1, vr( 1, is ), 1 )
380*
381 ii = izamax( ki, vr( 1, is ), 1 )
382 remax = one / cabs1( vr( ii, is ) )
383 CALL zdscal( ki, remax, vr( 1, is ), 1 )
384*
385 DO 60 k = ki + 1, n
386 vr( k, is ) = cmzero
387 60 CONTINUE
388 ELSE
389 IF( ki.GT.1 )
390 $ CALL zgemv( 'N', n, ki-1, cmone, vr, ldvr,
391 $ work( 1 ),
392 $ 1, dcmplx( scale ), vr( 1, ki ), 1 )
393*
394 ii = izamax( n, vr( 1, ki ), 1 )
395 remax = one / cabs1( vr( ii, ki ) )
396 CALL zdscal( n, remax, vr( 1, ki ), 1 )
397 END IF
398*
399* Set back the original diagonal elements of T.
400*
401 DO 70 k = 1, ki - 1
402 t( k, k ) = work( k+n )
403 70 CONTINUE
404*
405 is = is - 1
406 80 CONTINUE
407 END IF
408*
409 IF( leftv ) THEN
410*
411* Compute left eigenvectors.
412*
413 is = 1
414 DO 130 ki = 1, n
415*
416 IF( somev ) THEN
417 IF( .NOT.SELECT( ki ) )
418 $ GO TO 130
419 END IF
420 smin = max( ulp*( cabs1( t( ki, ki ) ) ), smlnum )
421*
422 work( n ) = cmone
423*
424* Form right-hand side.
425*
426 DO 90 k = ki + 1, n
427 work( k ) = -dconjg( t( ki, k ) )
428 90 CONTINUE
429*
430* Solve the triangular system:
431* (T(KI+1:N,KI+1:N) - T(KI,KI))**H * X = SCALE*WORK.
432*
433 DO 100 k = ki + 1, n
434 t( k, k ) = t( k, k ) - t( ki, ki )
435 IF( cabs1( t( k, k ) ).LT.smin )
436 $ t( k, k ) = smin
437 100 CONTINUE
438*
439 IF( ki.LT.n ) THEN
440 CALL zlatrs( 'Upper', 'Conjugate transpose',
441 $ 'Non-unit',
442 $ 'Y', n-ki, t( ki+1, ki+1 ), ldt,
443 $ work( ki+1 ), scale, rwork, info )
444 work( ki ) = scale
445 END IF
446*
447* Copy the vector x or Q*x to VL and normalize.
448*
449 IF( .NOT.over ) THEN
450 CALL zcopy( n-ki+1, work( ki ), 1, vl( ki, is ), 1 )
451*
452 ii = izamax( n-ki+1, vl( ki, is ), 1 ) + ki - 1
453 remax = one / cabs1( vl( ii, is ) )
454 CALL zdscal( n-ki+1, remax, vl( ki, is ), 1 )
455*
456 DO 110 k = 1, ki - 1
457 vl( k, is ) = cmzero
458 110 CONTINUE
459 ELSE
460 IF( ki.LT.n )
461 $ CALL zgemv( 'N', n, n-ki, cmone, vl( 1, ki+1 ),
462 $ ldvl,
463 $ work( ki+1 ), 1, dcmplx( scale ),
464 $ vl( 1, ki ), 1 )
465*
466 ii = izamax( n, vl( 1, ki ), 1 )
467 remax = one / cabs1( vl( ii, ki ) )
468 CALL zdscal( n, remax, vl( 1, ki ), 1 )
469 END IF
470*
471* Set back the original diagonal elements of T.
472*
473 DO 120 k = ki + 1, n
474 t( k, k ) = work( k+n )
475 120 CONTINUE
476*
477 is = is + 1
478 130 CONTINUE
479 END IF
480*
481 RETURN
482*
483* End of ZTREVC
484*
subroutine xerbla(srname, info)
Definition cblat2.f:3285
double precision function dzasum(n, zx, incx)
DZASUM
Definition dzasum.f:72
subroutine zcopy(n, zx, incx, zy, incy)
ZCOPY
Definition zcopy.f:81
subroutine zgemv(trans, m, n, alpha, a, lda, x, incx, beta, y, incy)
ZGEMV
Definition zgemv.f:160
integer function izamax(n, zx, incx)
IZAMAX
Definition izamax.f:71
double precision function dlamch(cmach)
DLAMCH
Definition dlamch.f:69
subroutine zlatrs(uplo, trans, diag, normin, n, a, lda, x, scale, cnorm, info)
ZLATRS solves a triangular system of equations with the scale factor set to prevent overflow.
Definition zlatrs.f:238
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
subroutine zdscal(n, da, zx, incx)
ZDSCAL
Definition zdscal.f:78
Here is the call graph for this function:
Here is the caller graph for this function: