Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

Chapter Contents
Chapter Introduction
NAG Toolbox

# NAG Toolbox: nag_lapack_dsterf (f08jf)

## Purpose

nag_lapack_dsterf (f08jf) computes all the eigenvalues of a real symmetric tridiagonal matrix.

## Syntax

[d, e, info] = f08jf(d, e, 'n', n)
[d, e, info] = nag_lapack_dsterf(d, e, 'n', n)

## Description

nag_lapack_dsterf (f08jf) 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_lapack_dsteqr (f08je), switches between the $QR$ and $QL$ variants in order to handle graded matrices effectively (see Greenbaum and Dongarra (1980)).

## References

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

## Parameters

### Compulsory Input Parameters

1:     $\mathrm{d}\left(:\right)$ – double array
The dimension of the array d must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$
The diagonal elements of the tridiagonal matrix $T$.
2:     $\mathrm{e}\left(:\right)$ – double array
The dimension of the array e must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}-1\right)$
The off-diagonal elements of the tridiagonal matrix $T$.

### Optional Input Parameters

1:     $\mathrm{n}$int64int32nag_int scalar
Default: the first dimension of the array d and the second dimension of the array d. (An error is raised if these dimensions are not equal.)
$n$, the order of the matrix $T$.
Constraint: ${\mathbf{n}}\ge 0$.

### Output Parameters

1:     $\mathrm{d}\left(:\right)$ – double array
The dimension of the array d will be $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$
The $n$ eigenvalues in ascending order, unless ${\mathbf{info}}>{\mathbf{0}}$ (in which case see Error Indicators and Warnings).
2:     $\mathrm{e}\left(:\right)$ – double array
The dimension of the array e will be $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}-1\right)$
3:     $\mathrm{info}$int64int32nag_int scalar
${\mathbf{info}}=0$ unless the function detects an error (see Error Indicators and Warnings).

## Error Indicators and Warnings

Cases prefixed with W are classified as warnings and do not generate an error of type NAG:error_n. See nag_issue_warnings.

${\mathbf{info}}=-i$
If ${\mathbf{info}}=-i$, parameter $i$ had an illegal value on entry. The parameters are numbered as follows:
1: n, 2: d, 3: e, 4: info.
W  ${\mathbf{info}}>0$
The algorithm has failed to find all the eigenvalues after a total of $30×{\mathbf{n}}$ iterations. If ${\mathbf{info}}=i$, then on exit $i$ elements of e have not converged to zero.

## Accuracy

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$.

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.

## Example

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 .$
```function f08jf_example

fprintf('f08jf example results\n\n');

% Symmetric tridiagonal A stored as diagonal and off-diagonal
n = 4;
d = [-6.99;     7.92;     2.34;     0.32];
e = [-0.44;    -2.63;    -1.18];

% Eigenvalues only of A
[w, ~, info] = f08jf( ...
d, e);

disp('Eigenvalues');
disp(w');

```
```f08jf example results

Eigenvalues
-7.0037   -0.4059    2.0028    8.9968

```