Skip to content

Commit

Permalink
Start SE(n).
Browse files Browse the repository at this point in the history
  • Loading branch information
kellertuer committed Dec 14, 2024
1 parent 7a52177 commit ebf6453
Show file tree
Hide file tree
Showing 7 changed files with 141 additions and 4 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Everything denoted by “formerly” refers to the previous name in [`Manifolds.
* `LieAlgebra`
* `LieGroup` (formerly `GroupManifold`) as well as the concrete groups
* `TranslationGroup`
* `SpecialEuclideanGroup` (formerly `SpecialEuclidean`)
* `SpecialOrthogonalGroup` (formerly `SpecialOrthogonal`)
* `GeneralLinearGroup` (formerly `GeneralLinear`)
* `LeftSemidirectProductLieGroup` (formerly `SemidirectProductGroup`)
Expand Down
4 changes: 3 additions & 1 deletion src/LieGroups.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ include("groups/semidirect_product_group.jl")
include("groups/translation_group.jl")
include("groups/general_linear_group.jl")
include("groups/special_orthogonal_group.jl")
include("groups/special_Euclidean_group.jl")

export LieGroup, LieAlgebra
export PowerLieGroup, ProductLieGroup
Expand Down Expand Up @@ -68,7 +69,8 @@ export GroupAction, GroupOperationAction
#
#
# Specific groups
export TranslationGroup, GeneralLinearGroup, SpecialOrthogonalGroup
export TranslationGroup, GeneralLinearGroup
export SpecialEuclideanGroup, SpecialOrthogonalGroup

export adjoint, adjoint!, apply, apply!
export base_lie_group, base_manifold
Expand Down
7 changes: 7 additions & 0 deletions src/documentation_glossary.jl
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ define!(:Math, :Adjoint, :description, "the adjoint operation")
define!(:Math, :Ad, _math(:Adjoint, :symbol))
define!(:Math, :GroupAction, :symbol, "")
define!(:Math, :GroupAction, :description, "a Lie Group Action")
define!(:Math, :, _math(:GroupAction, :symbol))
define!(:Math, :act, _math(:GroupAction, :symbol))
define!(:Math, :GroupOp, :symbol, "")
define!(:Math, :GroupOp, :description, "the Lie Group operation")
Expand All @@ -111,9 +112,15 @@ define!(:Math, :G, (; G="G") -> _math(:LieGroup, :symbol; G=G))
define!(:Math, :Manifold, :symbol, (; M="M") -> _tex(:Cal, M))
define!(:Math, :Manifold, :description, "the Riemannian manifold")
define!(:Math, :M, (; M="M") -> _math(:Manifold, :symbol; M=M))
define!(:Math, :SE, :symbol, _tex(:rm, "SE"))
define!(:Math, :SE, :description, "the special Euclidean group")
define!(:Math, :SE, _math(:SE, :symbol))
define!(:Math, :SO, :symbol, _tex(:rm, "SO"))
define!(:Math, :SO, :description, "the special orthogonal group")
define!(:Math, :SO, _math(:SO, :symbol))
define!(:Math, :T, :symbol, _tex(:Cal, "T"))
define!(:Math, :T, :description, "the translation group")
define!(:Math, :T, _math(:T, :symbol))

#
# ---
Expand Down
76 changes: 76 additions & 0 deletions src/groups/special_euclidean_group.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
"""
SpecialEuclideanGroup{T}
The special Euclidean group ``$(_math(:SE))(n) = $(_math(:SO))(n) ⋉ $(_math(:T))(n)``. is the Lie group consisting of the
[`LeftSemidirectProductGroup`](@ref) of the [`SpecialOrthogonalGroup`](@ref) and the
[`TranslationGroup`](@ref) together with the [`GroupOperationAction`](@ref)`{`[`LeftGroupOperationAction`](@ref)`}`.
To be precise, the group operation is defined on ``$(_math(:SO))(n) ⋉ $(_math(:T))(n)`` as follows:
```math
(g_1, t_1) ⋅ (g_2, t_2) = (g_1$(_math(:))g_2, t_1 + g_1$(_math(:))t_2)
```
Analogously you can write this on elements of ``$(_math(:SO))(n) ⋊ $(_math(:T))(n)`` as
```math
(s_1, h_1) ⋅ (s_2, h_2) = (s_1 + h_1$(_math(:))s_2, h_1$(_math(:))h_2)
```
# Constructor
SpecialEuclideanGroup(n; kwargs...)
SpecialOrthogonalGroup(n; kwargs...) ⋉ TranslationGroup(n; kwargs...)
Generate special Euclidean group ``$(_math(:SE))(n) = $(_math(:SO))(n) ⋉ $(_math(:T))(n)``, where the first
constructor is equivalent to the second.
Alternatively you can also use
TranslationGroup(n; kwargs...) ⋊ SpecialOrthogonalGroup(n; kwargs...)
to define ``$(_math(:SO))(n) ⋊ $(_math(:T))(n)``.
If you prefer to have the order of the elements reversed, i.e. a representation with first
the translation vector and then the rotation matrix, use the third constructor.
All keyword arguments in `kwargs...` are passed on to [`Rotations`](@extref `Manifolds.Rotations`) as well.
"""
const SpecialEuclideanGroup{T} = LieGroup{
ℝ,
<:LeftSemidirectProductGroupOperation{
<:MatrixMultiplicationGroupOperation,
<:AdditionGroupOperation,
LeftGroupOperationAction,
},
<:Manifolds.ProductManifold{<:Manifolds.Rotations{T},<:Manifolds.Euclidean{T,ℝ}},
}

"""
default_left_action(G::SpecialOrthogonalGroup, ::TranslationGroup)
Return the default left action for the special Euclidean group ``$(_math(:SO))(n) ⋊ $(_math(:T))(n)``,
that is the [`GroupOperationAction`](@ref)`(`[`LeftGroupOperationAction`](@ref)`(G.op))`.
"""
default_left_action(G::SpecialOrthogonalGroup, ::TranslationGroup) =
LeftGroupOperationAction()

"""
default_right_action(::TranslationGroup, G::SpecialOrthogonalGroup)
Return the default right action for the special Euclidean group,
that is the [`GroupOperationAction`](@ref)`(`[`LeftGroupOperationAction`](@ref)`(G.op))`.
"""
function default_right_action(::TranslationGroup, ::SpecialOrthogonalGroup)
return LeftGroupOperationAction()
end

function SpecialEuclideanGroup(n; kwargs...)
SOn = SpecialOrthogonalGroup(n; kwargs...)
Tn = TranslationGroup(n; kwargs...)
return SOn Tn
end

function Base.show(io::IO, G::SpecialEuclideanGroup)
size = Manifolds.get_parameter(G.manifold[2].size)[1]
return print(io, "SpecialEuclideanGroup($(size))")
end
4 changes: 2 additions & 2 deletions src/groups/translation_group.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""
TranslationGroup{𝔽,T}
The Lie group consisting of the [`AdditionGroupOperation`](@ref) on some
[`Euclidean`](@extref `Manifolds.Euclidean`) space.
The translation group ``$(_math(:T))(n)`` is Lie group consisting of
the [`AdditionGroupOperation`](@ref) on some [`Euclidean`](@extref `Manifolds.Euclidean`) space.
# Constructor
TranslationGroup(n₁,...,nᵢ; kwargs...)
Expand Down
50 changes: 50 additions & 0 deletions test/groups/test_special_euclidean_group.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
using LieGroups, Random, Test, RecursiveArrayTools

s = joinpath(@__DIR__, "..", "LieGroupsTestSuite.jl")
!(s in LOAD_PATH) && (push!(LOAD_PATH, s))
using LieGroupsTestSuite

begin
G = SpecialEuclideanGroup(2)
g1 = ArrayPartition(1 / sqrt(2) * [1.0 1.0; -1.0 1.0], [1.0, 0.0])
#g2 = [0.0 -1.0; 1.0 0.0]
#g3 = [1.0 0.0; 0.0 1.0]
# X1, X2, X3 = [1.0 0.0; 0.0 0.0], [0.0 0.0; 0.0 1.0], [0.0 0.5; 0.5 0.0]
properties = Dict(
:Name => "The special Euclidean group",
:Points => [
g1, #, g2, g3
],
# :Vectors => [X1, X2, X3],
:Rng => Random.MersenneTwister(),
:Functions => [
# adjoint,
# compose,
# conjugate,
# diff_inv,
# diff_left_compose,
# diff_right_compose,
# exp,
# hat,
# identity_element,
# inv,
# inv_left_compose,
# inv_right_compose,
# is_identity,
# lie_bracket,
# log,
rand,
show,
# vee,
],
)
expectations = Dict(
# dispatch of show does not yet work.
:repr => "SpecialEuclideanGroup(2)",
#:diff_inv => -X1,
#:diff_left_compose => X1,
#:diff_right_compose => X1,
#:lie_bracket => zero(X1),
)
test_lie_group(G, properties, expectations)
end
3 changes: 2 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ end
include_test("groups/test_power_group.jl")
include_test("groups/test_product_group.jl")
include_test("groups/test_semidirect_product_group.jl")
include_test("groups/test_special_orthogonal_group.jl")
end
include_test("groups/test_general_linear_group.jl")
include_test("groups/test_special_orthogonal_group.jl")
include_test("groups/test_special_euclidean_group.jl")
include_test("groups/test_translation_group.jl")
end
include("test_aqua.jl")
Expand Down

0 comments on commit ebf6453

Please sign in to comment.