Skip to content

Commit d608d77

Browse files
authored
Fixes Douglas Rachford Tests (#35)
* fixes DR tests. * switch to new formatter style and a style file. * fix random_point for SPD and increase code coverage. * fixes proxes to new manifolds. * fix the SPD example.
1 parent ce7ed29 commit d608d77

File tree

71 files changed

+849
-1243
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+849
-1243
lines changed

.JuliaFormatter.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
style = "blue"

.github/workflows/format.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,7 @@ jobs:
1717
- name: Install JuliaFormatter and format
1818
run: |
1919
julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter"))'
20-
julia -e 'using JuliaFormatter; format(
21-
".",
22-
short_to_long_function_def = true,
23-
always_for_in = true,
24-
whitespace_ops_in_indices = true,
25-
pipe_to_function_call = true,
26-
import_to_using = true,
27-
always_use_return = true,
28-
)'
20+
julia -e 'using JuliaFormatter; format(".")'
2921
- name: Check format
3022
run: |
3123
julia -e '

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "Manopt"
22
uuid = "0fc0a36d-df90-57f3-8f93-d78a9fc72bb5"
33
authors = ["Ronny Bergmann <manopt@ronnybergmann.net>"]
4-
version = "0.2.6"
4+
version = "0.2.7"
55

66
[deps]
77
ColorSchemes = "35d6a980-a343-548e-a6ea-1d62b119f2f4"
@@ -23,7 +23,7 @@ TestImages = "5e47fb64-e119-507b-a336-dd2b206d9990"
2323
ColorSchemes = "3.5.0"
2424
ColorTypes = "0.9.1, 0.10"
2525
Colors = "0.11.2, 0.12"
26-
Manifolds = "0.4"
26+
Manifolds = "0.4.1"
2727
ManifoldsBase = "0.9"
2828
StaticArrays = "0.12"
2929
TestImages = "1.0.0"

docs/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
1414

1515
[compat]
1616
Documenter = "0.24"
17-
Manifolds = "0.4"
17+
Manifolds = "0.4.1"
1818
ManifoldsBase = "0.9"

docs/make.jl

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ using Manopt, Documenter, Literate
44
tutorialsInputPath = joinpath(@__DIR__, "..", "src/tutorials")
55
tutorialsRelativePath = "tutorials/"
66
tutorialsOutputPath = joinpath(@__DIR__, "src/" * tutorialsRelativePath)
7-
tutorials =
8-
["MeanAndMedian", "BezierCurves", "GradientOfSecondOrderDifference", "JacobiFields"]
7+
tutorials = [
8+
"MeanAndMedian", "BezierCurves", "GradientOfSecondOrderDifference", "JacobiFields"
9+
]
910
menuEntries = [
1011
"get Started: Optimize!",
1112
"work with Bézier curves",
@@ -20,17 +21,17 @@ for (i, tutorial) in enumerate(tutorials)
2021
Literate.markdown(
2122
sourceFile,
2223
tutorialsOutputPath;
23-
name = tutorial,
24+
name=tutorial,
2425
# codefence = "```julia" => "```",
25-
credit = false,
26+
credit=false,
2627
)
2728
push!(TutorialMenu, menuEntries[i] => joinpath(tutorialsRelativePath, tutorial * ".md"))
2829
end
29-
makedocs(
30-
format = Documenter.HTML(prettyurls = false),
31-
modules = [Manopt],
32-
sitename = "Manopt.jl",
33-
pages = [
30+
makedocs(;
31+
format=Documenter.HTML(; prettyurls=false),
32+
modules=[Manopt],
33+
sitename="Manopt.jl",
34+
pages=[
3435
"Home" => "index.md",
3536
"About" => "about.md",
3637
"How to..." => TutorialMenu,
@@ -67,4 +68,4 @@ makedocs(
6768
"Function Index" => "list.md",
6869
],
6970
)
70-
deploydocs(repo = "github.com/JuliaManifolds/Manopt.jl", push_preview = true)
71+
deploydocs(; repo="github.com/JuliaManifolds/Manopt.jl", push_preview=true)

docs/src/plans/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ update_storage!
5454

5555
```@autodocs
5656
Modules = [Manopt]
57-
Pages = ["plans/debugOptions.jl"]
57+
Pages = ["plans/debug_options.jl"]
5858
Order = [:type, :function]
5959
```
6060

@@ -66,7 +66,7 @@ Further specific [`DebugAction`](@ref)s can be found at the specific Options.
6666

6767
```@autodocs
6868
Modules = [Manopt]
69-
Pages = ["plans/recordOptions.jl"]
69+
Pages = ["plans/record_options.jl"]
7070
Order = [:type, :function]
7171
Private = false
7272
```

docs/src/solvers/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ StoppingCriterionSet
3838

3939
```@autodocs
4040
Modules = [Manopt]
41-
Pages = ["plans/stoppingCriterion.jl"]
41+
Pages = ["plans/stopping_criterion.jl"]
4242
Order = [:type]
4343
```
4444

examples/Minimize_Acceleration/R3_Bezier.jl

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ This example appeared in Sec. 5.2, second example, of
1414
using Manopt, Manifolds, Colors, ColorSchemes, Makie
1515
λ = 50.0
1616

17-
curve_samples = [range(0, 3, length = 1601)...] # sample curve for the gradient
18-
curve_samples_plot = [range(0, 3, length = 1601)...] # sample curve for asy exports
17+
curve_samples = [range(0, 3; length=1601)...] # sample curve for the gradient
18+
curve_samples_plot = [range(0, 3; length=1601)...] # sample curve for asy exports
1919

2020
experimentFolder = "examples/Minimize_Acceleration/R3_Bezier/"
2121
experimentName = "Bezier_R3_Approximation"
@@ -51,12 +51,7 @@ pB = get_bezier_points(M, B, :differentiable)
5151
N = PowerManifold(M, NestedPowerRepresentation(), length(pB))
5252
function F(pB)
5353
return cost_L2_acceleration_bezier(
54-
M,
55-
pB,
56-
get_bezier_degrees(M, B),
57-
curve_samples,
58-
λ,
59-
dataP,
54+
M, pB, get_bezier_degrees(M, B), curve_samples, λ, dataP
6055
)
6156
end
6257
∇F(pB) = ∇L2_acceleration_bezier(M, pB, get_bezier_degrees(M, B), curve_samples, λ, dataP)
@@ -66,13 +61,13 @@ pB_opt = gradient_descent(
6661
F,
6762
∇F,
6863
x0;
69-
stepsize = ArmijoLinesearch(1.0, ExponentialRetraction(), 0.5, 0.0001), # use Armijo lineSearch
70-
stopping_criterion = StopWhenAny(
64+
stepsize=ArmijoLinesearch(1.0, ExponentialRetraction(), 0.5, 0.0001), # use Armijo lineSearch
65+
stopping_criterion=StopWhenAny(
7166
StopWhenChangeLess(10.0^(-16)),
7267
StopWhenGradientNormLess(10.0^-9),
7368
StopAfterIteration(300),
7469
),
75-
debug = [
70+
debug=[
7671
:Stop,
7772
:Iteration,
7873
" | ",
@@ -96,15 +91,15 @@ scatter!(
9691
scene,
9792
[p0[1], p1[1], p2[1], p3[1]],
9893
[p0[2], p1[2], p2[2], p3[2]],
99-
[p0[3], p1[3], p2[3], p3[3]],
100-
color = pColor,
94+
[p0[3], p1[3], p2[3], p3[3]];
95+
color=pColor,
10196
)
10297

103-
lines!(scene, resPmat[1, :], resPmat[2, :], resPmat[3, :], color = ξColor, linewidth = 1.5)
98+
lines!(scene, resPmat[1, :], resPmat[2, :], resPmat[3, :]; color=ξColor, linewidth=1.5)
10499
scatter!(
105100
scene,
106101
[res_cp[1][1], res_cp[2][1], res_cp[3][1], res_cp[4][1]],
107102
[res_cp[1][2], res_cp[2][2], res_cp[3][2], res_cp[4][2]],
108-
[res_cp[1][3], res_cp[2][3], res_cp[3][3], res_cp[4][3]],
109-
color = dColor,
103+
[res_cp[1][3], res_cp[2][3], res_cp[3][3], res_cp[4][3]];
104+
color=dColor,
110105
)

examples/Minimize_Acceleration/S2_Bezier_Approximation.jl

Lines changed: 25 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ using Manopt, Manifolds, Colors, ColorSchemes
1515
asyExport = true #export data and results to asyExport
1616
λ = 10.0
1717

18-
curve_samples = [range(0, 3, length = 101)...] # sample curve for the gradient
19-
curve_samples_plot = [range(0, 3, length = 201)...] # sample curve for asy exports
18+
curve_samples = [range(0, 3; length=101)...] # sample curve for the gradient
19+
curve_samples_plot = [range(0, 3; length=201)...] # sample curve for asy exports
2020

2121
experimentFolder = "examples/Minimize_Acceleration/S2_Bezier/"
2222
experimentName = "Bezier_Approximation"
@@ -39,36 +39,29 @@ dataP = get_bezier_junctions(M, B)
3939
if asyExport
4040
asymptote_export_S2_signals(
4141
experimentFolder * experimentName * "-orig.asy";
42-
curves = [cP],
43-
points = [get_bezier_junctions(M, B), get_bezier_inner_points(M, B)],
44-
tVectors = [[
42+
curves=[cP],
43+
points=[get_bezier_junctions(M, B), get_bezier_inner_points(M, B)],
44+
tVectors=[[
4545
Tuple(a)
4646
for
4747
a in
4848
zip(get_bezier_junctions(M, B, true), get_bezier_junction_tangent_vectors(M, B))
4949
]],
50-
colors = Dict(
51-
:curves => [curveColor],
52-
:points => [dColor, bColor],
53-
:tvectors => [ξColor],
50+
colors=Dict(
51+
:curves => [curveColor], :points => [dColor, bColor], :tvectors => [ξColor]
5452
),
55-
cameraPosition = cameraPosition,
56-
arrowHeadSize = 10.0,
57-
lineWidths = [1.5, 1.5],
58-
dotSize = 4.0,
53+
cameraPosition=cameraPosition,
54+
arrowHeadSize=10.0,
55+
lineWidths=[1.5, 1.5],
56+
dotSize=4.0,
5957
)
60-
render_asymptote(experimentFolder * experimentName * "-orig.asy"; render = 4)
58+
render_asymptote(experimentFolder * experimentName * "-orig.asy"; render=4)
6159
end
6260
pB = get_bezier_points(M, B, :differentiable)
6361
N = PowerManifold(M, NestedPowerRepresentation(), length(pB))
6462
function F(pB)
6563
return cost_L2_acceleration_bezier(
66-
M,
67-
pB,
68-
get_bezier_degrees(M, B),
69-
curve_samples,
70-
λ,
71-
dataP,
64+
M, pB, get_bezier_degrees(M, B), curve_samples, λ, dataP
7265
)
7366
end
7467
∇F(pB) = ∇L2_acceleration_bezier(M, pB, get_bezier_degrees(M, B), curve_samples, λ, dataP)
@@ -78,13 +71,13 @@ pB_opt = gradient_descent(
7871
F,
7972
∇F,
8073
x0;
81-
stepsize = ArmijoLinesearch(1.0, ExponentialRetraction(), 0.5, 0.001), # use Armijo lineSearch
82-
stopping_criterion = StopWhenAny(
74+
stepsize=ArmijoLinesearch(1.0, ExponentialRetraction(), 0.5, 0.001), # use Armijo lineSearch
75+
stopping_criterion=StopWhenAny(
8376
StopWhenChangeLess(10.0^(-5)),
8477
StopWhenGradientNormLess(10.0^-7),
8578
StopAfterIteration(300),
8679
),
87-
debug = [
80+
debug=[
8881
:Stop,
8982
:Iteration,
9083
" | ",
@@ -105,25 +98,25 @@ res_curve = de_casteljau(M, B_opt, curve_samples_plot)
10598
if asyExport
10699
asymptote_export_S2_signals(
107100
experimentFolder * experimentName * "-result.asy";
108-
curves = [res_curve, cP],
109-
points = [get_bezier_junctions(M, B_opt), get_bezier_inner_points(M, B_opt)],
110-
tVectors = [[
101+
curves=[res_curve, cP],
102+
points=[get_bezier_junctions(M, B_opt), get_bezier_inner_points(M, B_opt)],
103+
tVectors=[[
111104
Tuple(a)
112105
for
113106
a in zip(
114107
get_bezier_junctions(M, B_opt, true),
115108
get_bezier_junction_tangent_vectors(M, B_opt),
116109
)
117110
]],
118-
colors = Dict(
111+
colors=Dict(
119112
:curves => [curveColor, pColor],
120113
:points => [dColor, bColor],
121114
:tvectors => [ξColor],
122115
),
123-
cameraPosition = cameraPosition,
124-
arrowHeadSize = 10.0,
125-
lineWidths = [1.5, 0.75, 1.5],
126-
dotSize = 4.0,
116+
cameraPosition=cameraPosition,
117+
arrowHeadSize=10.0,
118+
lineWidths=[1.5, 0.75, 1.5],
119+
dotSize=4.0,
127120
)
128-
render_asymptote(experimentFolder * experimentName * "-result.asy"; render = 4)
121+
render_asymptote(experimentFolder * experimentName * "-result.asy"; render=4)
129122
end

examples/Minimize_Acceleration/S2_Bezier_Approximation_lambda_video.jl

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ render_detail = 2
1818
asy_export = true
1919
asy_export_summary = true
2020
render_video = true
21-
λRange = collect(range(10.0, 0.0, length = 1001))[1:(end - 1)] #exclude zero.
22-
colors = RGBA.(get.(Ref(viridis), range(0.0, 1.0, length = length(λRange))))
21+
λRange = collect(range(10.0, 0.0; length=1001))[1:(end - 1)] #exclude zero.
22+
colors = RGBA.(get.(Ref(viridis), range(0.0, 1.0; length=length(λRange))))
2323

24-
curve_samples = [range(0, 3, length = 101)...] # sample curve for the gradient
25-
curve_samples_plot = [range(0, 3, length = 201)...] # sample curve for asy exports
24+
curve_samples = [range(0, 3; length=101)...] # sample curve for the gradient
25+
curve_samples_plot = [range(0, 3; length=201)...] # sample curve for asy exports
2626

2727
experimentFolder = "examples/Minimize_Acceleration/S2_Bezier/video/"
2828
experimentName = "Bezier_Approximation_video"
@@ -48,12 +48,11 @@ for i in eachindex(λRange)
4848
F,
4949
∇F,
5050
x0;
51-
stepsize = ArmijoLinesearch(1.0, ExponentialRetraction(), 0.5, 0.001),
52-
stopping_criterion = StopWhenAny(
53-
StopWhenChangeLess(5 * 10.0^(-6)),
54-
StopAfterIteration(15000),
51+
stepsize=ArmijoLinesearch(1.0, ExponentialRetraction(), 0.5, 0.001),
52+
stopping_criterion=StopWhenAny(
53+
StopWhenChangeLess(5 * 10.0^(-6)), StopAfterIteration(15000)
5554
),
56-
debug = [
55+
debug=[
5756
:Stop,
5857
"$(λ) ",
5958
:Iteration,
@@ -79,33 +78,31 @@ if asy_export
7978
B_opt = get_bezier_segments(M, results[i], degs, :differentiable)
8079
asymptote_export_S2_signals(
8180
experimentFolder * experimentName * "-$(@sprintf "%04.0f" i)-result.asy";
82-
curves = [resulting_curves[i], cP],
83-
points = [get_bezier_junctions(M, B_opt), get_bezier_inner_points(M, B_opt)],
84-
colors = Dict(
85-
:curves => [colors[i], curveColor],
86-
:points => [colors[i], colors[i]],
81+
curves=[resulting_curves[i], cP],
82+
points=[get_bezier_junctions(M, B_opt), get_bezier_inner_points(M, B_opt)],
83+
colors=Dict(
84+
:curves => [colors[i], curveColor], :points => [colors[i], colors[i]]
8785
),
88-
cameraPosition = cameraPosition,
89-
lineWidths = [1.0, 0.5],
90-
dotSize = 2.0,
86+
cameraPosition=cameraPosition,
87+
lineWidths=[1.0, 0.5],
88+
dotSize=2.0,
9189
)
9290
render_asymptote(
9391
experimentFolder * experimentName * "-$(@sprintf "%04.0f" i)-result.asy";
94-
render = render_detail,
92+
render=render_detail,
9593
)
9694
end
9795
end
9896
if asy_export_summary
9997
asymptote_export_S2_signals(
10098
experimentFolder * experimentName * "-Summary-result.asy";
101-
curves = [cP, resulting_curves...],
102-
colors = Dict(:curves => [curveColor, colors...]),
103-
cameraPosition = cameraPosition,
104-
lineWidths = [0.75, [1.5 for i in eachindex(λRange)]...],
99+
curves=[cP, resulting_curves...],
100+
colors=Dict(:curves => [curveColor, colors...]),
101+
cameraPosition=cameraPosition,
102+
lineWidths=[0.75, [1.5 for i in eachindex(λRange)]...],
105103
)
106104
render_asymptote(
107-
experimentFolder * experimentName * "-Summary-result.asy";
108-
render = render_detail,
105+
experimentFolder * experimentName * "-Summary-result.asy"; render=render_detail
109106
)
110107
end
111108
if render_video

0 commit comments

Comments
 (0)