mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-03-25 06:12:11 +08:00
Documentation for 4a03c62dd3
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
<map id="math/extended_euclid_algorithm.cpp" name="math/extended_euclid_algorithm.cpp">
|
||||
<area shape="rect" id="Node000001" title="GCD using [extended Euclid's algorithm] (https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm)" alt="" coords="16,5,165,46"/>
|
||||
<area shape="rect" id="Node000001" title="GCD using [extended Euclid's algorithm] (https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm)" alt="" coords="66,5,214,46"/>
|
||||
<area shape="rect" id="Node000002" title=" " alt="" coords="5,94,80,120"/>
|
||||
<area shape="poly" id="edge1_Node000001_Node000002" title=" " alt="" coords="81,48,60,82,55,79,76,45"/>
|
||||
<area shape="poly" id="edge1_Node000001_Node000002" title=" " alt="" coords="117,48,71,86,68,82,114,44"/>
|
||||
<area shape="rect" id="Node000003" title=" " alt="" coords="104,94,176,120"/>
|
||||
<area shape="poly" id="edge2_Node000001_Node000003" title=" " alt="" coords="105,45,126,79,122,82,100,48"/>
|
||||
<area shape="poly" id="edge2_Node000001_Node000003" title=" " alt="" coords="142,46,142,78,137,78,137,46"/>
|
||||
<area shape="rect" id="Node000004" title=" " alt="" coords="199,94,259,120"/>
|
||||
<area shape="poly" id="edge3_Node000001_Node000004" title=" " alt="" coords="164,44,206,82,202,86,160,48"/>
|
||||
</map>
|
||||
|
||||
@@ -1 +1 @@
|
||||
912a5ae6442784e10eaa3b2b127524ce
|
||||
bda3ede91d5270b35a16a11d5046c4a8
|
||||
@@ -4,8 +4,8 @@
|
||||
<!-- Generated by graphviz version 12.1.0 (20240811.2233)
|
||||
-->
|
||||
<!-- Title: math/extended_euclid_algorithm.cpp Pages: 1 -->
|
||||
<svg width="136pt" height="94pt"
|
||||
viewBox="0.00 0.00 135.62 93.75" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<svg width="199pt" height="94pt"
|
||||
viewBox="0.00 0.00 198.50 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="GCD using [extended Euclid's algorithm] (https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm)">
|
||||
<polygon fill="#999999" stroke="#666666" points="119.5,-85.75 8.25,-85.75 8.25,-55.25 119.5,-55.25 119.5,-85.75"/>
|
||||
<text text-anchor="start" x="16.25" y="-72.25" font-family="Helvetica,sans-Serif" font-size="10.00">math/extended_euclid</text>
|
||||
<text text-anchor="middle" x="63.88" y="-61" font-family="Helvetica,sans-Serif" font-size="10.00">_algorithm.cpp</text>
|
||||
<polygon fill="#999999" stroke="#666666" points="156.5,-85.75 45.25,-85.75 45.25,-55.25 156.5,-55.25 156.5,-85.75"/>
|
||||
<text text-anchor="start" x="53.25" y="-72.25" font-family="Helvetica,sans-Serif" font-size="10.00">math/extended_euclid</text>
|
||||
<text text-anchor="middle" x="100.88" y="-61" font-family="Helvetica,sans-Serif" font-size="10.00">_algorithm.cpp</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
@@ -42,8 +42,8 @@
|
||||
<g id="edge1_Node000001_Node000002" class="edge">
|
||||
<title>Node1->Node2</title>
|
||||
<g id="a_edge1_Node000001_Node000002"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M54.98,-54.95C50.23,-47.19 44.35,-37.56 39.27,-29.26"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="42.42,-27.7 34.21,-20.99 36.45,-31.35 42.42,-27.7"/>
|
||||
<path fill="none" stroke="#63b8ff" d="M82.83,-54.95C72.25,-46.41 58.86,-35.62 47.95,-26.81"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="50.29,-24.2 40.31,-20.65 45.89,-29.65 50.29,-24.2"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
@@ -60,8 +60,26 @@
|
||||
<g id="edge2_Node000001_Node000003" class="edge">
|
||||
<title>Node1->Node3</title>
|
||||
<g id="a_edge2_Node000001_Node000003"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M73.02,-54.95C77.9,-47.19 83.95,-37.56 89.16,-29.26"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="92.01,-31.31 94.37,-20.98 86.08,-27.59 92.01,-31.31"/>
|
||||
<path fill="none" stroke="#63b8ff" d="M100.88,-54.95C100.88,-47.71 100.88,-38.84 100.88,-30.94"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="104.38,-31.21 100.88,-21.21 97.38,-31.21 104.38,-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="190.5,-19.25 145.25,-19.25 145.25,0 190.5,0 190.5,-19.25"/>
|
||||
<text text-anchor="middle" x="167.88" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">cstdint</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node4 -->
|
||||
<g id="edge3_Node000001_Node000004" class="edge">
|
||||
<title>Node1->Node4</title>
|
||||
<g id="a_edge3_Node000001_Node000004"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M117.44,-54.95C127.05,-46.5 139.19,-35.83 149.15,-27.08"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="151.21,-29.93 156.41,-20.7 146.59,-24.67 151.21,-29.93"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 4.0 KiB |
@@ -4,17 +4,17 @@
|
||||
<!-- Generated by graphviz version 12.1.0 (20240811.2233)
|
||||
-->
|
||||
<!-- Title: math/extended_euclid_algorithm.cpp Pages: 1 -->
|
||||
<svg width="136pt" height="94pt"
|
||||
viewBox="0.00 0.00 135.62 93.75" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<svg width="199pt" height="94pt"
|
||||
viewBox="0.00 0.00 198.50 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>math/extended_euclid_algorithm.cpp</title>
|
||||
<!-- Node1 -->
|
||||
<g id="Node000001" class="node">
|
||||
<title>Node1</title>
|
||||
<g id="a_Node000001"><a xlink:title="GCD using [extended Euclid's algorithm] (https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm)">
|
||||
<polygon fill="#999999" stroke="#666666" points="119.5,-85.75 8.25,-85.75 8.25,-55.25 119.5,-55.25 119.5,-85.75"/>
|
||||
<text text-anchor="start" x="16.25" y="-72.25" font-family="Helvetica,sans-Serif" font-size="10.00">math/extended_euclid</text>
|
||||
<text text-anchor="middle" x="63.88" y="-61" font-family="Helvetica,sans-Serif" font-size="10.00">_algorithm.cpp</text>
|
||||
<polygon fill="#999999" stroke="#666666" points="156.5,-85.75 45.25,-85.75 45.25,-55.25 156.5,-55.25 156.5,-85.75"/>
|
||||
<text text-anchor="start" x="53.25" y="-72.25" font-family="Helvetica,sans-Serif" font-size="10.00">math/extended_euclid</text>
|
||||
<text text-anchor="middle" x="100.88" y="-61" font-family="Helvetica,sans-Serif" font-size="10.00">_algorithm.cpp</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
@@ -31,8 +31,8 @@
|
||||
<g id="edge1_Node000001_Node000002" class="edge">
|
||||
<title>Node1->Node2</title>
|
||||
<g id="a_edge1_Node000001_Node000002"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M54.98,-54.95C50.23,-47.19 44.35,-37.56 39.27,-29.26"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="42.42,-27.7 34.21,-20.99 36.45,-31.35 42.42,-27.7"/>
|
||||
<path fill="none" stroke="#63b8ff" d="M82.83,-54.95C72.25,-46.41 58.86,-35.62 47.95,-26.81"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="50.29,-24.2 40.31,-20.65 45.89,-29.65 50.29,-24.2"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
@@ -49,8 +49,26 @@
|
||||
<g id="edge2_Node000001_Node000003" class="edge">
|
||||
<title>Node1->Node3</title>
|
||||
<g id="a_edge2_Node000001_Node000003"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M73.02,-54.95C77.9,-47.19 83.95,-37.56 89.16,-29.26"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="92.01,-31.31 94.37,-20.98 86.08,-27.59 92.01,-31.31"/>
|
||||
<path fill="none" stroke="#63b8ff" d="M100.88,-54.95C100.88,-47.71 100.88,-38.84 100.88,-30.94"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="104.38,-31.21 100.88,-21.21 97.38,-31.21 104.38,-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="190.5,-19.25 145.25,-19.25 145.25,0 190.5,0 190.5,-19.25"/>
|
||||
<text text-anchor="middle" x="167.88" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">cstdint</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node4 -->
|
||||
<g id="edge3_Node000001_Node000004" class="edge">
|
||||
<title>Node1->Node4</title>
|
||||
<g id="a_edge3_Node000001_Node000004"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M117.44,-54.95C127.05,-46.5 139.19,-35.83 149.15,-27.08"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="151.21,-29.93 156.41,-20.7 146.59,-24.67 151.21,-29.93"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 3.3 KiB |
@@ -114,10 +114,11 @@ $(function(){initNavTree('d9/d5d/extended__euclid__algorithm_8cpp.html','../../'
|
||||
<a href="#details">More...</a></p>
|
||||
<div class="textblock"><code>#include <algorithm></code><br />
|
||||
<code>#include <iostream></code><br />
|
||||
<code>#include <cstdint></code><br />
|
||||
</div><div class="textblock"><div class="dynheader">
|
||||
Include dependency graph for extended_euclid_algorithm.cpp:</div>
|
||||
<div class="dyncontent">
|
||||
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d4/dc7/extended__euclid__algorithm_8cpp__incl.svg" width="182" 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="../../d4/dc7/extended__euclid__algorithm_8cpp__incl.svg" width="266" 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>
|
||||
@@ -188,22 +189,22 @@ template<typename T , typename T2 > </div>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 70</span> {</div>
|
||||
<div class="line"><span class="lineno"> 71</span> <span class="keywordflow">if</span> (B > A)</div>
|
||||
<div class="line"><span class="lineno"> 72</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/swap.html">std::swap</a>(A, B); <span class="comment">// Ensure that A >= B</span></div>
|
||||
<div class="line"><span class="lineno"> 73</span> </div>
|
||||
<div class="line"><span class="lineno"> 74</span> <span class="keywordflow">if</span> (B == 0) {</div>
|
||||
<div class="line"><span class="lineno"> 75</span> *GCD = A;</div>
|
||||
<div class="line"><span class="lineno"> 76</span> *x = 1;</div>
|
||||
<div class="line"><span class="lineno"> 77</span> *y = 0;</div>
|
||||
<div class="line"><span class="lineno"> 78</span> } <span class="keywordflow">else</span> {</div>
|
||||
<div class="line"><span class="lineno"> 79</span> <a class="code hl_function" href="#acba15ca55b3e7dcb91f3c65d72ba052d">extendedEuclid</a>(B, A % B, GCD, x, y);</div>
|
||||
<div class="line"><span class="lineno"> 80</span> T2 temp = *x;</div>
|
||||
<div class="line"><span class="lineno"> 81</span> *x = *y;</div>
|
||||
<div class="line"><span class="lineno"> 82</span> *y = temp - (A / B) * (*y);</div>
|
||||
<div class="line"><span class="lineno"> 83</span> }</div>
|
||||
<div class="line"><span class="lineno"> 84</span>}</div>
|
||||
<div class="ttc" id="aextended__euclid__algorithm_8cpp_html_acba15ca55b3e7dcb91f3c65d72ba052d"><div class="ttname"><a href="#acba15ca55b3e7dcb91f3c65d72ba052d">extendedEuclid</a></div><div class="ttdeci">void extendedEuclid(T A, T B, T *GCD, T2 *x, T2 *y)</div><div class="ttdef"><b>Definition</b> extended_euclid_algorithm.cpp:70</div></div>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 71</span> {</div>
|
||||
<div class="line"><span class="lineno"> 72</span> <span class="keywordflow">if</span> (B > A)</div>
|
||||
<div class="line"><span class="lineno"> 73</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/swap.html">std::swap</a>(A, B); <span class="comment">// Ensure that A >= B</span></div>
|
||||
<div class="line"><span class="lineno"> 74</span> </div>
|
||||
<div class="line"><span class="lineno"> 75</span> <span class="keywordflow">if</span> (B == 0) {</div>
|
||||
<div class="line"><span class="lineno"> 76</span> *GCD = A;</div>
|
||||
<div class="line"><span class="lineno"> 77</span> *x = 1;</div>
|
||||
<div class="line"><span class="lineno"> 78</span> *y = 0;</div>
|
||||
<div class="line"><span class="lineno"> 79</span> } <span class="keywordflow">else</span> {</div>
|
||||
<div class="line"><span class="lineno"> 80</span> <a class="code hl_function" href="#acba15ca55b3e7dcb91f3c65d72ba052d">extendedEuclid</a>(B, A % B, GCD, x, y);</div>
|
||||
<div class="line"><span class="lineno"> 81</span> T2 temp = *x;</div>
|
||||
<div class="line"><span class="lineno"> 82</span> *x = *y;</div>
|
||||
<div class="line"><span class="lineno"> 83</span> *y = temp - (A / B) * (*y);</div>
|
||||
<div class="line"><span class="lineno"> 84</span> }</div>
|
||||
<div class="line"><span class="lineno"> 85</span>}</div>
|
||||
<div class="ttc" id="aextended__euclid__algorithm_8cpp_html_acba15ca55b3e7dcb91f3c65d72ba052d"><div class="ttname"><a href="#acba15ca55b3e7dcb91f3c65d72ba052d">extendedEuclid</a></div><div class="ttdeci">void extendedEuclid(T A, T B, T *GCD, T2 *x, T2 *y)</div><div class="ttdef"><b>Definition</b> extended_euclid_algorithm.cpp:71</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>
|
||||
</div><!-- fragment --><div class="dynheader">
|
||||
Here is the call graph for this function:</div>
|
||||
@@ -259,25 +260,25 @@ template<typename T1 , typename T2 > </div>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 41</span> {</div>
|
||||
<div class="line"><span class="lineno"> 42</span> <span class="keywordflow">if</span> (B > A)</div>
|
||||
<div class="line"><span class="lineno"> 43</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/swap.html">std::swap</a>(A, B); <span class="comment">// Ensure that A >= B</span></div>
|
||||
<div class="line"><span class="lineno"> 44</span> </div>
|
||||
<div class="line"><span class="lineno"> 45</span> T2 s = 0, s0 = 1;</div>
|
||||
<div class="line"><span class="lineno"> 46</span> T2 t = 1, t0 = 0;</div>
|
||||
<div class="line"><span class="lineno"> 47</span> T1 r = B, r0 = A;</div>
|
||||
<div class="line"><span class="lineno"> 48</span> </div>
|
||||
<div class="line"><span class="lineno"> 49</span> <span class="keywordflow">while</span> (r != 0) {</div>
|
||||
<div class="line"><span class="lineno"> 50</span> T1 quotient = r0 / r;</div>
|
||||
<div class="line"><span class="lineno"> 51</span> <a class="code hl_function" href="#abe92d63a0ff9bda7e304df510d5dd217">update_step</a>(&r, &r0, quotient);</div>
|
||||
<div class="line"><span class="lineno"> 52</span> <a class="code hl_function" href="#abe92d63a0ff9bda7e304df510d5dd217">update_step</a>(&s, &s0, quotient);</div>
|
||||
<div class="line"><span class="lineno"> 53</span> <a class="code hl_function" href="#abe92d63a0ff9bda7e304df510d5dd217">update_step</a>(&t, &t0, quotient);</div>
|
||||
<div class="line"><span class="lineno"> 54</span> }</div>
|
||||
<div class="line"><span class="lineno"> 55</span> *GCD = r0;</div>
|
||||
<div class="line"><span class="lineno"> 56</span> *x = s0;</div>
|
||||
<div class="line"><span class="lineno"> 57</span> *y = t0;</div>
|
||||
<div class="line"><span class="lineno"> 58</span>}</div>
|
||||
<div class="ttc" id="aextended__euclid__algorithm_8cpp_html_abe92d63a0ff9bda7e304df510d5dd217"><div class="ttname"><a href="#abe92d63a0ff9bda7e304df510d5dd217">update_step</a></div><div class="ttdeci">void update_step(T *r, T *r0, const T2 quotient)</div><div class="ttdef"><b>Definition</b> extended_euclid_algorithm.cpp:24</div></div>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 42</span> {</div>
|
||||
<div class="line"><span class="lineno"> 43</span> <span class="keywordflow">if</span> (B > A)</div>
|
||||
<div class="line"><span class="lineno"> 44</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/swap.html">std::swap</a>(A, B); <span class="comment">// Ensure that A >= B</span></div>
|
||||
<div class="line"><span class="lineno"> 45</span> </div>
|
||||
<div class="line"><span class="lineno"> 46</span> T2 s = 0, s0 = 1;</div>
|
||||
<div class="line"><span class="lineno"> 47</span> T2 t = 1, t0 = 0;</div>
|
||||
<div class="line"><span class="lineno"> 48</span> T1 r = B, r0 = A;</div>
|
||||
<div class="line"><span class="lineno"> 49</span> </div>
|
||||
<div class="line"><span class="lineno"> 50</span> <span class="keywordflow">while</span> (r != 0) {</div>
|
||||
<div class="line"><span class="lineno"> 51</span> T1 quotient = r0 / r;</div>
|
||||
<div class="line"><span class="lineno"> 52</span> <a class="code hl_function" href="#abe92d63a0ff9bda7e304df510d5dd217">update_step</a>(&r, &r0, quotient);</div>
|
||||
<div class="line"><span class="lineno"> 53</span> <a class="code hl_function" href="#abe92d63a0ff9bda7e304df510d5dd217">update_step</a>(&s, &s0, quotient);</div>
|
||||
<div class="line"><span class="lineno"> 54</span> <a class="code hl_function" href="#abe92d63a0ff9bda7e304df510d5dd217">update_step</a>(&t, &t0, quotient);</div>
|
||||
<div class="line"><span class="lineno"> 55</span> }</div>
|
||||
<div class="line"><span class="lineno"> 56</span> *GCD = r0;</div>
|
||||
<div class="line"><span class="lineno"> 57</span> *x = s0;</div>
|
||||
<div class="line"><span class="lineno"> 58</span> *y = t0;</div>
|
||||
<div class="line"><span class="lineno"> 59</span>}</div>
|
||||
<div class="ttc" id="aextended__euclid__algorithm_8cpp_html_abe92d63a0ff9bda7e304df510d5dd217"><div class="ttname"><a href="#abe92d63a0ff9bda7e304df510d5dd217">update_step</a></div><div class="ttdeci">void update_step(T *r, T *r0, const T2 quotient)</div><div class="ttdef"><b>Definition</b> extended_euclid_algorithm.cpp:25</div></div>
|
||||
</div><!-- fragment --><div class="dynheader">
|
||||
Here is the call graph for this function:</div>
|
||||
<div class="dyncontent">
|
||||
@@ -302,20 +303,20 @@ Here is the call graph for this function:</div>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Main function. </p>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 87</span> {</div>
|
||||
<div class="line"><span class="lineno"> 88</span> uint32_t a, b, <a class="code hl_function" href="../../d4/da0/gcd__iterative__euclidean_8cpp.html#ae48807fa2b7000afae599e67f327545e">gcd</a>;</div>
|
||||
<div class="line"><span class="lineno"> 89</span> int32_t x, y;</div>
|
||||
<div class="line"><span class="lineno"> 90</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_istream.html">std::cin</a> >> a >> b;</div>
|
||||
<div class="line"><span class="lineno"> 91</span> <a class="code hl_function" href="#acba15ca55b3e7dcb91f3c65d72ba052d">extendedEuclid</a>(a, b, &<a class="code hl_function" href="../../d4/da0/gcd__iterative__euclidean_8cpp.html#ae48807fa2b7000afae599e67f327545e">gcd</a>, &x, &y);</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> << <a class="code hl_function" href="../../d4/da0/gcd__iterative__euclidean_8cpp.html#ae48807fa2b7000afae599e67f327545e">gcd</a> << <span class="stringliteral">" "</span> << x << <span class="stringliteral">" "</span> << y << <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"> 93</span> <a class="code hl_function" href="#a1792ac7c33aaf26b860ab55f5652ab25">extendedEuclid_1</a>(a, b, &<a class="code hl_function" href="../../d4/da0/gcd__iterative__euclidean_8cpp.html#ae48807fa2b7000afae599e67f327545e">gcd</a>, &x, &y);</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> << <a class="code hl_function" href="../../d4/da0/gcd__iterative__euclidean_8cpp.html#ae48807fa2b7000afae599e67f327545e">gcd</a> << <span class="stringliteral">" "</span> << x << <span class="stringliteral">" "</span> << y << <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="keywordflow">return</span> 0;</div>
|
||||
<div class="line"><span class="lineno"> 96</span>}</div>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 88</span> {</div>
|
||||
<div class="line"><span class="lineno"> 89</span> uint32_t a, b, <a class="code hl_function" href="../../d4/da0/gcd__iterative__euclidean_8cpp.html#ae48807fa2b7000afae599e67f327545e">gcd</a>;</div>
|
||||
<div class="line"><span class="lineno"> 90</span> int32_t x, y;</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_istream.html">std::cin</a> >> a >> b;</div>
|
||||
<div class="line"><span class="lineno"> 92</span> <a class="code hl_function" href="#acba15ca55b3e7dcb91f3c65d72ba052d">extendedEuclid</a>(a, b, &<a class="code hl_function" href="../../d4/da0/gcd__iterative__euclidean_8cpp.html#ae48807fa2b7000afae599e67f327545e">gcd</a>, &x, &y);</div>
|
||||
<div class="line"><span class="lineno"> 93</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <a class="code hl_function" href="../../d4/da0/gcd__iterative__euclidean_8cpp.html#ae48807fa2b7000afae599e67f327545e">gcd</a> << <span class="stringliteral">" "</span> << x << <span class="stringliteral">" "</span> << y << <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"> 94</span> <a class="code hl_function" href="#a1792ac7c33aaf26b860ab55f5652ab25">extendedEuclid_1</a>(a, b, &<a class="code hl_function" href="../../d4/da0/gcd__iterative__euclidean_8cpp.html#ae48807fa2b7000afae599e67f327545e">gcd</a>, &x, &y);</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> << <a class="code hl_function" href="../../d4/da0/gcd__iterative__euclidean_8cpp.html#ae48807fa2b7000afae599e67f327545e">gcd</a> << <span class="stringliteral">" "</span> << x << <span class="stringliteral">" "</span> << y << <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="keywordflow">return</span> 0;</div>
|
||||
<div class="line"><span class="lineno"> 97</span>}</div>
|
||||
<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="aextended__euclid__algorithm_8cpp_html_a1792ac7c33aaf26b860ab55f5652ab25"><div class="ttname"><a href="#a1792ac7c33aaf26b860ab55f5652ab25">extendedEuclid_1</a></div><div class="ttdeci">void extendedEuclid_1(T1 A, T1 B, T1 *GCD, T2 *x, T2 *y)</div><div class="ttdef"><b>Definition</b> extended_euclid_algorithm.cpp:41</div></div>
|
||||
<div class="ttc" id="aextended__euclid__algorithm_8cpp_html_a1792ac7c33aaf26b860ab55f5652ab25"><div class="ttname"><a href="#a1792ac7c33aaf26b860ab55f5652ab25">extendedEuclid_1</a></div><div class="ttdeci">void extendedEuclid_1(T1 A, T1 B, T1 *GCD, T2 *x, T2 *y)</div><div class="ttdef"><b>Definition</b> extended_euclid_algorithm.cpp:42</div></div>
|
||||
<div class="ttc" id="agcd__iterative__euclidean_8cpp_html_ae48807fa2b7000afae599e67f327545e"><div class="ttname"><a href="../../d4/da0/gcd__iterative__euclidean_8cpp.html#ae48807fa2b7000afae599e67f327545e">gcd</a></div><div class="ttdeci">int gcd(int num1, int num2)</div><div class="ttdef"><b>Definition</b> gcd_iterative_euclidean.cpp:15</div></div>
|
||||
</div><!-- fragment --><div class="dynheader">
|
||||
Here is the call graph for this function:</div>
|
||||
@@ -369,11 +370,11 @@ template<typename T , typename T2 > </div>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 24</span> {</div>
|
||||
<div class="line"><span class="lineno"> 25</span> T temp = *r;</div>
|
||||
<div class="line"><span class="lineno"> 26</span> *r = *r0 - (quotient * temp);</div>
|
||||
<div class="line"><span class="lineno"> 27</span> *r0 = temp;</div>
|
||||
<div class="line"><span class="lineno"> 28</span>}</div>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 25</span> {</div>
|
||||
<div class="line"><span class="lineno"> 26</span> T temp = *r;</div>
|
||||
<div class="line"><span class="lineno"> 27</span> *r = *r0 - (quotient * temp);</div>
|
||||
<div class="line"><span class="lineno"> 28</span> *r0 = temp;</div>
|
||||
<div class="line"><span class="lineno"> 29</span>}</div>
|
||||
</div><!-- fragment -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user