Expand description
Forward-mode automatic differentiation for constraint residuals.
Every residual is written once, generically over Scalar (the same
trait the rest of the kernel runs on), and evaluated either with a plain
Scalar value (the value only) or with Dual (the value plus its
exact partial derivatives with respect to the constraint’s own
variables). A constraint touches only a handful of variables, so a dual
number carries a small fixed-size gradient rather than one entry per
sketch variable.
Building Dual over an interval Scalar rather than a bare f64
means a residual’s value is a rigorous enclosure of the true real number
it stands for, not a float that silently absorbs whatever rounding sin,
sqrt or PI introduced along the way — the sketch solver’s own
uncertainty about an irrational quantity shows up as interval width
instead of vanishing.
Structs§
- Dual
- A value together with its gradient with respect to up to
MAX_LOCAL_VARSseeded variables.
Constants§
- MAX_
LOCAL_ VARS - The most variables a single constraint may depend on. The largest constraints (tangency or equality between two arcs) touch two arcs of five variables each.