code wiki / (root) / nx_sketch_types.nx

nx_sketch_types.nx

buildroot/runtime/nx_sketch_types.nx

3610 B91 linesdepth 2pulls 2 transitivereach 97 importersview sourcekind sketch/demotopic sketch
docsdependenciesstructsconstsfunctions

about

sketch_types.nx -- L-4 typed envelope scaffold for streaming sketches. Lossless-language discipline (per nishi-engine docs 17 + 20): every approximate primitive in the substrate ships its loss NAMED, BOUNDED, and QUERYABLE. Sketches are bounded-loss, not silent-loss. Mirrors nishi-engine/packages/core-sketch/src/types.ts so the TS reference layer and the NishiLang sovereign sibling carry identical envelope semantics. All-i64 representation (no f64 source-level types) for C-anchor compatibility. Floating-point quantities (stddev, eps, conf) are stored as fixed-point integers scaled by 10^9 (parts-per- billion). Caller decodes by dividing by 1_000_000_000. stddev_rel = 0.0162 -> stddev_rel_ppb = 16_200_000 conf = 0.6827 -> conf_ppb = 682_700_000

dependencies 1 imports · 54 importers

nx_syscalls.nx nx_sketch_types.nx nx_bench_hll_vs_cpc.nx nx_bench_hll_vs_cpcd.nx nx_sketch_ams.nx nx_sketch_bit_vector.nx nx_sketch_bloom.nx nx_sketch_buglog.nx nx_sketch_cms.nx nx_sketch_comparator.nx nx_sketch_correlation.nx nx_sketch_count_sketch.nx

diagram shows first 10 each side; +0 more imports, +44 more importers in the complete lists below.

imports: nx_syscalls.nx

imported by: nx_bench_hll_vs_cpc.nxnx_bench_hll_vs_cpcd.nxnx_sketch_ams.nxnx_sketch_bit_vector.nxnx_sketch_bloom.nxnx_sketch_buglog.nxnx_sketch_cms.nxnx_sketch_comparator.nxnx_sketch_correlation.nxnx_sketch_count_sketch.nxnx_sketch_counting_bloom.nxnx_sketch_cpc.nxnx_sketch_cpc_dense.nxnx_sketch_cuckoo.nxnx_sketch_cusum.nxnx_sketch_ddsketch.nxnx_sketch_entropy.nxnx_sketch_epsilon_greedy.nxnx_sketch_ewma.nxnx_sketch_geomean.nxnx_sketch_hash_map.nxnx_sketch_histogram.nxnx_sketch_hll.nxnx_sketch_hll4.nxnx_sketch_hll_packed.nxnx_sketch_hll_provenance.nxnx_sketch_hll_provenance_v2.nxnx_sketch_hllmap.nxnx_sketch_holt.nxnx_sketch_kll.nxnx_sketch_kmeans1d.nxnx_sketch_kmv.nxnx_sketch_linear_counter.nxnx_sketch_lossy_counting.nxnx_sketch_mann_kendall.nxnx_sketch_markov.nxnx_sketch_min_heap.nxnx_sketch_misra_gries.nxnx_sketch_moments.nxnx_sketch_naive_bayes.nxnx_sketch_reservoir.nxnx_sketch_robust_hll.nxnx_sketch_segment_tree.nxnx_sketch_sliding_window.nxnx_sketch_space_saving.nxnx_sketch_stream_stats.nxnx_sketch_tdigest.nxnx_sketch_theta.nxnx_sketch_tuple.nxnx_sketch_types_kat.nxnx_sketch_ucb1.nxnx_sketch_union_find.nxnx_sketch_varopt.nxnx_sketch_zscore.nx

structs

70struct ApproxI64

consts

26const NX_MAGIC_682700000: i64 = 682700000
27const NX_MAGIC_6827: i64 = 6827
36const NX_MATURITY_THEORETICAL: i64 = 0
37const NX_MATURITY_REFERENCE_IMPL: i64 = 1
38const NX_MATURITY_PRODUCTION: i64 = 2
46const NX_ADV_HONEST: i64 = 0
47const NX_ADV_ADVERSARIAL: i64 = 1
60const NX_ENV_REL_STDDEV: i64 = 0
61const NX_ENV_RANK_ERROR: i64 = 1
62const NX_ENV_ABS: i64 = 2

functions

80func nx_approx_new(value: i64, envelope_kind: i64, param_a: i64,