@@ -42,9 +42,9 @@ function foo(du, u, p, t)
4242 nothing
4343end
4444
45- ps = 2 # use to specify problem size (ps ∈ {1,2})
46- coeffs = rand (ps^ 2 )
47- cache = dualcache (zeros (ps,ps), [4 , 4 , 4 ])
45+ ps = 3 # use to specify problem size; don't go crazy on this, because compilation time...
46+ coeffs = - rand (ps^ 2 )
47+ cache = dualcache (zeros (ps,ps), [9 , 9 , 9 ])
4848prob = ODEProblem (foo, ones (ps, ps), (0. , 1.0 ), (coeffs, cache))
4949realsol = solve (prob, TRBDF2 (), saveat = 0.0 : 0.01 : 1.0 , reltol = 1e-8 )
5050
@@ -66,7 +66,7 @@ fn(x,p) = objfun(x, p[1], p[2], p[3])
6666optfun = OptimizationFunction (fn, GalacticOptim. AutoForwardDiff ())
6767optprob = OptimizationProblem (optfun, rand (size (coeffs)... ), (prob, realsol, cache))
6868newtonsol = solve (optprob, Newton ())
69- bfgssol = solve (optprob, BFGS ()) # since only gradients are used here, we could go with a slim dualcache(zeros(ps,ps), [4,4 ]) as well.
69+ bfgssol = solve (optprob, BFGS ()) # since only gradients are used here, we could go with a smaller dualcache(zeros(ps,ps), [9,9 ]) as well.
7070
7171@test all (abs .(coeffs .- newtonsol. u) .< 1e-3 )
7272@test all (abs .(coeffs .- bfgssol. u) .< 1e-3 )
@@ -81,7 +81,6 @@ function foo(du, u, p, t)
8181 nothing
8282end
8383
84- ps = 2 # use to specify problem size (ps ∈ {1,2})
8584coeffs = rand (1 )
8685cache = dualcache (zeros (ps,ps), [1 , 1 , 4 ])
8786prob = ODEProblem (foo, ones (ps, ps), (0. , 1.0 ), (coeffs, cache))
0 commit comments