This module contains the utility to use alias table lookup on lists, requiring to precompute biases but making the lookup O(1)
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=dp), | private, | parameter | :: | redrawing_cutoff | = | 0.1_dp |
If we draw from constrained subsets of a precomputed probability distributions
we can use two different algorithms:
1. We just redraw until we sample an element from our subset
2. We reconstruct probability distributions for our narrower subset.
If the sum of probabilities of our subset is larger than |
This class implements the Walker-Vose Alias Sampling method.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| type(shared_array_real_t), | private | :: | bias |
this is the table of bias |
|||
| type(shared_array_int32_t), | private | :: | alias |
this is the lookup table for the resulting random number |
| procedure, public :: setup => setup_AliasTable_t | constructor |
| procedure, private :: init => init_AliasTable_t | only compute the data, without allocation |
| procedure, public :: finalize => finalize_AliasTable_t | destructor - final would be suited better, but is not supported by all compilers |
| procedure, public :: sample => sample_AliasTable_t | get a random value from the alias table |
| procedure, public :: get_memory_demand => get_memory_demand_AliasTable_t |
Alias Sampler class
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| type(AliasTable_t), | private | :: | table |
alias table used for sampling |
|||
| type(shared_array_real_t), | private | :: | probs |
the probabilities |
| procedure, public :: setup => setup_AliasSampler_t | constructor |
| procedure, private :: init => init_AliasSampler_t | only compute the data, i.e. bias tables etc., without allocation |
| procedure, private :: init_probs => init_probs_AliasSampler_t | initialize the probabilities |
| procedure, public :: finalize => finalize_AliasSampler_t | destructor |
| procedure, public :: sample | get a random element and the generation probability |
| generic, public :: constrained_sample => constrained_sample_fast, constrained_sample_nI | get a random element from a constrained set and its normalized! generation probability |
| procedure, private :: constrained_sample_fast | |
| procedure, private :: constrained_sample_nI | |
| procedure, public :: get_prob => get_prob_AliasSampler_t | get the probability to produce a given value |
| procedure, public :: constrained_getProb | get the probability to draw a given value from a constrained set |
| procedure, public :: get_memory_demand => get_memory_demand_AliasSampler |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| type(AliasSampler_t), | private, | allocatable | :: | samplerArray(:,:,:) | |||
| type(shared_array_real_t), | private | :: | allProbs | ||||
| type(shared_array_real_t), | private | :: | allBiasTable | ||||
| type(shared_array_int32_t), | private | :: | allAliasTable |
| procedure, public :: shared_alloc => setupSamplerArray_3D | |
| procedure, public :: setup_entry => setupEntry_3D | |
| procedure, public :: finalize => samplerArrayDestructor_3D | |
| procedure, public :: sample => aSample_3D | |
| generic, public :: constrained_sample => constrained_sample_3D_nI, constrained_sample_3D_fast | |
| procedure, private :: constrained_sample_3D_fast | |
| procedure, private :: constrained_sample_3D_nI | |
| procedure, public :: get_prob => aGetProb_3D | |
| procedure, public :: constrained_getProb => constrained_get_prob_3D | |
| procedure, public :: get_memory_demand => get_memory_demand_AliasSampler_3D_t |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| type(AliasSampler_3D_t), | private | :: | alias_sampler |
| procedure, public :: shared_alloc => setupSamplerArray_2D | |
| procedure, public :: setup_entry => setupEntry_2D | |
| procedure, public :: finalize => samplerArrayDestructor_2D | |
| procedure, public :: sample => aSample_2D | |
| generic, public :: constrained_sample => constrained_sample_2D_nI, constrained_sample_2D_fast | |
| procedure, private :: constrained_sample_2D_fast | |
| procedure, private :: constrained_sample_2D_nI | |
| procedure, public :: get_prob => aGetProb_2D | |
| procedure, public :: constrained_getProb => constrained_get_prob_2D | |
| procedure, public :: get_memory_demand => get_memory_demand_AliasSampler_2D_t |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| type(AliasSampler_3D_t), | private | :: | alias_sampler |
| procedure, public :: shared_alloc => setupSamplerArray_1D | |
| procedure, public :: setup_entry => setupEntry_1D | |
| procedure, public :: finalize => samplerArrayDestructor_1D | |
| procedure, public :: sample => aSample_1D | |
| generic, public :: constrained_sample => constrained_sample_1D_nI, constrained_sample_1D_fast | |
| procedure, private :: constrained_sample_1D_fast | |
| procedure, private :: constrained_sample_1D_nI | |
| procedure, public :: get_prob => aGetProb_1D | |
| procedure, public :: constrained_getProb => constrained_get_prob_1D | |
| procedure, public :: get_memory_demand => get_memory_demand_AliasSampler_1D_t |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(AliasTable_t), | intent(in) | :: | this |
Draw a random number from an alias table created with the corresponding probabilities aliasTable object
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(AliasTable_t), | intent(in) | :: | this |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(AliasSampler_t), | intent(in) | :: | this |
Returns the probability to draw tgt from this sampler
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(AliasSampler_t), | intent(in) | :: | this | |||
| integer, | intent(in) | :: | tgt |
the number for which we request the probability of sampling |
the probability of drawing tgt with the sample routine
Returns the probability to draw tgt from this sampler (has to be a set, i.e. unique and ordered) the probability of drawing anything from an empty sampler is 0
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(AliasSampler_t), | intent(in) | :: | this | |||
| integer, | intent(in) | :: | contain(:) | |||
| real(kind=dp), | intent(in) | :: | renorm | |||
| integer, | intent(in) | :: | tgt |
the number for which we request the probability of sampling |
This loosened threshhold might be a good idea if the renormalization was calculated via the complement, i.e. \Sum{ p_i } {i \in D_i} = 1 - \Sum{ p_i } {i \notin D_i}
the probability of picking tgt from constraint
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(AliasSampler_1D_t), | intent(in) | :: | this |
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_2D_t), | intent(in) | :: | this |
Returns the probability to draw tgt from the sampler with index iEntry
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(AliasSampler_2D_t), | intent(in) | :: | this | |||
| integer, | intent(in) | :: | i | |||
| integer, | intent(in) | :: | j | |||
| 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_2D_t), | intent(in) | :: | this | |||
| integer, | intent(in) | :: | i |
Index of the sampler to use |
||
| integer, | intent(in) | :: | j |
Index of the sampler to use 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_3D_t), | intent(in) | :: | this |
Returns the probability to draw tgt from the sampler with index iEntry
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(AliasSampler_3D_t), | intent(in) | :: | this | |||
| integer, | intent(in) | :: | i |
Index of the sampler to use |
||
| integer, | intent(in) | :: | j |
Index of the sampler to use Index of the sampler to use |
||
| integer, | intent(in) | :: | k |
Index of the sampler to use Index of the sampler to use 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_3D_t), | intent(in) | :: | this | |||
| integer, | intent(in) | :: | i |
Index of the sampler to use |
||
| integer, | intent(in) | :: | j |
Index of the sampler to use Index of the sampler to use |
||
| integer, | intent(in) | :: | k |
Index of the sampler to use Index of the sampler to use 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 |
Evaluate if a normalization has to be calculated directly.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in) | :: | normalization |
pseudo-constructor for alias tables
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(AliasTable_t), | intent(inout) | :: | this | |||
| integer, | intent(in) | :: | rank_with_info |
The intra-node rank that contains the weights to be used all other arr of all other ranks are ignored (and can be allocated with size 0). |
||
| real(kind=dp), | intent(in) | :: | arr(:) |
arr array containing the (not necessarily normalized) probabilities we want to use for sampling |
Set the bias and alias values for each value in range want to use for sampling
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(AliasTable_t), | intent(inout) | :: | this | |||
| integer, | intent(in) | :: | rank_with_info |
The intra-node rank that contains the weights to be used all other arr of all other ranks are ignored (and can be allocated with size 0). |
||
| real(kind=dp), | intent(in) | :: | arr(:) |
clear the memory used by the alias table
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(AliasTable_t), | intent(inout) | :: | this |
allocate the resources of this and load the probability distribution from arr into this want to use for sampling
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(AliasSampler_t), | intent(inout) | :: | this | |||
| integer, | intent(in) | :: | rank_with_info |
The intra-node rank that contains the weights to be used all other arr of all other ranks are ignored (and can be allocated with size 0). |
||
| real(kind=dp), | intent(in) | :: | arr(:) |
load the probability distribution from arr into this we only use this in the sampler array, but fortran has no friend classes, so its public want to use for sampling
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(AliasSampler_t), | intent(inout) | :: | this | |||
| integer, | intent(in) | :: | rank_with_info |
The intra-node rank that contains the weights to be used all other arr of all other ranks are ignored (and can be allocated with size 0). |
||
| real(kind=dp), | intent(in) | :: | arr(:) |
load the probability distribution from arr into this%probs want to use for sampling
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(AliasSampler_t), | intent(inout) | :: | this | |||
| integer, | intent(in) | :: | rank_with_info |
The intra-node rank that contains the weights to be used all other arr of all other ranks are ignored (and can be allocated with size 0). |
||
| real(kind=dp), | intent(in) | :: | arr(:) |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(AliasSampler_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_t), | intent(in) | :: | this | |||
| integer, | intent(out) | :: | tgt |
on return, this is a random number in the sampling range of this |
||
| real(kind=dp), | intent(out) | :: | prob |
on return, the probability of picking tgt |
draw a random element from 1:size(this%probs) with the probabilities listed in prob
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(AliasSampler_t), | intent(in) | :: | this | |||
| integer, | intent(in) | :: | contain(:) | |||
| real(kind=dp), | intent(in) | :: | renormalization | |||
| integer, | intent(out) | :: | pos |
the position of tgt in |
||
| integer, | intent(out) | :: | tgt |
the position of tgt in |
||
| real(kind=dp), | intent(out) | :: | prob |
on return, the probability of picking tgt from constraint |
draw a random element from 1:size(this%probs) with the probabilities listed in prob
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(AliasSampler_t), | intent(in) | :: | this | |||
| integer, | intent(in) | :: | contain(:) | |||
| integer(kind=n_int), | intent(in) | :: | contain_ilut(0:) | |||
| real(kind=dp), | intent(in) | :: | renormalization | |||
| integer, | intent(out) | :: | pos |
the position of tgt in |
||
| integer, | intent(out) | :: | val |
the position of tgt in |
||
| real(kind=dp), | intent(out) | :: | prob |
on return, the probability of picking tgt from constraint |
call the destructor on all elements of an array, then deallocate it. This is for intrinsic arrays, the sampler array class has its own deallocate routine.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(AliasSampler_t), | intent(inout), | allocatable | :: | arr(:) |
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 |
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_2D_t) | :: | this | ||||
| integer, | intent(in) | :: | dims(2) | |||
| integer, | intent(in) | :: | entrySize |
number of values per sampler |
||
| character(len=*), | intent(in) | :: | name |
Initialise one sampler of an array
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(AliasSampler_2D_t), | intent(inout) | :: | this | |||
| integer, | intent(in) | :: | i | |||
| integer, | intent(in) | :: | j | |||
| integer, | intent(in) | :: | rank_with_info | |||
| real(kind=dp), | intent(in) | :: | arr(:) |
Deallocate an array of samplers
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(AliasSampler_2D_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_2D_t), | intent(in) | :: | this | |||
| integer, | intent(in) | :: | i |
The index of the sampler. |
||
| integer, | intent(in) | :: | j |
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_2D_t), | intent(in) | :: | this | |||
| integer, | intent(in) | :: | i |
The index of the sampler. |
||
| integer, | intent(in) | :: | j |
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_2D_t), | intent(in) | :: | this | |||
| integer, | intent(in) | :: | i |
The index of the sampler. |
||
| integer, | intent(in) | :: | j |
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 |
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_3D_t), | intent(inout) | :: | this | |||
| integer, | intent(in) | :: | dims(3) | |||
| integer, | intent(in) | :: | entry_size |
number of values per sampler |
||
| character(len=*), | intent(in) | :: | name |
@brief Initialise one sampler of an array
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(AliasSampler_3D_t), | intent(inout) | :: | this | |||
| integer, | intent(in) | :: | i |
Index of the entry to initialize |
||
| integer, | intent(in) | :: | j |
Index of the entry to initialize Index of the entry to initialize |
||
| integer, | intent(in) | :: | k |
Index of the entry to initialize Index of the entry to initialize Index of the entry to initialize |
||
| integer, | intent(in) | :: | rank_with_info |
The intra-node rank that contains the weights to be used all other arr of all other ranks are ignored (and can be allocated with size 0). |
||
| real(kind=dp), | intent(in) | :: | arr(:) |
@brief Deallocate an array of samplers
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(AliasSampler_3D_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_3D_t), | intent(in) | :: | this | |||
| integer, | intent(in) | :: | i |
The index of the sampler. |
||
| integer, | intent(in) | :: | j |
The index of the sampler. |
||
| integer, | intent(in) | :: | k |
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_3D_t), | intent(in) | :: | this | |||
| integer, | intent(in) | :: | i |
The index of the sampler. |
||
| integer, | intent(in) | :: | j |
The index of the sampler. |
||
| integer, | intent(in) | :: | k |
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_3D_t), | intent(in) | :: | this | |||
| integer, | intent(in) | :: | i |
The index of the sampler. |
||
| integer, | intent(in) | :: | j |
The index of the sampler. |
||
| integer, | intent(in) | :: | k |
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 |