Compare commits

...

32 Commits

Author SHA1 Message Date
0085ffc437
Update paper 2023-09-25 14:21:09 +02:00
8d7c20f919
Change n=6 to n=10 2023-09-25 14:19:58 +02:00
Janita Willumsen
d6e0090fb8 Add instruction to remove compiled files 2023-09-25 13:39:30 +02:00
Janita Willumsen
11cd6aa27e Remove initial compile instruction and use script typesetting when referring to directories inline 2023-09-25 13:34:01 +02:00
Janita Willumsen
16bcbc3ecc Clean up code 2023-09-25 13:16:27 +02:00
Janita Willumsen
6f5b947239 Finish project 2023-09-25 13:15:43 +02:00
Janita Willumsen
7a6f93f9ba Finish problem 5 and 6 with plot 2023-09-25 13:14:33 +02:00
Janita Willumsen
b4ab7e9f53 Fix grammar 2023-09-25 13:13:53 +02:00
Janita Willumsen
4c87a53780 Include analytic vector files 2023-09-25 13:11:52 +02:00
Janita Willumsen
6fcb081016 Include analytic vector in plot 2023-09-25 13:11:29 +02:00
Janita Willumsen
2fde592256 Include analytic vector in plot 2023-09-25 13:11:04 +02:00
Janita Willumsen
4f2a49a0ff Build analytic vector to include in plot 2023-09-25 13:10:34 +02:00
3b1c42cf2d
Update documentation 2023-09-24 16:02:40 +02:00
58c58a97af
Create Makefiles for easier compilation 2023-09-24 15:39:37 +02:00
f186b52548
Add things 2023-09-24 15:39:17 +02:00
ea38b19fc9
Update docs 2023-09-24 15:38:17 +02:00
bd1b1195b2
Merge branch 'main' into coryab/create-code-structure 2023-09-24 14:47:31 +02:00
139cd1961e
Add changes 2023-09-24 14:46:41 +02:00
81f1b9b567
Make small change 2023-09-24 14:43:34 +02:00
37b8aa5709
Merge branch 'coryab/create-code-structure' of github.uio.no:FYS3150-G2-2023/Project-2 into coryab/create-code-structure 2023-09-24 14:42:07 +02:00
dfb14b5c4a
Create better Makefile 2023-09-24 14:40:59 +02:00
87474d6e6d Merge pull request #10 from FYS3150-G2-2023/janitaws/check-eigen-bug
Finish problem 5 and 6
2023-09-23 16:32:26 +02:00
Janita Willumsen
97997b9f1d Update plots 2023-09-23 16:23:28 +02:00
Janita Willumsen
3c9a84598d Use f-strings 2023-09-23 16:22:56 +02:00
Janita Willumsen
97e6b35112 Added comments and renamed functions 2023-09-23 16:21:51 +02:00
Janita Willumsen
0a2ca3c0cf Add data generated and used for plotting 2023-09-23 15:16:47 +02:00
Janita Willumsen
4db545527a Add plots of transformations and eigenvectors 2023-09-23 15:15:57 +02:00
Janita Willumsen
e979c3955e Add comment on how main is linked 2023-09-23 15:14:57 +02:00
Janita Willumsen
2b103b9e3a Add program for plotting problem 5 and 6 2023-09-23 15:14:15 +02:00
Janita Willumsen
24f9f88af5 Finish problem 5 and 6 2023-09-23 15:13:24 +02:00
Janita Willumsen
a9d2c9dfb7 Merge branch 'coryab/create-code-structure' into janitaws/check-eigen-bug
Add new implementations in jacobi
2023-09-22 08:42:08 +02:00
Janita Willumsen
f85e41460b Start implementing plot functionality 2023-09-22 08:38:30 +02:00
41 changed files with 936 additions and 95 deletions

12
Makefile Normal file
View File

@ -0,0 +1,12 @@
MAKE=make
.PHONY: code latex docs
code:
$(MAKE) -C src
latex:
$(MAKE) -C latex
docs:
$(MAKE) -C src doxygen

View File

@ -4,27 +4,68 @@
- [Project](https://anderkve.github.io/FYS3150/book/projects/project2.html)
## Compile and run
## Compile and run C++ programs
Compiling and linking is done using Make, make sure you are in the root folder. To create executable files, run shell commands
Compiling and linking is done using Make, make sure you are in the root directory.
There are two alternative ways to compile the code. The first alternative is to change
directory to `src/` and compile
```shell
cd src/
make
cd src && make
```
To run `script-name`
The second alternative does not involve changing directory to `src/`, use
make in the projects root directory
```shell
make code
```
You can run any of the compiled programs by changing directory to `src/`, then
```shell
./test_suite
./main
```
Remove object files and executables from `src/`
```shell
make clean
```
## Generate plots
To generate plots, the Python scripts is run using
To generate plots, you can do
```shell
python3 <script-name>
python3 plot.py
```
The plots will be saved inside [latex/images](../blob/main/latex/images).
and the plots will be saved inside [latex/images](latex/images).
## Generate documentation
For this project, we have used Doxygen to generate some nice and readable
documentation for the C++ code.
If you want to generate the documentation you can do
```shell
make docs
```
in the project root, and the documentation will be made into the `docs/`
directory.
## Generate project document
If you want to recompile the Pdf file, you can do
```shell
make latex
```
and a Pdf file will be produced inside the `latex/` directory.

View File

@ -76,17 +76,19 @@ $(function() {
<dt>File <a class="el" href="jacobi_8cpp.html">jacobi.cpp</a> </dt>
<dd><a class="anchor" id="_bug000001"></a>The eigenvalues fail the test. When comparing them to arma::eigsym there is one value that is way off when testing with a 6x6 matrix. </dd>
<dt>File <a class="el" href="jacobi_8hpp.html">jacobi.hpp</a> </dt>
<dd><a class="anchor" id="_bug000005"></a>No known bugs </dd>
<dt>File <a class="el" href="matrix_8cpp.html">matrix.cpp</a> </dt>
<dd><a class="anchor" id="_bug000002"></a>No known bugs </dd>
<dt>File <a class="el" href="matrix_8hpp.html">matrix.hpp</a> </dt>
<dd><a class="anchor" id="_bug000006"></a>No known bugs </dd>
<dt>File <a class="el" href="test__suite_8cpp.html">test_suite.cpp</a> </dt>
<dt>File <a class="el" href="main_8cpp.html">main.cpp</a> </dt>
<dd><a class="anchor" id="_bug000002"></a>No known bugs </dd>
<dt>File <a class="el" href="matrix_8cpp.html">matrix.cpp</a> </dt>
<dd><a class="anchor" id="_bug000003"></a>No known bugs </dd>
<dt>File <a class="el" href="utils_8cpp.html">utils.cpp</a> </dt>
<dd><a class="anchor" id="_bug000004"></a>No known bugs </dd>
<dt>File <a class="el" href="utils_8hpp.html">utils.hpp</a> </dt>
<dt>File <a class="el" href="matrix_8hpp.html">matrix.hpp</a> </dt>
<dd><a class="anchor" id="_bug000007"></a>No known bugs </dd>
<dt>File <a class="el" href="test__suite_8cpp.html">test_suite.cpp</a> </dt>
<dd><a class="anchor" id="_bug000004"></a>No known bugs </dd>
<dt>File <a class="el" href="utils_8cpp.html">utils.cpp</a> </dt>
<dd><a class="anchor" id="_bug000005"></a>No known bugs </dd>
<dt>File <a class="el" href="utils_8hpp.html">utils.hpp</a> </dt>
<dd><a class="anchor" id="_bug000008"></a>No known bugs </dd>
</dl>
</div></div><!-- contents -->
</div><!-- PageDoc -->

View File

@ -79,9 +79,10 @@ $(function() {
<tr id="row_0_1_" class="even"><td class="entry"><span style="width:32px;display:inline-block;">&#160;</span><a href="matrix_8hpp_source.html"><span class="icondoc"></span></a><a class="el" href="matrix_8hpp.html" target="_self">matrix.hpp</a></td><td class="desc">Function prototypes for creating tridiagonal matrices </td></tr>
<tr id="row_0_2_" class="odd"><td class="entry"><span style="width:32px;display:inline-block;">&#160;</span><a href="utils_8hpp_source.html"><span class="icondoc"></span></a><a class="el" href="utils_8hpp.html" target="_self">utils.hpp</a></td><td class="desc">Function prototypes and macros that are useful </td></tr>
<tr id="row_1_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icondoc"></span><a class="el" href="jacobi_8cpp.html" target="_self">jacobi.cpp</a></td><td class="desc">Implementation of the jacobi rotation method </td></tr>
<tr id="row_2_" class="odd"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icondoc"></span><a class="el" href="matrix_8cpp.html" target="_self">matrix.cpp</a></td><td class="desc">Function prototypes for creating tridiagonal matrices </td></tr>
<tr id="row_3_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icondoc"></span><a class="el" href="test__suite_8cpp.html" target="_self">test_suite.cpp</a></td><td class="desc">Test suite for project 2 </td></tr>
<tr id="row_4_" class="odd"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icondoc"></span><a class="el" href="utils_8cpp.html" target="_self">utils.cpp</a></td><td class="desc">Implementation of the utils </td></tr>
<tr id="row_2_" class="odd"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icondoc"></span><a class="el" href="main_8cpp.html" target="_self">main.cpp</a></td><td class="desc">Main program for Project 2 </td></tr>
<tr id="row_3_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icondoc"></span><a class="el" href="matrix_8cpp.html" target="_self">matrix.cpp</a></td><td class="desc">Function prototypes for creating tridiagonal matrices </td></tr>
<tr id="row_4_" class="odd"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icondoc"></span><a class="el" href="test__suite_8cpp.html" target="_self">test_suite.cpp</a></td><td class="desc">Test suite for project 2 </td></tr>
<tr id="row_5_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icondoc"></span><a class="el" href="utils_8cpp.html" target="_self">utils.cpp</a></td><td class="desc">Implementation of the utils </td></tr>
</table>
</div><!-- directory -->
</div><!-- contents -->

View File

@ -77,7 +77,9 @@ $(function() {
<p>Implementation of the jacobi rotation method.
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &lt;cmath&gt;</code><br />
<div class="textblock"><code>#include &lt;algorithm&gt;</code><br />
<code>#include &lt;cmath&gt;</code><br />
<code>#include &lt;utility&gt;</code><br />
<code>#include &quot;<a class="el" href="utils_8hpp_source.html">utils.hpp</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="jacobi_8hpp_source.html">jacobi.hpp</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="matrix_8hpp_source.html">matrix.hpp</a>&quot;</code><br />
@ -155,7 +157,9 @@ Janita Ovidie Sandtrøen Willumsen (janitaws) </dd></dl>
</div><div class="memdoc">
<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>
<table class="params">
<tr><td class="paramname">A</td><td>The initial matrix to be solved </td></tr>
@ -211,7 +215,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws) </dd></dl>
</div><div class="memdoc">
<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>
<table class="params">
<tr><td class="paramname">A</td><td>Matrix A<sup> (m) </sup> </td></tr>

View File

@ -99,7 +99,7 @@ Functions</h2></td></tr>
<dl class="section author"><dt>Author</dt><dd>Cory Alexander Balaton (coryab) </dd>
<dd>
Janita Ovidie Sandtrøen Willumsen (janitaws) </dd></dl>
<dl class="bug"><dt><b><a class="el" href="bug.html#_bug000005">Bug:</a></b></dt><dd>No known bugs </dd></dl>
<dl class="bug"><dt><b><a class="el" href="bug.html#_bug000006">Bug:</a></b></dt><dd>No known bugs </dd></dl>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="a5a8da00df38bec1046249e8589a8aad0" name="a5a8da00df38bec1046249e8589a8aad0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5a8da00df38bec1046249e8589a8aad0">&#9670;&#160;</a></span>jacobi_eigensolver()</h2>
@ -158,7 +158,9 @@ Janita Ovidie Sandtrøen Willumsen (janitaws) </dd></dl>
</div><div class="memdoc">
<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>
<table class="params">
<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">
<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>
<table class="params">
<tr><td class="paramname">A</td><td>Matrix A<sup> (m) </sup> </td></tr>

View File

@ -82,19 +82,19 @@ $(function() {
<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="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="l00025" name="l00025"></a><span class="lineno"> 25</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="l00041" name="l00041"></a><span class="lineno"> 41</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="l00043" name="l00043"></a><span class="lineno"> 43</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="l00045" name="l00045"></a><span class="lineno"> 45</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="l00047" name="l00047"></a><span class="lineno"> 47</span> </div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</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:15</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:54</div></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="l00027" name="l00027"></a><span class="lineno"> 27</span> </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="l00052" name="l00052"></a><span class="lineno"> 52</span> <span class="keywordtype">double</span> eps, </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="l00054" name="l00054"></a><span class="lineno"> 54</span> arma::mat&amp; eigenvectors, </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="l00056" name="l00056"></a><span class="lineno"> 56</span> <span class="keywordtype">int</span>&amp; iterations, </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="l00058" name="l00058"></a><span class="lineno"> 58</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_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 -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>

115
doc/html/main_8cpp.html Normal file
View File

@ -0,0 +1,115 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<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.6"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>FYS3150: Project 2: main.cpp File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">FYS3150: Project 2
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- 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');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#func-members">Functions</a> </div>
<div class="headertitle"><div class="title">main.cpp File Reference</div></div>
</div><!--header-->
<div class="contents">
<p>Main program for Project 2.
<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;iostream&gt;</code><br />
<code>#include &quot;<a class="el" href="utils_8hpp_source.html">utils.hpp</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="matrix_8hpp_source.html">matrix.hpp</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="jacobi_8hpp_source.html">jacobi.hpp</a>&quot;</code><br />
</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:a53cac9c8c53af2f5786024fc55ca3864"><td class="memItemLeft" align="right" valign="top"><a id="a53cac9c8c53af2f5786024fc55ca3864" name="a53cac9c8c53af2f5786024fc55ca3864"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>write_transformation_dense</b> (int N)</td></tr>
<tr class="separator:a53cac9c8c53af2f5786024fc55ca3864"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acbb39b9c7880e8c390ff599f30a44388"><td class="memItemLeft" align="right" valign="top"><a id="acbb39b9c7880e8c390ff599f30a44388" name="acbb39b9c7880e8c390ff599f30a44388"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>write_transformation_tridiag</b> (int N)</td></tr>
<tr class="separator:acbb39b9c7880e8c390ff599f30a44388"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a60bac2011e71020815da55a734cb3e89"><td class="memItemLeft" align="right" valign="top"><a id="a60bac2011e71020815da55a734cb3e89" name="a60bac2011e71020815da55a734cb3e89"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>write_eigenvec</b> (int N)</td></tr>
<tr class="separator:a60bac2011e71020815da55a734cb3e89"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="memItemLeft" align="right" valign="top"><a id="ae66f6b31b5ad750f1fe042a706a4e3d4" name="ae66f6b31b5ad750f1fe042a706a4e3d4"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><b>main</b> ()</td></tr>
<tr class="separator:ae66f6b31b5ad750f1fe042a706a4e3d4"><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>Main program for Project 2. </p>
<p>The program performs the Jacobi rotation method. The size of the matrix, and number of transformations performed are written to file. Eigenvector correstonding to the 3 smallest eigenvalues for matrices of size 6x6 and 100x100 are written to file.</p>
<dl class="section author"><dt>Author</dt><dd>Cory Alexander Balaton (coryab) </dd>
<dd>
Janita Ovidie Sandtrøen Willumsen (janitaws) </dd></dl>
<dl class="bug"><dt><b><a class="el" href="bug.html#_bug000002">Bug:</a></b></dt><dd>No known bugs </dd></dl>
</div></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.6
</small></address>
</body>
</html>

View File

@ -99,7 +99,7 @@ Functions</h2></td></tr>
<dl class="section author"><dt>Author</dt><dd>Cory Alexander Balaton (coryab) </dd>
<dd>
Janita Ovidie Sandtrøen Willumsen (janitaws) </dd></dl>
<dl class="bug"><dt><b><a class="el" href="bug.html#_bug000002">Bug:</a></b></dt><dd>No known bugs </dd></dl>
<dl class="bug"><dt><b><a class="el" href="bug.html#_bug000003">Bug:</a></b></dt><dd>No known bugs </dd></dl>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="a564688c96a8e4282e995a0663545d627" name="a564688c96a8e4282e995a0663545d627"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a564688c96a8e4282e995a0663545d627">&#9670;&#160;</a></span>create_symmetric_tridiagonal()</h2>
@ -134,6 +134,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws) </dd></dl>
</div><div class="memdoc">
<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>
<table class="params">
<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">
<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>
<table class="params">
<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">
<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>
<table class="params">
<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">
<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>
<table class="params">
<tr><td class="paramname">A</td><td>Symmetric matrix </td></tr>

View File

@ -105,7 +105,7 @@ Functions</h2></td></tr>
<dl class="section author"><dt>Author</dt><dd>Cory Alexander Balaton (coryab) </dd>
<dd>
Janita Ovidie Sandtrøen Willumsen (janitaws) </dd></dl>
<dl class="bug"><dt><b><a class="el" href="bug.html#_bug000006">Bug:</a></b></dt><dd>No known bugs </dd></dl>
<dl class="bug"><dt><b><a class="el" href="bug.html#_bug000007">Bug:</a></b></dt><dd>No known bugs </dd></dl>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="a564688c96a8e4282e995a0663545d627" name="a564688c96a8e4282e995a0663545d627"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a564688c96a8e4282e995a0663545d627">&#9670;&#160;</a></span>create_symmetric_tridiagonal()</h2>
@ -140,6 +140,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws) </dd></dl>
</div><div class="memdoc">
<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>
<table class="params">
<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">
<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>
<table class="params">
<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">
<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>
<table class="params">
<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">
<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>
<table class="params">
<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="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="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="l00024" name="l00024"></a><span class="lineno"> 24</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="l00026" name="l00026"></a><span class="lineno"> 26</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="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="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="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="l00029" name="l00029"></a><span class="lineno"> 29</span> <span class="keyword">const</span> arma::vec&amp; a, </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="l00031" name="l00031"></a><span class="lineno"> 31</span> <span class="keyword">const</span> arma::vec&amp; e);</div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</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#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="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="l00058" name="l00058"></a><span class="lineno"> 58</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="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="l00061" name="l00061"></a><span class="lineno"> 61</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_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>

View File

@ -1,6 +1,7 @@
var searchData=
[
['matrix_2ecpp_0',['matrix.cpp',['../matrix_8cpp.html',1,'']]],
['matrix_2ehpp_1',['matrix.hpp',['../matrix_8hpp.html',1,'']]],
['max_5foffdiag_5fsymmetric_2',['max_offdiag_symmetric',['../matrix_8cpp.html#af42e501cbf71bec9c77ececc22723df9',1,'max_offdiag_symmetric(arma::mat &amp;A, int &amp;k, int &amp;l):&#160;matrix.cpp'],['../matrix_8hpp.html#af42e501cbf71bec9c77ececc22723df9',1,'max_offdiag_symmetric(arma::mat &amp;A, int &amp;k, int &amp;l):&#160;matrix.cpp']]]
['main_2ecpp_0',['main.cpp',['../main_8cpp.html',1,'']]],
['matrix_2ecpp_1',['matrix.cpp',['../matrix_8cpp.html',1,'']]],
['matrix_2ehpp_2',['matrix.hpp',['../matrix_8hpp.html',1,'']]],
['max_5foffdiag_5fsymmetric_3',['max_offdiag_symmetric',['../matrix_8cpp.html#af42e501cbf71bec9c77ececc22723df9',1,'max_offdiag_symmetric(arma::mat &amp;A, int &amp;k, int &amp;l):&#160;matrix.cpp'],['../matrix_8hpp.html#af42e501cbf71bec9c77ececc22723df9',1,'max_offdiag_symmetric(arma::mat &amp;A, int &amp;k, int &amp;l):&#160;matrix.cpp']]]
];

View File

@ -1,5 +1,6 @@
var searchData=
[
['matrix_2ecpp_0',['matrix.cpp',['../matrix_8cpp.html',1,'']]],
['matrix_2ehpp_1',['matrix.hpp',['../matrix_8hpp.html',1,'']]]
['main_2ecpp_0',['main.cpp',['../main_8cpp.html',1,'']]],
['matrix_2ecpp_1',['matrix.cpp',['../matrix_8cpp.html',1,'']]],
['matrix_2ehpp_2',['matrix.hpp',['../matrix_8hpp.html',1,'']]]
];

View File

@ -105,7 +105,7 @@ int&#160;</td><td class="memItemRight" valign="bottom"><b>main</b> ()</td></tr>
<dl class="section author"><dt>Author</dt><dd>Cory Alexander Balaton (coryab) </dd>
<dd>
Janita Ovidie Sandtrøen Willumsen (janitaws) </dd></dl>
<dl class="bug"><dt><b><a class="el" href="bug.html#_bug000003">Bug:</a></b></dt><dd>No known bugs </dd></dl>
<dl class="bug"><dt><b><a class="el" href="bug.html#_bug000004">Bug:</a></b></dt><dd>No known bugs </dd></dl>
</div></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>

View File

@ -93,7 +93,7 @@ Functions</h2></td></tr>
<dl class="section author"><dt>Author</dt><dd>Cory Alexander Balaton (coryab) </dd>
<dd>
Janita Ovidie Sandtrøen Willumsen (janitaws) </dd></dl>
<dl class="bug"><dt><b><a class="el" href="bug.html#_bug000004">Bug:</a></b></dt><dd>No known bugs </dd></dl>
<dl class="bug"><dt><b><a class="el" href="bug.html#_bug000005">Bug:</a></b></dt><dd>No known bugs </dd></dl>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="a58565270b643b24e3132f38c653e0199" name="a58565270b643b24e3132f38c653e0199"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a58565270b643b24e3132f38c653e0199">&#9670;&#160;</a></span>scientific_format() <span class="overload">[1/2]</span></h2>

View File

@ -85,6 +85,7 @@ $(function() {
<div class="textblock"><code>#include &lt;string&gt;</code><br />
<code>#include &lt;vector&gt;</code><br />
<code>#include &lt;iomanip&gt;</code><br />
<code>#include &lt;sstream&gt;</code><br />
</div>
<p><a href="utils_8hpp_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
@ -109,7 +110,7 @@ Functions</h2></td></tr>
<dl class="section author"><dt>Author</dt><dd>Cory Alexander Balaton (coryab) </dd>
<dd>
Janita Ovidie Sandtrøen Willumsen (janitaws) </dd></dl>
<dl class="bug"><dt><b><a class="el" href="bug.html#_bug000007">Bug:</a></b></dt><dd>No known bugs </dd></dl>
<dl class="bug"><dt><b><a class="el" href="bug.html#_bug000008">Bug:</a></b></dt><dd>No known bugs </dd></dl>
</div><h2 class="groupheader">Macro Definition Documentation</h2>
<a id="aecc1f7a8a2493b9e021e5bff76a00a5b" name="aecc1f7a8a2493b9e021e5bff76a00a5b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aecc1f7a8a2493b9e021e5bff76a00a5b">&#9670;&#160;</a></span>DEBUG</h2>

View File

@ -83,21 +83,22 @@ $(function() {
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span><span class="preprocessor">#include &lt;string&gt;</span></div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span><span class="preprocessor">#include &lt;vector&gt;</span></div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span><span class="preprocessor">#include &lt;iomanip&gt;</span></div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span> </div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span><span class="preprocessor">#ifdef DBG</span></div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span><span class="preprocessor"> #define DEBUG(msg) std::cout &lt;&lt; __FILE__ &lt;&lt; &quot; &quot;</span> &lt;&lt; __LINE__ &lt;&lt; &quot;: &quot; \</div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span> &lt;&lt; msg &lt;&lt; std::endl</div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span><span class="preprocessor">#else</span></div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"><a class="line" href="utils_8hpp.html#aecc1f7a8a2493b9e021e5bff76a00a5b"> 30</a></span><span class="preprocessor"> #define DEBUG(msg)</span></div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span> </div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span>std::string <a class="code hl_function" href="utils_8hpp.html#adfb618b2fdff47ef30a4a2b62c04f384">scientific_format</a>(<span class="keywordtype">double</span> d, <span class="keywordtype">int</span> width=20, <span class="keywordtype">int</span> prec=10);</div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span> </div>
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span>std::string <a class="code hl_function" href="utils_8hpp.html#adfb618b2fdff47ef30a4a2b62c04f384">scientific_format</a>(<span class="keyword">const</span> std::vector&lt;double&gt;&amp; v, </div>
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> <span class="keywordtype">int</span> width=20, </div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span> <span class="keywordtype">int</span> prec=10);</div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span> </div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span><span class="preprocessor">#include &lt;sstream&gt;</span></div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span> </div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span><span class="preprocessor">#ifdef DBG</span></div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span><span class="preprocessor"> #define DEBUG(msg) std::cout &lt;&lt; __FILE__ &lt;&lt; &quot; &quot;</span> &lt;&lt; __LINE__ &lt;&lt; &quot;: &quot; \</div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span> &lt;&lt; msg &lt;&lt; std::endl</div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span><span class="preprocessor">#else</span></div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"><a class="line" href="utils_8hpp.html#aecc1f7a8a2493b9e021e5bff76a00a5b"> 31</a></span><span class="preprocessor"> #define DEBUG(msg)</span></div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> </div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span>std::string <a class="code hl_function" href="utils_8hpp.html#adfb618b2fdff47ef30a4a2b62c04f384">scientific_format</a>(<span class="keywordtype">double</span> d, <span class="keywordtype">int</span> width=20, <span class="keywordtype">int</span> prec=10);</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>std::string <a class="code hl_function" href="utils_8hpp.html#adfb618b2fdff47ef30a4a2b62c04f384">scientific_format</a>(<span class="keyword">const</span> std::vector&lt;double&gt;&amp; v, </div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span> <span class="keywordtype">int</span> width=20, </div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span> <span class="keywordtype">int</span> prec=10);</div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> </div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span><span class="preprocessor">#endif</span></div>
<div class="ttc" id="autils_8hpp_html_adfb618b2fdff47ef30a4a2b62c04f384"><div class="ttname"><a href="utils_8hpp.html#adfb618b2fdff47ef30a4a2b62c04f384">scientific_format</a></div><div class="ttdeci">std::string scientific_format(double d, int width=20, int prec=10)</div><div class="ttdoc">Turns a double into a string written in scientific format.</div><div class="ttdef"><b>Definition:</b> utils.cpp:10</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->

View File

@ -12,7 +12,9 @@
/** @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 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.
*
* 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 eps Tolerance

View File

@ -13,6 +13,11 @@
#include <armadillo>
/** @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 d Vector for the main diagonal of size N
@ -26,6 +31,11 @@ arma::mat create_tridiagonal(
const arma::vec& e);
/** @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 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);
/** @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 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);
/** @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 k Variable to store the row of the return value

View File

@ -14,6 +14,7 @@
#include <string>
#include <vector>
#include <iomanip>
#include <sstream>
/** @def DEBUG(msg)
* @brief Writes a debug message

5
latex/Makefile Normal file
View File

@ -0,0 +1,5 @@
.PHONY: latex
latex:
pdflatex assignment-2.tex

BIN
latex/assignment-2.pdf Normal file

Binary file not shown.

View File

@ -91,15 +91,15 @@
\input{problems/problem-1}
% \input{problems/problem-2}
\input{problems/problem-2}
% \input{problems/problem-3}
\input{problems/problem-3}
% \input{problems/problem-4}
\input{problems/problem-4}
% \input{problems/problem-5}
\input{problems/problem-5}
% \input{problems/problem-6}
\input{problems/problem-6}
\end{document}

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
latex/images/transform.pdf Normal file

Binary file not shown.

View File

@ -0,0 +1,13 @@
x,Vector 1,Vector 2,Vector 3,Analytic 1,Analytic 2,Analytic 3
0.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00
9.0909090909e-02,1.2013116562e-01,2.3053001908e-01,3.2225269916e-01,1.2013116588e-01,2.3053001915e-01,3.2225270128e-01
1.8181818182e-01,2.3053002022e-01,3.8786838557e-01,4.2206128116e-01,2.3053001915e-01,3.8786838606e-01,4.2206128095e-01
2.7272727273e-01,3.2225270064e-01,4.2206128186e-01,2.3053002150e-01,3.2225270128e-01,4.2206128095e-01,2.3053001915e-01
3.6363636364e-01,3.8786838571e-01,3.2225270018e-01,-1.2013116730e-01,3.8786838606e-01,3.2225270128e-01,-1.2013116588e-01
4.5454545455e-01,4.2206128199e-01,1.2013116659e-01,-3.8786838753e-01,4.2206128095e-01,1.2013116588e-01,-3.8786838606e-01
5.4545454545e-01,4.2206128029e-01,-1.2013116676e-01,-3.8786838497e-01,4.2206128095e-01,-1.2013116588e-01,-3.8786838606e-01
6.3636363636e-01,3.8786838601e-01,-3.2225270035e-01,-1.2013116452e-01,3.8786838606e-01,-3.2225270128e-01,-1.2013116588e-01
7.2727272727e-01,3.2225270138e-01,-4.2206128196e-01,2.3053001725e-01,3.2225270128e-01,-4.2206128095e-01,2.3053001915e-01
8.1818181818e-01,2.3053001839e-01,-3.8786838569e-01,4.2206128036e-01,2.3053001915e-01,-3.8786838606e-01,4.2206128095e-01
9.0909090909e-01,1.2013116693e-01,-2.3053001912e-01,3.2225270306e-01,1.2013116588e-01,-2.3053001915e-01,3.2225270128e-01
1.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00
1 x Vector 1 Vector 2 Vector 3 Analytic 1 Analytic 2 Analytic 3
2 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00
3 9.0909090909e-02 1.2013116562e-01 2.3053001908e-01 3.2225269916e-01 1.2013116588e-01 2.3053001915e-01 3.2225270128e-01
4 1.8181818182e-01 2.3053002022e-01 3.8786838557e-01 4.2206128116e-01 2.3053001915e-01 3.8786838606e-01 4.2206128095e-01
5 2.7272727273e-01 3.2225270064e-01 4.2206128186e-01 2.3053002150e-01 3.2225270128e-01 4.2206128095e-01 2.3053001915e-01
6 3.6363636364e-01 3.8786838571e-01 3.2225270018e-01 -1.2013116730e-01 3.8786838606e-01 3.2225270128e-01 -1.2013116588e-01
7 4.5454545455e-01 4.2206128199e-01 1.2013116659e-01 -3.8786838753e-01 4.2206128095e-01 1.2013116588e-01 -3.8786838606e-01
8 5.4545454545e-01 4.2206128029e-01 -1.2013116676e-01 -3.8786838497e-01 4.2206128095e-01 -1.2013116588e-01 -3.8786838606e-01
9 6.3636363636e-01 3.8786838601e-01 -3.2225270035e-01 -1.2013116452e-01 3.8786838606e-01 -3.2225270128e-01 -1.2013116588e-01
10 7.2727272727e-01 3.2225270138e-01 -4.2206128196e-01 2.3053001725e-01 3.2225270128e-01 -4.2206128095e-01 2.3053001915e-01
11 8.1818181818e-01 2.3053001839e-01 -3.8786838569e-01 4.2206128036e-01 2.3053001915e-01 -3.8786838606e-01 4.2206128095e-01
12 9.0909090909e-01 1.2013116693e-01 -2.3053001912e-01 3.2225270306e-01 1.2013116588e-01 -2.3053001915e-01 3.2225270128e-01
13 1.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00

View File

@ -0,0 +1,103 @@
x,Vector 1,Vector 2,Vector 3,Analytic 1,Analytic 2,Analytic 3
0.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00
9.9009900990e-03,4.3763580486e-03,-8.7484808732e-03,-1.3112140868e-02,4.3763573469e-03,-8.7484808507e-03,-1.3112140764e-02
1.9801980198e-02,8.7484805374e-03,-1.7463118426e-02,-2.6110190173e-02,8.7484808507e-03,-1.7463115529e-02,-2.6110188805e-02
2.9702970297e-02,1.3112137258e-02,-2.6110188342e-02,-3.8881042300e-02,1.3112140764e-02,-2.6110188805e-02,-3.8881044154e-02
3.9603960396e-02,1.7463113948e-02,-3.4656251014e-02,-5.1313582739e-02,1.7463115529e-02,-3.4656246833e-02,-5.1313583715e-02
4.9504950495e-02,2.1797194330e-02,-4.3068225457e-02,-6.3299631766e-02,2.1797195856e-02,-4.3068226575e-02,-6.3299628182e-02
5.9405940594e-02,2.6110192331e-02,-5.1313581763e-02,-7.4734880361e-02,2.6110188805e-02,-5.1313583715e-02,-7.4734883337e-02
6.9306930693e-02,3.0397918929e-02,-5.9360418816e-02,-8.5519850123e-02,3.0397921832e-02,-5.9360418568e-02,-8.5519847548e-02
7.9207920792e-02,3.4656246898e-02,-6.7177598362e-02,-9.5560679417e-02,3.4656246833e-02,-6.7177599493e-02,-9.5560677562e-02
8.9108910891e-02,3.8881042315e-02,-7.4734886241e-02,-1.0477000717e-01,3.8881044154e-02,-7.4734883337e-02,-1.0477000506e-01
9.9009900990e-02,4.3068230096e-02,-8.2003031501e-02,-1.1306769719e-01,4.3068226575e-02,-8.2003032435e-02,-1.1306769690e-01
1.0891089109e-01,4.7213744503e-02,-8.8953927224e-02,-1.2038155127e-01,4.7213743269e-02,-8.8953927731e-02,-1.2038155232e-01
1.1881188119e-01,5.1313588425e-02,-9.5560676214e-02,-1.2664793098e-01,5.1313583715e-02,-9.5560677562e-02,-1.2664793125e-01
1.2871287129e-01,5.5363780001e-02,-1.0179771917e-01,-1.3181231002e-01,5.5363781583e-02,-1.0179772170e-01,-1.3181230802e-01
1.3861386139e-01,5.9360419789e-02,-1.0764092918e-01,-1.3582974462e-01,5.9360418568e-02,-1.0764093022e-01,-1.3582974582e-01
1.4851485149e-01,6.3299627984e-02,-1.1306769819e-01,-1.3866528556e-01,6.3299628182e-02,-1.1306769690e-01,-1.3866528771e-01
1.5841584158e-01,6.7177601217e-02,-1.1805702763e-01,-1.4029426114e-01,6.7177599493e-02,-1.1805702662e-01,-1.4029426076e-01
1.6831683168e-01,7.0990579025e-02,-1.2258961789e-01,-1.4070249027e-01,7.0990580816e-02,-1.2258961664e-01,-1.4070249079e-01
1.7821782178e-01,7.4734880844e-02,-1.2664793546e-01,-1.3988642874e-01,7.4734883337e-02,-1.2664793125e-01,-1.3988642566e-01
1.8811881188e-01,7.8406882603e-02,-1.3021626991e-01,-1.3785316434e-01,7.8406884685e-02,-1.3021626962e-01,-1.3785316621e-01
1.9801980198e-01,8.2003032834e-02,-1.3328082864e-01,-1.3462040439e-01,8.2003032435e-02,-1.3328082653e-01,-1.3462040445e-01
2.0792079208e-01,8.5519846919e-02,-1.3582974378e-01,-1.3021627110e-01,8.5519847548e-02,-1.3582974582e-01,-1.3021626962e-01
2.1782178218e-01,8.8953926852e-02,-1.3785316224e-01,-1.2467908375e-01,8.8953927731e-02,-1.3785316621e-01,-1.2467908343e-01
2.2772277228e-01,9.2301946409e-02,-1.3934326062e-01,-1.1805702523e-01,9.2301950735e-02,-1.3934325949e-01,-1.1805702662e-01
2.3762376238e-01,9.5560676953e-02,-1.4029425672e-01,-1.1040771966e-01,9.5560677562e-02,-1.4029426076e-01,-1.1040771973e-01
2.4752475248e-01,9.8726957572e-02,-1.4070249295e-01,-1.0179772068e-01,9.8726955606e-02,-1.4070249079e-01,-1.0179772170e-01
2.5742574257e-01,1.0179772036e-01,-1.4056637044e-01,-9.2301949636e-02,1.0179772170e-01,-1.4056637021e-01,-9.2301950735e-02
2.6732673267e-01,1.0477000527e-01,-1.3988642578e-01,-8.2003032107e-02,1.0477000506e-01,-1.3988642566e-01,-8.2003032435e-02
2.7722772277e-01,1.0764093290e-01,-1.3866528965e-01,-7.0990578930e-02,1.0764093022e-01,-1.3866528771e-01,-7.0990580816e-02
2.8712871287e-01,1.1040771987e-01,-1.3690767831e-01,-5.9360423847e-02,1.1040771973e-01,-1.3690768069e-01,-5.9360418568e-02
2.9702970297e-01,1.1306770152e-01,-1.3462040609e-01,-4.7213742425e-02,1.1306769690e-01,-1.3462040445e-01,-4.7213743269e-02
3.0693069307e-01,1.1561828862e-01,-1.3181230529e-01,-3.4656247048e-02,1.1561828837e-01,-1.3181230802e-01,-3.4656246833e-02
3.1683168317e-01,1.1805702504e-01,-1.2849425366e-01,-2.1797195258e-02,1.1805702662e-01,-1.2849425538e-01,-2.1797195856e-02
3.2673267327e-01,1.2038155014e-01,-1.2467908448e-01,-8.7484830929e-03,1.2038155232e-01,-1.2467908343e-01,-8.7484808507e-03
3.3663366337e-01,1.2258961573e-01,-1.2038155323e-01,4.3763575797e-03,1.2258961664e-01,-1.2038155232e-01,4.3763573469e-03
3.4653465347e-01,1.2467908410e-01,-1.1561829169e-01,1.7463115474e-02,1.2467908343e-01,-1.1561828837e-01,1.7463115529e-02
3.5643564356e-01,1.2664793338e-01,-1.1040771926e-01,3.0397924158e-02,1.2664793125e-01,-1.1040771973e-01,3.0397921832e-02
3.6633663366e-01,1.2849425248e-01,-1.0477000407e-01,4.3068226361e-02,1.2849425538e-01,-1.0477000506e-01,4.3068226575e-02
3.7623762376e-01,1.3021626897e-01,-9.8726953501e-02,5.5363781149e-02,1.3021626962e-01,-9.8726955606e-02,5.5363781583e-02
3.8613861386e-01,1.3181230641e-01,-9.2301949069e-02,6.7177599971e-02,1.3181230802e-01,-9.2301950735e-02,6.7177599493e-02
3.9603960396e-01,1.3328082420e-01,-8.5519846476e-02,7.8406881225e-02,1.3328082653e-01,-8.5519847548e-02,7.8406884685e-02
4.0594059406e-01,1.3462040441e-01,-7.8406886916e-02,8.8953928507e-02,1.3462040445e-01,-7.8406884685e-02,8.8953927731e-02
4.1584158416e-01,1.3582974237e-01,-7.0990582377e-02,9.8726952665e-02,1.3582974582e-01,-7.0990580816e-02,9.8726955606e-02
4.2574257426e-01,1.3690768207e-01,-6.3299628825e-02,1.0764092847e-01,1.3690768069e-01,-6.3299628182e-02,1.0764093022e-01
4.3564356436e-01,1.3785316922e-01,-5.5363784270e-02,1.1561828790e-01,1.3785316621e-01,-5.5363781583e-02,1.1561828837e-01
4.4554455446e-01,1.3866529183e-01,-4.7213741970e-02,1.2258961490e-01,1.3866528771e-01,-4.7213743269e-02,1.2258961664e-01
4.5544554455e-01,1.3934325896e-01,-3.8881046285e-02,1.2849425510e-01,1.3934325949e-01,-3.8881044154e-02,1.2849425538e-01
4.6534653465e-01,1.3988642934e-01,-3.0397919107e-02,1.3328083063e-01,1.3988642566e-01,-3.0397921832e-02,1.3328082653e-01
4.7524752475e-01,1.4029425867e-01,-2.1797194223e-02,1.3690767978e-01,1.4029426076e-01,-2.1797195856e-02,1.3690768069e-01
4.8514851485e-01,1.4056637371e-01,-1.3112142627e-02,1.3934326030e-01,1.4056637021e-01,-1.3112140764e-02,1.3934325949e-01
4.9504950495e-01,1.4070249059e-01,-4.3763545931e-03,1.4056637087e-01,1.4070249079e-01,-4.3763573469e-03,1.4056637021e-01
5.0495049505e-01,1.4070249237e-01,4.3763553240e-03,1.4056636855e-01,1.4070249079e-01,4.3763573469e-03,1.4056637021e-01
5.1485148515e-01,1.4056636701e-01,1.3112141424e-02,1.3934326274e-01,1.4056637021e-01,1.3112140764e-02,1.3934325949e-01
5.2475247525e-01,1.4029426479e-01,2.1797196040e-02,1.3690767734e-01,1.4029426076e-01,2.1797195856e-02,1.3690768069e-01
5.3465346535e-01,1.3988642418e-01,3.0397922181e-02,1.3328082645e-01,1.3988642566e-01,3.0397921832e-02,1.3328082653e-01
5.4455445545e-01,1.3934325818e-01,3.8881045170e-02,1.2849425588e-01,1.3934325949e-01,3.8881044154e-02,1.2849425538e-01
5.5445544554e-01,1.3866528548e-01,4.7213739894e-02,1.2258961529e-01,1.3866528771e-01,4.7213743269e-02,1.2258961664e-01
5.6435643564e-01,1.3785316347e-01,5.5363782200e-02,1.1561828838e-01,1.3785316621e-01,5.5363781583e-02,1.1561828837e-01
5.7425742574e-01,1.3690767808e-01,6.3299625555e-02,1.0764093012e-01,1.3690768069e-01,6.3299628182e-02,1.0764093022e-01
5.8415841584e-01,1.3582975080e-01,7.0990579118e-02,9.8726956974e-02,1.3582974582e-01,7.0990580816e-02,9.8726955606e-02
5.9405940594e-01,1.3462040473e-01,7.8406883764e-02,8.8953931156e-02,1.3462040445e-01,7.8406884685e-02,8.8953927731e-02
6.0396039604e-01,1.3328082628e-01,8.5519847508e-02,7.8406882521e-02,1.3328082653e-01,8.5519847548e-02,7.8406884685e-02
6.1386138614e-01,1.3181231043e-01,9.2301955750e-02,6.7177597738e-02,1.3181230802e-01,9.2301950735e-02,6.7177599493e-02
6.2376237624e-01,1.3021627254e-01,9.8726959125e-02,5.5363781584e-02,1.3021626962e-01,9.8726955606e-02,5.5363781583e-02
6.3366336634e-01,1.2849425843e-01,1.0477000685e-01,4.3068225262e-02,1.2849425538e-01,1.0477000506e-01,4.3068226575e-02
6.4356435644e-01,1.2664792968e-01,1.1040772008e-01,3.0397923775e-02,1.2664793125e-01,1.1040771973e-01,3.0397921832e-02
6.5346534653e-01,1.2467908233e-01,1.1561828667e-01,1.7463112100e-02,1.2467908343e-01,1.1561828837e-01,1.7463115529e-02
6.6336633663e-01,1.2258961618e-01,1.2038154892e-01,4.3763558959e-03,1.2258961664e-01,1.2038155232e-01,4.3763573469e-03
6.7326732673e-01,1.2038155509e-01,1.2467908434e-01,-8.7484791158e-03,1.2038155232e-01,1.2467908343e-01,-8.7484808507e-03
6.8316831683e-01,1.1805702847e-01,1.2849425619e-01,-2.1797195967e-02,1.1805702662e-01,1.2849425538e-01,-2.1797195856e-02
6.9306930693e-01,1.1561828622e-01,1.3181230822e-01,-3.4656246425e-02,1.1561828837e-01,1.3181230802e-01,-3.4656246833e-02
7.0297029703e-01,1.1306768997e-01,1.3462040633e-01,-4.7213742058e-02,1.1306769690e-01,1.3462040445e-01,-4.7213743269e-02
7.1287128713e-01,1.1040771799e-01,1.3690767691e-01,-5.9360418526e-02,1.1040771973e-01,1.3690768069e-01,-5.9360418568e-02
7.2277227723e-01,1.0764092776e-01,1.3866528979e-01,-7.0990581227e-02,1.0764093022e-01,1.3866528771e-01,-7.0990580816e-02
7.3267326733e-01,1.0477000620e-01,1.3988642119e-01,-8.2003033815e-02,1.0477000506e-01,1.3988642566e-01,-8.2003032435e-02
7.4257425743e-01,1.0179772152e-01,1.4056636623e-01,-9.2301952893e-02,1.0179772170e-01,1.4056637021e-01,-9.2301950735e-02
7.5247524752e-01,9.8726952848e-02,1.4070249392e-01,-1.0179771955e-01,9.8726955606e-02,1.4070249079e-01,-1.0179772170e-01
7.6237623762e-01,9.5560678408e-02,1.4029425948e-01,-1.1040772236e-01,9.5560677562e-02,1.4029426076e-01,-1.1040771973e-01
7.7227722772e-01,9.2301954838e-02,1.3934326416e-01,-1.1805702951e-01,9.2301950735e-02,1.3934325949e-01,-1.1805702662e-01
7.8217821782e-01,8.8953928903e-02,1.3785316849e-01,-1.2467908256e-01,8.8953927731e-02,1.3785316621e-01,-1.2467908343e-01
7.9207920792e-01,8.5519848124e-02,1.3582974727e-01,-1.3021626851e-01,8.5519847548e-02,1.3582974582e-01,-1.3021626962e-01
8.0198019802e-01,8.2003030909e-02,1.3328082828e-01,-1.3462040327e-01,8.2003032435e-02,1.3328082653e-01,-1.3462040445e-01
8.1188118812e-01,7.8406885186e-02,1.3021626587e-01,-1.3785316474e-01,7.8406884685e-02,1.3021626962e-01,-1.3785316621e-01
8.2178217822e-01,7.4734885540e-02,1.2664793089e-01,-1.3988642777e-01,7.4734883337e-02,1.2664793125e-01,-1.3988642566e-01
8.3168316832e-01,7.0990582072e-02,1.2258961409e-01,-1.4070248742e-01,7.0990580816e-02,1.2258961664e-01,-1.4070249079e-01
8.4158415842e-01,6.7177598843e-02,1.1805702585e-01,-1.4029426160e-01,6.7177599493e-02,1.1805702662e-01,-1.4029426076e-01
8.5148514851e-01,6.3299627125e-02,1.1306769708e-01,-1.3866528902e-01,6.3299628182e-02,1.1306769690e-01,-1.3866528771e-01
8.6138613861e-01,5.9360415245e-02,1.0764093150e-01,-1.3582974369e-01,5.9360418568e-02,1.0764093022e-01,-1.3582974582e-01
8.7128712871e-01,5.5363784218e-02,1.0179772269e-01,-1.3181231038e-01,5.5363781583e-02,1.0179772170e-01,-1.3181230802e-01
8.8118811881e-01,5.1313579361e-02,9.5560678437e-02,-1.2664793139e-01,5.1313583715e-02,9.5560677562e-02,-1.2664793125e-01
8.9108910891e-01,4.7213741091e-02,8.8953928103e-02,-1.2038155214e-01,4.7213743269e-02,8.8953927731e-02,-1.2038155232e-01
9.0099009901e-01,4.3068225595e-02,8.2003031564e-02,-1.1306769867e-01,4.3068226575e-02,8.2003032435e-02,-1.1306769690e-01
9.1089108911e-01,3.8881045999e-02,7.4734883659e-02,-1.0477000196e-01,3.8881044154e-02,7.4734883337e-02,-1.0477000506e-01
9.2079207921e-01,3.4656245355e-02,6.7177597583e-02,-9.5560676903e-02,3.4656246833e-02,6.7177599493e-02,-9.5560677562e-02
9.3069306931e-01,3.0397926577e-02,5.9360420731e-02,-8.5519850964e-02,3.0397921832e-02,5.9360418568e-02,-8.5519847548e-02
9.4059405941e-01,2.6110186824e-02,5.1313584318e-02,-7.4734880388e-02,2.6110188805e-02,5.1313583715e-02,-7.4734883337e-02
9.5049504950e-01,2.1797196485e-02,4.3068226072e-02,-6.3299628759e-02,2.1797195856e-02,4.3068226575e-02,-6.3299628182e-02
9.6039603960e-01,1.7463116664e-02,3.4656247119e-02,-5.1313584252e-02,1.7463115529e-02,3.4656246833e-02,-5.1313583715e-02
9.7029702970e-01,1.3112143651e-02,2.6110184365e-02,-3.8881045879e-02,1.3112140764e-02,2.6110188805e-02,-3.8881044154e-02
9.8019801980e-01,8.7484791764e-03,1.7463117510e-02,-2.6110190428e-02,8.7484808507e-03,1.7463115529e-02,-2.6110188805e-02
9.9009900990e-01,4.3763588619e-03,8.7484790494e-03,-1.3112138188e-02,4.3763573469e-03,8.7484808507e-03,-1.3112140764e-02
1.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00
1 x Vector 1 Vector 2 Vector 3 Analytic 1 Analytic 2 Analytic 3
2 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00
3 9.9009900990e-03 4.3763580486e-03 -8.7484808732e-03 -1.3112140868e-02 4.3763573469e-03 -8.7484808507e-03 -1.3112140764e-02
4 1.9801980198e-02 8.7484805374e-03 -1.7463118426e-02 -2.6110190173e-02 8.7484808507e-03 -1.7463115529e-02 -2.6110188805e-02
5 2.9702970297e-02 1.3112137258e-02 -2.6110188342e-02 -3.8881042300e-02 1.3112140764e-02 -2.6110188805e-02 -3.8881044154e-02
6 3.9603960396e-02 1.7463113948e-02 -3.4656251014e-02 -5.1313582739e-02 1.7463115529e-02 -3.4656246833e-02 -5.1313583715e-02
7 4.9504950495e-02 2.1797194330e-02 -4.3068225457e-02 -6.3299631766e-02 2.1797195856e-02 -4.3068226575e-02 -6.3299628182e-02
8 5.9405940594e-02 2.6110192331e-02 -5.1313581763e-02 -7.4734880361e-02 2.6110188805e-02 -5.1313583715e-02 -7.4734883337e-02
9 6.9306930693e-02 3.0397918929e-02 -5.9360418816e-02 -8.5519850123e-02 3.0397921832e-02 -5.9360418568e-02 -8.5519847548e-02
10 7.9207920792e-02 3.4656246898e-02 -6.7177598362e-02 -9.5560679417e-02 3.4656246833e-02 -6.7177599493e-02 -9.5560677562e-02
11 8.9108910891e-02 3.8881042315e-02 -7.4734886241e-02 -1.0477000717e-01 3.8881044154e-02 -7.4734883337e-02 -1.0477000506e-01
12 9.9009900990e-02 4.3068230096e-02 -8.2003031501e-02 -1.1306769719e-01 4.3068226575e-02 -8.2003032435e-02 -1.1306769690e-01
13 1.0891089109e-01 4.7213744503e-02 -8.8953927224e-02 -1.2038155127e-01 4.7213743269e-02 -8.8953927731e-02 -1.2038155232e-01
14 1.1881188119e-01 5.1313588425e-02 -9.5560676214e-02 -1.2664793098e-01 5.1313583715e-02 -9.5560677562e-02 -1.2664793125e-01
15 1.2871287129e-01 5.5363780001e-02 -1.0179771917e-01 -1.3181231002e-01 5.5363781583e-02 -1.0179772170e-01 -1.3181230802e-01
16 1.3861386139e-01 5.9360419789e-02 -1.0764092918e-01 -1.3582974462e-01 5.9360418568e-02 -1.0764093022e-01 -1.3582974582e-01
17 1.4851485149e-01 6.3299627984e-02 -1.1306769819e-01 -1.3866528556e-01 6.3299628182e-02 -1.1306769690e-01 -1.3866528771e-01
18 1.5841584158e-01 6.7177601217e-02 -1.1805702763e-01 -1.4029426114e-01 6.7177599493e-02 -1.1805702662e-01 -1.4029426076e-01
19 1.6831683168e-01 7.0990579025e-02 -1.2258961789e-01 -1.4070249027e-01 7.0990580816e-02 -1.2258961664e-01 -1.4070249079e-01
20 1.7821782178e-01 7.4734880844e-02 -1.2664793546e-01 -1.3988642874e-01 7.4734883337e-02 -1.2664793125e-01 -1.3988642566e-01
21 1.8811881188e-01 7.8406882603e-02 -1.3021626991e-01 -1.3785316434e-01 7.8406884685e-02 -1.3021626962e-01 -1.3785316621e-01
22 1.9801980198e-01 8.2003032834e-02 -1.3328082864e-01 -1.3462040439e-01 8.2003032435e-02 -1.3328082653e-01 -1.3462040445e-01
23 2.0792079208e-01 8.5519846919e-02 -1.3582974378e-01 -1.3021627110e-01 8.5519847548e-02 -1.3582974582e-01 -1.3021626962e-01
24 2.1782178218e-01 8.8953926852e-02 -1.3785316224e-01 -1.2467908375e-01 8.8953927731e-02 -1.3785316621e-01 -1.2467908343e-01
25 2.2772277228e-01 9.2301946409e-02 -1.3934326062e-01 -1.1805702523e-01 9.2301950735e-02 -1.3934325949e-01 -1.1805702662e-01
26 2.3762376238e-01 9.5560676953e-02 -1.4029425672e-01 -1.1040771966e-01 9.5560677562e-02 -1.4029426076e-01 -1.1040771973e-01
27 2.4752475248e-01 9.8726957572e-02 -1.4070249295e-01 -1.0179772068e-01 9.8726955606e-02 -1.4070249079e-01 -1.0179772170e-01
28 2.5742574257e-01 1.0179772036e-01 -1.4056637044e-01 -9.2301949636e-02 1.0179772170e-01 -1.4056637021e-01 -9.2301950735e-02
29 2.6732673267e-01 1.0477000527e-01 -1.3988642578e-01 -8.2003032107e-02 1.0477000506e-01 -1.3988642566e-01 -8.2003032435e-02
30 2.7722772277e-01 1.0764093290e-01 -1.3866528965e-01 -7.0990578930e-02 1.0764093022e-01 -1.3866528771e-01 -7.0990580816e-02
31 2.8712871287e-01 1.1040771987e-01 -1.3690767831e-01 -5.9360423847e-02 1.1040771973e-01 -1.3690768069e-01 -5.9360418568e-02
32 2.9702970297e-01 1.1306770152e-01 -1.3462040609e-01 -4.7213742425e-02 1.1306769690e-01 -1.3462040445e-01 -4.7213743269e-02
33 3.0693069307e-01 1.1561828862e-01 -1.3181230529e-01 -3.4656247048e-02 1.1561828837e-01 -1.3181230802e-01 -3.4656246833e-02
34 3.1683168317e-01 1.1805702504e-01 -1.2849425366e-01 -2.1797195258e-02 1.1805702662e-01 -1.2849425538e-01 -2.1797195856e-02
35 3.2673267327e-01 1.2038155014e-01 -1.2467908448e-01 -8.7484830929e-03 1.2038155232e-01 -1.2467908343e-01 -8.7484808507e-03
36 3.3663366337e-01 1.2258961573e-01 -1.2038155323e-01 4.3763575797e-03 1.2258961664e-01 -1.2038155232e-01 4.3763573469e-03
37 3.4653465347e-01 1.2467908410e-01 -1.1561829169e-01 1.7463115474e-02 1.2467908343e-01 -1.1561828837e-01 1.7463115529e-02
38 3.5643564356e-01 1.2664793338e-01 -1.1040771926e-01 3.0397924158e-02 1.2664793125e-01 -1.1040771973e-01 3.0397921832e-02
39 3.6633663366e-01 1.2849425248e-01 -1.0477000407e-01 4.3068226361e-02 1.2849425538e-01 -1.0477000506e-01 4.3068226575e-02
40 3.7623762376e-01 1.3021626897e-01 -9.8726953501e-02 5.5363781149e-02 1.3021626962e-01 -9.8726955606e-02 5.5363781583e-02
41 3.8613861386e-01 1.3181230641e-01 -9.2301949069e-02 6.7177599971e-02 1.3181230802e-01 -9.2301950735e-02 6.7177599493e-02
42 3.9603960396e-01 1.3328082420e-01 -8.5519846476e-02 7.8406881225e-02 1.3328082653e-01 -8.5519847548e-02 7.8406884685e-02
43 4.0594059406e-01 1.3462040441e-01 -7.8406886916e-02 8.8953928507e-02 1.3462040445e-01 -7.8406884685e-02 8.8953927731e-02
44 4.1584158416e-01 1.3582974237e-01 -7.0990582377e-02 9.8726952665e-02 1.3582974582e-01 -7.0990580816e-02 9.8726955606e-02
45 4.2574257426e-01 1.3690768207e-01 -6.3299628825e-02 1.0764092847e-01 1.3690768069e-01 -6.3299628182e-02 1.0764093022e-01
46 4.3564356436e-01 1.3785316922e-01 -5.5363784270e-02 1.1561828790e-01 1.3785316621e-01 -5.5363781583e-02 1.1561828837e-01
47 4.4554455446e-01 1.3866529183e-01 -4.7213741970e-02 1.2258961490e-01 1.3866528771e-01 -4.7213743269e-02 1.2258961664e-01
48 4.5544554455e-01 1.3934325896e-01 -3.8881046285e-02 1.2849425510e-01 1.3934325949e-01 -3.8881044154e-02 1.2849425538e-01
49 4.6534653465e-01 1.3988642934e-01 -3.0397919107e-02 1.3328083063e-01 1.3988642566e-01 -3.0397921832e-02 1.3328082653e-01
50 4.7524752475e-01 1.4029425867e-01 -2.1797194223e-02 1.3690767978e-01 1.4029426076e-01 -2.1797195856e-02 1.3690768069e-01
51 4.8514851485e-01 1.4056637371e-01 -1.3112142627e-02 1.3934326030e-01 1.4056637021e-01 -1.3112140764e-02 1.3934325949e-01
52 4.9504950495e-01 1.4070249059e-01 -4.3763545931e-03 1.4056637087e-01 1.4070249079e-01 -4.3763573469e-03 1.4056637021e-01
53 5.0495049505e-01 1.4070249237e-01 4.3763553240e-03 1.4056636855e-01 1.4070249079e-01 4.3763573469e-03 1.4056637021e-01
54 5.1485148515e-01 1.4056636701e-01 1.3112141424e-02 1.3934326274e-01 1.4056637021e-01 1.3112140764e-02 1.3934325949e-01
55 5.2475247525e-01 1.4029426479e-01 2.1797196040e-02 1.3690767734e-01 1.4029426076e-01 2.1797195856e-02 1.3690768069e-01
56 5.3465346535e-01 1.3988642418e-01 3.0397922181e-02 1.3328082645e-01 1.3988642566e-01 3.0397921832e-02 1.3328082653e-01
57 5.4455445545e-01 1.3934325818e-01 3.8881045170e-02 1.2849425588e-01 1.3934325949e-01 3.8881044154e-02 1.2849425538e-01
58 5.5445544554e-01 1.3866528548e-01 4.7213739894e-02 1.2258961529e-01 1.3866528771e-01 4.7213743269e-02 1.2258961664e-01
59 5.6435643564e-01 1.3785316347e-01 5.5363782200e-02 1.1561828838e-01 1.3785316621e-01 5.5363781583e-02 1.1561828837e-01
60 5.7425742574e-01 1.3690767808e-01 6.3299625555e-02 1.0764093012e-01 1.3690768069e-01 6.3299628182e-02 1.0764093022e-01
61 5.8415841584e-01 1.3582975080e-01 7.0990579118e-02 9.8726956974e-02 1.3582974582e-01 7.0990580816e-02 9.8726955606e-02
62 5.9405940594e-01 1.3462040473e-01 7.8406883764e-02 8.8953931156e-02 1.3462040445e-01 7.8406884685e-02 8.8953927731e-02
63 6.0396039604e-01 1.3328082628e-01 8.5519847508e-02 7.8406882521e-02 1.3328082653e-01 8.5519847548e-02 7.8406884685e-02
64 6.1386138614e-01 1.3181231043e-01 9.2301955750e-02 6.7177597738e-02 1.3181230802e-01 9.2301950735e-02 6.7177599493e-02
65 6.2376237624e-01 1.3021627254e-01 9.8726959125e-02 5.5363781584e-02 1.3021626962e-01 9.8726955606e-02 5.5363781583e-02
66 6.3366336634e-01 1.2849425843e-01 1.0477000685e-01 4.3068225262e-02 1.2849425538e-01 1.0477000506e-01 4.3068226575e-02
67 6.4356435644e-01 1.2664792968e-01 1.1040772008e-01 3.0397923775e-02 1.2664793125e-01 1.1040771973e-01 3.0397921832e-02
68 6.5346534653e-01 1.2467908233e-01 1.1561828667e-01 1.7463112100e-02 1.2467908343e-01 1.1561828837e-01 1.7463115529e-02
69 6.6336633663e-01 1.2258961618e-01 1.2038154892e-01 4.3763558959e-03 1.2258961664e-01 1.2038155232e-01 4.3763573469e-03
70 6.7326732673e-01 1.2038155509e-01 1.2467908434e-01 -8.7484791158e-03 1.2038155232e-01 1.2467908343e-01 -8.7484808507e-03
71 6.8316831683e-01 1.1805702847e-01 1.2849425619e-01 -2.1797195967e-02 1.1805702662e-01 1.2849425538e-01 -2.1797195856e-02
72 6.9306930693e-01 1.1561828622e-01 1.3181230822e-01 -3.4656246425e-02 1.1561828837e-01 1.3181230802e-01 -3.4656246833e-02
73 7.0297029703e-01 1.1306768997e-01 1.3462040633e-01 -4.7213742058e-02 1.1306769690e-01 1.3462040445e-01 -4.7213743269e-02
74 7.1287128713e-01 1.1040771799e-01 1.3690767691e-01 -5.9360418526e-02 1.1040771973e-01 1.3690768069e-01 -5.9360418568e-02
75 7.2277227723e-01 1.0764092776e-01 1.3866528979e-01 -7.0990581227e-02 1.0764093022e-01 1.3866528771e-01 -7.0990580816e-02
76 7.3267326733e-01 1.0477000620e-01 1.3988642119e-01 -8.2003033815e-02 1.0477000506e-01 1.3988642566e-01 -8.2003032435e-02
77 7.4257425743e-01 1.0179772152e-01 1.4056636623e-01 -9.2301952893e-02 1.0179772170e-01 1.4056637021e-01 -9.2301950735e-02
78 7.5247524752e-01 9.8726952848e-02 1.4070249392e-01 -1.0179771955e-01 9.8726955606e-02 1.4070249079e-01 -1.0179772170e-01
79 7.6237623762e-01 9.5560678408e-02 1.4029425948e-01 -1.1040772236e-01 9.5560677562e-02 1.4029426076e-01 -1.1040771973e-01
80 7.7227722772e-01 9.2301954838e-02 1.3934326416e-01 -1.1805702951e-01 9.2301950735e-02 1.3934325949e-01 -1.1805702662e-01
81 7.8217821782e-01 8.8953928903e-02 1.3785316849e-01 -1.2467908256e-01 8.8953927731e-02 1.3785316621e-01 -1.2467908343e-01
82 7.9207920792e-01 8.5519848124e-02 1.3582974727e-01 -1.3021626851e-01 8.5519847548e-02 1.3582974582e-01 -1.3021626962e-01
83 8.0198019802e-01 8.2003030909e-02 1.3328082828e-01 -1.3462040327e-01 8.2003032435e-02 1.3328082653e-01 -1.3462040445e-01
84 8.1188118812e-01 7.8406885186e-02 1.3021626587e-01 -1.3785316474e-01 7.8406884685e-02 1.3021626962e-01 -1.3785316621e-01
85 8.2178217822e-01 7.4734885540e-02 1.2664793089e-01 -1.3988642777e-01 7.4734883337e-02 1.2664793125e-01 -1.3988642566e-01
86 8.3168316832e-01 7.0990582072e-02 1.2258961409e-01 -1.4070248742e-01 7.0990580816e-02 1.2258961664e-01 -1.4070249079e-01
87 8.4158415842e-01 6.7177598843e-02 1.1805702585e-01 -1.4029426160e-01 6.7177599493e-02 1.1805702662e-01 -1.4029426076e-01
88 8.5148514851e-01 6.3299627125e-02 1.1306769708e-01 -1.3866528902e-01 6.3299628182e-02 1.1306769690e-01 -1.3866528771e-01
89 8.6138613861e-01 5.9360415245e-02 1.0764093150e-01 -1.3582974369e-01 5.9360418568e-02 1.0764093022e-01 -1.3582974582e-01
90 8.7128712871e-01 5.5363784218e-02 1.0179772269e-01 -1.3181231038e-01 5.5363781583e-02 1.0179772170e-01 -1.3181230802e-01
91 8.8118811881e-01 5.1313579361e-02 9.5560678437e-02 -1.2664793139e-01 5.1313583715e-02 9.5560677562e-02 -1.2664793125e-01
92 8.9108910891e-01 4.7213741091e-02 8.8953928103e-02 -1.2038155214e-01 4.7213743269e-02 8.8953927731e-02 -1.2038155232e-01
93 9.0099009901e-01 4.3068225595e-02 8.2003031564e-02 -1.1306769867e-01 4.3068226575e-02 8.2003032435e-02 -1.1306769690e-01
94 9.1089108911e-01 3.8881045999e-02 7.4734883659e-02 -1.0477000196e-01 3.8881044154e-02 7.4734883337e-02 -1.0477000506e-01
95 9.2079207921e-01 3.4656245355e-02 6.7177597583e-02 -9.5560676903e-02 3.4656246833e-02 6.7177599493e-02 -9.5560677562e-02
96 9.3069306931e-01 3.0397926577e-02 5.9360420731e-02 -8.5519850964e-02 3.0397921832e-02 5.9360418568e-02 -8.5519847548e-02
97 9.4059405941e-01 2.6110186824e-02 5.1313584318e-02 -7.4734880388e-02 2.6110188805e-02 5.1313583715e-02 -7.4734883337e-02
98 9.5049504950e-01 2.1797196485e-02 4.3068226072e-02 -6.3299628759e-02 2.1797195856e-02 4.3068226575e-02 -6.3299628182e-02
99 9.6039603960e-01 1.7463116664e-02 3.4656247119e-02 -5.1313584252e-02 1.7463115529e-02 3.4656246833e-02 -5.1313583715e-02
100 9.7029702970e-01 1.3112143651e-02 2.6110184365e-02 -3.8881045879e-02 1.3112140764e-02 2.6110188805e-02 -3.8881044154e-02
101 9.8019801980e-01 8.7484791764e-03 1.7463117510e-02 -2.6110190428e-02 8.7484808507e-03 1.7463115529e-02 -2.6110188805e-02
102 9.9009900990e-01 4.3763588619e-03 8.7484790494e-03 -1.3112138188e-02 4.3763573469e-03 8.7484808507e-03 -1.3112140764e-02
103 1.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00

View File

@ -0,0 +1,9 @@
x,Vector 1,Vector 2,Vector 3,Analytic 1,Analytic 2,Analytic 3
0.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00
1.4285714286e-01,2.3192061397e-01,-4.1790650593e-01,-5.2112088916e-01,2.3192061392e-01,-4.1790650594e-01,-5.2112088917e-01
2.8571428571e-01,4.1790650598e-01,-5.2112088916e-01,-2.3192061388e-01,4.1790650594e-01,-5.2112088917e-01,-2.3192061392e-01
4.2857142857e-01,5.2112088920e-01,-2.3192061385e-01,4.1790650595e-01,5.2112088917e-01,-2.3192061392e-01,4.1790650594e-01
5.7142857143e-01,5.2112088915e-01,2.3192061400e-01,4.1790650592e-01,5.2112088917e-01,2.3192061392e-01,4.1790650594e-01
7.1428571429e-01,4.1790650588e-01,5.2112088921e-01,-2.3192061394e-01,4.1790650594e-01,5.2112088917e-01,-2.3192061392e-01
8.5714285714e-01,2.3192061389e-01,4.1790650591e-01,-5.2112088921e-01,2.3192061392e-01,4.1790650594e-01,-5.2112088917e-01
1.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00
1 x Vector 1 Vector 2 Vector 3 Analytic 1 Analytic 2 Analytic 3
2 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00
3 1.4285714286e-01 2.3192061397e-01 -4.1790650593e-01 -5.2112088916e-01 2.3192061392e-01 -4.1790650594e-01 -5.2112088917e-01
4 2.8571428571e-01 4.1790650598e-01 -5.2112088916e-01 -2.3192061388e-01 4.1790650594e-01 -5.2112088917e-01 -2.3192061392e-01
5 4.2857142857e-01 5.2112088920e-01 -2.3192061385e-01 4.1790650595e-01 5.2112088917e-01 -2.3192061392e-01 4.1790650594e-01
6 5.7142857143e-01 5.2112088915e-01 2.3192061400e-01 4.1790650592e-01 5.2112088917e-01 2.3192061392e-01 4.1790650594e-01
7 7.1428571429e-01 4.1790650588e-01 5.2112088921e-01 -2.3192061394e-01 4.1790650594e-01 5.2112088917e-01 -2.3192061392e-01
8 8.5714285714e-01 2.3192061389e-01 4.1790650591e-01 -5.2112088921e-01 2.3192061392e-01 4.1790650594e-01 -5.2112088917e-01
9 1.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00

View File

@ -0,0 +1,97 @@
N,T
5,32
6,53
7,73
8,98
9,130
10,157
11,201
12,254
13,293
14,349
15,394
16,458
17,518
18,587
19,649
20,740
21,827
22,911
23,999
24,1073
25,1187
26,1299
27,1410
28,1502
29,1604
30,1725
31,1856
32,1979
33,2089
34,2227
35,2383
36,2536
37,2644
38,2810
39,3000
40,3138
41,3299
42,3445
43,3638
44,3828
45,4015
46,4143
47,4348
48,4611
49,4773
50,4994
51,5163
52,5363
53,5586
54,5784
55,6075
56,6275
57,6550
58,6711
59,6957
60,7225
61,7483
62,7782
63,7952
64,8265
65,8531
66,8764
67,9060
68,9331
69,9686
70,9913
71,10098
72,10417
73,10795
74,11108
75,11342
76,11703
77,12104
78,12356
79,12623
80,13066
81,13513
82,13706
83,13998
84,14333
85,14694
86,15160
87,15470
88,15845
89,16211
90,16551
91,17047
92,17237
93,17669
94,18055
95,18614
96,18838
97,19253
98,19868
99,20092
100,20517
1 N T
2 5 32
3 6 53
4 7 73
5 8 98
6 9 130
7 10 157
8 11 201
9 12 254
10 13 293
11 14 349
12 15 394
13 16 458
14 17 518
15 18 587
16 19 649
17 20 740
18 21 827
19 22 911
20 23 999
21 24 1073
22 25 1187
23 26 1299
24 27 1410
25 28 1502
26 29 1604
27 30 1725
28 31 1856
29 32 1979
30 33 2089
31 34 2227
32 35 2383
33 36 2536
34 37 2644
35 38 2810
36 39 3000
37 40 3138
38 41 3299
39 42 3445
40 43 3638
41 44 3828
42 45 4015
43 46 4143
44 47 4348
45 48 4611
46 49 4773
47 50 4994
48 51 5163
49 52 5363
50 53 5586
51 54 5784
52 55 6075
53 56 6275
54 57 6550
55 58 6711
56 59 6957
57 60 7225
58 61 7483
59 62 7782
60 63 7952
61 64 8265
62 65 8531
63 66 8764
64 67 9060
65 68 9331
66 69 9686
67 70 9913
68 71 10098
69 72 10417
70 73 10795
71 74 11108
72 75 11342
73 76 11703
74 77 12104
75 78 12356
76 79 12623
77 80 13066
78 81 13513
79 82 13706
80 83 13998
81 84 14333
82 85 14694
83 86 15160
84 87 15470
85 88 15845
86 89 16211
87 90 16551
88 91 17047
89 92 17237
90 93 17669
91 94 18055
92 95 18614
93 96 18838
94 97 19253
95 98 19868
96 99 20092
97 100 20517

View File

@ -0,0 +1,97 @@
N,T
5,35
6,41
7,78
8,104
9,135
10,177
11,222
12,238
13,305
14,335
15,417
16,460
17,537
18,606
19,688
20,756
21,840
22,917
23,1017
24,1095
25,1207
26,1298
27,1420
28,1492
29,1629
30,1766
31,1869
32,1965
33,2132
34,2275
35,2403
36,2570
37,2670
38,2794
39,2962
40,3169
41,3284
42,3469
43,3619
44,3840
45,3977
46,4161
47,4406
48,4523
49,4710
50,4919
51,5207
52,5336
53,5582
54,5801
55,5997
56,6248
57,6465
58,6694
59,6911
60,7078
61,7355
62,7618
63,7880
64,8170
65,8407
66,8651
67,8899
68,9139
69,9478
70,9786
71,10059
72,10325
73,10608
74,10887
75,11223
76,11514
77,11794
78,12120
79,12420
80,12738
81,13111
82,13402
83,13772
84,14018
85,14393
86,14820
87,15096
88,15451
89,15866
90,16243
91,16688
92,16864
93,17359
94,17701
95,18027
96,18473
97,18810
98,19231
99,19573
100,19992
1 N T
2 5 35
3 6 41
4 7 78
5 8 104
6 9 135
7 10 177
8 11 222
9 12 238
10 13 305
11 14 335
12 15 417
13 16 460
14 17 537
15 18 606
16 19 688
17 20 756
18 21 840
19 22 917
20 23 1017
21 24 1095
22 25 1207
23 26 1298
24 27 1420
25 28 1492
26 29 1629
27 30 1766
28 31 1869
29 32 1965
30 33 2132
31 34 2275
32 35 2403
33 36 2570
34 37 2670
35 38 2794
36 39 2962
37 40 3169
38 41 3284
39 42 3469
40 43 3619
41 44 3840
42 45 3977
43 46 4161
44 47 4406
45 48 4523
46 49 4710
47 50 4919
48 51 5207
49 52 5336
50 53 5582
51 54 5801
52 55 5997
53 56 6248
54 57 6465
55 58 6694
56 59 6911
57 60 7078
58 61 7355
59 62 7618
60 63 7880
61 64 8170
62 65 8407
63 66 8651
64 67 8899
65 68 9139
66 69 9478
67 70 9786
68 71 10059
69 72 10325
70 73 10608
71 74 10887
72 75 11223
73 76 11514
74 77 11794
75 78 12120
76 79 12420
77 80 12738
78 81 13111
79 82 13402
80 83 13772
81 84 14018
82 85 14393
83 86 14820
84 87 15096
85 88 15451
86 89 15866
87 90 16243
88 91 16688
89 92 16864
90 93 17359
91 94 17701
92 95 18027
93 96 18473
94 97 18810
95 98 19231
96 99 19573
97 100 19992

View File

@ -12,5 +12,5 @@ Scaling will result in a dimensionless variable $\hat{x} = \frac{1}{L}$.
\end{align*}
Now we insert the expression into the original equation
\begin{align*}
\frac{d u(\hat{x})}{d\hat{x}^{2}} &= - \frac{F L^{2}}{\gamma} u(\hat{x}) \\
\frac{d u(\hat{x})}{d\hat{x}^{2}} &= - \frac{F L^{2}}{\gamma} u(\hat{x}). \\
\end{align*}

View File

@ -1,2 +1,6 @@
\section*{Problem 2}
The functions that set up the tridiagonal matrices can be found in
\textbf{matrix.hpp} and \textbf{matrix.cpp} in the Github repo.
The test for this can be found in \textbf{test\_suite.cpp}.

View File

@ -1 +1,10 @@
\section*{Problem 3}
\subsection*{a)}
The function to find the largest off-diagonal can be found in
\textbf{matrix.hpp} and \textbf{matrix.cpp}.
\subsection*{b)}
The test for (a) can be found in \textbf{test\_suite.cpp}.

View File

@ -1 +1,10 @@
\section*{Problem 4}
\subsection*{a)}
The code for Jacobi's rotation algorithm can be found in \textbf{jacobi.hpp}
and \textbf{jacobi.cpp}.
\subsection*{b)}
The test for (a) can be found in \textbf{test\_suite.cpp}.

View File

@ -1 +1,20 @@
\section*{Problem 5}
\subsection*{a)}
We used the Jacobi's rotation method to solve $\boldsymbol{A} \vec{v} = \lambda \vec{v}$, for $\boldsymbol{A}_{(N \cross N)}$ with $N \in [5, 100]$,
and increased the matrix size by $3$ rows and columns for every new matrix generated. The number of similarity transformations performed for a tridiagonal matrix
of is presented in Figure \ref{fig:transform}. We chose to run the program using dense matrices of same size as the tridiagonal matrices, to compare the scaling data.
What we see is that the number of similarity transformations necessary to solve the system is proportional to the matrix size.
\begin{figure}[h]
\centering
\includegraphics[width=0.8\textwidth]{images/transform.pdf}
\caption{Similarity transformations performed as a function of matrix size (N), data is presented in a logarithmic scale.}
\label{fig:transform}
\end{figure}
\subsection*{b)}
For both the tridiagonal and dense matrices we are checking off-diagonal elements above the main diagonal, since these are symmetric matrices.
The max value is found at index $(k,l)$ and for every rotation of the matrix, we update the remaining elements along row $k$ and $l$. This can lead to an increased
value of off-diagonal elements, that previously were close to zero, and extra rotations has to be performed due to these elements. Which suggest that the
number of similarity transformations perfomed on a matrix does not depend on its initial number of non-zero elements, making the Jacobi's rotation algorithm as
computationally expensive for both dense and tridiagonal matrices of size $N \cross N$.

View File

@ -1 +1,21 @@
\section*{Problem 6}
\subsection*{a)}
The plot in Figure \ref{fig:eigenvector_10} is showing the discretization of $\hat{x}$ with $n=10$.
The eigenvectors and corresponding analytical eigenvectors have a complete overlap suggesting the implementation of the algorithm is correct.
We have included the boundary points for each vector to show a complete solution.
\begin{figure}[h]
\centering
\includegraphics[width=0.8\textwidth]{images/eigenvector_10.pdf}
\caption{The plot is showing the elements of eigenvector $\vec{v}_{1}, \vec{v}_{2}, \vec{v}_{3}$, corresponding to the three lowest eigenvalues of matrix $\boldsymbol{A} (10 \cross 10)$, against the position $\hat{x}$. The analytical eigenvectors $\vec{v}^{(1)}, \vec{v}^{(2)}, \vec{v}^{(3)}$ are also included in the plot.}
\label{fig:eigenvector_10}
\end{figure}
\subsection*{b)}
For the discretization with $n=100$ the solution is visually close to a continuous curve, with a complete overlap of the analytical eigenvectors, presented in Figure \ref{fig:eigenvector_100}.
\begin{figure}
\centering
\includegraphics[width=0.8\textwidth]{images/eigenvector_100.pdf}
\caption{The plot is showing the elements of eigenvector $\vec{v}_{1}, \vec{v}_{2}, \vec{v}_{3}$, corresponding to the three lowest eigenvalues of matrix $\boldsymbol{A} (100 \cross 100)$, against the position $\hat{x}$. The analytical eigenvectors $\vec{v}^{(1)}, \vec{v}^{(2)}, \vec{v}^{(3)}$ are also included in the plot.}
\label{fig:eigenvector_100}
\end{figure}

View File

@ -1,19 +1,41 @@
INCLUDE=../include
CC=g++
CCFLAGS=-larmadillo -llapack -std=c++11
LIBSRCS=utils.cpp matrix.cpp jacobi.cpp
LIBOBJS=$(LIBSRCS:.cpp=.o)
DEBUG=-DDBG
INCLUDE=../include
.PHONY: clean
CFLAGS=-larmadillo -llapack -std=c++11
test_suite: test_suite.o matrix.o jacobi.o
$(CC) $^ -o $@ $(CCFLAGS) $(DEBUG)
# Add a debug flag when compiling (For the DEBUG macro in utils.hpp)
DEBUG ?= 0
ifeq ($(DEBUG), 1)
DBGFLAG=-DDBG
else
DBGFLAG=
endif
.PHONY: doxygen clean
all: test_suite main
# Rules for executables
main: main.o $(LIBOBJS)
$(CC) $^ -o $@ $(CFLAGS) $(DBGFLAG) -I$(INCLUDE)
test_suite: test_suite.o $(LIBOBJS)
$(CC) $^ -o $@ $(CFLAGS) $(DBGFLAG) -I$(INCLUDE)
# Rule for object files
%.o: %.cpp
$(CC) -c $^ -o $@ -I $(INCLUDE) $(DEBUG)
$(CC) -c $^ -o $@ $(DBGFLAG) -I$(INCLUDE)
# Make documentation
doxygen:
doxygen
clean:
rm *.o
rm test_suite
rm main

View File

@ -0,0 +1,164 @@
/** @file main.cpp
* @brief Main program for Project 2
*
* The program performs the Jacobi rotation method.
* The size of the matrix, and number of transformations
* performed are written to file.
* Eigenvector correstonding to the 3 smallest eigenvalues
* for matrices of size 6x6 and 100x100 are written to file.
*
* @author Cory Alexander Balaton (coryab)
* @author Janita Ovidie Sandtrøen Willumsen (janitaws)
* @bug No known bugs
*/
#include <cassert>
#include <cmath>
#include <iostream>
#include "utils.hpp"
#include "matrix.hpp"
#include "jacobi.hpp"
void write_transformation_dense(int N)
{
std::ofstream ofile;
ofile.open("../latex/output/transform_dense.csv");
ofile << "N,T" << std::endl;
// Increase size of matrix, start at 5 to avoid logic_error of N=4
for (int i = 5; i <= N; i++) {
arma::mat A = arma::mat(i, i).randn();
A = arma::symmatu(A);
arma::vec eigval;
arma::mat eigvec;
int iters;
bool converged;
jacobi_eigensolver(A, 10e-14, eigval, eigvec, 100000, iters, converged);
// Write size, and number of iterations to file
ofile << i << "," << iters << std::endl;
}
ofile.close();
}
void write_transformation_tridiag(int N)
{
std::ofstream ofile;
double h;
double a, d;
ofile.open("../latex/output/transform_tridiag.csv");
// Write header line to file
ofile << "N,T" << std::endl;
// Increase size of matrix, start at 5 to avoid logic_error of N=4
for (int i = 5; i <= N; i++) {
h = 1. / (double) (i+1);
a = -1. / (h*h), d = 2. / (h*h);
arma::mat A = create_symmetric_tridiagonal(i, a, d);
arma::vec eigval;
arma::mat eigvec;
int iters;
bool converged;
jacobi_eigensolver(A, 10e-14, eigval, eigvec, 100000, iters, converged);
// Write size, and number of iterations to file
ofile << i << "," << iters << std::endl;
}
ofile.close();
}
void write_eigenvec(int N)
{
double h = 1. / (double) (N+1);
double a = -1. / (h*h);
double d = 2. / (h*h);
double x = 0.;
// Create tridiagonal matrix
arma::mat A = create_symmetric_tridiagonal(N, a, d);
arma::mat analytic = arma::mat(N, N);
arma::vec eigval;
arma::mat eigvec;
int iters;
bool converged;
// Solve using Jacobi rotation method
jacobi_eigensolver(A, 10e-14, eigval, eigvec, 100000, iters, converged);
// Build analytic eigenvectors
arma::vec v, analytic_vec = arma::vec(N);
for (int i=0; i < N; i++) {
v = eigvec.col(i);
for (int j=0; j < N; j++) {
analytic_vec(j) = std::sin(((j+1.)*(i+1.)*M_PI) / (N+1.));
}
analytic_vec = arma::normalise(analytic_vec);
// Flip the sign of the analytic vector if they are different
if (analytic_vec(0)*v(0) < 0.) {
analytic_vec *= -1;
}
analytic.col(i) = analytic_vec;
}
std::ofstream ofile;
// Create file based on matrix size, and write header line to file
ofile.open("../latex/output/eigenvector_" + std::to_string(N) + ".csv");
ofile << "x,"
<< "Vector 1,Vector 2,Vector 3,"
<< "Analytic 1,Analytic 2,Analytic 3" << std::endl;
// Add boundary value for x=0
ofile << scientific_format(0., 16) << ","
<< scientific_format(0., 16) << ","
<< scientific_format(0., 16) << ","
<< scientific_format(0., 16) << ","
<< scientific_format(0., 16) << ","
<< scientific_format(0., 16) << ","
<< scientific_format(0., 16) << std::endl;
// Add x-value and element i of each eigenvector to same line
for (int i = 0; i < N; i++) {
x += h;
ofile << scientific_format(x, 16)<< ","
<< scientific_format(eigvec(i,0), 16) << ","
<< scientific_format(eigvec(i,1), 16) << ","
<< scientific_format(eigvec(i,2), 16) << ","
<< scientific_format(analytic(i,0), 16) << ","
<< scientific_format(analytic(i,1), 16) << ","
<< scientific_format(analytic(i,2), 16) << std::endl;
}
// Add boundary value for x=1
ofile << scientific_format(1., 16) << ","
<< scientific_format(0., 16) << ","
<< scientific_format(0., 16) << ","
<< scientific_format(0., 16) << ","
<< scientific_format(0., 16) << ","
<< scientific_format(0., 16) << ","
<< scientific_format(0., 16) << std::endl;
ofile.close();
}
int main()
{
write_transformation_tridiag(100);
write_transformation_dense(100);
write_eigenvec(10);
write_eigenvec(100);
return 0;
}

51
src/plot.py Normal file
View File

@ -0,0 +1,51 @@
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
sns.set_theme()
plt.rcParams['text.usetex'] = True
def plot_transformations(save: bool=False) -> None:
# Load data
tridiag = pd.read_csv("../latex/output/transform_tridiag.csv", header=0)
dense = pd.read_csv("../latex/output/transform_dense.csv", header=0)
fig, ax = plt.subplots()
ax.loglog(dense['N'], dense['T'], '--', label='Dense')
ax.loglog(tridiag['N'], tridiag['T'], label='Tridiagonal')
ax.set_xlabel('N')
ax.set_ylabel('Similarity transformations')
ax.legend()
# Save to file
if save is True:
fig.savefig("../latex/images/transform.pdf")
def plot_eigenvectors(N: int, save: bool=False) -> None:
# Load data based on matrix size
path = f"../latex/output/eigenvector_{N}.csv"
eigvec = pd.read_csv(path, header=0)
fig, ax = plt.subplots()
ax.plot(eigvec['x'], eigvec['Vector 1'], label=r'$\vec{v}_{1}$')
ax.plot(eigvec['x'], eigvec['Vector 2'], label=r'$\vec{v}_{2}$')
ax.plot(eigvec['x'], eigvec['Vector 3'], label=r'$\vec{v}_{3}$')
ax.plot(eigvec['x'], eigvec['Analytic 1'], '--', label=r'$\vec{v}^{(1)}$')
ax.plot(eigvec['x'], eigvec['Analytic 2'], '--', label=r'$\vec{v}^{(2)}$')
ax.plot(eigvec['x'], eigvec['Analytic 3'], '--', label=r'$\vec{v}^{(3)}$')
ax.set_xlabel(r'Element $\hat{x}_{i}$')
ax.set_ylabel(r'Element $v_{i}$')
ax.legend(loc='upper left')
# Save to file
if save is True:
fig.savefig(f"../latex/images/eigenvector_{N}.pdf")
if __name__ == '__main__':
plot_transformations(True)
plot_eigenvectors(10, True)
plot_eigenvectors(100, True)