Skip to content

Commit e18c2e6

Browse files
AayushSabharwalChrisRackauckas
authored andcommitted
fix: call remake on LinearProblem SCCs to recalculate parametrized A and b
1 parent 3ad5eff commit e18c2e6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/SCCNonlinearSolve/src/SCCNonlinearSolve.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@ function iteratively_build_sols(alg, sols, (prob, explicitfun), args...; kwargs.
4141
SymbolicIndexingInterface.parameter_values(prob), sols)
4242

4343
_sol = if prob isa SciMLBase.LinearProblem
44-
sol = SciMLBase.solve(prob, alg.linalg; kwargs...)
44+
A = prob.A
45+
b = prob.b
46+
# `remake` to recalculate `A` and `b` based on updated parameters from `explicitfun`.
47+
# Pass `A` and `b` to avoid unnecessarily copying them.
48+
sol = SciMLBase.solve(SciMLBase.remake(prob; A, b), alg.linalg; kwargs...)
4549
SciMLBase.build_linear_solution(
4650
alg.linalg, sol.u, nothing, nothing, retcode = sol.retcode)
4751
else

0 commit comments

Comments
 (0)