geneig | R Documentation |
Computes the generalized eigenvalues and eigenvectors for the problem: A x = λ B x. Various methods differ in assumptions about A and B.
geneig(
A = NULL,
B = NULL,
ncomp = 2,
preproc = prep(pass()),
method = c("robust", "sdiag", "geigen", "primme"),
which = "LR",
...
)
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:
|
which |
Only used for |
... |
Additional arguments to pass to the underlying solver. |
A projector
object with generalized eigenvectors and eigenvalues.
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.
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.