ashvardanian/NumKong
FreeSIMD-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 📐
About ashvardanian/NumKong
NumKong is a portable mixed-precision math, linear algebra, and retrieval library featuring over 2,000 SIMD kernels for x86, Arm, RISC-V, LoongArch, Power, and WebAssembly. It covers 15+ numeric types from 4-bit integers and 6-bit floats to 128-bit complex numbers, and is validated against 118-bit extended-precision baselines. The library leverages rare algebraic transforms with both 1D and 2D registers like AMX and SME, and is co-designed with Tensor abstractions in C++, Python, Rust, JavaScript, GoLang, and Swift. Unlike typical BLAS libraries, NumKong promotes to wider accumulators to prevent overflow and achieves a 5–100x smaller binary footprint while delivering high throughput (e.g., 14.8 gso/s for i8 dot products on Intel Sapphire Rapids).
Key Features
Pros & Cons
- High performance (up to 14.8 gso/s for i8 dot product on Sapphire Rapids)
- Wide range of supported numeric types
- Portable across multiple CPU architectures
- Open source and free
- Small binary footprint (5–100x smaller than alternatives)
- Numerical accuracy ensured by promotion and validation