Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuszbaran committed Oct 17, 2023
1 parent 833a11c commit dd59e6d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/groups/special_euclidean.jl
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ function get_coordinates(
get_coordinates(M2.manifold, p.x[2], X.x[2], basis),
)
end
function hat(M::SpecialEuclidean{2}, p::ArrayPartition, c)
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)], ℝ),
Expand All @@ -744,7 +744,7 @@ function get_vector(
)
end

function hat(M::SpecialEuclidean{3}, p::ArrayPartition, c)
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)], ℝ),
Expand Down
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

0 comments on commit dd59e6d

Please sign in to comment.