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_dsbtrd (f08he)

## Purpose

nag_lapack_dsbtrd (f08he) reduces a real symmetric band matrix to tridiagonal form.

## Syntax

[ab, d, e, q, info] = f08he(vect, uplo, kd, ab, q, 'n', n)
[ab, d, e, q, info] = nag_lapack_dsbtrd(vect, uplo, kd, ab, q, 'n', n)

## Description

nag_lapack_dsbtrd (f08he) reduces a symmetric band matrix A$A$ to symmetric tridiagonal form T$T$ by an orthogonal similarity transformation:
 T = QT A Q . $T = QT A Q .$
The orthogonal matrix Q$Q$ is determined as a product of Givens rotation matrices, and may be formed explicitly by the function if required.
The function uses a vectorizable form of the reduction, due to Kaufman (1984).

## References

Kaufman L (1984) Banded eigenvalue solvers on vector machines ACM Trans. Math. Software 10 73–86
Parlett B N (1998) The Symmetric Eigenvalue Problem SIAM, Philadelphia

## Parameters

### Compulsory Input Parameters

1:     vect – string (length ≥ 1)
Indicates whether Q$Q$ is to be returned.
vect = 'V'${\mathbf{vect}}=\text{'V'}$
Q$Q$ is returned.
vect = 'U'${\mathbf{vect}}=\text{'U'}$
Q$Q$ is updated (and the array q must contain a matrix on entry).
vect = 'N'${\mathbf{vect}}=\text{'N'}$
Q$Q$ is not required.
Constraint: vect = 'V'${\mathbf{vect}}=\text{'V'}$, 'U'$\text{'U'}$ or 'N'$\text{'N'}$.
2:     uplo – string (length ≥ 1)
Indicates whether the upper or lower triangular part of A$A$ is stored.
uplo = 'U'${\mathbf{uplo}}=\text{'U'}$
The upper triangular part of A$A$ is stored.
uplo = 'L'${\mathbf{uplo}}=\text{'L'}$
The lower triangular part of A$A$ is stored.
Constraint: uplo = 'U'${\mathbf{uplo}}=\text{'U'}$ or 'L'$\text{'L'}$.
3:     kd – int64int32nag_int scalar
If uplo = 'U'${\mathbf{uplo}}=\text{'U'}$, the number of superdiagonals, kd${k}_{d}$, of the matrix A$A$.
If uplo = 'L'${\mathbf{uplo}}=\text{'L'}$, the number of subdiagonals, kd${k}_{d}$, of the matrix A$A$.
Constraint: kd0${\mathbf{kd}}\ge 0$.
4:     ab(ldab, : $:$) – double array
The first dimension of the array ab must be at least max (1,kd + 1)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{kd}}+1\right)$
The second dimension of the array must be at least max (1,n)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$
The upper or lower triangle of the n$n$ by n$n$ symmetric band matrix A$A$.
The matrix is stored in rows 1$1$ to kd + 1${k}_{d}+1$, more precisely,
• if uplo = 'U'${\mathbf{uplo}}=\text{'U'}$, the elements of the upper triangle of A$A$ within the band must be stored with element Aij${A}_{ij}$ in ab(kd + 1 + ij,j)​ for ​max (1,jkd)ij${\mathbf{ab}}\left({k}_{d}+1+i-j,j\right)\text{​ for ​}\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,j-{k}_{d}\right)\le i\le j$;
• if uplo = 'L'${\mathbf{uplo}}=\text{'L'}$, the elements of the lower triangle of A$A$ within the band must be stored with element Aij${A}_{ij}$ in ab(1 + ij,j)​ for ​jimin (n,j + kd).${\mathbf{ab}}\left(1+i-j,j\right)\text{​ for ​}j\le i\le \mathrm{min}\phantom{\rule{0.125em}{0ex}}\left(n,j+{k}_{d}\right)\text{.}$
5:     q(ldq, : $:$) – double array
The first dimension, ldq, of the array q must satisfy
• if vect = 'V'${\mathbf{vect}}=\text{'V'}$ or 'U'$\text{'U'}$, ldq max (1,n) $\mathit{ldq}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$;
• if vect = 'N'${\mathbf{vect}}=\text{'N'}$, ldq1$\mathit{ldq}\ge 1$.
The second dimension of the array must be at least max (1,n)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$ if vect = 'V'${\mathbf{vect}}=\text{'V'}$ or 'U'$\text{'U'}$ and at least 1$1$ if vect = 'N'${\mathbf{vect}}=\text{'N'}$
If vect = 'U'${\mathbf{vect}}=\text{'U'}$, q must contain the matrix formed in a previous stage of the reduction (for example, the reduction of a banded symmetric-definite generalized eigenproblem); otherwise q need not be set.

### Optional Input Parameters

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

ldab ldq work

### Output Parameters

1:     ab(ldab, : $:$) – double array
The first dimension of the array ab will be max (1,kd + 1)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{kd}}+1\right)$
The second dimension of the array will be max (1,n)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$
ldab max (1,kd + 1) $\mathit{ldab}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{kd}}+1\right)$.
ab stores values generated during the reduction to tridiagonal form.
The first superdiagonal or subdiagonal and the diagonal of the tridiagonal matrix T$T$ are returned in ab using the same storage format as described above.
2:     d(n) – double array
The diagonal elements of the tridiagonal matrix T$T$.
3:     e(n1${\mathbf{n}}-1$) – double array
The off-diagonal elements of the tridiagonal matrix T$T$.
4:     q(ldq, : $:$) – double array
The first dimension, ldq, of the array q will be
• if vect = 'V'${\mathbf{vect}}=\text{'V'}$ or 'U'$\text{'U'}$, ldq max (1,n) $\mathit{ldq}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$;
• if vect = 'N'${\mathbf{vect}}=\text{'N'}$, ldq1$\mathit{ldq}\ge 1$.
The second dimension of the array will be max (1,n)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$ if vect = 'V'${\mathbf{vect}}=\text{'V'}$ or 'U'$\text{'U'}$ and at least 1$1$ if vect = 'N'${\mathbf{vect}}=\text{'N'}$
If vect = 'V'${\mathbf{vect}}=\text{'V'}$ or 'U'$\text{'U'}$, the n$n$ by n$n$ matrix Q$Q$.
If vect = 'N'${\mathbf{vect}}=\text{'N'}$, q is not referenced.
5:     info – int64int32nag_int scalar
info = 0${\mathbf{info}}=0$ unless the function detects an error (see Section [Error Indicators and Warnings]).

## Error Indicators and Warnings

info = i${\mathbf{info}}=-i$
If info = i${\mathbf{info}}=-i$, parameter i$i$ had an illegal value on entry. The parameters are numbered as follows:
1: vect, 2: uplo, 3: n, 4: kd, 5: ab, 6: ldab, 7: d, 8: e, 9: q, 10: ldq, 11: work, 12: info.
It is possible that info refers to a parameter that is omitted from the MATLAB interface. This usually indicates that an error in one of the other input parameters has caused an incorrect value to be inferred.

## Accuracy

The computed tridiagonal matrix T$T$ is exactly similar to a nearby matrix (A + E)$\left(A+E\right)$, where
 ‖E‖2 ≤ c (n) ε ‖A‖2 , $‖E‖2≤ c (n) ε ‖A‖2 ,$
c(n)$c\left(n\right)$ is a modestly increasing function of n$n$, and ε$\epsilon$ is the machine precision.
The elements of T$T$ themselves may be sensitive to small perturbations in A$A$ or to rounding errors in the computation, but this does not affect the stability of the eigenvalues and eigenvectors.
The computed matrix Q$Q$ differs from an exactly orthogonal matrix by a matrix E$E$ such that
 ‖E‖2 = O(ε) , $‖E‖2 = O(ε) ,$
where ε$\epsilon$ is the machine precision.

The total number of floating point operations is approximately 6n2k$6{n}^{2}k$ if vect = 'N'${\mathbf{vect}}=\text{'N'}$ with 3n3(k1) / k$3{n}^{3}\left(k-1\right)/k$ additional operations if vect = 'V'${\mathbf{vect}}=\text{'V'}$.
The complex analogue of this function is nag_lapack_zhbtrd (f08hs).

## Example

```function nag_lapack_dsbtrd_example
vect = 'V';
uplo = 'L';
kd = int64(2);
ab = [4.99, 1.05, -2.31, -0.43;
0.04, -0.79, -1.3, 0;
0.22, 1.04, 0, 0];
q = zeros(4, 4);
[abOut, d, e, qOut, info] = nag_lapack_dsbtrd(vect, uplo, kd, ab, q)
```
```

4.9900   -2.4806   -0.0661    0.8567
0.2236    1.1030    1.4301         0
0.2200   -1.0930         0         0

d =

4.9900
-2.4806
-0.0661
0.8567

e =

0.2236
1.1030
1.4301

qOut =

1.0000         0         0         0
0    0.1789   -0.1321   -0.9750
0    0.9839    0.0240    0.1773
0         0   -0.9909    0.1343

info =

0

```
```function f08he_example
vect = 'V';
uplo = 'L';
kd = int64(2);
ab = [4.99, 1.05, -2.31, -0.43;
0.04, -0.79, -1.3, 0;
0.22, 1.04, 0, 0];
q = zeros(4, 4);
[abOut, d, e, qOut, info] = f08he(vect, uplo, kd, ab, q)
```
```

4.9900   -2.4806   -0.0661    0.8567
0.2236    1.1030    1.4301         0
0.2200   -1.0930         0         0

d =

4.9900
-2.4806
-0.0661
0.8567

e =

0.2236
1.1030
1.4301

qOut =

1.0000         0         0         0
0    0.1789   -0.1321   -0.9750
0    0.9839    0.0240    0.1773
0         0   -0.9909    0.1343

info =

0

```

Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2013