Skip to content

Commit 1317ebf

Browse files
committed
WIP
1 parent 556ef0d commit 1317ebf

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

test/ipo.jl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,11 @@ end
6767
@noinline sink2!(x, v) = always!(ddt(x) - v)
6868
function sinsink2!()
6969
x = continuous()
70+
initial!(x - 1.0)
7071
sink2!(x, sin(x))
7172
end
72-
dae_sol = solve(DAECProblem(sinsink2!, (1,) .=> 1.), DFBDF(autodiff=false))
73-
ode_sol = solve(ODECProblem(sinsink2!, (1,) .=> 1.), Rodas5(autodiff=false))
73+
dae_sol = solve(DAECProblem(sinsink2!), DFBDF(autodiff=false))
74+
ode_sol = solve(ODECProblem(sinsink2!), Rodas5(autodiff=false))
7475
for sol in (dae_sol, ode_sol)
7576
@test all(map((x,y)->isapprox(x[], y, atol=1e-2), sol[1, :], 2*acot.(exp.(-sol.t).*cot(1/2))))
7677
end
@@ -82,6 +83,7 @@ end
8283

8384
@noinline function (this::sicm!)()
8485
x = continuous()
86+
initial!(x - 1.0)
8587
always!(ddt(x) - this.arg)
8688
end
8789

@@ -94,8 +96,8 @@ function (this::sicm2!)()
9496
sicm!(this.a)(); sicm!(this.b)();
9597
return nothing
9698
end
97-
dae_sol = solve(DAECProblem(sicm2!(1., 1.), (1, 2) .=> 1.), DFBDF(autodiff=false))
98-
ode_sol = solve(ODECProblem(sicm2!(1., 1.), (1, 2) .=> 1.), Rodas5(autodiff=false))
99+
dae_sol = solve(DAECProblem(sicm2!(1., 1.)), DFBDF(autodiff=false))
100+
ode_sol = solve(ODECProblem(sicm2!(1., 1.)), Rodas5(autodiff=false))
99101
for (sol, i) in Iterators.product((dae_sol, ode_sol), 1:2)
100102
@test all(map((x,y)->isapprox(x[], y, atol=1e-2), sol[i, :], 1. .+ sol.t))
101103
end

0 commit comments

Comments
 (0)