Skip to content

Commit

Permalink
Bump dependencies and add a exclude-tutorials option for the docs, …
Browse files Browse the repository at this point in the history
…to be able to render documentation locally when not having quarot installed.
  • Loading branch information
kellertuer committed Oct 24, 2023
1 parent b37dde4 commit b135acf
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 45 deletions.
2 changes: 1 addition & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
[compat]
BenchmarkTools = "1.3"
CondaPkg = "0.2"
Documenter = "0.27"
Documenter = "1"
Manifolds = "0.8.81, 0.9"
ManifoldsBase = "0.14.12, 0.15"
79 changes: 50 additions & 29 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,28 @@
#
#

if "--help" ARGS
println(
"""
docs/make.jl
Render the `Manopt.jl` documenation with optinal arguments
Arguments
* `--exclude-docs` - exlcude the tutorials from the menu of Documenter,
this can be used if you do not have Quarto installed to still be able to render the docs
locally on this machine. This option should not be set on CI.
* `--help` - print this help and exit without rendering the documentation
* `--quarto` – run the Quarto notebooks from the `tutorials/` folder before generating the documentation
this has to be run locally at least once for the `tutorials/*.md` files to exist that are included in
the documentation (see `--exclude-tutorials`) for the alternative.
If they are generated ones they are cached accordingly.
Then you can spare time in the rendering by not passing this argument.
""",
)
exit(0)
end

#
# (a) if docs is not the current active environment, switch to it
# (from https://github.com/JuliaIO/HDF5.jl/pull/1020/) 
Expand Down Expand Up @@ -29,6 +51,17 @@ if "--quarto" ∈ ARGS
end
end

tutorials_in_menu = true
if "--exclude-tutorials" ARGS
@warn """
You are excluding the tutorials from the Menu,
which might be done if you can not render them locally.
Remember that this should never be done on CI for the full documentation.
"""
tutorials_in_menu = false
end

# (c) load necessary packages for the docs
using Documenter
using DocumenterCitations
Expand All @@ -54,10 +87,23 @@ open(joinpath(generated_path, "contributing.md"), "w") do io
end
end

## Build titorials menu
tutorials_menu =
"How to..." => [
"Get started: Optimize!" => "tutorials/Optimize!.md",
"Speedup using Inplace computations" => "tutorials/InplaceGradient.md",
"Use Automatic Differentiation" => "tutorials/AutomaticDifferentiation.md",
"Define Objectives in the Embedding" => "tutorials/EmbeddingObjectives.md",
"Count and use a Cache" => "tutorials/CountAndCache.md",
"Print Debug Output" => "tutorials/HowToDebug.md",
"Record values" => "tutorials/HowToRecord.md",
"Implement a Solver" => "tutorials/ImplementASolver.md",
"Do Constrained Optimization" => "tutorials/ConstrainedOptimization.md",
"Do Geodesic Regression" => "tutorials/GeodesicRegression.md",
]
# (e) ...finally! make docs
bib = CitationBibliography(joinpath(@__DIR__, "src", "references.bib"); style=:alpha)
makedocs(
bib;
makedocs(;
format=Documenter.HTML(;
mathengine=MathJax3(), prettyurls=get(ENV, "CI", nothing) == "true"
),
Expand Down Expand Up @@ -86,36 +132,10 @@ makedocs(
],
authors="Ronny Bergmann and contributors.",
sitename="Manopt.jl",
strict=[
:doctest,
:linkcheck,
:parse_error,
:example_block,
:autodocs_block,
:cross_references,
:docs_block,
:eval_block,
:example_block,
:footnote,
:meta_block,
:missing_docs,
:setup_block,
],
pages=[
"Home" => "index.md",
"About" => "about.md",
"How to..." => [
"Get started: Optimize!" => "tutorials/Optimize!.md",
"Speedup using Inplace computations" => "tutorials/InplaceGradient.md",
"Use Automatic Differentiation" => "tutorials/AutomaticDifferentiation.md",
"Define Objectives in the Embedding" => "tutorials/EmbeddingObjectives.md",
"Count and use a Cache" => "tutorials/CountAndCache.md",
"Print Debug Output" => "tutorials/HowToDebug.md",
"Record values" => "tutorials/HowToRecord.md",
"Implement a Solver" => "tutorials/ImplementASolver.md",
"Do Constrained Optimization" => "tutorials/ConstrainedOptimization.md",
"Do Geodesic Regression" => "tutorials/GeodesicRegression.md",
],
(tutorials_in_menu ? [tutorials_menu] : [])...,
"Solvers" => [
"Introduction" => "solvers/index.md",
"Adaptive Regularization with Cubics" => "solvers/adaptive-regularization-with-cubics.md",
Expand Down Expand Up @@ -170,6 +190,7 @@ makedocs(
"Notation" => "notation.md",
"References" => "references.md",
],
plugins=[bib],
)
deploydocs(; repo="github.com/JuliaManifolds/Manopt.jl", push_preview=true)
#back to main env
Expand Down
2 changes: 1 addition & 1 deletion docs/src/solvers/ChambollePock.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
The Riemannian Chambolle–Pock is a generalization of the Chambolle–Pock algorithm [ChambollePock:2011](@citet*)
It is also known as primal-dual hybrid gradient (PDHG) or primal-dual proximal splitting (PDPS) algorithm.

In order to minimize over $p∈\mathcal M§ the cost function consisting of
In order to minimize over $p∈\mathcal M$ the cost function consisting of

```math
F(p) + G(Λ(p)),
Expand Down
26 changes: 13 additions & 13 deletions src/data/artificialDataFunctions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ end
generate a real-valued signal having piecewise constant, linear and quadratic
intervals with jumps in between. If the resulting manifold the data lives on,
is the [`Circle`](hhttps://juliamanifolds.github.io/Manifolds.jl/latest/manifolds/circle.html)
the data is also wrapped to $[-\pi,\pi)$. This is data for an example from [Bergmann et. al., SIAM J Imag Sci, 2014](@cite BergmannLausSteidlWeinmann:2014:1).
the data is also wrapped to ``[-\pi,\pi)``. This is data for an example from [Bergmann et. al., SIAM J Imag Sci, 2014](@cite BergmannLausSteidlWeinmann:2014:1).
# Optional
* `pts` – (`500`) number of points to sample the function
Expand All @@ -110,7 +110,7 @@ function artificial_S1_signal(pts::Integer=500)
end
@doc raw"""
artificial_S1_signal(x)
evaluate the example signal $f(x), x ∈ [0,1]$,
evaluate the example signal ``f(x), x ∈ [0,1]``,
of phase-valued data introduces in Sec. 5.1 of [Bergmann et. al., SIAM J Imag Sci, 2014](@cite BergmannLausSteidlWeinmann:2014:1)
for values outside that interval, this Signal is `missing`.
"""
Expand Down Expand Up @@ -147,7 +147,7 @@ function artificial_S2_whirl_image end
Generate an artificial image of data on the 2 sphere,
# Arguments
* `pts` – (`64`) size of the image in `pts`$\times$`pts` pixel.
* `pts` – (`64`) size of the image in `pts`×`pts` pixel.
This example dataset was used in the numerical example in Section 5.5 of [Laus et al., SIAM J Imag Sci., 2017](@cite LausNikolovaPerschSteidl:2017)
Expand All @@ -172,7 +172,7 @@ artificial_S2_rotation_image()
@doc raw"""
artificial_S2_whirl_patch([pts=5])
create a whirl within the `pts`$\times$`pts` patch of
create a whirl within the `pts`×`pts` patch of
[Sphere](https://juliamanifolds.github.io/Manifolds.jl/stable/manifolds/sphere.html)(@ref)`(2)`-valued image data.
These patches are used within [`artificial_S2_whirl_image`](@ref).
Expand Down Expand Up @@ -213,11 +213,11 @@ p_2 = \begin{bmatrix}-1&0&0\end{bmatrix}^{\mathrm{T}},
p_3 = \begin{bmatrix}0&0&-1\end{bmatrix}^{\mathrm{T}},
````
where each segment is a cubic Bézier curve, i.e. each point, except $p_3$ has a first point
within the following segment $b_i^+$, $i=0,1,2$ and a last point within the previous
segment, except for $p_0$, which are denoted by $b_i^-$, $i=1,2,3$.
This curve is differentiable by the conditions $b_i^- = \gamma_{b_i^+,p_i}(2)$, $i=1,2$,
where $\gamma_{a,b}$ is the [`shortest_geodesic`](https://juliamanifolds.github.io/ManifoldsBase.jl/stable/functions/#ManifoldsBase.shortest_geodesic-Tuple{AbstractManifold,%20Any,%20Any}) connecting $a$ and $b$.
where each segment is a cubic Bézier curve, i.e. each point, except ``p_3`` has a first point
within the following segment ``b_i^+``, ``i=0,1,2`` and a last point within the previous
segment, except for ``p_0``, which are denoted by ``b_i^-``, ``i=1,2,3``.
This curve is differentiable by the conditions ``b_i^- = \gamma_{b_i^+,p_i}(2)``, ``i=1,2``,
where ``\gamma_{a,b}`` is the [`shortest_geodesic`](https://juliamanifolds.github.io/ManifoldsBase.jl/stable/functions/#ManifoldsBase.shortest_geodesic-Tuple{AbstractManifold,%20Any,%20Any}) connecting ``a`` and ``b``.
The remaining points are defined as
````math
Expand All @@ -237,7 +237,7 @@ artificial_S2_composite_bezier_curve()
artificial_SPD_image([pts=64, stepsize=1.5])
create an artificial image of symmetric positive definite matrices of size
`pts`$\times$`pts` pixel with a jump of size `stepsize`.
`pts`×`pts` pixel with a jump of size `stepsize`.
This dataset was used in the numerical example of Section 5.2 of [Bačák et al., SIAM J Sci Comput, 2016](@cite BacakBergmannSteidlWeinmann:2016).
"""
Expand Down Expand Up @@ -273,7 +273,7 @@ function artificial_SPD_image2 end
artificial_SPD_image2([pts=64, fraction=.66])
create an artificial image of symmetric positive definite matrices of size
`pts`$\times$`pts` pixel with right hand side `fraction` is moved upwards.
`pts`×`pts` pixel with right hand side `fraction` is moved upwards.
This data set was introduced in the numerical examples of Section of [Bergmann, Presch, Steidl, SIAM J Imag Sci, 2016](@cite BergmannPerschSteidl:2016)
"""
Expand All @@ -282,7 +282,7 @@ artificial_SPD_image2(pts, fraction)
@doc raw"""
artificial_S2_lemniscate(p, t::Float64; a::Float64=π/2)
Generate a point from the signal on the [`Sphere`](https://juliamanifolds.github.io/Manifolds.jl/stable/manifolds/sphere.html) $\mathbb S^2$ by
Generate a point from the signal on the [`Sphere`](https://juliamanifolds.github.io/Manifolds.jl/stable/manifolds/sphere.html) ``\mathbb S^2`` by
creating the [Lemniscate of Bernoulli](https://en.wikipedia.org/wiki/Lemniscate_of_Bernoulli)
in the tangent space of `p` sampled at `t` and use exp` to obtain a point on
the [`Sphere`](https://juliamanifolds.github.io/Manifolds.jl/stable/manifolds/sphere.html).
Expand All @@ -302,7 +302,7 @@ artificial_S2_lemniscate(p, t::Float64, a::Float64=π / 2.0)
@doc raw"""
artificial_S2_lemniscate(p [,pts=128,a=π/2,interval=[0,2π])
Generate a Signal on the [`Sphere`](https://juliamanifolds.github.io/Manifolds.jl/stable/manifolds/sphere.html) $\mathbb S^2$ by creating the
Generate a Signal on the [`Sphere`](https://juliamanifolds.github.io/Manifolds.jl/stable/manifolds/sphere.html) ``\mathbb S^2`` by creating the
[Lemniscate of Bernoulli](https://en.wikipedia.org/wiki/Lemniscate_of_Bernoulli)
in the tangent space of `p` sampled at `pts` points and use `exp` to get a
signal on the [`Sphere`](https://juliamanifolds.github.io/Manifolds.jl/stable/manifolds/sphere.html).
Expand Down
2 changes: 1 addition & 1 deletion tutorials/HowToRecord.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ mutable struct RecordCount <: RecordAction
end
function (r::RecordCount)(p::AbstractManoptProblem, ::AbstractManoptSolverState, i)
if i > 0
push!(r.recorded_values, get_cost_function(get_objective(p)).count)
push!(r.recorded_values, Manopt.get_cost_function(get_objective(p)).count)
elseif i < 0 # reset if negative
r.recorded_values = Vector{Int}()
end
Expand Down

0 comments on commit b135acf

Please sign in to comment.