Skip to content

Commit

Permalink
Fix random sampling from BFGSResult on old Julia
Browse files Browse the repository at this point in the history
See issue #59.
  • Loading branch information
cgarling committed Jan 14, 2025
1 parent 171e680 commit f276996
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/fitting/hierarchical/bfgs_result.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ function _rand!(rng::AbstractRNG, result::BFGSResult,
row_idxs = vcat(1:Nbins, (Nbins+1:Nbins+length(free))[free])
# row_idxs = LazyArrays.Vcat(1:Nbins, (Nbins+1:Nbins+length(free))[free])
fittable_view = view(samples, row_idxs, :)
_rand!(rng, dist, fittable_view)
# _rand!(rng, dist, fittable_view) # See issue #59
tmpsample = rand(rng, dist, size(samples, 2))
samples[row_idxs, :] .= tmpsample
# Now perform variable transformations for free metallicity and dispersion parameters
exptransform_samples!(fittable_view, μ, tf[free], free[free])
# Now write in fixed parameters
Expand Down Expand Up @@ -122,7 +124,9 @@ function _rand!(rng::AbstractRNG,
row_idxs = vcat(1:Nbins, (Nbins+1:Nbins+length(free))[free])
# row_idxs = LazyArrays.Vcat(1:Nbins, (Nbins+1:Nbins+length(free))[free])
fittable_view = view(samples, row_idxs, :)
_rand!(rng, dist, fittable_view)
# _rand!(rng, dist, fittable_view) # See issue #59
tmpsample = rand(rng, dist, size(samples, 2))
samples[row_idxs, :] .= tmpsample
# Now perform variable transformations for free metallicity and dispersion parameters
exptransform_samples!(fittable_view, μ, tf[free], free[free])
# Now write in fixed parameters
Expand Down

0 comments on commit f276996

Please sign in to comment.