Python

NumKong for Python

python -m pip install numkong 8.0.0-rc.1 · b1f866ab

It combines NumPy-friendly buffers with native mixed-precision kernels, zero-copy tensor views, packed and symmetric matrix operations, sparse helpers, many-to-many shape distances, and MaxSim. The API feels NumPy-shaped with familiar scalar, batched, and all-pairs entrypoints, while Tensor keeps shape, dtype, and strides visible through a memoryview-backed container. Low-precision dtypes (BFloat16, Float8, Float6, packed bits) flow through the same API, and dense, packed, and symmetric kernels release the GIL around native work.

Topics

Installation
Quickstart
Highlights
Scalar Types6NumKong exposes two different low-precision stories in Python.
Tensors and Views65Tensor is a memoryview-backed object with NumPy-like metadata.
Dot Products3Dot products are their own family because storage type, conjugation rules, and output widening matter.
Dense Distances4The dense distance entrypoints cover sqeuclidean, euclidean, and angular.
Set Similarity2Packed-binary metrics operate on packed bits.
Probability Metrics5Probability divergences deserve their own section because they are not just "one more distance".
Geospatial Metrics16Geospatial kernels score every row point against every column point into a [rows, columns] matrix.
Curved Metrics2Curved-space kernels use an extra metric tensor or inverse covariance and should not be mixed into the Euclidean section.
Elementwise and Reductions19Elementwise arithmetic and fused operations are their own family.
Sparse Operations2Sparse helpers cover both sorted-index intersections and weighted sparse dot products.
Matrix Kernels33Packed matrix kernels are the right tool when the right-hand side is reused across many query batches.
MaxSim11MaxSim is the late-interaction primitive used by systems such as ColBERT.
Mesh Alignment27Point clouds are packed once each, centered on their centroids and rotated onto their principal axes.
Runtime Dispatch24
Parallelism
External MemoryNumKong implements the Python buffer protocol for zero-copy interop with NumPy, PyTorch, and other buffer-aware libraries.