'%^%' <- function(A,b, tol = 1e-10) {
if (b==0){
return(diag(nrow(A)))
} else {
res <- Reduce('%*%',rep(list(A),b))
# Tolerance:
res[abs(res) < tol] <- 0
as(res, "Matrix")
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.