diff --git a/src/manifolds/FiberBundle.jl b/src/manifolds/FiberBundle.jl index f86f6989fe..81e62ab69b 100644 --- a/src/manifolds/FiberBundle.jl +++ b/src/manifolds/FiberBundle.jl @@ -157,7 +157,44 @@ the fiber over ``p``, transport ``X`` to fiber over ``q``. Exact meaning of the operation depends on the fiber bundle, or may even be undefined. """ -bundle_transport_to(B::FiberBundle, p, X, q) +function bundle_transport_to(B::FiberBundle, p, X, q) + Y = allocate(X) + return bundle_transport_to!(B, Y, p, X, q) +end + +@doc raw""" + bundle_transport_tangent_direction(B::FiberBundle, p, X, d) + +TODO +""" +function bundle_transport_tangent_direction( + B::FiberBundle, + p, + X, + d, + m::AbstractVectorTransportMethod=default_vector_transport_method(B.manifold), +) + Y = allocate(X) + return bundle_transport_tangent_direction!(B, Y, p, X, d, m) +end + +@doc raw""" + bundle_transport_tangent_to(B::FiberBundle, p, X, q) + +TODO + +Ehresmann connection; ``X`` is an element of the vertical bundle ``VF\mathcal M`` from tangent to fiber ``\pi^{-1}({p})``, ``p\in \mathcal M``. +""" +function bundle_transport_tangent_to( + B::FiberBundle, + p, + X, + q, + m::AbstractVectorTransportMethod=default_vector_transport_method(B.manifold), +) + Y = allocate(X) + return bundle_transport_tangent_to!(B, Y, p, X, q, m) +end """ bundle_projection(B::FiberBundle, p) @@ -247,7 +284,7 @@ function get_vector!( n = manifold_dimension(M.manifold) xp1, xp2 = submanifold_components(M, p) Yp1, Yp2 = submanifold_components(M, Y) - F = Fiber(M.manifold, M.type, xp1) + F = Fiber(M.manifold, xp1, M.type) get_vector!(M.manifold, Yp1, xp1, X[1:n], B.data.base_basis) get_vector!(F, Yp2, xp2, X[(n + 1):end], B.data.fiber_basis) return Y diff --git a/src/manifolds/VectorBundle.jl b/src/manifolds/VectorBundle.jl index 2a51833308..b30c6c3101 100644 --- a/src/manifolds/VectorBundle.jl +++ b/src/manifolds/VectorBundle.jl @@ -68,6 +68,28 @@ function bundle_transport_to!(B::TangentBundle, Y, p, X, q) return vector_transport_to!(B.manifold, Y, p, X, q, B.vector_transport.method_fiber) end +function bundle_transport_tangent_direction!( + B::TangentBundle, + Y, + p, + X, + d, + m::AbstractVectorTransportMethod=default_vector_transport_method(B.manifold), +) + return vector_transport_direction!(B.manifold, Y, p, X, d, m) +end + +function bundle_transport_tangent_to!( + B::TangentBundle, + Y, + p, + X, + q, + m::AbstractVectorTransportMethod=default_vector_transport_method(B.manifold), +) + return vector_transport_to!(B.manifold, Y, p, X, q, m) +end + function default_inverse_retraction_method(::TangentBundle) return FiberBundleInverseProductRetraction() end @@ -100,20 +122,20 @@ end inner(B::VectorBundle, p, X, Y) Inner product of tangent vectors `X` and `Y` at point `p` from the -vector bundle `B` over manifold `B.fiber` (denoted $\mathcal M$). +vector bundle `B` over manifold `B.fiber` (denoted ``\mathcal M``). Notation: - * The point $p = (x_p, V_p)$ where $x_p ∈ \mathcal M$ and $V_p$ belongs to the - fiber $F=π^{-1}(\{x_p\})$ of the vector bundle $B$ where $π$ is the - canonical projection of that vector bundle $B$. - * The tangent vector $v = (V_{X,M}, V_{X,F}) ∈ T_{x}B$ where - $V_{X,M}$ is a tangent vector from the tangent space $T_{x_p}\mathcal M$ and - $V_{X,F}$ is a tangent vector from the tangent space $T_{V_p}F$ (isomorphic to $F$). - Similarly for the other tangent vector $w = (V_{Y,M}, V_{Y,F}) ∈ T_{x}B$. + * The point ``p = (x_p, V_p)`` where ``x_p ∈ \mathcal M`` and ``V_p`` belongs to the + fiber ``F=π^{-1}(\{x_p\})`` of the vector bundle ``B`` where ``π`` is the + canonical projection of that vector bundle ``B``. + * The tangent vector ``v = (V_{X,M}, V_{X,F}) ∈ T_{x}B`` where + ``V_{X,M}`` is a tangent vector from the tangent space ``T_{x_p}\mathcal M`` and + ``V_{X,F}`` is a tangent vector from the tangent space ``T_{V_p}F`` (isomorphic to ``F``). + Similarly for the other tangent vector ``w = (V_{Y,M}, V_{Y,F}) ∈ T_{x}B``. The inner product is calculated as -$⟨X, Y⟩_p = ⟨V_{X,M}, V_{Y,M}⟩_{x_p} + ⟨V_{X,F}, V_{Y,F}⟩_{V_p}.$ +``⟨X, Y⟩_p = ⟨V_{X,M}, V_{Y,M}⟩_{x_p} + ⟨V_{X,F}, V_{Y,F}⟩_{V_p}.`` """ function inner(B::FiberBundle, p, X, Y) px, Vx = submanifold_components(B.manifold, p) @@ -354,7 +376,7 @@ function vector_transport_to!( VYM, VYF = submanifold_components(M.manifold, Y) qx, qVx = submanifold_components(M.manifold, q) vector_transport_to!(M.manifold, VYM, px, VXM, qx, m.method_point) - vector_transport_to!(M.manifold, VYF, px, VXF, qx, m.method_fiber) + bundle_transport_tangent_to!(M, VYF, px, VXF, qx, m.method_fiber) return Y end @@ -370,7 +392,7 @@ function _vector_transport_direction( dx, dVx = submanifold_components(M.manifold, d) return ArrayPartition( vector_transport_direction(M.manifold, px, VXM, dx, m.method_point), - vector_transport_direction(M.fiber, px, VXF, dx, m.method_fiber), + bundle_transport_tangent_direction(M, px, VXF, dx, m.method_fiber), ) end @@ -386,7 +408,7 @@ function _vector_transport_to( qx, qVx = submanifold_components(M.manifold, q) return ArrayPartition( vector_transport_to(M.manifold, px, VXM, qx, m.method_point), - vector_transport_to(M.manifold, px, VXF, qx, m.method_fiber), + bundle_transport_tangent_to(M, px, VXF, qx, m.method_fiber), ) end diff --git a/test/manifolds/vector_bundle.jl b/test/manifolds/vector_bundle.jl index 4b5e6fd84d..b9a0a07a8d 100644 --- a/test/manifolds/vector_bundle.jl +++ b/test/manifolds/vector_bundle.jl @@ -103,26 +103,8 @@ struct TestVectorSpaceType <: VectorSpaceType end Xir = allocate(pts_tb[1]) inverse_retract!(TB, Xir, pts_tb[1], pts_tb[2], m_prod_invretr) @test isapprox(TB, pts_tb[1], Xir, X12_prod) - @test isapprox( - norm(TB.fiber, pts_tb[1][TB, :point], pts_tb[1][TB, :vector]), - sqrt( - inner( - TB.fiber, - pts_tb[1][TB, :point], - pts_tb[1][TB, :vector], - pts_tb[1][TB, :vector], - ), - ), - ) - @test isapprox( - distance( - TB.fiber, - pts_tb[1][TB, :point], - pts_tb[1][TB, :vector], - [0.0, 2.0, 3.0], - ), - 5.0, - ) + F = Fiber(M, pts_tb[1][TB, :point], TangentSpaceType()) + @test isapprox(distance(F, pts_tb[1][TB, :vector], [0.0, 2.0, 3.0]), 5.0) Xir2 = allocate(pts_tb[1]) vector_transport_to!( TB, @@ -175,7 +157,7 @@ struct TestVectorSpaceType <: VectorSpaceType end @test vector_space_dimension(Sphere(3), TT) == 9 @test base_manifold(Fiber(Sphere(2), [1.0, 0.0, 0.0], TT)) == M @test sprint(show, Fiber(Sphere(2), [1.0, 0.0, 0.0], TT)) == - "VectorSpaceFiber(TensorProductType(TangentSpaceType(), TangentSpaceType()), Sphere(2, ℝ))" + "VectorSpaceFiber{ℝ, Sphere{TypeParameter{Tuple{2}}, ℝ}, Manifolds.TensorProductType{Tuple{TangentSpaceType, TangentSpaceType}}, Vector{Float64}}(Sphere(2, ℝ), [1.0, 0.0, 0.0], TensorProductType(TangentSpaceType(), TangentSpaceType()))" end @testset "Error messages" begin @@ -215,7 +197,7 @@ struct TestVectorSpaceType <: VectorSpaceType end tbvt = Manifolds.FiberBundleProductVectorTransport(ppt, ppt) @test TangentBundle(M, tbvt).vector_transport === tbvt @test CotangentBundle(M, tbvt).vector_transport === tbvt - @test VectorBundle(TangentSpace, M, tbvt).vector_transport === tbvt + @test TangentBundle(M, tbvt).vector_transport === tbvt end @testset "Extended flatness tests" begin