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 |
subroutine aSample_2D(this, i, j, tgt, prob)
!! Draw a random element from 1:size(this%probs) with the probabilities listed in prob
class(AliasSampler_2D_t), intent(in) :: this
integer, intent(in) :: i, j
!! The index of the sampler.
integer, intent(out) :: tgt
!! The sampled value `tgt`.
real(dp), intent(out) :: prob
!! The probability of sampling `tgt`.
call this%alias_sampler%sample(i, j, 1, tgt, prob)
end subroutine aSample_2D