Reputation: 365
How can I calculate the joint eigenvalues of matrices A and B defined as the roots of the equation det(lambda * A - B) = 0 in R?
In Matlab, the function [V,D] = eig(A,B)
accepts one or two matrices as input parameters (example: How can I find the joint eigenvalues of two matrices in MATLAB?). The R function e=eigen(A)
does not seem to have the same feature. Are there alternative ways to calculate the joint eigenvalues in R?
Upvotes: 1
Views: 167
Reputation: 84529
You can do that with the geigen
package.
library(geigen)
A <- toeplitz(c(2,1))
B <- toeplitz(c(4,3))
jointEigen <- geigen(B, A)
lambda <- jointEigen$values[1]
det(lambda*A - B)
# 0
Upvotes: 1