Documentation for c6af943508

This commit is contained in:
realstealthninja
2024-11-04 12:10:37 +00:00
parent e97327bf4f
commit fb1d00ead7
518 changed files with 13882 additions and 10974 deletions

View File

@@ -165,25 +165,25 @@ Private Attributes</h2></td></tr>
<p>Delete element from back of the queue. </p>
<p>Remove element that is located at the first of the queue.</p>
<dl class="section return"><dt>Returns</dt><dd>data that is deleted if queue is not empty </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 75</span> {</div>
<div class="line"><span class="lineno"> 76</span> int8_t d{0};</div>
<div class="line"><span class="lineno"> 77</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="#a2f676f2f249eb36dfd49711a03e9e67e">front</a> == -1) {</div>
<div class="line"><span class="lineno"> 78</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;\nstack is empty &quot;</span>;</div>
<div class="line"><span class="lineno"> 79</span> <span class="keywordflow">return</span> 0;</div>
<div class="line"><span class="lineno"> 80</span> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="#a2f676f2f249eb36dfd49711a03e9e67e">front</a> == <a class="code hl_variable" href="#a9883dfcceede9a42227d2d313ae86f85">rear</a>) {</div>
<div class="line"><span class="lineno"> 81</span> d = <a class="code hl_variable" href="#ae69a0bf6c9921b37c516c8a4d2fb904d">arr</a>.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/array/at.html">at</a>(<a class="code hl_variable" href="#a2f676f2f249eb36dfd49711a03e9e67e">front</a>);</div>
<div class="line"><span class="lineno"> 82</span> <a class="code hl_variable" href="#a2f676f2f249eb36dfd49711a03e9e67e">front</a> = <a class="code hl_variable" href="#a9883dfcceede9a42227d2d313ae86f85">rear</a> = -1;</div>
<div class="line"><span class="lineno"> 83</span> } <span class="keywordflow">else</span> {</div>
<div class="line"><span class="lineno"> 84</span> d = <a class="code hl_variable" href="#ae69a0bf6c9921b37c516c8a4d2fb904d">arr</a>.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/array/at.html">at</a>(<a class="code hl_variable" href="#a2f676f2f249eb36dfd49711a03e9e67e">front</a>++);</div>
<div class="line"><span class="lineno"> 85</span> }</div>
<div class="line"><span class="lineno"> 86</span> </div>
<div class="line"><span class="lineno"> 87</span> <span class="keywordflow">return</span> d;</div>
<div class="line"><span class="lineno"> 88</span>}</div>
<div class="fragment"><div class="line"><span class="lineno"> 76</span> {</div>
<div class="line"><span class="lineno"> 77</span> int8_t d{0};</div>
<div class="line"><span class="lineno"> 78</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="#a2f676f2f249eb36dfd49711a03e9e67e">front</a> == -1) {</div>
<div class="line"><span class="lineno"> 79</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;\nstack is empty &quot;</span>;</div>
<div class="line"><span class="lineno"> 80</span> <span class="keywordflow">return</span> 0;</div>
<div class="line"><span class="lineno"> 81</span> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="#a2f676f2f249eb36dfd49711a03e9e67e">front</a> == <a class="code hl_variable" href="#a9883dfcceede9a42227d2d313ae86f85">rear</a>) {</div>
<div class="line"><span class="lineno"> 82</span> d = <a class="code hl_variable" href="#ae69a0bf6c9921b37c516c8a4d2fb904d">arr</a>.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/array/at.html">at</a>(<a class="code hl_variable" href="#a2f676f2f249eb36dfd49711a03e9e67e">front</a>);</div>
<div class="line"><span class="lineno"> 83</span> <a class="code hl_variable" href="#a2f676f2f249eb36dfd49711a03e9e67e">front</a> = <a class="code hl_variable" href="#a9883dfcceede9a42227d2d313ae86f85">rear</a> = -1;</div>
<div class="line"><span class="lineno"> 84</span> } <span class="keywordflow">else</span> {</div>
<div class="line"><span class="lineno"> 85</span> d = <a class="code hl_variable" href="#ae69a0bf6c9921b37c516c8a4d2fb904d">arr</a>.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/array/at.html">at</a>(<a class="code hl_variable" href="#a2f676f2f249eb36dfd49711a03e9e67e">front</a>++);</div>
<div class="line"><span class="lineno"> 86</span> }</div>
<div class="line"><span class="lineno"> 87</span> </div>
<div class="line"><span class="lineno"> 88</span> <span class="keywordflow">return</span> d;</div>
<div class="line"><span class="lineno"> 89</span>}</div>
<div class="ttc" id="aat_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/array/at.html">std::array::at</a></div><div class="ttdeci">T at(T... args)</div></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="aclassdata__structures_1_1queue__using__array_1_1_queue___array_html_a2f676f2f249eb36dfd49711a03e9e67e"><div class="ttname"><a href="#a2f676f2f249eb36dfd49711a03e9e67e">data_structures::queue_using_array::Queue_Array::front</a></div><div class="ttdeci">int8_t front</div><div class="ttdoc">Index of head of the array.</div><div class="ttdef"><b>Definition</b> queue_using_array.cpp:49</div></div>
<div class="ttc" id="aclassdata__structures_1_1queue__using__array_1_1_queue___array_html_a9883dfcceede9a42227d2d313ae86f85"><div class="ttname"><a href="#a9883dfcceede9a42227d2d313ae86f85">data_structures::queue_using_array::Queue_Array::rear</a></div><div class="ttdeci">int8_t rear</div><div class="ttdoc">Index of tail of the array.</div><div class="ttdef"><b>Definition</b> queue_using_array.cpp:50</div></div>
<div class="ttc" id="aclassdata__structures_1_1queue__using__array_1_1_queue___array_html_ae69a0bf6c9921b37c516c8a4d2fb904d"><div class="ttname"><a href="#ae69a0bf6c9921b37c516c8a4d2fb904d">data_structures::queue_using_array::Queue_Array::arr</a></div><div class="ttdeci">std::array&lt; int16_t, max_size &gt; arr</div><div class="ttdoc">All stored data.</div><div class="ttdef"><b>Definition</b> queue_using_array.cpp:51</div></div>
<div class="ttc" id="aclassdata__structures_1_1queue__using__array_1_1_queue___array_html_a2f676f2f249eb36dfd49711a03e9e67e"><div class="ttname"><a href="#a2f676f2f249eb36dfd49711a03e9e67e">data_structures::queue_using_array::Queue_Array::front</a></div><div class="ttdeci">int8_t front</div><div class="ttdoc">Index of head of the array.</div><div class="ttdef"><b>Definition</b> queue_using_array.cpp:50</div></div>
<div class="ttc" id="aclassdata__structures_1_1queue__using__array_1_1_queue___array_html_a9883dfcceede9a42227d2d313ae86f85"><div class="ttname"><a href="#a9883dfcceede9a42227d2d313ae86f85">data_structures::queue_using_array::Queue_Array::rear</a></div><div class="ttdeci">int8_t rear</div><div class="ttdoc">Index of tail of the array.</div><div class="ttdef"><b>Definition</b> queue_using_array.cpp:51</div></div>
<div class="ttc" id="aclassdata__structures_1_1queue__using__array_1_1_queue___array_html_ae69a0bf6c9921b37c516c8a4d2fb904d"><div class="ttname"><a href="#ae69a0bf6c9921b37c516c8a4d2fb904d">data_structures::queue_using_array::Queue_Array::arr</a></div><div class="ttdeci">std::array&lt; int16_t, max_size &gt; arr</div><div class="ttdoc">All stored data.</div><div class="ttdef"><b>Definition</b> queue_using_array.cpp:52</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
@@ -209,13 +209,13 @@ Here is the call graph for this function:</div>
<p>Show all saved data. </p>
<p>Utility function to show all elements in the queue. </p>
<div class="fragment"><div class="line"><span class="lineno"> 93</span> {</div>
<div class="line"><span class="lineno"> 94</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="#a2f676f2f249eb36dfd49711a03e9e67e">front</a> == -1) {</div>
<div class="line"><span class="lineno"> 95</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;\nStack is empty&quot;</span>;</div>
<div class="line"><span class="lineno"> 96</span> } <span class="keywordflow">else</span> {</div>
<div class="line"><span class="lineno"> 97</span> <span class="keywordflow">for</span> (int16_t i{<a class="code hl_variable" href="#a2f676f2f249eb36dfd49711a03e9e67e">front</a>}; i &lt;= <a class="code hl_variable" href="#a9883dfcceede9a42227d2d313ae86f85">rear</a>; ++i) <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <a class="code hl_variable" href="#ae69a0bf6c9921b37c516c8a4d2fb904d">arr</a>.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/array/at.html">at</a>(i) &lt;&lt; <span class="stringliteral">&quot; &quot;</span>;</div>
<div class="line"><span class="lineno"> 98</span> }</div>
<div class="line"><span class="lineno"> 99</span>}</div>
<div class="fragment"><div class="line"><span class="lineno"> 94</span> {</div>
<div class="line"><span class="lineno"> 95</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="#a2f676f2f249eb36dfd49711a03e9e67e">front</a> == -1) {</div>
<div class="line"><span class="lineno"> 96</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;\nStack is empty&quot;</span>;</div>
<div class="line"><span class="lineno"> 97</span> } <span class="keywordflow">else</span> {</div>
<div class="line"><span class="lineno"> 98</span> <span class="keywordflow">for</span> (int16_t i{<a class="code hl_variable" href="#a2f676f2f249eb36dfd49711a03e9e67e">front</a>}; i &lt;= <a class="code hl_variable" href="#a9883dfcceede9a42227d2d313ae86f85">rear</a>; ++i) <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <a class="code hl_variable" href="#ae69a0bf6c9921b37c516c8a4d2fb904d">arr</a>.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/array/at.html">at</a>(i) &lt;&lt; <span class="stringliteral">&quot; &quot;</span>;</div>
<div class="line"><span class="lineno"> 99</span> }</div>
<div class="line"><span class="lineno"> 100</span>}</div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
@@ -247,18 +247,18 @@ Here is the call graph for this function:</div>
</table>
</dd>
</dl>
<div class="fragment"><div class="line"><span class="lineno"> 58</span> {</div>
<div class="line"><span class="lineno"> 59</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="#a9883dfcceede9a42227d2d313ae86f85">rear</a> == <a class="code hl_variable" href="#ae69a0bf6c9921b37c516c8a4d2fb904d">arr</a>.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/array/size.html">size</a>() - 1) {</div>
<div class="line"><span class="lineno"> 60</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;\nStack is full&quot;</span>;</div>
<div class="line"><span class="lineno"> 61</span> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="#a2f676f2f249eb36dfd49711a03e9e67e">front</a> == -1 &amp;&amp; <a class="code hl_variable" href="#a9883dfcceede9a42227d2d313ae86f85">rear</a> == -1) {</div>
<div class="line"><span class="lineno"> 62</span> <a class="code hl_variable" href="#a2f676f2f249eb36dfd49711a03e9e67e">front</a> = 0;</div>
<div class="line"><span class="lineno"> 63</span> <a class="code hl_variable" href="#a9883dfcceede9a42227d2d313ae86f85">rear</a> = 0;</div>
<div class="line"><span class="lineno"> 64</span> <a class="code hl_variable" href="#ae69a0bf6c9921b37c516c8a4d2fb904d">arr</a>[<a class="code hl_variable" href="#a9883dfcceede9a42227d2d313ae86f85">rear</a>] = ele;</div>
<div class="line"><span class="lineno"> 65</span> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="#a9883dfcceede9a42227d2d313ae86f85">rear</a> &lt; <a class="code hl_variable" href="#ae69a0bf6c9921b37c516c8a4d2fb904d">arr</a>.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/array/size.html">size</a>()) {</div>
<div class="line"><span class="lineno"> 66</span> ++<a class="code hl_variable" href="#a9883dfcceede9a42227d2d313ae86f85">rear</a>;</div>
<div class="line"><span class="lineno"> 67</span> <a class="code hl_variable" href="#ae69a0bf6c9921b37c516c8a4d2fb904d">arr</a>[<a class="code hl_variable" href="#a9883dfcceede9a42227d2d313ae86f85">rear</a>] = ele;</div>
<div class="line"><span class="lineno"> 68</span> }</div>
<div class="line"><span class="lineno"> 69</span>}</div>
<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> (<a class="code hl_variable" href="#a9883dfcceede9a42227d2d313ae86f85">rear</a> == <a class="code hl_variable" href="#ae69a0bf6c9921b37c516c8a4d2fb904d">arr</a>.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/array/size.html">size</a>() - 1) {</div>
<div class="line"><span class="lineno"> 61</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;\nStack is full&quot;</span>;</div>
<div class="line"><span class="lineno"> 62</span> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="#a2f676f2f249eb36dfd49711a03e9e67e">front</a> == -1 &amp;&amp; <a class="code hl_variable" href="#a9883dfcceede9a42227d2d313ae86f85">rear</a> == -1) {</div>
<div class="line"><span class="lineno"> 63</span> <a class="code hl_variable" href="#a2f676f2f249eb36dfd49711a03e9e67e">front</a> = 0;</div>
<div class="line"><span class="lineno"> 64</span> <a class="code hl_variable" href="#a9883dfcceede9a42227d2d313ae86f85">rear</a> = 0;</div>
<div class="line"><span class="lineno"> 65</span> <a class="code hl_variable" href="#ae69a0bf6c9921b37c516c8a4d2fb904d">arr</a>[<a class="code hl_variable" href="#a9883dfcceede9a42227d2d313ae86f85">rear</a>] = ele;</div>
<div class="line"><span class="lineno"> 66</span> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="#a9883dfcceede9a42227d2d313ae86f85">rear</a> &lt; <a class="code hl_variable" href="#ae69a0bf6c9921b37c516c8a4d2fb904d">arr</a>.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/array/size.html">size</a>()) {</div>
<div class="line"><span class="lineno"> 67</span> ++<a class="code hl_variable" href="#a9883dfcceede9a42227d2d313ae86f85">rear</a>;</div>
<div class="line"><span class="lineno"> 68</span> <a class="code hl_variable" href="#ae69a0bf6c9921b37c516c8a4d2fb904d">arr</a>[<a class="code hl_variable" href="#a9883dfcceede9a42227d2d313ae86f85">rear</a>] = ele;</div>
<div class="line"><span class="lineno"> 69</span> }</div>
<div class="line"><span class="lineno"> 70</span>}</div>
<div class="ttc" id="asize_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/array/size.html">std::array::size</a></div><div class="ttdeci">T size(T... args)</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
@@ -290,7 +290,7 @@ Here is the call graph for this function:</div>
</div><div class="memdoc">
<p>All stored data. </p>
<div class="fragment"><div class="line"><span class="lineno"> 51</span>{}; <span class="comment">///&lt; All stored data</span></div>
<div class="fragment"><div class="line"><span class="lineno"> 52</span>{}; <span class="comment">///&lt; All stored data</span></div>
</div><!-- fragment -->
</div>
</div>
@@ -315,7 +315,7 @@ Here is the call graph for this function:</div>
</div><div class="memdoc">
<p>Index of head of the array. </p>
<div class="fragment"><div class="line"><span class="lineno"> 49</span>{-1}; <span class="comment">///&lt; Index of head of the array</span></div>
<div class="fragment"><div class="line"><span class="lineno"> 50</span>{-1}; <span class="comment">///&lt; Index of head of the array</span></div>
</div><!-- fragment -->
</div>
</div>
@@ -340,7 +340,7 @@ Here is the call graph for this function:</div>
</div><div class="memdoc">
<p>Index of tail of the array. </p>
<div class="fragment"><div class="line"><span class="lineno"> 50</span>{-1}; <span class="comment">///&lt; Index of tail of the array</span></div>
<div class="fragment"><div class="line"><span class="lineno"> 51</span>{-1}; <span class="comment">///&lt; Index of tail of the array</span></div>
</div><!-- fragment -->
</div>
</div>

View File

@@ -108,13 +108,16 @@ $(function(){initNavTree('d6/d0c/namespacehashing.html','../../'); initResizable
</div><!--header-->
<div class="contents">
<p>Hashing algorithms.
<p>Used for assert.
<a href="#details">More...</a></p>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Hashing algorithms. </p>
<div class="textblock"><p>Used for assert. </p>
<p>For <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>.</p>
<p>Used for <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/copy.html">std::copy</a> Used for <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/array.html">std::array</a> Used for assert Used for std::memcopy Used for IO operations Used for strings Used for <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a></p>
<p>For <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/copy.html">std::copy</a> For <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/array.html">std::array</a> For assert For std::memcopy For IO operations For strings For <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a></p>
<p>For assert.</p>
<p>Used for <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/copy.html">std::copy</a> Used for <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/array.html">std::array</a> Used for std::memcopy Used for IO operations Used for strings Used for <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a></p>
<p>Hashing algorithms</p>
<p>For <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/copy.html">std::copy</a> For <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/array.html">std::array</a> For std::memcopy For IO operations For strings For <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a></p>
<p>Hashing algorithms</p>
<p>For <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/array.html">std::array</a> For assert For uint8_t, uint32_t and uint64_t data types For <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/setfill.html">std::setfill</a> and <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/setw.html">std::setw</a> For IO operations For <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_stringstream.html">std::stringstream</a> For <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/move.html">std::move</a></p>
<p>Hashing algorithms </p>
</div></div><!-- contents -->

View File

@@ -115,12 +115,13 @@ $(function(){initNavTree('d6/d1a/dnf__sort_8cpp.html','../../'); initResizable(t
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &lt;algorithm&gt;</code><br />
<code>#include &lt;cassert&gt;</code><br />
<code>#include &lt;cstdint&gt;</code><br />
<code>#include &lt;iostream&gt;</code><br />
<code>#include &lt;vector&gt;</code><br />
</div><div class="textblock"><div class="dynheader">
Include dependency graph for dnf_sort.cpp:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../df/d14/dnf__sort_8cpp__incl.svg" width="350" height="111"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
<div class="center"><iframe scrolling="no" frameborder="0" src="../../df/d14/dnf__sort_8cpp__incl.svg" width="434" height="111"><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">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="namespaces" name="namespaces"></a>
@@ -181,34 +182,34 @@ template&lt;typename T &gt; </div>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>void </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 38</span> {</div>
<div class="line"><span class="lineno"> 39</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;T&gt;</a> arr(in_arr);</div>
<div class="line"><span class="lineno"> 40</span> uint64_t lo = 0;</div>
<div class="line"><span class="lineno"> 41</span> uint64_t hi = arr.size() - 1;</div>
<div class="line"><span class="lineno"> 42</span> uint64_t mid = 0;</div>
<div class="line"><span class="lineno"> 43</span> </div>
<div class="line"><span class="lineno"> 44</span> <span class="comment">// Iterate till all the elements</span></div>
<div class="line"><span class="lineno"> 45</span> <span class="comment">// are sorted</span></div>
<div class="line"><span class="lineno"> 46</span> <span class="keywordflow">while</span> (mid &lt;= hi) {</div>
<div class="line"><span class="lineno"> 47</span> <span class="keywordflow">switch</span> (arr[mid]) {</div>
<div class="line"><span class="lineno"> 48</span> <span class="comment">// If the element is 0</span></div>
<div class="line"><span class="lineno"> 49</span> <span class="keywordflow">case</span> 0:</div>
<div class="line"><span class="lineno"> 50</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/swap.html">std::swap</a>(arr[lo++], arr[mid++]);</div>
<div class="line"><span class="lineno"> 51</span> <span class="keywordflow">break</span>;</div>
<div class="line"><span class="lineno"> 52</span> </div>
<div class="line"><span class="lineno"> 53</span> <span class="comment">// If the element is 1 .</span></div>
<div class="line"><span class="lineno"> 54</span> <span class="keywordflow">case</span> 1:</div>
<div class="line"><span class="lineno"> 55</span> mid++;</div>
<div class="line"><span class="lineno"> 56</span> <span class="keywordflow">break</span>;</div>
<div class="line"><span class="lineno"> 57</span> </div>
<div class="line"><span class="lineno"> 58</span> <span class="comment">// If the element is 2</span></div>
<div class="line"><span class="lineno"> 59</span> <span class="keywordflow">case</span> 2:</div>
<div class="line"><span class="lineno"> 60</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/swap.html">std::swap</a>(arr[mid], arr[hi--]);</div>
<div class="line"><span class="lineno"> 61</span> <span class="keywordflow">break</span>;</div>
<div class="line"><span class="lineno"> 62</span> }</div>
<div class="line"><span class="lineno"> 63</span> }</div>
<div class="line"><span class="lineno"> 64</span> <span class="keywordflow">return</span> arr;</div>
<div class="line"><span class="lineno"> 65</span>}</div>
<div class="fragment"><div class="line"><span class="lineno"> 39</span> {</div>
<div class="line"><span class="lineno"> 40</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;T&gt;</a> arr(in_arr);</div>
<div class="line"><span class="lineno"> 41</span> uint64_t lo = 0;</div>
<div class="line"><span class="lineno"> 42</span> uint64_t hi = arr.size() - 1;</div>
<div class="line"><span class="lineno"> 43</span> uint64_t mid = 0;</div>
<div class="line"><span class="lineno"> 44</span> </div>
<div class="line"><span class="lineno"> 45</span> <span class="comment">// Iterate till all the elements</span></div>
<div class="line"><span class="lineno"> 46</span> <span class="comment">// are sorted</span></div>
<div class="line"><span class="lineno"> 47</span> <span class="keywordflow">while</span> (mid &lt;= hi) {</div>
<div class="line"><span class="lineno"> 48</span> <span class="keywordflow">switch</span> (arr[mid]) {</div>
<div class="line"><span class="lineno"> 49</span> <span class="comment">// If the element is 0</span></div>
<div class="line"><span class="lineno"> 50</span> <span class="keywordflow">case</span> 0:</div>
<div class="line"><span class="lineno"> 51</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/swap.html">std::swap</a>(arr[lo++], arr[mid++]);</div>
<div class="line"><span class="lineno"> 52</span> <span class="keywordflow">break</span>;</div>
<div class="line"><span class="lineno"> 53</span> </div>
<div class="line"><span class="lineno"> 54</span> <span class="comment">// If the element is 1 .</span></div>
<div class="line"><span class="lineno"> 55</span> <span class="keywordflow">case</span> 1:</div>
<div class="line"><span class="lineno"> 56</span> mid++;</div>
<div class="line"><span class="lineno"> 57</span> <span class="keywordflow">break</span>;</div>
<div class="line"><span class="lineno"> 58</span> </div>
<div class="line"><span class="lineno"> 59</span> <span class="comment">// If the element is 2</span></div>
<div class="line"><span class="lineno"> 60</span> <span class="keywordflow">case</span> 2:</div>
<div class="line"><span class="lineno"> 61</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/swap.html">std::swap</a>(arr[mid], arr[hi--]);</div>
<div class="line"><span class="lineno"> 62</span> <span class="keywordflow">break</span>;</div>
<div class="line"><span class="lineno"> 63</span> }</div>
<div class="line"><span class="lineno"> 64</span> }</div>
<div class="line"><span class="lineno"> 65</span> <span class="keywordflow">return</span> arr;</div>
<div class="line"><span class="lineno"> 66</span>}</div>
<div class="ttc" id="aswap_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/algorithm/swap.html">std::swap</a></div><div class="ttdeci">T swap(T... args)</div></div>
<div class="ttc" id="avector_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a></div></div>
</div><!-- fragment --><div class="dynheader">
@@ -236,11 +237,11 @@ 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>
<div class="fragment"><div class="line"><span class="lineno"> 108</span> {</div>
<div class="line"><span class="lineno"> 109</span> <a class="code hl_function" href="#aa8dca7b867074164d5f45b0f3851269d">test</a>(); <span class="comment">// execute the test</span></div>
<div class="line"><span class="lineno"> 110</span> <span class="keywordflow">return</span> 0;</div>
<div class="line"><span class="lineno"> 111</span>}</div>
<div class="ttc" id="adnf__sort_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> dnf_sort.cpp:73</div></div>
<div class="fragment"><div class="line"><span class="lineno"> 109</span> {</div>
<div class="line"><span class="lineno"> 110</span> <a class="code hl_function" href="#aa8dca7b867074164d5f45b0f3851269d">test</a>(); <span class="comment">// execute the test</span></div>
<div class="line"><span class="lineno"> 111</span> <span class="keywordflow">return</span> 0;</div>
<div class="line"><span class="lineno"> 112</span>}</div>
<div class="ttc" id="adnf__sort_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> dnf_sort.cpp:74</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
@@ -274,39 +275,39 @@ 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>
<div class="fragment"><div class="line"><span class="lineno"> 73</span> {</div>
<div class="line"><span class="lineno"> 74</span> <span class="comment">// 1st test</span></div>
<div class="line"><span class="lineno"> 75</span> <span class="comment">// [1, 0, 2, 1] return [0, 1, 1, 2]</span></div>
<div class="line"><span class="lineno"> 76</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;uint64_t&gt;</a> array1 = {0, 1, 1, 2};</div>
<div class="line"><span class="lineno"> 77</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 1... &quot;</span>;</div>
<div class="line"><span class="lineno"> 78</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;uint64_t&gt;</a> arr1 = <a class="code hl_function" href="#a621767fe711db64fe57a2ac4987b11f0">sorting::dnf_sort::dnfSort</a>(array1);</div>
<div class="line"><span class="lineno"> 79</span> assert(<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/is_sorted.html">std::is_sorted</a>(<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/begin.html">std::begin</a>(arr1), <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/end.html">std::end</a>(arr1)));</div>
<div class="line"><span class="lineno"> 80</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;passed&quot;</span> &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><span class="lineno"> 81</span> <span class="comment">// 2nd test</span></div>
<div class="line"><span class="lineno"> 82</span> <span class="comment">// [1, 0, 0, 1, 1, 0, 2, 1] return [0, 0, 0, 1, 1, 1, 1, 2]</span></div>
<div class="line"><span class="lineno"> 83</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;uint64_t&gt;</a> array2 = {1, 0, 0, 1, 1, 0, 2, 1};</div>
<div class="line"><span class="lineno"> 84</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 2... &quot;</span>;</div>
<div class="line"><span class="lineno"> 85</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;uint64_t&gt;</a> arr2 = <a class="code hl_function" href="#a621767fe711db64fe57a2ac4987b11f0">sorting::dnf_sort::dnfSort</a>(array2);</div>
<div class="line"><span class="lineno"> 86</span> assert(<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/is_sorted.html">std::is_sorted</a>(<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/begin.html">std::begin</a>(arr2), <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/end.html">std::end</a>(arr2)));</div>
<div class="line"><span class="lineno"> 87</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;passed&quot;</span> &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><span class="lineno"> 88</span> <span class="comment">// 3rd test</span></div>
<div class="line"><span class="lineno"> 89</span> <span class="comment">// [1, 1, 0, 0, 1, 2, 2, 0, 2, 1] return [0, 0, 0, 1, 1, 1, 1, 2, 2, 2]</span></div>
<div class="line"><span class="lineno"> 90</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;uint64_t&gt;</a> array3 = {1, 1, 0, 0, 1, 2, 2, 0, 2, 1};</div>
<div class="line"><span class="lineno"> 91</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 3... &quot;</span>;</div>
<div class="line"><span class="lineno"> 92</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;uint64_t&gt;</a> arr3 = <a class="code hl_function" href="#a621767fe711db64fe57a2ac4987b11f0">sorting::dnf_sort::dnfSort</a>(array3);</div>
<div class="line"><span class="lineno"> 93</span> assert(<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/is_sorted.html">std::is_sorted</a>(<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/begin.html">std::begin</a>(arr3), <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/end.html">std::end</a>(arr3)));</div>
<div class="line"><span class="lineno"> 94</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;passed&quot;</span> &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><span class="lineno"> 95</span> <span class="comment">// 4th test</span></div>
<div class="line"><span class="lineno"> 96</span> <span class="comment">// [2, 2, 2, 0, 0, 1, 1] return [0, 0, 1, 1, 2, 2, 2]</span></div>
<div class="line"><span class="lineno"> 97</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;uint64_t&gt;</a> array4 = {2, 2, 2, 0, 0, 1, 1};</div>
<div class="line"><span class="lineno"> 98</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 4... &quot;</span>;</div>
<div class="line"><span class="lineno"> 99</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;uint64_t&gt;</a> arr4 = <a class="code hl_function" href="#a621767fe711db64fe57a2ac4987b11f0">sorting::dnf_sort::dnfSort</a>(array4);</div>
<div class="line"><span class="lineno"> 100</span> assert(<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/is_sorted.html">std::is_sorted</a>(<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/begin.html">std::begin</a>(arr4), <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/end.html">std::end</a>(arr4)));</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;passed&quot;</span> &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><span class="lineno"> 102</span>}</div>
<div class="fragment"><div class="line"><span class="lineno"> 74</span> {</div>
<div class="line"><span class="lineno"> 75</span> <span class="comment">// 1st test</span></div>
<div class="line"><span class="lineno"> 76</span> <span class="comment">// [1, 0, 2, 1] return [0, 1, 1, 2]</span></div>
<div class="line"><span class="lineno"> 77</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;uint64_t&gt;</a> array1 = {0, 1, 1, 2};</div>
<div class="line"><span class="lineno"> 78</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 1... &quot;</span>;</div>
<div class="line"><span class="lineno"> 79</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;uint64_t&gt;</a> arr1 = <a class="code hl_function" href="#a621767fe711db64fe57a2ac4987b11f0">sorting::dnf_sort::dnfSort</a>(array1);</div>
<div class="line"><span class="lineno"> 80</span> assert(<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/is_sorted.html">std::is_sorted</a>(<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/begin.html">std::begin</a>(arr1), <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/end.html">std::end</a>(arr1)));</div>
<div class="line"><span class="lineno"> 81</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;passed&quot;</span> &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><span class="lineno"> 82</span> <span class="comment">// 2nd test</span></div>
<div class="line"><span class="lineno"> 83</span> <span class="comment">// [1, 0, 0, 1, 1, 0, 2, 1] return [0, 0, 0, 1, 1, 1, 1, 2]</span></div>
<div class="line"><span class="lineno"> 84</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;uint64_t&gt;</a> array2 = {1, 0, 0, 1, 1, 0, 2, 1};</div>
<div class="line"><span class="lineno"> 85</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 2... &quot;</span>;</div>
<div class="line"><span class="lineno"> 86</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;uint64_t&gt;</a> arr2 = <a class="code hl_function" href="#a621767fe711db64fe57a2ac4987b11f0">sorting::dnf_sort::dnfSort</a>(array2);</div>
<div class="line"><span class="lineno"> 87</span> assert(<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/is_sorted.html">std::is_sorted</a>(<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/begin.html">std::begin</a>(arr2), <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/end.html">std::end</a>(arr2)));</div>
<div class="line"><span class="lineno"> 88</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;passed&quot;</span> &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><span class="lineno"> 89</span> <span class="comment">// 3rd test</span></div>
<div class="line"><span class="lineno"> 90</span> <span class="comment">// [1, 1, 0, 0, 1, 2, 2, 0, 2, 1] return [0, 0, 0, 1, 1, 1, 1, 2, 2, 2]</span></div>
<div class="line"><span class="lineno"> 91</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;uint64_t&gt;</a> array3 = {1, 1, 0, 0, 1, 2, 2, 0, 2, 1};</div>
<div class="line"><span class="lineno"> 92</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 3... &quot;</span>;</div>
<div class="line"><span class="lineno"> 93</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;uint64_t&gt;</a> arr3 = <a class="code hl_function" href="#a621767fe711db64fe57a2ac4987b11f0">sorting::dnf_sort::dnfSort</a>(array3);</div>
<div class="line"><span class="lineno"> 94</span> assert(<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/is_sorted.html">std::is_sorted</a>(<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/begin.html">std::begin</a>(arr3), <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/end.html">std::end</a>(arr3)));</div>
<div class="line"><span class="lineno"> 95</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;passed&quot;</span> &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><span class="lineno"> 96</span> <span class="comment">// 4th test</span></div>
<div class="line"><span class="lineno"> 97</span> <span class="comment">// [2, 2, 2, 0, 0, 1, 1] return [0, 0, 1, 1, 2, 2, 2]</span></div>
<div class="line"><span class="lineno"> 98</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;uint64_t&gt;</a> array4 = {2, 2, 2, 0, 0, 1, 1};</div>
<div class="line"><span class="lineno"> 99</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 4... &quot;</span>;</div>
<div class="line"><span class="lineno"> 100</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;uint64_t&gt;</a> arr4 = <a class="code hl_function" href="#a621767fe711db64fe57a2ac4987b11f0">sorting::dnf_sort::dnfSort</a>(array4);</div>
<div class="line"><span class="lineno"> 101</span> assert(<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/is_sorted.html">std::is_sorted</a>(<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/begin.html">std::begin</a>(arr4), <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/end.html">std::end</a>(arr4)));</div>
<div class="line"><span class="lineno"> 102</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;passed&quot;</span> &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><span class="lineno"> 103</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="abegin_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/iterator/begin.html">std::begin</a></div><div class="ttdeci">T begin(T... args)</div></div>
<div class="ttc" id="adnf__sort_8cpp_html_a621767fe711db64fe57a2ac4987b11f0"><div class="ttname"><a href="#a621767fe711db64fe57a2ac4987b11f0">sorting::dnf_sort::dnfSort</a></div><div class="ttdeci">std::vector&lt; T &gt; dnfSort(const std::vector&lt; T &gt; &amp;in_arr)</div><div class="ttdoc">The main function implements DNF sort.</div><div class="ttdef"><b>Definition</b> dnf_sort.cpp:38</div></div>
<div class="ttc" id="adnf__sort_8cpp_html_a621767fe711db64fe57a2ac4987b11f0"><div class="ttname"><a href="#a621767fe711db64fe57a2ac4987b11f0">sorting::dnf_sort::dnfSort</a></div><div class="ttdeci">std::vector&lt; T &gt; dnfSort(const std::vector&lt; T &gt; &amp;in_arr)</div><div class="ttdoc">The main function implements DNF sort.</div><div class="ttdef"><b>Definition</b> dnf_sort.cpp:39</div></div>
<div class="ttc" id="aend_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/iterator/end.html">std::end</a></div><div class="ttdeci">T end(T... args)</div></div>
<div class="ttc" id="aendl_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a></div><div class="ttdeci">T endl(T... args)</div></div>
<div class="ttc" id="ais_sorted_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/algorithm/is_sorted.html">std::is_sorted</a></div><div class="ttdeci">T is_sorted(T... args)</div></div>

View File

@@ -204,42 +204,42 @@ Static Private Member Functions</h2></td></tr>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>encrypted/decrypted output </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 211</span> {</div>
<div class="line"><span class="lineno"> 212</span> <span class="keywordtype">size_t</span> text_len = text.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string/size.html">length</a>();</div>
<div class="line"><span class="lineno"> 213</span> <span class="keywordtype">size_t</span> key_len = key.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>();</div>
<div class="line"><span class="lineno"> 214</span> </div>
<div class="line"><span class="lineno"> 215</span> <span class="comment">// length of output string must be a multiple of key_len</span></div>
<div class="line"><span class="lineno"> 216</span> <span class="comment">// create output string and initialize with &#39;\0&#39; character</span></div>
<div class="line"><span class="lineno"> 217</span> <span class="keywordtype">size_t</span> L2 = text_len % key_len == 0</div>
<div class="line"><span class="lineno"> 218</span> ? text_len</div>
<div class="line"><span class="lineno"> 219</span> : text_len + key_len - (text_len % key_len);</div>
<div class="line"><span class="lineno"> 220</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> coded_text(L2, <span class="charliteral">&#39;\0&#39;</span>);</div>
<div class="line"><span class="lineno"> 221</span> </div>
<div class="line"><span class="lineno"> 222</span> <span class="comment">// temporary array for batch processing</span></div>
<div class="line"><span class="lineno"> 223</span> <span class="keywordtype">int</span> i;</div>
<div class="line"><span class="lineno"> 224</span><span class="preprocessor">#ifdef _OPENMP</span></div>
<div class="line"><span class="lineno"> 225</span><span class="preprocessor">#pragma parallel omp for private(i)</span></div>
<div class="line"><span class="lineno"> 226</span><span class="preprocessor">#endif</span></div>
<div class="line"><span class="lineno"> 227</span> <span class="keywordflow">for</span> (i = 0; i &lt; L2 - key_len + 1; i += key_len) {</div>
<div class="line"><span class="lineno"> 228</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray&lt;uint8_t&gt;</a> batch_int(key_len);</div>
<div class="line"><span class="lineno"> 229</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> j = 0; j &lt; key_len; j++) {</div>
<div class="line"><span class="lineno"> 230</span> batch_int[j] = <a class="code hl_function" href="#ae77cad522fa44b8c985779a7188d2f41">get_char_idx</a>(text[i + j]);</div>
<div class="line"><span class="lineno"> 231</span> }</div>
<div class="line"><span class="lineno"> 232</span> </div>
<div class="line"><span class="lineno"> 233</span> batch_int = <a class="code hl_function" href="#ad36cbcc7a458b3f3a2af0c4aa1126590">mat_mul</a>(batch_int, key);</div>
<div class="line"><span class="lineno"> 234</span> </div>
<div class="line"><span class="lineno"> 235</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> j = 0; j &lt; key_len; j++) {</div>
<div class="line"><span class="lineno"> 236</span> coded_text[i + j] =</div>
<div class="line"><span class="lineno"> 237</span> <a class="code hl_variable" href="../../d6/d4e/namespaceciphers.html#ab9aec0ccf4b6809f652bb540be87c216">STRKEY</a>[batch_int[j]]; <span class="comment">// get character at key</span></div>
<div class="line"><span class="lineno"> 238</span> }</div>
<div class="line"><span class="lineno"> 239</span> }</div>
<div class="line"><span class="lineno"> 240</span> </div>
<div class="line"><span class="lineno"> 241</span> <span class="keywordflow">return</span> coded_text;</div>
<div class="line"><span class="lineno"> 242</span> }</div>
<div class="fragment"><div class="line"><span class="lineno"> 212</span> {</div>
<div class="line"><span class="lineno"> 213</span> <span class="keywordtype">size_t</span> text_len = text.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string/size.html">length</a>();</div>
<div class="line"><span class="lineno"> 214</span> <span class="keywordtype">size_t</span> key_len = key.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>();</div>
<div class="line"><span class="lineno"> 215</span> </div>
<div class="line"><span class="lineno"> 216</span> <span class="comment">// length of output string must be a multiple of key_len</span></div>
<div class="line"><span class="lineno"> 217</span> <span class="comment">// create output string and initialize with &#39;\0&#39; character</span></div>
<div class="line"><span class="lineno"> 218</span> <span class="keywordtype">size_t</span> L2 = text_len % key_len == 0</div>
<div class="line"><span class="lineno"> 219</span> ? text_len</div>
<div class="line"><span class="lineno"> 220</span> : text_len + key_len - (text_len % key_len);</div>
<div class="line"><span class="lineno"> 221</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> coded_text(L2, <span class="charliteral">&#39;\0&#39;</span>);</div>
<div class="line"><span class="lineno"> 222</span> </div>
<div class="line"><span class="lineno"> 223</span> <span class="comment">// temporary array for batch processing</span></div>
<div class="line"><span class="lineno"> 224</span> <span class="keywordtype">int</span> i;</div>
<div class="line"><span class="lineno"> 225</span><span class="preprocessor">#ifdef _OPENMP</span></div>
<div class="line"><span class="lineno"> 226</span><span class="preprocessor">#pragma parallel omp for private(i)</span></div>
<div class="line"><span class="lineno"> 227</span><span class="preprocessor">#endif</span></div>
<div class="line"><span class="lineno"> 228</span> <span class="keywordflow">for</span> (i = 0; i &lt; L2 - key_len + 1; i += key_len) {</div>
<div class="line"><span class="lineno"> 229</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray&lt;uint8_t&gt;</a> batch_int(key_len);</div>
<div class="line"><span class="lineno"> 230</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> j = 0; j &lt; key_len; j++) {</div>
<div class="line"><span class="lineno"> 231</span> batch_int[j] = <a class="code hl_function" href="#ae77cad522fa44b8c985779a7188d2f41">get_char_idx</a>(text[i + j]);</div>
<div class="line"><span class="lineno"> 232</span> }</div>
<div class="line"><span class="lineno"> 233</span> </div>
<div class="line"><span class="lineno"> 234</span> batch_int = <a class="code hl_function" href="#ad36cbcc7a458b3f3a2af0c4aa1126590">mat_mul</a>(batch_int, key);</div>
<div class="line"><span class="lineno"> 235</span> </div>
<div class="line"><span class="lineno"> 236</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> j = 0; j &lt; key_len; j++) {</div>
<div class="line"><span class="lineno"> 237</span> coded_text[i + j] =</div>
<div class="line"><span class="lineno"> 238</span> <a class="code hl_variable" href="../../d6/d4e/namespaceciphers.html#ab9aec0ccf4b6809f652bb540be87c216">STRKEY</a>[batch_int[j]]; <span class="comment">// get character at key</span></div>
<div class="line"><span class="lineno"> 239</span> }</div>
<div class="line"><span class="lineno"> 240</span> }</div>
<div class="line"><span class="lineno"> 241</span> </div>
<div class="line"><span class="lineno"> 242</span> <span class="keywordflow">return</span> coded_text;</div>
<div class="line"><span class="lineno"> 243</span> }</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="aclassciphers_1_1_hill_cipher_html_ad36cbcc7a458b3f3a2af0c4aa1126590"><div class="ttname"><a href="#ad36cbcc7a458b3f3a2af0c4aa1126590">ciphers::HillCipher::mat_mul</a></div><div class="ttdeci">static const std::valarray&lt; uint8_t &gt; mat_mul(const std::valarray&lt; uint8_t &gt; &amp;vector, const matrix&lt; int &gt; &amp;key)</div><div class="ttdoc">helper function to perform vector multiplication with encryption or decryption matrix</div><div class="ttdef"><b>Definition</b> hill_cipher.cpp:159</div></div>
<div class="ttc" id="aclassciphers_1_1_hill_cipher_html_ae77cad522fa44b8c985779a7188d2f41"><div class="ttname"><a href="#ae77cad522fa44b8c985779a7188d2f41">ciphers::HillCipher::get_char_idx</a></div><div class="ttdeci">static uint8_t get_char_idx(const char ch)</div><div class="ttdoc">Get the index of a character in the STRKEY.</div><div class="ttdef"><b>Definition</b> hill_cipher.cpp:190</div></div>
<div class="ttc" id="anamespaceciphers_html_ab9aec0ccf4b6809f652bb540be87c216"><div class="ttname"><a href="../../d6/d4e/namespaceciphers.html#ab9aec0ccf4b6809f652bb540be87c216">ciphers::STRKEY</a></div><div class="ttdeci">static const char * STRKEY</div><div class="ttdef"><b>Definition</b> hill_cipher.cpp:73</div></div>
<div class="ttc" id="aclassciphers_1_1_hill_cipher_html_ad36cbcc7a458b3f3a2af0c4aa1126590"><div class="ttname"><a href="#ad36cbcc7a458b3f3a2af0c4aa1126590">ciphers::HillCipher::mat_mul</a></div><div class="ttdeci">static const std::valarray&lt; uint8_t &gt; mat_mul(const std::valarray&lt; uint8_t &gt; &amp;vector, const matrix&lt; int &gt; &amp;key)</div><div class="ttdoc">helper function to perform vector multiplication with encryption or decryption matrix</div><div class="ttdef"><b>Definition</b> hill_cipher.cpp:160</div></div>
<div class="ttc" id="aclassciphers_1_1_hill_cipher_html_ae77cad522fa44b8c985779a7188d2f41"><div class="ttname"><a href="#ae77cad522fa44b8c985779a7188d2f41">ciphers::HillCipher::get_char_idx</a></div><div class="ttdeci">static uint8_t get_char_idx(const char ch)</div><div class="ttdoc">Get the index of a character in the STRKEY.</div><div class="ttdef"><b>Definition</b> hill_cipher.cpp:191</div></div>
<div class="ttc" id="anamespaceciphers_html_ab9aec0ccf4b6809f652bb540be87c216"><div class="ttname"><a href="../../d6/d4e/namespaceciphers.html#ab9aec0ccf4b6809f652bb540be87c216">ciphers::STRKEY</a></div><div class="ttdeci">static const char * STRKEY</div><div class="ttdef"><b>Definition</b> hill_cipher.cpp:74</div></div>
<div class="ttc" id="asize_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/string/basic_string/size.html">std::string::length</a></div><div class="ttdeci">T length(T... args)</div></div>
<div class="ttc" id="avalarray_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray</a></div></div>
</div><!-- fragment --><div class="dynheader">
@@ -286,10 +286,10 @@ Here is the call graph for this function:</div>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>decrypted text </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 458</span> {</div>
<div class="line"><span class="lineno"> 459</span> <span class="keywordflow">return</span> <a class="code hl_function" href="#ad667fa0860977f6d6d443fa1dbcd80aa">codec</a>(text, decrypt_key);</div>
<div class="line"><span class="lineno"> 460</span> }</div>
<div class="ttc" id="aclassciphers_1_1_hill_cipher_html_ad667fa0860977f6d6d443fa1dbcd80aa"><div class="ttname"><a href="#ad667fa0860977f6d6d443fa1dbcd80aa">ciphers::HillCipher::codec</a></div><div class="ttdeci">static const std::string codec(const std::string &amp;text, const matrix&lt; int &gt; &amp;key)</div><div class="ttdoc">Convenience function to perform block cipher operations. The operations are identical for both encryp...</div><div class="ttdef"><b>Definition</b> hill_cipher.cpp:210</div></div>
<div class="fragment"><div class="line"><span class="lineno"> 459</span> {</div>
<div class="line"><span class="lineno"> 460</span> <span class="keywordflow">return</span> <a class="code hl_function" href="#ad667fa0860977f6d6d443fa1dbcd80aa">codec</a>(text, decrypt_key);</div>
<div class="line"><span class="lineno"> 461</span> }</div>
<div class="ttc" id="aclassciphers_1_1_hill_cipher_html_ad667fa0860977f6d6d443fa1dbcd80aa"><div class="ttname"><a href="#ad667fa0860977f6d6d443fa1dbcd80aa">ciphers::HillCipher::codec</a></div><div class="ttdeci">static const std::string codec(const std::string &amp;text, const matrix&lt; int &gt; &amp;key)</div><div class="ttdoc">Convenience function to perform block cipher operations. The operations are identical for both encryp...</div><div class="ttdef"><b>Definition</b> hill_cipher.cpp:211</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
@@ -334,9 +334,9 @@ Here is the call graph for this function:</div>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>encrypted text </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 446</span> {</div>
<div class="line"><span class="lineno"> 447</span> <span class="keywordflow">return</span> <a class="code hl_function" href="#ad667fa0860977f6d6d443fa1dbcd80aa">codec</a>(text, encrypt_key);</div>
<div class="line"><span class="lineno"> 448</span> }</div>
<div class="fragment"><div class="line"><span class="lineno"> 447</span> {</div>
<div class="line"><span class="lineno"> 448</span> <span class="keywordflow">return</span> <a class="code hl_function" href="#ad667fa0860977f6d6d443fa1dbcd80aa">codec</a>(text, encrypt_key);</div>
<div class="line"><span class="lineno"> 449</span> }</div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
@@ -383,18 +383,18 @@ template&lt;typename T &gt; </div>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>GCD of \(a\) and \(b\) </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 138</span> {</div>
<div class="line"><span class="lineno"> 139</span> <span class="keywordflow">if</span> (b &gt; a) <span class="comment">// ensure always a &lt; b</span></div>
<div class="line"><span class="lineno"> 140</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/swap.html">std::swap</a>(a, b);</div>
<div class="line"><span class="lineno"> 141</span> </div>
<div class="line"><span class="lineno"> 142</span> <span class="keywordflow">while</span> (b != 0) {</div>
<div class="line"><span class="lineno"> 143</span> T tmp = b;</div>
<div class="line"><span class="lineno"> 144</span> b = a % b;</div>
<div class="line"><span class="lineno"> 145</span> a = tmp;</div>
<div class="line"><span class="lineno"> 146</span> }</div>
<div class="line"><span class="lineno"> 147</span> </div>
<div class="line"><span class="lineno"> 148</span> <span class="keywordflow">return</span> a;</div>
<div class="line"><span class="lineno"> 149</span> }</div>
<div class="fragment"><div class="line"><span class="lineno"> 139</span> {</div>
<div class="line"><span class="lineno"> 140</span> <span class="keywordflow">if</span> (b &gt; a) <span class="comment">// ensure always a &lt; b</span></div>
<div class="line"><span class="lineno"> 141</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/swap.html">std::swap</a>(a, b);</div>
<div class="line"><span class="lineno"> 142</span> </div>
<div class="line"><span class="lineno"> 143</span> <span class="keywordflow">while</span> (b != 0) {</div>
<div class="line"><span class="lineno"> 144</span> T tmp = b;</div>
<div class="line"><span class="lineno"> 145</span> b = a % b;</div>
<div class="line"><span class="lineno"> 146</span> a = tmp;</div>
<div class="line"><span class="lineno"> 147</span> }</div>
<div class="line"><span class="lineno"> 148</span> </div>
<div class="line"><span class="lineno"> 149</span> <span class="keywordflow">return</span> a;</div>
<div class="line"><span class="lineno"> 150</span> }</div>
<div class="ttc" id="aswap_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/algorithm/swap.html">std::swap</a></div><div class="ttdeci">T swap(T... args)</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
@@ -435,49 +435,49 @@ Here is the call graph for this function:</div>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Decryption martix </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 371</span> {</div>
<div class="line"><span class="lineno"> 372</span> <span class="keywordtype">size_t</span> size = encrypt_key.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>();</div>
<div class="line"><span class="lineno"> 373</span> <span class="keywordtype">int</span> L = <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/byte/strlen.html">std::strlen</a>(<a class="code hl_variable" href="../../d6/d4e/namespaceciphers.html#ab9aec0ccf4b6809f652bb540be87c216">STRKEY</a>);</div>
<div class="line"><span class="lineno"> 374</span> </div>
<div class="line"><span class="lineno"> 375</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">matrix&lt;int&gt;</a> decrypt_key(size, <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray&lt;int&gt;</a>(size));</div>
<div class="line"><span class="lineno"> 376</span> <span class="keywordtype">int</span> det_encrypt = <span class="keyword">static_cast&lt;</span><span class="keywordtype">int</span><span class="keyword">&gt;</span>(<a class="code hl_function" href="../../d1/dbe/lu__decomposition_8h.html#a3108d43bd32c6fb3b3c158476c51ba7f">determinant_lu</a>(encrypt_key));</div>
<div class="line"><span class="lineno"> 377</span> </div>
<div class="line"><span class="lineno"> 378</span> <span class="keywordtype">int</span> mat_determinant = det_encrypt &lt; 0 ? det_encrypt % L : det_encrypt;</div>
<div class="line"><span class="lineno"> 379</span> </div>
<div class="line"><span class="lineno"> 380</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">matrix&lt;double&gt;</a> tmp_inverse = <a class="code hl_function" href="#a2eb58750b978a93ac5e6eb29e3e570b7">get_inverse</a>(encrypt_key);</div>
<div class="line"><span class="lineno"> 381</span> <span class="keywordtype">double</span> d2 = <a class="code hl_function" href="../../d1/dbe/lu__decomposition_8h.html#a3108d43bd32c6fb3b3c158476c51ba7f">determinant_lu</a>(decrypt_key);</div>
<div class="line"><span class="lineno"> 382</span> </div>
<div class="line"><span class="lineno"> 383</span> <span class="comment">// find co-prime factor for inversion</span></div>
<div class="line"><span class="lineno"> 384</span> <span class="keywordtype">int</span> det_inv = -1;</div>
<div class="line"><span class="lineno"> 385</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; L; i++) {</div>
<div class="line"><span class="lineno"> 386</span> <span class="keywordflow">if</span> (modulo(mat_determinant * i, L) == 1) {</div>
<div class="line"><span class="lineno"> 387</span> det_inv = i;</div>
<div class="line"><span class="lineno"> 388</span> <span class="keywordflow">break</span>;</div>
<div class="line"><span class="lineno"> 389</span> }</div>
<div class="line"><span class="lineno"> 390</span> }</div>
<div class="line"><span class="lineno"> 391</span> </div>
<div class="line"><span class="lineno"> 392</span> <span class="keywordflow">if</span> (det_inv == -1) {</div>
<div class="line"><span class="lineno"> 393</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cerr</a> &lt;&lt; <span class="stringliteral">&quot;Could not find a co-prime for inversion\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 394</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/program/exit.html">std::exit</a>(EXIT_FAILURE);</div>
<div class="line"><span class="lineno"> 395</span> }</div>
<div class="line"><span class="lineno"> 396</span> </div>
<div class="line"><span class="lineno"> 397</span> mat_determinant = det_inv * det_encrypt;</div>
<div class="line"><span class="lineno"> 398</span> </div>
<div class="line"><span class="lineno"> 399</span> <span class="comment">// perform modular inverse of encryption matrix</span></div>
<div class="line"><span class="lineno"> 400</span> <span class="keywordtype">int</span> i;</div>
<div class="line"><span class="lineno"> 401</span><span class="preprocessor">#ifdef _OPENMP</span></div>
<div class="line"><span class="lineno"> 402</span><span class="preprocessor">#pragma parallel omp for private(i)</span></div>
<div class="line"><span class="lineno"> 403</span><span class="preprocessor">#endif</span></div>
<div class="line"><span class="lineno"> 404</span> <span class="keywordflow">for</span> (i = 0; i &lt; size; i++) {</div>
<div class="line"><span class="lineno"> 405</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 0; j &lt; size; j++) {</div>
<div class="line"><span class="lineno"> 406</span> <span class="keywordtype">int</span> temp = <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/math/round.html">std::round</a>(tmp_inverse[i][j] * mat_determinant);</div>
<div class="line"><span class="lineno"> 407</span> decrypt_key[i][j] = modulo(temp, L);</div>
<div class="line"><span class="lineno"> 408</span> }</div>
<div class="line"><span class="lineno"> 409</span> }</div>
<div class="line"><span class="lineno"> 410</span> <span class="keywordflow">return</span> decrypt_key;</div>
<div class="line"><span class="lineno"> 411</span> }</div>
<div class="fragment"><div class="line"><span class="lineno"> 372</span> {</div>
<div class="line"><span class="lineno"> 373</span> <span class="keywordtype">size_t</span> size = encrypt_key.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>();</div>
<div class="line"><span class="lineno"> 374</span> <span class="keywordtype">int</span> L = <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/byte/strlen.html">std::strlen</a>(<a class="code hl_variable" href="../../d6/d4e/namespaceciphers.html#ab9aec0ccf4b6809f652bb540be87c216">STRKEY</a>);</div>
<div class="line"><span class="lineno"> 375</span> </div>
<div class="line"><span class="lineno"> 376</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">matrix&lt;int&gt;</a> decrypt_key(size, <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray&lt;int&gt;</a>(size));</div>
<div class="line"><span class="lineno"> 377</span> <span class="keywordtype">int</span> det_encrypt = <span class="keyword">static_cast&lt;</span><span class="keywordtype">int</span><span class="keyword">&gt;</span>(<a class="code hl_function" href="../../d1/dbe/lu__decomposition_8h.html#a3108d43bd32c6fb3b3c158476c51ba7f">determinant_lu</a>(encrypt_key));</div>
<div class="line"><span class="lineno"> 378</span> </div>
<div class="line"><span class="lineno"> 379</span> <span class="keywordtype">int</span> mat_determinant = det_encrypt &lt; 0 ? det_encrypt % L : det_encrypt;</div>
<div class="line"><span class="lineno"> 380</span> </div>
<div class="line"><span class="lineno"> 381</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">matrix&lt;double&gt;</a> tmp_inverse = <a class="code hl_function" href="#a2eb58750b978a93ac5e6eb29e3e570b7">get_inverse</a>(encrypt_key);</div>
<div class="line"><span class="lineno"> 382</span> <span class="keywordtype">double</span> d2 = <a class="code hl_function" href="../../d1/dbe/lu__decomposition_8h.html#a3108d43bd32c6fb3b3c158476c51ba7f">determinant_lu</a>(decrypt_key);</div>
<div class="line"><span class="lineno"> 383</span> </div>
<div class="line"><span class="lineno"> 384</span> <span class="comment">// find co-prime factor for inversion</span></div>
<div class="line"><span class="lineno"> 385</span> <span class="keywordtype">int</span> det_inv = -1;</div>
<div class="line"><span class="lineno"> 386</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; L; i++) {</div>
<div class="line"><span class="lineno"> 387</span> <span class="keywordflow">if</span> (modulo(mat_determinant * i, L) == 1) {</div>
<div class="line"><span class="lineno"> 388</span> det_inv = i;</div>
<div class="line"><span class="lineno"> 389</span> <span class="keywordflow">break</span>;</div>
<div class="line"><span class="lineno"> 390</span> }</div>
<div class="line"><span class="lineno"> 391</span> }</div>
<div class="line"><span class="lineno"> 392</span> </div>
<div class="line"><span class="lineno"> 393</span> <span class="keywordflow">if</span> (det_inv == -1) {</div>
<div class="line"><span class="lineno"> 394</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cerr</a> &lt;&lt; <span class="stringliteral">&quot;Could not find a co-prime for inversion\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 395</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/program/exit.html">std::exit</a>(EXIT_FAILURE);</div>
<div class="line"><span class="lineno"> 396</span> }</div>
<div class="line"><span class="lineno"> 397</span> </div>
<div class="line"><span class="lineno"> 398</span> mat_determinant = det_inv * det_encrypt;</div>
<div class="line"><span class="lineno"> 399</span> </div>
<div class="line"><span class="lineno"> 400</span> <span class="comment">// perform modular inverse of encryption matrix</span></div>
<div class="line"><span class="lineno"> 401</span> <span class="keywordtype">int</span> i;</div>
<div class="line"><span class="lineno"> 402</span><span class="preprocessor">#ifdef _OPENMP</span></div>
<div class="line"><span class="lineno"> 403</span><span class="preprocessor">#pragma parallel omp for private(i)</span></div>
<div class="line"><span class="lineno"> 404</span><span class="preprocessor">#endif</span></div>
<div class="line"><span class="lineno"> 405</span> <span class="keywordflow">for</span> (i = 0; i &lt; size; i++) {</div>
<div class="line"><span class="lineno"> 406</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 0; j &lt; size; j++) {</div>
<div class="line"><span class="lineno"> 407</span> <span class="keywordtype">int</span> temp = <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/math/round.html">std::round</a>(tmp_inverse[i][j] * mat_determinant);</div>
<div class="line"><span class="lineno"> 408</span> decrypt_key[i][j] = modulo(temp, L);</div>
<div class="line"><span class="lineno"> 409</span> }</div>
<div class="line"><span class="lineno"> 410</span> }</div>
<div class="line"><span class="lineno"> 411</span> <span class="keywordflow">return</span> decrypt_key;</div>
<div class="line"><span class="lineno"> 412</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::cerr</a></div></div>
<div class="ttc" id="aclassciphers_1_1_hill_cipher_html_a2eb58750b978a93ac5e6eb29e3e570b7"><div class="ttname"><a href="#a2eb58750b978a93ac5e6eb29e3e570b7">ciphers::HillCipher::get_inverse</a></div><div class="ttdeci">static matrix&lt; double &gt; get_inverse(matrix&lt; T &gt; const &amp;A)</div><div class="ttdef"><b>Definition</b> hill_cipher.cpp:250</div></div>
<div class="ttc" id="aclassciphers_1_1_hill_cipher_html_a2eb58750b978a93ac5e6eb29e3e570b7"><div class="ttname"><a href="#a2eb58750b978a93ac5e6eb29e3e570b7">ciphers::HillCipher::get_inverse</a></div><div class="ttdeci">static matrix&lt; double &gt; get_inverse(matrix&lt; T &gt; const &amp;A)</div><div class="ttdef"><b>Definition</b> hill_cipher.cpp:251</div></div>
<div class="ttc" id="aexit_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/utility/program/exit.html">std::exit</a></div><div class="ttdeci">T exit(T... args)</div></div>
<div class="ttc" id="alu__decomposition_8h_html_a3108d43bd32c6fb3b3c158476c51ba7f"><div class="ttname"><a href="../../d1/dbe/lu__decomposition_8h.html#a3108d43bd32c6fb3b3c158476c51ba7f">determinant_lu</a></div><div class="ttdeci">double determinant_lu(const matrix&lt; T &gt; &amp;A)</div><div class="ttdef"><b>Definition</b> lu_decomposition.h:90</div></div>
<div class="ttc" id="around_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/numeric/math/round.html">std::round</a></div><div class="ttdeci">T round(T... args)</div></div>
@@ -537,32 +537,32 @@ Here is the call graph for this function:</div>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Encryption martix </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 340</span> {</div>
<div class="line"><span class="lineno"> 341</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">matrix&lt;int&gt;</a> encrypt_key(size, <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray&lt;int&gt;</a>(size));</div>
<div class="line"><span class="lineno"> 342</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">matrix&lt;int&gt;</a> min_mat = encrypt_key;</div>
<div class="line"><span class="lineno"> 343</span> <span class="keywordtype">int</span> mat_determinant = -1; <span class="comment">// because matrix has only ints, the</span></div>
<div class="line"><span class="lineno"> 344</span> <span class="comment">// determinant will also be an int</span></div>
<div class="line"><span class="lineno"> 345</span> <span class="keywordtype">int</span> L = <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/byte/strlen.html">std::strlen</a>(<a class="code hl_variable" href="../../d6/d4e/namespaceciphers.html#ab9aec0ccf4b6809f652bb540be87c216">STRKEY</a>);</div>
<div class="line"><span class="lineno"> 346</span> </div>
<div class="line"><span class="lineno"> 347</span> <span class="keywordtype">double</span> dd;</div>
<div class="line"><span class="lineno"> 348</span> <span class="keywordflow">do</span> {</div>
<div class="line"><span class="lineno"> 349</span> <span class="comment">// keeping the random number range smaller generates better</span></div>
<div class="line"><span class="lineno"> 350</span> <span class="comment">// defined matrices with more ease of cracking</span></div>
<div class="line"><span class="lineno"> 351</span> dd = <a class="code hl_function" href="#a629be41c1ab78850963e4ce14e1d11d9">rand_range</a>(&amp;encrypt_key, limit1, limit2);</div>
<div class="line"><span class="lineno"> 352</span> mat_determinant = <span class="keyword">static_cast&lt;</span><span class="keywordtype">int</span><span class="keyword">&gt;</span>(dd);</div>
<div class="line"><span class="lineno"> 353</span> </div>
<div class="line"><span class="lineno"> 354</span> <span class="keywordflow">if</span> (mat_determinant &lt; 0)</div>
<div class="line"><span class="lineno"> 355</span> mat_determinant = (mat_determinant % L);</div>
<div class="line"><span class="lineno"> 356</span> } <span class="keywordflow">while</span> (std::abs(dd) &gt; 1e3 || <span class="comment">// while ill-defined</span></div>
<div class="line"><span class="lineno"> 357</span> dd &lt; 0.1 || <span class="comment">// while singular or negative determinant</span></div>
<div class="line"><span class="lineno"> 358</span> !<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/math/isfinite.html">std::isfinite</a>(dd) || <span class="comment">// while determinant is not finite</span></div>
<div class="line"><span class="lineno"> 359</span> <a class="code hl_function" href="#a7760f3665651a0a37937c79c62f219c0">gcd</a>(mat_determinant, L) != 1); <span class="comment">// while no common factors</span></div>
<div class="line"><span class="lineno"> 360</span> <span class="comment">// std::cout &lt;&lt;</span></div>
<div class="line"><span class="lineno"> 361</span> </div>
<div class="line"><span class="lineno"> 362</span> <span class="keywordflow">return</span> encrypt_key;</div>
<div class="line"><span class="lineno"> 363</span> }</div>
<div class="ttc" id="aclassciphers_1_1_hill_cipher_html_a629be41c1ab78850963e4ce14e1d11d9"><div class="ttname"><a href="#a629be41c1ab78850963e4ce14e1d11d9">ciphers::HillCipher::rand_range</a></div><div class="ttdeci">static const T2 rand_range(T1 a, T1 b)</div><div class="ttdoc">Function to generate a random integer in a given interval.</div><div class="ttdef"><b>Definition</b> hill_cipher.cpp:92</div></div>
<div class="ttc" id="aclassciphers_1_1_hill_cipher_html_a7760f3665651a0a37937c79c62f219c0"><div class="ttname"><a href="#a7760f3665651a0a37937c79c62f219c0">ciphers::HillCipher::gcd</a></div><div class="ttdeci">static const T gcd(T a, T b)</div><div class="ttdoc">Compute GCD of two integers using Euler's algorithm.</div><div class="ttdef"><b>Definition</b> hill_cipher.cpp:138</div></div>
<div class="fragment"><div class="line"><span class="lineno"> 341</span> {</div>
<div class="line"><span class="lineno"> 342</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">matrix&lt;int&gt;</a> encrypt_key(size, <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray&lt;int&gt;</a>(size));</div>
<div class="line"><span class="lineno"> 343</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">matrix&lt;int&gt;</a> min_mat = encrypt_key;</div>
<div class="line"><span class="lineno"> 344</span> <span class="keywordtype">int</span> mat_determinant = -1; <span class="comment">// because matrix has only ints, the</span></div>
<div class="line"><span class="lineno"> 345</span> <span class="comment">// determinant will also be an int</span></div>
<div class="line"><span class="lineno"> 346</span> <span class="keywordtype">int</span> L = <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/byte/strlen.html">std::strlen</a>(<a class="code hl_variable" href="../../d6/d4e/namespaceciphers.html#ab9aec0ccf4b6809f652bb540be87c216">STRKEY</a>);</div>
<div class="line"><span class="lineno"> 347</span> </div>
<div class="line"><span class="lineno"> 348</span> <span class="keywordtype">double</span> dd;</div>
<div class="line"><span class="lineno"> 349</span> <span class="keywordflow">do</span> {</div>
<div class="line"><span class="lineno"> 350</span> <span class="comment">// keeping the random number range smaller generates better</span></div>
<div class="line"><span class="lineno"> 351</span> <span class="comment">// defined matrices with more ease of cracking</span></div>
<div class="line"><span class="lineno"> 352</span> dd = <a class="code hl_function" href="#a629be41c1ab78850963e4ce14e1d11d9">rand_range</a>(&amp;encrypt_key, limit1, limit2);</div>
<div class="line"><span class="lineno"> 353</span> mat_determinant = <span class="keyword">static_cast&lt;</span><span class="keywordtype">int</span><span class="keyword">&gt;</span>(dd);</div>
<div class="line"><span class="lineno"> 354</span> </div>
<div class="line"><span class="lineno"> 355</span> <span class="keywordflow">if</span> (mat_determinant &lt; 0)</div>
<div class="line"><span class="lineno"> 356</span> mat_determinant = (mat_determinant % L);</div>
<div class="line"><span class="lineno"> 357</span> } <span class="keywordflow">while</span> (std::abs(dd) &gt; 1e3 || <span class="comment">// while ill-defined</span></div>
<div class="line"><span class="lineno"> 358</span> dd &lt; 0.1 || <span class="comment">// while singular or negative determinant</span></div>
<div class="line"><span class="lineno"> 359</span> !<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/math/isfinite.html">std::isfinite</a>(dd) || <span class="comment">// while determinant is not finite</span></div>
<div class="line"><span class="lineno"> 360</span> <a class="code hl_function" href="#a7760f3665651a0a37937c79c62f219c0">gcd</a>(mat_determinant, L) != 1); <span class="comment">// while no common factors</span></div>
<div class="line"><span class="lineno"> 361</span> <span class="comment">// std::cout &lt;&lt;</span></div>
<div class="line"><span class="lineno"> 362</span> </div>
<div class="line"><span class="lineno"> 363</span> <span class="keywordflow">return</span> encrypt_key;</div>
<div class="line"><span class="lineno"> 364</span> }</div>
<div class="ttc" id="aclassciphers_1_1_hill_cipher_html_a629be41c1ab78850963e4ce14e1d11d9"><div class="ttname"><a href="#a629be41c1ab78850963e4ce14e1d11d9">ciphers::HillCipher::rand_range</a></div><div class="ttdeci">static const T2 rand_range(T1 a, T1 b)</div><div class="ttdoc">Function to generate a random integer in a given interval.</div><div class="ttdef"><b>Definition</b> hill_cipher.cpp:93</div></div>
<div class="ttc" id="aclassciphers_1_1_hill_cipher_html_a7760f3665651a0a37937c79c62f219c0"><div class="ttname"><a href="#a7760f3665651a0a37937c79c62f219c0">ciphers::HillCipher::gcd</a></div><div class="ttdeci">static const T gcd(T a, T b)</div><div class="ttdoc">Compute GCD of two integers using Euler's algorithm.</div><div class="ttdef"><b>Definition</b> hill_cipher.cpp:139</div></div>
<div class="ttc" id="aisfinite_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/numeric/math/isfinite.html">std::isfinite</a></div><div class="ttdeci">T isfinite(T... args)</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
@@ -615,19 +615,19 @@ Here is the call graph for this function:</div>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/pair.html">std::pair</a>&lt;matrix&lt;int&gt;, matrix&lt;int&gt;&gt; encryption and decryption keys as a pair</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="#a642f70fb54cb50b00fb6df7c3f2b120e" title="Generate encryption matrix of a given size. Larger size matrices are difficult to generate but provid...">generate_encryption_key</a> </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 426</span> {</div>
<div class="line"><span class="lineno"> 427</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">matrix&lt;int&gt;</a> encrypt_key = <a class="code hl_function" href="#a642f70fb54cb50b00fb6df7c3f2b120e">generate_encryption_key</a>(size);</div>
<div class="line"><span class="lineno"> 428</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">matrix&lt;int&gt;</a> decrypt_key = <a class="code hl_function" href="#ab02c7563889bf1e363deb8e21967b706">generate_decryption_key</a>(encrypt_key);</div>
<div class="line"><span class="lineno"> 429</span> <span class="keywordtype">double</span> det2 = <a class="code hl_function" href="../../d1/dbe/lu__decomposition_8h.html#a3108d43bd32c6fb3b3c158476c51ba7f">determinant_lu</a>(decrypt_key);</div>
<div class="line"><span class="lineno"> 430</span> <span class="keywordflow">while</span> (std::abs(det2) &lt; 0.1 || std::abs(det2) &gt; 1e3) {</div>
<div class="line"><span class="lineno"> 431</span> encrypt_key = <a class="code hl_function" href="#a642f70fb54cb50b00fb6df7c3f2b120e">generate_encryption_key</a>(size, limit1, limit2);</div>
<div class="line"><span class="lineno"> 432</span> decrypt_key = <a class="code hl_function" href="#ab02c7563889bf1e363deb8e21967b706">generate_decryption_key</a>(encrypt_key);</div>
<div class="line"><span class="lineno"> 433</span> det2 = <a class="code hl_function" href="../../d1/dbe/lu__decomposition_8h.html#a3108d43bd32c6fb3b3c158476c51ba7f">determinant_lu</a>(decrypt_key);</div>
<div class="line"><span class="lineno"> 434</span> }</div>
<div class="line"><span class="lineno"> 435</span> <span class="keywordflow">return</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/pair/make_pair.html">std::make_pair</a>(encrypt_key, decrypt_key);</div>
<div class="line"><span class="lineno"> 436</span> }</div>
<div class="ttc" id="aclassciphers_1_1_hill_cipher_html_a642f70fb54cb50b00fb6df7c3f2b120e"><div class="ttname"><a href="#a642f70fb54cb50b00fb6df7c3f2b120e">ciphers::HillCipher::generate_encryption_key</a></div><div class="ttdeci">static matrix&lt; int &gt; generate_encryption_key(size_t size, int limit1=0, int limit2=10)</div><div class="ttdoc">Generate encryption matrix of a given size. Larger size matrices are difficult to generate but provid...</div><div class="ttdef"><b>Definition</b> hill_cipher.cpp:339</div></div>
<div class="ttc" id="aclassciphers_1_1_hill_cipher_html_ab02c7563889bf1e363deb8e21967b706"><div class="ttname"><a href="#ab02c7563889bf1e363deb8e21967b706">ciphers::HillCipher::generate_decryption_key</a></div><div class="ttdeci">static matrix&lt; int &gt; generate_decryption_key(matrix&lt; int &gt; const &amp;encrypt_key)</div><div class="ttdoc">Generate decryption matrix from an encryption matrix key.</div><div class="ttdef"><b>Definition</b> hill_cipher.cpp:371</div></div>
<div class="fragment"><div class="line"><span class="lineno"> 427</span> {</div>
<div class="line"><span class="lineno"> 428</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">matrix&lt;int&gt;</a> encrypt_key = <a class="code hl_function" href="#a642f70fb54cb50b00fb6df7c3f2b120e">generate_encryption_key</a>(size);</div>
<div class="line"><span class="lineno"> 429</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">matrix&lt;int&gt;</a> decrypt_key = <a class="code hl_function" href="#ab02c7563889bf1e363deb8e21967b706">generate_decryption_key</a>(encrypt_key);</div>
<div class="line"><span class="lineno"> 430</span> <span class="keywordtype">double</span> det2 = <a class="code hl_function" href="../../d1/dbe/lu__decomposition_8h.html#a3108d43bd32c6fb3b3c158476c51ba7f">determinant_lu</a>(decrypt_key);</div>
<div class="line"><span class="lineno"> 431</span> <span class="keywordflow">while</span> (std::abs(det2) &lt; 0.1 || std::abs(det2) &gt; 1e3) {</div>
<div class="line"><span class="lineno"> 432</span> encrypt_key = <a class="code hl_function" href="#a642f70fb54cb50b00fb6df7c3f2b120e">generate_encryption_key</a>(size, limit1, limit2);</div>
<div class="line"><span class="lineno"> 433</span> decrypt_key = <a class="code hl_function" href="#ab02c7563889bf1e363deb8e21967b706">generate_decryption_key</a>(encrypt_key);</div>
<div class="line"><span class="lineno"> 434</span> det2 = <a class="code hl_function" href="../../d1/dbe/lu__decomposition_8h.html#a3108d43bd32c6fb3b3c158476c51ba7f">determinant_lu</a>(decrypt_key);</div>
<div class="line"><span class="lineno"> 435</span> }</div>
<div class="line"><span class="lineno"> 436</span> <span class="keywordflow">return</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/pair/make_pair.html">std::make_pair</a>(encrypt_key, decrypt_key);</div>
<div class="line"><span class="lineno"> 437</span> }</div>
<div class="ttc" id="aclassciphers_1_1_hill_cipher_html_a642f70fb54cb50b00fb6df7c3f2b120e"><div class="ttname"><a href="#a642f70fb54cb50b00fb6df7c3f2b120e">ciphers::HillCipher::generate_encryption_key</a></div><div class="ttdeci">static matrix&lt; int &gt; generate_encryption_key(size_t size, int limit1=0, int limit2=10)</div><div class="ttdoc">Generate encryption matrix of a given size. Larger size matrices are difficult to generate but provid...</div><div class="ttdef"><b>Definition</b> hill_cipher.cpp:340</div></div>
<div class="ttc" id="aclassciphers_1_1_hill_cipher_html_ab02c7563889bf1e363deb8e21967b706"><div class="ttname"><a href="#ab02c7563889bf1e363deb8e21967b706">ciphers::HillCipher::generate_decryption_key</a></div><div class="ttdeci">static matrix&lt; int &gt; generate_decryption_key(matrix&lt; int &gt; const &amp;encrypt_key)</div><div class="ttdoc">Generate decryption matrix from an encryption matrix key.</div><div class="ttdef"><b>Definition</b> hill_cipher.cpp:372</div></div>
<div class="ttc" id="amake_pair_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/utility/pair/make_pair.html">std::make_pair</a></div><div class="ttdeci">T make_pair(T... args)</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
@@ -668,17 +668,17 @@ Here is the call graph for this function:</div>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>index of character </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 190</span> {</div>
<div class="line"><span class="lineno"> 191</span> <span class="keywordtype">size_t</span> L = <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/byte/strlen.html">std::strlen</a>(<a class="code hl_variable" href="../../d6/d4e/namespaceciphers.html#ab9aec0ccf4b6809f652bb540be87c216">STRKEY</a>);</div>
<div class="line"><span class="lineno"> 192</span> </div>
<div class="line"><span class="lineno"> 193</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> idx = 0; idx &lt;= L; idx++)</div>
<div class="line"><span class="lineno"> 194</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="../../d6/d4e/namespaceciphers.html#ab9aec0ccf4b6809f652bb540be87c216">STRKEY</a>[idx] == ch)</div>
<div class="line"><span class="lineno"> 195</span> <span class="keywordflow">return</span> idx;</div>
<div class="line"><span class="lineno"> 196</span> </div>
<div class="line"><span class="lineno"> 197</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cerr</a> &lt;&lt; __func__ &lt;&lt; <span class="stringliteral">&quot;:&quot;</span> &lt;&lt; __LINE__ &lt;&lt; <span class="stringliteral">&quot;: (&quot;</span> &lt;&lt; ch</div>
<div class="line"><span class="lineno"> 198</span> &lt;&lt; <span class="stringliteral">&quot;) Should not reach here!\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 199</span> <span class="keywordflow">return</span> 0;</div>
<div class="line"><span class="lineno"> 200</span> }</div>
<div class="fragment"><div class="line"><span class="lineno"> 191</span> {</div>
<div class="line"><span class="lineno"> 192</span> <span class="keywordtype">size_t</span> L = <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/byte/strlen.html">std::strlen</a>(<a class="code hl_variable" href="../../d6/d4e/namespaceciphers.html#ab9aec0ccf4b6809f652bb540be87c216">STRKEY</a>);</div>
<div class="line"><span class="lineno"> 193</span> </div>
<div class="line"><span class="lineno"> 194</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> idx = 0; idx &lt;= L; idx++)</div>
<div class="line"><span class="lineno"> 195</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="../../d6/d4e/namespaceciphers.html#ab9aec0ccf4b6809f652bb540be87c216">STRKEY</a>[idx] == ch)</div>
<div class="line"><span class="lineno"> 196</span> <span class="keywordflow">return</span> idx;</div>
<div class="line"><span class="lineno"> 197</span> </div>
<div class="line"><span class="lineno"> 198</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cerr</a> &lt;&lt; __func__ &lt;&lt; <span class="stringliteral">&quot;:&quot;</span> &lt;&lt; __LINE__ &lt;&lt; <span class="stringliteral">&quot;: (&quot;</span> &lt;&lt; ch</div>
<div class="line"><span class="lineno"> 199</span> &lt;&lt; <span class="stringliteral">&quot;) Should not reach here!\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 200</span> <span class="keywordflow">return</span> 0;</div>
<div class="line"><span class="lineno"> 201</span> }</div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
@@ -718,7 +718,7 @@ Here is the call graph for this function:</div>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>character at the index </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 182</span>{ <span class="keywordflow">return</span> <a class="code hl_variable" href="../../d6/d4e/namespaceciphers.html#ab9aec0ccf4b6809f652bb540be87c216">STRKEY</a>[idx]; }</div>
<div class="fragment"><div class="line"><span class="lineno"> 183</span>{ <span class="keywordflow">return</span> <a class="code hl_variable" href="../../d6/d4e/namespaceciphers.html#ab9aec0ccf4b6809f652bb540be87c216">STRKEY</a>[idx]; }</div>
</div><!-- fragment -->
</div>
</div>
@@ -747,70 +747,70 @@ template&lt;typename T &gt; </div>
</table>
</div><div class="memdoc">
<p>Get matrix inverse using Row-transformations. Given matrix must be a square and non-singular. </p><dl class="section return"><dt>Returns</dt><dd>inverse matrix </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 250</span> {</div>
<div class="line"><span class="lineno"> 251</span> <span class="comment">// Assuming A is square matrix</span></div>
<div class="line"><span class="lineno"> 252</span> <span class="keywordtype">size_t</span> <a class="code hl_variable" href="../../d6/d42/data__structures_2sparse__table_8cpp.html#a10f3ffb3f6f7e1b83d556b9c8de89a5d">N</a> = A.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>();</div>
<div class="line"><span class="lineno"> 253</span> </div>
<div class="line"><span class="lineno"> 254</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">matrix&lt;double&gt;</a> inverse(N, <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray&lt;double&gt;</a>(N));</div>
<div class="line"><span class="lineno"> 255</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> row = 0; row &lt; <a class="code hl_variable" href="../../d6/d42/data__structures_2sparse__table_8cpp.html#a10f3ffb3f6f7e1b83d556b9c8de89a5d">N</a>; row++) {</div>
<div class="line"><span class="lineno"> 256</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> col = 0; col &lt; <a class="code hl_variable" href="../../d6/d42/data__structures_2sparse__table_8cpp.html#a10f3ffb3f6f7e1b83d556b9c8de89a5d">N</a>; col++) {</div>
<div class="line"><span class="lineno"> 257</span> <span class="comment">// create identity matrix</span></div>
<div class="line"><span class="lineno"> 258</span> inverse[row][col] = (row == col) ? 1.f : 0.f;</div>
<div class="line"><span class="lineno"> 259</span> }</div>
<div class="line"><span class="lineno"> 260</span> }</div>
<div class="line"><span class="lineno"> 261</span> </div>
<div class="line"><span class="lineno"> 262</span> <span class="keywordflow">if</span> (A.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>() != A[0].size()) {</div>
<div class="line"><span class="lineno"> 263</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cerr</a> &lt;&lt; <span class="stringliteral">&quot;A must be a square matrix!&quot;</span> &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><span class="lineno"> 264</span> <span class="keywordflow">return</span> inverse;</div>
<div class="line"><span class="lineno"> 265</span> }</div>
<div class="line"><span class="lineno"> 266</span> </div>
<div class="line"><span class="lineno"> 267</span> <span class="comment">// preallocate a temporary matrix identical to A</span></div>
<div class="line"><span class="lineno"> 268</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">matrix&lt;double&gt;</a> temp(N, <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray&lt;double&gt;</a>(N));</div>
<div class="line"><span class="lineno"> 269</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> row = 0; row &lt; <a class="code hl_variable" href="../../d6/d42/data__structures_2sparse__table_8cpp.html#a10f3ffb3f6f7e1b83d556b9c8de89a5d">N</a>; row++) {</div>
<div class="line"><span class="lineno"> 270</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> col = 0; col &lt; <a class="code hl_variable" href="../../d6/d42/data__structures_2sparse__table_8cpp.html#a10f3ffb3f6f7e1b83d556b9c8de89a5d">N</a>; col++)</div>
<div class="line"><span class="lineno"> 271</span> temp[row][col] = <span class="keyword">static_cast&lt;</span><span class="keywordtype">double</span><span class="keyword">&gt;</span>(A[row][col]);</div>
<div class="line"><span class="lineno"> 272</span> }</div>
<div class="line"><span class="lineno"> 273</span> </div>
<div class="line"><span class="lineno"> 274</span> <span class="comment">// start transformations</span></div>
<div class="line"><span class="lineno"> 275</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> row = 0; row &lt; <a class="code hl_variable" href="../../d6/d42/data__structures_2sparse__table_8cpp.html#a10f3ffb3f6f7e1b83d556b9c8de89a5d">N</a>; row++) {</div>
<div class="line"><span class="lineno"> 276</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> row2 = row; row2 &lt; <a class="code hl_variable" href="../../d6/d42/data__structures_2sparse__table_8cpp.html#a10f3ffb3f6f7e1b83d556b9c8de89a5d">N</a> &amp;&amp; temp[row][row] == 0; row2++) {</div>
<div class="line"><span class="lineno"> 277</span> <span class="comment">// this to ensure diagonal elements are not 0</span></div>
<div class="line"><span class="lineno"> 278</span> temp[row] = temp[row] + temp[row2];</div>
<div class="line"><span class="lineno"> 279</span> inverse[row] = inverse[row] + inverse[row2];</div>
<div class="line"><span class="lineno"> 280</span> }</div>
<div class="line"><span class="lineno"> 281</span> </div>
<div class="line"><span class="lineno"> 282</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> col2 = row; col2 &lt; <a class="code hl_variable" href="../../d6/d42/data__structures_2sparse__table_8cpp.html#a10f3ffb3f6f7e1b83d556b9c8de89a5d">N</a> &amp;&amp; temp[row][row] == 0; col2++) {</div>
<div class="line"><span class="lineno"> 283</span> <span class="comment">// this to further ensure diagonal elements are not 0</span></div>
<div class="line"><span class="lineno"> 284</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> row2 = 0; row2 &lt; <a class="code hl_variable" href="../../d6/d42/data__structures_2sparse__table_8cpp.html#a10f3ffb3f6f7e1b83d556b9c8de89a5d">N</a>; row2++) {</div>
<div class="line"><span class="lineno"> 285</span> temp[row2][row] = temp[row2][row] + temp[row2][col2];</div>
<div class="line"><span class="lineno"> 286</span> inverse[row2][row] =</div>
<div class="line"><span class="lineno"> 287</span> inverse[row2][row] + inverse[row2][col2];</div>
<div class="line"><span class="lineno"> 288</span> }</div>
<div class="line"><span class="lineno"> 289</span> }</div>
<div class="line"><span class="lineno"> 290</span> </div>
<div class="line"><span class="lineno"> 291</span> <span class="keywordflow">if</span> (temp[row][row] == 0) {</div>
<div class="line"><span class="lineno"> 292</span> <span class="comment">// Probably a low-rank matrix and hence singular</span></div>
<div class="line"><span class="lineno"> 293</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cerr</a> &lt;&lt; <span class="stringliteral">&quot;Low-rank matrix, no inverse!&quot;</span> &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><span class="lineno"> 294</span> <span class="keywordflow">return</span> inverse;</div>
<div class="line"><span class="lineno"> 295</span> }</div>
<div class="line"><span class="lineno"> 296</span> </div>
<div class="line"><span class="lineno"> 297</span> <span class="comment">// set diagonal to 1</span></div>
<div class="line"><span class="lineno"> 298</span> <span class="keywordtype">double</span> divisor = temp[row][row];</div>
<div class="line"><span class="lineno"> 299</span> temp[row] = temp[row] / divisor;</div>
<div class="line"><span class="lineno"> 300</span> inverse[row] = inverse[row] / divisor;</div>
<div class="line"><span class="lineno"> 301</span> <span class="comment">// Row transformations</span></div>
<div class="line"><span class="lineno"> 302</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> row2 = 0; row2 &lt; <a class="code hl_variable" href="../../d6/d42/data__structures_2sparse__table_8cpp.html#a10f3ffb3f6f7e1b83d556b9c8de89a5d">N</a>; row2++) {</div>
<div class="line"><span class="lineno"> 303</span> <span class="keywordflow">if</span> (row2 == row)</div>
<div class="line"><span class="lineno"> 304</span> <span class="keywordflow">continue</span>;</div>
<div class="line"><span class="lineno"> 305</span> <span class="keywordtype">double</span> factor = temp[row2][row];</div>
<div class="line"><span class="lineno"> 306</span> temp[row2] = temp[row2] - factor * temp[row];</div>
<div class="line"><span class="lineno"> 307</span> inverse[row2] = inverse[row2] - factor * inverse[row];</div>
<div class="line"><span class="lineno"> 308</span> }</div>
<div class="line"><span class="lineno"> 309</span> }</div>
<div class="line"><span class="lineno"> 310</span> </div>
<div class="line"><span class="lineno"> 311</span> <span class="keywordflow">return</span> inverse;</div>
<div class="line"><span class="lineno"> 312</span> }</div>
<div class="ttc" id="adata__structures_2sparse__table_8cpp_html_a10f3ffb3f6f7e1b83d556b9c8de89a5d"><div class="ttname"><a href="../../d6/d42/data__structures_2sparse__table_8cpp.html#a10f3ffb3f6f7e1b83d556b9c8de89a5d">data_structures::sparse_table::N</a></div><div class="ttdeci">constexpr uint32_t N</div><div class="ttdoc">A struct to represent sparse table for min() as their invariant function, for the given array A....</div><div class="ttdef"><b>Definition</b> sparse_table.cpp:47</div></div>
<div class="fragment"><div class="line"><span class="lineno"> 251</span> {</div>
<div class="line"><span class="lineno"> 252</span> <span class="comment">// Assuming A is square matrix</span></div>
<div class="line"><span class="lineno"> 253</span> <span class="keywordtype">size_t</span> <a class="code hl_variable" href="../../d6/d42/data__structures_2sparse__table_8cpp.html#a10f3ffb3f6f7e1b83d556b9c8de89a5d">N</a> = A.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>();</div>
<div class="line"><span class="lineno"> 254</span> </div>
<div class="line"><span class="lineno"> 255</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">matrix&lt;double&gt;</a> inverse(N, <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray&lt;double&gt;</a>(N));</div>
<div class="line"><span class="lineno"> 256</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> row = 0; row &lt; <a class="code hl_variable" href="../../d6/d42/data__structures_2sparse__table_8cpp.html#a10f3ffb3f6f7e1b83d556b9c8de89a5d">N</a>; row++) {</div>
<div class="line"><span class="lineno"> 257</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> col = 0; col &lt; <a class="code hl_variable" href="../../d6/d42/data__structures_2sparse__table_8cpp.html#a10f3ffb3f6f7e1b83d556b9c8de89a5d">N</a>; col++) {</div>
<div class="line"><span class="lineno"> 258</span> <span class="comment">// create identity matrix</span></div>
<div class="line"><span class="lineno"> 259</span> inverse[row][col] = (row == col) ? 1.f : 0.f;</div>
<div class="line"><span class="lineno"> 260</span> }</div>
<div class="line"><span class="lineno"> 261</span> }</div>
<div class="line"><span class="lineno"> 262</span> </div>
<div class="line"><span class="lineno"> 263</span> <span class="keywordflow">if</span> (A.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>() != A[0].size()) {</div>
<div class="line"><span class="lineno"> 264</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cerr</a> &lt;&lt; <span class="stringliteral">&quot;A must be a square matrix!&quot;</span> &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><span class="lineno"> 265</span> <span class="keywordflow">return</span> inverse;</div>
<div class="line"><span class="lineno"> 266</span> }</div>
<div class="line"><span class="lineno"> 267</span> </div>
<div class="line"><span class="lineno"> 268</span> <span class="comment">// preallocate a temporary matrix identical to A</span></div>
<div class="line"><span class="lineno"> 269</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">matrix&lt;double&gt;</a> temp(N, <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray&lt;double&gt;</a>(N));</div>
<div class="line"><span class="lineno"> 270</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> row = 0; row &lt; <a class="code hl_variable" href="../../d6/d42/data__structures_2sparse__table_8cpp.html#a10f3ffb3f6f7e1b83d556b9c8de89a5d">N</a>; row++) {</div>
<div class="line"><span class="lineno"> 271</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> col = 0; col &lt; <a class="code hl_variable" href="../../d6/d42/data__structures_2sparse__table_8cpp.html#a10f3ffb3f6f7e1b83d556b9c8de89a5d">N</a>; col++)</div>
<div class="line"><span class="lineno"> 272</span> temp[row][col] = <span class="keyword">static_cast&lt;</span><span class="keywordtype">double</span><span class="keyword">&gt;</span>(A[row][col]);</div>
<div class="line"><span class="lineno"> 273</span> }</div>
<div class="line"><span class="lineno"> 274</span> </div>
<div class="line"><span class="lineno"> 275</span> <span class="comment">// start transformations</span></div>
<div class="line"><span class="lineno"> 276</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> row = 0; row &lt; <a class="code hl_variable" href="../../d6/d42/data__structures_2sparse__table_8cpp.html#a10f3ffb3f6f7e1b83d556b9c8de89a5d">N</a>; row++) {</div>
<div class="line"><span class="lineno"> 277</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> row2 = row; row2 &lt; <a class="code hl_variable" href="../../d6/d42/data__structures_2sparse__table_8cpp.html#a10f3ffb3f6f7e1b83d556b9c8de89a5d">N</a> &amp;&amp; temp[row][row] == 0; row2++) {</div>
<div class="line"><span class="lineno"> 278</span> <span class="comment">// this to ensure diagonal elements are not 0</span></div>
<div class="line"><span class="lineno"> 279</span> temp[row] = temp[row] + temp[row2];</div>
<div class="line"><span class="lineno"> 280</span> inverse[row] = inverse[row] + inverse[row2];</div>
<div class="line"><span class="lineno"> 281</span> }</div>
<div class="line"><span class="lineno"> 282</span> </div>
<div class="line"><span class="lineno"> 283</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> col2 = row; col2 &lt; <a class="code hl_variable" href="../../d6/d42/data__structures_2sparse__table_8cpp.html#a10f3ffb3f6f7e1b83d556b9c8de89a5d">N</a> &amp;&amp; temp[row][row] == 0; col2++) {</div>
<div class="line"><span class="lineno"> 284</span> <span class="comment">// this to further ensure diagonal elements are not 0</span></div>
<div class="line"><span class="lineno"> 285</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> row2 = 0; row2 &lt; <a class="code hl_variable" href="../../d6/d42/data__structures_2sparse__table_8cpp.html#a10f3ffb3f6f7e1b83d556b9c8de89a5d">N</a>; row2++) {</div>
<div class="line"><span class="lineno"> 286</span> temp[row2][row] = temp[row2][row] + temp[row2][col2];</div>
<div class="line"><span class="lineno"> 287</span> inverse[row2][row] =</div>
<div class="line"><span class="lineno"> 288</span> inverse[row2][row] + inverse[row2][col2];</div>
<div class="line"><span class="lineno"> 289</span> }</div>
<div class="line"><span class="lineno"> 290</span> }</div>
<div class="line"><span class="lineno"> 291</span> </div>
<div class="line"><span class="lineno"> 292</span> <span class="keywordflow">if</span> (temp[row][row] == 0) {</div>
<div class="line"><span class="lineno"> 293</span> <span class="comment">// Probably a low-rank matrix and hence singular</span></div>
<div class="line"><span class="lineno"> 294</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cerr</a> &lt;&lt; <span class="stringliteral">&quot;Low-rank matrix, no inverse!&quot;</span> &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><span class="lineno"> 295</span> <span class="keywordflow">return</span> inverse;</div>
<div class="line"><span class="lineno"> 296</span> }</div>
<div class="line"><span class="lineno"> 297</span> </div>
<div class="line"><span class="lineno"> 298</span> <span class="comment">// set diagonal to 1</span></div>
<div class="line"><span class="lineno"> 299</span> <span class="keywordtype">double</span> divisor = temp[row][row];</div>
<div class="line"><span class="lineno"> 300</span> temp[row] = temp[row] / divisor;</div>
<div class="line"><span class="lineno"> 301</span> inverse[row] = inverse[row] / divisor;</div>
<div class="line"><span class="lineno"> 302</span> <span class="comment">// Row transformations</span></div>
<div class="line"><span class="lineno"> 303</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> row2 = 0; row2 &lt; <a class="code hl_variable" href="../../d6/d42/data__structures_2sparse__table_8cpp.html#a10f3ffb3f6f7e1b83d556b9c8de89a5d">N</a>; row2++) {</div>
<div class="line"><span class="lineno"> 304</span> <span class="keywordflow">if</span> (row2 == row)</div>
<div class="line"><span class="lineno"> 305</span> <span class="keywordflow">continue</span>;</div>
<div class="line"><span class="lineno"> 306</span> <span class="keywordtype">double</span> factor = temp[row2][row];</div>
<div class="line"><span class="lineno"> 307</span> temp[row2] = temp[row2] - factor * temp[row];</div>
<div class="line"><span class="lineno"> 308</span> inverse[row2] = inverse[row2] - factor * inverse[row];</div>
<div class="line"><span class="lineno"> 309</span> }</div>
<div class="line"><span class="lineno"> 310</span> }</div>
<div class="line"><span class="lineno"> 311</span> </div>
<div class="line"><span class="lineno"> 312</span> <span class="keywordflow">return</span> inverse;</div>
<div class="line"><span class="lineno"> 313</span> }</div>
<div class="ttc" id="adata__structures_2sparse__table_8cpp_html_a10f3ffb3f6f7e1b83d556b9c8de89a5d"><div class="ttname"><a href="../../d6/d42/data__structures_2sparse__table_8cpp.html#a10f3ffb3f6f7e1b83d556b9c8de89a5d">data_structures::sparse_table::N</a></div><div class="ttdeci">constexpr uint32_t N</div><div class="ttdoc">A struct to represent sparse table for min() as their invariant function, for the given array A....</div><div class="ttdef"><b>Definition</b> sparse_table.cpp:48</div></div>
<div class="ttc" id="aendl_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a></div><div class="ttdeci">T endl(T... args)</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
@@ -856,21 +856,21 @@ Here is the call graph for this function:</div>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>corresponding encrypted or decrypted text </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 160</span> {</div>
<div class="line"><span class="lineno"> 161</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray&lt;uint8_t&gt;</a> out(vector); <span class="comment">// make a copy</span></div>
<div class="line"><span class="lineno"> 162</span> </div>
<div class="line"><span class="lineno"> 163</span> <span class="keywordtype">size_t</span> L = <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/byte/strlen.html">std::strlen</a>(<a class="code hl_variable" href="../../d6/d4e/namespaceciphers.html#ab9aec0ccf4b6809f652bb540be87c216">STRKEY</a>);</div>
<div class="line"><span class="lineno"> 164</span> </div>
<div class="line"><span class="lineno"> 165</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; key.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>(); i++) {</div>
<div class="line"><span class="lineno"> 166</span> <span class="keywordtype">int</span> tmp = 0;</div>
<div class="line"><span class="lineno"> 167</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> j = 0; j &lt; vector.size(); j++) {</div>
<div class="line"><span class="lineno"> 168</span> tmp += key[i][j] * vector[j];</div>
<div class="line"><span class="lineno"> 169</span> }</div>
<div class="line"><span class="lineno"> 170</span> out[i] = <span class="keyword">static_cast&lt;</span>uint8_t<span class="keyword">&gt;</span>(tmp % L);</div>
<div class="line"><span class="lineno"> 171</span> }</div>
<div class="line"><span class="lineno"> 172</span> </div>
<div class="line"><span class="lineno"> 173</span> <span class="keywordflow">return</span> out;</div>
<div class="line"><span class="lineno"> 174</span> }</div>
<div class="fragment"><div class="line"><span class="lineno"> 161</span> {</div>
<div class="line"><span class="lineno"> 162</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray&lt;uint8_t&gt;</a> out(vector); <span class="comment">// make a copy</span></div>
<div class="line"><span class="lineno"> 163</span> </div>
<div class="line"><span class="lineno"> 164</span> <span class="keywordtype">size_t</span> L = <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/byte/strlen.html">std::strlen</a>(<a class="code hl_variable" href="../../d6/d4e/namespaceciphers.html#ab9aec0ccf4b6809f652bb540be87c216">STRKEY</a>);</div>
<div class="line"><span class="lineno"> 165</span> </div>
<div class="line"><span class="lineno"> 166</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; key.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>(); i++) {</div>
<div class="line"><span class="lineno"> 167</span> <span class="keywordtype">int</span> tmp = 0;</div>
<div class="line"><span class="lineno"> 168</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> j = 0; j &lt; vector.size(); j++) {</div>
<div class="line"><span class="lineno"> 169</span> tmp += key[i][j] * vector[j];</div>
<div class="line"><span class="lineno"> 170</span> }</div>
<div class="line"><span class="lineno"> 171</span> out[i] = <span class="keyword">static_cast&lt;</span>uint8_t<span class="keyword">&gt;</span>(tmp % L);</div>
<div class="line"><span class="lineno"> 172</span> }</div>
<div class="line"><span class="lineno"> 173</span> </div>
<div class="line"><span class="lineno"> 174</span> <span class="keywordflow">return</span> out;</div>
<div class="line"><span class="lineno"> 175</span> }</div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
@@ -905,12 +905,12 @@ Here is the call graph for this function:</div>
</tr>
</table>
</div><div class="memdoc">
<div class="fragment"><div class="line"><span class="lineno"> 314</span> {</div>
<div class="line"><span class="lineno"> 315</span> <span class="keywordtype">int</span> ret = a % b;</div>
<div class="line"><span class="lineno"> 316</span> <span class="keywordflow">if</span> (ret &lt; 0)</div>
<div class="line"><span class="lineno"> 317</span> ret += b;</div>
<div class="line"><span class="lineno"> 318</span> <span class="keywordflow">return</span> ret;</div>
<div class="line"><span class="lineno"> 319</span> }</div>
<div class="fragment"><div class="line"><span class="lineno"> 315</span> {</div>
<div class="line"><span class="lineno"> 316</span> <span class="keywordtype">int</span> ret = a % b;</div>
<div class="line"><span class="lineno"> 317</span> <span class="keywordflow">if</span> (ret &lt; 0)</div>
<div class="line"><span class="lineno"> 318</span> ret += b;</div>
<div class="line"><span class="lineno"> 319</span> <span class="keywordflow">return</span> ret;</div>
<div class="line"><span class="lineno"> 320</span> }</div>
</div><!-- fragment -->
</div>
</div>
@@ -966,16 +966,16 @@ template&lt;typename T1 , typename T2 &gt; </div>
</dl>
<dl class="section return"><dt>Returns</dt><dd>determinant of generated random matrix</dd></dl>
<dl class="section warning"><dt>Warning</dt><dd>There will need to be a balance between the matrix size and the range of random numbers. If the matrix is large, the range of random numbers must be small to have a well defined keys. Or if the matrix is smaller, the random numbers range can be larger. For an 8x8 matrix, range should be no more than \([0,10]\) </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 118</span> {</div>
<div class="line"><span class="lineno"> 119</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; <a class="code hl_variable" href="../../d6/d42/data__structures_2sparse__table_8cpp.html#af7db62f21983565c64d5d42d2a49888e">M</a>-&gt;size(); i++) {</div>
<div class="line"><span class="lineno"> 120</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> j = 0; j &lt; <a class="code hl_variable" href="../../d6/d42/data__structures_2sparse__table_8cpp.html#af7db62f21983565c64d5d42d2a49888e">M</a>[0][0].size(); j++) {</div>
<div class="line"><span class="lineno"> 121</span> <a class="code hl_variable" href="../../d6/d42/data__structures_2sparse__table_8cpp.html#af7db62f21983565c64d5d42d2a49888e">M</a>[0][i][j] = <a class="code hl_function" href="#a629be41c1ab78850963e4ce14e1d11d9">rand_range&lt;T1, T2&gt;</a>(a, b);</div>
<div class="line"><span class="lineno"> 122</span> }</div>
<div class="line"><span class="lineno"> 123</span> }</div>
<div class="line"><span class="lineno"> 124</span> </div>
<div class="line"><span class="lineno"> 125</span> <span class="keywordflow">return</span> <a class="code hl_function" href="../../d1/dbe/lu__decomposition_8h.html#a3108d43bd32c6fb3b3c158476c51ba7f">determinant_lu</a>(*M);</div>
<div class="line"><span class="lineno"> 126</span> }</div>
<div class="ttc" id="adata__structures_2sparse__table_8cpp_html_af7db62f21983565c64d5d42d2a49888e"><div class="ttname"><a href="../../d6/d42/data__structures_2sparse__table_8cpp.html#af7db62f21983565c64d5d42d2a49888e">data_structures::sparse_table::M</a></div><div class="ttdeci">constexpr uint8_t M</div><div class="ttdoc">ceil(log2(N)).</div><div class="ttdef"><b>Definition</b> sparse_table.cpp:48</div></div>
<div class="fragment"><div class="line"><span class="lineno"> 119</span> {</div>
<div class="line"><span class="lineno"> 120</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; <a class="code hl_variable" href="../../d6/d42/data__structures_2sparse__table_8cpp.html#af7db62f21983565c64d5d42d2a49888e">M</a>-&gt;size(); i++) {</div>
<div class="line"><span class="lineno"> 121</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> j = 0; j &lt; <a class="code hl_variable" href="../../d6/d42/data__structures_2sparse__table_8cpp.html#af7db62f21983565c64d5d42d2a49888e">M</a>[0][0].size(); j++) {</div>
<div class="line"><span class="lineno"> 122</span> <a class="code hl_variable" href="../../d6/d42/data__structures_2sparse__table_8cpp.html#af7db62f21983565c64d5d42d2a49888e">M</a>[0][i][j] = <a class="code hl_function" href="#a629be41c1ab78850963e4ce14e1d11d9">rand_range&lt;T1, T2&gt;</a>(a, b);</div>
<div class="line"><span class="lineno"> 123</span> }</div>
<div class="line"><span class="lineno"> 124</span> }</div>
<div class="line"><span class="lineno"> 125</span> </div>
<div class="line"><span class="lineno"> 126</span> <span class="keywordflow">return</span> <a class="code hl_function" href="../../d1/dbe/lu__decomposition_8h.html#a3108d43bd32c6fb3b3c158476c51ba7f">determinant_lu</a>(*M);</div>
<div class="line"><span class="lineno"> 127</span> }</div>
<div class="ttc" id="adata__structures_2sparse__table_8cpp_html_af7db62f21983565c64d5d42d2a49888e"><div class="ttname"><a href="../../d6/d42/data__structures_2sparse__table_8cpp.html#af7db62f21983565c64d5d42d2a49888e">data_structures::sparse_table::M</a></div><div class="ttdeci">constexpr uint8_t M</div><div class="ttdoc">ceil(log2(N)).</div><div class="ttdef"><b>Definition</b> sparse_table.cpp:49</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
@@ -1028,13 +1028,13 @@ template&lt;typename T1 , typename T2 &gt; </div>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>random integer in the interval \([a,b)\) </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 92</span> {</div>
<div class="line"><span class="lineno"> 93</span> <span class="comment">// generate random number between 0 and 1</span></div>
<div class="line"><span class="lineno"> 94</span> <span class="keywordtype">long</span> <span class="keywordtype">double</span> r = <span class="keyword">static_cast&lt;</span><span class="keywordtype">long</span> <span class="keywordtype">double</span><span class="keyword">&gt;</span>(<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/random/rand.html">std::rand</a>()) / RAND_MAX;</div>
<div class="line"><span class="lineno"> 95</span> </div>
<div class="line"><span class="lineno"> 96</span> <span class="comment">// scale and return random number as integer</span></div>
<div class="line"><span class="lineno"> 97</span> <span class="keywordflow">return</span> <span class="keyword">static_cast&lt;</span>T2<span class="keyword">&gt;</span>(r * (b - a) + a);</div>
<div class="line"><span class="lineno"> 98</span> }</div>
<div class="fragment"><div class="line"><span class="lineno"> 93</span> {</div>
<div class="line"><span class="lineno"> 94</span> <span class="comment">// generate random number between 0 and 1</span></div>
<div class="line"><span class="lineno"> 95</span> <span class="keywordtype">long</span> <span class="keywordtype">double</span> r = <span class="keyword">static_cast&lt;</span><span class="keywordtype">long</span> <span class="keywordtype">double</span><span class="keyword">&gt;</span>(<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/random/rand.html">std::rand</a>()) / RAND_MAX;</div>
<div class="line"><span class="lineno"> 96</span> </div>
<div class="line"><span class="lineno"> 97</span> <span class="comment">// scale and return random number as integer</span></div>
<div class="line"><span class="lineno"> 98</span> <span class="keywordflow">return</span> <span class="keyword">static_cast&lt;</span>T2<span class="keyword">&gt;</span>(r * (b - a) + a);</div>
<div class="line"><span class="lineno"> 99</span> }</div>
<div class="ttc" id="arand_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/numeric/random/rand.html">std::rand</a></div><div class="ttdeci">T rand(T... args)</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>

View File

@@ -113,17 +113,18 @@ $(function(){initNavTree('d6/d2d/modular__inverse__simple_8cpp.html','../../');
<p>Simple implementation of <a href="https://en.wikipedia.org/wiki/Modular_multiplicative_inverse" target="_blank">modular multiplicative inverse</a>
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &lt;cassert&gt;</code><br />
<code>#include &lt;cstdint&gt;</code><br />
<code>#include &lt;iostream&gt;</code><br />
</div><div class="textblock"><div class="dynheader">
Include dependency graph for modular_inverse_simple.cpp:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../db/d13/modular__inverse__simple_8cpp__incl.svg" width="171" height="126"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
<div class="center"><iframe scrolling="no" frameborder="0" src="../../db/d13/modular__inverse__simple_8cpp__incl.svg" width="255" 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">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a618b198f74a88ab0023355b3a05d9ad6" id="r_a618b198f74a88ab0023355b3a05d9ad6"><td class="memItemLeft" align="right" valign="top">uint64_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a618b198f74a88ab0023355b3a05d9ad6">imod</a> (uint64_t x, uint64_t y)</td></tr>
<tr class="memdesc:a618b198f74a88ab0023355b3a05d9ad6"><td class="mdescLeft">&#160;</td><td class="mdescRight">for IO operations <br /></td></tr>
<tr class="memdesc:a618b198f74a88ab0023355b3a05d9ad6"><td class="mdescLeft">&#160;</td><td class="mdescRight">for assert <br /></td></tr>
<tr class="separator:a618b198f74a88ab0023355b3a05d9ad6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa8dca7b867074164d5f45b0f3851269d" id="r_aa8dca7b867074164d5f45b0f3851269d"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#aa8dca7b867074164d5f45b0f3851269d">test</a> ()</td></tr>
<tr class="memdesc:aa8dca7b867074164d5f45b0f3851269d"><td class="mdescLeft">&#160;</td><td class="mdescRight">self-test implementations <br /></td></tr>
@@ -155,8 +156,8 @@ Functions</h2></td></tr>
</table>
</div><div class="memdoc">
<p>for IO operations </p>
<p>for assert</p>
<p>for assert </p>
<p>for IO operations</p>
<p>Function imod Calculates the modular inverse of x with respect to y, x^{-1} \mod y </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">x</td><td>number </td></tr>
@@ -165,17 +166,17 @@ Functions</h2></td></tr>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the modular inverse </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 20</span> {</div>
<div class="line"><span class="lineno"> 21</span> uint64_t aux = 0; <span class="comment">// auxiliary variable</span></div>
<div class="line"><span class="lineno"> 22</span> uint64_t itr = 0; <span class="comment">// iteration counter</span></div>
<div class="line"><span class="lineno"> 23</span> </div>
<div class="line"><span class="lineno"> 24</span> <span class="keywordflow">do</span> { <span class="comment">// run the algorithm while not find the inverse</span></div>
<div class="line"><span class="lineno"> 25</span> aux = y * itr + 1;</div>
<div class="line"><span class="lineno"> 26</span> itr++;</div>
<div class="line"><span class="lineno"> 27</span> } <span class="keywordflow">while</span> (aux % x); <span class="comment">// while module aux % x non-zero</span></div>
<div class="line"><span class="lineno"> 28</span> </div>
<div class="line"><span class="lineno"> 29</span> <span class="keywordflow">return</span> aux / x;</div>
<div class="line"><span class="lineno"> 30</span>}</div>
<div class="fragment"><div class="line"><span class="lineno"> 21</span> {</div>
<div class="line"><span class="lineno"> 22</span> uint64_t aux = 0; <span class="comment">// auxiliary variable</span></div>
<div class="line"><span class="lineno"> 23</span> uint64_t itr = 0; <span class="comment">// iteration counter</span></div>
<div class="line"><span class="lineno"> 24</span> </div>
<div class="line"><span class="lineno"> 25</span> <span class="keywordflow">do</span> { <span class="comment">// run the algorithm while not find the inverse</span></div>
<div class="line"><span class="lineno"> 26</span> aux = y * itr + 1;</div>
<div class="line"><span class="lineno"> 27</span> itr++;</div>
<div class="line"><span class="lineno"> 28</span> } <span class="keywordflow">while</span> (aux % x); <span class="comment">// while module aux % x non-zero</span></div>
<div class="line"><span class="lineno"> 29</span> </div>
<div class="line"><span class="lineno"> 30</span> <span class="keywordflow">return</span> aux / x;</div>
<div class="line"><span class="lineno"> 31</span>}</div>
</div><!-- fragment -->
</div>
</div>
@@ -196,10 +197,10 @@ Functions</h2></td></tr>
<p>Main function. </p>
<dl class="section return"><dt>Returns</dt><dd>0 on exit </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 58</span> {</div>
<div class="line"><span class="lineno"> 59</span> <a class="code hl_function" href="#aa8dca7b867074164d5f45b0f3851269d">test</a>(); <span class="comment">// run self-test implementations</span></div>
<div class="line"><span class="lineno"> 60</span>};</div>
<div class="ttc" id="amodular__inverse__simple_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> modular_inverse_simple.cpp:36</div></div>
<div class="fragment"><div class="line"><span class="lineno"> 59</span> {</div>
<div class="line"><span class="lineno"> 60</span> <a class="code hl_function" href="#aa8dca7b867074164d5f45b0f3851269d">test</a>(); <span class="comment">// run self-test implementations</span></div>
<div class="line"><span class="lineno"> 61</span>};</div>
<div class="ttc" id="amodular__inverse__simple_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> modular_inverse_simple.cpp:37</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
@@ -233,26 +234,26 @@ 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>
<div class="fragment"><div class="line"><span class="lineno"> 36</span> {</div>
<div class="line"><span class="lineno"> 37</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;First case testing... \n&quot;</span>;</div>
<div class="line"><span class="lineno"> 38</span> <span class="comment">// for a = 3 and b = 11 return 4</span></div>
<div class="line"><span class="lineno"> 39</span> assert(<a class="code hl_function" href="#a618b198f74a88ab0023355b3a05d9ad6">imod</a>(3, 11) == 4);</div>
<div class="line"><span class="lineno"> 40</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;\nPassed!\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 41</span> </div>
<div class="line"><span class="lineno"> 42</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;Second case testing... \n&quot;</span>;</div>
<div class="line"><span class="lineno"> 43</span> <span class="comment">// for a = 3 and b = 26 return 9</span></div>
<div class="line"><span class="lineno"> 44</span> assert(<a class="code hl_function" href="#a618b198f74a88ab0023355b3a05d9ad6">imod</a>(3, 26) == 9);</div>
<div class="line"><span class="lineno"> 45</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;\nPassed!\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 46</span> </div>
<div class="line"><span class="lineno"> 47</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;Third case testing... \n&quot;</span>;</div>
<div class="line"><span class="lineno"> 48</span> <span class="comment">// for a = 7 and b = 26 return 15</span></div>
<div class="line"><span class="lineno"> 49</span> assert(<a class="code hl_function" href="#a618b198f74a88ab0023355b3a05d9ad6">imod</a>(7, 26) == 15);</div>
<div class="line"><span class="lineno"> 50</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;\nPassed!\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 51</span> </div>
<div class="line"><span class="lineno"> 52</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;\nAll test cases have successfully passed!\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 53</span>}</div>
<div class="fragment"><div class="line"><span class="lineno"> 37</span> {</div>
<div class="line"><span class="lineno"> 38</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;First case testing... \n&quot;</span>;</div>
<div class="line"><span class="lineno"> 39</span> <span class="comment">// for a = 3 and b = 11 return 4</span></div>
<div class="line"><span class="lineno"> 40</span> assert(<a class="code hl_function" href="#a618b198f74a88ab0023355b3a05d9ad6">imod</a>(3, 11) == 4);</div>
<div class="line"><span class="lineno"> 41</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;\nPassed!\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 42</span> </div>
<div class="line"><span class="lineno"> 43</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;Second case testing... \n&quot;</span>;</div>
<div class="line"><span class="lineno"> 44</span> <span class="comment">// for a = 3 and b = 26 return 9</span></div>
<div class="line"><span class="lineno"> 45</span> assert(<a class="code hl_function" href="#a618b198f74a88ab0023355b3a05d9ad6">imod</a>(3, 26) == 9);</div>
<div class="line"><span class="lineno"> 46</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;\nPassed!\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 47</span> </div>
<div class="line"><span class="lineno"> 48</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;Third case testing... \n&quot;</span>;</div>
<div class="line"><span class="lineno"> 49</span> <span class="comment">// for a = 7 and b = 26 return 15</span></div>
<div class="line"><span class="lineno"> 50</span> assert(<a class="code hl_function" href="#a618b198f74a88ab0023355b3a05d9ad6">imod</a>(7, 26) == 15);</div>
<div class="line"><span class="lineno"> 51</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;\nPassed!\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 52</span> </div>
<div class="line"><span class="lineno"> 53</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;\nAll test cases have successfully passed!\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 54</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="amodular__inverse__simple_8cpp_html_a618b198f74a88ab0023355b3a05d9ad6"><div class="ttname"><a href="#a618b198f74a88ab0023355b3a05d9ad6">imod</a></div><div class="ttdeci">uint64_t imod(uint64_t x, uint64_t y)</div><div class="ttdoc">for IO operations</div><div class="ttdef"><b>Definition</b> modular_inverse_simple.cpp:20</div></div>
<div class="ttc" id="amodular__inverse__simple_8cpp_html_a618b198f74a88ab0023355b3a05d9ad6"><div class="ttname"><a href="#a618b198f74a88ab0023355b3a05d9ad6">imod</a></div><div class="ttdeci">uint64_t imod(uint64_t x, uint64_t y)</div><div class="ttdoc">for assert</div><div class="ttdef"><b>Definition</b> modular_inverse_simple.cpp:21</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">

View File

@@ -1,5 +1,5 @@
<map id="test" name="test">
<area shape="rect" id="Node000001" title="self&#45;test implementations" alt="" coords="5,5,49,31"/>
<area shape="rect" id="Node000002" href="$d6/d2d/modular__inverse__simple_8cpp.html#a618b198f74a88ab0023355b3a05d9ad6" title="for IO operations" alt="" coords="97,5,146,31"/>
<area shape="rect" id="Node000002" href="$d6/d2d/modular__inverse__simple_8cpp.html#a618b198f74a88ab0023355b3a05d9ad6" title="for assert" alt="" coords="97,5,146,31"/>
<area shape="poly" id="edge1_Node000001_Node000002" title=" " alt="" coords="49,16,81,16,81,21,49,21"/>
</map>

View File

@@ -1 +1 @@
ba9de9851f1640018e799d4fcfa97dd2
fbc8d68de96efc0106d4060c9e36751e

View File

@@ -31,7 +31,7 @@
<!-- Node2 -->
<g id="Node000002" class="node">
<title>Node2</title>
<g id="a_Node000002"><a xlink:href="../../d6/d2d/modular__inverse__simple_8cpp.html#a618b198f74a88ab0023355b3a05d9ad6" target="_top" xlink:title="for IO operations">
<g id="a_Node000002"><a xlink:href="../../d6/d2d/modular__inverse__simple_8cpp.html#a618b198f74a88ab0023355b3a05d9ad6" target="_top" xlink:title="for assert">
<polygon fill="white" stroke="#666666" points="105.5,-19.25 68.5,-19.25 68.5,0 105.5,0 105.5,-19.25"/>
<text text-anchor="middle" x="87" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">imod</text>
</a>

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@@ -20,7 +20,7 @@
<!-- Node2 -->
<g id="Node000002" class="node">
<title>Node2</title>
<g id="a_Node000002"><a xlink:href="../../d6/d2d/modular__inverse__simple_8cpp.html#a618b198f74a88ab0023355b3a05d9ad6" target="_top" xlink:title="for IO operations">
<g id="a_Node000002"><a xlink:href="../../d6/d2d/modular__inverse__simple_8cpp.html#a618b198f74a88ab0023355b3a05d9ad6" target="_top" xlink:title="for assert">
<polygon fill="white" stroke="#666666" points="105.5,-19.25 68.5,-19.25 68.5,0 105.5,0 105.5,-19.25"/>
<text text-anchor="middle" x="87" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">imod</text>
</a>

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -2,6 +2,6 @@
<area shape="rect" id="Node000001" title="Main function." alt="" coords="5,5,55,31"/>
<area shape="rect" id="Node000002" href="$d6/d2d/modular__inverse__simple_8cpp.html#aa8dca7b867074164d5f45b0f3851269d" title="self&#45;test implementations" alt="" coords="103,5,146,31"/>
<area shape="poly" id="edge1_Node000001_Node000002" title=" " alt="" coords="55,16,87,16,87,21,55,21"/>
<area shape="rect" id="Node000003" href="$d6/d2d/modular__inverse__simple_8cpp.html#a618b198f74a88ab0023355b3a05d9ad6" title="for IO operations" alt="" coords="194,5,243,31"/>
<area shape="rect" id="Node000003" href="$d6/d2d/modular__inverse__simple_8cpp.html#a618b198f74a88ab0023355b3a05d9ad6" title="for assert" alt="" coords="194,5,243,31"/>
<area shape="poly" id="edge2_Node000002_Node000003" title=" " alt="" coords="146,16,178,16,178,21,146,21"/>
</map>

View File

@@ -1 +1 @@
bccd6ac9291697dc50bf9a0d4687c625
8b83b67a2084fe8f4843131e415507fa

View File

@@ -49,7 +49,7 @@
<!-- Node3 -->
<g id="Node000003" class="node">
<title>Node3</title>
<g id="a_Node000003"><a xlink:href="../../d6/d2d/modular__inverse__simple_8cpp.html#a618b198f74a88ab0023355b3a05d9ad6" target="_top" xlink:title="for IO operations">
<g id="a_Node000003"><a xlink:href="../../d6/d2d/modular__inverse__simple_8cpp.html#a618b198f74a88ab0023355b3a05d9ad6" target="_top" xlink:title="for assert">
<polygon fill="white" stroke="#666666" points="178.5,-19.25 141.5,-19.25 141.5,0 178.5,0 178.5,-19.25"/>
<text text-anchor="middle" x="160" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">imod</text>
</a>

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@@ -38,7 +38,7 @@
<!-- Node3 -->
<g id="Node000003" class="node">
<title>Node3</title>
<g id="a_Node000003"><a xlink:href="../../d6/d2d/modular__inverse__simple_8cpp.html#a618b198f74a88ab0023355b3a05d9ad6" target="_top" xlink:title="for IO operations">
<g id="a_Node000003"><a xlink:href="../../d6/d2d/modular__inverse__simple_8cpp.html#a618b198f74a88ab0023355b3a05d9ad6" target="_top" xlink:title="for assert">
<polygon fill="white" stroke="#666666" points="178.5,-19.25 141.5,-19.25 141.5,0 178.5,0 178.5,-19.25"/>
<text text-anchor="middle" x="160" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">imod</text>
</a>

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@@ -447,7 +447,7 @@ template&lt;size_t N&gt; </div>
<div class="line"><span class="lineno"> 173</span> }</div>
<div class="line"><span class="lineno"> 174</span> }</div>
<div class="ttc" id="aclassmachine__learning_1_1adaline_html_a74e3c6c037b67895014414c5d75465e5"><div class="ttname"><a href="#a74e3c6c037b67895014414c5d75465e5">machine_learning::adaline::fit</a></div><div class="ttdeci">double fit(const std::vector&lt; double &gt; &amp;x, const int &amp;y)</div><div class="ttdef"><b>Definition</b> adaline_learning.cpp:119</div></div>
<div class="ttc" id="adata__structures_2sparse__table_8cpp_html_a10f3ffb3f6f7e1b83d556b9c8de89a5d"><div class="ttname"><a href="../../d6/d42/data__structures_2sparse__table_8cpp.html#a10f3ffb3f6f7e1b83d556b9c8de89a5d">data_structures::sparse_table::N</a></div><div class="ttdeci">constexpr uint32_t N</div><div class="ttdoc">A struct to represent sparse table for min() as their invariant function, for the given array A....</div><div class="ttdef"><b>Definition</b> sparse_table.cpp:47</div></div>
<div class="ttc" id="adata__structures_2sparse__table_8cpp_html_a10f3ffb3f6f7e1b83d556b9c8de89a5d"><div class="ttname"><a href="../../d6/d42/data__structures_2sparse__table_8cpp.html#a10f3ffb3f6f7e1b83d556b9c8de89a5d">data_structures::sparse_table::N</a></div><div class="ttdeci">constexpr uint32_t N</div><div class="ttdoc">A struct to represent sparse table for min() as their invariant function, for the given array A....</div><div class="ttdef"><b>Definition</b> sparse_table.cpp:48</div></div>
<div class="ttc" id="agroup__machine__learning_html_ga5118e5cbc4f0886e27b3a7a2544dded1"><div class="ttname"><a href="../../d9/d66/group__machine__learning.html#ga5118e5cbc4f0886e27b3a7a2544dded1">MAX_ITER</a></div><div class="ttdeci">constexpr int MAX_ITER</div><div class="ttdef"><b>Definition</b> adaline_learning.cpp:40</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>

View File

@@ -125,7 +125,7 @@ Include dependency graph for find_non_repeating_number.cpp:</div>
<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="../../d7/d81/namespacebit__manipulation.html">bit_manipulation</a></td></tr>
<tr class="memdesc:d7/d81/namespacebit__manipulation"><td class="mdescLeft">&#160;</td><td class="mdescRight">for IO operations <br /></td></tr>
<tr class="memdesc:d7/d81/namespacebit__manipulation"><td class="mdescLeft">&#160;</td><td class="mdescRight">for assert <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">namespace &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d2/da7/namespacefind__non__repeating__integer.html">find_non_repeating_integer</a></td></tr>
<tr class="memdesc:d2/da7/namespacefind__non__repeating__integer"><td class="mdescLeft">&#160;</td><td class="mdescRight">Functions to find the non repeating integer in an array of repeating integers. <a href="https://leetcode.com/problems/single-number/" target="_blank">Single Number</a> <br /></td></tr>

View File

@@ -1,11 +1,13 @@
<map id="numerical_methods/newton_raphson_method.cpp" name="numerical_methods/newton_raphson_method.cpp">
<area shape="rect" id="Node000001" title="Solve the equation &#160;using Newton&#45;Raphson method for both real and complex solutions." alt="" coords="66,5,247,46"/>
<area shape="rect" id="Node000001" title="Solve the equation &#160;using Newton&#45;Raphson method for both real and complex solutions." alt="" coords="108,5,288,46"/>
<area shape="rect" id="Node000002" title=" " alt="" coords="5,94,63,120"/>
<area shape="poly" id="edge1_Node000001_Node000002" title=" " alt="" coords="128,49,67,88,64,83,125,44"/>
<area shape="rect" id="Node000003" title=" " alt="" coords="87,94,141,120"/>
<area shape="poly" id="edge2_Node000001_Node000003" title=" " alt="" coords="148,48,130,81,126,79,144,45"/>
<area shape="rect" id="Node000004" title=" " alt="" coords="165,94,236,120"/>
<area shape="poly" id="edge3_Node000001_Node000004" title=" " alt="" coords="170,45,189,79,184,82,165,48"/>
<area shape="rect" id="Node000005" title=" " alt="" coords="260,94,312,120"/>
<area shape="poly" id="edge4_Node000001_Node000005" title=" " alt="" coords="190,44,255,83,252,88,187,49"/>
<area shape="poly" id="edge1_Node000001_Node000002" title=" " alt="" coords="158,49,74,89,72,85,156,44"/>
<area shape="rect" id="Node000003" title=" " alt="" coords="86,94,147,120"/>
<area shape="poly" id="edge2_Node000001_Node000003" title=" " alt="" coords="180,48,142,85,138,81,176,44"/>
<area shape="rect" id="Node000004" title=" " alt="" coords="171,94,225,120"/>
<area shape="poly" id="edge3_Node000001_Node000004" title=" " alt="" coords="201,46,201,78,195,78,195,46"/>
<area shape="rect" id="Node000005" title=" " alt="" coords="249,94,320,120"/>
<area shape="poly" id="edge4_Node000001_Node000005" title=" " alt="" coords="221,44,262,81,258,85,218,48"/>
<area shape="rect" id="Node000006" title=" " alt="" coords="344,94,396,120"/>
<area shape="poly" id="edge5_Node000001_Node000006" title=" " alt="" coords="242,44,331,85,329,90,240,49"/>
</map>

View File

@@ -1 +1 @@
93649f2a32043d469eae8cd032d2b96f
ca16c4c2e2102852b83778a716e1b526

View File

@@ -4,8 +4,8 @@
<!-- Generated by graphviz version 12.1.2 (20240928.0832)
-->
<!-- Title: numerical_methods/newton_raphson_method.cpp Pages: 1 -->
<svg width="238pt" height="94pt"
viewBox="0.00 0.00 238.12 93.75" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<svg width="301pt" height="94pt"
viewBox="0.00 0.00 301.12 93.75" 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">
@@ -23,9 +23,9 @@
<g id="Node000001" class="node">
<title>Node1</title>
<g id="a_Node000001"><a xlink:title="Solve the equation &#160;using Newton&#45;Raphson method for both real and complex solutions.">
<polygon fill="#999999" stroke="#666666" points="181.12,-85.75 45.88,-85.75 45.88,-55.25 181.12,-55.25 181.12,-85.75"/>
<text text-anchor="start" x="53.88" y="-72.25" font-family="Helvetica,sans-Serif" font-size="10.00">numerical_methods/newton</text>
<text text-anchor="middle" x="113.5" y="-61" font-family="Helvetica,sans-Serif" font-size="10.00">_raphson_method.cpp</text>
<polygon fill="#999999" stroke="#666666" points="212.12,-85.75 76.88,-85.75 76.88,-55.25 212.12,-55.25 212.12,-85.75"/>
<text text-anchor="start" x="84.88" y="-72.25" font-family="Helvetica,sans-Serif" font-size="10.00">numerical_methods/newton</text>
<text text-anchor="middle" x="144.5" y="-61" font-family="Helvetica,sans-Serif" font-size="10.00">_raphson_method.cpp</text>
</a>
</g>
</g>
@@ -42,8 +42,8 @@
<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="M90.76,-54.95C76.89,-46.07 59.18,-34.74 45.15,-25.76"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="47.27,-22.96 36.96,-20.52 43.49,-28.86 47.27,-22.96"/>
<path fill="none" stroke="#63b8ff" d="M113.78,-54.8C94.42,-45.53 69.57,-33.63 50.54,-24.52"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="52.26,-21.47 41.73,-20.31 49.24,-27.78 52.26,-21.47"/>
</a>
</g>
</g>
@@ -51,8 +51,8 @@
<g id="Node000003" class="node">
<title>Node3</title>
<g id="a_Node000003"><a xlink:title=" ">
<polygon fill="#e0e0e0" stroke="#999999" points="101.5,-19.25 61.5,-19.25 61.5,0 101.5,0 101.5,-19.25"/>
<text text-anchor="middle" x="81.5" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">ctime</text>
<polygon fill="#e0e0e0" stroke="#999999" points="106.12,-19.25 60.88,-19.25 60.88,0 106.12,0 106.12,-19.25"/>
<text text-anchor="middle" x="83.5" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">cstdint</text>
</a>
</g>
</g>
@@ -60,8 +60,8 @@
<g id="edge2_Node000001_Node000003" class="edge">
<title>Node1&#45;&gt;Node3</title>
<g id="a_edge2_Node000001_Node000003"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M105.59,-54.95C101.47,-47.36 96.37,-37.99 91.93,-29.82"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="95.01,-28.15 87.16,-21.03 88.86,-31.49 95.01,-28.15"/>
<path fill="none" stroke="#63b8ff" d="M129.42,-54.95C120.85,-46.67 110.07,-36.27 101.11,-27.62"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="103.62,-25.18 93.99,-20.75 98.76,-30.22 103.62,-25.18"/>
</a>
</g>
</g>
@@ -69,8 +69,8 @@
<g id="Node000004" class="node">
<title>Node4</title>
<g id="a_Node000004"><a xlink:title=" ">
<polygon fill="#e0e0e0" stroke="#999999" points="173.25,-19.25 119.75,-19.25 119.75,0 173.25,0 173.25,-19.25"/>
<text text-anchor="middle" x="146.5" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">iostream</text>
<polygon fill="#e0e0e0" stroke="#999999" points="164.5,-19.25 124.5,-19.25 124.5,0 164.5,0 164.5,-19.25"/>
<text text-anchor="middle" x="144.5" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">ctime</text>
</a>
</g>
</g>
@@ -78,8 +78,8 @@
<g id="edge3_Node000001_Node000004" class="edge">
<title>Node1&#45;&gt;Node4</title>
<g id="a_edge3_Node000001_Node000004"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M121.66,-54.95C125.96,-47.28 131.28,-37.77 135.9,-29.54"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="138.84,-31.46 140.67,-21.02 132.73,-28.03 138.84,-31.46"/>
<path fill="none" stroke="#63b8ff" d="M144.5,-54.95C144.5,-47.71 144.5,-38.84 144.5,-30.94"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="148,-31.21 144.5,-21.21 141,-31.21 148,-31.21"/>
</a>
</g>
</g>
@@ -87,8 +87,8 @@
<g id="Node000005" class="node">
<title>Node5</title>
<g id="a_Node000005"><a xlink:title=" ">
<polygon fill="#e0e0e0" stroke="#999999" points="230.12,-19.25 190.88,-19.25 190.88,0 230.12,0 230.12,-19.25"/>
<text text-anchor="middle" x="210.5" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">limits</text>
<polygon fill="#e0e0e0" stroke="#999999" points="236.25,-19.25 182.75,-19.25 182.75,0 236.25,0 236.25,-19.25"/>
<text text-anchor="middle" x="209.5" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">iostream</text>
</a>
</g>
</g>
@@ -96,8 +96,26 @@
<g id="edge4_Node000001_Node000005" class="edge">
<title>Node1&#45;&gt;Node5</title>
<g id="a_edge4_Node000001_Node000005"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M137.48,-54.95C152.25,-45.98 171.13,-34.52 186,-25.5"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="187.52,-28.67 194.25,-20.49 183.89,-22.68 187.52,-28.67"/>
<path fill="none" stroke="#63b8ff" d="M160.57,-54.95C169.8,-46.59 181.43,-36.05 191.03,-27.35"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="193.3,-30.02 198.36,-20.72 188.6,-24.84 193.3,-30.02"/>
</a>
</g>
</g>
<!-- Node6 -->
<g id="Node000006" class="node">
<title>Node6</title>
<g id="a_Node000006"><a xlink:title=" ">
<polygon fill="#e0e0e0" stroke="#999999" points="293.12,-19.25 253.88,-19.25 253.88,0 293.12,0 293.12,-19.25"/>
<text text-anchor="middle" x="273.5" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">limits</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node6 -->
<g id="edge5_Node000001_Node000006" class="edge">
<title>Node1&#45;&gt;Node6</title>
<g id="a_edge5_Node000001_Node000006"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M176.72,-54.8C197.12,-45.48 223.33,-33.52 243.32,-24.4"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="244.7,-27.62 252.34,-20.28 241.79,-21.25 244.7,-27.62"/>
</a>
</g>
</g>

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

@@ -4,17 +4,17 @@
<!-- Generated by graphviz version 12.1.2 (20240928.0832)
-->
<!-- Title: numerical_methods/newton_raphson_method.cpp Pages: 1 -->
<svg width="238pt" height="94pt"
viewBox="0.00 0.00 238.12 93.75" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<svg width="301pt" height="94pt"
viewBox="0.00 0.00 301.12 93.75" 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 89.75)">
<title>numerical_methods/newton_raphson_method.cpp</title>
<!-- Node1 -->
<g id="Node000001" class="node">
<title>Node1</title>
<g id="a_Node000001"><a xlink:title="Solve the equation &#160;using Newton&#45;Raphson method for both real and complex solutions.">
<polygon fill="#999999" stroke="#666666" points="181.12,-85.75 45.88,-85.75 45.88,-55.25 181.12,-55.25 181.12,-85.75"/>
<text text-anchor="start" x="53.88" y="-72.25" font-family="Helvetica,sans-Serif" font-size="10.00">numerical_methods/newton</text>
<text text-anchor="middle" x="113.5" y="-61" font-family="Helvetica,sans-Serif" font-size="10.00">_raphson_method.cpp</text>
<polygon fill="#999999" stroke="#666666" points="212.12,-85.75 76.88,-85.75 76.88,-55.25 212.12,-55.25 212.12,-85.75"/>
<text text-anchor="start" x="84.88" y="-72.25" font-family="Helvetica,sans-Serif" font-size="10.00">numerical_methods/newton</text>
<text text-anchor="middle" x="144.5" y="-61" font-family="Helvetica,sans-Serif" font-size="10.00">_raphson_method.cpp</text>
</a>
</g>
</g>
@@ -31,8 +31,8 @@
<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="M90.76,-54.95C76.89,-46.07 59.18,-34.74 45.15,-25.76"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="47.27,-22.96 36.96,-20.52 43.49,-28.86 47.27,-22.96"/>
<path fill="none" stroke="#63b8ff" d="M113.78,-54.8C94.42,-45.53 69.57,-33.63 50.54,-24.52"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="52.26,-21.47 41.73,-20.31 49.24,-27.78 52.26,-21.47"/>
</a>
</g>
</g>
@@ -40,8 +40,8 @@
<g id="Node000003" class="node">
<title>Node3</title>
<g id="a_Node000003"><a xlink:title=" ">
<polygon fill="#e0e0e0" stroke="#999999" points="101.5,-19.25 61.5,-19.25 61.5,0 101.5,0 101.5,-19.25"/>
<text text-anchor="middle" x="81.5" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">ctime</text>
<polygon fill="#e0e0e0" stroke="#999999" points="106.12,-19.25 60.88,-19.25 60.88,0 106.12,0 106.12,-19.25"/>
<text text-anchor="middle" x="83.5" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">cstdint</text>
</a>
</g>
</g>
@@ -49,8 +49,8 @@
<g id="edge2_Node000001_Node000003" class="edge">
<title>Node1&#45;&gt;Node3</title>
<g id="a_edge2_Node000001_Node000003"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M105.59,-54.95C101.47,-47.36 96.37,-37.99 91.93,-29.82"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="95.01,-28.15 87.16,-21.03 88.86,-31.49 95.01,-28.15"/>
<path fill="none" stroke="#63b8ff" d="M129.42,-54.95C120.85,-46.67 110.07,-36.27 101.11,-27.62"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="103.62,-25.18 93.99,-20.75 98.76,-30.22 103.62,-25.18"/>
</a>
</g>
</g>
@@ -58,8 +58,8 @@
<g id="Node000004" class="node">
<title>Node4</title>
<g id="a_Node000004"><a xlink:title=" ">
<polygon fill="#e0e0e0" stroke="#999999" points="173.25,-19.25 119.75,-19.25 119.75,0 173.25,0 173.25,-19.25"/>
<text text-anchor="middle" x="146.5" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">iostream</text>
<polygon fill="#e0e0e0" stroke="#999999" points="164.5,-19.25 124.5,-19.25 124.5,0 164.5,0 164.5,-19.25"/>
<text text-anchor="middle" x="144.5" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">ctime</text>
</a>
</g>
</g>
@@ -67,8 +67,8 @@
<g id="edge3_Node000001_Node000004" class="edge">
<title>Node1&#45;&gt;Node4</title>
<g id="a_edge3_Node000001_Node000004"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M121.66,-54.95C125.96,-47.28 131.28,-37.77 135.9,-29.54"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="138.84,-31.46 140.67,-21.02 132.73,-28.03 138.84,-31.46"/>
<path fill="none" stroke="#63b8ff" d="M144.5,-54.95C144.5,-47.71 144.5,-38.84 144.5,-30.94"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="148,-31.21 144.5,-21.21 141,-31.21 148,-31.21"/>
</a>
</g>
</g>
@@ -76,8 +76,8 @@
<g id="Node000005" class="node">
<title>Node5</title>
<g id="a_Node000005"><a xlink:title=" ">
<polygon fill="#e0e0e0" stroke="#999999" points="230.12,-19.25 190.88,-19.25 190.88,0 230.12,0 230.12,-19.25"/>
<text text-anchor="middle" x="210.5" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">limits</text>
<polygon fill="#e0e0e0" stroke="#999999" points="236.25,-19.25 182.75,-19.25 182.75,0 236.25,0 236.25,-19.25"/>
<text text-anchor="middle" x="209.5" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">iostream</text>
</a>
</g>
</g>
@@ -85,8 +85,26 @@
<g id="edge4_Node000001_Node000005" class="edge">
<title>Node1&#45;&gt;Node5</title>
<g id="a_edge4_Node000001_Node000005"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M137.48,-54.95C152.25,-45.98 171.13,-34.52 186,-25.5"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="187.52,-28.67 194.25,-20.49 183.89,-22.68 187.52,-28.67"/>
<path fill="none" stroke="#63b8ff" d="M160.57,-54.95C169.8,-46.59 181.43,-36.05 191.03,-27.35"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="193.3,-30.02 198.36,-20.72 188.6,-24.84 193.3,-30.02"/>
</a>
</g>
</g>
<!-- Node6 -->
<g id="Node000006" class="node">
<title>Node6</title>
<g id="a_Node000006"><a xlink:title=" ">
<polygon fill="#e0e0e0" stroke="#999999" points="293.12,-19.25 253.88,-19.25 253.88,0 293.12,0 293.12,-19.25"/>
<text text-anchor="middle" x="273.5" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">limits</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node6 -->
<g id="edge5_Node000001_Node000006" class="edge">
<title>Node1&#45;&gt;Node6</title>
<g id="a_edge5_Node000001_Node000006"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M176.72,-54.8C197.12,-45.48 223.33,-33.52 243.32,-24.4"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="244.7,-27.62 252.34,-20.28 241.79,-21.25 244.7,-27.62"/>
</a>
</g>
</g>

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@@ -117,11 +117,12 @@ $(function(){initNavTree('d6/d42/data__structures_2sparse__table_8cpp.html','../
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &lt;array&gt;</code><br />
<code>#include &lt;cassert&gt;</code><br />
<code>#include &lt;cstdint&gt;</code><br />
<code>#include &lt;iostream&gt;</code><br />
</div><div class="textblock"><div class="dynheader">
Include dependency graph for sparse_table.cpp:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../df/d88/data__structures_2sparse__table_8cpp__incl.svg" width="246" height="126"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
<div class="center"><iframe scrolling="no" frameborder="0" src="../../df/d88/data__structures_2sparse__table_8cpp__incl.svg" width="330" 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">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="nested-classes" name="nested-classes"></a>
@@ -193,11 +194,11 @@ constexpr uint8_t&#160;</td><td class="memItemRight" valign="bottom"><b>data_str
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 on exit </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 161</span> {</div>
<div class="line"><span class="lineno"> 162</span> <a class="code hl_function" href="#aa8dca7b867074164d5f45b0f3851269d">test</a>(); <span class="comment">// run self-test implementations</span></div>
<div class="line"><span class="lineno"> 163</span> <span class="keywordflow">return</span> 0;</div>
<div class="line"><span class="lineno"> 164</span>}</div>
<div class="ttc" id="adata__structures_2sparse__table_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> sparse_table.cpp:128</div></div>
<div class="fragment"><div class="line"><span class="lineno"> 162</span> {</div>
<div class="line"><span class="lineno"> 163</span> <a class="code hl_function" href="#aa8dca7b867074164d5f45b0f3851269d">test</a>(); <span class="comment">// run self-test implementations</span></div>
<div class="line"><span class="lineno"> 164</span> <span class="keywordflow">return</span> 0;</div>
<div class="line"><span class="lineno"> 165</span>}</div>
<div class="ttc" id="adata__structures_2sparse__table_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> sparse_table.cpp:129</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
@@ -240,39 +241,39 @@ Here is the call graph for this function:</div>
<p>&lt; as 1 is smallest from 1..9</p>
<p>&lt; as 2 is smallest from 2..6</p>
<p>&lt; as 3 is smallest from 3..8</p>
<div class="fragment"><div class="line"><span class="lineno"> 128</span> {</div>
<div class="line"><span class="lineno"> 129</span> <span class="comment">/* We take an array as an input on which we need to perform the ranged</span></div>
<div class="line"><span class="lineno"> 130</span><span class="comment"> * minimum queries[RMQ](https://en.wikipedia.org/wiki/Range_minimum_query).</span></div>
<div class="line"><span class="lineno"> 131</span><span class="comment"> */</span></div>
<div class="line"><span class="lineno"> 132</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/array.html">std::array&lt;int64_t, 10&gt;</a> testcase = {</div>
<div class="line"><span class="lineno"> 133</span> 1, 2, 3, 4, 5,</div>
<div class="line"><span class="lineno"> 134</span> 6, 7, 8, 9, 10}; <span class="comment">///&lt; array on which RMQ will be performed.</span></div>
<div class="line"><span class="lineno"> 135</span> <span class="keywordtype">size_t</span> testcase_size =</div>
<div class="line"><span class="lineno"> 136</span> <span class="keyword">sizeof</span>(testcase) / <span class="keyword">sizeof</span>(testcase[0]); <span class="comment">///&lt; size of self test&#39;s array</span></div>
<div class="line"><span class="lineno"> 137</span> </div>
<div class="line"><span class="lineno"> 138</span> <a class="code hl_struct" href="../../da/d37/structdata__structures_1_1sparse__table_1_1_sparse__table.html">data_structures::sparse_table::Sparse_table</a></div>
<div class="line"><span class="lineno"> 139</span> st{}; <span class="comment">///&lt; declaring sparse tree</span></div>
<div class="line"><span class="lineno"> 140</span> </div>
<div class="line"><span class="lineno"> 141</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/copy.html">std::copy</a>(<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/begin.html">std::begin</a>(testcase), <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/end.html">std::end</a>(testcase),</div>
<div class="line"><span class="lineno"> 142</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/begin.html">std::begin</a>(st.A)); <span class="comment">///&lt; copying array to the struct</span></div>
<div class="line"><span class="lineno"> 143</span> st.n = testcase_size; <span class="comment">///&lt; passing the array&#39;s size to the struct</span></div>
<div class="line"><span class="lineno"> 144</span> </div>
<div class="line"><span class="lineno"> 145</span> st.buildST(); <span class="comment">///&lt; precomputing sparse tree</span></div>
<div class="line"><span class="lineno"> 146</span> </div>
<div class="line"><span class="lineno"> 147</span> <span class="comment">// pass queries of the form: [l,r]</span></div>
<div class="line"><span class="lineno"> 148</span> assert(st.query(1, 9) == 1); <span class="comment">///&lt; as 1 is smallest from 1..9</span></div>
<div class="line"><span class="lineno"> 149</span> assert(st.query(2, 6) == 2); <span class="comment">///&lt; as 2 is smallest from 2..6</span></div>
<div class="line"><span class="lineno"> 150</span> assert(st.query(3, 8) == 3); <span class="comment">///&lt; as 3 is smallest from 3..8</span></div>
<div class="line"><span class="lineno"> 151</span> </div>
<div class="line"><span class="lineno"> 152</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;Self-test implementations passed!&quot;</span> &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><span class="lineno"> 153</span>}</div>
<div class="fragment"><div class="line"><span class="lineno"> 129</span> {</div>
<div class="line"><span class="lineno"> 130</span> <span class="comment">/* We take an array as an input on which we need to perform the ranged</span></div>
<div class="line"><span class="lineno"> 131</span><span class="comment"> * minimum queries[RMQ](https://en.wikipedia.org/wiki/Range_minimum_query).</span></div>
<div class="line"><span class="lineno"> 132</span><span class="comment"> */</span></div>
<div class="line"><span class="lineno"> 133</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/array.html">std::array&lt;int64_t, 10&gt;</a> testcase = {</div>
<div class="line"><span class="lineno"> 134</span> 1, 2, 3, 4, 5,</div>
<div class="line"><span class="lineno"> 135</span> 6, 7, 8, 9, 10}; <span class="comment">///&lt; array on which RMQ will be performed.</span></div>
<div class="line"><span class="lineno"> 136</span> <span class="keywordtype">size_t</span> testcase_size =</div>
<div class="line"><span class="lineno"> 137</span> <span class="keyword">sizeof</span>(testcase) / <span class="keyword">sizeof</span>(testcase[0]); <span class="comment">///&lt; size of self test&#39;s array</span></div>
<div class="line"><span class="lineno"> 138</span> </div>
<div class="line"><span class="lineno"> 139</span> <a class="code hl_struct" href="../../da/d37/structdata__structures_1_1sparse__table_1_1_sparse__table.html">data_structures::sparse_table::Sparse_table</a></div>
<div class="line"><span class="lineno"> 140</span> st{}; <span class="comment">///&lt; declaring sparse tree</span></div>
<div class="line"><span class="lineno"> 141</span> </div>
<div class="line"><span class="lineno"> 142</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/copy.html">std::copy</a>(<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/begin.html">std::begin</a>(testcase), <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/end.html">std::end</a>(testcase),</div>
<div class="line"><span class="lineno"> 143</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/begin.html">std::begin</a>(st.A)); <span class="comment">///&lt; copying array to the struct</span></div>
<div class="line"><span class="lineno"> 144</span> st.n = testcase_size; <span class="comment">///&lt; passing the array&#39;s size to the struct</span></div>
<div class="line"><span class="lineno"> 145</span> </div>
<div class="line"><span class="lineno"> 146</span> st.buildST(); <span class="comment">///&lt; precomputing sparse tree</span></div>
<div class="line"><span class="lineno"> 147</span> </div>
<div class="line"><span class="lineno"> 148</span> <span class="comment">// pass queries of the form: [l,r]</span></div>
<div class="line"><span class="lineno"> 149</span> assert(st.query(1, 9) == 1); <span class="comment">///&lt; as 1 is smallest from 1..9</span></div>
<div class="line"><span class="lineno"> 150</span> assert(st.query(2, 6) == 2); <span class="comment">///&lt; as 2 is smallest from 2..6</span></div>
<div class="line"><span class="lineno"> 151</span> assert(st.query(3, 8) == 3); <span class="comment">///&lt; as 3 is smallest from 3..8</span></div>
<div class="line"><span class="lineno"> 152</span> </div>
<div class="line"><span class="lineno"> 153</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;Self-test implementations passed!&quot;</span> &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><span class="lineno"> 154</span>}</div>
<div class="ttc" id="aarray_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/array.html">std::array</a></div></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="abegin_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/iterator/begin.html">std::begin</a></div><div class="ttdeci">T begin(T... args)</div></div>
<div class="ttc" id="acopy_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/algorithm/copy.html">std::copy</a></div><div class="ttdeci">T copy(T... args)</div></div>
<div class="ttc" id="aend_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/iterator/end.html">std::end</a></div><div class="ttdeci">T end(T... args)</div></div>
<div class="ttc" id="aendl_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a></div><div class="ttdeci">T endl(T... args)</div></div>
<div class="ttc" id="astructdata__structures_1_1sparse__table_1_1_sparse__table_html"><div class="ttname"><a href="../../da/d37/structdata__structures_1_1sparse__table_1_1_sparse__table.html">data_structures::sparse_table::Sparse_table</a></div><div class="ttdef"><b>Definition</b> sparse_table.cpp:50</div></div>
<div class="ttc" id="astructdata__structures_1_1sparse__table_1_1_sparse__table_html"><div class="ttname"><a href="../../da/d37/structdata__structures_1_1sparse__table_1_1_sparse__table.html">data_structures::sparse_table::Sparse_table</a></div><div class="ttdef"><b>Definition</b> sparse_table.cpp:51</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">

View File

@@ -409,7 +409,7 @@ template&lt;typename T &gt; </div>
<div class="line"><span class="lineno"> 25</span> }</div>
<div class="line"><span class="lineno"> 26</span> <span class="keywordflow">return</span> <a class="code hl_function" href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">result</a>;</div>
<div class="line"><span class="lineno"> 27</span>}</div>
<div class="ttc" id="afibonacci__sum_8cpp_html_aadb40ac4c74a7efc0680b83eeee138aa"><div class="ttname"><a href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">math::fibonacci_sum::result</a></div><div class="ttdeci">uint64_t result(uint64_t n)</div><div class="ttdef"><b>Definition</b> fibonacci_sum.cpp:76</div></div>
<div class="ttc" id="afibonacci__sum_8cpp_html_aadb40ac4c74a7efc0680b83eeee138aa"><div class="ttname"><a href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">math::fibonacci_sum::result</a></div><div class="ttdeci">uint64_t result(uint64_t n)</div><div class="ttdef"><b>Definition</b> fibonacci_sum.cpp:77</div></div>
</div><!-- fragment -->
</div>
</div>

View File

@@ -1,7 +1,9 @@
<map id="bit_manipulation/hamming_distance.cpp" name="bit_manipulation/hamming_distance.cpp">
<area shape="rect" id="Node000001" title="Returns the Hamming distance between two integers." alt="" coords="5,5,178,46"/>
<area shape="rect" id="Node000002" title=" " alt="" coords="14,94,78,120"/>
<area shape="poly" id="edge1_Node000001_Node000002" title=" " alt="" coords="83,48,63,82,58,79,78,45"/>
<area shape="rect" id="Node000003" title=" " alt="" coords="102,94,174,120"/>
<area shape="poly" id="edge2_Node000001_Node000003" title=" " alt="" coords="105,45,125,79,121,82,101,48"/>
<area shape="rect" id="Node000001" title="Returns the Hamming distance between two integers." alt="" coords="38,5,210,46"/>
<area shape="rect" id="Node000002" title=" " alt="" coords="5,94,70,120"/>
<area shape="poly" id="edge1_Node000001_Node000002" title=" " alt="" coords="105,48,64,85,60,81,101,44"/>
<area shape="rect" id="Node000003" title=" " alt="" coords="94,94,154,120"/>
<area shape="poly" id="edge2_Node000001_Node000003" title=" " alt="" coords="127,46,127,78,122,78,122,46"/>
<area shape="rect" id="Node000004" title=" " alt="" coords="178,94,249,120"/>
<area shape="poly" id="edge3_Node000001_Node000004" title=" " alt="" coords="148,44,190,82,187,86,144,48"/>
</map>

View File

@@ -1 +1 @@
b1667788f629f29092dafc0c7e82c894
f8b4be1ee5a65bf383fa0f2e84f9b14e

View File

@@ -4,8 +4,8 @@
<!-- Generated by graphviz version 12.1.2 (20240928.0832)
-->
<!-- Title: bit_manipulation/hamming_distance.cpp Pages: 1 -->
<svg width="137pt" height="94pt"
viewBox="0.00 0.00 137.25 93.75" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<svg width="191pt" height="94pt"
viewBox="0.00 0.00 190.88 93.75" 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">
@@ -23,9 +23,9 @@
<g id="Node000001" class="node">
<title>Node1</title>
<g id="a_Node000001"><a xlink:title="Returns the Hamming distance between two integers.">
<polygon fill="#999999" stroke="#666666" points="129.25,-85.75 0,-85.75 0,-55.25 129.25,-55.25 129.25,-85.75"/>
<text text-anchor="start" x="8" y="-72.25" font-family="Helvetica,sans-Serif" font-size="10.00">bit_manipulation/hamming</text>
<text text-anchor="middle" x="64.62" y="-61" font-family="Helvetica,sans-Serif" font-size="10.00">_distance.cpp</text>
<polygon fill="#999999" stroke="#666666" points="153.75,-85.75 24.5,-85.75 24.5,-55.25 153.75,-55.25 153.75,-85.75"/>
<text text-anchor="start" x="32.5" y="-72.25" font-family="Helvetica,sans-Serif" font-size="10.00">bit_manipulation/hamming</text>
<text text-anchor="middle" x="89.12" y="-61" font-family="Helvetica,sans-Serif" font-size="10.00">_distance.cpp</text>
</a>
</g>
</g>
@@ -33,8 +33,8 @@
<g id="Node000002" class="node">
<title>Node2</title>
<g id="a_Node000002"><a xlink:title=" ">
<polygon fill="#e0e0e0" stroke="#999999" points="54.75,-19.25 6.5,-19.25 6.5,0 54.75,0 54.75,-19.25"/>
<text text-anchor="middle" x="30.62" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">cassert</text>
<polygon fill="#e0e0e0" stroke="#999999" points="48.25,-19.25 0,-19.25 0,0 48.25,0 48.25,-19.25"/>
<text text-anchor="middle" x="24.12" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">cassert</text>
</a>
</g>
</g>
@@ -42,8 +42,8 @@
<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="M56.22,-54.95C51.79,-47.28 46.3,-37.77 41.55,-29.54"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="44.66,-27.92 36.62,-21.01 38.59,-31.42 44.66,-27.92"/>
<path fill="none" stroke="#63b8ff" d="M73.06,-54.95C63.83,-46.59 52.2,-36.05 42.59,-27.35"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="45.03,-24.84 35.27,-20.72 40.33,-30.02 45.03,-24.84"/>
</a>
</g>
</g>
@@ -51,8 +51,8 @@
<g id="Node000003" class="node">
<title>Node3</title>
<g id="a_Node000003"><a xlink:title=" ">
<polygon fill="#e0e0e0" stroke="#999999" points="126.38,-19.25 72.88,-19.25 72.88,0 126.38,0 126.38,-19.25"/>
<text text-anchor="middle" x="99.62" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">iostream</text>
<polygon fill="#e0e0e0" stroke="#999999" points="111.75,-19.25 66.5,-19.25 66.5,0 111.75,0 111.75,-19.25"/>
<text text-anchor="middle" x="89.12" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">cstdint</text>
</a>
</g>
</g>
@@ -60,8 +60,26 @@
<g id="edge2_Node000001_Node000003" class="edge">
<title>Node1&#45;&gt;Node3</title>
<g id="a_edge2_Node000001_Node000003"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M73.28,-54.95C77.84,-47.28 83.49,-37.77 88.38,-29.54"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="91.35,-31.39 93.46,-21 85.34,-27.81 91.35,-31.39"/>
<path fill="none" stroke="#63b8ff" d="M89.12,-54.95C89.12,-47.71 89.12,-38.84 89.12,-30.94"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="92.63,-31.21 89.13,-21.21 85.63,-31.21 92.63,-31.21"/>
</a>
</g>
</g>
<!-- Node4 -->
<g id="Node000004" class="node">
<title>Node4</title>
<g id="a_Node000004"><a xlink:title=" ">
<polygon fill="#e0e0e0" stroke="#999999" points="182.88,-19.25 129.38,-19.25 129.38,0 182.88,0 182.88,-19.25"/>
<text text-anchor="middle" x="156.12" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">iostream</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node4 -->
<g id="edge3_Node000001_Node000004" class="edge">
<title>Node1&#45;&gt;Node4</title>
<g id="a_edge3_Node000001_Node000004"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M105.69,-54.95C115.3,-46.5 127.44,-35.83 137.4,-27.08"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="139.46,-29.93 144.66,-20.7 134.84,-24.67 139.46,-29.93"/>
</a>
</g>
</g>

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@@ -4,17 +4,17 @@
<!-- Generated by graphviz version 12.1.2 (20240928.0832)
-->
<!-- Title: bit_manipulation/hamming_distance.cpp Pages: 1 -->
<svg width="137pt" height="94pt"
viewBox="0.00 0.00 137.25 93.75" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<svg width="191pt" height="94pt"
viewBox="0.00 0.00 190.88 93.75" 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 89.75)">
<title>bit_manipulation/hamming_distance.cpp</title>
<!-- Node1 -->
<g id="Node000001" class="node">
<title>Node1</title>
<g id="a_Node000001"><a xlink:title="Returns the Hamming distance between two integers.">
<polygon fill="#999999" stroke="#666666" points="129.25,-85.75 0,-85.75 0,-55.25 129.25,-55.25 129.25,-85.75"/>
<text text-anchor="start" x="8" y="-72.25" font-family="Helvetica,sans-Serif" font-size="10.00">bit_manipulation/hamming</text>
<text text-anchor="middle" x="64.62" y="-61" font-family="Helvetica,sans-Serif" font-size="10.00">_distance.cpp</text>
<polygon fill="#999999" stroke="#666666" points="153.75,-85.75 24.5,-85.75 24.5,-55.25 153.75,-55.25 153.75,-85.75"/>
<text text-anchor="start" x="32.5" y="-72.25" font-family="Helvetica,sans-Serif" font-size="10.00">bit_manipulation/hamming</text>
<text text-anchor="middle" x="89.12" y="-61" font-family="Helvetica,sans-Serif" font-size="10.00">_distance.cpp</text>
</a>
</g>
</g>
@@ -22,8 +22,8 @@
<g id="Node000002" class="node">
<title>Node2</title>
<g id="a_Node000002"><a xlink:title=" ">
<polygon fill="#e0e0e0" stroke="#999999" points="54.75,-19.25 6.5,-19.25 6.5,0 54.75,0 54.75,-19.25"/>
<text text-anchor="middle" x="30.62" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">cassert</text>
<polygon fill="#e0e0e0" stroke="#999999" points="48.25,-19.25 0,-19.25 0,0 48.25,0 48.25,-19.25"/>
<text text-anchor="middle" x="24.12" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">cassert</text>
</a>
</g>
</g>
@@ -31,8 +31,8 @@
<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="M56.22,-54.95C51.79,-47.28 46.3,-37.77 41.55,-29.54"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="44.66,-27.92 36.62,-21.01 38.59,-31.42 44.66,-27.92"/>
<path fill="none" stroke="#63b8ff" d="M73.06,-54.95C63.83,-46.59 52.2,-36.05 42.59,-27.35"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="45.03,-24.84 35.27,-20.72 40.33,-30.02 45.03,-24.84"/>
</a>
</g>
</g>
@@ -40,8 +40,8 @@
<g id="Node000003" class="node">
<title>Node3</title>
<g id="a_Node000003"><a xlink:title=" ">
<polygon fill="#e0e0e0" stroke="#999999" points="126.38,-19.25 72.88,-19.25 72.88,0 126.38,0 126.38,-19.25"/>
<text text-anchor="middle" x="99.62" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">iostream</text>
<polygon fill="#e0e0e0" stroke="#999999" points="111.75,-19.25 66.5,-19.25 66.5,0 111.75,0 111.75,-19.25"/>
<text text-anchor="middle" x="89.12" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">cstdint</text>
</a>
</g>
</g>
@@ -49,8 +49,26 @@
<g id="edge2_Node000001_Node000003" class="edge">
<title>Node1&#45;&gt;Node3</title>
<g id="a_edge2_Node000001_Node000003"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M73.28,-54.95C77.84,-47.28 83.49,-37.77 88.38,-29.54"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="91.35,-31.39 93.46,-21 85.34,-27.81 91.35,-31.39"/>
<path fill="none" stroke="#63b8ff" d="M89.12,-54.95C89.12,-47.71 89.12,-38.84 89.12,-30.94"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="92.63,-31.21 89.13,-21.21 85.63,-31.21 92.63,-31.21"/>
</a>
</g>
</g>
<!-- Node4 -->
<g id="Node000004" class="node">
<title>Node4</title>
<g id="a_Node000004"><a xlink:title=" ">
<polygon fill="#e0e0e0" stroke="#999999" points="182.88,-19.25 129.38,-19.25 129.38,0 182.88,0 182.88,-19.25"/>
<text text-anchor="middle" x="156.12" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">iostream</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node4 -->
<g id="edge3_Node000001_Node000004" class="edge">
<title>Node1&#45;&gt;Node4</title>
<g id="a_edge3_Node000001_Node000004"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M105.69,-54.95C115.3,-46.5 127.44,-35.83 137.4,-27.08"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="139.46,-29.93 144.66,-20.7 134.84,-24.67 139.46,-29.93"/>
</a>
</g>
</g>

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@@ -237,7 +237,7 @@ $(function(){initNavTree('d6/d50/_2_users_2runner_2work_2_c-_plus-_plus_2_c-_plu
<div class="ttc" id="agenerate__parentheses_8cpp_html_aa8dca7b867074164d5f45b0f3851269d"><div class="ttname"><a href="../../dd/d1e/generate__parentheses_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> generate_parentheses.cpp:82</div></div>
<div class="ttc" id="agenerate__parentheses_8cpp_html_gae66f6b31b5ad750f1fe042a706a4e3d4"><div class="ttname"><a href="../../dd/d1e/generate__parentheses_8cpp.html#gae66f6b31b5ad750f1fe042a706a4e3d4">main</a></div><div class="ttdeci">int main()</div><div class="ttdoc">Main function.</div><div class="ttdef"><b>Definition</b> generate_parentheses.cpp:110</div></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 class="ttc" id="anamespacemath_html"><div class="ttname"><a href="../../dd/d47/namespacemath.html">math</a></div><div class="ttdoc">for IO operations</div></div>
<div class="ttc" id="anamespacemath_html"><div class="ttname"><a href="../../dd/d47/namespacemath.html">math</a></div><div class="ttdoc">for assert</div></div>
<div class="ttc" id="anamespacemath_html_a2565c745aac2f9561cc6fd9e56d9b77a"><div class="ttname"><a href="../../dd/d47/namespacemath.html#a2565c745aac2f9561cc6fd9e56d9b77a">math::iterativeFactorial</a></div><div class="ttdeci">uint64_t iterativeFactorial(uint8_t n)</div><div class="ttdoc">Calculates the factorial iteratively.</div><div class="ttdef"><b>Definition</b> iterative_factorial.cpp:47</div></div>
</div><!-- fragment --> </div><!-- contents -->
</div><!-- doc-content -->

View File

@@ -1,13 +1,15 @@
<map id="graph/travelling_salesman_problem.cpp" name="graph/travelling_salesman_problem.cpp">
<area shape="rect" id="Node000001" title="[Travelling Salesman Problem] (https://en.wikipedia.org/wiki/Travelling_salesman_problem) implementat..." alt="" coords="142,5,314,46"/>
<area shape="rect" id="Node000001" title="[Travelling Salesman Problem] (https://en.wikipedia.org/wiki/Travelling_salesman_problem) implementat..." alt="" coords="180,5,353,46"/>
<area shape="rect" id="Node000002" title=" " alt="" coords="5,94,80,120"/>
<area shape="poly" id="edge1_Node000001_Node000002" title=" " alt="" coords="183,49,86,90,84,85,181,44"/>
<area shape="poly" id="edge1_Node000001_Node000002" title=" " alt="" coords="211,49,92,91,90,86,210,44"/>
<area shape="rect" id="Node000003" title=" " alt="" coords="104,94,168,120"/>
<area shape="poly" id="edge2_Node000001_Node000003" title=" " alt="" coords="207,48,163,86,160,82,203,44"/>
<area shape="rect" id="Node000004" title=" " alt="" coords="192,94,264,120"/>
<area shape="poly" id="edge3_Node000001_Node000004" title=" " alt="" coords="230,46,230,78,225,78,225,46"/>
<area shape="rect" id="Node000005" title=" " alt="" coords="287,94,339,120"/>
<area shape="poly" id="edge4_Node000001_Node000005" title=" " alt="" coords="251,44,291,81,287,85,247,48"/>
<area shape="rect" id="Node000006" title=" " alt="" coords="363,94,420,120"/>
<area shape="poly" id="edge5_Node000001_Node000006" title=" " alt="" coords="270,44,354,85,352,89,268,49"/>
<area shape="poly" id="edge2_Node000001_Node000003" title=" " alt="" coords="235,49,170,88,167,83,232,44"/>
<area shape="rect" id="Node000004" title=" " alt="" coords="192,94,253,120"/>
<area shape="poly" id="edge3_Node000001_Node000004" title=" " alt="" coords="258,48,239,82,234,79,253,45"/>
<area shape="rect" id="Node000005" title=" " alt="" coords="276,94,348,120"/>
<area shape="poly" id="edge4_Node000001_Node000005" title=" " alt="" coords="280,45,300,79,295,82,275,48"/>
<area shape="rect" id="Node000006" title=" " alt="" coords="371,94,423,120"/>
<area shape="poly" id="edge5_Node000001_Node000006" title=" " alt="" coords="301,44,366,83,363,88,298,49"/>
<area shape="rect" id="Node000007" title=" " alt="" coords="447,94,504,120"/>
<area shape="poly" id="edge6_Node000001_Node000007" title=" " alt="" coords="320,44,433,87,432,92,318,49"/>
</map>

View File

@@ -1 +1 @@
c96a6e1d7d44a729b08b2273d53e03ea
6f56ee33a14f3e3a914ff8c2b1577402

View File

@@ -4,8 +4,8 @@
<!-- Generated by graphviz version 12.1.2 (20240928.0832)
-->
<!-- Title: graph/travelling_salesman_problem.cpp Pages: 1 -->
<svg width="319pt" height="94pt"
viewBox="0.00 0.00 319.38 93.75" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<svg width="382pt" height="94pt"
viewBox="0.00 0.00 382.38 93.75" 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">
@@ -23,9 +23,9 @@
<g id="Node000001" class="node">
<title>Node1</title>
<g id="a_Node000001"><a xlink:title="[Travelling Salesman Problem] (https://en.wikipedia.org/wiki/Travelling_salesman_problem) implementat...">
<polygon fill="#999999" stroke="#666666" points="231.5,-85.75 102.25,-85.75 102.25,-55.25 231.5,-55.25 231.5,-85.75"/>
<text text-anchor="start" x="110.25" y="-72.25" font-family="Helvetica,sans-Serif" font-size="10.00">graph/travelling_salesman</text>
<text text-anchor="middle" x="166.88" y="-61" font-family="Helvetica,sans-Serif" font-size="10.00">_problem.cpp</text>
<polygon fill="#999999" stroke="#666666" points="260.5,-85.75 131.25,-85.75 131.25,-55.25 260.5,-55.25 260.5,-85.75"/>
<text text-anchor="start" x="139.25" y="-72.25" font-family="Helvetica,sans-Serif" font-size="10.00">graph/travelling_salesman</text>
<text text-anchor="middle" x="195.88" y="-61" font-family="Helvetica,sans-Serif" font-size="10.00">_problem.cpp</text>
</a>
</g>
</g>
@@ -42,8 +42,8 @@
<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="M132.16,-54.8C109.87,-45.35 81.15,-33.19 59.5,-24.02"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="61.16,-20.92 50.59,-20.24 58.43,-27.37 61.16,-20.92"/>
<path fill="none" stroke="#63b8ff" d="M153.91,-54.8C126.36,-45.14 90.68,-32.63 64.32,-23.4"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="65.66,-20.16 55.07,-20.15 63.35,-26.76 65.66,-20.16"/>
</a>
</g>
</g>
@@ -60,8 +60,8 @@
<g id="edge2_Node000001_Node000003" class="edge">
<title>Node1&#45;&gt;Node3</title>
<g id="a_edge2_Node000001_Node000003"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M149.82,-54.95C139.92,-46.5 127.42,-35.83 117.16,-27.08"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="119.54,-24.51 109.66,-20.68 115,-29.84 119.54,-24.51"/>
<path fill="none" stroke="#63b8ff" d="M171.4,-54.8C156.47,-45.83 137.46,-34.41 122.51,-25.42"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="124.58,-22.58 114.2,-20.43 120.97,-28.58 124.58,-22.58"/>
</a>
</g>
</g>
@@ -69,8 +69,8 @@
<g id="Node000004" class="node">
<title>Node4</title>
<g id="a_Node000004"><a xlink:title=" ">
<polygon fill="#e0e0e0" stroke="#999999" points="193.62,-19.25 140.12,-19.25 140.12,0 193.62,0 193.62,-19.25"/>
<text text-anchor="middle" x="166.88" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">iostream</text>
<polygon fill="#e0e0e0" stroke="#999999" points="185.5,-19.25 140.25,-19.25 140.25,0 185.5,0 185.5,-19.25"/>
<text text-anchor="middle" x="162.88" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">cstdint</text>
</a>
</g>
</g>
@@ -78,8 +78,8 @@
<g id="edge3_Node000001_Node000004" class="edge">
<title>Node1&#45;&gt;Node4</title>
<g id="a_edge3_Node000001_Node000004"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M166.88,-54.95C166.88,-47.71 166.88,-38.84 166.88,-30.94"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="170.38,-31.21 166.88,-21.21 163.38,-31.21 170.38,-31.21"/>
<path fill="none" stroke="#63b8ff" d="M187.72,-54.95C183.42,-47.28 178.09,-37.77 173.48,-29.54"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="176.64,-28.03 168.7,-21.02 170.54,-31.46 176.64,-28.03"/>
</a>
</g>
</g>
@@ -87,8 +87,8 @@
<g id="Node000005" class="node">
<title>Node5</title>
<g id="a_Node000005"><a xlink:title=" ">
<polygon fill="#e0e0e0" stroke="#999999" points="250.5,-19.25 211.25,-19.25 211.25,0 250.5,0 250.5,-19.25"/>
<text text-anchor="middle" x="230.88" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">limits</text>
<polygon fill="#e0e0e0" stroke="#999999" points="256.62,-19.25 203.12,-19.25 203.12,0 256.62,0 256.62,-19.25"/>
<text text-anchor="middle" x="229.88" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">iostream</text>
</a>
</g>
</g>
@@ -96,8 +96,8 @@
<g id="edge4_Node000001_Node000005" class="edge">
<title>Node1&#45;&gt;Node5</title>
<g id="a_edge4_Node000001_Node000005"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M182.7,-54.95C191.78,-46.59 203.24,-36.05 212.69,-27.35"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="214.9,-30.07 219.89,-20.73 210.17,-24.92 214.9,-30.07"/>
<path fill="none" stroke="#63b8ff" d="M204.28,-54.95C208.71,-47.28 214.2,-37.77 218.95,-29.54"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="221.91,-31.42 223.88,-21.01 215.84,-27.92 221.91,-31.42"/>
</a>
</g>
</g>
@@ -105,8 +105,8 @@
<g id="Node000006" class="node">
<title>Node6</title>
<g id="a_Node000006"><a xlink:title=" ">
<polygon fill="#e0e0e0" stroke="#999999" points="311.38,-19.25 268.38,-19.25 268.38,0 311.38,0 311.38,-19.25"/>
<text text-anchor="middle" x="289.88" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">vector</text>
<polygon fill="#e0e0e0" stroke="#999999" points="313.5,-19.25 274.25,-19.25 274.25,0 313.5,0 313.5,-19.25"/>
<text text-anchor="middle" x="293.88" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">limits</text>
</a>
</g>
</g>
@@ -114,8 +114,26 @@
<g id="edge5_Node000001_Node000006" class="edge">
<title>Node1&#45;&gt;Node6</title>
<g id="a_edge5_Node000001_Node000006"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M197.6,-54.8C216.96,-45.53 241.8,-33.63 260.84,-24.52"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="262.14,-27.78 269.65,-20.31 259.12,-21.47 262.14,-27.78"/>
<path fill="none" stroke="#63b8ff" d="M220.35,-54.8C235.28,-45.83 254.29,-34.41 269.24,-25.42"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="270.78,-28.58 277.55,-20.43 267.17,-22.58 270.78,-28.58"/>
</a>
</g>
</g>
<!-- Node7 -->
<g id="Node000007" class="node">
<title>Node7</title>
<g id="a_Node000007"><a xlink:title=" ">
<polygon fill="#e0e0e0" stroke="#999999" points="374.38,-19.25 331.38,-19.25 331.38,0 374.38,0 374.38,-19.25"/>
<text text-anchor="middle" x="352.88" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">vector</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node7 -->
<g id="edge6_Node000001_Node000007" class="edge">
<title>Node1&#45;&gt;Node7</title>
<g id="a_edge6_Node000001_Node000007"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M235.09,-54.8C261.39,-44.93 295.63,-32.09 320.41,-22.8"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="321.51,-26.12 329.65,-19.34 319.05,-19.57 321.51,-26.12"/>
</a>
</g>
</g>

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

@@ -4,17 +4,17 @@
<!-- Generated by graphviz version 12.1.2 (20240928.0832)
-->
<!-- Title: graph/travelling_salesman_problem.cpp Pages: 1 -->
<svg width="319pt" height="94pt"
viewBox="0.00 0.00 319.38 93.75" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<svg width="382pt" height="94pt"
viewBox="0.00 0.00 382.38 93.75" 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 89.75)">
<title>graph/travelling_salesman_problem.cpp</title>
<!-- Node1 -->
<g id="Node000001" class="node">
<title>Node1</title>
<g id="a_Node000001"><a xlink:title="[Travelling Salesman Problem] (https://en.wikipedia.org/wiki/Travelling_salesman_problem) implementat...">
<polygon fill="#999999" stroke="#666666" points="231.5,-85.75 102.25,-85.75 102.25,-55.25 231.5,-55.25 231.5,-85.75"/>
<text text-anchor="start" x="110.25" y="-72.25" font-family="Helvetica,sans-Serif" font-size="10.00">graph/travelling_salesman</text>
<text text-anchor="middle" x="166.88" y="-61" font-family="Helvetica,sans-Serif" font-size="10.00">_problem.cpp</text>
<polygon fill="#999999" stroke="#666666" points="260.5,-85.75 131.25,-85.75 131.25,-55.25 260.5,-55.25 260.5,-85.75"/>
<text text-anchor="start" x="139.25" y="-72.25" font-family="Helvetica,sans-Serif" font-size="10.00">graph/travelling_salesman</text>
<text text-anchor="middle" x="195.88" y="-61" font-family="Helvetica,sans-Serif" font-size="10.00">_problem.cpp</text>
</a>
</g>
</g>
@@ -31,8 +31,8 @@
<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="M132.16,-54.8C109.87,-45.35 81.15,-33.19 59.5,-24.02"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="61.16,-20.92 50.59,-20.24 58.43,-27.37 61.16,-20.92"/>
<path fill="none" stroke="#63b8ff" d="M153.91,-54.8C126.36,-45.14 90.68,-32.63 64.32,-23.4"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="65.66,-20.16 55.07,-20.15 63.35,-26.76 65.66,-20.16"/>
</a>
</g>
</g>
@@ -49,8 +49,8 @@
<g id="edge2_Node000001_Node000003" class="edge">
<title>Node1&#45;&gt;Node3</title>
<g id="a_edge2_Node000001_Node000003"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M149.82,-54.95C139.92,-46.5 127.42,-35.83 117.16,-27.08"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="119.54,-24.51 109.66,-20.68 115,-29.84 119.54,-24.51"/>
<path fill="none" stroke="#63b8ff" d="M171.4,-54.8C156.47,-45.83 137.46,-34.41 122.51,-25.42"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="124.58,-22.58 114.2,-20.43 120.97,-28.58 124.58,-22.58"/>
</a>
</g>
</g>
@@ -58,8 +58,8 @@
<g id="Node000004" class="node">
<title>Node4</title>
<g id="a_Node000004"><a xlink:title=" ">
<polygon fill="#e0e0e0" stroke="#999999" points="193.62,-19.25 140.12,-19.25 140.12,0 193.62,0 193.62,-19.25"/>
<text text-anchor="middle" x="166.88" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">iostream</text>
<polygon fill="#e0e0e0" stroke="#999999" points="185.5,-19.25 140.25,-19.25 140.25,0 185.5,0 185.5,-19.25"/>
<text text-anchor="middle" x="162.88" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">cstdint</text>
</a>
</g>
</g>
@@ -67,8 +67,8 @@
<g id="edge3_Node000001_Node000004" class="edge">
<title>Node1&#45;&gt;Node4</title>
<g id="a_edge3_Node000001_Node000004"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M166.88,-54.95C166.88,-47.71 166.88,-38.84 166.88,-30.94"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="170.38,-31.21 166.88,-21.21 163.38,-31.21 170.38,-31.21"/>
<path fill="none" stroke="#63b8ff" d="M187.72,-54.95C183.42,-47.28 178.09,-37.77 173.48,-29.54"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="176.64,-28.03 168.7,-21.02 170.54,-31.46 176.64,-28.03"/>
</a>
</g>
</g>
@@ -76,8 +76,8 @@
<g id="Node000005" class="node">
<title>Node5</title>
<g id="a_Node000005"><a xlink:title=" ">
<polygon fill="#e0e0e0" stroke="#999999" points="250.5,-19.25 211.25,-19.25 211.25,0 250.5,0 250.5,-19.25"/>
<text text-anchor="middle" x="230.88" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">limits</text>
<polygon fill="#e0e0e0" stroke="#999999" points="256.62,-19.25 203.12,-19.25 203.12,0 256.62,0 256.62,-19.25"/>
<text text-anchor="middle" x="229.88" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">iostream</text>
</a>
</g>
</g>
@@ -85,8 +85,8 @@
<g id="edge4_Node000001_Node000005" class="edge">
<title>Node1&#45;&gt;Node5</title>
<g id="a_edge4_Node000001_Node000005"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M182.7,-54.95C191.78,-46.59 203.24,-36.05 212.69,-27.35"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="214.9,-30.07 219.89,-20.73 210.17,-24.92 214.9,-30.07"/>
<path fill="none" stroke="#63b8ff" d="M204.28,-54.95C208.71,-47.28 214.2,-37.77 218.95,-29.54"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="221.91,-31.42 223.88,-21.01 215.84,-27.92 221.91,-31.42"/>
</a>
</g>
</g>
@@ -94,8 +94,8 @@
<g id="Node000006" class="node">
<title>Node6</title>
<g id="a_Node000006"><a xlink:title=" ">
<polygon fill="#e0e0e0" stroke="#999999" points="311.38,-19.25 268.38,-19.25 268.38,0 311.38,0 311.38,-19.25"/>
<text text-anchor="middle" x="289.88" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">vector</text>
<polygon fill="#e0e0e0" stroke="#999999" points="313.5,-19.25 274.25,-19.25 274.25,0 313.5,0 313.5,-19.25"/>
<text text-anchor="middle" x="293.88" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">limits</text>
</a>
</g>
</g>
@@ -103,8 +103,26 @@
<g id="edge5_Node000001_Node000006" class="edge">
<title>Node1&#45;&gt;Node6</title>
<g id="a_edge5_Node000001_Node000006"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M197.6,-54.8C216.96,-45.53 241.8,-33.63 260.84,-24.52"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="262.14,-27.78 269.65,-20.31 259.12,-21.47 262.14,-27.78"/>
<path fill="none" stroke="#63b8ff" d="M220.35,-54.8C235.28,-45.83 254.29,-34.41 269.24,-25.42"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="270.78,-28.58 277.55,-20.43 267.17,-22.58 270.78,-28.58"/>
</a>
</g>
</g>
<!-- Node7 -->
<g id="Node000007" class="node">
<title>Node7</title>
<g id="a_Node000007"><a xlink:title=" ">
<polygon fill="#e0e0e0" stroke="#999999" points="374.38,-19.25 331.38,-19.25 331.38,0 374.38,0 374.38,-19.25"/>
<text text-anchor="middle" x="352.88" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">vector</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node7 -->
<g id="edge6_Node000001_Node000007" class="edge">
<title>Node1&#45;&gt;Node7</title>
<g id="a_edge6_Node000001_Node000007"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M235.09,-54.8C261.39,-44.93 295.63,-32.09 320.41,-22.8"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="321.51,-26.12 329.65,-19.34 319.05,-19.57 321.51,-26.12"/>
</a>
</g>
</g>

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

@@ -115,13 +115,14 @@ $(function(){initNavTree('d6/d7a/golden__search__extrema_8cpp.html','../../'); i
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &lt;cassert&gt;</code><br />
<code>#include &lt;cmath&gt;</code><br />
<code>#include &lt;cstdint&gt;</code><br />
<code>#include &lt;functional&gt;</code><br />
<code>#include &lt;iostream&gt;</code><br />
<code>#include &lt;limits&gt;</code><br />
</div><div class="textblock"><div class="dynheader">
Include dependency graph for golden_search_extrema.cpp:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d9/d94/golden__search__extrema_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 class="center"><iframe scrolling="no" frameborder="0" src="../../d9/d94/golden__search__extrema_8cpp__incl.svg" width="515" 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">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="define-members" name="define-members"></a>
@@ -197,50 +198,50 @@ k=\frac{3-\sqrt{5}}{2} \approx 0.381966\ldots\]
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>local minima found in the interval </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 30</span> {</div>
<div class="line"><span class="lineno"> 31</span> uint32_t iters = 0;</div>
<div class="line"><span class="lineno"> 32</span> <span class="keywordtype">double</span> c, d;</div>
<div class="line"><span class="lineno"> 33</span> <span class="keywordtype">double</span> prev_mean, mean = <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/types/numeric_limits/infinity.html">std::numeric_limits&lt;double&gt;::infinity</a>();</div>
<div class="line"><span class="lineno"> 34</span> </div>
<div class="line"><span class="lineno"> 35</span> <span class="comment">// golden ratio value</span></div>
<div class="line"><span class="lineno"> 36</span> <span class="keyword">const</span> <span class="keywordtype">double</span> M_GOLDEN_RATIO = (1.f + <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/math/sqrt.html">std::sqrt</a>(5.f)) / 2.f;</div>
<div class="line"><span class="lineno"> 37</span> </div>
<div class="line"><span class="lineno"> 38</span> <span class="comment">// ensure that lim_a &lt; lim_b</span></div>
<div class="line"><span class="lineno"> 39</span> <span class="keywordflow">if</span> (lim_a &gt; lim_b) {</div>
<div class="line"><span class="lineno"> 40</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/swap.html">std::swap</a>(lim_a, lim_b);</div>
<div class="line"><span class="lineno"> 41</span> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (std::abs(lim_a - lim_b) &lt;= <a class="code hl_define" href="#a002b2f4894492820fe708b1b7e7c5e70">EPSILON</a>) {</div>
<div class="line"><span class="lineno"> 42</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cerr</a> &lt;&lt; <span class="stringliteral">&quot;Search range must be greater than &quot;</span> &lt;&lt; <a class="code hl_define" href="#a002b2f4894492820fe708b1b7e7c5e70">EPSILON</a> &lt;&lt; <span class="stringliteral">&quot;\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 43</span> <span class="keywordflow">return</span> lim_a;</div>
<div class="line"><span class="lineno"> 44</span> }</div>
<div class="line"><span class="lineno"> 45</span> </div>
<div class="line"><span class="lineno"> 46</span> <span class="keywordflow">do</span> {</div>
<div class="line"><span class="lineno"> 47</span> prev_mean = mean;</div>
<div class="line"><span class="lineno"> 48</span> </div>
<div class="line"><span class="lineno"> 49</span> <span class="comment">// compute the section ratio width</span></div>
<div class="line"><span class="lineno"> 50</span> <span class="keywordtype">double</span> ratio = (lim_b - lim_a) / M_GOLDEN_RATIO;</div>
<div class="line"><span class="lineno"> 51</span> c = lim_b - ratio; <span class="comment">// right-side section start</span></div>
<div class="line"><span class="lineno"> 52</span> d = lim_a + ratio; <span class="comment">// left-side section end</span></div>
<div class="line"><span class="lineno"> 53</span> </div>
<div class="line"><span class="lineno"> 54</span> <span class="keywordflow">if</span> (<a class="code hl_function" href="../../d4/d18/composite__simpson__rule_8cpp.html#a4251b4df4748a0b9c43a48f61bdd2397">f</a>(c) &lt; <a class="code hl_function" href="../../d4/d18/composite__simpson__rule_8cpp.html#a4251b4df4748a0b9c43a48f61bdd2397">f</a>(d)) {</div>
<div class="line"><span class="lineno"> 55</span> <span class="comment">// select left section</span></div>
<div class="line"><span class="lineno"> 56</span> lim_b = d;</div>
<div class="line"><span class="lineno"> 57</span> } <span class="keywordflow">else</span> {</div>
<div class="line"><span class="lineno"> 58</span> <span class="comment">// selct right section</span></div>
<div class="line"><span class="lineno"> 59</span> lim_a = c;</div>
<div class="line"><span class="lineno"> 60</span> }</div>
<div class="line"><span class="lineno"> 61</span> </div>
<div class="line"><span class="lineno"> 62</span> mean = (lim_a + lim_b) / 2.f;</div>
<div class="line"><span class="lineno"> 63</span> iters++;</div>
<div class="line"><span class="lineno"> 64</span> </div>
<div class="line"><span class="lineno"> 65</span> <span class="comment">// continue till the interval width is greater than sqrt(system epsilon)</span></div>
<div class="line"><span class="lineno"> 66</span> } <span class="keywordflow">while</span> (std::abs(lim_a - lim_b) &gt; <a class="code hl_define" href="#a002b2f4894492820fe708b1b7e7c5e70">EPSILON</a>);</div>
<div class="line"><span class="lineno"> 67</span> </div>
<div class="line"><span class="lineno"> 68</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; (iters: &quot;</span> &lt;&lt; iters &lt;&lt; <span class="stringliteral">&quot;) &quot;</span>;</div>
<div class="line"><span class="lineno"> 69</span> <span class="keywordflow">return</span> prev_mean;</div>
<div class="line"><span class="lineno"> 70</span>}</div>
<div class="fragment"><div class="line"><span class="lineno"> 31</span> {</div>
<div class="line"><span class="lineno"> 32</span> uint32_t iters = 0;</div>
<div class="line"><span class="lineno"> 33</span> <span class="keywordtype">double</span> c, d;</div>
<div class="line"><span class="lineno"> 34</span> <span class="keywordtype">double</span> prev_mean, mean = <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/types/numeric_limits/infinity.html">std::numeric_limits&lt;double&gt;::infinity</a>();</div>
<div class="line"><span class="lineno"> 35</span> </div>
<div class="line"><span class="lineno"> 36</span> <span class="comment">// golden ratio value</span></div>
<div class="line"><span class="lineno"> 37</span> <span class="keyword">const</span> <span class="keywordtype">double</span> M_GOLDEN_RATIO = (1.f + <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/math/sqrt.html">std::sqrt</a>(5.f)) / 2.f;</div>
<div class="line"><span class="lineno"> 38</span> </div>
<div class="line"><span class="lineno"> 39</span> <span class="comment">// ensure that lim_a &lt; lim_b</span></div>
<div class="line"><span class="lineno"> 40</span> <span class="keywordflow">if</span> (lim_a &gt; lim_b) {</div>
<div class="line"><span class="lineno"> 41</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/swap.html">std::swap</a>(lim_a, lim_b);</div>
<div class="line"><span class="lineno"> 42</span> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (std::abs(lim_a - lim_b) &lt;= <a class="code hl_define" href="#a002b2f4894492820fe708b1b7e7c5e70">EPSILON</a>) {</div>
<div class="line"><span class="lineno"> 43</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cerr</a> &lt;&lt; <span class="stringliteral">&quot;Search range must be greater than &quot;</span> &lt;&lt; <a class="code hl_define" href="#a002b2f4894492820fe708b1b7e7c5e70">EPSILON</a> &lt;&lt; <span class="stringliteral">&quot;\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 44</span> <span class="keywordflow">return</span> lim_a;</div>
<div class="line"><span class="lineno"> 45</span> }</div>
<div class="line"><span class="lineno"> 46</span> </div>
<div class="line"><span class="lineno"> 47</span> <span class="keywordflow">do</span> {</div>
<div class="line"><span class="lineno"> 48</span> prev_mean = mean;</div>
<div class="line"><span class="lineno"> 49</span> </div>
<div class="line"><span class="lineno"> 50</span> <span class="comment">// compute the section ratio width</span></div>
<div class="line"><span class="lineno"> 51</span> <span class="keywordtype">double</span> ratio = (lim_b - lim_a) / M_GOLDEN_RATIO;</div>
<div class="line"><span class="lineno"> 52</span> c = lim_b - ratio; <span class="comment">// right-side section start</span></div>
<div class="line"><span class="lineno"> 53</span> d = lim_a + ratio; <span class="comment">// left-side section end</span></div>
<div class="line"><span class="lineno"> 54</span> </div>
<div class="line"><span class="lineno"> 55</span> <span class="keywordflow">if</span> (<a class="code hl_function" href="../../d4/d18/composite__simpson__rule_8cpp.html#a4251b4df4748a0b9c43a48f61bdd2397">f</a>(c) &lt; <a class="code hl_function" href="../../d4/d18/composite__simpson__rule_8cpp.html#a4251b4df4748a0b9c43a48f61bdd2397">f</a>(d)) {</div>
<div class="line"><span class="lineno"> 56</span> <span class="comment">// select left section</span></div>
<div class="line"><span class="lineno"> 57</span> lim_b = d;</div>
<div class="line"><span class="lineno"> 58</span> } <span class="keywordflow">else</span> {</div>
<div class="line"><span class="lineno"> 59</span> <span class="comment">// selct right section</span></div>
<div class="line"><span class="lineno"> 60</span> lim_a = c;</div>
<div class="line"><span class="lineno"> 61</span> }</div>
<div class="line"><span class="lineno"> 62</span> </div>
<div class="line"><span class="lineno"> 63</span> mean = (lim_a + lim_b) / 2.f;</div>
<div class="line"><span class="lineno"> 64</span> iters++;</div>
<div class="line"><span class="lineno"> 65</span> </div>
<div class="line"><span class="lineno"> 66</span> <span class="comment">// continue till the interval width is greater than sqrt(system epsilon)</span></div>
<div class="line"><span class="lineno"> 67</span> } <span class="keywordflow">while</span> (std::abs(lim_a - lim_b) &gt; <a class="code hl_define" href="#a002b2f4894492820fe708b1b7e7c5e70">EPSILON</a>);</div>
<div class="line"><span class="lineno"> 68</span> </div>
<div class="line"><span class="lineno"> 69</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; (iters: &quot;</span> &lt;&lt; iters &lt;&lt; <span class="stringliteral">&quot;) &quot;</span>;</div>
<div class="line"><span class="lineno"> 70</span> <span class="keywordflow">return</span> prev_mean;</div>
<div class="line"><span class="lineno"> 71</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::cerr</a></div></div>
<div class="ttc" id="acomposite__simpson__rule_8cpp_html_a4251b4df4748a0b9c43a48f61bdd2397"><div class="ttname"><a href="../../d4/d18/composite__simpson__rule_8cpp.html#a4251b4df4748a0b9c43a48f61bdd2397">numerical_methods::simpson_method::f</a></div><div class="ttdeci">double f(double x)</div><div class="ttdoc">A function f(x) that will be used to test the method.</div><div class="ttdef"><b>Definition</b> composite_simpson_rule.cpp:113</div></div>
<div class="ttc" id="agolden__search__extrema_8cpp_html_a002b2f4894492820fe708b1b7e7c5e70"><div class="ttname"><a href="#a002b2f4894492820fe708b1b7e7c5e70">EPSILON</a></div><div class="ttdeci">#define EPSILON</div><div class="ttdoc">solution accuracy limit</div><div class="ttdef"><b>Definition</b> golden_search_extrema.cpp:17</div></div>
<div class="ttc" id="agolden__search__extrema_8cpp_html_a002b2f4894492820fe708b1b7e7c5e70"><div class="ttname"><a href="#a002b2f4894492820fe708b1b7e7c5e70">EPSILON</a></div><div class="ttdeci">#define EPSILON</div><div class="ttdoc">solution accuracy limit</div><div class="ttdef"><b>Definition</b> golden_search_extrema.cpp:18</div></div>
<div class="ttc" id="ainfinity_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/types/numeric_limits/infinity.html">std::numeric_limits::infinity</a></div><div class="ttdeci">T infinity(T... args)</div></div>
<div class="ttc" id="asqrt_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/numeric/math/sqrt.html">std::sqrt</a></div><div class="ttdeci">T sqrt(T... args)</div></div>
<div class="ttc" id="aswap_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/algorithm/swap.html">std::swap</a></div><div class="ttdeci">T swap(T... args)</div></div>
@@ -267,21 +268,21 @@ Here is the call graph for this function:</div>
</table>
</div><div class="memdoc">
<p>Main function </p>
<div class="fragment"><div class="line"><span class="lineno"> 139</span> {</div>
<div class="line"><span class="lineno"> 140</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a>.precision(9);</div>
<div class="line"><span class="lineno"> 141</span> </div>
<div class="line"><span class="lineno"> 142</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;Computations performed with machine epsilon: &quot;</span> &lt;&lt; <a class="code hl_define" href="#a002b2f4894492820fe708b1b7e7c5e70">EPSILON</a></div>
<div class="line"><span class="lineno"> 143</span> &lt;&lt; <span class="stringliteral">&quot;\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 144</span> </div>
<div class="line"><span class="lineno"> 145</span> <a class="code hl_function" href="#a1440a7779ac56f47a3f355ce4a8c7da0">test1</a>();</div>
<div class="line"><span class="lineno"> 146</span> <a class="code hl_function" href="#a0283886819c7c140a023582b7269e2d0">test2</a>();</div>
<div class="line"><span class="lineno"> 147</span> <a class="code hl_function" href="#a6d0455dd5c30adda100e95f0423c786e">test3</a>();</div>
<div class="line"><span class="lineno"> 148</span> </div>
<div class="line"><span class="lineno"> 149</span> <span class="keywordflow">return</span> 0;</div>
<div class="line"><span class="lineno"> 150</span>}</div>
<div class="ttc" id="agolden__search__extrema_8cpp_html_a0283886819c7c140a023582b7269e2d0"><div class="ttname"><a href="#a0283886819c7c140a023582b7269e2d0">test2</a></div><div class="ttdeci">void test2()</div><div class="ttdoc">Test function to find maxima for the function in the interval Expected result: .</div><div class="ttdef"><b>Definition</b> golden_search_extrema.cpp:100</div></div>
<div class="ttc" id="agolden__search__extrema_8cpp_html_a1440a7779ac56f47a3f355ce4a8c7da0"><div class="ttname"><a href="#a1440a7779ac56f47a3f355ce4a8c7da0">test1</a></div><div class="ttdeci">void test1()</div><div class="ttdoc">Test function to find minima for the function in the interval Expected result = 2.</div><div class="ttdef"><b>Definition</b> golden_search_extrema.cpp:78</div></div>
<div class="ttc" id="agolden__search__extrema_8cpp_html_a6d0455dd5c30adda100e95f0423c786e"><div class="ttname"><a href="#a6d0455dd5c30adda100e95f0423c786e">test3</a></div><div class="ttdeci">void test3()</div><div class="ttdoc">Test function to find maxima for the function in the interval Expected result: .</div><div class="ttdef"><b>Definition</b> golden_search_extrema.cpp:123</div></div>
<div class="fragment"><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>.precision(9);</div>
<div class="line"><span class="lineno"> 142</span> </div>
<div class="line"><span class="lineno"> 143</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;Computations performed with machine epsilon: &quot;</span> &lt;&lt; <a class="code hl_define" href="#a002b2f4894492820fe708b1b7e7c5e70">EPSILON</a></div>
<div class="line"><span class="lineno"> 144</span> &lt;&lt; <span class="stringliteral">&quot;\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 145</span> </div>
<div class="line"><span class="lineno"> 146</span> <a class="code hl_function" href="#a1440a7779ac56f47a3f355ce4a8c7da0">test1</a>();</div>
<div class="line"><span class="lineno"> 147</span> <a class="code hl_function" href="#a0283886819c7c140a023582b7269e2d0">test2</a>();</div>
<div class="line"><span class="lineno"> 148</span> <a class="code hl_function" href="#a6d0455dd5c30adda100e95f0423c786e">test3</a>();</div>
<div class="line"><span class="lineno"> 149</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="agolden__search__extrema_8cpp_html_a0283886819c7c140a023582b7269e2d0"><div class="ttname"><a href="#a0283886819c7c140a023582b7269e2d0">test2</a></div><div class="ttdeci">void test2()</div><div class="ttdoc">Test function to find maxima for the function in the interval Expected result: .</div><div class="ttdef"><b>Definition</b> golden_search_extrema.cpp:101</div></div>
<div class="ttc" id="agolden__search__extrema_8cpp_html_a1440a7779ac56f47a3f355ce4a8c7da0"><div class="ttname"><a href="#a1440a7779ac56f47a3f355ce4a8c7da0">test1</a></div><div class="ttdeci">void test1()</div><div class="ttdoc">Test function to find minima for the function in the interval Expected result = 2.</div><div class="ttdef"><b>Definition</b> golden_search_extrema.cpp:79</div></div>
<div class="ttc" id="agolden__search__extrema_8cpp_html_a6d0455dd5c30adda100e95f0423c786e"><div class="ttname"><a href="#a6d0455dd5c30adda100e95f0423c786e">test3</a></div><div class="ttdeci">void test3()</div><div class="ttdoc">Test function to find maxima for the function in the interval Expected result: .</div><div class="ttdef"><b>Definition</b> golden_search_extrema.cpp:124</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
@@ -307,23 +308,23 @@ Here is the call graph for this function:</div>
<p>Test function to find minima for the function \(f(x)= (x-2)^2\) in the interval \([1,5]\) <br />
Expected result = 2. </p>
<div class="fragment"><div class="line"><span class="lineno"> 78</span> {</div>
<div class="line"><span class="lineno"> 79</span> <span class="comment">// define the function to minimize as a lambda function</span></div>
<div class="line"><span class="lineno"> 80</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/functional/function.html">std::function</a>&lt;double(<span class="keywordtype">double</span>)&gt; f1 = [](<span class="keywordtype">double</span> x) {</div>
<div class="line"><span class="lineno"> 81</span> <span class="keywordflow">return</span> (x - 2) * (x - 2);</div>
<div class="line"><span class="lineno"> 82</span> };</div>
<div class="line"><span class="lineno"> 83</span> </div>
<div class="line"><span class="lineno"> 84</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 1.... &quot;</span>;</div>
<div class="line"><span class="lineno"> 85</span> </div>
<div class="line"><span class="lineno"> 86</span> <span class="keywordtype">double</span> minima = <a class="code hl_function" href="#a1aa76a6d5fd4d333f9072beff1dc486b">get_minima</a>(f1, 1, 5);</div>
<div class="line"><span class="lineno"> 87</span> </div>
<div class="line"><span class="lineno"> 88</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; minima &lt;&lt; <span class="stringliteral">&quot;...&quot;</span>;</div>
<div class="line"><span class="lineno"> 89</span> </div>
<div class="line"><span class="lineno"> 90</span> assert(std::abs(minima - 2) &lt; <a class="code hl_define" href="#a002b2f4894492820fe708b1b7e7c5e70">EPSILON</a>);</div>
<div class="line"><span class="lineno"> 91</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;passed\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 92</span>}</div>
<div class="fragment"><div class="line"><span class="lineno"> 79</span> {</div>
<div class="line"><span class="lineno"> 80</span> <span class="comment">// define the function to minimize as a lambda function</span></div>
<div class="line"><span class="lineno"> 81</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/functional/function.html">std::function</a>&lt;double(<span class="keywordtype">double</span>)&gt; f1 = [](<span class="keywordtype">double</span> x) {</div>
<div class="line"><span class="lineno"> 82</span> <span class="keywordflow">return</span> (x - 2) * (x - 2);</div>
<div class="line"><span class="lineno"> 83</span> };</div>
<div class="line"><span class="lineno"> 84</span> </div>
<div class="line"><span class="lineno"> 85</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 1.... &quot;</span>;</div>
<div class="line"><span class="lineno"> 86</span> </div>
<div class="line"><span class="lineno"> 87</span> <span class="keywordtype">double</span> minima = <a class="code hl_function" href="#a1aa76a6d5fd4d333f9072beff1dc486b">get_minima</a>(f1, 1, 5);</div>
<div class="line"><span class="lineno"> 88</span> </div>
<div class="line"><span class="lineno"> 89</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; minima &lt;&lt; <span class="stringliteral">&quot;...&quot;</span>;</div>
<div class="line"><span class="lineno"> 90</span> </div>
<div class="line"><span class="lineno"> 91</span> assert(std::abs(minima - 2) &lt; <a class="code hl_define" href="#a002b2f4894492820fe708b1b7e7c5e70">EPSILON</a>);</div>
<div class="line"><span class="lineno"> 92</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;passed\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 93</span>}</div>
<div class="ttc" id="afunction_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/utility/functional/function.html">std::function</a></div></div>
<div class="ttc" id="agolden__search__extrema_8cpp_html_a1aa76a6d5fd4d333f9072beff1dc486b"><div class="ttname"><a href="#a1aa76a6d5fd4d333f9072beff1dc486b">get_minima</a></div><div class="ttdeci">double get_minima(const std::function&lt; double(double)&gt; &amp;f, double lim_a, double lim_b)</div><div class="ttdoc">Get the minima of a function in the given interval. To get the maxima, simply negate the function....</div><div class="ttdef"><b>Definition</b> golden_search_extrema.cpp:29</div></div>
<div class="ttc" id="agolden__search__extrema_8cpp_html_a1aa76a6d5fd4d333f9072beff1dc486b"><div class="ttname"><a href="#a1aa76a6d5fd4d333f9072beff1dc486b">get_minima</a></div><div class="ttdeci">double get_minima(const std::function&lt; double(double)&gt; &amp;f, double lim_a, double lim_b)</div><div class="ttdoc">Get the minima of a function in the given interval. To get the maxima, simply negate the function....</div><div class="ttdef"><b>Definition</b> golden_search_extrema.cpp:30</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
@@ -349,22 +350,22 @@ Here is the call graph for this function:</div>
<p>Test function to find <em>maxima</em> for the function \(f(x)= x^{\frac{1}{x}}\) in the interval \([-2,10]\) <br />
Expected result: \(e\approx 2.71828182845904509\). </p>
<div class="fragment"><div class="line"><span class="lineno"> 100</span> {</div>
<div class="line"><span class="lineno"> 101</span> <span class="comment">// define the function to maximize as a lambda function</span></div>
<div class="line"><span class="lineno"> 102</span> <span class="comment">// since we are maximixing, we negated the function return value</span></div>
<div class="line"><span class="lineno"> 103</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/functional/function.html">std::function</a>&lt;double(<span class="keywordtype">double</span>)&gt; func = [](<span class="keywordtype">double</span> x) {</div>
<div class="line"><span class="lineno"> 104</span> <span class="keywordflow">return</span> -<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/math/pow.html">std::pow</a>(x, 1.f / x);</div>
<div class="line"><span class="lineno"> 105</span> };</div>
<div class="line"><span class="lineno"> 106</span> </div>
<div class="line"><span class="lineno"> 107</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 2.... &quot;</span>;</div>
<div class="line"><span class="lineno"> 108</span> </div>
<div class="line"><span class="lineno"> 109</span> <span class="keywordtype">double</span> minima = <a class="code hl_function" href="#a1aa76a6d5fd4d333f9072beff1dc486b">get_minima</a>(func, -2, 10);</div>
<div class="line"><span class="lineno"> 110</span> </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; minima &lt;&lt; <span class="stringliteral">&quot; (&quot;</span> &lt;&lt; M_E &lt;&lt; <span class="stringliteral">&quot;)...&quot;</span>;</div>
<div class="line"><span class="lineno"> 112</span> </div>
<div class="line"><span class="lineno"> 113</span> assert(std::abs(minima - M_E) &lt; <a class="code hl_define" href="#a002b2f4894492820fe708b1b7e7c5e70">EPSILON</a>);</div>
<div class="line"><span class="lineno"> 114</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;passed\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 115</span>}</div>
<div class="fragment"><div class="line"><span class="lineno"> 101</span> {</div>
<div class="line"><span class="lineno"> 102</span> <span class="comment">// define the function to maximize as a lambda function</span></div>
<div class="line"><span class="lineno"> 103</span> <span class="comment">// since we are maximixing, we negated the function return value</span></div>
<div class="line"><span class="lineno"> 104</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/functional/function.html">std::function</a>&lt;double(<span class="keywordtype">double</span>)&gt; func = [](<span class="keywordtype">double</span> x) {</div>
<div class="line"><span class="lineno"> 105</span> <span class="keywordflow">return</span> -<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/math/pow.html">std::pow</a>(x, 1.f / x);</div>
<div class="line"><span class="lineno"> 106</span> };</div>
<div class="line"><span class="lineno"> 107</span> </div>
<div class="line"><span class="lineno"> 108</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 2.... &quot;</span>;</div>
<div class="line"><span class="lineno"> 109</span> </div>
<div class="line"><span class="lineno"> 110</span> <span class="keywordtype">double</span> minima = <a class="code hl_function" href="#a1aa76a6d5fd4d333f9072beff1dc486b">get_minima</a>(func, -2, 10);</div>
<div class="line"><span class="lineno"> 111</span> </div>
<div class="line"><span class="lineno"> 112</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; minima &lt;&lt; <span class="stringliteral">&quot; (&quot;</span> &lt;&lt; M_E &lt;&lt; <span class="stringliteral">&quot;)...&quot;</span>;</div>
<div class="line"><span class="lineno"> 113</span> </div>
<div class="line"><span class="lineno"> 114</span> assert(std::abs(minima - M_E) &lt; <a class="code hl_define" href="#a002b2f4894492820fe708b1b7e7c5e70">EPSILON</a>);</div>
<div class="line"><span class="lineno"> 115</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;passed\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 116</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>
@@ -391,20 +392,20 @@ Here is the call graph for this function:</div>
<p>Test function to find <em>maxima</em> for the function \(f(x)= \cos x\) in the interval \([0,12]\) <br />
Expected result: \(\pi\approx 3.14159265358979312\). </p>
<div class="fragment"><div class="line"><span class="lineno"> 123</span> {</div>
<div class="line"><span class="lineno"> 124</span> <span class="comment">// define the function to maximize as a lambda function</span></div>
<div class="line"><span class="lineno"> 125</span> <span class="comment">// since we are maximixing, we negated the function return value</span></div>
<div class="line"><span class="lineno"> 126</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/functional/function.html">std::function</a>&lt;double(<span class="keywordtype">double</span>)&gt; func = [](<span class="keywordtype">double</span> x) { <span class="keywordflow">return</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/math/cos.html">std::cos</a>(x); };</div>
<div class="line"><span class="lineno"> 127</span> </div>
<div class="line"><span class="lineno"> 128</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 3.... &quot;</span>;</div>
<div class="line"><span class="lineno"> 129</span> </div>
<div class="line"><span class="lineno"> 130</span> <span class="keywordtype">double</span> minima = <a class="code hl_function" href="#a1aa76a6d5fd4d333f9072beff1dc486b">get_minima</a>(func, -4, 12);</div>
<div class="line"><span class="lineno"> 131</span> </div>
<div class="line"><span class="lineno"> 132</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; minima &lt;&lt; <span class="stringliteral">&quot; (&quot;</span> &lt;&lt; M_PI &lt;&lt; <span class="stringliteral">&quot;)...&quot;</span>;</div>
<div class="line"><span class="lineno"> 133</span> </div>
<div class="line"><span class="lineno"> 134</span> assert(std::abs(minima - M_PI) &lt; <a class="code hl_define" href="#a002b2f4894492820fe708b1b7e7c5e70">EPSILON</a>);</div>
<div class="line"><span class="lineno"> 135</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;passed\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 136</span>}</div>
<div class="fragment"><div class="line"><span class="lineno"> 124</span> {</div>
<div class="line"><span class="lineno"> 125</span> <span class="comment">// define the function to maximize as a lambda function</span></div>
<div class="line"><span class="lineno"> 126</span> <span class="comment">// since we are maximixing, we negated the function return value</span></div>
<div class="line"><span class="lineno"> 127</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/functional/function.html">std::function</a>&lt;double(<span class="keywordtype">double</span>)&gt; func = [](<span class="keywordtype">double</span> x) { <span class="keywordflow">return</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/math/cos.html">std::cos</a>(x); };</div>
<div class="line"><span class="lineno"> 128</span> </div>
<div class="line"><span class="lineno"> 129</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 3.... &quot;</span>;</div>
<div class="line"><span class="lineno"> 130</span> </div>
<div class="line"><span class="lineno"> 131</span> <span class="keywordtype">double</span> minima = <a class="code hl_function" href="#a1aa76a6d5fd4d333f9072beff1dc486b">get_minima</a>(func, -4, 12);</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; minima &lt;&lt; <span class="stringliteral">&quot; (&quot;</span> &lt;&lt; M_PI &lt;&lt; <span class="stringliteral">&quot;)...&quot;</span>;</div>
<div class="line"><span class="lineno"> 134</span> </div>
<div class="line"><span class="lineno"> 135</span> assert(std::abs(minima - M_PI) &lt; <a class="code hl_define" href="#a002b2f4894492820fe708b1b7e7c5e70">EPSILON</a>);</div>
<div class="line"><span class="lineno"> 136</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;passed\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 137</span>}</div>
<div class="ttc" id="acos_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/numeric/math/cos.html">std::cos</a></div><div class="ttdeci">T cos(T... args)</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>

View File

@@ -272,7 +272,7 @@ bool&#160;</td><td class="memItemRight" valign="bottom"><b>double_hashing::rehas
<div class="ttc" id="abasic_istream_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/basic_istream.html">std::cin</a></div></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="aendl_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a></div><div class="ttdeci">T endl(T... args)</div></div>
<div class="ttc" id="amd5_8cpp_html_a88705fab5f92adf3427b4cf76ff33edb"><div class="ttname"><a href="../../d5/d96/md5_8cpp.html#a88705fab5f92adf3427b4cf76ff33edb">hashing::md5::hash</a></div><div class="ttdeci">void * hash(const std::string &amp;message)</div><div class="ttdoc">Converts the string to bytestring and calls the main algorithm.</div><div class="ttdef"><b>Definition</b> md5.cpp:287</div></div>
<div class="ttc" id="amd5_8cpp_html_a88705fab5f92adf3427b4cf76ff33edb"><div class="ttname"><a href="../../d5/d96/md5_8cpp.html#a88705fab5f92adf3427b4cf76ff33edb">hashing::md5::hash</a></div><div class="ttdeci">void * hash(const std::string &amp;message)</div><div class="ttdoc">Converts the string to bytestring and calls the main algorithm.</div><div class="ttdef"><b>Definition</b> md5.cpp:288</div></div>
<div class="ttc" id="anamespacedouble__hashing_html_a0d90726ed1de7b3d2ae261baed048003"><div class="ttname"><a href="../../d0/d65/namespacedouble__hashing.html#a0d90726ed1de7b3d2ae261baed048003">double_hashing::hashFxn</a></div><div class="ttdeci">size_t hashFxn(int key)</div><div class="ttdoc">Hash a key. Uses the STL library's std::hash() function.</div><div class="ttdef"><b>Definition</b> double_hash_hash_table.cpp:47</div></div>
<div class="ttc" id="anamespacedouble__hashing_html_a1e901418c759627557eff359b8db38cd"><div class="ttname"><a href="../../d0/d65/namespacedouble__hashing.html#a1e901418c759627557eff359b8db38cd">double_hashing::display</a></div><div class="ttdeci">void display()</div><div class="ttdef"><b>Definition</b> double_hash_hash_table.cpp:143</div></div>
<div class="ttc" id="anamespacedouble__hashing_html_a5d06e4598569526294f10104875f6824"><div class="ttname"><a href="../../d0/d65/namespacedouble__hashing.html#a5d06e4598569526294f10104875f6824">double_hashing::removalInfo</a></div><div class="ttdeci">void removalInfo(int key)</div><div class="ttdef"><b>Definition</b> double_hash_hash_table.cpp:227</div></div>

View File

@@ -170,7 +170,7 @@ Functions</h2></td></tr>
<div class="line"><span class="lineno"> 121</span> <a class="code hl_function" href="../../d0/dfe/backtracking_2subset__sum_8cpp.html#aa8dca7b867074164d5f45b0f3851269d">test</a>(); <span class="comment">// execute the test</span></div>
<div class="line"><span class="lineno"> 122</span> <span class="keywordflow">return</span> 0;</div>
<div class="line"><span class="lineno"> 123</span>}</div>
<div class="ttc" id="abacktracking_2subset__sum_8cpp_html_aa8dca7b867074164d5f45b0f3851269d"><div class="ttname"><a href="../../d0/dfe/backtracking_2subset__sum_8cpp.html#aa8dca7b867074164d5f45b0f3851269d">test</a></div><div class="ttdeci">static void test()</div><div class="ttdoc">Test implementations.</div><div class="ttdef"><b>Definition</b> subset_sum.cpp:57</div></div>
<div class="ttc" id="abacktracking_2subset__sum_8cpp_html_aa8dca7b867074164d5f45b0f3851269d"><div class="ttname"><a href="../../d0/dfe/backtracking_2subset__sum_8cpp.html#aa8dca7b867074164d5f45b0f3851269d">test</a></div><div class="ttdeci">static void test()</div><div class="ttdoc">Test implementations.</div><div class="ttdef"><b>Definition</b> subset_sum.cpp:58</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">

View File

@@ -192,7 +192,7 @@ Functions</h2></td></tr>
<div class="ttc" id="aclock_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/chrono/c/clock.html">std::clock</a></div><div class="ttdeci">T clock(T... args)</div></div>
<div class="ttc" id="aclock_t_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/chrono/c/clock_t.html">std::clock_t</a></div></div>
<div class="ttc" id="aendl_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a></div><div class="ttdeci">T endl(T... args)</div></div>
<div class="ttc" id="afibonacci__sum_8cpp_html_aadb40ac4c74a7efc0680b83eeee138aa"><div class="ttname"><a href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">math::fibonacci_sum::result</a></div><div class="ttdeci">uint64_t result(uint64_t n)</div><div class="ttdef"><b>Definition</b> fibonacci_sum.cpp:76</div></div>
<div class="ttc" id="afibonacci__sum_8cpp_html_aadb40ac4c74a7efc0680b83eeee138aa"><div class="ttname"><a href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">math::fibonacci_sum::result</a></div><div class="ttdeci">uint64_t result(uint64_t n)</div><div class="ttdef"><b>Definition</b> fibonacci_sum.cpp:77</div></div>
<div class="ttc" id="afixed_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/manip/fixed.html">std::scientific</a></div><div class="ttdeci">T scientific(T... args)</div></div>
<div class="ttc" id="alarge__factorial_8cpp_html_a3f93b60e229b6683e24c4754a7106ee8"><div class="ttname"><a href="#a3f93b60e229b6683e24c4754a7106ee8">test1</a></div><div class="ttdeci">bool test1()</div><div class="ttdef"><b>Definition</b> large_factorial.cpp:17</div></div>
<div class="ttc" id="alarge__factorial_8cpp_html_a76aae4778fbe89a3d59fd61fbc050cfa"><div class="ttname"><a href="#a76aae4778fbe89a3d59fd61fbc050cfa">test2</a></div><div class="ttdeci">bool test2()</div><div class="ttdef"><b>Definition</b> large_factorial.cpp:54</div></div>
@@ -247,7 +247,7 @@ Here is the call graph for this function:</div>
<div class="line"><span class="lineno"> 42</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;Passed!&quot;</span> &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><span class="lineno"> 43</span> <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><span class="lineno"> 44</span>}</div>
<div class="ttc" id="adata__structures_2sparse__table_8cpp_html_a10f3ffb3f6f7e1b83d556b9c8de89a5d"><div class="ttname"><a href="../../d6/d42/data__structures_2sparse__table_8cpp.html#a10f3ffb3f6f7e1b83d556b9c8de89a5d">data_structures::sparse_table::N</a></div><div class="ttdeci">constexpr uint32_t N</div><div class="ttdoc">A struct to represent sparse table for min() as their invariant function, for the given array A....</div><div class="ttdef"><b>Definition</b> sparse_table.cpp:47</div></div>
<div class="ttc" id="adata__structures_2sparse__table_8cpp_html_a10f3ffb3f6f7e1b83d556b9c8de89a5d"><div class="ttname"><a href="../../d6/d42/data__structures_2sparse__table_8cpp.html#a10f3ffb3f6f7e1b83d556b9c8de89a5d">data_structures::sparse_table::N</a></div><div class="ttdeci">constexpr uint32_t N</div><div class="ttdoc">A struct to represent sparse table for min() as their invariant function, for the given array A....</div><div class="ttdef"><b>Definition</b> sparse_table.cpp:48</div></div>
<div class="ttc" id="astrlen_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/string/byte/strlen.html">std::strlen</a></div><div class="ttdeci">T strlen(T... args)</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>

View File

@@ -191,8 +191,8 @@ uint64_t&#160;</td><td class="memItemRight" valign="bottom"><b>pageFrame</b></td
</table>
</dd>
</dl>
<div class="fragment"><div class="line"><span class="lineno"> 84</span>{ <a class="code hl_variable" href="#a1aafd0444b410e0fcb66287e9954c893">pageFrame</a> = pf; }</div>
<div class="ttc" id="aclassothers_1_1lru__cache_1_1_l_r_u_cache_html_a1aafd0444b410e0fcb66287e9954c893"><div class="ttname"><a href="#a1aafd0444b410e0fcb66287e9954c893">others::lru_cache::LRUCache::pageFrame</a></div><div class="ttdeci">uint64_t pageFrame</div><div class="ttdoc">Page frame, or total size of the cache.</div><div class="ttdef"><b>Definition</b> lru_cache.cpp:68</div></div>
<div class="fragment"><div class="line"><span class="lineno"> 85</span>{ <a class="code hl_variable" href="#a1aafd0444b410e0fcb66287e9954c893">pageFrame</a> = pf; }</div>
<div class="ttc" id="aclassothers_1_1lru__cache_1_1_l_r_u_cache_html_a1aafd0444b410e0fcb66287e9954c893"><div class="ttname"><a href="#a1aafd0444b410e0fcb66287e9954c893">others::lru_cache::LRUCache::pageFrame</a></div><div class="ttdeci">uint64_t pageFrame</div><div class="ttdoc">Page frame, or total size of the cache.</div><div class="ttdef"><b>Definition</b> lru_cache.cpp:69</div></div>
</div><!-- fragment -->
</div>
</div>
@@ -222,14 +222,14 @@ uint64_t&#160;</td><td class="memItemRight" valign="bottom"><b>pageFrame</b></td
<p>A function to display the current cache. </p>
<dl class="section return"><dt>Returns</dt><dd>Void </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 120</span> {</div>
<div class="line"><span class="lineno"> 121</span> <span class="keywordflow">for</span> (uint64_t &amp;it : <a class="code hl_variable" href="#a3ee3560a6b90e6f50f6e063d690ba8e8">cache</a>) {</div>
<div class="line"><span class="lineno"> 122</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; it &lt;&lt; <span class="stringliteral">&quot; &quot;</span>;</div>
<div class="line"><span class="lineno"> 123</span> }</div>
<div class="line"><span class="lineno"> 124</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><span class="lineno"> 125</span> }</div>
<div class="fragment"><div class="line"><span class="lineno"> 121</span> {</div>
<div class="line"><span class="lineno"> 122</span> <span class="keywordflow">for</span> (uint64_t &amp;it : <a class="code hl_variable" href="#a3ee3560a6b90e6f50f6e063d690ba8e8">cache</a>) {</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; it &lt;&lt; <span class="stringliteral">&quot; &quot;</span>;</div>
<div class="line"><span class="lineno"> 124</span> }</div>
<div class="line"><span class="lineno"> 125</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><span class="lineno"> 126</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="aclassothers_1_1lru__cache_1_1_l_r_u_cache_html_a3ee3560a6b90e6f50f6e063d690ba8e8"><div class="ttname"><a href="#a3ee3560a6b90e6f50f6e063d690ba8e8">others::lru_cache::LRUCache::cache</a></div><div class="ttdeci">std::list&lt; uint64_t &gt; cache</div><div class="ttdoc">Cache linked list (using the STL)</div><div class="ttdef"><b>Definition</b> lru_cache.cpp:69</div></div>
<div class="ttc" id="aclassothers_1_1lru__cache_1_1_l_r_u_cache_html_a3ee3560a6b90e6f50f6e063d690ba8e8"><div class="ttname"><a href="#a3ee3560a6b90e6f50f6e063d690ba8e8">others::lru_cache::LRUCache::cache</a></div><div class="ttdeci">std::list&lt; uint64_t &gt; cache</div><div class="ttdoc">Cache linked list (using the STL)</div><div class="ttdef"><b>Definition</b> lru_cache.cpp:70</div></div>
<div class="ttc" id="aendl_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a></div><div class="ttdeci">T endl(T... args)</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
@@ -264,8 +264,8 @@ Here is the call graph for this function:</div>
<p>A function to get page hits. </p>
<dl class="section return"><dt>Returns</dt><dd>int </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 130</span>{ <span class="keywordflow">return</span> <a class="code hl_variable" href="#a5f33913e7ddfbb38062362e7bd859154">hits</a>; }</div>
<div class="ttc" id="aclassothers_1_1lru__cache_1_1_l_r_u_cache_html_a5f33913e7ddfbb38062362e7bd859154"><div class="ttname"><a href="#a5f33913e7ddfbb38062362e7bd859154">others::lru_cache::LRUCache::hits</a></div><div class="ttdeci">uint64_t hits</div><div class="ttdoc">was found in cache.</div><div class="ttdef"><b>Definition</b> lru_cache.cpp:73</div></div>
<div class="fragment"><div class="line"><span class="lineno"> 131</span>{ <span class="keywordflow">return</span> <a class="code hl_variable" href="#a5f33913e7ddfbb38062362e7bd859154">hits</a>; }</div>
<div class="ttc" id="aclassothers_1_1lru__cache_1_1_l_r_u_cache_html_a5f33913e7ddfbb38062362e7bd859154"><div class="ttname"><a href="#a5f33913e7ddfbb38062362e7bd859154">others::lru_cache::LRUCache::hits</a></div><div class="ttdeci">uint64_t hits</div><div class="ttdoc">was found in cache.</div><div class="ttdef"><b>Definition</b> lru_cache.cpp:74</div></div>
</div><!-- fragment -->
</div>
</div>
@@ -294,8 +294,8 @@ Here is the call graph for this function:</div>
<p>A function to get page fault. </p>
<dl class="section return"><dt>Returns</dt><dd>int </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 135</span>{ <span class="keywordflow">return</span> <a class="code hl_variable" href="#a09cbe562b0c396329607f5d388d57c9c">pageFault</a>; }</div>
<div class="ttc" id="aclassothers_1_1lru__cache_1_1_l_r_u_cache_html_a09cbe562b0c396329607f5d388d57c9c"><div class="ttname"><a href="#a09cbe562b0c396329607f5d388d57c9c">others::lru_cache::LRUCache::pageFault</a></div><div class="ttdeci">uint64_t pageFault</div><div class="ttdef"><b>Definition</b> lru_cache.cpp:76</div></div>
<div class="fragment"><div class="line"><span class="lineno"> 136</span>{ <span class="keywordflow">return</span> <a class="code hl_variable" href="#a09cbe562b0c396329607f5d388d57c9c">pageFault</a>; }</div>
<div class="ttc" id="aclassothers_1_1lru__cache_1_1_l_r_u_cache_html_a09cbe562b0c396329607f5d388d57c9c"><div class="ttname"><a href="#a09cbe562b0c396329607f5d388d57c9c">others::lru_cache::LRUCache::pageFault</a></div><div class="ttdeci">uint64_t pageFault</div><div class="ttdef"><b>Definition</b> lru_cache.cpp:77</div></div>
</div><!-- fragment -->
</div>
</div>
@@ -331,33 +331,33 @@ Here is the call graph for this function:</div>
</dl>
<dl class="section return"><dt>Returns</dt><dd>void </dd></dl>
<p>&lt; Increase the page fault by one.</p>
<div class="fragment"><div class="line"><span class="lineno"> 91</span> {</div>
<div class="line"><span class="lineno"> 92</span> <span class="comment">// If the page requested not in cache.</span></div>
<div class="line"><span class="lineno"> 93</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="#aa4d6db56109af196ffc7e5f72bc9907c">pageMap</a>.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/unordered_map/find.html">find</a>(page) == <a class="code hl_variable" href="#aa4d6db56109af196ffc7e5f72bc9907c">pageMap</a>.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/unordered_map/end.html">end</a>()) {</div>
<div class="line"><span class="lineno"> 94</span> <a class="code hl_variable" href="#a09cbe562b0c396329607f5d388d57c9c">pageFault</a>++; <span class="comment">///&lt; Increase the page fault by one.</span></div>
<div class="line"><span class="lineno"> 95</span> </div>
<div class="line"><span class="lineno"> 96</span> <span class="comment">// Check if the cache is full</span></div>
<div class="line"><span class="lineno"> 97</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="#a3ee3560a6b90e6f50f6e063d690ba8e8">cache</a>.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/list/size.html">size</a>() == <a class="code hl_variable" href="#a1aafd0444b410e0fcb66287e9954c893">pageFrame</a>) {</div>
<div class="line"><span class="lineno"> 98</span> <span class="comment">// delete the last page from cache</span></div>
<div class="line"><span class="lineno"> 99</span> uint64_t lastPage = <a class="code hl_variable" href="#a3ee3560a6b90e6f50f6e063d690ba8e8">cache</a>.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/list/back.html">back</a>();</div>
<div class="line"><span class="lineno"> 100</span> <a class="code hl_variable" href="#a3ee3560a6b90e6f50f6e063d690ba8e8">cache</a>.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/list/pop_back.html">pop_back</a>();</div>
<div class="line"><span class="lineno"> 101</span> <a class="code hl_variable" href="#aa4d6db56109af196ffc7e5f72bc9907c">pageMap</a>.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/unordered_map/erase.html">erase</a>(lastPage);</div>
<div class="line"><span class="lineno"> 102</span> }</div>
<div class="line"><span class="lineno"> 103</span> }</div>
<div class="line"><span class="lineno"> 104</span> <span class="comment">// The requested page is in the cache</span></div>
<div class="line"><span class="lineno"> 105</span> <span class="keywordflow">else</span> {</div>
<div class="line"><span class="lineno"> 106</span> <a class="code hl_variable" href="#a5f33913e7ddfbb38062362e7bd859154">hits</a>++;</div>
<div class="line"><span class="lineno"> 107</span> <span class="comment">// present in cache, erase from current position to bring in front</span></div>
<div class="line"><span class="lineno"> 108</span> <a class="code hl_variable" href="#a3ee3560a6b90e6f50f6e063d690ba8e8">cache</a>.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/list/erase.html">erase</a>(<a class="code hl_variable" href="#aa4d6db56109af196ffc7e5f72bc9907c">pageMap</a>[page]);</div>
<div class="line"><span class="lineno"> 109</span> }</div>
<div class="line"><span class="lineno"> 110</span> <span class="comment">// Push it in the front of the cache and update the page reference in</span></div>
<div class="line"><span class="lineno"> 111</span> <span class="comment">// page map.</span></div>
<div class="line"><span class="lineno"> 112</span> <a class="code hl_variable" href="#a3ee3560a6b90e6f50f6e063d690ba8e8">cache</a>.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/list/push_front.html">push_front</a>(page);</div>
<div class="line"><span class="lineno"> 113</span> <a class="code hl_variable" href="#aa4d6db56109af196ffc7e5f72bc9907c">pageMap</a>[page] = <a class="code hl_variable" href="#a3ee3560a6b90e6f50f6e063d690ba8e8">cache</a>.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/list/begin.html">begin</a>();</div>
<div class="line"><span class="lineno"> 114</span> }</div>
<div class="fragment"><div class="line"><span class="lineno"> 92</span> {</div>
<div class="line"><span class="lineno"> 93</span> <span class="comment">// If the page requested not in cache.</span></div>
<div class="line"><span class="lineno"> 94</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="#aa4d6db56109af196ffc7e5f72bc9907c">pageMap</a>.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/unordered_map/find.html">find</a>(page) == <a class="code hl_variable" href="#aa4d6db56109af196ffc7e5f72bc9907c">pageMap</a>.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/unordered_map/end.html">end</a>()) {</div>
<div class="line"><span class="lineno"> 95</span> <a class="code hl_variable" href="#a09cbe562b0c396329607f5d388d57c9c">pageFault</a>++; <span class="comment">///&lt; Increase the page fault by one.</span></div>
<div class="line"><span class="lineno"> 96</span> </div>
<div class="line"><span class="lineno"> 97</span> <span class="comment">// Check if the cache is full</span></div>
<div class="line"><span class="lineno"> 98</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="#a3ee3560a6b90e6f50f6e063d690ba8e8">cache</a>.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/list/size.html">size</a>() == <a class="code hl_variable" href="#a1aafd0444b410e0fcb66287e9954c893">pageFrame</a>) {</div>
<div class="line"><span class="lineno"> 99</span> <span class="comment">// delete the last page from cache</span></div>
<div class="line"><span class="lineno"> 100</span> uint64_t lastPage = <a class="code hl_variable" href="#a3ee3560a6b90e6f50f6e063d690ba8e8">cache</a>.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/list/back.html">back</a>();</div>
<div class="line"><span class="lineno"> 101</span> <a class="code hl_variable" href="#a3ee3560a6b90e6f50f6e063d690ba8e8">cache</a>.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/list/pop_back.html">pop_back</a>();</div>
<div class="line"><span class="lineno"> 102</span> <a class="code hl_variable" href="#aa4d6db56109af196ffc7e5f72bc9907c">pageMap</a>.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/unordered_map/erase.html">erase</a>(lastPage);</div>
<div class="line"><span class="lineno"> 103</span> }</div>
<div class="line"><span class="lineno"> 104</span> }</div>
<div class="line"><span class="lineno"> 105</span> <span class="comment">// The requested page is in the cache</span></div>
<div class="line"><span class="lineno"> 106</span> <span class="keywordflow">else</span> {</div>
<div class="line"><span class="lineno"> 107</span> <a class="code hl_variable" href="#a5f33913e7ddfbb38062362e7bd859154">hits</a>++;</div>
<div class="line"><span class="lineno"> 108</span> <span class="comment">// present in cache, erase from current position to bring in front</span></div>
<div class="line"><span class="lineno"> 109</span> <a class="code hl_variable" href="#a3ee3560a6b90e6f50f6e063d690ba8e8">cache</a>.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/list/erase.html">erase</a>(<a class="code hl_variable" href="#aa4d6db56109af196ffc7e5f72bc9907c">pageMap</a>[page]);</div>
<div class="line"><span class="lineno"> 110</span> }</div>
<div class="line"><span class="lineno"> 111</span> <span class="comment">// Push it in the front of the cache and update the page reference in</span></div>
<div class="line"><span class="lineno"> 112</span> <span class="comment">// page map.</span></div>
<div class="line"><span class="lineno"> 113</span> <a class="code hl_variable" href="#a3ee3560a6b90e6f50f6e063d690ba8e8">cache</a>.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/list/push_front.html">push_front</a>(page);</div>
<div class="line"><span class="lineno"> 114</span> <a class="code hl_variable" href="#aa4d6db56109af196ffc7e5f72bc9907c">pageMap</a>[page] = <a class="code hl_variable" href="#a3ee3560a6b90e6f50f6e063d690ba8e8">cache</a>.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/list/begin.html">begin</a>();</div>
<div class="line"><span class="lineno"> 115</span> }</div>
<div class="ttc" id="aback_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/list/back.html">std::list::back</a></div><div class="ttdeci">T back(T... args)</div></div>
<div class="ttc" id="abegin_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/list/begin.html">std::list::begin</a></div><div class="ttdeci">T begin(T... args)</div></div>
<div class="ttc" id="aclassothers_1_1lru__cache_1_1_l_r_u_cache_html_aa4d6db56109af196ffc7e5f72bc9907c"><div class="ttname"><a href="#aa4d6db56109af196ffc7e5f72bc9907c">others::lru_cache::LRUCache::pageMap</a></div><div class="ttdeci">std::unordered_map&lt; uint64_t, std::list&lt; uint64_t &gt;::iterator &gt; pageMap</div><div class="ttdoc">Hash map containing pages and their addresses.</div><div class="ttdef"><b>Definition</b> lru_cache.cpp:71</div></div>
<div class="ttc" id="aclassothers_1_1lru__cache_1_1_l_r_u_cache_html_aa4d6db56109af196ffc7e5f72bc9907c"><div class="ttname"><a href="#aa4d6db56109af196ffc7e5f72bc9907c">others::lru_cache::LRUCache::pageMap</a></div><div class="ttdeci">std::unordered_map&lt; uint64_t, std::list&lt; uint64_t &gt;::iterator &gt; pageMap</div><div class="ttdoc">Hash map containing pages and their addresses.</div><div class="ttdef"><b>Definition</b> lru_cache.cpp:72</div></div>
<div class="ttc" id="aend_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/unordered_map/end.html">std::unordered_map::end</a></div><div class="ttdeci">T end(T... args)</div></div>
<div class="ttc" id="aerase_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/unordered_map/erase.html">std::unordered_map::erase</a></div><div class="ttdeci">T erase(T... args)</div></div>
<div class="ttc" id="afind_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/unordered_map/find.html">std::unordered_map::find</a></div><div class="ttdeci">T find(T... args)</div></div>

View File

@@ -114,19 +114,20 @@ $(function(){initNavTree('d6/db8/inv__sqrt_8cpp.html','../../'); initResizable(t
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &lt;cassert&gt;</code><br />
<code>#include &lt;cmath&gt;</code><br />
<code>#include &lt;cstdint&gt;</code><br />
<code>#include &lt;iostream&gt;</code><br />
<code>#include &lt;limits&gt;</code><br />
</div><div class="textblock"><div class="dynheader">
Include dependency graph for inv_sqrt.cpp:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d7/d53/inv__sqrt_8cpp__incl.svg" width="328" height="111"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d7/d53/inv__sqrt_8cpp__incl.svg" width="412" height="111"><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">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ad219034bf5fba657f5035ec5a1d50f52" id="r_ad219034bf5fba657f5035ec5a1d50f52"><td class="memTemplParams" colspan="2">template&lt;typename T = double, char iterations = 2&gt; </td></tr>
<tr class="memitem:ad219034bf5fba657f5035ec5a1d50f52"><td class="memTemplItemLeft" align="right" valign="top">T&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="#ad219034bf5fba657f5035ec5a1d50f52">Fast_InvSqrt</a> (T x)</td></tr>
<tr class="memdesc:ad219034bf5fba657f5035ec5a1d50f52"><td class="mdescLeft">&#160;</td><td class="mdescRight">for numeric_limits <br /></td></tr>
<tr class="memdesc:ad219034bf5fba657f5035ec5a1d50f52"><td class="mdescLeft">&#160;</td><td class="mdescRight">for <code><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/math/sqrt.html">std::sqrt</a></code> <br /></td></tr>
<tr class="separator:ad219034bf5fba657f5035ec5a1d50f52"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa2703e5cf3fecde8becd9066b9666b97" id="r_aa2703e5cf3fecde8becd9066b9666b97"><td class="memTemplParams" colspan="2">template&lt;typename T = double&gt; </td></tr>
<tr class="memitem:aa2703e5cf3fecde8becd9066b9666b97"><td class="memTemplItemLeft" align="right" valign="top">T&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="#aa2703e5cf3fecde8becd9066b9666b97">Standard_InvSqrt</a> (T number)</td></tr>
@@ -168,8 +169,8 @@ template&lt;typename T = double, char iterations = 2&gt; </div>
</table>
</div><div class="memdoc">
<p>for numeric_limits </p>
<p>for assert for <code><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/math/sqrt.html">std::sqrt</a></code> for IO operations</p>
<p>for <code><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/math/sqrt.html">std::sqrt</a></code> </p>
<p>for assert for IO operations for numeric_limits</p>
<p>This is the function that calculates the fast inverse square root. The following code is the fast inverse square root implementation from Quake III Arena (Adapted for C++). More information can be found at <a href="https://en.wikipedia.org/wiki/Fast_inverse_square_root" target="_blank">Wikipedia</a> </p><dl class="tparams"><dt>Template Parameters</dt><dd>
<table class="tparams">
<tr><td class="paramname">T</td><td>floating type </td></tr>
@@ -247,7 +248,7 @@ template&lt;typename T = double, char iterations = 2&gt; </div>
<div class="ttc" id="aendl_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a></div><div class="ttdeci">T endl(T... args)</div></div>
<div class="ttc" id="ainv__sqrt_8cpp_html_aa2703e5cf3fecde8becd9066b9666b97"><div class="ttname"><a href="#aa2703e5cf3fecde8becd9066b9666b97">Standard_InvSqrt</a></div><div class="ttdeci">T Standard_InvSqrt(T number)</div><div class="ttdoc">This is the function that calculates the fast inverse square root. The following code is the fast inv...</div><div class="ttdef"><b>Definition</b> inv_sqrt.cpp:59</div></div>
<div class="ttc" id="ainv__sqrt_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> inv_sqrt.cpp:68</div></div>
<div class="ttc" id="ainv__sqrt_8cpp_html_ad219034bf5fba657f5035ec5a1d50f52"><div class="ttname"><a href="#ad219034bf5fba657f5035ec5a1d50f52">Fast_InvSqrt</a></div><div class="ttdeci">T Fast_InvSqrt(T x)</div><div class="ttdoc">for numeric_limits</div><div class="ttdef"><b>Definition</b> inv_sqrt.cpp:28</div></div>
<div class="ttc" id="ainv__sqrt_8cpp_html_ad219034bf5fba657f5035ec5a1d50f52"><div class="ttname"><a href="#ad219034bf5fba657f5035ec5a1d50f52">Fast_InvSqrt</a></div><div class="ttdeci">T Fast_InvSqrt(T x)</div><div class="ttdoc">for std::sqrt</div><div class="ttdef"><b>Definition</b> inv_sqrt.cpp:28</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">

View File

@@ -2,7 +2,7 @@
<area shape="rect" id="Node000001" title="Self&#45;test implementations." alt="" coords="5,55,49,80"/>
<area shape="rect" id="Node000002" href="/Users/runner/work/C-Plus-Plus/C-Plus-Plus/doc/cppreference-doxygen-web.tag.xml$cpp/numeric/math/fabs.html#" title=" " alt="" coords="122,5,194,31"/>
<area shape="poly" id="edge1_Node000001_Node000002" title=" " alt="" coords="48,57,106,35,108,40,50,62"/>
<area shape="rect" id="Node000003" href="$d6/db8/inv__sqrt_8cpp.html#ad219034bf5fba657f5035ec5a1d50f52" title="for numeric_limits" alt="" coords="110,55,206,80"/>
<area shape="rect" id="Node000003" href="$d6/db8/inv__sqrt_8cpp.html#ad219034bf5fba657f5035ec5a1d50f52" title="for std::sqrt" alt="" coords="110,55,206,80"/>
<area shape="poly" id="edge2_Node000001_Node000003" title=" " alt="" coords="49,65,94,65,94,70,49,70"/>
<area shape="rect" id="Node000004" href="$d6/db8/inv__sqrt_8cpp.html#aa2703e5cf3fecde8becd9066b9666b97" title="This is the function that calculates the fast inverse square root. The following code is the fast inv..." alt="" coords="97,104,219,130"/>
<area shape="poly" id="edge3_Node000001_Node000004" title=" " alt="" coords="50,73,108,95,106,100,48,78"/>

View File

@@ -1 +1 @@
10c08706c543d14b1d3a7166cdba4af0
06769312eaeb707d415e3f0b084fcecd

View File

@@ -49,7 +49,7 @@
<!-- Node3 -->
<g id="Node000003" class="node">
<title>Node3</title>
<g id="a_Node000003"><a xlink:href="../../d6/db8/inv__sqrt_8cpp.html#ad219034bf5fba657f5035ec5a1d50f52" target="_top" xlink:title="for numeric_limits">
<g id="a_Node000003"><a xlink:href="../../d6/db8/inv__sqrt_8cpp.html#ad219034bf5fba657f5035ec5a1d50f52" target="_top" xlink:title="for std::sqrt">
<polygon fill="white" stroke="#666666" points="150.5,-56.25 78.25,-56.25 78.25,-37 150.5,-37 150.5,-56.25"/>
<text text-anchor="middle" x="114.38" y="-42.75" font-family="Helvetica,sans-Serif" font-size="10.00">Fast_InvSqrt</text>
</a>

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@@ -38,7 +38,7 @@
<!-- Node3 -->
<g id="Node000003" class="node">
<title>Node3</title>
<g id="a_Node000003"><a xlink:href="../../d6/db8/inv__sqrt_8cpp.html#ad219034bf5fba657f5035ec5a1d50f52" target="_top" xlink:title="for numeric_limits">
<g id="a_Node000003"><a xlink:href="../../d6/db8/inv__sqrt_8cpp.html#ad219034bf5fba657f5035ec5a1d50f52" target="_top" xlink:title="for std::sqrt">
<polygon fill="white" stroke="#666666" points="150.5,-56.25 78.25,-56.25 78.25,-37 150.5,-37 150.5,-56.25"/>
<text text-anchor="middle" x="114.38" y="-42.75" font-family="Helvetica,sans-Serif" font-size="10.00">Fast_InvSqrt</text>
</a>

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@@ -2,7 +2,7 @@
<area shape="rect" id="Node000001" title="Main function." alt="" coords="5,81,55,107"/>
<area shape="rect" id="Node000002" href="/Users/runner/work/C-Plus-Plus/C-Plus-Plus/doc/cppreference-doxygen-web.tag.xml$cpp/io/manip/endl.html#" title=" " alt="" coords="103,5,174,31"/>
<area shape="poly" id="edge1_Node000001_Node000002" title=" " alt="" coords="48,79,104,38,108,43,51,83"/>
<area shape="rect" id="Node000003" href="$d6/db8/inv__sqrt_8cpp.html#ad219034bf5fba657f5035ec5a1d50f52" title="for numeric_limits" alt="" coords="235,57,331,83"/>
<area shape="rect" id="Node000003" href="$d6/db8/inv__sqrt_8cpp.html#ad219034bf5fba657f5035ec5a1d50f52" title="for std::sqrt" alt="" coords="235,57,331,83"/>
<area shape="poly" id="edge2_Node000001_Node000003" title=" " alt="" coords="55,89,219,73,220,79,55,95"/>
<area shape="rect" id="Node000004" href="$d6/db8/inv__sqrt_8cpp.html#aa2703e5cf3fecde8becd9066b9666b97" title="This is the function that calculates the fast inverse square root. The following code is the fast inv..." alt="" coords="222,156,344,182"/>
<area shape="poly" id="edge3_Node000001_Node000004" title=" " alt="" coords="47,105,72,125,104,142,155,157,207,164,206,169,154,162,102,147,69,130,44,109"/>

View File

@@ -1 +1 @@
7c5937b1334cbfc3148ea1d000d4ec3b
737c1b9ea92d0445059fc576a7c498c9

View File

@@ -49,7 +49,7 @@
<!-- Node3 -->
<g id="Node000003" class="node">
<title>Node3</title>
<g id="a_Node000003"><a xlink:href="../../d6/db8/inv__sqrt_8cpp.html#ad219034bf5fba657f5035ec5a1d50f52" target="_top" xlink:title="for numeric_limits">
<g id="a_Node000003"><a xlink:href="../../d6/db8/inv__sqrt_8cpp.html#ad219034bf5fba657f5035ec5a1d50f52" target="_top" xlink:title="for std::sqrt">
<polygon fill="white" stroke="#666666" points="244.5,-93.25 172.25,-93.25 172.25,-74 244.5,-74 244.5,-93.25"/>
<text text-anchor="middle" x="208.38" y="-79.75" font-family="Helvetica,sans-Serif" font-size="10.00">Fast_InvSqrt</text>
</a>

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

@@ -38,7 +38,7 @@
<!-- Node3 -->
<g id="Node000003" class="node">
<title>Node3</title>
<g id="a_Node000003"><a xlink:href="../../d6/db8/inv__sqrt_8cpp.html#ad219034bf5fba657f5035ec5a1d50f52" target="_top" xlink:title="for numeric_limits">
<g id="a_Node000003"><a xlink:href="../../d6/db8/inv__sqrt_8cpp.html#ad219034bf5fba657f5035ec5a1d50f52" target="_top" xlink:title="for std::sqrt">
<polygon fill="white" stroke="#666666" points="244.5,-93.25 172.25,-93.25 172.25,-74 244.5,-74 244.5,-93.25"/>
<text text-anchor="middle" x="208.38" y="-79.75" font-family="Helvetica,sans-Serif" font-size="10.00">Fast_InvSqrt</text>
</a>

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

@@ -1,7 +1,9 @@
<map id="math/n_choose_r.cpp" name="math/n_choose_r.cpp">
<area shape="rect" id="Node000001" title="Combinations n choose r function implementation" alt="" coords="10,5,156,31"/>
<area shape="rect" id="Node000001" title="Combinations n choose r function implementation" alt="" coords="52,5,197,31"/>
<area shape="rect" id="Node000002" title=" " alt="" coords="5,79,70,105"/>
<area shape="poly" id="edge1_Node000001_Node000002" title=" " alt="" coords="78,33,55,67,51,64,73,30"/>
<area shape="rect" id="Node000003" title=" " alt="" coords="94,79,165,105"/>
<area shape="poly" id="edge2_Node000001_Node000003" title=" " alt="" coords="93,30,116,64,111,67,88,33"/>
<area shape="poly" id="edge1_Node000001_Node000002" title=" " alt="" coords="111,34,65,71,62,67,108,29"/>
<area shape="rect" id="Node000003" title=" " alt="" coords="94,79,154,105"/>
<area shape="poly" id="edge2_Node000001_Node000003" title=" " alt="" coords="127,31,127,63,122,63,122,31"/>
<area shape="rect" id="Node000004" title=" " alt="" coords="178,79,249,105"/>
<area shape="poly" id="edge3_Node000001_Node000004" title=" " alt="" coords="141,29,188,67,185,71,138,34"/>
</map>

View File

@@ -1 +1 @@
181c65e9bdbfd55c6f603b5fa29f6958
16b175e71e3a22a30a255c715beee25e

View File

@@ -4,8 +4,8 @@
<!-- Generated by graphviz version 12.1.2 (20240928.0832)
-->
<!-- Title: math/n_choose_r.cpp Pages: 1 -->
<svg width="128pt" height="83pt"
viewBox="0.00 0.00 127.88 82.50" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<svg width="191pt" height="83pt"
viewBox="0.00 0.00 190.88 82.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">
@@ -23,8 +23,8 @@
<g id="Node000001" class="node">
<title>Node1</title>
<g id="a_Node000001"><a xlink:title="Combinations n choose r function implementation">
<polygon fill="#999999" stroke="#666666" points="112.62,-74.5 3.62,-74.5 3.62,-55.25 112.62,-55.25 112.62,-74.5"/>
<text text-anchor="middle" x="58.12" y="-61" font-family="Helvetica,sans-Serif" font-size="10.00">math/n_choose_r.cpp</text>
<polygon fill="#999999" stroke="#666666" points="143.62,-74.5 34.62,-74.5 34.62,-55.25 143.62,-55.25 143.62,-74.5"/>
<text text-anchor="middle" x="89.12" y="-61" font-family="Helvetica,sans-Serif" font-size="10.00">math/n_choose_r.cpp</text>
</a>
</g>
</g>
@@ -41,8 +41,8 @@
<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="M52.51,-55.08C48.01,-48.03 41.54,-37.9 35.91,-29.08"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="39.01,-27.43 30.68,-20.88 33.11,-31.2 39.01,-27.43"/>
<path fill="none" stroke="#63b8ff" d="M78.1,-54.84C68.7,-47.15 54.98,-35.9 43.72,-26.68"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="46.11,-24.11 36.16,-20.48 41.68,-29.53 46.11,-24.11"/>
</a>
</g>
</g>
@@ -50,8 +50,8 @@
<g id="Node000003" class="node">
<title>Node3</title>
<g id="a_Node000003"><a xlink:title=" ">
<polygon fill="#e0e0e0" stroke="#999999" points="119.88,-19.25 66.38,-19.25 66.38,0 119.88,0 119.88,-19.25"/>
<text text-anchor="middle" x="93.12" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">iostream</text>
<polygon fill="#e0e0e0" stroke="#999999" points="111.75,-19.25 66.5,-19.25 66.5,0 111.75,0 111.75,-19.25"/>
<text text-anchor="middle" x="89.12" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">cstdint</text>
</a>
</g>
</g>
@@ -59,8 +59,26 @@
<g id="edge2_Node000001_Node000003" class="edge">
<title>Node1&#45;&gt;Node3</title>
<g id="a_edge2_Node000001_Node000003"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M63.9,-55.08C68.54,-48.03 75.2,-37.9 80.99,-29.08"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="83.82,-31.15 86.39,-20.87 77.97,-27.31 83.82,-31.15"/>
<path fill="none" stroke="#63b8ff" d="M89.12,-55.08C89.12,-48.57 89.12,-39.42 89.12,-31.12"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="92.63,-31.12 89.13,-21.12 85.63,-31.12 92.63,-31.12"/>
</a>
</g>
</g>
<!-- Node4 -->
<g id="Node000004" class="node">
<title>Node4</title>
<g id="a_Node000004"><a xlink:title=" ">
<polygon fill="#e0e0e0" stroke="#999999" points="182.88,-19.25 129.38,-19.25 129.38,0 182.88,0 182.88,-19.25"/>
<text text-anchor="middle" x="156.12" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">iostream</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node4 -->
<g id="edge3_Node000001_Node000004" class="edge">
<title>Node1&#45;&gt;Node4</title>
<g id="a_edge3_Node000001_Node000004"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M100.49,-54.84C110.17,-47.15 124.32,-35.9 135.93,-26.68"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="138.09,-29.43 143.74,-20.47 133.74,-23.95 138.09,-29.43"/>
</a>
</g>
</g>

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@@ -4,16 +4,16 @@
<!-- Generated by graphviz version 12.1.2 (20240928.0832)
-->
<!-- Title: math/n_choose_r.cpp Pages: 1 -->
<svg width="128pt" height="83pt"
viewBox="0.00 0.00 127.88 82.50" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<svg width="191pt" height="83pt"
viewBox="0.00 0.00 190.88 82.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 78.5)">
<title>math/n_choose_r.cpp</title>
<!-- Node1 -->
<g id="Node000001" class="node">
<title>Node1</title>
<g id="a_Node000001"><a xlink:title="Combinations n choose r function implementation">
<polygon fill="#999999" stroke="#666666" points="112.62,-74.5 3.62,-74.5 3.62,-55.25 112.62,-55.25 112.62,-74.5"/>
<text text-anchor="middle" x="58.12" y="-61" font-family="Helvetica,sans-Serif" font-size="10.00">math/n_choose_r.cpp</text>
<polygon fill="#999999" stroke="#666666" points="143.62,-74.5 34.62,-74.5 34.62,-55.25 143.62,-55.25 143.62,-74.5"/>
<text text-anchor="middle" x="89.12" y="-61" font-family="Helvetica,sans-Serif" font-size="10.00">math/n_choose_r.cpp</text>
</a>
</g>
</g>
@@ -30,8 +30,8 @@
<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="M52.51,-55.08C48.01,-48.03 41.54,-37.9 35.91,-29.08"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="39.01,-27.43 30.68,-20.88 33.11,-31.2 39.01,-27.43"/>
<path fill="none" stroke="#63b8ff" d="M78.1,-54.84C68.7,-47.15 54.98,-35.9 43.72,-26.68"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="46.11,-24.11 36.16,-20.48 41.68,-29.53 46.11,-24.11"/>
</a>
</g>
</g>
@@ -39,8 +39,8 @@
<g id="Node000003" class="node">
<title>Node3</title>
<g id="a_Node000003"><a xlink:title=" ">
<polygon fill="#e0e0e0" stroke="#999999" points="119.88,-19.25 66.38,-19.25 66.38,0 119.88,0 119.88,-19.25"/>
<text text-anchor="middle" x="93.12" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">iostream</text>
<polygon fill="#e0e0e0" stroke="#999999" points="111.75,-19.25 66.5,-19.25 66.5,0 111.75,0 111.75,-19.25"/>
<text text-anchor="middle" x="89.12" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">cstdint</text>
</a>
</g>
</g>
@@ -48,8 +48,26 @@
<g id="edge2_Node000001_Node000003" class="edge">
<title>Node1&#45;&gt;Node3</title>
<g id="a_edge2_Node000001_Node000003"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M63.9,-55.08C68.54,-48.03 75.2,-37.9 80.99,-29.08"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="83.82,-31.15 86.39,-20.87 77.97,-27.31 83.82,-31.15"/>
<path fill="none" stroke="#63b8ff" d="M89.12,-55.08C89.12,-48.57 89.12,-39.42 89.12,-31.12"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="92.63,-31.12 89.13,-21.12 85.63,-31.12 92.63,-31.12"/>
</a>
</g>
</g>
<!-- Node4 -->
<g id="Node000004" class="node">
<title>Node4</title>
<g id="a_Node000004"><a xlink:title=" ">
<polygon fill="#e0e0e0" stroke="#999999" points="182.88,-19.25 129.38,-19.25 129.38,0 182.88,0 182.88,-19.25"/>
<text text-anchor="middle" x="156.12" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">iostream</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node4 -->
<g id="edge3_Node000001_Node000004" class="edge">
<title>Node1&#45;&gt;Node4</title>
<g id="a_edge3_Node000001_Node000004"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M100.49,-54.84C110.17,-47.15 124.32,-35.9 135.93,-26.68"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="138.09,-29.43 143.74,-20.47 133.74,-23.95 138.09,-29.43"/>
</a>
</g>
</g>

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB