This module implements rejection sampling with two classes We split the weights into two classes based on a threshold
Constructor
Create a new rejection 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 | ||
| type(weighted_sampler_t), | public | :: | samplers(2) | ||||
| real(kind=dp), | public | :: | threshold | = | huge(dp) | ||
| integer(kind=i4), | public, | allocatable | :: | sampler_of_index(:) |
| 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 |