# Highlights

> NumKong for Python

### Ecosystem Comparison

| Feature                         | NumKong                                                                                                                      | [NumPy][numpy]/[SciPy][scipy]                                          | [PyTorch][pytorch]                                                          |
| :------------------------------ | :--------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------- | :-------------------------------------------------------------------------- |
| Operation families              | dots, distances, binary, probability, geospatial, curved, shapes, sparse, MaxSim, elementwise, reductions, cast, trig        | dots, distances, elementwise, reductions, some probability via `cdist` | dots, distances, elementwise, reductions                                    |
| Precision                       | BFloat16 through sub-byte — Float8, Float6, Int4, packed bits; automatic widening; Kahan summation; 0 ULP in Float32/Float64 | Float16, partial BFloat16; no auto-widening; standard accuracy         | Float16, BFloat16, partial Float8; explicit AMP required; standard accuracy |
| Runtime SIMD dispatch           | picks the best ISA per call, from a capability mask, at runtime on x86, ARM, RISC-V                                          | runtime, among a few compiled targets per loop                         | CPU: compile-time; CUDA: runtime                                            |
| Packed matrix, GEMM-like        | pack once, reuse across query batches                                                                                        | `np.dot`/`@` — no persistent packing                                   | `torch.mm` — no persistent distance-oriented packing                        |
| Symmetric kernels, SYRK-like    | skip duplicate pairs, up to 2x speedup for self-distance                                                                     | `pdist` computes one triangle; `cdist` recomputes both                 | `X @ X.T` recomputes both triangles                                         |
| Output parameter `out=`         | Yes — all major entrypoints                                                                                                  | Yes — most `ufunc`s and functions; SciPy: some functions only          | Yes for `torch.mm`, `torch.matmul`; No for `torch.cdist`                    |
| Fast CPython calling convention | Yes — direct `METH_FASTCALL`                                                                                                 | Yes — `vectorcall` in 2.0+                                             | No — tensor dispatch overhead                                               |
| GIL release                     | batched, packed, and symmetric kernels                                                                                       | some ops only                                                          | most ops                                                                    |

[numpy]: https://github.com/numpy/numpy
[scipy]: https://github.com/scipy/scipy
[pytorch]: https://github.com/pytorch/pytorch

