Trait net_ensembles::sampling::traits::MarkovChain
source · [−]pub trait MarkovChain<S, Res> {
fn undo_step(&mut self, step: &S) -> Res;
fn undo_step_quiet(&mut self, step: &S);
fn m_step(&mut self) -> S;
fn m_steps(&mut self, count: usize, steps: &mut Vec<S, Global>) { ... }
fn m_steps_quiet(&mut self, count: usize) { ... }
fn m_step_acc<Acc, AccFn>(&mut self, acc: &mut Acc, acc_fn: AccFn) -> S
where
AccFn: FnMut(&Self, &S, &mut Acc),
{ ... }
fn m_steps_acc<Acc, AccFn>(
&mut self,
count: usize,
steps: &mut Vec<S, Global>,
acc: &mut Acc,
acc_fn: AccFn
)
where
AccFn: FnMut(&Self, &S, &mut Acc),
{ ... }
fn m_steps_acc_quiet<Acc, AccFn>(
&mut self,
count: usize,
acc: &mut Acc,
acc_fn: AccFn
)
where
AccFn: FnMut(&Self, &S, &mut Acc),
{ ... }
fn undo_steps(&mut self, steps: &[S], res: &mut Vec<Res, Global>) { ... }
fn undo_steps_quiet(&mut self, steps: &[S]) { ... }
fn steps_accepted(&mut self, _steps: &[S]) { ... }
fn steps_rejected(&mut self, _steps: &[S]) { ... }
}
Expand description
Required Methods
sourcefn undo_step(&mut self, step: &S) -> Res
fn undo_step(&mut self, step: &S) -> Res
- undo a markov step, return result-state
- if you want to undo more than one step
see
undo_steps
sourcefn undo_step_quiet(&mut self, step: &S)
fn undo_step_quiet(&mut self, step: &S)
- undo a markov, panic on invalid result state
- for undoing multiple steps see
undo_steps_quiet
sourcefn m_step(&mut self) -> S
fn m_step(&mut self) -> S
Markov step
- use this to perform a markov step step
- for doing multiple markov steps at once, use
m_steps
Provided Methods
sourcefn m_steps(&mut self, count: usize, steps: &mut Vec<S, Global>)
fn m_steps(&mut self, count: usize, steps: &mut Vec<S, Global>)
Markov steps
- use this to perform multiple markov steps at once
- steps can be used to undo the steps with
self.undo_steps(steps)
steps
will be emptied before step is performed
sourcefn m_steps_quiet(&mut self, count: usize)
fn m_steps_quiet(&mut self, count: usize)
Markov steps without return
- use this to perform multiple markov steps at once
- only use this if you know that you do not want to undo the steps
- you cannot undo this steps, but therefore it does not need to allocate a vector for undoing steps
sourcefn m_step_acc<Acc, AccFn>(&mut self, acc: &mut Acc, acc_fn: AccFn) -> Swhere
AccFn: FnMut(&Self, &S, &mut Acc),
fn m_step_acc<Acc, AccFn>(&mut self, acc: &mut Acc, acc_fn: AccFn) -> Swhere
AccFn: FnMut(&Self, &S, &mut Acc),
Accumulating markov step
- this calculates something while performing the markov chain, e.g., the current energy, which can be more efficient then calculating it from scratch afterwards
sourcefn m_steps_acc<Acc, AccFn>(
&mut self,
count: usize,
steps: &mut Vec<S, Global>,
acc: &mut Acc,
acc_fn: AccFn
)where
AccFn: FnMut(&Self, &S, &mut Acc),
fn m_steps_acc<Acc, AccFn>(
&mut self,
count: usize,
steps: &mut Vec<S, Global>,
acc: &mut Acc,
acc_fn: AccFn
)where
AccFn: FnMut(&Self, &S, &mut Acc),
Accumulating markov steps
- this calculates something while performing the markov chain, e.g., the current energy which can be more efficient then calculating it from scratch afterwards
sourcefn m_steps_acc_quiet<Acc, AccFn>(
&mut self,
count: usize,
acc: &mut Acc,
acc_fn: AccFn
)where
AccFn: FnMut(&Self, &S, &mut Acc),
fn m_steps_acc_quiet<Acc, AccFn>(
&mut self,
count: usize,
acc: &mut Acc,
acc_fn: AccFn
)where
AccFn: FnMut(&Self, &S, &mut Acc),
Accumulating markov steps
- this calculates something while performing the markov chain, e.g., the current energy which can be more efficient then calculating it from scratch afterwards
- quiet step, i.e., you will not be able to undo the step
sourcefn undo_steps(&mut self, steps: &[S], res: &mut Vec<Res, Global>)
fn undo_steps(&mut self, steps: &[S], res: &mut Vec<Res, Global>)
Undo markov steps
- Note: uses undo_step in correct order and returns result
Important:
- look at specific implementation of
undo_step
, every thing mentioned there applies to each step
sourcefn undo_steps_quiet(&mut self, steps: &[S])
fn undo_steps_quiet(&mut self, steps: &[S])
Undo markov steps
- Note: uses
undo_step_quiet
in correct order
Important:
- look at specific implementation of
undo_step_quiet
, every thing mentioned there applies to each step
sourcefn steps_accepted(&mut self, _steps: &[S])
fn steps_accepted(&mut self, _steps: &[S])
Function called whenever the steps are accepted.
*You can use it to create the acceptance statistics if you move a variety of different moves
- If you use the default implementation this will be a optimized out
sourcefn steps_rejected(&mut self, _steps: &[S])
fn steps_rejected(&mut self, _steps: &[S])
Function called whenever the steps are rejected.
- You can use it to create the acceptance statistics if you move a variety of different moves
- If you use the default implementation this will be a optimized out