commit
431c5ff158
@ -114,7 +114,7 @@ Operating systems</h2>
|
||||
</ul>
|
||||
</li>
|
||||
<li>MacOS<ul>
|
||||
<li>Might work, but hasn't been tested</li>
|
||||
<li>Will most likely not work due to the use of getopt, which is GNU specific.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Windows<ul>
|
||||
@ -188,7 +188,17 @@ Running scripts</h3>
|
||||
Batch system</h2>
|
||||
<p>For the <b>phase_transition_mpi</b> program, there are scripts in the **./slurm_scripts** directory that come along with it. This is to be able to run it on a batch system using Slurm if you have access to one. The only program that should be executed by the user is the **./slurm_scripts/execute.script** script. You can see how to use this script by doing:</p>
|
||||
<div class="fragment"><div class="line">./slurm_scripts/execute.script --help</div>
|
||||
</div><!-- fragment --><p>This is the recommended way to use this program as it takes approximately 90 minutes to complete when using 8 processes where each process has 10 threads.</p>
|
||||
</div><!-- fragment --><p>This is the recommended way of using the program. Here is a table using different parameters on the Fox cluster:</p>
|
||||
<table class="markdownTable">
|
||||
<tr class="markdownTableHead">
|
||||
<th class="markdownTableHeadNone">Lattice size </th><th class="markdownTableHeadNone">Samples </th><th class="markdownTableHeadNone">Processes </th><th class="markdownTableHeadNone">threads </th><th class="markdownTableHeadNone">Time (seconds) </th></tr>
|
||||
<tr class="markdownTableRowOdd">
|
||||
<td class="markdownTableBodyNone">20 </td><td class="markdownTableBodyNone">1e7 </td><td class="markdownTableBodyNone">10 </td><td class="markdownTableBodyNone">10 </td><td class="markdownTableBodyNone">133.735 </td></tr>
|
||||
<tr class="markdownTableRowEven">
|
||||
<td class="markdownTableBodyNone">40 </td><td class="markdownTableBodyNone">1e7 </td><td class="markdownTableBodyNone">10 </td><td class="markdownTableBodyNone">10 </td><td class="markdownTableBodyNone">814.126 </td></tr>
|
||||
<tr class="markdownTableRowOdd">
|
||||
<td class="markdownTableBodyNone">60 </td><td class="markdownTableBodyNone">1e7 </td><td class="markdownTableBodyNone">10 </td><td class="markdownTableBodyNone">10 </td><td class="markdownTableBodyNone">2575.33 </td></tr>
|
||||
</table>
|
||||
<p>If you happen to have such a system available to you, then you should clone this repo on that system, then compile the MPI program like this:</p>
|
||||
<div class="fragment"><div class="line">make bin/phase_transition_mpi</div>
|
||||
</div><!-- fragment --><p>After compiling, you can schedule it by using the **./slurm_scripts/execute.script**:</p>
|
||||
|
||||
@ -119,7 +119,7 @@ Functions</h2></td></tr>
|
||||
<tr class="memdesc:a68406fc2dd8de5849c3984658c171f32"><td class="mdescLeft"> </td><td class="mdescRight">Create the data for the burn-in time for temperatures 1.0 and 2.4 for both unordered and ordered initial states. <br /></td></tr>
|
||||
<tr class="separator:a68406fc2dd8de5849c3984658c171f32"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a4f8ea24364d72024915d3753a572cc5b"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="main_8cpp.html#a4f8ea24364d72024915d3753a572cc5b">create_pd_estimate_data</a> ()</td></tr>
|
||||
<tr class="memdesc:a4f8ea24364d72024915d3753a572cc5b"><td class="mdescLeft"> </td><td class="mdescRight">Create the data used to estimate the probability distribution for tempratures 1.0 anbd 2.4. <br /></td></tr>
|
||||
<tr class="memdesc:a4f8ea24364d72024915d3753a572cc5b"><td class="mdescLeft"> </td><td class="mdescRight">Create the data used to estimate the probability distribution for tempratures 1.0 and 2.4. <br /></td></tr>
|
||||
<tr class="separator:a4f8ea24364d72024915d3753a572cc5b"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a746d8dc451b2b2536abbb1ff1acaf861"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="main_8cpp.html#a746d8dc451b2b2536abbb1ff1acaf861">test_burn_in_time</a> ()</td></tr>
|
||||
<tr class="memdesc:a746d8dc451b2b2536abbb1ff1acaf861"><td class="mdescLeft"> </td><td class="mdescRight">Create data using the same parameters except one uses burn-in time, while the other doesn't. <br /></td></tr>
|
||||
@ -183,7 +183,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Create the data used to estimate the probability distribution for tempratures 1.0 anbd 2.4. </p>
|
||||
<p>Create the data used to estimate the probability distribution for tempratures 1.0 and 2.4. </p>
|
||||
|
||||
<p class="definition">Definition at line <a class="el" href="main_8cpp_source.html#l00037">37</a> of file <a class="el" href="main_8cpp_source.html">main.cpp</a>.</p>
|
||||
|
||||
|
||||
@ -125,25 +125,25 @@ $(document).ready(function(){initNavTree('main_8cpp_source.html',''); initResiza
|
||||
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span>{</div>
|
||||
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> <span class="comment">// Test burn-in time</span></div>
|
||||
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> montecarlo::progression(1.0, 20, 20000,</div>
|
||||
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> <span class="stringliteral">"../output/burn_in_time/unordered_1_0.txt"</span>);</div>
|
||||
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> <span class="stringliteral">"./data/hp/burn_in_time/unordered_1_0.txt"</span>);</div>
|
||||
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span> montecarlo::progression(1.0, 20, 20000, 1,</div>
|
||||
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> <span class="stringliteral">"../output/burn_in_time/ordered_1_0.txt"</span>);</div>
|
||||
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> <span class="stringliteral">"./data/hp/burn_in_time/ordered_1_0.txt"</span>);</div>
|
||||
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span> montecarlo::progression(2.4, 20, 20000,</div>
|
||||
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span> <span class="stringliteral">"../output/burn_in_time/unordered_2_4.txt"</span>);</div>
|
||||
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span> <span class="stringliteral">"./data/hp/burn_in_time/unordered_2_4.txt"</span>);</div>
|
||||
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span> montecarlo::progression(2.4, 20, 20000, 1,</div>
|
||||
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> <span class="stringliteral">"../output/burn_in_time/ordered_2_4.txt"</span>);</div>
|
||||
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> <span class="stringliteral">"./data/hp/burn_in_time/ordered_2_4.txt"</span>);</div>
|
||||
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span>}</div>
|
||||
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> </div>
|
||||
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span><span class="comment">/** @brief Create the data used to estimate the probability distribution</span></div>
|
||||
<div class="line"><span class="lineno"> 35</span><span class="comment"> * for tempratures 1.0 anbd 2.4.</span></div>
|
||||
<div class="line"><span class="lineno"> 35</span><span class="comment"> * for tempratures 1.0 and 2.4.</span></div>
|
||||
<div class="line"><span class="lineno"> 36</span><span class="comment"> * */</span></div>
|
||||
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"><a class="line" href="main_8cpp.html#a4f8ea24364d72024915d3753a572cc5b"> 37</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="main_8cpp.html#a4f8ea24364d72024915d3753a572cc5b">create_pd_estimate_data</a>()</div>
|
||||
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span>{</div>
|
||||
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> <span class="comment">// Estimate pd</span></div>
|
||||
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> montecarlo<a class="code hl_function" href="monte__carlo_8hpp.html#aea2dd1b5fac7c45633bc6f8dc4541226">::</a><a class="code hl_function" href="monte__carlo_8hpp.html#aea2dd1b5fac7c45633bc6f8dc4541226">pd_estimate</a>(1.0, 20, 1000000,</div>
|
||||
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span> <span class="stringliteral">"../output/pd_estimate/estimate_1_0.txt"</span>);</div>
|
||||
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span> <span class="stringliteral">"./data/hp/pd_estimate/estimate_1_0.txt"</span>);</div>
|
||||
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> montecarlo<a class="code hl_function" href="monte__carlo_8hpp.html#aea2dd1b5fac7c45633bc6f8dc4541226">::</a><a class="code hl_function" href="monte__carlo_8hpp.html#aea2dd1b5fac7c45633bc6f8dc4541226">pd_estimate</a>(2.4, 20, 1000000,</div>
|
||||
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> <span class="stringliteral">"../output/pd_estimate/estimate_2_4.txt"</span>);</div>
|
||||
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> <span class="stringliteral">"./data/hp/pd_estimate/estimate_2_4.txt"</span>);</div>
|
||||
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span>}</div>
|
||||
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span> </div>
|
||||
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span><span class="comment">/** @brief Create data using the same parameters except one uses burn-in time,</span></div>
|
||||
@ -153,10 +153,10 @@ $(document).ready(function(){initNavTree('main_8cpp_source.html',''); initResiza
|
||||
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span>{</div>
|
||||
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> montecarlo<a class="code hl_function" href="monte__carlo_8hpp.html#a34e9c3e24f26760693266b8a7b6b3d21">::</a><a class="code hl_function" href="monte__carlo_8hpp.html#a34e9c3e24f26760693266b8a7b6b3d21">phase_transition</a>(</div>
|
||||
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> 100, 2.1, 2.4, 40, 1e5, montecarlo<a class="code hl_function" href="monte__carlo_8hpp.html#ae67483ff00d1b0594d543261c8283ffd">::</a><a class="code hl_function" href="monte__carlo_8hpp.html#ae67483ff00d1b0594d543261c8283ffd">mcmc_serial</a>,</div>
|
||||
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> <span class="stringliteral">"../output/test_burn_in_time/burn_in.txt"</span>, 5000);</div>
|
||||
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> <span class="stringliteral">"./data/hp/test_burn_in_time/burn_in.txt"</span>, 5000);</div>
|
||||
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> montecarlo<a class="code hl_function" href="monte__carlo_8hpp.html#a34e9c3e24f26760693266b8a7b6b3d21">::</a><a class="code hl_function" href="monte__carlo_8hpp.html#a34e9c3e24f26760693266b8a7b6b3d21">phase_transition</a>(</div>
|
||||
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span> 100, 2.1, 2.4, 40, 1e5, montecarlo<a class="code hl_function" href="monte__carlo_8hpp.html#ae67483ff00d1b0594d543261c8283ffd">::</a><a class="code hl_function" href="monte__carlo_8hpp.html#ae67483ff00d1b0594d543261c8283ffd">mcmc_serial</a>,</div>
|
||||
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> <span class="stringliteral">"../output/test_burn_in_time/no_burn_in.txt"</span>, 0);</div>
|
||||
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> <span class="stringliteral">"./data/hp/test_burn_in_time/no_burn_in.txt"</span>, 0);</div>
|
||||
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span>}</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="comment">/** @brief Test how much Openmp speeds up.*/</span></div>
|
||||
@ -191,19 +191,19 @@ $(document).ready(function(){initNavTree('main_8cpp_source.html',''); initResiza
|
||||
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span> <span class="comment">// Phase transition</span></div>
|
||||
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span> montecarlo<a class="code hl_function" href="monte__carlo_8hpp.html#a34e9c3e24f26760693266b8a7b6b3d21">::</a><a class="code hl_function" href="monte__carlo_8hpp.html#a34e9c3e24f26760693266b8a7b6b3d21">phase_transition</a>(20, 2.1, 2.4, 40, 1e4,</div>
|
||||
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span> montecarlo<a class="code hl_function" href="monte__carlo_8hpp.html#ae1e7f904ecfc3d8f3c4dd1ef155dd771">::</a><a class="code hl_function" href="monte__carlo_8hpp.html#ae1e7f904ecfc3d8f3c4dd1ef155dd771">mcmc_parallel</a>,</div>
|
||||
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span> <span class="stringliteral">"../output/phase_transition/size_20.txt"</span>);</div>
|
||||
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span> <span class="stringliteral">"./data/hp/phase_transition/size_20.txt"</span>);</div>
|
||||
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"> 92</span> montecarlo<a class="code hl_function" href="monte__carlo_8hpp.html#a34e9c3e24f26760693266b8a7b6b3d21">::</a><a class="code hl_function" href="monte__carlo_8hpp.html#a34e9c3e24f26760693266b8a7b6b3d21">phase_transition</a>(40, 2.1, 2.4, 40, 1e4,</div>
|
||||
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span> montecarlo<a class="code hl_function" href="monte__carlo_8hpp.html#ae1e7f904ecfc3d8f3c4dd1ef155dd771">::</a><a class="code hl_function" href="monte__carlo_8hpp.html#ae1e7f904ecfc3d8f3c4dd1ef155dd771">mcmc_parallel</a>,</div>
|
||||
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span> <span class="stringliteral">"../output/phase_transition/size_40.txt"</span>);</div>
|
||||
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span> <span class="stringliteral">"./data/hp/phase_transition/size_40.txt"</span>);</div>
|
||||
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"> 95</span> montecarlo<a class="code hl_function" href="monte__carlo_8hpp.html#a34e9c3e24f26760693266b8a7b6b3d21">::</a><a class="code hl_function" href="monte__carlo_8hpp.html#a34e9c3e24f26760693266b8a7b6b3d21">phase_transition</a>(60, 2.1, 2.4, 40, 1e4,</div>
|
||||
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno"> 96</span> montecarlo<a class="code hl_function" href="monte__carlo_8hpp.html#ae1e7f904ecfc3d8f3c4dd1ef155dd771">::</a><a class="code hl_function" href="monte__carlo_8hpp.html#ae1e7f904ecfc3d8f3c4dd1ef155dd771">mcmc_parallel</a>,</div>
|
||||
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno"> 97</span> <span class="stringliteral">"../output/phase_transition/size_60.txt"</span>);</div>
|
||||
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno"> 97</span> <span class="stringliteral">"./data/hp/phase_transition/size_60.txt"</span>);</div>
|
||||
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno"> 98</span> montecarlo<a class="code hl_function" href="monte__carlo_8hpp.html#a34e9c3e24f26760693266b8a7b6b3d21">::</a><a class="code hl_function" href="monte__carlo_8hpp.html#a34e9c3e24f26760693266b8a7b6b3d21">phase_transition</a>(80, 2.1, 2.4, 40, 1e4,</div>
|
||||
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"> 99</span> montecarlo<a class="code hl_function" href="monte__carlo_8hpp.html#ae1e7f904ecfc3d8f3c4dd1ef155dd771">::</a><a class="code hl_function" href="monte__carlo_8hpp.html#ae1e7f904ecfc3d8f3c4dd1ef155dd771">mcmc_parallel</a>,</div>
|
||||
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"> 100</span> <span class="stringliteral">"../output/phase_transition/size_80.txt"</span>);</div>
|
||||
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"> 100</span> <span class="stringliteral">"./data/hp/phase_transition/size_80.txt"</span>);</div>
|
||||
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno"> 101</span> montecarlo<a class="code hl_function" href="monte__carlo_8hpp.html#a34e9c3e24f26760693266b8a7b6b3d21">::</a><a class="code hl_function" href="monte__carlo_8hpp.html#a34e9c3e24f26760693266b8a7b6b3d21">phase_transition</a>(100, 2.1, 2.4, 40, 1e4,</div>
|
||||
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno"> 102</span> montecarlo<a class="code hl_function" href="monte__carlo_8hpp.html#ae1e7f904ecfc3d8f3c4dd1ef155dd771">::</a><a class="code hl_function" href="monte__carlo_8hpp.html#ae1e7f904ecfc3d8f3c4dd1ef155dd771">mcmc_parallel</a>,</div>
|
||||
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"> 103</span> <span class="stringliteral">"../output/phase_transition/size_100.txt"</span>);</div>
|
||||
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"> 103</span> <span class="stringliteral">"./data/hp/phase_transition/size_100.txt"</span>);</div>
|
||||
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"> 104</span> t1 = omp_get_wtime();</div>
|
||||
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span> </div>
|
||||
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span> std::cout << <span class="stringliteral">"Time: "</span> << t1 - t0 << std::endl;</div>
|
||||
@ -281,15 +281,15 @@ $(document).ready(function(){initNavTree('main_8cpp_source.html',''); initResiza
|
||||
<div class="ttc" id="aclassdata__t_html"><div class="ttname"><a href="classdata__t.html">data_t</a></div><div class="ttdoc">Type to use with the IsingModel class and montecarlo module.</div><div class="ttdef"><b>Definition:</b> <a href="data__type_8hpp_source.html#l00019">data_type.hpp:19</a></div></div>
|
||||
<div class="ttc" id="amain_8cpp_html_a0dfa85080578dffff23b68e372cece95"><div class="ttname"><a href="main_8cpp.html#a0dfa85080578dffff23b68e372cece95">test_parallel_speedup</a></div><div class="ttdeci">void test_parallel_speedup()</div><div class="ttdoc">Test how much Openmp speeds up.</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00060">main.cpp:60</a></div></div>
|
||||
<div class="ttc" id="amain_8cpp_html_a3c04138a5bfe5d72780bb7e82a18e627"><div class="ttname"><a href="main_8cpp.html#a3c04138a5bfe5d72780bb7e82a18e627">main</a></div><div class="ttdeci">int main(int argc, char **argv)</div><div class="ttdoc">The main function.</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00125">main.cpp:125</a></div></div>
|
||||
<div class="ttc" id="amain_8cpp_html_a4f8ea24364d72024915d3753a572cc5b"><div class="ttname"><a href="main_8cpp.html#a4f8ea24364d72024915d3753a572cc5b">create_pd_estimate_data</a></div><div class="ttdeci">void create_pd_estimate_data()</div><div class="ttdoc">Create the data used to estimate the probability distribution for tempratures 1.0 anbd 2....</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00037">main.cpp:37</a></div></div>
|
||||
<div class="ttc" id="amain_8cpp_html_a4f8ea24364d72024915d3753a572cc5b"><div class="ttname"><a href="main_8cpp.html#a4f8ea24364d72024915d3753a572cc5b">create_pd_estimate_data</a></div><div class="ttdeci">void create_pd_estimate_data()</div><div class="ttdoc">Create the data used to estimate the probability distribution for tempratures 1.0 and 2....</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00037">main.cpp:37</a></div></div>
|
||||
<div class="ttc" id="amain_8cpp_html_a68406fc2dd8de5849c3984658c171f32"><div class="ttname"><a href="main_8cpp.html#a68406fc2dd8de5849c3984658c171f32">create_burn_in_time_data</a></div><div class="ttdeci">void create_burn_in_time_data()</div><div class="ttdoc">Create the data for the burn-in time for temperatures 1.0 and 2.4 for both unordered and ordered init...</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00021">main.cpp:21</a></div></div>
|
||||
<div class="ttc" id="amain_8cpp_html_a746d8dc451b2b2536abbb1ff1acaf861"><div class="ttname"><a href="main_8cpp.html#a746d8dc451b2b2536abbb1ff1acaf861">test_burn_in_time</a></div><div class="ttdeci">void test_burn_in_time()</div><div class="ttdoc">Create data using the same parameters except one uses burn-in time, while the other doesn't.</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00049">main.cpp:49</a></div></div>
|
||||
<div class="ttc" id="amain_8cpp_html_a9d62cf1399596f4c5a39abdd3196d76d"><div class="ttname"><a href="main_8cpp.html#a9d62cf1399596f4c5a39abdd3196d76d">create_phase_transition_data</a></div><div class="ttdeci">void create_phase_transition_data()</div><div class="ttdoc">Create data for studying phase transition.</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00083">main.cpp:83</a></div></div>
|
||||
<div class="ttc" id="amain_8cpp_html_ac907e18135856c90366aaa599a9e10b1"><div class="ttname"><a href="main_8cpp.html#ac907e18135856c90366aaa599a9e10b1">usage</a></div><div class="ttdeci">void usage(std::string filename)</div><div class="ttdoc">A function that displays how to use the program and quits.</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00110">main.cpp:110</a></div></div>
|
||||
<div class="ttc" id="amonte__carlo_8hpp_html_a34e9c3e24f26760693266b8a7b6b3d21"><div class="ttname"><a href="monte__carlo_8hpp.html#a34e9c3e24f26760693266b8a7b6b3d21">montecarlo::phase_transition</a></div><div class="ttdeci">void phase_transition(int L, double start_T, double end_T, int points_T, int cycles, std::function< data_t(int, double, int, int)> monte_carlo, std::string outfile, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Perform the MCMC algorithm using a range of temperatures.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00169">monte_carlo.cpp:169</a></div></div>
|
||||
<div class="ttc" id="amonte__carlo_8hpp_html_ae1e7f904ecfc3d8f3c4dd1ef155dd771"><div class="ttname"><a href="monte__carlo_8hpp.html#ae1e7f904ecfc3d8f3c4dd1ef155dd771">montecarlo::mcmc_parallel</a></div><div class="ttdeci">data_t mcmc_parallel(int L, double T, int cycles, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Execute the Metropolis algorithm for a certain amount of Monte Carlo cycles in parallel.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00141">monte_carlo.cpp:141</a></div></div>
|
||||
<div class="ttc" id="amonte__carlo_8hpp_html_ae67483ff00d1b0594d543261c8283ffd"><div class="ttname"><a href="monte__carlo_8hpp.html#ae67483ff00d1b0594d543261c8283ffd">montecarlo::mcmc_serial</a></div><div class="ttdeci">data_t mcmc_serial(int L, double T, int cycles, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Execute the Metropolis algorithm for a certain amount of Monte Carlo cycles.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00122">monte_carlo.cpp:122</a></div></div>
|
||||
<div class="ttc" id="amonte__carlo_8hpp_html_aea2dd1b5fac7c45633bc6f8dc4541226"><div class="ttname"><a href="monte__carlo_8hpp.html#aea2dd1b5fac7c45633bc6f8dc4541226">montecarlo::pd_estimate</a></div><div class="ttdeci">void pd_estimate(double T, int L, int cycles, const std::string filename, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Estimate the probability distribution for the energy.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00091">monte_carlo.cpp:91</a></div></div>
|
||||
<div class="ttc" id="amonte__carlo_8hpp_html_a34e9c3e24f26760693266b8a7b6b3d21"><div class="ttname"><a href="monte__carlo_8hpp.html#a34e9c3e24f26760693266b8a7b6b3d21">montecarlo::phase_transition</a></div><div class="ttdeci">void phase_transition(int L, double start_T, double end_T, int points_T, int cycles, std::function< data_t(int, double, int, int)> monte_carlo, std::string outfile, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Perform the MCMC algorithm using a range of temperatures.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00155">monte_carlo.cpp:155</a></div></div>
|
||||
<div class="ttc" id="amonte__carlo_8hpp_html_ae1e7f904ecfc3d8f3c4dd1ef155dd771"><div class="ttname"><a href="monte__carlo_8hpp.html#ae1e7f904ecfc3d8f3c4dd1ef155dd771">montecarlo::mcmc_parallel</a></div><div class="ttdeci">data_t mcmc_parallel(int L, double T, int cycles, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Execute the Metropolis algorithm for a certain amount of Monte Carlo cycles in parallel.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00127">monte_carlo.cpp:127</a></div></div>
|
||||
<div class="ttc" id="amonte__carlo_8hpp_html_ae67483ff00d1b0594d543261c8283ffd"><div class="ttname"><a href="monte__carlo_8hpp.html#ae67483ff00d1b0594d543261c8283ffd">montecarlo::mcmc_serial</a></div><div class="ttdeci">data_t mcmc_serial(int L, double T, int cycles, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Execute the Metropolis algorithm for a certain amount of Monte Carlo cycles.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00108">monte_carlo.cpp:108</a></div></div>
|
||||
<div class="ttc" id="amonte__carlo_8hpp_html_aea2dd1b5fac7c45633bc6f8dc4541226"><div class="ttname"><a href="monte__carlo_8hpp.html#aea2dd1b5fac7c45633bc6f8dc4541226">montecarlo::pd_estimate</a></div><div class="ttdeci">void pd_estimate(double T, int L, int cycles, const std::string filename, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Estimate the probability distribution for the energy.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00077">monte_carlo.cpp:77</a></div></div>
|
||||
</div><!-- fragment --></div><!-- contents -->
|
||||
</div><!-- doc-content -->
|
||||
<!-- start footer part -->
|
||||
|
||||
@ -135,52 +135,67 @@ $(document).ready(function(){initNavTree('mcmc__progression_8cpp_source.html',''
|
||||
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"><a class="line" href="mcmc__progression_8cpp.html#a3c04138a5bfe5d72780bb7e82a18e627"> 32</a></span><span class="keywordtype">int</span> <a class="code hl_function" href="main_8cpp.html#a3c04138a5bfe5d72780bb7e82a18e627">main</a>(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> **argv)</div>
|
||||
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span>{</div>
|
||||
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span> <span class="comment">// Command options</span></div>
|
||||
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> <span class="keyword">struct</span> option long_options[] = {{<span class="stringliteral">"help"</span>, 0, 0, 0}, {NULL, 0, NULL, 0}};</div>
|
||||
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> </div>
|
||||
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> <span class="keywordtype">int</span> option_index = -1;</div>
|
||||
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> <span class="keywordtype">int</span> c;</div>
|
||||
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> </div>
|
||||
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> <span class="keywordflow">while</span> (<span class="keyword">true</span>) {</div>
|
||||
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span> c = getopt_long(argc, argv, <span class="stringliteral">"h"</span>, long_options, &option_index);</div>
|
||||
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> </div>
|
||||
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> <span class="keywordflow">if</span> (c == -1)</div>
|
||||
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> <span class="keywordflow">break</span>;</div>
|
||||
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span> </div>
|
||||
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span> <span class="keywordflow">switch</span> (c) {</div>
|
||||
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span> <span class="keywordflow">case</span> 0:</div>
|
||||
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> <span class="keywordflow">switch</span> (option_index) {</div>
|
||||
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> <span class="keywordflow">case</span> 0: <span class="comment">// Not a mistake. This just goes to the default.</span></div>
|
||||
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> <span class="keywordflow">default</span>:</div>
|
||||
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> usage(argv[0]);</div>
|
||||
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> }</div>
|
||||
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> <span class="keywordflow">break</span>;</div>
|
||||
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> <span class="keywordflow">case</span> <span class="stringliteral">'h'</span>:</div>
|
||||
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span> <span class="keywordflow">default</span>:</div>
|
||||
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> usage(argv[0]);</div>
|
||||
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> }</div>
|
||||
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> <span class="keyword">struct</span> option long_options[] = {</div>
|
||||
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> {<span class="stringliteral">"help"</span>, 0, 0, 0}, {NULL, 0, NULL, 0}};</div>
|
||||
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> </div>
|
||||
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> <span class="keywordtype">int</span> option_index = -1;</div>
|
||||
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> <span class="keywordtype">int</span> c;</div>
|
||||
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> </div>
|
||||
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span> <span class="keywordflow">while</span> (<span class="keyword">true</span>) {</div>
|
||||
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> c = getopt_long(argc, argv, <span class="stringliteral">"h"</span>, long_options, &option_index);</div>
|
||||
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> </div>
|
||||
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> <span class="keywordflow">if</span> (c == -1)</div>
|
||||
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span> <span class="keywordflow">break</span>;</div>
|
||||
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span> </div>
|
||||
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span> <span class="keywordflow">switch</span> (c) {</div>
|
||||
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> <span class="keywordflow">case</span> 0:</div>
|
||||
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> <span class="keywordflow">switch</span> (option_index) {</div>
|
||||
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> <span class="keywordflow">case</span> 0: <span class="comment">// Not a mistake. This just goes to the default.</span></div>
|
||||
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> <span class="keywordflow">default</span>:</div>
|
||||
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> usage(argv[0]);</div>
|
||||
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> }</div>
|
||||
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> <span class="keywordflow">break</span>;</div>
|
||||
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span> <span class="keywordflow">case</span> <span class="stringliteral">'h'</span>:</div>
|
||||
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> <span class="keywordflow">default</span>:</div>
|
||||
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> usage(argv[0]);</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="comment">// Check that the number of arguments is at least 8.</span></div>
|
||||
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> <span class="keywordflow">if</span> (argc < 6) {</div>
|
||||
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> usage(argv[0]);</div>
|
||||
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> }</div>
|
||||
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> </div>
|
||||
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> <span class="comment">// Timing variables</span></div>
|
||||
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> <span class="keywordtype">double</span> t0, t1;</div>
|
||||
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span> t0 = omp_get_wtime();</div>
|
||||
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span> </div>
|
||||
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span> <span class="comment">// Define/initialize variables</span></div>
|
||||
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> <span class="keywordtype">double</span> temp = atoi(argv[1]);</div>
|
||||
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span> <span class="keywordtype">int</span> L = atoi(argv[2]), cycles = atoi(argv[3]), burn_in_time = atoi(argv[4]);</div>
|
||||
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span> std::string outfile = argv[5];</div>
|
||||
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span> </div>
|
||||
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> montecarlo::progression(temp, L, cycles, outfile, burn_in_time);</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="comment">// Check that the number of arguments is at least 6.</span></div>
|
||||
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> <span class="keywordflow">if</span> (argc < 6) {</div>
|
||||
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> usage(argv[0]);</div>
|
||||
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> }</div>
|
||||
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> </div>
|
||||
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> <span class="keywordtype">bool</span> ordered = <span class="keyword">false</span>;</div>
|
||||
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span> </div>
|
||||
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span> <span class="keywordflow">if</span> (argc == 7) {</div>
|
||||
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span> ordered = <span class="keyword">true</span>;</div>
|
||||
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> }</div>
|
||||
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span> </div>
|
||||
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span> <span class="comment">// Timing variables</span></div>
|
||||
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span> <span class="keywordtype">double</span> t0, t1;</div>
|
||||
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> t0 = omp_get_wtime();</div>
|
||||
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span> </div>
|
||||
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span> t1 = omp_get_wtime();</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> std::cout << <span class="stringliteral">"Time: "</span> << t1 - t0 << <span class="stringliteral">" seconds\n"</span>;</div>
|
||||
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span>}</div>
|
||||
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span> <span class="comment">// Define/initialize variables</span></div>
|
||||
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> <span class="keywordtype">double</span> temp = atoi(argv[1]);</div>
|
||||
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> <span class="keywordtype">int</span> L = atoi(argv[2]), cycles = atoi(argv[3]), burn_in_time = atoi(argv[4]);</div>
|
||||
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> std::string outfile = argv[5];</div>
|
||||
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> </div>
|
||||
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> <span class="keywordflow">if</span> (ordered) {</div>
|
||||
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> <a class="code hl_define" href="utils_8hpp.html#aecc1f7a8a2493b9e021e5bff76a00a5b">DEBUG</a>(<span class="stringliteral">"Hello"</span>);</div>
|
||||
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span> montecarlo<a class="code hl_function" href="monte__carlo_8hpp.html#a1549fc386bd3cdd1cdbe0261b9dd8415">::</a><a class="code hl_function" href="monte__carlo_8hpp.html#a1549fc386bd3cdd1cdbe0261b9dd8415">progression</a><a class="code hl_function" href="monte__carlo_8hpp.html#a1549fc386bd3cdd1cdbe0261b9dd8415">(</a>temp<a class="code hl_function" href="monte__carlo_8hpp.html#a1549fc386bd3cdd1cdbe0261b9dd8415">,</a> L<a class="code hl_function" href="monte__carlo_8hpp.html#a1549fc386bd3cdd1cdbe0261b9dd8415">,</a> cycles<a class="code hl_function" href="monte__carlo_8hpp.html#a1549fc386bd3cdd1cdbe0261b9dd8415">,</a> 1<a class="code hl_function" href="monte__carlo_8hpp.html#a1549fc386bd3cdd1cdbe0261b9dd8415">,</a> outfile<a class="code hl_function" href="monte__carlo_8hpp.html#a1549fc386bd3cdd1cdbe0261b9dd8415">,</a> burn_in_time<a class="code hl_function" href="monte__carlo_8hpp.html#a1549fc386bd3cdd1cdbe0261b9dd8415">)</a>;</div>
|
||||
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span> }</div>
|
||||
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span> <span class="keywordflow">else</span> {</div>
|
||||
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span> montecarlo::progression(temp, L, cycles, outfile, burn_in_time);</div>
|
||||
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno"> 86</span> }</div>
|
||||
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno"> 87</span> </div>
|
||||
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span> t1 = omp_get_wtime();</div>
|
||||
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span> </div>
|
||||
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span> std::cout << <span class="stringliteral">"Time: "</span> << t1 - t0 << <span class="stringliteral">" seconds\n"</span>;</div>
|
||||
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span>}</div>
|
||||
<div class="ttc" id="amain_8cpp_html_a3c04138a5bfe5d72780bb7e82a18e627"><div class="ttname"><a href="main_8cpp.html#a3c04138a5bfe5d72780bb7e82a18e627">main</a></div><div class="ttdeci">int main(int argc, char **argv)</div><div class="ttdoc">The main function.</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00125">main.cpp:125</a></div></div>
|
||||
<div class="ttc" id="amain_8cpp_html_ac907e18135856c90366aaa599a9e10b1"><div class="ttname"><a href="main_8cpp.html#ac907e18135856c90366aaa599a9e10b1">usage</a></div><div class="ttdeci">void usage(std::string filename)</div><div class="ttdoc">A function that displays how to use the program and quits.</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00110">main.cpp:110</a></div></div>
|
||||
<div class="ttc" id="amonte__carlo_8hpp_html_a1549fc386bd3cdd1cdbe0261b9dd8415"><div class="ttname"><a href="monte__carlo_8hpp.html#a1549fc386bd3cdd1cdbe0261b9dd8415">montecarlo::progression</a></div><div class="ttdeci">void progression(double T, int L, int cycles, int value, const std::string filename, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Write the expected values for each Monte Carlo cycles to file.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00046">monte_carlo.cpp:46</a></div></div>
|
||||
<div class="ttc" id="autils_8hpp_html_aecc1f7a8a2493b9e021e5bff76a00a5b"><div class="ttname"><a href="utils_8hpp.html#aecc1f7a8a2493b9e021e5bff76a00a5b">DEBUG</a></div><div class="ttdeci">#define DEBUG(msg)</div><div class="ttdoc">Writes a debug message.</div><div class="ttdef"><b>Definition:</b> <a href="utils_8hpp_source.html#l00039">utils.hpp:39</a></div></div>
|
||||
</div><!-- fragment --></div><!-- contents -->
|
||||
</div><!-- doc-content -->
|
||||
<!-- start footer part -->
|
||||
|
||||
@ -191,7 +191,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
|
||||
</dl>
|
||||
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="classdata__t.html" title="Type to use with the IsingModel class and montecarlo module.">data_t</a> </dd></dl>
|
||||
|
||||
<p class="definition">Definition at line <a class="el" href="monte__carlo_8cpp_source.html#l00141">141</a> of file <a class="el" href="monte__carlo_8cpp_source.html">monte_carlo.cpp</a>.</p>
|
||||
<p class="definition">Definition at line <a class="el" href="monte__carlo_8cpp_source.html#l00127">127</a> of file <a class="el" href="monte__carlo_8cpp_source.html">monte_carlo.cpp</a>.</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@ -245,7 +245,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
|
||||
</dl>
|
||||
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="classdata__t.html" title="Type to use with the IsingModel class and montecarlo module.">data_t</a> </dd></dl>
|
||||
|
||||
<p class="definition">Definition at line <a class="el" href="monte__carlo_8cpp_source.html#l00122">122</a> of file <a class="el" href="monte__carlo_8cpp_source.html">monte_carlo.cpp</a>.</p>
|
||||
<p class="definition">Definition at line <a class="el" href="monte__carlo_8cpp_source.html#l00108">108</a> of file <a class="el" href="monte__carlo_8cpp_source.html">monte_carlo.cpp</a>.</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@ -305,7 +305,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<p class="definition">Definition at line <a class="el" href="monte__carlo_8cpp_source.html#l00091">91</a> of file <a class="el" href="monte__carlo_8cpp_source.html">monte_carlo.cpp</a>.</p>
|
||||
<p class="definition">Definition at line <a class="el" href="monte__carlo_8cpp_source.html#l00077">77</a> of file <a class="el" href="monte__carlo_8cpp_source.html">monte_carlo.cpp</a>.</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@ -385,7 +385,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<p class="definition">Definition at line <a class="el" href="monte__carlo_8cpp_source.html#l00169">169</a> of file <a class="el" href="monte__carlo_8cpp_source.html">monte_carlo.cpp</a>.</p>
|
||||
<p class="definition">Definition at line <a class="el" href="monte__carlo_8cpp_source.html#l00155">155</a> of file <a class="el" href="monte__carlo_8cpp_source.html">monte_carlo.cpp</a>.</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@ -512,7 +512,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<p class="definition">Definition at line <a class="el" href="monte__carlo_8cpp_source.html#l00053">53</a> of file <a class="el" href="monte__carlo_8cpp_source.html">monte_carlo.cpp</a>.</p>
|
||||
<p class="definition">Definition at line <a class="el" href="monte__carlo_8cpp_source.html#l00046">46</a> of file <a class="el" href="monte__carlo_8cpp_source.html">monte_carlo.cpp</a>.</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -126,180 +126,166 @@ $(document).ready(function(){initNavTree('monte__carlo_8cpp_source.html',''); in
|
||||
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> std::string directory = utils<a class="code hl_function" href="utils_8hpp.html#aed026119193a9bbe076671809ff0f430">::</a><a class="code hl_function" href="utils_8hpp.html#aed026119193a9bbe076671809ff0f430">dirname</a><a class="code hl_function" href="utils_8hpp.html#aed026119193a9bbe076671809ff0f430">(</a>filename<a class="code hl_function" href="utils_8hpp.html#aed026119193a9bbe076671809ff0f430">)</a>;</div>
|
||||
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> std::ofstream ofile;</div>
|
||||
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> </div>
|
||||
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span> <span class="comment">// Create random engine using the mersenne twister</span></div>
|
||||
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> std::random_device rd;</div>
|
||||
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span> uint32_t rd_sample = rd();</div>
|
||||
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span> std::mt19937 engine(rd_sample);</div>
|
||||
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span> </div>
|
||||
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> std::cout << <span class="stringliteral">"Seed: "</span> << rd_sample << std::endl;</div>
|
||||
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span> </div>
|
||||
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> <a class="code hl_class" href="classIsingModel.html">IsingModel</a> ising<a class="code hl_function" href="classIsingModel.html#a4a39ee7fbfbbf566f75bc28900ca9ea5">(</a>L<a class="code hl_function" href="classIsingModel.html#a4a39ee7fbfbbf566f75bc28900ca9ea5">,</a> T<a class="code hl_function" href="classIsingModel.html#a4a39ee7fbfbbf566f75bc28900ca9ea5">)</a>;</div>
|
||||
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span> </div>
|
||||
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> <span class="comment">// Create path and open file</span></div>
|
||||
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> utils<a class="code hl_function" href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">::</a><a class="code hl_function" href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">mkpath</a><a class="code hl_function" href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">(</a>directory<a class="code hl_function" href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">)</a>;</div>
|
||||
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> ofile.open(filename);</div>
|
||||
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> </div>
|
||||
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> <span class="keywordflow">for</span> (size_t i = 0; i < burn_in_time; i++) {</div>
|
||||
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> ising<a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">.</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">Metropolis</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">(</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">)</a>;</div>
|
||||
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span> }</div>
|
||||
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> </div>
|
||||
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> <span class="comment">// Loop through cycles</span></div>
|
||||
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> <span class="keywordflow">for</span> (size_t i = 1; i <= cycles; i++) {</div>
|
||||
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span> data <a class="code hl_function" href="classdata__t.html#a6cb96b4ff750ab29041038ca53f307cb">+=</a> ising<a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">.</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">Metropolis</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">(</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">)</a>;</div>
|
||||
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span> tmp = data / (i * n_spins);</div>
|
||||
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span> ofile << i << <span class="stringliteral">','</span> << tmp<a class="code hl_variable" href="classdata__t.html#a6c1a196d96e177b11ca98c61fae35a2e">.</a><a class="code hl_variable" href="classdata__t.html#a6c1a196d96e177b11ca98c61fae35a2e">E</a> << <span class="stringliteral">','</span> << tmp<a class="code hl_variable" href="classdata__t.html#abb622f9c6cc5ffb9dddb151d2e202f72">.</a><a class="code hl_variable" href="classdata__t.html#abb622f9c6cc5ffb9dddb151d2e202f72">E2</a> << <span class="stringliteral">','</span> << tmp<a class="code hl_variable" href="classdata__t.html#ad08d2488bf913c626157471cf6e8a46a">.</a><a class="code hl_variable" href="classdata__t.html#ad08d2488bf913c626157471cf6e8a46a">M</a> << <span class="stringliteral">','</span></div>
|
||||
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> << tmp<a class="code hl_variable" href="classdata__t.html#a71ae3cd4460f2c66239500c11804e70b">.</a><a class="code hl_variable" href="classdata__t.html#a71ae3cd4460f2c66239500c11804e70b">M2</a> << <span class="stringliteral">','</span> << tmp<a class="code hl_variable" href="classdata__t.html#a586475e0f71322dffda2e75f228ab24b">.</a><a class="code hl_variable" href="classdata__t.html#a586475e0f71322dffda2e75f228ab24b">M_abs</a> << <span class="stringliteral">'\n'</span>;</div>
|
||||
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> }</div>
|
||||
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> ofile.close();</div>
|
||||
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span>}</div>
|
||||
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span> <a class="code hl_class" href="classIsingModel.html">IsingModel</a> ising<a class="code hl_function" href="classIsingModel.html#a4a39ee7fbfbbf566f75bc28900ca9ea5">(</a>L<a class="code hl_function" href="classIsingModel.html#a4a39ee7fbfbbf566f75bc28900ca9ea5">,</a> T<a class="code hl_function" href="classIsingModel.html#a4a39ee7fbfbbf566f75bc28900ca9ea5">)</a>;</div>
|
||||
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> </div>
|
||||
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span> <span class="comment">// Create path and open file</span></div>
|
||||
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span> utils<a class="code hl_function" href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">::</a><a class="code hl_function" href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">mkpath</a><a class="code hl_function" href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">(</a>directory<a class="code hl_function" href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">)</a>;</div>
|
||||
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span> ofile.open(filename);</div>
|
||||
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> </div>
|
||||
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span> <span class="keywordflow">for</span> (size_t i = 0; i < burn_in_time; i++) {</div>
|
||||
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> ising<a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">.</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">Metropolis</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">(</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">)</a>;</div>
|
||||
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span> }</div>
|
||||
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> </div>
|
||||
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> <span class="comment">// Loop through cycles</span></div>
|
||||
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> <span class="keywordflow">for</span> (size_t i = 1; i <= cycles; i++) {</div>
|
||||
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> data <a class="code hl_function" href="classdata__t.html#a6cb96b4ff750ab29041038ca53f307cb">+=</a> ising<a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">.</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">Metropolis</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">(</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">)</a>;</div>
|
||||
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> tmp = data / (i * n_spins);</div>
|
||||
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> ofile << i << <span class="stringliteral">','</span> << tmp<a class="code hl_variable" href="classdata__t.html#a6c1a196d96e177b11ca98c61fae35a2e">.</a><a class="code hl_variable" href="classdata__t.html#a6c1a196d96e177b11ca98c61fae35a2e">E</a> << <span class="stringliteral">','</span> << tmp<a class="code hl_variable" href="classdata__t.html#abb622f9c6cc5ffb9dddb151d2e202f72">.</a><a class="code hl_variable" href="classdata__t.html#abb622f9c6cc5ffb9dddb151d2e202f72">E2</a> << <span class="stringliteral">','</span> << tmp<a class="code hl_variable" href="classdata__t.html#ad08d2488bf913c626157471cf6e8a46a">.</a><a class="code hl_variable" href="classdata__t.html#ad08d2488bf913c626157471cf6e8a46a">M</a> << <span class="stringliteral">','</span></div>
|
||||
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span> << tmp<a class="code hl_variable" href="classdata__t.html#a71ae3cd4460f2c66239500c11804e70b">.</a><a class="code hl_variable" href="classdata__t.html#a71ae3cd4460f2c66239500c11804e70b">M2</a> << <span class="stringliteral">','</span> << tmp<a class="code hl_variable" href="classdata__t.html#a586475e0f71322dffda2e75f228ab24b">.</a><a class="code hl_variable" href="classdata__t.html#a586475e0f71322dffda2e75f228ab24b">M_abs</a> << <span class="stringliteral">'\n'</span>;</div>
|
||||
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> }</div>
|
||||
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> ofile.close();</div>
|
||||
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span>}</div>
|
||||
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span> </div>
|
||||
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"><a class="line" href="monte__carlo_8hpp.html#a1549fc386bd3cdd1cdbe0261b9dd8415"> 46</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="monte__carlo_8hpp.html#a1549fc386bd3cdd1cdbe0261b9dd8415">progression</a>(<span class="keywordtype">double</span> T, <span class="keywordtype">int</span> L, <span class="keywordtype">int</span> cycles, <span class="keywordtype">int</span> value,</div>
|
||||
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span> <span class="keyword">const</span> std::string filename, <span class="keywordtype">int</span> burn_in_time)</div>
|
||||
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span>{</div>
|
||||
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> <span class="comment">// Set some variables</span></div>
|
||||
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> <a class="code hl_class" href="classdata__t.html">data_t</a> data, tmp;</div>
|
||||
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> <span class="keywordtype">int</span> n_spins = L * L;</div>
|
||||
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> </div>
|
||||
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"><a class="line" href="monte__carlo_8hpp.html#a1549fc386bd3cdd1cdbe0261b9dd8415"> 53</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="monte__carlo_8hpp.html#a1549fc386bd3cdd1cdbe0261b9dd8415">progression</a>(<span class="keywordtype">double</span> T, <span class="keywordtype">int</span> L, <span class="keywordtype">int</span> cycles, <span class="keywordtype">int</span> value,</div>
|
||||
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> <span class="keyword">const</span> std::string filename, <span class="keywordtype">int</span> burn_in_time)</div>
|
||||
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span>{</div>
|
||||
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> <span class="comment">// Set some variables</span></div>
|
||||
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> <a class="code hl_class" href="classdata__t.html">data_t</a> data, tmp;</div>
|
||||
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span> <span class="keywordtype">int</span> n_spins = L * L;</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="comment">// File stuff</span></div>
|
||||
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> std::string directory = utils<a class="code hl_function" href="utils_8hpp.html#aed026119193a9bbe076671809ff0f430">::</a><a class="code hl_function" href="utils_8hpp.html#aed026119193a9bbe076671809ff0f430">dirname</a><a class="code hl_function" href="utils_8hpp.html#aed026119193a9bbe076671809ff0f430">(</a>filename<a class="code hl_function" href="utils_8hpp.html#aed026119193a9bbe076671809ff0f430">)</a>;</div>
|
||||
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> std::ofstream ofile;</div>
|
||||
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> </div>
|
||||
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> <span class="comment">// Create random engine using the mersenne twister</span></div>
|
||||
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> std::random_device rd;</div>
|
||||
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span> uint32_t rd_sample = rd();</div>
|
||||
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span> std::mt19937 engine(rd());</div>
|
||||
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span> </div>
|
||||
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> std::cout << <span class="stringliteral">"Seed: "</span> << rd_sample << std::endl;</div>
|
||||
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span> </div>
|
||||
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span> <a class="code hl_class" href="classIsingModel.html">IsingModel</a> ising<a class="code hl_function" href="classIsingModel.html#a46c9446e94854452f715d307c77c1c15">(</a>L<a class="code hl_function" href="classIsingModel.html#a46c9446e94854452f715d307c77c1c15">,</a> T<a class="code hl_function" href="classIsingModel.html#a46c9446e94854452f715d307c77c1c15">,</a> value<a class="code hl_function" href="classIsingModel.html#a46c9446e94854452f715d307c77c1c15">)</a>;</div>
|
||||
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span> </div>
|
||||
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> <span class="keywordflow">for</span> (size_t i = 0; i < burn_in_time; i++) {</div>
|
||||
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span> ising<a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">.</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">Metropolis</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">(</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">)</a>;</div>
|
||||
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> <span class="comment">// File stuff</span></div>
|
||||
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> std::string directory = utils<a class="code hl_function" href="utils_8hpp.html#aed026119193a9bbe076671809ff0f430">::</a><a class="code hl_function" href="utils_8hpp.html#aed026119193a9bbe076671809ff0f430">dirname</a><a class="code hl_function" href="utils_8hpp.html#aed026119193a9bbe076671809ff0f430">(</a>filename<a class="code hl_function" href="utils_8hpp.html#aed026119193a9bbe076671809ff0f430">)</a>;</div>
|
||||
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span> std::ofstream ofile;</div>
|
||||
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> </div>
|
||||
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> <a class="code hl_class" href="classIsingModel.html">IsingModel</a> ising<a class="code hl_function" href="classIsingModel.html#a46c9446e94854452f715d307c77c1c15">(</a>L<a class="code hl_function" href="classIsingModel.html#a46c9446e94854452f715d307c77c1c15">,</a> T<a class="code hl_function" href="classIsingModel.html#a46c9446e94854452f715d307c77c1c15">,</a> value<a class="code hl_function" href="classIsingModel.html#a46c9446e94854452f715d307c77c1c15">)</a>;</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="keywordflow">for</span> (size_t i = 0; i < burn_in_time; i++) {</div>
|
||||
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> ising<a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">.</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">Metropolis</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">(</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">)</a>;</div>
|
||||
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> }</div>
|
||||
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> </div>
|
||||
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> <span class="comment">// Create path and open file</span></div>
|
||||
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> utils<a class="code hl_function" href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">::</a><a class="code hl_function" href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">mkpath</a><a class="code hl_function" href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">(</a>directory<a class="code hl_function" href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">)</a>;</div>
|
||||
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> ofile.open(filename);</div>
|
||||
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span> </div>
|
||||
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span> <span class="comment">// Loop through cycles</span></div>
|
||||
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span> <span class="keywordflow">for</span> (size_t i = 1; i <= cycles; i++) {</div>
|
||||
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> data <a class="code hl_function" href="classdata__t.html#a6cb96b4ff750ab29041038ca53f307cb">+=</a> ising<a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">.</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">Metropolis</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">(</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">)</a>;</div>
|
||||
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span> tmp = data / (i * n_spins);</div>
|
||||
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span> ofile << i << <span class="stringliteral">','</span> << tmp<a class="code hl_variable" href="classdata__t.html#a6c1a196d96e177b11ca98c61fae35a2e">.</a><a class="code hl_variable" href="classdata__t.html#a6c1a196d96e177b11ca98c61fae35a2e">E</a> << <span class="stringliteral">','</span> << tmp<a class="code hl_variable" href="classdata__t.html#abb622f9c6cc5ffb9dddb151d2e202f72">.</a><a class="code hl_variable" href="classdata__t.html#abb622f9c6cc5ffb9dddb151d2e202f72">E2</a> << <span class="stringliteral">','</span> << tmp<a class="code hl_variable" href="classdata__t.html#ad08d2488bf913c626157471cf6e8a46a">.</a><a class="code hl_variable" href="classdata__t.html#ad08d2488bf913c626157471cf6e8a46a">M</a> << <span class="stringliteral">','</span></div>
|
||||
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span> << tmp<a class="code hl_variable" href="classdata__t.html#a71ae3cd4460f2c66239500c11804e70b">.</a><a class="code hl_variable" href="classdata__t.html#a71ae3cd4460f2c66239500c11804e70b">M2</a> << <span class="stringliteral">','</span> << tmp<a class="code hl_variable" href="classdata__t.html#a586475e0f71322dffda2e75f228ab24b">.</a><a class="code hl_variable" href="classdata__t.html#a586475e0f71322dffda2e75f228ab24b">M_abs</a> << <span class="stringliteral">'\n'</span>;</div>
|
||||
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> }</div>
|
||||
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span> ofile.close();</div>
|
||||
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span>}</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="comment">// Create path and open file</span></div>
|
||||
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> utils<a class="code hl_function" href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">::</a><a class="code hl_function" href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">mkpath</a><a class="code hl_function" href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">(</a>directory<a class="code hl_function" href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">)</a>;</div>
|
||||
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> ofile.open(filename);</div>
|
||||
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> </div>
|
||||
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> <span class="comment">// Loop through cycles</span></div>
|
||||
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span> <span class="keywordflow">for</span> (size_t i = 1; i <= cycles; i++) {</div>
|
||||
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span> data <a class="code hl_function" href="classdata__t.html#a6cb96b4ff750ab29041038ca53f307cb">+=</a> ising<a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">.</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">Metropolis</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">(</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">)</a>;</div>
|
||||
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span> tmp = data / (i * n_spins);</div>
|
||||
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span> ofile << i << <span class="stringliteral">','</span> << tmp<a class="code hl_variable" href="classdata__t.html#a6c1a196d96e177b11ca98c61fae35a2e">.</a><a class="code hl_variable" href="classdata__t.html#a6c1a196d96e177b11ca98c61fae35a2e">E</a> << <span class="stringliteral">','</span> << tmp<a class="code hl_variable" href="classdata__t.html#abb622f9c6cc5ffb9dddb151d2e202f72">.</a><a class="code hl_variable" href="classdata__t.html#abb622f9c6cc5ffb9dddb151d2e202f72">E2</a> << <span class="stringliteral">','</span> << tmp<a class="code hl_variable" href="classdata__t.html#ad08d2488bf913c626157471cf6e8a46a">.</a><a class="code hl_variable" href="classdata__t.html#ad08d2488bf913c626157471cf6e8a46a">M</a> << <span class="stringliteral">','</span></div>
|
||||
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno"> 86</span> << tmp<a class="code hl_variable" href="classdata__t.html#a71ae3cd4460f2c66239500c11804e70b">.</a><a class="code hl_variable" href="classdata__t.html#a71ae3cd4460f2c66239500c11804e70b">M2</a> << <span class="stringliteral">','</span> << tmp<a class="code hl_variable" href="classdata__t.html#a586475e0f71322dffda2e75f228ab24b">.</a><a class="code hl_variable" href="classdata__t.html#a586475e0f71322dffda2e75f228ab24b">M_abs</a> << <span class="stringliteral">'\n'</span>;</div>
|
||||
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno"> 87</span> }</div>
|
||||
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span> ofile.close();</div>
|
||||
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span>}</div>
|
||||
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span> </div>
|
||||
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"><a class="line" href="monte__carlo_8hpp.html#aea2dd1b5fac7c45633bc6f8dc4541226"> 91</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="monte__carlo_8hpp.html#aea2dd1b5fac7c45633bc6f8dc4541226">pd_estimate</a>(<span class="keywordtype">double</span> T, <span class="keywordtype">int</span> L, <span class="keywordtype">int</span> cycles, <span class="keyword">const</span> std::string filename,</div>
|
||||
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"> 92</span> <span class="keywordtype">int</span> burn_in_time)</div>
|
||||
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span>{</div>
|
||||
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span> <span class="comment">// Set some variables</span></div>
|
||||
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"> 95</span> <a class="code hl_class" href="classdata__t.html">data_t</a> data, tmp;</div>
|
||||
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno"> 96</span> <span class="keywordtype">int</span> n_spins = L * L;</div>
|
||||
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"><a class="line" href="monte__carlo_8hpp.html#aea2dd1b5fac7c45633bc6f8dc4541226"> 77</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="monte__carlo_8hpp.html#aea2dd1b5fac7c45633bc6f8dc4541226">pd_estimate</a>(<span class="keywordtype">double</span> T, <span class="keywordtype">int</span> L, <span class="keywordtype">int</span> cycles, <span class="keyword">const</span> std::string filename,</div>
|
||||
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> <span class="keywordtype">int</span> burn_in_time)</div>
|
||||
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span>{</div>
|
||||
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> <span class="comment">// Set some variables</span></div>
|
||||
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> <a class="code hl_class" href="classdata__t.html">data_t</a> data, tmp;</div>
|
||||
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span> <span class="keywordtype">int</span> n_spins = L * L;</div>
|
||||
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span> </div>
|
||||
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span> <span class="comment">// File stuff</span></div>
|
||||
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span> std::string directory = utils<a class="code hl_function" href="utils_8hpp.html#aed026119193a9bbe076671809ff0f430">::</a><a class="code hl_function" href="utils_8hpp.html#aed026119193a9bbe076671809ff0f430">dirname</a><a class="code hl_function" href="utils_8hpp.html#aed026119193a9bbe076671809ff0f430">(</a>filename<a class="code hl_function" href="utils_8hpp.html#aed026119193a9bbe076671809ff0f430">)</a>;</div>
|
||||
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno"> 86</span> std::ofstream ofile;</div>
|
||||
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno"> 87</span> </div>
|
||||
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span> <a class="code hl_class" href="classIsingModel.html">IsingModel</a> ising<a class="code hl_function" href="classIsingModel.html#a4a39ee7fbfbbf566f75bc28900ca9ea5">(</a>L<a class="code hl_function" href="classIsingModel.html#a4a39ee7fbfbbf566f75bc28900ca9ea5">,</a> T<a class="code hl_function" href="classIsingModel.html#a4a39ee7fbfbbf566f75bc28900ca9ea5">)</a>;</div>
|
||||
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span> </div>
|
||||
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span> <span class="keywordflow">for</span> (size_t i = 0; i < burn_in_time; i++) {</div>
|
||||
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span> ising<a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">.</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">Metropolis</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">(</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">)</a>;</div>
|
||||
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"> 92</span> }</div>
|
||||
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span> </div>
|
||||
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span> <span class="comment">// Create path and open file</span></div>
|
||||
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"> 95</span> utils<a class="code hl_function" href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">::</a><a class="code hl_function" href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">mkpath</a><a class="code hl_function" href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">(</a>directory<a class="code hl_function" href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">)</a>;</div>
|
||||
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno"> 96</span> ofile.open(filename);</div>
|
||||
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno"> 97</span> </div>
|
||||
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno"> 98</span> <span class="comment">// File stuff</span></div>
|
||||
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"> 99</span> std::string directory = utils<a class="code hl_function" href="utils_8hpp.html#aed026119193a9bbe076671809ff0f430">::</a><a class="code hl_function" href="utils_8hpp.html#aed026119193a9bbe076671809ff0f430">dirname</a><a class="code hl_function" href="utils_8hpp.html#aed026119193a9bbe076671809ff0f430">(</a>filename<a class="code hl_function" href="utils_8hpp.html#aed026119193a9bbe076671809ff0f430">)</a>;</div>
|
||||
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"> 100</span> std::ofstream ofile;</div>
|
||||
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno"> 101</span> </div>
|
||||
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno"> 102</span> <a class="code hl_class" href="classIsingModel.html">IsingModel</a> ising<a class="code hl_function" href="classIsingModel.html#a4a39ee7fbfbbf566f75bc28900ca9ea5">(</a>L<a class="code hl_function" href="classIsingModel.html#a4a39ee7fbfbbf566f75bc28900ca9ea5">,</a> T<a class="code hl_function" href="classIsingModel.html#a4a39ee7fbfbbf566f75bc28900ca9ea5">)</a>;</div>
|
||||
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"> 103</span> </div>
|
||||
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"> 104</span> <span class="keywordflow">for</span> (size_t i = 0; i < burn_in_time; i++) {</div>
|
||||
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span> ising<a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">.</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">Metropolis</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">(</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">)</a>;</div>
|
||||
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span> }</div>
|
||||
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"> 107</span> </div>
|
||||
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno"> 108</span> <span class="comment">// Create path and open file</span></div>
|
||||
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno"> 109</span> utils<a class="code hl_function" href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">::</a><a class="code hl_function" href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">mkpath</a><a class="code hl_function" href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">(</a>directory<a class="code hl_function" href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">)</a>;</div>
|
||||
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno"> 110</span> ofile.open(filename);</div>
|
||||
<div class="line"><a id="l00111" name="l00111"></a><span class="lineno"> 111</span> </div>
|
||||
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno"> 112</span> <span class="comment">// Loop through cycles</span></div>
|
||||
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno"> 113</span> <span class="keywordflow">for</span> (size_t i = 1; i <= cycles; i++) {</div>
|
||||
<div class="line"><a id="l00114" name="l00114"></a><span class="lineno"> 114</span> data = ising<a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">.</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">Metropolis</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">(</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">)</a> / n_spins;</div>
|
||||
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno"> 115</span> ofile << data<a class="code hl_variable" href="classdata__t.html#a6c1a196d96e177b11ca98c61fae35a2e">.</a><a class="code hl_variable" href="classdata__t.html#a6c1a196d96e177b11ca98c61fae35a2e">E</a> << <span class="stringliteral">','</span> << data<a class="code hl_variable" href="classdata__t.html#abb622f9c6cc5ffb9dddb151d2e202f72">.</a><a class="code hl_variable" href="classdata__t.html#abb622f9c6cc5ffb9dddb151d2e202f72">E2</a> << <span class="stringliteral">','</span> << data<a class="code hl_variable" href="classdata__t.html#ad08d2488bf913c626157471cf6e8a46a">.</a><a class="code hl_variable" href="classdata__t.html#ad08d2488bf913c626157471cf6e8a46a">M</a> << <span class="stringliteral">','</span> << data<a class="code hl_variable" href="classdata__t.html#a71ae3cd4460f2c66239500c11804e70b">.</a><a class="code hl_variable" href="classdata__t.html#a71ae3cd4460f2c66239500c11804e70b">M2</a></div>
|
||||
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno"> 116</span> << <span class="stringliteral">','</span> << data<a class="code hl_variable" href="classdata__t.html#a586475e0f71322dffda2e75f228ab24b">.</a><a class="code hl_variable" href="classdata__t.html#a586475e0f71322dffda2e75f228ab24b">M_abs</a> << <span class="stringliteral">'\n'</span>;</div>
|
||||
<div class="line"><a id="l00117" name="l00117"></a><span class="lineno"> 117</span> }</div>
|
||||
<div class="line"><a id="l00118" name="l00118"></a><span class="lineno"> 118</span> ofile.close();</div>
|
||||
<div class="line"><a id="l00119" name="l00119"></a><span class="lineno"> 119</span>}</div>
|
||||
<div class="line"><a id="l00120" name="l00120"></a><span class="lineno"> 120</span> </div>
|
||||
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno"> 121</span><span class="comment">// Code for seeing phase transitions.</span></div>
|
||||
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno"><a class="line" href="monte__carlo_8hpp.html#ae67483ff00d1b0594d543261c8283ffd"> 122</a></span><a class="code hl_class" href="classdata__t.html">data_t</a> <a class="code hl_function" href="monte__carlo_8hpp.html#ae67483ff00d1b0594d543261c8283ffd">mcmc_serial</a>(<span class="keywordtype">int</span> L, <span class="keywordtype">double</span> T, <span class="keywordtype">int</span> cycles, <span class="keywordtype">int</span> burn_in_time)</div>
|
||||
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno"> 123</span>{</div>
|
||||
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno"> 124</span> <a class="code hl_class" href="classdata__t.html">data_t</a> data;</div>
|
||||
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno"> 125</span> <a class="code hl_class" href="classIsingModel.html">IsingModel</a> model<a class="code hl_function" href="classIsingModel.html#a4a39ee7fbfbbf566f75bc28900ca9ea5">(</a>L<a class="code hl_function" href="classIsingModel.html#a4a39ee7fbfbbf566f75bc28900ca9ea5">,</a> T<a class="code hl_function" href="classIsingModel.html#a4a39ee7fbfbbf566f75bc28900ca9ea5">)</a>;</div>
|
||||
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno"> 98</span> <span class="comment">// Loop through cycles</span></div>
|
||||
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"> 99</span> <span class="keywordflow">for</span> (size_t i = 1; i <= cycles; i++) {</div>
|
||||
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"> 100</span> data = ising<a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">.</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">Metropolis</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">(</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">)</a> / n_spins;</div>
|
||||
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno"> 101</span> ofile << data<a class="code hl_variable" href="classdata__t.html#a6c1a196d96e177b11ca98c61fae35a2e">.</a><a class="code hl_variable" href="classdata__t.html#a6c1a196d96e177b11ca98c61fae35a2e">E</a> << <span class="stringliteral">','</span> << data<a class="code hl_variable" href="classdata__t.html#abb622f9c6cc5ffb9dddb151d2e202f72">.</a><a class="code hl_variable" href="classdata__t.html#abb622f9c6cc5ffb9dddb151d2e202f72">E2</a> << <span class="stringliteral">','</span> << data<a class="code hl_variable" href="classdata__t.html#ad08d2488bf913c626157471cf6e8a46a">.</a><a class="code hl_variable" href="classdata__t.html#ad08d2488bf913c626157471cf6e8a46a">M</a> << <span class="stringliteral">','</span> << data<a class="code hl_variable" href="classdata__t.html#a71ae3cd4460f2c66239500c11804e70b">.</a><a class="code hl_variable" href="classdata__t.html#a71ae3cd4460f2c66239500c11804e70b">M2</a></div>
|
||||
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno"> 102</span> << <span class="stringliteral">','</span> << data<a class="code hl_variable" href="classdata__t.html#a586475e0f71322dffda2e75f228ab24b">.</a><a class="code hl_variable" href="classdata__t.html#a586475e0f71322dffda2e75f228ab24b">M_abs</a> << <span class="stringliteral">'\n'</span>;</div>
|
||||
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"> 103</span> }</div>
|
||||
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"> 104</span> ofile.close();</div>
|
||||
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span>}</div>
|
||||
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span> </div>
|
||||
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"> 107</span><span class="comment">// Code for seeing phase transitions.</span></div>
|
||||
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno"><a class="line" href="monte__carlo_8hpp.html#ae67483ff00d1b0594d543261c8283ffd"> 108</a></span><a class="code hl_class" href="classdata__t.html">data_t</a> <a class="code hl_function" href="monte__carlo_8hpp.html#ae67483ff00d1b0594d543261c8283ffd">mcmc_serial</a>(<span class="keywordtype">int</span> L, <span class="keywordtype">double</span> T, <span class="keywordtype">int</span> cycles, <span class="keywordtype">int</span> burn_in_time)</div>
|
||||
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno"> 109</span>{</div>
|
||||
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno"> 110</span> <a class="code hl_class" href="classdata__t.html">data_t</a> data;</div>
|
||||
<div class="line"><a id="l00111" name="l00111"></a><span class="lineno"> 111</span> <a class="code hl_class" href="classIsingModel.html">IsingModel</a> model<a class="code hl_function" href="classIsingModel.html#a4a39ee7fbfbbf566f75bc28900ca9ea5">(</a>L<a class="code hl_function" href="classIsingModel.html#a4a39ee7fbfbbf566f75bc28900ca9ea5">,</a> T<a class="code hl_function" href="classIsingModel.html#a4a39ee7fbfbbf566f75bc28900ca9ea5">)</a>;</div>
|
||||
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno"> 112</span> </div>
|
||||
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno"> 113</span> <span class="keywordflow">for</span> (size_t i = 0; i < burn_in_time; i++) {</div>
|
||||
<div class="line"><a id="l00114" name="l00114"></a><span class="lineno"> 114</span> model<a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">.</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">Metropolis</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">(</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">)</a>;</div>
|
||||
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno"> 115</span> }</div>
|
||||
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno"> 116</span> </div>
|
||||
<div class="line"><a id="l00117" name="l00117"></a><span class="lineno"> 117</span> <span class="keywordtype">double</span> E, M;</div>
|
||||
<div class="line"><a id="l00118" name="l00118"></a><span class="lineno"> 118</span> <span class="keywordflow">for</span> (size_t i = 0; i < (uint)cycles; i++) {</div>
|
||||
<div class="line"><a id="l00119" name="l00119"></a><span class="lineno"> 119</span> data <a class="code hl_function" href="classdata__t.html#a6cb96b4ff750ab29041038ca53f307cb">+=</a> model<a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">.</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">Metropolis</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">(</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">)</a>;</div>
|
||||
<div class="line"><a id="l00120" name="l00120"></a><span class="lineno"> 120</span> }</div>
|
||||
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno"> 121</span> </div>
|
||||
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno"> 122</span> <span class="keywordtype">double</span> norm = 1. / (<span class="keywordtype">double</span>)cycles;</div>
|
||||
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno"> 123</span> </div>
|
||||
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno"> 124</span> <span class="keywordflow">return</span> data * norm;</div>
|
||||
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno"> 125</span>}</div>
|
||||
<div class="line"><a id="l00126" name="l00126"></a><span class="lineno"> 126</span> </div>
|
||||
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno"> 127</span> <span class="keywordflow">for</span> (size_t i = 0; i < burn_in_time; i++) {</div>
|
||||
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno"> 128</span> model<a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">.</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">Metropolis</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">(</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">)</a>;</div>
|
||||
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno"> 129</span> }</div>
|
||||
<div class="line"><a id="l00130" name="l00130"></a><span class="lineno"> 130</span> </div>
|
||||
<div class="line"><a id="l00131" name="l00131"></a><span class="lineno"> 131</span> <span class="keywordtype">double</span> E, M;</div>
|
||||
<div class="line"><a id="l00132" name="l00132"></a><span class="lineno"> 132</span> <span class="keywordflow">for</span> (size_t i = 0; i < (uint)cycles; i++) {</div>
|
||||
<div class="line"><a id="l00133" name="l00133"></a><span class="lineno"> 133</span> data <a class="code hl_function" href="classdata__t.html#a6cb96b4ff750ab29041038ca53f307cb">+=</a> model<a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">.</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">Metropolis</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">(</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">)</a>;</div>
|
||||
<div class="line"><a id="l00134" name="l00134"></a><span class="lineno"> 134</span> }</div>
|
||||
<div class="line"><a id="l00135" name="l00135"></a><span class="lineno"> 135</span> </div>
|
||||
<div class="line"><a id="l00136" name="l00136"></a><span class="lineno"> 136</span> <span class="keywordtype">double</span> norm = 1. / (<span class="keywordtype">double</span>)cycles;</div>
|
||||
<div class="line"><a id="l00137" name="l00137"></a><span class="lineno"> 137</span> </div>
|
||||
<div class="line"><a id="l00138" name="l00138"></a><span class="lineno"> 138</span> <span class="keywordflow">return</span> data * norm;</div>
|
||||
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno"><a class="line" href="monte__carlo_8hpp.html#ae1e7f904ecfc3d8f3c4dd1ef155dd771"> 127</a></span><a class="code hl_class" href="classdata__t.html">data_t</a> <a class="code hl_function" href="monte__carlo_8hpp.html#ae1e7f904ecfc3d8f3c4dd1ef155dd771">mcmc_parallel</a>(<span class="keywordtype">int</span> L, <span class="keywordtype">double</span> T, <span class="keywordtype">int</span> cycles, <span class="keywordtype">int</span> burn_in_time)</div>
|
||||
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno"> 128</span>{</div>
|
||||
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno"> 129</span> <a class="code hl_class" href="classdata__t.html">data_t</a> data;</div>
|
||||
<div class="line"><a id="l00130" name="l00130"></a><span class="lineno"> 130</span><span class="preprocessor">#</span><span class="preprocessor">pragma</span> <span class="preprocessor">omp</span> <span class="preprocessor">parallel</span></div>
|
||||
<div class="line"><a id="l00131" name="l00131"></a><span class="lineno"> 131</span> {</div>
|
||||
<div class="line"><a id="l00132" name="l00132"></a><span class="lineno"> 132</span> <span class="comment">// Each thread creates an instance of IsingModel.</span></div>
|
||||
<div class="line"><a id="l00133" name="l00133"></a><span class="lineno"> 133</span> <a class="code hl_class" href="classIsingModel.html">IsingModel</a> model<a class="code hl_function" href="classIsingModel.html#a4a39ee7fbfbbf566f75bc28900ca9ea5">(</a>L<a class="code hl_function" href="classIsingModel.html#a4a39ee7fbfbbf566f75bc28900ca9ea5">,</a> T<a class="code hl_function" href="classIsingModel.html#a4a39ee7fbfbbf566f75bc28900ca9ea5">)</a>;</div>
|
||||
<div class="line"><a id="l00134" name="l00134"></a><span class="lineno"> 134</span> </div>
|
||||
<div class="line"><a id="l00135" name="l00135"></a><span class="lineno"> 135</span> <span class="comment">// Each thread runs the Metropolis algorithm before starting to collect</span></div>
|
||||
<div class="line"><a id="l00136" name="l00136"></a><span class="lineno"> 136</span> <span class="comment">// samples</span></div>
|
||||
<div class="line"><a id="l00137" name="l00137"></a><span class="lineno"> 137</span> <span class="keywordflow">for</span> (size_t i = 0; i < burn_in_time; i++) {</div>
|
||||
<div class="line"><a id="l00138" name="l00138"></a><span class="lineno"> 138</span> model<a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">.</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">Metropolis</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">(</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">)</a>;</div>
|
||||
<div class="line"><a id="l00139" name="l00139"></a><span class="lineno"> 139</span> }</div>
|
||||
<div class="line"><a id="l00140" name="l00140"></a><span class="lineno"> 140</span> </div>
|
||||
<div class="line"><a id="l00141" name="l00141"></a><span class="lineno"><a class="line" href="monte__carlo_8hpp.html#ae1e7f904ecfc3d8f3c4dd1ef155dd771"> 141</a></span><a class="code hl_class" href="classdata__t.html">data_t</a> <a class="code hl_function" href="monte__carlo_8hpp.html#ae1e7f904ecfc3d8f3c4dd1ef155dd771">mcmc_parallel</a>(<span class="keywordtype">int</span> L, <span class="keywordtype">double</span> T, <span class="keywordtype">int</span> cycles, <span class="keywordtype">int</span> burn_in_time)</div>
|
||||
<div class="line"><a id="l00142" name="l00142"></a><span class="lineno"> 142</span>{</div>
|
||||
<div class="line"><a id="l00143" name="l00143"></a><span class="lineno"> 143</span> <a class="code hl_class" href="classdata__t.html">data_t</a> data;</div>
|
||||
<div class="line"><a id="l00144" name="l00144"></a><span class="lineno"> 144</span><span class="preprocessor">#</span><span class="preprocessor">pragma</span> <span class="preprocessor">omp</span> <span class="preprocessor">parallel</span></div>
|
||||
<div class="line"><a id="l00145" name="l00145"></a><span class="lineno"> 145</span> {</div>
|
||||
<div class="line"><a id="l00146" name="l00146"></a><span class="lineno"> 146</span> <span class="comment">// Each thread creates an instance of IsingModel.</span></div>
|
||||
<div class="line"><a id="l00147" name="l00147"></a><span class="lineno"> 147</span> <a class="code hl_class" href="classIsingModel.html">IsingModel</a> model<a class="code hl_function" href="classIsingModel.html#a4a39ee7fbfbbf566f75bc28900ca9ea5">(</a>L<a class="code hl_function" href="classIsingModel.html#a4a39ee7fbfbbf566f75bc28900ca9ea5">,</a> T<a class="code hl_function" href="classIsingModel.html#a4a39ee7fbfbbf566f75bc28900ca9ea5">)</a>;</div>
|
||||
<div class="line"><a id="l00148" name="l00148"></a><span class="lineno"> 148</span> </div>
|
||||
<div class="line"><a id="l00149" name="l00149"></a><span class="lineno"> 149</span> <span class="comment">// Each thread runs the Metropolis algorithm before starting to collect</span></div>
|
||||
<div class="line"><a id="l00150" name="l00150"></a><span class="lineno"> 150</span> <span class="comment">// samples</span></div>
|
||||
<div class="line"><a id="l00151" name="l00151"></a><span class="lineno"> 151</span> <span class="keywordflow">for</span> (size_t i = 0; i < burn_in_time; i++) {</div>
|
||||
<div class="line"><a id="l00152" name="l00152"></a><span class="lineno"> 152</span> model<a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">.</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">Metropolis</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">(</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">)</a>;</div>
|
||||
<div class="line"><a id="l00141" name="l00141"></a><span class="lineno"> 141</span> <span class="comment">// Now each thread work on one loop together, but using their own</span></div>
|
||||
<div class="line"><a id="l00142" name="l00142"></a><span class="lineno"> 142</span> <span class="comment">// instances of things, but the total of cycles add up.</span></div>
|
||||
<div class="line"><a id="l00143" name="l00143"></a><span class="lineno"> 143</span> <span class="comment">// static ensure that each thread gets the same amount of iterations</span></div>
|
||||
<div class="line"><a id="l00144" name="l00144"></a><span class="lineno"> 144</span><span class="preprocessor">#</span><span class="preprocessor">pragma</span> <span class="preprocessor">omp</span> <span class="preprocessor">for</span> <span class="preprocessor">schedule</span><span class="preprocessor">(</span><span class="preprocessor">static</span><span class="preprocessor">)</span> <span class="preprocessor">reduction</span><span class="preprocessor">(</span><span class="preprocessor">+</span> <span class="preprocessor">:</span> <span class="preprocessor">data</span><span class="preprocessor">)</span></div>
|
||||
<div class="line"><a id="l00145" name="l00145"></a><span class="lineno"> 145</span> <span class="keywordflow">for</span> (size_t i = 0; i < (uint)cycles; i++) {</div>
|
||||
<div class="line"><a id="l00146" name="l00146"></a><span class="lineno"> 146</span> data <a class="code hl_function" href="classdata__t.html#a6cb96b4ff750ab29041038ca53f307cb">+=</a> model<a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">.</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">Metropolis</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">(</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">)</a>;</div>
|
||||
<div class="line"><a id="l00147" name="l00147"></a><span class="lineno"> 147</span> }</div>
|
||||
<div class="line"><a id="l00148" name="l00148"></a><span class="lineno"> 148</span> }</div>
|
||||
<div class="line"><a id="l00149" name="l00149"></a><span class="lineno"> 149</span> </div>
|
||||
<div class="line"><a id="l00150" name="l00150"></a><span class="lineno"> 150</span> <span class="keywordtype">double</span> norm = 1. / (<span class="keywordtype">double</span>)cycles;</div>
|
||||
<div class="line"><a id="l00151" name="l00151"></a><span class="lineno"> 151</span> </div>
|
||||
<div class="line"><a id="l00152" name="l00152"></a><span class="lineno"> 152</span> <span class="keywordflow">return</span> data * norm;</div>
|
||||
<div class="line"><a id="l00153" name="l00153"></a><span class="lineno"> 153</span>}</div>
|
||||
<div class="line"><a id="l00154" name="l00154"></a><span class="lineno"> 154</span> </div>
|
||||
<div class="line"><a id="l00155" name="l00155"></a><span class="lineno"> 155</span> <span class="comment">// Now each thread work on one loop together, but using their own</span></div>
|
||||
<div class="line"><a id="l00156" name="l00156"></a><span class="lineno"> 156</span> <span class="comment">// instances of things, but the total of cycles add up.</span></div>
|
||||
<div class="line"><a id="l00157" name="l00157"></a><span class="lineno"> 157</span> <span class="comment">// static ensure that each thread gets the same amount of iterations</span></div>
|
||||
<div class="line"><a id="l00158" name="l00158"></a><span class="lineno"> 158</span><span class="preprocessor">#</span><span class="preprocessor">pragma</span> <span class="preprocessor">omp</span> <span class="preprocessor">for</span> <span class="preprocessor">schedule</span><span class="preprocessor">(</span><span class="preprocessor">static</span><span class="preprocessor">)</span> <span class="preprocessor">reduction</span><span class="preprocessor">(</span><span class="preprocessor">+</span> <span class="preprocessor">:</span> <span class="preprocessor">data</span><span class="preprocessor">)</span></div>
|
||||
<div class="line"><a id="l00159" name="l00159"></a><span class="lineno"> 159</span> <span class="keywordflow">for</span> (size_t i = 0; i < (uint)cycles; i++) {</div>
|
||||
<div class="line"><a id="l00160" name="l00160"></a><span class="lineno"> 160</span> data <a class="code hl_function" href="classdata__t.html#a6cb96b4ff750ab29041038ca53f307cb">+=</a> model<a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">.</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">Metropolis</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">(</a><a class="code hl_function" href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">)</a>;</div>
|
||||
<div class="line"><a id="l00161" name="l00161"></a><span class="lineno"> 161</span> }</div>
|
||||
<div class="line"><a id="l00162" name="l00162"></a><span class="lineno"> 162</span> }</div>
|
||||
<div class="line"><a id="l00163" name="l00163"></a><span class="lineno"> 163</span> </div>
|
||||
<div class="line"><a id="l00164" name="l00164"></a><span class="lineno"> 164</span> <span class="keywordtype">double</span> norm = 1. / (<span class="keywordtype">double</span>)cycles;</div>
|
||||
<div class="line"><a id="l00165" name="l00165"></a><span class="lineno"> 165</span> </div>
|
||||
<div class="line"><a id="l00166" name="l00166"></a><span class="lineno"> 166</span> <span class="keywordflow">return</span> data * norm;</div>
|
||||
<div class="line"><a id="l00167" name="l00167"></a><span class="lineno"> 167</span>}</div>
|
||||
<div class="line"><a id="l00168" name="l00168"></a><span class="lineno"> 168</span> </div>
|
||||
<div class="line"><a id="l00169" name="l00169"></a><span class="lineno"><a class="line" href="monte__carlo_8hpp.html#a34e9c3e24f26760693266b8a7b6b3d21"> 169</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="monte__carlo_8hpp.html#a34e9c3e24f26760693266b8a7b6b3d21">phase_transition</a>(<span class="keywordtype">int</span> L, <span class="keywordtype">double</span> start, <span class="keywordtype">double</span> end, <span class="keywordtype">int</span> points, <span class="keywordtype">int</span> cycles,</div>
|
||||
<div class="line"><a id="l00170" name="l00170"></a><span class="lineno"> 170</span> std::function<<a class="code hl_class" href="classdata__t.html">data_t</a>(<span class="keywordtype">int</span>, <span class="keywordtype">double</span>, <span class="keywordtype">int</span>, <span class="keywordtype">int</span>)> monte_carlo,</div>
|
||||
<div class="line"><a id="l00171" name="l00171"></a><span class="lineno"> 171</span> std::string outfile, <span class="keywordtype">int</span> burn_in_time)</div>
|
||||
<div class="line"><a id="l00172" name="l00172"></a><span class="lineno"> 172</span>{</div>
|
||||
<div class="line"><a id="l00173" name="l00173"></a><span class="lineno"> 173</span> <span class="keywordtype">double</span> dt = (end - start) / (<span class="keywordtype">double</span>)points;</div>
|
||||
<div class="line"><a id="l00174" name="l00174"></a><span class="lineno"> 174</span> <span class="keywordtype">int</span> N = L * L;</div>
|
||||
<div class="line"><a id="l00175" name="l00175"></a><span class="lineno"> 175</span> std::ofstream ofile;</div>
|
||||
<div class="line"><a id="l00155" name="l00155"></a><span class="lineno"><a class="line" href="monte__carlo_8hpp.html#a34e9c3e24f26760693266b8a7b6b3d21"> 155</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="monte__carlo_8hpp.html#a34e9c3e24f26760693266b8a7b6b3d21">phase_transition</a>(<span class="keywordtype">int</span> L, <span class="keywordtype">double</span> start, <span class="keywordtype">double</span> end, <span class="keywordtype">int</span> points, <span class="keywordtype">int</span> cycles,</div>
|
||||
<div class="line"><a id="l00156" name="l00156"></a><span class="lineno"> 156</span> std::function<<a class="code hl_class" href="classdata__t.html">data_t</a>(<span class="keywordtype">int</span>, <span class="keywordtype">double</span>, <span class="keywordtype">int</span>, <span class="keywordtype">int</span>)> monte_carlo,</div>
|
||||
<div class="line"><a id="l00157" name="l00157"></a><span class="lineno"> 157</span> std::string outfile, <span class="keywordtype">int</span> burn_in_time)</div>
|
||||
<div class="line"><a id="l00158" name="l00158"></a><span class="lineno"> 158</span>{</div>
|
||||
<div class="line"><a id="l00159" name="l00159"></a><span class="lineno"> 159</span> <span class="keywordtype">double</span> dt = (end - start) / (<span class="keywordtype">double</span>)points;</div>
|
||||
<div class="line"><a id="l00160" name="l00160"></a><span class="lineno"> 160</span> <span class="keywordtype">int</span> N = L * L;</div>
|
||||
<div class="line"><a id="l00161" name="l00161"></a><span class="lineno"> 161</span> std::ofstream ofile;</div>
|
||||
<div class="line"><a id="l00162" name="l00162"></a><span class="lineno"> 162</span> </div>
|
||||
<div class="line"><a id="l00163" name="l00163"></a><span class="lineno"> 163</span> <a class="code hl_class" href="classdata__t.html">data_t</a> data;</div>
|
||||
<div class="line"><a id="l00164" name="l00164"></a><span class="lineno"> 164</span> </div>
|
||||
<div class="line"><a id="l00165" name="l00165"></a><span class="lineno"> 165</span> utils<a class="code hl_function" href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">::</a><a class="code hl_function" href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">mkpath</a><a class="code hl_function" href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">(</a>utils<a class="code hl_function" href="utils_8hpp.html#aed026119193a9bbe076671809ff0f430">::</a><a class="code hl_function" href="utils_8hpp.html#aed026119193a9bbe076671809ff0f430">dirname</a><a class="code hl_function" href="utils_8hpp.html#aed026119193a9bbe076671809ff0f430">(</a>outfile<a class="code hl_function" href="utils_8hpp.html#aed026119193a9bbe076671809ff0f430">)</a><a class="code hl_function" href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">)</a>;</div>
|
||||
<div class="line"><a id="l00166" name="l00166"></a><span class="lineno"> 166</span> ofile.open(outfile);</div>
|
||||
<div class="line"><a id="l00167" name="l00167"></a><span class="lineno"> 167</span> </div>
|
||||
<div class="line"><a id="l00168" name="l00168"></a><span class="lineno"> 168</span> <span class="keywordtype">double</span> temp, CV, X, E_var, M_var;</div>
|
||||
<div class="line"><a id="l00169" name="l00169"></a><span class="lineno"> 169</span> </div>
|
||||
<div class="line"><a id="l00170" name="l00170"></a><span class="lineno"> 170</span> <span class="keyword">using</span> utils::scientific_format;</div>
|
||||
<div class="line"><a id="l00171" name="l00171"></a><span class="lineno"> 171</span> <span class="keywordflow">for</span> (size_t i = 0; i < points; i++) {</div>
|
||||
<div class="line"><a id="l00172" name="l00172"></a><span class="lineno"> 172</span> temp = start + dt * i;</div>
|
||||
<div class="line"><a id="l00173" name="l00173"></a><span class="lineno"> 173</span> data = monte_carlo(L, temp, cycles, burn_in_time);</div>
|
||||
<div class="line"><a id="l00174" name="l00174"></a><span class="lineno"> 174</span> E_var = (data<a class="code hl_variable" href="classdata__t.html#abb622f9c6cc5ffb9dddb151d2e202f72">.</a><a class="code hl_variable" href="classdata__t.html#abb622f9c6cc5ffb9dddb151d2e202f72">E2</a> - data<a class="code hl_variable" href="classdata__t.html#a6c1a196d96e177b11ca98c61fae35a2e">.</a><a class="code hl_variable" href="classdata__t.html#a6c1a196d96e177b11ca98c61fae35a2e">E</a> * data<a class="code hl_variable" href="classdata__t.html#a6c1a196d96e177b11ca98c61fae35a2e">.</a><a class="code hl_variable" href="classdata__t.html#a6c1a196d96e177b11ca98c61fae35a2e">E</a>) / (<span class="keywordtype">double</span>)N;</div>
|
||||
<div class="line"><a id="l00175" name="l00175"></a><span class="lineno"> 175</span> M_var = (data<a class="code hl_variable" href="classdata__t.html#a71ae3cd4460f2c66239500c11804e70b">.</a><a class="code hl_variable" href="classdata__t.html#a71ae3cd4460f2c66239500c11804e70b">M2</a> - data<a class="code hl_variable" href="classdata__t.html#a586475e0f71322dffda2e75f228ab24b">.</a><a class="code hl_variable" href="classdata__t.html#a586475e0f71322dffda2e75f228ab24b">M_abs</a> * data<a class="code hl_variable" href="classdata__t.html#a586475e0f71322dffda2e75f228ab24b">.</a><a class="code hl_variable" href="classdata__t.html#a586475e0f71322dffda2e75f228ab24b">M_abs</a>) / (<span class="keywordtype">double</span>)N;</div>
|
||||
<div class="line"><a id="l00176" name="l00176"></a><span class="lineno"> 176</span> </div>
|
||||
<div class="line"><a id="l00177" name="l00177"></a><span class="lineno"> 177</span> <a class="code hl_class" href="classdata__t.html">data_t</a> data;</div>
|
||||
<div class="line"><a id="l00178" name="l00178"></a><span class="lineno"> 178</span> </div>
|
||||
<div class="line"><a id="l00179" name="l00179"></a><span class="lineno"> 179</span> utils<a class="code hl_function" href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">::</a><a class="code hl_function" href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">mkpath</a><a class="code hl_function" href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">(</a>utils<a class="code hl_function" href="utils_8hpp.html#aed026119193a9bbe076671809ff0f430">::</a><a class="code hl_function" href="utils_8hpp.html#aed026119193a9bbe076671809ff0f430">dirname</a><a class="code hl_function" href="utils_8hpp.html#aed026119193a9bbe076671809ff0f430">(</a>outfile<a class="code hl_function" href="utils_8hpp.html#aed026119193a9bbe076671809ff0f430">)</a><a class="code hl_function" href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">)</a>;</div>
|
||||
<div class="line"><a id="l00180" name="l00180"></a><span class="lineno"> 180</span> ofile.open(outfile);</div>
|
||||
<div class="line"><a id="l00181" name="l00181"></a><span class="lineno"> 181</span> </div>
|
||||
<div class="line"><a id="l00182" name="l00182"></a><span class="lineno"> 182</span> <span class="keywordtype">double</span> temp, CV, X, E_var, M_var;</div>
|
||||
<div class="line"><a id="l00183" name="l00183"></a><span class="lineno"> 183</span> </div>
|
||||
<div class="line"><a id="l00184" name="l00184"></a><span class="lineno"> 184</span> <span class="keyword">using</span> utils::scientific_format;</div>
|
||||
<div class="line"><a id="l00185" name="l00185"></a><span class="lineno"> 185</span> <span class="keywordflow">for</span> (size_t i = 0; i < points; i++) {</div>
|
||||
<div class="line"><a id="l00186" name="l00186"></a><span class="lineno"> 186</span> temp = start + dt * i;</div>
|
||||
<div class="line"><a id="l00187" name="l00187"></a><span class="lineno"> 187</span> data = monte_carlo(L, temp, cycles, burn_in_time);</div>
|
||||
<div class="line"><a id="l00188" name="l00188"></a><span class="lineno"> 188</span> E_var = (data<a class="code hl_variable" href="classdata__t.html#abb622f9c6cc5ffb9dddb151d2e202f72">.</a><a class="code hl_variable" href="classdata__t.html#abb622f9c6cc5ffb9dddb151d2e202f72">E2</a> - data<a class="code hl_variable" href="classdata__t.html#a6c1a196d96e177b11ca98c61fae35a2e">.</a><a class="code hl_variable" href="classdata__t.html#a6c1a196d96e177b11ca98c61fae35a2e">E</a> * data<a class="code hl_variable" href="classdata__t.html#a6c1a196d96e177b11ca98c61fae35a2e">.</a><a class="code hl_variable" href="classdata__t.html#a6c1a196d96e177b11ca98c61fae35a2e">E</a>) / (<span class="keywordtype">double</span>)N;</div>
|
||||
<div class="line"><a id="l00189" name="l00189"></a><span class="lineno"> 189</span> M_var = (data<a class="code hl_variable" href="classdata__t.html#a71ae3cd4460f2c66239500c11804e70b">.</a><a class="code hl_variable" href="classdata__t.html#a71ae3cd4460f2c66239500c11804e70b">M2</a> - data<a class="code hl_variable" href="classdata__t.html#a586475e0f71322dffda2e75f228ab24b">.</a><a class="code hl_variable" href="classdata__t.html#a586475e0f71322dffda2e75f228ab24b">M_abs</a> * data<a class="code hl_variable" href="classdata__t.html#a586475e0f71322dffda2e75f228ab24b">.</a><a class="code hl_variable" href="classdata__t.html#a586475e0f71322dffda2e75f228ab24b">M_abs</a>) / (<span class="keywordtype">double</span>)N;</div>
|
||||
<div class="line"><a id="l00190" name="l00190"></a><span class="lineno"> 190</span> </div>
|
||||
<div class="line"><a id="l00191" name="l00191"></a><span class="lineno"> 191</span> ofile << <a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">scientific_format</a><a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">(</a>temp<a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">)</a> << <span class="stringliteral">','</span></div>
|
||||
<div class="line"><a id="l00192" name="l00192"></a><span class="lineno"> 192</span> << <a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">scientific_format</a><a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">(</a>data<a class="code hl_variable" href="classdata__t.html#a6c1a196d96e177b11ca98c61fae35a2e">.</a><a class="code hl_variable" href="classdata__t.html#a6c1a196d96e177b11ca98c61fae35a2e">E</a> / (<span class="keywordtype">double</span>)N<a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">)</a> << <span class="stringliteral">','</span></div>
|
||||
<div class="line"><a id="l00193" name="l00193"></a><span class="lineno"> 193</span> << <a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">scientific_format</a><a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">(</a>data<a class="code hl_variable" href="classdata__t.html#a586475e0f71322dffda2e75f228ab24b">.</a><a class="code hl_variable" href="classdata__t.html#a586475e0f71322dffda2e75f228ab24b">M_abs</a> / N<a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">)</a> << <span class="stringliteral">','</span></div>
|
||||
<div class="line"><a id="l00194" name="l00194"></a><span class="lineno"> 194</span> << <a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">scientific_format</a><a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">(</a>E_var / (temp * temp)<a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">)</a> << <span class="stringliteral">','</span></div>
|
||||
<div class="line"><a id="l00195" name="l00195"></a><span class="lineno"> 195</span> << <a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">scientific_format</a><a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">(</a>M_var / temp<a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">)</a> << <span class="stringliteral">'\n'</span>;</div>
|
||||
<div class="line"><a id="l00196" name="l00196"></a><span class="lineno"> 196</span> }</div>
|
||||
<div class="line"><a id="l00197" name="l00197"></a><span class="lineno"> 197</span> ofile.close();</div>
|
||||
<div class="line"><a id="l00198" name="l00198"></a><span class="lineno"> 198</span>}</div>
|
||||
<div class="line"><a id="l00199" name="l00199"></a><span class="lineno"> 199</span>} <span class="comment">// namespace montecarlo</span></div>
|
||||
<div class="line"><a id="l00177" name="l00177"></a><span class="lineno"> 177</span> ofile << <a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">scientific_format</a><a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">(</a>temp<a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">)</a> << <span class="stringliteral">','</span></div>
|
||||
<div class="line"><a id="l00178" name="l00178"></a><span class="lineno"> 178</span> << <a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">scientific_format</a><a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">(</a>data<a class="code hl_variable" href="classdata__t.html#a6c1a196d96e177b11ca98c61fae35a2e">.</a><a class="code hl_variable" href="classdata__t.html#a6c1a196d96e177b11ca98c61fae35a2e">E</a> / (<span class="keywordtype">double</span>)N<a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">)</a> << <span class="stringliteral">','</span></div>
|
||||
<div class="line"><a id="l00179" name="l00179"></a><span class="lineno"> 179</span> << <a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">scientific_format</a><a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">(</a>data<a class="code hl_variable" href="classdata__t.html#a586475e0f71322dffda2e75f228ab24b">.</a><a class="code hl_variable" href="classdata__t.html#a586475e0f71322dffda2e75f228ab24b">M_abs</a> / N<a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">)</a> << <span class="stringliteral">','</span></div>
|
||||
<div class="line"><a id="l00180" name="l00180"></a><span class="lineno"> 180</span> << <a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">scientific_format</a><a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">(</a>E_var / (temp * temp)<a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">)</a> << <span class="stringliteral">','</span></div>
|
||||
<div class="line"><a id="l00181" name="l00181"></a><span class="lineno"> 181</span> << <a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">scientific_format</a><a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">(</a>M_var / temp<a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">)</a> << <span class="stringliteral">'\n'</span>;</div>
|
||||
<div class="line"><a id="l00182" name="l00182"></a><span class="lineno"> 182</span> }</div>
|
||||
<div class="line"><a id="l00183" name="l00183"></a><span class="lineno"> 183</span> ofile.close();</div>
|
||||
<div class="line"><a id="l00184" name="l00184"></a><span class="lineno"> 184</span>}</div>
|
||||
<div class="line"><a id="l00185" name="l00185"></a><span class="lineno"> 185</span>} <span class="comment">// namespace montecarlo</span></div>
|
||||
<div class="ttc" id="aclassIsingModel_html"><div class="ttname"><a href="classIsingModel.html">IsingModel</a></div><div class="ttdoc">The Ising model in 2 dimensions.</div><div class="ttdef"><b>Definition:</b> <a href="IsingModel_8hpp_source.html#l00036">IsingModel.hpp:36</a></div></div>
|
||||
<div class="ttc" id="aclassIsingModel_html_a46c9446e94854452f715d307c77c1c15"><div class="ttname"><a href="classIsingModel.html#a46c9446e94854452f715d307c77c1c15">IsingModel::IsingModel</a></div><div class="ttdeci">IsingModel(int L, double T, int val)</div><div class="ttdoc">Constructor for the Ising model.</div><div class="ttdef"><b>Definition:</b> <a href="IsingModel_8cpp_source.html#l00031">IsingModel.cpp:31</a></div></div>
|
||||
<div class="ttc" id="aclassIsingModel_html_a4a39ee7fbfbbf566f75bc28900ca9ea5"><div class="ttname"><a href="classIsingModel.html#a4a39ee7fbfbbf566f75bc28900ca9ea5">IsingModel::IsingModel</a></div><div class="ttdeci">IsingModel(int L, double T)</div><div class="ttdoc">Constructor for the Ising model.</div><div class="ttdef"><b>Definition:</b> <a href="IsingModel_8cpp_source.html#l00019">IsingModel.cpp:19</a></div></div>
|
||||
@ -311,12 +297,12 @@ $(document).ready(function(){initNavTree('monte__carlo_8cpp_source.html',''); in
|
||||
<div class="ttc" id="aclassdata__t_html_a71ae3cd4460f2c66239500c11804e70b"><div class="ttname"><a href="classdata__t.html#a71ae3cd4460f2c66239500c11804e70b">data_t::M2</a></div><div class="ttdeci">double M2</div><div class="ttdoc">Magnetization squared.</div><div class="ttdef"><b>Definition:</b> <a href="data__type_8hpp_source.html#l00024">data_type.hpp:24</a></div></div>
|
||||
<div class="ttc" id="aclassdata__t_html_abb622f9c6cc5ffb9dddb151d2e202f72"><div class="ttname"><a href="classdata__t.html#abb622f9c6cc5ffb9dddb151d2e202f72">data_t::E2</a></div><div class="ttdeci">double E2</div><div class="ttdoc">Energy squared.</div><div class="ttdef"><b>Definition:</b> <a href="data__type_8hpp_source.html#l00023">data_type.hpp:23</a></div></div>
|
||||
<div class="ttc" id="aclassdata__t_html_ad08d2488bf913c626157471cf6e8a46a"><div class="ttname"><a href="classdata__t.html#ad08d2488bf913c626157471cf6e8a46a">data_t::M</a></div><div class="ttdeci">double M</div><div class="ttdoc">Magnetization.</div><div class="ttdef"><b>Definition:</b> <a href="data__type_8hpp_source.html#l00022">data_type.hpp:22</a></div></div>
|
||||
<div class="ttc" id="amonte__carlo_8hpp_html_a1549fc386bd3cdd1cdbe0261b9dd8415"><div class="ttname"><a href="monte__carlo_8hpp.html#a1549fc386bd3cdd1cdbe0261b9dd8415">montecarlo::progression</a></div><div class="ttdeci">void progression(double T, int L, int cycles, int value, const std::string filename, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Write the expected values for each Monte Carlo cycles to file.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00053">monte_carlo.cpp:53</a></div></div>
|
||||
<div class="ttc" id="amonte__carlo_8hpp_html_a34e9c3e24f26760693266b8a7b6b3d21"><div class="ttname"><a href="monte__carlo_8hpp.html#a34e9c3e24f26760693266b8a7b6b3d21">montecarlo::phase_transition</a></div><div class="ttdeci">void phase_transition(int L, double start_T, double end_T, int points_T, int cycles, std::function< data_t(int, double, int, int)> monte_carlo, std::string outfile, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Perform the MCMC algorithm using a range of temperatures.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00169">monte_carlo.cpp:169</a></div></div>
|
||||
<div class="ttc" id="amonte__carlo_8hpp_html_a1549fc386bd3cdd1cdbe0261b9dd8415"><div class="ttname"><a href="monte__carlo_8hpp.html#a1549fc386bd3cdd1cdbe0261b9dd8415">montecarlo::progression</a></div><div class="ttdeci">void progression(double T, int L, int cycles, int value, const std::string filename, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Write the expected values for each Monte Carlo cycles to file.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00046">monte_carlo.cpp:46</a></div></div>
|
||||
<div class="ttc" id="amonte__carlo_8hpp_html_a34e9c3e24f26760693266b8a7b6b3d21"><div class="ttname"><a href="monte__carlo_8hpp.html#a34e9c3e24f26760693266b8a7b6b3d21">montecarlo::phase_transition</a></div><div class="ttdeci">void phase_transition(int L, double start_T, double end_T, int points_T, int cycles, std::function< data_t(int, double, int, int)> monte_carlo, std::string outfile, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Perform the MCMC algorithm using a range of temperatures.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00155">monte_carlo.cpp:155</a></div></div>
|
||||
<div class="ttc" id="amonte__carlo_8hpp_html_a781d946de16211ba18ad6671a5b6838d"><div class="ttname"><a href="monte__carlo_8hpp.html#a781d946de16211ba18ad6671a5b6838d">montecarlo::progression</a></div><div class="ttdeci">void progression(double T, int L, int cycles, const std::string filename, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Write the expected values for each Monte Carlo cycles to file.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00015">monte_carlo.cpp:15</a></div></div>
|
||||
<div class="ttc" id="amonte__carlo_8hpp_html_ae1e7f904ecfc3d8f3c4dd1ef155dd771"><div class="ttname"><a href="monte__carlo_8hpp.html#ae1e7f904ecfc3d8f3c4dd1ef155dd771">montecarlo::mcmc_parallel</a></div><div class="ttdeci">data_t mcmc_parallel(int L, double T, int cycles, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Execute the Metropolis algorithm for a certain amount of Monte Carlo cycles in parallel.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00141">monte_carlo.cpp:141</a></div></div>
|
||||
<div class="ttc" id="amonte__carlo_8hpp_html_ae67483ff00d1b0594d543261c8283ffd"><div class="ttname"><a href="monte__carlo_8hpp.html#ae67483ff00d1b0594d543261c8283ffd">montecarlo::mcmc_serial</a></div><div class="ttdeci">data_t mcmc_serial(int L, double T, int cycles, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Execute the Metropolis algorithm for a certain amount of Monte Carlo cycles.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00122">monte_carlo.cpp:122</a></div></div>
|
||||
<div class="ttc" id="amonte__carlo_8hpp_html_aea2dd1b5fac7c45633bc6f8dc4541226"><div class="ttname"><a href="monte__carlo_8hpp.html#aea2dd1b5fac7c45633bc6f8dc4541226">montecarlo::pd_estimate</a></div><div class="ttdeci">void pd_estimate(double T, int L, int cycles, const std::string filename, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Estimate the probability distribution for the energy.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00091">monte_carlo.cpp:91</a></div></div>
|
||||
<div class="ttc" id="amonte__carlo_8hpp_html_ae1e7f904ecfc3d8f3c4dd1ef155dd771"><div class="ttname"><a href="monte__carlo_8hpp.html#ae1e7f904ecfc3d8f3c4dd1ef155dd771">montecarlo::mcmc_parallel</a></div><div class="ttdeci">data_t mcmc_parallel(int L, double T, int cycles, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Execute the Metropolis algorithm for a certain amount of Monte Carlo cycles in parallel.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00127">monte_carlo.cpp:127</a></div></div>
|
||||
<div class="ttc" id="amonte__carlo_8hpp_html_ae67483ff00d1b0594d543261c8283ffd"><div class="ttname"><a href="monte__carlo_8hpp.html#ae67483ff00d1b0594d543261c8283ffd">montecarlo::mcmc_serial</a></div><div class="ttdeci">data_t mcmc_serial(int L, double T, int cycles, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Execute the Metropolis algorithm for a certain amount of Monte Carlo cycles.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00108">monte_carlo.cpp:108</a></div></div>
|
||||
<div class="ttc" id="amonte__carlo_8hpp_html_aea2dd1b5fac7c45633bc6f8dc4541226"><div class="ttname"><a href="monte__carlo_8hpp.html#aea2dd1b5fac7c45633bc6f8dc4541226">montecarlo::pd_estimate</a></div><div class="ttdeci">void pd_estimate(double T, int L, int cycles, const std::string filename, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Estimate the probability distribution for the energy.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00077">monte_carlo.cpp:77</a></div></div>
|
||||
<div class="ttc" id="autils_8hpp_html_a2b45adc86b70f42021582994e83fa00d"><div class="ttname"><a href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">utils::mkpath</a></div><div class="ttdeci">bool mkpath(std::string path, int mode=0777)</div><div class="ttdoc">Make path given.</div><div class="ttdef"><b>Definition:</b> <a href="utils_8cpp_source.html#l00032">utils.cpp:32</a></div></div>
|
||||
<div class="ttc" id="autils_8hpp_html_a3529a74fd2a25d24de73d9d4e1c90835"><div class="ttname"><a href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">utils::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> <a href="utils_8cpp_source.html#l00016">utils.cpp:16</a></div></div>
|
||||
<div class="ttc" id="autils_8hpp_html_aed026119193a9bbe076671809ff0f430"><div class="ttname"><a href="utils_8hpp.html#aed026119193a9bbe076671809ff0f430">utils::dirname</a></div><div class="ttdeci">std::string dirname(const std::string &path)</div><div class="ttdoc">Get the directory name of the path.</div><div class="ttdef"><b>Definition:</b> <a href="utils_8cpp_source.html#l00058">utils.cpp:58</a></div></div>
|
||||
|
||||
@ -219,7 +219,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
|
||||
</dl>
|
||||
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="classdata__t.html" title="Type to use with the IsingModel class and montecarlo module.">data_t</a> </dd></dl>
|
||||
|
||||
<p class="definition">Definition at line <a class="el" href="monte__carlo_8cpp_source.html#l00141">141</a> of file <a class="el" href="monte__carlo_8cpp_source.html">monte_carlo.cpp</a>.</p>
|
||||
<p class="definition">Definition at line <a class="el" href="monte__carlo_8cpp_source.html#l00127">127</a> of file <a class="el" href="monte__carlo_8cpp_source.html">monte_carlo.cpp</a>.</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@ -273,7 +273,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
|
||||
</dl>
|
||||
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="classdata__t.html" title="Type to use with the IsingModel class and montecarlo module.">data_t</a> </dd></dl>
|
||||
|
||||
<p class="definition">Definition at line <a class="el" href="monte__carlo_8cpp_source.html#l00122">122</a> of file <a class="el" href="monte__carlo_8cpp_source.html">monte_carlo.cpp</a>.</p>
|
||||
<p class="definition">Definition at line <a class="el" href="monte__carlo_8cpp_source.html#l00108">108</a> of file <a class="el" href="monte__carlo_8cpp_source.html">monte_carlo.cpp</a>.</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@ -333,7 +333,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<p class="definition">Definition at line <a class="el" href="monte__carlo_8cpp_source.html#l00091">91</a> of file <a class="el" href="monte__carlo_8cpp_source.html">monte_carlo.cpp</a>.</p>
|
||||
<p class="definition">Definition at line <a class="el" href="monte__carlo_8cpp_source.html#l00077">77</a> of file <a class="el" href="monte__carlo_8cpp_source.html">monte_carlo.cpp</a>.</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@ -413,7 +413,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<p class="definition">Definition at line <a class="el" href="monte__carlo_8cpp_source.html#l00169">169</a> of file <a class="el" href="monte__carlo_8cpp_source.html">monte_carlo.cpp</a>.</p>
|
||||
<p class="definition">Definition at line <a class="el" href="monte__carlo_8cpp_source.html#l00155">155</a> of file <a class="el" href="monte__carlo_8cpp_source.html">monte_carlo.cpp</a>.</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@ -540,7 +540,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<p class="definition">Definition at line <a class="el" href="monte__carlo_8cpp_source.html#l00053">53</a> of file <a class="el" href="monte__carlo_8cpp_source.html">monte_carlo.cpp</a>.</p>
|
||||
<p class="definition">Definition at line <a class="el" href="monte__carlo_8cpp_source.html#l00046">46</a> of file <a class="el" href="monte__carlo_8cpp_source.html">monte_carlo.cpp</a>.</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -207,18 +207,18 @@ $(document).ready(function(){initNavTree('monte__carlo_8hpp_source.html',''); in
|
||||
<div class="ttc" id="aclassdata__t_html"><div class="ttname"><a href="classdata__t.html">data_t</a></div><div class="ttdoc">Type to use with the IsingModel class and montecarlo module.</div><div class="ttdef"><b>Definition:</b> <a href="data__type_8hpp_source.html#l00019">data_type.hpp:19</a></div></div>
|
||||
<div class="ttc" id="amain_8cpp_html_a0dfa85080578dffff23b68e372cece95"><div class="ttname"><a href="main_8cpp.html#a0dfa85080578dffff23b68e372cece95">test_parallel_speedup</a></div><div class="ttdeci">void test_parallel_speedup()</div><div class="ttdoc">Test how much Openmp speeds up.</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00060">main.cpp:60</a></div></div>
|
||||
<div class="ttc" id="amain_8cpp_html_a3c04138a5bfe5d72780bb7e82a18e627"><div class="ttname"><a href="main_8cpp.html#a3c04138a5bfe5d72780bb7e82a18e627">main</a></div><div class="ttdeci">int main(int argc, char **argv)</div><div class="ttdoc">The main function.</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00125">main.cpp:125</a></div></div>
|
||||
<div class="ttc" id="amain_8cpp_html_a4f8ea24364d72024915d3753a572cc5b"><div class="ttname"><a href="main_8cpp.html#a4f8ea24364d72024915d3753a572cc5b">create_pd_estimate_data</a></div><div class="ttdeci">void create_pd_estimate_data()</div><div class="ttdoc">Create the data used to estimate the probability distribution for tempratures 1.0 anbd 2....</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00037">main.cpp:37</a></div></div>
|
||||
<div class="ttc" id="amain_8cpp_html_a4f8ea24364d72024915d3753a572cc5b"><div class="ttname"><a href="main_8cpp.html#a4f8ea24364d72024915d3753a572cc5b">create_pd_estimate_data</a></div><div class="ttdeci">void create_pd_estimate_data()</div><div class="ttdoc">Create the data used to estimate the probability distribution for tempratures 1.0 and 2....</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00037">main.cpp:37</a></div></div>
|
||||
<div class="ttc" id="amain_8cpp_html_a68406fc2dd8de5849c3984658c171f32"><div class="ttname"><a href="main_8cpp.html#a68406fc2dd8de5849c3984658c171f32">create_burn_in_time_data</a></div><div class="ttdeci">void create_burn_in_time_data()</div><div class="ttdoc">Create the data for the burn-in time for temperatures 1.0 and 2.4 for both unordered and ordered init...</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00021">main.cpp:21</a></div></div>
|
||||
<div class="ttc" id="amain_8cpp_html_a746d8dc451b2b2536abbb1ff1acaf861"><div class="ttname"><a href="main_8cpp.html#a746d8dc451b2b2536abbb1ff1acaf861">test_burn_in_time</a></div><div class="ttdeci">void test_burn_in_time()</div><div class="ttdoc">Create data using the same parameters except one uses burn-in time, while the other doesn't.</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00049">main.cpp:49</a></div></div>
|
||||
<div class="ttc" id="amain_8cpp_html_a9d62cf1399596f4c5a39abdd3196d76d"><div class="ttname"><a href="main_8cpp.html#a9d62cf1399596f4c5a39abdd3196d76d">create_phase_transition_data</a></div><div class="ttdeci">void create_phase_transition_data()</div><div class="ttdoc">Create data for studying phase transition.</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00083">main.cpp:83</a></div></div>
|
||||
<div class="ttc" id="amain_8cpp_html_ac907e18135856c90366aaa599a9e10b1"><div class="ttname"><a href="main_8cpp.html#ac907e18135856c90366aaa599a9e10b1">usage</a></div><div class="ttdeci">void usage(std::string filename)</div><div class="ttdoc">A function that displays how to use the program and quits.</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00110">main.cpp:110</a></div></div>
|
||||
<div class="ttc" id="amonte__carlo_8hpp_html_a1549fc386bd3cdd1cdbe0261b9dd8415"><div class="ttname"><a href="monte__carlo_8hpp.html#a1549fc386bd3cdd1cdbe0261b9dd8415">montecarlo::progression</a></div><div class="ttdeci">void progression(double T, int L, int cycles, int value, const std::string filename, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Write the expected values for each Monte Carlo cycles to file.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00053">monte_carlo.cpp:53</a></div></div>
|
||||
<div class="ttc" id="amonte__carlo_8hpp_html_a34e9c3e24f26760693266b8a7b6b3d21"><div class="ttname"><a href="monte__carlo_8hpp.html#a34e9c3e24f26760693266b8a7b6b3d21">montecarlo::phase_transition</a></div><div class="ttdeci">void phase_transition(int L, double start_T, double end_T, int points_T, int cycles, std::function< data_t(int, double, int, int)> monte_carlo, std::string outfile, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Perform the MCMC algorithm using a range of temperatures.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00169">monte_carlo.cpp:169</a></div></div>
|
||||
<div class="ttc" id="amonte__carlo_8hpp_html_a1549fc386bd3cdd1cdbe0261b9dd8415"><div class="ttname"><a href="monte__carlo_8hpp.html#a1549fc386bd3cdd1cdbe0261b9dd8415">montecarlo::progression</a></div><div class="ttdeci">void progression(double T, int L, int cycles, int value, const std::string filename, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Write the expected values for each Monte Carlo cycles to file.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00046">monte_carlo.cpp:46</a></div></div>
|
||||
<div class="ttc" id="amonte__carlo_8hpp_html_a34e9c3e24f26760693266b8a7b6b3d21"><div class="ttname"><a href="monte__carlo_8hpp.html#a34e9c3e24f26760693266b8a7b6b3d21">montecarlo::phase_transition</a></div><div class="ttdeci">void phase_transition(int L, double start_T, double end_T, int points_T, int cycles, std::function< data_t(int, double, int, int)> monte_carlo, std::string outfile, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Perform the MCMC algorithm using a range of temperatures.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00155">monte_carlo.cpp:155</a></div></div>
|
||||
<div class="ttc" id="amonte__carlo_8hpp_html_a362b5ad7de095387fcbc573632a19cbf"><div class="ttname"><a href="monte__carlo_8hpp.html#a362b5ad7de095387fcbc573632a19cbf">BURN_IN_TIME</a></div><div class="ttdeci">#define BURN_IN_TIME</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8hpp_source.html#l00024">monte_carlo.hpp:24</a></div></div>
|
||||
<div class="ttc" id="amonte__carlo_8hpp_html_a781d946de16211ba18ad6671a5b6838d"><div class="ttname"><a href="monte__carlo_8hpp.html#a781d946de16211ba18ad6671a5b6838d">montecarlo::progression</a></div><div class="ttdeci">void progression(double T, int L, int cycles, const std::string filename, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Write the expected values for each Monte Carlo cycles to file.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00015">monte_carlo.cpp:15</a></div></div>
|
||||
<div class="ttc" id="amonte__carlo_8hpp_html_ae1e7f904ecfc3d8f3c4dd1ef155dd771"><div class="ttname"><a href="monte__carlo_8hpp.html#ae1e7f904ecfc3d8f3c4dd1ef155dd771">montecarlo::mcmc_parallel</a></div><div class="ttdeci">data_t mcmc_parallel(int L, double T, int cycles, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Execute the Metropolis algorithm for a certain amount of Monte Carlo cycles in parallel.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00141">monte_carlo.cpp:141</a></div></div>
|
||||
<div class="ttc" id="amonte__carlo_8hpp_html_ae67483ff00d1b0594d543261c8283ffd"><div class="ttname"><a href="monte__carlo_8hpp.html#ae67483ff00d1b0594d543261c8283ffd">montecarlo::mcmc_serial</a></div><div class="ttdeci">data_t mcmc_serial(int L, double T, int cycles, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Execute the Metropolis algorithm for a certain amount of Monte Carlo cycles.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00122">monte_carlo.cpp:122</a></div></div>
|
||||
<div class="ttc" id="amonte__carlo_8hpp_html_aea2dd1b5fac7c45633bc6f8dc4541226"><div class="ttname"><a href="monte__carlo_8hpp.html#aea2dd1b5fac7c45633bc6f8dc4541226">montecarlo::pd_estimate</a></div><div class="ttdeci">void pd_estimate(double T, int L, int cycles, const std::string filename, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Estimate the probability distribution for the energy.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00091">monte_carlo.cpp:91</a></div></div>
|
||||
<div class="ttc" id="amonte__carlo_8hpp_html_ae1e7f904ecfc3d8f3c4dd1ef155dd771"><div class="ttname"><a href="monte__carlo_8hpp.html#ae1e7f904ecfc3d8f3c4dd1ef155dd771">montecarlo::mcmc_parallel</a></div><div class="ttdeci">data_t mcmc_parallel(int L, double T, int cycles, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Execute the Metropolis algorithm for a certain amount of Monte Carlo cycles in parallel.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00127">monte_carlo.cpp:127</a></div></div>
|
||||
<div class="ttc" id="amonte__carlo_8hpp_html_ae67483ff00d1b0594d543261c8283ffd"><div class="ttname"><a href="monte__carlo_8hpp.html#ae67483ff00d1b0594d543261c8283ffd">montecarlo::mcmc_serial</a></div><div class="ttdeci">data_t mcmc_serial(int L, double T, int cycles, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Execute the Metropolis algorithm for a certain amount of Monte Carlo cycles.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00108">monte_carlo.cpp:108</a></div></div>
|
||||
<div class="ttc" id="amonte__carlo_8hpp_html_aea2dd1b5fac7c45633bc6f8dc4541226"><div class="ttname"><a href="monte__carlo_8hpp.html#aea2dd1b5fac7c45633bc6f8dc4541226">montecarlo::pd_estimate</a></div><div class="ttdeci">void pd_estimate(double T, int L, int cycles, const std::string filename, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Estimate the probability distribution for the energy.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00077">monte_carlo.cpp:77</a></div></div>
|
||||
</div><!-- fragment --></div><!-- contents -->
|
||||
</div><!-- doc-content -->
|
||||
<!-- start footer part -->
|
||||
|
||||
@ -183,7 +183,7 @@ $(document).ready(function(){initNavTree('pd__estimate_8cpp_source.html',''); in
|
||||
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span>}</div>
|
||||
<div class="ttc" id="amain_8cpp_html_a3c04138a5bfe5d72780bb7e82a18e627"><div class="ttname"><a href="main_8cpp.html#a3c04138a5bfe5d72780bb7e82a18e627">main</a></div><div class="ttdeci">int main(int argc, char **argv)</div><div class="ttdoc">The main function.</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00125">main.cpp:125</a></div></div>
|
||||
<div class="ttc" id="amain_8cpp_html_ac907e18135856c90366aaa599a9e10b1"><div class="ttname"><a href="main_8cpp.html#ac907e18135856c90366aaa599a9e10b1">usage</a></div><div class="ttdeci">void usage(std::string filename)</div><div class="ttdoc">A function that displays how to use the program and quits.</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00110">main.cpp:110</a></div></div>
|
||||
<div class="ttc" id="amonte__carlo_8hpp_html_aea2dd1b5fac7c45633bc6f8dc4541226"><div class="ttname"><a href="monte__carlo_8hpp.html#aea2dd1b5fac7c45633bc6f8dc4541226">montecarlo::pd_estimate</a></div><div class="ttdeci">void pd_estimate(double T, int L, int cycles, const std::string filename, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Estimate the probability distribution for the energy.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00091">monte_carlo.cpp:91</a></div></div>
|
||||
<div class="ttc" id="amonte__carlo_8hpp_html_aea2dd1b5fac7c45633bc6f8dc4541226"><div class="ttname"><a href="monte__carlo_8hpp.html#aea2dd1b5fac7c45633bc6f8dc4541226">montecarlo::pd_estimate</a></div><div class="ttdeci">void pd_estimate(double T, int L, int cycles, const std::string filename, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Estimate the probability distribution for the energy.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00077">monte_carlo.cpp:77</a></div></div>
|
||||
</div><!-- fragment --></div><!-- contents -->
|
||||
</div><!-- doc-content -->
|
||||
<!-- start footer part -->
|
||||
|
||||
@ -186,8 +186,8 @@ $(document).ready(function(){initNavTree('phase__transition_8cpp_source.html',''
|
||||
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span>}</div>
|
||||
<div class="ttc" id="amain_8cpp_html_a3c04138a5bfe5d72780bb7e82a18e627"><div class="ttname"><a href="main_8cpp.html#a3c04138a5bfe5d72780bb7e82a18e627">main</a></div><div class="ttdeci">int main(int argc, char **argv)</div><div class="ttdoc">The main function.</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00125">main.cpp:125</a></div></div>
|
||||
<div class="ttc" id="amain_8cpp_html_ac907e18135856c90366aaa599a9e10b1"><div class="ttname"><a href="main_8cpp.html#ac907e18135856c90366aaa599a9e10b1">usage</a></div><div class="ttdeci">void usage(std::string filename)</div><div class="ttdoc">A function that displays how to use the program and quits.</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00110">main.cpp:110</a></div></div>
|
||||
<div class="ttc" id="amonte__carlo_8hpp_html_a34e9c3e24f26760693266b8a7b6b3d21"><div class="ttname"><a href="monte__carlo_8hpp.html#a34e9c3e24f26760693266b8a7b6b3d21">montecarlo::phase_transition</a></div><div class="ttdeci">void phase_transition(int L, double start_T, double end_T, int points_T, int cycles, std::function< data_t(int, double, int, int)> monte_carlo, std::string outfile, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Perform the MCMC algorithm using a range of temperatures.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00169">monte_carlo.cpp:169</a></div></div>
|
||||
<div class="ttc" id="amonte__carlo_8hpp_html_ae1e7f904ecfc3d8f3c4dd1ef155dd771"><div class="ttname"><a href="monte__carlo_8hpp.html#ae1e7f904ecfc3d8f3c4dd1ef155dd771">montecarlo::mcmc_parallel</a></div><div class="ttdeci">data_t mcmc_parallel(int L, double T, int cycles, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Execute the Metropolis algorithm for a certain amount of Monte Carlo cycles in parallel.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00141">monte_carlo.cpp:141</a></div></div>
|
||||
<div class="ttc" id="amonte__carlo_8hpp_html_a34e9c3e24f26760693266b8a7b6b3d21"><div class="ttname"><a href="monte__carlo_8hpp.html#a34e9c3e24f26760693266b8a7b6b3d21">montecarlo::phase_transition</a></div><div class="ttdeci">void phase_transition(int L, double start_T, double end_T, int points_T, int cycles, std::function< data_t(int, double, int, int)> monte_carlo, std::string outfile, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Perform the MCMC algorithm using a range of temperatures.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00155">monte_carlo.cpp:155</a></div></div>
|
||||
<div class="ttc" id="amonte__carlo_8hpp_html_ae1e7f904ecfc3d8f3c4dd1ef155dd771"><div class="ttname"><a href="monte__carlo_8hpp.html#ae1e7f904ecfc3d8f3c4dd1ef155dd771">montecarlo::mcmc_parallel</a></div><div class="ttdeci">data_t mcmc_parallel(int L, double T, int cycles, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Execute the Metropolis algorithm for a certain amount of Monte Carlo cycles in parallel.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00127">monte_carlo.cpp:127</a></div></div>
|
||||
</div><!-- fragment --></div><!-- contents -->
|
||||
</div><!-- doc-content -->
|
||||
<!-- start footer part -->
|
||||
|
||||
@ -279,7 +279,7 @@ $(document).ready(function(){initNavTree('phase__transition__mpi_8cpp_source.htm
|
||||
<div class="ttc" id="aclassdata__t_html"><div class="ttname"><a href="classdata__t.html">data_t</a></div><div class="ttdoc">Type to use with the IsingModel class and montecarlo module.</div><div class="ttdef"><b>Definition:</b> <a href="data__type_8hpp_source.html#l00019">data_type.hpp:19</a></div></div>
|
||||
<div class="ttc" id="amain_8cpp_html_a3c04138a5bfe5d72780bb7e82a18e627"><div class="ttname"><a href="main_8cpp.html#a3c04138a5bfe5d72780bb7e82a18e627">main</a></div><div class="ttdeci">int main(int argc, char **argv)</div><div class="ttdoc">The main function.</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00125">main.cpp:125</a></div></div>
|
||||
<div class="ttc" id="amain_8cpp_html_ac907e18135856c90366aaa599a9e10b1"><div class="ttname"><a href="main_8cpp.html#ac907e18135856c90366aaa599a9e10b1">usage</a></div><div class="ttdeci">void usage(std::string filename)</div><div class="ttdoc">A function that displays how to use the program and quits.</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00110">main.cpp:110</a></div></div>
|
||||
<div class="ttc" id="amonte__carlo_8hpp_html_ae1e7f904ecfc3d8f3c4dd1ef155dd771"><div class="ttname"><a href="monte__carlo_8hpp.html#ae1e7f904ecfc3d8f3c4dd1ef155dd771">montecarlo::mcmc_parallel</a></div><div class="ttdeci">data_t mcmc_parallel(int L, double T, int cycles, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Execute the Metropolis algorithm for a certain amount of Monte Carlo cycles in parallel.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00141">monte_carlo.cpp:141</a></div></div>
|
||||
<div class="ttc" id="amonte__carlo_8hpp_html_ae1e7f904ecfc3d8f3c4dd1ef155dd771"><div class="ttname"><a href="monte__carlo_8hpp.html#ae1e7f904ecfc3d8f3c4dd1ef155dd771">montecarlo::mcmc_parallel</a></div><div class="ttdeci">data_t mcmc_parallel(int L, double T, int cycles, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Execute the Metropolis algorithm for a certain amount of Monte Carlo cycles in parallel.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00127">monte_carlo.cpp:127</a></div></div>
|
||||
<div class="ttc" id="autils_8hpp_html_a2b45adc86b70f42021582994e83fa00d"><div class="ttname"><a href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">utils::mkpath</a></div><div class="ttdeci">bool mkpath(std::string path, int mode=0777)</div><div class="ttdoc">Make path given.</div><div class="ttdef"><b>Definition:</b> <a href="utils_8cpp_source.html#l00032">utils.cpp:32</a></div></div>
|
||||
<div class="ttc" id="autils_8hpp_html_a3529a74fd2a25d24de73d9d4e1c90835"><div class="ttname"><a href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">utils::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> <a href="utils_8cpp_source.html#l00016">utils.cpp:16</a></div></div>
|
||||
<div class="ttc" id="autils_8hpp_html_aed026119193a9bbe076671809ff0f430"><div class="ttname"><a href="utils_8hpp.html#aed026119193a9bbe076671809ff0f430">utils::dirname</a></div><div class="ttdeci">std::string dirname(const std::string &path)</div><div class="ttdoc">Get the directory name of the path.</div><div class="ttdef"><b>Definition:</b> <a href="utils_8cpp_source.html#l00058">utils.cpp:58</a></div></div>
|
||||
|
||||
@ -168,7 +168,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
|
||||
|
||||
<p>The main function. </p>
|
||||
|
||||
<p class="definition">Definition at line <a class="el" href="time_8cpp_source.html#l00079">79</a> of file <a class="el" href="time_8cpp_source.html">time.cpp</a>.</p>
|
||||
<p class="definition">Definition at line <a class="el" href="time_8cpp_source.html#l00087">87</a> of file <a class="el" href="time_8cpp_source.html">time.cpp</a>.</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@ -210,7 +210,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
|
||||
|
||||
<p>Time phase transition using different sample sizes. </p>
|
||||
|
||||
<p class="definition">Definition at line <a class="el" href="time_8cpp_source.html#l00045">45</a> of file <a class="el" href="time_8cpp_source.html">time.cpp</a>.</p>
|
||||
<p class="definition">Definition at line <a class="el" href="time_8cpp_source.html#l00049">49</a> of file <a class="el" href="time_8cpp_source.html">time.cpp</a>.</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@ -232,7 +232,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
|
||||
|
||||
<p>A function that displays how to use the program and quits. </p>
|
||||
|
||||
<p class="definition">Definition at line <a class="el" href="time_8cpp_source.html#l00067">67</a> of file <a class="el" href="time_8cpp_source.html">time.cpp</a>.</p>
|
||||
<p class="definition">Definition at line <a class="el" href="time_8cpp_source.html#l00075">75</a> of file <a class="el" href="time_8cpp_source.html">time.cpp</a>.</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -124,110 +124,119 @@ $(document).ready(function(){initNavTree('time_8cpp_source.html',''); initResiza
|
||||
<div class="line"><span class="lineno"> 21</span><span class="comment"> * */</span></div>
|
||||
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"><a class="line" href="time_8cpp.html#aa224066f42c47cae5fbd457c1948e4a5"> 22</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="time_8cpp.html#aa224066f42c47cae5fbd457c1948e4a5">time_lattice_sizes</a>()</div>
|
||||
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span>{</div>
|
||||
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> std::string outfile = <span class="stringliteral">"data/timing/lattice_sizes.txt"</span>;</div>
|
||||
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> std::string outfile = <span class="stringliteral">"data/hp/timing/lattice_sizes.txt"</span>;</div>
|
||||
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> std::ofstream ofile;</div>
|
||||
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span> </div>
|
||||
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> <span class="keywordtype">int</span> lattice_sizes[] = {20, 40, 60, 80, 100};</div>
|
||||
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span> </div>
|
||||
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span> utils<a class="code hl_function" href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">::</a><a class="code hl_function" href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">mkpath</a><a class="code hl_function" href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">(</a>utils<a class="code hl_function" href="utils_8hpp.html#aed026119193a9bbe076671809ff0f430">::</a><a class="code hl_function" href="utils_8hpp.html#aed026119193a9bbe076671809ff0f430">dirname</a><a class="code hl_function" href="utils_8hpp.html#aed026119193a9bbe076671809ff0f430">(</a>outfile<a class="code hl_function" href="utils_8hpp.html#aed026119193a9bbe076671809ff0f430">)</a><a class="code hl_function" href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">)</a>;</div>
|
||||
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span> ofile.open(outfile);</div>
|
||||
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> <span class="keywordtype">double</span> t0, t1;</div>
|
||||
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> <span class="keywordtype">double</span> t0, t1, t2;</div>
|
||||
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> L : lattice_sizes) {</div>
|
||||
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> t0 = omp_get_wtime();</div>
|
||||
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span> montecarlo<a class="code hl_function" href="monte__carlo_8hpp.html#a34e9c3e24f26760693266b8a7b6b3d21">::</a><a class="code hl_function" href="monte__carlo_8hpp.html#a34e9c3e24f26760693266b8a7b6b3d21">phase_transition</a>(L, 2.1, 2.4, 40, 100000,</div>
|
||||
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> montecarlo<a class="code hl_function" href="monte__carlo_8hpp.html#ae1e7f904ecfc3d8f3c4dd1ef155dd771">::</a><a class="code hl_function" href="monte__carlo_8hpp.html#ae1e7f904ecfc3d8f3c4dd1ef155dd771">mcmc_parallel</a>, <span class="stringliteral">"/dev/null"</span>);</div>
|
||||
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span> montecarlo<a class="code hl_function" href="monte__carlo_8hpp.html#a34e9c3e24f26760693266b8a7b6b3d21">::</a><a class="code hl_function" href="monte__carlo_8hpp.html#a34e9c3e24f26760693266b8a7b6b3d21">phase_transition</a>(L, 2.1, 2.4, 40, 20000,</div>
|
||||
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> montecarlo<a class="code hl_function" href="monte__carlo_8hpp.html#ae1e7f904ecfc3d8f3c4dd1ef155dd771">::</a><a class="code hl_function" href="monte__carlo_8hpp.html#ae1e7f904ecfc3d8f3c4dd1ef155dd771">mcmc_parallel</a>, <span class="stringliteral">"/dev/null"</span>, 0);</div>
|
||||
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> t1 = omp_get_wtime();</div>
|
||||
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> ofile << utils<a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">::</a><a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">scientific_format</a><a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">(</a>L<a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">)</a> << <span class="stringliteral">','</span></div>
|
||||
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> << utils<a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">::</a><a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">scientific_format</a><a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">(</a>t1 - t0<a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">)</a> << <span class="stringliteral">'\n'</span>;</div>
|
||||
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> }</div>
|
||||
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> ofile.close();</div>
|
||||
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span>}</div>
|
||||
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> </div>
|
||||
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span><span class="comment">/** @brief Time phase transition using different sample sizes.</span></div>
|
||||
<div class="line"><span class="lineno"> 44</span><span class="comment"> * */</span></div>
|
||||
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"><a class="line" href="time_8cpp.html#ace9eb0821fe4edf19cf2e7d8ffe6efb4"> 45</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="time_8cpp.html#ace9eb0821fe4edf19cf2e7d8ffe6efb4">time_sample_sizes</a>()</div>
|
||||
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span>{</div>
|
||||
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span> std::string outfile = <span class="stringliteral">"data/timing/sample_sizes.txt"</span>;</div>
|
||||
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> std::ofstream ofile;</div>
|
||||
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> </div>
|
||||
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> <span class="keywordtype">int</span> sample_sizes[] = {1000, 10000, 100000};</div>
|
||||
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> </div>
|
||||
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> utils<a class="code hl_function" href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">::</a><a class="code hl_function" href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">mkpath</a><a class="code hl_function" href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">(</a>utils<a class="code hl_function" href="utils_8hpp.html#aed026119193a9bbe076671809ff0f430">::</a><a class="code hl_function" href="utils_8hpp.html#aed026119193a9bbe076671809ff0f430">dirname</a><a class="code hl_function" href="utils_8hpp.html#aed026119193a9bbe076671809ff0f430">(</a>outfile<a class="code hl_function" href="utils_8hpp.html#aed026119193a9bbe076671809ff0f430">)</a><a class="code hl_function" href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">)</a>;</div>
|
||||
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> ofile.open(outfile);</div>
|
||||
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> <span class="keywordtype">double</span> t0, t1;</div>
|
||||
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> samples : sample_sizes) {</div>
|
||||
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> t0 = omp_get_wtime();</div>
|
||||
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> montecarlo<a class="code hl_function" href="monte__carlo_8hpp.html#a34e9c3e24f26760693266b8a7b6b3d21">::</a><a class="code hl_function" href="monte__carlo_8hpp.html#a34e9c3e24f26760693266b8a7b6b3d21">phase_transition</a>(20, 2.1, 2.4, 40, samples,</div>
|
||||
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span> montecarlo<a class="code hl_function" href="monte__carlo_8hpp.html#ae1e7f904ecfc3d8f3c4dd1ef155dd771">::</a><a class="code hl_function" href="monte__carlo_8hpp.html#ae1e7f904ecfc3d8f3c4dd1ef155dd771">mcmc_parallel</a>, <span class="stringliteral">"/dev/null"</span>);</div>
|
||||
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span> t1 = omp_get_wtime();</div>
|
||||
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> ofile << utils<a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">::</a><a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">scientific_format</a><a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">(</a>samples<a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">)</a> << <span class="stringliteral">','</span></div>
|
||||
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> << utils<a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">::</a><a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">scientific_format</a><a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">(</a>t1 - t0<a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">)</a> << <span class="stringliteral">'\n'</span>;</div>
|
||||
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> }</div>
|
||||
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> ofile.close();</div>
|
||||
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span>}</div>
|
||||
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> </div>
|
||||
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span><span class="comment">/** @brief A function that displays how to use the program and quits.*/</span></div>
|
||||
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"><a class="line" href="time_8cpp.html#ac907e18135856c90366aaa599a9e10b1"> 67</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="main_8cpp.html#ac907e18135856c90366aaa599a9e10b1">usage</a>(std::string filename)</div>
|
||||
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span>{</div>
|
||||
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> std::cout << <span class="stringliteral">"Usage: "</span> << filename << <span class="stringliteral">" OPTION ...\n"</span></div>
|
||||
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span> << <span class="stringliteral">"At least one option should be used.\n\n"</span></div>
|
||||
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span> << <span class="stringliteral">"\t[ -h | --help ]\n"</span></div>
|
||||
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span> << <span class="stringliteral">"\t[ --all ]\n"</span></div>
|
||||
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> << <span class="stringliteral">"\t[ --time-lattice-sizes ]\n"</span></div>
|
||||
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span> << <span class="stringliteral">"\t[ --time-sample-sizes ]\n"</span>;</div>
|
||||
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span> exit(-1);</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> </div>
|
||||
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span><span class="comment">/** @brief The main function.*/</span></div>
|
||||
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"><a class="line" href="time_8cpp.html#a3c04138a5bfe5d72780bb7e82a18e627"> 79</a></span><span class="keywordtype">int</span> <a class="code hl_function" href="main_8cpp.html#a3c04138a5bfe5d72780bb7e82a18e627">main</a>(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> **argv)</div>
|
||||
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span>{</div>
|
||||
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> <span class="keyword">struct</span> option long_options[] = {{<span class="stringliteral">"all"</span>, 0, 0, 0},</div>
|
||||
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span> {<span class="stringliteral">"time-lattice-sizes"</span>, 0, 0, 0},</div>
|
||||
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span> {<span class="stringliteral">"time-sample-sizes"</span>, 0, 0, 0},</div>
|
||||
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span> {<span class="stringliteral">"help"</span>, 0, 0, 0},</div>
|
||||
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span> {NULL, 0, NULL, 0}};</div>
|
||||
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno"> 86</span> </div>
|
||||
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno"> 87</span> <span class="keywordtype">int</span> option_index = -1;</div>
|
||||
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span> <span class="keywordtype">int</span> c;</div>
|
||||
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span> </div>
|
||||
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span> <span class="keywordflow">while</span> (<span class="keyword">true</span>) {</div>
|
||||
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span> c = getopt_long(argc, argv, <span class="stringliteral">"h"</span>, long_options, &option_index);</div>
|
||||
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"> 92</span> </div>
|
||||
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span> <span class="keywordflow">if</span> (c == -1)</div>
|
||||
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span> <span class="keywordflow">break</span>;</div>
|
||||
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"> 95</span> </div>
|
||||
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno"> 96</span> <span class="keywordflow">switch</span> (c) {</div>
|
||||
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno"> 97</span> <span class="keywordflow">case</span> 0:</div>
|
||||
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno"> 98</span> <span class="keywordflow">switch</span> (option_index) {</div>
|
||||
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"> 99</span> <span class="keywordflow">case</span> 0:</div>
|
||||
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"> 100</span> <a class="code hl_function" href="time_8cpp.html#aa224066f42c47cae5fbd457c1948e4a5">time_lattice_sizes</a><a class="code hl_function" href="time_8cpp.html#aa224066f42c47cae5fbd457c1948e4a5">(</a><a class="code hl_function" href="time_8cpp.html#aa224066f42c47cae5fbd457c1948e4a5">)</a>;</div>
|
||||
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno"> 101</span> <a class="code hl_function" href="time_8cpp.html#ace9eb0821fe4edf19cf2e7d8ffe6efb4">time_sample_sizes</a><a class="code hl_function" href="time_8cpp.html#ace9eb0821fe4edf19cf2e7d8ffe6efb4">(</a><a class="code hl_function" href="time_8cpp.html#ace9eb0821fe4edf19cf2e7d8ffe6efb4">)</a>;</div>
|
||||
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> montecarlo<a class="code hl_function" href="monte__carlo_8hpp.html#a34e9c3e24f26760693266b8a7b6b3d21">::</a><a class="code hl_function" href="monte__carlo_8hpp.html#a34e9c3e24f26760693266b8a7b6b3d21">phase_transition</a>(L, 2.1, 2.4, 40, 20000,</div>
|
||||
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> montecarlo<a class="code hl_function" href="monte__carlo_8hpp.html#ae67483ff00d1b0594d543261c8283ffd">::</a><a class="code hl_function" href="monte__carlo_8hpp.html#ae67483ff00d1b0594d543261c8283ffd">mcmc_serial</a>, <span class="stringliteral">"/dev/null"</span>, 0);</div>
|
||||
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> t2 = omp_get_wtime();</div>
|
||||
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> ofile << utils<a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">::</a><a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">scientific_format</a><a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">(</a>L<a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">)</a> << <span class="stringliteral">','</span></div>
|
||||
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span> << utils<a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">::</a><a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">scientific_format</a><a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">(</a>t1 - t0<a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">)</a> << <span class="stringliteral">','</span></div>
|
||||
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> << utils<a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">::</a><a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">scientific_format</a><a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">(</a>t2 - t1<a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">)</a> << <span class="stringliteral">'\n'</span>;</div>
|
||||
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> }</div>
|
||||
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> ofile.close();</div>
|
||||
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span>}</div>
|
||||
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span> </div>
|
||||
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span><span class="comment">/** @brief Time phase transition using different sample sizes.</span></div>
|
||||
<div class="line"><span class="lineno"> 48</span><span class="comment"> * */</span></div>
|
||||
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"><a class="line" href="time_8cpp.html#ace9eb0821fe4edf19cf2e7d8ffe6efb4"> 49</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="time_8cpp.html#ace9eb0821fe4edf19cf2e7d8ffe6efb4">time_sample_sizes</a>()</div>
|
||||
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span>{</div>
|
||||
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> std::string outfile = <span class="stringliteral">"data/hp/timing/sample_sizes.txt"</span>;</div>
|
||||
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> std::ofstream ofile;</div>
|
||||
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> </div>
|
||||
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> <span class="keywordtype">int</span> sample_sizes[] = {1000, 10000, 100000};</div>
|
||||
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span> </div>
|
||||
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> utils<a class="code hl_function" href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">::</a><a class="code hl_function" href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">mkpath</a><a class="code hl_function" href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">(</a>utils<a class="code hl_function" href="utils_8hpp.html#aed026119193a9bbe076671809ff0f430">::</a><a class="code hl_function" href="utils_8hpp.html#aed026119193a9bbe076671809ff0f430">dirname</a><a class="code hl_function" href="utils_8hpp.html#aed026119193a9bbe076671809ff0f430">(</a>outfile<a class="code hl_function" href="utils_8hpp.html#aed026119193a9bbe076671809ff0f430">)</a><a class="code hl_function" href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">)</a>;</div>
|
||||
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> ofile.open(outfile);</div>
|
||||
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span> <span class="keywordtype">double</span> t0, t1, t2;</div>
|
||||
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> samples : sample_sizes) {</div>
|
||||
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> t0 = omp_get_wtime();</div>
|
||||
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> montecarlo<a class="code hl_function" href="monte__carlo_8hpp.html#a34e9c3e24f26760693266b8a7b6b3d21">::</a><a class="code hl_function" href="monte__carlo_8hpp.html#a34e9c3e24f26760693266b8a7b6b3d21">phase_transition</a>(20, 2.1, 2.4, 40, samples,</div>
|
||||
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> montecarlo<a class="code hl_function" href="monte__carlo_8hpp.html#ae1e7f904ecfc3d8f3c4dd1ef155dd771">::</a><a class="code hl_function" href="monte__carlo_8hpp.html#ae1e7f904ecfc3d8f3c4dd1ef155dd771">mcmc_parallel</a>, <span class="stringliteral">"/dev/null"</span>, 0);</div>
|
||||
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> t1 = omp_get_wtime();</div>
|
||||
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> montecarlo<a class="code hl_function" href="monte__carlo_8hpp.html#a34e9c3e24f26760693266b8a7b6b3d21">::</a><a class="code hl_function" href="monte__carlo_8hpp.html#a34e9c3e24f26760693266b8a7b6b3d21">phase_transition</a>(20, 2.1, 2.4, 40, samples,</div>
|
||||
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> montecarlo<a class="code hl_function" href="monte__carlo_8hpp.html#ae67483ff00d1b0594d543261c8283ffd">::</a><a class="code hl_function" href="monte__carlo_8hpp.html#ae67483ff00d1b0594d543261c8283ffd">mcmc_serial</a>, <span class="stringliteral">"/dev/null"</span>, 0);</div>
|
||||
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span> t2 = omp_get_wtime();</div>
|
||||
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span> ofile << utils<a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">::</a><a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">scientific_format</a><a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">(</a>samples<a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">)</a> << <span class="stringliteral">','</span></div>
|
||||
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span> << utils<a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">::</a><a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">scientific_format</a><a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">(</a>t1 - t0<a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">)</a> << <span class="stringliteral">','</span></div>
|
||||
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> << utils<a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">::</a><a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">scientific_format</a><a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">(</a>t2 - t1<a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">)</a> << <span class="stringliteral">'\n'</span>;</div>
|
||||
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span> }</div>
|
||||
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span> ofile.close();</div>
|
||||
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span>}</div>
|
||||
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> </div>
|
||||
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span><span class="comment">/** @brief A function that displays how to use the program and quits.*/</span></div>
|
||||
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"><a class="line" href="time_8cpp.html#ac907e18135856c90366aaa599a9e10b1"> 75</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="main_8cpp.html#ac907e18135856c90366aaa599a9e10b1">usage</a>(std::string filename)</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> std::cout << <span class="stringliteral">"Usage: "</span> << filename << <span class="stringliteral">" OPTION ...\n"</span></div>
|
||||
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> << <span class="stringliteral">"At least one option should be used.\n\n"</span></div>
|
||||
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> << <span class="stringliteral">"\t[ -h | --help ]\n"</span></div>
|
||||
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> << <span class="stringliteral">"\t[ --all ]\n"</span></div>
|
||||
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> << <span class="stringliteral">"\t[ --time-lattice-sizes ]\n"</span></div>
|
||||
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span> << <span class="stringliteral">"\t[ --time-sample-sizes ]\n"</span>;</div>
|
||||
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span> exit(-1);</div>
|
||||
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span>}</div>
|
||||
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span> </div>
|
||||
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno"> 86</span><span class="comment">/** @brief The main function.*/</span></div>
|
||||
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno"><a class="line" href="time_8cpp.html#a3c04138a5bfe5d72780bb7e82a18e627"> 87</a></span><span class="keywordtype">int</span> <a class="code hl_function" href="main_8cpp.html#a3c04138a5bfe5d72780bb7e82a18e627">main</a>(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> **argv)</div>
|
||||
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span>{</div>
|
||||
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span> <span class="keyword">struct</span> option long_options[] = {{<span class="stringliteral">"all"</span>, 0, 0, 0},</div>
|
||||
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span> {<span class="stringliteral">"time-lattice-sizes"</span>, 0, 0, 0},</div>
|
||||
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span> {<span class="stringliteral">"time-sample-sizes"</span>, 0, 0, 0},</div>
|
||||
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"> 92</span> {<span class="stringliteral">"help"</span>, 0, 0, 0},</div>
|
||||
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span> {NULL, 0, NULL, 0}};</div>
|
||||
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span> </div>
|
||||
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"> 95</span> <span class="keywordtype">int</span> option_index = -1;</div>
|
||||
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno"> 96</span> <span class="keywordtype">int</span> c;</div>
|
||||
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno"> 97</span> </div>
|
||||
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno"> 98</span> <span class="keywordflow">while</span> (<span class="keyword">true</span>) {</div>
|
||||
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"> 99</span> c = getopt_long(argc, argv, <span class="stringliteral">"h"</span>, long_options, &option_index);</div>
|
||||
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"> 100</span> </div>
|
||||
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno"> 101</span> <span class="keywordflow">if</span> (c == -1)</div>
|
||||
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno"> 102</span> <span class="keywordflow">break</span>;</div>
|
||||
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"> 103</span> <span class="keywordflow">case</span> 1:</div>
|
||||
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"> 104</span> <a class="code hl_function" href="time_8cpp.html#aa224066f42c47cae5fbd457c1948e4a5">time_lattice_sizes</a><a class="code hl_function" href="time_8cpp.html#aa224066f42c47cae5fbd457c1948e4a5">(</a><a class="code hl_function" href="time_8cpp.html#aa224066f42c47cae5fbd457c1948e4a5">)</a>;</div>
|
||||
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span> <span class="keywordflow">break</span>;</div>
|
||||
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span> <span class="keywordflow">case</span> 2:</div>
|
||||
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"> 107</span> <a class="code hl_function" href="time_8cpp.html#ace9eb0821fe4edf19cf2e7d8ffe6efb4">time_sample_sizes</a><a class="code hl_function" href="time_8cpp.html#ace9eb0821fe4edf19cf2e7d8ffe6efb4">(</a><a class="code hl_function" href="time_8cpp.html#ace9eb0821fe4edf19cf2e7d8ffe6efb4">)</a>;</div>
|
||||
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno"> 108</span> <span class="keywordflow">break</span>;</div>
|
||||
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno"> 109</span> <span class="keywordflow">case</span> 3: <span class="comment">// Not a mistake. This just goes to the default.</span></div>
|
||||
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno"> 110</span> <span class="keywordflow">default</span>:</div>
|
||||
<div class="line"><a id="l00111" name="l00111"></a><span class="lineno"> 111</span> usage(argv[0]);</div>
|
||||
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno"> 112</span> }</div>
|
||||
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"> 103</span> </div>
|
||||
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"> 104</span> <span class="keywordflow">switch</span> (c) {</div>
|
||||
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span> <span class="keywordflow">case</span> 0:</div>
|
||||
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span> <span class="keywordflow">switch</span> (option_index) {</div>
|
||||
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"> 107</span> <span class="keywordflow">case</span> 0:</div>
|
||||
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno"> 108</span> <a class="code hl_function" href="time_8cpp.html#aa224066f42c47cae5fbd457c1948e4a5">time_lattice_sizes</a><a class="code hl_function" href="time_8cpp.html#aa224066f42c47cae5fbd457c1948e4a5">(</a><a class="code hl_function" href="time_8cpp.html#aa224066f42c47cae5fbd457c1948e4a5">)</a>;</div>
|
||||
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno"> 109</span> <a class="code hl_function" href="time_8cpp.html#ace9eb0821fe4edf19cf2e7d8ffe6efb4">time_sample_sizes</a><a class="code hl_function" href="time_8cpp.html#ace9eb0821fe4edf19cf2e7d8ffe6efb4">(</a><a class="code hl_function" href="time_8cpp.html#ace9eb0821fe4edf19cf2e7d8ffe6efb4">)</a>;</div>
|
||||
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno"> 110</span> <span class="keywordflow">break</span>;</div>
|
||||
<div class="line"><a id="l00111" name="l00111"></a><span class="lineno"> 111</span> <span class="keywordflow">case</span> 1:</div>
|
||||
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno"> 112</span> <a class="code hl_function" href="time_8cpp.html#aa224066f42c47cae5fbd457c1948e4a5">time_lattice_sizes</a><a class="code hl_function" href="time_8cpp.html#aa224066f42c47cae5fbd457c1948e4a5">(</a><a class="code hl_function" href="time_8cpp.html#aa224066f42c47cae5fbd457c1948e4a5">)</a>;</div>
|
||||
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno"> 113</span> <span class="keywordflow">break</span>;</div>
|
||||
<div class="line"><a id="l00114" name="l00114"></a><span class="lineno"> 114</span> <span class="keywordflow">case</span> <span class="stringliteral">'h'</span>:</div>
|
||||
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno"> 115</span> <span class="keywordflow">default</span>:</div>
|
||||
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno"> 116</span> usage(argv[0]);</div>
|
||||
<div class="line"><a id="l00117" name="l00117"></a><span class="lineno"> 117</span> }</div>
|
||||
<div class="line"><a id="l00118" name="l00118"></a><span class="lineno"> 118</span> }</div>
|
||||
<div class="line"><a id="l00119" name="l00119"></a><span class="lineno"> 119</span> </div>
|
||||
<div class="line"><a id="l00120" name="l00120"></a><span class="lineno"> 120</span> <span class="keywordflow">return</span> 0;</div>
|
||||
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno"> 121</span>}</div>
|
||||
<div class="line"><a id="l00114" name="l00114"></a><span class="lineno"> 114</span> <span class="keywordflow">case</span> 2:</div>
|
||||
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno"> 115</span> <a class="code hl_function" href="time_8cpp.html#ace9eb0821fe4edf19cf2e7d8ffe6efb4">time_sample_sizes</a><a class="code hl_function" href="time_8cpp.html#ace9eb0821fe4edf19cf2e7d8ffe6efb4">(</a><a class="code hl_function" href="time_8cpp.html#ace9eb0821fe4edf19cf2e7d8ffe6efb4">)</a>;</div>
|
||||
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno"> 116</span> <span class="keywordflow">break</span>;</div>
|
||||
<div class="line"><a id="l00117" name="l00117"></a><span class="lineno"> 117</span> <span class="keywordflow">case</span> 3: <span class="comment">// Not a mistake. This just goes to the default.</span></div>
|
||||
<div class="line"><a id="l00118" name="l00118"></a><span class="lineno"> 118</span> <span class="keywordflow">default</span>:</div>
|
||||
<div class="line"><a id="l00119" name="l00119"></a><span class="lineno"> 119</span> usage(argv[0]);</div>
|
||||
<div class="line"><a id="l00120" name="l00120"></a><span class="lineno"> 120</span> }</div>
|
||||
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno"> 121</span> <span class="keywordflow">break</span>;</div>
|
||||
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno"> 122</span> <span class="keywordflow">case</span> <span class="stringliteral">'h'</span>:</div>
|
||||
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno"> 123</span> <span class="keywordflow">default</span>:</div>
|
||||
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno"> 124</span> usage(argv[0]);</div>
|
||||
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno"> 125</span> }</div>
|
||||
<div class="line"><a id="l00126" name="l00126"></a><span class="lineno"> 126</span> }</div>
|
||||
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno"> 127</span> </div>
|
||||
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno"> 128</span> <span class="keywordflow">return</span> 0;</div>
|
||||
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno"> 129</span>}</div>
|
||||
<div class="ttc" id="amain_8cpp_html_a3c04138a5bfe5d72780bb7e82a18e627"><div class="ttname"><a href="main_8cpp.html#a3c04138a5bfe5d72780bb7e82a18e627">main</a></div><div class="ttdeci">int main(int argc, char **argv)</div><div class="ttdoc">The main function.</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00125">main.cpp:125</a></div></div>
|
||||
<div class="ttc" id="amain_8cpp_html_ac907e18135856c90366aaa599a9e10b1"><div class="ttname"><a href="main_8cpp.html#ac907e18135856c90366aaa599a9e10b1">usage</a></div><div class="ttdeci">void usage(std::string filename)</div><div class="ttdoc">A function that displays how to use the program and quits.</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00110">main.cpp:110</a></div></div>
|
||||
<div class="ttc" id="amonte__carlo_8hpp_html_a34e9c3e24f26760693266b8a7b6b3d21"><div class="ttname"><a href="monte__carlo_8hpp.html#a34e9c3e24f26760693266b8a7b6b3d21">montecarlo::phase_transition</a></div><div class="ttdeci">void phase_transition(int L, double start_T, double end_T, int points_T, int cycles, std::function< data_t(int, double, int, int)> monte_carlo, std::string outfile, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Perform the MCMC algorithm using a range of temperatures.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00169">monte_carlo.cpp:169</a></div></div>
|
||||
<div class="ttc" id="amonte__carlo_8hpp_html_ae1e7f904ecfc3d8f3c4dd1ef155dd771"><div class="ttname"><a href="monte__carlo_8hpp.html#ae1e7f904ecfc3d8f3c4dd1ef155dd771">montecarlo::mcmc_parallel</a></div><div class="ttdeci">data_t mcmc_parallel(int L, double T, int cycles, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Execute the Metropolis algorithm for a certain amount of Monte Carlo cycles in parallel.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00141">monte_carlo.cpp:141</a></div></div>
|
||||
<div class="ttc" id="amonte__carlo_8hpp_html_a34e9c3e24f26760693266b8a7b6b3d21"><div class="ttname"><a href="monte__carlo_8hpp.html#a34e9c3e24f26760693266b8a7b6b3d21">montecarlo::phase_transition</a></div><div class="ttdeci">void phase_transition(int L, double start_T, double end_T, int points_T, int cycles, std::function< data_t(int, double, int, int)> monte_carlo, std::string outfile, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Perform the MCMC algorithm using a range of temperatures.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00155">monte_carlo.cpp:155</a></div></div>
|
||||
<div class="ttc" id="amonte__carlo_8hpp_html_ae1e7f904ecfc3d8f3c4dd1ef155dd771"><div class="ttname"><a href="monte__carlo_8hpp.html#ae1e7f904ecfc3d8f3c4dd1ef155dd771">montecarlo::mcmc_parallel</a></div><div class="ttdeci">data_t mcmc_parallel(int L, double T, int cycles, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Execute the Metropolis algorithm for a certain amount of Monte Carlo cycles in parallel.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00127">monte_carlo.cpp:127</a></div></div>
|
||||
<div class="ttc" id="amonte__carlo_8hpp_html_ae67483ff00d1b0594d543261c8283ffd"><div class="ttname"><a href="monte__carlo_8hpp.html#ae67483ff00d1b0594d543261c8283ffd">montecarlo::mcmc_serial</a></div><div class="ttdeci">data_t mcmc_serial(int L, double T, int cycles, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Execute the Metropolis algorithm for a certain amount of Monte Carlo cycles.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00108">monte_carlo.cpp:108</a></div></div>
|
||||
<div class="ttc" id="atime_8cpp_html_aa224066f42c47cae5fbd457c1948e4a5"><div class="ttname"><a href="time_8cpp.html#aa224066f42c47cae5fbd457c1948e4a5">time_lattice_sizes</a></div><div class="ttdeci">void time_lattice_sizes()</div><div class="ttdoc">Time phase transition using different lattice sizes.</div><div class="ttdef"><b>Definition:</b> <a href="time_8cpp_source.html#l00022">time.cpp:22</a></div></div>
|
||||
<div class="ttc" id="atime_8cpp_html_ace9eb0821fe4edf19cf2e7d8ffe6efb4"><div class="ttname"><a href="time_8cpp.html#ace9eb0821fe4edf19cf2e7d8ffe6efb4">time_sample_sizes</a></div><div class="ttdeci">void time_sample_sizes()</div><div class="ttdoc">Time phase transition using different sample sizes.</div><div class="ttdef"><b>Definition:</b> <a href="time_8cpp_source.html#l00045">time.cpp:45</a></div></div>
|
||||
<div class="ttc" id="atime_8cpp_html_ace9eb0821fe4edf19cf2e7d8ffe6efb4"><div class="ttname"><a href="time_8cpp.html#ace9eb0821fe4edf19cf2e7d8ffe6efb4">time_sample_sizes</a></div><div class="ttdeci">void time_sample_sizes()</div><div class="ttdoc">Time phase transition using different sample sizes.</div><div class="ttdef"><b>Definition:</b> <a href="time_8cpp_source.html#l00049">time.cpp:49</a></div></div>
|
||||
<div class="ttc" id="autils_8hpp_html_a2b45adc86b70f42021582994e83fa00d"><div class="ttname"><a href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">utils::mkpath</a></div><div class="ttdeci">bool mkpath(std::string path, int mode=0777)</div><div class="ttdoc">Make path given.</div><div class="ttdef"><b>Definition:</b> <a href="utils_8cpp_source.html#l00032">utils.cpp:32</a></div></div>
|
||||
<div class="ttc" id="autils_8hpp_html_a3529a74fd2a25d24de73d9d4e1c90835"><div class="ttname"><a href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">utils::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> <a href="utils_8cpp_source.html#l00016">utils.cpp:16</a></div></div>
|
||||
<div class="ttc" id="autils_8hpp_html_aed026119193a9bbe076671809ff0f430"><div class="ttname"><a href="utils_8hpp.html#aed026119193a9bbe076671809ff0f430">utils::dirname</a></div><div class="ttdeci">std::string dirname(const std::string &path)</div><div class="ttdoc">Get the directory name of the path.</div><div class="ttdef"><b>Definition:</b> <a href="utils_8cpp_source.html#l00058">utils.cpp:58</a></div></div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user