Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hyperbolic Riemann tensor #651

Merged
merged 10 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .zenodo.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
{
"contributors": [
{
"affiliation": "NTNU Trondheim",
"name": "Jasa, Hajg",
"type": "ProjectMember",
"orcid": "0009-0002-7917-0530"
},
{
"name": "Mathieu Besançon",
"type": "Other",
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Manifolds"
uuid = "1cead3c2-87b3-11e9-0ccd-23c62b72b94e"
authors = ["Seth Axen <seth.axen@gmail.com>", "Mateusz Baran <mateuszbaran89@gmail.com>", "Ronny Bergmann <manopt@ronnybergmann.net>", "Antoine Levitt <antoine.levitt@gmail.com>"]
version = "0.8.76"
version = "0.8.77"

[deps]
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
Expand Down
10 changes: 9 additions & 1 deletion docs/src/references.bib
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,14 @@ @article{LorenziPennec:2013
TITLE = {Efficient Parallel Transport of Deformations in Time Series of Images: From Schild's to Pole Ladder},
JOURNAL = {Journal of Mathematical Imaging and Vision}
}
@book{Lee:2019,
AUTHOR = {John M. Lee},
DOI = {10.1007/978-3-319-91755-9},
ISBN = {978-3-319-91755-9},
PUBLISHER = {Springer Cham},
TITLE = {Introduction to Riemannian Manifolds},
YEAR = {2019}
}
#
# M
# ----------------------------------------------------------------------------------------
Expand Down Expand Up @@ -667,7 +675,7 @@ @book{SrivastavaKlassen:2016
AUTHOR = {Anuj Srivastava and Eric P. Klassen},
DOI = {10.1007/978-1-4939-4020-2},
ISBN = {978-1-4939-4018-9},
PUBLISHER = {Springer NEw York},
PUBLISHER = {Springer New York},
TITLE = {Functional and Shape Data Analysis},
YEAR = {2016}
}
Expand Down
17 changes: 17 additions & 0 deletions src/manifolds/Hyperbolic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -380,3 +380,20 @@
@eval zero_vector(::Hyperbolic, p::$P) = $T(zero(p.value))
@eval zero_vector!(::Hyperbolic, X::$T, ::$P) = fill!(X.value, 0)
end

@doc raw"""
riemann_tensor(M::Hyperbolic{n}, p, X, Y, Z)

Compute the Riemann tensor ``R(X,Y)Z`` at point `p` on [`Hyperbolic`](@ref) `M`.
The formula reads (see e.g., [Lee:2019](@cite) Proposition 8.36)

````math
R(X,Y)Z = - (\langle Z, Y \rangle X - \langle Z, X \rangle Y)
````
"""
riemann_tensor(::Hyperbolic, p, X, Y, Z)

function riemann_tensor!(M::Hyperbolic, W, p, X, Y, Z)
W .= inner(M, p, Z, X) .* Y .- inner(M, p, Z, Y) .* X
return W

Check warning on line 398 in src/manifolds/Hyperbolic.jl

View check run for this annotation

Codecov / codecov/patch

src/manifolds/Hyperbolic.jl#L396-L398

Added lines #L396 - L398 were not covered by tests
end
20 changes: 20 additions & 0 deletions test/manifolds/hyperbolic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,26 @@ include("../utils.jl")
A = change_metric(M, MinkowskiMetric(), p, X)
@test A == X
end
@testset "other metric" begin
M = Hyperbolic(2)
@test riemann_tensor(
M,
[0.0, 0.0, -1.0],
[-1.0, 0.0, 0.0],
[0.0, -1.0, 0.0],
[-0.5, -0.5, 0.0],
) == [0.5, -0.5, 0.0]
X = [0.0, 0.0, 0.0]
@test riemann_tensor!(
M,
X,
[0.0, 0.0, -1.0],
[-1.0, 0.0, 0.0],
[0.0, -1.0, 0.0],
[-0.5, -0.5, 0.0],
) === X
@test X == [0.5, -0.5, 0.0]
end
@testset "ManifoldDiff" begin
# ManifoldDiff
M = Hyperbolic(2)
Expand Down
Loading