Skip to content

Commit

Permalink
fixing the SpecialEuclidean case (mostly)
Browse files Browse the repository at this point in the history
what remains to be fixed is if it is wrapped
in a `MetricManifold`, or a `ConnectionManifold`, for instance.
In that case, the wrong `translate_diff` methods are called.
  • Loading branch information
olivierverdier committed Nov 13, 2023
1 parent 63e0b6c commit eb7f283
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/groups/group.jl
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,7 @@ end

@trait_function inv_diff!(G::AbstractDecoratorManifold, Y, p, X)

# true only if tangent vectors are stored with the left-invariant convention
inv_diff!(::TraitList{<:IsGroupManifold}, G::AbstractDecoratorManifold, Y, p, X) = -adjoint_action!(G, Y, p, X)

Check warning on line 564 in src/groups/group.jl

View workflow job for this annotation

GitHub Actions / Format Check

[JuliaFormatter] reported by reviewdog 🐶 Raw Output: src/groups/group.jl:564:-inv_diff!(::TraitList{<:IsGroupManifold}, G::AbstractDecoratorManifold, Y, p, X) = -adjoint_action!(G, Y, p, X) src/groups/group.jl:574:+function inv_diff!(::TraitList{<:IsGroupManifold}, G::AbstractDecoratorManifold, Y, p, X) src/groups/group.jl:575:+ return -adjoint_action!(G, Y, p, X) src/groups/group.jl:576:+end

Check warning on line 564 in src/groups/group.jl

View check run for this annotation

Codecov / codecov/patch

src/groups/group.jl#L564

Added line #L564 was not covered by tests

function Base.copyto!(
Expand Down Expand Up @@ -907,13 +908,13 @@ end
X,
conv::ActionDirectionAndSide=LeftForwardAction(),
)
translate_diff(::AbstractDecoratorManifold, ::Any, ::Any, X, ::LeftForwardAction) = X
translate_diff(::AbstractDecoratorManifold, ::Any, ::Any, X, ::RightForwardAction) = X
# the following are true if the tangent vectors are stored with the left invariant convention
translate_diff!(G::AbstractDecoratorManifold, Y, ::Any, ::Any, X, ::LeftForwardAction) = copyto!(G, Y, X)
translate_diff!(G::AbstractDecoratorManifold, Y, ::Any, ::Any, X, ::RightForwardAction) = copyto!(G, Y, X)
translate_diff!(G::AbstractDecoratorManifold, Y, p, ::Any, X, ::LeftBackwardAction) = adjoint_action!(G, Y, p, X, LeftAction())
translate_diff!(G::AbstractDecoratorManifold, Y, p, ::Any, X, ::RightBackwardAction) = adjoint_action!(G, Y, p, X, RightAction())

Check warning on line 915 in src/groups/group.jl

View check run for this annotation

Codecov / codecov/patch

src/groups/group.jl#L912-L915

Added lines #L912 - L915 were not covered by tests

# the following are true regardless of how the tangent vectors are stored:
translate_diff(::AbstractDecoratorManifold, ::Identity, q, X, ::LeftForwardAction) = X
translate_diff(::AbstractDecoratorManifold, ::Identity, q, X, ::RightForwardAction) = X
translate_diff(::AbstractDecoratorManifold, ::Identity, q, X, ::LeftBackwardAction) = X
Expand Down
12 changes: 12 additions & 0 deletions src/groups/special_euclidean.jl
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,18 @@ function translate_diff!(G::SpecialEuclidean, Y, p, q, X, ::RightBackwardAction)
return Y
end

function adjoint_action!(

Check warning on line 647 in src/groups/special_euclidean.jl

View check run for this annotation

Codecov / codecov/patch

src/groups/special_euclidean.jl#L647

Added line #L647 was not covered by tests
G::SpecialEuclidean,
Y,
p,
Xₑ,
::LeftAction
)
Xₚ = translate_diff(G, p, Identity(G), Xₑ, LeftForwardAction())
inverse_translate_diff!(G, Y, p, p, Xₚ, RightBackwardAction())
return Y

Check warning on line 656 in src/groups/special_euclidean.jl

View check run for this annotation

Codecov / codecov/patch

src/groups/special_euclidean.jl#L654-L656

Added lines #L654 - L656 were not covered by tests
end

@doc raw"""
SpecialEuclideanInGeneralLinear
Expand Down

0 comments on commit eb7f283

Please sign in to comment.