Commit 27cd4ca6 authored by Corson N. Areshenkoff's avatar Corson N. Areshenkoff

Exp/log by eigendecomp

parent 8b94124c
logm2 <- function(x){
lx <- logm(x)
#lx <- logm(x)
e <- eigen(x)
lx <- e$vectors %*% diag(log(e$values)) %*% t(e$vectors)
return((lx + t(lx))/2)
}
expm2 <- function(x){
ex <- expm(x)
#ex <- expm(x)
e <- eigen(x)
ex <- e$vectors %*% diag(exp(e$values)) %*% t(e$vectors)
return((ex + t(ex))/2)
}
......@@ -19,7 +19,7 @@ spd.vectorize <- function(x, scaling = F){
if (is.matrix(x)){
if (dim(x)[1] != dim(x)[2]){
stop('Inout must be a square matrix')
stop('Input must be a square matrix')
}
n <- dim(x)[1]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment