Skip to content

Commit

Permalink
improved error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
scheidan committed May 17, 2024
1 parent 9e7e71c commit f15ee23
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/BarkerMCMC.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,11 @@ function barker_mcmc(lp,
preconditioning::Function = precond_eigen)

d = LogDensityProblems.dimension(lp)
@assert LogDensityProblems.capabilities(lp) >= LogDensityProblems.LogDensityOrder(1)
@assert length(inits) == d

LogDensityProblems.capabilities(lp) >= LogDensityProblems.LogDensityOrder(1) ||
error("The LogDensityProblem must proide gradient computation!")
length(inits) == d ||
error("The initial values must be of length $(d)!")

chain = Array{Float64}(undef, n_iter, d)
log_ps = Vector{Float64}(undef, n_iter)
Expand Down

0 comments on commit f15ee23

Please sign in to comment.