-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Introduce proxes * Unify docs, introduce Changelog, finish testing proxes (adapting tests formerly done in Manopt). * Unify variables and docs. --------- Co-authored-by: Mateusz Baran <[email protected]>
- Loading branch information
1 parent
7fb4aa7
commit b8c3464
Showing
11 changed files
with
190 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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: Changelog.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Changelog | ||
|
||
All notable changes to this Julia package 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.3.9] - December 8, 2023 | ||
|
||
### Added | ||
|
||
* proximal map of the distance function, `prox_distance`, and its mutating variant, `prox_distance!` | ||
* this changelog | ||
* A GitHub Action to check that the Changelog is updated on every PR. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name = "ManifoldDiff" | ||
uuid = "af67fdf4-a580-4b9f-bbec-742ef357defd" | ||
authors = ["Seth Axen <[email protected]>", "Mateusz Baran <[email protected]>", "Ronny Bergmann <[email protected]>"] | ||
version = "0.3.8" | ||
version = "0.3.9" | ||
|
||
[deps] | ||
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* Taken from https://juliadocs.org/DocumenterCitations.jl/v1.2/styling/ */ | ||
|
||
.citation dl { | ||
display: grid; | ||
grid-template-columns: max-content auto; } | ||
.citation dt { | ||
grid-column-start: 1; } | ||
.citation dd { | ||
grid-column-start: 2; | ||
margin-bottom: 0.75em; } | ||
.citation ul { | ||
padding: 0 0 2.25em 0; | ||
margin: 0; | ||
list-style: none;} | ||
.citation ul li { | ||
text-indent: -2.25em; | ||
margin: 0.33em 0.5em 0.5em 2.25em;} | ||
.citation ol li { | ||
padding-left:0.75em;} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
@doc raw""" | ||
y = prox_distance(M::AbstractManifold, λ::Real, p_data, p [, r=2]) | ||
prox_distance!(M::AbstractManifold, q, λ::Real, p_data, p [, r=2]) | ||
Compute the proximal map ``\operatorname{prox}_{λf}`` with | ||
parameter λ of ``f(p) = \frac{1}{r}d_{\mathcal M}^r(p_{\mathrm{data}},p)``. | ||
For the in-place variant the computation is done in place of `q`. | ||
# Input | ||
* `M` a manifold `M` | ||
* `λ` the prox parameter, a positive real number. | ||
* `p_data` a point on `M`. | ||
* `p` the argument of the proximal map | ||
* `r` (`2`) exponent of the distance. | ||
# Output | ||
* `q` – the result of the proximal map of ``f`` | ||
For more details see [WeinmannDemaretStorath:2014](@cite) | ||
""" | ||
function prox_distance(M::AbstractManifold, λ::Real, p_data, p, r::Int = 2) | ||
d = distance(M, p_data, p) | ||
if r == 2 | ||
t = λ / (1 + λ) | ||
elseif r == 1 | ||
t = (λ < d) ? λ / d : 1.0 | ||
else | ||
throw( | ||
ErrorException( | ||
"Proximal Map of distance(M, p_data, p) not implemented for an exponent $(r) (requires 1 or 2)", | ||
), | ||
) | ||
end | ||
return shortest_geodesic(M, p, p_data, t) | ||
end | ||
function prox_distance!(M::AbstractManifold, q, λ::Real, p_data, p, r::Int = 2) | ||
d = distance(M, p_data, p) | ||
if r == 2 | ||
t = λ / (1 + λ) | ||
elseif r == 1 | ||
t = (λ < d) ? λ / d : 1.0 | ||
else | ||
throw( | ||
ErrorException( | ||
"Proximal Map of distance(M, p_data, p) not implemented for an exponent $(r) (requires 1 or 2)", | ||
), | ||
) | ||
end | ||
return shortest_geodesic!(M, q, p, p_data, t) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using Manifolds, ManifoldDiff, Test | ||
|
||
@testset "proximal maps" begin | ||
# | ||
# Distance | ||
p = [1.0, 0.0, 0.0] | ||
q = [0.0, 1.0, 0.0] | ||
M = Sphere(2) | ||
# Error for r != 1 or 2 | ||
@test_throws ErrorException ManifoldDiff.prox_distance(M, 1.0, p, q, 3) | ||
@test_throws ErrorException ManifoldDiff.prox_distance!(M, p, 1.0, p, q, 3) | ||
# r = 1 | ||
@test distance( | ||
M, | ||
ManifoldDiff.prox_distance(M, distance(M, p, q) / 2, p, q, 1), | ||
shortest_geodesic(M, p, q, 0.5), | ||
) < eps() | ||
t = similar(p) | ||
ManifoldDiff.prox_distance!(M, t, distance(M, p, q) / 2, p, q, 1) | ||
@test t == ManifoldDiff.prox_distance(M, distance(M, p, q) / 2, p, q, 1) | ||
# r = 2 | ||
ManifoldDiff.prox_distance!(M, t, 1.0, p, q, 2) | ||
@test t == ManifoldDiff.prox_distance(M, 1.0, p, q, 2) | ||
@test t == ManifoldDiff.prox_distance(M, 1.0, p, q) # 2 is also the default | ||
@test distance(M, t, shortest_geodesic(M, p, q, 0.5)) ≈ 0 atol = 1e-15 | ||
end |
b8c3464
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
b8c3464
There was a problem hiding this comment.
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/96741
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.
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: