Algorithm Search⌘K

Algorithmcore

L-curve method

Also called L-curve criterion, L-curve corner rule.

Plot the log solution norm against the log residual norm over the parameter and choose the parameter at the corner of maximum curvature.

Time
Θ(m n + (P + K) n) worst · average · best
Space
Θ(P + n) extra
Where
K = the number of golden-section steps; P = the number of grid points; m = the number of measurements; n = the number of unknowns (n <= m)
Properties
not convergent regularizationdeterministicheuristicnot needs noise level
Origin
Per Christian Hansen, Dianne P. O'Leary, Charles L. Lawson, Richard J. Hanson, 1992

The L-curve method chooses the parameter of Tikhonov regularization from the data alone. For each α>0\alpha > 0 it takes the point (log⁡∥Axα−y∥,log⁡∥xα∥)(\log\lVert Ax_\alpha - y\rVert, \log\lVert x_\alpha\rVert). As α\alpha runs from large to small, the residual falls and the solution norm grows, and for many discrete ill-posed problems the curve has the shape of the letter L. On the flat part, the solution is over-smoothed: a smaller α\alpha buys a much smaller residual at little cost in norm. On the steep part, the solution fits noise: a smaller α\alpha makes the norm explode for almost no gain in residual. The rule takes the corner between the two, defined as the point of largest curvature. Hansen and O'Leary proposed it in 1993, after Hansen's 1992 analysis of the curve. It needs neither the noise level nor the noise variance, so it is a heuristic rule. By the Bakushinskii veto no such rule can converge for every problem, and Hanke and Vogel gave explicit examples where the L-curve choice does not converge. In practice it is robust to correlated noise and easy to inspect by eye.

In plain words

A smoothing method has a knob. For each setting you can measure two numbers: how far the result is from the data, and how wild the result is. Draw these two numbers against each other on log scales, one point per setting. For many problems you get an L. Along one arm, turning the knob makes the result much closer to the data and only a little wilder. Along the other arm, it makes the result much wilder and only a little closer. The best compromise sits at the bend. The method finds the bend as the point where the curve turns most sharply. It does not need to know how much noise there is, which is its strength, and it can be fooled, which is its weakness.

The problem

The model is y=Ax†+ey = Ax^\dagger + e with an m×nm \times n matrix AA and unknown noise ee. The Tikhonov solution for α>0\alpha > 0 is

xα=arg⁡min⁡x∥Ax−y∥2+α∥x∥2=(ATA+αI)−1ATy.x_\alpha = \arg\min_x \lVert Ax - y\rVert^2 + \alpha\lVert x\rVert^2 = (A^TA + \alpha I)^{-1}A^Ty.

The page Tikhonov regularization writes λ\lambda for this α\alpha. With the thin SVD A=∑i≤rsiuiviTA = \sum_{i \le r} s_iu_iv_i^T, bi=⟨ui,y⟩b_i = \langle u_i, y\rangle and p2=∥y∥2−∑ibi2p^2 = \lVert y\rVert^2 - \sum_i b_i^2, write

η(α)=∥xα∥2=∑isi2bi2(si2+α)2,ρ(α)=∥Axα−y∥2=∑iα2bi2(si2+α)2+p2.\eta(\alpha) = \lVert x_\alpha\rVert^2 = \sum_i \frac{s_i^2b_i^2}{(s_i^2 + \alpha)^2}, \qquad \rho(\alpha) = \lVert Ax_\alpha - y\rVert^2 = \sum_i \frac{\alpha^2b_i^2}{(s_i^2 + \alpha)^2} + p^2.

The L-curve is the plane curve α↦(12log⁡ρ,12log⁡η)\alpha \mapsto (\tfrac12\log\rho, \tfrac12\log\eta). Its signed curvature is

κ(α)=−2ηρ (αη′ρ+α2η′η+ηρ)η′ (α2η2+ρ2)3/2,η′(α)=−2∑isi2bi2(si2+α)3.\kappa(\alpha) = -\frac{2\eta\rho\,(\alpha\eta'\rho + \alpha^2\eta'\eta + \eta\rho)}{\eta'\,(\alpha^2\eta^2 + \rho^2)^{3/2}}, \qquad \eta'(\alpha) = -2\sum_i \frac{s_i^2b_i^2}{(s_i^2 + \alpha)^3}.

It is positive where the curve turns like the corner of an L. The task is to find the α\alpha that maximizes κ\kappa on a search interval, by default [sr2,s12][s_r^2, s_1^2].

The algorithm

The search works in t=log⁡αt = \log\alpha. A coarse geometric grid finds the region of the largest curvature, and golden-section search refines the maximum between the two grid neighbours.

  1. L-CURVE-CORNER(U, s, V, y, P, eps) ▷ thin SVD of A, s descending, r positive values
  2. 1b_i ← <u_i, y> for i ≤ r; p² ← ‖y‖² - Σ b_i²
  3. 2t_j ← log s_r² + (j / (P - 1)) · (log s_1² - log s_r²) for j = 0, ..., P - 1
  4. 3k_j ← κ(e^{t_j}) for every j ▷ η, ρ, η' from b, p² in Θ(r)
  5. 4j* ← the index of the largest k_j
  6. 5[a, c] ← [t_{j*-1}, t_{j*+1}] ▷ clipped at the ends of the grid
  7. 6while c - a > eps
  8. 7golden-section step on [a, c] that keeps the larger κ inside
  9. 8remember the best (t, κ) seen so far
  10. 9alpha ← e^t for the best t
  11. 10return alpha, x = Σ_i s_i b_i / (s_i² + alpha) · v_i, and its curvature

Line L1 projects the data on the left singular vectors. After that, every value of η\eta, ρ\rho and η′\eta' costs Θ(r)\Theta(r), so line L3 is cheap even with a fine grid. Line L4 picks the grid point of largest curvature, and line L5 brackets it by its neighbours. Lines L6 to L8 are a golden-section search for a maximum: each step evaluates κ\kappa once and shrinks the bracket by the factor 0.6180.618. Line L8 keeps the best point, so the result is never worse than the best grid point. Line L10 forms the Tikhonov solution from the SVD.

Example

Take the test problem deriv2 with n=m=24n = m = 24: AA is the discretized Green's function of −u′′-u'' on [0,1][0, 1] with zero boundary values, at the midpoints ti=(i−12)/24t_i = (i - \frac12)/24, with entries h ti(tj−1)h\,t_i(t_j - 1) for ti<tjt_i < t_j and h=1/24h = 1/24. The true solution has two bumps, xj†=e−80(tj−0.3)2+0.6 e−80(tj−0.7)2x^\dagger_j = e^{-80(t_j - 0.3)^2} + 0.6\,e^{-80(t_j - 0.7)^2}, and ∥x†∥=2.1402\lVert x^\dagger\rVert = 2.1402. The noise is Gaussian from random.Random(0), scaled so that ∥e∥=0.1∥Ax†∥=0.01754\lVert e\rVert = 0.1\lVert Ax^\dagger\rVert = 0.01754. The singular values run from s1=0.101466s_1 = 0.101466 to s24=4.34×10−4s_{24} = 4.34 \times 10^{-4}, and p=0p = 0 because AA is square and invertible.

α\alpha ∥Axα−y∥\lVert Ax_\alpha - y\rVert ∥xα∥\lVert x_\alpha\rVert κ\kappa ∥xα−x†∥\lVert x_\alpha - x^\dagger\rVert
10−710^{-7} 0.00404 21.3866 -0.3935 21.2693
10−610^{-6} 0.01186 7.4657 -0.3572 7.1273
10−510^{-5} 0.01590 2.4850 0.2798 1.3985
3.16×10−53.16 \times 10^{-5} 0.01694 2.0287 2.1954 0.8312
10−410^{-4} 0.01799 1.8573 4.4166 0.9049
3.16×10−43.16 \times 10^{-4} 0.02001 1.7423 1.4294 1.0462
10−310^{-3} 0.02638 1.5990 0.0332 1.1602
10−210^{-2} 0.08996 0.8802 -0.6814 1.5090
10−110^{-1} 0.16138 0.1619 -0.1089 2.0110

Read the table from the bottom up. From α=0.1\alpha = 0.1 to 10−310^{-3} the residual falls by a factor of 6 and the norm grows by a factor of 10. From 10−510^{-5} to 10−710^{-7} the residual falls by a factor of 4 and the norm grows by a factor of 9. In between, from 10−310^{-3} to 10−510^{-5}, the residual barely moves and the norm grows slowly: that is the corner. The curvature is negative on both arms, where the log-log curve bends the other way.

Line L2 uses the default interval [s242,s12]=[1.88×10−7,0.0103][s_{24}^2, s_1^2] = [1.88 \times 10^{-7}, 0.0103] with P=60P = 60 points, so neighbouring grid points are 0.18490.1849 apart in log⁡α\log\alpha. Line L4 picks grid point 33, α=8.4117×10−5\alpha = 8.4117 \times 10^{-5} with κ=4.4985\kappa = 4.4985, and line L5 brackets it by 6.99×10−56.99 \times 10^{-5} and 1.012×10−41.012 \times 10^{-4}. With ε=10−6\varepsilon = 10^{-6} the golden-section loop makes 27 steps and returns α=8.5477×10−5\alpha = 8.5477 \times 10^{-5} with κ=4.4994\kappa = 4.4994, residual 0.017820.01782 and ∥xα∥=1.8749\lVert x_\alpha\rVert = 1.8749. The error is ∥xα−x†∥=0.8850\lVert x_\alpha - x^\dagger\rVert = 0.8850. On a fine grid the smallest error is 0.82150.8215, at α≈3.98×10−5\alpha \approx 3.98 \times 10^{-5}, so the corner costs 8 percent here. For comparison, the discrepancy principle with the true δ\delta and τ=1\tau = 1 gives α=6.42×10−5\alpha = 6.42 \times 10^{-5} and error 0.85170.8517. The residual at the corner, 0.017820.01782, is close to δ\delta, which is what the rule hopes for when it has no δ\delta.

Correctness

The proof is in proofs/correctness.md. It shows three things. First, η\eta is strictly decreasing and ρ\rho is strictly increasing in α\alpha when some sibi≠0s_ib_i \ne 0, and ρ′=−αη′\rho' = -\alpha\eta', so the L-curve is a graph that runs from upper left to lower right. Second, the closed form of κ\kappa above is the signed curvature of the curve (12log⁡ρ,12log⁡η)(\frac12\log\rho, \frac12\log\eta): the second derivative η′′\eta'' cancels out of the numerator once ρ′=−αη′\rho' = -\alpha\eta' and ρ′′=−η′−αη′′\rho'' = -\eta' - \alpha\eta'' are substituted. The curvature of a plane curve does not depend on the parameter, so computing it in α\alpha or in t=log⁡αt = \log\alpha gives the same value. Third, the search terminates after ⌈log⁡(w/ε)/log⁡(1/0.618)⌉\lceil\log(w/\varepsilon)/\log(1/0.618)\rceil golden-section steps, where ww is the width of the initial bracket, and returns a point whose curvature is at least the largest curvature on the grid. If κ\kappa is unimodal on the bracket, the result is within ε\varepsilon of the local maximum in log⁡α\log\alpha.

None of this says that the corner gives a good α\alpha. That claim is a heuristic. For a solution that satisfies the discrete Picard condition and noise that is not too small, Hansen (1992) explains why the curve has a corner near the α\alpha where the noise starts to dominate the solution. There is no theorem that it converges, and there are proofs that it does not in some settings (see Pitfalls).

Proof: The L-curve is monotone, the closed-form curvature is its signed curvature, and the corner search terminates with a point at least as curved as the best grid pointfull

Setting. AA is a real m×nm \times n matrix with thin SVD A=∑i=1rsiuiviTA = \sum_{i=1}^r s_iu_iv_i^T and s1≥⋯≥sr>0s_1 \ge \dots \ge s_r > 0. For data yy, line L1 computes bi=⟨ui,y⟩b_i = \langle u_i, y\rangle and p2=∥y∥2−∑ibi2≥0p^2 = \lVert y\rVert^2 - \sum_i b_i^2 \ge 0, the squared norm of the part of yy outside the range of AA. For α>0\alpha > 0 the Tikhonov solution is xα=(ATA+αI)−1ATyx_\alpha = (A^TA + \alpha I)^{-1}A^Ty. Assume some sibi≠0s_ib_i \ne 0; otherwise xα=0x_\alpha = 0 for every α\alpha and there is no curve.

Claim 1 (the two norms). With qi=si2+αq_i = s_i^2 + \alpha,

xα=∑isibiqivi,η=∥xα∥2=∑isi2bi2qi2,ρ=∥Axα−y∥2=∑iα2bi2qi2+p2.x_\alpha = \sum_i \frac{s_ib_i}{q_i}v_i, \qquad \eta = \lVert x_\alpha\rVert^2 = \sum_i \frac{s_i^2b_i^2}{q_i^2}, \qquad \rho = \lVert Ax_\alpha - y\rVert^2 = \sum_i \frac{\alpha^2b_i^2}{q_i^2} + p^2.

Proof. In the basis viv_i the normal equations (ATA+αI)x=ATy(A^TA + \alpha I)x = A^Ty are diagonal, with qiξi=sibiq_i\xi_i = s_ib_i for i≤ri \le r and αξ=0\alpha\xi = 0 on the null space of AA. Then Axα−y=∑i(si2/qi−1)biui−P⊥yAx_\alpha - y = \sum_i (s_i^2/q_i - 1)b_iu_i - P^\perp y with si2/qi−1=−α/qis_i^2/q_i - 1 = -\alpha/q_i, and Pythagoras gives both norms. □\square

Claim 2 (monotonicity). η′=−2∑isi2bi2/qi3<0\eta' = -2\sum_i s_i^2b_i^2/q_i^3 < 0 and ρ′=−αη′>0\rho' = -\alpha\eta' > 0. So as α\alpha grows, the curve (X,Y)=(12log⁡ρ,12log⁡η)(X, Y) = (\frac12\log\rho, \frac12\log\eta) moves strictly right and strictly down.

Proof. Differentiate term by term: ddα(si2bi2qi−2)=−2si2bi2qi−3\frac{d}{d\alpha}(s_i^2b_i^2q_i^{-2}) = -2s_i^2b_i^2q_i^{-3}, and ddα(α2bi2qi−2)=2αbi2qi−2−2α2bi2qi−3=2αbi2si2qi−3\frac{d}{d\alpha}(\alpha^2b_i^2q_i^{-2}) = 2\alpha b_i^2q_i^{-2} - 2\alpha^2b_i^2q_i^{-3} = 2\alpha b_i^2s_i^2q_i^{-3}. The second is −α-\alpha times the first. Some sibi≠0s_ib_i \ne 0, so η′<0\eta' < 0. □\square

Claim 3 (the curvature formula). The signed curvature κ=(X′Y′′−X′′Y′)/(X′2+Y′2)3/2\kappa = (X'Y'' - X''Y')/(X'^2 + Y'^2)^{3/2} of the curve, with ′' the derivative in α\alpha, equals

κ=−2ηρ (αη′ρ+α2η′η+ηρ)η′ (α2η2+ρ2)3/2.\kappa = -\frac{2\eta\rho\,(\alpha\eta'\rho + \alpha^2\eta'\eta + \eta\rho)}{\eta'\,(\alpha^2\eta^2 + \rho^2)^{3/2}}.

Proof. We have X′=ρ′/(2ρ)X' = \rho'/(2\rho), Y′=η′/(2η)Y' = \eta'/(2\eta), X′′=ρ′′/(2ρ)−ρ′2/(2ρ2)X'' = \rho''/(2\rho) - \rho'^2/(2\rho^2) and Y′′=η′′/(2η)−η′2/(2η2)Y'' = \eta''/(2\eta) - \eta'^2/(2\eta^2). By Claim 2, ρ′=−αη′\rho' = -\alpha\eta' and so ρ′′=−η′−αη′′\rho'' = -\eta' - \alpha\eta''. Substitute:

4(X′Y′′−X′′Y′)=ρ′ρ(η′′η−η′2η2)−η′η(ρ′′ρ−ρ′2ρ2)=−αη′η′′ρη+αη′3ρη2+η′2+αη′η′′ηρ+α2η′3ηρ2.4(X'Y'' - X''Y') = \frac{\rho'}{\rho}\Big(\frac{\eta''}{\eta} - \frac{\eta'^2}{\eta^2}\Big) - \frac{\eta'}{\eta}\Big(\frac{\rho''}{\rho} - \frac{\rho'^2}{\rho^2}\Big) = \frac{-\alpha\eta'\eta''}{\rho\eta} + \frac{\alpha\eta'^3}{\rho\eta^2} + \frac{\eta'^2 + \alpha\eta'\eta''}{\eta\rho} + \frac{\alpha^2\eta'^3}{\eta\rho^2}.

The two terms with η′′\eta'' cancel. Over the common denominator η2ρ2\eta^2\rho^2 the rest is η′2(αη′ρ+ηρ+α2η′η)/(η2ρ2)\eta'^2(\alpha\eta'\rho + \eta\rho + \alpha^2\eta'\eta)/(\eta^2\rho^2). Also

4(X′2+Y′2)=α2η′2ρ2+η′2η2=η′2(α2η2+ρ2)η2ρ2.4(X'^2 + Y'^2) = \frac{\alpha^2\eta'^2}{\rho^2} + \frac{\eta'^2}{\eta^2} = \frac{\eta'^2(\alpha^2\eta^2 + \rho^2)}{\eta^2\rho^2}.

So

κ=η′2(αη′ρ+α2η′η+ηρ)/(4η2ρ2)∣η′∣3(α2η2+ρ2)3/2/(8η3ρ3)=2ηρ(αη′ρ+α2η′η+ηρ)∣η′∣(α2η2+ρ2)3/2,\kappa = \frac{\eta'^2(\alpha\eta'\rho + \alpha^2\eta'\eta + \eta\rho)/(4\eta^2\rho^2)}{|\eta'|^3(\alpha^2\eta^2 + \rho^2)^{3/2}/(8\eta^3\rho^3)} = \frac{2\eta\rho(\alpha\eta'\rho + \alpha^2\eta'\eta + \eta\rho)}{|\eta'|(\alpha^2\eta^2 + \rho^2)^{3/2}},

and ∣η′∣=−η′|\eta'| = -\eta' by Claim 2. □\square

The sign convention: the curve runs right and down as α\alpha grows, and κ>0\kappa > 0 means that it turns counterclockwise, from steep to flat, which is the turn at the corner of an L.

Claim 4 (invariance). The value of κ\kappa at a point of the curve does not depend on the parameter. In particular, κ\kappa computed in α\alpha equals κ\kappa computed in t=log⁡αt = \log\alpha.

Proof. Let α=g(t)\alpha = g(t) with g′>0g' > 0. Then X˙=X′g′\dot X = X'g' and X¨=X′′g′2+X′g′′\ddot X = X''g'^2 + X'g'', and the same for YY. So X˙Y¨−X¨Y˙=g′3(X′Y′′−X′′Y′)\dot X\ddot Y - \ddot X\dot Y = g'^3(X'Y'' - X''Y'), because the g′′g'' terms cancel, and (X˙2+Y˙2)3/2=g′3(X′2+Y′2)3/2(\dot X^2 + \dot Y^2)^{3/2} = g'^3(X'^2 + Y'^2)^{3/2}. The factors g′3g'^3 cancel. □\square

Claim 5 (scaling). Replacing AA and yy by cAcA and cycy with c>0c > 0 maps the curvature at α\alpha to the curvature at c2αc^2\alpha of the new problem, and the solution is unchanged.

Proof. The new singular values are csics_i and the new coefficients cbicb_i. At c2αc^2\alpha each term of η\eta is unchanged and each term of ρ\rho is multiplied by c2c^2. So the new curve is the old one shifted by (log⁡c,0)(\log c, 0), a rigid motion, and the curvature is unchanged. The solution ∑icsicbivi/(c2qi)\sum_i cs_icb_iv_i/(c^2q_i) is the old one. □\square

Claim 6 (termination and the guarantee of the search). Let w=tj∗+1−tj∗−1w = t_{j^\ast+1} - t_{j^\ast-1} be the width of the bracket from line L5 (at most 2(log⁡s12−log⁡sr2)/(P−1)2(\log s_1^2 - \log s_r^2)/(P - 1)). The loop of lines L6 to L8 stops after K=⌈log⁡(w/ε)/log⁡(1/φ)⌉K = \lceil\log(w/\varepsilon)/\log(1/\varphi)\rceil steps, with φ=(5−1)/2\varphi = (\sqrt5 - 1)/2. The returned α\alpha satisfies κ(α)≥max⁡jkj\kappa(\alpha) \ge \max_j k_j. If κ(et)\kappa(e^t) is unimodal on the bracket, the returned tt is within ε\varepsilon of the maximizer on the bracket.

Proof. The search keeps two interior points t1<t2t_1 < t_2 of [a,c][a, c] at the golden ratio positions t1=c−φ(c−a)t_1 = c - \varphi(c - a) and t2=a+φ(c−a)t_2 = a + \varphi(c - a). If κ(t1)≥κ(t2)\kappa(t_1) \ge \kappa(t_2) it replaces cc by t2t_2, otherwise aa by t1t_1. Since φ2=1−φ\varphi^2 = 1 - \varphi, the kept interior point is at a golden position of the new bracket, so one new evaluation per step suffices, and the width is multiplied by φ\varphi in every step. After KK steps it is wφK≤εw\varphi^K \le \varepsilon, so the loop stops. Line L8 starts from the best grid point (tj∗,kj∗)(t_{j^\ast}, k_{j^\ast}) and replaces it only by a point with a larger value, so the returned value is at least kj∗=max⁡jkjk_{j^\ast} = \max_j k_j, and line L9 returns the α\alpha where it was attained. If the function is unimodal on [a,c][a, c], each step discards a part of the bracket that contains no point larger than the kept interior point, so the maximizer stays in [a,c][a, c]. The returned tt was evaluated inside the final bracket or is at least as good as all points evaluated in it, so it lies within the final width of the maximizer when the function is unimodal. □\square

Claim 7 (the output). Line L10 returns xα=∑isibi/(si2+α) vix_\alpha = \sum_i s_ib_i/(s_i^2 + \alpha)\,v_i, the Tikhonov solution for the chosen α\alpha, by Claim 1.

What is not proved. The claims above make the algorithm a correct and terminating maximizer of the curvature. They do not say that the corner gives a small error. By the Bakushinskii veto, no rule that does not use the noise level can make xα→x†x_\alpha \to x^\dagger for all x†x^\dagger and all noise as the noise goes to zero, and Hanke (1996) and Vogel (1996) give explicit model problems where the L-curve choice fails to converge. The good behaviour in the example of the page is a measurement.

Complexity

With the thin SVD given, line L1 costs Θ(mn)\Theta(mn). Each curvature value costs Θ(r)⊆O(n)\Theta(r) \subseteq O(n), so line L3 costs Θ(Pn)\Theta(Pn) and the loop costs Θ(Kn)\Theta(Kn) for KK golden-section steps. Line L10 costs Θ(n2)⊆O(mn)\Theta(n^2) \subseteq O(mn). The total is Θ(mn+(P+K)n)\Theta(mn + (P + K)n) with Θ(P+n)\Theta(P + n) extra space. The bracket has width w=2log⁡(s12/sr2)/(P−1)w = 2\log(s_1^2/s_r^2)/(P - 1), and K=⌈log⁡(w/ε)/log⁡1.618⌉K = \lceil\log(w/\varepsilon)/\log 1.618\rceil. In the example w=0.370w = 0.370, ε=10−6\varepsilon = 10^{-6} and K=27K = 27. The SVD itself costs O(mn2)O(mn^2) by a standard dense method and dominates. Without an SVD, each point of the curve needs one Tikhonov solve and η′\eta' needs one more solve, so large problems use a few points of the curve and a Krylov method, as in hybrid Krylov regularization.

Properties

  • Heuristic: it uses only AA and yy, not δ\delta or σ\sigma.
  • Not convergent in general. By the Bakushinskii veto, a rule that ignores the noise level cannot converge for every x†x^\dagger and every noise sequence.
  • Scale free: replacing AA and yy by cAcA and cycy multiplies the chosen α\alpha by c2c^2 and leaves xαx_\alpha and κ\kappa unchanged, because a scaling of ρ\rho and η\eta is a shift of the log-log curve.
  • The curvature is a property of the curve and not of the parameter. The same corner is found in α\alpha, log⁡α\log\alpha or α\sqrt\alpha.
  • The corner need not exist. On mildly ill-posed problems the curve can be convex the wrong way everywhere, and then line L4 returns the least negative curvature, which is not a corner (see Pitfalls).

Variants and improvements

  • Discrete L-curve. For truncated SVD, CGLS or other methods with a discrete parameter the curve is a set of points. Hansen, Jensen and Rodriguez (2007) choose the corner by an adaptive pruning of the points. A simpler choice is the point of largest angle change.
  • Triangle and maximum distance rules. Pick the point farthest from the line through the two ends of the curve. This needs no derivatives.
  • Krylov approximations. Calvetti, Golub and Reichel (1999) bound the curve with Gauss quadrature from Lanczos bidiagonalization, the L-ribbon, so the corner can be found without the SVD.
  • General form. With a penalty α∥Lx∥2\alpha\lVert Lx\rVert^2 the vertical axis becomes log⁡∥Lxα∥\log\lVert Lx_\alpha\rVert. The same formulas hold with the generalized SVD of (A,L)(A, L).
  • Other heuristic rules. GCV and the quasi-optimality criterion also work without δ\delta. They fail in different situations, so computing two of them is a cheap check.

When to use it

Use it when the noise level is unknown, the problem is severely ill-posed and the noise is not tiny, and you want a picture that a person can check. It is a good first rule in exploratory work because the plot shows at once whether the problem has a clear corner. If δ\delta is known, use the discrepancy principle or the balancing principle, which have proofs. If the noise is white with known variance, use UPRE. For large white-noise problems, GCV is often more accurate.

Pitfalls

  • A curve with no corner. For a mildly ill-posed problem, such as a 16×1616 \times 16 integration matrix with 11 percent noise, the curvature is negative on the whole interval. Line L4 still returns a point. Check that the returned κ\kappa is positive and look at the plot.
  • Smooth solutions and small noise. Hanke (1996) showed in a model problem that the L-curve choice does not converge in the right way when the true solution is very smooth. Vogel (1996) showed that the chosen parameter does not converge as the discretization is refined in a statistical setting. Treat the rule as a heuristic, not as a regularization method.
  • A grid that is too coarse in line L2. The peak of κ\kappa can be narrow, and a coarse grid can miss it and lock line L5 onto a second, smaller local maximum. With P=60P = 60 on [sr2,s12][s_r^2, s_1^2] this rarely happens, but more points cost little.
  • A search interval that is too narrow or too wide. Below sr2s_r^2 the curve is nearly a straight line and can have spurious bends caused by rounding. Above s12s_1^2 the curvature is near zero. The default [sr2,s12][s_r^2, s_1^2] in line L2 avoids both.
  • Using the plain norms instead of their logarithms. The corner is a feature of the log-log plot. In linear scales the curvature formula and the maximum are different.
  • Computing the curvature with finite differences of the plotted points instead of the closed form in line L3. The second differences lose many digits when the points are close, and η′\eta' is available exactly.

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
l_curve_method.py 110 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/l-curve-method/. The authors are listed in prov/W03DNM.jsonl.
"""The L-curve corner rule for Tikhonov regularization.

The L-curve is the curve (log ||A x_alpha - y||, log ||x_alpha||) for
alpha > 0, where x_alpha minimizes ||A x - y||^2 + alpha ||x||^2. The rule
picks the alpha of largest curvature. With eta = ||x_alpha||^2,
rho = ||A x_alpha - y||^2 and eta' = d eta / d alpha, the curvature is

    kappa = -2 eta rho (alpha eta' rho + alpha^2 eta' eta + eta rho)
            / (eta' (alpha^2 eta^2 + rho^2)^(3/2)),

so it needs no second derivative. Everything comes from the thin SVD.
"""

import math

from imgla import norm2, svd

INV_PHI = (math.sqrt(5.0) - 1.0) / 2.0


def coefficients(u, s, y):
    """b_i = <u_i, y> for the s_i > 0, and p2 = ||y||^2 - sum b_i^2 (clamped at 0)."""
    m = len(y)
    b = [sum(u[i][k] * y[i] for i in range(m)) for k in range(len(s)) if s[k] > 0.0]
    p2 = max(norm2(y) ** 2 - sum(t * t for t in b), 0.0)
    return b, p2


def norms(s, b, p2, alpha):
    """(eta, rho, eta') at alpha: ||x_alpha||^2, ||A x_alpha - y||^2 and d eta / d alpha."""
    eta = rho = deta = 0.0
    for si, bi in zip(s, b):
        q = si * si + alpha
        eta += si * si * bi * bi / (q * q)
        rho += (alpha / q) ** 2 * bi * bi
        deta -= 2.0 * si * si * bi * bi / (q * q * q)
    return eta, rho + p2, deta


def curvature(s, b, p2, alpha):
    """The signed curvature of the L-curve at alpha (positive at the corner)."""
    eta, rho, deta = norms(s, b, p2, alpha)
    num = alpha * deta * rho + alpha * alpha * deta * eta + eta * rho
    return -2.0 * eta * rho * num / (deta * (alpha * alpha * eta * eta + rho * rho) ** 1.5)


def tikhonov_svd(s, v, b, alpha):
    """x_alpha = sum_i s_i b_i / (s_i^2 + alpha) v_i."""
    n = len(v)
    x = [0.0] * n
    for k, (si, bi) in enumerate(zip(s, b)):
        c = si * bi / (si * si + alpha)
        for j in range(n):
            x[j] += c * v[j][k]
    return x


def l_curve_corner(u, s, v, y, alpha_min=None, alpha_max=None, points=60, eps=1e-6):
    """Return (alpha, x, kappa) at the point of largest curvature of the L-curve.

    The search is over [alpha_min, alpha_max], by default [s_r^2, s_1^2]: a
    geometric grid of the given number of points, then golden-section search
    in log alpha between the neighbours of the best grid point.
    """
    s = [si for si in s if si > 0.0]
    b, p2 = coefficients(u, s, y)  # @line L1
    lo_t = math.log(alpha_min if alpha_min is not None else s[-1] ** 2)
    hi_t = math.log(alpha_max if alpha_max is not None else s[0] ** 2)
    ts = [lo_t + (hi_t - lo_t) * j / (points - 1) for j in range(points)]  # @line L2

    def kappa(t):
        return curvature(s, b, p2, math.exp(t))

    ks = [kappa(t) for t in ts]  # @line L3
    j = max(range(points), key=lambda i: ks[i])  # @line L4
    a, c = ts[max(j - 1, 0)], ts[min(j + 1, points - 1)]  # @line L5
    best_t, best_k = ts[j], ks[j]
    t1, t2 = c - INV_PHI * (c - a), a + INV_PHI * (c - a)
    k1, k2 = kappa(t1), kappa(t2)
    while c - a > eps:  # @line L6
        if k1 >= k2:  # @line L7
            c, t2, k2 = t2, t1, k1
            t1 = c - INV_PHI * (c - a)
            k1 = kappa(t1)
        else:
            a, t1, k1 = t1, t2, k2
            t2 = a + INV_PHI * (c - a)
            k2 = kappa(t2)
        for t, k in ((t1, k1), (t2, k2)):  # @line L8
            if k > best_k:
                best_t, best_k = t, k
    alpha = math.exp(best_t)  # @line L9
    return alpha, tikhonov_svd(s, v, b, alpha), best_k  # @line L10


def l_curve_corner_matrix(a, y, **kw):
    """The same for a dense matrix: compute the SVD, then call l_curve_corner."""
    u, s, v = svd(a)
    return l_curve_corner(u, s, v, y, **kw)


def l_curve_points(s, b, p2, alphas):
    """The points (log ||A x_alpha - y||, log ||x_alpha||) for a list of alphas."""
    out = []
    for al in alphas:
        eta, rho, _ = norms(s, b, p2, al)
        out.append((0.5 * math.log(rho), 0.5 * math.log(eta)))
    return out
test_l_curve_method.py 160 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/l-curve-method/. The authors are listed in prov/W03DNM.jsonl.

import math
import random

from imgla import matmul, matvec, norm2, rmatvec, solve, svd, transpose
from l_curve_method import (
    coefficients,
    curvature,
    l_curve_corner,
    l_curve_corner_matrix,
    l_curve_points,
    norms,
    tikhonov_svd,
)


def deriv2(n):
    """Discretized Green's function of -u'' on [0, 1] with zero boundary values."""
    h = 1.0 / n
    t = [(i + 0.5) * h for i in range(n)]
    return [[h * (t[i] * (t[j] - 1.0) if t[i] < t[j] else t[j] * (t[i] - 1.0)) for j in range(n)] for i in range(n)]


def integration_matrix(n):
    h = 1.0 / n
    return [[h if j <= i else 0.0 for j in range(n)] for i in range(n)]


def bumps(n):
    t = [(j + 0.5) / n for j in range(n)]
    return [math.exp(-80.0 * (x - 0.3) ** 2) + 0.6 * math.exp(-80.0 * (x - 0.7) ** 2) for x in t]


def noisy(a, xt, rel, seed):
    y0 = matvec(a, xt)
    rng = random.Random(seed)
    e = [rng.gauss(0.0, 1.0) for _ in y0]
    c = rel * norm2(y0) / norm2(e)
    return [p + c * q for p, q in zip(y0, e)], c * norm2(e)


def tikhonov_solve(a, y, alpha):
    ata = matmul(transpose(a), a)
    for i in range(len(ata)):
        ata[i][i] += alpha
    return solve(ata, rmatvec(a, y))


def best_on_grid(s, v, b, xt):
    return min(math.dist(tikhonov_svd(s, v, b, 10.0 ** (k / 40.0)), xt) for k in range(-400, 40))


def test_page_example():
    a, xt = deriv2(24), bumps(24)
    y, delta = noisy(a, xt, 0.1, 0)
    u, s, v = svd(a)
    alpha, x, kappa = l_curve_corner(u, s, v, y)
    assert abs(alpha / 8.5477e-5 - 1.0) < 1e-3
    assert abs(kappa - 4.4994) < 1e-3
    assert abs(math.dist(x, xt) - 0.8850) < 1e-3
    b, p2 = coefficients(u, s, y)
    assert abs(math.sqrt(norms(s, b, p2, alpha)[1]) - 0.01782) < 1e-5
    assert abs(delta - 0.01754) < 1e-5


def test_norms_match_direct_solves():
    a = deriv2(10)
    y, _ = noisy(a, bumps(10), 0.05, 3)
    u, s, v = svd(a)
    b, p2 = coefficients(u, s, y)
    for alpha in (1e-6, 1e-4, 1e-2):
        x = tikhonov_solve(a, y, alpha)
        r = [p - q for p, q in zip(matvec(a, x), y)]
        eta, rho, _ = norms(s, b, p2, alpha)
        assert abs(eta - norm2(x) ** 2) <= 1e-8 * eta
        assert abs(rho - norm2(r) ** 2) <= 1e-8 * rho
        assert math.dist(tikhonov_svd(s, v, b, alpha), x) <= 1e-8 * norm2(x)


def test_derivative_and_curvature_match_finite_differences():
    a = deriv2(12)
    y, _ = noisy(a, bumps(12), 0.05, 4)
    u, s, v = svd(a)
    b, p2 = coefficients(u, s, y)
    for t in (-14.0, -11.0, -9.0, -6.0):
        h = 1e-4
        ep = norms(s, b, p2, math.exp(t + h))[0]
        em = norms(s, b, p2, math.exp(t - h))[0]
        deta = norms(s, b, p2, math.exp(t))[2]
        assert abs((ep - em) / (math.exp(t + h) - math.exp(t - h)) - deta) <= 1e-6 * abs(deta)
        # curvature of the parametric curve (log rho / 2, log eta / 2) in t = log alpha
        (x0, y0), (x1, y1), (x2, y2) = l_curve_points(s, b, p2, [math.exp(t - h), math.exp(t), math.exp(t + h)])
        dx, dy = (x2 - x0) / (2 * h), (y2 - y0) / (2 * h)
        ddx, ddy = (x2 - 2 * x1 + x0) / h ** 2, (y2 - 2 * y1 + y0) / h ** 2
        k_fd = (dx * ddy - ddx * dy) / (dx * dx + dy * dy) ** 1.5
        k = curvature(s, b, p2, math.exp(t))
        assert abs(k_fd - k) <= 1e-4 * max(1.0, abs(k))


def test_curve_is_monotone():
    a = deriv2(10)
    y, _ = noisy(a, bumps(10), 0.02, 5)
    u, s, v = svd(a)
    b, p2 = coefficients(u, s, y)
    pts = l_curve_points(s, b, p2, [10.0 ** (k / 4.0) for k in range(-40, 0)])
    assert all(pts[i][0] < pts[i + 1][0] for i in range(len(pts) - 1))
    assert all(pts[i][1] > pts[i + 1][1] for i in range(len(pts) - 1))


def test_corner_is_a_local_maximum_above_the_grid():
    a = deriv2(16)
    u, s, v = svd(a)
    for seed in range(3):
        y, _ = noisy(a, bumps(16), 0.05, 10 + seed)
        b, p2 = coefficients(u, s, y)
        alpha, _, kappa = l_curve_corner(u, s, v, y)
        assert abs(curvature(s, b, p2, alpha) - kappa) <= 1e-12 * abs(kappa)
        lo, hi = math.log(s[-1] ** 2), math.log(s[0] ** 2)
        grid = [curvature(s, b, p2, math.exp(lo + (hi - lo) * j / 59)) for j in range(60)]
        assert kappa >= max(grid)
        for f in (0.999, 1.001):
            assert curvature(s, b, p2, alpha * f) <= kappa + 1e-9


def test_error_close_to_best_on_a_favourable_problem():
    a, xt = deriv2(24), bumps(24)
    u, s, v = svd(a)
    for rel, factor in ((0.1, 1.6), (0.01, 2.0)):
        for seed in range(3):
            y, _ = noisy(a, xt, rel, seed)
            b, _ = coefficients(u, s, y)
            _, x, _ = l_curve_corner(u, s, v, y)
            assert math.dist(x, xt) <= factor * best_on_grid(s, v, b, xt)


def test_scaling_moves_alpha_by_c_squared():
    a = deriv2(12)
    y, _ = noisy(a, bumps(12), 0.05, 6)
    alpha, x, kappa = l_curve_corner_matrix(a, y)
    c = 7.0
    ac = [[c * t for t in row] for row in a]
    alpha_c, x_c, kappa_c = l_curve_corner_matrix(ac, [c * t for t in y])
    assert abs(alpha_c / (c * c * alpha) - 1.0) < 1e-4
    assert math.dist(x, x_c) <= 1e-4 * norm2(x)
    assert abs(kappa - kappa_c) <= 1e-6 * abs(kappa)


def test_no_corner_on_a_mildly_ill_posed_problem():
    n = 16
    a = integration_matrix(n)
    xt = [math.sin(math.pi * (j + 0.5) / n) for j in range(n)]
    y, _ = noisy(a, xt, 0.01, 1)
    u, s, v = svd(a)
    b, p2 = coefficients(u, s, y)
    _, _, kappa = l_curve_corner(u, s, v, y)
    assert kappa < 0.0
    lo, hi = math.log(s[-1] ** 2), math.log(s[0] ** 2)
    assert all(curvature(s, b, p2, math.exp(lo + (hi - lo) * j / 99)) < 0.0 for j in range(100))

History

Lawson and Hanson (1974) plotted the solution norm against the residual norm to choose a truncation level. Hansen (1992) studied the curve in log-log scale for discrete ill-posed problems and explained its L shape from the SVD and the Picard condition. Hansen and O'Leary (1993) turned the picture into a rule, the corner of maximum curvature, and gave the curvature formula in terms of η\eta, ρ\rho and η′\eta'. Hanke (1996) and Vogel (1996) showed limits of the rule: it is not convergent in general. It remains one of the most used heuristic rules, mainly because the plot is easy to read.

References

  1. Per Christian Hansen, Analysis of discrete ill-posed problems by means of the L-curve, SIAM Review 34(4), 1992, pages 561 to 580
  2. Per Christian Hansen and Dianne P. O'Leary, The use of the L-curve in the regularization of discrete ill-posed problems, SIAM Journal on Scientific Computing 14(6), 1993, pages 1487 to 1503
  3. Martin Hanke, Limitations of the L-curve method in ill-posed problems, BIT 36(2), 1996, pages 287 to 301
  4. Curtis R. Vogel, Non-convergence of the L-curve regularization parameter selection method, Inverse Problems 12(4), 1996, pages 535 to 547
  5. Per Christian Hansen, Discrete Inverse Problems, Insight and Algorithms, SIAM, 2010, chapter 5 (choosing the regularization parameter)

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.average
  • a full proof of time.best
  • a full proof of time.worst
  • 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