Skip to content

Commit 8ef0351

Browse files
Fix the failing github action tests (#297)
* Dummy change to get a PR going and trigger the github actions * Remove many deprecation warnings from the tests * Update the docs such that we don't recommend indexing with `sol[t]` * Fix a bug in the classic solver init * Fix another overlooked old array indexing
1 parent fe97a39 commit 8ef0351

File tree

10 files changed

+27
-35
lines changed

10 files changed

+27
-35
lines changed

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
[![Coverage](https://codecov.io/gh/nathanaelbosch/ProbNumDiffEq.jl/branch/main/graph/badge.svg?token=eufIemCGXn)](https://codecov.io/gh/nathanaelbosch/ProbNumDiffEq.jl)
77
[![Benchmarks](http://img.shields.io/badge/benchmarks-docs-blueviolet.svg)](https://nathanaelbosch.github.io/ProbNumDiffEq.jl/dev/benchmarks/multi-language-wrappers/)
88

9-
<!-- [![Code Style: Blue](https://img.shields.io/badge/code%20style-blue-4495d1.svg)](https://github.com/invenia/BlueStyle) -->
10-
<!-- [![ColPrac: Contributor's Guide on Collaborative Practices for Community Packages](https://img.shields.io/badge/ColPrac-Contributor's%20Guide-blueviolet)](https://github.com/SciML/ColPrac) -->
119
![Banner](./examples/banner.svg?raw=true)
1210

1311
__ProbNumDiffEq.jl__ provides _probabilistic numerical_ ODE solvers to the

docs/src/tutorials/getting_started.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -128,18 +128,12 @@ plot!(sol.t, zero(errors), ribbon=3error_estimates, label="error estimate",
128128

129129
The solution object returned by ProbNumDiffEq.jl mostly behaves just like any other `ODESolution` in DifferentialEquations.jl --
130130
with some added uncertainties and related functionality on top.
131-
The `ProbabilisticODESolution` can be indexed
131+
The `ProbabilisticODESolution` can be indexed with
132132

133133
```@repl 1
134-
sol[1]
135-
sol[end]
136-
```
137-
138-
and has fields `sol.t` and `sol.u` which store the time points and mean estimates:
139-
140-
```@repl 1
141-
sol.t[end]
134+
sol.u[1]
142135
sol.u[end]
136+
sol.t[end]
143137
```
144138

145139

src/initialization/classicsolverinit.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function initial_update!(integ, cache, ::ClassicSolverInit)
1313
is_secondorder = integ.f isa DynamicalODEFunction
1414
_u = is_secondorder ? view(u.x[2], :) : view(u, :)
1515
init_condition_on!(x, Proj(0), _u, cache)
16-
is_secondorder ? u.x[1] : f(du, u, p, t)
16+
is_secondorder ? f.f1(du, u.x[1], u.x[2], p, t) : f(du, u, p, t)
1717
integ.stats.nf += 1
1818
init_condition_on!(x, Proj(1), view(du, :), cache)
1919

src/perform_step.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ function compute_scaled_error_estimate!(integ, cache)
188188
DiffEqBase.calculate_residuals!(
189189
err_tmp,
190190
err_est_unscaled,
191-
integ.u[1, :],
192-
integ.uprev[1, :],
191+
integ.u.x[1],
192+
integ.uprev.x[1],
193193
integ.opts.abstol,
194194
integ.opts.reltol,
195195
integ.opts.internalnorm,

test/callbacks.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ end
5757
@test_nowarn solve(prob, EK1(order=3), callback=ManifoldUpdate(E))
5858
sol2 = solve(prob, EK1(order=3), callback=ManifoldUpdate(E))
5959

60-
@test E(sol1[end]) .^ 2 > E(sol2[end]) .^ 2
60+
@test E(sol1.u[end]) .^ 2 > E(sol2.u[end]) .^ 2
6161

62-
err1 = sol1[end] .- appxsol[end]
63-
err2 = sol2[end] .- appxsol[end]
62+
err1 = sol1.u[end] .- appxsol.u[end]
63+
err2 = sol2.u[end] .- appxsol.u[end]
6464
@test all(err1 .^ 2 > err2 .^ 2)
6565
end

test/exponential_integrators.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ using Test
1818
solexp = solve(prob, ExpEK(L=p, order=3))
1919
solros = solve(prob, RosenbrockExpEK(order=3))
2020

21-
err0 = norm(uend - sol0[end])
21+
err0 = norm(uend - sol0.u[end])
2222
@test err0 < 1e-7
23-
err1 = norm(uend - sol1[end])
23+
err1 = norm(uend - sol1.u[end])
2424
@test err1 < 1e-9
25-
errexp = norm(uend - solexp[end])
25+
errexp = norm(uend - solexp.u[end])
2626
@test errexp < 1e-10
27-
errros = norm(uend - solros[end])
27+
errros = norm(uend - solros.u[end])
2828
@test errros < 1e-13
2929

3030
@test errros < errexp < err1 < err0

test/ioup.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ prob = ODEProblem(f, u0, tspan)
1414
ref = solve(prob, Vern9(), abstol=1e-9, reltol=1e-9);
1515

1616
sol_iwp = solve(prob, EK1());
17-
err_iwp = norm(ref[end] - sol_iwp[end])
17+
err_iwp = norm(ref.u[end] - sol_iwp.u[end])
1818
@test err_iwp < 1e-5
1919

2020
A_noisy = A + 1e-3 * randn(MersenneTwister(42), 2, 2)
2121

2222
@testset "Adaptive steps" begin
2323
sol_ioup_noisy = solve(prob, EK1(prior=IOUP(3, A_noisy)))
24-
err_ioup_noisy = norm(ref[end] - sol_ioup_noisy[end])
24+
err_ioup_noisy = norm(ref.u[end] - sol_ioup_noisy.u[end])
2525
@test sol_ioup_noisy.stats.nf < sol_iwp.stats.nf
2626
@test err_ioup_noisy < 2e-5
2727

2828
sol_ioup = solve(prob, EK1(prior=IOUP(3, A)))
29-
err_ioup = norm(ref[end] - sol_ioup[end])
29+
err_ioup = norm(ref.u[end] - sol_ioup.u[end])
3030
@test sol_ioup.stats.nf < sol_ioup_noisy.stats.nf
3131
@test err_ioup < 5e-10
3232
end
@@ -38,7 +38,7 @@ end
3838
prior=IOUP(order, A_noisy),
3939
diffusionmodel=FixedDiffusion(),
4040
), adaptive=false, dt=1e-1)
41-
err = norm(ref[end] - sol[end])
41+
err = norm(ref.u[end] - sol.u[end])
4242
@test err < last_error
4343
last_error = err
4444
end
@@ -48,7 +48,7 @@ end
4848
@testset "$(typeof(r))" for r in (-α, [-α, -α], [-α 0; 0 -α], -α * I(2))
4949
sol = solve(prob, EK1(prior=IOUP(3, r)))
5050

51-
err = norm(ref[end] - sol[end])
51+
err = norm(ref.u[end] - sol.u[end])
5252
@test err < 6e-6
5353
end
5454
end

test/mass_matrix.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ using Test
1212

1313
@testset "Correct EK1" begin
1414
sol = solve(prob, EK1(order=3))
15-
@test sol[end] ref[end] rtol = 1e-10
15+
@test sol.u[end] ref.u[end] rtol = 1e-10
1616
end
1717

1818
@testset "Kronecker working" begin
@@ -38,7 +38,7 @@ using Test
3838
s0 = ek0()
3939

4040
ref = solve(prob, RadauIIA5(), abstol=1e-9, reltol=1e-6)
41-
@test s0[end] ref[end] rtol = 1e-7
41+
@test s0.u[end] ref.u[end] rtol = 1e-7
4242

4343
@test s1.pu.Σ[1] isa PSDMatrix{<:Number,<:Matrix}
4444
@test s0.pu.Σ[1] isa PSDMatrix{<:Number,<:ProbNumDiffEq.IsometricKroneckerProduct}
@@ -68,14 +68,14 @@ end
6868

6969
ref = solve(prob, RadauIIA5())
7070
sol = solve(prob, EK1(order=3))
71-
@test sol[end] ref[end] rtol = 1e-8
71+
@test sol.u[end] ref.u[end] rtol = 1e-8
7272

7373
sol = solve(prob, EK1(order=3, initialization=ForwardDiffInit(3)))
74-
@test sol[end] ref[end] rtol = 1e-8
74+
@test sol.u[end] ref.u[end] rtol = 1e-8
7575

7676
sol = solve(prob, EK1(order=3, initialization=ClassicSolverInit(RadauIIA5())))
77-
@test sol[end] ref[end] rtol = 1e-8
77+
@test sol.u[end] ref.u[end] rtol = 1e-8
7878

7979
sol = solve(prob, EK1(order=3, initialization=SimpleInit()))
80-
@test sol[end] ref[end] rtol = 1e-8
80+
@test sol.u[end] ref.u[end] rtol = 1e-8
8181
end

test/smoothing.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ end
3333
sol_smooth = solve(prob, EK0(order=q, smooth=true), adaptive=false, dt=dt)
3434

3535
@test sol_nonsmooth.t sol_smooth.t
36-
@test sol_nonsmooth[end] == sol_smooth[end]
37-
@test sol_nonsmooth[end-1] != sol_smooth[end-1]
36+
@test sol_nonsmooth.u[end] == sol_smooth.u[end]
37+
@test sol_nonsmooth.u[end-1] != sol_smooth.u[end-1]
3838

3939
plot(sol_smooth, label="smooth")
4040
plot!(sol_nonsmooth, label="nonsmooth")

test/stiff_problem.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ using ODEProblemLibrary: prob_ode_vanderpol_stiff
66
prob = prob_ode_vanderpol_stiff
77
appxsol = solve(prob, RadauIIA5())
88
sol = solve(prob, EK1(order=3))
9-
@test appxsol[end] sol[end] rtol = 5e-3
9+
@test appxsol.u[end] sol.u[end] rtol = 5e-3
1010
@test appxsol(0.5) sol(0.5).μ rtol = 5e-3

0 commit comments

Comments
 (0)