From d6e338127bc610f6b92b0683f242e2decd6c80b9 Mon Sep 17 00:00:00 2001 From: Mateusz Baran Date: Fri, 3 Nov 2023 21:34:57 +0100 Subject: [PATCH] fix translate_diff on general unitary --- src/groups/general_unitary_groups.jl | 8 ++++++-- test/groups/general_unitary_groups.jl | 2 +- test/groups/group_operation_action.jl | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/groups/general_unitary_groups.jl b/src/groups/general_unitary_groups.jl index 804e6eecea..6f06c6e670 100644 --- a/src/groups/general_unitary_groups.jl +++ b/src/groups/general_unitary_groups.jl @@ -306,7 +306,9 @@ function translate_diff!( X, ::RightForwardAction, ) - return copyto!(G, Y, X) + copyto!(G, Y, X) + Y .*= -1 + return Y end function translate_diff!( G::GeneralUnitaryMultiplicationGroup, @@ -316,7 +318,9 @@ function translate_diff!( X, ::LeftBackwardAction, ) - return copyto!(G, Y, p * X * inv(G, p)) + copyto!(G, Y, p * X * inv(G, p)) + Y .*= -1 + return Y end function translate_diff!( G::GeneralUnitaryMultiplicationGroup, diff --git a/test/groups/general_unitary_groups.jl b/test/groups/general_unitary_groups.jl index d393c07819..7168d59651 100644 --- a/test/groups/general_unitary_groups.jl +++ b/test/groups/general_unitary_groups.jl @@ -19,7 +19,7 @@ include("group_utils.jl") X2 = log_lie(On, p) e = Identity(MultiplicationOperation()) # They are not yet inverting, p2 is on the “other half” - # but taking the log again should also be X ahain + # but taking the log again should also be X again @test isapprox(On, e, X2, X) @test log_lie(On, e) == zeros(n, n) end diff --git a/test/groups/group_operation_action.jl b/test/groups/group_operation_action.jl index 01f806c559..0f4974805d 100644 --- a/test/groups/group_operation_action.jl +++ b/test/groups/group_operation_action.jl @@ -136,5 +136,6 @@ using Manifolds: @test apply_diff_group(A_right_fwd, a_pts[1], X_pts[1], m_pts[1]) ≈ -m_pts[1] \ X_pts[1] * m_pts[1] + @test apply_diff_group(A_left_back, a_pts[1], X_pts[1], m_pts[1]) ≈ -X_pts[1] end end