Update documentation

This commit is contained in:
Cory Balaton 2023-09-24 16:02:40 +02:00
parent 58c58a97af
commit 3b1c42cf2d
No known key found for this signature in database
GPG Key ID: 3E5FCEBFD80F432B
8 changed files with 69 additions and 28 deletions

View File

@ -157,7 +157,9 @@ Janita Ovidie Sandtrøen Willumsen (janitaws) </dd></dl>
</div><div class="memdoc"> </div><div class="memdoc">
<p>Solves the eigenvalue problem using the jacobi rotation method. </p> <p>Solves the eigenvalue problem using the jacobi rotation method. </p>
<p>Description</p> <p>jacobi_eigensolver Initializes matrices A_m and R before going into the main loop.</p>
<p>For each iteration of the loop, it finds the largest absolute off-diagonal value of A_m, and then calls jacobi_rotate. The loop stops when the largest off-diagonal is less than the tolerance (eps) or if the maximum number of iterations has been reached.</p>
<p>The last thing this function does is to sort the eigenvalues and the corresponding eigenvectors in ascending order.</p>
<dl class="params"><dt>Parameters</dt><dd> <dl class="params"><dt>Parameters</dt><dd>
<table class="params"> <table class="params">
<tr><td class="paramname">A</td><td>The initial matrix to be solved </td></tr> <tr><td class="paramname">A</td><td>The initial matrix to be solved </td></tr>
@ -213,7 +215,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws) </dd></dl>
</div><div class="memdoc"> </div><div class="memdoc">
<p>Computes a single rotation. </p> <p>Computes a single rotation. </p>
<p>Description</p> <p>jacobi_rotate computes a single rotation for Jacobi's rotation algorithm. It starts by calculating tau, t (tan), c (cos), s (sin) and then updates A and R at rows/columsn k and l.</p>
<dl class="params"><dt>Parameters</dt><dd> <dl class="params"><dt>Parameters</dt><dd>
<table class="params"> <table class="params">
<tr><td class="paramname">A</td><td>Matrix A<sup> (m) </sup> </td></tr> <tr><td class="paramname">A</td><td>Matrix A<sup> (m) </sup> </td></tr>

View File

@ -158,7 +158,9 @@ Janita Ovidie Sandtrøen Willumsen (janitaws) </dd></dl>
</div><div class="memdoc"> </div><div class="memdoc">
<p>Solves the eigenvalue problem using the jacobi rotation method. </p> <p>Solves the eigenvalue problem using the jacobi rotation method. </p>
<p>Description</p> <p>jacobi_eigensolver Initializes matrices A_m and R before going into the main loop.</p>
<p>For each iteration of the loop, it finds the largest absolute off-diagonal value of A_m, and then calls jacobi_rotate. The loop stops when the largest off-diagonal is less than the tolerance (eps) or if the maximum number of iterations has been reached.</p>
<p>The last thing this function does is to sort the eigenvalues and the corresponding eigenvectors in ascending order.</p>
<dl class="params"><dt>Parameters</dt><dd> <dl class="params"><dt>Parameters</dt><dd>
<table class="params"> <table class="params">
<tr><td class="paramname">A</td><td>The initial matrix to be solved </td></tr> <tr><td class="paramname">A</td><td>The initial matrix to be solved </td></tr>
@ -214,7 +216,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws) </dd></dl>
</div><div class="memdoc"> </div><div class="memdoc">
<p>Computes a single rotation. </p> <p>Computes a single rotation. </p>
<p>Description</p> <p>jacobi_rotate computes a single rotation for Jacobi's rotation algorithm. It starts by calculating tau, t (tan), c (cos), s (sin) and then updates A and R at rows/columsn k and l.</p>
<dl class="params"><dt>Parameters</dt><dd> <dl class="params"><dt>Parameters</dt><dd>
<table class="params"> <table class="params">
<tr><td class="paramname">A</td><td>Matrix A<sup> (m) </sup> </td></tr> <tr><td class="paramname">A</td><td>Matrix A<sup> (m) </sup> </td></tr>

View File

@ -82,17 +82,17 @@ $(function() {
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno"> 10</span> </div> <div class="line"><a id="l00010" name="l00010"></a><span class="lineno"> 10</span> </div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno"> 11</span><span class="preprocessor">#include &lt;armadillo&gt;</span></div> <div class="line"><a id="l00011" name="l00011"></a><span class="lineno"> 11</span><span class="preprocessor">#include &lt;armadillo&gt;</span></div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span> </div> <div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span> </div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span><span class="keywordtype">void</span> <a class="code hl_function" href="jacobi_8hpp.html#a49809414937a1491ff04ec3dc780982a">jacobi_rotate</a>(arma::mat&amp; A, arma::mat&amp; R, <span class="keywordtype">int</span> k, <span class="keywordtype">int</span> l);</div> <div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span><span class="keywordtype">void</span> <a class="code hl_function" href="jacobi_8hpp.html#a49809414937a1491ff04ec3dc780982a">jacobi_rotate</a>(arma::mat&amp; A, arma::mat&amp; R, <span class="keywordtype">int</span> k, <span class="keywordtype">int</span> l);</div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> </div> <div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> </div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span><span class="keywordtype">void</span> <a class="code hl_function" href="jacobi_8hpp.html#a5a8da00df38bec1046249e8589a8aad0">jacobi_eigensolver</a>(<span class="keyword">const</span> arma::mat&amp; A, </div> <div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span><span class="keywordtype">void</span> <a class="code hl_function" href="jacobi_8hpp.html#a5a8da00df38bec1046249e8589a8aad0">jacobi_eigensolver</a>(<span class="keyword">const</span> arma::mat&amp; A, </div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span> <span class="keywordtype">double</span> eps, </div> <div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> <span class="keywordtype">double</span> eps, </div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> arma::vec&amp; eigenvalues, </div> <div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> arma::vec&amp; eigenvalues, </div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> arma::mat&amp; eigenvectors, </div> <div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> arma::mat&amp; eigenvectors, </div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> <span class="keyword">const</span> <span class="keywordtype">int</span> maxiter, </div> <div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span> <span class="keyword">const</span> <span class="keywordtype">int</span> maxiter, </div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span> <span class="keywordtype">int</span>&amp; iterations, </div> <div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> <span class="keywordtype">int</span>&amp; iterations, </div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span> <span class="keywordtype">bool</span>&amp; converged);</div> <div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> <span class="keywordtype">bool</span>&amp; converged);</div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span> </div> <div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span> </div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span><span class="preprocessor">#endif</span></div> <div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span><span class="preprocessor">#endif</span></div>
<div class="ttc" id="ajacobi_8hpp_html_a49809414937a1491ff04ec3dc780982a"><div class="ttname"><a href="jacobi_8hpp.html#a49809414937a1491ff04ec3dc780982a">jacobi_rotate</a></div><div class="ttdeci">void jacobi_rotate(arma::mat &amp;A, arma::mat &amp;R, int k, int l)</div><div class="ttdoc">Computes a single rotation.</div><div class="ttdef"><b>Definition:</b> jacobi.cpp:17</div></div> <div class="ttc" id="ajacobi_8hpp_html_a49809414937a1491ff04ec3dc780982a"><div class="ttname"><a href="jacobi_8hpp.html#a49809414937a1491ff04ec3dc780982a">jacobi_rotate</a></div><div class="ttdeci">void jacobi_rotate(arma::mat &amp;A, arma::mat &amp;R, int k, int l)</div><div class="ttdoc">Computes a single rotation.</div><div class="ttdef"><b>Definition:</b> jacobi.cpp:17</div></div>
<div class="ttc" id="ajacobi_8hpp_html_a5a8da00df38bec1046249e8589a8aad0"><div class="ttname"><a href="jacobi_8hpp.html#a5a8da00df38bec1046249e8589a8aad0">jacobi_eigensolver</a></div><div class="ttdeci">void jacobi_eigensolver(const arma::mat &amp;A, double eps, arma::vec &amp;eigenvalues, arma::mat &amp;eigenvectors, const int maxiter, int &amp;iterations, bool &amp;converged)</div><div class="ttdoc">Solves the eigenvalue problem using the jacobi rotation method.</div><div class="ttdef"><b>Definition:</b> jacobi.cpp:56</div></div> <div class="ttc" id="ajacobi_8hpp_html_a5a8da00df38bec1046249e8589a8aad0"><div class="ttname"><a href="jacobi_8hpp.html#a5a8da00df38bec1046249e8589a8aad0">jacobi_eigensolver</a></div><div class="ttdeci">void jacobi_eigensolver(const arma::mat &amp;A, double eps, arma::vec &amp;eigenvalues, arma::mat &amp;eigenvectors, const int maxiter, int &amp;iterations, bool &amp;converged)</div><div class="ttdoc">Solves the eigenvalue problem using the jacobi rotation method.</div><div class="ttdef"><b>Definition:</b> jacobi.cpp:56</div></div>
</div><!-- fragment --></div><!-- contents --> </div><!-- fragment --></div><!-- contents -->

View File

@ -134,6 +134,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws) </dd></dl>
</div><div class="memdoc"> </div><div class="memdoc">
<p>Create a symmetric tridiagonal matrix. </p> <p>Create a symmetric tridiagonal matrix. </p>
<p>create_symmetric_tridiagonal creates a symmetric tridiagonal matrix by calling create_tridiagonal with the same signature for the off-diagonals.</p>
<dl class="params"><dt>Parameters</dt><dd> <dl class="params"><dt>Parameters</dt><dd>
<table class="params"> <table class="params">
<tr><td class="paramname">n</td><td>The dimensions of the tridiagonal matrix </td></tr> <tr><td class="paramname">n</td><td>The dimensions of the tridiagonal matrix </td></tr>
@ -179,6 +180,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws) </dd></dl>
</div><div class="memdoc"> </div><div class="memdoc">
<p>Create a tridiagonal matrix. </p> <p>Create a tridiagonal matrix. </p>
<p>create_tridiagonal creates a tridiagonal matrix by first creating a matrix, filled with zeros, of size NxN where N is the size of the main diagonal matrix. Then it will fill all the values from the vector parameters into the matrix and return it.</p>
<dl class="params"><dt>Parameters</dt><dd> <dl class="params"><dt>Parameters</dt><dd>
<table class="params"> <table class="params">
<tr><td class="paramname">a</td><td>Vector for the lower diagonal of size N-1 </td></tr> <tr><td class="paramname">a</td><td>Vector for the lower diagonal of size N-1 </td></tr>
@ -230,6 +232,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws) </dd></dl>
</div><div class="memdoc"> </div><div class="memdoc">
<p>Create a tridiagonal matrix. </p> <p>Create a tridiagonal matrix. </p>
<p>This is an overload that takes doubles for the diagonals instead of vectors. It will create 3 vectors that are filled with the signature provided in the arguments, and then call create_tridiagonal with the vectors as the arguments.</p>
<dl class="params"><dt>Parameters</dt><dd> <dl class="params"><dt>Parameters</dt><dd>
<table class="params"> <table class="params">
<tr><td class="paramname">n</td><td>The dimensions of the tridiagonal matrix </td></tr> <tr><td class="paramname">n</td><td>The dimensions of the tridiagonal matrix </td></tr>
@ -276,6 +279,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws) </dd></dl>
</div><div class="memdoc"> </div><div class="memdoc">
<p>Find the off-diagonal element with the largest absolute value. </p> <p>Find the off-diagonal element with the largest absolute value. </p>
<p>max_offdiag_symmetric find the element with the largest absolute value that isn't in the diagonal. Since this function assumes that the matrix that is given is symmetrical, we only need to loop through the upper diagonals of the matrix.</p>
<dl class="params"><dt>Parameters</dt><dd> <dl class="params"><dt>Parameters</dt><dd>
<table class="params"> <table class="params">
<tr><td class="paramname">A</td><td>Symmetric matrix </td></tr> <tr><td class="paramname">A</td><td>Symmetric matrix </td></tr>

View File

@ -140,6 +140,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws) </dd></dl>
</div><div class="memdoc"> </div><div class="memdoc">
<p>Create a symmetric tridiagonal matrix. </p> <p>Create a symmetric tridiagonal matrix. </p>
<p>create_symmetric_tridiagonal creates a symmetric tridiagonal matrix by calling create_tridiagonal with the same signature for the off-diagonals.</p>
<dl class="params"><dt>Parameters</dt><dd> <dl class="params"><dt>Parameters</dt><dd>
<table class="params"> <table class="params">
<tr><td class="paramname">n</td><td>The dimensions of the tridiagonal matrix </td></tr> <tr><td class="paramname">n</td><td>The dimensions of the tridiagonal matrix </td></tr>
@ -185,6 +186,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws) </dd></dl>
</div><div class="memdoc"> </div><div class="memdoc">
<p>Create a tridiagonal matrix. </p> <p>Create a tridiagonal matrix. </p>
<p>create_tridiagonal creates a tridiagonal matrix by first creating a matrix, filled with zeros, of size NxN where N is the size of the main diagonal matrix. Then it will fill all the values from the vector parameters into the matrix and return it.</p>
<dl class="params"><dt>Parameters</dt><dd> <dl class="params"><dt>Parameters</dt><dd>
<table class="params"> <table class="params">
<tr><td class="paramname">a</td><td>Vector for the lower diagonal of size N-1 </td></tr> <tr><td class="paramname">a</td><td>Vector for the lower diagonal of size N-1 </td></tr>
@ -236,6 +238,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws) </dd></dl>
</div><div class="memdoc"> </div><div class="memdoc">
<p>Create a tridiagonal matrix. </p> <p>Create a tridiagonal matrix. </p>
<p>This is an overload that takes doubles for the diagonals instead of vectors. It will create 3 vectors that are filled with the signature provided in the arguments, and then call create_tridiagonal with the vectors as the arguments.</p>
<dl class="params"><dt>Parameters</dt><dd> <dl class="params"><dt>Parameters</dt><dd>
<table class="params"> <table class="params">
<tr><td class="paramname">n</td><td>The dimensions of the tridiagonal matrix </td></tr> <tr><td class="paramname">n</td><td>The dimensions of the tridiagonal matrix </td></tr>
@ -282,6 +285,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws) </dd></dl>
</div><div class="memdoc"> </div><div class="memdoc">
<p>Find the off-diagonal element with the largest absolute value. </p> <p>Find the off-diagonal element with the largest absolute value. </p>
<p>max_offdiag_symmetric find the element with the largest absolute value that isn't in the diagonal. Since this function assumes that the matrix that is given is symmetrical, we only need to loop through the upper diagonals of the matrix.</p>
<dl class="params"><dt>Parameters</dt><dd> <dl class="params"><dt>Parameters</dt><dd>
<table class="params"> <table class="params">
<tr><td class="paramname">A</td><td>Symmetric matrix </td></tr> <tr><td class="paramname">A</td><td>Symmetric matrix </td></tr>

View File

@ -82,18 +82,18 @@ $(function() {
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span> </div> <div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span> </div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span><span class="preprocessor">#include &lt;armadillo&gt;</span></div> <div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span><span class="preprocessor">#include &lt;armadillo&gt;</span></div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span> </div> <div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span> </div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span>arma::mat <a class="code hl_function" href="matrix_8hpp.html#aa524feaf9f44790470df4cb99bb714af">create_tridiagonal</a>(</div> <div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span>arma::mat <a class="code hl_function" href="matrix_8hpp.html#aa524feaf9f44790470df4cb99bb714af">create_tridiagonal</a>(</div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> <span class="keyword">const</span> arma::vec&amp; a, </div> <div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span> <span class="keyword">const</span> arma::vec&amp; a, </div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> <span class="keyword">const</span> arma::vec&amp; d, </div> <div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span> <span class="keyword">const</span> arma::vec&amp; d, </div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span> <span class="keyword">const</span> arma::vec&amp; e);</div> <div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> <span class="keyword">const</span> arma::vec&amp; e);</div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> </div> <div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span> </div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span>arma::mat <a class="code hl_function" href="matrix_8hpp.html#aa524feaf9f44790470df4cb99bb714af">create_tridiagonal</a>(<span class="keywordtype">int</span> n, <span class="keywordtype">double</span> a, <span class="keywordtype">double</span> d, <span class="keywordtype">double</span> e);</div> <div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span>arma::mat <a class="code hl_function" href="matrix_8hpp.html#aa524feaf9f44790470df4cb99bb714af">create_tridiagonal</a>(<span class="keywordtype">int</span> n, <span class="keywordtype">double</span> a, <span class="keywordtype">double</span> d, <span class="keywordtype">double</span> e);</div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> </div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span>arma::mat <a class="code hl_function" href="matrix_8hpp.html#a564688c96a8e4282e995a0663545d627">create_symmetric_tridiagonal</a>(<span class="keywordtype">int</span> n, <span class="keywordtype">double</span> a, <span class="keywordtype">double</span> d);</div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> </div> <div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> </div>
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span><span class="keywordtype">double</span> <a class="code hl_function" href="matrix_8hpp.html#af42e501cbf71bec9c77ececc22723df9">max_offdiag_symmetric</a>(arma::mat&amp; A, <span class="keywordtype">int</span>&amp; k, <span class="keywordtype">int</span>&amp; l);</div> <div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span>arma::mat <a class="code hl_function" href="matrix_8hpp.html#a564688c96a8e4282e995a0663545d627">create_symmetric_tridiagonal</a>(<span class="keywordtype">int</span> n, <span class="keywordtype">double</span> a, <span class="keywordtype">double</span> d);</div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span> </div> <div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> </div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span><span class="preprocessor">#endif</span></div> <div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span><span class="keywordtype">double</span> <a class="code hl_function" href="matrix_8hpp.html#af42e501cbf71bec9c77ececc22723df9">max_offdiag_symmetric</a>(arma::mat&amp; A, <span class="keywordtype">int</span>&amp; k, <span class="keywordtype">int</span>&amp; l);</div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> </div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span><span class="preprocessor">#endif</span></div>
<div class="ttc" id="amatrix_8hpp_html_a564688c96a8e4282e995a0663545d627"><div class="ttname"><a href="matrix_8hpp.html#a564688c96a8e4282e995a0663545d627">create_symmetric_tridiagonal</a></div><div class="ttdeci">arma::mat create_symmetric_tridiagonal(int n, double a, double d)</div><div class="ttdoc">Create a symmetric tridiagonal matrix.</div><div class="ttdef"><b>Definition:</b> matrix.cpp:44</div></div> <div class="ttc" id="amatrix_8hpp_html_a564688c96a8e4282e995a0663545d627"><div class="ttname"><a href="matrix_8hpp.html#a564688c96a8e4282e995a0663545d627">create_symmetric_tridiagonal</a></div><div class="ttdeci">arma::mat create_symmetric_tridiagonal(int n, double a, double d)</div><div class="ttdoc">Create a symmetric tridiagonal matrix.</div><div class="ttdef"><b>Definition:</b> matrix.cpp:44</div></div>
<div class="ttc" id="amatrix_8hpp_html_aa524feaf9f44790470df4cb99bb714af"><div class="ttname"><a href="matrix_8hpp.html#aa524feaf9f44790470df4cb99bb714af">create_tridiagonal</a></div><div class="ttdeci">arma::mat create_tridiagonal(const arma::vec &amp;a, const arma::vec &amp;d, const arma::vec &amp;e)</div><div class="ttdoc">Create a tridiagonal matrix.</div><div class="ttdef"><b>Definition:</b> matrix.cpp:12</div></div> <div class="ttc" id="amatrix_8hpp_html_aa524feaf9f44790470df4cb99bb714af"><div class="ttname"><a href="matrix_8hpp.html#aa524feaf9f44790470df4cb99bb714af">create_tridiagonal</a></div><div class="ttdeci">arma::mat create_tridiagonal(const arma::vec &amp;a, const arma::vec &amp;d, const arma::vec &amp;e)</div><div class="ttdoc">Create a tridiagonal matrix.</div><div class="ttdef"><b>Definition:</b> matrix.cpp:12</div></div>
<div class="ttc" id="amatrix_8hpp_html_af42e501cbf71bec9c77ececc22723df9"><div class="ttname"><a href="matrix_8hpp.html#af42e501cbf71bec9c77ececc22723df9">max_offdiag_symmetric</a></div><div class="ttdeci">double max_offdiag_symmetric(arma::mat &amp;A, int &amp;k, int &amp;l)</div><div class="ttdoc">Find the off-diagonal element with the largest absolute value.</div><div class="ttdef"><b>Definition:</b> matrix.cpp:49</div></div> <div class="ttc" id="amatrix_8hpp_html_af42e501cbf71bec9c77ececc22723df9"><div class="ttname"><a href="matrix_8hpp.html#af42e501cbf71bec9c77ececc22723df9">max_offdiag_symmetric</a></div><div class="ttdeci">double max_offdiag_symmetric(arma::mat &amp;A, int &amp;k, int &amp;l)</div><div class="ttdoc">Find the off-diagonal element with the largest absolute value.</div><div class="ttdef"><b>Definition:</b> matrix.cpp:49</div></div>

View File

@ -12,7 +12,9 @@
/** @brief Computes a single rotation. /** @brief Computes a single rotation.
* *
* Description * jacobi_rotate computes a single rotation for Jacobi's rotation algorithm.
* It starts by calculating tau, t (tan), c (cos), s (sin) and then
* updates A and R at rows/columsn k and l.
* *
* @param A Matrix A<sup> (m) </sup> * @param A Matrix A<sup> (m) </sup>
* @param R The rotation matrix R<sup> (m) </sup> * @param R The rotation matrix R<sup> (m) </sup>
@ -25,7 +27,16 @@ void jacobi_rotate(arma::mat& A, arma::mat& R, int k, int l);
/** @brief Solves the eigenvalue problem using the jacobi rotation method. /** @brief Solves the eigenvalue problem using the jacobi rotation method.
* *
* Description * jacobi_eigensolver Initializes matrices A_m and R before going into the
* main loop.
*
* For each iteration of the loop, it finds the largest absolute off-diagonal
* value of A_m, and then calls jacobi_rotate. The loop stops when the largest
* off-diagonal is less than the tolerance (eps) or if the maximum number of
* iterations has been reached.
*
* The last thing this function does is to sort the eigenvalues and the
* corresponding eigenvectors in ascending order.
* *
* @param A The initial matrix to be solved * @param A The initial matrix to be solved
* @param eps Tolerance * @param eps Tolerance

View File

@ -13,6 +13,11 @@
#include <armadillo> #include <armadillo>
/** @brief Create a tridiagonal matrix. /** @brief Create a tridiagonal matrix.
*
* create_tridiagonal creates a tridiagonal matrix by first creating a matrix,
* filled with zeros, of size NxN where N is the size of the main diagonal
* matrix. Then it will fill all the values from the vector parameters into
* the matrix and return it.
* *
* @param a Vector for the lower diagonal of size N-1 * @param a Vector for the lower diagonal of size N-1
* @param d Vector for the main diagonal of size N * @param d Vector for the main diagonal of size N
@ -26,6 +31,11 @@ arma::mat create_tridiagonal(
const arma::vec& e); const arma::vec& e);
/** @brief Create a tridiagonal matrix. /** @brief Create a tridiagonal matrix.
*
* This is an overload that takes doubles for the diagonals instead of
* vectors. It will create 3 vectors that are filled with the signature
* provided in the arguments, and then call create_tridiagonal with the
* vectors as the arguments.
* *
* @param n The dimensions of the tridiagonal matrix * @param n The dimensions of the tridiagonal matrix
* @param a The signature for the lower diagonal * @param a The signature for the lower diagonal
@ -37,6 +47,9 @@ arma::mat create_tridiagonal(
arma::mat create_tridiagonal(int n, double a, double d, double e); arma::mat create_tridiagonal(int n, double a, double d, double e);
/** @brief Create a symmetric tridiagonal matrix. /** @brief Create a symmetric tridiagonal matrix.
*
* create_symmetric_tridiagonal creates a symmetric tridiagonal matrix by
* calling create_tridiagonal with the same signature for the off-diagonals.
* *
* @param n The dimensions of the tridiagonal matrix * @param n The dimensions of the tridiagonal matrix
* @param a The signature for the off diagonals * @param a The signature for the off diagonals
@ -47,6 +60,11 @@ arma::mat create_tridiagonal(int n, double a, double d, double e);
arma::mat create_symmetric_tridiagonal(int n, double a, double d); arma::mat create_symmetric_tridiagonal(int n, double a, double d);
/** @brief Find the off-diagonal element with the largest absolute value. /** @brief Find the off-diagonal element with the largest absolute value.
*
* max_offdiag_symmetric find the element with the largest absolute value
* that isn't in the diagonal. Since this function assumes that the matrix
* that is given is symmetrical, we only need to loop through the upper
* diagonals of the matrix.
* *
* @param A Symmetric matrix * @param A Symmetric matrix
* @param k Variable to store the row of the return value * @param k Variable to store the row of the return value