clQMC
An OpenCL library for quasi-Monte Carlo methods
Typedefs | Functions
latticerule.h File Reference

Host interface for lattice rules. More...

#include <clQMC/clQMC.h>
#include <stdio.h>

Go to the source code of this file.

Typedefs

typedef struct clqmcLatticeRule_ clqmcLatticeRule
 Lattice rule object. More...
 
typedef struct clqmcLatticeRuleStream_ clqmcLatticeRuleStream
 Lattice rule stream object. More...
 

Functions

cl_uint clqmcLatticeRuleNumPoints (const clqmcLatticeRule *lattice)
 Return the number of point in the point set [device]. More...
 
cl_uint clqmcLatticeRuleDimension (const clqmcLatticeRule *lattice)
 Return the dimension of the point set [device]. More...
 
clqmcLatticeRuleclqmcLatticeRuleCreate (cl_uint numPoints, cl_uint dimension, const cl_int *genVec, size_t *objectSize, clqmcStatus *err)
 Create a new rank-1 lattice rule. More...
 
clqmcLatticeRuleclqmcLatticeRuleCreateKorobov (cl_uint numPoints, cl_uint dimension, cl_int gen, size_t *objectSize, clqmcStatus *err)
 Create a new Korobov lattice rule. More...
 
clqmcStatus clqmcLatticeRuleDestroy (clqmcLatticeRule *lattice)
 Destroy a point set object. More...
 
clqmcStatus clqmcLatticeRuleWriteInfo (const clqmcLatticeRule *lattice, FILE *file)
 Write information about a point set object. More...
 
CLQMCAPI clqmcLatticeRuleStreamclqmcLatticeRuleCreateStream (const clqmcLatticeRule *lattice, cl_uint partCount, cl_uint partIndex, const _CLQMC_FPTYPE *shift, clqmcStatus *err)
 Attach a new stream to a point set object. More...
 
CLQMCAPI clqmcStatus clqmcLatticeRuleCreateOverStream (clqmcLatticeRuleStream *stream, const clqmcLatticeRule *lattice, cl_uint partCount, cl_uint partIndex, const _CLQMC_FPTYPE *shift)
 Attach a new stream to a point set object in already allocated memory [device]. More...
 
CLQMCAPI clqmcStatus clqmcLatticeRuleDestroyStream (clqmcLatticeRuleStream *stream)
 Destroy a stream object. More...
 
CLQMCAPI _CLQMC_FPTYPE clqmcLatticeRuleNextCoordinate (clqmcLatticeRuleStream *stream)
 Return the value of the next coordinate [device]. More...
 
CLQMCAPI cl_uint clqmcLatticeRuleNextPoint (clqmcLatticeRuleStream *stream, clqmc_fptype *coords)
 Retrieve all coordinates of the next point [device]. More...
 
CLQMCAPI cl_uint clqmcLatticeRuleForwardToNextPoint (clqmcLatticeRuleStream *stream)
 Advance a stream to the next point [device]. More...
 
CLQMCAPI cl_uint clqmcLatticeRuleCurrentPointIndex (const clqmcLatticeRuleStream *stream)
 Return the current point index of a stream [device]. More...
 
CLQMCAPI cl_uint clqmcLatticeRuleCurrentCoordIndex (const clqmcLatticeRuleStream *stream)
 Return the current coordinate index of a stream [device]. More...
 

Detailed Description

Host interface for lattice rules.

Typedef Documentation

typedef struct clqmcLatticeRule_ clqmcLatticeRule

Lattice rule object.

This object stores the properties of a lattice rule (number of points, dimension and generating vector).

typedef struct clqmcLatticeRuleStream_ clqmcLatticeRuleStream

Lattice rule stream object.

This stream object can enumerate all or a portion of the points of a lattice rule. When a random shift is applied to a lattice rule, it is attached to the stream object.

Function Documentation

cl_uint clqmcLatticeRuleNumPoints ( const clqmcLatticeRule lattice)

Return the number of point in the point set [device].

See also
clqmcNumPoints()
Examples:
DocsTutorial/example3_kernel.cl, and DocsTutorial/example4_kernel.cl.
cl_uint clqmcLatticeRuleDimension ( const clqmcLatticeRule lattice)

Return the dimension of the point set [device].

See also
clqmcDimension()
clqmcLatticeRule* clqmcLatticeRuleCreate ( cl_uint  numPoints,
cl_uint  dimension,
const cl_int *  genVec,
size_t *  objectSize,
clqmcStatus err 
)

Create a new rank-1 lattice rule.

See also
qmc_qmc
Parameters
[in]numPointsNumber of points.
[in]dimensionDimension.
[in]genVecGenerating vector.
[out]objectSizeSize in bytes of the returned object.
[out]errError status.
Returns
New rank-1 lattice rule object.
Examples:
DocsTutorial/example2.c, DocsTutorial/example3.c, and DocsTutorial/example4.c.
clqmcLatticeRule* clqmcLatticeRuleCreateKorobov ( cl_uint  numPoints,
cl_uint  dimension,
cl_int  gen,
size_t *  objectSize,
clqmcStatus err 
)

Create a new Korobov lattice rule.

For a Korobov lattice rule, the generating vector \(\boldsymbol a = (1, a, a^2 \bmod n, \dots, a^s \bmod n)\) is parameterized by a single number \(a\).

Parameters
[in]numPointsNumber of points.
[in]dimensionDimension.
[in]genParameter \(a\) for the generating vector.
[out]objectSizeSize in bytes of the returned object.
[out]errError status.
Returns
New Korobov lattice rule object.
See also
clqmcLatticeRuleCreate()
clqmcStatus clqmcLatticeRuleDestroy ( clqmcLatticeRule lattice)

Destroy a point set object.

See also
clqmcDestroy()
Examples:
DocsTutorial/example2.c, DocsTutorial/example3.c, and DocsTutorial/example4.c.
clqmcStatus clqmcLatticeRuleWriteInfo ( const clqmcLatticeRule lattice,
FILE *  file 
)

Write information about a point set object.

See also
clqmcWriteInfo()
Examples:
DocsTutorial/example2.c, DocsTutorial/example3.c, and DocsTutorial/example4.c.
CLQMCAPI clqmcLatticeRuleStream* clqmcLatticeRuleCreateStream ( const clqmcLatticeRule lattice,
cl_uint  partCount,
cl_uint  partIndex,
const _CLQMC_FPTYPE *  shift,
clqmcStatus err 
)

Attach a new stream to a point set object.

See also
clqmcCreateStream()
CLQMCAPI clqmcStatus clqmcLatticeRuleCreateOverStream ( clqmcLatticeRuleStream stream,
const clqmcLatticeRule lattice,
cl_uint  partCount,
cl_uint  partIndex,
const _CLQMC_FPTYPE *  shift 
)

Attach a new stream to a point set object in already allocated memory [device].

See also
clqmcCreateOverStream()

For a rank-1 lattice rule, the randomization is a periodic random shift. The argument shift must be a vector of the same dimension as the lattice, or NULL.

Examples:
DocsTutorial/example2_kernel.cl, DocsTutorial/example3_kernel.cl, and DocsTutorial/example4_kernel.cl.
CLQMCAPI clqmcStatus clqmcLatticeRuleDestroyStream ( clqmcLatticeRuleStream stream)

Destroy a stream object.

See also
clqmcDestroyStream()
CLQMCAPI _CLQMC_FPTYPE clqmcLatticeRuleNextCoordinate ( clqmcLatticeRuleStream stream)

Return the value of the next coordinate [device].

See also
clqmcNextCoordinate()
CLQMCAPI cl_uint clqmcLatticeRuleNextPoint ( clqmcLatticeRuleStream stream,
clqmc_fptype *  coords 
)

Retrieve all coordinates of the next point [device].

See also
clqmcNextPoint()
CLQMCAPI cl_uint clqmcLatticeRuleForwardToNextPoint ( clqmcLatticeRuleStream stream)
CLQMCAPI cl_uint clqmcLatticeRuleCurrentPointIndex ( const clqmcLatticeRuleStream stream)

Return the current point index of a stream [device].

See also
clqmcCurrentPointIndex()
CLQMCAPI cl_uint clqmcLatticeRuleCurrentCoordIndex ( const clqmcLatticeRuleStream stream)

Return the current coordinate index of a stream [device].

See also
clqmcCurrentCoordIndex()