Skip to content

Commit 295fdc1

Browse files
committed
Added checks as @devmotion requested
1 parent f9142a6 commit 295fdc1

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/sample.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,13 @@ function mcmcsample(
265265
initial_state=nothing,
266266
kwargs...,
267267
)
268+
# Check the number of requested samples.
269+
N > 0 || error("the number of samples must be ≥ 1")
270+
discard_initial >= 0 ||
271+
throw(ArgumentError("number of discarded samples must be non-negative"))
272+
num_warmup >= 0 ||
273+
throw(ArgumentError("number of warm-up samples must be non-negative"))
274+
268275
# Determine how many samples to drop from `num_warmup` and the
269276
# main sampling process before we start saving samples.
270277
discard_from_warmup = min(num_warmup, discard_initial)

0 commit comments

Comments
 (0)