symforce.ops.lie_group_ops module

class LieGroupOps[source]

Bases: GroupOps

API for Lie groups.

A Lie group is a group that is also a differentiable manifold, with the property that the group operations are compatible with the smooth structure.

A manifold is a topological space that locally resembles Euclidean space near each point. More precisely, each point of an n-dimensional manifold has a neighbourhood that is homeomorphic to the Euclidean space of dimension n.

A differentiable manifold is a type of manifold that is locally similar enough to a linear space to allow one to do calculus. Any manifold can be described by a collection of charts, also known as an atlas. One may then apply ideas from calculus while working within the individual charts, since each chart lies within a linear space to which the usual rules of calculus apply. If the charts are suitably compatible (namely, the transition from one chart to another is differentiable), then computations done in one chart are valid in any other differentiable chart.

References

static tangent_dim(a)[source]

Size of the element’s tangent space, aka the degrees of freedom it represents. The storage_dim is the higher dimensional space in which this manifold is embedded. For example SO3 could be a tangent_dim of 3 with a storage_dim of 4 if storing quaternions, or 9 if storing rotation matrices. For vector spaces they are equal.

Parameters:

a (Any | Type) –

Return type:

int

static from_tangent(a, vec, epsilon=0.0)[source]

Mapping from the tangent space approximation at identity into a group element of type a. For most manifold types this is implemented as the exponential map.

This method does not rely on the value of a, only the type.

Parameters:
  • a (Any | Type) –

  • vec (Sequence[float]) – Tangent space perturbation

  • epsilon (float) – Small number to avoid singularity

Returns:

Element – Valid group element that approximates vec around identity.

Return type:

Any

static to_tangent(a, epsilon=0.0)[source]

Mapping from this element to the tangent space approximation at identity.

Parameters:
  • a (Any) –

  • epsilon (float) – Small number to avoid singularity

Returns:

list – Tangent space perturbation around identity that approximates a.

Return type:

List[float]

static retract(a, vec, epsilon=0.0)[source]

Applies a tangent space perturbation vec to the group element a. Often used in optimization to update nonlinear values from an update step in the tangent space.

Implementation is simply compose(a, from_tangent(vec)).

Parameters:
Returns:

Element – Group element that conceptually represents “a + vec”

Return type:

Any

static local_coordinates(a, b, epsilon=0.0)[source]

Computes a tangent space perturbation around a to produce b. Often used in optimization to minimize the distance between two group elements.

Implementation is simply to_tangent(between(a, b)).

Parameters:
  • a (Any) –

  • b (Any) –

  • epsilon (float) – Small number to avoid singularity

Returns:

list – Tangent space perturbation that conceptually represents “b - a”

Return type:

List[float]

static interpolate(a, b, alpha, epsilon=0.0)[source]

Interpolates between self and b.

Implementation is to take the perturbation between self and b in tangent space (local_coordinates) and add a scaled version of that to self (retract).

Parameters:
  • a (Any) –

  • b (Any) –

  • alpha (float) – ratio between a and b - 0 is a, 1 is b. Note that this variable is not clamped between 0 and 1 in this function.

  • epsilon (float) – Small number to avoid singularity

Returns:

Element – Interpolated group element

Return type:

List[float]

static jacobian(a, b, tangent_space=True)[source]

Computes the jacobian of a with respect to b

If tangent_space is True, the jacobian is computed in the local coordinates of the tangent spaces around self and X. If tangent_space is False, the jacobian is computed in the storage spaces of self and X.

Returns: the jacobian matrix of shape MxN, where M is the dimension of the tangent (or

storage) space of a and N is the dimension of the tangent (or storage) space of b.

Parameters:
  • a (T.Element) –

  • b (T.Element) –

  • tangent_space (bool) –

Return type:

geo.Matrix

static storage_D_tangent(a)[source]

Computes the jacobian of the storage space of an element with respect to the tangent space around that element.

Parameters:

a (T.Element) –

Return type:

geo.Matrix

static tangent_D_storage(a)[source]

Computes the jacobian of the tangent space around an element with respect to the storage space of that element.

Parameters:

a (T.Element) –

Return type:

geo.Matrix