lagrange_projection
std.optim.lagrange_projection · Level L0The Lagrange condition for minimizing ‖x − c‖² subject to one linear constraint g·x = h (g ≠ 0): the minimizer x* = c − ((g·c − h)/‖g‖²)·g, the multiplier λ with ∇f(x*) = λ·∇(g·x) (this sign convention), and the residuals of stationarity, 2(x* − c) − λg, and of feasibility, g·x* − h, both 0. The condition is necessary, not sufficient, in general; here the problem is convex, so x* is the global minimizer. It is not the KKT condition for inequalities.
Signature
lagrange_projection(c: f64[n], g: f64[n], h: f64[]) → f64[n], f64[], f64[n], f64[]
Structure
The function as NOVA stores it: one box per input, operation and output, and arrows that carry values. A double border marks another library function this one runs — called once, or by Scan once per element; select it to open that function.
- input
- operation
- constant
- call
- output
Verification
- Signature proven by NOVA’s shape solver, for every size.
- Equal to the reference
the projection formula in exact arithmeticin exact rational arithmetic, on all 40 test cases. - All 388 float64 results inside the running error bound; the closest uses 87% of it.
- Interpreter and NumPy backend return bit-identical results.
- At float32 too: the 40 test cases rounded to float32, and 40 of them inside the running error bound at u = 2⁻²⁴; the closest uses 69% of it.
- correctly rounded (the float64 nearest the exact value)
- 64%
- bit-equal to the NumPy formula in float64
- 84%
- largest error, in units in the last place
- 7.7e+3
Large ulp counts appear where a result is tiny next to the numbers it is computed from (after cancellation, for example), so one unit in the last place is tiny too; the absolute error is still inside the bound. Results within their own error of zero are not counted.
Identity
sha256:27c492c10d08dd10f07f3eed016a9eb5683fd59456a2b7ea882d7412d94faf67The semantic hash of the graph. It changes when the program changes, and never when only its documentation does.
Control handle
- Symbol
- Ω:std.optim.lagrange_projection · Ω:lagrange_projection
- Pins
sha256:d13b78fcb1038fb4406d56bc4c7817659f193e09be01ad5c2723ff4340e42a38this graph and the 1 it reaches through calls- Evidence
sha256:bc6dd0fc42742b43da16dad33a647105dd66dcafb867894767edb7ccdff382b6the hash of its verification record- Needs
- no capability: a pure function
Through NOVA’s control layer, the symbol launches this function only while the program still matches what it pins: a change to this graph, or to any graph it reaches, needs a migration first.