Quadratic In-Step Range
QuadraticInStepRangeFunction is a closed-interval gate, not a floor or step-rounding operation. For a quadratic polynomial
The undefined bands make the continuous-domain boundary contract explicit: strict complements cannot be encoded exactly by finitely many non-strict inequalities. Both implementations create three mutually exclusive binary indicators
The one-hot partition forces the inside branch throughout
API
val p = QuadraticPolynomial(
monomials = listOf(QuadraticMonomial.quadratic(Flt64.one, x, x)),
constant = Flt64.zero
)
val f = QuadraticInStepRangeFunction(
x = p,
lower = Flt64.zero,
upper = Flt64(4.0),
bigM = Flt64(100.0),
outsideTolerance = Flt64(1e-6),
converter = IntoValue.Identity,
name = "square_gate"
)let p = Quadratic::new(
vec![QuadraticMonomial::new_quadratic(1.0, x_index, x_index)],
0.0,
);
let f = QuadraticInStepRangeFunction::with_parameters(
11, "square_gate", p, 0.0, 4.0, 100.0, 1e-6,
);The old Rust step-floor constructor and with_quadratic_bounds API were removed. A separate floor function should be used when the mathematical operation is
Evaluation and registration
Evaluation returns the input on the closed interval, zero beyond the exterior tolerance, and null/None in either undefined tolerance band. Registration adds three binary indicators and the signed result helper, then emits nine rows. A linear input is emitted through the linear mechanism model; a quadratic input is emitted through the quadratic mechanism model.
Tests and source
- Kotlin source:
QuadraticInStepRange.kt - Rust source:
quadratic_in_step_range.rs - Kotlin independent tests:
QuadraticInStepRangeFunctionDedicatedTest.ktandQuadraticFunctionGenericEvaluationTest.kt - Rust independent test:
function_symbol_quadratic_in_step_range.rs