Square matrix power operator

Description

This operator computes an arbitrary power of a positive definite square matrix using an Eigen-decomposition: \mathbf{X}^p = \mathbf{UD}^{p}\mathbf{U}'

Usage

1
X %**% power

Arguments

X

Positive definite square matrix

power

numeric scalar - desired power of X

Value

Matrix X to the power p

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
# Inverse Square Root of a positive definite square matrix
X <- matrix(rnorm(100*5000),100,1000)

XX <- ccross(X)

XX_InvSqrt <- XX %**% -0.5

# check result: ((XX')^-0.5 (XX')^-0.5)^-1 = XX'
table(round(csolve(XX_InvSqrt %c% XX_InvSqrt),digits=2) == round(XX,digits=2) )

## End(Not run)