diff --git a/Project.toml b/Project.toml index ec3ffee..dd50daf 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "AffineInvariantMCMC" uuid = "a0f608ac-68d0-5108-ad9a-0cdca73324f3" -version = "1.2.2" +version = "1.2.3" [deps] JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819" diff --git a/README.md b/README.md index bdd0bab..cdbc899 100644 --- a/README.md +++ b/README.md @@ -73,11 +73,11 @@ Restarts AffineInvariantMCMC analyses can be performed utilizing extremely efficient restarts. -Typically, the AffineInvariantMCMC runs require large number of functional (model) evaluations which may take substantial computational time. +Typically, the AffineInvariantMCMC runs require a large number of functional (model) evaluations which may take substantial computational time. Occasionally, the AffineInvariantMCMC runs may crash due to external issues (e.g., network/computer/disk failures). Furthermore, AffineInvariantMCMC runs may require more time than the allowed allocation time on existing HPC cluster queues. -In all these cases, the AffineInvariantMCMC runs needs to be restarted. -Our codes allow are very efficient restarts with very minimal overhead and without re-execution of completed functional (model) evaluations. +In all these cases, the AffineInvariantMCMC runs need to be restarted. +Our codes allow for efficient restarts with very minimal overhead and without re-execution of completed functional (model) evaluations. For more information, check out our Julia module [ReusableFunctions](https://github.com/madsjulia/ReusableFunctions.jl). diff --git a/src/AffineInvariantMCMC.jl b/src/AffineInvariantMCMC.jl index a03d588..e13af49 100644 --- a/src/AffineInvariantMCMC.jl +++ b/src/AffineInvariantMCMC.jl @@ -46,6 +46,9 @@ function sample(llhood::Function, numwalkers::Integer, x0::AbstractMatrix{<:Real chain, llhoodvals = JLD2.load(filename, "chain", "llhoods") end x = copy(x0) + if numsamples_perwalker < 2 + numsamples_perwalker = 2 + end chain = Array{Float64}(undef, size(x0, 1), numwalkers, div(numsamples_perwalker, thinning)) lastllhoodvals = RobustPmap.rpmap(llhood, map(i->x[:, i], 1:size(x, 2))) llhoodvals = Array{Float64}(undef, numwalkers, div(numsamples_perwalker, thinning)) @@ -94,4 +97,4 @@ function flattenmcmcarray(chain::AbstractArray, llhoodvals::AbstractArray) return newchain, llhoodvals[1:end] end -end +end \ No newline at end of file