construct_CDF_sampler_with_total_t Function

private pure function construct_CDF_sampler_with_total_t(w, total) result(res)

Construct a CDF sampler from given weights.

The weights do not have to be normalized. If all weights are zero, or the array is empty, the sampler will return the (non-existent) index 0 with probability 1.

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: w(:)
real(kind=dp), intent(in) :: total

Return Value type(CDF_Sampler_t)


Contents