angles_to_torus {polykde}R Documentation

Conversion between the angular and Cartesian coordinates of the torus

Description

Transforms the angles (\theta_1,\ldots,\theta_d) in [-\pi,\pi)^d into the Cartesian coordinates

(\cos(x_1), \sin(x_1),\ldots,\cos(x_d), \sin(x_d))

of the torus (\mathcal{S}^1)^d, and vice versa.

Usage

angles_to_torus(theta)

torus_to_angles(x)

Arguments

theta

matrix of size c(n, d) with the angles.

x

matrix of size c(n, 2 * d) with the Cartesian coordinates on (\mathcal{S}^1)^d. Assumed to be of unit norm by pairs of coordinates in the rows.

Value

Examples

# Check changes of coordinates
torus_to_angles(angles_to_torus(c(0, pi / 3, pi / 2)))
torus_to_angles(angles_to_torus(rbind(c(0, pi / 3, pi / 2), c(0, 1, -2))))
angles_to_torus(torus_to_angles(c(0, 1, 1, 0)))
angles_to_torus(torus_to_angles(rbind(c(0, 1, 1, 0), c(0, 1, 0, 1))))

[Package polykde version 1.1.4 Index]