d01gy calculates the optimal coefficients for use by (D01GCF not in this release) d01gd, for prime numbers of points.

Syntax

C#
public static void d01gy(
	int ndim,
	int npts,
	double[] vk,
	out int ifail
)
Visual Basic
Public Shared Sub d01gy ( _
	ndim As Integer, _
	npts As Integer, _
	vk As Double(), _
	<OutAttribute> ByRef ifail As Integer _
)
Visual C++
public:
static void d01gy(
	int ndim, 
	int npts, 
	array<double>^ vk, 
	[OutAttribute] int% ifail
)
F#
static member d01gy : 
        ndim : int * 
        npts : int * 
        vk : float[] * 
        ifail : int byref -> unit 

Parameters

ndim
Type: System..::..Int32
On entry: n, the number of dimensions of the integral.
Constraint: ndim1.
npts
Type: System..::..Int32
On entry: p, the number of points to be used.
Constraint: npts must be a prime number 5.
vk
Type: array<System..::..Double>[]()[][]
An array of size [ndim]
On exit: the n optimal coefficients.
ifail
Type: System..::..Int32%
On exit: ifail=0 unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).

Description

The Korobov (1963) procedure for calculating the optimal coefficients a1,a2,,an for p-point integration over the n-cube 0,1n imposes the constraint that
a1=1  and  ai=ai-1 mod p,  i=1,2,,n (1)
where p is a prime number and a is an adjustable parameter. This parameter is computed to minimize the error in the integral
3n01dx101dxni=1n1-2xi2, (2)
when computed using the number theoretic rule, and the resulting coefficients can be shown to fit the Korobov definition of optimality.
The computation for large values of p is extremely time consuming (the number of elementary operations varying as p2) and there is a practical upper limit to the number of points that can be used. Method d01gz is computationally more economical in this respect but the associated error is likely to be larger.

References

Korobov N M (1963) Number Theoretic Methods in Approximate Analysis Fizmatgiz, Moscow

Error Indicators and Warnings

Errors or warnings detected by the method:
ifail=1
On entry,ndim<1.
ifail=2
On entry,npts<5.
ifail=3
On entry,npts is not a prime number.
ifail=4
The precision of the machine is insufficient to perform the computation exactly. Try a smaller value of npts, or use an implementation of higher precision.
ifail=-9000
An error occured, see message report.
ifail=-8000
Negative dimension for array value
ifail=-6000
Invalid Parameters value

Accuracy

The optimal coefficients are returned as exact integers (though stored in a real array).

Parallelism and Performance

None.

Further Comments

The time taken is approximately proportional to p2 (see [Description]).

Example

This example calculates the Korobov optimal coefficients where the number of dimensions is 4 and the number of points is 631.

Example program (C#): d01gye.cs

Example program results: d01gye.r

See Also