Skip to content

Commit

Permalink
Remove extension again, maybe not needed, implement first product fun…
Browse files Browse the repository at this point in the history
…ctions.
  • Loading branch information
kellertuer committed Nov 25, 2024
1 parent 0680095 commit 459d526
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 76 deletions.
9 changes: 2 additions & 7 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@ Manifolds = "1cead3c2-87b3-11e9-0ccd-23c62b72b94e"
ManifoldsBase = "3362f125-f0bb-47a3-aa74-596ffd7ef2fb"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"

[weakdeps]
RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd"

[extensions]
LieGroupsRecursiveArrayToolsExt = "RecursiveArrayTools"

[compat]
Aqua = "0.8"
LinearAlgebra = "1.6"
Expand All @@ -28,7 +22,8 @@ julia = "1.6"
[extras]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
Manifolds = "1cead3c2-87b3-11e9-0ccd-23c62b72b94e"
RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test", "Aqua", "Manifolds"]
test = ["Test", "Aqua", "Manifolds", "RecursiveArrayTools"]
15 changes: 0 additions & 15 deletions ext/LieGroupsRecursiveArrayToolsExt.jl

This file was deleted.

86 changes: 43 additions & 43 deletions src/groups/power_group.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ end
Base.:^(G::LieGroup, n...) = PowerLieGroup(G, n...)

function _compose!(
PG::LieGroup{𝔽,Op,M}, k, g, h
PoG::LieGroup{𝔽,Op,M}, k, g, h
) where {𝔽,Op<:PowerGroupOperation,M<:ManifoldsBase.AbstractPowerManifold}
PM = PG.manifold
PM = PoG.manifold
rep_size = representation_size(PM)
G = LieGroup(PM.manifold, PG.op.op)
G = LieGroup(PM.manifold, PoG.op.op)
for i in ManifoldsBase.get_iterator(PM)
compose!(
G,
Expand All @@ -56,27 +56,27 @@ function _compose!(
end

function ManifoldsBase.check_size(
PG::LieGroup{𝔽,Op,M}, g
PoG::LieGroup{𝔽,Op,M}, g
) where {𝔽,Op<:PowerGroupOperation,M<:ManifoldsBase.AbstractPowerManifold}
return ManifoldsBase.check_size(PG.manifold, g)
return ManifoldsBase.check_size(PoG.manifold, g)
end
function ManifoldsBase.check_size(

Check warning on line 63 in src/groups/power_group.jl

View check run for this annotation

Codecov / codecov/patch

src/groups/power_group.jl#L63

Added line #L63 was not covered by tests
::LieGroup{𝔽,Op,M}, ::Identity
) where {𝔽,Op<:PowerGroupOperation,M<:ManifoldsBase.AbstractPowerManifold}
return nothing

Check warning on line 66 in src/groups/power_group.jl

View check run for this annotation

Codecov / codecov/patch

src/groups/power_group.jl#L66

Added line #L66 was not covered by tests
end
function ManifoldsBase.check_size(
PG::LieGroup{𝔽,Op,M}, g, X
PoG::LieGroup{𝔽,Op,M}, g, X
) where {𝔽,Op<:PowerGroupOperation,M<:ManifoldsBase.AbstractPowerManifold}
return ManifoldsBase.check_size(PG.manifold, g, X)
return ManifoldsBase.check_size(PoG.manifold, g, X)
end

function conjugate!(
PG::LieGroup{𝔽,Op,M}, h, g, k
PoG::LieGroup{𝔽,Op,M}, h, g, k
) where {𝔽,Op<:PowerGroupOperation,M<:ManifoldsBase.AbstractPowerManifold}
PM = PG.manifold
PM = PoG.manifold
rep_size = representation_size(PM)
G = LieGroup(PM.manifold, PG.op.op)
G = LieGroup(PM.manifold, PoG.op.op)
for i in ManifoldsBase.get_iterator(PM)
conjugate!(
G,
Expand All @@ -89,11 +89,11 @@ function conjugate!(
end

function diff_conjugate!(

Check warning on line 91 in src/groups/power_group.jl

View check run for this annotation

Codecov / codecov/patch

src/groups/power_group.jl#L91

Added line #L91 was not covered by tests
PG::LieGroup{𝔽,Op,M}, Y, g, h, X
PoG::LieGroup{𝔽,Op,M}, Y, g, h, X
) where {𝔽,Op<:PowerGroupOperation,M<:ManifoldsBase.AbstractPowerManifold}
PM = PG.manifold
PM = PoG.manifold
rep_size = representation_size(PM)
G = LieGroup(PM.manifold, PG.op.op)
G = LieGroup(PM.manifold, PoG.op.op)
for i in ManifoldsBase.get_iterator(PM)
diff_conjugate!(

Check warning on line 98 in src/groups/power_group.jl

View check run for this annotation

Codecov / codecov/patch

src/groups/power_group.jl#L94-L98

Added lines #L94 - L98 were not covered by tests
G,
Expand All @@ -107,11 +107,11 @@ function diff_conjugate!(
end

function diff_inv!(
PG::LieGroup{𝔽,Op,M}, Y, g, X
PoG::LieGroup{𝔽,Op,M}, Y, g, X
) where {𝔽,Op<:PowerGroupOperation,M<:ManifoldsBase.AbstractPowerManifold}
PM = PG.manifold
PM = PoG.manifold
rep_size = representation_size(PM)
G = LieGroup(PM.manifold, PG.op.op)
G = LieGroup(PM.manifold, PoG.op.op)
for i in ManifoldsBase.get_iterator(PM)
diff_inv!(
G,
Expand All @@ -124,11 +124,11 @@ function diff_inv!(
end

function diff_left_compose!(
PG::LieGroup{𝔽,Op,M}, Y, g, h, X
PoG::LieGroup{𝔽,Op,M}, Y, g, h, X
) where {𝔽,Op<:PowerGroupOperation,M<:ManifoldsBase.AbstractPowerManifold}
PM = PG.manifold
PM = PoG.manifold
rep_size = representation_size(PM)
G = LieGroup(PM.manifold, PG.op.op)
G = LieGroup(PM.manifold, PoG.op.op)
for i in ManifoldsBase.get_iterator(PM)
diff_left_compose!(
G,
Expand All @@ -142,11 +142,11 @@ function diff_left_compose!(
end

function diff_right_compose!(
PG::LieGroup{𝔽,Op,M}, Y, g, h, X
PoG::LieGroup{𝔽,Op,M}, Y, g, h, X
) where {𝔽,Op<:PowerGroupOperation,M<:ManifoldsBase.AbstractPowerManifold}
PM = PG.manifold
PM = PoG.manifold
rep_size = representation_size(PM)
G = LieGroup(PM.manifold, PG.op.op)
G = LieGroup(PM.manifold, PoG.op.op)
for i in ManifoldsBase.get_iterator(PM)
diff_right_compose!(
G,
Expand All @@ -160,11 +160,11 @@ function diff_right_compose!(
end

function ManifoldsBase.exp!(
PG::LieGroup{𝔽,Op,M}, h, g, X, t::Number=1
PoG::LieGroup{𝔽,Op,M}, h, g, X, t::Number=1
) where {𝔽,Op<:PowerGroupOperation,M<:ManifoldsBase.AbstractPowerManifold}
PM = PG.manifold
PM = PoG.manifold
rep_size = representation_size(PM)
G = LieGroup(PM.manifold, PG.op.op)
G = LieGroup(PM.manifold, PoG.op.op)
for i in ManifoldsBase.get_iterator(PM)
exp!(
G,
Expand All @@ -177,11 +177,11 @@ function ManifoldsBase.exp!(
return h
end
function ManifoldsBase.exp!(
PG::LieGroup{𝔽,Op,M}, h, ::Identity{Op}, X, t::Number=1
PoG::LieGroup{𝔽,Op,M}, h, ::Identity{Op}, X, t::Number=1
) where {𝔽,Op<:PowerGroupOperation,M<:ManifoldsBase.AbstractPowerManifold}
PM = PG.manifold
PM = PoG.manifold
rep_size = representation_size(PM)
G = LieGroup(PM.manifold, PG.op.op)
G = LieGroup(PM.manifold, PoG.op.op)
e_g = Identity(G)
for i in ManifoldsBase.get_iterator(PM)
exp!(
Expand All @@ -196,23 +196,23 @@ function ManifoldsBase.exp!(
end

function identity_element!(
PG::LieGroup{𝔽,Op,M}, e
PoG::LieGroup{𝔽,Op,M}, e
) where {𝔽,Op<:PowerGroupOperation,M<:ManifoldsBase.AbstractPowerManifold}
PM = PG.manifold
PM = PoG.manifold
rep_size = representation_size(PM)
G = LieGroup(PM.manifold, PG.op.op)
G = LieGroup(PM.manifold, PoG.op.op)
for i in ManifoldsBase.get_iterator(PM)
identity_element!(G, ManifoldsBase._write(PM, rep_size, e, i))
end
return e
end

function inv!(
PG::LieGroup{𝔽,Op,M}, h, g
PoG::LieGroup{𝔽,Op,M}, h, g
) where {𝔽,Op<:PowerGroupOperation,M<:ManifoldsBase.AbstractPowerManifold}
PM = PG.manifold
PM = PoG.manifold
rep_size = representation_size(PM)
G = LieGroup(PM.manifold, PG.op.op)
G = LieGroup(PM.manifold, PoG.op.op)
for i in ManifoldsBase.get_iterator(PM)
inv!(
G,
Expand All @@ -223,11 +223,11 @@ function inv!(
return h
end
function inv!(
PG::LieGroup{𝔽,Op,M}, h, ::Identity{Op}
PoG::LieGroup{𝔽,Op,M}, h, ::Identity{Op}
) where {𝔽,Op<:PowerGroupOperation,M<:ManifoldsBase.AbstractPowerManifold}
PM = PG.manifold
PM = PoG.manifold
rep_size = representation_size(PM)
G = LieGroup(PM.manifold, PG.op.op)
G = LieGroup(PM.manifold, PoG.op.op)
e_g = Identity(G.op)
for i in ManifoldsBase.get_iterator(PM)
inv!(G, ManifoldsBase._write(PM, rep_size, h, i), e_g)
Expand All @@ -241,11 +241,11 @@ function inv!(
end

function ManifoldsBase.log!(

Check warning on line 243 in src/groups/power_group.jl

View check run for this annotation

Codecov / codecov/patch

src/groups/power_group.jl#L243

Added line #L243 was not covered by tests
PG::LieGroup{𝔽,Op,M}, X, g
PoG::LieGroup{𝔽,Op,M}, X, g
) where {𝔽,Op<:PowerGroupOperation,M<:ManifoldsBase.AbstractPowerManifold}
PM = PG.manifold
PM = PoG.manifold
rep_size = representation_size(PM)
G = LieGroup(PM.manifold, PG.op.op)
G = LieGroup(PM.manifold, PoG.op.op)
for i in ManifoldsBase.get_iterator(PM)
log!(

Check warning on line 250 in src/groups/power_group.jl

View check run for this annotation

Codecov / codecov/patch

src/groups/power_group.jl#L246-L250

Added lines #L246 - L250 were not covered by tests
G,
Expand All @@ -256,11 +256,11 @@ function ManifoldsBase.log!(
return X

Check warning on line 256 in src/groups/power_group.jl

View check run for this annotation

Codecov / codecov/patch

src/groups/power_group.jl#L255-L256

Added lines #L255 - L256 were not covered by tests
end
function ManifoldsBase.log!(
PG::LieGroup{𝔽,Op,M}, X, ::Identity{Op}, g
PoG::LieGroup{𝔽,Op,M}, X, ::Identity{Op}, g
) where {𝔽,Op<:PowerGroupOperation,M<:ManifoldsBase.AbstractPowerManifold}
PM = PG.manifold
PM = PoG.manifold
rep_size = representation_size(PM)
G = LieGroup(PM.manifold, PG.op.op)
G = LieGroup(PM.manifold, PoG.op.op)
e_g = Identity(G.op)
for i in ManifoldsBase.get_iterator(PM)
log!(
Expand Down
43 changes: 35 additions & 8 deletions src/groups/product_group.jl
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,13 @@ end
function conjugate!(
PrG::LieGroup{𝔽,Op,M}, k, g, h
) where {𝔽,Op<:ProductGroupOperation,M<:ManifoldsBase.ProductManifold}
PrM = PrG.manifold
map(
conjugate,
LieGroup.(PrG.manifold.manifolds, PrG.op.operations),
submanifold_components(PrG.manifold, k),
submanifold_components(PrG.manifold, g),
submanifold_components(PrG.manifold, h),
conjugate!,
LieGroup.(PrM.manifolds, PrG.op.operations),
submanifold_components(PrM, k),
submanifold_components(PrM, g),
submanifold_components(PrM, h),
)
return k
end
Expand All @@ -117,14 +118,40 @@ function LinearAlgebra.cross(G::LieGroup, H::LieGroup)
return ProductLieGroup(G, H)
end

function identity_element!(
PrG::LieGroup{𝔽,Op,M}, e
) where {𝔽,Op<:ProductGroupOperation,M<:ManifoldsBase.ProductManifold}
PrM = PrG.manifold
map(
identity_element!,
LieGroup.(PrM.manifolds, PrG.op.operations),
submanifold_components(PrG, e),
)
return e
end

function inv!(
PrG::LieGroup{𝔽,Op,M}, h, g
) where {𝔽,Op<:ProductGroupOperation,M<:ManifoldsBase.ProductManifold}
PrM = PrG.manifold
map(
inv!,
LieGroup.(PrG.manifold.manifolds, PrG.op.operations),
submanifold_components(M, h),
submanifold_components(M, g),
LieGroup.(PrM.manifolds, PrG.op.operations),
submanifold_components(PrM, h),
submanifold_components(PrM, g),
)
return h
end

function inv!(
PrG::LieGroup{𝔽,Op,M}, h, ::Identity{Op}
) where {𝔽,Op<:ProductGroupOperation,M<:ManifoldsBase.ProductManifold}
PrM = PrG.manifold
map(
inv!,
LieGroup.(PrM.manifolds, PrG.op.operations),
submanifold_components(PrM, h),
Identity.(PrG.op.operations),
)
return h
end
Expand Down
3 changes: 2 additions & 1 deletion src/interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -880,5 +880,6 @@ end
function ManifoldsBase.allocate_result(
G::LieGroup, f::Union{typeof(rand),typeof(identity_element)}
)
return ManifoldsBase.allocate_result(G.manifold, f)
# both get a type allocated like rand
return ManifoldsBase.allocate_result(G.manifold, rand)
end
4 changes: 2 additions & 2 deletions test/groups/test_product_group.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ using LieGroupsTestSuite
:Vectors => [X, Y],
:Functions => [
compose,
# conjugate,
conjugate,
# diff_conjugate,
# diff_inv,
# diff_left_compose,
# diff_right_compose,
# exp,
# hat,
# inv,
inv,
# inv_left_compose,
# inv_right_compose,
# is_identity,
Expand Down

0 comments on commit 459d526

Please sign in to comment.