# NAG FL Interfacef08tef (dspgst)

## 1Purpose

f08tef reduces a real symmetric-definite generalized eigenproblem $Az=\lambda Bz$, $ABz=\lambda z$ or $BAz=\lambda z$ to the standard form $Cy=\lambda y$, where $A$ is a real symmetric matrix and $B$ has been factorized by f07gdf, using packed storage.

## 2Specification

Fortran Interface
 Subroutine f08tef ( uplo, n, ap, bp, info)
 Integer, Intent (In) :: itype, n Integer, Intent (Out) :: info Real (Kind=nag_wp), Intent (In) :: bp(*) Real (Kind=nag_wp), Intent (Inout) :: ap(*) Character (1), Intent (In) :: uplo
#include <nag.h>
 void f08tef_ (const Integer *itype, const char *uplo, const Integer *n, double ap[], const double bp[], Integer *info, const Charlen length_uplo)
The routine may be called by the names f08tef, nagf_lapackeig_dspgst or its LAPACK name dspgst.

## 3Description

To reduce the real symmetric-definite generalized eigenproblem $Az=\lambda Bz$, $ABz=\lambda z$ or $BAz=\lambda z$ to the standard form $Cy=\lambda y$ using packed storage, f08tef must be preceded by a call to f07gdf which computes the Cholesky factorization of $B$; $B$ must be positive definite.
The different problem types are specified by the argument itype, as indicated in the table below. The table shows how $C$ is computed by the routine, and also how the eigenvectors $z$ of the original problem can be recovered from the eigenvectors of the standard form.
 itype Problem uplo $B$ $C$ $z$ $1$ $Az=\lambda Bz$ 'U' 'L' ${U}^{\mathrm{T}}U$ $L{L}^{\mathrm{T}}$ ${U}^{-\mathrm{T}}A{U}^{-1}$ ${L}^{-1}A{L}^{-\mathrm{T}}$ ${U}^{-1}y$ ${L}^{-\mathrm{T}}y$ $2$ $ABz=\lambda z$ 'U' 'L' ${U}^{\mathrm{T}}U$ $L{L}^{\mathrm{T}}$ $UA{U}^{\mathrm{T}}$ ${L}^{\mathrm{T}}AL$ ${U}^{-1}y$ ${L}^{-\mathrm{T}}y$ $3$ $BAz=\lambda z$ 'U' 'L' ${U}^{\mathrm{T}}U$ $L{L}^{\mathrm{T}}$ $UA{U}^{\mathrm{T}}$ ${L}^{\mathrm{T}}AL$ ${U}^{\mathrm{T}}y$ $Ly$

## 4References

Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore

## 5Arguments

1: $\mathbf{itype}$Integer Input
On entry: indicates how the standard form is computed.
${\mathbf{itype}}=1$
• if ${\mathbf{uplo}}=\text{'U'}$, $C={U}^{-\mathrm{T}}A{U}^{-1}$;
• if ${\mathbf{uplo}}=\text{'L'}$, $C={L}^{-1}A{L}^{-\mathrm{T}}$.
${\mathbf{itype}}=2$ or $3$
• if ${\mathbf{uplo}}=\text{'U'}$, $C=UA{U}^{\mathrm{T}}$;
• if ${\mathbf{uplo}}=\text{'L'}$, $C={L}^{\mathrm{T}}AL$.
Constraint: ${\mathbf{itype}}=1$, $2$ or $3$.
2: $\mathbf{uplo}$Character(1) Input
On entry: indicates whether the upper or lower triangular part of $A$ is stored and how $B$ has been factorized.
${\mathbf{uplo}}=\text{'U'}$
The upper triangular part of $A$ is stored and $B={U}^{\mathrm{T}}U$.
${\mathbf{uplo}}=\text{'L'}$
The lower triangular part of $A$ is stored and $B=L{L}^{\mathrm{T}}$.
Constraint: ${\mathbf{uplo}}=\text{'U'}$ or $\text{'L'}$.
3: $\mathbf{n}$Integer Input
On entry: $n$, the order of the matrices $A$ and $B$.
Constraint: ${\mathbf{n}}\ge 0$.
4: $\mathbf{ap}\left(*\right)$Real (Kind=nag_wp) array Input/Output
Note: the dimension of the array ap must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}×\left({\mathbf{n}}+1\right)/2\right)$.
On entry: the upper or lower triangle of the $n$ by $n$ symmetric matrix $A$, packed by columns.
More precisely,
• if ${\mathbf{uplo}}=\text{'U'}$, the upper triangle of $A$ must be stored with element ${A}_{ij}$ in ${\mathbf{ap}}\left(i+j\left(j-1\right)/2\right)$ for $i\le j$;
• if ${\mathbf{uplo}}=\text{'L'}$, the lower triangle of $A$ must be stored with element ${A}_{ij}$ in ${\mathbf{ap}}\left(i+\left(2n-j\right)\left(j-1\right)/2\right)$ for $i\ge j$.
On exit: the upper or lower triangle of ap is overwritten by the corresponding upper or lower triangle of $C$ as specified by itype and uplo, using the same packed storage format as described above.
5: $\mathbf{bp}\left(*\right)$Real (Kind=nag_wp) array Input
Note: the dimension of the array bp must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}×\left({\mathbf{n}}+1\right)/2\right)$.
On entry: the Cholesky factor of $B$ as specified by uplo and returned by f07gdf.
6: $\mathbf{info}$Integer Output
On exit: ${\mathbf{info}}=0$ unless the routine detects an error (see Section 6).

## 6Error Indicators and Warnings

${\mathbf{info}}<0$
If ${\mathbf{info}}=-i$, argument $i$ had an illegal value. An explanatory message is output, and execution of the program is terminated.

## 7Accuracy

Forming the reduced matrix $C$ is a stable procedure. However it involves implicit multiplication by ${B}^{-1}$ if (${\mathbf{itype}}=1$) or $B$ (if ${\mathbf{itype}}=2$ or $3$). When f08tef is used as a step in the computation of eigenvalues and eigenvectors of the original problem, there may be a significant loss of accuracy if $B$ is ill-conditioned with respect to inversion. See the document for f08saf for further details.

## 8Parallelism and Performance

f08tef makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

The total number of floating-point operations is approximately ${n}^{3}$.
The complex analogue of this routine is f08tsf.

## 10Example

This example computes all the eigenvalues of $Az=\lambda Bz$, where
 $A = 0.24 0.39 0.42 -0.16 0.39 -0.11 0.79 0.63 0.42 0.79 -0.25 0.48 -0.16 0.63 0.48 -0.03 and B= 4.16 -3.12 0.56 -0.10 -3.12 5.03 -0.83 1.09 0.56 -0.83 0.76 0.34 -0.10 1.09 0.34 1.18 ,$
using packed storage. Here $B$ is symmetric positive definite and must first be factorized by f07gdf. The program calls f08tef to reduce the problem to the standard form $Cy=\lambda y$; then f08gef to reduce $C$ to tridiagonal form, and f08jff to compute the eigenvalues.

### 10.1Program Text

Program Text (f08tefe.f90)

### 10.2Program Data

Program Data (f08tefe.d)

### 10.3Program Results

Program Results (f08tefe.r)