Skip to content

Commit

Permalink
GroupManifold accepts two arguments (#747)
Browse files Browse the repository at this point in the history
* GroupManifold accepts two arguments

* Update src/groups/GroupManifold.jl

Co-authored-by: Mateusz Baran <mateuszbaran89@gmail.com>

* improve docs

* bump version

* fix warning

---------

Co-authored-by: Mateusz Baran <mateuszbaran89@gmail.com>
  • Loading branch information
olivierverdier and mateuszbaran authored Sep 24, 2024
1 parent 43b6990 commit 315601e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Manifolds"
uuid = "1cead3c2-87b3-11e9-0ccd-23c62b72b94e"
authors = ["Seth Axen <seth.axen@gmail.com>", "Mateusz Baran <mateuszbaran89@gmail.com>", "Ronny Bergmann <manopt@ronnybergmann.net>", "Antoine Levitt <antoine.levitt@gmail.com>"]
version = "0.10.1"
version = "0.10.2"

[deps]
Einsum = "b7d42ee7-0b51-5a75-98ca-779d3107e4c0"
Expand Down
11 changes: 10 additions & 1 deletion src/groups/GroupManifold.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)
Expand Down
12 changes: 2 additions & 10 deletions test/groups/groups_general.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]],
Expand Down

2 comments on commit 315601e

@mateuszbaran
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/115840

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.10.2 -m "<description of version>" 315601ea7492d5b2d97f056aa2be389da7e40dd7
git push origin v0.10.2

Please sign in to comment.