BRL-CAD
|
Generation of the Sobol quasi-random low-discrepancy sequence of numbers. More...
Files | |
file | sobol.h |
Macros | |
#define | BN_SOBOL_MAXDIM 1111 |
Functions | |
struct bn_soboldata * | bn_sobol_create (unsigned int sdim, unsigned long seed) |
void | bn_sobol_destroy (struct bn_soboldata *s) |
double * | bn_sobol_next (struct bn_soboldata *s, const double *lb, const double *ub) |
void | bn_sobol_skip (struct bn_soboldata *s, unsigned n) |
void | bn_sobol_sph_sample (point_t sample, const point_t center, const fastf_t radius, struct bn_soboldata *s) |
Generate a sample point on a sphere per Marsaglia (1972), using the Sobol data sequence s to drive the selection. More... | |
Generation of the Sobol quasi-random low-discrepancy sequence of numbers.
#define BN_SOBOL_MAXDIM 1111 |
struct bn_soboldata * bn_sobol_create | ( | unsigned int | sdim, |
unsigned long | seed | ||
) |
Create and initialize an instance of a Sobol sequence data container. If seed is non-zero the value will be used in initialization, otherwise a default will be used. User must destroy the returned data with bn_sobol_destroy
void bn_sobol_destroy | ( | struct bn_soboldata * | s | ) |
Destroy a Sobol data container
double * bn_sobol_next | ( | struct bn_soboldata * | s, |
const double * | lb, | ||
const double * | ub | ||
) |
Return the next vector in Sobol sequence, scaled to (lb[i], ub[i]) interval.
If lb and ub are NULL, x[i] will be in the range (0,1).
The return vector is read only and is managed internally by bn_sobodata.
Note: not performing the scale saves some math operations, so NULL lb and ub are recommend if the required interval for the caller's application happens to be (0,1).
Note: If the user attempts to read more than 2^32-1 points from the sequence, the generator will fall back on pseudo random number generation.
void bn_sobol_skip | ( | struct bn_soboldata * | s, |
unsigned | n | ||
) |
If the caller knows in advance how many numbers (n) they want to compute, this function supports implementation of the Acworth et al (1998) strategy of skipping a number of points equal to the largest power of 2 smaller than n for better performance.
Joe and Kuo indicate in their notes at http://web.maths.unsw.edu.au/~fkuo/sobol/ that they are "less persuaded" by this recommendation, but this function is available for callers who wish to use it.
void bn_sobol_sph_sample | ( | point_t | sample, |
const point_t | center, | ||
const fastf_t | radius, | ||
struct bn_soboldata * | s | ||
) |
Generate a sample point on a sphere per Marsaglia (1972), using the Sobol data sequence s to drive the selection.
The caller is responsible for initializing the bn_sobodata sequence before generating points.
TODO: investigate the http://www.dtic.mil/docs/citations/ADA510216 scrambling method to see if basic Sobol sequence can be improved on for spherical sampling Also relevant: people.sc.fsu.edu/~hcc8471/ssobol.pdf