# geigen: Generalized Eigenvalues In geigen: Calculate Generalized Eigenvalues, the Generalized Schur Decomposition and the Generalized Singular Value Decomposition of a Matrix Pair with Lapack

## Description

Computes generalized eigenvalues and eigenvectors of a pair of matrices.

## Usage

 `1` ```geigen(A, B, symmetric, only.values=FALSE) ```

## Arguments

 `A` left hand side matrix. `B` right hand side matrix. `symmetric` if `TRUE`, both matrices are assumed to be symmetric (or Hermitian if complex) and only their lower triangle (diagonal included) is used. If `symmetric` is not specified, the matrices are inspected for symmetry. `only.values` if `TRUE` only eigenvalues are computed otherwise both eigenvalues and eigenvctors are returned.

## Details

If the argument `symmetric` is missing, the function will try to determine if the matrices are symmetric with the function `isSymmetric` from the base package. It is faster to specify the argument.

Both matrices must be square. This function provides the solution to the generalized eigenvalue problem defined by

A*x = lambda B*x

If either one of the matrices is complex the other matrix is coerced to be complex.

If the matrices are symmetric then the matrix `B` must be positive definite; if it is not an error message will be issued. If the matrix `B` is known to be symmetric but not positive definite then the argument `symmetric` should be set to `FALSE` explicitly.

If the matrix `B` is not positive definite when it should be an error message of the form

` Leading minor of order ... of B is not positive definite`

will be issued. In that case set the argument `symmetric` to `FALSE` if not set and try again.

For general matrices the generalized eigenvalues lambda are calculated as the ratio alpha/beta where beta may be zero or very small leading to non finite or very large values for the eigenvalues. Therefore the values for alpha and beta are also included in the return value of the function. When both matrices are complex (or coerced to be so) the generalized eigenvalues, alpha and beta are complex. When both matrices are numeric alpha may be numeric or complex and beta is numeric.

When both matrices are symmetric (or Hermitian) the generalized eigenvalues are numeric and no components alpha and beta are available.

## Value

A list containing components

 `values` a vector containing the n generalized eigenvalues. `vectors` an n-by-n matrix containing the generalized eigenvectors or NULL if `only.values` is `TRUE`. `alpha` the numerator of the generalized eigenvalues and may be NULL if not applicable. `beta` the denominator of the generalized eigenvalues and may be NULL if not applicable.

## Source

`geigen` uses the LAPACK routines `DGGEV`, `DSYGV`, `ZHEGV` and `ZGGEV`. LAPACK is from http://www.netlib.org/lapack. The complex routines used by the package come from LAPACK 3.8.0.

## References

Anderson. E. and ten others (1999) LAPACK Users' Guide. Third Edition. SIAM.
Available on-line at http://www.netlib.org/lapack/lug/lapack_lug.html. See the section Generalized Eigenvalue and Singular Value Problems (http://www.netlib.org/lapack/lug/node33.html).

`eigen`

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32``` ```A <- matrix(c(14, 10, 12, 10, 12, 13, 12, 13, 14), nrow=3, byrow=TRUE) B <- matrix(c(48, 17, 26, 17, 33, 32, 26, 32, 34), nrow=3, byrow=TRUE) z1 <- geigen(A, B, symmetric=FALSE, only.values=TRUE) z2 <- geigen(A, B, symmetric=FALSE, only.values=FALSE ) z2 # geigen(A, B) z1 <- geigen(A, B, only.values=TRUE) z2 <- geigen(A, B, only.values=FALSE) z1;z2 A.c <- A + 1i B.c <- B + 1i A[upper.tri(A)] <- A[upper.tri(A)] + 1i A[lower.tri(A)] <- Conj(t(A[upper.tri(A)])) B[upper.tri(B)] <- B[upper.tri(B)] + 1i B[lower.tri(B)] <- Conj(t(B[upper.tri(B)])) isSymmetric(A) isSymmetric(B) z1 <- geigen(A, B, only.values=TRUE) z2 <- geigen(A, B, only.values=FALSE) z1;z2 ```

### Example output

```\$values
[1]  0.4187472  0.1318637 -0.4643638

\$vectors
[,1]       [,2]       [,3]
[1,] -0.3120432  1.0000000 -0.2372125
[2,] -0.2744767 -0.3316136 -0.8642553
[3,] -1.0000000 -0.5947330  1.0000000

\$alpha
[1] 31.9414378  3.4003231 -0.2025574

\$beta
[1] 76.2785706 25.7866569  0.4362041

\$values
[1] -0.4643638  0.1318637  0.4187472

\$vectors
NULL

\$alpha
NULL

\$beta
NULL

\$values
[1] -0.4643638  0.1318637  0.4187472

\$vectors
[,1]        [,2]       [,3]
[1,] -0.2891757 -0.17130678 0.03536261
[2,] -1.0535770  0.05680765 0.03110534
[3,]  1.2190576  0.10188180 0.11332600

\$alpha
NULL

\$beta
NULL

[1] TRUE
[1] TRUE
\$values
[1] -0.7044551  0.1653871  0.4351390

\$vectors
NULL

\$alpha
NULL

\$beta
NULL

\$values
[1] -0.7044551  0.1653871  0.4351390

\$vectors
[,1]                  [,2]                    [,3]
[1,]  0.1632469+0.2544924i  0.1569196-0.0633106i -0.03140445-0.04366039i
[2,]  0.3640465+1.0043941i -0.0783497-0.2088297i -0.04977910-0.12972701i
[3,] -0.5278801-1.1202501i -0.0450348+0.2581692i -0.09245599+0.17089589i

\$alpha
NULL

\$beta
NULL
```

geigen documentation built on May 30, 2019, 5:03 p.m.