This modules implements a binary tree sampler It provides a way to sample elements based on their weights using a binary tree structure.
Constructor
Create a new binary tree sampler with N weights Input: n - number of weights
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=i4), | intent(in) | :: | n |
Derived type, extending from the base
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
real(kind=dp), | public, | allocatable | :: | weights(:) | |||
integer(kind=i4), | public | :: | n | = | 0 | ||
real(kind=dp), | public, | allocatable | :: | tree(:) |
final :: sampler_finalize |
generic, public :: init => init_n, init_w, init_w2 | |
procedure, public :: init_n => sampler_init | |
procedure, public :: init_w => sampler_init_w | |
procedure, public :: init_w2 => sampler_init_w2 | |
procedure, public :: reset => sampler_reset | |
procedure, public :: set_weight => sampler_set_weight | |
procedure, public :: set_weight_array => sampler_set_weight_array | |
procedure, public :: add_weight => sampler_add_weight | |
procedure, public :: sample => sampler_sample | |
procedure, public :: remove => sampler_remove | |
procedure, public :: sum => sampler_sum |