| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| type(AliasSampler_3D_t), | private | :: | alias_sampler |
Setup an array of samplers using a single shared resource (split into parts associated with one of them each). This only does the allocation.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(AliasSampler_1D_t) | :: | this | ||||
| integer, | intent(in) | :: | nEntries |
number of samplers to initialise |
||
| integer, | intent(in) | :: | entrySize |
number of samplers to initialise number of values per sampler |
||
| character(len=*), | intent(in) | :: | name |
Initialise one sampler of an array
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(AliasSampler_1D_t), | intent(inout) | :: | this | |||
| integer, | intent(in) | :: | iEntry |
index of the entry to initialize |
||
| integer, | intent(in) | :: | rank_with_info |
index of the entry to initialize |
||
| real(kind=dp), | intent(in) | :: | arr(:) |
Deallocate an array of samplers
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(AliasSampler_1D_t), | intent(inout) | :: | this |
Draw a random element from 1:size(this%probs) with the probabilities listed in prob
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(AliasSampler_1D_t), | intent(in) | :: | this | |||
| integer, | intent(in) | :: | iEntry |
The index of the sampler. |
||
| integer, | intent(out) | :: | tgt |
The sampled value |
||
| real(kind=dp), | intent(out) | :: | prob |
The probability of sampling |
Draw a random element from 1:size(this%probs) with the probabilities listed in prob while adherring to constraints
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(AliasSampler_1D_t), | intent(in) | :: | this | |||
| integer, | intent(in) | :: | i |
The index of the sampler. |
||
| integer, | intent(in) | :: | contain(:) |
The constraint in nI format. |
||
| real(kind=dp), | intent(in) | :: | renorm |
The renormalization. (i.e. sum(this%get_prob(… contain…)) |
||
| integer, | intent(out) | :: | pos |
The sampled value |
||
| integer, | intent(out) | :: | tgt |
The sampled value |
||
| real(kind=dp), | intent(out) | :: | prob |
The probability of sampling |
Draw a random element from 1:size(this%probs) with the probabilities listed in prob while adherring to constraints
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(AliasSampler_1D_t), | intent(in) | :: | this | |||
| integer, | intent(in) | :: | i |
The index of the sampler. |
||
| integer, | intent(in) | :: | contain(:) |
The constraint in nI format. |
||
| integer(kind=n_int), | intent(in) | :: | contain_ilut(0:) |
The constraint in ilut (bitmask) format |
||
| real(kind=dp), | intent(in) | :: | renormalization |
The renormalization. (i.e. sum(this%get_prob(… contain…)) |
||
| integer, | intent(out) | :: | pos |
The sampled value |
||
| integer, | intent(out) | :: | tgt |
The sampled value |
||
| real(kind=dp), | intent(out) | :: | prob |
The probability of sampling |
Draw a random element from 1:size(this%probs) with the probabilities listed in prob while adherring to constraints
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(AliasSampler_1D_t), | intent(in) | :: | this | |||
| integer, | intent(in) | :: | i |
The index of the sampler. |
||
| integer, | intent(in) | :: | contain(:) |
The constraint in nI format. |
||
| integer(kind=n_int), | intent(in) | :: | contain_ilut(0:) |
The constraint in ilut (bitmask) format |
||
| real(kind=dp), | intent(in) | :: | renormalization |
The renormalization. (i.e. sum(this%get_prob(… contain…)) |
||
| integer, | intent(out) | :: | pos |
The sampled value |
||
| integer, | intent(out) | :: | tgt |
The sampled value |
||
| real(kind=dp), | intent(out) | :: | prob |
The probability of sampling |
Draw a random element from 1:size(this%probs) with the probabilities listed in prob while adherring to constraints
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(AliasSampler_1D_t), | intent(in) | :: | this | |||
| integer, | intent(in) | :: | i |
The index of the sampler. |
||
| integer, | intent(in) | :: | contain(:) |
The constraint in nI format. |
||
| real(kind=dp), | intent(in) | :: | renorm |
The renormalization. (i.e. sum(this%get_prob(… contain…)) |
||
| integer, | intent(out) | :: | pos |
The sampled value |
||
| integer, | intent(out) | :: | tgt |
The sampled value |
||
| real(kind=dp), | intent(out) | :: | prob |
The probability of sampling |
Returns the probability to draw tgt from the sampler with index iEntry
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(AliasSampler_1D_t), | intent(in) | :: | this | |||
| integer, | intent(in) | :: | iEntry |
index of the sampler to use |
||
| integer, | intent(in) | :: | tgt |
the number for which we request the probability of sampling |
Returns the probability to draw tgt from the sampler with index iEntry
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(AliasSampler_1D_t), | intent(in) | :: | this | |||
| integer, | intent(in) | :: | i |
Index of the sampler to use |
||
| integer, | intent(in) | :: | contain(:) | |||
| real(kind=dp), | intent(in) | :: | renorm | |||
| integer, | intent(in) | :: | tgt |
the number for which we request the probability of sampling |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(AliasSampler_1D_t), | intent(in) | :: | this |
type AliasSampler_1D_t private type(AliasSampler_3D_t) :: alias_sampler contains ! constructor procedure :: shared_alloc => setupSamplerArray_1D procedure :: setup_entry => setupEntry_1D ! destructor procedure :: finalize => samplerArrayDestructor_1D ! get a random element and the generation probability from one of the samplers procedure :: sample => aSample_1D generic :: constrained_sample => constrained_sample_1D_nI, constrained_sample_1D_fast procedure, private :: constrained_sample_1D_nI, constrained_sample_1D_fast procedure :: get_prob => aGetProb_1D procedure :: constrained_getProb => constrained_get_prob_1D procedure, public :: get_memory_demand => get_memory_demand_AliasSampler_1D_t end type AliasSampler_1D_t