Computes eigenvalues and eigenvectors of numeric (double, integer, logical) or complex matrices.
eigen(x, symmetric, only.values = FALSE, EISPACK = FALSE)
| Parameter | Description |
|---|---|
x |
a numeric or complex matrix whose spectral decomposition is to be computed. Logical matrices are coerced to numeric. |
symmetric |
if TRUE, the matrix is assumed to be symmetric (or Hermitian if complex) and only its lower triangle (diagonal included) is used. If symmetric is not specified, isSymmetric(x) is used. |
only.values |
if TRUE, only the eigenvalues are computed and returned, otherwise both eigenvalues and eigenvectors are returned. |
EISPACK |
logical. Defunct and ignored. |
# NOT RUN {
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
# }