Skip to content

Commit 0a122df

Browse files
committed
more SampleFromUniform fixes
1 parent 6c79439 commit 0a122df

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
@@ -68,7 +68,7 @@ end
6868
# ROBUST INITIALISATIONS
6969
# Uniform rand with range 2; ref: https://mc-stan.org/docs/2_19/reference-manual/initialization.html
7070
randrealuni() = Real(4rand()-2)
71-
randrealuni(args...) = map(Real, 4rand(args...)-2)
71+
randrealuni(args...) = map(Real, 4 .* rand(args...) .- 2)
7272

7373
const Transformable = Union{TransformDistribution, SimplexDistribution, PDMatDistribution}
7474

src/varinfo.jl

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

0 commit comments

Comments
 (0)