aSample_2D Subroutine

private subroutine aSample_2D(this, i, j, tgt, prob)

Draw a random element from 1:size(this%probs) with the probabilities listed in prob

Type Bound

AliasSampler_2D_t

Arguments

Type IntentOptional 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 tgt.

real(kind=dp), intent(out) :: prob

The probability of sampling tgt.


Contents

Source Code


Source Code

    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