Skip to content

Commit

Permalink
improving ProductManifold coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuszbaran committed May 6, 2022
1 parent 9082e60 commit dc55d78
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
16 changes: 2 additions & 14 deletions src/manifolds/ProductManifold.jl
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ function injectivity_radius(M::ProductManifold, p, m::AbstractRetractionMethod)
)...,
)
end
function _injectivity_radius(M::ProductManifold, p, m::ProductRetraction)

This comment has been minimized.

Copy link
@kellertuer

kellertuer May 6, 2022

Member

I thought we dispatched on the retraction type only on level 2 (i.e. the _... functions?

This comment has been minimized.

Copy link
@mateuszbaran

mateuszbaran May 6, 2022

Author Member

Generally yes but we already have a level 1 manifold-specific dispatch for ProductManifold that catches calls with ProductRetraction before they get to this method.

This comment has been minimized.

Copy link
@kellertuer

kellertuer May 6, 2022

Member

ah, ok.

function injectivity_radius(M::ProductManifold, p, m::ProductRetraction)
return min(
map(
(lM, lp, lm) -> injectivity_radius(lM, lp, lm),
Expand All @@ -673,7 +673,7 @@ injectivity_radius(M::ProductManifold) = min(map(injectivity_radius, M.manifolds
function injectivity_radius(M::ProductManifold, m::AbstractRetractionMethod)
return min(map(manif -> injectivity_radius(manif, m), M.manifolds)...)
end
function _injectivity_radius(M::ProductManifold, m::ProductRetraction)
function injectivity_radius(M::ProductManifold, m::ProductRetraction)
return min(map((lM, lm) -> injectivity_radius(lM, lm), M.manifolds, m.retractions)...)
end

Expand Down Expand Up @@ -728,18 +728,6 @@ for TP in [ProductRepr, ArrayPartition]
)
end

function _inverse_retract!(M::ProductManifold, X, p, q, method::InverseProductRetraction)
map(
inverse_retract!,
M.manifolds,
submanifold_components(M, X),
submanifold_components(M, p),
submanifold_components(M, q),
method.inverse_retractions,
)
return X
end

function Base.isapprox(M::ProductManifold, p, q; kwargs...)
return all(
t -> isapprox(t...; kwargs...),
Expand Down
5 changes: 5 additions & 0 deletions test/manifolds/product_manifold.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ using RecursiveArrayTools: ArrayPartition
@test Mse[1] == M1
@test Mse[2] == M2
@test injectivity_radius(Mse) π
@test injectivity_radius(
Mse,
ProductRetraction(ExponentialRetraction(), ExponentialRetraction()),
) π
@test injectivity_radius(Mse, ExponentialRetraction()) π
@test injectivity_radius(
Mse,
ProductRepr([0.0, 1.0, 0.0], [0.0, 0.0]),
Expand Down

0 comments on commit dc55d78

Please sign in to comment.