Nothing
normalise <- function(x) {
if (is.matrix(x)) {
lengths <- sqrt(colSums(x ^ 2, na.rm = TRUE))
sweep(x, 2, lengths, "/")
} else {
x / sqrt(sum(x ^ 2))
}
}
orthonormalise <- function(x) {
x <- normalise(x) # to be conservative
if (ncol(x) > 1) {
for (j in seq_len(ncol(x))) {
for (i in seq_len(j - 1)) {
x[, j] <- x[, j] - crossprod(x[, j], x[, i]) * x[, i]
}
}
}
normalise(x)
}
basis_random <- function (n, d = 2)
{
mvn <- matrix(rnorm(n * d), ncol = d)
orthonormalise(mvn)
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.