From 54c774e452fce3d6e2dbc74bbd33b94fb6ae669a Mon Sep 17 00:00:00 2001 From: Olivier Verdier Date: Mon, 21 Oct 2024 15:13:30 +0200 Subject: [PATCH] Lie bracket is zero on so(2) (#761) * Lie bracket is zero on so(2) * Format * Faster implementation Co-authored-by: Mateusz Baran --------- Co-authored-by: Mateusz Baran --- NEWS.md | 1 + src/groups/general_unitary_groups.jl | 16 ++++++++++++++++ test/groups/general_unitary_groups.jl | 9 +++++++++ 3 files changed, 26 insertions(+) diff --git a/NEWS.md b/NEWS.md index 34493d098a..d73b3dd1d3 100644 --- a/NEWS.md +++ b/NEWS.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Union type `MatrixGroup` - Columnwise group action with arbitrary matrix groups - `uniform_distribution` now has an error hint explaining what has to be done to make it work. +- `lie_bracket` is exactly zero on orthogonal Lie algebra in 2D ## [0.10.3] - 2024-10-04 diff --git a/src/groups/general_unitary_groups.jl b/src/groups/general_unitary_groups.jl index c4896767c0..a31d1ee544 100644 --- a/src/groups/general_unitary_groups.jl +++ b/src/groups/general_unitary_groups.jl @@ -349,6 +349,22 @@ function adjoint_action!(G::GeneralUnitaryMultiplicationGroup, Y, p, X, ::RightA return copyto!(G, Y, inv(G, p) * X * p) end +function Manifolds.lie_bracket( + G::Manifolds.GeneralUnitaryMultiplicationGroup{ManifoldsBase.TypeParameter{Tuple{2}},ℝ}, + X, + ::Any, +) + return zero(X) +end +function Manifolds.lie_bracket!( + G::Manifolds.GeneralUnitaryMultiplicationGroup{ManifoldsBase.TypeParameter{Tuple{2}},ℝ}, + X, + ::Any, + ::Any, +) + return fill!(X, 0) +end + function volume_density(M::GeneralUnitaryMultiplicationGroup, p, X) return volume_density(M.manifold, p, X) end diff --git a/test/groups/general_unitary_groups.jl b/test/groups/general_unitary_groups.jl index d2cc2c8c22..ed275443c0 100644 --- a/test/groups/general_unitary_groups.jl +++ b/test/groups/general_unitary_groups.jl @@ -46,6 +46,15 @@ include("group_utils.jl") X = [0.0 -0.7071067811865475; 0.7071067811865475 0.0] @test volume_density(M, p, X) ≈ 1.0 + @testset "SO(2) Lie Bracket == 0" begin + Y = [0.0 0.7071067811865475; -0.7071067811865475 0.0] + X_ = copy(X) + X_[1, 2] += 1e-16 + @test is_vector(M, identity_element(M), X_) + @test lie_bracket(M, X_, Y) == zeros(2, 2) + @test lie_bracket!(M, similar(X_), X_, Y) == zeros(2, 2) + end + M = SpecialOrthogonal(3) p = [ -0.5908399013383766 -0.6241917041179139 0.5111681988316876