Skip to content

Commit

Permalink
small commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Jacobsson committed Dec 20, 2024
1 parent 341e913 commit a2413c5
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/manifolds/Segre.jl
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ end
````math
\mathcal{P} = ℝ^{+} \times \mathbb{S}^{n_1 - 1} \times \dots \times \mathbb{S}^{n_d - 1}
````
with the metric [`inner`](@ref inner(::Segre, ::Any, ::Any, ::Any)).
with a warped product metric.
Every equivalence class ``q \in \mathcal{S}`` has ``2^d`` representatives in ``\mathcal{P}``.
`closest_representative!(M, q, p)` changes representative of `q` to the one that is closest to `p` in ``\mathcal{P}``.
"""
Expand Down
4 changes: 2 additions & 2 deletions src/manifolds/SegreWarpedMetric.jl
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,9 @@ and assume ``(μ, y_1,…, y_d)`` is the representative of ``q`` that minimizes
\operatorname{log}_p(q) =
\left(
\mu \cos{m} - \lambda,
(y_1 - ⟨x_1, y_1⟩ x_1) \frac{\mu \sphericalangle(x_1, y_1) \sin{A m}}{\lambda A m \sin{\sphericalangle(x_1, y_1)}},
(y_1 - ⟨x_1, y_1⟩ x_1) \frac{\mu \sphericalangle(x_1, y_1) \sin(A m)}{\lambda A m \sin{\sphericalangle(x_1, y_1)}},
\dots,
(y_d - ⟨x_d, y_d⟩ x_d) \frac{\mu \sphericalangle(x_d, y_d) \sin{A m}}{\lambda A m \sin{\sphericalangle(x_d, y_d)}}
(y_d - ⟨x_d, y_d⟩ x_d) \frac{\mu \sphericalangle(x_d, y_d) \sin(A m)}{\lambda A m \sin{\sphericalangle(x_d, y_d)}}
\right).
````
Expand Down
35 changes: 31 additions & 4 deletions test/manifolds/segre.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ using Manifolds, Test, Random, LinearAlgebra, FiniteDifferences
Segre(7, 2),
Segre(7, 9, 9),
Segre(9, 3, 6, 6),
MetricManifold(Segre(10), WarpedMetric(1.2025837056880606)),
MetricManifold(Segre(2, 9), WarpedMetric(1.1302422072971439)),
MetricManifold(Segre(9, 6, 10), WarpedMetric(1.4545138169484464)),
MetricManifold(Segre(9, 3, 8, 10), WarpedMetric(1.396673190458706)),
MetricManifold(Segre(10), WarpedMetric(1.20)),
MetricManifold(Segre(2, 9), WarpedMetric(1.13)),
MetricManifold(Segre(9, 6, 10), WarpedMetric(0.87)),
MetricManifold(Segre(9, 3, 8, 10), WarpedMetric(1.40)),
]

# Vs[i] is the valence of Ms[i]
Expand Down Expand Up @@ -115,6 +115,11 @@ using Manifolds, Test, Random, LinearAlgebra, FiniteDifferences
[[1.0, 0.0], p[2:end]...];
error=:error,
)
@test_throws DomainError is_point(
M,
[p[1], [1.0], p[3:end]...];
error=:error,
)
@test_throws DomainError is_point(M, [[-1.0], p[2:end]...]; error=:error)
@test_throws DomainError is_point(M, [p[1], 2 * p[2:end]...]; error=:error)
end
Expand All @@ -139,6 +144,10 @@ using Manifolds, Test, Random, LinearAlgebra, FiniteDifferences
@test_throws DomainError is_vector(M, p, p, false, true)
end

@testset "connected_by_geodesic" begin
@test connected_by_geodesic(M, p, q)
end

Random.seed!(1)
@testset "rand" begin
@test is_point(M, rand(M))
Expand Down Expand Up @@ -319,4 +328,22 @@ using Manifolds, Test, Random, LinearAlgebra, FiniteDifferences
q_ = [q[1], q[2], q[3], q[4], -q[5]]
@test is_vector(M, p, log(M, p, q_))
end

# Test the formulas for sectional curvature stated in the docs
@testset "sectional_curvature" begin
M = Segre(3, 3)
p = [[1.3], [1.0, 0.0, 0.0], [1.0, 0.0, 0.0]]
X = [[0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 0.0]]
Y = [[0.0], [0.0, 0.0, 1.0], [0.0, 0.0, 0.0]]
Z = [[0.0], [0.0, 0.0, 0.0], [0.0, 1.0, 0.0]]
V = [[1.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]]
@test isapprox(0.0, sectional_curvature(M, p, X, Y))
@test isapprox(-1 / p[1][1]^2, sectional_curvature(M, p, X, Z))
@test isapprox(0.0, sectional_curvature(M, p, X, V))

M = MetricManifold(Segre(3, 3, 3), WarpedMetric(1.23))
@test isapprox((1.23^(-2) - 1) / p[1][1]^2, sectional_curvature(M, p, X, Y))
@test isapprox(-1 / p[1][1]^2, sectional_curvature(M, p, X, Z))
@test isapprox(0.0, sectional_curvature(M, p, X, V))
end
end

0 comments on commit a2413c5

Please sign in to comment.