Documentation for 0931d530ae

This commit is contained in:
github-actions
2023-01-22 19:44:10 +00:00
parent a448f64699
commit b48f6e8671
2457 changed files with 9513 additions and 8691 deletions

View File

@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.5"/>
<meta name="generator" content="Doxygen 1.9.6"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Algorithms_in_C++: others/matrix_exponentiation.cpp File Reference</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
@@ -41,7 +41,7 @@ MathJax.Hub.Config({
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.5 -->
<!-- Generated by Doxygen 1.9.6 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "../../search/",'.html');
@@ -150,8 +150,8 @@ Variables</h2></td></tr>
<tr class="separator:a0cbd1162483ef7eccd5b947b2e01b1ab"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p >Matrix Exponentiation. </p>
<p >The problem can be solved with DP but constraints are high. <br />
<div class="textblock"><p>Matrix Exponentiation. </p>
<p>The problem can be solved with DP but constraints are high. <br />
\(a_i = b_i\) (for \(i &lt;= k\)) <br />
\(a_i = c_1 a_{i-1} + c_2 a_{i-2} + ... + c_k a_{i-k}\) (for \(i &gt; k\)) <br />
Taking the example of Fibonacci series, \(k=2\) <br />
@@ -159,13 +159,13 @@ Taking the example of Fibonacci series, \(k=2\) <br />
\(c_1 = 1,\; c_2=1\) <br />
\(a = \begin{bmatrix}0&amp; 1&amp; 1&amp; 2&amp; \ldots\end{bmatrix}\) <br />
This way you can find the \(10^{18}\) fibonacci numberMOD. I have given a general way to use it. The program takes the input of B and C matrix.</p>
<p >Steps for Matrix Expo</p><ol type="1">
<p>Steps for Matrix Expo</p><ol type="1">
<li>Create vector F1 : which is the copy of B.</li>
<li>Create transpose matrix (Learn more about it on the internet)</li>
<li>Perform \(T^{n-1}\) [transpose matrix to the power n-1]</li>
<li>Multiply with F to get the last matrix of size (1 \(\times\)k).</li>
</ol>
<p >The first element of this matrix is the required result. </p>
<p>The first element of this matrix is the required result. </p>
</div><h2 class="groupheader">Macro Definition Documentation</h2>
<a id="a600eaf353befc174637855795f12d258" name="a600eaf353befc174637855795f12d258"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a600eaf353befc174637855795f12d258">&#9670;&#160;</a></span>endl</h2>
@@ -178,7 +178,7 @@ This way you can find the \(10^{18}\) fibonacci numberMOD. I have given a genera
</tr>
</table>
</div><div class="memdoc">
<p >shorthand definition for <code><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a></code> </p>
<p>shorthand definition for <code><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a></code> </p>
</div>
</div>
@@ -193,7 +193,7 @@ This way you can find the \(10^{18}\) fibonacci numberMOD. I have given a genera
</tr>
</table>
</div><div class="memdoc">
<p >shorthand definition for <code>int64_t</code> </p>
<p>shorthand definition for <code>int64_t</code> </p>
</div>
</div>
@@ -208,7 +208,7 @@ This way you can find the \(10^{18}\) fibonacci numberMOD. I have given a genera
</tr>
</table>
</div><div class="memdoc">
<p >shorthand definition for <code>int64_t</code> </p>
<p>shorthand definition for <code>int64_t</code> </p>
</div>
</div>
@@ -228,7 +228,7 @@ This way you can find the \(10^{18}\) fibonacci numberMOD. I have given a genera
</tr>
</table>
</div><div class="memdoc">
<p >Wrapper for Fibonacci </p><dl class="params"><dt>Parameters</dt><dd>
<p>Wrapper for Fibonacci </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">n</td><td>\(n^\text{th}\) Fibonacci number </td></tr>
</table>
@@ -296,7 +296,7 @@ Here is the call graph for this function:</div>
</tr>
</table>
</div><div class="memdoc">
<p >Main function </p>
<p>Main function </p>
<div class="fragment"><div class="line"><span class="lineno"> 126</span> {</div>
<div class="line"><span class="lineno"> 127</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_istream.html">cin</a>.tie(0);</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">cout</a>.tie(0);</div>
@@ -351,7 +351,7 @@ Here is the call graph for this function:</div>
</tr>
</table>
</div><div class="memdoc">
<p >To multiply 2 matrices </p><dl class="params"><dt>Parameters</dt><dd>
<p>To multiply 2 matrices </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">A</td><td>matrix 1 of size (m \(\times\)n) </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">B</td><td><code>matrix</code> 2 of size (p \(\times\)q)<br />
@@ -400,7 +400,7 @@ Here is the call graph for this function:</div>
</tr>
</table>
</div><div class="memdoc">
<p >computing integer power of a matrix using recursive multiplication. </p><dl class="section note"><dt>Note</dt><dd>A must be a square matrix for this algorithm. </dd></dl>
<p>computing integer power of a matrix using recursive multiplication. </p><dl class="section note"><dt>Note</dt><dd>A must be a square matrix for this algorithm. </dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">A</td><td>base matrix </td></tr>
@@ -441,7 +441,7 @@ Here is the call graph for this function:</div>
</tr>
</table>
</div><div class="memdoc">
<p >global vector variables used in the <a class="el" href="../../d7/d35/matrix__exponentiation_8cpp.html#ad8389ed58fd0ec66df248014775ad1fa">ans</a> function. </p><dl class="todo"><dt><b><a class="el" href="../../dd/da0/todo.html#_todo000008">Todo:</a></b></dt><dd>@stepfencurryxiao add documetnation </dd></dl>
<p>global vector variables used in the <a class="el" href="../../d7/d35/matrix__exponentiation_8cpp.html#ad8389ed58fd0ec66df248014775ad1fa">ans</a> function. </p><dl class="todo"><dt><b><a class="el" href="../../dd/da0/todo.html#_todo000008">Todo:</a></b></dt><dd>@stepfencurryxiao add documetnation </dd></dl>
</div>
</div>
@@ -456,7 +456,7 @@ Here is the call graph for this function:</div>
</tr>
</table>
</div><div class="memdoc">
<p >global variable mat_size </p><dl class="todo"><dt><b><a class="el" href="../../dd/da0/todo.html#_todo000007">Todo:</a></b></dt><dd>@stepfencurryxiao add documetnation </dd></dl>
<p>global variable mat_size </p><dl class="todo"><dt><b><a class="el" href="../../dd/da0/todo.html#_todo000007">Todo:</a></b></dt><dd>@stepfencurryxiao add documetnation </dd></dl>
</div>
</div>
@@ -466,7 +466,7 @@ Here is the call graph for this function:</div>
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="../../dir_9510827d0b234b3cc54b29892f217477.html">others</a></li><li class="navelem"><a class="el" href="../../d7/d35/matrix__exponentiation_8cpp.html">matrix_exponentiation.cpp</a></li>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="../../doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.5 </li>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="../../doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.6 </li>
</ul>
</div>
</body>