From 88d92cb26fe25d21998a3b744f7ac1a0062021b7 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Thu, 1 Jun 2023 12:22:43 -0700 Subject: [PATCH] Update for LinearSolve v2 --- Project.toml | 2 +- src/utils.jl | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Project.toml b/Project.toml index a079b38ca..95df268dd 100644 --- a/Project.toml +++ b/Project.toml @@ -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" diff --git a/src/utils.jl b/src/utils.jl index aa0083be5..f8fd04188 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -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 @@ -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