# ?sygs2/?hegs2

Reduces a symmetric/Hermitian definite generalized eigenproblem to standard form, using the factorization results obtained from ?potrf (unblocked algorithm).

## Syntax

call ssygs2( itype, uplo, n, a, lda, b, ldb, info )

call dsygs2( itype, uplo, n, a, lda, b, ldb, info )

call chegs2( itype, uplo, n, a, lda, b, ldb, info )

call zhegs2( itype, uplo, n, a, lda, b, ldb, info )

## Description

The routine ?sygs2/?hegs2 reduces a real symmetric-definite or a complex Hermitian-definite generalized eigenproblem to standard form.

If `itype = 1`, the problem is

`A*x = λ*B*x`

and A is overwritten by `inv(U')*A*inv(U)`, or `inv(L)*A*inv(L')`.

If `itype = 2` or `3`, the problem is

`A*B*x = λ*x`, or `B*A*x = λ*x`,

and A is overwritten by `U*A*U'` or `L'*A*L`. Here `U'`(`L'`) is the transpose (conjugate transpose) of U (L).

B must be previously factorized as `U'*U` or `L*L'` by ?potrf.

## Input Parameters

itype

  INTEGER.

  = 1: compute `inv(U')*A*inv(U),` or `inv(L)*A*inv(L')`;

  = 2 or 3: compute `U*A*U'`, or `L'*A*L`.

uplo

  CHARACTER*1. Specifies whether the upper or lower triangular part of the symmetric/Hermitian matrix A is stored, and how B has been factorized.

  = 'U': upper triangular

  = 'L': lower triangular

n

  INTEGER. The order of the matrices A and B. `n ≥ 0`.

a

  REAL for ssygs2

  DOUBLE PRECISION for dsygs2

  COMPLEX for chegs2

  COMPLEX*16 for zhegs2.

  Array, DIMENSION (lda, n).

  On entry, the symmetric/Hermitian matrix A.

  If `uplo = 'U'`, the leading n-by-n upper triangular part of a contains the upper triangular part of the matrix A, and the strictly lower triangular part of a is not referenced.

  If `uplo = 'L'`, the leading n-by-n lower triangular part of a contains the lower triangular part of the matrix A, and the strictly upper triangular part of a is not referenced.

lda

  INTEGER.

  The leading dimension of the array a. `lda ≥ max(1,n)`.

b

  REAL for ssygs2

  DOUBLE PRECISION for dsygs2

  COMPLEX for chegs2

  COMPLEX*16 for zhegs2.

  Array, DIMENSION (ldb, n).

  The triangular factor from the Cholesky factorization of B as returned by ?potrf.

ldb

  INTEGER. The leading dimension of the array b. `ldb ≥ max(1,n)`.

## Output Parameters

a

  On exit, If `info = 0`, the transformed matrix, stored in the same format as A.

info

  INTEGER.

  = 0: successful exit.

  < 0: if `info = -i`, the i-th argument had an illegal value.

Parent topic: Auxiliary Routines