g05te generates a vector of pseudorandom integers from the discrete hypergeometric distribution of the number of specified items in a sample of size , taken from a population of size with specified items in it.
Syntax
C# |
---|
public static void g05te( int mode, int n, int ns, int np, int m, double[] r, G05..::..G05State g05state, int[] x, out int ifail ) |
Visual Basic |
---|
Public Shared Sub g05te ( _ mode As Integer, _ n As Integer, _ ns As Integer, _ np As Integer, _ m As Integer, _ r As Double(), _ g05state As G05..::..G05State, _ x As Integer(), _ <OutAttribute> ByRef ifail As Integer _ ) |
Visual C++ |
---|
public: static void g05te( int mode, int n, int ns, int np, int m, array<double>^ r, G05..::..G05State^ g05state, array<int>^ x, [OutAttribute] int% ifail ) |
F# |
---|
static member g05te : mode : int * n : int * ns : int * np : int * m : int * r : float[] * g05state : G05..::..G05State * x : int[] * ifail : int byref -> unit |
Parameters
- mode
- Type: System..::..Int32On entry: a code for selecting the operation to be performed by the method.
- Set up reference vector only.
- Generate variates using reference vector set up in a prior call to g05te.
- Set up reference vector and generate variates.
- Generate variates without using the reference vector.
Constraint: , , or .
- n
- Type: System..::..Int32On entry: , the number of pseudorandom numbers to be generated.Constraint: .
- ns
- Type: System..::..Int32On entry: , the sample size of the hypergeometric distribution.Constraint: .
- np
- Type: System..::..Int32On entry: , the population size of the hypergeometric distribution.Constraint: .
- m
- Type: System..::..Int32On entry: , the number of specified items of the hypergeometric distribution.Constraint: .
- r
- Type: array<System..::..Double>[]()[][]An array of size [lr]On exit: if , the reference vector.
- g05state
- Type: NagLibrary..::..G05..::..G05StateAn Object of type G05.G05State.
- x
- Type: array<System..::..Int32>[]()[][]An array of size [n]On exit: the pseudorandom numbers from the specified hypergeometric distribution.
- ifail
- Type: System..::..Int32%On exit: unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).
Description
g05te generates integers from a discrete hypergeometric distribution, where the probability of is
The variates can be generated with or without using a search table and index. If a search table is used then it is stored with the index in a reference vector and subsequent calls to g05te with the same parameter values can then use this reference vector to generate further variates. The reference array is generated by a recurrence relation if , otherwise Stirling's approximation is used.
One of the initialization methods (G05KFF not in this release) (for a repeatable sequence if computed sequentially) or (G05KGF not in this release) (for a non-repeatable sequence) must be called prior to the first call to g05te.
References
Knuth D E (1981) The Art of Computer Programming (Volume 2) (2nd Edition) Addison–Wesley
Error Indicators and Warnings
Errors or warnings detected by the method:
- On entry, , , or .
- On entry, .
On entry, , or .
- On entry, .
On entry, , or .
- On entry, at least one of ns, np or m is not the same as when r was set up in a previous call to g05te with or .On entry, the r vector was not initialized correctly or has been corrupted.
- On entry, lr is too small when or .
On entry, state vector was not initialized or has been corrupted.
Accuracy
Not applicable.
Parallelism and Performance
None.
Further Comments
None.