Skip to main content

Module real

Module real 

Source
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 < b exactly, written b − a > 0·s(a, b) for finite values and a < b otherwise (Tolerances::lt(a, b, 0.0));
  • le_exact(a, b) — a ≤ b exactly, 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 = 0 exactly (or −0): a structural test.
is_nan 🔒
x is NaN (it is not equal to itself).
le_exact 🔒
a ≤ b exactly, without the scale.
lt 🔒
a < b exactly (Tolerances::lt(a, b, 0.0)).
scale 🔒
The scale s(a, b) = max(1, |a|, |b|).