D2K <-
function(D){
n <- nrow(D)
centerM <- diag(n) - 1/n
K <- -0.5*centerM %*% (D*D) %*% centerM
eK <- eigen(K, symmetric=TRUE)
K <- eK$vector %*% diag(pmax(0,eK$values)) %*% t(eK$vector)
return(K)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.