API

The exported types and functions are the public API. The internal helpers are listed for reference and may change without notice.

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.

source
NSDEBase.InitialValueProblem — Type
InitialValueProblem <: AbstractInitialValueProblem

A 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 function
  • u0::AbstractVector : initial condition
  • tspan::Tuple : end limits of time domain

Functions

  • remake: construct a problem with selected updated parameters
source
NSDEBase.LinearRightHandSide — Type
LinearRightHandSide <: AbstractRightHandSide

A 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 term
  • g::Function : $g$, the forcing term, independent of $u$
  • g!::Function : $g$ but in-place
source
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.

source
NSDEBase.NonlinearRightHandSide — Type
NonlinearRightHandSide <: AbstractRightHandSide

A 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 function
  • f!::Function : $f$ but in-place
  • Df::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.

source
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.

source
NSDEBase.SolverFailure — Type
SolverFailure <: Exception

An 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.

source
NSDEBase.SplitRightHandSide — Type
SplitRightHandSide <: AbstractRightHandSide

A 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$
source
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.

source
Base.show — Method
show(io::IO, object::AbstractObject)

prints the full description of an object and its contents to a stream io.

source
Base.summary — Method
summary(io::IO, object::AbstractObject)

prints the short description of an object to a stream io.

source
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...)::InitialValueProblem

returns an InitialValueProblem for the double pendulum problem.

source
NSDEBase.IVP — Method
InitialValueProblem <: AbstractInitialValueProblem

A 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 function
  • u0::AbstractVector : initial condition
  • tspan::Tuple : end limits of time domain

Functions

  • remake: construct a problem with selected updated parameters
source
NSDEBase.LRHS — Method
LinearRightHandSide <: AbstractRightHandSide

A 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 term
  • g::Function : $g$, the forcing term, independent of $u$
  • g!::Function : $g$ but in-place
source
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...)::InitialValueProblem

returns an InitialValueProblem for the Lorenz equations.

source
NSDEBase.Lorenz96 — Function
Lorenz96(u0=[1.01; ones(39)], tspan=(0.0, 1.0); F=8.0)::InitialValueProblem
Lorenz96(u0, t0, tN; kwargs...)::InitialValueProblem

returns an InitialValueProblem for the Lorenz-96 equations.

source
NSDEBase.RHS — Method
NonlinearRightHandSide <: AbstractRightHandSide

A 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 function
  • f!::Function : $f$ but in-place
  • Df::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.

source
NSDEBase.RightHandSide — Method
NonlinearRightHandSide <: AbstractRightHandSide

A 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 function
  • f!::Function : $f$ but in-place
  • Df::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.

source
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...)::InitialValueProblem

returns an InitialValueProblem for the Rössler equations.

source
NSDEBase.SRHS — Method
SplitRightHandSide <: AbstractRightHandSide

A 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$
source
NSDEBase.VanDerPol — Function
VanDerPol(u0=[1.0, 0.0], tspan=(0.0, 1.0); μ=1.0)::InitialValueProblem
VanDerPol(u0, t0, tN; kwargs...)::InitialValueProblem

returns an InitialValueProblem for the Van der Pol equation (in first-order form).

source
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.

source
NSDEBase.initialize_cache — Function
initialize_cache(problem, solver) :: AbstractCache

builds a reusable cache for solving problem with solver. Solver packages extend this function.

source
NSDEBase.initialize_solution — Function
initialize_solution(problem, solver; kwargs...) :: AbstractSolution

builds an empty solution object for solving problem with solver. Solver packages extend this function.

source
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.

source
NSDEBase.solve — Function
solve(problem, solver; kwargs...) :: AbstractSolution

computes 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!.

source
NSDEBase.solve! — Function
solve!(cache, solution, problem, solver) :: AbstractSolution
solve!(solution, problem, solver) :: AbstractSolution

computes 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.

source
NSDEBase.withstepsize — Function
withstepsize(solver, h) :: AbstractInitialValueSolver

returns a solver like solver but with step size h, leaving solver unchanged. Solver packages extend this function.

source
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.

source