# ?stein2

Computes the eigenvectors corresponding to specified eigenvalues of a real symmetric tridiagonal matrix, using inverse iteration.

## Syntax

call sstein2(n, d, e, m, w, iblock, isplit, orfac, z, ldz, work, iwork, ifail, info)

call dstein2(n, d, e, m, w, iblock, isplit, orfac, z, ldz, work, iwork, ifail, info)

## Description

The ?stein2 routine is a modified LAPACK routine ?stein. It computes the eigenvectors of a real symmetric tridiagonal matrix T corresponding to specified eigenvalues, using inverse iteration.

The maximum number of iterations allowed for each eigenvector is specified by an internal parameter maxits (currently set to 5).

## Input Parameters

n

INTEGER. The order of the matrix T `(n ≥ 0)`.

m

INTEGER. The number of eigenvectors to be found `(0 ≤ m ≤ n)`.

d, e, w

REAL for single-precision flavors

DOUBLE PRECISION for double-precision flavors.

Arrays:

d(*), of size n. The n diagonal elements of the tridiagonal matrix T.

e(*), of size n.

The `(n-1)` subdiagonal elements of the tridiagonal matrix T, in elements 1 to `n-1`. e(n) need not be set.

w(*), of size n.

The first m elements of w contain the eigenvalues for which eigenvectors are to be computed. The eigenvalues should be grouped by split-off block and ordered from smallest to largest within the block. (The output array w from ?stebz with `ORDER = 'B'` is expected here).

The size of w must be at least `max(1, n)`.

iblock

INTEGER.

Array of size n.

The submatrix indices associated with the corresponding eigenvalues in w;

iblock(i) = 1, if eigenvalue w(i) belongs to the first submatrix from the top,

iblock(i) = 2, if eigenvalue w(i) belongs to the second submatrix, etc. (The output array iblock from ?stebz is expected here).

isplit

INTEGER.

Array of size n.

The splitting points, at which T breaks up into submatrices. The first submatrix consists of rows/columns 1 to isplit(1), the second submatrix consists of rows/columns isplit(1)+1 through isplit(2), etc. (The output array isplit from ?stebz is expected here).

orfac

REAL for single-precision flavors

DOUBLE PRECISION for double-precision flavors.

orfac specifies which eigenvectors should be orthogonalized. Eigenvectors that correspond to eigenvalues which are within `orfac*||T||` of each other are to be orthogonalized.

ldz

INTEGER. The leading dimension of the output array z; `ldz ≥ max(1, n)`.

work

REAL for single-precision flavors

DOUBLE PRECISION for double-precision flavors.

Workspace array of size 5n.

iwork

INTEGER. Workspace array of size n.

## Output Parameters

z

REAL for sstein2

DOUBLE PRECISION for dstein2

Array of size ldz by m.

The computed eigenvectors. The eigenvector associated with the eigenvalue w(i) is stored in the i-th column of z. Any vector that fails to converge is set to its current iterate after maxits iterations.

ifail

INTEGER.

Array of size m.

On normal exit, all elements of ifail are zero. If one or more eigenvectors fail to converge after maxits iterations, then their indices are stored in the array ifail.

info

INTEGER.

`info = 0`, the exit is successful.

`info < 0`: if `info = -i`, the i-th had an illegal value.

`info > 0`: if `info = i`, then i eigenvectors failed to converge in maxits iterations. Their indices are stored in the array ifail.