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.
https://docs.sciml.ai/LinearSolve/stable/
Other
241 stars 52 forks source link

Handle StaticArrays.jl #440

Closed ranocha closed 8 months ago

ranocha commented 8 months ago

It looks like the current default algorithm will choose

https://github.com/SciML/LinearSolve.jl/blob/e712202303d0649a55b5143857b928df68eccc9f/src/default.jl#L185

when an SMatrix from StaticArrays.jl is passed. For example,

julia> using LinearSolve, StaticArrays

julia> A = @SMatrix [1.0 2.0; 3.0 4.0]; b = @SVector [1.0, 2.0]; prob = LinearProblem(A, b)
LinearProblem. In-place: true
b: 2-element SVector{2, Float64} with indices SOneTo(2):
 1.0
 2.0

julia> sol = solve(prob)
retcode: Default
u: 2-element Vector{Float64}:
 1.966189735084803e-16
 0.49999999999999994

julia> sol.alg
LinearSolve.DefaultLinearSolver(LinearSolve.DefaultAlgorithmChoice.KrylovJL_GMRES)

It would be nice if LinearSolve.jl could handle StaticArrays.jl efficiently.

CC @skopecz

ChrisRackauckas commented 8 months ago

This was fixed by https://github.com/SciML/LinearSolve.jl/pull/436 . The PR was already there I just needed to review and merge 😅

ranocha commented 8 months ago

Thanks!