smpower {multiway}R Documentation

Symmetric Matrix Power

Description

Raise symmetric matrix to specified power. Default calculates symmetric square root.

Usage

smpower(X, power = 0.5, tol = NULL)

Arguments

X

Symmetric real-valued matrix.

power

Power to apply to eigenvalues of X.

tol

Stability tolerance for eigenvalues.

Details

Basically returns tcrossprod(Y$vec%*%diag(Y$val^power),Y$vec) where Y = eigen(X,symmetric=TRUE).

Value

Returns X raised to specified power.

Note

Default tolerance is tol = max(dim(X)) * .Machine$double.eps.

Author(s)

Nathaniel E. Helwig <helwig@umn.edu>

Examples

##########   EXAMPLE   ##########

X <- crossprod(matrix(rnorm(2000),100,20))
Xsqrt <- smpower(X)         # square root
Xinv <- smpower(X,-1)       # inverse
Xisqrt <- smpower(X,-0.5)   # inverse square root


[Package multiway version 1.0-6 Index]