smpower: Symmetric Matrix Power

Description Usage Arguments Details Value Note Author(s) Examples

Description

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

Usage

1
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

1
2
3
4
5
6
##########   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

multiway documentation built on May 2, 2019, 6:47 a.m.