Skip to content

Commit c15f28f

Browse files
Adapt to default_basis and pass onwards get_coordinates/get_vector (#34)
* adapt to default_basis * Fix forward of defaults from Lie Group to Lie algebra. * Fix forward of defaults from Lie Group to Lie algebra. * add news entry. * Fix the remaining ambiguities as well. * Add tests for the new fallbacks. * increase code coverage. * Fix date in tutorial. * Add an entry to the transition page about the second, positional argument of `identity_element`. --------- Co-authored-by: Mateusz Baran <[email protected]>
1 parent c38b148 commit c15f28f

File tree

6 files changed

+39
-2
lines changed

6 files changed

+39
-2
lines changed

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Added
1111

1212
* `identity_element` on `TranslationGroup` supports now `StaticArrays.jl` types.
13+
* introduce `get_vector` in legacy form to work on Lie groups, but they pass on to their Lie algebra.
14+
* adapt to the new `default_basis` from ManifoldsBase.jl 1.1.
1315

1416
### Changed
1517

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ LieGroupsRecursiveArrayToolsExt = "RecursiveArrayTools"
2121
Aqua = "0.8"
2222
LinearAlgebra = "1.10"
2323
Manifolds = "0.10.16"
24-
ManifoldsBase = "1.0.3"
24+
ManifoldsBase = "1.1"
2525
Quaternions = "0.7.6"
2626
Random = "1.10"
2727
RecursiveArrayTools = "2, 3"

docs/src/tutorials/transition.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,4 @@ The list is alphabetical, but first lists types, then functions
5858
3. Formerly, both a power manifold of Lie groups as a manifold as well as a Lie group of a power manifold as a Lie group were possible. This is unified to just defining `G^n` as the Lie group on the power manifold with the element-wise group operation.
5959
4. Formerly, product manifolds were stored as a [`ProductManifold`](@extref) of Lie groups and an indicator for the group operation, that the direct product should be used. This is switched to internally only store a [`ProductManifold`](@extref) as well as a (new) [`ProductGroupOperation`](@ref) that specifies one group operation for every factor.
6060
5. The last two points achieve one unified modelling aspect of Lie groups: they are now always a manifold `M` together with a group operation `op`, but a Lie group does not store another Lie group (or product of them) internally with one common type they share, a [`LieGroup`](@ref).
61+
6. Formerly, [`identity_element`](@ref)`(group[, gT])` to provide a materialized version of the [`Identity`](@ref) point on a Lie group accepted either a concrete point `g` on the Lie group _or_ the `Type` `T` of `g`. This is now unified for example with [`zero_vector`](@ref) and only accepts a `Type` as second argument.

src/interface.jl

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,9 @@ function ManifoldsBase.copyto!(
280280
),
281281
)
282282
end
283+
284+
ManifoldsBase.default_basis(::AbstractLieGroup) = DefaultLieAlgebraOrthogonalBasis()
285+
283286
_doc_diff_conjugate = """
284287
diff_conjugate(G::AbstractLieGroup, g, h, X)
285288
diff_conjugate!(G::AbstractLieGroup, Y, g, h, X)
@@ -430,6 +433,29 @@ end
430433
@doc "$(_doc_exponential)"
431434
ManifoldsBase.exp!(G::AbstractLieGroup, ::Any, ::Any)
432435

436+
function ManifoldsBase.get_coordinates(
437+
G::AbstractLieGroup, g, X, B::AbstractBasis{<:Any,TangentSpaceType}
438+
)
439+
return get_coordinates(LieAlgebra(G), X, B)
440+
end
441+
function ManifoldsBase.get_coordinates!(
442+
G::AbstractLieGroup, c, g, X, B::AbstractBasis{<:Any,TangentSpaceType}
443+
)
444+
get_coordinates!(LieAlgebra(G), c, X, B)
445+
return c
446+
end
447+
448+
function ManifoldsBase.get_vector(
449+
G::AbstractLieGroup, g, c, B::AbstractBasis{<:Any,TangentSpaceType}
450+
)
451+
return get_vector(LieAlgebra(G), c, B)
452+
end
453+
function ManifoldsBase.get_vector!(
454+
G::AbstractLieGroup, X, g, c, B::AbstractBasis{<:Any,TangentSpaceType}
455+
)
456+
return get_vector!(LieAlgebra(G), X, c, B)
457+
end
458+
433459
_doc_identity_element = """
434460
identity_element(G::AbstractLieGroup)
435461
identity_element(G::AbstractLieGroup, T)

test/test_interface.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,26 @@ end
6969
p = [1.0, 2.0]
7070
q = [0.0, 0.0]
7171
# coordinates and vector on 𝔤 are here the same as the ones on M at 0
72+
# Similarly: on G they are the same even for p
7273
X = [1.0, 0.0]
74+
@test default_basis(G) == DefaultLieAlgebraOrthogonalBasis()
7375
@test get_coordinates(𝔤, X, B) == get_coordinates(M, q, X, B)
76+
@test get_coordinates(G, p, X, B) == get_coordinates(M, q, X, B)
7477
Y = copy(X)
7578
@test get_coordinates!(𝔤, Y, X, B) == get_coordinates!(M, Y, q, X, B)
7679
@test X == Y
80+
@test get_coordinates!(G, Y, p, X, B) == get_coordinates!(M, Y, q, X, B)
81+
@test X == Y
7782
c = [0.0, 1.0]
7883
@test get_vector(𝔤, c, B) == get_vector(M, q, c, B)
84+
@test get_vector(G, p, c, B) == get_vector(M, q, c, B)
7985
@test get_vector(𝔤, c, B; tangent_vector_type=Vector{Float64}) ==
8086
get_vector(M, q, c, B)
8187
d = copy(c)
8288
@test get_vector!(𝔤, d, c, B) == get_vector!(M, d, q, c, B)
8389
@test c == d
90+
@test get_vector!(G, d, p, c, B) == get_vector!(M, d, q, c, B)
91+
@test c == d
8492
@test project(G, p) == project(M, p)
8593
@test project(𝔤, X) == project(M, p, X)
8694
@test project(𝔤, X, X) == project(M, p, X)

tutorials/getstarted.qmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ Pkg.status()
311311
#| echo: false
312312
#| output: asis
313313
using Dates
314-
println("This tutorial was last rendered $(Dates.format(now(), "U d, Y, H:M:S")).");
314+
println("This tutorial was last rendered $(Dates.format(now(), "U d, Y, HH:MM:SS")).");
315315
```
316316

317317
## Literature

0 commit comments

Comments
 (0)