Skip to content

Commit e2bdfb7

Browse files
committed
added state_from_transition, parameters and setparameters!!
1 parent 56431bd commit e2bdfb7

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

src/AbstractMCMC.jl

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,36 @@ The `MCMCSerial` algorithm allows users to sample serially, with no thread or pr
7979
"""
8080
struct MCMCSerial <: AbstractMCMCEnsemble end
8181

82+
"""
83+
state_from_transiton(state, transition_prev[, state_prev])
84+
85+
Return new instance of `state` using information from `transition_prev` and, optionally, `state_prev`.
86+
87+
Defaults to `setparameters!!(state, parameters(transition_prev))`.
88+
"""
89+
function state_from_transition(state, transition_prev, state_prev)
90+
return state_from_transition(state, transition_prev)
91+
end
92+
93+
function state_from_transition(state, transition)
94+
return setparameters!!(state, parameters(transition))
95+
end
96+
97+
"""
98+
setparameters!!(state, parameters)
99+
100+
Return new instance of `state` with parameters set to `parameters`.
101+
"""
102+
setparameters!!
103+
104+
"""
105+
parameters(transition)
106+
107+
Return parameters in `transition`.
108+
"""
109+
parameters
110+
111+
82112
include("samplingstats.jl")
83113
include("logging.jl")
84114
include("interface.jl")

0 commit comments

Comments
 (0)