spectral {qwalkr}R Documentation

Spectral Decomposition of a Hermitian Matrix

Description

spectral() is a wrapper around base::eigen() designed for Hermitian matrices, which can handle repeated eigenvalues.

Usage

spectral(S, multiplicity = TRUE, tol = .Machine$double.eps^0.5, ...)

Arguments

S

a Hermitian matrix. Obs: The matrix is always assumed to be Hermitian, and only its lower triangle (diagonal included) is used.

multiplicity

if TRUE (default), tries to infer eigenvalue multiplicity. If set to FALSE, each eigenvalue is considered unique with multiplicity one.

tol

two eigenvalues x, y are considered equal if abs(x-y) < tol. Defaults to tol=.Machine$double.eps^0.5.

...

further arguments passed on to base::eigen()

Value

The spectral decomposition of S is returned as a list with components

eigvals

vector containing the unique eigenvalues of S in decreasing order.

multiplicity

multiplicities of the eigenvalues in eigvals.

eigvectors

a ⁠nrow(S) x nrow(S)⁠ unitary matrix whose columns are eigenvectors ordered according to eigvals. Note that there may be more eigenvectors than eigenvalues if multiplicity=TRUE, however eigenvectors of the same eigenspace are next to each other.

The Spectral Theorem ensures the eigenvalues of S are real and that the vector space admits an orthonormal basis consisting of eigenvectors of S. Thus, if s <- spectral(S), and ⁠V <- s$eigvectors; lam <- s$eigvals⁠, then

S = V \Lambda V^{*}

where \Lambda =\ diag(rep(lam, times=s$multiplicity))

See Also

base::eigen(), get_eigspace.spectral(), get_eigproj.spectral(), get_eigschur.spectral(), act_eigfun.spectral()

Examples

spectral(matrix(c(0,1,0,1,0,1,0,1,0), nrow=3))

# Use "tol" to set the tolerance for numerical equality
spectral(matrix(c(0,1,0,1,0,1,0,1,0), nrow=3), tol=10e-5)

# Use "multiplicity=FALSE" to force each eigenvalue to be considered unique
spectral(matrix(c(0,1,0,1,0,1,0,1,0), nrow=3), multiplicity = FALSE)


[Package qwalkr version 0.1.0 Index]