SciML /LinearSolve.jl
LinearSolve.jl: High-Performance Unified Interface for Linear Solvers in Julia. Easily switch between factorization and Krylov methods, add preconditioners, and all in one interface.
★ 300⑂ 100👁 7⑃ 1,062● 356▤ 355
+1
日增长
300
stars
100
forks
7
watchers
1,062
prs
356
issues
355
releases
README
LinearSolve.jl
Fast implementations of linear solving algorithms in Julia that satisfy the SciML
common interface. LinearSolve.jl makes it easy to define high level algorithms
which allow for swapping out the linear solver that is used while maintaining
maximum efficiency. Specifically, LinearSolve.jl includes:
- Fast pure Julia LU factorizations which outperform standard BLAS
- KLU for faster sparse LU factorization on unstructured matrices
- UMFPACK for faster sparse LU factorization on matrices with some repeated structure
- MKLPardiso wrappers for handling many sparse matrices faster than SuiteSparse (KLU, UMFPACK) methods
- Sparspak.jl for sparse LU factorization in pure Julia for generic number types and for non-GPL distributions
- GPU-offloading for large dense matrices
- Wrappers to all of the Krylov implementations (Krylov.jl, IterativeSolvers.jl, KrylovKit.jl) for easy
testing of all of them. LinearSolve.jl handles the API differences, especially with the preconditioner
definitions
- A polyalgorithm that smartly chooses between these methods
- A caching interface which automates caching of symbolic factorizations and numerical factorizations
as optimally as possible
For information on using the package,
see the stable documentation. Use the
in-development documentation for the version of
the documentation which contains the unreleased features.
High Level Examples
julia
n = 4
A = rand(n, n)
b1 = rand(n);
b2 = rand(n);
prob = LinearProblem(A, b1)
linsolve = init(prob)
sol1 = solve!(linsolve)
sol1.u
=
4-element Vector{Float64}:
-0.9247817429364165
-0.0972021708185121
0.6839050402960025
1.8385599677530706
=
linsolve.b = b2
sol2 = solve!(linsolve)
sol2.u
=
4-element Vector{Float64}:
1.0321556637762768
0.49724400693338083
-1.1696540870182406
-0.4998342686003478
=
linsolve = init(prob, IterativeSolversJL_GMRES()) Switch to GMRES
linsolve.b = b2
sol2 = solve!(linsolve)
sol2.u
=
4-element Vector{Float64}:
1.0321556637762768
0.49724400693338083
-1.1696540870182406
-0.4998342686003478
=
A2 = rand(n, n)
linsolve.A = A2
sol3 = solve!(linsolve)
sol3.u
=
4-element Vector{Float64}:
-6.793605395935224
2.8673042300837466
1.1665136934977371
-0.4097250749016653
=
Citation
If LinearSolve.jl is part of your research, please cite it using
CITATION.bib:
bib
@software{LinearSolve.jl,
author = {Will Kimmerer and Vedant Puri and Jash Ambaliya and Chris Rackauckas},
title = {LinearSolve.jl},
url = {https://github.com/SciML/LinearSolve.jl}
}Top issues
#211BibTex (citation) for LinearSolve.jl16 comments · 2022-10-24#53Trilinos solver wrappers8 comments · 2021-12-14#1170Nondeterministic GC corruption (`GC error (probable corruption)`, SIGABRT) in large-N GenericLU adjoint test workload on Julia 1.11.9–1.12.6 — reproduces on clean main3 comments · 2026-08-08#430AOCL wrappers for faster sparse and dense operations on AMD CPUs3 comments · 2023-11-11#1397SupernodalLU errors on in-place sparsity pattern change2 comments · 2026-10-23#1371SupernodalLUFactorization returns Success with backward error far from machine precision on some SuiteSparse collection matrices2 comments · 2026-10-05#1253Reactant: add backend-aware native XLA lowerings and fallback policy2 comments · 2026-08-26#1359`SimpleLUFactorization` returns the initial `u` as the values of dual-number solutions1 comments · 2026-09-29
Latest release
v5.18.3 v5.18.3 2026-10-30LinearSolve v5.18.3 Diff since v5.18.2 Merged pull requests: - Fix PardisoJL matrix-type selection for symmetric sparse systems (1345) (@ChrisRackauckas-Claude) - typos: inferrable → inferable in IterativeSolversExt comment (1346) (@ChrisRackauckas-Claude) - Default solver: route adjoint solve through QR after the LU-to-QR fallback (1373) (@ChrisRackauckas-Claude) - Fix QA: explicit triangular-type imports, drop non-public IterativeSolvers.converged (1383) (@ChrisRackauckas-Claude) - Fix QA: resolve a Reactant that loads on Julia 1.13 and take adjoint from Base (1387) (@ChrisRackauckas) - A