ing-bank/sparse_dot_topn

Python package to accelerate the sparse matrix multiplication and top-n similarity selection

What it solves

sparse_dot_topn solves the computational and memory bottlenecks of multiplying very large sparse matrices and picking the top-n results per row, a common requirement when comparing massive feature vectors.

How it works

It provides a parallelised C++ extension that combines sparse matrix multiplication with top-n value selection into a single routine. By utilizing a max-heap internally and supporting multi-threading, it lowers memory overhead and improves processing speed compared to standard approaches.

Who it’s for

It is designed for data scientists and developers working with large sparse matrices in Python who need faster similarity matching or vector comparisons.

Highlights

  • Speeds up matrix multiplication and top-n selection by up to 6 times on large datasets
  • Supports parallel execution using multiple threads via integrated OpenMP
  • Provides options for thresholding, matrix density estimation, and sorting
  • Allows scaling to extremely large O(10M+) sparse matrices by splitting and distributing chunks across a cluster

Related

  • Project
  • Project
  • Project
  • Project
  • Project