code wiki / (root) / nx_vec_min.nx

nx_vec_min.nx source

↩ module page · 28 lines · 885 B

1// nx_vec_min.nx -- AUTO-GENERATED from shape `pairwise_array_op`. 2// Imperative body has access to av = a[i], bv = b[i], i, n, out. 3// Body MUST assign to out[i]. Supports branching / multi-statement. 4// 5// genealogy_id: 6// lineage_id: pairwise_array 7// license: public_domain 8// complexity: O(n) 9 10// nx_safety_envelope: 11// intended_use: AUTO_APPLIED -- primitive-specific tuning queued 12// sil_target: SIL1 13// evidence: [bulk_applied_2026-05-16, see-file-comment-for-detail] 14// verdict: NOT_YET_EVALUATED 15 16import "nx_syscalls.nx" 17import "nx_tier.nx" 18 19func nx_vec_min(a: *nx_int, b: *nx_int, out: *nx_int, n: nx_idx) -> nx_int { 20 var i: nx_idx = 0 21 while i < n { 22 let av: nx_int = a[i] 23 let bv: nx_int = b[i] 24 if av <= bv { out[i] = av } if bv < av { out[i] = bv } 25 i = i + 1 26 } 27 return 0 28}