diff --git a/Project.toml b/Project.toml index a5925908..54478ea4 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.14.2" +version = "0.14.3" [deps] LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" diff --git a/src/PowerManifold.jl b/src/PowerManifold.jl index 715186af..61e45e0a 100644 --- a/src/PowerManifold.jl +++ b/src/PowerManifold.jl @@ -148,13 +148,25 @@ function Base.:^( return PowerManifold(M, size...) end +""" + _allocate_access_nested(M::PowerManifoldNested, y, i) + +Helper function for `allocate_result` on `PowerManifoldNested`. In allocation `y` can be +a number in which case `_access_nested` wouldn't work. +""" +_allocate_access_nested(M::PowerManifoldNested, y, i) = _access_nested(M, y, i) +_allocate_access_nested(::PowerManifoldNested, y::Number, i) = y + function allocate_result(M::PowerManifoldNested, f, x...) if representation_size(M.manifold) === () && length(x) > 0 return allocate(M, x[1]) else return [ - allocate_result(M.manifold, f, map(y -> _access_nested(M, y, i), x)...) for - i in get_iterator(M) + allocate_result( + M.manifold, + f, + map(y -> _allocate_access_nested(M, y, i), x)..., + ) for i in get_iterator(M) ] end end diff --git a/test/power.jl b/test/power.jl index 4b9fe81c..b5494922 100644 --- a/test/power.jl +++ b/test/power.jl @@ -120,6 +120,7 @@ struct TestArrayRepresentation <: AbstractPowerRepresentation end @testset "specific functions" begin @test distance(N, p, q) == sqrt(sum(distance.(Ref(M), p, q) .^ 2)) @test exp(N, p, q) == p .+ q + @test exp(N, p, q, 2) == p .+ 2 .* q @test retract(N, p, q) == p .+ q @test retract(N, p, q, ExponentialRetraction()) == p .+ q