NeuralLinearSolve.jl is a Julia package that uses a pretrained CNN to predict the fastest direct linear solver for a given sparse matrix.
Given a SparseMatrixCSC, the package generates a 64×64 SPY plot image and passes it through a frozen CNN to classify the matrix into one of three solver categories: UMFPACK, KLU, or Pardiso.
using Pkg
Pkg.add("NeuralLinearSolve")using NeuralLinearSolve
using SparseArrays
A = sprand(1000, 1000, 0.01)
# Get the recommended solver
solver = predict_solver(A)
# e.g. :KLU
# Get the full probability distribution over solvers
probs = predict_solver_probs(A)
# e.g. Dict(:UMFPACK => 0.05, :KLU => 0.91, :Pardiso => 0.04)The CNN was trained on timing data from the SuiteSparse Matrix Collection, comparing solve times for UMFPACK, KLU, and Pardiso across ~1000 sparse matrices. It achieved 94.2% test accuracy on held-out matrices.
MIT
