-
Notifications
You must be signed in to change notification settings - Fork 56
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
Simplify MetricManifold
to not use SimpleTraits
#48
Comments
And a small addendum: why are |
IIRC it was argued that along with the introduction of
A few reasons:
|
Thanks for the explanation on the I hope that omitting the trait and maybe doing THTT yields a nice default fallback idea. Let's keep this open and start a PR after transition to |
I found a way interims to THTT that already simplifies a lot of code, but leaves 2-3 lines in |
As a first step, I started a branch but I am again stuck in with a small detail on. But then calling
does not work since one actually needs
to work. Can that be tricked in somehow? I did not yet open a PR, since convert for the log does not yet work I fear (it still says that for |
I think changing convert(::Type{MT},M::MetricManifold{MT,GT}) where {MT <: Manifold,GT} = base_manifold(M) to convert(::Type{MT},M::MetricManifold{<:MT,GT}) where {MT <: Manifold,GT} = base_manifold(M) should make |
Cool. Still 3 things that I think should convert, to not (namely I removed the explicit definitions of removing the metric for |
One thing that you have to do is modifying a bit default implementations of functions on manifolds so that manifold_dimension(M::Manifold) = manifold_dimension(M, is_decorator_manifold(M))
manifold_dimension(M::Manifold, ::Val{true}) = manifold_dimension(base_manifold(M))
manifold_dimension(M::Manifold, ::Val{false}) = error("manifold_dimension not implemented for manifold $(typeof(M)).") in ManifoldsBase.jl, all other functions have to be modified this way. All functions where you want |
I had hoped to avoid that with a trick, since this would mean that we have to do that for every manifold function where we think the metric might play a role for manifold_dimension(M::Manifold, ::Val{true}) = manifold_dimension(base_manifold(M)) is enough, but for Edit: I think I know how to do it. If you don't specify anything, |
So the only things left, that either I get confused on or Julia (or both) is, that I get a few errors, where Julia can not find a function since on argument is a Edit: Found it! I was confused and returned |
While working on a first example on a manifold with two different metrics in #27 I noticed that quite a few things are nice, with metric manifold but with the
hasMetric
trait it has a mayor drawbag:All functions that currently have a fallback from
MetricManifold{M,G}
for thehasMetric{M,G}
(let's call that default metric for now) trait have the large disadvantage, that every new and non default metric has to implement every function that has a fallback implemented. Also the fallbacks are all quite longish.I propose the following:
hasMetric
trait and allhasMetric
fallbacksMetricManifold
case for the default metric and all metrics that should fall back to default implementations for certain functionsexp(MetricManifold{M,G},x,v)
for a new metricG
(but would trigger formanifold_dimension
if that's not explicitly implemented for just mentioned type!hasMetric
implementations of for exampleexp!
,flat!
, andsharp!
inMatricManifold
, since if you implement a new metric, you'd implement these anyways ( or let them fall back)I will try this today on #27, but of course would love to hear other opinions on that, too.
The text was updated successfully, but these errors were encountered: