`#include <sobolrsg.hpp>`

A Gray code counter and bitwise operations are used for very fast sequence generation.

The implementation relies on primitive polynomials modulo two from the book "Monte Carlo Methods in Finance" by Peter Jäckel.

21 200 primitive polynomials modulo two are provided in QuantLib. Jäckel has calculated 8 129 334 polynomials: if you need that many dimensions you can replace the primitivepolynomials.c file included in QuantLib with the one provided in the CD of the "Monte Carlo Methods in Finance" book.

The choice of initialization numbers (also know as free direction integers) is crucial for the homogeneity properties of the sequence. Sobol defines two homogeneity properties: Property A and Property A'.

The unit initialization numbers suggested in "Numerical Recipes in C", 2nd edition, by Press, Teukolsky, Vetterling, and Flannery (section 7.7) fail the test for Property A even for low dimensions.

Bratley and Fox published coefficients of the free direction integers up to dimension 40, crediting unpublished work of Sobol' and Levitan. See Bratley, P., Fox, B.L. (1988) "Algorithm 659: Implementing Sobol's quasirandom sequence generator," ACM Transactions on Mathematical Software 14:88-100. These values satisfy Property A for d<=20 and d = 23, 31, 33, 34, 37; Property A' holds for d<=6.

Jäckel provides in his book (section 8.3) initialization numbers up to dimension 32. Coefficients for d<=8 are the same as in Bradley-Fox, so Property A' holds for d<=6 but Property A holds for d<=32.

The implementation of Lemieux, Cieslak, and Luttmer includes coefficients of the free direction integers up to dimension 360. Coefficients for d<=40 are the same as in Bradley-Fox. For dimension 40<d<=360 the coefficients have been calculated as optimal values based on the "resolution" criterion. See "RandQMC user's guide - A package for randomized quasi-Monte Carlo methods in C," by C. Lemieux, M. Cieslak, and K. Luttmer, version January 13 2004, and references cited there (http://www.math.ucalgary.ca/~lemieux/randqmc.html). The values up to d<=360 has been provided to the QuantLib team by Christiane Lemieux, private communication, September 2004.

For more info on Sobol' sequences see also "Monte Carlo Methods in Financial Engineering," by P. Glasserman, 2004, Springer, section 5.2.3

**Test:**- the correctness of the returned values is tested by reproducing known good values.
- the correctness of the returned values is tested by checking their discrepancy against known good values.

Definition at line 92 of file sobolrsg.hpp.

## Public Types | |

enum | DirectionIntegers { Unit,
Jaeckel,
SobolLevitan,
SobolLevitanLemieux
} |

typedef Sample< std::vector < Real > > | sample_type |

## Public Member Functions | |

Size | dimension () const |

const sample_type & | lastSequence () const |

const std::vector< unsigned long > & | nextInt32Sequence () const |

const SobolRsg::sample_type & | nextSequence () const |

void | skipTo (unsigned long n) |

SobolRsg (Size dimensionality, unsigned long seed=0, DirectionIntegers directionIntegers=Jaeckel) | |

## Private Attributes | |

Size | dimensionality_ |

std::vector< std::vector < unsigned long > > | directionIntegers_ |

bool | firstDraw_ |

std::vector< unsigned long > | integerSequence_ |

sample_type | sequence_ |

unsigned long | sequenceCounter_ |

## Static Private Attributes | |

static const int | bits_ = 8*sizeof(unsigned long) |

static const double | normalizationFactor_ |

The documentation for this class was generated from the following files:

- QuantLib-0.8.1/ql/math/randomnumbers/sobolrsg.hpp
- QuantLib-0.8.1/ql/math/randomnumbers/sobolrsg.cpp

Generated by Doxygen 1.6.0 Back to index