 LAPACK  3.6.1 LAPACK: Linear Algebra PACKage
 subroutine shsein ( character SIDE, character EIGSRC, character INITV, logical, dimension( * ) SELECT, integer N, real, dimension( ldh, * ) H, integer LDH, real, dimension( * ) WR, real, dimension( * ) WI, real, dimension( ldvl, * ) VL, integer LDVL, real, dimension( ldvr, * ) VR, integer LDVR, integer MM, integer M, real, dimension( * ) WORK, integer, dimension( * ) IFAILL, integer, dimension( * ) IFAILR, integer INFO )

SHSEIN

Purpose:
``` SHSEIN uses inverse iteration to find specified right and/or left
eigenvectors of a real upper Hessenberg matrix H.

The right eigenvector x and the left eigenvector y of the matrix H
corresponding to an eigenvalue w are defined by:

H * x = w * x,     y**h * H = w * y**h

where y**h denotes the conjugate transpose of the vector y.```
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] EIGSRC ``` EIGSRC is CHARACTER*1 Specifies the source of eigenvalues supplied in (WR,WI): = 'Q': the eigenvalues were found using SHSEQR; thus, if H has zero subdiagonal elements, and so is block-triangular, then the j-th eigenvalue can be assumed to be an eigenvalue of the block containing the j-th row/column. This property allows SHSEIN to perform inverse iteration on just one diagonal block. = 'N': no assumptions are made on the correspondence between eigenvalues and diagonal blocks. In this case, SHSEIN must always perform inverse iteration using the whole matrix H.``` [in] INITV ``` INITV is CHARACTER*1 = 'N': no initial vectors are supplied; = 'U': user-supplied initial vectors are stored in the arrays VL and/or VR.``` [in,out] SELECT ``` SELECT is LOGICAL array, dimension (N) Specifies the eigenvectors to be computed. To select the real eigenvector corresponding to a real eigenvalue WR(j), SELECT(j) must be set to .TRUE.. To select the complex eigenvector corresponding to a complex eigenvalue (WR(j),WI(j)), with complex conjugate (WR(j+1),WI(j+1)), either SELECT(j) or SELECT(j+1) or both must be set to .TRUE.; then on exit SELECT(j) is .TRUE. and SELECT(j+1) is .FALSE..``` [in] N ``` N is INTEGER The order of the matrix H. N >= 0.``` [in] H ``` H is REAL array, dimension (LDH,N) The upper Hessenberg matrix H. If a NaN is detected in H, the routine will return with INFO=-6.``` [in] LDH ``` LDH is INTEGER The leading dimension of the array H. LDH >= max(1,N).``` [in,out] WR ` WR is REAL array, dimension (N)` [in] WI ``` WI is REAL array, dimension (N) On entry, the real and imaginary parts of the eigenvalues of H; a complex conjugate pair of eigenvalues must be stored in consecutive elements of WR and WI. On exit, WR may have been altered since close eigenvalues are perturbed slightly in searching for independent eigenvectors.``` [in,out] VL ``` VL is REAL array, dimension (LDVL,MM) On entry, if INITV = 'U' and SIDE = 'L' or 'B', VL must contain starting vectors for the inverse iteration for the left eigenvectors; the starting vector for each eigenvector must be in the same column(s) in which the eigenvector will be stored. On exit, if SIDE = 'L' or 'B', the left eigenvectors specified by SELECT will be stored consecutively in the columns of VL, in the same order as their eigenvalues. A complex eigenvector corresponding to a complex eigenvalue is stored in two consecutive columns, the first holding the real part and the second the imaginary part. If SIDE = 'R', VL is not referenced.``` [in] LDVL ``` LDVL is INTEGER The leading dimension of the array VL. LDVL >= max(1,N) if SIDE = 'L' or 'B'; LDVL >= 1 otherwise.``` [in,out] VR ``` VR is REAL array, dimension (LDVR,MM) On entry, if INITV = 'U' and SIDE = 'R' or 'B', VR must contain starting vectors for the inverse iteration for the right eigenvectors; the starting vector for each eigenvector must be in the same column(s) in which the eigenvector will be stored. On exit, if SIDE = 'R' or 'B', the right eigenvectors specified by SELECT will be stored consecutively in the columns of VR, in the same order as their eigenvalues. A complex eigenvector corresponding to a complex eigenvalue is stored in two consecutive columns, the first holding the real part and the second the imaginary part. If SIDE = 'L', VR is not referenced.``` [in] LDVR ``` LDVR is INTEGER The leading dimension of the array VR. LDVR >= max(1,N) if SIDE = 'R' or 'B'; LDVR >= 1 otherwise.``` [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 required to store the eigenvectors; each selected real eigenvector occupies one column and each selected complex eigenvector occupies two columns.``` [out] WORK ` WORK is REAL array, dimension ((N+2)*N)` [out] IFAILL ``` IFAILL is INTEGER array, dimension (MM) If SIDE = 'L' or 'B', IFAILL(i) = j > 0 if the left eigenvector in the i-th column of VL (corresponding to the eigenvalue w(j)) failed to converge; IFAILL(i) = 0 if the eigenvector converged satisfactorily. If the i-th and (i+1)th columns of VL hold a complex eigenvector, then IFAILL(i) and IFAILL(i+1) are set to the same value. If SIDE = 'R', IFAILL is not referenced.``` [out] IFAILR ``` IFAILR is INTEGER array, dimension (MM) If SIDE = 'R' or 'B', IFAILR(i) = j > 0 if the right eigenvector in the i-th column of VR (corresponding to the eigenvalue w(j)) failed to converge; IFAILR(i) = 0 if the eigenvector converged satisfactorily. If the i-th and (i+1)th columns of VR hold a complex eigenvector, then IFAILR(i) and IFAILR(i+1) are set to the same value. If SIDE = 'L', IFAILR is not referenced.``` [out] INFO ``` INFO is INTEGER = 0: successful exit < 0: if INFO = -i, the i-th argument had an illegal value > 0: if INFO = i, i is the number of eigenvectors which failed to converge; see IFAILL and IFAILR for further details.```
Date
November 2013
Further Details:
```  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 265 of file shsein.f.

265 *
266 * -- LAPACK computational routine (version 3.5.0) --
267 * -- LAPACK is a software package provided by Univ. of Tennessee, --
268 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
269 * November 2013
270 *
271 * .. Scalar Arguments ..
272  CHARACTER eigsrc, initv, side
273  INTEGER info, ldh, ldvl, ldvr, m, mm, n
274 * ..
275 * .. Array Arguments ..
276  LOGICAL select( * )
277  INTEGER ifaill( * ), ifailr( * )
278  REAL h( ldh, * ), vl( ldvl, * ), vr( ldvr, * ),
279  \$ wi( * ), work( * ), wr( * )
280 * ..
281 *
282 * =====================================================================
283 *
284 * .. Parameters ..
285  REAL zero, one
286  parameter ( zero = 0.0e+0, one = 1.0e+0 )
287 * ..
288 * .. Local Scalars ..
289  LOGICAL bothv, fromqr, leftv, noinit, pair, rightv
290  INTEGER i, iinfo, k, kl, kln, kr, ksi, ksr, ldwork
291  REAL bignum, eps3, hnorm, smlnum, ulp, unfl, wki,
292  \$ wkr
293 * ..
294 * .. External Functions ..
295  LOGICAL lsame, sisnan
296  REAL slamch, slanhs
297  EXTERNAL lsame, slamch, slanhs, sisnan
298 * ..
299 * .. External Subroutines ..
300  EXTERNAL slaein, xerbla
301 * ..
302 * .. Intrinsic Functions ..
303  INTRINSIC abs, max
304 * ..
305 * .. Executable Statements ..
306 *
307 * Decode and test the input parameters.
308 *
309  bothv = lsame( side, 'B' )
310  rightv = lsame( side, 'R' ) .OR. bothv
311  leftv = lsame( side, 'L' ) .OR. bothv
312 *
313  fromqr = lsame( eigsrc, 'Q' )
314 *
315  noinit = lsame( initv, 'N' )
316 *
317 * Set M to the number of columns required to store the selected
318 * eigenvectors, and standardize the array SELECT.
319 *
320  m = 0
321  pair = .false.
322  DO 10 k = 1, n
323  IF( pair ) THEN
324  pair = .false.
325  SELECT( k ) = .false.
326  ELSE
327  IF( wi( k ).EQ.zero ) THEN
328  IF( SELECT( k ) )
329  \$ m = m + 1
330  ELSE
331  pair = .true.
332  IF( SELECT( k ) .OR. SELECT( k+1 ) ) THEN
333  SELECT( k ) = .true.
334  m = m + 2
335  END IF
336  END IF
337  END IF
338  10 CONTINUE
339 *
340  info = 0
341  IF( .NOT.rightv .AND. .NOT.leftv ) THEN
342  info = -1
343  ELSE IF( .NOT.fromqr .AND. .NOT.lsame( eigsrc, 'N' ) ) THEN
344  info = -2
345  ELSE IF( .NOT.noinit .AND. .NOT.lsame( initv, 'U' ) ) THEN
346  info = -3
347  ELSE IF( n.LT.0 ) THEN
348  info = -5
349  ELSE IF( ldh.LT.max( 1, n ) ) THEN
350  info = -7
351  ELSE IF( ldvl.LT.1 .OR. ( leftv .AND. ldvl.LT.n ) ) THEN
352  info = -11
353  ELSE IF( ldvr.LT.1 .OR. ( rightv .AND. ldvr.LT.n ) ) THEN
354  info = -13
355  ELSE IF( mm.LT.m ) THEN
356  info = -14
357  END IF
358  IF( info.NE.0 ) THEN
359  CALL xerbla( 'SHSEIN', -info )
360  RETURN
361  END IF
362 *
363 * Quick return if possible.
364 *
365  IF( n.EQ.0 )
366  \$ RETURN
367 *
368 * Set machine-dependent constants.
369 *
370  unfl = slamch( 'Safe minimum' )
371  ulp = slamch( 'Precision' )
372  smlnum = unfl*( n / ulp )
373  bignum = ( one-ulp ) / smlnum
374 *
375  ldwork = n + 1
376 *
377  kl = 1
378  kln = 0
379  IF( fromqr ) THEN
380  kr = 0
381  ELSE
382  kr = n
383  END IF
384  ksr = 1
385 *
386  DO 120 k = 1, n
387  IF( SELECT( k ) ) THEN
388 *
389 * Compute eigenvector(s) corresponding to W(K).
390 *
391  IF( fromqr ) THEN
392 *
393 * If affiliation of eigenvalues is known, check whether
394 * the matrix splits.
395 *
396 * Determine KL and KR such that 1 <= KL <= K <= KR <= N
397 * and H(KL,KL-1) and H(KR+1,KR) are zero (or KL = 1 or
398 * KR = N).
399 *
400 * Then inverse iteration can be performed with the
401 * submatrix H(KL:N,KL:N) for a left eigenvector, and with
402 * the submatrix H(1:KR,1:KR) for a right eigenvector.
403 *
404  DO 20 i = k, kl + 1, -1
405  IF( h( i, i-1 ).EQ.zero )
406  \$ GO TO 30
407  20 CONTINUE
408  30 CONTINUE
409  kl = i
410  IF( k.GT.kr ) THEN
411  DO 40 i = k, n - 1
412  IF( h( i+1, i ).EQ.zero )
413  \$ GO TO 50
414  40 CONTINUE
415  50 CONTINUE
416  kr = i
417  END IF
418  END IF
419 *
420  IF( kl.NE.kln ) THEN
421  kln = kl
422 *
423 * Compute infinity-norm of submatrix H(KL:KR,KL:KR) if it
424 * has not ben computed before.
425 *
426  hnorm = slanhs( 'I', kr-kl+1, h( kl, kl ), ldh, work )
427  IF( sisnan( hnorm ) ) THEN
428  info = -6
429  RETURN
430  ELSE IF( hnorm.GT.zero ) THEN
431  eps3 = hnorm*ulp
432  ELSE
433  eps3 = smlnum
434  END IF
435  END IF
436 *
437 * Perturb eigenvalue if it is close to any previous
438 * selected eigenvalues affiliated to the submatrix
439 * H(KL:KR,KL:KR). Close roots are modified by EPS3.
440 *
441  wkr = wr( k )
442  wki = wi( k )
443  60 CONTINUE
444  DO 70 i = k - 1, kl, -1
445  IF( SELECT( i ) .AND. abs( wr( i )-wkr )+
446  \$ abs( wi( i )-wki ).LT.eps3 ) THEN
447  wkr = wkr + eps3
448  GO TO 60
449  END IF
450  70 CONTINUE
451  wr( k ) = wkr
452 *
453  pair = wki.NE.zero
454  IF( pair ) THEN
455  ksi = ksr + 1
456  ELSE
457  ksi = ksr
458  END IF
459  IF( leftv ) THEN
460 *
461 * Compute left eigenvector.
462 *
463  CALL slaein( .false., noinit, n-kl+1, h( kl, kl ), ldh,
464  \$ wkr, wki, vl( kl, ksr ), vl( kl, ksi ),
465  \$ work, ldwork, work( n*n+n+1 ), eps3, smlnum,
466  \$ bignum, iinfo )
467  IF( iinfo.GT.0 ) THEN
468  IF( pair ) THEN
469  info = info + 2
470  ELSE
471  info = info + 1
472  END IF
473  ifaill( ksr ) = k
474  ifaill( ksi ) = k
475  ELSE
476  ifaill( ksr ) = 0
477  ifaill( ksi ) = 0
478  END IF
479  DO 80 i = 1, kl - 1
480  vl( i, ksr ) = zero
481  80 CONTINUE
482  IF( pair ) THEN
483  DO 90 i = 1, kl - 1
484  vl( i, ksi ) = zero
485  90 CONTINUE
486  END IF
487  END IF
488  IF( rightv ) THEN
489 *
490 * Compute right eigenvector.
491 *
492  CALL slaein( .true., noinit, kr, h, ldh, wkr, wki,
493  \$ vr( 1, ksr ), vr( 1, ksi ), work, ldwork,
494  \$ work( n*n+n+1 ), eps3, smlnum, bignum,
495  \$ iinfo )
496  IF( iinfo.GT.0 ) THEN
497  IF( pair ) THEN
498  info = info + 2
499  ELSE
500  info = info + 1
501  END IF
502  ifailr( ksr ) = k
503  ifailr( ksi ) = k
504  ELSE
505  ifailr( ksr ) = 0
506  ifailr( ksi ) = 0
507  END IF
508  DO 100 i = kr + 1, n
509  vr( i, ksr ) = zero
510  100 CONTINUE
511  IF( pair ) THEN
512  DO 110 i = kr + 1, n
513  vr( i, ksi ) = zero
514  110 CONTINUE
515  END IF
516  END IF
517 *
518  IF( pair ) THEN
519  ksr = ksr + 2
520  ELSE
521  ksr = ksr + 1
522  END IF
523  END IF
524  120 CONTINUE
525 *
526  RETURN
527 *
528 * End of SHSEIN
529 *
real function slanhs(NORM, N, A, LDA, WORK)
SLANHS returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
Definition: slanhs.f:110
logical function sisnan(SIN)
SISNAN tests input for NaN.
Definition: sisnan.f:61
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine slaein(RIGHTV, NOINIT, N, H, LDH, WR, WI, VR, VI, B, LDB, WORK, EPS3, SMLNUM, BIGNUM, INFO)
SLAEIN computes a specified right or left eigenvector of an upper Hessenberg matrix by inverse iterat...
Definition: slaein.f:174
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:69
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55

Here is the call graph for this function:

Here is the caller graph for this function: