Skip to content

Commit cabc01e

Browse files
committed
more SampleFromUniform fixes
1 parent e0840a9 commit cabc01e

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/utils.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ end
118118
# ROBUST INITIALISATIONS
119119
# Uniform rand with range 2; ref: https://mc-stan.org/docs/2_19/reference-manual/initialization.html
120120
randrealuni() = Real(4rand()-2)
121-
randrealuni(args...) = map(Real, 4rand(args...)-2)
121+
randrealuni(args...) = map(Real, 4 .* rand(args...) .- 2)
122122

123123
const Transformable = Union{TransformDistribution, SimplexDistribution, PDMatDistribution}
124124

src/varinfo.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,7 @@ Return the current value(s) of the random variables sampled by `spl` in `vi`.
820820
The value(s) may or may not be transformed to Euclidean space.
821821
"""
822822
getindex(vi::AbstractVarInfo, spl::SampleFromPrior) = copy(getall(vi))
823+
getindex(vi::AbstractVarInfo, spl::SampleFromUniform) = copy(getall(vi))
823824
getindex(vi::UntypedVarInfo, spl::Sampler) = copy(getval(vi, _getranges(vi, spl)))
824825
function getindex(vi::TypedVarInfo, spl::Sampler)
825826
# Gets the ranges as a NamedTuple

0 commit comments

Comments
 (0)