Swift

NumKong for Swift

.package(url: "https://github.com/ashvardanian/NumKong.git", from: "7.0") 8.0.0-rc.1 · b1f866ab

NumKong provides hardware-accelerated vector math for Swift without pulling in a full tensor framework. It gives you collection-based dense metrics, binary set distances, owning tensors, explicit matrix views, reusable packed matrices, symmetric all-pairs kernels, MaxSim late-interaction scoring, geospatial distance helpers, and storage wrappers for low-precision formats that Swift does not model natively.

Swift users usually want one of two things. They either want ergonomic collection-based scalar metrics. Or they want a compact matrix API for repeated retrieval-style workloads. This package targets those two cases directly instead of pretending to be a full tensor framework.

Topics

Installation
Quickstart6
HighlightsCollection-first scalar API.
Scalar Types137The output type is intentionally wider than the storage type for most operations.
Tensors and Views44Tensor<T> is the owning two-dimensional type.
Dot Products3Dot products follow a collection-first shape.
Dense Distances10The collection extensions are the lightest entry point.
Set Similarity6Binary metrics work on packed words instead of boolean slices.
Geospatial Metrics6The Swift geospatial helpers operate on four coordinate arrays, two per point set.
Matrix Kernels24Packed kernels are the GEMM-like throughput path.
MaxSim9MaxSim is the late-interaction primitive used by systems such as ColBERT.
Runtime Dispatch67