rot_ab: Rotate a sample of spherical data

View source: R/r_alt.R

rot_abR Documentation

Rotate a sample of spherical data

Description

Rotate a sample of spherical data by a rotation matrix {\bf H}_{{\bf a},{\bf b}} = ({\bf a}+{\bf b})({\bf a}+{\bf b})' / (1 + {\bf a}'{\bf b}) - {\bf I}_p.

Usage

rot_ab(X, a, b)

H_ab(a, b)

Arguments

X

a sample of spherical data, an array of size c(n, p, M) or a matrix of size c(n, p).

a

vector on S^{p-1} to rotate from.

b

vector on S^{p-1} to rotate to.

Details

The vectors a and b are checked for unit norms.

Value

  • rot_ab: an array or matrix with the same size as X containing the rotated sample.

  • H_ab: a rotation matrix of size c(p, p).

Examples

p <- 3
a <- c(rep(0, p - 1), 1)
b <- c(1, rep(0, p - 1))
H_ab(a = a, b = b)
X <- r_alt(n = 100, p = p, M = 1, alt = "vMF", kappa = 10)[, , 1]
X_rot <- rot_ab(X, a = a, b = b)
s3d <- scatterplot3d::scatterplot3d(X, pch = 16, xlim = c(-1.1, 1.1),
                             ylim = c(-1.1, 1.1), zlim = c(-1.1, 1.1))
s3d$points3d(X_rot, col = 2, pch = 16)

sphunif documentation built on Nov. 9, 2025, 5:07 p.m.