1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<meta name="robots" content="none">
<title>QuantLib: SobolRsg Class Reference</title>
<link rel="stylesheet" href="quantlib.css" type="text/css">
<link rel="stylesheet" href="print.css" type="text/css" media="print">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<link rel="icon" href="favicon.ico" type="image/x-icon">
</head>
<body>
<div id="container">
<div id="header">
<img class="titleimage"
src="QL-title.jpg" width="212" height="47" border="0"
alt="QuantLib">
<br>
<h3 class="subtitle">A free/open-source library for quantitative finance</h3>
</div>
<div id="menu">
<h3 class="navbartitle">Version 0.9.0</h3>
<hr>
<h3 class="navbartitle">Getting started</h3>
<ul class="navbarlist">
<li class="navlink"><a href="index.html">Introduction</a></li>
<li class="navlink"><a href="overview.html">Project overview</a></li>
<li class="navlink"><a href="where.html">Where to get QuantLib</a></li>
<li class="navlink"><a href="install.html">Installation</a></li>
<li class="navlink"><a href="config.html">Configuration</a></li>
<li class="navlink"><a href="usage.html">Usage</a></li>
<li class="navlink"><a href="history.html">Version history</a></li>
<li class="navlink"><a href="resources.html">Additional resources</a></li>
<li class="navlink"><a href="group.html">The QuantLib group</a></li>
<li class="navlink"><a href="license.html">Copyright and license</a></li>
</ul>
<hr>
<h3 class="navbartitle">Reference manual</h3>
<ul class="navbarlist">
<li class="navlink"><a href="modules.html">Modules</a></li>
<li class="navlink"><a href="hierarchy.html">Class Hierarchy</a></li>
<li class="navlink"><a href="annotated.html">Compound List</a></li>
<li class="navlink"><a href="files.html">File List</a></li>
<li class="navlink"><a href="functions.html">Compound Members</a></li>
<li class="navlink"><a href="globals.html">File Members</a></li>
<li class="navlink"><a href="bug.html">Known Bugs</a></li>
<li class="navlink"><a href="caveats.html">Caveats</a></li>
<li class="navlink"><a href="test.html">Test Suite</a></li>
<li class="navlink"><a href="examples.html">Examples</a></li>
</ul>
</div>
<div id="content">
<!--Doxygen-generated content-->
<!-- Generated by Doxygen 1.5.4 -->
<div class="nav">
<a class="el" href="namespace_quant_lib.html">QuantLib</a>::<a class="el" href="class_quant_lib_1_1_sobol_rsg.html">SobolRsg</a></div>
<h1>SobolRsg Class Reference</h1><!-- doxytag: class="QuantLib::SobolRsg" --><code>#include <ql/math/randomnumbers/sobolrsg.hpp></code>
<p>
<p>
<a href="class_quant_lib_1_1_sobol_rsg-members.html">List of all members.</a><hr><a name="_details"></a><h2>Detailed Description</h2>
Sobol low-discrepancy sequence generator.
<p>
A Gray code counter and bitwise operations are used for very fast sequence generation.<p>
The implementation relies on primitive polynomials modulo two from the book "Monte Carlo Methods in Finance" by Peter Jckel.<p>
21 200 primitive polynomials modulo two are provided in <a class="el" href="namespace_quant_lib.html">QuantLib</a>. Jckel has calculated 8 129 334 polynomials: if you need that many dimensions you can replace the primitivepolynomials.c file included in <a class="el" href="namespace_quant_lib.html">QuantLib</a> with the one provided in the CD of the "Monte Carlo Methods in Finance" book.<p>
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'.<p>
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.<p>
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.<p>
Jckel 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.<p>
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 (<a href="http://www.math.ucalgary.ca/~lemieux/randqmc.html">http://www.math.ucalgary.ca/~lemieux/randqmc.html</a>). The values up to d<=360 has been provided to the <a class="el" href="namespace_quant_lib.html">QuantLib</a> team by Christiane Lemieux, private communication, September 2004.<p>
For more info on Sobol' sequences see also "Monte Carlo Methods in Financial Engineering," by P. Glasserman, 2004, Springer, section 5.2.3<p>
The Joe--Kuo numbers and the Kuo numbers are due to Stephen Joe and Frances Kuo.<p>
S. Joe and F. Y. Kuo, Constructing Sobol sequences with better two-dimensional projections, preprint Nov 22 2007<p>
See <a href="http://web.maths.unsw.edu.au/~fkuo/sobol/">http://web.maths.unsw.edu.au/~fkuo/sobol/</a> for more information.<p>
Note that the Kuo numbers were generated to work with a different ordering of primitive polynomials for the first 40 or so dimensions which is why we have the Alternative Primitive Polynomials.<p>
<dl compact><dt><b><a class="el" href="test.html#_test000050">Tests:</a></b></dt><dd><ul>
<li>the correctness of the returned values is tested by reproducing known good values.</li><li>the correctness of the returned values is tested by checking their discrepancy against known good values. </li></ul>
</dd></dl>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Types</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">enum </td><td class="memItemRight" valign="bottom"><b>DirectionIntegers</b> { <br>
<b>Unit</b>,
<b>Jaeckel</b>,
<b>SobolLevitan</b>,
<b>SobolLevitanLemieux</b>,
<br>
<b>JoeKuoD5</b>,
<b>JoeKuoD6</b>,
<b>JoeKuoD7</b>,
<b>Kuo</b>,
<br>
<b>Kuo2</b>,
<b>Kuo3</b>
<br>
}</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="f3b59a3dd56521693efc68c221a2bf38"></a><!-- doxytag: member="QuantLib::SobolRsg::sample_type" ref="f3b59a3dd56521693efc68c221a2bf38" args="" -->
typedef <a class="el" href="struct_quant_lib_1_1_sample.html">Sample</a>< std::vector<br>
< <a class="el" href="group__types.html#g4bdf4bfe76b9ffa6fa64c47d8bfa0c78">Real</a> > > </td><td class="memItemRight" valign="bottom"><b>sample_type</b></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_quant_lib_1_1_sobol_rsg.html#517494ec668ecd36efffc01912e484c0">SobolRsg</a> (<a class="el" href="group__types.html#gf38bdb4c54463b1f456655efa95b5c77">Size</a> dimensionality, unsigned long seed=0, DirectionIntegers directionIntegers=Jaeckel)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="class_quant_lib_1_1_sobol_rsg.html#aa2d30eb47ba0545410f2a87ebbacf1a">skipTo</a> (unsigned long n)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="12298c913deb1e1134ac23f669b1b294"></a><!-- doxytag: member="QuantLib::SobolRsg::nextInt32Sequence" ref="12298c913deb1e1134ac23f669b1b294" args="() const " -->
const std::vector< unsigned <br>
long > & </td><td class="memItemRight" valign="bottom"><b>nextInt32Sequence</b> () const </td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="24eb8d9ace7d89bd65c3767bdc1edf57"></a><!-- doxytag: member="QuantLib::SobolRsg::nextSequence" ref="24eb8d9ace7d89bd65c3767bdc1edf57" args="() const " -->
const <a class="el" href="struct_quant_lib_1_1_sample.html">SobolRsg::sample_type</a> & </td><td class="memItemRight" valign="bottom"><b>nextSequence</b> () const </td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="8d216498c4107b3bca19b47a929407fc"></a><!-- doxytag: member="QuantLib::SobolRsg::lastSequence" ref="8d216498c4107b3bca19b47a929407fc" args="() const " -->
const <a class="el" href="struct_quant_lib_1_1_sample.html">sample_type</a> & </td><td class="memItemRight" valign="bottom"><b>lastSequence</b> () const </td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="d089a89a18aa50ad2c64712cf5fb5e3d"></a><!-- doxytag: member="QuantLib::SobolRsg::dimension" ref="d089a89a18aa50ad2c64712cf5fb5e3d" args="() const " -->
<a class="el" href="group__types.html#gf38bdb4c54463b1f456655efa95b5c77">Size</a> </td><td class="memItemRight" valign="bottom"><b>dimension</b> () const </td></tr>
</table>
<hr><h2>Constructor & Destructor Documentation</h2>
<a class="anchor" name="517494ec668ecd36efffc01912e484c0"></a><!-- doxytag: member="QuantLib::SobolRsg::SobolRsg" ref="517494ec668ecd36efffc01912e484c0" args="(Size dimensionality, unsigned long seed=0, DirectionIntegers directionIntegers=Jaeckel)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="class_quant_lib_1_1_sobol_rsg.html">SobolRsg</a> </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__types.html#gf38bdb4c54463b1f456655efa95b5c77">Size</a> </td>
<td class="paramname"> <em>dimensionality</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">unsigned long </td>
<td class="paramname"> <em>seed</em> = <code>0</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">DirectionIntegers </td>
<td class="paramname"> <em>directionIntegers</em> = <code>Jaeckel</code></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
<dl class="pre" compact><dt><b>Precondition:</b></dt><dd>dimensionality must be <= PPMT_MAX_DIM </dd></dl>
</div>
</div><p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="aa2d30eb47ba0545410f2a87ebbacf1a"></a><!-- doxytag: member="QuantLib::SobolRsg::skipTo" ref="aa2d30eb47ba0545410f2a87ebbacf1a" args="(unsigned long n)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void skipTo </td>
<td>(</td>
<td class="paramtype">unsigned long </td>
<td class="paramname"> <em>n</em> </td>
<td> ) </td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
skip to the n-th sample in the low-discrepancy sequence
</div>
</div><p>
</div>
<div class="footer">
<div class="endmatter">
Documentation generated by
<a href="http://www.doxygen.org">Doxygen</a> 1.5.4
</div>
</div>
</div>
</body>
</html>
|