FrankenNumPy

Docs/Evidence

Divergence Ledger

Behavioral differences vs upstream NumPy that we accept either intentionally or as tracked parity debt live in docs/DIVERGENCES.md. The ledger is machine-readable: a diagnostic case can only be marked intentional_divergence when it references a row here.

Current state (2026-10-08): 9 active rows, one ledger — seven intentional (four of them Hardened-mode only) and two upstream defects fnp declines to copy. The former second ledger, crates/fnp-conformance/DISCREPANCIES.md, was merged in; each of its twelve entries was re-probed at the Python surface and none is an active NumPy divergence (the resolution notes in docs/DIVERGENCES.md give the evidence per entry).

ID Disposition Surface Behavior
DIV-HARDENED-LINALG-NONFINITE intentional linalg decompositions and solvers, Hardened mode only inf/NaN operands raise LinAlgError; Strict matches NumPy
DIV-HARDENED-ADMISSION-CAP intentional creation routines (empty, zeros, full, arange, eye, repeat, tile, ...), Hardened mode only one array above the admission cap (4 GiB default, FNP_HARDENED_MAX_ARRAY_BYTES) raises MemoryError before allocating; Strict matches NumPy
DIV-HARDENED-LOAD-BOUNDS intentional load of .npy / .npz, path or file-like, Hardened mode only a file violating an fnp-io bound raises ValueError before NumPy reads it; Strict matches NumPy
DIV-HARDENED-SPAWN-BUDGET intentional random SeedSequence.spawn and bit-generator spawn, Hardened mode only more than 4096 children per call raises ValueError; Strict spawns as NumPy does
DIV-COV-GRAM-NO-FMA intentional cov / corrcoef native Gram path, engaged only on the shapes where it beats NumPy (every other shape returns NumPy's bytes) last-bit differences from NumPy's FMA-contracted BLAS result: within 1e-12 relative per entry below 256 variables, within 1e-12 of sqrt(c_ii * c_jj) from 256
DIV-BATCHED-LINALG-NO-LAPACK intentional finite float64 stacks of inv, solve, eigvalsh, cholesky (n <= 3), pinv, svdvals, cond, matrix_rank and the 2 / -2 / 'nuc' norms, inside their win gates last-bit differences from NumPy's per-lane LAPACK within norm-wise bounds (C * cond2 * k * eps scaled, or C * k * eps * norm2(A)); ranks may differ near the tolerance
DIV-EINSUM-FLOAT-NO-FMA intentional float64 einsum contractions with optimize=False within 1e-12 of NumPy's FMA-contracted einsum loops; all other products (float32 and complex einsum included) byte-identical
UD-F16-SORT-X86SIMDSORT upstream_drift float16 sort / unique fnp sorts correctly where numpy 2.3.x's AVX-512 fp16 qsort does not
UD-LEGACY-ZIPF-LARGE-A upstream_drift random.RandomState.zipf with a >= 1025 fnp returns 1 for such entries, as NumPy's modern random_zipf does; NumPy's legacy kernel never returns there

No-seed RNG constructors source OS entropy via getrandom, matching NumPy.

The ledger gate runs in CI G2 as repository_markers_and_ledger_rows_agree (crates/fnp-conformance/src/divergence_ledger.rs). It fails when an ignored test or ExpectedFail that tolerates a NumPy divergence cites no live row, when an #[ignore] has no reason, or when a row's path.rs::test_fn probe no longer exists. The same audit prints from:

cargo run -p fnp-conformance --bin run_divergence_ledger -- --fail-on-missing

This section in the README on GitHub