Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

mlx-sparse

PyPI License Documentation Status codecov

mlx-sparse is an attempt at an MLX-native sparse array package. The public API is Python, while performance-critical operations are implemented as MLX primitives in C++ with CPU backends and Metal kernels for fixed-shape sparse operations.

The supported format surface is COO, CSR, and CSC for 2D sparse arrays. Current functionality includes construction, validation, format conversions, canonicalization, sparse-dense products, batched dense RHS products, sparse-sparse products, transpose, and Hermitian transpose. mlx-sparse also supports sparse linalg solvers (cg, bicgstab, gmres, minres), reusable direct solves (factorized), sparse spectral routines (eigsh, eigs, svds), sparse Cholesky/LU factors, sparse triangular solves, sparse dot/vdot, and autodiff through sparse values and dense RHS operands, including complex64.

Supported value dtypes are float32, float16, bfloat16, and complex64. Supported index dtypes are int32 and int64 on CPU and GPU.

Quick Start

Install from PyPI:

python -m pip install mlx-sparse

Published macOS wheels are built with optional Apple Accelerate sparse direct solver support enabled. Published Linux wheels are CPU-only. For editable/source macOS builds, enable the same Accelerate path with:

CMAKE_ARGS="-DMLX_SPARSE_ENABLE_ACCELERATE=ON" python -m pip install -e .

See the full installation guide for platform requirements, feature gates, and verification commands.

import mlx.core as mx
import numpy as np

import mlx_sparse as ms

ms.use_cpu()

data = [2.0, -1.0, 4.0]
row = [0, 0, 1]
col = [0, 2, 1]

a = ms.coo_array((data, (row, col)), shape=(2, 3)).tocsr(canonical=True)
x = mx.array(np.array([3.0, 10.0, 7.0], dtype=np.float32))

y = a @ x
dense = a.todense()
at = a.T

b = mx.array(np.array([1.0, 2.0], dtype=np.float32))
spd = ms.csr_array(
    (
        [4.0, 1.0, 1.0, 3.0],
        [0, 1, 0, 1],
        [0, 2, 4],
    ),
    shape=(2, 2),
    canonical=True,
)
solution, info = ms.linalg.cg(spd, b)
factor = ms.linalg.sparse_cholesky(spd)

The package build compiles src/sparse/*.metal into mlx_sparse/mlx_sparse.metallib when the macOS Metal toolchain is available, and macOS wheels ship that metallib beside the Python package. Linux wheels do not build or ship Metal assets.

Development

For contributors, use an editable install from the repository root. This builds the native extension and installs the development tooling.

python -m pip install -e ".[dev]"

License

This package is licensed under the Apache License 2.0.

Metadata

Release files for mlx-sparse 0.0.6b0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mlx-sparse 0.0.6b0
File Size Uploaded
mlx_sparse-0.0.6b0.tar.gz 1.1 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for mlx-sparse 0.0.6b0
File
mlx_sparse-0.0.6b0-cp313-cp313-manylinux_2_35_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.35+ x86-64 Details
mlx_sparse-0.0.6b0-cp313-cp313-macosx_14_0_arm64.whl CPython 3.13 CPython 3.13 macOS 14.0+ ARM64 Details
mlx_sparse-0.0.6b0-cp312-cp312-manylinux_2_35_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.35+ x86-64 Details
mlx_sparse-0.0.6b0-cp312-cp312-macosx_14_0_arm64.whl CPython 3.12 CPython 3.12 macOS 14.0+ ARM64 Details
mlx_sparse-0.0.6b0-cp311-cp311-manylinux_2_35_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.35+ x86-64 Details
mlx_sparse-0.0.6b0-cp311-cp311-macosx_14_0_arm64.whl CPython 3.11 CPython 3.11 macOS 14.0+ ARM64 Details
mlx_sparse-0.0.6b0-cp310-cp310-manylinux_2_35_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.35+ x86-64 Details
mlx_sparse-0.0.6b0-cp310-cp310-macosx_14_0_arm64.whl CPython 3.10 CPython 3.10 macOS 14.0+ ARM64 Details

Total release size: 43.8 MB

Release files / mlx_sparse-0.0.6b0.tar.gz

Download URL mlx_sparse-0.0.6b0.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
17addfd20db5834ff07d5469e9db70b5acaa77a9a6971d85e178406cb7a74d5c
BLAKE2b-256 checksum
How to use checksums
9d581ed8e5d1a57867fc0f25b0b12a380b1f0417bbb03229dd13adbccaa3fbbc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 22, 2026.

Transparency log

Release files / mlx_sparse-0.0.6b0-cp313-cp313-manylinux_2_35_x86_64.whl

Download URL mlx_sparse-0.0.6b0-cp313-cp313-manylinux_2_35_x86_64.whl
Size 5.1 MB
Tags CPython 3.13 Linux glibc 2.35+ x86-64
SHA-256 checksum
How to use checksums
4ddae60649cb599e7197f8f0c91c431e432a99c7990925091955951413ec360c
BLAKE2b-256 checksum
How to use checksums
afd5d03b84fddafa54d5365b193d2c1000ed6409c1aa6830fb6897d45d153fe7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 22, 2026.

Transparency log

Release files / mlx_sparse-0.0.6b0-cp313-cp313-macosx_14_0_arm64.whl

Download URL mlx_sparse-0.0.6b0-cp313-cp313-macosx_14_0_arm64.whl
Size 5.5 MB
Tags CPython 3.13 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
b0619f8583578dc9b9181b04a7a419b697b8ec063778a3d382800977ec44893f
BLAKE2b-256 checksum
How to use checksums
bfd01d46b003cbdbd45666c9d45d8da19cc137927d04e327169fb02fd5e23d72
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 22, 2026.

Transparency log

Release files / mlx_sparse-0.0.6b0-cp312-cp312-manylinux_2_35_x86_64.whl

Download URL mlx_sparse-0.0.6b0-cp312-cp312-manylinux_2_35_x86_64.whl
Size 5.1 MB
Tags CPython 3.12 Linux glibc 2.35+ x86-64
SHA-256 checksum
How to use checksums
087229f69b872b4e6feb40b408e4fa8ccdc96306def46de0f1ff797c733c6d02
BLAKE2b-256 checksum
How to use checksums
85d9820768af7b2a6a426a4b8ec446388c0546851f4e1d6b7db02a2ea99847b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 22, 2026.

Transparency log

Release files / mlx_sparse-0.0.6b0-cp312-cp312-macosx_14_0_arm64.whl

Download URL mlx_sparse-0.0.6b0-cp312-cp312-macosx_14_0_arm64.whl
Size 5.5 MB
Tags CPython 3.12 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
c32332dcf1af7c856e5486969cbc0252ce2ebdf358ca46b8a24a33f7164cb1b6
BLAKE2b-256 checksum
How to use checksums
32633571713faf1d9bff700bd3847abca5ba37ec4e8aa7ee34f6ee60bf14e5aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 22, 2026.

Transparency log

Release files / mlx_sparse-0.0.6b0-cp311-cp311-manylinux_2_35_x86_64.whl

Download URL mlx_sparse-0.0.6b0-cp311-cp311-manylinux_2_35_x86_64.whl
Size 5.1 MB
Tags CPython 3.11 Linux glibc 2.35+ x86-64
SHA-256 checksum
How to use checksums
60ac590399ed597ebcde9295a5cb027ba02f575259fea958a675d8749312ce01
BLAKE2b-256 checksum
How to use checksums
02cab83882817b3df511f66018b2068a4f5009fa6914276b6528041ef48d76d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 22, 2026.

Transparency log

Release files / mlx_sparse-0.0.6b0-cp311-cp311-macosx_14_0_arm64.whl

Download URL mlx_sparse-0.0.6b0-cp311-cp311-macosx_14_0_arm64.whl
Size 5.5 MB
Tags CPython 3.11 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
c8ff3f99238e5c6bb387d7e8292ac6ab89e545945cc704d8ee965e7746e0cbd3
BLAKE2b-256 checksum
How to use checksums
b4fcfdd8f9739ec91964b7fbea48bdee89f262ff0e61aa2afefffdca37b72f0b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 22, 2026.

Transparency log

Release files / mlx_sparse-0.0.6b0-cp310-cp310-manylinux_2_35_x86_64.whl

Download URL mlx_sparse-0.0.6b0-cp310-cp310-manylinux_2_35_x86_64.whl
Size 5.1 MB
Tags CPython 3.10 Linux glibc 2.35+ x86-64
SHA-256 checksum
How to use checksums
d47d05a79a8b5932bdbd05ff542c4e6b5f29b6721028a18c989d9a5f6f84859c
BLAKE2b-256 checksum
How to use checksums
5a8abe882b3c2db455bd984cb6908e26c153b0ced8f1c02e5692f5de5f2a0092
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 22, 2026.

Transparency log

Release files / mlx_sparse-0.0.6b0-cp310-cp310-macosx_14_0_arm64.whl

Download URL mlx_sparse-0.0.6b0-cp310-cp310-macosx_14_0_arm64.whl
Size 5.5 MB
Tags CPython 3.10 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
993697dec1e880d614aa4b9316ee9288aebb68aa521d30a7a7c098e68e56af54
BLAKE2b-256 checksum
How to use checksums
c99e2f68d4ba27ca138fcccb040db30eb3a954a5c93d46044791923bde3d4fa3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 22, 2026.

Transparency log
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page