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

Template of the API for specific quasi-Monte Carlo methods(not to be included as is!) More...

#include <clQMC/clQMC.h>

Go to the source code of this file.

Typedefs

typedef struct clqmcPointset_ clqmcPointset
 Point set object [device]. More...
 
typedef struct clqmcPointsetStream_ clqmcPointsetStream
 Point set stream object [device]. More...
 

Functions

cl_uint clqmcNumPoints (const clqmcPointset *pointset)
 Return the number of point in the point set [device]. More...
 
cl_uint clqmcDimension (const clqmcPointset *pointset)
 Return the dimension of the point set [device]. More...
 
clqmcPointsetclqmcCreate (..., size_t *objectSize, clqmcStatus *err)
 Create a new point set object. More...
 
clqmcStatus clqmcDestroy (clqmcPointset *pointset)
 Destroy a point set object. More...
 
clqmcStatus clqmcWriteInfo (const clqmcPointset *pointset, FILE *file)
 Write information about a point set object. More...
 
clqmcPointsetStreamclqmcCreateStream (const clqmcPointset *pointset, cl_uint partCount, cl_uint partIndex, const double *shift, clqmcStatus *err)
 Attach a new stream to a point set object. More...
 
clqmcStatus clqmcCreateOverStream (clqmcPointsetStream *stream, const clqmcPointset *pointset, cl_uint partCount, cl_uint partIndex, const RandType *randomization)
 Attach a new stream to a point set object in already allocated memory [device]. More...
 
clqmcStatus clqmcDestroyStream (clqmcPointsetStream *stream)
 Destroy a stream object. More...
 
double clqmcNextCoordinate (clqmcPointsetStream *stream)
 Return the value of the next coordinate [device]. More...
 
cl_uint clqmcNextPoint (clqmcPointsetStream *stream, double *coords)
 Retrieve all coordinates of the next point [device]. More...
 
cl_uint clqmcForwardToNextPoint (clqmcPointsetStream *stream)
 Advance a stream to the next point [device]. More...
 
cl_uint clqmcCurrentPointIndex (const clqmcPointsetStream *stream)
 Return the current point index of a stream [device]. More...
 
cl_uint clqmcCurrentCoordIndex (const clqmcPointsetStream *stream)
 Return the current coordinate index of a stream [device]. More...
 

Detailed Description

Template of the API for specific quasi-Monte Carlo methods(not to be included as is!)

The function and type names in this API all start with clqmc. In each specific implementation, prefixes to function names are expanded to a specific prefix and the generic point set and types clqmcPointset and clqmcPointsetStream are replaced with specific point set and stream type, e.g., clqmcLatticeRule and clqmcLatticeRuleStream.

Host and Device APIs

The functions described here are all available on the host, in all implementations, unless specified otherwise. Only some of the functions and types are also available on the device in addition to the host; they are tagged with [device]. Other functions are only available on the device; they are tagged with [device-only]. Some functions return an error code in err.

Typedef Documentation

typedef struct clqmcPointset_ clqmcPointset

Point set object [device].

This structure contains data that describes a quasi-Monte Carlo point set. Its definition depends on the type of point set.

typedef struct clqmcPointsetStream_ clqmcPointsetStream

Point set stream object [device].

This structure contains data that describes a stream associated to a quasi-Monte Carlo point set. Its definition depends on the type of point set.

Function Documentation

cl_uint clqmcNumPoints ( const clqmcPointset pointset)

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

Parameters
[in]pointsetA point set object.
Returns
Number of points in the point set.
cl_uint clqmcDimension ( const clqmcPointset pointset)

Return the dimension of the point set [device].

Parameters
[in]pointsetA point set object.
Returns
Dimension of the point set.
clqmcPointset* clqmcCreate (   ...,
size_t *  objectSize,
clqmcStatus err 
)

Create a new point set object.

Allocate resources for and create a new point set object.

The arguments of this function depend on the specific type of point set.

Parameters
[out]objectSizeSize in bytes of the returned object.
[out]errError status.
Returns
Newly created point set object.
See also
clqmcLatticeRuleCreate(), clqmcLatticeRuleCreateKorobov()
clqmcStatus clqmcDestroy ( clqmcPointset pointset)

Destroy a point set object.

Release the resources associated to a point set object.

Parameters
[in]pointsetPoint set object to be destroyed.
clqmcStatus clqmcWriteInfo ( const clqmcPointset pointset,
FILE *  file 
)

Write information about a point set object.

Write a description of a point set object and its properties to the console.

clqmcPointsetStream* clqmcCreateStream ( const clqmcPointset pointset,
cl_uint  partCount,
cl_uint  partIndex,
const double *  shift,
clqmcStatus err 
)

Attach a new stream to a point set object.

This function allocates resources for a new stream object and calls clqmcCreateOverStream() to actually create the stream object.

See also
clqmcCreateOverStream()
clqmcStatus clqmcCreateOverStream ( clqmcPointsetStream stream,
const clqmcPointset pointset,
cl_uint  partCount,
cl_uint  partIndex,
const RandType *  randomization 
)

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

This function does not allocate memory; it uses already allocated memory to create a stream object.

The point set pointset is divided into partCount indexed from 0 to partCount - 1. The internal structure of the partitioning generally depends on the type of point set.

A randomization is optionally applied. The type of the randomization (written here as RandType for convenience) depends on the type of point set. For example, 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.

Parameters
[out]streamMemory location that will hold the new stream object.
[in]pointsetPoint set object to attach the new stream to.
[in]partCountNumber of subsets of equal cardinality into which pointset must be partitioned.
[in]partIndexIndex of the subset represented by the new stream object.
[in]randomizationRandomization of an appropriate type, or NULL for no randomization.
Returns
Error status.
clqmcStatus clqmcDestroyStream ( clqmcPointsetStream stream)

Destroy a stream object.

Release the resources associated to a stream object.

double clqmcNextCoordinate ( clqmcPointsetStream stream)

Return the value of the next coordinate [device].

Advance the stream to the next coordinate of the current point and return its value. When all coordinates of a point are exhausted, clqmcForwardToNextPoint() should be call to advance the stream to the next point.

Parameters
[in,out]streamPoint set stream object.
Returns
Value of the next coordinate of the current point in the stream, or -1.0 if no further coordinate is available.
cl_uint clqmcNextPoint ( clqmcPointsetStream stream,
double *  coords 
)

Retrieve all coordinates of the next point [device].

Advance the stream to the next point and return all its coordinates.

Parameters
[in,out]streamPoint set stream object.
[out]coordsCoordinates of the point.
Returns
Index of the point returned in coords.
Todo:
Not implemented yet.
cl_uint clqmcForwardToNextPoint ( clqmcPointsetStream stream)

Advance a stream to the next point [device].

Advance the stream to the first coordinate of the next point.

Parameters
[in,out]streamPoint set stream object.
Returns
Index of the next point.
cl_uint clqmcCurrentPointIndex ( const clqmcPointsetStream stream)

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

Parameters
[in]streamPoint set stream object.
Returns
Index of the point currently pointed to by the stream.
cl_uint clqmcCurrentCoordIndex ( const clqmcPointsetStream stream)

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

Parameters
[in]streamPoint set stream object.
Returns
Index of the coordinate of the point currently pointed to by the stream.