Skip to content

Commit d1d4642

Browse files
committed
renamed values and setvalues!! to realize and realize!!
1 parent abebd59 commit d1d4642

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

docs/src/api.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ AbstractMCMC.chainsstack
8181

8282
To make it a bit easier to interact with some arbitrary sampler state, we encourage implementations of `AbstractSampler` to implement the following methods:
8383
```@docs
84-
AbstractMCMC.values
85-
AbstractMCMC.setvalues!!
84+
AbstractMCMC.realize
85+
AbstractMCMC.realize!!
8686
```
8787
and optionally
8888
```@docs
@@ -214,7 +214,7 @@ function AbstractMCMC.step(rng, model::AbstractMCMC.AbstractModel, sampler::Mixt
214214
end
215215
```
216216

217-
Suppose we then wanted to use this with some of the packages which implements AbstractMCMC.jl's interface, e.g. [`AdvancedMH.jl`](https://github.com/TuringLang/AdvancedMH.jl), then we'd simply have to implement `values` and `setvalues!!`:
217+
Suppose we then wanted to use this with some of the packages which implements AbstractMCMC.jl's interface, e.g. [`AdvancedMH.jl`](https://github.com/TuringLang/AdvancedMH.jl), then we'd simply have to implement `realize` and `realize!!`:
218218

219219
```julia
220220
function AbstractMCMC.updatestate!!(::AdvancedMH.Transition, state_prev::AdvancedMH.Transition)

src/AbstractMCMC.jl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -84,27 +84,27 @@ struct MCMCSerial <: AbstractMCMCEnsemble end
8484
8585
Return new instance of `state` using information from `transition_prev` and, optionally, `state_prev`.
8686
87-
Defaults to `setvalues!!(state, values(transition_prev))`.
87+
Defaults to `realize!!(state, realize(transition_prev))`.
8888
"""
8989
updatestate!!(state, transition_prev, state_prev) = updatestate!!(state, transition_prev)
90-
updatestate!!(state, transition) = setvalues!!(state, Base.values(transition))
90+
updatestate!!(state, transition) = realize!!(state, realize(transition))
9191

9292
"""
93-
setvalues!!(state, values)
93+
realize!!(state, realization)
9494
95-
Update the values of the `state` with `values` and return it.
95+
Update the realization of the `state` with `realization` and return it.
9696
9797
If `state` can be updated in-place, it is expected that this function returns `state` with updated
98-
values. Otherwise a new `state` object with the new `values` is returned.
98+
realize. Otherwise a new `state` object with the new `realization` is returned.
9999
"""
100-
function setvalues!! end
100+
function realize!! end
101101

102-
@doc """
103-
values(transition)
102+
"""
103+
realize(transition)
104104
105-
Return values in `transition`.
105+
Return the realization of the random variables present in `transition`.
106106
"""
107-
Base.values
107+
function realize end
108108

109109

110110
include("samplingstats.jl")

0 commit comments

Comments
 (0)