eigen {base} | R Documentation |

Computes eigenvalues and eigenvectors of numeric (double, integer, logical) or complex matrices.

eigen(x, symmetric, only.values = FALSE, EISPACK = FALSE)

`x` |
a numeric or complex matrix whose spectral decomposition is to be computed. Logical matrices are coerced to numeric. |

`symmetric` |
if |

`only.values` |
if |

`EISPACK` |
logical. Defunct and ignored. |

If `symmetric`

is unspecified, `isSymmetric(x)`

determines if the matrix is symmetric up to plausible numerical
inaccuracies. It is surer and typically much faster 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.

Unsuccessful results from the underlying LAPACK code will result in an
error giving a positive error code (most often `1`

): these can
only be interpreted by detailed study of the FORTRAN code.

The spectral decomposition of `x`

is returned as a list with components

`values` |
a vector containing the |

`vectors` |
either a 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). |

When `only.values`

is not true, as by default, the result is of
S3 class `"eigen"`

.

If `r <- eigen(A)`

, and `V <- r$vectors; lam <- r$values`

,
then

*A = V Lmbd V^(-1)*

(up to numerical
fuzz), where *Lmbd =*`diag(lam)`

.

`eigen`

uses the LAPACK routines `DSYEVR`

, `DGEEV`

,
`ZHEEV`

and `ZGEEV`

.

LAPACK is from http://www.netlib.org/lapack and its guide is listed in the references.

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.

Wilkinson, J. H. (1965) *The Algebraic Eigenvalue Problem.*
Clarendon Press, Oxford.

`svd`

, a generalization of `eigen`

; `qr`

, and
`chol`

for related decompositions.

To compute the determinant of a matrix, the `qr`

decomposition is much more efficient: `det`

.

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

[Package *base* version 3.5.0 Index]