View source: R/equidistant_vectors.R
equidistant_vectors | R Documentation |
This function constructs the coordinates of vertices of a regular simplex
in \mathbb{R}^{\code{dim}}
and returns the first n
of them,
scaled so that the pairwise Euclidean distance between any two vertices
equals dist
,
and centered so their centroid is at center
.
equidistant_vectors(dim, n = dim + 1, dist = 1, center = rep(0, dim))
dim |
[ |
n |
[ |
dist |
[ |
center |
[ |
A matrix, where each column is a vertex of the simplex.
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()
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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.