Skip to content

Commit

Permalink
Use FiniteHorizonGramians.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanaelbosch committed Nov 3, 2023
1 parent 9e8c8e0 commit 4155a46
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ DiffEqDevTools = "f3b72e0c-5b89-59e1-b016-84e28bfd966d"
ExponentialUtilities = "d4d017d3-3776-5f7e-afef-a10c40355c18"
FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898"
FastGaussQuadrature = "442a2c76-b920-505d-bb47-c5924d526838"
FiniteHorizonGramians = "b59a298d-d283-4a37-9369-85a9f9a111a5"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
FunctionWrappersWrappers = "77dc65aa-8811-40c2-897b-53d922fa7daf"
GaussianDistributions = "43dcc890-d446-5863-8d1a-14597580bb8d"
Expand Down
1 change: 1 addition & 0 deletions src/ProbNumDiffEq.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ using Octavian
using FastGaussQuadrature
import Kronecker
using ArrayAllocators
using FiniteHorizonGramians

@reexport using GaussianDistributions
using GaussianDistributions: logpdf
Expand Down
12 changes: 11 additions & 1 deletion src/priors/ltisde.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function matrix_fraction_decomposition(
return A, Q
end

function discretize_sqrt(sde::LTISDE, dt::Real)
function discretize_sqrt_with_quadraturetrick(sde::LTISDE, dt::Real)
F, L = drift(sde), dispersion(sde)

D = size(F, 1)
Expand Down Expand Up @@ -71,3 +71,13 @@ function discretize_sqrt(sde::LTISDE, dt::Real)

return Ah, Qh_R
end


function discretize_sqrt(sde::LTISDE, dt::Real)
Fdt, Ldt = dt*drift(sde), sqrt(dt)*dispersion(sde)

method = FiniteHorizonGramians.ExpAndGram{eltype(Fdt),13}()
Ah, Qh_R = FiniteHorizonGramians.exp_and_gram_chol(Fdt, Ldt, method)

return Ah, Qh_R
end

0 comments on commit 4155a46

Please sign in to comment.