Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document regular jumps #449

Merged
merged 2 commits into from
Sep 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions src/jumps.jl
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,50 @@ 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)
## Notes
- `mark_dist` is not currently used or supported in τ-leaping methods.
```
"""
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)
Expand Down
Loading