Learn R Programming

multiway (version 1.0-2)

smpower: Symmetric Matrix Power

Description

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

Usage

smpower(X,power=0.5,tol=.Machine$double.eps)

Arguments

X
Symmetric real-valued matrix.
power
Power to apply to eigenvalues of X.
tol
Stability tolerance for eigenvalues.

Value

Returns X raised to specified power.

Examples

Run this code
##########   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

Run the code above in your browser using DataLab