dist_polysph | R Documentation |
Computation of the distance between points \boldsymbol{x}
and \boldsymbol{y}
on the polysphere
\mathcal{S}^{d_1} \times \cdots \times \mathcal{S}^{d_r}
:
\sqrt{\sum_{j=1}^r
d_{\mathcal{S}^{d_j}}(\boldsymbol{x}_j, \boldsymbol{y}_j)^2},
where d_{\mathcal{S}^{d_j}}(\boldsymbol{x}_j, \boldsymbol{y}_j)=
\cos^{-1}(\boldsymbol{x}_j' \boldsymbol{y}_j)
.
dist_polysph(x, y, ind_dj, norm_x = FALSE, norm_y = FALSE, std = TRUE)
dist_polysph_cross(x, y, ind_dj, norm_x = FALSE, norm_y = FALSE,
std = TRUE)
dist_polysph_matrix(x, ind_dj, norm_x = FALSE, norm_y = FALSE,
std = TRUE)
x |
a matrix of size |
y |
either a matrix of size |
ind_dj |
|
norm_x , norm_y |
ensure a normalization of the data? Default to
|
std |
standardize distance to |
dist_polysph
: a vector of size n
with the distances
between x
and y
.
dist_polysph_matrix
: a matrix of size c(n, n)
with the
pairwise distances of x
.
dist_polysph_cross
: a matrix of distances of size
c(n, m)
with the cross distances between x
and y
.
# Example on S^2 x S^3 x S^1
d <- c(2, 3, 1)
ind_dj <- comp_ind_dj(d)
n <- 3
x <- r_unif_polysph(n = n, d = d)
y <- r_unif_polysph(n = n, d = d)
# Distances of x to y
dist_polysph(x = x, y = y, ind_dj = ind_dj, std = FALSE)
dist_polysph(x = x, y = y[1, , drop = FALSE], ind_dj = ind_dj, std = FALSE)
# Pairwise distance matrix of x
dist_polysph_matrix(x = x, ind_dj = ind_dj, std = FALSE)
# Cross distances between x and y
dist_polysph_cross(x = x, y = y, ind_dj = ind_dj, std = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.