Expand description
§Chapter 12.0.3 — Comparisons
§Purpose
The rule of Chapter 5.C of xingo-sparse holds here too: every
comparison of scalar values goes through the helpers of this module,
and every threshold lives in an options struct (crate::CholOptions,
crate::QrOptions) — never a literal in a kernel (D-0088). The
helpers of Chapter 5.6 are pub(crate) in xingo-sparse, so this is a
private copy with the same definitions (D-0127, §3), restricted to the
ones this crate uses.
§Notation
For finite a, b and ε ≥ 0, s(a, b) = max(1, |a|, |b|):
lt(a, b)—a < bexactly, writtenb − a > 0·s(a, b)for finite values anda < botherwise (Tolerances::lt(a, b, 0.0));le_exact(a, b)—a ≤ bexactly, without the scale;is_exact_zero(x)—x = 0(or−0): a structural test;is_nan(x)—x ≠ x.
§Invariant
(C1) No helper is called with NaN except is_nan (debug builds assert
it): the public functions reject non-finite input first.
§References
Chapter 5.6 of xingo-sparse (real.rs), whose definitions these are.
Functions§
- is_
exact_ 🔒zero x = 0exactly (or−0): a structural test.- is_nan 🔒
xis NaN (it is not equal to itself).- le_
exact 🔒 a ≤ bexactly, without the scale.- lt 🔒
a < bexactly (Tolerances::lt(a, b, 0.0)).- scale 🔒
- The scale
s(a, b) = max(1, |a|, |b|).