Computes eigenvalues and eigenvectors of numeric (double, integer, logical) or complex matrices.
eigen(x, symmetric, only.values = FALSE, EISPACK = FALSE)
- a numeric or complex matrix whose spectral decomposition is to be computed. Logical matrices are coerced to numeric.
TRUE, the matrix is assumed to be symmetric (or Hermitian if complex) and only its lower triangle (diagonal included) is used. If
symmetricis not specified, the matrix is inspected for symmetry.
TRUE, only the eigenvalues are computed and returned, otherwise both eigenvalues and eigenvectors are returned.
- logical. Defunct and ignored (with a warning for true values).
symmetric is unspecified, the code attempts to determine if the matrix is symmetric up to plausible numerical inaccuracies. It is faster and surer to set the value yourself.
Computing the eigenvectors is the slow part for large matrices.
Computing the eigendecomposition of a matrix is subject to errors on a real-world computer: the definitive analysis is Wilkinson (1965). All you can hope for is a solution to a problem suitably close to
x. So even though a real asymmetric
x may have an algebraic solution with repeated real eigenvalues, the computed solution may be of a similar matrix with complex conjugate pairs of eigenvalues.
The spectral decomposition of
x is returned as components of a list with components
- a vector containing the p eigenvalues of
x, sorted in decreasing order, according to
Mod(values)in the asymmetric case when they might be complex (even for real matrices). For real asymmetric matrices the vector will be complex only if complex conjugate pairs of eigenvalues are detected.
- either a p * p matrix whose columns contain the eigenvectors of
TRUE. The vectors are normalized to unit length.
Recall that the eigenvectors are only defined up to a constant: even when the length is specified they are still only defined up to a scalar of modulus one (the sign for real matrices).
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.
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole. Springer-Verlag Lecture Notes in Computer Science 6.
Wilkinson, J. H. (1965) The Algebraic Eigenvalue Problem. Clarendon Press, Oxford.
eigen(cbind(c(1,-1), c(-1,1))) eigen(cbind(c(1,-1), c(-1,1)), symmetric = FALSE) # same (different algorithm). eigen(cbind(1, c(1,-1)), only.values = TRUE) eigen(cbind(-1, 2:1)) # complex values eigen(print(cbind(c(0, 1i), c(-1i, 0)))) # Hermite ==> real Eigenvalues ## 3 x 3: eigen(cbind( 1, 3:1, 1:3)) eigen(cbind(-1, c(1:2,0), 0:2)) # complex values
Documentation reproduced from R 3.0.2. License: GPL-2.