F08 Chapter Contents
F08 Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentF08SEF (DSYGST)

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

F08SEF (DSYGST) 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 F07FDF (DPOTRF).

## 2  Specification

 SUBROUTINE F08SEF ( ITYPE, UPLO, N, A, LDA, B, LDB, INFO)
 INTEGER ITYPE, N, LDA, LDB, INFO REAL (KIND=nag_wp) A(LDA,*), B(LDB,*) CHARACTER(1) UPLO
The routine may be called by its LAPACK name dsygst.

## 3  Description

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$, F08SEF (DSYGST) must be preceded by a call to F07FDF (DPOTRF) which computes the Cholesky factorization of $B$; $B$ must be positive definite.
The different problem types are specified by the parameter 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$

## 4  References

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

## 5  Parameters

1:     ITYPE – INTEGERInput
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:     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:     N – INTEGERInput
On entry: $n$, the order of the matrices $A$ and $B$.
Constraint: ${\mathbf{N}}\ge 0$.
4:     A(LDA,$*$) – REAL (KIND=nag_wp) arrayInput/Output
Note: the second dimension of the array A must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{N}}\right)$.
On entry: the $n$ by $n$ symmetric matrix $A$.
• If ${\mathbf{UPLO}}=\text{'U'}$, the upper triangular part of $A$ must be stored and the elements of the array below the diagonal are not referenced.
• If ${\mathbf{UPLO}}=\text{'L'}$, the lower triangular part of $A$ must be stored and the elements of the array above the diagonal are not referenced.
On exit: the upper or lower triangle of A is overwritten by the corresponding upper or lower triangle of $C$ as specified by ITYPE and UPLO.
5:     LDA – INTEGERInput
On entry: the first dimension of the array A as declared in the (sub)program from which F08SEF (DSYGST) is called.
Constraint: ${\mathbf{LDA}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{N}}\right)$.
6:     B(LDB,$*$) – REAL (KIND=nag_wp) arrayInput
Note: the second dimension of the array B must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{N}}\right)$.
On entry: the Cholesky factor of $B$ as specified by UPLO and returned by F07FDF (DPOTRF).
7:     LDB – INTEGERInput
On entry: the first dimension of the array B as declared in the (sub)program from which F08SEF (DSYGST) is called.
Constraint: ${\mathbf{LDB}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{N}}\right)$.
8:     INFO – INTEGEROutput
On exit: ${\mathbf{INFO}}=0$ unless the routine detects an error (see Section 6).

## 6  Error Indicators and Warnings

Errors or warnings detected by the routine:
${\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.

## 7  Accuracy

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 F08SEF (DSYGST) 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 (DSYGV) for further details.

The total number of floating point operations is approximately ${n}^{3}$.
The complex analogue of this routine is F08SSF (ZHEGST).

## 9  Example

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 .$
Here $B$ is symmetric positive definite and must first be factorized by F07FDF (DPOTRF). The program calls F08SEF (DSYGST) to reduce the problem to the standard form $Cy=\lambda y$; then F08FEF (DSYTRD) to reduce $C$ to tridiagonal form, and F08JFF (DSTERF) to compute the eigenvalues.

### 9.1  Program Text

Program Text (f08sefe.f90)

### 9.2  Program Data

Program Data (f08sefe.d)

### 9.3  Program Results

Program Results (f08sefe.r)