mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-03-24 22:02:20 +08:00
Documentation for c26eea874d
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.12.0"/>
|
||||
<meta name="generator" content="Doxygen 1.13.2"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>TheAlgorithms/C++: math/ncr_modulo_p.cpp File Reference</title>
|
||||
<link rel="icon" href="../../favicon.svg" type="image/x-icon" />
|
||||
@@ -60,7 +60,7 @@ window.MathJax = {
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.12.0 -->
|
||||
<!-- Generated by Doxygen 1.13.2 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "../../search/",'.html');
|
||||
@@ -269,14 +269,13 @@ Functions</h2></td></tr>
|
||||
<div class="line"><span class="lineno"> 50</span> }</div>
|
||||
<div class="line"><span class="lineno"> 51</span> </div>
|
||||
<div class="line"><span class="lineno"> 52</span> int64_t x1 = 0, y1 = 0;</div>
|
||||
<div class="line"><span class="lineno"> 53</span> <span class="keyword">const</span> int64_t <a class="code hl_function" href="../../d4/da0/gcd__iterative__euclidean_8cpp.html#ae48807fa2b7000afae599e67f327545e">gcd</a> = <a class="code hl_function" href="#a9010ad5669d31449c3bf3271ab5ebc86">gcdExtended</a>(b % a, a, x1, y1);</div>
|
||||
<div class="line"><span class="lineno"> 53</span> <span class="keyword">const</span> int64_t <a class="code hl_function" href="../../d4/da0/gcd__iterative__euclidean_8cpp.html#ae48807fa2b7000afae599e67f327545e">gcd</a> = gcdExtended(b % a, a, x1, y1);</div>
|
||||
<div class="line"><span class="lineno"> 54</span> </div>
|
||||
<div class="line"><span class="lineno"> 55</span> x = y1 - (b / a) * x1;</div>
|
||||
<div class="line"><span class="lineno"> 56</span> y = x1;</div>
|
||||
<div class="line"><span class="lineno"> 57</span> <span class="keywordflow">return</span> <a class="code hl_function" href="../../d4/da0/gcd__iterative__euclidean_8cpp.html#ae48807fa2b7000afae599e67f327545e">gcd</a>;</div>
|
||||
<div class="line"><span class="lineno"> 58</span>}</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> <a href="../../d4/da0/gcd__iterative__euclidean_8cpp_source.html#l00015">gcd_iterative_euclidean.cpp:15</a></div></div>
|
||||
<div class="ttc" id="ancr__modulo__p_8cpp_html_a9010ad5669d31449c3bf3271ab5ebc86"><div class="ttname"><a href="#a9010ad5669d31449c3bf3271ab5ebc86">math::ncr_modulo_p::utils::gcdExtended</a></div><div class="ttdeci">int64_t gcdExtended(const int64_t &a, const int64_t &b, int64_t &x, int64_t &y)</div><div class="ttdoc">finds the values x and y such that a*x + b*y = gcd(a,b)</div><div class="ttdef"><b>Definition</b> <a href="../../de/dab/ncr__modulo__p_8cpp_source.html#l00044">ncr_modulo_p.cpp:44</a></div></div>
|
||||
</div><!-- fragment -->
|
||||
</div>
|
||||
</div>
|
||||
@@ -337,14 +336,14 @@ Functions</h2></td></tr>
|
||||
<p class="definition">Definition at line <a class="el" href="../../de/dab/ncr__modulo__p_8cpp_source.html#l00066">66</a> of file <a class="el" href="../../de/dab/ncr__modulo__p_8cpp_source.html">ncr_modulo_p.cpp</a>.</p>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 66</span> {</div>
|
||||
<div class="line"><span class="lineno"> 67</span> int64_t x = 0, y = 0;</div>
|
||||
<div class="line"><span class="lineno"> 68</span> <span class="keyword">const</span> int64_t <a class="code hl_function" href="../../d4/d18/composite__simpson__rule_8cpp.html#a2f67508d5f392b0321772169342c98ad">g</a> = <a class="code hl_function" href="#a9010ad5669d31449c3bf3271ab5ebc86">gcdExtended</a>(a, m, x, y);</div>
|
||||
<div class="line"><span class="lineno"> 68</span> <span class="keyword">const</span> int64_t g = <a class="code hl_function" href="#a9010ad5669d31449c3bf3271ab5ebc86">gcdExtended</a>(a, m, x, y);</div>
|
||||
<div class="line"><span class="lineno"> 69</span> <span class="keywordflow">if</span> (g != 1) { <span class="comment">// modular inverse doesn't exist</span></div>
|
||||
<div class="line"><span class="lineno"> 70</span> <span class="keywordflow">return</span> -1;</div>
|
||||
<div class="line"><span class="lineno"> 71</span> } <span class="keywordflow">else</span> {</div>
|
||||
<div class="line"><span class="lineno"> 72</span> <span class="keywordflow">return</span> ((x + m) % m);</div>
|
||||
<div class="line"><span class="lineno"> 73</span> }</div>
|
||||
<div class="line"><span class="lineno"> 74</span>}</div>
|
||||
<div class="ttc" id="acomposite__simpson__rule_8cpp_html_a2f67508d5f392b0321772169342c98ad"><div class="ttname"><a href="../../d4/d18/composite__simpson__rule_8cpp.html#a2f67508d5f392b0321772169342c98ad">numerical_methods::simpson_method::g</a></div><div class="ttdeci">double g(double x)</div><div class="ttdoc">Another test function.</div><div class="ttdef"><b>Definition</b> <a href="../../d4/d18/composite__simpson__rule_8cpp_source.html#l00115">composite_simpson_rule.cpp:115</a></div></div>
|
||||
<div class="ttc" id="ancr__modulo__p_8cpp_html_a9010ad5669d31449c3bf3271ab5ebc86"><div class="ttname"><a href="#a9010ad5669d31449c3bf3271ab5ebc86">math::ncr_modulo_p::utils::gcdExtended</a></div><div class="ttdeci">int64_t gcdExtended(const int64_t &a, const int64_t &b, int64_t &x, int64_t &y)</div><div class="ttdoc">finds the values x and y such that a*x + b*y = gcd(a,b)</div><div class="ttdef"><b>Definition</b> <a href="../../de/dab/ncr__modulo__p_8cpp_source.html#l00044">ncr_modulo_p.cpp:44</a></div></div>
|
||||
</div><!-- fragment -->
|
||||
</div>
|
||||
</div>
|
||||
@@ -366,7 +365,7 @@ Functions</h2></td></tr>
|
||||
</table>
|
||||
</td>
|
||||
<td class="mlabels-right">
|
||||
<span class="mlabels"><span class="mlabel">static</span></span> </td>
|
||||
<span class="mlabels"><span class="mlabel static">static</span></span> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
@@ -382,7 +381,7 @@ Functions</h2></td></tr>
|
||||
<div class="line"><span class="lineno"> 147</span> <span class="keyword">const</span> int64_t r;</div>
|
||||
<div class="line"><span class="lineno"> 148</span> <span class="keyword">const</span> int64_t expected;</div>
|
||||
<div class="line"><span class="lineno"> 149</span> </div>
|
||||
<div class="line"><span class="lineno"> 150</span> <a class="code hl_struct" href="../../da/d86/struct_test_case.html">TestCase</a>(<span class="keyword">const</span> int64_t size, <span class="keyword">const</span> int64_t p, <span class="keyword">const</span> int64_t n,</div>
|
||||
<div class="line"><span class="lineno"> 150</span> TestCase(<span class="keyword">const</span> int64_t size, <span class="keyword">const</span> int64_t p, <span class="keyword">const</span> int64_t n,</div>
|
||||
<div class="line"><span class="lineno"> 151</span> <span class="keyword">const</span> int64_t r, <span class="keyword">const</span> int64_t expected)</div>
|
||||
<div class="line"><span class="lineno"> 152</span> : size(size), p(p), n(n), r(r), expected(expected) {}</div>
|
||||
<div class="line"><span class="lineno"> 153</span> };</div>
|
||||
@@ -414,7 +413,7 @@ Functions</h2></td></tr>
|
||||
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
||||
<ul>
|
||||
<li class="navelem"><a class="el" href="../../dir_296d53ceaeaa7e099814a6def439fe8a.html">math</a></li><li class="navelem"><a class="el" href="../../de/dab/ncr__modulo__p_8cpp.html">ncr_modulo_p.cpp</a></li>
|
||||
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="../../doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.12.0 </li>
|
||||
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="../../doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.13.2 </li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user