Skip to content

Commit

Permalink
minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuszbaran committed Oct 22, 2024
1 parent afe76c9 commit 2997c03
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 31 deletions.
4 changes: 2 additions & 2 deletions docs/src/notation.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Notation on LIe Groups
# Notation on Lie Groups

For most of the notation used throughout this package, we follow [HilgertNeeb:2012](@cite)
For most of the notation used throughout this package, we follow [HilgertNeeb:2012](@cite).

| Symbol | Description | Also used | Comment |
|:--:|:--------------- |:--:|:-- |
Expand Down
2 changes: 1 addition & 1 deletion src/Lie_algebra/Lie_algebra_interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ lie_bracket!(𝔤::LieAlgebra, Z, X, Y)
Check whether `X` is a valid point on the Lie Algebra `𝔤`.
This falls back to checking whether `X` is a valid point on the tangent space
at the [`identity_element``](@ref)`]`(G)` on `G.manifold` on the [`LieGroup`](@ref)
at the [`identity_element`](@ref)`(G)` on `G.manifold` on the [`LieGroup`](@ref)
of `G`
"""
function ManifoldsBase.is_point(𝔤::LieAlgebra, X; kwargs...)
Expand Down
6 changes: 3 additions & 3 deletions src/interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ _doc_diff_inv = """
diff_inv(G::LieGroup, g, X)
diff_inv!(G::LieGroup, Y, g, X)
Compute the differential of the function ``ι_{$(_math(:G))}(g) = g^-1``, where
Compute the differential of the function ``ι_{$(_math(:G))}(g) = g^{-1}``, where
``Dι_{$(_math(:G))}(g): $(_math(:𝔤))$(_math(:𝔤))``.
This can be done in-place of `Y`.
"""
Expand Down Expand Up @@ -510,7 +510,7 @@ _doc_is_vector = """
is_vector(G::LieGroup, X; kwargs...)
is_vector(G::LieGroup{𝔽,O}, e::Indentity{O}, X; kwargs...)
Check whether `X` is a tangent vector, that is an element of the |`LieAlgebra`](@ref)
Check whether `X` is a tangent vector, that is an element of the [`LieAlgebra`](@ref)
of `G`.
The first variant calls [`is_point`](@extref ManifoldsBase.is_point) on the [`LieAlgebra`](@ref) `𝔤` of `G`.
The second variant calls [`is_vector`](@extref ManifoldsBase.is_vector) on the $(_link(:AbstractManifold)) at the [`identity_element`](@ref).
Expand Down Expand Up @@ -566,7 +566,7 @@ _doc_log = """
Compute the Lie group logarithmic map
```math
$(_tex(:log))_g h = $(_math(:))$(_tex(:log))_{$(_math(:G))}(g^{-1}$(_math(:))h)
$(_tex(:log))_g h = $(_tex(:log))_{$(_math(:G))}(g^{-1}$(_math(:))h)
```
where ``$(_tex(:log))_{$(_math(:G))}`` denotes the [Lie group logarithmic function](@ref log(::LieGroup, ::Identity, :Any))
Expand Down
54 changes: 29 additions & 25 deletions test/LieGroupsTestSuite.jl/LieGroupsTestSuite.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ struct DummyGroupAction <: AbstractGroupAction{DummyActionType,DummyLieGroup,Dum
#
# --- A
"""
test_adjoint(G, g, X; kwargs...)
test_adjoint(G::LieGroup, g, X; kwargs...)
Test `adjoint` function for a given Lie group element `g` and a Lie Algebra vector `X`
# Keyword arguments
* `expected=missing` provide the value expected. If none is provided, the
default from `diff_conjugate` is used
* `test_mutating=true`: test the mutating functions
* `test_mutating::Bool=true`: test the mutating functions
"""
function test_adjoint(G::LieGroup, g, X; expected=missing, test_mutating=true)
function test_adjoint(G::LieGroup, g, X; expected=missing, test_mutating::Bool=true)
@testset "adjoint" begin
v = if ismissing(expected)
diff_conjugate(G, g, identity_element(G), X)
Expand Down Expand Up @@ -261,9 +261,11 @@ 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_mutating=true`: test the mutating functions
* `test_mutating::Bool=true`: test the mutating functions
"""
function test_diff_left_compose(G::LieGroup, g, h, X; expected=missing, test_mutating=true)
function test_diff_left_compose(
G::LieGroup, g, h, X; expected=missing, test_mutating::Bool=true
)
@testset "diff_left_compose" begin
𝔤 = LieAlgebra(G)
Y1 = diff_left_compose(G, g, h, X)
Expand All @@ -287,9 +289,11 @@ 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_mutating=true`: test the mutating functions
* `test_mutating::Bool=true`: test the mutating functions
"""
function test_diff_right_compose(G::LieGroup, g, h, X; expected=missing, test_mutating=true)
function test_diff_right_compose(
G::LieGroup, g, h, X; expected=missing, test_mutating::Bool=true
)
@testset "diff_right_compose" begin
𝔤 = LieAlgebra(G)
Y1 = diff_right_compose(G, g, h, X)
Expand Down Expand Up @@ -349,12 +353,12 @@ a vector `X` from the Lie Algebra.
# Keyword arguments
* `test_exp=true`: test the exponential map yields a point on `G`
* `test_log=true`: test the logarithmic map.
* `test_mutating=true`: test the mutating functions
* `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
"""
function test_exp_log(
G::LieGroup, g, h, X; test_exp=true, test_mutating=true, test_log=true
G::LieGroup, g, h, X; test_exp::Bool=true, test_mutating::Bool=true, test_log::Bool=true
)
@testset "(Lie group) exp & log" begin
𝔤 = LieAlgebra(G)
Expand Down Expand Up @@ -441,19 +445,19 @@ For these tests both `compose` and `inv` are required.
# Keyword arguments
* `test_left=true`: test ``g^{-1}∘h``
* `test_mutating=true`: test the mutating functions
* `test_right=true`: test ``g∘h^{-1}``
* `test_left::Bool=true`: test ``g^{-1}∘h``
* `test_mutating::Bool=true`: test the mutating functions
* `test_right::Bool=true`: test ``g∘h^{-1}``
"""
function test_inv_compose(
G::LieGroup,
g,
h;
expected_left=missing,
expected_right=missing,
test_left=true,
test_mutating=true,
test_right=true,
test_left::Bool=true,
test_mutating::Bool=true,
test_right::Bool=true,
)
@testset "test compose inv combinations" begin
if test_left
Expand Down Expand Up @@ -503,9 +507,9 @@ 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=true`: test the mutating functions
* `test_mutating::Bool=true`: test the mutating functions
"""
function test_lie_bracket(G::LieGroup, X, Y; expected=missing, test_mutating=true)
function test_lie_bracket(G::LieGroup, X, Y; expected=missing, test_mutating::Bool=true)
@testset "lie_bracket" begin
𝔤 = LieAlgebra(G)
Z1 = lie_bracket(𝔤, X, Y)
Expand All @@ -524,14 +528,14 @@ end
#
# --- S
"""
test_show(G, repr_string)
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.
"""
function test_show(G::Union{AbstractGroupAction,LieGroup}, repr_string)
function test_show(G::Union{AbstractGroupAction,LieGroup}, repr_string::AbstractString)
@testset "repr(G, g, h)" begin
@test repr(G) == repr_string
end
Expand All @@ -542,7 +546,7 @@ end
#
#
"""
test_lie_group(G, properties, expectations)
test_lie_group(G::LieGroup, properties::Dict, expectations::Dict)
Test the Lie group ``G`` based on a `Dict` of properties and a `Dict` of `expectations
Expand Down Expand Up @@ -598,7 +602,7 @@ function test_lie_group(G::LieGroup, properties::Dict, expectations::Dict=Dict()
v = get(expectations, :conjugate, missing)
test_conjugate(G, points[1], points[2]; expected=v, test_mutating=mutating)
end
# Either `copyto` or the default with `identity_element`` available
# Either `copyto` or the default with `identity_element` available
if any(in.([copyto!, identity_element], Ref(functions))) && (mutating)
test_copyto(G, points[1])
end
Expand Down Expand Up @@ -674,9 +678,9 @@ function test_lie_group(G::LieGroup, properties::Dict, expectations::Dict=Dict()
end

"""
test_group_action(G, properties, expectations)
test_group_action(G::LieGroup, properties::Dict, expectations::Dict)
Test the Lie group ``G`` based on a `Dict` of properties and a `Dict` of `expectations
Test the Lie group ``G`` based on a `Dict` of properties and a `Dict` of `expectations`.
Possible properties are
Expand Down

0 comments on commit 2997c03

Please sign in to comment.