@@ -19,7 +19,7 @@ sol = solve(DAECProblem(onecall!, (1,) .=> 1.), IDA())
1919sol = solve (ODECProblem (onecall!, (1 ,) .=> 1. ), Rodas5 (autodiff= false ))
2020@test all (map ((x,y)-> isapprox (x[], y, atol= 1e-2 ), sol[1 , :], exp .(sol. t)))
2121
22- #= + Contained Equations =#
22+ #= === Contained Equations =========== =#
2323function twocall! ()
2424 onecall! (); onecall! ();
2525 return nothing
@@ -32,7 +32,7 @@ for (sol, i) in Iterators.product((dae_sol, ode_sol), 1:2)
3232 @test all (map ((x,y)-> isapprox (x[], y, atol= 1e-2 ), sol[i, :], exp .(sol. t)))
3333end
3434
35- #= + NonLinear =#
35+ #= ============= NonLinear =========== =#
3636@noinline function sin! ()
3737 x = continuous ()
3838 always! (ddt (x) - sin (x))
@@ -47,7 +47,7 @@ for (sol, i) in Iterators.product((dae_sol, ode_sol), 1:2)
4747 @test all (map ((x,y)-> isapprox (x[], y, atol= 1e-2 ), sol[i, :], 2 * acot .(exp .(- sol. t).* cot (1 / 2 ))))
4848end
4949
50- #= + SICM =#
50+ #= ============= SICM =========== =#
5151struct sicm!
5252 arg:: Float64
5353end
@@ -72,7 +72,7 @@ for (sol, i) in Iterators.product((dae_sol, ode_sol), 1:2)
7272 @test all (map ((x,y)-> isapprox (x[], y, atol= 1e-2 ), sol[i, :], 1. .+ sol. t))
7373end
7474
75- #= + NonLinear SICM =#
75+ #= ========= NonLinear SICM ========== =#
7676struct nlsicm!
7777 arg:: Float64
7878end
@@ -97,7 +97,7 @@ for (sol, i) in Iterators.product((dae_sol, ode_sol), 1:2)
9797 @test all (map ((x,y)-> isapprox (x[], y, atol= 1e-2 ), sol[i, :], 1. .+ sin (1. )* sol. t))
9898end
9999
100- #= + Ping Ping =#
100+ #= ============= Ping Pong =========== =#
101101@noinline function ping (a, b, c, d)
102102 always! (b - sin (a))
103103 always! (d - sin (c))
@@ -126,4 +126,17 @@ for sol in (dae_sol, ode_sol)
126126 @test all (map ((x,y)-> isapprox (x[], y, atol= 1e-2 ), sol[1 , :], 0.1 exp .(sol. t)))
127127end
128128
129+ #= ========= Implicit External ===========#
130+ @noinline intro () = ddt (continuous ())
131+ @noinline outro! (x) = always! (x- 1 )
132+
133+ implicit () = outro! (intro ())
134+
135+ dae_sol = solve (DAECProblem (implicit, (1 ,) .=> 1 ), IDA ())
136+ ode_sol = solve (ODECProblem (implicit, (1 ,) .=> 1 ), Rodas5 (autodiff= false ))
137+
138+ for sol in (dae_sol, ode_sol)
139+ @test all (map ((x,y)-> isapprox (x[], y, atol= 1e-2 ), sol[1 , :], 1 .+ sol. t))
140+ end
141+
129142end
0 commit comments