# NAG C Library Function Document

## 1Purpose

nag_dsterf (f08jfc) computes all the eigenvalues of a real symmetric tridiagonal matrix.

## 2Specification

 #include #include
 void nag_dsterf (Integer n, double d[], double e[], NagError *fail)

## 3Description

nag_dsterf (f08jfc) computes all the eigenvalues of a real symmetric tridiagonal matrix, using a square-root-free variant of the $QR$ algorithm.
The function uses an explicit shift, and, like nag_dsteqr (f08jec), switches between the $QR$ and $QL$ variants in order to handle graded matrices effectively (see Greenbaum and Dongarra (1980)).

## 4References

Greenbaum A and Dongarra J J (1980) Experiments with QR/QL methods for the symmetric triangular eigenproblem LAPACK Working Note No. 17 (Technical Report CS-89-92) University of Tennessee, Knoxville http://www.netlib.org/lapack/lawnspdf/lawn17.pdf
Parlett B N (1998) The Symmetric Eigenvalue Problem SIAM, Philadelphia

## 5Arguments

1:    $\mathbf{n}$IntegerInput
On entry: $n$, the order of the matrix $T$.
Constraint: ${\mathbf{n}}\ge 0$.
2:    $\mathbf{d}\left[\mathit{dim}\right]$doubleInput/Output
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$.
On exit: the $n$ eigenvalues in ascending order, unless ${\mathbf{fail}}\mathbf{.}\mathbf{code}=$ NE_CONVERGENCE (in which case see Section 6).
3:    $\mathbf{e}\left[\mathit{dim}\right]$doubleInput/Output
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$.
On exit: e is overwritten.
4:    $\mathbf{fail}$NagError *Input/Output
The NAG error argument (see Section 3.7 in How to Use the NAG Library and its Documentation).

## 6Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 2.3.1.2 in How to Use the NAG Library and its Documentation for further information.
On entry, argument $〈\mathit{\text{value}}〉$ had an illegal value.
NE_CONVERGENCE
The algorithm has failed to find all the eigenvalues after a total of $30×{\mathbf{n}}$ iterations; $〈\mathit{\text{value}}〉$ elements of e have not converged to zero.
NE_INT
On entry, ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{n}}\ge 0$.
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.
See Section 2.7.6 in How to Use the NAG Library and its Documentation for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 2.7.5 in How to Use the NAG Library and its Documentation for further information.

## 7Accuracy

The computed eigenvalues are exact for a nearby matrix $\left(T+E\right)$, where
 $E2 = Oε T2 ,$
and $\epsilon$ is the machine precision.
If ${\lambda }_{i}$ is an exact eigenvalue and ${\stackrel{~}{\lambda }}_{i}$ is the corresponding computed value, then
 $λ~i - λi ≤ c n ε T2 ,$
where $c\left(n\right)$ is a modestly increasing function of $n$.

## 8Parallelism and Performance

nag_dsterf (f08jfc) is not threaded in any implementation.

The total number of floating-point operations is typically about $14{n}^{2}$, but depends on how rapidly the algorithm converges. The operations are all performed in scalar mode.
There is no complex analogue of this function.

## 10Example

This example computes all the eigenvalues of the symmetric tridiagonal matrix $T$, where
 $T = -6.99 -0.44 0.00 0.00 -0.44 7.92 -2.63 0.00 0.00 -2.63 2.34 -1.18 0.00 0.00 -1.18 0.32 .$

### 10.1Program Text

Program Text (f08jfce.c)

### 10.2Program Data

Program Data (f08jfce.d)

### 10.3Program Results

Program Results (f08jfce.r)