# NAG Library Routine Document

## 1Purpose

f08jkf (dstein) computes the eigenvectors of a real symmetric tridiagonal matrix corresponding to specified eigenvalues, by inverse iteration.

## 2Specification

Fortran Interface
 Subroutine f08jkf ( n, d, e, m, w, z, ldz, work, info)
 Integer, Intent (In) :: n, m, iblock(*), isplit(*), ldz Integer, Intent (Out) :: iwork(n), ifailv(m), info Real (Kind=nag_wp), Intent (In) :: d(*), e(*), w(*) Real (Kind=nag_wp), Intent (Inout) :: z(ldz,*) Real (Kind=nag_wp), Intent (Out) :: work(5*n)
#include nagmk26.h
 void f08jkf_ (const Integer *n, const double d[], const double e[], const Integer *m, const double w[], const Integer iblock[], const Integer isplit[], double z[], const Integer *ldz, double work[], Integer iwork[], Integer ifailv[], Integer *info)
The routine may be called by its LAPACK name dstein.

## 3Description

f08jkf (dstein) computes the eigenvectors of a real symmetric tridiagonal matrix $T$ corresponding to specified eigenvalues, by inverse iteration (see Jessup and Ipsen (1992)). It is designed to be used in particular after the specified eigenvalues have been computed by f08jjf (dstebz) with ${\mathbf{order}}=\text{'B'}$, but may also be used when the eigenvalues have been computed by other routines in Chapters F02 or F08.
If $T$ has been formed by reduction of a full real symmetric matrix $A$ to tridiagonal form, then eigenvectors of $T$ may be transformed to eigenvectors of $A$ by a call to f08fgf (dormtr) or f08ggf (dopmtr).
f08jjf (dstebz) determines whether the matrix $T$ splits into block diagonal form:
 $T = T1 T2 . . . Tp$
and passes details of the block structure to this routine in the arrays iblock and isplit. This routine can then take advantage of the block structure by performing inverse iteration on each block ${T}_{i}$ separately, which is more efficient than using the whole matrix.

## 4References

Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore
Jessup E and Ipsen I C F (1992) Improving the accuracy of inverse iteration SIAM J. Sci. Statist. Comput. 13 550–572

## 5Arguments

1:     $\mathbf{n}$ – IntegerInput
On entry: $n$, the order of the matrix $T$.
Constraint: ${\mathbf{n}}\ge 0$.
2:     $\mathbf{d}\left(*\right)$ – Real (Kind=nag_wp) arrayInput
Note: the dimension of the array d must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
On entry: the diagonal elements of the tridiagonal matrix $T$.
3:     $\mathbf{e}\left(*\right)$ – Real (Kind=nag_wp) arrayInput
Note: the dimension of the array e must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}-1\right)$.
On entry: the off-diagonal elements of the tridiagonal matrix $T$.
4:     $\mathbf{m}$ – IntegerInput
On entry: $m$, the number of eigenvectors to be returned.
Constraint: $0\le {\mathbf{m}}\le {\mathbf{n}}$.
5:     $\mathbf{w}\left(*\right)$ – Real (Kind=nag_wp) arrayInput
Note: the dimension of the array w must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
On entry: the eigenvalues of the tridiagonal matrix $T$ stored in ${\mathbf{w}}\left(1\right)$ to ${\mathbf{w}}\left(m\right)$, as returned by f08jjf (dstebz) with ${\mathbf{order}}=\text{'B'}$. Eigenvalues associated with the first sub-matrix must be supplied first, in nondecreasing order; then those associated with the second sub-matrix, again in nondecreasing order; and so on.
Constraint: if ${\mathbf{iblock}}\left(\mathit{i}\right)={\mathbf{iblock}}\left(\mathit{i}+1\right)$, ${\mathbf{w}}\left(\mathit{i}\right)\le {\mathbf{w}}\left(\mathit{i}+1\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{m}}-1$.
6:     $\mathbf{iblock}\left(*\right)$ – Integer arrayInput
Note: the dimension of the array iblock must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
On entry: the first $m$ elements must contain the sub-matrix indices associated with the specified eigenvalues, as returned by f08jjf (dstebz) with ${\mathbf{order}}=\text{'B'}$. If the eigenvalues were not computed by f08jjf (dstebz) with ${\mathbf{order}}=\text{'B'}$, set ${\mathbf{iblock}}\left(\mathit{i}\right)$ to $1$, for $\mathit{i}=1,2,\dots ,m$.
Constraint: ${\mathbf{iblock}}\left(\mathit{i}\right)\le {\mathbf{iblock}}\left(\mathit{i}+1\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{m}}-1$.
7:     $\mathbf{isplit}\left(*\right)$ – Integer arrayInput
Note: the dimension of the array isplit must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
On entry: the points at which $T$ breaks up into sub-matrices, as returned by f08jjf (dstebz) with ${\mathbf{order}}=\text{'B'}$. If the eigenvalues were not computed by f08jjf (dstebz) with ${\mathbf{order}}=\text{'B'}$, set ${\mathbf{isplit}}\left(1\right)$ to n.
8:     $\mathbf{z}\left({\mathbf{ldz}},*\right)$ – Real (Kind=nag_wp) arrayOutput
Note: the second dimension of the array z must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}\right)$.
On exit: the $m$ eigenvectors, stored as columns of $Z$; the $i$th column corresponds to the $i$th specified eigenvalue, unless ${\mathbf{info}}>{\mathbf{0}}$ (in which case see Section 6).
9:     $\mathbf{ldz}$ – IntegerInput
On entry: the first dimension of the array z as declared in the (sub)program from which f08jkf (dstein) is called.
Constraint: ${\mathbf{ldz}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
10:   $\mathbf{work}\left(5×{\mathbf{n}}\right)$ – Real (Kind=nag_wp) arrayWorkspace
11:   $\mathbf{iwork}\left({\mathbf{n}}\right)$ – Integer arrayWorkspace
12:   $\mathbf{ifailv}\left({\mathbf{m}}\right)$ – Integer arrayOutput
On exit: if ${\mathbf{info}}=i>0$, the first $i$ elements of ifailv contain the indices of any eigenvectors which have failed to converge. The rest of the first m elements of ifailv are set to $0$.
13:   $\mathbf{info}$ – IntegerOutput
On exit: ${\mathbf{info}}=0$ unless the routine detects an error (see Section 6).

## 6Error Indicators and Warnings

${\mathbf{info}}<0$
If ${\mathbf{info}}=-i$, argument $i$ had an illegal value. An explanatory message is output, and execution of the program is terminated.
${\mathbf{info}}>0$
If ${\mathbf{info}}=i$, then $i$ eigenvectors (as indicated by the argument ifailv above) each failed to converge in five iterations. The current iterate after five iterations is stored in the corresponding column of z.

## 7Accuracy

Each computed eigenvector ${z}_{i}$ is the exact eigenvector of a nearby matrix $A+{E}_{i}$, such that
 $Ei = Oε A ,$
where $\epsilon$ is the machine precision. Hence the residual is small:
 $A zi - λi zi = Oε A .$
However, a set of eigenvectors computed by this routine may not be orthogonal to so high a degree of accuracy as those computed by f08jef (dsteqr).

## 8Parallelism and Performance

f08jkf (dstein) is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
f08jkf (dstein) makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.