Jupyter notebooks#
The notebooks below can be downloaded and executed locally. Pre-computed outputs are shown inline where available so you can read the results without running anything.
All timing results are collected on an Apple M5, 10-core GPU, macOS 26.0, MLX 0.31, mlx-sparse 0.0.1b0.
Primitives#
These notebooks cover the core sparse containers and operations: construction, matrix-vector products, matrix-matrix products, autodiff, dtype/device handling, and integration with third-party libraries.
- First steps with mlx-sparse
- CSR matvec (SpMV)
- CSR matmul (SpMM) and batched products
- Structured constructors:
eye,diags,fromdense - Sparse-sparse products (
csr_matmat) - Autodiff through sparse operations
- Dtypes and device execution
- Canonicalization and validation
- SciPy interoperability
- CSC format
- Performance benchmarks
- Graph algorithms with sparse matrices
- Sparse neural network layers
Sparse linear algebra#
These notebooks cover mlx_sparse.linalg: iterative solvers, direct
factorizations, spectral routines, and matrix-free linear operators.
Sparse preconditioners#
These notebooks focus on mlx_sparse.linalg.preconditioners. They keep the
preconditioner material separate from the general solver notebook so each
inverse-apply strategy can show its setup cost, apply path, solver effect, and
failure policy in context.
Accelerate direct solvers#
These notebooks focus on optional Apple Accelerate sparse direct solvers: opaque reusable factorized solves for square systems and rectangular least-squares workloads. Source/editable builds must enable Accelerate as described in Installation.