Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuszbaran committed Oct 14, 2023
1 parent 32c8e96 commit 3a1e4d6
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 28 deletions.
8 changes: 3 additions & 5 deletions src/Manifolds.jl
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,10 @@ using ManifoldsBase:
ComplexNumbers,
ComponentManifoldError,
CompositeManifoldError,
CotangentSpace,
CotangentSpaceType,
CoTFVector,
CoTVector,
DefaultBasis,
DefaultOrthogonalBasis,
DefaultOrthonormalBasis,
Expand Down Expand Up @@ -255,6 +257,7 @@ using ManifoldsBase:
PolarInverseRetraction,
PolarRetraction,
PoleLadderTransport,
PowerBasisData,
PowerManifold,
PowerManifoldNested,
PowerManifoldNestedReplacing,
Expand Down Expand Up @@ -728,7 +731,6 @@ export AbstractRetractionMethod,
ODEExponentialRetraction,
PadeRetraction,
ProductRetraction,
PowerRetraction,
SasakiRetraction
# Inverse Retraction types
export AbstractInverseRetractionMethod,
Expand Down Expand Up @@ -793,7 +795,6 @@ export ×,
einstein_tensor,
embed,
embed!,
equiv,
exp,
exp!,
flat,
Expand All @@ -806,8 +807,6 @@ export ×,
get_embedding,
get_orbit_action,
get_total_space,
grad_euclidean_to_manifold,
grad_euclidean_to_manifold!,
hat,
hat!,
horizontal_component,
Expand Down Expand Up @@ -919,7 +918,6 @@ export AbstractGroupAction,
GroupManifold,
GroupOperationAction,
Identity,
InvariantMetric,
LeftAction,
LeftInvariantMetric,
LeftSide,
Expand Down
2 changes: 1 addition & 1 deletion src/groups/product_group.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function Base.show(io::IO, ::MIME"text/plain", G::ProductGroup)
io,
"ProductGroup with $(length(base_manifold(G).manifolds)) subgroup$(length(base_manifold(G).manifolds) == 1 ? "" : "s"):",
)
return _show_product_manifold_no_header(io, base_manifold(G))
return ManifoldsBase._show_product_manifold_no_header(io, base_manifold(G))
end

function Base.show(io::IO, G::ProductGroup)
Expand Down
16 changes: 4 additions & 12 deletions src/manifolds/VectorFiber.jl
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@

const CotangentSpaceAtPoint{𝔽,M} =
Fiber{𝔽,CotangentSpaceType,M} where {𝔽,M<:AbstractManifold{𝔽}}

"""
CotangentSpaceAtPoint(M::AbstractManifold, p)
Return an object of type [`VectorSpaceAtPoint`](@ref) representing cotangent
space at `p`.
"""
function CotangentSpace(M::AbstractManifold, p)
return Fiber(M, CotangentSpaceType(), p)
end

"""
TensorProductType(spaces::VectorSpaceType...)
Expand All @@ -24,6 +12,10 @@ end

TensorProductType(spaces::VectorSpaceType...) = TensorProductType{typeof(spaces)}(spaces)

function inner(B::CotangentSpace, p, X, Y)
return inner(B.manifold, B.point, sharp(B.manifold, B.point, X), sharp(B.manifold, B.point, Y))
end

function Base.show(io::IO, tpt::TensorProductType)
return print(io, "TensorProductType(", join(tpt.spaces, ", "), ")")
end
Expand Down
10 changes: 5 additions & 5 deletions test/manifolds/fiber.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ struct TestVectorSpaceType <: VectorSpaceType end
@testset "tangent and cotangent space" begin
p = [1.0, 0.0, 0.0]
t_p = TangentSpace(M, p)
ct_p = CotangentSpaceAtPoint(M, p)
ct_p = CotangentSpace(M, p)
t_ps = sprint(show, "text/plain", t_p)
sp = sprint(show, "text/plain", p)
sp = replace(sp, '\n' => "\n ")
t_ps_test = "Tangent space to the manifold $(M) at point:\n $(sp)"
@test t_ps == t_ps_test
@test base_manifold(t_p) == M
@test base_manifold(ct_p) == M
@test t_p.fiber.manifold == M
@test ct_p.fiber.manifold == M
@test t_p.fiber.fiber == Manifolds.TangentFiber
@test ct_p.fiber.fiber == Manifolds.CotangentFiber
@test t_p.manifold == M
@test ct_p.manifold == M
@test t_p.fiber_type == TangentSpaceType()
@test ct_p.fiber_type == CotangentSpaceType()
@test t_p.point == p
@test ct_p.point == p
@test injectivity_radius(t_p) == Inf
Expand Down
9 changes: 5 additions & 4 deletions test/metric.jl
Original file line number Diff line number Diff line change
Expand Up @@ -617,15 +617,16 @@ Manifolds.inner(::MetricManifold{ℝ,<:AbstractManifold{ℝ},Issue539Metric}, p,
cotspace = CotangentSpace(M, p)
cotspace2 = CotangentSpace(MM, p)
@test coX.X X
@test inner(M, p, X, Y) inner(cotspace, p, coX, coY)
@test inner(MM, p, fX, fY) inner(cotspace, p, coX, coY)
X0p = zero_vector(MM, p)
@test inner(M, p, X, Y) inner(cotspace, X0p, coX, coY)
@test inner(MM, p, fX, fY) inner(cotspace, X0p, coX, coY)

@test inner(MM, p, fX, fY) inner(cotspace2, p, cofX, cofY)
@test inner(MM, p, fX, fY) inner(cotspace2, X0p, cofX, cofY)
@test sharp(M, p, coX) X

coMMfX = flat(MM, p, fX)
coMMfY = flat(MM, p, fY)
@test inner(MM, p, fX, fY) inner(cotspace2, p, coMMfX, coMMfY)
@test inner(MM, p, fX, fY) inner(cotspace2, X0p, coMMfX, coMMfY)
@test isapprox(sharp(MM, p, coMMfX).data, fX.data)

@testset "Mutating flat/sharp" begin
Expand Down
1 change: 0 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ include("utils.jl")
include_test("manifolds/product_manifold.jl")
include_test("manifolds/power_manifold.jl")
include_test("manifolds/quotient_manifold.jl")
include_test("manifolds/fiber.jl")
include_test("manifolds/fiber_bundle.jl")
include_test("manifolds/vector_bundle.jl")
include_test("manifolds/graph.jl")
Expand Down

0 comments on commit 3a1e4d6

Please sign in to comment.