F08 Chapter Contents
F08 Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentF08TSF (ZHPGST)

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

F08TSF (ZHPGST) reduces a complex Hermitian-definite generalized eigenproblem $Az=\lambda Bz$, $ABz=\lambda z$ or $BAz=\lambda z$ to the standard form $Cy=\lambda y$, where $A$ is a complex Hermitian matrix and $B$ has been factorized by F07GRF (ZPPTRF), using packed storage.

## 2  Specification

 SUBROUTINE F08TSF ( ITYPE, UPLO, N, AP, BP, INFO)
 INTEGER ITYPE, N, INFO COMPLEX (KIND=nag_wp) AP(*), BP(*) CHARACTER(1) UPLO
The routine may be called by its LAPACK name zhpgst.

## 3  Description

To reduce the complex Hermitian-definite generalized eigenproblem $Az=\lambda Bz$, $ABz=\lambda z$ or $BAz=\lambda z$ to the standard form $Cy=\lambda y$ using packed storage, F08TSF (ZHPGST) must be preceded by a call to F07GRF (ZPPTRF) 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{H}}U$  $L{L}^{\mathrm{H}}$ ${U}^{-\mathrm{H}}A{U}^{-1}$  ${L}^{-1}A{L}^{-\mathrm{H}}$ ${U}^{-1}y$  ${L}^{-\mathrm{H}}y$ $2$ $ABz=\lambda z$ 'U' 'L' ${U}^{\mathrm{H}}U$  $L{L}^{\mathrm{H}}$ $UA{U}^{\mathrm{H}}$  ${L}^{\mathrm{H}}AL$ ${U}^{-1}y$  ${L}^{-\mathrm{H}}y$ $3$ $BAz=\lambda z$ 'U' 'L' ${U}^{\mathrm{H}}U$  $L{L}^{\mathrm{H}}$ $UA{U}^{\mathrm{H}}$  ${L}^{\mathrm{H}}AL$ ${U}^{\mathrm{H}}y$  $Ly$

## 4  References

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

## 5  Arguments

1:     $\mathrm{ITYPE}$ – INTEGERInput
On entry: indicates how the standard form is computed.
${\mathbf{ITYPE}}=1$
• if ${\mathbf{UPLO}}=\text{'U'}$, $C={U}^{-\mathrm{H}}A{U}^{-1}$;
• if ${\mathbf{UPLO}}=\text{'L'}$, $C={L}^{-1}A{L}^{-\mathrm{H}}$.
${\mathbf{ITYPE}}=2$ or $3$
• if ${\mathbf{UPLO}}=\text{'U'}$, $C=UA{U}^{\mathrm{H}}$;
• if ${\mathbf{UPLO}}=\text{'L'}$, $C={L}^{\mathrm{H}}AL$.
Constraint: ${\mathbf{ITYPE}}=1$, $2$ or $3$.
2:     $\mathrm{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{H}}U$.
${\mathbf{UPLO}}=\text{'L'}$
The lower triangular part of $A$ is stored and $B=L{L}^{\mathrm{H}}$.
Constraint: ${\mathbf{UPLO}}=\text{'U'}$ or $\text{'L'}$.
3:     $\mathrm{N}$ – INTEGERInput
On entry: $n$, the order of the matrices $A$ and $B$.
Constraint: ${\mathbf{N}}\ge 0$.
4:     $\mathrm{AP}\left(*\right)$ – COMPLEX (KIND=nag_wp) arrayInput/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$ Hermitian 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:     $\mathrm{BP}\left(*\right)$ – COMPLEX (KIND=nag_wp) arrayInput
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 F07GRF (ZPPTRF).
6:     $\mathrm{INFO}$ – INTEGEROutput
On exit: ${\mathbf{INFO}}=0$ unless the routine detects an error (see Section 6).

## 6  Error 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.

## 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 F08TSF (ZHPGST) 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 F08SNF (ZHEGV) for further details.

## 8  Parallelism and Performance

F08TSF (ZHPGST) 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 real floating-point operations is approximately $4{n}^{3}$.
The real analogue of this routine is F08TEF (DSPGST).

## 10  Example

This example computes all the eigenvalues of $Az=\lambda Bz$, where
 $A = -7.36+0.00i 0.77-0.43i -0.64-0.92i 3.01-6.97i 0.77+0.43i 3.49+0.00i 2.19+4.45i 1.90+3.73i -0.64+0.92i 2.19-4.45i 0.12+0.00i 2.88-3.17i 3.01+6.97i 1.90-3.73i 2.88+3.17i -2.54+0.00i$
and
 $B = 3.23+0.00i 1.51-1.92i 1.90+0.84i 0.42+2.50i 1.51+1.92i 3.58+0.00i -0.23+1.11i -1.18+1.37i 1.90-0.84i -0.23-1.11i 4.09+0.00i 2.33-0.14i 0.42-2.50i -1.18-1.37i 2.33+0.14i 4.29+0.00i ,$
using packed storage. Here $B$ is Hermitian positive definite and must first be factorized by F07GRF (ZPPTRF). The program calls F08TSF (ZHPGST) to reduce the problem to the standard form $Cy=\lambda y$; then F08GSF (ZHPTRD) to reduce $C$ to tridiagonal form, and F08JFF (DSTERF) to compute the eigenvalues.

### 10.1  Program Text

Program Text (f08tsfe.f90)

### 10.2  Program Data

Program Data (f08tsfe.d)

### 10.3  Program Results

Program Results (f08tsfe.r)