Skip to content

Commit

Permalink
Added checks as @devmotion requested
Browse files Browse the repository at this point in the history
  • Loading branch information
torfjelde committed Oct 4, 2024
1 parent f9142a6 commit 295fdc1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/sample.jl
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,13 @@ function mcmcsample(
initial_state=nothing,
kwargs...,
)
# Check the number of requested samples.
N > 0 || error("the number of samples must be ≥ 1")
discard_initial >= 0 ||
throw(ArgumentError("number of discarded samples must be non-negative"))
num_warmup >= 0 ||
throw(ArgumentError("number of warm-up samples must be non-negative"))

# Determine how many samples to drop from `num_warmup` and the
# main sampling process before we start saving samples.
discard_from_warmup = min(num_warmup, discard_initial)
Expand Down

0 comments on commit 295fdc1

Please sign in to comment.