This is a ‘type interface.’ See Type Interfaces for more info on what that is.
The RandomWalk type is responsible for actually implementing the random walk. It should keep the current state of the random walk in memory and update it when the move()
function is called.
RandomWalk types are used in particular by:
The RandomWalk type should provide the following typedef member:
- typedef ... CountIntType
- This (usually an
unsigned int
or unsigned long
) should specify which type to use to count the iterations. This is also the return type of n_sweep()
etc.
RandomWalk needs to provide the following members, which are called at the appropriate times:
- CountIntType RandomWalk::n_sweep()
- Number of iterations that compose a "sweep".
- CountIntType RandomWalk::n_therm()
- Number of thermalizing sweeps to perform.
- CountIntType RandomWalk::n_run()
- Number of live sweeps to perform.
- void RandomWalk::move(CountIntType k, bool is_thermalizing, bool is_live_iter)
- Is called to perform a new random walk iteration. The random walk object is responsible for keeping the current state of the random walk in memory, and for processing a jump function. This method should update the internal state of the random walk. This function does not return anything.
k
is the raw iteration count, starting at zero (and which is reset to zero after the thermalizing sweeps). is_thermalizing
is true
during the thermalizing runs, false
otherwise. is_live_iter
is true
when a live sample is taken, only once every sweep after the thermalization runs.
- void RandomWalk::process_sample(CountIntType k)
- Is called for each "live" point for which a sample should be taken. The point in question is the current state of the random walk. This only happens after thermalization, and at the last iteration of a sweep.
- void RandomWalk::init()
- Is called before starting the random walk. The RandomWalk may perform custom last-minute initializations if required.
- void RandomWalk::thermalizing_done()
- Is called after the thermalizing runs and before starting the live runs.
- void RandomWalk::done()
- Is called after the random walk is finished. This happens after the given number of iterations were reached.