How to sample complex-valued diffusions?

From the perspective of internal mechanics of the package there is nothing special about complex valued processes. You simply need to make sure that you define the process with appropriate datatype, say ComplexF64.


The logo of this package was sampled using a complex-valued diffusion that has a mean reversion term that attracts the process towards a point that zooms around a unit circle on a complex plane:

using DiffusionDefinition
const DD = DiffusionDefinition
using Random, Plots

@diffusion_process CustomComplexOU begin
    (θ, μ, σ) --> ComplexF64

DD.b(t, x, P::CustomComplexOU) = P.θ*(P.μ*exp(im*t) - x)
DD.σ(t, x, P::CustomComplexOU) = P.σ

DD.default_type(::CustomComplexOU) = ComplexF64
DD.default_wiener_type(::CustomComplexOU) = ComplexF64

θ = ComplexF64.([10.0, 0.15, 0.2])
P = CustomComplexOU(θ...)
tt, x0 = 0.0:0.0001:2π, ComplexF64(θ[2])
X = rand(P, tt, x0)
plot(map(x->real(x), X.x), map(x->imag(x), X.x), size=(500, 500))