Skip to main content

Module bisect

Module bisect 

Source
Expand description

Bisection of a bracket on which side of a crossing its middle lies — in plain numbers, where where-exactly is a free choice found as far as f64 goes, or in sharp scalars, where the side is told by an interval test that may not decide — and the scan of samples that finds the brackets: every pair of neighbouring samples on different sides.

Structs§

Bracket
Where a bisection ended: its bracket, and the middle whose side could not be told, if that is what stopped it.
Crossings
The brackets of a SignChanges scan, bisected: see SignChanges::bisected.
SignChanges
Neighbouring samples on different sides: see sign_changes.

Traits§

Bisect
A value a bracket can be bisected in.

Functions§

bisect
Bisects (lo, hi) at most steps times. side(mid) says whether the middle lies on lo’s side (Some(true), it becomes lo), on hi’s (Some(false)), or cannot be told (None, which stops the bisection). With until_collapsed, it also stops once the middle no longer lies strictly inside the bracket. side may keep state of its own — a seed carried from one middle to the next — since every step asks it once.
sign_changes
The pairs of neighbouring samples of samples that side puts on different sides, in order, each with the side of its first: brackets of a crossing. side says which side a sample lies on (< cut against <= 0, a sign of a number or of an interval: the caller’s choice), or None where it cannot tell; such a sample is passed over, its neighbours paired across it. Lazy: a scan for the first crossing asks no sample past it. SignChanges::bisected bisects each bracket.