Algorithm Search⌘K

Algorithmcore

Landweber iteration

Also called Landweber method.

Iterate x_{k+1} = x_k + omega A* (y - A x_k), a gradient descent on the residual whose iteration count acts as the regularization parameter.

Time
O(k (a + m + n)) totalO(k m n) denseO(a + m + n) per_iteration
Space
O(m + n) extra
Where
a = the cost of one product with A plus one product with A*; k = the number of iterations; m = the number of data values; n = the number of unknowns
Properties
deterministiciterativelinear in datamatrix free
Origin
Louis Landweber, 1951

The Landweber iteration solves an ill-posed linear equation Ax=yA x = y from noisy data yδy^\delta with ∥yδ−y∥≤δ\|y^\delta - y\| \le \delta. It starts at x0=0x_0 = 0 and repeats the step xk+1=xk+ωA∗(yδ−Axk)x_{k+1} = x_k + \omega A^*(y^\delta - A x_k) with a fixed step 0<ω<2/∥A∥20 < \omega < 2/\|A\|^2. Each step is one step of gradient descent on 12∥Ax−yδ∥2\frac12\|A x - y^\delta\|^2, and costs one product with AA and one with the adjoint A∗A^*. Run to the end, the iteration converges to the least squares solution of the noisy data, which is useless when AA is ill-conditioned. Stopped early, it is a regularization method: the iteration count kk plays the role of the parameter 1/α1/\alpha of Tikhonov regularization. The usual stopping rule is the discrepancy principle, which stops at the first kk with ∥yδ−Axk∥≤τδ\|y^\delta - A x_k\| \le \tau\delta.

In plain words

The method guesses an answer, predicts the data from the guess, and moves the guess a small step in the direction that reduces the misfit. The first steps fix the large, well-measured features of the answer. Later steps fix finer and finer features, and these are exactly the features where the measurement noise is strongest. So the guess first gets better and then gets worse, as it starts to fit the noise. The method is stopped when the misfit is about as large as the noise. The number of steps is then the only tuning knob, and each step is cheap: it needs one simulation of the measurement and one of its reverse.

The problem

Given a bounded linear operator A:X→YA: X \to Y between Hilbert spaces (an m×nm \times n matrix in the discrete setting), its adjoint A∗A^*, data yδy^\delta with ∥yδ−y∥≤δ\|y^\delta - y\| \le \delta for exact data y=Ax†y = A x^\dagger, and the noise level δ\delta, find an approximation of the minimum norm solution x†=A†yx^\dagger = A^\dagger y (see pseudoinverse) whose error tends to 00 as δ→0\delta \to 0. The operator is only needed as two functions, x↦Axx \mapsto A x and r↦A∗rr \mapsto A^* r.

The algorithm

  1. LANDWEBER(A, y, ω, K, δ, τ) ▷ 0 < ω < 2 / ‖A‖², τ > 1
  2. 1x ← 0
  3. 2for k ← 0 to K - 1 do
  4. 3r ← y - A x
  5. 4if ‖r‖ ≤ τ δ then return (x, k)
  6. 5x ← x + ω A* r
  7. 6return (x, K)

Line L1 starts at zero; a start x0≠0x_0 \ne 0 makes the method converge to the solution nearest to x0x_0 instead. Line L3 computes the residual of the current iterate. Line L4 is the discrepancy principle: it returns the first iterate whose residual is at the noise level. Without a noise level the test is left out, and KK must be chosen in another way. Line L5 moves xx along A∗rA^* r, which is minus the gradient of 12∥Ax−y∥2\frac12\|A x - y\|^2. Line L6 returns after KK steps if the test never passed. The code also has a version for a dense matrix with the default step ω=1/∥A∥F2\omega = 1/\|A\|_F^2, which is safe because ∥A∥≤∥A∥F\|A\| \le \|A\|_F.

In terms of the singular system (σj;vj,uj)(\sigma_j; v_j, u_j) of AA, the iterate is a filtered expansion (see spectral filter factors):

xk=∑j(1−(1−ωσj2)k)⟨uj,yδ⟩σjvj.x_k = \sum_j \big(1 - (1 - \omega\sigma_j^2)^k\big) \frac{\langle u_j, y^\delta\rangle}{\sigma_j} v_j.

The filter factor is near 11 for components with ωσj2k≫1\omega\sigma_j^2 k \gg 1 and near ωσj2k\omega\sigma_j^2 k for the others. So kk acts like 1/(ωα)1/(\omega\alpha) in Tikhonov regularization, where the filter is σ2/(σ2+α)\sigma^2/(\sigma^2 + \alpha).

Example

A trace. Take A=diag(1,0.1)A = \mathrm{diag}(1, 0.1), x†=(1,1)x^\dagger = (1, 1), so y=(1,0.1)y = (1, 0.1), and the noise e=(0,0.01)e = (0, 0.01), so yδ=(1,0.11)y^\delta = (1, 0.11) and δ=0.01\delta = 0.01. With ω=1\omega = 1 the first component is exact after one step, and the second is xk,2=1.1 (1−0.99k)x_{k,2} = 1.1\,(1 - 0.99^k). The discrepancy test uses τ=1.5\tau = 1.5, so τδ=0.015\tau\delta = 0.015.

kk xkx_k ∥xk−x†∥\|x_k - x^\dagger\| ∥yδ−Axk∥\|y^\delta - A x_k\| L4 stops?
0 (0,0)(0, 0) 1.41421 1.00603 no
1 (1,0.01100)(1, 0.01100) 0.98900 0.10890 no
2 (1,0.02189)(1, 0.02189) 0.97811 0.10781 no
3 (1,0.03267)(1, 0.03267) 0.96733 0.10673 no
10 (1,0.10518)(1, 0.10518) 0.89482 0.09948 no
100 (1,0.69736)(1, 0.69736) 0.30264 0.04026 no
199 (1,0.95113)(1, 0.95113) 0.04887 0.01489 yes
1000 (1,1.09995)(1, 1.09995) 0.09995 0.00001
∞\infty (1,1.1)(1, 1.1) 0.1 0

At k=100k = 100 the filter factor of the second component is 1−0.99100=0.633971 - 0.99^{100} = 0.63397. Line L4 returns k=199k = 199, because the residual at k=198k = 198 is 0.11⋅0.99198=0.01504>0.0150.11 \cdot 0.99^{198} = 0.01504 > 0.015. Here the noise has the same sign as the signal, so the error has its minimum 0.00040.0004 near k=239k = 239; in general the minimum is not known, and the discrepancy rule only guarantees the rate below.

Rates on an integral operator. For (Ax)(s)=∫0sx(t) dt(A x)(s) = \int_0^s x(t)\,dt on L2(0,1)L^2(0, 1) the singular values are σj=2/((2j−1)π)\sigma_j = 2/((2j - 1)\pi). The solution x†(t)=1−t=A∗1x^\dagger(t) = 1 - t = A^* 1 satisfies the source condition with ν=12\nu = \frac12 and ρ=1\rho = 1. The test of the code uses the first 200 singular components, ω=1/σ12\omega = 1/\sigma_1^2, k=⌈1/δ⌉k = \lceil 1/\delta \rceil, and puts the noise of size δ\delta on the component that step kk amplifies most (a measurement):

δ\delta kk ∥xkδ−x†∥\|x_k^\delta - x^\dagger\| bound of Theorem 3
10−210^{-2} 100 0.0986 0.202
10−310^{-3} 1000 0.0315 0.0639
10−410^{-4} 10000 0.0100 0.0202

The slopes of log⁡\log error against log⁡δ\log\delta are 0.4960.496 and 0.4980.498; the theory gives 2ν/(2ν+1)=0.52\nu/(2\nu + 1) = 0.5. With the discrepancy rule and τ=1.5\tau = 1.5 instead, the same problem stopped at k=3k = 3, 3232 and 205205 with errors 0.05090.0509, 0.01170.0117 and 0.002970.00297 (a measurement).

Correctness

The proofs are in proofs/correctness.md, in exact arithmetic, with x0=0x_0 = 0.

  • Filter form (theorem). By induction on kk, xkx_k is the filtered expansion above. The key step is that A∗A^* maps the part of yy outside the range of AA to 00.
  • Exact data (theorem). xk→x†x_k \to x^\dagger when yy is in the domain of A†A^\dagger, because ∣1−ωσ2∣<1|1 - \omega\sigma^2| < 1 for 0<σ≤∥A∥0 < \sigma \le \|A\|.
  • Monotone residual (theorem). ∥y−Axk+1∥≤∥y−Axk∥\|y - A x_{k+1}\| \le \|y - A x_k\| for any data.
  • Error bound (theorem). For ω∥A∥2≤1\omega\|A\|^2 \le 1, the data error is at most ωk δ\sqrt{\omega k}\,\delta. Under the source condition x†=(A∗A)νwx^\dagger = (A^* A)^\nu w, ∥w∥≤ρ\|w\| \le \rho, the total error is at most (ν/(ωk))νρ+ωk δ(\nu/(\omega k))^\nu\rho + \sqrt{\omega k}\,\delta. The choice ωk=(ρ/δ)2/(2ν+1)\omega k = (\rho/\delta)^{2/(2\nu+1)} gives O(ρ1/(2ν+1)δ2ν/(2ν+1))O(\rho^{1/(2\nu+1)}\delta^{2\nu/(2\nu+1)}) for every ν>0\nu > 0, which is the best possible worst-case rate.
  • Termination (theorem). If yy is in the range of AA and τ>1\tau > 1, line L4 passes after finitely many steps.

That the discrepancy principle also gives the rate O(δ2ν/(2ν+1))O(\delta^{2\nu/(2\nu+1)}) for every ν>0\nu > 0 is a theorem of Engl, Hanke and Neubauer (Chapter 6); it is cited, not proved here.

Proof: Correctness of the Landweber iterationfull

Exact arithmetic. A:X→YA: X \to Y is a bounded linear operator between Hilbert spaces with a singular system (σj;vj,uj)(\sigma_j; v_j, u_j); for a matrix this is the SVD, with the sums finite. The start is x0=0x_0 = 0 (line L1), the step is ω\omega with 0<ω<2/∥A∥20 < \omega < 2/\|A\|^2, and xk+1=xk+ωA∗(y−Axk)x_{k+1} = x_k + \omega A^*(y - A x_k) (lines L3 and L5). PP is the orthogonal projection onto the closure of the range of AA, and x†=A†yx^\dagger = A^\dagger y for yy in the domain of A†A^\dagger.

Lemma 1 (filter form). For every k≥0k \ge 0,

xk=∑jfk(σj)⟨uj,y⟩σjvj,fk(σ)=1−(1−ωσ2)k,x_k = \sum_j f_k(\sigma_j) \frac{\langle u_j, y\rangle}{\sigma_j} v_j, \qquad f_k(\sigma) = 1 - (1 - \omega\sigma^2)^k,

and y−Axk=∑j(1−ωσj2)k⟨uj,y⟩uj+(I−P)yy - A x_k = \sum_j (1 - \omega\sigma_j^2)^k \langle u_j, y\rangle u_j + (I - P) y.

Proof. Induction on kk. Base: f0=0f_0 = 0, so the formula gives x0=0x_0 = 0. Step: assume the formula for xkx_k. Then y−Axk=(I−P)y+∑j(1−fk(σj))⟨uj,y⟩ujy - A x_k = (I - P) y + \sum_j (1 - f_k(\sigma_j)) \langle u_j, y\rangle u_j, since Py=∑j⟨uj,y⟩ujP y = \sum_j \langle u_j, y\rangle u_j and Avj=σjujA v_j = \sigma_j u_j. Apply A∗A^*: A∗(I−P)y=0A^*(I - P) y = 0 because (I−P)y(I - P)y is orthogonal to the range of AA, and A∗uj=σjvjA^* u_j = \sigma_j v_j. So

xk+1=∑j[fk(σj)+ωσj2(1−fk(σj))]⟨uj,y⟩σjvj.x_{k+1} = \sum_j \Big[ f_k(\sigma_j) + \omega\sigma_j^2 (1 - f_k(\sigma_j)) \Big] \frac{\langle u_j, y\rangle}{\sigma_j} v_j.

With 1−fk=(1−ωσ2)k1 - f_k = (1 - \omega\sigma^2)^k, the bracket is 1−(1−ωσ2)k(1−ωσ2)=fk+1(σ)1 - (1 - \omega\sigma^2)^k (1 - \omega\sigma^2) = f_{k+1}(\sigma). The residual formula follows from the same computation with k+1k + 1 in place of kk. □\square

Lemma 2 (bounds on the filter). Let q(σ)=1−ωσ2q(\sigma) = 1 - \omega\sigma^2. For 0<σ≤∥A∥0 < \sigma \le \|A\|: (a) ∣q(σ)∣<1|q(\sigma)| < 1; (b) if ω∥A∥2≤1\omega\|A\|^2 \le 1, then 0≤fk(σ)≤10 \le f_k(\sigma) \le 1 and fk(σ)/σ≤ωkf_k(\sigma)/\sigma \le \sqrt{\omega k}; (c) if ω∥A∥2≤1\omega\|A\|^2 \le 1 and ν>0\nu > 0, then (1−fk(σ)) σ2ν≤(ν/(ωk))ν(1 - f_k(\sigma))\, \sigma^{2\nu} \le (\nu/(\omega k))^\nu for k≥1k \ge 1.

Proof. (a) 0<ωσ2≤ω∥A∥2<20 < \omega\sigma^2 \le \omega\|A\|^2 < 2, so −1<q<1-1 < q < 1. (b) Put t=ωσ2∈(0,1]t = \omega\sigma^2 \in (0, 1]. Then (1−t)k∈[0,1)(1 - t)^k \in [0, 1), so 0≤fk≤10 \le f_k \le 1. Bernoulli's inequality (1−t)k≥1−kt(1 - t)^k \ge 1 - k t gives fk≤ktf_k \le k t. Hence fk≤min⁡(1,kt)≤ktf_k \le \min(1, k t) \le \sqrt{k t}, and fk/σ≤kt/σ=ωkf_k/\sigma \le \sqrt{k t}/\sigma = \sqrt{\omega k}. (c) (1−t)kσ2ν=ω−ν(1−t)ktν(1 - t)^k \sigma^{2\nu} = \omega^{-\nu} (1 - t)^k t^\nu. On [0,1][0, 1] the function g(t)=(1−t)ktνg(t) = (1 - t)^k t^\nu has its maximum where g′(t)=0g'(t) = 0, that is at t∗=ν/(ν+k)t^* = \nu/(\nu + k), with g(t∗)=(k/(ν+k))k(ν/(ν+k))ν≤(ν/k)νg(t^*) = (k/(\nu + k))^k (\nu/(\nu + k))^\nu \le (\nu/k)^\nu. □\square

Theorem 1 (exact data). If yy is in the domain of A†A^\dagger, then xk→x†x_k \to x^\dagger as k→∞k \to \infty.

Proof. By Lemma 1 and the Picard expansion x†=∑j⟨uj,y⟩σj−1vjx^\dagger = \sum_j \langle u_j, y\rangle \sigma_j^{-1} v_j, the error is x†−xk=∑jq(σj)k⟨vj,x†⟩vjx^\dagger - x_k = \sum_j q(\sigma_j)^k \langle v_j, x^\dagger\rangle v_j, so ∥x†−xk∥2=∑jq(σj)2k∣⟨vj,x†⟩∣2\|x^\dagger - x_k\|^2 = \sum_j q(\sigma_j)^{2k} |\langle v_j, x^\dagger\rangle|^2. Each term tends to 00 by Lemma 2(a) and is bounded by ∣⟨vj,x†⟩∣2|\langle v_j, x^\dagger\rangle|^2, a summable sequence. By dominated convergence the sum tends to 00. □\square

Theorem 2 (the residual does not increase). ∥y−Axk+1∥≤∥y−Axk∥\|y - A x_{k+1}\| \le \|y - A x_k\| for every kk and every y∈Yy \in Y.

Proof. By Lemma 1, ∥y−Axk∥2=∑jq(σj)2k∣⟨uj,y⟩∣2+∥(I−P)y∥2\|y - A x_k\|^2 = \sum_j q(\sigma_j)^{2k} |\langle u_j, y\rangle|^2 + \|(I - P)y\|^2, and q(σj)2(k+1)≤q(σj)2kq(\sigma_j)^{2(k+1)} \le q(\sigma_j)^{2k} by Lemma 2(a). □\square

Theorem 3 (error bound). Let ω∥A∥2≤1\omega\|A\|^2 \le 1, let ∥yδ−y∥≤δ\|y^\delta - y\| \le \delta with y=Ax†y = A x^\dagger, and let xkx_k and xkδx_k^\delta be the iterates for yy and yδy^\delta. Then ∥xkδ−xk∥≤ωk δ\|x_k^\delta - x_k\| \le \sqrt{\omega k}\,\delta. If also x†=(A∗A)νwx^\dagger = (A^* A)^\nu w with ∥w∥≤ρ\|w\| \le \rho and ν>0\nu > 0, then for k≥1k \ge 1

∥xkδ−x†∥≤(νωk)νρ+ωk δ.\|x_k^\delta - x^\dagger\| \le \Big(\frac{\nu}{\omega k}\Big)^\nu \rho + \sqrt{\omega k}\,\delta.

Proof. The iterate is linear in the data, so xkδ−xk=∑jfk(σj)σj−1⟨uj,yδ−y⟩vjx_k^\delta - x_k = \sum_j f_k(\sigma_j) \sigma_j^{-1} \langle u_j, y^\delta - y\rangle v_j. By Lemma 2(b) each coefficient is multiplied by at most ωk\sqrt{\omega k}, and by Bessel's inequality ∥xkδ−xk∥≤ωk ∥yδ−y∥\|x_k^\delta - x_k\| \le \sqrt{\omega k}\, \|y^\delta - y\|. For the second part, ⟨vj,x†⟩=σj2ν⟨vj,w⟩\langle v_j, x^\dagger\rangle = \sigma_j^{2\nu} \langle v_j, w\rangle, so by the proof of Theorem 1 and Lemma 2(c), ∥x†−xk∥2=∑j(q(σj)kσj2ν)2∣⟨vj,w⟩∣2≤(ν/(ωk))2νρ2\|x^\dagger - x_k\|^2 = \sum_j \big(q(\sigma_j)^k \sigma_j^{2\nu}\big)^2 |\langle v_j, w\rangle|^2 \le (\nu/(\omega k))^{2\nu} \rho^2. The triangle inequality adds the two parts. □\square

Corollary (a priori rate). With ωk=(ρ/δ)2/(2ν+1)\omega k = (\rho/\delta)^{2/(2\nu+1)} (rounded up to an integer kk), Theorem 3 gives ∥xkδ−x†∥≤(νν+1+o(1)) ρ1/(2ν+1)δ2ν/(2ν+1)\|x_k^\delta - x^\dagger\| \le (\nu^\nu + 1 + o(1))\, \rho^{1/(2\nu+1)} \delta^{2\nu/(2\nu+1)} as δ→0\delta \to 0. Substitute: (ν/(ωk))νρ=ννρ1/(2ν+1)δ2ν/(2ν+1)(\nu/(\omega k))^\nu \rho = \nu^\nu \rho^{1/(2\nu+1)} \delta^{2\nu/(2\nu+1)} and ωk δ=ρ1/(2ν+1)δ2ν/(2ν+1)\sqrt{\omega k}\,\delta = \rho^{1/(2\nu+1)} \delta^{2\nu/(2\nu+1)}; the rounding of kk changes the second term by a factor 1+1/k→1\sqrt{1 + 1/k} \to 1. □\square

Theorem 4 (termination of the discrepancy rule). Let y=Ax†y = A x^\dagger, ∥yδ−y∥≤δ\|y^\delta - y\| \le \delta and τ>1\tau > 1. Then the loop L2 to L5 with the test of line L4 stops after finitely many steps (for KK large enough), and the returned xkx_k satisfies ∥yδ−Axk∥≤τδ\|y^\delta - A x_k\| \le \tau\delta, while every earlier iterate has a residual above τδ\tau\delta.

Proof. By Lemma 1 for the data yδy^\delta, ∥yδ−Axk∥2=∑jq(σj)2k∣⟨uj,yδ⟩∣2+∥(I−P)yδ∥2\|y^\delta - A x_k\|^2 = \sum_j q(\sigma_j)^{2k} |\langle u_j, y^\delta\rangle|^2 + \|(I - P) y^\delta\|^2. The sum tends to 00 by Lemma 2(a) and dominated convergence, as in Theorem 1. Since yy is in the range of AA, (I−P)yδ=(I−P)(yδ−y)(I - P) y^\delta = (I - P)(y^\delta - y), so ∥(I−P)yδ∥≤δ<τδ\|(I - P) y^\delta\| \le \delta < \tau\delta. So the residual is below τδ\tau\delta for all large kk, and the first such kk exists. Line L4 tests the residual of each iterate in order of kk and returns at the first one that passes, which gives the last two claims. □\square

The order optimality of the discrepancy rule, an error O(δ2ν/(2ν+1))O(\delta^{2\nu/(2\nu+1)}) for every ν>0\nu > 0 with a stopping index k∗=O(δ−2/(2ν+1))k_* = O(\delta^{-2/(2\nu+1)}), is a theorem of Engl, Hanke and Neubauer (Chapter 6). It is not proved here and the code does not rely on it. ■\blacksquare

Complexity

  • Per iteration (real-ram). Line L3 costs one product with AA and mm subtractions, line L4 a norm of length mm, and line L5 one product with A∗A^* and 2n2n operations. That is O(a+m+n)O(a + m + n), where aa is the cost of one product with AA plus one with A∗A^*. For a dense matrix a=O(mn)a = O(m n); for a sparse projector, aa is proportional to the number of nonzeros.
  • Iterations. The count depends on the noise and on the smoothness of x†x^\dagger, not on mm and nn. The a priori choice of the corollary is k=(ρ/δ)2/(2ν+1)/ωk = (\rho/\delta)^{2/(2\nu+1)}/\omega, so kk grows like δ−2/(2ν+1)\delta^{-2/(2\nu+1)}. With the discrepancy principle, the stopping index is also O(δ−2/(2ν+1))O(\delta^{-2/(2\nu+1)}) (EHN Chapter 6). For ν=12\nu = \frac12 this is k∼δ−1k \sim \delta^{-1}, as in the table above.
  • Total. O(k(a+m+n))O(k(a + m + n)) time, and O(m+n)O(m + n) extra space for xx, rr and A∗rA^* r.

CGLS with the discrepancy principle stops after O(δ−1/(2ν+1))O(\delta^{-1/(2\nu+1)}) steps (a theorem, EHN Chapter 7), about the square root of the Landweber count. That square root is why Landweber is rarely the fastest choice.

Properties

  • Infinite qualification. The bias bound (ν/(ωk))νρ(\nu/(\omega k))^\nu\rho (Lemma 2(c) of the proof) holds for every ν>0\nu > 0, so the rate does not saturate, unlike Tikhonov regularization at ν=1\nu = 1 (see qualification of regularization).
  • Linear in the data for a fixed kk. With the discrepancy rule, kk depends on the data and the map is not linear.
  • Monotone residual and, for exact data, a monotone error ∥xk−x†∥\|x_k - x^\dagger\|. With noisy data the error shows semi-convergence: it decreases, then increases.
  • Matrix-free. Only products with AA and A∗A^* are used. No matrix is formed or factored.
  • Smooth filter. Its filter factors are near the Tikhonov factors with α=1/(ωk)\alpha = 1/(\omega k).

Variants and improvements

  • Preconditioned and weighted forms. xk+1=xk+ωMA∗D(y−Axk)x_{k+1} = x_k + \omega M A^* D (y - A x_k) with diagonal weights DD and MM. In tomography this is SIRT, with the row and column sums of the projector as weights.
  • Projected Landweber. Project onto a convex set (for example x≥0x \ge 0) after each step.
  • Accelerated methods. The ν\nu-methods of Brakhage and Hanke and CGLS reach the same accuracy in about the square root of the number of steps (EHN Chapter 6 and 7).
  • Nonlinear Landweber. For y=F(x)y = F(x), use xk+1=xk+ωF′(xk)∗(yδ−F(xk))x_{k+1} = x_k + \omega F'(x_k)^*(y^\delta - F(x_k)) (EHN Chapter 11). The iteratively regularized Gauss-Newton method is a faster alternative.
  • Richardson iteration. The same step on the normal equations A∗Ax=A∗yA^* A x = A^* y is the Richardson iteration; Landweber is that iteration used as a regularization method.

When to use it

Use Landweber when you have only a forward and an adjoint code, want the simplest possible method, and can afford many cheap steps. It is the reference method for the theory of iterative regularization, because its filter is explicit. It is a good choice inside nonlinear methods and with constraints such as nonnegativity, where Krylov methods are harder to use. When speed matters, use CGLS or LSQR: they need far fewer products with AA for the same error. For a small dense problem, truncated SVD or Tikhonov regularization (which writes λ\lambda for α\alpha) with a direct solver is simpler.

Pitfalls

  • Step too large. With ω≥2/∥A∥2\omega \ge 2/\|A\|^2 at line L5, the component of the largest singular value grows and the iteration diverges. Estimate ∥A∥\|A\| by a few steps of the power method on A∗AA^* A, or use ω=1/∥A∥F2\omega = 1/\|A\|_F^2 for a matrix.
  • No stopping rule. Running the loop of line L2 to convergence fits the noise. The error goes up again after the best kk (see the trace). Keep the test of line L4, or choose KK from δ\delta.
  • τ≤1\tau \le 1 at line L4. If the data have a part outside the range of AA, the residual tends to the norm of that part, which can be close to δ\delta, and the test may never pass. Use τ>1\tau > 1, for example 1.11.1 to 22.
  • A wrong adjoint at line L5. If the code for A∗A^* is not the true adjoint of the code for AA, the step is not a gradient step and the theory fails. Check ∣⟨Ax,r⟩−⟨x,A∗r⟩∣|\langle A x, r\rangle - \langle x, A^* r\rangle| on random vectors.
  • Reading the error from the residual. The residual decreases at every step, even when the error has started to increase. A small residual does not mean a small error.

Implementations

Each implementation follows the pseudocode above. A comment @line links a line of code to a line of the pseudocode. Point at a line of the pseudocode to see the matching code. The build runs the native tests of each language.

imgla.pyI0RawGitHub
# SPDX-License-Identifier: MIT
# Shared helper of the imaging and inverse problems pages of https://algorithm.tamnd.com/. The authors are listed in prov/.
"""Dense linear algebra on lists of rows (float, complex or Fraction entries).

A matrix is a list of rows. A vector is a list of numbers. The inner product
is <u, v> = sum_i conj(u_i) v_i, linear in the second argument, so that the
adjoint A^H satisfies <A x, y> = <x, A^H y>.
"""

import math


def _flat(x):
    """Flatten a list of rows (an image) into one list; a vector is returned as is."""
    if x and isinstance(x[0], (list, tuple)):
        return [v for row in x for v in row]
    return x


def zeros(m, n):
    """The m x n zero matrix."""
    return [[0.0] * n for _ in range(m)]


def eye(n):
    """The n x n identity matrix."""
    out = zeros(n, n)
    for i in range(n):
        out[i][i] = 1.0
    return out


def transpose(a):
    """A^T."""
    return [list(col) for col in zip(*a)]


def conj_transpose(a):
    """A^H, the conjugate transpose."""
    return [[v.conjugate() for v in col] for col in zip(*a)]


def matmul(a, b):
    """The product A B."""
    bt = list(zip(*b))
    return [[sum(x * y for x, y in zip(row, col)) for col in bt] for row in a]


def matvec(a, x):
    """The product A x."""
    return [sum(v * w for v, w in zip(row, x)) for row in a]


def rmatvec(a, y):
    """The product A^H y."""
    n = len(a[0]) if a else 0
    out = [0.0] * n
    for row, yi in zip(a, y):
        if yi == 0:
            continue
        for j, v in enumerate(row):
            out[j] += v.conjugate() * yi
    return out


def dot(u, v):
    """<u, v> = sum_i conj(u_i) v_i. Images (lists of rows) are flattened."""
    return sum(a.conjugate() * b for a, b in zip(_flat(u), _flat(v)))


def norm2(x):
    """The Euclidean norm. Images (lists of rows) are flattened."""
    return math.sqrt(sum(abs(v) ** 2 for v in _flat(x)))


def solve(a, b):
    """Solve A x = b by Gaussian elimination with partial pivoting.

    b is a vector or a matrix (a list of rows). A must be square and
    nonsingular; a zero pivot raises ValueError. Fractions stay exact.
    """
    n = len(a)
    vec = not (b and isinstance(b[0], (list, tuple)))
    rhs = [[bi] for bi in b] if vec else [list(r) for r in b]
    m = [list(row) + rhs[i] for i, row in enumerate(a)]
    w = len(m[0])
    for c in range(n):
        p = max(range(c, n), key=lambda r: abs(m[r][c]))
        if m[p][c] == 0:
            raise ValueError("singular matrix")
        m[c], m[p] = m[p], m[c]
        piv = m[c][c]
        for r in range(c + 1, n):
            f = m[r][c] / piv
            if f != 0:
                mr, mc = m[r], m[c]
                for j in range(c, w):
                    mr[j] -= f * mc[j]
    x = [[0.0] * (w - n) for _ in range(n)]
    for r in range(n - 1, -1, -1):
        for j in range(w - n):
            s = m[r][n + j] - sum(m[r][k] * x[k][j] for k in range(r + 1, n))
            x[r][j] = s / m[r][r]
    return [row[0] for row in x] if vec else x


def cholesky(a):
    """Lower triangular L with A = L L^H for a Hermitian positive definite A."""
    n = len(a)
    low = zeros(n, n)
    for j in range(n):
        d = a[j][j] - sum(abs(low[j][k]) ** 2 for k in range(j))
        d = d.real if isinstance(d, complex) else d
        if not d > 0:
            raise ValueError("matrix is not positive definite")
        ljj = math.sqrt(d)
        low[j][j] = ljj
        for i in range(j + 1, n):
            s = a[i][j] - sum(low[i][k] * low[j][k].conjugate() for k in range(j))
            low[i][j] = s / ljj
    return low


def cho_solve(low, b):
    """Solve (L L^H) x = b, with L from cholesky."""
    n = len(low)
    z = [0.0] * n
    for i in range(n):
        z[i] = (b[i] - sum(low[i][k] * z[k] for k in range(i))) / low[i][i]
    x = [0.0] * n
    for i in range(n - 1, -1, -1):
        s = z[i] - sum(low[k][i].conjugate() * x[k] for k in range(i + 1, n))
        x[i] = s / low[i][i].conjugate()
    return x


def _rot_params(app, aqq, apq):
    """c, s of the Jacobi rotation that zeroes the (p, q) entry of [[app, apq], [apq, aqq]]."""
    theta = (aqq - app) / (2.0 * apq)
    t = (1.0 if theta >= 0 else -1.0) / (abs(theta) + math.sqrt(theta * theta + 1.0))
    c = 1.0 / math.sqrt(1.0 + t * t)
    return c, c * t


def sym_eig(a, tol=1e-15, max_sweeps=100):
    """Eigenvalues (ascending) and eigenvectors (as columns) of a real symmetric matrix.

    Cyclic Jacobi method. Returns (w, Q) with A = Q diag(w) Q^T.
    """
    n = len(a)
    m = [[float(v) for v in row] for row in a]
    q = eye(n)
    for _ in range(max_sweeps):
        off = sum(m[i][j] ** 2 for i in range(n) for j in range(n) if i != j)
        scale = sum(m[i][i] ** 2 for i in range(n)) + off
        if off <= (tol * tol) * scale or off == 0.0:
            break
        for p in range(n - 1):
            for r in range(p + 1, n):
                apq = m[p][r]
                if apq == 0.0:
                    continue
                c, s = _rot_params(m[p][p], m[r][r], apq)
                for k in range(n):
                    mkp, mkr = m[k][p], m[k][r]
                    m[k][p] = c * mkp - s * mkr
                    m[k][r] = s * mkp + c * mkr
                mp, mr = m[p], m[r]
                for k in range(n):
                    mpk, mrk = mp[k], mr[k]
                    mp[k] = c * mpk - s * mrk
                    mr[k] = s * mpk + c * mrk
                m[p][r] = m[r][p] = 0.0
                for k in range(n):
                    qkp, qkr = q[k][p], q[k][r]
                    q[k][p] = c * qkp - s * qkr
                    q[k][r] = s * qkp + c * qkr
    order = sorted(range(n), key=lambda i: m[i][i])
    w = [m[i][i] for i in order]
    qs = [[q[k][i] for i in order] for k in range(n)]
    return w, qs


def _complete(cols, m):
    """Replace zero columns of an m-row column list by unit vectors orthogonal to the others."""
    for idx, col in enumerate(cols):
        if any(v != 0.0 for v in col):
            continue
        for e in range(m):
            cand = [0.0] * m
            cand[e] = 1.0
            for _ in range(2):
                for jdx, other in enumerate(cols):
                    if jdx == idx or not any(v != 0.0 for v in other):
                        continue
                    h = sum(a * b for a, b in zip(other, cand))
                    cand = [a - h * b for a, b in zip(cand, other)]
            nrm = math.sqrt(sum(v * v for v in cand))
            if nrm > 0.5:
                cols[idx] = [v / nrm for v in cand]
                break
    return cols


def svd(a, tol=1e-15, max_sweeps=100):
    """Thin SVD of a real m x n matrix by one-sided Jacobi (Hestenes).

    Returns (U, S, V) with p = min(m, n): U is m x p, S a list of p values in
    descending order, V is n x p, U^T U = I, V^T V = I and A = U diag(S) V^T.
    """
    m, n = len(a), len(a[0])
    if m < n:
        v, s, u = svd(transpose(a), tol, max_sweeps)
        return u, s, v
    cols = [[float(a[i][j]) for i in range(m)] for j in range(n)]
    vcols = [[1.0 if i == j else 0.0 for i in range(n)] for j in range(n)]
    for _ in range(max_sweeps):
        rotated = False
        for p in range(n - 1):
            for r in range(p + 1, n):
                cp, cr = cols[p], cols[r]
                alpha = sum(x * x for x in cp)
                beta = sum(x * x for x in cr)
                gamma = sum(x * y for x, y in zip(cp, cr))
                if gamma == 0.0 or abs(gamma) <= tol * math.sqrt(alpha * beta):
                    continue
                rotated = True
                c, s = _rot_params(alpha, beta, gamma)
                cols[p] = [c * x - s * y for x, y in zip(cp, cr)]
                cols[r] = [s * x + c * y for x, y in zip(cp, cr)]
                vp, vr = vcols[p], vcols[r]
                vcols[p] = [c * x - s * y for x, y in zip(vp, vr)]
                vcols[r] = [s * x + c * y for x, y in zip(vp, vr)]
        if not rotated:
            break
    sig = [math.sqrt(sum(x * x for x in col)) for col in cols]
    # A column below 1e-150 times the largest one is zero to working precision;
    # its squares underflow, so its direction carries no information.
    floor = max(sig) * 1e-150 if sig else 0.0
    sig = [t if t > floor and t > 1e-150 else 0.0 for t in sig]
    order = sorted(range(n), key=lambda j: -sig[j])
    s_out = [sig[j] for j in order]
    ucols = [[x / sig[j] for x in cols[j]] if sig[j] > 0.0 else [0.0] * m for j in order]
    ucols = _complete(ucols, m)
    u = [[ucols[j][i] for j in range(n)] for i in range(m)]
    v = [[vcols[j][i] for j in order] for i in range(n)]
    return u, s_out, v


def adjoint_gap(apply_a, apply_ah, x, y):
    """|<A x, y> - <x, A^H y>| / (||A x|| ||y||) for given functions A and A^H.

    x and y may be vectors or images (lists of rows). If the denominator is
    zero, the absolute gap is returned.
    """
    ax = apply_a(x)
    gap = abs(dot(ax, y) - dot(x, apply_ah(y)))
    den = norm2(ax) * norm2(y)
    return gap / den if den > 0.0 else gap
landweber_iteration.py 87 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/landweber-iteration/. The authors are listed in prov/G6JZZF.jsonl.
"""Landweber iteration for a linear equation A x = y with noisy data.

The step is x_{k+1} = x_k + omega A^T (y - A x_k) with 0 < omega < 2 / ||A||^2.
The operator is given as two functions, apply_a(x) = A x and
apply_at(r) = A^T r, so the same code runs on a dense matrix, on a sparse
projector or on a diagonal model. The iteration count k is the
regularization parameter; with a noise level delta the discrepancy
principle stops at the first k with ||y - A x_k|| <= tau delta.
"""

import math
from typing import Callable, List, Optional, Sequence

from imgla import matvec, rmatvec, norm2

Vector = List[float]
Operator = Callable[[Sequence[float]], Vector]


class LandweberResult:
    """x: the last iterate; k: the number of steps done; residuals: ||y - A x_j||
    for j = 0, ..., k; stopped: "discrepancy" or "maxit"."""

    def __init__(self, x: Vector, k: int, residuals: List[float], stopped: str) -> None:
        self.x, self.k, self.residuals, self.stopped = x, k, residuals, stopped


def landweber(apply_a: Operator, apply_at: Operator, y: Sequence[float], omega: float, kmax: int,
              x0: Optional[Sequence[float]] = None, delta: Optional[float] = None,
              tau: float = 1.01, n: Optional[int] = None) -> LandweberResult:
    """Run at most kmax Landweber steps from x0 (default 0).

    Precondition: 0 < omega < 2 / ||A||^2 (not checked here). If delta is
    given, stop at the first k with ||y - A x_k|| <= tau delta. n is the
    number of unknowns; it is needed only when x0 is None.
    Cost: per step one product with A, one with A^T and O(m + n) more.
    """
    if x0 is None:
        x = [0.0] * (n if n is not None else len(apply_at([0.0] * len(y))))  # @line L1
    else:
        x = list(x0)
    residuals = []
    for k in range(kmax):  # @line L2
        ax = apply_a(x)
        r = [yi - v for yi, v in zip(y, ax)]  # @line L3
        rn = norm2(r)
        residuals.append(rn)
        if delta is not None and rn <= tau * delta:  # @line L4
            return LandweberResult(x, k, residuals, "discrepancy")
        g = apply_at(r)
        x = [xi + omega * gi for xi, gi in zip(x, g)]  # @line L5
    r = [yi - v for yi, v in zip(y, apply_a(x))]
    residuals.append(norm2(r))
    if delta is not None and residuals[-1] <= tau * delta:
        return LandweberResult(x, kmax, residuals, "discrepancy")
    return LandweberResult(x, kmax, residuals, "maxit")  # @line L6


def landweber_matrix(a: List[List[float]], y: Sequence[float], omega: Optional[float] = None,
                     kmax: int = 100, x0: Optional[Sequence[float]] = None,
                     delta: Optional[float] = None, tau: float = 1.01) -> LandweberResult:
    """Landweber for a dense matrix A (a list of rows).

    The default step is omega = 1 / ||A||_F^2. The Frobenius norm is at least
    the spectral norm, so this step is always in (0, 2 / ||A||^2).
    Cost: O(m n) per step.
    """
    if omega is None:
        omega = 1.0 / sum(v * v for row in a for v in row)
    return landweber(lambda x: matvec(a, x), lambda r: rmatvec(a, r), y, omega, kmax,
                     x0=x0, delta=delta, tau=tau, n=len(a[0]))


def filter_factor(omega: float, sigma: float, k: int) -> float:
    """The Landweber filter factor 1 - (1 - omega sigma^2)^k (start x0 = 0)."""
    return 1.0 - (1.0 - omega * sigma * sigma) ** k


def error_bound(nu: float, rho: float, omega: float, k: int, delta: float) -> float:
    """The bound (nu / (omega k))^nu rho + sqrt(omega k) delta on ||x_k - x^dagger||.

    It holds for x0 = 0, omega ||A||^2 <= 1, k >= 1, the source condition
    x^dagger = (A^T A)^nu w with ||w|| <= rho, and ||y - y^delta|| <= delta.
    """
    return (nu / (omega * k)) ** nu * rho + math.sqrt(omega * k) * delta
test_landweber_iteration.py 173 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/landweber-iteration/. The authors are listed in prov/G6JZZF.jsonl.
import math
import random
import unittest

from imgla import adjoint_gap, matvec, norm2, rmatvec, svd
from landweber_iteration import error_bound, filter_factor, landweber, landweber_matrix


def rand_matrix(rng, m, n):
    return [[rng.uniform(-1.0, 1.0) for _ in range(n)] for _ in range(m)]


def pinv_solution(a, y):
    """x^dagger = A^dagger y from the SVD (the reference method)."""
    u, s, v = svd(a)
    tol = max(s) * 1e-12
    x = [0.0] * len(a[0])
    for i, si in enumerate(s):
        if si > tol:
            c = sum(u[r][i] * y[r] for r in range(len(y))) / si
            x = [xj + c * v[j][i] for j, xj in enumerate(x)]
    return x


def cumsum(x, h):
    """Matrix-free rectangle rule for (A x)(s) = int_0^s x(t) dt."""
    out, acc = [], 0.0
    for v in x:
        acc += h * v
        out.append(acc)
    return out


def rcumsum(y, h):
    """The adjoint of cumsum: (A* y)(t) = int_t^1 y(s) ds."""
    out, acc = [0.0] * len(y), 0.0
    for i in range(len(y) - 1, -1, -1):
        acc += h * y[i]
        out[i] = acc
    return out


class TestLandweber(unittest.TestCase):
    def test_check_value(self):
        self.assertAlmostEqual(filter_factor(0.01, 1.0, 100), 0.63397, places=5)
        res = landweber_matrix([[1.0]], [1.0], omega=0.01, kmax=100)
        self.assertAlmostEqual(res.x[0], 0.63397, places=5)

    def test_page_trace(self):
        # A = diag(1, 0.1), x^dagger = (1, 1), y^delta = (1, 0.11), omega = 1, tau delta = 0.015.
        a = [[1.0, 0.0], [0.0, 0.1]]
        res = landweber_matrix(a, [1.0, 0.11], omega=1.0, kmax=1000, delta=0.01, tau=1.5)
        self.assertEqual((res.k, res.stopped), (199, "discrepancy"))
        self.assertAlmostEqual(res.x[1], 1.1 * (1.0 - 0.99 ** 199), places=10)
        self.assertAlmostEqual(res.residuals[0], 1.00603, places=5)
        self.assertGreater(res.residuals[198], 0.015)
        x100 = landweber_matrix(a, [1.0, 0.11], omega=1.0, kmax=100).x
        self.assertAlmostEqual(x100[1], 0.69736, places=5)

    def test_filter_factors_match_svd(self):
        rng = random.Random(11)
        a = rand_matrix(rng, 7, 5)
        y = [rng.gauss(0.0, 1.0) for _ in range(7)]
        u, s, v = svd(a)
        omega = 1.0 / (s[0] * s[0])
        for k in (1, 3, 10, 40):
            x = landweber_matrix(a, y, omega=omega, kmax=k).x
            ref = [0.0] * 5
            for i, si in enumerate(s):
                c = filter_factor(omega, si, k) * sum(u[r][i] * y[r] for r in range(7)) / si
                ref = [rj + c * v[j][i] for j, rj in enumerate(ref)]
            for p, q in zip(x, ref):
                self.assertAlmostEqual(p, q, places=10)

    def test_residual_is_monotone(self):
        rng = random.Random(12)
        for _ in range(5):
            a = rand_matrix(rng, 8, 6)
            y = [rng.gauss(0.0, 1.0) for _ in range(8)]
            res = landweber_matrix(a, y, kmax=60)
            for r0, r1 in zip(res.residuals, res.residuals[1:]):
                self.assertLessEqual(r1, r0 + 1e-12)

    def test_exact_data_converges_to_minimum_norm_solution(self):
        rng = random.Random(13)
        b = rand_matrix(rng, 6, 2)
        c = rand_matrix(rng, 2, 4)
        a = [[sum(b[i][t] * c[t][j] for t in range(2)) for j in range(4)] for i in range(6)]
        y = [rng.gauss(0.0, 1.0) for _ in range(6)]
        u, s, v = svd(a)
        omega = 1.0 / (s[0] * s[0])
        x = landweber_matrix(a, y, omega=omega, kmax=4000).x
        ref = pinv_solution(a, y)
        self.assertLess(norm2([p - q for p, q in zip(x, ref)]), 1e-8 * norm2(ref))

    def test_discrepancy_stop(self):
        rng = random.Random(14)
        a = rand_matrix(rng, 10, 6)
        xt = [rng.gauss(0.0, 1.0) for _ in range(6)]
        e = [rng.gauss(0.0, 1.0) for _ in range(10)]
        delta = 0.05
        ne = norm2(e)
        y = [p + delta * q / ne for p, q in zip(matvec(a, xt), e)]
        tau = 1.2
        res = landweber_matrix(a, y, kmax=100000, delta=delta, tau=tau)
        self.assertEqual(res.stopped, "discrepancy")
        self.assertLessEqual(res.residuals[-1], tau * delta)
        for r in res.residuals[:-1]:
            self.assertGreater(r, tau * delta)

    def test_data_error_bound(self):
        rng = random.Random(15)
        a = rand_matrix(rng, 9, 6)
        u, s, v = svd(a)
        omega = 1.0 / (s[0] * s[0])
        y = [rng.gauss(0.0, 1.0) for _ in range(9)]
        e = [rng.gauss(0.0, 1.0) for _ in range(9)]
        delta = 1e-3
        ne = norm2(e)
        yd = [p + delta * q / ne for p, q in zip(y, e)]
        for k in (1, 5, 25, 125):
            x0 = landweber_matrix(a, y, omega=omega, kmax=k).x
            x1 = landweber_matrix(a, yd, omega=omega, kmax=k).x
            gap = norm2([p - q for p, q in zip(x0, x1)])
            self.assertLessEqual(gap, math.sqrt(omega * k) * delta * (1 + 1e-12))

    def test_rate_on_integration_operator(self):
        # Diagonal model of (A x)(s) = int_0^s x on L^2(0, 1). x^dagger = 1 - t = A* 1
        # has coefficients sqrt2 sigma_k^2, so nu = 1/2 and rho = 1. The noise sits on
        # the component that the step count k amplifies most.
        n = 200
        sig = [2.0 / ((2 * k - 1) * math.pi) for k in range(1, n + 1)]
        xd = [math.sqrt(2.0) * t * t for t in sig]
        y = [t * x for t, x in zip(sig, xd)]
        omega = 1.0 / (sig[0] * sig[0])

        def op(x):
            return [t * v for t, v in zip(sig, x)]

        errs, deltas = [], [1e-2, 1e-3, 1e-4]
        for delta in deltas:
            k = math.ceil(1.0 / delta)
            m = max(range(n), key=lambda i: filter_factor(omega, sig[i], k) / sig[i])
            yd = list(y)
            yd[m] += delta
            x = landweber(op, op, yd, omega, k).x
            err = norm2([p - q for p, q in zip(x, xd)])
            self.assertLessEqual(err, error_bound(0.5, 1.0, omega, k, delta))
            errs.append(err)
        for i in range(2):
            slope = math.log(errs[i] / errs[i + 1]) / math.log(deltas[i] / deltas[i + 1])
            self.assertLess(abs(slope - 0.5), 0.15)

    def test_matrix_free_operator(self):
        n = 50
        h = 1.0 / n
        rng = random.Random(16)
        x = [rng.gauss(0.0, 1.0) for _ in range(n)]
        z = [rng.gauss(0.0, 1.0) for _ in range(n)]
        self.assertLess(adjoint_gap(lambda w: cumsum(w, h), lambda w: rcumsum(w, h), x, z), 1e-12)
        a = [[h if j <= i else 0.0 for j in range(n)] for i in range(n)]
        y = [rng.gauss(0.0, 1.0) for _ in range(n)]
        omega = 1.0 / sum(v * v for row in a for v in row)
        free = landweber(lambda w: cumsum(w, h), lambda w: rcumsum(w, h), y, omega, 30).x
        dense = landweber(lambda w: matvec(a, w), lambda w: rmatvec(a, w), y, omega, 30).x
        for p, q in zip(free, dense):
            self.assertAlmostEqual(p, q, places=10)


if __name__ == "__main__":
    unittest.main()

History

Louis Landweber published the iteration in 1951 for Fredholm integral equations of the first kind and proved its convergence for exact data. Its role as a regularization method, with the iteration count as the parameter, the saturation-free rates under source conditions, and the discrepancy principle as a stopping rule, was worked out in the 1970s and 1980s and is summarized in Chapter 6 of Engl, Hanke and Neubauer (1996). SIRT in tomography is a weighted form of the same iteration.

References

  1. L. Landweber, An iteration formula for Fredholm integral equations of the first kind, American Journal of Mathematics 73(3), 1951, 615 to 624, the iteration and its convergence for exact data
  2. Heinz W. Engl, Martin Hanke and Andreas Neubauer, Regularization of Inverse Problems, Kluwer, 1996, Chapter 6 (Landweber iteration as a regularization method, its rates and the discrepancy principle) and Chapter 11 (the nonlinear Landweber iteration)
  3. Per Christian Hansen, Discrete Inverse Problems, Insight and Algorithms, SIAM, 2010, Chapter 6 (iterative regularization, semi-convergence)

Where this leads

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH1 sketch
  • a full proof of time.dense
  • a full proof of time.per_iteration
  • a full proof of time.total
  • a full proof of space.extra
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
Code (python)I0 not checked yet
  • the tests did not run in this build
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW2 basic
  • a scene preset for the example