A test suite for Lie groups

In the sub module LieGroups.Test, we provide a test suite for Lie groups and Lie group actions.

LieGroups.Test โ€” Module
LieGroups.Test

This module provides tools and dummy structures to test functionality provided within LieGroups.jl.

For every test function, several interactions to other functions can be activated.

The following functions are expected to be available, since their defaults just pass through to the manifold

  • is_point both on the Lie group G and the Lie algebra ๐”ค
  • isapprox(G, g, h) and isapprox(๐”ค, X, Y)
  • copy(G, g)
  • norm(๐”ค, X)

Most functionality only gets loaded once Test.jl is loaded as well, i.e. that the functions are populated with methods by the extension.

source

Test suites

LieGroups.Test.test_lie_group โ€” Function
LieGroups.Test.test_lie_group(G::AbstractLieGroup, properties::Dict, expectations::Dict)

Test the AbstractLieGroup $G$ based on a Dict of properties and a Dict of expectations.

Possible properties are

  • :Aliased is a boolean (same as :Mutating by default) whether to test the mutating variants with aliased input
  • :Functions is a vector of all defined functions for G Note that if f is in :Functions, and f! makes sense, for example for compose, it is assumed that both are defined.
  • :Points is a vector of at least 2 points on G, the first is not allowed to be the identity numerically
  • :Vectors is a vector of at least 2 elements from the Lie algebra ๐”ค og G
  • :Mutating is a boolean (true by default) whether to test the mutating variants of functions or not.
  • :Name is a name of the test. If not provided, defaults to "$G"
  • :Rng is a random number generator, if provided, the random functions are tested with this generator as well

Possible expectations are

  • :adjoint for the result of 'conjugate in the case where diff_conjugate is not implemented
  • :atol => 0.0 a global absolute tolerance
  • :atols -> Dict() a dictionary function -> atol for specific function tested.
  • :conjugate for the result of `conjugate
  • :conjugate_default => false to activate the test of the default implementation of conjugate
  • :diff_inv for the result of diff_inv with respect to the first point and the first vector.
  • :diff_left_compose for the result of diff_left_compose with respect to the first two points and the first vector.
  • :diff_right_compose for the result of diff_right_compose with respect to the first two points and the first vector.
  • :inv_left_compose for the result of inv_left_right_compose with respect to the first two points
  • :inv_right_compose for the result of inv_right_compose with respect to the first two points
  • :repr is a sting one gets from repr(G)
  • :vee for the result of vee(G, X) where X is the first of the vectors
source
LieGroups.Test.test_group_action โ€” Function
LieGroups.Test.test_group_action(A::GroupAction, properties::Dict, expectations::Dict)

Test the GroupAction $A$ based on a Dict of properties and a Dict of expectations.

Possible properties are

  • :AlgebraVectors is a vector of at least 3 elements from the Lie algebra ๐”ค of G
  • :Functions is a vector of all defined functions for G Note that if f is in :Functions, and f! makes sense, for example for compose, it is assumed that both are defined.
  • :GroupPoints is a vector of at least three points on G, the first is not allowed to be the identity numerically
  • :ManifoldPoints is a vector of at least three points on M
  • :TangentVectors is a vector of at least three tangent vectors on M, each in the tangent space of the corresponding :ManifoldPoint
  • :Mutating is a boolean (true by default) whether to test the mutating variants of functions or not.
  • :Name is a name of the test. If not provided, defaults to "$G"

Possible expectations are

  • :apply for the result of apply on the first group and manifold point
  • :diff_apply for the result of apply on the first group and manifold point together with the first tangent vector
  • :atol a global absolute tolerance, defaults to 1e-8
  • :group is the AbstractLieGroup describing the action
  • :manifold is the AbstractManifold the action acts upon
  • :repr is a sting one gets from repr(G)
source

Single test functions

LieGroups.Test.test_apply โ€” Function
LieGroups.Test.test_apply(A::GroupAction, g, p; expected=missing)

Test apply.

Keyword arguments

  • test_aliased::Bool=test_mutating: test aliased input on the mutating variants.
  • expected=missing: the result of the application of the group action.
  • test_mutating::Bool=true: test the mutating functions
source
LieGroups.Test.test_adjoint โ€” Function
LieGroups.Test.test_adjoint(G::AbstractLieGroup, g, X; kwargs...)

Test adjoint function for a given Lie group element g and a Lie Algebra vector X

Keyword arguments

  • test_aliased::Bool=test_mutating: test aliased input on the mutating variants.
  • expected=missing provide the value expected. If none is provided, the default from diff_conjugate is used
  • test_mutating::Bool=true: test the mutating functions
source
LieGroups.Test.test_compose โ€” Function
LieGroups.Test.test_compose(G::AbstractLieGroup, g, h; kwargs...)

Test compose for given Lie group elements g, h.

Keyword arguments

  • atol::Real=0: the absolute tolerance for the tests of zero-vectors
  • test_aliased::Bool=test_mutating: test aliased input on the mutating variants.
  • test_identity::Bool=true: test that composing with the identity yields the identity (requires identity_element)
  • test_inverse::Bool=true: test that g^{-1}g is the identity (requires inv, inv!, and is_identity)
  • test_mutating::Bool=true: test the mutating functions
source
LieGroups.Test.test_conjugate โ€” Function
LieGroups.Test.test_conjugate(G::AbstractLieGroup, g, h; expected=missing)

Test conjugate.

Keyword arguments

  • expected=missing: the result of the conjugate with a concrete expected result.
  • test_default=false: Since the conjugate can be computed using compose and inv โ€“ this test can check that this default provides the same result
  • test_mutating::Bool=true: test the mutating functions
source
LieGroups.Test.test_copyto โ€” Function
LieGroups.Test.test_copyto(G::LieGroup, g)

Test that copyto! works also when copying over an Identity.

The point g can be any point but the identity_element. The group has to be a mutating one, that is, not work on isbit types.

source
LieGroups.Test.test_diff_apply โ€” Function
LieGroups.Test.test_diff_apply(A::GroupAction, g, p, X; expected=missing)

Test diff_apply.

Keyword arguments

  • expected=missing: the result of the application of the group action.
  • test_aliased::Bool=test_mutating: test aliased input on the mutating variants.
  • test_mutating::Bool=true: test the mutating functions
source
LieGroups.Test.test_diff_group_apply โ€” Function
LieGroups.Test.test_diff_group_apply(A::GroupAction, g, p, X; expected=missing)

Test diff_group_apply.

Keyword arguments

  • expected=missing: the result of the application of the group action.
  • test_aliased::Bool=test_mutating: test aliased input on the mutating variants.
  • test_mutating::Bool=true: test the mutating functions
source
LieGroups.Test.test_diff_inv โ€” Function
LieGroups.Test.test_diff_inv(G::AbstractLieGroup, g, X; expected=missing)

Test diff_inv.

Keyword arguments

  • expected=missing: the result of the differential of the inverse, if not provided, only consistency between the allocating and the in-place variant is checked.
  • test_aliased::Bool=test_mutating: test aliased input on the mutating variants.
  • test_mutating::Bool=true: test the mutating functions
source
LieGroups.Test.test_diff_left_compose โ€” Function
LieGroups.Test.test_diff_left_compose(G::AbstractLieGroup, g, h, X; expected=missing)

Test diff_left_compose.

Keyword arguments

  • expected=missing: the result of the differential of the compose's left argument, if not provided, only consistency between the allocating and the in-place variant is checked.
  • test_aliased::Bool=test_mutating: test aliased input on the mutating variants.
  • test_mutating::Bool=true: test the mutating functions
source
LieGroups.Test.test_diff_right_compose โ€” Function
LieGroups.Test.test_diff_right_compose(G::AbstractLieGroup, g, h, X; expected=missing)

Test diff_right_compose.

Keyword arguments

  • expected=missing: the result of the differential of the compose's right argument, if not provided, only consistency between the allocating and the in-place variant is checked.
  • test_aliased::Bool=test_mutating: test aliased input on the mutating variants.
  • test_mutating::Bool=true: test the mutating functions
source
LieGroups.Test.test_exp_log โ€” Function
LieGroups.Test.test_exp_log(G::AbstractLieGroup, g, h, X)

Test exp and log for given Lie group elements g, h and a vector X from the Lie Algebra.

Note

This function requires is_point(G, g) and is_point(LieAlgebra(G), X) to be implemented

Keyword arguments

  • atol::Real=0: the absolute tolerance for the tests of zero-vectors
  • test_aliased::Bool=test_mutating: test aliased input on the mutating variants.
  • test_exp::Bool=true: test the exponential map yields a point on G
  • test_log::Bool=true: test the logarithmic map.
  • test_mutating::Bool=true: test the mutating functions
source
LieGroups.Test.test_identity โ€” Function
LieGroups.Test.test_is_identity(G::AbstractLieGroup, g)

Test that the Identity returns that is_identity is true and that it is a point

source
LieGroups.Test.test_hat_vee โ€” Function
LieGroups.Test.test_hat_vee(G::AbstractLieGroup, g, X; kwargs...)

Test hat and vee for given Lie group element g and a Lie Algebra vector X.

Keyword arguments

  • expected_value=missing: the expected value of vee(G,X)
  • test_mutating::Bool=true: test the mutating functions
  • test_vee::Bool=true: test the vee function
  • test_hat::Bool=true: test the hat function
source
LieGroups.Test.test_identity_element โ€” Function
LieGroups.Test.test_identity_element(G::AbstractLieGroup; kwargs...)

Test the function identity_element(G) or identity_element(G, T).

Keyword arguments

  • expected_value=missing: the expected value of the call to identity_element
  • identity_type=missing; provide a type T? to testidentity_element(G, T)the case ofnothing` calls the one-parameter version
  • test_mutating::Bool=true: test the mutating functions
source
LieGroups.Test.test_injectivity_radius โ€” Function
LieGroups.Test.test_injectivity_radius(G::AbstractLieGroup; kwargs...)

Test the function injectivity_radius.

Keyword arguments

  • expected=missing: expected value for global injectivity radius.
source
LieGroups.Test.test_inner โ€” Function
LieGroups.Test.test_inner(G::AbstractLieGroup, g, X, Y; expected=missing)

Test inner.

Keyword arguments

  • expected=missing: the result of the lie bracket if not provided, nonnegativity of inner products of vectors with themselves is tested as well as consistency with the inner product at the identity element called on the manifold.
source
LieGroups.Test.test_inv โ€” Function
LieGroups.Test.test_inv(G::AbstractLieGroup, g)

Test the inverse function, both the allocating and the in-place variant, and that the double inverse is the identity.

Keyword arguments

  • test_aliased::Bool=test_mutating: test aliased input on the mutating variants.
  • test_mutating::Bool=true: test the mutating functions
  • test_identity::Bool=true: test that inv(e) == e
  • expected=missing: the expected value of inv(G, g)
  • atol::Real=0: the absolute tolerance for the tests.
source
LieGroups.Test.test_inv_compose โ€” Function
LieGroups.Test.test_inv_compose(G::AbstractLieGroup, g, h, X; kwargs...)

Test the special functions combining inv and compose, inv_left_compose and inv_right_compose. For these tests both compose and inv are required.

Keyword arguments

  • test_left::Bool=true: test $g^{-1}โˆ˜h$
  • test_mutating::Bool=true: test the mutating functions
  • test_right::Bool=true: test $gโˆ˜h^{-1}$
source
LieGroups.Test.test_is_flat โ€” Function
LieGroups.Test.test_is_flat(G::AbstractLieGroup; kwargs...)

Test the function is_flat.

Keyword arguments

  • expected=missing: expected value for flatness.
source
LieGroups.Test.test_jacobian_conjugate โ€” Function
LieGroups.Test.test_jacobian_conjugate(G::AbstractLieGroup, g, h, basis=DefaultLieAlgebraOrthogonalBasis();
    expected=missing,
    test_mutating=true,
    kwargs...
)

Test jacobian_conjugate. The kwargs... are passed down to the isapprox check for the expeced value

source
LieGroups.Test.test_jacobian_exp โ€” Function
LieGroups.Test.test_jacobian_exp(
    G::AbstractLieGroup, g, X;
    basis = DefaultLieAlgebraOrthogonalBasis(),
    expected = missing,
    test_mutating = true,
    kwargs...
)

test jacobian_exp.

source
LieGroups.Test.test_lie_bracket โ€” Function
LieGroups.Test.test_lie_bracket(G::AbstractLieGroup, X, Y; expected=missing)

Test lie_bracket.

Keyword arguments

  • expected=missing: the result of the lie bracket if not provided, only consistency between the allocating and the in-place variant is checked.
  • test_mutating::Bool=true: test the mutating functions
source
LieGroups.Test.test_norm โ€” Function
LieGroups.Test.test_norm(G::AbstractLieGroup, g, X; expected=missing)

Test norm on the Lie Algebra and the pass-through from the Lie group.

Keyword arguments

  • expected=missing: the result of the lie bracket if not provided, nonnegativity of inner products of vectors with themselves is tested as well as consistency with the inner product at the identity element called on the manifold.
source
LieGroups.Test.test_push_pull_tangent โ€” Function
LieGroups.Test.test_push_pull_tangent(G::AbstractLieGroup, g, X; expected=missing, atol=0)

Test push_forward_tangent and pull_back_tangent.

Keyword arguments

  • atol=0: the absolute tolerance for the tests of zero-vectors
  • test_mutating::Bool=true: test the mutating functions
  • test_pull_back::Bool=true: test the pull-back of a tangent vector. If only this is set, a zero vector is pulled-back.
  • test_push_forward::Bool=true: test the push-forward of a tangent vector. If only this is set, X is pushed forward and has to be a valid tangent vector.
source
LieGroups.Test.test_rand โ€” Function
LieGroups.Test.test_rand(G::AbstractLieGroup)

Test the random function, both the allocating and the in-place variant, as well as the variant with an rng, if one is provided.

both the random point and the random tangent vector variants are tested.

Keyword arguments

  • test_mutating::Bool=true: test the mutating functions
  • rng=missing: test with a specific random number generator
source
LieGroups.Test.test_show โ€” Function
LieGroups.Test.test_show(G, repr_string::AbstractString)

Test that show methods work as expected. For now this (only) checks that "$G" yields the repr_string.

Requires show (or repr) to be implemented.

source

Helper functions

LieGroups.Test.rotation_matrix โ€” Function
rotate_matrix(n, k1, k2, ฮฑ)

Generate a rotation matrix in $โ„^{nร—n}$ with a rotation about $ฮฑ$ (in radians) in the $k_1-k_2$-plane.

source