diff --git a/Project.toml b/Project.toml
index 594700144..244f6a2d0 100644
--- a/Project.toml
+++ b/Project.toml
@@ -10,6 +10,8 @@ DiffEqDevTools = "f3b72e0c-5b89-59e1-b016-84e28bfd966d"
ExponentialUtilities = "d4d017d3-3776-5f7e-afef-a10c40355c18"
FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898"
FastGaussQuadrature = "442a2c76-b920-505d-bb47-c5924d526838"
+FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"
+FiniteHorizonGramians = "b59a298d-d283-4a37-9369-85a9f9a111a5"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
FunctionWrappersWrappers = "77dc65aa-8811-40c2-897b-53d922fa7daf"
GaussianDistributions = "43dcc890-d446-5863-8d1a-14597580bb8d"
@@ -45,6 +47,8 @@ DiffEqDevTools = "2"
ExponentialUtilities = "1"
FastBroadcast = "0.2"
FastGaussQuadrature = "0.5, 1"
+FillArrays = "1.9"
+FiniteHorizonGramians = "0.1"
ForwardDiff = "0.10"
FunctionWrappersWrappers = "0.1.3"
GaussianDistributions = "0.5"
diff --git a/benchmarks/hodgkinhuxley.jmd b/benchmarks/hodgkinhuxley.jmd
index d99f78d29..002b499b8 100644
--- a/benchmarks/hodgkinhuxley.jmd
+++ b/benchmarks/hodgkinhuxley.jmd
@@ -34,7 +34,8 @@ Plots.theme(
αh(V, VT) = 0.128 * exp(-(V - VT - 17) / 18)
βh(V, VT) = 4 / (1 + exp(-(V - VT - 40) / 5))
-Inj(t) = (5 <= t <= 40) ? 500one(t) : zero(t)
+const current_tspan = (5, 40)
+Inj(t) = (current_tspan[1] <= t <= current_tspan[2]) ? 500one(t) : zero(t)
function f(du, u, p, t)
@unpack gNa, gK, ENa, EK, area, C, Eleak, VT, gleak = p
@@ -88,14 +89,13 @@ _setups = [
"EK0(3)" => Dict(:alg=>EK0(order=3, smooth=DENSE))
"EK1(2)" => Dict(:alg=>EK1(order=2, smooth=DENSE))
"EK1(3)" => Dict(:alg=>EK1(order=3, smooth=DENSE))
- "EK1(5)" => Dict(:alg=>EK1(order=5, smooth=DENSE))
+ "RosenbrockExpEK1(2)" => Dict(:alg=>RosenbrockExpEK(order=2, smooth=DENSE))
"RosenbrockExpEK1(3)" => Dict(:alg=>RosenbrockExpEK(order=3, smooth=DENSE))
- "RosenbrockExpEK1(5)" => Dict(:alg=>RosenbrockExpEK(order=5, smooth=DENSE))
]
labels = first.(_setups)
setups = last.(_setups)
-colors = [1 1 2 2 2 3 3]
+colors = [1 1 2 2 3 3]
abstols = 1.0 ./ 10.0 .^ (6:10)
reltols = 1.0 ./ 10.0 .^ (3:7)
@@ -108,6 +108,7 @@ wp = WorkPrecisionSet(
save_everystep = SAVE_EVERYSTEP,
maxiters = Int(1e7),
numruns = 5,
+ tstops = current_tspan,
)
plot(wp, title="Adaptive steps - no smoothing", color=colors)
@@ -127,6 +128,7 @@ ref_wp_final = WorkPrecisionSet(
dense = false,
save_everystep = false,
maxiters = Int(1e7),
+ tstops = current_tspan,
)
ref_wp_dense = WorkPrecisionSet(
prob, abstols ./ 1000, reltols ./ 1000, ref_setups;
@@ -135,6 +137,7 @@ ref_wp_dense = WorkPrecisionSet(
dense = true,
save_everystep = true,
maxiters = Int(1e7),
+ tstops = current_tspan,
)
plot!(ref_wp_final, x=:final, color=:gray, alpha=0.7, linestyle=:dash)
@@ -150,14 +153,13 @@ _setups = [
"EK0(3)" => Dict(:alg=>EK0(order=3, smooth=DENSE))
"EK1(2)" => Dict(:alg=>EK1(order=2, smooth=DENSE))
"EK1(3)" => Dict(:alg=>EK1(order=3, smooth=DENSE))
- "EK1(5)" => Dict(:alg=>EK1(order=5, smooth=DENSE))
+ "RosenbrockExpEK1(2)" => Dict(:alg=>RosenbrockExpEK(order=2, smooth=DENSE))
"RosenbrockExpEK1(3)" => Dict(:alg=>RosenbrockExpEK(order=3, smooth=DENSE))
- "RosenbrockExpEK1(5)" => Dict(:alg=>RosenbrockExpEK(order=5, smooth=DENSE))
]
labels = first.(_setups)
setups = last.(_setups)
-colors = [1 1 2 2 2 3 3]
+colors = [1 1 2 2 3 3]
abstols = 1.0 ./ 10.0 .^ (6:10)
reltols = 1.0 ./ 10.0 .^ (3:7)
@@ -170,6 +172,7 @@ wp = WorkPrecisionSet(
save_everystep = SAVE_EVERYSTEP,
maxiters = Int(1e7),
numruns = 5,
+ tstops = current_tspan,
)
plot(wp, title="Adaptive steps - with smoothing", color=colors)
diff --git a/docs/src/benchmarks/figures/hodgkinhuxley_2_1.svg b/docs/src/benchmarks/figures/hodgkinhuxley_2_1.svg
index 57e779959..0ac554c1c 100644
--- a/docs/src/benchmarks/figures/hodgkinhuxley_2_1.svg
+++ b/docs/src/benchmarks/figures/hodgkinhuxley_2_1.svg
@@ -1,444 +1,444 @@
diff --git a/docs/src/benchmarks/figures/hodgkinhuxley_3_1.svg b/docs/src/benchmarks/figures/hodgkinhuxley_3_1.svg
index 7427671dd..feae04186 100644
--- a/docs/src/benchmarks/figures/hodgkinhuxley_3_1.svg
+++ b/docs/src/benchmarks/figures/hodgkinhuxley_3_1.svg
@@ -1,246 +1,234 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/src/benchmarks/figures/hodgkinhuxley_4_1.svg b/docs/src/benchmarks/figures/hodgkinhuxley_4_1.svg
index 30288f79a..c34a5fb22 100644
--- a/docs/src/benchmarks/figures/hodgkinhuxley_4_1.svg
+++ b/docs/src/benchmarks/figures/hodgkinhuxley_4_1.svg
@@ -1,246 +1,236 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/src/benchmarks/figures/hodgkinhuxley_5_1.svg b/docs/src/benchmarks/figures/hodgkinhuxley_5_1.svg
index c320fa281..836da534e 100644
--- a/docs/src/benchmarks/figures/hodgkinhuxley_5_1.svg
+++ b/docs/src/benchmarks/figures/hodgkinhuxley_5_1.svg
@@ -1,432 +1,250 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/src/benchmarks/figures/hodgkinhuxley_6_1.svg b/docs/src/benchmarks/figures/hodgkinhuxley_6_1.svg
index da798d5ca..4af343b2f 100644
--- a/docs/src/benchmarks/figures/hodgkinhuxley_6_1.svg
+++ b/docs/src/benchmarks/figures/hodgkinhuxley_6_1.svg
@@ -1,265 +1,245 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/src/benchmarks/figures/hodgkinhuxley_7_1.svg b/docs/src/benchmarks/figures/hodgkinhuxley_7_1.svg
index 3d4fa2459..3416bcf37 100644
--- a/docs/src/benchmarks/figures/hodgkinhuxley_7_1.svg
+++ b/docs/src/benchmarks/figures/hodgkinhuxley_7_1.svg
@@ -1,174 +1,172 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/src/benchmarks/figures/hodgkinhuxley_8_1.svg b/docs/src/benchmarks/figures/hodgkinhuxley_8_1.svg
index 90d26f609..65bc081c0 100644
--- a/docs/src/benchmarks/figures/hodgkinhuxley_8_1.svg
+++ b/docs/src/benchmarks/figures/hodgkinhuxley_8_1.svg
@@ -1,164 +1,164 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/src/benchmarks/hodgkinhuxley.md b/docs/src/benchmarks/hodgkinhuxley.md
index 2b60fafa8..8636e842a 100644
--- a/docs/src/benchmarks/hodgkinhuxley.md
+++ b/docs/src/benchmarks/hodgkinhuxley.md
@@ -44,7 +44,8 @@ Plots.theme(
αh(V, VT) = 0.128 * exp(-(V - VT - 17) / 18)
βh(V, VT) = 4 / (1 + exp(-(V - VT - 40) / 5))
-Inj(t) = (5 <= t <= 40) ? 500one(t) : zero(t)
+const current_tspan = (5, 40)
+Inj(t) = (current_tspan[1] <= t <= current_tspan[2]) ? 500one(t) : zero(t)
function f(du, u, p, t)
@unpack gNa, gK, ENa, EK, area, C, Eleak, VT, gleak = p
@@ -108,14 +109,13 @@ _setups = [
"EK0(3)" => Dict(:alg=>EK0(order=3, smooth=DENSE))
"EK1(2)" => Dict(:alg=>EK1(order=2, smooth=DENSE))
"EK1(3)" => Dict(:alg=>EK1(order=3, smooth=DENSE))
- "EK1(5)" => Dict(:alg=>EK1(order=5, smooth=DENSE))
+ "RosenbrockExpEK1(2)" => Dict(:alg=>RosenbrockExpEK(order=2, smooth=DENSE))
"RosenbrockExpEK1(3)" => Dict(:alg=>RosenbrockExpEK(order=3, smooth=DENSE))
- "RosenbrockExpEK1(5)" => Dict(:alg=>RosenbrockExpEK(order=5, smooth=DENSE))
]
labels = first.(_setups)
setups = last.(_setups)
-colors = [1 1 2 2 2 3 3]
+colors = [1 1 2 2 3 3]
abstols = 1.0 ./ 10.0 .^ (6:10)
reltols = 1.0 ./ 10.0 .^ (3:7)
@@ -128,6 +128,7 @@ wp = WorkPrecisionSet(
save_everystep = SAVE_EVERYSTEP,
maxiters = Int(1e7),
numruns = 5,
+ tstops = current_tspan,
)
plot(wp, title="Adaptive steps - no smoothing", color=colors)
@@ -147,6 +148,7 @@ ref_wp_final = WorkPrecisionSet(
dense = false,
save_everystep = false,
maxiters = Int(1e7),
+ tstops = current_tspan,
)
ref_wp_dense = WorkPrecisionSet(
prob, abstols ./ 1000, reltols ./ 1000, ref_setups;
@@ -155,6 +157,7 @@ ref_wp_dense = WorkPrecisionSet(
dense = true,
save_everystep = true,
maxiters = Int(1e7),
+ tstops = current_tspan,
)
plot!(ref_wp_final, x=:final, color=:gray, alpha=0.7, linestyle=:dash)
@@ -180,14 +183,13 @@ _setups = [
"EK0(3)" => Dict(:alg=>EK0(order=3, smooth=DENSE))
"EK1(2)" => Dict(:alg=>EK1(order=2, smooth=DENSE))
"EK1(3)" => Dict(:alg=>EK1(order=3, smooth=DENSE))
- "EK1(5)" => Dict(:alg=>EK1(order=5, smooth=DENSE))
+ "RosenbrockExpEK1(2)" => Dict(:alg=>RosenbrockExpEK(order=2, smooth=DENSE))
"RosenbrockExpEK1(3)" => Dict(:alg=>RosenbrockExpEK(order=3, smooth=DENSE))
- "RosenbrockExpEK1(5)" => Dict(:alg=>RosenbrockExpEK(order=5, smooth=DENSE))
]
labels = first.(_setups)
setups = last.(_setups)
-colors = [1 1 2 2 2 3 3]
+colors = [1 1 2 2 3 3]
abstols = 1.0 ./ 10.0 .^ (6:10)
reltols = 1.0 ./ 10.0 .^ (3:7)
@@ -200,6 +202,7 @@ wp = WorkPrecisionSet(
save_everystep = SAVE_EVERYSTEP,
maxiters = Int(1e7),
numruns = 5,
+ tstops = current_tspan,
)
plot(wp, title="Adaptive steps - with smoothing", color=colors)
@@ -364,8 +367,8 @@ InteractiveUtils.versioninfo()
```
```
-Julia Version 1.9.4
-Commit 8e5136fa297 (2023-11-14 08:46 UTC)
+Julia Version 1.10.0
+Commit 3120989f39b (2023-12-25 18:01 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
@@ -373,11 +376,10 @@ Platform Info:
CPU: 12 × Intel(R) Core(TM) i7-6800K CPU @ 3.40GHz
WORD_SIZE: 64
LIBM: libopenlibm
- LLVM: libLLVM-14.0.6 (ORCJIT, broadwell)
- Threads: 12 on 12 virtual cores
+ LLVM: libLLVM-15.0.7 (ORCJIT, broadwell)
+ Threads: 17 on 12 virtual cores
Environment:
JULIA_NUM_THREADS = auto
- JULIA_STACKTRACE_MINIMAL = true
```
```@raw html
@@ -395,24 +397,24 @@ Pkg.status()
```
Status `~/.julia/dev/ProbNumDiffEq/benchmarks/Project.toml`
- [f3b72e0c] DiffEqDevTools v2.42.0
- [31c24e10] Distributions v0.25.103
+ [f3b72e0c] DiffEqDevTools v2.44.1
+ [31c24e10] Distributions v0.25.104
[7073ff75] IJulia v1.24.2
[7f56f5a3] LSODA v0.7.5
[e6f89c97] LoggingExtras v1.0.3
[e2752cbe] MATLABDiffEq v1.2.0
-⌃ [961ee093] ModelingToolkit v8.73.0
+⌃ [961ee093] ModelingToolkit v8.73.2
[54ca160b] ODEInterface v0.5.0
[09606e27] ODEInterfaceDiffEq v3.13.3
- [1dea7af3] OrdinaryDiffEq v6.59.1
+⌃ [1dea7af3] OrdinaryDiffEq v6.66.0
[65888b18] ParameterizedFunctions v5.16.0
[91a5bcdd] Plots v1.39.0
- [bf3e78b0] ProbNumDiffEq v0.13.0 `~/.julia/dev/ProbNumDiffEq`
- [0bca4576] SciMLBase v2.8.1
+ [bf3e78b0] ProbNumDiffEq v0.13.1 `~/.julia/dev/ProbNumDiffEq`
+⌃ [0bca4576] SciMLBase v2.10.0
[505e40e9] SciPyDiffEq v0.2.1
[ce78b400] SimpleUnPack v1.1.0
- [90137ffa] StaticArrays v1.6.5
- [c3572dad] Sundials v4.20.1
+ [90137ffa] StaticArrays v1.9.0
+ [c3572dad] Sundials v4.23.1
[44d3d7a6] Weave v0.10.12
[0518478a] deSolveDiffEq v0.1.1
Info Packages marked with ⌃ have new versions available and may be upgradable.
@@ -432,16 +434,17 @@ Pkg.status(mode=Pkg.PKGMODE_MANIFEST)
```
Status `~/.julia/dev/ProbNumDiffEq/benchmarks/Manifest.toml`
- [47edcb42] ADTypes v0.2.5
-⌅ [c3fe647b] AbstractAlgebra v0.32.5
+ [47edcb42] ADTypes v0.2.6
+ [c3fe647b] AbstractAlgebra v0.34.7
[621f4979] AbstractFFTs v1.5.0
[1520ce14] AbstractTrees v0.4.4
[7d9f7c33] Accessors v0.1.33
- [79e6a3ab] Adapt v3.7.1
+⌅ [79e6a3ab] Adapt v3.7.2
[ec485272] ArnoldiMethod v0.2.0
[c9d4266f] ArrayAllocators v0.3.0
- [4fba245c] ArrayInterface v7.5.1
- [6e4b80f9] BenchmarkTools v1.3.2
+ [4fba245c] ArrayInterface v7.7.0
+ [4c555306] ArrayLayouts v1.4.5
+ [6e4b80f9] BenchmarkTools v1.4.0
[e2ed5e7c] Bijections v0.1.6
[d1d4a3ce] BitFlags v0.1.8
[62783981] BitTwiddlingConvenienceFunctions v0.1.5
@@ -450,7 +453,7 @@ Status `~/.julia/dev/ProbNumDiffEq/benchmarks/Manifest.toml`
[00ebfdb7] CSTParser v3.3.6
[49dc2e85] Calculus v0.5.1
[324d7699] CategoricalArrays v0.10.8
- [d360d2e6] ChainRulesCore v1.18.0
+ [d360d2e6] ChainRulesCore v1.19.0
[fb6a15b2] CloseOpenIntervals v0.1.12
[944b1d66] CodecZlib v0.7.3
[35d6a980] ColorSchemes v3.24.0
@@ -461,15 +464,15 @@ Status `~/.julia/dev/ProbNumDiffEq/benchmarks/Manifest.toml`
[a80b9123] CommonMark v0.8.12
[38540f10] CommonSolve v0.2.4
[bbf7d656] CommonSubexpressions v0.3.0
- [34da2185] Compat v4.10.0
+ [34da2185] Compat v4.10.1
[b152e2b5] CompositeTypes v0.1.3
[a33af91c] CompositionsBase v0.1.2
[2569d6c7] ConcreteStructs v0.2.3
[f0e56b4a] ConcurrentUtilities v2.3.0
-⌃ [8f4d0f93] Conda v1.9.1
+ [8f4d0f93] Conda v1.10.0
[187b0558] ConstructionBase v1.5.4
[d38c429a] Contour v0.6.2
- [587fd27a] CovarianceEstimation v0.2.9
+ [587fd27a] CovarianceEstimation v0.2.11
[adafc99b] CpuId v0.3.1
[a8cc5b0e] Crayons v4.1.1
[717857b8] DSP v0.7.9
@@ -478,49 +481,50 @@ Status `~/.julia/dev/ProbNumDiffEq/benchmarks/Manifest.toml`
[864edb3b] DataStructures v0.18.15
[e2d170a0] DataValueInterfaces v1.0.0
[8bb1440f] DelimitedFiles v1.9.1
- [2b5f629d] DiffEqBase v6.139.0
- [459566f4] DiffEqCallbacks v2.33.1
- [f3b72e0c] DiffEqDevTools v2.42.0
- [77a26b50] DiffEqNoiseProcess v5.19.0
+⌃ [2b5f629d] DiffEqBase v6.145.2
+ [459566f4] DiffEqCallbacks v2.36.1
+ [f3b72e0c] DiffEqDevTools v2.44.1
+ [77a26b50] DiffEqNoiseProcess v5.20.0
[163ba53b] DiffResults v1.1.0
[b552c78f] DiffRules v1.15.1
- [b4f34e82] Distances v0.10.10
- [31c24e10] Distributions v0.25.103
+ [b4f34e82] Distances v0.10.11
+ [31c24e10] Distributions v0.25.104
[ffbed154] DocStringExtensions v0.9.3
⌅ [5b8099bc] DomainSets v0.6.7
[fa6b7ba4] DualNumbers v0.6.8
[7c1d4256] DynamicPolynomials v0.5.3
[b305315f] Elliptic v1.0.1
[4e289a0a] EnumX v1.0.4
- [f151be2c] EnzymeCore v0.6.3
+ [f151be2c] EnzymeCore v0.6.4
[6912e4f1] Espresso v0.6.1
- [460bff9d] ExceptionUnwrapping v0.1.9
+ [460bff9d] ExceptionUnwrapping v0.1.10
[d4d017d3] ExponentialUtilities v1.25.0
[e2ba6199] ExprTools v0.1.10
[c87230d0] FFMPEG v0.4.1
- [7a1cc6ca] FFTW v1.7.1
+ [7a1cc6ca] FFTW v1.7.2
[7034ab61] FastBroadcast v0.2.8
[9aa1b823] FastClosures v0.3.2
- [442a2c76] FastGaussQuadrature v1.0.0
+ [442a2c76] FastGaussQuadrature v1.0.1
[29a986be] FastLapackInterface v2.0.0
- [1a297f60] FillArrays v1.7.0
- [6a86dc24] FiniteDiff v2.21.1
+ [1a297f60] FillArrays v1.9.3
+ [6a86dc24] FiniteDiff v2.22.0
+⌃ [b59a298d] FiniteHorizonGramians v0.1.1
[53c48c17] FixedPointNumbers v0.8.4
[59287772] Formatting v0.4.2
[f6369f11] ForwardDiff v0.10.36
[069b7b12] FunctionWrappers v1.1.3
[77dc65aa] FunctionWrappersWrappers v0.1.3
[d9f16b24] Functors v0.4.5
- [46192b85] GPUArraysCore v0.1.5
- [28b8d3ca] GR v0.72.10
+⌃ [46192b85] GPUArraysCore v0.1.5
+⌅ [28b8d3ca] GR v0.72.10
[43dcc890] GaussianDistributions v0.5.2
[c145ed77] GenericSchur v0.5.3
[c27321d9] Glob v1.3.1
[86223c79] Graphs v1.9.0
[42e2da0e] Grisu v1.0.2
-⌅ [0b43b601] Groebner v0.4.4
- [d5909c97] GroupsCore v0.4.0
- [cd3eb016] HTTP v1.10.0
+ [0b43b601] Groebner v0.5.1
+⌅ [d5909c97] GroupsCore v0.4.2
+ [cd3eb016] HTTP v1.10.1
[eafb193a] Highlights v0.5.2
[3e5b6fbb] HostCPUFeatures v0.1.16
[34004b35] HypergeometricFunctions v0.3.23
@@ -533,66 +537,69 @@ Status `~/.julia/dev/ProbNumDiffEq/benchmarks/Manifest.toml`
[3587e190] InverseFunctions v0.1.12
[41ab1584] InvertedIndices v1.3.0
[92d709cd] IrrationalConstants v0.2.2
- [c8e1da08] IterTools v1.8.0
+ [c8e1da08] IterTools v1.10.0
[82899510] IteratorInterfaceExtensions v1.0.0
- [1019f520] JLFzf v0.1.6
+ [1019f520] JLFzf v0.1.7
[692b3bcd] JLLWrappers v1.5.0
[682c06a0] JSON v0.21.4
- [98e50ef6] JuliaFormatter v1.0.42
- [ccbc3e58] JumpProcesses v9.8.0
+ [98e50ef6] JuliaFormatter v1.0.45
+ [ccbc3e58] JumpProcesses v9.10.1
[ef3ab10e] KLU v0.4.1
- [2c470bb0] Kronecker v0.5.4
- [ba0b0d4f] Krylov v0.9.4
+ [2c470bb0] Kronecker v0.5.5
+ [ba0b0d4f] Krylov v0.9.5
[7f56f5a3] LSODA v0.7.5
[b964fa9f] LaTeXStrings v1.3.1
- [2ee39098] LabelledArrays v1.14.0
+ [2ee39098] LabelledArrays v1.15.0
[984bce1d] LambertW v0.4.6
[23fbe1c1] Latexify v0.16.1
[73f95e8e] LatticeRules v0.0.1
[10f19ff3] LayoutPointers v0.1.15
[50d2b5c4] Lazy v0.15.1
+ [5078a376] LazyArrays v1.8.3
[1d6d02ad] LeftChildRightSiblingTrees v0.2.0
[d3d80556] LineSearches v7.2.0
- [7ed4a6bd] LinearSolve v2.20.0
+ [7ed4a6bd] LinearSolve v2.22.0
[2ab3a3ac] LogExpFunctions v0.3.26
[e6f89c97] LoggingExtras v1.0.3
[bdcacae8] LoopVectorization v0.12.166
[10e44e05] MATLAB v0.8.4
[e2752cbe] MATLABDiffEq v1.2.0
[d8e11817] MLStyle v0.4.17
- [1914dd2f] MacroTools v0.5.11
+ [1914dd2f] MacroTools v0.5.12
[d125e4d3] ManualMemory v0.1.8
- [739be429] MbedTLS v1.1.8
+ [a3b82374] MatrixFactorizations v2.1.0
+ [bb5d69b7] MaybeInplace v0.1.1
+ [739be429] MbedTLS v1.1.9
[442fdcdd] Measures v0.3.2
[e1d29d7a] Missings v1.1.0
-⌃ [961ee093] ModelingToolkit v8.73.0
+⌃ [961ee093] ModelingToolkit v8.73.2
[46d2c3a1] MuladdMacro v0.2.4
- [102ac46a] MultivariatePolynomials v0.5.2
+ [102ac46a] MultivariatePolynomials v0.5.3
[ffc61752] Mustache v1.0.19
- [d8a4904e] MutableArithmetics v1.3.3
+ [d8a4904e] MutableArithmetics v1.4.0
[d41bc354] NLSolversBase v7.8.3
[2774e3e8] NLsolve v4.5.1
[77ba4419] NaNMath v1.0.2
-⌅ [356022a1] NamedDims v0.2.50
- [8913a72c] NonlinearSolve v2.8.0
+ [356022a1] NamedDims v1.2.1
+⌃ [8913a72c] NonlinearSolve v3.1.0
[54ca160b] ODEInterface v0.5.0
[09606e27] ODEInterfaceDiffEq v3.13.3
[6fd5a793] Octavian v0.3.27
- [6fe1bfb0] OffsetArrays v1.12.10
+ [6fe1bfb0] OffsetArrays v1.13.0
[4d8831e6] OpenSSL v1.4.1
[429524aa] Optim v1.7.8
- [bac558e1] OrderedCollections v1.6.2
- [1dea7af3] OrdinaryDiffEq v6.59.1
- [90014a1f] PDMats v0.11.29
- [fe68d972] PSDMatrices v0.4.6
+ [bac558e1] OrderedCollections v1.6.3
+⌃ [1dea7af3] OrdinaryDiffEq v6.66.0
+ [90014a1f] PDMats v0.11.31
+ [fe68d972] PSDMatrices v0.4.7
[65ce6f38] PackageExtensionCompat v1.0.2
[65888b18] ParameterizedFunctions v5.16.0
[d96e819e] Parameters v0.12.3
- [69de0a69] Parsers v2.8.0
+ [69de0a69] Parsers v2.8.1
[b98c9c47] Pipe v1.3.0
[32113eaa] PkgBenchmark v0.2.12
[ccf2f8ad] PlotThemes v3.1.0
- [995b91a9] PlotUtils v1.3.5
+ [995b91a9] PlotUtils v1.4.0
[91a5bcdd] Plots v1.39.0
[e409e4f3] PoissonRandom v0.4.4
[f517fe37] Polyester v0.7.9
@@ -600,36 +607,35 @@ Status `~/.julia/dev/ProbNumDiffEq/benchmarks/Manifest.toml`
⌅ [f27b6e38] Polynomials v3.2.13
[2dfb63ee] PooledArrays v1.4.3
[85a6dd25] PositiveFactorizations v0.2.4
- [d236fae5] PreallocationTools v0.4.12
+ [d236fae5] PreallocationTools v0.4.16
[aea7be01] PrecompileTools v1.2.0
[21216c6a] Preferences v1.4.1
- [08abe8d2] PrettyTables v2.3.0
+ [08abe8d2] PrettyTables v2.3.1
[27ebfcd6] Primes v0.5.5
- [bf3e78b0] ProbNumDiffEq v0.13.0 `~/.julia/dev/ProbNumDiffEq`
+ [bf3e78b0] ProbNumDiffEq v0.13.1 `~/.julia/dev/ProbNumDiffEq`
[33c8b6b6] ProgressLogging v0.1.4
- [438e738f] PyCall v1.96.2
+ [438e738f] PyCall v1.96.4
[1fd47b50] QuadGK v2.9.1
-⌃ [8a4e6c94] QuasiMonteCarlo v0.3.2
+ [8a4e6c94] QuasiMonteCarlo v0.3.3
[6f49c342] RCall v0.13.18
- [74087812] Random123 v1.6.1
+ [74087812] Random123 v1.6.2
[fb686558] RandomExtensions v0.4.4
[e6cf234a] RandomNumbers v1.5.3
[3cdcf5f2] RecipesBase v1.3.4
[01d81517] RecipesPipeline v0.6.12
- [731186ca] RecursiveArrayTools v2.38.10
+⌅ [731186ca] RecursiveArrayTools v2.38.10
[f2c3362d] RecursiveFactorization v0.2.21
[189a3867] Reexport v1.2.2
[05181044] RelocatableFolders v1.0.1
[ae029012] Requires v1.3.0
[ae5879a3] ResettableStacks v1.1.1
[79098fc4] Rmath v0.7.1
- [47965b36] RootedTrees v2.19.2
+ [47965b36] RootedTrees v2.20.0
[7e49a35a] RuntimeGeneratedFunctions v0.5.12
[fdea26ae] SIMD v3.4.6
[94e857df] SIMDTypes v0.1.0
[476501e8] SLEEFPirates v0.6.42
- [0bca4576] SciMLBase v2.8.1
- [e9a6253c] SciMLNLSolve v0.1.9
+⌃ [0bca4576] SciMLBase v2.10.0
[c0aeaf25] SciMLOperators v0.3.7
[505e40e9] SciPyDiffEq v0.2.1
[6c6a2e73] Scratch v1.2.1
@@ -638,37 +644,36 @@ Status `~/.julia/dev/ProbNumDiffEq/benchmarks/Manifest.toml`
[1277b4bf] ShiftedArrays v2.0.0
[992d4aef] Showoff v1.0.3
[777ac1f9] SimpleBufferStream v1.1.0
- [727e6d20] SimpleNonlinearSolve v0.1.25
+ [727e6d20] SimpleNonlinearSolve v1.2.0
[699a6c99] SimpleTraits v0.9.4
[ce78b400] SimpleUnPack v1.1.0
- [66db9d55] SnoopPrecompile v1.0.3
[ed01d8cd] Sobol v1.5.0
[b85f4697] SoftGlobalScope v1.1.0
- [a2af1166] SortingAlgorithms v1.2.0
-⌃ [47a9eef4] SparseDiffTools v2.11.0
+ [a2af1166] SortingAlgorithms v1.2.1
+ [47a9eef4] SparseDiffTools v2.15.0
[e56a9233] Sparspak v0.3.9
[276daf66] SpecialFunctions v2.3.1
[928aab9d] SpecialMatrices v3.0.0
[aedffcd0] Static v0.8.8
- [0d7ed370] StaticArrayInterface v1.4.1
- [90137ffa] StaticArrays v1.6.5
+ [0d7ed370] StaticArrayInterface v1.5.0
+ [90137ffa] StaticArrays v1.9.0
[1e83bf80] StaticArraysCore v1.4.2
[82ae8749] StatsAPI v1.7.0
[2913bbd2] StatsBase v0.34.2
[4c63d2b9] StatsFuns v1.3.0
[3eaba693] StatsModels v0.7.3
- [7792a7ef] StrideArraysCore v0.5.1
+ [7792a7ef] StrideArraysCore v0.5.2
[69024149] StringEncodings v0.3.7
[892a3eda] StringManipulation v0.3.4
[09ab397b] StructArrays v0.6.16
- [c3572dad] Sundials v4.20.1
- [2efcf032] SymbolicIndexingInterface v0.2.2
- [d1185830] SymbolicUtils v1.4.0
- [0c5d862f] Symbolics v5.10.0
+ [c3572dad] Sundials v4.23.1
+⌅ [2efcf032] SymbolicIndexingInterface v0.2.2
+⌃ [d1185830] SymbolicUtils v1.4.0
+⌃ [0c5d862f] Symbolics v5.11.0
[3783bdb8] TableTraits v1.0.1
[bd369af6] Tables v1.11.1
- [92b13dbe] TaylorIntegration v0.14.4
- [6aa5eb33] TaylorSeries v0.15.2
+ [92b13dbe] TaylorIntegration v0.14.5
+ [6aa5eb33] TaylorSeries v0.15.4
[62fd8b95] TensorCore v0.1.1
[5d786b92] TerminalLoggers v0.1.7
[8290d209] ThreadingUtilities v0.5.2
@@ -676,18 +681,17 @@ Status `~/.julia/dev/ProbNumDiffEq/benchmarks/Manifest.toml`
[c751599d] ToeplitzMatrices v0.8.2
[0796e94c] Tokenize v0.5.26
[3bb67fe8] TranscodingStreams v0.10.2
- [a2a6695c] TreeViews v0.3.0
[d5829a12] TriangularSolve v0.1.20
[410a4b4d] Tricks v0.1.8
[781d530d] TruncatedStacktraces v1.4.0
[5c2747f8] URIs v1.5.1
[3a884ed6] UnPack v1.0.2
[1cfade01] UnicodeFun v0.4.1
- [1986cc42] Unitful v1.18.0
+ [1986cc42] Unitful v1.19.0
[45397f5d] UnitfulLatexify v1.6.3
- [a7c27f48] Unityper v0.1.5
+ [a7c27f48] Unityper v0.1.6
[41fe7b60] Unzip v0.2.0
- [3d5dd08c] VectorizationBase v0.21.64
+ [3d5dd08c] VectorizationBase v0.21.65
[81def892] VersionParsing v1.3.0
[19fa3120] VertexSafeGraphs v0.2.0
[44d3d7a6] Weave v0.10.12
@@ -704,17 +708,17 @@ Status `~/.julia/dev/ProbNumDiffEq/benchmarks/Manifest.toml`
[a3f928ae] Fontconfig_jll v2.13.93+0
[d7e528f0] FreeType2_jll v2.13.1+0
[559328eb] FriBidi_jll v1.0.10+0
- [0656b61e] GLFW_jll v3.3.8+0
- [d2c73de3] GR_jll v0.72.10+0
+ [0656b61e] GLFW_jll v3.3.9+0
+⌅ [d2c73de3] GR_jll v0.72.10+0
[78b55507] Gettext_jll v0.21.0+0
[7746bdde] Glib_jll v2.76.5+0
[3b182d85] Graphite2_jll v1.3.14+0
[2e76f6c2] HarfBuzz_jll v2.8.1+1
- [1d5cc7b8] IntelOpenMP_jll v2023.2.0+0
- [aacddb02] JpegTurbo_jll v2.1.91+0
+ [1d5cc7b8] IntelOpenMP_jll v2024.0.2+0
+ [aacddb02] JpegTurbo_jll v3.0.1+0
[c1c5ebd0] LAME_jll v3.100.1+0
[88015f11] LERC_jll v3.0.0+1
- [1d63c593] LLVMOpenMP_jll v15.0.4+0
+ [1d63c593] LLVMOpenMP_jll v15.0.7+0
[aae0fff6] LSODA_jll v0.1.2+0
[dd4b983a] LZO_jll v2.10.1+0
⌅ [e9f186c6] Libffi_jll v3.2.2+1
@@ -723,9 +727,9 @@ Status `~/.julia/dev/ProbNumDiffEq/benchmarks/Manifest.toml`
[7add5ba3] Libgpg_error_jll v1.42.0+0
[94ce4f54] Libiconv_jll v1.17.0+0
[4b2f31a3] Libmount_jll v2.35.0+0
- [89763e89] Libtiff_jll v4.5.1+1
+⌅ [89763e89] Libtiff_jll v4.5.1+1
[38a345b3] Libuuid_jll v2.36.0+0
- [856f044c] MKL_jll v2023.2.0+0
+ [856f044c] MKL_jll v2024.0.0+0
[c771fb93] ODEInterface_jll v0.0.1+0
[e7412a2a] Ogg_jll v1.3.5+1
[458c3c95] OpenSSL_jll v3.0.12+0
@@ -734,11 +738,11 @@ Status `~/.julia/dev/ProbNumDiffEq/benchmarks/Manifest.toml`
[30392449] Pixman_jll v0.42.2+0
[c0090381] Qt6Base_jll v6.5.3+1
[f50d1b31] Rmath_jll v0.4.0+0
-⌅ [fb77eaff] Sundials_jll v5.2.1+0
+⌅ [fb77eaff] Sundials_jll v5.2.2+0
[a44049a8] Vulkan_Loader_jll v1.3.243+0
[a2964d1f] Wayland_jll v1.21.0+1
- [2381bf8a] Wayland_protocols_jll v1.25.0+0
- [02c8fc9c] XML2_jll v2.11.5+0
+ [2381bf8a] Wayland_protocols_jll v1.31.0+0
+ [02c8fc9c] XML2_jll v2.12.2+0
[aed1982a] XSLT_jll v1.1.34+0
[ffd25f8a] XZ_jll v5.4.5+0
[f67eecfb] Xorg_libICE_jll v1.0.10+1
@@ -768,14 +772,14 @@ Status `~/.julia/dev/ProbNumDiffEq/benchmarks/Manifest.toml`
[8f1865be] ZeroMQ_jll v4.3.4+0
[3161d3a3] Zstd_jll v1.5.5+0
[35ca27e7] eudev_jll v3.2.9+0
-⌅ [214eeab7] fzf_jll v0.35.1+0
+ [214eeab7] fzf_jll v0.43.0+0
[1a1c6b14] gperf_jll v3.1.1+0
[a4ae2306] libaom_jll v3.4.0+0
[0ac62f75] libass_jll v0.15.1+0
[2db6ffa8] libevdev_jll v1.11.0+0
[f638f0a6] libfdk_aac_jll v2.0.2+0
[36db933b] libinput_jll v1.18.0+0
- [b53b4c65] libpng_jll v1.6.38+0
+ [b53b4c65] libpng_jll v1.6.40+0
[a9144af2] libsodium_jll v1.0.20+0
[f27f6e37] libvorbis_jll v1.3.7+1
[009596ad] mtdev_jll v1.1.6+0
@@ -800,7 +804,7 @@ Status `~/.julia/dev/ProbNumDiffEq/benchmarks/Manifest.toml`
[d6f4376e] Markdown
[a63ad114] Mmap
[ca575930] NetworkOptions v1.2.0
- [44cfe95a] Pkg v1.9.2
+ [44cfe95a] Pkg v1.10.0
[de0858da] Printf
[9abbd945] Profile
[3fa0cd96] REPL
@@ -809,27 +813,28 @@ Status `~/.julia/dev/ProbNumDiffEq/benchmarks/Manifest.toml`
[9e88b42a] Serialization
[1a1011a3] SharedArrays
[6462fe0b] Sockets
- [2f01184e] SparseArrays
- [10745b16] Statistics v1.9.0
+ [2f01184e] SparseArrays v1.10.0
+ [10745b16] Statistics v1.10.0
[4607b0f0] SuiteSparse
[fa267f1f] TOML v1.0.3
[a4e569a6] Tar v1.10.0
[8dfed614] Test
[cf7118a7] UUIDs
[4ec0a83e] Unicode
- [e66e0078] CompilerSupportLibraries_jll v1.0.5+0
+ [e66e0078] CompilerSupportLibraries_jll v1.0.5+1
[deac9b47] LibCURL_jll v8.4.0+0
+ [e37daf67] LibGit2_jll v1.6.4+0
[29816b5a] LibSSH2_jll v1.11.0+1
- [c8ffd9c3] MbedTLS_jll v2.28.2+0
- [14a3606d] MozillaCACerts_jll v2022.10.11
- [4536629a] OpenBLAS_jll v0.3.21+4
- [05823500] OpenLibm_jll v0.8.1+0
- [efcefdf7] PCRE2_jll v10.42.0+0
- [bea87d4a] SuiteSparse_jll v5.10.1+6
- [83775a58] Zlib_jll v1.2.13+0
- [8e850b90] libblastrampoline_jll v5.8.0+0
+ [c8ffd9c3] MbedTLS_jll v2.28.2+1
+ [14a3606d] MozillaCACerts_jll v2023.1.10
+ [4536629a] OpenBLAS_jll v0.3.23+2
+ [05823500] OpenLibm_jll v0.8.1+2
+ [efcefdf7] PCRE2_jll v10.42.0+1
+ [bea87d4a] SuiteSparse_jll v7.2.1+1
+ [83775a58] Zlib_jll v1.2.13+1
+ [8e850b90] libblastrampoline_jll v5.8.0+1
[8e850ede] nghttp2_jll v1.52.0+1
- [3f19e933] p7zip_jll v17.4.0+0
+ [3f19e933] p7zip_jll v17.4.0+2
Info Packages marked with ⌃ and ⌅ have new versions available. Those with ⌃ may be upgradable, but those with ⌅ are restricted by compatibility constraints from upgrading. To see why use `status --outdated -m`
```
diff --git a/src/ProbNumDiffEq.jl b/src/ProbNumDiffEq.jl
index b782372b4..ffd774d6d 100644
--- a/src/ProbNumDiffEq.jl
+++ b/src/ProbNumDiffEq.jl
@@ -2,7 +2,7 @@ __precompile__()
module ProbNumDiffEq
-import Base: copy, copy!, show, size, ndims, similar, isapprox, isequal, iterate, ==
+import Base: copy, copy!, show, size, ndims, similar, isapprox, isequal, iterate, ==, length
using LinearAlgebra
import LinearAlgebra: mul!
@@ -28,6 +28,8 @@ using Octavian
using FastGaussQuadrature
import Kronecker
using ArrayAllocators
+using FiniteHorizonGramians
+using FillArrays
@reexport using GaussianDistributions
using GaussianDistributions: logpdf
diff --git a/src/caches.jl b/src/caches.jl
index 6d6adf8a8..6d4a2cfa1 100644
--- a/src/caches.jl
+++ b/src/caches.jl
@@ -3,7 +3,9 @@
########################################################################################
mutable struct EKCache{
RType,CFacType,ProjType,SolProjType,PType,PIType,EType,uType,duType,xType,PriorType,
- AType,QType,HType,matType,bkType,diffusionType,diffModelType,measModType,measType,
+ AType,QType,
+ FType,LType,FHGMethodType,FHGCacheType,
+ HType,matType,bkType,diffusionType,diffModelType,measModType,measType,
puType,llType,dtType,rateType,UF,JC,uNoUnitsType,
} <: AbstractODEFilterCache
# Constants
@@ -15,6 +17,10 @@ mutable struct EKCache{
Q::QType
Ah::AType
Qh::QType
+ F::FType # Prior SDE drift
+ L::LType # Prior SDE dispersion
+ FHG_method::FHGMethodType
+ FHG_cache::FHGCacheType
diffusionmodel::diffModelType
measurement_model::measModType
R::RType
@@ -125,6 +131,12 @@ function OrdinaryDiffEq.alg_cache(
error("Invalid prior $(alg.prior)")
end
A, Q, Ah, Qh, P, PI = initialize_transition_matrices(FAC, prior, dt)
+ F, L = to_sde(prior)
+ F, L = to_factorized_matrix(FAC, F), to_factorized_matrix(FAC, L)
+ FHG_method =
+ !(prior isa IWP) ? FiniteHorizonGramians.ExpAndGram{eltype(F),13}() : nothing
+ FHG_cache =
+ !(prior isa IWP) ? FiniteHorizonGramians.alloc_mem(F, L, FHG_method) : nothing
# Measurement Model
measurement_model = make_measurement_model(f)
@@ -213,12 +225,15 @@ function OrdinaryDiffEq.alg_cache(
ll = zero(uEltypeNoUnits)
return EKCache{
typeof(R),typeof(FAC),typeof(Proj),typeof(SolProj),typeof(P),typeof(PI),typeof(E0),
- uType,typeof(du),typeof(x0),typeof(prior),typeof(A),typeof(Q),typeof(H),matType,
+ uType,typeof(du),typeof(x0),typeof(prior),typeof(A),typeof(Q),
+ typeof(F),typeof(L),typeof(FHG_method),typeof(FHG_cache),
+ typeof(H),matType,
typeof(backward_kernel),typeof(initdiff),
typeof(diffmodel),typeof(measurement_model),typeof(measurement),typeof(pu_tmp),
uEltypeNoUnits,typeof(dt),typeof(du1),typeof(uf),typeof(jac_config),typeof(atmp),
}(
- d, q, FAC, prior, A, Q, Ah, Qh, diffmodel, measurement_model, R, Proj, SolProj,
+ d, q, FAC, prior, A, Q, Ah, Qh, F, L, FHG_method, FHG_cache, diffmodel,
+ measurement_model, R, Proj, SolProj,
P, PI, E0, E1, E2,
u, u_pred, u_filt, tmp, atmp,
x0, xprev, x_pred, x_filt, x_tmp, x_tmp2,
diff --git a/src/preconditioning.jl b/src/preconditioning.jl
index 5c334f8e9..8dfd9fac8 100644
--- a/src/preconditioning.jl
+++ b/src/preconditioning.jl
@@ -9,7 +9,7 @@ function init_preconditioner(C::DenseCovariance{elType}) where {elType}
return P, PI
end
-function make_preconditioners!(cache::AbstractODEFilterCache, dt)
+function make_preconditioners!(cache, dt)
@unpack P, PI, d, q = cache
return make_preconditioners!(P, PI, d, q, dt)
end
diff --git a/src/priors/common.jl b/src/priors/common.jl
index a4cad3f70..fcebb0a52 100644
--- a/src/priors/common.jl
+++ b/src/priors/common.jl
@@ -99,17 +99,8 @@ make_transition_matrices!(cache::AbstractODEFilterCache, dt) =
make_transition_matrices!(cache, cache.prior, dt)
"""
- to_1d_sde(p::AbstractODEFilterPrior)
+ to_sde(p::AbstractODEFilterPrior)
-Convert the prior to a 1-dimensional SDE. This is only possible for independent dimensions.
+Convert the prior to the corresponding SDE.
"""
-to_1d_sde(p::AbstractODEFilterPrior)
-
-function to_sde(p::AbstractODEFilterPrior)
- d = p.wiener_process_dimension
- _sde = to_1d_sde(p)
- F_breve, L_breve = drift(_sde), dispersion(_sde)
- F = kron(I(d), F_breve)
- L = kron(I(d), L_breve)
- return LTISDE(F, L)
-end
+to_sde(p::AbstractODEFilterPrior)
diff --git a/src/priors/ioup.jl b/src/priors/ioup.jl
index 0840138d7..65006bac9 100644
--- a/src/priors/ioup.jl
+++ b/src/priors/ioup.jl
@@ -61,13 +61,9 @@ IOUP{T}(
update_rate_parameter,
)
-function to_1d_sde(p::IOUP)
+function to_sde(p::IOUP{T,D,<:Number}) where {T,D}
q = p.num_derivatives
r = p.rate_parameter
- if !(r isa Number)
- m = "The rate parameter must be a scalar to convert the IOUP to a 1D SDE."
- throw(ArgumentError(m))
- end
F_breve = diagm(1 => ones(q))
F_breve[end, end] = r
@@ -75,22 +71,16 @@ function to_1d_sde(p::IOUP)
L_breve = zeros(q + 1)
L_breve[end] = 1.0
- return LTISDE(F_breve, L_breve)
+ d = p.wiener_process_dimension
+ F = IsometricKroneckerProduct(d, F_breve)
+ L = IsometricKroneckerProduct(d, L_breve)
+ return LTISDE(F, L)
end
function to_sde(p::IOUP)
d = p.wiener_process_dimension
q = p.num_derivatives
r = p.rate_parameter
- if r isa Number
- d = p.wiener_process_dimension
- _sde = to_1d_sde(p)
- F_breve, L_breve = drift(_sde), dispersion(_sde)
- F = kron(I(d), F_breve)
- L = kron(I(d), L_breve)
- return LTISDE(F, L)
- end
-
R = if r isa AbstractVector
@assert length(r) == d
Diagonal(r)
@@ -112,21 +102,48 @@ function to_sde(p::IOUP)
end
function discretize(p::IOUP, dt::Real)
- r = p.rate_parameter
- A, Q = if p.rate_parameter isa Number
- A_breve, QR_breve = discretize_sqrt(to_1d_sde(p), dt)
-
- d = p.wiener_process_dimension
- A = kron(I(d), A_breve)
- QR = kron(I(d), QR_breve)
- Q = PSDMatrix(QR)
- A, Q
+ F, L = to_sde(p)
+ if F isa IsometricKroneckerProduct
+ method = FiniteHorizonGramians.ExpAndGram{eltype(F.B),13}()
+ A_breve, QR_breve = FiniteHorizonGramians.exp_and_gram_chol(F.B, L.B, dt, method)
+ A = IsometricKroneckerProduct(F.ldim, A_breve)
+ Q = PSDMatrix(IsometricKroneckerProduct(F.ldim, QR_breve))
+ return A, Q
else
- @assert r isa AbstractVector || r isa AbstractMatrix
- A, QR = discretize_sqrt(to_sde(p), dt)
+ method = FiniteHorizonGramians.ExpAndGram{eltype(F),13}()
+ A, QR = FiniteHorizonGramians.exp_and_gram_chol(F, L, dt, method)
Q = PSDMatrix(QR)
- A, Q
+ return A, Q
end
+end
+
+function update_sde_drift!(F::AbstractMatrix, prior::IOUP{<:Any,<:Any,<:AbstractMatrix})
+ q = prior.num_derivatives
+ r = prior.rate_parameter
+ F[q+1:q+1:end, q+1:q+1:end] = r
+end
+function update_sde_drift!(F::AbstractMatrix, prior::IOUP{<:Any,<:Any,<:AbstractVector})
+ q = prior.num_derivatives
+ r = prior.rate_parameter
+ F[q+1:q+1:end, q+1:q+1:end] = Diagonal(r)
+end
+function update_sde_drift!(F::AbstractMatrix, prior::IOUP{<:Any,<:Any,<:Number})
+ d = prior.wiener_process_dimension
+ q = prior.num_derivatives
+ r = prior.rate_parameter
+ F[q+1:q+1:end, q+1:q+1:end] = Diagonal(Fill(r, d))
+end
+
+function make_transition_matrices!(cache, prior::IOUP, dt)
+ @unpack F, L, A, Q, Ah, Qh, P, PI = cache
+
+ update_sde_drift!(F, prior)
+
+ make_preconditioners!(cache, dt)
+
+ FiniteHorizonGramians.exp_and_gram_chol!(
+ Ah, Qh.R, F, L, dt, cache.FHG_method, cache.FHG_cache)
- return A, Q
+ _matmul!(A, P, _matmul!(A, Ah, PI))
+ fast_X_A_Xt!(Q, Qh, P)
end
diff --git a/src/priors/iwp.jl b/src/priors/iwp.jl
index cbe9a4cab..f675c6352 100644
--- a/src/priors/iwp.jl
+++ b/src/priors/iwp.jl
@@ -36,12 +36,16 @@ IWP{elType}(wiener_process_dimension, num_derivatives) where {elType} =
IWP(wiener_process_dimension, num_derivatives) =
IWP{typeof(1.0)}(wiener_process_dimension, num_derivatives)
-function to_1d_sde(p::IWP)
- q = p.num_derivatives
+function to_sde(p::IWP)
+ d, q = p.wiener_process_dimension, p.num_derivatives
+
F_breve = diagm(1 => ones(q))
L_breve = zeros(q + 1)
L_breve[end] = 1.0
- return LTISDE(F_breve, L_breve)
+
+ F = IsometricKroneckerProduct(d, F_breve)
+ L = IsometricKroneckerProduct(d, L_breve)
+ return LTISDE(F, L)
end
"""
diff --git a/src/priors/ltisde.jl b/src/priors/ltisde.jl
index 30ba4efda..b6d088194 100644
--- a/src/priors/ltisde.jl
+++ b/src/priors/ltisde.jl
@@ -21,8 +21,34 @@ end
drift(sde::LTISDE) = sde.F
dispersion(sde::LTISDE) = sde.L
-discretize(sde::LTISDE, dt::Real) =
- matrix_fraction_decomposition(drift(sde), dispersion(sde), dt)
+iterate(sde::LTISDE) = sde.F, true
+iterate(sde::LTISDE, s) = s ? (sde.L, false) : nothing
+length(sde::LTISDE) = 2
+
+discretize(sde::LTISDE, dt::Real) = discretize(drift(sde), dispersion(sde), dt)
+discretize(F::AbstractMatrix, L::AbstractMatrix, dt::Real) = begin
+ method = FiniteHorizonGramians.ExpAndGram{eltype(F),13}()
+ A, QR = FiniteHorizonGramians.exp_and_gram_chol(F, L, dt, method)
+ Q = PSDMatrix(QR)
+ return A, Q
+end
+discretize(F::IsometricKroneckerProduct, L::IsometricKroneckerProduct, dt::Real) = begin
+ method = FiniteHorizonGramians.ExpAndGram{eltype(F.B),13}()
+ A_breve, QR_breve = FiniteHorizonGramians.exp_and_gram_chol(F.B, L.B, dt, method)
+ A = IsometricKroneckerProduct(F.ldim, A_breve)
+ Q = PSDMatrix(IsometricKroneckerProduct(F.ldim, QR_breve))
+ return A, Q
+end
+
+function matrix_fraction_decomposition(
+ drift::IsometricKroneckerProduct,
+ dispersion::IsometricKroneckerProduct,
+ dt::Real,
+)
+ d = drift.ldim
+ A_breve, Q_breve = matrix_fraction_decomposition(drift.B, dispersion.B, dt)
+ return IsometricKroneckerProduct(d, A_breve), IsometricKroneckerProduct(d, Q_breve)
+end
function matrix_fraction_decomposition(
drift::AbstractMatrix,
@@ -37,12 +63,13 @@ function matrix_fraction_decomposition(
return A, Q
end
-function discretize_sqrt(sde::LTISDE, dt::Real)
+# Previous implementation, outdated thanks to FiniteHorizonGramians.jl:
+function _discretize_sqrt_with_quadraturetrick(sde::LTISDE, dt::Real)
F, L = drift(sde), dispersion(sde)
D = size(F, 1)
d = size(L, 2)
- N = Int(D / d)
+ N = D # more robust than Int(D / d)
R = similar(F, N * d, D)
method = ExpMethodHigham2005()
expcache = ExponentialUtilities.alloc_mem(F, method)
diff --git a/src/priors/matern.jl b/src/priors/matern.jl
index e1fbcee67..1b5e993a5 100644
--- a/src/priors/matern.jl
+++ b/src/priors/matern.jl
@@ -43,9 +43,10 @@ Matern{T}(wiener_process_dimension, num_derivatives, lengthscale) where {T} =
lengthscale,
)
-function to_1d_sde(p::Matern)
+function to_sde(p::Matern)
q = p.num_derivatives
l = p.lengthscale
+ @assert l isa Number
ν = q - 1 / 2
λ = sqrt(2ν) / l
@@ -56,31 +57,14 @@ function to_1d_sde(p::Matern)
L_breve = zeros(q + 1)
L_breve[end] = 1.0
- return LTISDE(F_breve, L_breve)
-end
-function to_sde(p::Matern)
d = p.wiener_process_dimension
- _sde = to_1d_sde(p)
- F_breve, L_breve = drift(_sde), dispersion(_sde)
- F = kron(I(d), F_breve)
- L = kron(I(d), L_breve)
+ F = IsometricKroneckerProduct(d, F_breve)
+ L = IsometricKroneckerProduct(d, L_breve)
return LTISDE(F, L)
end
function discretize(p::Matern, dt::Real)
l = p.lengthscale
@assert l isa Number
- A, Q = begin
- A_breve, Q_breve = discretize(to_1d_sde(p), dt)
- d = p.wiener_process_dimension
- # QR_breve = cholesky!(Symmetric(Q_breve)).L'
- E = eigen(Symmetric(Q_breve))
- QR_breve = Diagonal(sqrt.(max.(E.values, 0))) * E.vectors'
-
- A = kron(I(d), A_breve)
- QR = kron(I(d), QR_breve)
- Q = PSDMatrix(QR)
- A, Q
- end
-
+ A, Q = discretize(to_sde(p), dt)
return A, Q
end
diff --git a/test/Project.toml b/test/Project.toml
index 2af565072..056d6c57e 100644
--- a/test/Project.toml
+++ b/test/Project.toml
@@ -2,6 +2,7 @@
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
DiffEqDevTools = "f3b72e0c-5b89-59e1-b016-84e28bfd966d"
FiniteDiff = "6a86dc24-6348-571c-b903-95158fe2bd41"
+FiniteHorizonGramians = "b59a298d-d283-4a37-9369-85a9f9a111a5"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
Kronecker = "2c470bb0-bcc8-11e8-3dad-c9649493f05e"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
diff --git a/test/core/priors.jl b/test/core/priors.jl
index 788af07a3..e51955131 100644
--- a/test/core/priors.jl
+++ b/test/core/priors.jl
@@ -3,22 +3,29 @@ using ProbNumDiffEq
import ProbNumDiffEq as PNDE
using Test
using LinearAlgebra
+using FiniteHorizonGramians
h = 0.1
σ = 0.1
@testset "General prior API" begin
for prior in (IWP(2, 3), IOUP(2, 3, 1), Matern(2, 3, 1))
- @test_nowarn PNDE.to_1d_sde(prior)
sde = PNDE.to_sde(prior)
A1, Q1 = PNDE.discretize(sde, h)
A2, Q2 = PNDE.discretize(prior, h)
@test A1 ≈ A2
- @test Q1 ≈ Matrix(Q2)
- end
-
- for prior in (IOUP(2, 3, ones(2)), IOUP(2, 3, I(2)))
- @test_throws ArgumentError PNDE.to_1d_sde(prior)
+ @test Q1 ≈ Q2
+ @test Matrix(Q1) ≈ Matrix(Q2)
+
+ A3, Q3 = PNDE.matrix_fraction_decomposition(
+ PNDE.drift(sde), PNDE.dispersion(sde), h)
+ @test A1 ≈ A3
+ @test Matrix(Q1) ≈ Q3
+
+ A4, Q4R = PNDE._discretize_sqrt_with_quadraturetrick(
+ PNDE.LTISDE(Matrix(sde.F), Matrix(sde.L)), h)
+ @test A1 ≈ A4
+ @test Q1.R ≈ Q4R
end
end
@@ -108,29 +115,64 @@ end
end
@testset "Test `make_transition_matrices!`" begin
- struct DummyCache <: PNDE.AbstractODEFilterCache
- d::Any
- q::Any
- A::Any
- Q::Any
- P::Any
- PI::Any
- Ah::Any
- Qh::Any
- end
-
A, Q, Ah, Qh, P, PI = PNDE.initialize_transition_matrices(
PNDE.DenseCovariance{Float64}(d, q), prior, h)
+
@test AH_22_PRE ≈ A
@test QH_22_PRE ≈ Matrix(PNDE.apply_diffusion(Q, σ^2))
- cache = DummyCache(d, q, A, Q, P, PI, Ah, Qh)
+ cache = (
+ d=d,
+ q=q,
+ A=A,
+ Q=Q,
+ P=P,
+ PI=PI,
+ Ah=Ah,
+ Qh=Qh,
+ )
+
make_transition_matrices!(cache, prior, h)
- @test AH_22_IBM ≈ Ah
+ @test AH_22_IBM ≈ cache.Ah
@test QH_22_IBM ≈ Matrix(PNDE.apply_diffusion(cache.Qh, σ^2))
end
end
+function test_make_transition_matrices(prior, Atrue, Qtrue)
+ d, q = prior.wiener_process_dimension, prior.num_derivatives
+ @testset "Test `make_transition_matrices!`" begin
+ A, Q, Ah, Qh, P, PI = PNDE.initialize_transition_matrices(
+ PNDE.DenseCovariance{Float64}(d, q), prior, h)
+ F, L = PNDE.to_sde(prior)
+ FHG_method = FiniteHorizonGramians.ExpAndGram{eltype(F),13}()
+ FHG_cache = FiniteHorizonGramians.alloc_mem(F, L, FHG_method)
+
+ cache = (
+ d=d,
+ q=q,
+ A=A,
+ Q=Q,
+ P=P,
+ PI=PI,
+ Ah=Ah,
+ Qh=Qh,
+ F=F,
+ L=L,
+ FHG_method=FHG_method,
+ FHG_cache=FHG_cache,
+ prior=prior,
+ )
+
+ make_transition_matrices!(cache, prior, h)
+
+ @test Atrue ≈ cache.Ah
+ @test Qtrue ≈ cache.Qh
+
+ @test Atrue ≈ cache.PI * cache.A * cache.P
+ @test Qtrue ≈ X_A_Xt(cache.Q, cache.PI)
+ end
+end
+
@testset "Test IOUP (d=2,q=2)" begin
d, q = 2, 2
r = randn(d, d)
@@ -156,6 +198,14 @@ end
]
@test sde.F ≈ F
@test sde.L ≈ L
+
+ A1, Q1 = PNDE.discretize(prior, h)
+ A2, Q2 = PNDE.discretize(sde, h)
+ @test A1 ≈ A2
+ @test Q1 ≈ Q2
+ @test Matrix(Q1) ≈ Matrix(Q2)
+
+ test_make_transition_matrices(prior, A1, Q1)
end
@testset "Test Matern (d=2,q=2)" begin
@@ -187,4 +237,12 @@ end
]
@test sde.F ≈ F
@test sde.L ≈ L
+
+ A1, Q1 = PNDE.discretize(prior, h)
+ A2, Q2 = PNDE.discretize(sde, h)
+ @test A1 ≈ A2
+ @test Q1 ≈ Q2
+ @test Matrix(Q1) ≈ Matrix(Q2)
+
+ test_make_transition_matrices(prior, A1, Q1)
end
diff --git a/test/secondorderode.jl b/test/secondorderode.jl
index 8143c2c5b..b849af055 100644
--- a/test/secondorderode.jl
+++ b/test/secondorderode.jl
@@ -9,7 +9,7 @@ function twobody(du, u, p, t)
@. du[1:2] = u[3:4]
end
u0, du0 = [0.4, 0.0], [0.0, 2.0]
-tspan = (0, 2π)
+tspan = (0, 0.1)
prob_base = ODEProblem(twobody, [u0...; du0...], tspan)
function twobody2_iip(ddu, du, u, p, t)
@@ -26,32 +26,25 @@ prob_oop = SecondOrderODEProblem(twobody2_oop, du0, u0, tspan)
appxsol = solve(prob_iip, Vern9(), abstol=1e-10, reltol=1e-10)
-ALGS = (
- EK0(),
- EK1(),
-)
-
@testset "$S" for (S, _prob) in (("IIP", prob_iip), ("OOP", prob_oop))
@testset "$alg" for alg in (
EK0(),
EK1(),
EK0(initialization=ForwardDiffInit(2)),
EK1(initialization=ForwardDiffInit(2)),
+ # EK1(initialization=ClassicSolverInit()), # unstable for this problem
EK1(diffusionmodel=FixedDiffusion()),
EK0(diffusionmodel=FixedMVDiffusion()),
EK0(diffusionmodel=DynamicMVDiffusion()),
)
- @test solve(_prob, alg) isa ProbNumDiffEq.AbstractProbODESolution
+ sol = solve(_prob, alg)
- sol = solve(_prob, alg, abstol=1e-7, reltol=1e-7)
@test sol isa ProbNumDiffEq.ProbODESolution
@test sol.u[end] ≈ appxsol.u[end] rtol = 1e-3
- @test sol(π).μ ≈ appxsol(π) rtol = 1e-3
- end
-
- @testset "ClassicSolverInit" begin
- @test solve(_prob, EK1(initialization=ClassicSolverInit())) isa
- ProbNumDiffEq.AbstractProbODESolution
+ @test sol(tspan[2] / π).μ ≈ appxsol(tspan[2] / π) rtol = 1e-3
end
end
+@testset "ClassicSolverInit" begin
+ @test_nowarn solve(prob_iip, EK1(initialization=ClassicSolverInit()))
+end
diff --git a/test/stiff_problem.jl b/test/stiff_problem.jl
index 3a93da105..4274116a6 100644
--- a/test/stiff_problem.jl
+++ b/test/stiff_problem.jl
@@ -5,5 +5,6 @@ using ODEProblemLibrary: prob_ode_vanderpol_stiff
prob = prob_ode_vanderpol_stiff
appxsol = solve(prob, RadauIIA5())
-sol = solve(prob, EK1(order=3), abstol=1e-6, reltol=1e-6)
+sol = solve(prob, EK1(order=3))
@test appxsol[end] ≈ sol[end] rtol = 5e-3
+@test appxsol(0.5) ≈ sol(0.5).μ rtol = 5e-3