BioChemoinformatics - 1 year ago 38

R Question

Suppose I have a positive semi-definite matrix

`S`

`S^(-1/2)`

May I do like this?

`ei <- eigen(S)`

V <- ei$vectors

res <- V %*% diag(1 / sqrt(ei$values)) %*% t(V)

Is

`res`

`S^(-1/2)`

I just do

`inverse of square root`

`S`

I know that: if one wants to get

`S^(1/2)`

`res <- V %*% diag(sqrt(ei$values)) %*% t(V)`

`res = S^(1/2)`

How about for

`S^(-1/2)`

Thanks.

Recommended for you: Get network issues from **WhatsUp Gold**. **Not end users.**

Answer Source

Yes. We can easily take an example S and check that S times res times res is the identity matrix:

```
set.seed(123)
S <- crossprod(matrix(rnorm(9), 3))
ei <- eigen(S)
V <- ei$vectors
res <- V %*% diag(1 / sqrt(ei$values)) %*% t(V)
S %*% res %*% res
## [,1] [,2] [,3]
## [1,] 1.0000e+00 -2.3731e-15 -1.6653e-16
## [2,] 3.3346e-15 1.0000e+00 -6.6613e-16
## [3,] -1.0235e-16 8.3267e-16 1.0000e+00
```

Recommended from our users: **Dynamic Network Monitoring from WhatsUp Gold from IPSwitch**. ** Free Download**