Skip to content

Commit

Permalink
filename
Browse files Browse the repository at this point in the history
  • Loading branch information
montyvesselinov committed Aug 6, 2023
1 parent 46ac906 commit e136c43
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "AffineInvariantMCMC"
uuid = "a0f608ac-68d0-5108-ad9a-0cdca73324f3"
version = "1.2.1"
version = "1.2.2"

[deps]
JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
Expand Down
6 changes: 3 additions & 3 deletions src/AffineInvariantMCMC.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ Reference:
Goodman & Weare, "Ensemble samplers with affine invariance", Communications in Applied Mathematics and Computational Science, DOI: 10.2140/camcos.2010.5.65, 2010.
"""
function sample(llhood::Function, numwalkers::Integer, x0::AbstractMatrix, numsamples_perwalker::Integer, thinning::Integer, a::Number=2.; filename::AbstractString, load::Bool=true, save::Bool=true, rng::Random.AbstractRNG=Random.GLOBAL_RNG)
if isfile(filename) && load
function sample(llhood::Function, numwalkers::Integer, x0::AbstractMatrix, numsamples_perwalker::Integer, thinning::Integer, a::Number=2.; filename::AbstractString="", load::Bool=true, save::Bool=true, rng::Random.AbstractRNG=Random.GLOBAL_RNG)
if filename != "" && isfile(filename) && load
chain, llhoodvals = JLD2.load(filename, "chain", "llhoods")
end
x = copy(x0)
Expand Down Expand Up @@ -75,7 +75,7 @@ function sample(llhood::Function, numwalkers::Integer, x0::AbstractMatrix, numsa
end
end
end
if save && filename != ""
if save && filename != ""
JLD2.save(filename, "chain", chain, "llhoods", llhoodvals)
end
return chain, llhoodvals
Expand Down

0 comments on commit e136c43

Please sign in to comment.