# Unified Interface for Linear Solving

**URL:** <https://discourse.julialang.org/t/unified-interface-for-linear-solving/699>\
**Category:** Numerics\
**Created:** [December 2, 2016, 5:01pm UTC](https://discourse.julialang.org/t/unified-interface-for-linear-solving/699 "2016-12-02T17:01:01Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [December 2, 2016, 5:01pm UTC](https://discourse.julialang.org/t/unified-interface-for-linear-solving/699/1 "2016-12-02T17:01:01Z")

</div>

Building off of [the rootfinding topic](https://discourse.julialang.org/t/a-unified-interface-for-rootfinding/698/1), I would like to propose some common interface for linear solving in Julia for the same reasons: allowing packages which use linear solvers to easy “swap out methods”. While `\` is nice for many, it’s well known there exists many different methods we would like to be able to swap around, many existing in different packages. These include:

1. Direct solvers (`\`)
2. Sparse direct solvers (is there a package in Julia?)
3. IterativeSolvers.jl
4. PETSc.jl
5. MUMPS.jl
6. Sparso.jl
7. CUSOLVER.jl
8. ArrayFire.jl
9. PyAMG.jl
10. Pardiso.jl

(Any more to add?)

It would be nice to have one unified way to do:

```julia
linear_solve(A,b,alg(),kwargs...)

```

For example, one possibility could be:

```julia
linear_solve(A,b,cg!(alg_specific_option=...),abstol=1e-6)

```

to use the `cg!` method from IterativeSolvers.jl. Again, this would be really nice because then algorithms could be written at a high level without reference to a specific linear solving package, and users could then pick what fits the problem (including GPU algorithms like CUBLAS!).

Some problems to hammer out include:

1. What about matrix-free cases? Just let `A` be a function?
2. Etc.

---

_[View the full topic](https://discourse.julialang.org/t/unified-interface-for-linear-solving/699)._
