Documentation for 8b1eab204b

This commit is contained in:
realstealthninja
2024-11-04 12:43:05 +00:00
parent 4fb6e622e9
commit a7bccf7d01
6732 changed files with 153919 additions and 365711 deletions

View File

@@ -1,3 +1,4 @@
<!-- HTML header for doxygen 1.12.0-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
@@ -5,10 +6,15 @@
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.12.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Algorithms_in_C++: probability/exponential_dist.cpp File Reference</title>
<title>TheAlgorithms/C++: probability/exponential_dist.cpp File Reference</title>
<link rel="icon" href="../../favicon.svg" type="image/x-icon" />
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@xpack-3rd-party/doxygen-awesome-css@2.2.0-1/doxygen-awesome-darkmode-toggle.js"></script>
<script type="text/javascript">
DoxygenAwesomeDarkModeToggle.init()
</script>
<script type="text/javascript" src="../../clipboard.js"></script>
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../navtreedata.js"></script>
@@ -18,14 +24,24 @@
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../search/searchdata.js"></script>
<script type="text/javascript" src="../../search/search.js"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
<script type="text/javascript">
window.MathJax = {
options: {
ignoreHtmlClass: 'tex2jax_ignore',
processHtmlClass: 'tex2jax_process'
},
loader: {
load: ['[tex]/ams']
},
tex: {
macros: {},
packages: ['base','configmacros','ams']
}
};
</script>
<script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML/MathJax.js"></script>
<script type="text/javascript" id="MathJax-script" async="async" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"></script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
<link href="../../doxygen-awesome.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
@@ -33,10 +49,11 @@ MathJax.Hub.Config({
<table cellspacing="0" cellpadding="0">
<tbody>
<tr id="projectrow">
<td id="projectlogo"><img alt="Logo" src="../../project_logo.png"/></td>
<td id="projectalign">
<div id="projectname">Algorithms_in_C++<span id="projectnumber">&#160;1.0.0</span>
<div id="projectname">TheAlgorithms/C++<span id="projectnumber">&#160;1.0.0</span>
</div>
<div id="projectbrief">Set of algorithms implemented in C++.</div>
<div id="projectbrief">All the algorithms implemented in C++</div>
</td>
</tr>
</tbody>
@@ -123,7 +140,9 @@ Include dependency graph for exponential_dist.cpp:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d0/d5e/exponential__dist_8cpp__incl.svg" width="431" height="126"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
</div>
</div><table class="memberdecls">
</div>
<p><a href="../../d9/da2/exponential__dist_8cpp_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="namespaces" name="namespaces"></a>
Namespaces</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">namespace &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d4/ded/namespaceprobability.html">probability</a></td></tr>
@@ -158,6 +177,8 @@ Functions</h2></td></tr>
\[P(x, \lambda) = \lambda e^{-\lambda x}\]
</p>
<p>Summary of variables used: \(\lambda\) : rate parameter </p>
<p class="definition">Definition in file <a class="el" href="../../d9/da2/exponential__dist_8cpp_source.html">exponential_dist.cpp</a>.</p>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="a1c8b6e787f72a209ef96c096eedf7afc" name="a1c8b6e787f72a209ef96c096eedf7afc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1c8b6e787f72a209ef96c096eedf7afc">&#9670;&#160;</a></span>exponential_expected()</h2>
@@ -179,19 +200,15 @@ Functions</h2></td></tr>
\[\mu = \frac{1}{\lambda}\]
</p>
</dd></dl>
<p class="definition">Definition at line <a class="el" href="../../d9/da2/exponential__dist_8cpp_source.html#l00037">37</a> of file <a class="el" href="../../d9/da2/exponential__dist_8cpp_source.html">exponential_dist.cpp</a>.</p>
<div class="fragment"><div class="line"><span class="lineno"> 37</span> {</div>
<div class="line"><span class="lineno"> 38</span> <span class="keywordflow">if</span> (lambda &lt;= 0) {</div>
<div class="line"><span class="lineno"> 39</span> <span class="keywordflow">throw</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/error/invalid_argument.html">std::invalid_argument</a>(<span class="stringliteral">&quot;lambda must be greater than 0&quot;</span>);</div>
<div class="line"><span class="lineno"> 39</span> <span class="keywordflow">throw</span> std::invalid_argument(<span class="stringliteral">&quot;lambda must be greater than 0&quot;</span>);</div>
<div class="line"><span class="lineno"> 40</span> }</div>
<div class="line"><span class="lineno"> 41</span> <span class="keywordflow">return</span> 1 / lambda;</div>
<div class="line"><span class="lineno"> 42</span>}</div>
<div class="ttc" id="ainvalid_argument_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/error/invalid_argument.html">std::invalid_argument</a></div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d9/da2/exponential__dist_8cpp_a1c8b6e787f72a209ef96c096eedf7afc_cgraph.svg" width="195" height="76"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
</div>
</div><!-- fragment -->
</div>
</div>
<a id="ac7b0091e17479d47438a281fefc2549a" name="ac7b0091e17479d47438a281fefc2549a"></a>
@@ -214,18 +231,15 @@ Here is the call graph for this function:</div>
\[\sigma = \frac{1}{\lambda}\]
</p>
</dd></dl>
<p class="definition">Definition at line <a class="el" href="../../d9/da2/exponential__dist_8cpp_source.html#l00059">59</a> of file <a class="el" href="../../d9/da2/exponential__dist_8cpp_source.html">exponential_dist.cpp</a>.</p>
<div class="fragment"><div class="line"><span class="lineno"> 59</span> {</div>
<div class="line"><span class="lineno"> 60</span> <span class="keywordflow">if</span> (lambda &lt;= 0) {</div>
<div class="line"><span class="lineno"> 61</span> <span class="keywordflow">throw</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/error/invalid_argument.html">std::invalid_argument</a>(<span class="stringliteral">&quot;lambda must be greater than 0&quot;</span>);</div>
<div class="line"><span class="lineno"> 61</span> <span class="keywordflow">throw</span> std::invalid_argument(<span class="stringliteral">&quot;lambda must be greater than 0&quot;</span>);</div>
<div class="line"><span class="lineno"> 62</span> }</div>
<div class="line"><span class="lineno"> 63</span> <span class="keywordflow">return</span> 1 / lambda;</div>
<div class="line"><span class="lineno"> 64</span>}</div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d9/da2/exponential__dist_8cpp_ac7b0091e17479d47438a281fefc2549a_cgraph.svg" width="159" height="76"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
</div>
</div><!-- fragment -->
</div>
</div>
<a id="af435dbeb43a05c8c7785f53bf4ce1df1" name="af435dbeb43a05c8c7785f53bf4ce1df1"></a>
@@ -248,19 +262,15 @@ Here is the call graph for this function:</div>
\[\sigma^2 = \frac{1}{\lambda^2}\]
</p>
</dd></dl>
<p class="definition">Definition at line <a class="el" href="../../d9/da2/exponential__dist_8cpp_source.html#l00048">48</a> of file <a class="el" href="../../d9/da2/exponential__dist_8cpp_source.html">exponential_dist.cpp</a>.</p>
<div class="fragment"><div class="line"><span class="lineno"> 48</span> {</div>
<div class="line"><span class="lineno"> 49</span> <span class="keywordflow">if</span> (lambda &lt;= 0) {</div>
<div class="line"><span class="lineno"> 50</span> <span class="keywordflow">throw</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/error/invalid_argument.html">std::invalid_argument</a>(<span class="stringliteral">&quot;lambda must be greater than 0&quot;</span>);</div>
<div class="line"><span class="lineno"> 50</span> <span class="keywordflow">throw</span> std::invalid_argument(<span class="stringliteral">&quot;lambda must be greater than 0&quot;</span>);</div>
<div class="line"><span class="lineno"> 51</span> }</div>
<div class="line"><span class="lineno"> 52</span> <span class="keywordflow">return</span> 1 / <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/math/pow.html">pow</a>(lambda, 2);</div>
<div class="line"><span class="lineno"> 52</span> <span class="keywordflow">return</span> 1 / pow(lambda, 2);</div>
<div class="line"><span class="lineno"> 53</span>}</div>
<div class="ttc" id="apow_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/numeric/math/pow.html">std::pow</a></div><div class="ttdeci">T pow(T... args)</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d9/da2/exponential__dist_8cpp_af435dbeb43a05c8c7785f53bf4ce1df1_cgraph.svg" width="159" height="76"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
</div>
</div><!-- fragment -->
</div>
</div>
<a id="ae66f6b31b5ad750f1fe042a706a4e3d4" name="ae66f6b31b5ad750f1fe042a706a4e3d4"></a>
@@ -280,17 +290,14 @@ Here is the call graph for this function:</div>
<p>Main function. </p>
<dl class="section return"><dt>Returns</dt><dd>0 on exit </dd></dl>
<p class="definition">Definition at line <a class="el" href="../../d9/da2/exponential__dist_8cpp_source.html#l00148">148</a> of file <a class="el" href="../../d9/da2/exponential__dist_8cpp_source.html">exponential_dist.cpp</a>.</p>
<div class="fragment"><div class="line"><span class="lineno"> 148</span> {</div>
<div class="line"><span class="lineno"> 149</span> <a class="code hl_function" href="#aa8dca7b867074164d5f45b0f3851269d">test</a>(); <span class="comment">// Self test implementation</span></div>
<div class="line"><span class="lineno"> 150</span> <span class="keywordflow">return</span> 0;</div>
<div class="line"><span class="lineno"> 151</span>}</div>
<div class="ttc" id="aexponential__dist_8cpp_html_aa8dca7b867074164d5f45b0f3851269d"><div class="ttname"><a href="#aa8dca7b867074164d5f45b0f3851269d">test</a></div><div class="ttdeci">static void test()</div><div class="ttdoc">Self-test implementations.</div><div class="ttdef"><b>Definition</b> exponential_dist.cpp:72</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d9/da2/exponential__dist_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg" width="346" height="52"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
</div>
<div class="ttc" id="aexponential__dist_8cpp_html_aa8dca7b867074164d5f45b0f3851269d"><div class="ttname"><a href="#aa8dca7b867074164d5f45b0f3851269d">test</a></div><div class="ttdeci">static void test()</div><div class="ttdoc">Self-test implementations.</div><div class="ttdef"><b>Definition</b> <a href="../../d9/da2/exponential__dist_8cpp_source.html#l00072">exponential_dist.cpp:72</a></div></div>
</div><!-- fragment -->
</div>
</div>
<a id="aa8dca7b867074164d5f45b0f3851269d" name="aa8dca7b867074164d5f45b0f3851269d"></a>
@@ -318,6 +325,8 @@ Here is the call graph for this function:</div>
<p>Self-test implementations. </p>
<dl class="section return"><dt>Returns</dt><dd>void </dd></dl>
<p class="definition">Definition at line <a class="el" href="../../d9/da2/exponential__dist_8cpp_source.html#l00072">72</a> of file <a class="el" href="../../d9/da2/exponential__dist_8cpp_source.html">exponential_dist.cpp</a>.</p>
<div class="fragment"><div class="line"><span class="lineno"> 72</span> {</div>
<div class="line"><span class="lineno"> 73</span> <span class="keywordtype">double</span> lambda_1 = 1;</div>
<div class="line"><span class="lineno"> 74</span> <span class="keywordtype">double</span> expected_1 = 1;</div>
@@ -339,7 +348,7 @@ Here is the call graph for this function:</div>
<div class="line"><span class="lineno"> 90</span> </div>
<div class="line"><span class="lineno"> 91</span> <span class="keyword">const</span> <span class="keywordtype">float</span> threshold = 1e-3f;</div>
<div class="line"><span class="lineno"> 92</span> </div>
<div class="line"><span class="lineno"> 93</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;Test for lambda = 1 \n&quot;</span>;</div>
<div class="line"><span class="lineno"> 93</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Test for lambda = 1 \n&quot;</span>;</div>
<div class="line"><span class="lineno"> 94</span> assert(</div>
<div class="line"><span class="lineno"> 95</span> std::abs(expected_1 - probability::geometric_dist::exponential_expected(</div>
<div class="line"><span class="lineno"> 96</span> lambda_1)) &lt; threshold);</div>
@@ -347,9 +356,9 @@ Here is the call graph for this function:</div>
<div class="line"><span class="lineno"> 98</span> lambda_1)) &lt; threshold);</div>
<div class="line"><span class="lineno"> 99</span> assert(std::abs(std_1 - probability::geometric_dist::exponential_std(</div>
<div class="line"><span class="lineno"> 100</span> lambda_1)) &lt; threshold);</div>
<div class="line"><span class="lineno"> 101</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;ALL TEST PASSED\n\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 101</span> std::cout &lt;&lt; <span class="stringliteral">&quot;ALL TEST PASSED\n\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 102</span> </div>
<div class="line"><span class="lineno"> 103</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;Test for lambda = 2 \n&quot;</span>;</div>
<div class="line"><span class="lineno"> 103</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Test for lambda = 2 \n&quot;</span>;</div>
<div class="line"><span class="lineno"> 104</span> assert(</div>
<div class="line"><span class="lineno"> 105</span> std::abs(expected_2 - probability::geometric_dist::exponential_expected(</div>
<div class="line"><span class="lineno"> 106</span> lambda_2)) &lt; threshold);</div>
@@ -357,9 +366,9 @@ Here is the call graph for this function:</div>
<div class="line"><span class="lineno"> 108</span> lambda_2)) &lt; threshold);</div>
<div class="line"><span class="lineno"> 109</span> assert(std::abs(std_2 - probability::geometric_dist::exponential_std(</div>
<div class="line"><span class="lineno"> 110</span> lambda_2)) &lt; threshold);</div>
<div class="line"><span class="lineno"> 111</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;ALL TEST PASSED\n\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 111</span> std::cout &lt;&lt; <span class="stringliteral">&quot;ALL TEST PASSED\n\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 112</span> </div>
<div class="line"><span class="lineno"> 113</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;Test for lambda = 3 \n&quot;</span>;</div>
<div class="line"><span class="lineno"> 113</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Test for lambda = 3 \n&quot;</span>;</div>
<div class="line"><span class="lineno"> 114</span> assert(</div>
<div class="line"><span class="lineno"> 115</span> std::abs(expected_3 - probability::geometric_dist::exponential_expected(</div>
<div class="line"><span class="lineno"> 116</span> lambda_3)) &lt; threshold);</div>
@@ -367,40 +376,32 @@ Here is the call graph for this function:</div>
<div class="line"><span class="lineno"> 118</span> lambda_3)) &lt; threshold);</div>
<div class="line"><span class="lineno"> 119</span> assert(std::abs(std_3 - probability::geometric_dist::exponential_std(</div>
<div class="line"><span class="lineno"> 120</span> lambda_3)) &lt; threshold);</div>
<div class="line"><span class="lineno"> 121</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;ALL TEST PASSED\n\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 121</span> std::cout &lt;&lt; <span class="stringliteral">&quot;ALL TEST PASSED\n\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 122</span> </div>
<div class="line"><span class="lineno"> 123</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;Test for lambda = 0 \n&quot;</span>;</div>
<div class="line"><span class="lineno"> 123</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Test for lambda = 0 \n&quot;</span>;</div>
<div class="line"><span class="lineno"> 124</span> <span class="keywordflow">try</span> {</div>
<div class="line"><span class="lineno"> 125</span> <a class="code hl_function" href="#a1c8b6e787f72a209ef96c096eedf7afc">probability::geometric_dist::exponential_expected</a>(lambda_4);</div>
<div class="line"><span class="lineno"> 126</span> <a class="code hl_function" href="#af435dbeb43a05c8c7785f53bf4ce1df1">probability::geometric_dist::exponential_var</a>(lambda_4);</div>
<div class="line"><span class="lineno"> 127</span> <a class="code hl_function" href="#ac7b0091e17479d47438a281fefc2549a">probability::geometric_dist::exponential_std</a>(lambda_4);</div>
<div class="line"><span class="lineno"> 128</span> } <span class="keywordflow">catch</span> (<a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/error/invalid_argument.html">std::invalid_argument</a>&amp; err) {</div>
<div class="line"><span class="lineno"> 129</span> assert(<a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a>(err.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/error/exception/what.html">what</a>()) == <span class="stringliteral">&quot;lambda must be greater than 0&quot;</span>);</div>
<div class="line"><span class="lineno"> 128</span> } <span class="keywordflow">catch</span> (std::invalid_argument&amp; err) {</div>
<div class="line"><span class="lineno"> 129</span> assert(std::string(err.what()) == <span class="stringliteral">&quot;lambda must be greater than 0&quot;</span>);</div>
<div class="line"><span class="lineno"> 130</span> }</div>
<div class="line"><span class="lineno"> 131</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;ALL TEST PASSED\n\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 131</span> std::cout &lt;&lt; <span class="stringliteral">&quot;ALL TEST PASSED\n\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 132</span> </div>
<div class="line"><span class="lineno"> 133</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;Test for lambda = -2.3 \n&quot;</span>;</div>
<div class="line"><span class="lineno"> 133</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Test for lambda = -2.3 \n&quot;</span>;</div>
<div class="line"><span class="lineno"> 134</span> <span class="keywordflow">try</span> {</div>
<div class="line"><span class="lineno"> 135</span> <a class="code hl_function" href="#a1c8b6e787f72a209ef96c096eedf7afc">probability::geometric_dist::exponential_expected</a>(lambda_5);</div>
<div class="line"><span class="lineno"> 136</span> <a class="code hl_function" href="#af435dbeb43a05c8c7785f53bf4ce1df1">probability::geometric_dist::exponential_var</a>(lambda_5);</div>
<div class="line"><span class="lineno"> 137</span> <a class="code hl_function" href="#ac7b0091e17479d47438a281fefc2549a">probability::geometric_dist::exponential_std</a>(lambda_5);</div>
<div class="line"><span class="lineno"> 138</span> } <span class="keywordflow">catch</span> (<a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/error/invalid_argument.html">std::invalid_argument</a>&amp; err) {</div>
<div class="line"><span class="lineno"> 139</span> assert(<a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a>(err.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/error/exception/what.html">what</a>()) == <span class="stringliteral">&quot;lambda must be greater than 0&quot;</span>);</div>
<div class="line"><span class="lineno"> 138</span> } <span class="keywordflow">catch</span> (std::invalid_argument&amp; err) {</div>
<div class="line"><span class="lineno"> 139</span> assert(std::string(err.what()) == <span class="stringliteral">&quot;lambda must be greater than 0&quot;</span>);</div>
<div class="line"><span class="lineno"> 140</span> }</div>
<div class="line"><span class="lineno"> 141</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;ALL TEST PASSED\n\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 141</span> std::cout &lt;&lt; <span class="stringliteral">&quot;ALL TEST PASSED\n\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 142</span>}</div>
<div class="ttc" id="abasic_ostream_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a></div></div>
<div class="ttc" id="abasic_string_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a></div></div>
<div class="ttc" id="aexponential__dist_8cpp_html_a1c8b6e787f72a209ef96c096eedf7afc"><div class="ttname"><a href="#a1c8b6e787f72a209ef96c096eedf7afc">probability::geometric_dist::exponential_expected</a></div><div class="ttdeci">double exponential_expected(double lambda)</div><div class="ttdoc">the expected value of the exponential distribution</div><div class="ttdef"><b>Definition</b> exponential_dist.cpp:37</div></div>
<div class="ttc" id="aexponential__dist_8cpp_html_ac7b0091e17479d47438a281fefc2549a"><div class="ttname"><a href="#ac7b0091e17479d47438a281fefc2549a">probability::geometric_dist::exponential_std</a></div><div class="ttdeci">double exponential_std(double lambda)</div><div class="ttdoc">the standard deviation of the exponential distribution</div><div class="ttdef"><b>Definition</b> exponential_dist.cpp:59</div></div>
<div class="ttc" id="aexponential__dist_8cpp_html_af435dbeb43a05c8c7785f53bf4ce1df1"><div class="ttname"><a href="#af435dbeb43a05c8c7785f53bf4ce1df1">probability::geometric_dist::exponential_var</a></div><div class="ttdeci">double exponential_var(double lambda)</div><div class="ttdoc">the variance of the exponential distribution</div><div class="ttdef"><b>Definition</b> exponential_dist.cpp:48</div></div>
<div class="ttc" id="awhat_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/error/exception/what.html">std::invalid_argument::what</a></div><div class="ttdeci">T what(T... args)</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d9/da2/exponential__dist_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg" width="248" height="52"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
</div>
<div class="ttc" id="aexponential__dist_8cpp_html_a1c8b6e787f72a209ef96c096eedf7afc"><div class="ttname"><a href="#a1c8b6e787f72a209ef96c096eedf7afc">probability::geometric_dist::exponential_expected</a></div><div class="ttdeci">double exponential_expected(double lambda)</div><div class="ttdoc">the expected value of the exponential distribution</div><div class="ttdef"><b>Definition</b> <a href="../../d9/da2/exponential__dist_8cpp_source.html#l00037">exponential_dist.cpp:37</a></div></div>
<div class="ttc" id="aexponential__dist_8cpp_html_ac7b0091e17479d47438a281fefc2549a"><div class="ttname"><a href="#ac7b0091e17479d47438a281fefc2549a">probability::geometric_dist::exponential_std</a></div><div class="ttdeci">double exponential_std(double lambda)</div><div class="ttdoc">the standard deviation of the exponential distribution</div><div class="ttdef"><b>Definition</b> <a href="../../d9/da2/exponential__dist_8cpp_source.html#l00059">exponential_dist.cpp:59</a></div></div>
<div class="ttc" id="aexponential__dist_8cpp_html_af435dbeb43a05c8c7785f53bf4ce1df1"><div class="ttname"><a href="#af435dbeb43a05c8c7785f53bf4ce1df1">probability::geometric_dist::exponential_var</a></div><div class="ttdeci">double exponential_var(double lambda)</div><div class="ttdoc">the variance of the exponential distribution</div><div class="ttdef"><b>Definition</b> <a href="../../d9/da2/exponential__dist_8cpp_source.html#l00048">exponential_dist.cpp:48</a></div></div>
</div><!-- fragment -->
</div>
</div>
</div><!-- contents -->

View File

@@ -1,4 +0,0 @@
<map id="probability::geometric_dist::exponential_expected" name="probability::geometric_dist::exponential_expected">
<area shape="rect" id="Node000001" title="the expected value of the exponential distribution" alt="" coords="5,29,189,70"/>
<area shape="poly" id="edge1_Node000001_Node000001" title=" " alt="" coords="62,29,60,19,66,10,78,5,97,3,117,5,129,11,126,16,115,10,97,8,80,10,69,14,65,20,67,28"/>
</map>

View File

@@ -1 +0,0 @@
ff895a711de292f98636438a15f73b2a

View File

@@ -1,57 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 12.1.2 (20240928.0832)
-->
<!-- Title: probability::geometric_dist::exponential_expected Pages: 1 -->
<svg width="146pt" height="57pt"
viewBox="0.00 0.00 145.50 56.50" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<svg id="main" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve">
<style type="text/css"><![CDATA[
.node, .edge {opacity: 0.7;}
.node.selected, .edge.selected {opacity: 1;}
.edge:hover path { stroke: red; }
.edge:hover polygon { stroke: red; fill: red; }
]]></style>
<script type="application/ecmascript" xlink:href="../../svg.min.js"/>
<svg id="graph" class="graph">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 52.5)">
<title>probability::geometric_dist::exponential_expected</title>
<!-- Node1 -->
<g id="Node000001" class="node">
<title>Node1</title>
<g id="a_Node000001"><a xlink:title="the expected value of the exponential distribution">
<polygon fill="#999999" stroke="#666666" points="137.5,-30.5 0,-30.5 0,0 137.5,0 137.5,-30.5"/>
<text text-anchor="start" x="8" y="-17" font-family="Helvetica,sans-Serif" font-size="10.00">probability::geometric</text>
<text text-anchor="middle" x="68.75" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">_dist::exponential_expected</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node1 -->
<g id="edge1_Node000001_Node000001" class="edge">
<title>Node1&#45;&gt;Node1</title>
<g id="a_edge1_Node000001_Node000001"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M44.38,-30.99C39.41,-40.06 47.53,-48.5 68.75,-48.5 80.35,-48.5 88.04,-45.97 91.81,-42.2"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="95.26,-42.83 92.94,-32.49 88.31,-42.02 95.26,-42.83"/>
</a>
</g>
</g>
</g>
</svg>
</svg>
<style type='text/css'>
<![CDATA[
[data-mouse-over-selected='false'] { opacity: 0.7; }
[data-mouse-over-selected='true'] { opacity: 1.0; }
]]>
</style>
<script type="application/ecmascript"><![CDATA[
document.addEventListener('DOMContentLoaded', (event) => {
highlightEdges();
highlightAdjacentNodes();
});
]]></script>
</svg>

Before

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -1,31 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 12.1.2 (20240928.0832)
-->
<!-- Title: probability::geometric_dist::exponential_expected Pages: 1 -->
<svg width="146pt" height="57pt"
viewBox="0.00 0.00 145.50 56.50" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 52.5)">
<title>probability::geometric_dist::exponential_expected</title>
<!-- Node1 -->
<g id="Node000001" class="node">
<title>Node1</title>
<g id="a_Node000001"><a xlink:title="the expected value of the exponential distribution">
<polygon fill="#999999" stroke="#666666" points="137.5,-30.5 0,-30.5 0,0 137.5,0 137.5,-30.5"/>
<text text-anchor="start" x="8" y="-17" font-family="Helvetica,sans-Serif" font-size="10.00">probability::geometric</text>
<text text-anchor="middle" x="68.75" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">_dist::exponential_expected</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node1 -->
<g id="edge1_Node000001_Node000001" class="edge">
<title>Node1&#45;&gt;Node1</title>
<g id="a_edge1_Node000001_Node000001"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M44.38,-30.99C39.41,-40.06 47.53,-48.5 68.75,-48.5 80.35,-48.5 88.04,-45.97 91.81,-42.2"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="95.26,-42.83 92.94,-32.49 88.31,-42.02 95.26,-42.83"/>
</a>
</g>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -1,5 +0,0 @@
<map id="test" name="test">
<area shape="rect" id="Node000001" title="Self&#45;test implementations." alt="" coords="5,13,49,38"/>
<area shape="rect" id="Node000002" href="/Users/runner/work/C-Plus-Plus/C-Plus-Plus/doc/cppreference-doxygen-web.tag.xml$cpp/error/exception/what.html#" title=" " alt="" coords="97,5,242,46"/>
<area shape="poly" id="edge1_Node000001_Node000002" title=" " alt="" coords="49,23,81,23,81,28,49,28"/>
</map>

View File

@@ -1 +0,0 @@
fd0ca36cc9d6dc3ed3c6004e7bb148ad

View File

@@ -1,66 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 12.1.2 (20240928.0832)
-->
<!-- Title: test Pages: 1 -->
<svg width="186pt" height="39pt"
viewBox="0.00 0.00 185.50 38.50" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<svg id="main" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve">
<style type="text/css"><![CDATA[
.node, .edge {opacity: 0.7;}
.node.selected, .edge.selected {opacity: 1;}
.edge:hover path { stroke: red; }
.edge:hover polygon { stroke: red; fill: red; }
]]></style>
<script type="application/ecmascript" xlink:href="../../svg.min.js"/>
<svg id="graph" class="graph">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 34.5)">
<title>test</title>
<!-- Node1 -->
<g id="Node000001" class="node">
<title>Node1</title>
<g id="a_Node000001"><a xlink:title="Self&#45;test implementations.">
<polygon fill="#999999" stroke="#666666" points="32.5,-24.88 0,-24.88 0,-5.63 32.5,-5.63 32.5,-24.88"/>
<text text-anchor="middle" x="16.25" y="-11.38" font-family="Helvetica,sans-Serif" font-size="10.00">test</text>
</a>
</g>
</g>
<!-- Node2 -->
<g id="Node000002" class="node">
<title>Node2</title>
<g id="a_Node000002"><a target="_blank" xlink:href="http://en.cppreference.com/w/cpp/error/exception/what.html#" xlink:title=" ">
<polygon fill="white" stroke="#666666" points="177.5,-30.5 68.5,-30.5 68.5,0 177.5,0 177.5,-30.5"/>
<text text-anchor="start" x="76.5" y="-17" font-family="Helvetica,sans-Serif" font-size="10.00">std::invalid_argument</text>
<text text-anchor="middle" x="123" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">::what</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node2 -->
<g id="edge1_Node000001_Node000002" class="edge">
<title>Node1&#45;&gt;Node2</title>
<g id="a_edge1_Node000001_Node000002"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M32.71,-15.25C39.43,-15.25 47.8,-15.25 56.71,-15.25"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="56.67,-18.75 66.67,-15.25 56.67,-11.75 56.67,-18.75"/>
</a>
</g>
</g>
</g>
</svg>
</svg>
<style type='text/css'>
<![CDATA[
[data-mouse-over-selected='false'] { opacity: 0.7; }
[data-mouse-over-selected='true'] { opacity: 1.0; }
]]>
</style>
<script type="application/ecmascript"><![CDATA[
document.addEventListener('DOMContentLoaded', (event) => {
highlightEdges();
highlightAdjacentNodes();
});
]]></script>
</svg>

Before

Width:  |  Height:  |  Size: 2.5 KiB

View File

@@ -1,40 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 12.1.2 (20240928.0832)
-->
<!-- Title: test Pages: 1 -->
<svg width="186pt" height="39pt"
viewBox="0.00 0.00 185.50 38.50" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 34.5)">
<title>test</title>
<!-- Node1 -->
<g id="Node000001" class="node">
<title>Node1</title>
<g id="a_Node000001"><a xlink:title="Self&#45;test implementations.">
<polygon fill="#999999" stroke="#666666" points="32.5,-24.88 0,-24.88 0,-5.63 32.5,-5.63 32.5,-24.88"/>
<text text-anchor="middle" x="16.25" y="-11.38" font-family="Helvetica,sans-Serif" font-size="10.00">test</text>
</a>
</g>
</g>
<!-- Node2 -->
<g id="Node000002" class="node">
<title>Node2</title>
<g id="a_Node000002"><a target="_blank" xlink:href="http://en.cppreference.com/w/cpp/error/exception/what.html#" xlink:title=" ">
<polygon fill="white" stroke="#666666" points="177.5,-30.5 68.5,-30.5 68.5,0 177.5,0 177.5,-30.5"/>
<text text-anchor="start" x="76.5" y="-17" font-family="Helvetica,sans-Serif" font-size="10.00">std::invalid_argument</text>
<text text-anchor="middle" x="123" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">::what</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node2 -->
<g id="edge1_Node000001_Node000002" class="edge">
<title>Node1&#45;&gt;Node2</title>
<g id="a_edge1_Node000001_Node000002"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M32.71,-15.25C39.43,-15.25 47.8,-15.25 56.71,-15.25"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="56.67,-18.75 66.67,-15.25 56.67,-11.75 56.67,-18.75"/>
</a>
</g>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -1,4 +0,0 @@
<map id="probability::geometric_dist::exponential_std" name="probability::geometric_dist::exponential_std">
<area shape="rect" id="Node000001" title="the standard deviation of the exponential distribution" alt="" coords="5,29,154,70"/>
<area shape="poly" id="edge1_Node000001_Node000001" title=" " alt="" coords="51,29,49,19,54,11,64,5,80,3,96,5,106,12,103,16,94,10,79,8,66,10,58,14,54,20,56,28"/>
</map>

View File

@@ -1 +0,0 @@
ed79ee4d1ea4c9c4877f1a08548d4d28

View File

@@ -1,57 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 12.1.2 (20240928.0832)
-->
<!-- Title: probability::geometric_dist::exponential_std Pages: 1 -->
<svg width="119pt" height="57pt"
viewBox="0.00 0.00 119.25 56.50" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<svg id="main" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve">
<style type="text/css"><![CDATA[
.node, .edge {opacity: 0.7;}
.node.selected, .edge.selected {opacity: 1;}
.edge:hover path { stroke: red; }
.edge:hover polygon { stroke: red; fill: red; }
]]></style>
<script type="application/ecmascript" xlink:href="../../svg.min.js"/>
<svg id="graph" class="graph">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 52.5)">
<title>probability::geometric_dist::exponential_std</title>
<!-- Node1 -->
<g id="Node000001" class="node">
<title>Node1</title>
<g id="a_Node000001"><a xlink:title="the standard deviation of the exponential distribution">
<polygon fill="#999999" stroke="#666666" points="111.25,-30.5 0,-30.5 0,0 111.25,0 111.25,-30.5"/>
<text text-anchor="start" x="8" y="-17" font-family="Helvetica,sans-Serif" font-size="10.00">probability::geometric</text>
<text text-anchor="middle" x="55.62" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">_dist::exponential_std</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node1 -->
<g id="edge1_Node000001_Node000001" class="edge">
<title>Node1&#45;&gt;Node1</title>
<g id="a_edge1_Node000001_Node000001"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M35.91,-30.99C31.89,-40.06 38.46,-48.5 55.62,-48.5 65.01,-48.5 71.23,-45.97 74.28,-42.2"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="77.74,-42.78 75.2,-32.49 70.77,-42.12 77.74,-42.78"/>
</a>
</g>
</g>
</g>
</svg>
</svg>
<style type='text/css'>
<![CDATA[
[data-mouse-over-selected='false'] { opacity: 0.7; }
[data-mouse-over-selected='true'] { opacity: 1.0; }
]]>
</style>
<script type="application/ecmascript"><![CDATA[
document.addEventListener('DOMContentLoaded', (event) => {
highlightEdges();
highlightAdjacentNodes();
});
]]></script>
</svg>

Before

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -1,31 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 12.1.2 (20240928.0832)
-->
<!-- Title: probability::geometric_dist::exponential_std Pages: 1 -->
<svg width="119pt" height="57pt"
viewBox="0.00 0.00 119.25 56.50" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 52.5)">
<title>probability::geometric_dist::exponential_std</title>
<!-- Node1 -->
<g id="Node000001" class="node">
<title>Node1</title>
<g id="a_Node000001"><a xlink:title="the standard deviation of the exponential distribution">
<polygon fill="#999999" stroke="#666666" points="111.25,-30.5 0,-30.5 0,0 111.25,0 111.25,-30.5"/>
<text text-anchor="start" x="8" y="-17" font-family="Helvetica,sans-Serif" font-size="10.00">probability::geometric</text>
<text text-anchor="middle" x="55.62" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">_dist::exponential_std</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node1 -->
<g id="edge1_Node000001_Node000001" class="edge">
<title>Node1&#45;&gt;Node1</title>
<g id="a_edge1_Node000001_Node000001"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M35.91,-30.99C31.89,-40.06 38.46,-48.5 55.62,-48.5 65.01,-48.5 71.23,-45.97 74.28,-42.2"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="77.74,-42.78 75.2,-32.49 70.77,-42.12 77.74,-42.78"/>
</a>
</g>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -1,7 +0,0 @@
<map id="main" name="main">
<area shape="rect" id="Node000001" title="Main function." alt="" coords="5,13,55,38"/>
<area shape="rect" id="Node000002" href="$d9/da2/exponential__dist_8cpp.html#aa8dca7b867074164d5f45b0f3851269d" title="Self&#45;test implementations." alt="" coords="103,13,146,38"/>
<area shape="poly" id="edge1_Node000001_Node000002" title=" " alt="" coords="55,23,87,23,87,28,55,28"/>
<area shape="rect" id="Node000003" href="/Users/runner/work/C-Plus-Plus/C-Plus-Plus/doc/cppreference-doxygen-web.tag.xml$cpp/error/exception/what.html#" title=" " alt="" coords="194,5,339,46"/>
<area shape="poly" id="edge2_Node000002_Node000003" title=" " alt="" coords="146,23,178,23,178,28,146,28"/>
</map>

View File

@@ -1 +0,0 @@
18e1a9230f6e6404a44726440b39cecd

View File

@@ -1,84 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 12.1.2 (20240928.0832)
-->
<!-- Title: main Pages: 1 -->
<svg width="259pt" height="39pt"
viewBox="0.00 0.00 258.50 38.50" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<svg id="main" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve">
<style type="text/css"><![CDATA[
.node, .edge {opacity: 0.7;}
.node.selected, .edge.selected {opacity: 1;}
.edge:hover path { stroke: red; }
.edge:hover polygon { stroke: red; fill: red; }
]]></style>
<script type="application/ecmascript" xlink:href="../../svg.min.js"/>
<svg id="graph" class="graph">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 34.5)">
<title>main</title>
<!-- Node1 -->
<g id="Node000001" class="node">
<title>Node1</title>
<g id="a_Node000001"><a xlink:title="Main function.">
<polygon fill="#999999" stroke="#666666" points="37,-24.88 0,-24.88 0,-5.63 37,-5.63 37,-24.88"/>
<text text-anchor="middle" x="18.5" y="-11.38" font-family="Helvetica,sans-Serif" font-size="10.00">main</text>
</a>
</g>
</g>
<!-- Node2 -->
<g id="Node000002" class="node">
<title>Node2</title>
<g id="a_Node000002"><a xlink:href="../../d9/da2/exponential__dist_8cpp.html#aa8dca7b867074164d5f45b0f3851269d" target="_top" xlink:title="Self&#45;test implementations.">
<polygon fill="white" stroke="#666666" points="105.5,-24.88 73,-24.88 73,-5.63 105.5,-5.63 105.5,-24.88"/>
<text text-anchor="middle" x="89.25" y="-11.38" font-family="Helvetica,sans-Serif" font-size="10.00">test</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node2 -->
<g id="edge1_Node000001_Node000002" class="edge">
<title>Node1&#45;&gt;Node2</title>
<g id="a_edge1_Node000001_Node000002"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M37.2,-15.25C44.58,-15.25 53.31,-15.25 61.45,-15.25"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="61.2,-18.75 71.2,-15.25 61.2,-11.75 61.2,-18.75"/>
</a>
</g>
</g>
<!-- Node3 -->
<g id="Node000003" class="node">
<title>Node3</title>
<g id="a_Node000003"><a target="_blank" xlink:href="http://en.cppreference.com/w/cpp/error/exception/what.html#" xlink:title=" ">
<polygon fill="white" stroke="#666666" points="250.5,-30.5 141.5,-30.5 141.5,0 250.5,0 250.5,-30.5"/>
<text text-anchor="start" x="149.5" y="-17" font-family="Helvetica,sans-Serif" font-size="10.00">std::invalid_argument</text>
<text text-anchor="middle" x="196" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">::what</text>
</a>
</g>
</g>
<!-- Node2&#45;&gt;Node3 -->
<g id="edge2_Node000002_Node000003" class="edge">
<title>Node2&#45;&gt;Node3</title>
<g id="a_edge2_Node000002_Node000003"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M105.71,-15.25C112.43,-15.25 120.8,-15.25 129.71,-15.25"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="129.67,-18.75 139.67,-15.25 129.67,-11.75 129.67,-18.75"/>
</a>
</g>
</g>
</g>
</svg>
</svg>
<style type='text/css'>
<![CDATA[
[data-mouse-over-selected='false'] { opacity: 0.7; }
[data-mouse-over-selected='true'] { opacity: 1.0; }
]]>
</style>
<script type="application/ecmascript"><![CDATA[
document.addEventListener('DOMContentLoaded', (event) => {
highlightEdges();
highlightAdjacentNodes();
});
]]></script>
</svg>

Before

Width:  |  Height:  |  Size: 3.3 KiB

View File

@@ -1,58 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 12.1.2 (20240928.0832)
-->
<!-- Title: main Pages: 1 -->
<svg width="259pt" height="39pt"
viewBox="0.00 0.00 258.50 38.50" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 34.5)">
<title>main</title>
<!-- Node1 -->
<g id="Node000001" class="node">
<title>Node1</title>
<g id="a_Node000001"><a xlink:title="Main function.">
<polygon fill="#999999" stroke="#666666" points="37,-24.88 0,-24.88 0,-5.63 37,-5.63 37,-24.88"/>
<text text-anchor="middle" x="18.5" y="-11.38" font-family="Helvetica,sans-Serif" font-size="10.00">main</text>
</a>
</g>
</g>
<!-- Node2 -->
<g id="Node000002" class="node">
<title>Node2</title>
<g id="a_Node000002"><a xlink:href="../../d9/da2/exponential__dist_8cpp.html#aa8dca7b867074164d5f45b0f3851269d" target="_top" xlink:title="Self&#45;test implementations.">
<polygon fill="white" stroke="#666666" points="105.5,-24.88 73,-24.88 73,-5.63 105.5,-5.63 105.5,-24.88"/>
<text text-anchor="middle" x="89.25" y="-11.38" font-family="Helvetica,sans-Serif" font-size="10.00">test</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node2 -->
<g id="edge1_Node000001_Node000002" class="edge">
<title>Node1&#45;&gt;Node2</title>
<g id="a_edge1_Node000001_Node000002"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M37.2,-15.25C44.58,-15.25 53.31,-15.25 61.45,-15.25"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="61.2,-18.75 71.2,-15.25 61.2,-11.75 61.2,-18.75"/>
</a>
</g>
</g>
<!-- Node3 -->
<g id="Node000003" class="node">
<title>Node3</title>
<g id="a_Node000003"><a target="_blank" xlink:href="http://en.cppreference.com/w/cpp/error/exception/what.html#" xlink:title=" ">
<polygon fill="white" stroke="#666666" points="250.5,-30.5 141.5,-30.5 141.5,0 250.5,0 250.5,-30.5"/>
<text text-anchor="start" x="149.5" y="-17" font-family="Helvetica,sans-Serif" font-size="10.00">std::invalid_argument</text>
<text text-anchor="middle" x="196" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">::what</text>
</a>
</g>
</g>
<!-- Node2&#45;&gt;Node3 -->
<g id="edge2_Node000002_Node000003" class="edge">
<title>Node2&#45;&gt;Node3</title>
<g id="a_edge2_Node000002_Node000003"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M105.71,-15.25C112.43,-15.25 120.8,-15.25 129.71,-15.25"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="129.67,-18.75 139.67,-15.25 129.67,-11.75 129.67,-18.75"/>
</a>
</g>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.6 KiB

View File

@@ -1,4 +0,0 @@
<map id="probability::geometric_dist::exponential_var" name="probability::geometric_dist::exponential_var">
<area shape="rect" id="Node000001" title="the variance of the exponential distribution" alt="" coords="5,29,154,70"/>
<area shape="poly" id="edge1_Node000001_Node000001" title=" " alt="" coords="51,29,49,19,54,11,64,5,80,3,96,5,106,12,103,16,94,10,79,8,66,10,58,14,54,20,56,28"/>
</map>

View File

@@ -1 +0,0 @@
1856649fa4105093a554c1732bd6e8a1

View File

@@ -1,57 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 12.1.2 (20240928.0832)
-->
<!-- Title: probability::geometric_dist::exponential_var Pages: 1 -->
<svg width="119pt" height="57pt"
viewBox="0.00 0.00 119.25 56.50" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<svg id="main" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve">
<style type="text/css"><![CDATA[
.node, .edge {opacity: 0.7;}
.node.selected, .edge.selected {opacity: 1;}
.edge:hover path { stroke: red; }
.edge:hover polygon { stroke: red; fill: red; }
]]></style>
<script type="application/ecmascript" xlink:href="../../svg.min.js"/>
<svg id="graph" class="graph">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 52.5)">
<title>probability::geometric_dist::exponential_var</title>
<!-- Node1 -->
<g id="Node000001" class="node">
<title>Node1</title>
<g id="a_Node000001"><a xlink:title="the variance of the exponential distribution">
<polygon fill="#999999" stroke="#666666" points="111.25,-30.5 0,-30.5 0,0 111.25,0 111.25,-30.5"/>
<text text-anchor="start" x="8" y="-17" font-family="Helvetica,sans-Serif" font-size="10.00">probability::geometric</text>
<text text-anchor="middle" x="55.62" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">_dist::exponential_var</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node1 -->
<g id="edge1_Node000001_Node000001" class="edge">
<title>Node1&#45;&gt;Node1</title>
<g id="a_edge1_Node000001_Node000001"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M35.91,-30.99C31.89,-40.06 38.46,-48.5 55.62,-48.5 65.01,-48.5 71.23,-45.97 74.28,-42.2"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="77.74,-42.78 75.2,-32.49 70.77,-42.12 77.74,-42.78"/>
</a>
</g>
</g>
</g>
</svg>
</svg>
<style type='text/css'>
<![CDATA[
[data-mouse-over-selected='false'] { opacity: 0.7; }
[data-mouse-over-selected='true'] { opacity: 1.0; }
]]>
</style>
<script type="application/ecmascript"><![CDATA[
document.addEventListener('DOMContentLoaded', (event) => {
highlightEdges();
highlightAdjacentNodes();
});
]]></script>
</svg>

Before

Width:  |  Height:  |  Size: 2.2 KiB

View File

@@ -1,31 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 12.1.2 (20240928.0832)
-->
<!-- Title: probability::geometric_dist::exponential_var Pages: 1 -->
<svg width="119pt" height="57pt"
viewBox="0.00 0.00 119.25 56.50" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 52.5)">
<title>probability::geometric_dist::exponential_var</title>
<!-- Node1 -->
<g id="Node000001" class="node">
<title>Node1</title>
<g id="a_Node000001"><a xlink:title="the variance of the exponential distribution">
<polygon fill="#999999" stroke="#666666" points="111.25,-30.5 0,-30.5 0,0 111.25,0 111.25,-30.5"/>
<text text-anchor="start" x="8" y="-17" font-family="Helvetica,sans-Serif" font-size="10.00">probability::geometric</text>
<text text-anchor="middle" x="55.62" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">_dist::exponential_var</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node1 -->
<g id="edge1_Node000001_Node000001" class="edge">
<title>Node1&#45;&gt;Node1</title>
<g id="a_edge1_Node000001_Node000001"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M35.91,-30.99C31.89,-40.06 38.46,-48.5 55.62,-48.5 65.01,-48.5 71.23,-45.97 74.28,-42.2"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="77.74,-42.78 75.2,-32.49 70.77,-42.12 77.74,-42.78"/>
</a>
</g>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -0,0 +1,262 @@
<!-- HTML header for doxygen 1.12.0-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<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.12.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>TheAlgorithms/C++: probability/exponential_dist.cpp Source File</title>
<link rel="icon" href="../../favicon.svg" type="image/x-icon" />
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@xpack-3rd-party/doxygen-awesome-css@2.2.0-1/doxygen-awesome-darkmode-toggle.js"></script>
<script type="text/javascript">
DoxygenAwesomeDarkModeToggle.init()
</script>
<script type="text/javascript" src="../../clipboard.js"></script>
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../navtreedata.js"></script>
<script type="text/javascript" src="../../navtree.js"></script>
<script type="text/javascript" src="../../resize.js"></script>
<script type="text/javascript" src="../../cookie.js"></script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../search/searchdata.js"></script>
<script type="text/javascript" src="../../search/search.js"></script>
<script type="text/javascript">
window.MathJax = {
options: {
ignoreHtmlClass: 'tex2jax_ignore',
processHtmlClass: 'tex2jax_process'
},
loader: {
load: ['[tex]/ams']
},
tex: {
macros: {},
packages: ['base','configmacros','ams']
}
};
</script>
<script type="text/javascript" id="MathJax-script" async="async" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"></script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
<link href="../../doxygen-awesome.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr id="projectrow">
<td id="projectlogo"><img alt="Logo" src="../../project_logo.png"/></td>
<td id="projectalign">
<div id="projectname">TheAlgorithms/C++<span id="projectnumber">&#160;1.0.0</span>
</div>
<div id="projectbrief">All the algorithms implemented in C++</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.12.0 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "../../search/",'.html');
/* @license-end */
</script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() { codefold.init(1); });
/* @license-end */
</script>
<script type="text/javascript" src="../../menudata.js"></script>
<script type="text/javascript" src="../../menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
initMenu('../../',true,false,'search.php','Search',true);
$(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function(){initNavTree('d9/da2/exponential__dist_8cpp_source.html','../../'); initResizable(true); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
<div class="header">
<div class="headertitle"><div class="title">exponential_dist.cpp</div></div>
</div><!--header-->
<div class="contents">
<a href="../../d9/da2/exponential__dist_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span> </div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span><span class="preprocessor">#include &lt;cassert&gt;</span> <span class="comment">// For assert</span></div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span><span class="preprocessor">#include &lt;cmath&gt;</span> <span class="comment">// For std::pow</span></div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span><span class="preprocessor">#include &lt;iostream&gt;</span> <span class="comment">// For I/O operation</span></div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span><span class="preprocessor">#include &lt;stdexcept&gt;</span> <span class="comment">// For std::invalid_argument</span></div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span><span class="preprocessor">#include &lt;string&gt;</span> <span class="comment">// For std::string</span></div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span> </div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span><span class="keyword">namespace </span><a class="code hl_namespace" href="../../d4/ded/namespaceprobability.html">probability</a> {</div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span><span class="keyword">namespace </span><a class="code hl_namespace" href="../../dd/d8a/namespacegeometric__dist.html">geometric_dist</a> {</div>
<div class="foldopen" id="foldopen00037" data-start="{" data-end="}">
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"><a class="line" href="../../d9/da2/exponential__dist_8cpp.html#a1c8b6e787f72a209ef96c096eedf7afc"> 37</a></span><span class="keywordtype">double</span> <a class="code hl_function" href="../../d9/da2/exponential__dist_8cpp.html#a1c8b6e787f72a209ef96c096eedf7afc">exponential_expected</a>(<span class="keywordtype">double</span> lambda) {</div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> <span class="keywordflow">if</span> (lambda &lt;= 0) {</div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> <span class="keywordflow">throw</span> std::invalid_argument(<span class="stringliteral">&quot;lambda must be greater than 0&quot;</span>);</div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> }</div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span> <span class="keywordflow">return</span> 1 / lambda;</div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span>}</div>
</div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> </div>
<div class="foldopen" id="foldopen00048" data-start="{" data-end="}">
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"><a class="line" href="../../d9/da2/exponential__dist_8cpp.html#af435dbeb43a05c8c7785f53bf4ce1df1"> 48</a></span><span class="keywordtype">double</span> <a class="code hl_function" href="../../d9/da2/exponential__dist_8cpp.html#af435dbeb43a05c8c7785f53bf4ce1df1">exponential_var</a>(<span class="keywordtype">double</span> lambda) {</div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> <span class="keywordflow">if</span> (lambda &lt;= 0) {</div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> <span class="keywordflow">throw</span> std::invalid_argument(<span class="stringliteral">&quot;lambda must be greater than 0&quot;</span>);</div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> }</div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> <span class="keywordflow">return</span> 1 / pow(lambda, 2);</div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span>}</div>
</div>
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> </div>
<div class="foldopen" id="foldopen00059" data-start="{" data-end="}">
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"><a class="line" href="../../d9/da2/exponential__dist_8cpp.html#ac7b0091e17479d47438a281fefc2549a"> 59</a></span><span class="keywordtype">double</span> <a class="code hl_function" href="../../d9/da2/exponential__dist_8cpp.html#ac7b0091e17479d47438a281fefc2549a">exponential_std</a>(<span class="keywordtype">double</span> lambda) {</div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> <span class="keywordflow">if</span> (lambda &lt;= 0) {</div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> <span class="keywordflow">throw</span> std::invalid_argument(<span class="stringliteral">&quot;lambda must be greater than 0&quot;</span>);</div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> }</div>
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> <span class="keywordflow">return</span> 1 / lambda;</div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span>}</div>
</div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span>} <span class="comment">// namespace geometric_dist</span></div>
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span>} <span class="comment">// namespace probability</span></div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span> </div>
<div class="foldopen" id="foldopen00072" data-start="{" data-end="}">
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"><a class="line" href="../../d9/da2/exponential__dist_8cpp.html#aa8dca7b867074164d5f45b0f3851269d"> 72</a></span><span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../d9/da2/exponential__dist_8cpp.html#aa8dca7b867074164d5f45b0f3851269d">test</a>() {</div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> <span class="keywordtype">double</span> lambda_1 = 1;</div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span> <span class="keywordtype">double</span> expected_1 = 1;</div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span> <span class="keywordtype">double</span> var_1 = 1;</div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> <span class="keywordtype">double</span> std_1 = 1;</div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> </div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> <span class="keywordtype">double</span> lambda_2 = 2;</div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> <span class="keywordtype">double</span> expected_2 = 0.5;</div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> <span class="keywordtype">double</span> var_2 = 0.25;</div>
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> <span class="keywordtype">double</span> std_2 = 0.5;</div>
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span> </div>
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span> <span class="keywordtype">double</span> lambda_3 = 3;</div>
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span> <span class="keywordtype">double</span> expected_3 = 0.333333;</div>
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span> <span class="keywordtype">double</span> var_3 = 0.111111;</div>
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno"> 86</span> <span class="keywordtype">double</span> std_3 = 0.333333;</div>
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno"> 87</span> </div>
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span> <span class="keywordtype">double</span> lambda_4 = 0; <span class="comment">// Test 0</span></div>
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span> <span class="keywordtype">double</span> lambda_5 = -2.3; <span class="comment">// Test negative value</span></div>
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span> </div>
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span> <span class="keyword">const</span> <span class="keywordtype">float</span> threshold = 1e-3f;</div>
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"> 92</span> </div>
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Test for lambda = 1 \n&quot;</span>;</div>
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span> assert(</div>
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"> 95</span> std::abs(expected_1 - probability::geometric_dist::exponential_expected(</div>
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno"> 96</span> lambda_1)) &lt; threshold);</div>
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno"> 97</span> assert(std::abs(var_1 - probability::geometric_dist::exponential_var(</div>
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno"> 98</span> lambda_1)) &lt; threshold);</div>
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"> 99</span> assert(std::abs(std_1 - probability::geometric_dist::exponential_std(</div>
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"> 100</span> lambda_1)) &lt; threshold);</div>
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno"> 101</span> std::cout &lt;&lt; <span class="stringliteral">&quot;ALL TEST PASSED\n\n&quot;</span>;</div>
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno"> 102</span> </div>
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"> 103</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Test for lambda = 2 \n&quot;</span>;</div>
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"> 104</span> assert(</div>
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span> std::abs(expected_2 - probability::geometric_dist::exponential_expected(</div>
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span> lambda_2)) &lt; threshold);</div>
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"> 107</span> assert(std::abs(var_2 - probability::geometric_dist::exponential_var(</div>
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno"> 108</span> lambda_2)) &lt; threshold);</div>
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno"> 109</span> assert(std::abs(std_2 - probability::geometric_dist::exponential_std(</div>
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno"> 110</span> lambda_2)) &lt; threshold);</div>
<div class="line"><a id="l00111" name="l00111"></a><span class="lineno"> 111</span> std::cout &lt;&lt; <span class="stringliteral">&quot;ALL TEST PASSED\n\n&quot;</span>;</div>
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno"> 112</span> </div>
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno"> 113</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Test for lambda = 3 \n&quot;</span>;</div>
<div class="line"><a id="l00114" name="l00114"></a><span class="lineno"> 114</span> assert(</div>
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno"> 115</span> std::abs(expected_3 - probability::geometric_dist::exponential_expected(</div>
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno"> 116</span> lambda_3)) &lt; threshold);</div>
<div class="line"><a id="l00117" name="l00117"></a><span class="lineno"> 117</span> assert(std::abs(var_3 - probability::geometric_dist::exponential_var(</div>
<div class="line"><a id="l00118" name="l00118"></a><span class="lineno"> 118</span> lambda_3)) &lt; threshold);</div>
<div class="line"><a id="l00119" name="l00119"></a><span class="lineno"> 119</span> assert(std::abs(std_3 - probability::geometric_dist::exponential_std(</div>
<div class="line"><a id="l00120" name="l00120"></a><span class="lineno"> 120</span> lambda_3)) &lt; threshold);</div>
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno"> 121</span> std::cout &lt;&lt; <span class="stringliteral">&quot;ALL TEST PASSED\n\n&quot;</span>;</div>
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno"> 122</span> </div>
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno"> 123</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Test for lambda = 0 \n&quot;</span>;</div>
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno"> 124</span> <span class="keywordflow">try</span> {</div>
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno"> 125</span> probability::geometric_dist::exponential_expected(lambda_4);</div>
<div class="line"><a id="l00126" name="l00126"></a><span class="lineno"> 126</span> probability::geometric_dist::exponential_var(lambda_4);</div>
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno"> 127</span> probability::geometric_dist::exponential_std(lambda_4);</div>
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno"> 128</span> } <span class="keywordflow">catch</span> (std::invalid_argument&amp; err) {</div>
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno"> 129</span> assert(std::string(err.what()) == <span class="stringliteral">&quot;lambda must be greater than 0&quot;</span>);</div>
<div class="line"><a id="l00130" name="l00130"></a><span class="lineno"> 130</span> }</div>
<div class="line"><a id="l00131" name="l00131"></a><span class="lineno"> 131</span> std::cout &lt;&lt; <span class="stringliteral">&quot;ALL TEST PASSED\n\n&quot;</span>;</div>
<div class="line"><a id="l00132" name="l00132"></a><span class="lineno"> 132</span> </div>
<div class="line"><a id="l00133" name="l00133"></a><span class="lineno"> 133</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Test for lambda = -2.3 \n&quot;</span>;</div>
<div class="line"><a id="l00134" name="l00134"></a><span class="lineno"> 134</span> <span class="keywordflow">try</span> {</div>
<div class="line"><a id="l00135" name="l00135"></a><span class="lineno"> 135</span> probability::geometric_dist::exponential_expected(lambda_5);</div>
<div class="line"><a id="l00136" name="l00136"></a><span class="lineno"> 136</span> probability::geometric_dist::exponential_var(lambda_5);</div>
<div class="line"><a id="l00137" name="l00137"></a><span class="lineno"> 137</span> probability::geometric_dist::exponential_std(lambda_5);</div>
<div class="line"><a id="l00138" name="l00138"></a><span class="lineno"> 138</span> } <span class="keywordflow">catch</span> (std::invalid_argument&amp; err) {</div>
<div class="line"><a id="l00139" name="l00139"></a><span class="lineno"> 139</span> assert(std::string(err.what()) == <span class="stringliteral">&quot;lambda must be greater than 0&quot;</span>);</div>
<div class="line"><a id="l00140" name="l00140"></a><span class="lineno"> 140</span> }</div>
<div class="line"><a id="l00141" name="l00141"></a><span class="lineno"> 141</span> std::cout &lt;&lt; <span class="stringliteral">&quot;ALL TEST PASSED\n\n&quot;</span>;</div>
<div class="line"><a id="l00142" name="l00142"></a><span class="lineno"> 142</span>}</div>
</div>
<div class="line"><a id="l00143" name="l00143"></a><span class="lineno"> 143</span> </div>
<div class="foldopen" id="foldopen00148" data-start="{" data-end="}">
<div class="line"><a id="l00148" name="l00148"></a><span class="lineno"><a class="line" href="../../d9/da2/exponential__dist_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4"> 148</a></span><span class="keywordtype">int</span> <a class="code hl_function" href="../../d9/da2/exponential__dist_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main</a>() {</div>
<div class="line"><a id="l00149" name="l00149"></a><span class="lineno"> 149</span> <a class="code hl_function" href="../../d9/da2/exponential__dist_8cpp.html#aa8dca7b867074164d5f45b0f3851269d">test</a>(); <span class="comment">// Self test implementation</span></div>
<div class="line"><a id="l00150" name="l00150"></a><span class="lineno"> 150</span> <span class="keywordflow">return</span> 0;</div>
<div class="line"><a id="l00151" name="l00151"></a><span class="lineno"> 151</span>}</div>
</div>
<div class="ttc" id="aexponential__dist_8cpp_html_a1c8b6e787f72a209ef96c096eedf7afc"><div class="ttname"><a href="../../d9/da2/exponential__dist_8cpp.html#a1c8b6e787f72a209ef96c096eedf7afc">probability::geometric_dist::exponential_expected</a></div><div class="ttdeci">double exponential_expected(double lambda)</div><div class="ttdoc">the expected value of the exponential distribution</div><div class="ttdef"><b>Definition</b> <a href="#l00037">exponential_dist.cpp:37</a></div></div>
<div class="ttc" id="aexponential__dist_8cpp_html_aa8dca7b867074164d5f45b0f3851269d"><div class="ttname"><a href="../../d9/da2/exponential__dist_8cpp.html#aa8dca7b867074164d5f45b0f3851269d">test</a></div><div class="ttdeci">static void test()</div><div class="ttdoc">Self-test implementations.</div><div class="ttdef"><b>Definition</b> <a href="#l00072">exponential_dist.cpp:72</a></div></div>
<div class="ttc" id="aexponential__dist_8cpp_html_ac7b0091e17479d47438a281fefc2549a"><div class="ttname"><a href="../../d9/da2/exponential__dist_8cpp.html#ac7b0091e17479d47438a281fefc2549a">probability::geometric_dist::exponential_std</a></div><div class="ttdeci">double exponential_std(double lambda)</div><div class="ttdoc">the standard deviation of the exponential distribution</div><div class="ttdef"><b>Definition</b> <a href="#l00059">exponential_dist.cpp:59</a></div></div>
<div class="ttc" id="aexponential__dist_8cpp_html_ae66f6b31b5ad750f1fe042a706a4e3d4"><div class="ttname"><a href="../../d9/da2/exponential__dist_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main</a></div><div class="ttdeci">int main()</div><div class="ttdoc">Main function.</div><div class="ttdef"><b>Definition</b> <a href="#l00148">exponential_dist.cpp:148</a></div></div>
<div class="ttc" id="aexponential__dist_8cpp_html_af435dbeb43a05c8c7785f53bf4ce1df1"><div class="ttname"><a href="../../d9/da2/exponential__dist_8cpp.html#af435dbeb43a05c8c7785f53bf4ce1df1">probability::geometric_dist::exponential_var</a></div><div class="ttdeci">double exponential_var(double lambda)</div><div class="ttdoc">the variance of the exponential distribution</div><div class="ttdef"><b>Definition</b> <a href="#l00048">exponential_dist.cpp:48</a></div></div>
<div class="ttc" id="anamespacegeometric__dist_html"><div class="ttname"><a href="../../dd/d8a/namespacegeometric__dist.html">geometric_dist</a></div><div class="ttdoc">Functions for the Geometric Distribution algorithm implementation.</div></div>
<div class="ttc" id="anamespaceprobability_html"><div class="ttname"><a href="../../d4/ded/namespaceprobability.html">probability</a></div><div class="ttdoc">Probability algorithms.</div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="../../dir_82e494173a87936756866de2fa774307.html">probability</a></li><li class="navelem"><a class="el" href="../../d9/da2/exponential__dist_8cpp.html">exponential_dist.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.12.0 </li>
</ul>
</div>
</body>
</html>