mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-03-25 14:23:03 +08:00
Documentation for 0931d530ae
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.9.5"/>
|
||||
<meta name="generator" content="Doxygen 1.9.6"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Algorithms_in_C++: math/integral_approximation2.cpp File Reference</title>
|
||||
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
|
||||
@@ -41,7 +41,7 @@ MathJax.Hub.Config({
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.9.5 -->
|
||||
<!-- Generated by Doxygen 1.9.6 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "../../search/",'.html');
|
||||
@@ -140,22 +140,22 @@ using </td><td class="memItemRight" valign="bottom"><b>math::monte_carlo::F
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
|
||||
Functions</h2></td></tr>
|
||||
<tr class="memitem:a71249ee535f16f8ed2e9cc8f0199a2cf"><td class="memItemLeft" align="right" valign="top"><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>< double > </td><td class="memItemRight" valign="bottom"><a class="el" href="../../db/d40/integral__approximation2_8cpp.html#a71249ee535f16f8ed2e9cc8f0199a2cf">math::monte_carlo::generate_samples</a> (const double &start_point, const Function &pdf, const uint32_t &num_samples, const uint32_t &discard=100000)</td></tr>
|
||||
<tr class="memdesc:a71249ee535f16f8ed2e9cc8f0199a2cf"><td class="mdescLeft"> </td><td class="mdescRight">short-hand for std::functions used in this implementation <a href="../../db/d40/integral__approximation2_8cpp.html#a71249ee535f16f8ed2e9cc8f0199a2cf">More...</a><br /></td></tr>
|
||||
<tr class="memdesc:a71249ee535f16f8ed2e9cc8f0199a2cf"><td class="mdescLeft"> </td><td class="mdescRight">short-hand for std::functions used in this implementation <br /></td></tr>
|
||||
<tr class="separator:a71249ee535f16f8ed2e9cc8f0199a2cf"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:af7da9ba8932f1f48b9bbc2d80471af51"><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="../../db/d40/integral__approximation2_8cpp.html#af7da9ba8932f1f48b9bbc2d80471af51">math::monte_carlo::integral_monte_carlo</a> (const double &start_point, const Function &function, const Function &pdf, const uint32_t &num_samples=1000000)</td></tr>
|
||||
<tr class="memdesc:af7da9ba8932f1f48b9bbc2d80471af51"><td class="mdescLeft"> </td><td class="mdescRight">Compute an approximation of an integral using Monte Carlo integration. <a href="../../db/d40/integral__approximation2_8cpp.html#af7da9ba8932f1f48b9bbc2d80471af51">More...</a><br /></td></tr>
|
||||
<tr class="memdesc:af7da9ba8932f1f48b9bbc2d80471af51"><td class="mdescLeft"> </td><td class="mdescRight">Compute an approximation of an integral using Monte Carlo integration. <br /></td></tr>
|
||||
<tr class="separator:af7da9ba8932f1f48b9bbc2d80471af51"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:aa8dca7b867074164d5f45b0f3851269d"><td class="memItemLeft" align="right" valign="top">static void </td><td class="memItemRight" valign="bottom"><a class="el" href="../../db/d40/integral__approximation2_8cpp.html#aa8dca7b867074164d5f45b0f3851269d">test</a> ()</td></tr>
|
||||
<tr class="memdesc:aa8dca7b867074164d5f45b0f3851269d"><td class="mdescLeft"> </td><td class="mdescRight">Self-test implementations. <a href="../../db/d40/integral__approximation2_8cpp.html#aa8dca7b867074164d5f45b0f3851269d">More...</a><br /></td></tr>
|
||||
<tr class="memdesc:aa8dca7b867074164d5f45b0f3851269d"><td class="mdescLeft"> </td><td class="mdescRight">Self-test implementations. <br /></td></tr>
|
||||
<tr class="separator:aa8dca7b867074164d5f45b0f3851269d"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="../../db/d40/integral__approximation2_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main</a> ()</td></tr>
|
||||
<tr class="memdesc:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="mdescLeft"> </td><td class="mdescRight">Main function. <a href="../../db/d40/integral__approximation2_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4">More...</a><br /></td></tr>
|
||||
<tr class="memdesc:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="mdescLeft"> </td><td class="mdescRight">Main function. <br /></td></tr>
|
||||
<tr class="separator:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
</table>
|
||||
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
||||
<div class="textblock"><p ><a href="https://en.wikipedia.org/wiki/Monte_Carlo_integration" target="_blank">Monte Carlo Integration</a> </p>
|
||||
<p >In mathematics, Monte Carlo integration is a technique for numerical integration using random numbers. It is a particular Monte Carlo method that numerically computes a definite integral. While other algorithms usually evaluate the integrand at a regular grid, Monte Carlo randomly chooses points at which the integrand is evaluated. This method is particularly useful for higher-dimensional integrals.</p>
|
||||
<p >This implementation supports arbitrary pdfs. These pdfs are sampled using the <a href="https://en.wikipedia.org/wiki/Metropolis–Hastings_algorithm" target="_blank">Metropolis-Hastings algorithm</a>. This can be swapped out by every other sampling techniques for example the inverse method. Metropolis-Hastings was chosen because it is the most general and can also be extended for a higher dimensional sampling space.</p>
|
||||
<div class="textblock"><p><a href="https://en.wikipedia.org/wiki/Monte_Carlo_integration" target="_blank">Monte Carlo Integration</a> </p>
|
||||
<p>In mathematics, Monte Carlo integration is a technique for numerical integration using random numbers. It is a particular Monte Carlo method that numerically computes a definite integral. While other algorithms usually evaluate the integrand at a regular grid, Monte Carlo randomly chooses points at which the integrand is evaluated. This method is particularly useful for higher-dimensional integrals.</p>
|
||||
<p>This implementation supports arbitrary pdfs. These pdfs are sampled using the <a href="https://en.wikipedia.org/wiki/Metropolis–Hastings_algorithm" target="_blank">Metropolis-Hastings algorithm</a>. This can be swapped out by every other sampling techniques for example the inverse method. Metropolis-Hastings was chosen because it is the most general and can also be extended for a higher dimensional sampling space.</p>
|
||||
<dl class="section author"><dt>Author</dt><dd><a href="https://github.com/DerAndereDomenic" target="_blank">Domenic Zingsheim</a> </dd></dl>
|
||||
</div><h2 class="groupheader">Function Documentation</h2>
|
||||
<a id="a71249ee535f16f8ed2e9cc8f0199a2cf" name="a71249ee535f16f8ed2e9cc8f0199a2cf"></a>
|
||||
@@ -197,8 +197,8 @@ Functions</h2></td></tr>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>short-hand for std::functions used in this implementation </p>
|
||||
<p >Generate samples according to some pdf</p>
|
||||
<p >This function uses Metropolis-Hastings to generate random numbers. It generates a sequence of random numbers by using a markov chain. Therefore, we need to define a start_point and the number of samples we want to generate. Because the first samples generated by the markov chain may not be distributed according to the given pdf, one can specify how many samples should be discarded before storing samples. </p><dl class="params"><dt>Parameters</dt><dd>
|
||||
<p>Generate samples according to some pdf</p>
|
||||
<p>This function uses Metropolis-Hastings to generate random numbers. It generates a sequence of random numbers by using a markov chain. Therefore, we need to define a start_point and the number of samples we want to generate. Because the first samples generated by the markov chain may not be distributed according to the given pdf, one can specify how many samples should be discarded before storing samples. </p><dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramname">start_point</td><td>The starting point of the markov chain </td></tr>
|
||||
<tr><td class="paramname">pdf</td><td>The pdf to sample </td></tr>
|
||||
@@ -294,7 +294,7 @@ Here is the call graph for this function:</div>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Compute an approximation of an integral using Monte Carlo integration. </p>
|
||||
<p >The integration domain [a,b] is given by the pdf. The pdf has to fulfill the following conditions: 1) for all x \in [a,b] : p(x) > 0 2) for all x \not\in [a,b] : p(x) = 0 3) \int_a^b p(x) dx = 1 </p><dl class="params"><dt>Parameters</dt><dd>
|
||||
<p>The integration domain [a,b] is given by the pdf. The pdf has to fulfill the following conditions: 1) for all x \in [a,b] : p(x) > 0 2) for all x \not\in [a,b] : p(x) = 0 3) \int_a^b p(x) dx = 1 </p><dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramname">start_point</td><td>The start point of the Markov Chain (see generate_samples) </td></tr>
|
||||
<tr><td class="paramname">function</td><td>The function to integrate </td></tr>
|
||||
@@ -484,7 +484,7 @@ Here is the call graph for this function:</div>
|
||||
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
||||
<ul>
|
||||
<li class="navelem"><a class="el" href="../../dir_296d53ceaeaa7e099814a6def439fe8a.html">math</a></li><li class="navelem"><a class="el" href="../../db/d40/integral__approximation2_8cpp.html">integral_approximation2.cpp</a></li>
|
||||
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="../../doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.5 </li>
|
||||
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="../../doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.6 </li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user