Skip to content

Commit 1b25548

Browse files
ericphansonodow
andauthored
update to Documenter v1 (#657)
* update to Documenter v1 * fix * try to appease vale * Update docs/make.jl --------- Co-authored-by: Oscar Dowson <[email protected]>
1 parent 68e9efc commit 1b25548

File tree

11 files changed

+72
-65
lines changed

11 files changed

+72
-65
lines changed

docs/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
2323
[compat]
2424
DataFrames = "1"
2525
Distributions = "0.25"
26-
Documenter = "0.27"
26+
Documenter = "1"
2727
Dualization = "0.5.8"
2828
ECOS = "1"
2929
GLPK = "1"

docs/make.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ function _literate_directory(dir)
3030
# `include` the file to test it before `#src` lines are removed. It is
3131
# in a testset to isolate local variables between files.
3232
Test.@testset "$(filename)" begin
33+
# we can't use just `mod = Module()`
34+
# as some examples use `include`.
35+
# TODO- remove `include`'s from examples
3336
mod = @eval module $(gensym()) end
3437
Base.include(mod, filename)
3538
end
@@ -84,20 +87,19 @@ open(joinpath(@__DIR__, "src", "changelog.md"), "r") do in_io
8487
end
8588

8689
# ==============================================================================
87-
# Build annd release
90+
# Build and release
8891
# ==============================================================================
8992

9093
Documenter.makedocs(
9194
sitename = "Convex.jl",
92-
repo = "https://github.com/jump-dev/Convex.jl/blob/{commit}{path}#L{line}",
9395
# TODO(odow): uncomment this once all docstrings are in the manual
9496
# modules = [Convex],
9597
format = Documenter.HTML(;
9698
ansicolor = true,
9799
collapselevel = 1,
98100
prettyurls = get(ENV, "CI", nothing) == "true",
99101
),
100-
strict = true,
102+
warnonly = [:cross_references],
101103
pages = [
102104
"Introduction" => [
103105
"Home" => "index.md",

docs/src/examples/general_examples/basic_usage.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ using SCS
66

77
# ### Linear program
88
#
9-
# $$
9+
# ```math
1010
# \begin{array}{ll}
1111
# \text{maximize} & c^T x \\
1212
# \text{subject to} & A x \leq b\\
@@ -15,7 +15,7 @@ using SCS
1515
# & x_2 \leq 5 \\
1616
# & x_1 + x_4 - x_2 \leq 10 \\
1717
# \end{array}
18-
# $$
18+
# ```
1919
#
2020

2121
x = Variable(4)
@@ -33,15 +33,15 @@ println(evaluate(x[1] + x[4] - x[2]))
3333

3434
# ### Matrix Variables and promotions
3535
#
36-
# $$
36+
# ```math
3737
# \begin{array}{ll}
3838
# \text{minimize} & \| X \|_F + y \\
3939
# \text{subject to} & 2 X \leq 1\\
4040
# & X' + y \geq 1 \\
4141
# & X \geq 0 \\
4242
# & y \geq 0 \\
4343
# \end{array}
44-
# $$
44+
# ```
4545
#
4646

4747
X = Variable(2, 2)
@@ -55,14 +55,14 @@ p.optval
5555

5656
# ### Norm, exponential and geometric mean
5757
#
58-
# $$
58+
# ```math
5959
# \begin{array}{ll}
6060
# \text{satisfy} & \| x \|_2 \leq 100 \\
6161
# & e^{x_1} \leq 5 \\
6262
# & x_2 \geq 7 \\
6363
# & \sqrt{x_3 x_4} \geq x_2
6464
# \end{array}
65-
# $$
65+
# ```
6666
#
6767

6868
x = Variable(4)

docs/src/examples/general_examples/control.jl

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
# denotes the input into the system over time. Linear constraints are used to
88
# capture the evolution of the system over time:
99
#
10-
# $$
10+
# ```math
1111
# x(t) = Ax(t - 1) + Bu(t), \ \text{for} \ t = 1,\ldots, T,
12-
# $$
12+
# ```
1313
#
1414
# where the numerical matrices $A$ and $B$ are called the dynamics and input matrices,
1515
# respectively.
@@ -30,7 +30,9 @@
3030
# have physical meaning, so we often want to find a sequence inputs that also
3131
# minimizes a least squares objective like the following:
3232
#
33-
# $$\sum_{t = 0}^T \|Fx(t)\|^2_2 + \sum_{t = 1}^T\|Gu(t)\|^2_2,$$
33+
# ```math
34+
# \sum_{t = 0}^T \|Fx(t)\|^2_2 + \sum_{t = 1}^T\|Gu(t)\|^2_2,
35+
# ```
3436
#
3537
# where $F$ and $G$ are numerical matrices.
3638
#
@@ -42,12 +44,12 @@
4244
# By the basic laws of physics, the relationship between force, velocity, and position
4345
# must satisfy:
4446
#
45-
# $$
47+
# ```math
4648
# \begin{aligned}
4749
# p(t+1) &= p(t) + h v(t) \\
4850
# v(t+1) &= v(t) + h a(t)
4951
# \end{aligned}.
50-
# $$
52+
# ```
5153
#
5254
# Here, $a(t)$ denotes the acceleration at time $t$, for which we use
5355
# $a(t) = f(t) / m + g - d v(t)$,
@@ -56,20 +58,20 @@
5658
#
5759
# Additionally, we have our initial/final position/velocity conditions:
5860
#
59-
# $$
61+
# ```math
6062
# \begin{aligned}
6163
# p(1) &= p_i\\
6264
# v(1) &= v_i\\
6365
# p(T+1) &= p_f\\
6466
# v(T+1) &= 0
6567
# \end{aligned}
66-
# $$
68+
# ```
6769
#
6870
# One reasonable objective to minimize would be
6971
#
70-
# $$
72+
# ```math
7173
# \text{objective} = \mu \sum_{t = 1}^{T+1} (v(t))^2 + \sum_{t = 1}^T (f(t))^2
72-
# $$
74+
# ```
7375
#
7476
# We would like to keep both the forces small to perhaps save fuel, and keep
7577
# the velocities small for safety concerns.

docs/src/examples/mixed_integer/binary_knapsack.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
#
44
# This can be formulated as a mixed-integer program as:
55
#
6-
# $$
6+
# ```math
77
# \begin{array}{ll}
88
# \text{maximize} & x' p \\
99
# \text{subject to} & x \in \{0, 1\} \\
1010
# & w' x \leq C \\
1111
# \end{array}
12-
# $$
12+
# ```
1313
#
1414
# where $x$ is a vector is size $n$ where $x_i$ is one if we chose to keep the object in the knapsack, 0 otherwise.
1515

docs/src/examples/optimization_with_complex_variables/Fidelity in Quantum Information Theory.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@
33
#
44
# The Fidelity between two Hermitian semidefinite matrices P and Q is defined as:
55
#
6-
# $$
6+
# ```math
77
# F(P, Q) = \|P^{1/2}Q^{1/2}\|_{\text{tr}} = \max_U \mathrm{tr}(P^{1/2}U Q^{1/2})
8-
# $$
8+
# ```
99
#
1010
# where the trace norm $\|\cdot\|_{\text{tr}}$ is the sum of the singular values, and the maximization goes over the set of all unitary matrices U. This quantity can be expressed as the optimal value of the following complex-valued SDP:
1111
#
12-
# $$
12+
# ```math
1313
# \begin{array}{ll}
1414
# \text{maximize} & \frac{1}{2}\text{tr}(Z+Z^\dagger) \\
1515
# \text{subject to} &\\
1616
# & \left[\begin{array}{cc}P&Z\\{Z}^{\dagger}&Q\end{array}\right] \succeq 0\\
1717
# & Z \in \mathbf {C}^{n \times n}\\
1818
# \end{array}
19-
# $$
19+
# ```
2020
#
2121

2222
using Convex, SCS, LinearAlgebra

docs/src/examples/optimization_with_complex_variables/phase_recovery_using_MaxCut.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
#
1717
# The original representation of the problem is as follows:
1818
#
19-
# $$
19+
# ```math
2020
# \begin{array}{ll}
2121
# \text{find} & x \in \mathbb{C}^p \\
2222
# \text{subject to} & |Ax| = b
2323
# \end{array}
24-
# $$
24+
# ```
2525
#
2626
# where $A \in \mathbb{C}^{n \times p}$ and $b \in \mathbb{R}^n$.
2727

@@ -38,13 +38,13 @@
3838
# Define the positive semidefinite hermitian matrix
3939
# $M = \text{diag}(b) (I - A A^*) \text{diag}(b)$. The problem is:
4040
#
41-
# $$
41+
# ```math
4242
# \begin{array}{ll}
4343
# \text{minimize} & \langle U, M \rangle \\
4444
# \text{subject to} & \text{diag}(U) = 1\\
4545
# & U \succeq 0
4646
# \end{array}
47-
# $$
47+
# ```
4848
#
4949
# Here the variable $U$ must be hermitian ($U \in \mathbb{H}_n $),
5050
# and we have a solution to the phase recovery problem if $U = u u^*$

docs/src/examples/optimization_with_complex_variables/povm_simulation.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# # POVM simulation
22
# This notebook shows how we can check how much depolarizing noise a qubit positive operator-valued measure (POVM) can take before it becomes simulable by projective measurements. The general method is described in [arXiv:1609.06139](https://arxiv.org/abs/1609.06139). The question of simulability by projective measurements boils down to an SDP problem. Eq. (8) from the paper defines the noisy POVM that we obtain subjecting a POVM $\mathbf{M}$ to a depolarizing channel $\Phi_t$:
33
#
4-
# $$\left[\Phi_t\left(\mathbf{M}\right)\right]_i := t M_i + (1-t)\frac{\mathrm{tr}(M_i)}{d} \mathbb{1}.$$
4+
# ```math
5+
# \left[\Phi_t\left(\mathbf{M}\right)\right]_i := t M_i + (1-t)\frac{\mathrm{tr}(M_i)}{d} \mathbb{1}.
6+
# ```
57
#
68
# If this visibility $t\in[0,1]$ is one, the POVM $\mathbf{M}$ is simulable.
79
#

docs/src/examples/supplemental_material/Convex.jl_intro_ISMP2015.jl

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,34 +16,34 @@
1616
# * [CVXPY](https://github.com/cvxgrp/cvxpy): Steven Diamond, Eric Chu, Stephen Boyd
1717
# * [JuliaOpt](https://github.com/JuliaOpt): Miles Lubin, Iain Dunning, Joey Huchette
1818

19-
## initial package installation
19+
# initial package installation
2020

2121
#-
2222

23-
## Make the Convex.jl module available
23+
# Make the Convex.jl module available
2424
using Convex, SparseArrays, LinearAlgebra
2525
using SCS # first order splitting conic solver [O'Donoghue et al., 2014]
2626

27-
## Generate random problem data
27+
# Generate random problem data
2828
m = 50;
2929
n = 100;
3030
A = randn(m, n)
3131
x♮ = sprand(n, 1, 0.5) # true (sparse nonnegative) parameter vector
3232
noise = 0.1 * randn(m) # gaussian noise
3333
b = A * x♮ + noise # noisy linear observations
3434

35-
## Create a (column vector) variable of size n.
35+
# Create a (column vector) variable of size n.
3636
x = Variable(n)
3737

38-
## nonnegative elastic net with regularization
38+
# nonnegative elastic net with regularization
3939
λ = 1
4040
μ = 1
4141
problem = minimize(
4242
square(norm(A * x - b)) + λ * square(norm(x)) + μ * norm(x, 1),
4343
x >= 0,
4444
)
4545

46-
## Solve the problem by calling solve!
46+
# Solve the problem by calling `solve!`
4747
solve!(problem, SCS.Optimizer; silent_solver = true)
4848

4949
println("problem status is ", problem.status) # :Optimal, :Infeasible, :Unbounded etc.
@@ -62,24 +62,25 @@ using Interact, Plots
6262
solve!(problem, SCS.Optimizer; silent_solver = true)
6363
histogram(evaluate(x), xlims = (0, 3.5), label = "x")
6464
end
65+
nothing # hide
6566

6667
# # Quick convex prototyping
6768

6869
#-
6970

7071
# ## Variables
7172

72-
## Scalar variable
73+
# Scalar variable
7374
x = Variable()
7475

7576
#-
7677

77-
## (Column) vector variable
78+
# (Column) vector variable
7879
y = Variable(4)
7980

8081
#-
8182

82-
## Matrix variable
83+
# Matrix variable
8384
Z = Variable(4, 4)
8485

8586
# # Expressions
@@ -132,7 +133,7 @@ p = minimize(objective, constraint)
132133

133134
#-
134135

135-
## solve the problem
136+
# Solve the problem:
136137
solve!(p, SCS.Optimizer; silent_solver = true)
137138
p.status
138139

@@ -142,7 +143,7 @@ evaluate(x)
142143

143144
#-
144145

145-
## can evaluate expressions directly
146+
# Can evaluate expressions directly:
146147
evaluate(objective)
147148

148149
# ## Pass to solver
@@ -163,18 +164,18 @@ evaluate(objective)
163164

164165
# ## Warmstart
165166

166-
## Generate random problem data
167+
# Generate random problem data:
167168
m = 50;
168169
n = 100;
169170
A = randn(m, n)
170171
x♮ = sprand(n, 1, 0.5) # true (sparse nonnegative) parameter vector
171172
noise = 0.1 * randn(m) # gaussian noise
172173
b = A * x♮ + noise # noisy linear observations
173174

174-
## Create a (column vector) variable of size n.
175+
# Create a (column vector) variable of size n.
175176
x = Variable(n)
176177

177-
## nonnegative elastic net with regularization
178+
# nonnegative elastic net with regularization
178179
λ = 1
179180
μ = 1
180181
problem = minimize(
@@ -187,7 +188,7 @@ problem = minimize(
187188

188189
# # DCP examples
189190

190-
## affine
191+
# - affine
191192
x = Variable(4)
192193
y = Variable(2)
193194
sum(x) + y[2]
@@ -196,22 +197,14 @@ sum(x) + y[2]
196197

197198
2 * maximum(x) + 4 * sum(y) - sqrt(y[1] + x[1]) - 7 * minimum(x[2:4])
198199

199-
#-
200-
201-
## not dcp compliant
200+
# - not DCP compliant
202201
log(x) + square(x)
203202

204-
#-
205-
206-
## $f$ is convex increasing and $g$ is convex
203+
# - Composition $f\circ g$ where $f$ is convex increasing and $g$ is convex
207204
square(pos(x))
208205

209-
#-
210-
211-
## $f$ is convex decreasing and $g$ is concave
206+
# - Composition $f\circ g$ where $f$ is convex decreasing and $g$ is concave
212207
invpos(sqrt(x))
213208

214-
#-
215-
216-
## $f$ is concave increasing and $g$ is concave
209+
# - Composition $f\circ g$ where $f$ is concave increasing and $g$ is concave
217210
sqrt(sqrt(x))

0 commit comments

Comments
 (0)