From fa91bedc1fecc5a1d0ac1e54eeb37328952cc7dd Mon Sep 17 00:00:00 2001 From: Mateusz Baran Date: Tue, 4 Oct 2022 14:41:15 +0200 Subject: [PATCH] small improvement --- src/manifolds/MetricManifold.jl | 5 +++-- test/metric.jl | 7 ++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/manifolds/MetricManifold.jl b/src/manifolds/MetricManifold.jl index 0abf738c59..10d9f6e145 100644 --- a/src/manifolds/MetricManifold.jl +++ b/src/manifolds/MetricManifold.jl @@ -77,13 +77,14 @@ _drop_embedding_type(t::EmptyTrait) = t function active_traits(f, M::MetricManifold, args...) at = active_traits(f, M.manifold, args...) - idm = is_default_metric(M.manifold, M.metric) + imf = is_metric_function(f) + idm = imf && is_default_metric(M.manifold, M.metric) return merge_traits( idm ? IsDefaultMetric(M.metric) : EmptyTrait(), IsMetricManifold(), # avoid forwarding to the embedding if the metric is not the default one idm ? at : _drop_embedding_type(at), - is_metric_function(f) ? EmptyTrait() : IsExplicitDecorator(), + imf ? EmptyTrait() : IsExplicitDecorator(), ) end # remetricise instead of double-decorating diff --git a/test/metric.jl b/test/metric.jl index 0d6154fc26..4bce4a042a 100644 --- a/test/metric.jl +++ b/test/metric.jl @@ -650,6 +650,11 @@ Manifolds.inner(::MetricManifold{ℝ,<:AbstractManifold{ℝ},Issue539Metric}, p, M = Sphere(2) p = [0.49567358314486515, 0.3740229181343087, -0.7838460025302334] X = [-1.1552859627097727, 0.40665559717366767, -0.5365163797547751] - @test 3 ≈ norm(MetricManifold(M, Issue539Metric()), p, X)^2 + MM = MetricManifold(M, Issue539Metric()) + @test norm(MM, p, X)^2 ≈ 3 + @test Manifolds._drop_embedding_type( + ManifoldsBase.merge_traits(IsEmbeddedSubmanifold()), + ) === ManifoldsBase.EmptyTrait() + @test get_embedding(MM) === get_embedding(M) end end