fstats_sampling Module



Contents


Interfaces

public interface box_muller_sample

Generates random, normally distributed values via the Box-Muller transform.

  • private function box_muller_sample_scalar(mu, sigma) result(rst)

    Generates a pair of independent, standard, normally distributed random values using the Box-Muller transform.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in) :: mu

    The mean of the distribution.

    real(kind=real64), intent(in) :: sigma

    The standard deviation of the distribution.

    Return Value real(kind=real64), (2)

    The pair of random values.

  • private function box_muller_array(mu, sigma, n) result(rst)

    Generates an array of normally distributed random values sampled by the Box-Muller transform.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in) :: mu

    The mean of the distribution.

    real(kind=real64), intent(in) :: sigma

    The standard deviation of the distribution.

    integer(kind=int32), intent(in) :: n

    The number of Box-Muller pairs to generate.

    Return Value real(kind=real64), allocatable, dimension(:)

    A 2N-element array containing the N Box-Muller pairs.


Functions

public function rejection_sample(tdist, n, xmin, xmax) result(rst)

Uses rejection sampling to randomly sample a target distribution.

Arguments

Type IntentOptional Attributes Name
class(distribution), intent(in) :: tdist

The distribution to sample

integer(kind=int32), intent(in) :: n

The number of samples to make.

real(kind=real64), intent(in) :: xmin

The minimum range to explore.

real(kind=real64), intent(in) :: xmax

The maximum range to explore.

Return Value real(kind=real64), allocatable, dimension(:)

An N-element array containing the N samples from the distribution.