code wiki / (root) / nx_identity_space_lib.nx

nx_identity_space_lib.nx

buildroot/runtime/nx_identity_space_lib.nx

8891 B175 linesdepth 7pulls 12 transitivereach 1 importersview sourcekind librarytopic identity
docsdependenciesstructsconstsfunctions

about

nx_identity_space_lib.nx -- THE CORRELATED IDENTITY DRAW (graphics GR24), as a pure core a gate can drive. WHY THIS IS THE AXIS A FINITE ASSET LIBRARY CANNOT ENTER. The rival position, measured and quoted on the board: VR HOT ships roughly 15-20 hand-picked skins accumulated over five years on a FIXED LICENSED TOPOLOGY, so their identity space is bounded by what one marketplace authored; Infinigen has no humans at all. Ours is a seed. But a seed is only worth more than a library if the draw is CORRELATED -- independent per-channel sampling produces an implausible combination of plausible parts, which is precisely why a naively generated face reads as generated. THE MECHANISM: x = mu + L z, where L is the Cholesky factor of the target covariance and z is a vector of independent standard normals. That is the whole of it, and the only hard part is the factor, which is why GR47 had to land first. THIS LIB COMPOSES la_cholesky_q30 AND CONTAINS NO SECOND DECOMPOSITION -- the rung's own words, "one ruler, never a second decomposition". WHY IRWIN-HALL AND NOT BOX-MULLER, WHICH IS THE OBVIOUS CHOICE. Box-Muller needs a log and a cosine, both of which nx_fixq30_lib has, and it produces UNBOUNDED tails. An identity parameter is not unbounded: a face eight sigma from the mean is not a face, so a Box-Muller draw would have to be clamped -- and clamping a Gaussian DISTORTS THE VERY COVARIANCE THE FACTOR WAS BUILT TO REPRODUCE. The sum of twelve uniforms minus six has mean 0 and variance EXACTLY 1 (each uniform contributes 1/12), needs no transcendental function, and has hard support at +/-6 sigma. The bound is the feature, not a concession. SPLIT STREAMS ARE CLAUSE 2 AND THEY ARE SATISFIED BY CONSTRUCTION, NOT BY CARE. Every axis draws from its OWN stream, seeded by splitmix over (seed, axis index). Axis j's numbers therefore do not depend on how many axes exist, so ADDING A PARAMETER NEVER RESHUFFLES EXISTING GENOMES. A single shared stream would make every genome in the population change the day someone appends a sixth master parameter -- the whole back catalogue silently rewritten by an additive change. * A DRAW THAT IS REPRODUCIBLE ONLY WHILE THE PARAMETER LIST IS FROZEN IS NOT REPRODUCIBLE. UPSTREAM DEFECT THIS LIB ROUTES AROUND AND DOES NOT FIX: nx_random's rotl and splitmix carry sign-extension mask bugs (see the devguardrails journal), so the underlying stream is measurably biased. This lib reads the HIGH bits to avoid the weakest ones, and its gate asserts only what GR24 requires -- determinism, split streams, covariance recovery -- because those survive a biased-but-deterministic z. Altering a PRNG rewrites every stream in the estate, so that fix belongs to whoever owns nx_random. license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 3 imports · 1 importers

nx_syscalls.nx nx_random.nx nx_linalg.nx nx_identity_space_lib.nx nx_identity_space_gate.nx

imports: nx_syscalls.nxnx_random.nxnx_linalg.nx

imported by: nx_identity_space_gate.nx

structs

none

consts

39const IS_UNIFORMS: i64 = 12 // Irwin-Hall order: 12 uniforms give variance exactly 1
40const IS_IH_MEAN: i64 = 6 // ...and mean exactly 6, so subtracting 6 centres it
41const IS_AXIS_ODD: i64 = 0x9E3779B97F4A7C15 // golden-ratio odd constant: decorrelates adjacent axis seeds
42const IS_MAX_AXES: i64 = 32 // matches LA_CHOL_MAX_N; the factor is the binding constraint
43const IS_HIGH_SHIFT: i64 = 33 // |x| spans 63 bits; >> 33 leaves the TOP 30, discarding the weak low ones
45const IS_OK: i64 = 0
46const IS_BAD_DIM: i64 = 1
47const IS_BAD_FACTOR: i64 = 2 // the supplied L is not the shape the covariance implies

functions

51func is_stream_seed(seed: i64, axis: i64) -> i64
called by 2: mainis_draw calls 2: sys_mmapnx_rng_splitmix
66func is_uniform_q30(r: *NxRng) -> i64
called by 1: is_normal_q30 calls 1: nx_rng_next
73func is_normal_q30(r: *NxRng) -> i64
called by 2: mainis_draw calls 1: is_uniform_q30
83func is_draw(seed: i64, n: i64, mu: *i64, l: *Mat, out: *i64) -> i64
114func is_empirical_cov(seed0: i64, m: i64, n: i64, mu: *i64, l: *Mat, cov: *Mat) -> i64
159func is_cov_maxdiff_q30(a: *Mat, b: *Mat) -> i64
calls 1: nx_mat_get