@@ -901,6 +901,49 @@ function remake(prob::SCCNonlinearProblem; u0 = missing, p = missing, probs = mi
901901 probs, explicitfuns!, f, newp, parameters_alias)
902902end
903903
904+ function remake (prob:: LinearProblem ; u0 = missing , p = missing , A = missing , b = missing ,
905+ f = missing , interpret_symbolicmap = true , use_defaults = false , kwargs = missing ,
906+ _kwargs... )
907+ u0, p = updated_u0_p (prob, u0, p; interpret_symbolicmap, use_defaults)
908+ f = coalesce (f, prob. f)
909+ # We want to copy to avoid aliasing, but don't want to unnecessarily copy
910+ A = @coalesce (A, copy (prob. A))
911+ b = @coalesce (b, copy (prob. b))
912+
913+ A, b = _get_new_A_b (f, p, A, b)
914+
915+ if kwargs === missing
916+ return LinearProblem {isinplace(prob)} (A, b, p; u0, f, prob. kwargs... , _kwargs... )
917+ else
918+ return LinearProblem {isinplace(prob)} (A, b, p; u0, f, kwargs... )
919+ end
920+ end
921+
922+ """
923+ $(TYPEDSIGNATURES)
924+
925+ A helper function to call `get_new_A_b` if `f isa SymbolicLinearInterface`.
926+ """
927+ _get_new_A_b (f, p, A, b; kw... ) = A, b
928+
929+ function _get_new_A_b (f:: SymbolicLinearInterface , p, A, b; kw... )
930+ get_new_A_b (f. sys, f, p, A, b; kw... )
931+ end
932+
933+ # public API
934+ """
935+ $(TYPEDSIGNATURES)
936+
937+ A function to return the updated `A` and `b` matrices for a `LinearProblem` after `remake`.
938+ `root_indp` is the innermost index provider found by recursively, calling
939+ `SymbolicIndexingInterface.symbolic_container`, provided for dispatch. Returns the new `A`
940+ `b` matrices. Mutation of `A` and `b` is permitted.
941+
942+ All implementations must accept arbitrary keyword arguments in case they are added in the
943+ future.
944+ """
945+ get_new_A_b (root_indp, f, p, A, b; kw... ) = A, b
946+
904947function varmap_has_var (varmap, var)
905948 haskey (varmap, var) || hasname (var) && haskey (varmap, getname (var))
906949end
@@ -1151,7 +1194,7 @@ function updated_u0_p(
11511194 if u0 === missing && p === missing
11521195 return state_values (prob), parameter_values (prob)
11531196 end
1154- if has_sys (prob. f) && prob. f. sys === nothing
1197+ if prob . f != = nothing && has_sys (prob. f) && prob. f. sys === nothing
11551198 if interpret_symbolicmap && eltype (p) != = Union{} && eltype (p) <: Pair
11561199 throw (ArgumentError (" This problem does not support symbolic maps with " *
11571200 " `remake`, i.e. it does not have a symbolic origin. Please use `remake`" *
0 commit comments