Closed blegat closed 11 months ago
This should be resolved once https://github.com/JuliaManifolds/ManifoldsBase.jl/pull/169 is merged and the product manifold. Then the product manifold is already defined in ManifoldsBase.jl
.
I am indeed a bit surprised that this error appears. Without context / versions it's also not so easy to comment, but I had hoped we passed all retractions on (to each factor of the product already), but maybe we missed a retraction type until now (and I have not yet run into this).
It worked by with the default retraction and I got the error when getting ManifoldsBase.ProjectionRetraction
. Feeld free to close then if it's going to be resolved by https://github.com/JuliaManifolds/ManifoldsBase.jl/pull/169
Ah, no it is not resolved by the linked PR, since the problem lies somewhere else. Let me illustrate.
If you do
using Manifolds
M = Sphere(2) × ℝ^3
(approximating your idea) you get a
ProductManifold with 2 submanifolds:
Sphere(2, ℝ)
Euclidean(3; field = ℝ)
Now note that the default retraction looks like (we could surely improve on the printing)
julia> default_retraction_method(M)
ProductRetraction{Tuple{ExponentialRetraction, ExponentialRetraction}}((ExponentialRetraction(), ExponentialRetraction()))
Since on Product manifolds you always have to provide a ProductRetraction
as well, so what you need is not a ProjectionRetraction
but for example
rtm = ProductRetraction(ProjectionRetraction(), ExponentialRetraction())
which I already allowed myself to adapt in the second component, so this does the projection based retraction on the sphere and still good-old +
on the Euclidean part.
We currently do not have the “automatism” to map a retraction type (like ProjectionRetraction
) to an n
-copies-vector of itself passed to ProductRetraction
.
You are probably correct that besides above show method also the docs of ProductRetraction
could be improved.
edit: My confusion came from the fact that I used much more often the PowerManifold
, but since there we have basically copies of a single manifold, there is no need for a PowerRetraction
there, since all are the same anyways. For the product manifold this is not the case. There might even be products of manifolds, where no retraction exists on both manifolds.
We can of course still discuss whether a single retraction should be passed down (to each factor of the product), but the error message of that – if it fails – might be misleading.
I think we could just implement the projection retraction on product manifold, this sounds fine.
But then I would vote for passing down any other retraction as well (i.e. like for power)?
IIRC there were some ambiguity issues that make passing arbitrary retractions on ProductManifold hard to do right. Passing a few particular ones should be fine though.
Ah, right, though I do not remember whether that stayed after the 3-layer structure. We can just try when first merging the product manifold PR in ManifoldsBase and then checking on the retraction-restructure PR :)
This now already works on ManifoldsBase main branch (i.e. that retract(M, p, X, ProjectionRetraciont())
works on product manifolds element wise, same for all other retractions).
This will be part of the forthcoming release ManifoldsBase.jl 0.15), so I'll already close this issue.