-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve get proximal map – add test coverage.
- Loading branch information
1 parent
3f96950
commit 27268c6
Showing
6 changed files
with
107 additions
and
31 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
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
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,27 @@ | ||
using Manopt, Manifolds, ManifoldDiff | ||
using ManifoldDiff: prox_distance, prox_distance! | ||
|
||
@testset "Proximal Point" begin | ||
# Dummy problem | ||
M = Sphere(2) | ||
q = [1.0, 0.0, 0.0] | ||
f(M, p) = 0.5 * distance(M, p, q)^2 | ||
prox_f(M, λ, p) = prox_distance(M, λ, q, p) | ||
prox_f!(M, r, λ, p) = prox_distance!(M, r, λ, q, p) | ||
|
||
p0 = [0.0, 0.0, 1.0] | ||
q1 = proximal_point(M, prox_f, p0) | ||
@test distance(M, q, q1) < 1e-12 | ||
q2 = proximal_point(M, prox_f!, p0; evaluation=InplaceEvaluation()) | ||
@test distance(M, q1, q2) == 0 | ||
os3 = proximal_point(M, prox_f, p0; return_state=true, return_objective=true) | ||
obj = os3[1] | ||
# test with get_prox map that these are fix points | ||
pps = os3[2] | ||
q3a = get_proximal_map(M, obj, 1.0, get_iterate(pps)) | ||
@test isapprox(M, q2, q3a) | ||
q3b = rand(M) | ||
get_proximal_map!(M, q3b, obj, 1.0, get_iterate(pps)) | ||
@test distance(M, q3a, q3b) == 0 | ||
@test startswith(repr(pps), "# Solver state for `Manopt.jl`s Proximal Point Method\n") | ||
end |