From 15cac9e9d0fc72cde5b2c4248aae1cd2c4395f2b Mon Sep 17 00:00:00 2001 From: Nathanael Bosch Date: Sat, 4 Nov 2023 16:13:01 +0100 Subject: [PATCH] Add exports and docstrings --- src/ProbNumDiffEq.jl | 2 +- src/initialization/common.jl | 23 ++++++++++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/ProbNumDiffEq.jl b/src/ProbNumDiffEq.jl index d917a8ee1..7cb7b99a0 100644 --- a/src/ProbNumDiffEq.jl +++ b/src/ProbNumDiffEq.jl @@ -58,7 +58,7 @@ include("diffusions.jl") export FixedDiffusion, DynamicDiffusion, FixedMVDiffusion, DynamicMVDiffusion include("initialization/common.jl") -export TaylorModeInit, ClassicSolverInit +export TaylorModeInit, ClassicSolverInit, SimpleInit, ForwardDiffInit include("algorithms.jl") export EK0, EK1 diff --git a/src/initialization/common.jl b/src/initialization/common.jl index 02fa81be2..71e0d2786 100644 --- a/src/initialization/common.jl +++ b/src/initialization/common.jl @@ -1,12 +1,20 @@ abstract type InitializationScheme end abstract type AutodiffInitializationScheme <: InitializationScheme end +""" + SimpleInit() + +Simple initialization, only with the given initial value and derivative. + +The remaining derivatives are set to zero with unit covariance (unless specified otherwise +by setting a custom [`FixedDiffusion`](@ref)). +""" struct SimpleInit <: InitializationScheme end """ - TaylorModeInit() + TaylorModeInit(order) -Exact initialization via Taylor-mode automatic differentiation. +Exact initialization via Taylor-mode automatic differentiation up to order `order`. **This is the recommended initialization method!** @@ -16,7 +24,8 @@ via Taylor-mode automatic differentiation. In some special cases it can happen that TaylorIntegration.jl is incompatible with the given problem (typically because the problem definition does not allow for elements of type - `Taylor`). If this happens, try [`ClassicSolverInit`](@ref). + `Taylor`). If this happens, try one of [`SimpleInit`](@ref), [`ForwardDiffInit`](@ref) +(for low enough orders), [`ClassicSolverInit`](@ref). # References * [kraemer20stableimplementation](@cite) Krämer et al, "Stable Implementation of Probabilistic ODE Solvers" (2020) @@ -31,6 +40,14 @@ struct TaylorModeInit <: AutodiffInitializationScheme end end +""" + ForwardDiffInit(order) + +Exact initialization via ForwardDiff.jl up to order `order`. + +**Warning:** This does not scale well to high orders! +For orders > 3, [`TaylorModeInit`](@ref) most likely performs better. +""" struct ForwardDiffInit <: AutodiffInitializationScheme order::Int64 ForwardDiffInit(order::Int64) = begin