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 202 203 204 205 206 207
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<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.3.14</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="faq.html">Frequently asked questions</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="todo.html">Todo List</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="deprecated.html">Deprecated Features</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.1 -->
<div class="nav">
<b>QuantLib</b>::<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/RandomNumbers/sobolrsg.hpp></code>
<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 by default in QuantLib. Jckel has calculated 8 129 334 polynomials, also available in a different file that can be downloaded from <a href="http://quantlib.org.">http://quantlib.org.</a> If you need that many dimensions you must replace the default version of the primitivepolynomials.c file with the extended one.<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 QuantLib 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>
<dl compact><dt><b><a class="el" href="test.html#_test000112">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>
<p>
<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> { <b>Unit</b>,
<b>Jaeckel</b>,
<b>SobolLevitan</b>,
<b>SobolLevitanLemieux</b>
}</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="c10175ab8a401908363648e5f3dad08d"></a><!-- doxytag: member="QuantLib::SobolRsg::sample_type" ref="c10175ab8a401908363648e5f3dad08d" args="" -->
typedef <a class="el" href="struct_quant_lib_1_1_sample.html">Sample</a>< <a class="el" href="class_quant_lib_1_1_array.html">Array</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> (Size 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="1d53ad1d2488bf01773158e9e10dce96"></a><!-- doxytag: member="QuantLib::SobolRsg::nextInt32Sequence" ref="1d53ad1d2488bf01773158e9e10dce96" 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="f099844672ae163c458ad6f0aafba9ae"></a><!-- doxytag: member="QuantLib::SobolRsg::nextSequence" ref="f099844672ae163c458ad6f0aafba9ae" 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="21fb9bff0e8370796df2b4a9d16b372b"></a><!-- doxytag: member="QuantLib::SobolRsg::lastSequence" ref="21fb9bff0e8370796df2b4a9d16b372b" 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="6d909a81181d49375588c96fd1494043"></a><!-- doxytag: member="QuantLib::SobolRsg::dimension" ref="6d909a81181d49375588c96fd1494043" args="() const" -->
Size </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">Size </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">
<table align="top" width="100%">
<tr>
<td align="middle" width="33%">
<strong>QuantLib.org</strong><br>
<a href="http://quantlib.org/">
<img src="QL-small.jpg" alt="QuantLib" align="middle" border=0>
</a>
</td>
<td align="middle" width="33%">
<strong>Hosted by</strong><br>
<a href="http://sourceforge.net"><img src=
"sfnetlogo.png" width="88" height="31"
border="0" alt="SourceForge.net Logo"></a>
</td>
<td align="middle" width="33%">
<strong>Documentation generated by</strong><br>
<a href="http://www.doxygen.org">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 width=110 height=53>
</a></td>
</tr>
</table>
</div>
</div>
</body>
</html>
|