powered by
This function constructs the coordinates of vertices of a regular simplex in \(\mathbb{R}^{\code{dim}}\) and returns the first n of them,
n
scaled so that the pairwise Euclidean distance between any two vertices equals dist,
dist
and centered so their centroid is at center.
center
equidistant_vectors(dim, n = dim + 1, dist = 1, center = rep(0, dim))
A matrix, where each column is a vertex of the simplex.
[integer(1)] The dimension.
integer(1)
[integer(1)] The number of vertices to return. Cannot be larger than dim + 1.
dim + 1
[numeric(1)] Desired pairwise Euclidean distance between any two vertices.
numeric(1)
[numeric(dim)] Desired center.
numeric(dim)
Other vector helpers: check_numeric_vector(), check_probability_vector(), chunk_vector(), insert_vector_entry(), map_indices(), match_numerics(), permutations(), split_vector_at(), subsets(), vector_occurrence()
check_numeric_vector()
check_probability_vector()
chunk_vector()
insert_vector_entry()
map_indices()
match_numerics()
permutations()
split_vector_at()
subsets()
vector_occurrence()
dim <- n <- 3 (dist <- runif(1)) (center <- rnorm(dim)) (V <- equidistant_vectors(dim = dim, n = n, dist = dist, center = center)) rowMeans(V) dist(t(V))
Run the code above in your browser using DataLab