From 808985a17155bafd69d466ab387ef223059476bf Mon Sep 17 00:00:00 2001 From: Ronny Bergmann Date: Mon, 30 Oct 2023 10:04:07 +0100 Subject: [PATCH 1/3] Forward points and tangent vectors on TpM to the right checks. --- src/TangentSpace.jl | 16 ++++++++++++++++ test/test_manifolds.jl | 2 +- test/test_sphere.jl | 10 ++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/TangentSpace.jl b/src/TangentSpace.jl index 6e568b25..da1d60f0 100644 --- a/src/TangentSpace.jl +++ b/src/TangentSpace.jl @@ -40,6 +40,22 @@ function allocate_result(M::TangentSpace, ::typeof(rand)) return zero_vector(M.manifold, M.point) end +# forward both point checks to tangent vector checks +function check_point(TpM::TangentSpace, p; kwargs...) + return check_vector(TpM.manifold, TpM.point, p; kwargs...) +end +function check_size(TpM::TangentSpace, p; kwargs...) + return check_size(TpM.manifold, TpM.point, p; kwargs...) +end +# fix tangent vector checks to use the right base point +function check_vector(TpM::TangentSpace, p, X; kwargs...) + return check_vector(TpM.manifold, TpM.point, X; kwargs...) +end +function check_size(TpM::TangentSpace, p, X; kwargs...) + return check_size(TpM.manifold, TpM.point, X; kwargs...) +end + + """ distance(M::TangentSpace, X, Y) diff --git a/test/test_manifolds.jl b/test/test_manifolds.jl index 571aab9e..02cfa6a1 100644 --- a/test/test_manifolds.jl +++ b/test/test_manifolds.jl @@ -1,5 +1,5 @@ using ManifoldsBase: ℝ, ℂ, DefaultManifold, RealNumbers, EuclideanMetric -using LinearAlgebra +using LinearAlgebra, Random # minimal sphere implementation for testing more complicated manifolds struct TestSphere{N,𝔽} <: AbstractManifold{𝔽} end diff --git a/test/test_sphere.jl b/test/test_sphere.jl index 931a2e00..dbe00c18 100644 --- a/test/test_sphere.jl +++ b/test/test_sphere.jl @@ -45,4 +45,14 @@ include("test_manifolds.jl") V = [0.1, 0.0, 0.0] #orthogonal to TpM -> parallel to p @test isapprox(M, p, Weingarten(M, p, X, V), -0.1 * X) end + @testset "Tangent Space" begin + M = TestSphere(2) + p = [1.0, 0.0, 0.0] + X = [0.0, 0.2, 0.0] + TpM = TangentSpace(M, p) + @test is_point(TpM, X) + @test !is_point(TpM, p) + @test is_vector(TpM, X, X) + @test !is_vector(TpM, X, p) + end end From 4a96c5c5539ce83e4a6d02e0fba9b33a9daea38c Mon Sep 17 00:00:00 2001 From: Ronny Bergmann Date: Mon, 30 Oct 2023 10:05:57 +0100 Subject: [PATCH 2/3] Bump version. --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 50c676ab..48ae29ca 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.15.0" +version = "0.15.1" [deps] LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" From 5f023ccbfa87dc3ba6bc13311f6ec8de4e6da949 Mon Sep 17 00:00:00 2001 From: Ronny Bergmann Date: Mon, 30 Oct 2023 10:42:24 +0100 Subject: [PATCH 3/3] Add a zero_vector(TpM), update News.md and add a GH Action for the News.md --- .github/workflows/changelog.yml | 12 ++++++++++++ NEWS.md | 14 +++++++++++++- src/TangentSpace.jl | 11 ++++++++++- test/test_sphere.jl | 1 + 4 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/changelog.yml diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml new file mode 100644 index 00000000..b01a5a8e --- /dev/null +++ b/.github/workflows/changelog.yml @@ -0,0 +1,12 @@ +name: Check Changelog +on: + pull_request: + +jobs: + Check-Changelog: + name: Check Changelog Action + runs-on: ubuntu-latest + steps: + - uses: tarides/changelog-check-action@v2 + with: + changelog: NEWS.md \ No newline at end of file diff --git a/NEWS.md b/NEWS.md index 4f7e3b48..81cb5c83 100644 --- a/NEWS.md +++ b/NEWS.md @@ -5,7 +5,19 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [0.15.0] dd/mm/2023 +## [0.15.1] 30/10/2023 + +### Added + +- `zero_vector(TpM)` to generate a zero vector in the tangent space +- a GitHub CI action that errors, when this file was not updated on a PR + +### Fixed + +- `is_point` and `is_vector` for the tangent space now correctly forward to + vector checks on the corresponding manifold. The same for both `check_size`s + +## [0.15.0] 21/10/2023 ### Added diff --git a/src/TangentSpace.jl b/src/TangentSpace.jl index da1d60f0..8ba795ef 100644 --- a/src/TangentSpace.jl +++ b/src/TangentSpace.jl @@ -257,11 +257,20 @@ Weingarten(::TangentSpace, ::Any, ::Any, ::Any) Weingarten!(::TangentSpace, W, X, V, A) = fill!(W, 0) +@doc raw""" + zero_vector(TpM::TangentSpace) + +Zero tangent vector in the [`TangentSpace`](@ref) `TpM`, +that is the zero tangent vector at point `TpM.point`. +""" +zero_vector(TpM::TangentSpace) = zero_vector(TpM.manifold, TpM.point) + @doc raw""" zero_vector(TpM::TangentSpace, X) Zero tangent vector at point `X` from the [`TangentSpace`](@ref) `TpM`, -that is the zero tangent vector at point `TpM.point`. +that is the zero tangent vector at point `TpM.point`, +since we identify the tangent space ``T_X(T_p\mathcal M)`` with ``T_p\mathcal M``. """ zero_vector(::TangentSpace, ::Any...) diff --git a/test/test_sphere.jl b/test/test_sphere.jl index dbe00c18..20f2a53c 100644 --- a/test/test_sphere.jl +++ b/test/test_sphere.jl @@ -54,5 +54,6 @@ include("test_manifolds.jl") @test !is_point(TpM, p) @test is_vector(TpM, X, X) @test !is_vector(TpM, X, p) + @test zero_vector(TpM) == zero_vector(M, p) end end