Skip to content

Commit

Permalink
restrict the default left-invariant log and exp on groups to semidire…
Browse files Browse the repository at this point in the history
…ct products for now
  • Loading branch information
mateuszbaran committed Aug 8, 2024
1 parent 8a0a988 commit 89ec7e6
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 47 deletions.
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* `SpecialEuclidean` group now has a different default tangent vector representation, the left-invariant one; to get the old representation pass `gvr=HybridTangentRepresentation()` to the constructor of `SpecialEuclidean`.
* `adjoint_action` takes a direction argument; by default it is `LeftAction`.
* `adjoint_action!` is the necessary method to implement in groups with left-invariant tangent vector representation.
* On groups with invariant vector storage, `exp` and `log` are based on `exp_lie` and `log_lie` and thus group invariant.
* On semidirect product groups with left-invariant vector storage, `exp` and `log` are based on `exp_lie` and `log_lie` and thus group invariant.
* Fixed a few typos in the doc string of the SPD fixed determinant description.

### Removed
Expand Down
46 changes: 0 additions & 46 deletions src/groups/group.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1238,52 +1238,6 @@ end
direction_and_side(::GroupExponentialRetraction{D}) where {D} = D()
direction_and_side(::GroupLogarithmicInverseRetraction{D}) where {D} = D()

function log(
::TraitList{<:IsGroupManifold,<:LeftInvariantRepresentation},
G::AbstractDecoratorManifold,
p,
q,
)
BG = base_group(G)
return log_lie(BG, compose(BG, inv(BG, p), q))
end
function log!(
::TraitList{<:IsGroupManifold,<:LeftInvariantRepresentation},
G::AbstractDecoratorManifold,
X,
p,
q,
)
x = allocate_result(G, inv)
BG = base_group(G)
inv!(BG, x, p)
compose!(BG, x, x, q)
log_lie!(BG, X, x)
return X
end
function exp(
::TraitList{<:IsGroupManifold,<:LeftInvariantRepresentation},
G::AbstractDecoratorManifold,
p,
X,
t::Number=1,
)
BG = base_group(G)
return compose(BG, p, exp_lie(BG, t * X))
end
function exp!(
::TraitList{<:IsGroupManifold,<:LeftInvariantRepresentation},
G::AbstractDecoratorManifold,
q,
p,
X,
)
BG = base_group(G)
exp_lie!(BG, q, X)
compose!(BG, q, p, q)
return q
end

@doc raw"""
retract(
G::AbstractDecoratorManifold,
Expand Down
54 changes: 54 additions & 0 deletions src/groups/semidirect_product_group.jl
Original file line number Diff line number Diff line change
Expand Up @@ -265,3 +265,57 @@ function submanifold_components(
)
return map(N -> Identity(N), M.manifolds)
end

function log(
::TraitList{
<:IsGroupManifold{<:SemidirectProductOperation,<:LeftInvariantRepresentation},
},
G::AbstractDecoratorManifold,
p,
q,
)
BG = base_group(G)
return log_lie(BG, compose(BG, inv(BG, p), q))
end
function log!(
::TraitList{
<:IsGroupManifold{<:SemidirectProductOperation,<:LeftInvariantRepresentation},
},
G::AbstractDecoratorManifold,
X,
p,
q,
)
x = allocate_result(G, inv)
BG = base_group(G)
inv!(BG, x, p)
compose!(BG, x, x, q)
log_lie!(BG, X, x)
return X
end
function exp(
::TraitList{
<:IsGroupManifold{<:SemidirectProductOperation,<:LeftInvariantRepresentation},
},
G::AbstractDecoratorManifold,
p,
X,
t::Number=1,
)
BG = base_group(G)
return compose(BG, p, exp_lie(BG, t * X))
end
function exp!(
::TraitList{
<:IsGroupManifold{<:SemidirectProductOperation,<:LeftInvariantRepresentation},
},
G::AbstractDecoratorManifold,
q,
p,
X,
)
BG = base_group(G)
exp_lie!(BG, q, X)
compose!(BG, q, p, q)
return q
end
2 changes: 2 additions & 0 deletions test/groups/groups_general.jl
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ using Manifolds:
@test_throws MethodError inv!(G, p, p)
@test_throws MethodError inv!(G, p, eg)
@test_throws MethodError inv(G, p)
@test_throws MethodError inv_diff(G, p, X)
@test_throws MethodError inv_diff!(G, X, p, X)

# no function defined to return the identity array representation
@test_throws MethodError copyto!(G, p, eg)
Expand Down

0 comments on commit 89ec7e6

Please sign in to comment.