d01gz calculates the optimal coefficients for use by
(D01GCF not in this release) d01gd,
when the number of points is the product of two primes.
Syntax
C# |
---|
public static void d01gz( int ndim, int np1, int np2, double[] vk, out int ifail ) |
Visual Basic |
---|
Public Shared Sub d01gz ( _ ndim As Integer, _ np1 As Integer, _ np2 As Integer, _ vk As Double(), _ <OutAttribute> ByRef ifail As Integer _ ) |
Visual C++ |
---|
public: static void d01gz( int ndim, int np1, int np2, array<double>^ vk, [OutAttribute] int% ifail ) |
F# |
---|
static member d01gz : ndim : int * np1 : int * np2 : int * vk : float[] * ifail : int byref -> unit |
Parameters
- ndim
- Type: System..::..Int32On entry: , the number of dimensions of the integral.Constraint: .
- np1
- Type: System..::..Int32On entry: the larger prime factor of the number of points in the integration rule.Constraint: must be a prime number .
- np2
- Type: System..::..Int32On entry: the smaller prime factor of the number of points in the integration rule. For maximum efficiency, should be close to .Constraint: must be a prime number such that .
- vk
- Type: array<System..::..Double>[]()[][]An array of size [ndim]On exit: the optimal coefficients.
- ifail
- Type: System..::..Int32%On exit: unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).
Description
Korobov (1963) gives a procedure for calculating optimal coefficients for -point integration over the -cube , when the number of points is
where and are distinct prime numbers.
(1) |
The advantage of this procedure is that if is chosen to be the nearest prime integer to , then the number of elementary operations required to compute the rule is of the order of which grows less rapidly than the number of operations required by d01gy. The associated error is likely to be larger although it may be the only practical alternative for high values of .
References
Korobov N M (1963) Number Theoretic Methods in Approximate Analysis Fizmatgiz, Moscow
Error Indicators and Warnings
Errors or warnings detected by the method:
On entry, .
On entry, , or , or .
- The value exceeds the largest integer representable on the machine, and hence the optimal coefficients could not be used in a valid call of (D01GCF not in this release) d01gd.
On entry, np1 is not a prime number.
On entry, np2 is not a prime number.
Accuracy
The optimal coefficients are returned as exact integers (though stored in a real array).
Parallelism and Performance
None.
Further Comments
The time taken by d01gz grows at least as fast as . (See [Description].)
Example
This example calculates the Korobov optimal coefficients where the number of dimensons is and the number of points is the product of the two prime numbers, and .