{"library":"sparse-dot-topn","title":"Sparse Dot Top-N","type":"library","description":"sparse-dot-topn is a Python package designed to accelerate sparse matrix multiplication followed by the selection of the top-N results. It significantly reduces memory footprint and improves performance for operations common in tasks like large-scale string comparison and entity matching. Developed by ING Wholesale Banking Advanced Analytics, it is currently at version 1.2.0 and receives regular updates with a focus on performance and Python version compatibility.","language":"python","status":"active","last_verified":"Mon May 18","install":{"commands":["pip install sparse-dot-topn"],"cli":null},"imports":["from sparse_dot_topn import sp_matmul_topn","from sparse_dot_topn import sp_matmul","from sparse_dot_topn import zip_sp_matmul_topn"],"auth":{"required":false,"env_vars":[]},"links":{"homepage":null,"github":"https://github.com/ing-bank/sparse_dot_topn","docs":null,"changelog":null,"pypi":"https://pypi.org/project/sparse-dot-topn/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null},"quickstart":{"code":"import scipy.sparse as sparse\nfrom sparse_dot_topn import sp_matmul_topn\nimport numpy as np\n\n# Create two sample sparse matrices (CSR format is recommended for performance)\nA = sparse.random(1000, 100, density=0.1, format=\"csr\", random_state=42)\nB = sparse.random(100, 2000, density=0.1, format=\"csr\", random_state=42)\n\n# Compute C = A * B and retain the top 10 values per row in C\n# sp_matmul_topn also supports `n_threads` for parallel execution\nC = sp_matmul_topn(A, B, top_n=10, n_threads=None, threshold=0.0)\n\nprint(f\"Shape of A: {A.shape}\")\nprint(f\"Shape of B: {B.shape}\")\nprint(f\"Shape of result C: {C.shape}\")\nprint(f\"Number of non-zero elements in C: {C.nnz}\")\n# print(C)","lang":"python","description":"This example demonstrates how to perform a sparse matrix multiplication with top-N result selection using `sp_matmul_topn`. It creates two random CSR sparse matrices and computes their product, keeping only the top 10 values for each row in the result matrix. Ensure `scipy` and `numpy` are installed.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-18","installed_version":"1.2.0","pypi_latest":"1.2.0","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":50,"avg_install_s":7.5,"avg_import_s":0.98,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"sparse-dot-topn","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"sparse-dot-topn","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":7.4,"import_time_s":0.73,"mem_mb":23.4,"disk_size":"223M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"sparse-dot-topn","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"sparse-dot-topn","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":7,"import_time_s":1.06,"mem_mb":26.5,"disk_size":"237M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"sparse-dot-topn","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"sparse-dot-topn","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":7.2,"import_time_s":1.14,"mem_mb":25.8,"disk_size":"223M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"sparse-dot-topn","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"sparse-dot-topn","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":7.5,"import_time_s":1.12,"mem_mb":26.2,"disk_size":"221M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"sparse-dot-topn","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"sparse-dot-topn","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":8.3,"import_time_s":0.84,"mem_mb":19.3,"disk_size":"231M"}]}}