Changes to modppl
starting with v0.3.0
are documented here.
- Renamed crate from
gen-rs
tomodppl
- Several major breaking API changes in
Trie
. The updates are roughly:Trie
has a new simplified API:Trie::new()
returns an emptyTrie
.Trie::leaf(value: V, weight: f64)
returns aTrie<V>
with an inner value and weight.- Value via
ref_inner
,take_inner
,replace_inner
, andexpect_inner
.
- Value via
trie.weight()
returns the weight.trie.search(addr: &str) -> Option<&Trie<V>>
returnsSome(sub)
ataddr
if occupied, otherwise None.trie.observe(addr: &str, value: V)
inserts an unweighted leaf at a valid unoccupiedaddr
(panics if occupied).trie.w_observe(addr: &str, value: V, weight: f64)
inserts a weighted leaf at a valid unoccupiedaddr
(panics if occupied) and increases thetrie
's weight byweight
.trie.insert(addr: &str, sub: Trie<V>)
inserts a subTrie
at a valid unoccupiedaddr
(panics if occupied) and increases thetrie
's weight bysub.weight()
.trie.remove(addr: &str) -> Option<Trie<V>>
removes and returnsSome(sub)
ataddr
if occupied, decreasingtrie
's weight bysub.weight()
, otherwise does nothing and returnsNone
.trie.merge(other: Trie<V>)
consumes anotherTrie
, merging it intoself
preferentially using the values ofother
at overlapping addresses.trie.schema()
returns anAddrMap
representing the address schema ofself
.trie.collect(mask: &AddrMap)
collects the set of values identified bymask
into a newTrie
, leaving values inself
that are in the complement ofmask
. Returns the newself
, the collected value trie, and the weight of the collected value trie.
TrieFn
was renamed toDynGenFn
. Correspondingly:TrieFnState
=>DynGenFnHandler
Trie<(Rc<dyn Any>>,f64)>
=>DynTrie
:=Trie<Arc<dyn Any + Send + Sync>>
Unfold
=>DynUnfold
and now takes in aDynGenFn
instead of a rawfn
item
Trace::logp
=>Trace::logjp
Rc
=>Arc
inDynTrie
and across the codebase.GfDiff
=>ArgDiff
categorical
returns ani64
instead ofusize
- Start of semver
- Prelude file (
use modppl::prelude::*;
) modppl-macros
, providingdyngen!
to automatically implement and instantiateDynGenFn
fromfn
itemsAddrMap
: a recursiveHashMap
serving as a mask- optional
regenerate
fn regenerate(&self,
trace: Trace<Args,Data,Ret>,
args: Args,
diff: ArgDiff,
mask: &AddrMap
) -> (Trace<Args,Data,Ret>, f64);
importance_resampling
regenerative_metropolis_hastings
(aliasregen_mh
, both available ifregenerate
is implemented)DynParticles<State> := ParticleSystem<State,Vec<DynTrie>,Vec<State>,DynUnfold<State>>
geometric
distribution (returnsi64
)poisson
distribution (returnsi64
)beta
distribution (returnsf64
)gamma
distribution (returnsf64
)
GLOBAL_RNG
AddrTrie