code wiki / _hdl_build / nx_bd_calc_gate.nx

nx_bd_calc_gate.nx

buildroot/runtime/_hdl_build/nx_bd_calc_gate.nx

6803 B122 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_bd_calc_gate.nx -- known-answer gate for the sovereign BD organ (2026-07-29). THE DOCTRINE INVERSION: the python cubic Bjontegaard (numpy polyfit) is now the ORACLE inside this gate and nothing else -- the lane instrument is nx_bd_calc (sovereign f64 PWL). Oracle values below were generated 2026-07-29 from the BANKED 4-seq curves (bd_rdoq.txt PRE vs bd_lam.txt LAM4 @2593, kbps_milli = total*5 exactly, psnr_milli from sseY/npix): foreman -148.4 akiyo -101.9 bus -28.8 mobile -12.9 permille. MEASURED estimator delta PWL-vs-cubic on these pairs: max 2.1 permille => TOLERANCE = +/-5 permille (derived from measurement + margin, never taste). Teeth: T1-T4 the four oracle pairs in-band; T5 identity == 0 exactly; T6 reverse comparison equals the EXACT algebraic inverse 1/(1+bd)-1 within +/-2 permille (self-consistency, catches sign bugs). The organ is forked as the INSTALLED artifact (_offc) -- the gate tests the shipped path. license: ORIGINAL

dependencies 1 imports · 0 importers

nx_tool_run.nx nx_bd_calc_gate.nx

imports: nx_tool_run.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main gw wpts sys_openat_wr wnum run_bd tr_run_capture sys_mmap sys_pipe2 sys_fork sys_close sys_dup3 sys_execve_clean sys_close ↻ sys_execve sys_exit sys_read sys_wait4 wait_exit_code chk gw ↻ gn gn ↻

structs

none

consts

14const BDG_TOL: i64 = 5
15const BDG_TOL_INV: i64 = 2

functions

17func gw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 2: chkmain
18func gn(v: i64) -> i64
called by 2: chkmain
23func wnum(fd: i64, v: i64) -> i64
called by 1: wpts
29func wpts(path: *u8, km: *i64, pm: *i64, n: i64) -> i64
called by 1: main calls 2: sys_openat_wrwnum
38func run_bd(a: *u8, t: *u8) -> i64
called by 1: main calls 1: tr_run_capture
65func chk(name: *u8, got: i64, want: i64, tol: i64, pass: *i64, fail: *i64) -> i64
called by 1: main calls 2: gwgn
73func main() -> i64