geneig: Generalized Eigenvalue Decomposition

View source: R/geneig.R

geneigR Documentation

Generalized Eigenvalue Decomposition

Description

Computes the generalized eigenvalues and eigenvectors for the problem: A x = λ B x. Various methods differ in assumptions about A and B.

Usage

geneig(
  A = NULL,
  B = NULL,
  ncomp = 2,
  preproc = prep(pass()),
  method = c("robust", "sdiag", "geigen", "primme"),
  which = "LR",
  ...
)

Arguments

A

The left-hand side square matrix.

B

The right-hand side square matrix, same dimension as A.

ncomp

Number of eigenpairs to return.

preproc

A preprocessing function to apply to the matrices before solving the generalized eigenvalue problem.

method

One of:

  • "robust": Uses a stable decomposition via a whitening transform (B must be symmetric PD).

  • "sdiag": Uses a spectral decomposition of B (must be symmetric PD). Requires A to be symmetric for meaningful results.

  • "geigen": Uses the geigen package for a general solution (A and B can be non-symmetric).

  • "primme": Uses the PRIMME package for large/sparse symmetric problems (A and B must be symmetric).

which

Only used for method = "primme". Specifies which eigenvalues to compute ("LM", "SM", "LA", "SA", etc.). Default is "LM" (Largest Magnitude). See eigs_sym.

...

Additional arguments to pass to the underlying solver.

Value

A projector object with generalized eigenvectors and eigenvalues.

See Also

projector for the base class structure.

#' @references Golub, G. H. & Van Loan, C. F. (2013) Matrix Computations, 4th ed., § 8.7 – textbook derivation for the "robust" (Cholesky) and "sdiag" (spectral) transforms.

Moler, C. & Stewart, G. (1973) "An Algorithm for Generalized Matrix Eigenvalue Problems". SIAM J. Numer. Anal., 10 (2): 241‑256 – the QZ algorithm behind the geigen backend.

Stathopoulos, A. & McCombs, J. R. (2010) "PRIMME: PReconditioned Iterative Multi‑Method Eigensolver". ACM TOMS 37 (2): 21:1‑21:30 – the algorithmic core of the primme backend.

See also the geigen (CRAN) and PRIMME documentation.

Examples

# Simulate two matrices
set.seed(123)
A <- matrix(rnorm(50 * 50), 50, 50)
B <- matrix(rnorm(50 * 50), 50, 50)
A <- A %*% t(A) # Make A symmetric
B <- B %*% t(B) + diag(50) * 0.1 # Make B symmetric positive definite

# Solve generalized eigenvalue problem
result <- geneig(A = A, B = B, ncomp = 3)


bbuchsbaum/multivarious documentation built on July 16, 2025, 11:04 p.m.