@@ -86,6 +86,20 @@ for T in containerTypes
86
86
push! (probs, NonlinearLeastSquaresProblem (fn, u0, T (p)))
87
87
end
88
88
89
+ update_A! = function (A, p)
90
+ A[1 , 1 ] = p[1 ]
91
+ A[2 , 2 ] = p[2 ]
92
+ A[3 , 3 ] = p[3 ]
93
+ end
94
+ update_b! = function (b, p)
95
+ b[1 ] = p[3 ]
96
+ b[2 ] = - 8 p[2 ] - p[1 ]
97
+ end
98
+ f = SciMLBase. SymbolicLinearInterface (update_A!, update_b!, indep_sys, nothing , nothing )
99
+ for T in containerTypes
100
+ push! (probs, LinearProblem (rand (3 , 3 ), rand (3 ), T (p); u0, f))
101
+ end
102
+
89
103
# temporary definition to test this functionality
90
104
function SciMLBase. late_binding_update_u0_p (
91
105
prob, u0, p:: SciMLBase.NullParameters , t0, newu0, newp)
429
443
prob2 = remake (ODEProblem ((u, p, t) -> 2 .* u, nothing , nothing ); f = f)
430
444
@test SciMLBase. specialization (prob2. f) == SciMLBase. FullSpecialize
431
445
end
446
+
447
+ @testset " `remake(::LinearProblem)` without a system" begin
448
+ prob = LinearProblem {true} (rand (3 , 3 ), rand (3 ))
449
+ @inferred remake (prob)
450
+ base_allocs = @allocations remake (prob)
451
+ A = ones (3 , 3 )
452
+ b = ones (3 )
453
+ u0 = ones (3 )
454
+ p = " P"
455
+ @inferred remake (prob; A, b, u0, p)
456
+ @test (@allocations remake (prob; A, b, u0, p)) <= base_allocs
457
+
458
+ prob2 = remake (prob; u0)
459
+ @test prob2. u0 === u0
460
+ prob2 = remake (prob; A = SMatrix {3, 3} (A))
461
+ @test prob2. A isa SMatrix{3 , 3 }
462
+ end
0 commit comments