API
The exported types and functions are the public API. The internal helpers are listed for reference and may change without notice.
NSDEBase.AbstractCache — Type
An abstract type for caching intermediate computations in AbstractSolvers.
NSDEBase.AbstractInitialValueCache — Type
An abstract type for caching intermediate computations in AbstractInitialValueSolvers.
NSDEBase.AbstractInitialValueParameters — Type
An abstract type for parameters in AbstractInitialValueSolvers.
NSDEBase.AbstractInitialValueProblem — Type
An abstract type for initial-value problems.
A custom subtype used for chunked or moving-window solves must expose mutable rhs, u0 and tspan fields and implement remake(problem; u0, tspan). The remade problem must keep the supplied floating-point state buffer: chunk updates write into it. Solvers also need compatible initialize_cache, initialize_solution and solve! methods for the custom problem type.
NSDEBase.AbstractInitialValueSolution — Type
An abstract type for computed solutions of AbstractInitialValueProblems.
NSDEBase.AbstractInitialValueSolver — Type
An abstract type for numerical solvers of AbstractInitialValueProblems.
NSDEBase.AbstractObject — Type
An abstract type for all objects in NSDEBase.
NSDEBase.AbstractParameters — Type
An abstract type for parameters used in AbstractSolvers.
NSDEBase.AbstractProblem — Type
An abstract type for differential-equation problems.
NSDEBase.AbstractRightHandSide — Type
An abstract type for right-hand-side (RHS) functions of AbstractInitialValueProblems.
NSDEBase.AbstractSolution — Type
An abstract type for solutions of AbstractProblems.
NSDEBase.AbstractSolver — Type
An abstract type for numerical solvers of AbstractProblems.
NSDEBase.InitialValueProblem — Type
InitialValueProblem <: AbstractInitialValueProblemA composite type for an initial-value problem. Time endpoints are promoted to a common floating-point type; integer and rational states are converted to floating point. Already-floating state vectors (including complex states) retain their storage. The solver time grid uses the resulting problem time type.
Constructors
InitialValueProblem(rhs, u0, tspan)
InitialValueProblem(rhs, u0, t0, tN)
InitialValueProblem(fₛ, fₙₛ, u0, tspan)
InitialValueProblem(fₛ, fₙₛ, u0, t0, tN)
IVP(args...; kwargs...)Function constructors accept inplace=true/false/nothing for scalar or vector states and tuple or separate time endpoints. Split constructors also accept inplace=(stiff_choice, nonstiff_choice); a shared choice applies to both raw functions. Prebuilt RHS objects retain their own conventions.
Arguments
rhs::AbstractRightHandSide: right-hand side functionu0::AbstractVector: initial conditiontspan::Tuple: end limits of time domain
Functions
remake: construct a problem with selected updated parameters
NSDEBase.LinearRightHandSide — Type
LinearRightHandSide <: AbstractRightHandSideA composite type for the right-hand side of an InitialValueProblem in the form $f(u, t) = L u + g(t)$.
Constructors
LinearRightHandSide(L, g, g!)
LinearRightHandSide(L[, g!_or_g]; inplace=nothing)
LRHS(args...; kwargs...)Arguments
L::AbstractMatrix: $L$, the coefficient termg::Function: $g$, the forcing term, independent of $u$g!::Function: $g$ but in-place
NSDEBase.LinearRightHandSide — Method
(rhs::LinearRightHandSide)(u, t)
(rhs::LinearRightHandSide)(du, u, t)
(rhs::LinearRightHandSide)(du, v, u, t)returns the derivative du from the solution u and time t. The 3-argument in-place form allocates a temporary when a forcing term g is present. For a derived g(t), the dense output buffer has the operator's element type. Use a complex state in rhs(u, t) when a real operator has complex forcing. The 4-argument form takes caller-owned scratch v (same shape as du) instead and is allocation-free. Hot loops should use the 4-argument form.
NSDEBase.NonlinearRightHandSide — Type
NonlinearRightHandSide <: AbstractRightHandSideA composite type for the right-hand side of an InitialValueProblem in the generic form $f(u, t)$.
Constructors
NonlinearRightHandSide(f, f!, Df, Df!)
NonlinearRightHandSide(f!_or_f; iscomplex=false, inplace=nothing)
RightHandSide(args...; kwargs...)
RHS(args...; kwargs...)Arguments
f::Function: $f$, the right-hand side functionf!::Function: $f$ but in-placeDf::Function: $\mathcal{D}f$, the Jacobian of $f$ with respect to $u$Df!::Function: $\mathcal{D}f$ but in-place
When only f!_or_f is given, the missing form is derived from it and the Jacobian is filled in automatically: ForwardDiff for real problems, and a finite-difference Wirtinger derivative (via FiniteDifferences) when iscomplex = true. Function-based IVP constructors infer this from complex initial data. This computes ∂f/∂u; implicit complex solves require a holomorphic RHS. For non-holomorphic equations, split real and imaginary parts explicitly. Optional arguments are interpreted by the shortest supported signature; use inplace=true or inplace=false to resolve ambiguity.
NSDEBase.NonlinearRightHandSide — Method
(rhs::NonlinearRightHandSide)(u, t)
(rhs::NonlinearRightHandSide)(du, u, t)
(rhs::NonlinearRightHandSide)(du, v, u, t)returns the derivative du from the solution u and time t. The 4-argument form takes caller-owned scratch v (same shape as du) so that hot loops can guarantee an allocation-free call; for a nonlinear RHS the scratch is unused.
NSDEBase.SolverFailure — Type
SolverFailure <: ExceptionAn abstract type for numerical failures: a solver could not produce a usable step (for example, Newton or adaptive-step failure). Custom solvers may subtype it to request numerical failure handling in Parareal and MoWi. Programming and configuration errors must use their ordinary exception types instead.
NSDEBase.SplitRightHandSide — Type
SplitRightHandSide <: AbstractRightHandSideA composite type for the right-hand side of an InitialValueProblem in the form $f(u, t) = f_\text{s}(u, t) + f_\text{ns}(u, t)$.
Constructors
SplitRightHandSide(fₛ, fₙₛ)
SRHS(args...; kwargs...)Raw functions accept iscomplex and inplace. The latter is a shared choice or a (stiff_choice, nonstiff_choice) pair, each true, false, or nothing. Prebuilt RHS objects retain their own calling convention.
Arguments
fₛ::Union{LinearRightHandSide,NonlinearRightHandSide}: $f_\text{s}$, the stiff part of the right-hand side function $f$fₙₛ::NonlinearRightHandSide: $f_\text{ns}$, the non-stiff part of the right-hand side function $f$
NSDEBase.SplitRightHandSide — Method
(rhs::SplitRightHandSide)(u, t)
(rhs::SplitRightHandSide)(du, u, t)
(rhs::SplitRightHandSide)(du, v, u, t)returns the derivative du from the solution u and time t. The 3-argument in-place form allocates a temporary; the 4-argument form takes caller-owned scratch v (same shape as du) instead and is allocation-free. v is used first as scratch for fₛ and then to hold fₙₛ(u, t), so a single buffer covers the whole evaluation. Hot loops should use the 4-argument form.
Base.summary — Method
summary(io::IO, object::AbstractObject)prints the short description of an object to a stream io.
NSDEBase.Dahlquist — Function
Dahlquist(u0=0.5, tspan=(0.0, 1.0); λ=1.0)::InitialValueProblem
Dahlquist(u0, t0, tN; kwargs...)::InitialValueProblemreturns an InitialValueProblem for the Dahlquist equation.
NSDEBase.DoublePendulum — Function
DoublePendulum(u0=[π/4, π/4, 0.0, 0.0], tspan=(0.0, 1.0); μ=1.0, λ=1.0)::InitialValueProblem
DoublePendulum(u0, t0, tN; kwargs...)::InitialValueProblemreturns an InitialValueProblem for the double pendulum problem.
NSDEBase.IVP — Method
InitialValueProblem <: AbstractInitialValueProblemA composite type for an initial-value problem. Time endpoints are promoted to a common floating-point type; integer and rational states are converted to floating point. Already-floating state vectors (including complex states) retain their storage. The solver time grid uses the resulting problem time type.
Constructors
InitialValueProblem(rhs, u0, tspan)
InitialValueProblem(rhs, u0, t0, tN)
InitialValueProblem(fₛ, fₙₛ, u0, tspan)
InitialValueProblem(fₛ, fₙₛ, u0, t0, tN)
IVP(args...; kwargs...)Function constructors accept inplace=true/false/nothing for scalar or vector states and tuple or separate time endpoints. Split constructors also accept inplace=(stiff_choice, nonstiff_choice); a shared choice applies to both raw functions. Prebuilt RHS objects retain their own conventions.
Arguments
rhs::AbstractRightHandSide: right-hand side functionu0::AbstractVector: initial conditiontspan::Tuple: end limits of time domain
Functions
remake: construct a problem with selected updated parameters
NSDEBase.LRHS — Method
LinearRightHandSide <: AbstractRightHandSideA composite type for the right-hand side of an InitialValueProblem in the form $f(u, t) = L u + g(t)$.
Constructors
LinearRightHandSide(L, g, g!)
LinearRightHandSide(L[, g!_or_g]; inplace=nothing)
LRHS(args...; kwargs...)Arguments
L::AbstractMatrix: $L$, the coefficient termg::Function: $g$, the forcing term, independent of $u$g!::Function: $g$ but in-place
NSDEBase.Logistic — Function
Logistic(u0=0.5, tspan=(0.0, 1.0); λ=1.0)::InitialValueProblem
Logistic(u0, t0, tN; kwargs...)::InitialValueProblemreturns an InitialValueProblem for the Logistic equation.
NSDEBase.Lorenz — Function
Lorenz(u0=[2.0, 3.0, -14.0], tspan=(0.0, 1.0); σ=10.0, β=8/3, ρ=28.0)::InitialValueProblem
Lorenz(u0, t0, tN; kwargs...)::InitialValueProblemreturns an InitialValueProblem for the Lorenz equations.
NSDEBase.Lorenz96 — Function
Lorenz96(u0=[1.01; ones(39)], tspan=(0.0, 1.0); F=8.0)::InitialValueProblem
Lorenz96(u0, t0, tN; kwargs...)::InitialValueProblemreturns an InitialValueProblem for the Lorenz-96 equations.
NSDEBase.RHS — Method
NonlinearRightHandSide <: AbstractRightHandSideA composite type for the right-hand side of an InitialValueProblem in the generic form $f(u, t)$.
Constructors
NonlinearRightHandSide(f, f!, Df, Df!)
NonlinearRightHandSide(f!_or_f; iscomplex=false, inplace=nothing)
RightHandSide(args...; kwargs...)
RHS(args...; kwargs...)Arguments
f::Function: $f$, the right-hand side functionf!::Function: $f$ but in-placeDf::Function: $\mathcal{D}f$, the Jacobian of $f$ with respect to $u$Df!::Function: $\mathcal{D}f$ but in-place
When only f!_or_f is given, the missing form is derived from it and the Jacobian is filled in automatically: ForwardDiff for real problems, and a finite-difference Wirtinger derivative (via FiniteDifferences) when iscomplex = true. Function-based IVP constructors infer this from complex initial data. This computes ∂f/∂u; implicit complex solves require a holomorphic RHS. For non-holomorphic equations, split real and imaginary parts explicitly. Optional arguments are interpreted by the shortest supported signature; use inplace=true or inplace=false to resolve ambiguity.
NSDEBase.RightHandSide — Method
NonlinearRightHandSide <: AbstractRightHandSideA composite type for the right-hand side of an InitialValueProblem in the generic form $f(u, t)$.
Constructors
NonlinearRightHandSide(f, f!, Df, Df!)
NonlinearRightHandSide(f!_or_f; iscomplex=false, inplace=nothing)
RightHandSide(args...; kwargs...)
RHS(args...; kwargs...)Arguments
f::Function: $f$, the right-hand side functionf!::Function: $f$ but in-placeDf::Function: $\mathcal{D}f$, the Jacobian of $f$ with respect to $u$Df!::Function: $\mathcal{D}f$ but in-place
When only f!_or_f is given, the missing form is derived from it and the Jacobian is filled in automatically: ForwardDiff for real problems, and a finite-difference Wirtinger derivative (via FiniteDifferences) when iscomplex = true. Function-based IVP constructors infer this from complex initial data. This computes ∂f/∂u; implicit complex solves require a holomorphic RHS. For non-holomorphic equations, split real and imaginary parts explicitly. Optional arguments are interpreted by the shortest supported signature; use inplace=true or inplace=false to resolve ambiguity.
NSDEBase.Rössler — Function
Rössler(u0=[2.0, 0.0, 0.0], tspan=(0.0, 1.0); α=0.2, β=0.2, γ=5.7)::InitialValueProblem
Rössler(u0, t0, tN; kwargs...)::InitialValueProblemreturns an InitialValueProblem for the Rössler equations.
NSDEBase.SRHS — Method
SplitRightHandSide <: AbstractRightHandSideA composite type for the right-hand side of an InitialValueProblem in the form $f(u, t) = f_\text{s}(u, t) + f_\text{ns}(u, t)$.
Constructors
SplitRightHandSide(fₛ, fₙₛ)
SRHS(args...; kwargs...)Raw functions accept iscomplex and inplace. The latter is a shared choice or a (stiff_choice, nonstiff_choice) pair, each true, false, or nothing. Prebuilt RHS objects retain their own calling convention.
Arguments
fₛ::Union{LinearRightHandSide,NonlinearRightHandSide}: $f_\text{s}$, the stiff part of the right-hand side function $f$fₙₛ::NonlinearRightHandSide: $f_\text{ns}$, the non-stiff part of the right-hand side function $f$
NSDEBase.SimplePendulum — Function
SimplePendulum(u0=[π/4, 0.0], tspan=(0.0, 2π/3 * √9.81))::InitialValueProblem
SimplePendulum(u0, t0, tN)::InitialValueProblemreturns an InitialValueProblem for the simple pendulum problem.
NSDEBase.VanDerPol — Function
VanDerPol(u0=[1.0, 0.0], tspan=(0.0, 1.0); μ=1.0)::InitialValueProblem
VanDerPol(u0, t0, tN; kwargs...)::InitialValueProblemreturns an InitialValueProblem for the Van der Pol equation (in first-order form).
NSDEBase.chunk_solver — Method
chunk_solver(solver, duration)prepares a solver for a chunk of nominal duration. Solver packages may specialise it to share a fixed schedule across translated chunks. The fallback copies the solver, so run-local mutable state is never shared with its caller.
NSDEBase.initialize_cache — Function
initialize_cache(problem, solver) :: AbstractCachebuilds a reusable cache for solving problem with solver. Solver packages extend this function.
NSDEBase.initialize_solution — Function
initialize_solution(problem, solver; kwargs...) :: AbstractSolutionbuilds an empty solution object for solving problem with solver. Solver packages extend this function.
NSDEBase.remake — Method
remake(problem; u0=problem.u0, tspan=problem.tspan)builds a problem with the same right-hand side and selected new initial data. Time-span endpoints are promoted to a common numeric type. A supplied floating-point state is not copied; other numeric states are converted. Use copy(u0) for independent storage. Other subtypes of AbstractInitialValueProblem must implement their own method; the fallback throws an ArgumentError.
NSDEBase.solve — Function
solve(problem, solver; kwargs...) :: AbstractSolutioncomputes the solution of problem using solver, allocating a fresh cache and solution. Solver packages extend this function; hot loops should prefer the cache-reusing solve!.
NSDEBase.solve! — Function
solve!(cache, solution, problem, solver) :: AbstractSolution
solve!(solution, problem, solver) :: AbstractSolutioncomputes the solution of problem in-place, reusing solution and, in the 4-argument form, a pre-allocated cache. This is the form every hot caller must use. Solver packages extend this function.
NSDEBase.withstepsize — Function
withstepsize(solver, h) :: AbstractInitialValueSolverreturns a solver like solver but with step size h, leaving solver unchanged. Solver packages extend this function.
NSDEBase.zero! — Method
zero!(v::AbstractVector)fills v with zeros in-place. Works on flat vectors of numbers and on nested vectors of vectors (e.g. stage arrays), recursing one level.