From a2cb5dfb03ccfe2fa3e4b542afd5f0932c565d78 Mon Sep 17 00:00:00 2001 From: Mateusz Baran Date: Fri, 5 Aug 2022 15:26:55 +0200 Subject: [PATCH] allocate_result IsExplicitDecorator (#123) * allocate_result IsExplicitDecorator * add test and bump version --- Project.toml | 2 +- src/decorator_trait.jl | 8 ++++++++ test/embedded_manifold.jl | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 8b19064f..c5fdee83 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "ManifoldsBase" uuid = "3362f125-f0bb-47a3-aa74-596ffd7ef2fb" authors = ["Seth Axen ", "Mateusz Baran ", "Ronny Bergmann ", "Antoine Levitt "] -version = "0.13.17" +version = "0.13.18" [deps] LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" diff --git a/src/decorator_trait.jl b/src/decorator_trait.jl index ddfd3089..e2859a31 100644 --- a/src/decorator_trait.jl +++ b/src/decorator_trait.jl @@ -132,6 +132,14 @@ function allocate_result( T = allocate_result_type(get_embedding(M, x[1]), f, x) return allocate(M, x[1], T, representation_size(M)) end +@inline function allocate_result( + ::TraitList{IsExplicitDecorator}, + M::AbstractDecoratorManifold, + f, + x..., +) + return allocate_result(decorated_manifold(M), f, x...) +end # Introduce Deco Trait | automatic foward | fallback diff --git a/test/embedded_manifold.jl b/test/embedded_manifold.jl index acb4ef9a..a1c538a2 100644 --- a/test/embedded_manifold.jl +++ b/test/embedded_manifold.jl @@ -418,5 +418,6 @@ ManifoldsBase.decorated_manifold(::FallbackManifold) = DefaultManifold(3) # test the explicit fallback to DefaultManifold(3) @test inner(M, [1, 0, 0], [1, 2, 3], [0, 1, 0]) == 2 @test is_point(M, [1, 0, 0]) + @test ManifoldsBase.allocate_result(M, exp, [1.0, 0.0, 2.0]) isa Vector end end