{"repo":"ashvardanian/NumKong","free":true,"listed":false,"github":"https://github.com/ashvardanian/NumKong","clone":"git clone https://github.com/ashvardanian/NumKong.git","description":"SIMD-accelerated distances, dot products, matrix ops, geospatial & geometric kernels for 16 numeric types — from 6-bit floats to 64-bit complex — across x86, Arm, RISC-V, and WASM, with bindings for Python, Rust, C, C++, Swift, JS, and Go 📐","language":"C","stars":1874,"topics":["arm-neon","assembly","metrics","simd","information-retrieval","numpy","scipy","vector-search","blas","matrix-multiplication"],"license":"Apache-2.0","category":"analytics","readme_excerpt":"NumKong: Mixed Precision for All Portable mixed-precision math, linear-algebra, & retrieval library with 2'000+ SIMD kernels for x86, Arm, RISC-V, LoongArch, Power, & WebAssembly, leveraging rare algebraic transforms with both 1D & 2D registers like AMX & SME, covering 15+ numeric types from 4-bit integers & 6-bit floats to 128-bit complex numbers, validated against 118-bit extended-precision baselines with saturation, casting, & rounding edge-case coverage, in a 5-100x smaller binary than other BLAS-like alternatives, co-designed with Tensor abstractions in C++, Python, Rust, JavaScript, GoLang, & Swift. Latency, Throughput, & Numerical Stability Most libraries return dot products in the same type as the input — Float16 × Float16 → Float16, Int8 × Int8 → Int8. This leads to quiet overflow: a 2048-dimensional i8 dot product can reach ±10 million, but i8 maxes out at 127. NumKong promotes to wider accumulators — Float16 → Float32, BFloat16 → Float32, Int8 → Int32, Float32 → Float64 — so results stay in range. Input NumPy + OpenBLAS PyTorch + MKL JAX NumKong :----- -------------------: -------------------: -------------------: --------------------: ░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░ f64 2.0 gso/s, 1e-15 err 0.6 gso/s, 1e-15 err 0.4 gso/s, 1e-14 err 5.8 gso/s, 1e-16 err f32 1.5 gso/s, 2e-6 err 0.6 gso/s, 2e-6 err 0.4 gso/s, 5e-6 err 7.1 gso/s, 2e-7 err bf16 — 0.5 gso/s, 1.9% err 0.5 gso/s, 1.9% err 9.7 gso/s, 1.8% err f16 0.2 gso/s, 0.25% err 0.5 gso/s, ","default_branch":null,"files":null,"tree":[],"storefront":"/r/ashvardanian","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/ashvardanian/NumKong/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}