Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more SE2 and SE3 performance dispatches #660

Merged
merged 6 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.8.80"
version = "0.8.81"

[deps]
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
Expand Down
39 changes: 37 additions & 2 deletions src/groups/special_euclidean.jl
Original file line number Diff line number Diff line change
Expand Up @@ -713,20 +713,55 @@
M1, M2 = M.manifold.manifolds
return vcat(vee(M1.manifold, p.x[1], X.x[1]), vee(M2.manifold, p.x[2], X.x[2]))
end
function hat(M::SpecialEuclidean{2}, p::ArrayPartition, c::SVector)
function get_coordinates(

Check warning on line 716 in src/groups/special_euclidean.jl

View check run for this annotation

Codecov / codecov/patch

src/groups/special_euclidean.jl#L716

Added line #L716 was not covered by tests
M::SpecialEuclidean,
p::ArrayPartition,
X::ArrayPartition,
basis::DefaultOrthogonalBasis,
)
M1, M2 = M.manifold.manifolds
return vcat(

Check warning on line 723 in src/groups/special_euclidean.jl

View check run for this annotation

Codecov / codecov/patch

src/groups/special_euclidean.jl#L722-L723

Added lines #L722 - L723 were not covered by tests
get_coordinates(M1.manifold, p.x[1], X.x[1], basis),
get_coordinates(M2.manifold, p.x[2], X.x[2], basis),
)
end
function hat(M::SpecialEuclidean{2}, p::ArrayPartition, c::AbstractVector)

Check warning on line 728 in src/groups/special_euclidean.jl

View check run for this annotation

Codecov / codecov/patch

src/groups/special_euclidean.jl#L728

Added line #L728 was not covered by tests
M1, M2 = M.manifold.manifolds
return ArrayPartition(
get_vector_orthogonal(M1.manifold, p.x[1], c[SOneTo(2)], ℝ),
get_vector_orthogonal(M2.manifold, p.x[2], c[SA[3]], ℝ),
)
end
function hat(M::SpecialEuclidean{3}, p::ArrayPartition, c::SVector)
function get_vector(

Check warning on line 735 in src/groups/special_euclidean.jl

View check run for this annotation

Codecov / codecov/patch

src/groups/special_euclidean.jl#L735

Added line #L735 was not covered by tests
M::SpecialEuclidean{2},
p::ArrayPartition,
c::AbstractVector,
kellertuer marked this conversation as resolved.
Show resolved Hide resolved
basis::DefaultOrthogonalBasis,
)
return ArrayPartition(

Check warning on line 741 in src/groups/special_euclidean.jl

View check run for this annotation

Codecov / codecov/patch

src/groups/special_euclidean.jl#L741

Added line #L741 was not covered by tests
get_vector(M.manifold.manifolds[1].manifold, p.x[1], c[SOneTo(2)], basis),
get_vector(M.manifold.manifolds[2].manifold, p.x[2], c[SA[3]], basis),
)
end

function hat(M::SpecialEuclidean{3}, p::ArrayPartition, c::AbstractVector)

Check warning on line 747 in src/groups/special_euclidean.jl

View check run for this annotation

Codecov / codecov/patch

src/groups/special_euclidean.jl#L747

Added line #L747 was not covered by tests
M1, M2 = M.manifold.manifolds
return ArrayPartition(
get_vector_orthogonal(M1.manifold, p.x[1], c[SOneTo(3)], ℝ),
get_vector_orthogonal(M2.manifold, p.x[2], c[SA[4, 5, 6]], ℝ),
)
end
function get_vector(

Check warning on line 754 in src/groups/special_euclidean.jl

View check run for this annotation

Codecov / codecov/patch

src/groups/special_euclidean.jl#L754

Added line #L754 was not covered by tests
M::SpecialEuclidean{3},
p::ArrayPartition,
c::AbstractVector,
basis::DefaultOrthogonalBasis,
)
return ArrayPartition(

Check warning on line 760 in src/groups/special_euclidean.jl

View check run for this annotation

Codecov / codecov/patch

src/groups/special_euclidean.jl#L760

Added line #L760 was not covered by tests
get_vector(M.manifold.manifolds[1].manifold, p.x[1], c[SOneTo(3)], basis),
get_vector(M.manifold.manifolds[2].manifold, p.x[2], c[SA[4, 5, 6]], basis),
)
end
function compose(::SpecialEuclidean, p::ArrayPartition, q::ArrayPartition)
return ArrayPartition(p.x[2] * q.x[1] + p.x[1], p.x[2] * q.x[2])
end
14 changes: 14 additions & 0 deletions test/groups/special_euclidean.jl
Original file line number Diff line number Diff line change
Expand Up @@ -382,15 +382,29 @@ Random.seed!(10)
@test isapprox(SEn, log(SEn, pts[1], pts[1]), 0 .* Xs[1]; atol=1e-16)
@test isapprox(SEn, exp(SEn, pts[1], 0 .* Xs[1]), pts[1])
vee(SEn, pts[1], Xs[2])
get_coordinates(SEn, pts[1], Xs[2], DefaultOrthogonalBasis())
csen = n == 2 ? SA[1.0, 2.0, 3.0] : SA[1.0, 0.0, 2.0, 2.0, -1.0, 1.0]
hat(SEn, pts[1], csen)
get_vector(SEn, pts[1], csen, DefaultOrthogonalBasis())
# @btime shows 0 but `@allocations` is inaccurate
@static if VERSION >= v"1.9-DEV"
@test (@allocations exp(SEn, pts[1], Xs[1])) <= 4
@test (@allocations compose(SEn, pts[1], pts[2])) <= 4
@test (@allocations log(SEn, pts[1], pts[2])) <= 28
@test (@allocations vee(SEn, pts[1], Xs[2])) <= 13
@test (@allocations get_coordinates(
SEn,
pts[1],
Xs[2],
DefaultOrthogonalBasis(),
)) <= 13
@test (@allocations hat(SEn, pts[1], csen)) <= 13
@test (@allocations get_vector(
SEn,
pts[1],
csen,
DefaultOrthogonalBasis(),
)) <= 13
end
end
end
Expand Down