Skip to content

Commit

Permalink
Add Aqua tests, refine a few function names, resolve ambiguities.
Browse files Browse the repository at this point in the history
  • Loading branch information
kellertuer committed Oct 21, 2024
1 parent 4a61bae commit 11404db
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 9 deletions.
5 changes: 4 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@ Manifolds = "1cead3c2-87b3-11e9-0ccd-23c62b72b94e"
ManifoldsBase = "3362f125-f0bb-47a3-aa74-596ffd7ef2fb"

[compat]
Aqua = "0.8"
LinearAlgebra = "1.6"
Manifolds = "0.10"
ManifoldsBase = "0.15.16"
Test = "1.6"
julia = "1.6"

[extras]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
Manifolds = "1cead3c2-87b3-11e9-0ccd-23c62b72b94e"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test", "Manifolds"]
test = ["Test", "Aqua", "Manifolds"]
2 changes: 1 addition & 1 deletion src/LieGroups.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ using ManifoldsBase, Manifolds, LinearAlgebra
#
#
# = Compatibility (and a bit of type piracy for now)
# The following imports are necessary to use Manifolds.jl 0.10 with Lie Groups
# The following imports are necessary to use Manifolds.jl 0.10 with Lie groups
# The line is removed when the Groups are removed from possibly 0.11
import Manifolds: apply, apply!, identity_element, is_identity, compose
# Both define the following structs, so these for now lead to asking for explicit prefixes
Expand Down
2 changes: 2 additions & 0 deletions src/Lie_algebra/Lie_algebra_interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ end

# Move this line already to ManifoldsBase? On Fibers of course.
LinearAlgebra.norm(𝔤::LieAlgebra, X) = LinearAlgebra.norm(𝔤.manifold, 𝔤.point, X)
# Non-mutating case with single number -> avoid ambiguity
LinearAlgebra.norm(𝔤::LieAlgebra, X::Real) = LinearAlgebra.norm(𝔤.manifold, 𝔤.point, X)

Check warning on line 69 in src/Lie_algebra/Lie_algebra_interface.jl

View check run for this annotation

Codecov / codecov/patch

src/Lie_algebra/Lie_algebra_interface.jl#L69

Added line #L69 was not covered by tests
function LinearAlgebra.norm(
G::LieGroup{𝔽,O}, ::Identity{O}, X
) where {𝔽,O<:AbstractGroupOperation}
Expand Down
6 changes: 3 additions & 3 deletions src/interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -547,17 +547,17 @@ function ManifoldsBase.isapprox(
return ManifoldsBase.isapprox(G.manifold, identity_element(G), h; kwargs...)
end
function ManifoldsBase.isapprox(
G::LieGroup{𝔽,O}, g, h::Identity{O}; kwargs...
G::LieGroup{𝔽,O}, g, h::Identity{<:O}; kwargs...
) where {𝔽,O<:AbstractGroupOperation}
return ManifoldsBase.isapprox(G.manifold, g, identity_element(G); kwargs...)
end
function ManifoldsBase.isapprox(
G::LieGroup{𝔽,O}, g::Identity{O}, h::Identity{O}; kwargs...
G::LieGroup{𝔽,O}, g::Identity{<:O}, h::Identity{<:O}; kwargs...
) where {𝔽,O<:AbstractGroupOperation}
return true
end
function ManifoldsBase.isapprox(
G::LieGroup{𝔽,O}, g::Identity{O}, h::Identity{O2}; kwargs...
G::LieGroup{𝔽,O}, g::Identity{<:O}, h::Identity{<:O2}; kwargs...
) where {𝔽,O<:AbstractGroupOperation,O2<:AbstractGroupOperation}
return false
end
Expand Down
6 changes: 3 additions & 3 deletions test/LieGroupsTestSuite.jl/LieGroupsTestSuite.jl
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ function test_lie_group(G::LieGroup, properties::Dict, expectations::Dict=Dict()
end

"""
test_lie_group(G, properties, expectations)
test_group_action(G, properties, expectations)
Test the Lie group ``G`` based on a `Dict` of properties and a `Dict` of `expectations
Expand All @@ -615,7 +615,7 @@ Possible `expectations` are
* `:manifold` is the `AbstractManifold` the action acts upon
* `:repr` is a sting one gets from `repr(G)`
"""
function test_GroupAction(
function test_group_action(
A::AbstractGroupAction, properties::Dict, expectations::Dict=Dict()
)
a_tol = get(expectations, :atol, 1e-8)
Expand Down Expand Up @@ -668,5 +668,5 @@ function test_GroupAction(
end
end

export test_lie_group, test_GroupAction
export test_lie_group, test_group_action
end # module
2 changes: 1 addition & 1 deletion test/groups/test_translation_group.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ begin
A = GroupOperationAction(t, G)
properties2[:Name] = "with $A"
expectations2[:repr] = "GroupOperationAction($t, $G)"
test_GroupAction(A, properties2, expectations2)
test_group_action(A, properties2, expectations2)
end
end
end
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ end
@testset "Lie Groups" begin
include_test("groups/test_translation_group.jl")
end
include("test_aqua.jl")
end
8 changes: 8 additions & 0 deletions test/test_aqua.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using Aqua, LieGroups, Test

@testset "Aqua.jl" begin
Aqua.test_all(LieGroups; ambiguities=(broken=false, exclude=[
Base.:+, #ambiguities between Manifolds.Identity and LIeGroups.Identity
Base.:-, #ambiguities between Manifolds.Identity and LIeGroups.Identity
]))
end

0 comments on commit 11404db

Please sign in to comment.