F01 Chapter Contents
F01 Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentF01BVF

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

## 1  Purpose

F01BVF transforms the generalized symmetric-definite eigenproblem $Ax=\lambda {\mathbf{B}}x$ to the equivalent standard eigenproblem $Cy=\lambda y$, where $A$, ${\mathbf{B}}$ and $C$ are symmetric band matrices and ${\mathbf{B}}$ is positive definite. ${\mathbf{B}}$ must have been decomposed by F01BUF.

## 2  Specification

 SUBROUTINE F01BVF ( N, MA1, MB1, M3, K, A, LDA, B, LDB, V, LDV, W, IFAIL)
 INTEGER N, MA1, MB1, M3, K, LDA, LDB, LDV, IFAIL REAL (KIND=nag_wp) A(LDA,N), B(LDB,N), V(LDV,M3), W(M3)

## 3  Description

$A$ is a symmetric band matrix of order $n$ and bandwidth $2{m}_{A}+1$. The positive definite symmetric band matrix $B$, of order $n$ and bandwidth $2{m}_{B}+1$, must have been previously decomposed by F01BUF as $ULD{L}^{\mathrm{T}}{U}^{\mathrm{T}}$. F01BVF applies $U$, $L$ and $D$ to $A$, ${m}_{A}$ rows at a time, restoring the band form of $A$ at each stage by plane rotations. The parameter $k$ defines the change-over point in the decomposition of $B$ as used by F01BUF and is also used as a change-over point in the transformations applied by this routine. For maximum efficiency, $k$ should be chosen to be the multiple of ${m}_{A}$ nearest to $n/2$. The resulting symmetric band matrix $C$ is overwritten on A. The eigenvalues of $C$, and thus of the original problem, may be found using F08HEF (DSBTRD) and F08JFF (DSTERF). For selected eigenvalues, use F08HEF (DSBTRD) and F08JJF (DSTEBZ).

## 4  References

Crawford C R (1973) Reduction of a band-symmetric generalized eigenvalue problem Comm. ACM 16 41–44

## 5  Parameters

1:     N – INTEGERInput
On entry: $n$, the order of the matrices $A$, $B$ and $C$.
2:     MA1 – INTEGERInput
On entry: ${m}_{A}+1$, where ${m}_{A}$ is the number of nonzero superdiagonals in $A$. Normally ${\mathbf{MA1}}\ll {\mathbf{N}}$.
3:     MB1 – INTEGERInput
On entry: ${m}_{B}+1$, where ${m}_{B}$ is the number of nonzero superdiagonals in $B$.
Constraint: ${\mathbf{MB1}}\le {\mathbf{MA1}}$.
4:     M3 – INTEGERInput
On entry: the value of $3{m}_{A}+{m}_{B}$.
5:     K – INTEGERInput
On entry: $k$, the change-over point in the transformations. It must be the same as the value used by F01BUF in the decomposition of $B$.
Suggested value: the optimum value is the multiple of ${m}_{A}$ nearest to $n/2$.
Constraint: ${\mathbf{MB1}}-1\le {\mathbf{K}}\le {\mathbf{N}}$.
6:     A(LDA,N) – REAL (KIND=nag_wp) arrayInput/Output
On entry: the upper triangle of the $n$ by $n$ symmetric band matrix $A$, with the diagonal of the matrix stored in the $\left({m}_{A}+1\right)$th row of the array, and the ${m}_{A}$ superdiagonals within the band stored in the first ${m}_{A}$ rows of the array. Each column of the matrix is stored in the corresponding column of the array. For example, if $n=6$ and ${m}_{A}=2$, the storage scheme is
 $* * a13 a24 a35 a46 * a12 a23 a34 a45 a56 a11 a22 a33 a44 a55 a66$
Elements in the top left corner of the array need not be set. The following code assigns the matrix elements within the band to the correct elements of the array:
```    DO 20 J = 1, N
DO 10 I = MAX(1,J-MA1+1), J
A(I-J+MA1,J) = matrix (I,J)
10    CONTINUE
20 CONTINUE
```
On exit: is overwritten by the corresponding elements of $C$.
7:     LDA – INTEGERInput
On entry: the first dimension of the array A as declared in the (sub)program from which F01BVF is called.
Constraint: ${\mathbf{LDA}}\ge {\mathbf{MA1}}$.
8:     B(LDB,N) – REAL (KIND=nag_wp) arrayInput/Output
On entry: the elements of the decomposition of matrix $B$ as returned by F01BUF.
On exit: the elements of B will have been permuted.
9:     LDB – INTEGERInput
On entry: the first dimension of the array B as declared in the (sub)program from which F01BVF is called.
Constraint: ${\mathbf{LDB}}\ge {\mathbf{MB1}}$.
10:   V(LDV,M3) – REAL (KIND=nag_wp) arrayWorkspace
11:   LDV – INTEGERInput
On entry: the first dimension of the array V as declared in the (sub)program from which F01BVF is called.
Constraint: ${\mathbf{LDV}}\ge {m}_{A}+{m}_{B}$.
12:   W(M3) – REAL (KIND=nag_wp) arrayWorkspace
13:   IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to $0$, $-1\text{​ or ​}1$. If you are unfamiliar with this parameter you should refer to Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value $-1\text{​ or ​}1$ is recommended. If the output of error messages is undesirable, then the value $1$ is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is $0$. When the value $-\mathbf{1}\text{​ or ​}\mathbf{1}$ is used it is essential to test the value of IFAIL on exit.
On exit: ${\mathbf{IFAIL}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see Section 6).

## 6  Error Indicators and Warnings

If on entry ${\mathbf{IFAIL}}={\mathbf{0}}$ or $-{\mathbf{1}}$, explanatory error messages are output on the current error message unit (as defined by X04AAF).
Errors or warnings detected by the routine:
${\mathbf{IFAIL}}=1$
 On entry, ${\mathbf{MB1}}>{\mathbf{MA1}}$.

## 7  Accuracy

In general the computed system is exactly congruent to a problem $\left(A+E\right)x=\lambda \left(B+F\right)x$, where $‖E‖$ and $‖F‖$ are of the order of $\epsilon \kappa \left(B\right)‖A‖$ and $\epsilon \kappa \left(B\right)‖B‖$ respectively, where $\kappa \left(B\right)$ is the condition number of $B$ with respect to inversion and $\epsilon$ is the machine precision. This means that when $B$ is positive definite but not well-conditioned with respect to inversion, the method, which effectively involves the inversion of $B$, may lead to a severe loss of accuracy in well-conditioned eigenvalues.

The time taken by F01BVF is approximately proportional to ${n}^{2}{m}_{B}^{2}$ and the distance of $k$ from $n/2$, e.g., $k=n/4$ and $k=3n/4$ take $502%$ longer.
When $B$ is positive definite and well-conditioned with respect to inversion, the generalized symmetric eigenproblem can be reduced to the standard symmetric problem $Py=\lambda y$ where $P={L}^{-1}A{L}^{-\mathrm{T}}$ and $B=L{L}^{\mathrm{T}}$, the Cholesky factorization.
When $A$ and $B$ are of band form, especially if the bandwidth is small compared with the order of the matrices, storage considerations may rule out the possibility of working with $P$ since it will be a full matrix in general. However, for any factorization of the form $B=S{S}^{\mathrm{T}}$, the generalized symmetric problem reduces to the standard form
 $S-1AS-TSTx=λSTx$
and there does exist a factorization such that ${S}^{-1}A{S}^{-\mathrm{T}}$ is still of band form (see Crawford (1973)). Writing
 $C=S-1AS-T and y=STx$
the standard form is $Cy=\lambda y$ and the bandwidth of $C$ is the maximum bandwidth of $A$ and $B$.
Each stage in the transformation consists of two phases. The first reduces a leading principal sub-matrix of $B$ to the identity matrix and this introduces nonzero elements outside the band of $A$. In the second, further transformations are applied which leave the reduced part of $B$ unaltered and drive the extra elements upwards and off the top left corner of $A$. Alternatively, $B$ may be reduced to the identity matrix starting at the bottom right-hand corner and the extra elements introduced in $A$ can be driven downwards.
The advantage of the $ULD{L}^{\mathrm{T}}{U}^{\mathrm{T}}$ decomposition of $B$ is that no extra elements have to be pushed over the whole length of $A$. If $k$ is taken as approximately $n/2$, the shifting is limited to halfway. At each stage the size of the triangular bumps produced in $A$ depends on the number of rows and columns of $B$ which are eliminated in the first phase and on the bandwidth of $B$. The number of rows and columns over which these triangles are moved at each step in the second phase is equal to the bandwidth of $A$.
In this routine, A is defined as being at least as wide as $B$ and must be filled out with zeros if necessary as it is overwritten with $C$. The number of rows and columns of $B$ which are effectively eliminated at each stage is ${m}_{A}$.

## 9  Example

This example finds the three smallest eigenvalues of $Ax=\lambda Bx$, where
 $A= 11 12 12 12 13 13 13 14 14 14 15 15 15 16 16 16 17 17 17 18 18 18 19 19 19$
 $B= 101 22 22 102 23 23 103 24 24 104 25 25 105 26 26 106 27 27 107 28 28 108 29 29 109 .$

### 9.1  Program Text

Program Text (f01bvfe.f90)

### 9.2  Program Data

Program Data (f01bvfe.d)

### 9.3  Program Results

Program Results (f01bvfe.r)