diff --git a/NEWS.md b/NEWS.md index 8240b28ac..cc28716c5 100644 --- a/NEWS.md +++ b/NEWS.md @@ -12,6 +12,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [0.10.2] - unreleased +### Added + +* `GroupManifold` can now be called with two arguments, the third one defaulting to `LeftInvariantRepresentation`. + ### Changed * fixes a few typographical errors. diff --git a/Project.toml b/Project.toml index b1680d546..b91dddcf5 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Manifolds" uuid = "1cead3c2-87b3-11e9-0ccd-23c62b72b94e" authors = ["Seth Axen ", "Mateusz Baran ", "Ronny Bergmann ", "Antoine Levitt "] -version = "0.10.1" +version = "0.10.2" [deps] Einsum = "b7d42ee7-0b51-5a75-98ca-779d3107e4c0" diff --git a/src/groups/GroupManifold.jl b/src/groups/GroupManifold.jl index 76474a05b..141d5fd32 100644 --- a/src/groups/GroupManifold.jl +++ b/src/groups/GroupManifold.jl @@ -8,7 +8,11 @@ Group manifolds by default forward metric-related operations to the wrapped mani # Constructor - GroupManifold(manifold, op) + GroupManifold( + manifold::AbstractManifold, + op::AbstractGroupOperation, + vectors::AbstractGroupVectorRepresentation=LeftInvariantRepresentation(), + ) Define the group operation `op` acting on the manifold `manifold`, hence if `op` acts smoothly, this forms a Lie group. @@ -24,6 +28,11 @@ struct GroupManifold{ vectors::VR end +function GroupManifold(M::AbstractManifold{𝔽}, op::AbstractGroupOperation) where {𝔽} + rep = LeftInvariantRepresentation() + return GroupManifold{𝔽,typeof(M),typeof(op),typeof(rep)}(M, op, rep) +end + """ vector_representation(M::GroupManifold) diff --git a/test/groups/groups_general.jl b/test/groups/groups_general.jl index c8e181765..a48f8fc23 100644 --- a/test/groups/groups_general.jl +++ b/test/groups/groups_general.jl @@ -138,11 +138,7 @@ using Manifolds: @test switch_direction(LeftAction()) === RightAction() @test switch_direction(RightAction()) === LeftAction() - G = GroupManifold( - NotImplementedManifold(), - NotImplementedOperation(), - Manifolds.LeftInvariantRepresentation(), - ) + G = GroupManifold(NotImplementedManifold(), NotImplementedOperation()) @test Manifolds._action_order(G, 1, 2, LeftForwardAction()) === (1, 2) @test Manifolds._action_order(G, 1, 2, RightBackwardAction()) === (2, 1) end @@ -153,11 +149,7 @@ using Manifolds: end @testset "Addition operation" begin - G = GroupManifold( - NotImplementedManifold(), - Manifolds.AdditionOperation(), - Manifolds.LeftInvariantRepresentation(), - ) + G = GroupManifold(NotImplementedManifold(), Manifolds.AdditionOperation()) test_group( G, [[1.0, 2.0], [3.0, 4.0], [5.0, 6.0]],