adaptive_card

Function adaptive_card 

Source
pub fn adaptive_card(
    curve: &HoldCurve,
    req: &AdaptiveRequest<'_>,
    unit: CardAdjustmentUnit,
) -> Result<AdaptiveCardReportV1, CardError>
Expand description

Build an adaptive range card and measure what it is worth.

Greedy worst-point insertion: start from the domain ends plus every anchor, then repeatedly add the single audited point whose linearly-interpolated printed value is furthest outside budget, until nothing violates, the row cap binds, or the remaining error is irreducible. A SEPARATE dense pass over the declared grid then measures the finished card, and budget_met comes from that measurement.

Everything is measured in printed-value space – the same zero-set bias, tracking correction and click quantization the rows carry – so the reported error is the error a shooter interpolating the printed card actually makes.

§What this does and does not buy you

It buys a MEASURED error bound, guaranteed anchors, and no step to guess. It does not reliably buy a shorter card than a well-chosen fixed step: a single insertion can at best quarter an interval’s error (a bisection), so on a trajectory whose curvature barely varies the whole card doubles at once while a uniform card may pick any row count. See fixed_step_comparison_is_measured_not_assumed for the measurements.

§Errors

Returns CardError for an inverted or non-positive domain, an anchor outside it, a non-positive budget, a zero row cap, a domain running past the curve’s last sample, or a tracking correction factor outside the locked (0.5, 1.5) band. Every one of these is checked before any work is done, on every build profile – a caller cannot reach the solver with a request that would produce a confidently wrong card.