Scikit-Sparse – Sparse Matrix Extensions for SciPy¶
Scikit-Sparse is a collection of sparse matrix extensions for SciPy, with a focus on factorization routines and reordering methods.
The package is a thin wrapper around the SuiteSparse
library, to make it compatible with scipy.sparse arrays.
Features¶
Fill-reducing orderings: AMD and COLAMD
Cholesky factorization via CHOLMOD
Integration with SciPy sparse arrays
Installation¶
conda install -c conda-forge scikit-sparse
# or
pip install scikit-sparse
Quick Example¶
import numpy as np
from scipy.sparse import csc_array
from sksparse.cholmod import cho_factor
# Create a sparse positive definite matrix
A = csc_array([[4, 1, 0],
[1, 3, 0],
[0, 0, 2]])
# Perform Cholesky factorization
f = cho_factor(A)
# Solve Ax = b
b = np.array([1, 2, 3])
x = f.solve(b)
Learn More¶
Overview - Introduction and installation instructions
User Guide - Tutorials and examples
API Reference - Detailed API documentation
Change Log - List of changes by version
Contributing - Guidelines for contributing to the project