Skip to content

Commit

Permalink
Merge pull request #185 from SciML/linearsolve2
Browse files Browse the repository at this point in the history
Update for LinearSolve v2
  • Loading branch information
ChrisRackauckas authored Jun 2, 2023
2 parents 54b8855 + 88d92cb commit 2d01939
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ DiffEqBase = "6"
EnumX = "1"
FiniteDiff = "2"
ForwardDiff = "0.10.3"
LinearSolve = "1"
LinearSolve = "2"
RecursiveArrayTools = "2"
Reexport = "0.2, 1"
SciMLBase = "1.73"
Expand Down
13 changes: 7 additions & 6 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ function dolinsolve(precs::P, linsolve; A = nothing, linu = nothing, b = nothing
du = nothing, u = nothing, p = nothing, t = nothing,
weight = nothing, cachedata = nothing,
reltol = nothing) where {P}
A !== nothing && (linsolve = LinearSolve.set_A(linsolve, A))
b !== nothing && (linsolve = LinearSolve.set_b(linsolve, b))
linu !== nothing && (linsolve = LinearSolve.set_u(linsolve, linu))
A !== nothing && (linsolve.A = A)
b !== nothing && (linsolve.b = b)
linu !== nothing && (linsolve.u = linu)

Plprev = linsolve.Pl isa LinearSolve.ComposePreconditioner ? linsolve.Pl.outer :
linsolve.Pl
Expand All @@ -86,13 +86,14 @@ function dolinsolve(precs::P, linsolve; A = nothing, linu = nothing, b = nothing
(linsolve.Pr isa Diagonal ? linsolve.Pr.diag : linsolve.Pr.inner.diag) :
weight
Pl, Pr = wrapprecs(_Pl, _Pr, _weight)
linsolve = LinearSolve.set_prec(linsolve, Pl, Pr)
linsolve.Pl = Pl
linsolve.Pr = Pr
end

linres = if reltol === nothing
solve(linsolve)
solve!(linsolve)
else
solve(linsolve; reltol)
solve!(linsolve; reltol)
end

return linres
Expand Down

0 comments on commit 2d01939

Please sign in to comment.