Skip to content

Commit

Permalink
Fix 0-index Euclidean just like Circle (#697)
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuszbaran committed Dec 27, 2023
1 parent fab7b4b commit 81a43d4
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
6 changes: 6 additions & 0 deletions NEWS.md
Expand Up @@ -5,6 +5,12 @@ 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.9.11] – 2023-12-27

### Fixed

* Fixed mixed array index number in-place `parallel_transport_to!` on zero-index `Euclidean`, on Julia 1.6.

## [0.9.10] – 2023-12-27

### Added
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
@@ -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.9.10"
version = "0.9.11"

[deps]
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
Expand Down
6 changes: 6 additions & 0 deletions src/manifolds/Euclidean.jl
Expand Up @@ -213,6 +213,8 @@ Base.exp(::Euclidean, p, X, t::Number) = p .+ t .* X

exp!(::Euclidean, q, p, X) = (q .= p .+ X)
exp!(::Euclidean, q, p, X, t::Number) = (q .= p .+ t .* X)
exp!(::Euclidean{TypeParameter{Tuple{}}}, q, p, X, t::Number) = (q .= p[] + t * X[])
exp!(::Euclidean{Tuple{}}, q, p, X, t::Number) = (q .= p[] + t * X[])

function get_basis_diagonalizing(
M::Euclidean,
Expand Down Expand Up @@ -677,6 +679,10 @@ the parallel transport on [`Euclidean`](@ref) is the identiy, i.e. returns `X`.
"""
parallel_transport_to(::Euclidean, ::Any, X, ::Any) = X
parallel_transport_to!(::Euclidean, Y, ::Any, X, ::Any) = copyto!(Y, X)
function parallel_transport_to!(::Euclidean{TypeParameter{Tuple{}}}, Y, ::Any, X, ::Any)
return copyto!(Y, X[])
end
parallel_transport_to!(::Euclidean{Tuple{}}, Y, ::Any, X, ::Any) = copyto!(Y, X[])

@doc raw"""
project(M::Euclidean, p)
Expand Down
11 changes: 11 additions & 0 deletions test/manifolds/euclidean.jl
Expand Up @@ -446,4 +446,15 @@ using FiniteDifferences
ManifoldDiff.βdifferential_shortest_geodesic_startpoint,
) === 2.0
end

@testset "Mixed array dimensions for exp and PT" begin
# this is an issue on Julia 1.6 but not later releases
for M in [Euclidean(), Euclidean(; parameter=:field)]
p = fill(0.0)
exp!(M, p, p, [1.0], 2.0)
@test p fill(2.0)
parallel_transport_to!(M, p, p, [4.0], p)
@test p fill(4.0)
end
end
end

2 comments on commit 81a43d4

@mateuszbaran
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/97820

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.9.11 -m "<description of version>" 81a43d434a1ed6f515c00dd9814fd45d0d99ae2e
git push origin v0.9.11

Please sign in to comment.