diff --git a/Project.toml b/Project.toml index 4e56f8d..2562998 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "InverseAlgos" uuid = "64ff6778-433b-4901-a403-25308785a0c4" authors = ["Andrea Zunino "] -version = "0.2.3" +version = "0.2.4" [deps] Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" diff --git a/src/Samplers/hammcsampler.jl b/src/Samplers/hammcsampler.jl index d3de465..85f8c73 100644 --- a/src/Samplers/hammcsampler.jl +++ b/src/Samplers/hammcsampler.jl @@ -341,7 +341,7 @@ A single iteration of the HMC algorithm, where a given number of function oneiterhmc_polyg(nlogppd::NLogPostPDF,HMCpar::HMCParams,mcur::Vector{Float64},Ucur::Float64, grptask::Array{Int,2}) - maxbreakcheck = 20 + maxbreakcheck = Int(floor(HMCpar.L*0.1)) #bodyindicesorg = nlogppd.likelihood() # mnew = nothing diff --git a/src/Samplers/nuts_polyg.jl b/src/Samplers/nuts_polyg.jl index 0f004e6..5f0300d 100644 --- a/src/Samplers/nuts_polyg.jl +++ b/src/Samplers/nuts_polyg.jl @@ -259,8 +259,10 @@ function leapfrog_pos_polyg(m, p, ϵ, usermodel,HMCpar,grptask) if isdefined(usermodel.likelihood,:dofwdchecks) && usermodel.likelihood.dofwdchecks # checksucceded = fwdchecks!(usermodel.likelihood,mcur,mnew,pnew,il,HMCpar.L) checksucceded = usermodel.likelihood(m,mtilde,ptilde,lowcon,upcon,HMCpar.LcholmassM,"performchecks") - # get out - return mtilde,ptilde,checksucceded + if checksucceded==false + # get out + return mtilde,ptilde,checksucceded + end else # in case there are no checks checksucceded = true @@ -324,8 +326,10 @@ function leapfrog_mom_polyg(m, p, ϵ, usermodel,HMCpar,grptask) if isdefined(usermodel.likelihood,:dofwdchecks) && usermodel.likelihood.dofwdchecks # checksucceded = fwdchecks!(usermodel.likelihood,mcur,mnew,pnew,il,HMCpar.L) checksucceded = usermodel.likelihood(m,mtilde,ptilde,lowcon,upcon,HMCpar.LcholmassM,"performchecks") - # get out - return mtilde,ptilde,checksucceded + if checksucceded==false + # get out + return mtilde,ptilde,checksucceded + end else # in case there are no checks checksucceded = true @@ -366,8 +370,10 @@ function leapfrog_mom_polyg(m, p, ϵ, usermodel,HMCpar,grptask) if isdefined(usermodel.likelihood,:dofwdchecks) && usermodel.likelihood.dofwdchecks # checksucceded = fwdchecks!(usermodel.likelihood,mcur,mnew,pnew,il,HMCpar.L) checksucceded = usermodel.likelihood(m,mtilde,ptilde,lowcon,upcon,HMCpar.LcholmassM,"performchecks") - # get out - return mtilde,ptilde,checksucceded + if checksucceded==false + # get out + return mtilde,ptilde,checksucceded + end else # in case there are no checks checksucceded = true