f08 Chapter Contents
f08 Chapter Introduction
NAG C Library Manual

# NAG Library Function Documentnag_zstein (f08jxc)

## 1  Purpose

nag_zstein (f08jxc) computes the eigenvectors of a real symmetric tridiagonal matrix corresponding to specified eigenvalues, by inverse iteration, storing the eigenvectors in a complex array.

## 2  Specification

 #include #include
 void nag_zstein (Nag_OrderType order, Integer n, const double d[], const double e[], Integer m, const double w[], const Integer iblock[], const Integer isplit[], Complex z[], Integer pdz, Integer ifailv[], NagError *fail)

## 3  Description

nag_zstein (f08jxc) 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 nag_dstebz (f08jjc) with ${\mathbf{rank}}=\mathrm{Nag_ByBlock}$, but may also be used when the eigenvalues have been computed by other functions in Chapters f02 or f08.
The eigenvectors of $T$ are real, but are stored by this function in a complex array. If $T$ has been formed by reduction of a full complex Hermitian matrix $A$ to tridiagonal form, then eigenvectors of $T$ may be transformed to (complex) eigenvectors of $A$ by a call to nag_zunmtr (f08fuc) or nag_zupmtr (f08guc).
nag_dstebz (f08jjc) determines whether the matrix $T$ splits into block diagonal form:
 $T = T1 T2 . . . Tp$
and passes details of the block structure to this function in the arrays iblock and isplit. This function 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.

## 4  References

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

## 5  Arguments

1:     orderNag_OrderTypeInput
On entry: the order argument specifies the two-dimensional storage scheme being used, i.e., row-major ordering or column-major ordering. C language defined storage is specified by ${\mathbf{order}}=\mathrm{Nag_RowMajor}$. See Section 3.2.1.3 in the Essential Introduction for a more detailed explanation of the use of this argument.
Constraint: ${\mathbf{order}}=\mathrm{Nag_RowMajor}$ or Nag_ColMajor.
2:     nIntegerInput
On entry: $n$, the order of the matrix $T$.
Constraint: ${\mathbf{n}}\ge 0$.
3:     d[$\mathit{dim}$]const doubleInput
Note: the dimension, dim, 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$.
4:     e[$\mathit{dim}$]const doubleInput
Note: the dimension, dim, 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$.
5:     mIntegerInput
On entry: $m$, the number of eigenvectors to be returned.
Constraint: $0\le {\mathbf{m}}\le {\mathbf{n}}$.
6:     w[$\mathit{dim}$]const doubleInput
Note: the dimension, dim, 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[0\right]$ to ${\mathbf{w}}\left[m-1\right]$, as returned by nag_dstebz (f08jjc) with ${\mathbf{rank}}=\mathrm{Nag_ByBlock}$. 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}=0,1,\dots ,{\mathbf{m}}-2$.
7:     iblock[$\mathit{dim}$]const IntegerInput
Note: the dimension, dim, 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 nag_dstebz (f08jjc) with ${\mathbf{rank}}=\mathrm{Nag_ByBlock}$. If the eigenvalues were not computed by nag_dstebz (f08jjc) with ${\mathbf{rank}}=\mathrm{Nag_ByBlock}$, set ${\mathbf{iblock}}\left[\mathit{i}-1\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}=0,1,\dots ,{\mathbf{m}}-2$.
8:     isplit[$\mathit{dim}$]const IntegerInput
Note: the dimension, dim, 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 nag_dstebz (f08jjc) with ${\mathbf{rank}}=\mathrm{Nag_ByBlock}$. If the eigenvalues were not computed by nag_dstebz (f08jjc) with ${\mathbf{rank}}=\mathrm{Nag_ByBlock}$, set ${\mathbf{isplit}}\left[0\right]$ to n.
9:     z[$\mathit{dim}$]ComplexOutput
Note: the dimension, dim, of the array z must be at least
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdz}}×{\mathbf{m}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}×{\mathbf{pdz}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
The $\left(i,j\right)$th element of the matrix $Z$ is stored in
• ${\mathbf{z}}\left[\left(j-1\right)×{\mathbf{pdz}}+i-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{z}}\left[\left(i-1\right)×{\mathbf{pdz}}+j-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
On exit: the $m$ eigenvectors, stored as columns of $Z$; the $i$th column corresponds to the $i$th specified eigenvalue, unless NE_CONVERGENCE (in which case see Section 6).
10:   pdzIntegerInput
On entry: the stride separating row or column elements (depending on the value of order) in the array z.
Constraints:
• if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$, ${\mathbf{pdz}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$, ${\mathbf{pdz}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}\right)$.
11:   ifailv[m]IntegerOutput
On exit: if ${\mathbf{fail}}\mathbf{.}\mathbf{errnum}=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$.
12:   failNagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

## 6  Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
On entry, argument $〈\mathit{\text{value}}〉$ had an illegal value.
NE_CONSTRAINT
On entry, ${\mathbf{m}}=〈\mathit{\text{value}}〉$, ${\mathbf{iblock}}\left[\mathit{i}\right]{\mathbf{iblock}}\left[\mathit{i}+1\right]=〈\mathit{\text{value}}〉$ and ${\mathbf{w}}\left[\mathit{i}\right]{\mathbf{w}}\left[\mathit{i}+1\right]=〈\mathit{\text{value}}〉$.
Constraint: , for $\mathit{i}=0,1,\dots ,{\mathbf{m}}-2$
NE_CONVERGENCE
$〈\mathit{\text{value}}〉$ eigenvectors (as indicated by argument ifailv) each failed to converge in five iterations. The current iterate after five iterations is stored in the corresponding column of z.
NE_INT
On entry, ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{n}}\ge 0$.
On entry, ${\mathbf{pdz}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdz}}>0$.
NE_INT_2
On entry, ${\mathbf{m}}=〈\mathit{\text{value}}〉$ and ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: $0\le {\mathbf{m}}\le {\mathbf{n}}$.
On entry, ${\mathbf{pdz}}=〈\mathit{\text{value}}〉$ and ${\mathbf{m}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdz}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}\right)$.
On entry, ${\mathbf{pdz}}=〈\mathit{\text{value}}〉$ and ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdz}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
NE_INT_ARRAY
On entry, ${\mathbf{m}}=〈\mathit{\text{value}}〉$ and ${\mathbf{iblock}}\left[\mathit{i}\right]{\mathbf{iblock}}\left[\mathit{i}+1\right]=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{iblock}}\left[\mathit{i}\right]\le {\mathbf{iblock}}\left[\mathit{i}+1\right]$, for $\mathit{i}=0,1,\dots ,{\mathbf{m}}-2$
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.

## 7  Accuracy

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 function may not be orthogonal to so high a degree of accuracy as those computed by nag_zsteqr (f08jsc).