nag_rand_exp_mix (g05sgc) generates a vector of pseudorandom numbers from an exponential mix distribution composed of exponential distributions each having a mean and weight .
The distribution has PDF (probability density function)
where
and
,
.
One of the initialization functions
nag_rand_init_repeatable (g05kfc) (for a repeatable sequence if computed sequentially) or
nag_rand_init_nonrepeatable (g05kgc) (for a non-repeatable sequence) must be called prior to the first call to nag_rand_exp_mix (g05sgc).
- 1:
– IntegerInput
-
On entry: , the number of pseudorandom numbers to be generated.
Constraint:
.
- 2:
– IntegerInput
-
On entry: , the number of exponential distributions in the mix.
Constraint:
.
- 3:
– const doubleInput
-
On entry: the parameters for the exponential distributions in the mix.
Constraint:
, for .
- 4:
– const doubleInput
-
On entry: the weights for the exponential distributions in the mix.
Constraints:
- ;
- , for .
- 5:
– IntegerCommunication Array
-
Note: the dimension,
, of this array is dictated by the requirements of associated functions that must have been previously called. This array MUST be the same array passed as argument
state in the previous call to
nag_rand_init_repeatable (g05kfc) or
nag_rand_init_nonrepeatable (g05kgc).
On entry: contains information on the selected base generator and its current state.
On exit: contains updated information on the state of the generator.
- 6:
– doubleOutput
-
On exit: the pseudorandom numbers from the specified exponential mix distribution.
- 7:
– NagError *Input/Output
-
The NAG error argument (see
Section 2.7 in How to Use the NAG Library and its Documentation).
Not applicable.
nag_rand_exp_mix (g05sgc) is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
Please consult the
x06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this function. Please also consult the
Users' Note for your implementation for any additional implementation-specific information.
None.
This example prints the first five pseudorandom numbers from an exponential mix distribution comprising three exponential distributions with parameters
,
and
, and with respective weights
,
and
. The numbers are generated by a single call to nag_rand_exp_mix (g05sgc), after initialization by
nag_rand_init_repeatable (g05kfc).
None.