From 8404cee3ee77c7b9df31f0280a677d3f36ee09e6 Mon Sep 17 00:00:00 2001 From: Sam Isaacson Date: Sun, 1 Sep 2024 19:55:34 -0400 Subject: [PATCH 1/2] document regular jumps --- src/jumps.jl | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/jumps.jl b/src/jumps.jl index f3b22f10..8796a079 100644 --- a/src/jumps.jl +++ b/src/jumps.jl @@ -195,11 +195,47 @@ end """ $(TYPEDEF) +Representation for encoding rates and multiple simultaneous jumps via τ-leaping type +methods. + +### Constructors +- `RegularJump(rate, c, numjumps; mark_dist = nothing)` + +## Fields + +$(FIELDS) + +## Examples +```julia +function rate!(out, u, p, t) + out[1] = (0.1 / 1000.0) * u[1] * u[2] + out[2] = 0.01u[2] + nothing +end + +const dc = zeros(3,2) +function c(du, u, p, t, counts, mark) + mul!(du, dc, counts) + nothing +end + +rj = RegularJump(rate!, c, 2) +``` """ struct RegularJump{iip, R, C, MD} + """ + Function `rate!(rate_vals, u, p, t)` that returns the current rates, i.e. + intensities or propensities, for all possible jumps. + """ rate::R + """ + Function `c(du, u, p, t, counts, mark)` that executes the `i`th jump `counts[i]` times, + saving the output in `c[i]`. + """ c::C + """ Number of jumps in the system.""" numjumps::Int + """ A distribution for marks. Not currently used or supported. """ mark_dist::MD function RegularJump{iip}(rate, c, numjumps::Int; mark_dist = nothing) where {iip} new{iip, typeof(rate), typeof(c), typeof(mark_dist)}(rate, c, numjumps, mark_dist) From 3ff78450ae18bc3f7cc1c2de4d54a62beb092b70 Mon Sep 17 00:00:00 2001 From: Sam Isaacson Date: Sun, 1 Sep 2024 19:57:41 -0400 Subject: [PATCH 2/2] update --- src/jumps.jl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/jumps.jl b/src/jumps.jl index 8796a079..69531e27 100644 --- a/src/jumps.jl +++ b/src/jumps.jl @@ -220,6 +220,9 @@ function c(du, u, p, t, counts, mark) end rj = RegularJump(rate!, c, 2) + +## Notes +- `mark_dist` is not currently used or supported in τ-leaping methods. ``` """ struct RegularJump{iip, R, C, MD}