Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Group retraction from invariant exp/log #762

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

* rewrote the `CONTRIBUTING.md` and adapt it to todays links and references.
* Deprecate direction and side parameter in group exponential/logarithm retractions

## [0.10.4] - 2024-10-20

Expand Down
10 changes: 2 additions & 8 deletions src/groups/GroupManifold.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,7 @@ function inverse_retract(
q,
method::GroupLogarithmicInverseRetraction,
)
conv = direction_and_side(method)
pinvq = inverse_translate(G, p, q, conv)
Xₑ = log_lie(G, pinvq)
return translate_diff(G, p, Identity(G), Xₑ, conv)
return log_inv(G, p, q)
end

function inverse_retract!(
Expand All @@ -95,10 +92,7 @@ function inverse_retract!(
q,
method::GroupLogarithmicInverseRetraction,
)
conv = direction_and_side(method)
pinvq = inverse_translate(G, p, q, conv)
Xₑ = log_lie(G, pinvq)
return translate_diff!(G, X, p, Identity(G), Xₑ, conv)
return log_inv!(G, X, p, q)
end

function is_point(
Expand Down
118 changes: 55 additions & 63 deletions src/groups/group.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1085,37 +1085,50 @@ Compute logarithmic map on a Lie group `G` invariant to group operation. For gro
bi-invariant metric or a Cartan-Schouten connection, this is the same as `log` but for
other groups it may differ.
"""
function log_inv(G::AbstractManifold, p, q)
BG = base_group(G)
return log_lie(BG, compose(BG, inv(BG, p), q))
end
function log_inv!(G::AbstractManifold, X, p, q)
x = allocate_result(G, inv, p)
BG = base_group(G)
inv!(BG, x, p)
compose!(BG, x, x, q)
log_lie!(BG, X, x)
return X
log_group(G, p, q) = apply_diff(
GroupOperationAction(G, (LeftAction(), LeftSide())),
p,
Identity(G),
log_lie(G, apply(GroupOperationAction(G, (RightAction(), LeftSide())), p, q)),
)
log_inv(G::AbstractManifold, p, q) = log_group(base_group(G), p, q)

function log_group!(G, Y, p, q)
pinvq = apply(GroupOperationAction(G, (RightAction(), LeftSide())), p, q)
X = log_lie(G, pinvq)
apply_diff!(GroupOperationAction(G, (LeftAction(), LeftSide())), Y, p, Identity(G), X)
return Y
end

log_inv!(G::AbstractManifold, X, p, q) = log_group!(base_group(G), X, p, q)

"""
exp_inv(G::AbstractManifold, p, X, t::Number=1)

Compute exponential map on a Lie group `G` invariant to group operation. For groups with a
bi-invariant metric or a Cartan-Schouten connection, this is the same as `exp` but for
other groups it may differ.
"""
function exp_inv(G::AbstractManifold, p, X, t::Number=1)
function exp_inv(G, p, X)
BG = base_group(G)
return compose(BG, p, exp_lie(BG, t * X))
return exp_group(G, p, X)
end
function exp_inv!(G::AbstractManifold, q, p, X)
BG = base_group(G)
exp_lie!(BG, q, X)
compose!(BG, q, p, q)
return q

function exp_group(G, p, X)
translated = apply_diff(GroupOperationAction(G, (RightAction(), LeftSide())), p, p, X)
return apply(
GroupOperationAction(G, (LeftAction(), LeftSide())),
p,
exp_lie(G, translated),
)
end

function exp_group!(G, q, p, X)
ξ = apply_diff(GroupOperationAction(G, (RightAction(), LeftSide())), p, p, X)
return apply!(GroupOperationAction(G, (LeftAction(), LeftSide())), q, p, exp_lie(G, ξ))
end
exp_inv!(G, q, p, X) = return exp_group!(base_group(G), q, p, X)

@doc raw"""
exp_lie(G, X)
exp_lie!(G, q, X)
Expand Down Expand Up @@ -1231,44 +1244,46 @@ function log_lie!(
end

"""
GroupExponentialRetraction{D<:ActionDirectionAndSide} <: AbstractRetractionMethod
GroupExponentialRetraction <: AbstractRetractionMethod

Retraction using the group exponential [`exp_lie`](@ref) "translated" to any point on the
manifold.
Retraction using the invariant group exponential [`exp_inv`](@ref).

For more details, see
[`retract`](@ref retract(::GroupManifold, p, X, ::GroupExponentialRetraction)).

# Constructor

GroupExponentialRetraction(conv::ActionDirectionAndSide = LeftAction())
GroupExponentialRetraction()
"""
struct GroupExponentialRetraction{D<:ActionDirectionAndSide} <: AbstractRetractionMethod end

function GroupExponentialRetraction(conv::ActionDirectionAndSide=LeftForwardAction())
return GroupExponentialRetraction{typeof(conv)}()
function GroupExponentialRetraction()
return GroupExponentialRetraction{LeftForwardAction}()
end

@deprecate GroupExponentialRetraction(conv::ActionDirectionAndSide) GroupExponentialRetraction()

"""
GroupLogarithmicInverseRetraction{D<:ActionDirectionAndSide} <: AbstractInverseRetractionMethod
GroupLogarithmicInverseRetraction <: AbstractInverseRetractionMethod

Retraction using the group logarithm [`log_lie`](@ref) "translated" to any point on the
manifold.
Retraction using the invariant group logarithm [`log_inv`](@ref).

For more details, see
[`inverse_retract`](@ref inverse_retract(::GroupManifold, p, q ::GroupLogarithmicInverseRetraction)).

# Constructor

GroupLogarithmicInverseRetraction(conv::ActionDirectionAndSide = LeftForwardAction())
GroupLogarithmicInverseRetraction()
"""
struct GroupLogarithmicInverseRetraction{D<:ActionDirectionAndSide} <:
AbstractInverseRetractionMethod end

function GroupLogarithmicInverseRetraction(conv::ActionDirectionAndSide=LeftForwardAction())
return GroupLogarithmicInverseRetraction{typeof(conv)}()
function GroupLogarithmicInverseRetraction()
return GroupLogarithmicInverseRetraction{LeftForwardAction}()
end

@deprecate GroupLogarithmicInverseRetraction(conv::ActionDirectionAndSide) GroupLogarithmicInverseRetraction()

direction_and_side(::GroupExponentialRetraction{D}) where {D} = D()
direction_and_side(::GroupLogarithmicInverseRetraction{D}) where {D} = D()

Expand All @@ -1280,18 +1295,13 @@ direction_and_side(::GroupLogarithmicInverseRetraction{D}) where {D} = D()
method::GroupExponentialRetraction,
)

Compute the retraction using the group exponential [`exp_lie`](@ref) "translated" to any
point on the manifold.
With a group translation ([`translate`](@ref)) ``τ_p`` in a specified direction, the
retraction is
Compute the retraction using the invariant group exponential [`exp_inv`](@ref)

````math
\operatorname{retr}_p = τ_p \circ \exp \circ (\mathrm{d}τ_p^{-1})_p,
\operatorname{retr}_p = \exp_p
````

where ``\exp`` is the group exponential ([`exp_lie`](@ref)), and ``(\mathrm{d}τ_p^{-1})_p`` is
the action of the differential of inverse translation ``τ_p^{-1}`` evaluated at ``p`` (see
[`inverse_translate_diff`](@ref)).
where ``\exp`` is the invariant exponential associated to the Cartan–Schouten connection.
"""
function retract(
::TraitList{<:IsGroupManifold},
Expand All @@ -1300,11 +1310,7 @@ function retract(
X,
method::GroupExponentialRetraction,
)
conv = direction_and_side(method)
Xₑ = inverse_translate_diff(G, p, p, X, conv)
pinvq = exp_lie(G, Xₑ)
q = translate(G, p, pinvq, conv)
return q
return exp_inv(G, p, X)
end
function retract(
tl::TraitList{<:IsGroupManifold},
Expand All @@ -1325,10 +1331,7 @@ function retract!(
X,
method::GroupExponentialRetraction,
)
conv = direction_and_side(method)
Xₑ = inverse_translate_diff(G, p, p, X, conv)
pinvq = exp_lie(G, Xₑ)
return translate!(G, q, p, pinvq, conv)
return exp_inv!(G, q, p, X)
end
function retract!(
tl::TraitList{<:IsGroupManifold},
Expand All @@ -1350,18 +1353,13 @@ end
method::GroupLogarithmicInverseRetraction,
)

Compute the inverse retraction using the group logarithm [`log_lie`](@ref) "translated"
to any point on the manifold.
With a group translation ([`translate`](@ref)) ``τ_p`` in a specified direction, the
retraction is
Compute the inverse retraction using the invariant group logarithm [`log_inv`](@ref)

````math
\operatorname{retr}_p^{-1} = (\mathrm{d}τ_p)_e \circ \log \circ τ_p^{-1},
\operatorname{retr}_p^{-1} = \log_p
````

where ``\log`` is the group logarithm ([`log_lie`](@ref)), and ``(\mathrm{d}τ_p)_e`` is the
action of the differential of translation ``τ_p`` evaluated at the identity element ``e``
(see [`translate_diff`](@ref)).
where ``\log`` is the invariant group logarithm ([`log_inv`](@ref)), the inverse of the group exponential [`exp_inv`](@ref).
"""
function inverse_retract(
::TraitList{<:IsGroupManifold},
Expand All @@ -1370,10 +1368,7 @@ function inverse_retract(
q,
method::GroupLogarithmicInverseRetraction,
)
conv = direction_and_side(method)
pinvq = inverse_translate(G, p, q, conv)
Xₑ = log_lie(G, pinvq)
return translate_diff(G, p, Identity(G), Xₑ, conv)
return log_inv(G, p, q)
end

function inverse_retract!(
Expand All @@ -1384,10 +1379,7 @@ function inverse_retract!(
q,
method::GroupLogarithmicInverseRetraction,
)
conv = direction_and_side(method)
pinvq = inverse_translate(G, p, q, conv)
Xₑ = log_lie(G, pinvq)
return translate_diff!(G, X, p, Identity(G), Xₑ, conv)
return log_inv!(G, X, p, q)
end

@trait_function get_vector_lie(G::AbstractManifold, X, B::AbstractBasis)
Expand Down
Loading