# How to use the geomstats.vectorization.decorator function in geomstats

## To help you get started, we’ve selected a few geomstats examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

geomstats / geomstats / geomstats / geometry / special_orthogonal3.py View on Github
    @geomstats.vectorization.decorator(['else', 'vector'])
def matrix_from_tait_bryan_angles_extrinsic_zyx(self, tait_bryan_angles):
"""Convert Tait-Bryan angles to rot mat in extrensic coords (zyx).

Convert a rotation given in terms of the tait bryan angles,
[angle_1, angle_2, angle_3] in extrinsic (fixed) coordinate system
in order zyx, into a rotation matrix.

rot_mat = X(angle_1).Y(angle_2).Z(angle_3)
where:
- X(angle_1) is a rotation of angle angle_1 around axis x.
- Y(angle_2) is a rotation of angle angle_2 around axis y.
- Z(angle_3) is a rotation of angle angle_3 around axis z.

Parameters
----------
tait_bryan_angles : array-like, shape=[n_samples, 3]
geomstats / geomstats / geomstats / geometry / spd_matrices.py View on Github
    @geomstats.vectorization.decorator(['matrix', 'matrix'])
def exp_domain(tangent_vec, base_point):
"""Compute the domain of the Euclidean exponential map.

Compute the real interval of time where the Euclidean geodesic starting
at point base_point in direction tangent_vec is defined.

Parameters
----------
tangent_vec : array-like, shape=[..., n, n]
Tangent vector at base point.
base_point : array-like, shape=[..., n, n]
Base point.

Returns
-------
exp_domain : array-like, shape=[..., 2]
geomstats / geomstats / geomstats / geometry / special_orthogonal3.py View on Github
    @geomstats.vectorization.decorator(['else', 'vector', 'else', 'else'])
def matrix_from_tait_bryan_angles(self, tait_bryan_angles,
extrinsic_or_intrinsic='extrinsic',
order='zyx'):
"""Convert Tait-Bryan angles to rot mat in extr or intr coords.

Convert a rotation given in terms of the tait bryan angles,
[angle_1, angle_2, angle_3] in extrinsic (fixed) or
intrinsic (moving) coordinate frame into a rotation matrix.

If the order is zyx, into the rotation matrix rot_mat:
rot_mat = X(angle_1).Y(angle_2).Z(angle_3)
where:
- X(angle_1) is a rotation of angle angle_1 around axis x.
- Y(angle_2) is a rotation of angle angle_2 around axis y.
- Z(angle_3) is a rotation of angle angle_3 around axis z.

geomstats / geomstats / geomstats / geometry / special_orthogonal.py View on Github
    @geomstats.vectorization.decorator(['else', 'vector'])
def matrix_from_rotation_vector(self, rot_vec):
"""Convert rotation vector to rotation matrix.

Parameters
----------
rot_vec: array-like, shape=[..., 3]
Rotation vector.

Returns
-------
rot_mat: array-like, shape=[..., 3]
Rotation matrix.
"""
rot_vec = self.regularize(rot_vec)

angle = gs.linalg.norm(rot_vec, axis=1)
geomstats / geomstats / geomstats / geometry / special_orthogonal.py View on Github
    @geomstats.vectorization.decorator(['else', 'matrix', 'else', 'else'])
def tait_bryan_angles_from_matrix(self, rot_mat,
extrinsic_or_intrinsic='extrinsic',
order='zyx'):
"""Convert rot_mat into Tait-Bryan angles.

Convert a rotation matrix rot_mat into the tait bryan angles,
[angle_1, angle_2, angle_3] in extrinsic (fixed) coordinate frame,
for the order zyx, i.e.:
rot_mat = X(angle_1).Y(angle_2).Z(angle_3)
where:
- X(angle_1) is a rotation of angle angle_1 around axis x.
- Y(angle_2) is a rotation of angle angle_2 around axis y.
- Z(angle_3) is a rotation of angle angle_3 around axis z.

Parameters
----------
geomstats / geomstats / geomstats / geometry / hyperbolic.py View on Github
    @geomstats.vectorization.decorator(['vector'])
def _ball_to_extrinsic_coordinates(point):
"""Convert ball to extrinsic coordinates.

Convert the parameterization of a point in hyperbolic space
from its poincare ball model coordinates, to the extrinsic
coordinates.

Parameters
----------
point : array-like, shape=[..., dim]
Point in hyperbolic space in Poincare ball coordinates.

Returns
-------
extrinsic : array-like, shape=[..., dim + 1]
Point in hyperbolic space in extrinsic coordinates.
geomstats / geomstats / geomstats / geometry / special_euclidean.py View on Github
    @geomstats.vectorization.decorator(
['else', 'vector', 'vector'])
def compose(self, point_a, point_b):
r"""Compose two elements of SE(3).

Parameters
----------
point_a : array-like, shape=[..., 3]
Point of the group.
point_b : array-like, shape=[..., 3]
Point of the group.

Equation
--------
(:math: (R_1, t_1) \\cdot (R_2, t_2) = (R_1 R_2, R_1 t_2 + t_1))

Returns
geomstats / geomstats / geomstats / geometry / hypersphere.py View on Github
    @geomstats.vectorization.decorator(['else', 'vector'])
def extrinsic_to_intrinsic_coords(self, point_extrinsic):
"""Convert point from extrinsic to intrinsic coordinates.

Convert from the extrinsic coordinates in Euclidean space,
to some intrinsic coordinates in the hypersphere.

Parameters
----------
point_extrinsic : array-like, shape=[..., dim + 1]
Point on the hypersphere, in extrinsic coordinates in
Euclidean space.

Returns
-------
point_intrinsic : array-like, shape=[..., dim]
Point on the hypersphere, in intrinsic coordinates.
geomstats / geomstats / geomstats / geometry / poincare_ball.py View on Github
    @geomstats.vectorization.decorator(['else', 'vector', 'vector'])
r"""Compute the Mobius addition of two points.

Mobius addition operation that is a necessary operation
to compute the log and exp using the 'ball' representation.

.. math::

a\oplus b=\frac{(1+2\langle a,b\rangle + ||b||^2)a+
(1-||a||^2)b}{1+2\langle a,b\rangle + ||a||^2||b||^2}

Parameters
----------
point_a : array-like, shape=[..., dim]
Point in hyperbolic space.
point_b : array-like, shape=[..., dim]
geomstats / geomstats / geomstats / geometry / special_orthogonal.py View on Github
    @geomstats.vectorization.decorator(['else', 'matrix', 'output_point'])
def vector_from_skew_matrix(self, skew_mat):
"""Derive a vector from the skew-symmetric matrix.

In 3D, compute the vector defining the cross product
associated to the skew-symmetric matrix skew mat.

Parameters
----------
skew_mat : array-like, shape=[..., n, n]
Skew-symmetric matrix.

Returns
-------
vec : array-like, shape=[..., dim]
Vector.
"""

## geomstats

Geometric statistics on manifolds

MIT