aSample_1D Subroutine

private subroutine aSample_1D(this, iEntry, tgt, prob)

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

Type Bound

AliasSampler_1D_t

Arguments

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

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

The probability of sampling tgt.


Contents

Source Code


Source Code

    subroutine aSample_1D(this, iEntry, tgt, prob)
        !! Draw a random element from 1:size(this%probs) with the probabilities listed in prob
        class(AliasSampler_1D_t), intent(in) :: this
        integer, intent(in) :: iEntry
            !! 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(iEntry, 1, 1, tgt, prob)
    end subroutine aSample_1D