Documentation for 8914128e13

This commit is contained in:
github-actions 2020-06-28 20:40:24 +00:00
parent 48d1caae8f
commit c913d6795e
459 changed files with 6948 additions and 11367 deletions

View File

@ -96,12 +96,12 @@ $(document).ready(function(){initNavTree('annotated.html',''); initResizable();
<div class="contents">
<div class="textblock">Here are the data structures with brief descriptions:</div><div class="directory">
<table class="directory">
<tr id="row_0_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="dc/d77/struct__big__int.html" target="_self">_big_int</a></td><td class="desc"></td></tr>
<tr id="row_1_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="d3/d5a/struct__large__num.html" target="_self">_large_num</a></td><td class="desc"></td></tr>
<tr id="row_2_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="d2/daa/structadaline.html" target="_self">adaline</a></td><td class="desc"></td></tr>
<tr id="row_3_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="d0/dc8/structarray__3d.html" target="_self">array_3d</a></td><td class="desc"></td></tr>
<tr id="row_0_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="dc/d77/struct__big__int.html" target="_self">_big_int</a></td><td class="desc">Store arbitratily large integer values as a linked list of digits </td></tr>
<tr id="row_1_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="d3/d5a/struct__large__num.html" target="_self">_large_num</a></td><td class="desc">Dynamically large number </td></tr>
<tr id="row_2_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="d2/daa/structadaline.html" target="_self">adaline</a></td><td class="desc">Structure to hold adaline model parameters </td></tr>
<tr id="row_3_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="d0/dc8/structarray__3d.html" target="_self">array_3d</a></td><td class="desc">To store info regarding 3D arrays </td></tr>
<tr id="row_4_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="d2/d71/struct_a_v_lnode.html" target="_self">AVLnode</a></td><td class="desc"></td></tr>
<tr id="row_5_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="d4/d02/struct_b_s_t_iterator.html" target="_self">BSTIterator</a></td><td class="desc"></td></tr>
<tr id="row_5_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="d4/d02/struct_b_s_t_iterator.html" target="_self">BSTIterator</a></td><td class="desc">Definition for a binary tree node </td></tr>
<tr id="row_6_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="d4/d2d/struct_c_array.html" target="_self">CArray</a></td><td class="desc"></td></tr>
<tr id="row_7_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="d2/d89/structcontour.html" target="_self">contour</a></td><td class="desc"></td></tr>
<tr id="row_8_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="df/dea/structdata.html" target="_self">data</a></td><td class="desc"></td></tr>
@ -115,9 +115,9 @@ $(document).ready(function(){initNavTree('annotated.html',''); initResizable();
<tr id="row_16_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="df/db3/struct_l.html" target="_self">L</a></td><td class="desc"></td></tr>
<tr id="row_17_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="d0/d8a/structmax__heap.html" target="_self">max_heap</a></td><td class="desc"></td></tr>
<tr id="row_18_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="de/dce/structmin__heap.html" target="_self">min_heap</a></td><td class="desc"></td></tr>
<tr id="row_19_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="db/d8b/struct_node.html" target="_self">Node</a></td><td class="desc"></td></tr>
<tr id="row_20_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="d5/da1/structnode.html" target="_self">node</a></td><td class="desc"></td></tr>
<tr id="row_21_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="d0/d43/structpid.html" target="_self">pid</a></td><td class="desc"></td></tr>
<tr id="row_19_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="db/d8b/struct_node.html" target="_self">Node</a></td><td class="desc"><a class="el" href="db/d8b/struct_node.html" title="Node, the basic data structure of the tree.">Node</a>, the basic data structure of the tree </td></tr>
<tr id="row_20_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="d5/da1/structnode.html" target="_self">node</a></td><td class="desc">Kyler Smith, 2017 <a class="el" href="dd/d10/struct_stack.html">Stack</a> data structure implementation </td></tr>
<tr id="row_21_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="d0/d43/structpid.html" target="_self">pid</a></td><td class="desc">PID Controller </td></tr>
<tr id="row_22_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="d2/d36/structqueue.html" target="_self">queue</a></td><td class="desc"></td></tr>
<tr id="row_23_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="d0/d10/struct_queue_rep.html" target="_self">QueueRep</a></td><td class="desc"></td></tr>
<tr id="row_24_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="dd/d10/struct_stack.html" target="_self">Stack</a></td><td class="desc"></td></tr>

View File

@ -1,3 +1,3 @@
<map id="node" name="node">
<area shape="rect" id="node1" title=" " alt="" coords="5,51,56,77"/>
<area shape="rect" id="node1" title="Kyler Smith, 2017 Stack data structure implementation." alt="" coords="5,51,56,77"/>
</map>

View File

@ -1 +1 @@
9368a08a51646ec65cca83a26b4cf4a6
043576a4dcc74ad8f1be870cb495956f

View File

@ -12,7 +12,7 @@
<!-- Node1 -->
<g id="node1" class="node">
<title>Node1</title>
<g id="a_node1"><a xlink:title=" ">
<g id="a_node1"><a xlink:title="Kyler Smith, 2017 Stack data structure implementation.">
<polygon fill="#bfbfbf" stroke="black" points="0,-34.5 0,-53.5 38,-53.5 38,-34.5 0,-34.5"/>
<text text-anchor="middle" x="19" y="-41.5" font-family="Helvetica,sans-Serif" font-size="10.00">node</text>
</a>

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -96,6 +96,9 @@ $(document).ready(function(){initNavTree('d0/d43/structpid.html','../../'); init
<div class="title">pid Struct Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>PID Controller.
<a href="../../d0/d43/structpid.html#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-attribs"></a>
Data Fields</h2></td></tr>
@ -116,7 +119,7 @@ float&#160;</td><td class="memItemRight" valign="bottom"><b>integral</b></td></t
<tr class="separator:a3c54185f7b4867281786eff640443a00"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>PID Controller</p>
<div class="textblock"><p>PID Controller. </p>
<p>The PID controller is a linear control algorithm that has three terms:</p><ul>
<li>Proportional: A simple scaling of the error value by a gain kP</li>
<li>Integral: Integration of the error value over time, then multipled by gain kI</li>
@ -125,7 +128,7 @@ float&#160;</td><td class="memItemRight" valign="bottom"><b>integral</b></td></t
<p>Terms of the controller can be removed by setting their gain to 0, creating a PI (kD = 0) or PD (kI = 0) controller. Depending on the control problem at hand, some terms may not increase the performance of the system, or may have a negative effect.</p>
<p>For a more mathematical expanation of the PID Controller, see <a href="https://en.wikipedia.org/wiki/PID_controller">https://en.wikipedia.org/wiki/PID_controller</a></p>
<p>Limitations of this implementation:</p><ul>
<li>Since this implementation is just for demonstration, the pid_step function takes the dt as a parameter, and it can be provided by the user in <a class="el" href="../../d7/dd8/c__atoi__str__to__integer_8c.html#a3c04138a5bfe5d72780bb7e82a18e627">main()</a>. This allows deterministic experimentation with the algorithm, rather than using time(NULL) which would make the function non-deterministic.</li>
<li>Since this implementation is just for demonstration, the pid_step function takes the dt as a parameter, and it can be provided by the user in <a class="el" href="../../d7/dd8/c__atoi__str__to__integer_8c.html#a3c04138a5bfe5d72780bb7e82a18e627" title="the main function take one argument of type char* example : .">main()</a>. This allows deterministic experimentation with the algorithm, rather than using time(NULL) which would make the function non-deterministic.</li>
</ul>
<p>Inputs: e(t) - Current error at time t. For example, how far a servo is off the desired angle Output: u(t) - Controller output at time t. </p>
</div><hr/>The documentation for this struct was generated from the following file:<ul>

View File

@ -113,121 +113,67 @@ Include dependency graph for kohonen_som_trace.c:</div>
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:a525335710b53cb064ca56b936120431e"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d46/kohonen__som__trace_8c.html#a525335710b53cb064ca56b936120431e">_USE_MATH_DEFINES</a></td></tr>
<tr class="memitem:a525335710b53cb064ca56b936120431e"><td class="memItemLeft" align="right" valign="top"><a id="a525335710b53cb064ca56b936120431e"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d46/kohonen__som__trace_8c.html#a525335710b53cb064ca56b936120431e">_USE_MATH_DEFINES</a></td></tr>
<tr class="memdesc:a525335710b53cb064ca56b936120431e"><td class="mdescLeft">&#160;</td><td class="mdescRight">required for MS Visual C <br /></td></tr>
<tr class="separator:a525335710b53cb064ca56b936120431e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:affe776513b24d84b39af8ab0930fef7f"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d46/kohonen__som__trace_8c.html#affe776513b24d84b39af8ab0930fef7f">max</a>(a, b)&#160;&#160;&#160;(((a) &gt; (b)) ? (a) : (b))</td></tr>
<tr class="memitem:affe776513b24d84b39af8ab0930fef7f"><td class="memItemLeft" align="right" valign="top"><a id="affe776513b24d84b39af8ab0930fef7f"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d46/kohonen__som__trace_8c.html#affe776513b24d84b39af8ab0930fef7f">max</a>(a, b)&#160;&#160;&#160;(((a) &gt; (b)) ? (a) : (b))</td></tr>
<tr class="memdesc:affe776513b24d84b39af8ab0930fef7f"><td class="mdescLeft">&#160;</td><td class="mdescRight">shorthand for maximum value <br /></td></tr>
<tr class="separator:affe776513b24d84b39af8ab0930fef7f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac6afabdc09a49a433ee19d8a9486056d"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d46/kohonen__som__trace_8c.html#ac6afabdc09a49a433ee19d8a9486056d">min</a>(a, b)&#160;&#160;&#160;(((a) &lt; (b)) ? (a) : (b))</td></tr>
<tr class="memitem:ac6afabdc09a49a433ee19d8a9486056d"><td class="memItemLeft" align="right" valign="top"><a id="ac6afabdc09a49a433ee19d8a9486056d"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d46/kohonen__som__trace_8c.html#ac6afabdc09a49a433ee19d8a9486056d">min</a>(a, b)&#160;&#160;&#160;(((a) &lt; (b)) ? (a) : (b))</td></tr>
<tr class="memdesc:ac6afabdc09a49a433ee19d8a9486056d"><td class="mdescLeft">&#160;</td><td class="mdescRight">shorthand for minimum value <br /></td></tr>
<tr class="separator:ac6afabdc09a49a433ee19d8a9486056d"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:af5ce14f026d6d231bef29161bac2b485"><td class="memItemLeft" align="right" valign="top">double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d46/kohonen__som__trace_8c.html#af5ce14f026d6d231bef29161bac2b485">_random</a> (double a, double b)</td></tr>
<tr class="memdesc:af5ce14f026d6d231bef29161bac2b485"><td class="mdescLeft">&#160;</td><td class="mdescRight">Helper function to generate a random number in a given interval. <a href="../../d0/d46/kohonen__som__trace_8c.html#af5ce14f026d6d231bef29161bac2b485">More...</a><br /></td></tr>
<tr class="separator:af5ce14f026d6d231bef29161bac2b485"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7b84b14e60f47812b581d1f93057c85a"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d46/kohonen__som__trace_8c.html#a7b84b14e60f47812b581d1f93057c85a">save_nd_data</a> (const char *fname, double **X, int num_points, int num_features)</td></tr>
<tr class="memdesc:a7b84b14e60f47812b581d1f93057c85a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Save a given n-dimensional data martix to file. <a href="../../d0/d46/kohonen__som__trace_8c.html#a7b84b14e60f47812b581d1f93057c85a">More...</a><br /></td></tr>
<tr class="separator:a7b84b14e60f47812b581d1f93057c85a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0a292ebd954c568934b1fd06666d27e6"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d46/kohonen__som__trace_8c.html#a0a292ebd954c568934b1fd06666d27e6">get_min_1d</a> (double const *X, int <a class="el" href="../../db/d01/problem__13_2sol1_8c.html#a0240ac851181b84ac374872dc5434ee4">N</a>, double *val, int *idx)</td></tr>
<tr class="memdesc:a0a292ebd954c568934b1fd06666d27e6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get minimum value and index of the value in a vector. <a href="../../d0/d46/kohonen__som__trace_8c.html#a0a292ebd954c568934b1fd06666d27e6">More...</a><br /></td></tr>
<tr class="separator:a0a292ebd954c568934b1fd06666d27e6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9c98203f55242ff7a8f45a6370840e66"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d46/kohonen__som__trace_8c.html#a9c98203f55242ff7a8f45a6370840e66">update_weights</a> (double const *x, double *const *W, double *D, int num_out, int num_features, double alpha, int R)</td></tr>
<tr class="memdesc:a9c98203f55242ff7a8f45a6370840e66"><td class="mdescLeft">&#160;</td><td class="mdescRight">Update weights of the SOM using Kohonen algorithm. <a href="../../d0/d46/kohonen__som__trace_8c.html#a9c98203f55242ff7a8f45a6370840e66">More...</a><br /></td></tr>
<tr class="separator:a9c98203f55242ff7a8f45a6370840e66"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aeaeffbff2be4d5d15b0d4f10f846abde"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d46/kohonen__som__trace_8c.html#aeaeffbff2be4d5d15b0d4f10f846abde">kohonen_som_tracer</a> (double **X, double *const *W, int num_samples, int num_features, int num_out, double alpha_min)</td></tr>
<tr class="memdesc:aeaeffbff2be4d5d15b0d4f10f846abde"><td class="mdescLeft">&#160;</td><td class="mdescRight">Apply incremental algorithm with updating neighborhood and learning rates on all samples in the given datset. <a href="../../d0/d46/kohonen__som__trace_8c.html#aeaeffbff2be4d5d15b0d4f10f846abde">More...</a><br /></td></tr>
<tr class="separator:aeaeffbff2be4d5d15b0d4f10f846abde"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a107f00650b8041f77767927073ddddb8"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d46/kohonen__som__trace_8c.html#a107f00650b8041f77767927073ddddb8">test_circle</a> (double *const *<a class="el" href="../../df/dea/structdata.html">data</a>, int <a class="el" href="../../db/d01/problem__13_2sol1_8c.html#a0240ac851181b84ac374872dc5434ee4">N</a>)</td></tr>
<tr class="memdesc:a107f00650b8041f77767927073ddddb8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates a random set of points distributed <em>near</em> the circumference of a circle and trains an SOM that finds that circular pattern. <a href="../../d0/d46/kohonen__som__trace_8c.html#a107f00650b8041f77767927073ddddb8">More...</a><br /></td></tr>
<tr class="separator:a107f00650b8041f77767927073ddddb8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1440a7779ac56f47a3f355ce4a8c7da0"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d46/kohonen__som__trace_8c.html#a1440a7779ac56f47a3f355ce4a8c7da0">test1</a> ()</td></tr>
<tr class="memdesc:a1440a7779ac56f47a3f355ce4a8c7da0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Test that creates a random set of points distributed <em>near</em> the circumference of a circle and trains an SOM that finds that circular pattern. <a href="../../d0/d46/kohonen__som__trace_8c.html#a1440a7779ac56f47a3f355ce4a8c7da0">More...</a><br /></td></tr>
<tr class="separator:a1440a7779ac56f47a3f355ce4a8c7da0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa2246f940155472084ee461f3685d614"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d46/kohonen__som__trace_8c.html#aa2246f940155472084ee461f3685d614">test_lamniscate</a> (double *const *<a class="el" href="../../df/dea/structdata.html">data</a>, int <a class="el" href="../../db/d01/problem__13_2sol1_8c.html#a0240ac851181b84ac374872dc5434ee4">N</a>)</td></tr>
<tr class="memdesc:aa2246f940155472084ee461f3685d614"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates a random set of points distributed <em>near</em> the locus of the <a href="https://en.wikipedia.org/wiki/Lemniscate_of_Gerono">Lamniscate of Gerono</a>. <a href="../../d0/d46/kohonen__som__trace_8c.html#aa2246f940155472084ee461f3685d614">More...</a><br /></td></tr>
<tr class="separator:aa2246f940155472084ee461f3685d614"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0283886819c7c140a023582b7269e2d0"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d46/kohonen__som__trace_8c.html#a0283886819c7c140a023582b7269e2d0">test2</a> ()</td></tr>
<tr class="memdesc:a0283886819c7c140a023582b7269e2d0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Test that creates a random set of points distributed <em>near</em> the locus of the <a href="https://en.wikipedia.org/wiki/Lemniscate_of_Gerono">Lamniscate of Gerono</a> and trains an SOM that finds that circular pattern. <a href="../../d0/d46/kohonen__som__trace_8c.html#a0283886819c7c140a023582b7269e2d0">More...</a><br /></td></tr>
<tr class="separator:a0283886819c7c140a023582b7269e2d0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a41ae16442e3e5b891a58d2e5932a2cd0"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d46/kohonen__som__trace_8c.html#a41ae16442e3e5b891a58d2e5932a2cd0">test_3d_classes</a> (double *const *<a class="el" href="../../df/dea/structdata.html">data</a>, int <a class="el" href="../../db/d01/problem__13_2sol1_8c.html#a0240ac851181b84ac374872dc5434ee4">N</a>)</td></tr>
<tr class="memdesc:a41ae16442e3e5b891a58d2e5932a2cd0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates a random set of points distributed in four clusters in 3D space with centroids at the points. <a href="../../d0/d46/kohonen__som__trace_8c.html#a41ae16442e3e5b891a58d2e5932a2cd0">More...</a><br /></td></tr>
<tr class="separator:a41ae16442e3e5b891a58d2e5932a2cd0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6d0455dd5c30adda100e95f0423c786e"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d46/kohonen__som__trace_8c.html#a6d0455dd5c30adda100e95f0423c786e">test3</a> ()</td></tr>
<tr class="memdesc:a6d0455dd5c30adda100e95f0423c786e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Test that creates a random set of points distributed in six clusters in 3D space. <a href="../../d0/d46/kohonen__som__trace_8c.html#a6d0455dd5c30adda100e95f0423c786e">More...</a><br /></td></tr>
<tr class="separator:a6d0455dd5c30adda100e95f0423c786e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2256c10b16edba377b64a44b6c656908"><td class="memItemLeft" align="right" valign="top">double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d46/kohonen__som__trace_8c.html#a2256c10b16edba377b64a44b6c656908">get_clock_diff</a> (clock_t start_t, clock_t end_t)</td></tr>
<tr class="memdesc:a2256c10b16edba377b64a44b6c656908"><td class="mdescLeft">&#160;</td><td class="mdescRight">Convert clock cycle difference to time in seconds. <a href="../../d0/d46/kohonen__som__trace_8c.html#a2256c10b16edba377b64a44b6c656908">More...</a><br /></td></tr>
<tr class="separator:a2256c10b16edba377b64a44b6c656908"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3c04138a5bfe5d72780bb7e82a18e627"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d46/kohonen__som__trace_8c.html#a3c04138a5bfe5d72780bb7e82a18e627">main</a> (int argc, char **argv)</td></tr>
<tr class="memitem:a3c04138a5bfe5d72780bb7e82a18e627"><td class="memItemLeft" align="right" valign="top"><a id="a3c04138a5bfe5d72780bb7e82a18e627"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d46/kohonen__som__trace_8c.html#a3c04138a5bfe5d72780bb7e82a18e627">main</a> (int argc, char **argv)</td></tr>
<tr class="memdesc:a3c04138a5bfe5d72780bb7e82a18e627"><td class="mdescLeft">&#160;</td><td class="mdescRight">Main function. <br /></td></tr>
<tr class="separator:a3c04138a5bfe5d72780bb7e82a18e627"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p><a href="https://en.wikipedia.org/wiki/Self-organizing_map">Kohonen self organizing map</a> (data tracing) </p>
<dl class="section author"><dt>Author</dt><dd><a href="https://github.com/kvedala">Krishna Vedala</a></dd></dl>
<p>This example implements a powerful self organizing map algorithm. The algorithm creates a connected network of weights that closely follows the given data points. This this creates a chain of nodes that resembles the given input shape. </p><dl class="section see"><dt>See also</dt><dd><a class="el" href="../../d2/df6/kohonen__som__topology_8c.html" title="Kohonen self organizing map (topological map)">kohonen_som_topology.c</a> </dd></dl>
</div><h2 class="groupheader">Macro Definition Documentation</h2>
<a id="a525335710b53cb064ca56b936120431e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a525335710b53cb064ca56b936120431e">&#9670;&nbsp;</a></span>_USE_MATH_DEFINES</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define _USE_MATH_DEFINES</td>
</tr>
</table>
</div><div class="memdoc">
<p>required for MS Visual C </p>
</div>
</div>
<a id="affe776513b24d84b39af8ab0930fef7f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#affe776513b24d84b39af8ab0930fef7f">&#9670;&nbsp;</a></span>max</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define max</td>
<td>(</td>
<td class="paramtype">&#160;</td>
<td class="paramname">a, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">&#160;</td>
<td class="paramname">b&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td>&#160;&#160;&#160;(((a) &gt; (b)) ? (a) : (b))</td>
</tr>
</table>
</div><div class="memdoc">
<p>shorthand for maximum value \ </p>
</div>
</div>
<a id="ac6afabdc09a49a433ee19d8a9486056d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac6afabdc09a49a433ee19d8a9486056d">&#9670;&nbsp;</a></span>min</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define min</td>
<td>(</td>
<td class="paramtype">&#160;</td>
<td class="paramname">a, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">&#160;</td>
<td class="paramname">b&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td>&#160;&#160;&#160;(((a) &lt; (b)) ? (a) : (b))</td>
</tr>
</table>
</div><div class="memdoc">
<p>shorthand for minimum value \ </p>
</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="af5ce14f026d6d231bef29161bac2b485"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af5ce14f026d6d231bef29161bac2b485">&#9670;&nbsp;</a></span>_random()</h2>
@ -253,7 +199,9 @@ Functions</h2></td></tr>
</tr>
</table>
</div><div class="memdoc">
<p>Helper function to generate a random number in a given interval. <br />
<p>Helper function to generate a random number in a given interval. </p>
<p><br />
Steps:</p><ol type="1">
<li><code>r1 = rand() % 100</code> gets a random number between 0 and 99</li>
<li><code>r2 = r1 / 100</code> converts random number to be between 0 and 0.99</li>
@ -264,13 +212,16 @@ Functions</h2></td></tr>
</ol>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">a</td><td>lower limit </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">b</td><td>upper limit </td></tr>
<tr><td class="paramname">a</td><td>lower limit </td></tr>
<tr><td class="paramname">b</td><td>upper limit </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>random number in the range \([a,b)\) </dd></dl>
<div class="fragment"><div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160;{</div>
<div class="fragment"><div class="line"><a name="l00049"></a><span class="lineno"> 49</span>&#160;{</div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>&#160; <span class="keywordtype">int</span> r = rand() % 100;</div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160; <span class="keywordflow">return</span> ((b - a) * r / 100.f) + a;</div>
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160;}</div>
</div><!-- fragment -->
</div>
</div>
@ -299,7 +250,8 @@ Functions</h2></td></tr>
</tr>
</table>
</div><div class="memdoc">
<p>Convert clock cycle difference to time in seconds</p>
<p>Convert clock cycle difference to time in seconds. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">start_t</td><td>start clock </td></tr>
@ -308,7 +260,9 @@ Functions</h2></td></tr>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>time difference in seconds </dd></dl>
<div class="fragment"><div class="line"><a name="l00507"></a><span class="lineno"> 507</span>&#160;{</div>
<div class="fragment"><div class="line"><a name="l00501"></a><span class="lineno"> 501</span>&#160;{</div>
<div class="line"><a name="l00502"></a><span class="lineno"> 502</span>&#160; <span class="keywordflow">return</span> (<span class="keywordtype">double</span>)(end_t - start_t) / (<span class="keywordtype">double</span>)CLOCKS_PER_SEC;</div>
<div class="line"><a name="l00503"></a><span class="lineno"> 503</span>&#160;}</div>
</div><!-- fragment -->
</div>
</div>
@ -349,25 +303,29 @@ Functions</h2></td></tr>
</tr>
</table>
</div><div class="memdoc">
<p>Get minimum value and index of the value in a vector </p><dl class="params"><dt>Parameters</dt><dd>
<p>Get minimum value and index of the value in a vector. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">x</td><td>vector to search </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">X</td><td>vector to search </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">N</td><td>number of points in the vector </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">val</td><td>minimum value found </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">idx</td><td>index where minimum value was found </td></tr>
</table>
</dd>
</dl>
<div class="fragment"><div class="line"><a name="l00102"></a><span class="lineno"> 102</span>&#160; {</div>
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span>&#160; <span class="keywordflow">if</span> (X[i] &lt; val[0]) <span class="comment">// if a lower value is found</span></div>
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span>&#160; { <span class="comment">// save the value and its index</span></div>
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>&#160; idx[0] = i;</div>
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span>&#160; val[0] = X[i];</div>
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>&#160; }</div>
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>&#160; }</div>
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>&#160;}</div>
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>&#160;<span class="comment">/**</span></div>
<div class="fragment"><div class="line"><a name="l00099"></a><span class="lineno"> 99</span>&#160;{</div>
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span>&#160; val[0] = INFINITY; <span class="comment">// initial min value</span></div>
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span>&#160; </div>
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span>&#160; <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; <a class="code" href="../../db/d01/problem__13_2sol1_8c.html#a0240ac851181b84ac374872dc5434ee4">N</a>; i++) <span class="comment">// check each value</span></div>
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span>&#160; {</div>
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span>&#160; <span class="keywordflow">if</span> (X[i] &lt; val[0]) <span class="comment">// if a lower value is found</span></div>
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>&#160; { <span class="comment">// save the value and its index</span></div>
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span>&#160; idx[0] = i;</div>
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>&#160; val[0] = X[i];</div>
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>&#160; }</div>
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>&#160; }</div>
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>&#160;}</div>
</div><!-- fragment -->
</div>
</div>
@ -420,12 +378,12 @@ Functions</h2></td></tr>
</tr>
</table>
</div><div class="memdoc">
<p>Apply incremental algorithm with updating neighborhood and learning rates on all samples in the given datset.</p>
<p>Apply incremental algorithm with updating neighborhood and learning rates on all samples in the given datset. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">X</td><td>data set </td></tr>
<tr><td class="paramdir">[in,out]</td><td class="paramname">W</td><td>weights matrix </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">D</td><td>temporary vector to store distances </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">num_samples</td><td>number of output points </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">num_features</td><td>number of features per input sample </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">num_out</td><td>number of output points </td></tr>
@ -456,8 +414,6 @@ Functions</h2></td></tr>
<div class="line"><a name="l00195"></a><span class="lineno"> 195</span>&#160; </div>
<div class="line"><a name="l00196"></a><span class="lineno"> 196</span>&#160; free(D);</div>
<div class="line"><a name="l00197"></a><span class="lineno"> 197</span>&#160;}</div>
<div class="line"><a name="l00198"></a><span class="lineno"> 198</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00199"></a><span class="lineno"> 199</span>&#160;<span class="comment">/** Creates a random set of points distributed *near* the circumference</span></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
@ -465,39 +421,6 @@ Here is the call graph for this function:</div>
</div>
</div>
</div>
</div>
<a id="a3c04138a5bfe5d72780bb7e82a18e627"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3c04138a5bfe5d72780bb7e82a18e627">&#9670;&nbsp;</a></span>main()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int main </td>
<td>(</td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>argc</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char **&#160;</td>
<td class="paramname"><em>argv</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Main function </p>
<div class="fragment"><div class="line"><a name="l00529"></a><span class="lineno"> 529</span>&#160; : Calculated times include: creating test sets, training <span class="stringliteral">&quot;</span></div>
<div class="line"><a name="l00530"></a><span class="lineno"> 530</span>&#160;<span class="stringliteral"> &quot;</span>model and writing files to disk.)\n\n<span class="stringliteral">&quot;);</span></div>
<div class="line"><a name="l00531"></a><span class="lineno"> 531</span>&#160;<span class="stringliteral"> return 0;</span></div>
<div class="line"><a name="l00532"></a><span class="lineno"> 532</span>&#160;<span class="stringliteral">}</span></div>
</div><!-- fragment -->
</div>
</div>
<a id="a7b84b14e60f47812b581d1f93057c85a"></a>
@ -537,7 +460,8 @@ Here is the call graph for this function:</div>
</tr>
</table>
</div><div class="memdoc">
<p>Save a given n-dimensional data martix to file.</p>
<p>Save a given n-dimensional data martix to file. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">fname</td><td>filename to save in (gets overwriten without confirmation) </td></tr>
@ -550,32 +474,30 @@ Here is the call graph for this function:</div>
<dl class="section return"><dt>Returns</dt><dd>0 if all ok </dd>
<dd>
-1 if file creation failed </dd></dl>
<div class="fragment"><div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160;{</div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160; FILE *fp = fopen(fname, <span class="stringliteral">&quot;wt&quot;</span>);</div>
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>&#160; <span class="keywordflow">if</span> (!fp) <span class="comment">// error with fopen</span></div>
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>&#160; {</div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>&#160; <span class="keywordtype">char</span> msg[120];</div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>&#160; sprintf(msg, <span class="stringliteral">&quot;File error (%s): &quot;</span>, fname);</div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>&#160; perror(msg);</div>
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>&#160; <span class="keywordflow">return</span> -1;</div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>&#160; }</div>
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>&#160; </div>
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>&#160; <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; num_points; i++) <span class="comment">// for each point in the array</span></div>
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>&#160; {</div>
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>&#160; <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 0; j &lt; num_features; j++) <span class="comment">// for each feature in the array</span></div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>&#160; {</div>
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>&#160; fprintf(fp, <span class="stringliteral">&quot;%.4g&quot;</span>, X[i][j]); <span class="comment">// print the feature value</span></div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>&#160; <span class="keywordflow">if</span> (j &lt; num_features - 1) <span class="comment">// if not the last feature</span></div>
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>&#160; fprintf(fp, <span class="stringliteral">&quot;,&quot;</span>); <span class="comment">// suffix comma</span></div>
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>&#160; }</div>
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>&#160; <span class="keywordflow">if</span> (i &lt; num_points - 1) <span class="comment">// if not the last row</span></div>
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span>&#160; fprintf(fp, <span class="stringliteral">&quot;\n&quot;</span>); <span class="comment">// start a new line</span></div>
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>&#160; }</div>
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>&#160; fclose(fp);</div>
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>&#160;}</div>
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span>&#160;<span class="comment">/**</span></div>
<div class="fragment"><div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160;{</div>
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>&#160; FILE *fp = fopen(fname, <span class="stringliteral">&quot;wt&quot;</span>);</div>
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>&#160; <span class="keywordflow">if</span> (!fp) <span class="comment">// error with fopen</span></div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>&#160; {</div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>&#160; <span class="keywordtype">char</span> msg[120];</div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>&#160; sprintf(msg, <span class="stringliteral">&quot;File error (%s): &quot;</span>, fname);</div>
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>&#160; perror(msg);</div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>&#160; <span class="keywordflow">return</span> -1;</div>
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>&#160; }</div>
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>&#160; </div>
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>&#160; <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; num_points; i++) <span class="comment">// for each point in the array</span></div>
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>&#160; {</div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>&#160; <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 0; j &lt; num_features; j++) <span class="comment">// for each feature in the array</span></div>
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>&#160; {</div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>&#160; fprintf(fp, <span class="stringliteral">&quot;%.4g&quot;</span>, X[i][j]); <span class="comment">// print the feature value</span></div>
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>&#160; <span class="keywordflow">if</span> (j &lt; num_features - 1) <span class="comment">// if not the last feature</span></div>
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>&#160; fprintf(fp, <span class="stringliteral">&quot;,&quot;</span>); <span class="comment">// suffix comma</span></div>
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>&#160; }</div>
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span>&#160; <span class="keywordflow">if</span> (i &lt; num_points - 1) <span class="comment">// if not the last row</span></div>
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>&#160; fprintf(fp, <span class="stringliteral">&quot;\n&quot;</span>); <span class="comment">// start a new line</span></div>
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>&#160; }</div>
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span>&#160; fclose(fp);</div>
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>&#160;}</div>
</div><!-- fragment -->
</div>
</div>
@ -593,7 +515,9 @@ Here is the call graph for this function:</div>
</tr>
</table>
</div><div class="memdoc">
<p>Test that creates a random set of points distributed <em>near</em> the circumference of a circle and trains an SOM that finds that circular pattern. The following <a href="https://en.wikipedia.org/wiki/Comma-separated_values">CSV</a> files are created to validate the execution:</p><ul>
<p>Test that creates a random set of points distributed <em>near</em> the circumference of a circle and trains an SOM that finds that circular pattern. </p>
<p>The following <a href="https://en.wikipedia.org/wiki/Comma-separated_values">CSV</a> files are created to validate the execution:</p><ul>
<li><code>test1.csv</code>: random test samples points with a circular pattern</li>
<li><code>w11.csv</code>: initial random map</li>
<li><code>w12.csv</code>: trained SOM map</li>
@ -604,7 +528,19 @@ Here is the call graph for this function:</div>
<div class="line"> &quot;w12.csv&quot; title &quot;w2&quot;</div>
</div><!-- fragment --><p><img src="https://raw.githubusercontent.com/TheAlgorithms/C/docs/images/machine_learning/kohonen/test1.svg" alt="Sample execution
output" style="pointer-events: none;" class="inline"/> </p>
<div class="fragment"><div class="line"><a name="l00263"></a><span class="lineno"> 263</span>&#160; {</div>
<div class="fragment"><div class="line"><a name="l00251"></a><span class="lineno"> 251</span>&#160;{</div>
<div class="line"><a name="l00252"></a><span class="lineno"> 252</span>&#160; <span class="keywordtype">int</span> j, <a class="code" href="../../db/d01/problem__13_2sol1_8c.html#a0240ac851181b84ac374872dc5434ee4">N</a> = 500;</div>
<div class="line"><a name="l00253"></a><span class="lineno"> 253</span>&#160; <span class="keywordtype">int</span> features = 2;</div>
<div class="line"><a name="l00254"></a><span class="lineno"> 254</span>&#160; <span class="keywordtype">int</span> num_out = 50;</div>
<div class="line"><a name="l00255"></a><span class="lineno"> 255</span>&#160; </div>
<div class="line"><a name="l00256"></a><span class="lineno"> 256</span>&#160; <span class="comment">// 2D space, hence size = number of rows * 2</span></div>
<div class="line"><a name="l00257"></a><span class="lineno"> 257</span>&#160; <span class="keywordtype">double</span> **X = (<span class="keywordtype">double</span> **)malloc(<a class="code" href="../../db/d01/problem__13_2sol1_8c.html#a0240ac851181b84ac374872dc5434ee4">N</a> * <span class="keyword">sizeof</span>(<span class="keywordtype">double</span> *));</div>
<div class="line"><a name="l00258"></a><span class="lineno"> 258</span>&#160; </div>
<div class="line"><a name="l00259"></a><span class="lineno"> 259</span>&#160; <span class="comment">// number of clusters nodes * 2</span></div>
<div class="line"><a name="l00260"></a><span class="lineno"> 260</span>&#160; <span class="keywordtype">double</span> **W = (<span class="keywordtype">double</span> **)malloc(num_out * <span class="keyword">sizeof</span>(<span class="keywordtype">double</span> *));</div>
<div class="line"><a name="l00261"></a><span class="lineno"> 261</span>&#160; </div>
<div class="line"><a name="l00262"></a><span class="lineno"> 262</span>&#160; <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; <a class="code" href="../../d0/d46/kohonen__som__trace_8c.html#affe776513b24d84b39af8ab0930fef7f">max</a>(num_out, <a class="code" href="../../db/d01/problem__13_2sol1_8c.html#a0240ac851181b84ac374872dc5434ee4">N</a>); i++) <span class="comment">// loop till max(N, num_out)</span></div>
<div class="line"><a name="l00263"></a><span class="lineno"> 263</span>&#160; {</div>
<div class="line"><a name="l00264"></a><span class="lineno"> 264</span>&#160; <span class="keywordflow">if</span> (i &lt; <a class="code" href="../../db/d01/problem__13_2sol1_8c.html#a0240ac851181b84ac374872dc5434ee4">N</a>) <span class="comment">// only add new arrays if i &lt; N</span></div>
<div class="line"><a name="l00265"></a><span class="lineno"> 265</span>&#160; X[i] = (<span class="keywordtype">double</span> *)malloc(features * <span class="keyword">sizeof</span>(<span class="keywordtype">double</span>));</div>
<div class="line"><a name="l00266"></a><span class="lineno"> 266</span>&#160; <span class="keywordflow">if</span> (i &lt; num_out) <span class="comment">// only add new arrays if i &lt; num_out</span></div>
@ -634,9 +570,13 @@ output" style="pointer-events: none;" class="inline"/> </p>
<div class="line"><a name="l00290"></a><span class="lineno"> 290</span>&#160; free(W[i]);</div>
<div class="line"><a name="l00291"></a><span class="lineno"> 291</span>&#160; }</div>
<div class="line"><a name="l00292"></a><span class="lineno"> 292</span>&#160;}</div>
<div class="line"><a name="l00293"></a><span class="lineno"> 293</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00294"></a><span class="lineno"> 294</span>&#160;<span class="comment">/** Creates a random set of points distributed *near* the locus</span></div>
</div><!-- fragment -->
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d0/d46/kohonen__som__trace_8c_a1440a7779ac56f47a3f355ce4a8c7da0_cgraph.svg" width="551" height="190"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
</div>
</div>
</div>
<a id="a0283886819c7c140a023582b7269e2d0"></a>
@ -653,7 +593,9 @@ output" style="pointer-events: none;" class="inline"/> </p>
</tr>
</table>
</div><div class="memdoc">
<p>Test that creates a random set of points distributed <em>near</em> the locus of the <a href="https://en.wikipedia.org/wiki/Lemniscate_of_Gerono">Lamniscate of Gerono</a> and trains an SOM that finds that circular pattern. The following <a href="https://en.wikipedia.org/wiki/Comma-separated_values">CSV</a> files are created to validate the execution:</p><ul>
<p>Test that creates a random set of points distributed <em>near</em> the locus of the <a href="https://en.wikipedia.org/wiki/Lemniscate_of_Gerono">Lamniscate of Gerono</a> and trains an SOM that finds that circular pattern. </p>
<p>The following <a href="https://en.wikipedia.org/wiki/Comma-separated_values">CSV</a> files are created to validate the execution:</p><ul>
<li><code>test2.csv</code>: random test samples points with a lamniscate pattern</li>
<li><code>w21.csv</code>: initial random map</li>
<li><code>w22.csv</code>: trained SOM map</li>
@ -664,7 +606,14 @@ output" style="pointer-events: none;" class="inline"/> </p>
<div class="line"> &quot;w22.csv&quot; title &quot;w2&quot;</div>
</div><!-- fragment --><p><img src="https://raw.githubusercontent.com/TheAlgorithms/C/docs/images/machine_learning/kohonen/test2.svg" alt="Sample execution
output" style="pointer-events: none;" class="inline"/> </p>
<div class="fragment"><div class="line"><a name="l00355"></a><span class="lineno"> 355</span>&#160; {</div>
<div class="fragment"><div class="line"><a name="l00348"></a><span class="lineno"> 348</span>&#160;{</div>
<div class="line"><a name="l00349"></a><span class="lineno"> 349</span>&#160; <span class="keywordtype">int</span> j, <a class="code" href="../../db/d01/problem__13_2sol1_8c.html#a0240ac851181b84ac374872dc5434ee4">N</a> = 500;</div>
<div class="line"><a name="l00350"></a><span class="lineno"> 350</span>&#160; <span class="keywordtype">int</span> features = 2;</div>
<div class="line"><a name="l00351"></a><span class="lineno"> 351</span>&#160; <span class="keywordtype">int</span> num_out = 20;</div>
<div class="line"><a name="l00352"></a><span class="lineno"> 352</span>&#160; <span class="keywordtype">double</span> **X = (<span class="keywordtype">double</span> **)malloc(<a class="code" href="../../db/d01/problem__13_2sol1_8c.html#a0240ac851181b84ac374872dc5434ee4">N</a> * <span class="keyword">sizeof</span>(<span class="keywordtype">double</span> *));</div>
<div class="line"><a name="l00353"></a><span class="lineno"> 353</span>&#160; <span class="keywordtype">double</span> **W = (<span class="keywordtype">double</span> **)malloc(num_out * <span class="keyword">sizeof</span>(<span class="keywordtype">double</span> *));</div>
<div class="line"><a name="l00354"></a><span class="lineno"> 354</span>&#160; <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; <a class="code" href="../../d0/d46/kohonen__som__trace_8c.html#affe776513b24d84b39af8ab0930fef7f">max</a>(num_out, <a class="code" href="../../db/d01/problem__13_2sol1_8c.html#a0240ac851181b84ac374872dc5434ee4">N</a>); i++)</div>
<div class="line"><a name="l00355"></a><span class="lineno"> 355</span>&#160; {</div>
<div class="line"><a name="l00356"></a><span class="lineno"> 356</span>&#160; <span class="keywordflow">if</span> (i &lt; <a class="code" href="../../db/d01/problem__13_2sol1_8c.html#a0240ac851181b84ac374872dc5434ee4">N</a>) <span class="comment">// only add new arrays if i &lt; N</span></div>
<div class="line"><a name="l00357"></a><span class="lineno"> 357</span>&#160; X[i] = (<span class="keywordtype">double</span> *)malloc(features * <span class="keyword">sizeof</span>(<span class="keywordtype">double</span>));</div>
<div class="line"><a name="l00358"></a><span class="lineno"> 358</span>&#160; <span class="keywordflow">if</span> (i &lt; num_out) <span class="comment">// only add new arrays if i &lt; num_out</span></div>
@ -697,9 +646,13 @@ output" style="pointer-events: none;" class="inline"/> </p>
<div class="line"><a name="l00385"></a><span class="lineno"> 385</span>&#160; free(X);</div>
<div class="line"><a name="l00386"></a><span class="lineno"> 386</span>&#160; free(W);</div>
<div class="line"><a name="l00387"></a><span class="lineno"> 387</span>&#160;}</div>
<div class="line"><a name="l00388"></a><span class="lineno"> 388</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00389"></a><span class="lineno"> 389</span>&#160;<span class="comment">/** Creates a random set of points distributed in four clusters in</span></div>
</div><!-- fragment -->
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d0/d46/kohonen__som__trace_8c_a0283886819c7c140a023582b7269e2d0_cgraph.svg" width="551" height="190"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
</div>
</div>
</div>
<a id="a6d0455dd5c30adda100e95f0423c786e"></a>
@ -716,7 +669,9 @@ output" style="pointer-events: none;" class="inline"/> </p>
</tr>
</table>
</div><div class="memdoc">
<p>Test that creates a random set of points distributed in six clusters in 3D space. The following <a href="https://en.wikipedia.org/wiki/Comma-separated_values">CSV</a> files are created to validate the execution:</p><ul>
<p>Test that creates a random set of points distributed in six clusters in 3D space. </p>
<p>The following <a href="https://en.wikipedia.org/wiki/Comma-separated_values">CSV</a> files are created to validate the execution:</p><ul>
<li><code>test3.csv</code>: random test samples points with a circular pattern</li>
<li><code>w31.csv</code>: initial random map</li>
<li><code>w32.csv</code>: trained SOM map</li>
@ -727,7 +682,14 @@ output" style="pointer-events: none;" class="inline"/> </p>
<div class="line"> &quot;w32.csv&quot; title &quot;w2&quot;</div>
</div><!-- fragment --><p><img src="https://raw.githubusercontent.com/TheAlgorithms/C/docs/images/machine_learning/kohonen/test3.svg" alt="Sample execution
output" style="pointer-events: none;" class="inline"/> </p>
<div class="fragment"><div class="line"><a name="l00459"></a><span class="lineno"> 459</span>&#160; {</div>
<div class="fragment"><div class="line"><a name="l00452"></a><span class="lineno"> 452</span>&#160;{</div>
<div class="line"><a name="l00453"></a><span class="lineno"> 453</span>&#160; <span class="keywordtype">int</span> j, <a class="code" href="../../db/d01/problem__13_2sol1_8c.html#a0240ac851181b84ac374872dc5434ee4">N</a> = 200;</div>
<div class="line"><a name="l00454"></a><span class="lineno"> 454</span>&#160; <span class="keywordtype">int</span> features = 3;</div>
<div class="line"><a name="l00455"></a><span class="lineno"> 455</span>&#160; <span class="keywordtype">int</span> num_out = 20;</div>
<div class="line"><a name="l00456"></a><span class="lineno"> 456</span>&#160; <span class="keywordtype">double</span> **X = (<span class="keywordtype">double</span> **)malloc(<a class="code" href="../../db/d01/problem__13_2sol1_8c.html#a0240ac851181b84ac374872dc5434ee4">N</a> * <span class="keyword">sizeof</span>(<span class="keywordtype">double</span> *));</div>
<div class="line"><a name="l00457"></a><span class="lineno"> 457</span>&#160; <span class="keywordtype">double</span> **W = (<span class="keywordtype">double</span> **)malloc(num_out * <span class="keyword">sizeof</span>(<span class="keywordtype">double</span> *));</div>
<div class="line"><a name="l00458"></a><span class="lineno"> 458</span>&#160; <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; <a class="code" href="../../d0/d46/kohonen__som__trace_8c.html#affe776513b24d84b39af8ab0930fef7f">max</a>(num_out, <a class="code" href="../../db/d01/problem__13_2sol1_8c.html#a0240ac851181b84ac374872dc5434ee4">N</a>); i++)</div>
<div class="line"><a name="l00459"></a><span class="lineno"> 459</span>&#160; {</div>
<div class="line"><a name="l00460"></a><span class="lineno"> 460</span>&#160; <span class="keywordflow">if</span> (i &lt; <a class="code" href="../../db/d01/problem__13_2sol1_8c.html#a0240ac851181b84ac374872dc5434ee4">N</a>) <span class="comment">// only add new arrays if i &lt; N</span></div>
<div class="line"><a name="l00461"></a><span class="lineno"> 461</span>&#160; X[i] = (<span class="keywordtype">double</span> *)malloc(features * <span class="keyword">sizeof</span>(<span class="keywordtype">double</span>));</div>
<div class="line"><a name="l00462"></a><span class="lineno"> 462</span>&#160; <span class="keywordflow">if</span> (i &lt; num_out) <span class="comment">// only add new arrays if i &lt; num_out</span></div>
@ -760,9 +722,13 @@ output" style="pointer-events: none;" class="inline"/> </p>
<div class="line"><a name="l00489"></a><span class="lineno"> 489</span>&#160; free(X);</div>
<div class="line"><a name="l00490"></a><span class="lineno"> 490</span>&#160; free(W);</div>
<div class="line"><a name="l00491"></a><span class="lineno"> 491</span>&#160;}</div>
<div class="line"><a name="l00492"></a><span class="lineno"> 492</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00493"></a><span class="lineno"> 493</span>&#160;<span class="comment">/**</span></div>
</div><!-- fragment -->
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d0/d46/kohonen__som__trace_8c_a6d0455dd5c30adda100e95f0423c786e_cgraph.svg" width="551" height="190"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
</div>
</div>
</div>
<a id="a41ae16442e3e5b891a58d2e5932a2cd0"></a>
@ -790,7 +756,9 @@ output" style="pointer-events: none;" class="inline"/> </p>
</tr>
</table>
</div><div class="memdoc">
<p>Creates a random set of points distributed in four clusters in 3D space with centroids at the points</p><ul>
<p>Creates a random set of points distributed in four clusters in 3D space with centroids at the points. </p>
<ul>
<li>\((0,5, 0.5, 0.5)\)</li>
<li>\((0,5,-0.5, -0.5)\)</li>
<li>\((-0,5, 0.5, 0.5)\)</li>
@ -803,7 +771,11 @@ output" style="pointer-events: none;" class="inline"/> </p>
</table>
</dd>
</dl>
<div class="fragment"><div class="line"><a name="l00404"></a><span class="lineno"> 404</span>&#160; {</div>
<div class="fragment"><div class="line"><a name="l00400"></a><span class="lineno"> 400</span>&#160;{</div>
<div class="line"><a name="l00401"></a><span class="lineno"> 401</span>&#160; <span class="keyword">const</span> <span class="keywordtype">double</span> R = 0.1; <span class="comment">// radius of cluster</span></div>
<div class="line"><a name="l00402"></a><span class="lineno"> 402</span>&#160; <span class="keywordtype">int</span> i;</div>
<div class="line"><a name="l00403"></a><span class="lineno"> 403</span>&#160; <span class="keyword">const</span> <span class="keywordtype">int</span> num_classes = 4;</div>
<div class="line"><a name="l00404"></a><span class="lineno"> 404</span>&#160; <span class="keyword">const</span> <span class="keywordtype">double</span> centres[][3] = {</div>
<div class="line"><a name="l00405"></a><span class="lineno"> 405</span>&#160; <span class="comment">// centres of each class cluster</span></div>
<div class="line"><a name="l00406"></a><span class="lineno"> 406</span>&#160; {.5, .5, .5}, <span class="comment">// centre of class 1</span></div>
<div class="line"><a name="l00407"></a><span class="lineno"> 407</span>&#160; {.5, -.5, -.5}, <span class="comment">// centre of class 2</span></div>
@ -830,9 +802,13 @@ output" style="pointer-events: none;" class="inline"/> </p>
<div class="line"><a name="l00428"></a><span class="lineno"> 428</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00429"></a><span class="lineno"> 429</span>&#160; }</div>
<div class="line"><a name="l00430"></a><span class="lineno"> 430</span>&#160;}</div>
<div class="line"><a name="l00431"></a><span class="lineno"> 431</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00432"></a><span class="lineno"> 432</span>&#160;<span class="comment">/** Test that creates a random set of points distributed in six clusters in</span></div>
</div><!-- fragment -->
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d0/d46/kohonen__som__trace_8c_a41ae16442e3e5b891a58d2e5932a2cd0_cgraph.svg" width="248" height="38"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
</div>
</div>
</div>
<a id="a107f00650b8041f77767927073ddddb8"></a>
@ -860,7 +836,9 @@ output" style="pointer-events: none;" class="inline"/> </p>
</tr>
</table>
</div><div class="memdoc">
<p>Creates a random set of points distributed <em>near</em> the circumference of a circle and trains an SOM that finds that circular pattern. The generating function is </p><p class="formulaDsp">
<p>Creates a random set of points distributed <em>near</em> the circumference of a circle and trains an SOM that finds that circular pattern. </p>
<p>The generating function is </p><p class="formulaDsp">
\begin{eqnarray*} r &amp;\in&amp; [1-\delta r, 1+\delta r)\\ \theta &amp;\in&amp; [0, 2\pi)\\ x &amp;=&amp; r\cos\theta\\ y &amp;=&amp; r\sin\theta \end{eqnarray*}
</p>
<dl class="params"><dt>Parameters</dt><dd>
@ -870,15 +848,23 @@ output" style="pointer-events: none;" class="inline"/> </p>
</table>
</dd>
</dl>
<div class="fragment"><div class="line"><a name="l00223"></a><span class="lineno"> 223</span>&#160; {</div>
<div class="fragment"><div class="line"><a name="l00213"></a><span class="lineno"> 213</span>&#160;{</div>
<div class="line"><a name="l00214"></a><span class="lineno"> 214</span>&#160; <span class="keyword">const</span> <span class="keywordtype">double</span> R = 0.75, dr = 0.3;</div>
<div class="line"><a name="l00215"></a><span class="lineno"> 215</span>&#160; <span class="keywordtype">double</span> a_t = 0., b_t = 2.f * M_PI; <span class="comment">// theta random between 0 and 2*pi</span></div>
<div class="line"><a name="l00216"></a><span class="lineno"> 216</span>&#160; <span class="keywordtype">double</span> a_r = R - dr, b_r = R + dr; <span class="comment">// radius random between R-dr and R+dr</span></div>
<div class="line"><a name="l00217"></a><span class="lineno"> 217</span>&#160; <span class="keywordtype">int</span> i;</div>
<div class="line"><a name="l00218"></a><span class="lineno"> 218</span>&#160; </div>
<div class="line"><a name="l00219"></a><span class="lineno"> 219</span>&#160;<span class="preprocessor">#ifdef _OPENMP</span></div>
<div class="line"><a name="l00220"></a><span class="lineno"> 220</span>&#160;<span class="preprocessor">#pragma omp for</span></div>
<div class="line"><a name="l00221"></a><span class="lineno"> 221</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00222"></a><span class="lineno"> 222</span>&#160; <span class="keywordflow">for</span> (i = 0; i &lt; <a class="code" href="../../db/d01/problem__13_2sol1_8c.html#a0240ac851181b84ac374872dc5434ee4">N</a>; i++)</div>
<div class="line"><a name="l00223"></a><span class="lineno"> 223</span>&#160; {</div>
<div class="line"><a name="l00224"></a><span class="lineno"> 224</span>&#160; <span class="keywordtype">double</span> r = <a class="code" href="../../d0/d46/kohonen__som__trace_8c.html#af5ce14f026d6d231bef29161bac2b485">_random</a>(a_r, b_r); <span class="comment">// random radius</span></div>
<div class="line"><a name="l00225"></a><span class="lineno"> 225</span>&#160; <span class="keywordtype">double</span> theta = <a class="code" href="../../d0/d46/kohonen__som__trace_8c.html#af5ce14f026d6d231bef29161bac2b485">_random</a>(a_t, b_t); <span class="comment">// random theta</span></div>
<div class="line"><a name="l00226"></a><span class="lineno"> 226</span>&#160; <a class="code" href="../../df/dea/structdata.html">data</a>[i][0] = r * cos(theta); <span class="comment">// convert from polar to cartesian</span></div>
<div class="line"><a name="l00227"></a><span class="lineno"> 227</span>&#160; <a class="code" href="../../df/dea/structdata.html">data</a>[i][1] = r * sin(theta);</div>
<div class="line"><a name="l00228"></a><span class="lineno"> 228</span>&#160; }</div>
<div class="line"><a name="l00229"></a><span class="lineno"> 229</span>&#160;}</div>
<div class="line"><a name="l00230"></a><span class="lineno"> 230</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00231"></a><span class="lineno"> 231</span>&#160;<span class="comment">/** Test that creates a random set of points distributed *near* the</span></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
@ -913,7 +899,9 @@ Here is the call graph for this function:</div>
</tr>
</table>
</div><div class="memdoc">
<p>Creates a random set of points distributed <em>near</em> the locus of the <a href="https://en.wikipedia.org/wiki/Lemniscate_of_Gerono">Lamniscate of Gerono</a>. </p><p class="formulaDsp">
<p>Creates a random set of points distributed <em>near</em> the locus of the <a href="https://en.wikipedia.org/wiki/Lemniscate_of_Gerono">Lamniscate of Gerono</a>. </p>
<p class="formulaDsp">
\begin{eqnarray*} \delta r &amp;=&amp; 0.2\\ \delta x &amp;\in&amp; [-\delta r, \delta r)\\ \delta y &amp;\in&amp; [-\delta r, \delta r)\\ \theta &amp;\in&amp; [0, \pi)\\ x &amp;=&amp; \delta x + \cos\theta\\ y &amp;=&amp; \delta y + \frac{\sin(2\theta)}{2} \end{eqnarray*}
</p>
<dl class="params"><dt>Parameters</dt><dd>
@ -923,7 +911,15 @@ Here is the call graph for this function:</div>
</table>
</dd>
</dl>
<div class="fragment"><div class="line"><a name="l00317"></a><span class="lineno"> 317</span>&#160; {</div>
<div class="fragment"><div class="line"><a name="l00309"></a><span class="lineno"> 309</span>&#160;{</div>
<div class="line"><a name="l00310"></a><span class="lineno"> 310</span>&#160; <span class="keyword">const</span> <span class="keywordtype">double</span> dr = 0.2;</div>
<div class="line"><a name="l00311"></a><span class="lineno"> 311</span>&#160; <span class="keywordtype">int</span> i;</div>
<div class="line"><a name="l00312"></a><span class="lineno"> 312</span>&#160; </div>
<div class="line"><a name="l00313"></a><span class="lineno"> 313</span>&#160;<span class="preprocessor">#ifdef _OPENMP</span></div>
<div class="line"><a name="l00314"></a><span class="lineno"> 314</span>&#160;<span class="preprocessor">#pragma omp for</span></div>
<div class="line"><a name="l00315"></a><span class="lineno"> 315</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00316"></a><span class="lineno"> 316</span>&#160; <span class="keywordflow">for</span> (i = 0; i &lt; <a class="code" href="../../db/d01/problem__13_2sol1_8c.html#a0240ac851181b84ac374872dc5434ee4">N</a>; i++)</div>
<div class="line"><a name="l00317"></a><span class="lineno"> 317</span>&#160; {</div>
<div class="line"><a name="l00318"></a><span class="lineno"> 318</span>&#160; <span class="keywordtype">double</span> dx = <a class="code" href="../../d0/d46/kohonen__som__trace_8c.html#af5ce14f026d6d231bef29161bac2b485">_random</a>(-dr, dr); <span class="comment">// random change in x</span></div>
<div class="line"><a name="l00319"></a><span class="lineno"> 319</span>&#160; <span class="keywordtype">double</span> dy = <a class="code" href="../../d0/d46/kohonen__som__trace_8c.html#af5ce14f026d6d231bef29161bac2b485">_random</a>(-dr, dr); <span class="comment">// random change in y</span></div>
<div class="line"><a name="l00320"></a><span class="lineno"> 320</span>&#160; <span class="keywordtype">double</span> theta = <a class="code" href="../../d0/d46/kohonen__som__trace_8c.html#af5ce14f026d6d231bef29161bac2b485">_random</a>(0, M_PI); <span class="comment">// random theta</span></div>
@ -931,8 +927,6 @@ Here is the call graph for this function:</div>
<div class="line"><a name="l00322"></a><span class="lineno"> 322</span>&#160; <a class="code" href="../../df/dea/structdata.html">data</a>[i][1] = dy + sin(2. * theta) / 2.f;</div>
<div class="line"><a name="l00323"></a><span class="lineno"> 323</span>&#160; }</div>
<div class="line"><a name="l00324"></a><span class="lineno"> 324</span>&#160;}</div>
<div class="line"><a name="l00325"></a><span class="lineno"> 325</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00326"></a><span class="lineno"> 326</span>&#160;<span class="comment">/** Test that creates a random set of points distributed *near* the locus</span></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
@ -997,10 +991,11 @@ Here is the call graph for this function:</div>
</tr>
</table>
</div><div class="memdoc">
<p>Update weights of the SOM using Kohonen algorithm</p>
<p>Update weights of the SOM using Kohonen algorithm. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">X</td><td>data point </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">x</td><td>data point </td></tr>
<tr><td class="paramdir">[in,out]</td><td class="paramname">W</td><td>weights matrix </td></tr>
<tr><td class="paramdir">[in,out]</td><td class="paramname">D</td><td>temporary vector to store distances </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">num_out</td><td>number of output points </td></tr>
@ -1010,44 +1005,42 @@ Here is the call graph for this function:</div>
</table>
</dd>
</dl>
<div class="fragment"><div class="line"><a name="l00124"></a><span class="lineno"> 124</span>&#160;{</div>
<div class="line"><a name="l00125"></a><span class="lineno"> 125</span>&#160; <span class="keywordtype">int</span> j, k;</div>
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>&#160; </div>
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>&#160;<span class="preprocessor">#ifdef _OPENMP</span></div>
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span>&#160;<span class="preprocessor">#pragma omp for</span></div>
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span>&#160; <span class="comment">// step 1: for each output point</span></div>
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span>&#160; <span class="keywordflow">for</span> (j = 0; j &lt; num_out; j++)</div>
<div class="line"><a name="l00132"></a><span class="lineno"> 132</span>&#160; {</div>
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span>&#160; D[j] = 0.f;</div>
<div class="line"><a name="l00134"></a><span class="lineno"> 134</span>&#160; <span class="comment">// compute Euclidian distance of each output</span></div>
<div class="line"><a name="l00135"></a><span class="lineno"> 135</span>&#160; <span class="comment">// point from the current sample</span></div>
<div class="line"><a name="l00136"></a><span class="lineno"> 136</span>&#160; <span class="keywordflow">for</span> (k = 0; k &lt; num_features; k++)</div>
<div class="line"><a name="l00137"></a><span class="lineno"> 137</span>&#160; D[j] += (W[j][k] - x[k]) * (W[j][k] - x[k]);</div>
<div class="line"><a name="l00138"></a><span class="lineno"> 138</span>&#160; }</div>
<div class="line"><a name="l00139"></a><span class="lineno"> 139</span>&#160; </div>
<div class="line"><a name="l00140"></a><span class="lineno"> 140</span>&#160; <span class="comment">// step 2: get closest node i.e., node with snallest Euclidian distance to</span></div>
<div class="line"><a name="l00141"></a><span class="lineno"> 141</span>&#160; <span class="comment">// the current pattern</span></div>
<div class="line"><a name="l00142"></a><span class="lineno"> 142</span>&#160; <span class="keywordtype">int</span> d_min_idx;</div>
<div class="line"><a name="l00143"></a><span class="lineno"> 143</span>&#160; <span class="keywordtype">double</span> d_min;</div>
<div class="line"><a name="l00144"></a><span class="lineno"> 144</span>&#160; <a class="code" href="../../d0/d46/kohonen__som__trace_8c.html#a0a292ebd954c568934b1fd06666d27e6">get_min_1d</a>(D, num_out, &amp;d_min, &amp;d_min_idx);</div>
<div class="line"><a name="l00145"></a><span class="lineno"> 145</span>&#160; </div>
<div class="line"><a name="l00146"></a><span class="lineno"> 146</span>&#160; <span class="comment">// step 3a: get the neighborhood range</span></div>
<div class="line"><a name="l00147"></a><span class="lineno"> 147</span>&#160; <span class="keywordtype">int</span> from_node = <a class="code" href="../../d0/d46/kohonen__som__trace_8c.html#affe776513b24d84b39af8ab0930fef7f">max</a>(0, d_min_idx - R);</div>
<div class="line"><a name="l00148"></a><span class="lineno"> 148</span>&#160; <span class="keywordtype">int</span> to_node = <a class="code" href="../../d0/d46/kohonen__som__trace_8c.html#ac6afabdc09a49a433ee19d8a9486056d">min</a>(num_out, d_min_idx + R + 1);</div>
<div class="line"><a name="l00149"></a><span class="lineno"> 149</span>&#160; </div>
<div class="line"><a name="l00150"></a><span class="lineno"> 150</span>&#160; <span class="comment">// step 3b: update the weights of nodes in the</span></div>
<div class="line"><a name="l00151"></a><span class="lineno"> 151</span>&#160; <span class="comment">// neighborhood</span></div>
<div class="line"><a name="l00152"></a><span class="lineno"> 152</span>&#160;<span class="preprocessor">#ifdef _OPENMP</span></div>
<div class="line"><a name="l00153"></a><span class="lineno"> 153</span>&#160;<span class="preprocessor">#pragma omp for</span></div>
<div class="line"><a name="l00154"></a><span class="lineno"> 154</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00155"></a><span class="lineno"> 155</span>&#160; <span class="keywordflow">for</span> (j = from_node; j &lt; to_node; j++)</div>
<div class="line"><a name="l00156"></a><span class="lineno"> 156</span>&#160; <span class="keywordflow">for</span> (k = 0; k &lt; num_features; k++)</div>
<div class="line"><a name="l00157"></a><span class="lineno"> 157</span>&#160; <span class="comment">// update weights of nodes in the neighborhood</span></div>
<div class="line"><a name="l00158"></a><span class="lineno"> 158</span>&#160; W[j][k] += alpha * (x[k] - W[j][k]);</div>
<div class="line"><a name="l00159"></a><span class="lineno"> 159</span>&#160;}</div>
<div class="line"><a name="l00160"></a><span class="lineno"> 160</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00161"></a><span class="lineno"> 161</span>&#160;<span class="comment">/**</span></div>
<div class="fragment"><div class="line"><a name="l00125"></a><span class="lineno"> 125</span>&#160;{</div>
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>&#160; <span class="keywordtype">int</span> j, k;</div>
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>&#160; </div>
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span>&#160;<span class="preprocessor">#ifdef _OPENMP</span></div>
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span>&#160;<span class="preprocessor">#pragma omp for</span></div>
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span>&#160; <span class="comment">// step 1: for each output point</span></div>
<div class="line"><a name="l00132"></a><span class="lineno"> 132</span>&#160; <span class="keywordflow">for</span> (j = 0; j &lt; num_out; j++)</div>
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span>&#160; {</div>
<div class="line"><a name="l00134"></a><span class="lineno"> 134</span>&#160; D[j] = 0.f;</div>
<div class="line"><a name="l00135"></a><span class="lineno"> 135</span>&#160; <span class="comment">// compute Euclidian distance of each output</span></div>
<div class="line"><a name="l00136"></a><span class="lineno"> 136</span>&#160; <span class="comment">// point from the current sample</span></div>
<div class="line"><a name="l00137"></a><span class="lineno"> 137</span>&#160; <span class="keywordflow">for</span> (k = 0; k &lt; num_features; k++)</div>
<div class="line"><a name="l00138"></a><span class="lineno"> 138</span>&#160; D[j] += (W[j][k] - x[k]) * (W[j][k] - x[k]);</div>
<div class="line"><a name="l00139"></a><span class="lineno"> 139</span>&#160; }</div>
<div class="line"><a name="l00140"></a><span class="lineno"> 140</span>&#160; </div>
<div class="line"><a name="l00141"></a><span class="lineno"> 141</span>&#160; <span class="comment">// step 2: get closest node i.e., node with snallest Euclidian distance to</span></div>
<div class="line"><a name="l00142"></a><span class="lineno"> 142</span>&#160; <span class="comment">// the current pattern</span></div>
<div class="line"><a name="l00143"></a><span class="lineno"> 143</span>&#160; <span class="keywordtype">int</span> d_min_idx;</div>
<div class="line"><a name="l00144"></a><span class="lineno"> 144</span>&#160; <span class="keywordtype">double</span> d_min;</div>
<div class="line"><a name="l00145"></a><span class="lineno"> 145</span>&#160; <a class="code" href="../../d0/d46/kohonen__som__trace_8c.html#a0a292ebd954c568934b1fd06666d27e6">get_min_1d</a>(D, num_out, &amp;d_min, &amp;d_min_idx);</div>
<div class="line"><a name="l00146"></a><span class="lineno"> 146</span>&#160; </div>
<div class="line"><a name="l00147"></a><span class="lineno"> 147</span>&#160; <span class="comment">// step 3a: get the neighborhood range</span></div>
<div class="line"><a name="l00148"></a><span class="lineno"> 148</span>&#160; <span class="keywordtype">int</span> from_node = <a class="code" href="../../d0/d46/kohonen__som__trace_8c.html#affe776513b24d84b39af8ab0930fef7f">max</a>(0, d_min_idx - R);</div>
<div class="line"><a name="l00149"></a><span class="lineno"> 149</span>&#160; <span class="keywordtype">int</span> to_node = <a class="code" href="../../d0/d46/kohonen__som__trace_8c.html#ac6afabdc09a49a433ee19d8a9486056d">min</a>(num_out, d_min_idx + R + 1);</div>
<div class="line"><a name="l00150"></a><span class="lineno"> 150</span>&#160; </div>
<div class="line"><a name="l00151"></a><span class="lineno"> 151</span>&#160; <span class="comment">// step 3b: update the weights of nodes in the</span></div>
<div class="line"><a name="l00152"></a><span class="lineno"> 152</span>&#160; <span class="comment">// neighborhood</span></div>
<div class="line"><a name="l00153"></a><span class="lineno"> 153</span>&#160;<span class="preprocessor">#ifdef _OPENMP</span></div>
<div class="line"><a name="l00154"></a><span class="lineno"> 154</span>&#160;<span class="preprocessor">#pragma omp for</span></div>
<div class="line"><a name="l00155"></a><span class="lineno"> 155</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00156"></a><span class="lineno"> 156</span>&#160; <span class="keywordflow">for</span> (j = from_node; j &lt; to_node; j++)</div>
<div class="line"><a name="l00157"></a><span class="lineno"> 157</span>&#160; <span class="keywordflow">for</span> (k = 0; k &lt; num_features; k++)</div>
<div class="line"><a name="l00158"></a><span class="lineno"> 158</span>&#160; <span class="comment">// update weights of nodes in the neighborhood</span></div>
<div class="line"><a name="l00159"></a><span class="lineno"> 159</span>&#160; W[j][k] += alpha * (x[k] - W[j][k]);</div>
<div class="line"><a name="l00160"></a><span class="lineno"> 160</span>&#160;}</div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
@ -1059,18 +1052,18 @@ Here is the call graph for this function:</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<div class="ttc" id="akohonen__som__trace_8c_html_a7b84b14e60f47812b581d1f93057c85a"><div class="ttname"><a href="../../d0/d46/kohonen__som__trace_8c.html#a7b84b14e60f47812b581d1f93057c85a">save_nd_data</a></div><div class="ttdeci">int save_nd_data(const char *fname, double **X, int num_points, int num_features)</div><div class="ttdef"><b>Definition:</b> kohonen_som_trace.c:65</div></div>
<div class="ttc" id="akohonen__som__trace_8c_html_affe776513b24d84b39af8ab0930fef7f"><div class="ttname"><a href="../../d0/d46/kohonen__som__trace_8c.html#affe776513b24d84b39af8ab0930fef7f">max</a></div><div class="ttdeci">#define max(a, b)</div><div class="ttdef"><b>Definition:</b> kohonen_som_trace.c:24</div></div>
<div class="ttc" id="akohonen__som__trace_8c_html_a107f00650b8041f77767927073ddddb8"><div class="ttname"><a href="../../d0/d46/kohonen__som__trace_8c.html#a107f00650b8041f77767927073ddddb8">test_circle</a></div><div class="ttdeci">void test_circle(double *const *data, int N)</div><div class="ttdef"><b>Definition:</b> kohonen_som_trace.c:214</div></div>
<div class="ttc" id="akohonen__som__trace_8c_html_a7b84b14e60f47812b581d1f93057c85a"><div class="ttname"><a href="../../d0/d46/kohonen__som__trace_8c.html#a7b84b14e60f47812b581d1f93057c85a">save_nd_data</a></div><div class="ttdeci">int save_nd_data(const char *fname, double **X, int num_points, int num_features)</div><div class="ttdoc">Save a given n-dimensional data martix to file.</div><div class="ttdef"><b>Definition:</b> kohonen_som_trace.c:64</div></div>
<div class="ttc" id="akohonen__som__trace_8c_html_affe776513b24d84b39af8ab0930fef7f"><div class="ttname"><a href="../../d0/d46/kohonen__som__trace_8c.html#affe776513b24d84b39af8ab0930fef7f">max</a></div><div class="ttdeci">#define max(a, b)</div><div class="ttdoc">shorthand for maximum value</div><div class="ttdef"><b>Definition:</b> kohonen_som_trace.c:26</div></div>
<div class="ttc" id="akohonen__som__trace_8c_html_a107f00650b8041f77767927073ddddb8"><div class="ttname"><a href="../../d0/d46/kohonen__som__trace_8c.html#a107f00650b8041f77767927073ddddb8">test_circle</a></div><div class="ttdeci">void test_circle(double *const *data, int N)</div><div class="ttdoc">Creates a random set of points distributed near the circumference of a circle and trains an SOM that ...</div><div class="ttdef"><b>Definition:</b> kohonen_som_trace.c:212</div></div>
<div class="ttc" id="astructdata_html"><div class="ttname"><a href="../../df/dea/structdata.html">data</a></div><div class="ttdef"><b>Definition:</b> prime_factoriziation.c:25</div></div>
<div class="ttc" id="akohonen__som__trace_8c_html_aeaeffbff2be4d5d15b0d4f10f846abde"><div class="ttname"><a href="../../d0/d46/kohonen__som__trace_8c.html#aeaeffbff2be4d5d15b0d4f10f846abde">kohonen_som_tracer</a></div><div class="ttdeci">void kohonen_som_tracer(double **X, double *const *W, int num_samples, int num_features, int num_out, double alpha_min)</div><div class="ttdef"><b>Definition:</b> kohonen_som_trace.c:175</div></div>
<div class="ttc" id="akohonen__som__trace_8c_html_a9c98203f55242ff7a8f45a6370840e66"><div class="ttname"><a href="../../d0/d46/kohonen__som__trace_8c.html#a9c98203f55242ff7a8f45a6370840e66">update_weights</a></div><div class="ttdeci">void update_weights(double const *x, double *const *W, double *D, int num_out, int num_features, double alpha, int R)</div><div class="ttdef"><b>Definition:</b> kohonen_som_trace.c:124</div></div>
<div class="ttc" id="aproblem__13_2sol1_8c_html_a0240ac851181b84ac374872dc5434ee4"><div class="ttname"><a href="../../db/d01/problem__13_2sol1_8c.html#a0240ac851181b84ac374872dc5434ee4">N</a></div><div class="ttdeci">#define N</div><div class="ttdef"><b>Definition:</b> sol1.c:109</div></div>
<div class="ttc" id="akohonen__som__trace_8c_html_a0a292ebd954c568934b1fd06666d27e6"><div class="ttname"><a href="../../d0/d46/kohonen__som__trace_8c.html#a0a292ebd954c568934b1fd06666d27e6">get_min_1d</a></div><div class="ttdeci">void get_min_1d(double const *X, int N, double *val, int *idx)</div><div class="ttdef"><b>Definition:</b> kohonen_som_trace.c:99</div></div>
<div class="ttc" id="akohonen__som__trace_8c_html_af5ce14f026d6d231bef29161bac2b485"><div class="ttname"><a href="../../d0/d46/kohonen__som__trace_8c.html#af5ce14f026d6d231bef29161bac2b485">_random</a></div><div class="ttdeci">double _random(double a, double b)</div><div class="ttdef"><b>Definition:</b> kohonen_som_trace.c:50</div></div>
<div class="ttc" id="akohonen__som__trace_8c_html_aa2246f940155472084ee461f3685d614"><div class="ttname"><a href="../../d0/d46/kohonen__som__trace_8c.html#aa2246f940155472084ee461f3685d614">test_lamniscate</a></div><div class="ttdeci">void test_lamniscate(double *const *data, int N)</div><div class="ttdef"><b>Definition:</b> kohonen_som_trace.c:310</div></div>
<div class="ttc" id="akohonen__som__trace_8c_html_ac6afabdc09a49a433ee19d8a9486056d"><div class="ttname"><a href="../../d0/d46/kohonen__som__trace_8c.html#ac6afabdc09a49a433ee19d8a9486056d">min</a></div><div class="ttdeci">#define min(a, b)</div><div class="ttdef"><b>Definition:</b> kohonen_som_trace.c:30</div></div>
<div class="ttc" id="akohonen__som__trace_8c_html_a41ae16442e3e5b891a58d2e5932a2cd0"><div class="ttname"><a href="../../d0/d46/kohonen__som__trace_8c.html#a41ae16442e3e5b891a58d2e5932a2cd0">test_3d_classes</a></div><div class="ttdeci">void test_3d_classes(double *const *data, int N)</div><div class="ttdef"><b>Definition:</b> kohonen_som_trace.c:401</div></div>
<div class="ttc" id="akohonen__som__trace_8c_html_aeaeffbff2be4d5d15b0d4f10f846abde"><div class="ttname"><a href="../../d0/d46/kohonen__som__trace_8c.html#aeaeffbff2be4d5d15b0d4f10f846abde">kohonen_som_tracer</a></div><div class="ttdeci">void kohonen_som_tracer(double **X, double *const *W, int num_samples, int num_features, int num_out, double alpha_min)</div><div class="ttdoc">Apply incremental algorithm with updating neighborhood and learning rates on all samples in the given...</div><div class="ttdef"><b>Definition:</b> kohonen_som_trace.c:173</div></div>
<div class="ttc" id="akohonen__som__trace_8c_html_a9c98203f55242ff7a8f45a6370840e66"><div class="ttname"><a href="../../d0/d46/kohonen__som__trace_8c.html#a9c98203f55242ff7a8f45a6370840e66">update_weights</a></div><div class="ttdeci">void update_weights(double const *x, double *const *W, double *D, int num_out, int num_features, double alpha, int R)</div><div class="ttdoc">Update weights of the SOM using Kohonen algorithm.</div><div class="ttdef"><b>Definition:</b> kohonen_som_trace.c:123</div></div>
<div class="ttc" id="aproblem__13_2sol1_8c_html_a0240ac851181b84ac374872dc5434ee4"><div class="ttname"><a href="../../db/d01/problem__13_2sol1_8c.html#a0240ac851181b84ac374872dc5434ee4">N</a></div><div class="ttdeci">#define N</div><div class="ttdoc">number of digits of the large number</div><div class="ttdef"><b>Definition:</b> sol1.c:109</div></div>
<div class="ttc" id="akohonen__som__trace_8c_html_a0a292ebd954c568934b1fd06666d27e6"><div class="ttname"><a href="../../d0/d46/kohonen__som__trace_8c.html#a0a292ebd954c568934b1fd06666d27e6">get_min_1d</a></div><div class="ttdeci">void get_min_1d(double const *X, int N, double *val, int *idx)</div><div class="ttdoc">Get minimum value and index of the value in a vector.</div><div class="ttdef"><b>Definition:</b> kohonen_som_trace.c:98</div></div>
<div class="ttc" id="akohonen__som__trace_8c_html_af5ce14f026d6d231bef29161bac2b485"><div class="ttname"><a href="../../d0/d46/kohonen__som__trace_8c.html#af5ce14f026d6d231bef29161bac2b485">_random</a></div><div class="ttdeci">double _random(double a, double b)</div><div class="ttdoc">Helper function to generate a random number in a given interval.</div><div class="ttdef"><b>Definition:</b> kohonen_som_trace.c:48</div></div>
<div class="ttc" id="akohonen__som__trace_8c_html_aa2246f940155472084ee461f3685d614"><div class="ttname"><a href="../../d0/d46/kohonen__som__trace_8c.html#aa2246f940155472084ee461f3685d614">test_lamniscate</a></div><div class="ttdeci">void test_lamniscate(double *const *data, int N)</div><div class="ttdoc">Creates a random set of points distributed near the locus of the Lamniscate of Gerono.</div><div class="ttdef"><b>Definition:</b> kohonen_som_trace.c:308</div></div>
<div class="ttc" id="akohonen__som__trace_8c_html_ac6afabdc09a49a433ee19d8a9486056d"><div class="ttname"><a href="../../d0/d46/kohonen__som__trace_8c.html#ac6afabdc09a49a433ee19d8a9486056d">min</a></div><div class="ttdeci">#define min(a, b)</div><div class="ttdoc">shorthand for minimum value</div><div class="ttdef"><b>Definition:</b> kohonen_som_trace.c:30</div></div>
<div class="ttc" id="akohonen__som__trace_8c_html_a41ae16442e3e5b891a58d2e5932a2cd0"><div class="ttname"><a href="../../d0/d46/kohonen__som__trace_8c.html#a41ae16442e3e5b891a58d2e5932a2cd0">test_3d_classes</a></div><div class="ttdeci">void test_3d_classes(double *const *data, int N)</div><div class="ttdoc">Creates a random set of points distributed in four clusters in 3D space with centroids at the points.</div><div class="ttdef"><b>Definition:</b> kohonen_som_trace.c:399</div></div>
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>

View File

@ -0,0 +1,9 @@
<map id="test2" name="test2">
<area shape="rect" id="node1" title="Test that creates a random set of points distributed near the locus of the Lamniscate of Gerono and t..." alt="" coords="5,81,56,108"/>
<area shape="rect" id="node2" href="$d0/d46/kohonen__som__trace_8c.html#af5ce14f026d6d231bef29161bac2b485" title="Helper function to generate a random number in a given interval." alt="" coords="315,107,387,133"/>
<area shape="rect" id="node3" href="$d0/d46/kohonen__som__trace_8c.html#aeaeffbff2be4d5d15b0d4f10f846abde" title="Apply incremental algorithm with updating neighborhood and learning rates on all samples in the given..." alt="" coords="104,5,247,32"/>
<area shape="rect" id="node6" href="$d0/d46/kohonen__som__trace_8c.html#a7b84b14e60f47812b581d1f93057c85a" title="Save a given n&#45;dimensional data martix to file." alt="" coords="124,107,227,133"/>
<area shape="rect" id="node7" href="$d0/d46/kohonen__som__trace_8c.html#aa2246f940155472084ee461f3685d614" title="Creates a random set of points distributed near the locus of the Lamniscate of Gerono." alt="" coords="118,157,233,184"/>
<area shape="rect" id="node4" href="$d0/d46/kohonen__som__trace_8c.html#a9c98203f55242ff7a8f45a6370840e66" title="Update weights of the SOM using Kohonen algorithm." alt="" coords="295,5,408,32"/>
<area shape="rect" id="node5" href="$d0/d46/kohonen__som__trace_8c.html#a0a292ebd954c568934b1fd06666d27e6" title="Get minimum value and index of the value in a vector." alt="" coords="456,5,545,32"/>
</map>

View File

@ -0,0 +1 @@
b6374797b9534757b62ef251e29f0275

View File

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.44.0 (20200408.0750)
-->
<!-- Title: test2 Pages: 1 -->
<svg width="413pt" height="142pt"
viewBox="0.00 0.00 413.00 142.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 138)">
<title>test2</title>
<polygon fill="white" stroke="transparent" points="-4,4 -4,-138 409,-138 409,4 -4,4"/>
<!-- Node1 -->
<g id="node1" class="node">
<title>Node1</title>
<g id="a_node1"><a xlink:title="Test that creates a random set of points distributed near the locus of the Lamniscate of Gerono and t...">
<polygon fill="#bfbfbf" stroke="black" points="0,-57.5 0,-76.5 38,-76.5 38,-57.5 0,-57.5"/>
<text text-anchor="middle" x="19" y="-64.5" font-family="Helvetica,sans-Serif" font-size="10.00">test2</text>
</a>
</g>
</g>
<!-- Node2 -->
<g id="node2" class="node">
<title>Node2</title>
<g id="a_node2"><a xlink:href="../../d0/d46/kohonen__som__trace_8c.html#af5ce14f026d6d231bef29161bac2b485" target="_top" xlink:title="Helper function to generate a random number in a given interval.">
<polygon fill="white" stroke="black" points="232.5,-38.5 232.5,-57.5 286.5,-57.5 286.5,-38.5 232.5,-38.5"/>
<text text-anchor="middle" x="259.5" y="-45.5" font-family="Helvetica,sans-Serif" font-size="10.00">_random</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node2 -->
<g id="edge1" class="edge">
<title>Node1&#45;&gt;Node2</title>
<path fill="none" stroke="midnightblue" d="M38.44,-68.43C68.44,-70.44 129.66,-73.2 181,-67 194.67,-65.35 209.42,-62.11 222.33,-58.78"/>
<polygon fill="midnightblue" stroke="midnightblue" points="223.5,-62.08 232.25,-56.1 221.68,-55.33 223.5,-62.08"/>
</g>
<!-- Node3 -->
<g id="node3" class="node">
<title>Node3</title>
<g id="a_node3"><a xlink:href="../../d0/d46/kohonen__som__trace_8c.html#aeaeffbff2be4d5d15b0d4f10f846abde" target="_top" xlink:title="Apply incremental algorithm with updating neighborhood and learning rates on all samples in the given...">
<polygon fill="white" stroke="black" points="74,-114.5 74,-133.5 181,-133.5 181,-114.5 74,-114.5"/>
<text text-anchor="middle" x="127.5" y="-121.5" font-family="Helvetica,sans-Serif" font-size="10.00">kohonen_som_tracer</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node3 -->
<g id="edge2" class="edge">
<title>Node1&#45;&gt;Node3</title>
<path fill="none" stroke="midnightblue" d="M34.85,-76.74C45.54,-83.59 60.42,-92.78 74,-100 80.63,-103.53 87.88,-107.04 94.81,-110.26"/>
<polygon fill="midnightblue" stroke="midnightblue" points="93.44,-113.48 103.99,-114.42 96.33,-107.1 93.44,-113.48"/>
</g>
<!-- Node6 -->
<g id="node6" class="node">
<title>Node6</title>
<g id="a_node6"><a xlink:href="../../d0/d46/kohonen__som__trace_8c.html#a7b84b14e60f47812b581d1f93057c85a" target="_top" xlink:title="Save a given n&#45;dimensional data martix to file.">
<polygon fill="white" stroke="black" points="89,-38.5 89,-57.5 166,-57.5 166,-38.5 89,-38.5"/>
<text text-anchor="middle" x="127.5" y="-45.5" font-family="Helvetica,sans-Serif" font-size="10.00">save_nd_data</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node6 -->
<g id="edge5" class="edge">
<title>Node1&#45;&gt;Node6</title>
<path fill="none" stroke="midnightblue" d="M38.07,-63.78C49.35,-61.76 64.45,-59.07 78.97,-56.48"/>
<polygon fill="midnightblue" stroke="midnightblue" points="79.65,-59.91 88.88,-54.71 78.42,-53.02 79.65,-59.91"/>
</g>
<!-- Node7 -->
<g id="node7" class="node">
<title>Node7</title>
<g id="a_node7"><a xlink:href="../../d0/d46/kohonen__som__trace_8c.html#aa2246f940155472084ee461f3685d614" target="_top" xlink:title="Creates a random set of points distributed near the locus of the Lamniscate of Gerono.">
<polygon fill="white" stroke="black" points="84.5,-0.5 84.5,-19.5 170.5,-19.5 170.5,-0.5 84.5,-0.5"/>
<text text-anchor="middle" x="127.5" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">test_lamniscate</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node7 -->
<g id="edge6" class="edge">
<title>Node1&#45;&gt;Node7</title>
<path fill="none" stroke="midnightblue" d="M31.84,-57.27C42.41,-48.94 58.55,-37.05 74,-29 77.98,-26.93 82.23,-24.99 86.53,-23.19"/>
<polygon fill="midnightblue" stroke="midnightblue" points="87.89,-26.42 95.93,-19.51 85.34,-19.9 87.89,-26.42"/>
</g>
<!-- Node4 -->
<g id="node4" class="node">
<title>Node4</title>
<g id="a_node4"><a xlink:href="../../d0/d46/kohonen__som__trace_8c.html#a9c98203f55242ff7a8f45a6370840e66" target="_top" xlink:title="Update weights of the SOM using Kohonen algorithm.">
<polygon fill="white" stroke="black" points="217,-114.5 217,-133.5 302,-133.5 302,-114.5 217,-114.5"/>
<text text-anchor="middle" x="259.5" y="-121.5" font-family="Helvetica,sans-Serif" font-size="10.00">update_weights</text>
</a>
</g>
</g>
<!-- Node3&#45;&gt;Node4 -->
<g id="edge3" class="edge">
<title>Node3&#45;&gt;Node4</title>
<path fill="none" stroke="midnightblue" d="M181,-124C189.52,-124 198.33,-124 206.83,-124"/>
<polygon fill="midnightblue" stroke="midnightblue" points="206.99,-127.5 216.99,-124 206.99,-120.5 206.99,-127.5"/>
</g>
<!-- Node5 -->
<g id="node5" class="node">
<title>Node5</title>
<g id="a_node5"><a xlink:href="../../d0/d46/kohonen__som__trace_8c.html#a0a292ebd954c568934b1fd06666d27e6" target="_top" xlink:title="Get minimum value and index of the value in a vector.">
<polygon fill="white" stroke="black" points="338,-114.5 338,-133.5 405,-133.5 405,-114.5 338,-114.5"/>
<text text-anchor="middle" x="371.5" y="-121.5" font-family="Helvetica,sans-Serif" font-size="10.00">get_min_1d</text>
</a>
</g>
</g>
<!-- Node4&#45;&gt;Node5 -->
<g id="edge4" class="edge">
<title>Node4&#45;&gt;Node5</title>
<path fill="none" stroke="midnightblue" d="M302.09,-124C310.48,-124 319.31,-124 327.74,-124"/>
<polygon fill="midnightblue" stroke="midnightblue" points="327.77,-127.5 337.77,-124 327.77,-120.5 327.77,-127.5"/>
</g>
<!-- Node7&#45;&gt;Node2 -->
<g id="edge7" class="edge">
<title>Node7&#45;&gt;Node2</title>
<path fill="none" stroke="midnightblue" d="M161.3,-19.59C179.92,-25.03 203.25,-31.85 222.39,-37.45"/>
<polygon fill="midnightblue" stroke="midnightblue" points="221.67,-40.88 232.25,-40.33 223.63,-34.16 221.67,-40.88"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

@ -1,4 +1,4 @@
<map id="test_circle" name="test_circle">
<area shape="rect" id="node1" title=" " alt="" coords="5,5,88,32"/>
<area shape="rect" id="node2" href="$d0/d46/kohonen__som__trace_8c.html#af5ce14f026d6d231bef29161bac2b485" title=" " alt="" coords="136,5,208,32"/>
<area shape="rect" id="node1" title="Creates a random set of points distributed near the circumference of a circle and trains an SOM that ..." alt="" coords="5,5,88,32"/>
<area shape="rect" id="node2" href="$d0/d46/kohonen__som__trace_8c.html#af5ce14f026d6d231bef29161bac2b485" title="Helper function to generate a random number in a given interval." alt="" coords="136,5,208,32"/>
</map>

View File

@ -1 +1 @@
ce0410fad29b3e83b825e08bc319f181
a1491d3ce371e149bc3ae6c3cda20027

View File

@ -12,7 +12,7 @@
<!-- Node1 -->
<g id="node1" class="node">
<title>Node1</title>
<g id="a_node1"><a xlink:title=" ">
<g id="a_node1"><a xlink:title="Creates a random set of points distributed near the circumference of a circle and trains an SOM that ...">
<polygon fill="#bfbfbf" stroke="black" points="0,-0.5 0,-19.5 62,-19.5 62,-0.5 0,-0.5"/>
<text text-anchor="middle" x="31" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">test_circle</text>
</a>
@ -21,7 +21,7 @@
<!-- Node2 -->
<g id="node2" class="node">
<title>Node2</title>
<g id="a_node2"><a xlink:href="../../d0/d46/kohonen__som__trace_8c.html#af5ce14f026d6d231bef29161bac2b485" target="_top" xlink:title=" ">
<g id="a_node2"><a xlink:href="../../d0/d46/kohonen__som__trace_8c.html#af5ce14f026d6d231bef29161bac2b485" target="_top" xlink:title="Helper function to generate a random number in a given interval.">
<polygon fill="white" stroke="black" points="98,-0.5 98,-19.5 152,-19.5 152,-0.5 98,-0.5"/>
<text text-anchor="middle" x="125" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">_random</text>
</a>

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -0,0 +1,9 @@
<map id="test1" name="test1">
<area shape="rect" id="node1" title="Test that creates a random set of points distributed near the circumference of a circle and trains an..." alt="" coords="5,81,56,108"/>
<area shape="rect" id="node2" href="$d0/d46/kohonen__som__trace_8c.html#af5ce14f026d6d231bef29161bac2b485" title="Helper function to generate a random number in a given interval." alt="" coords="315,107,387,133"/>
<area shape="rect" id="node3" href="$d0/d46/kohonen__som__trace_8c.html#aeaeffbff2be4d5d15b0d4f10f846abde" title="Apply incremental algorithm with updating neighborhood and learning rates on all samples in the given..." alt="" coords="104,5,247,32"/>
<area shape="rect" id="node6" href="$d0/d46/kohonen__som__trace_8c.html#a7b84b14e60f47812b581d1f93057c85a" title="Save a given n&#45;dimensional data martix to file." alt="" coords="124,107,227,133"/>
<area shape="rect" id="node7" href="$d0/d46/kohonen__som__trace_8c.html#a107f00650b8041f77767927073ddddb8" title="Creates a random set of points distributed near the circumference of a circle and trains an SOM that ..." alt="" coords="134,157,217,184"/>
<area shape="rect" id="node4" href="$d0/d46/kohonen__som__trace_8c.html#a9c98203f55242ff7a8f45a6370840e66" title="Update weights of the SOM using Kohonen algorithm." alt="" coords="295,5,408,32"/>
<area shape="rect" id="node5" href="$d0/d46/kohonen__som__trace_8c.html#a0a292ebd954c568934b1fd06666d27e6" title="Get minimum value and index of the value in a vector." alt="" coords="456,5,545,32"/>
</map>

View File

@ -0,0 +1 @@
11b857191d78163661d373779e1efbd9

View File

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.44.0 (20200408.0750)
-->
<!-- Title: test1 Pages: 1 -->
<svg width="413pt" height="142pt"
viewBox="0.00 0.00 413.00 142.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 138)">
<title>test1</title>
<polygon fill="white" stroke="transparent" points="-4,4 -4,-138 409,-138 409,4 -4,4"/>
<!-- Node1 -->
<g id="node1" class="node">
<title>Node1</title>
<g id="a_node1"><a xlink:title="Test that creates a random set of points distributed near the circumference of a circle and trains an...">
<polygon fill="#bfbfbf" stroke="black" points="0,-57.5 0,-76.5 38,-76.5 38,-57.5 0,-57.5"/>
<text text-anchor="middle" x="19" y="-64.5" font-family="Helvetica,sans-Serif" font-size="10.00">test1</text>
</a>
</g>
</g>
<!-- Node2 -->
<g id="node2" class="node">
<title>Node2</title>
<g id="a_node2"><a xlink:href="../../d0/d46/kohonen__som__trace_8c.html#af5ce14f026d6d231bef29161bac2b485" target="_top" xlink:title="Helper function to generate a random number in a given interval.">
<polygon fill="white" stroke="black" points="232.5,-38.5 232.5,-57.5 286.5,-57.5 286.5,-38.5 232.5,-38.5"/>
<text text-anchor="middle" x="259.5" y="-45.5" font-family="Helvetica,sans-Serif" font-size="10.00">_random</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node2 -->
<g id="edge1" class="edge">
<title>Node1&#45;&gt;Node2</title>
<path fill="none" stroke="midnightblue" d="M38.44,-68.43C68.44,-70.44 129.66,-73.2 181,-67 194.67,-65.35 209.42,-62.11 222.33,-58.78"/>
<polygon fill="midnightblue" stroke="midnightblue" points="223.5,-62.08 232.25,-56.1 221.68,-55.33 223.5,-62.08"/>
</g>
<!-- Node3 -->
<g id="node3" class="node">
<title>Node3</title>
<g id="a_node3"><a xlink:href="../../d0/d46/kohonen__som__trace_8c.html#aeaeffbff2be4d5d15b0d4f10f846abde" target="_top" xlink:title="Apply incremental algorithm with updating neighborhood and learning rates on all samples in the given...">
<polygon fill="white" stroke="black" points="74,-114.5 74,-133.5 181,-133.5 181,-114.5 74,-114.5"/>
<text text-anchor="middle" x="127.5" y="-121.5" font-family="Helvetica,sans-Serif" font-size="10.00">kohonen_som_tracer</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node3 -->
<g id="edge2" class="edge">
<title>Node1&#45;&gt;Node3</title>
<path fill="none" stroke="midnightblue" d="M34.85,-76.74C45.54,-83.59 60.42,-92.78 74,-100 80.63,-103.53 87.88,-107.04 94.81,-110.26"/>
<polygon fill="midnightblue" stroke="midnightblue" points="93.44,-113.48 103.99,-114.42 96.33,-107.1 93.44,-113.48"/>
</g>
<!-- Node6 -->
<g id="node6" class="node">
<title>Node6</title>
<g id="a_node6"><a xlink:href="../../d0/d46/kohonen__som__trace_8c.html#a7b84b14e60f47812b581d1f93057c85a" target="_top" xlink:title="Save a given n&#45;dimensional data martix to file.">
<polygon fill="white" stroke="black" points="89,-38.5 89,-57.5 166,-57.5 166,-38.5 89,-38.5"/>
<text text-anchor="middle" x="127.5" y="-45.5" font-family="Helvetica,sans-Serif" font-size="10.00">save_nd_data</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node6 -->
<g id="edge5" class="edge">
<title>Node1&#45;&gt;Node6</title>
<path fill="none" stroke="midnightblue" d="M38.07,-63.78C49.35,-61.76 64.45,-59.07 78.97,-56.48"/>
<polygon fill="midnightblue" stroke="midnightblue" points="79.65,-59.91 88.88,-54.71 78.42,-53.02 79.65,-59.91"/>
</g>
<!-- Node7 -->
<g id="node7" class="node">
<title>Node7</title>
<g id="a_node7"><a xlink:href="../../d0/d46/kohonen__som__trace_8c.html#a107f00650b8041f77767927073ddddb8" target="_top" xlink:title="Creates a random set of points distributed near the circumference of a circle and trains an SOM that ...">
<polygon fill="white" stroke="black" points="96.5,-0.5 96.5,-19.5 158.5,-19.5 158.5,-0.5 96.5,-0.5"/>
<text text-anchor="middle" x="127.5" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">test_circle</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node7 -->
<g id="edge6" class="edge">
<title>Node1&#45;&gt;Node7</title>
<path fill="none" stroke="midnightblue" d="M31.84,-57.27C42.41,-48.94 58.55,-37.05 74,-29 78.08,-26.88 82.44,-24.89 86.85,-23.06"/>
<polygon fill="midnightblue" stroke="midnightblue" points="88.43,-26.2 96.48,-19.31 85.89,-19.68 88.43,-26.2"/>
</g>
<!-- Node4 -->
<g id="node4" class="node">
<title>Node4</title>
<g id="a_node4"><a xlink:href="../../d0/d46/kohonen__som__trace_8c.html#a9c98203f55242ff7a8f45a6370840e66" target="_top" xlink:title="Update weights of the SOM using Kohonen algorithm.">
<polygon fill="white" stroke="black" points="217,-114.5 217,-133.5 302,-133.5 302,-114.5 217,-114.5"/>
<text text-anchor="middle" x="259.5" y="-121.5" font-family="Helvetica,sans-Serif" font-size="10.00">update_weights</text>
</a>
</g>
</g>
<!-- Node3&#45;&gt;Node4 -->
<g id="edge3" class="edge">
<title>Node3&#45;&gt;Node4</title>
<path fill="none" stroke="midnightblue" d="M181,-124C189.52,-124 198.33,-124 206.83,-124"/>
<polygon fill="midnightblue" stroke="midnightblue" points="206.99,-127.5 216.99,-124 206.99,-120.5 206.99,-127.5"/>
</g>
<!-- Node5 -->
<g id="node5" class="node">
<title>Node5</title>
<g id="a_node5"><a xlink:href="../../d0/d46/kohonen__som__trace_8c.html#a0a292ebd954c568934b1fd06666d27e6" target="_top" xlink:title="Get minimum value and index of the value in a vector.">
<polygon fill="white" stroke="black" points="338,-114.5 338,-133.5 405,-133.5 405,-114.5 338,-114.5"/>
<text text-anchor="middle" x="371.5" y="-121.5" font-family="Helvetica,sans-Serif" font-size="10.00">get_min_1d</text>
</a>
</g>
</g>
<!-- Node4&#45;&gt;Node5 -->
<g id="edge4" class="edge">
<title>Node4&#45;&gt;Node5</title>
<path fill="none" stroke="midnightblue" d="M302.09,-124C310.48,-124 319.31,-124 327.74,-124"/>
<polygon fill="midnightblue" stroke="midnightblue" points="327.77,-127.5 337.77,-124 327.77,-120.5 327.77,-127.5"/>
</g>
<!-- Node7&#45;&gt;Node2 -->
<g id="edge7" class="edge">
<title>Node7&#45;&gt;Node2</title>
<path fill="none" stroke="midnightblue" d="M158.65,-18.81C177.77,-24.4 202.61,-31.66 222.72,-37.54"/>
<polygon fill="midnightblue" stroke="midnightblue" points="221.89,-40.94 232.47,-40.39 223.85,-34.22 221.89,-40.94"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

@ -0,0 +1,4 @@
<map id="test_3d_classes" name="test_3d_classes">
<area shape="rect" id="node1" title="Creates a random set of points distributed in four clusters in 3D space with centroids at the points." alt="" coords="5,5,123,32"/>
<area shape="rect" id="node2" href="$d0/d46/kohonen__som__trace_8c.html#af5ce14f026d6d231bef29161bac2b485" title="Helper function to generate a random number in a given interval." alt="" coords="171,5,243,32"/>
</map>

View File

@ -0,0 +1 @@
5eb1a69570e173d89fe7f311410192f1

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.44.0 (20200408.0750)
-->
<!-- Title: test_3d_classes Pages: 1 -->
<svg width="186pt" height="28pt"
viewBox="0.00 0.00 186.00 28.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 24)">
<title>test_3d_classes</title>
<polygon fill="white" stroke="transparent" points="-4,4 -4,-24 182,-24 182,4 -4,4"/>
<!-- Node1 -->
<g id="node1" class="node">
<title>Node1</title>
<g id="a_node1"><a xlink:title="Creates a random set of points distributed in four clusters in 3D space with centroids at the points.">
<polygon fill="#bfbfbf" stroke="black" points="0,-0.5 0,-19.5 88,-19.5 88,-0.5 0,-0.5"/>
<text text-anchor="middle" x="44" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">test_3d_classes</text>
</a>
</g>
</g>
<!-- Node2 -->
<g id="node2" class="node">
<title>Node2</title>
<g id="a_node2"><a xlink:href="../../d0/d46/kohonen__som__trace_8c.html#af5ce14f026d6d231bef29161bac2b485" target="_top" xlink:title="Helper function to generate a random number in a given interval.">
<polygon fill="white" stroke="black" points="124,-0.5 124,-19.5 178,-19.5 178,-0.5 124,-0.5"/>
<text text-anchor="middle" x="151" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">_random</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node2 -->
<g id="edge1" class="edge">
<title>Node1&#45;&gt;Node2</title>
<path fill="none" stroke="midnightblue" d="M88.01,-10C96.53,-10 105.4,-10 113.67,-10"/>
<polygon fill="midnightblue" stroke="midnightblue" points="113.76,-13.5 123.76,-10 113.76,-6.5 113.76,-13.5"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -0,0 +1,9 @@
<map id="test3" name="test3">
<area shape="rect" id="node1" title="Test that creates a random set of points distributed in six clusters in 3D space." alt="" coords="5,81,56,108"/>
<area shape="rect" id="node2" href="$d0/d46/kohonen__som__trace_8c.html#af5ce14f026d6d231bef29161bac2b485" title="Helper function to generate a random number in a given interval." alt="" coords="315,107,387,133"/>
<area shape="rect" id="node3" href="$d0/d46/kohonen__som__trace_8c.html#aeaeffbff2be4d5d15b0d4f10f846abde" title="Apply incremental algorithm with updating neighborhood and learning rates on all samples in the given..." alt="" coords="104,5,247,32"/>
<area shape="rect" id="node6" href="$d0/d46/kohonen__som__trace_8c.html#a7b84b14e60f47812b581d1f93057c85a" title="Save a given n&#45;dimensional data martix to file." alt="" coords="124,107,227,133"/>
<area shape="rect" id="node7" href="$d0/d46/kohonen__som__trace_8c.html#a41ae16442e3e5b891a58d2e5932a2cd0" title="Creates a random set of points distributed in four clusters in 3D space with centroids at the points." alt="" coords="117,157,234,184"/>
<area shape="rect" id="node4" href="$d0/d46/kohonen__som__trace_8c.html#a9c98203f55242ff7a8f45a6370840e66" title="Update weights of the SOM using Kohonen algorithm." alt="" coords="295,5,408,32"/>
<area shape="rect" id="node5" href="$d0/d46/kohonen__som__trace_8c.html#a0a292ebd954c568934b1fd06666d27e6" title="Get minimum value and index of the value in a vector." alt="" coords="456,5,545,32"/>
</map>

View File

@ -0,0 +1 @@
b82f839c8b7d2f7ce36c277c9202442f

View File

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.44.0 (20200408.0750)
-->
<!-- Title: test3 Pages: 1 -->
<svg width="413pt" height="142pt"
viewBox="0.00 0.00 413.00 142.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 138)">
<title>test3</title>
<polygon fill="white" stroke="transparent" points="-4,4 -4,-138 409,-138 409,4 -4,4"/>
<!-- Node1 -->
<g id="node1" class="node">
<title>Node1</title>
<g id="a_node1"><a xlink:title="Test that creates a random set of points distributed in six clusters in 3D space.">
<polygon fill="#bfbfbf" stroke="black" points="0,-57.5 0,-76.5 38,-76.5 38,-57.5 0,-57.5"/>
<text text-anchor="middle" x="19" y="-64.5" font-family="Helvetica,sans-Serif" font-size="10.00">test3</text>
</a>
</g>
</g>
<!-- Node2 -->
<g id="node2" class="node">
<title>Node2</title>
<g id="a_node2"><a xlink:href="../../d0/d46/kohonen__som__trace_8c.html#af5ce14f026d6d231bef29161bac2b485" target="_top" xlink:title="Helper function to generate a random number in a given interval.">
<polygon fill="white" stroke="black" points="232.5,-38.5 232.5,-57.5 286.5,-57.5 286.5,-38.5 232.5,-38.5"/>
<text text-anchor="middle" x="259.5" y="-45.5" font-family="Helvetica,sans-Serif" font-size="10.00">_random</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node2 -->
<g id="edge1" class="edge">
<title>Node1&#45;&gt;Node2</title>
<path fill="none" stroke="midnightblue" d="M38.44,-68.43C68.44,-70.44 129.66,-73.2 181,-67 194.67,-65.35 209.42,-62.11 222.33,-58.78"/>
<polygon fill="midnightblue" stroke="midnightblue" points="223.5,-62.08 232.25,-56.1 221.68,-55.33 223.5,-62.08"/>
</g>
<!-- Node3 -->
<g id="node3" class="node">
<title>Node3</title>
<g id="a_node3"><a xlink:href="../../d0/d46/kohonen__som__trace_8c.html#aeaeffbff2be4d5d15b0d4f10f846abde" target="_top" xlink:title="Apply incremental algorithm with updating neighborhood and learning rates on all samples in the given...">
<polygon fill="white" stroke="black" points="74,-114.5 74,-133.5 181,-133.5 181,-114.5 74,-114.5"/>
<text text-anchor="middle" x="127.5" y="-121.5" font-family="Helvetica,sans-Serif" font-size="10.00">kohonen_som_tracer</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node3 -->
<g id="edge2" class="edge">
<title>Node1&#45;&gt;Node3</title>
<path fill="none" stroke="midnightblue" d="M34.85,-76.74C45.54,-83.59 60.42,-92.78 74,-100 80.63,-103.53 87.88,-107.04 94.81,-110.26"/>
<polygon fill="midnightblue" stroke="midnightblue" points="93.44,-113.48 103.99,-114.42 96.33,-107.1 93.44,-113.48"/>
</g>
<!-- Node6 -->
<g id="node6" class="node">
<title>Node6</title>
<g id="a_node6"><a xlink:href="../../d0/d46/kohonen__som__trace_8c.html#a7b84b14e60f47812b581d1f93057c85a" target="_top" xlink:title="Save a given n&#45;dimensional data martix to file.">
<polygon fill="white" stroke="black" points="89,-38.5 89,-57.5 166,-57.5 166,-38.5 89,-38.5"/>
<text text-anchor="middle" x="127.5" y="-45.5" font-family="Helvetica,sans-Serif" font-size="10.00">save_nd_data</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node6 -->
<g id="edge5" class="edge">
<title>Node1&#45;&gt;Node6</title>
<path fill="none" stroke="midnightblue" d="M38.07,-63.78C49.35,-61.76 64.45,-59.07 78.97,-56.48"/>
<polygon fill="midnightblue" stroke="midnightblue" points="79.65,-59.91 88.88,-54.71 78.42,-53.02 79.65,-59.91"/>
</g>
<!-- Node7 -->
<g id="node7" class="node">
<title>Node7</title>
<g id="a_node7"><a xlink:href="../../d0/d46/kohonen__som__trace_8c.html#a41ae16442e3e5b891a58d2e5932a2cd0" target="_top" xlink:title="Creates a random set of points distributed in four clusters in 3D space with centroids at the points.">
<polygon fill="white" stroke="black" points="83.5,-0.5 83.5,-19.5 171.5,-19.5 171.5,-0.5 83.5,-0.5"/>
<text text-anchor="middle" x="127.5" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">test_3d_classes</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node7 -->
<g id="edge6" class="edge">
<title>Node1&#45;&gt;Node7</title>
<path fill="none" stroke="midnightblue" d="M31.84,-57.27C42.41,-48.94 58.55,-37.05 74,-29 77.98,-26.93 82.23,-24.99 86.53,-23.19"/>
<polygon fill="midnightblue" stroke="midnightblue" points="87.89,-26.42 95.93,-19.51 85.34,-19.9 87.89,-26.42"/>
</g>
<!-- Node4 -->
<g id="node4" class="node">
<title>Node4</title>
<g id="a_node4"><a xlink:href="../../d0/d46/kohonen__som__trace_8c.html#a9c98203f55242ff7a8f45a6370840e66" target="_top" xlink:title="Update weights of the SOM using Kohonen algorithm.">
<polygon fill="white" stroke="black" points="217,-114.5 217,-133.5 302,-133.5 302,-114.5 217,-114.5"/>
<text text-anchor="middle" x="259.5" y="-121.5" font-family="Helvetica,sans-Serif" font-size="10.00">update_weights</text>
</a>
</g>
</g>
<!-- Node3&#45;&gt;Node4 -->
<g id="edge3" class="edge">
<title>Node3&#45;&gt;Node4</title>
<path fill="none" stroke="midnightblue" d="M181,-124C189.52,-124 198.33,-124 206.83,-124"/>
<polygon fill="midnightblue" stroke="midnightblue" points="206.99,-127.5 216.99,-124 206.99,-120.5 206.99,-127.5"/>
</g>
<!-- Node5 -->
<g id="node5" class="node">
<title>Node5</title>
<g id="a_node5"><a xlink:href="../../d0/d46/kohonen__som__trace_8c.html#a0a292ebd954c568934b1fd06666d27e6" target="_top" xlink:title="Get minimum value and index of the value in a vector.">
<polygon fill="white" stroke="black" points="338,-114.5 338,-133.5 405,-133.5 405,-114.5 338,-114.5"/>
<text text-anchor="middle" x="371.5" y="-121.5" font-family="Helvetica,sans-Serif" font-size="10.00">get_min_1d</text>
</a>
</g>
</g>
<!-- Node4&#45;&gt;Node5 -->
<g id="edge4" class="edge">
<title>Node4&#45;&gt;Node5</title>
<path fill="none" stroke="midnightblue" d="M302.09,-124C310.48,-124 319.31,-124 327.74,-124"/>
<polygon fill="midnightblue" stroke="midnightblue" points="327.77,-127.5 337.77,-124 327.77,-120.5 327.77,-127.5"/>
</g>
<!-- Node7&#45;&gt;Node2 -->
<g id="edge7" class="edge">
<title>Node7&#45;&gt;Node2</title>
<path fill="none" stroke="midnightblue" d="M161.3,-19.59C179.92,-25.03 203.25,-31.85 222.39,-37.45"/>
<polygon fill="midnightblue" stroke="midnightblue" points="221.67,-40.88 232.25,-40.33 223.63,-34.16 221.67,-40.88"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

@ -1,4 +1,4 @@
<map id="update_weights" name="update_weights">
<area shape="rect" id="node1" title=" " alt="" coords="5,5,119,32"/>
<area shape="rect" id="node2" href="$d0/d46/kohonen__som__trace_8c.html#a0a292ebd954c568934b1fd06666d27e6" title=" " alt="" coords="167,5,256,32"/>
<area shape="rect" id="node1" title="Update weights of the SOM using Kohonen algorithm." alt="" coords="5,5,119,32"/>
<area shape="rect" id="node2" href="$d0/d46/kohonen__som__trace_8c.html#a0a292ebd954c568934b1fd06666d27e6" title="Get minimum value and index of the value in a vector." alt="" coords="167,5,256,32"/>
</map>

View File

@ -1 +1 @@
39b9c9e997212cad5dab8e8d374f3bc2
31ffe430e8be93ac84683b3439bbedf3

View File

@ -12,7 +12,7 @@
<!-- Node1 -->
<g id="node1" class="node">
<title>Node1</title>
<g id="a_node1"><a xlink:title=" ">
<g id="a_node1"><a xlink:title="Update weights of the SOM using Kohonen algorithm.">
<polygon fill="#bfbfbf" stroke="black" points="0,-0.5 0,-19.5 85,-19.5 85,-0.5 0,-0.5"/>
<text text-anchor="middle" x="42.5" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">update_weights</text>
</a>
@ -21,7 +21,7 @@
<!-- Node2 -->
<g id="node2" class="node">
<title>Node2</title>
<g id="a_node2"><a xlink:href="../../d0/d46/kohonen__som__trace_8c.html#a0a292ebd954c568934b1fd06666d27e6" target="_top" xlink:title=" ">
<g id="a_node2"><a xlink:href="../../d0/d46/kohonen__som__trace_8c.html#a0a292ebd954c568934b1fd06666d27e6" target="_top" xlink:title="Get minimum value and index of the value in a vector.">
<polygon fill="white" stroke="black" points="121,-0.5 121,-19.5 188,-19.5 188,-0.5 121,-0.5"/>
<text text-anchor="middle" x="154.5" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">get_min_1d</text>
</a>

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -1,4 +1,4 @@
<map id="test_lamniscate" name="test_lamniscate">
<area shape="rect" id="node1" title=" " alt="" coords="5,5,120,32"/>
<area shape="rect" id="node2" href="$d0/d46/kohonen__som__trace_8c.html#af5ce14f026d6d231bef29161bac2b485" title=" " alt="" coords="168,5,240,32"/>
<area shape="rect" id="node1" title="Creates a random set of points distributed near the locus of the Lamniscate of Gerono." alt="" coords="5,5,120,32"/>
<area shape="rect" id="node2" href="$d0/d46/kohonen__som__trace_8c.html#af5ce14f026d6d231bef29161bac2b485" title="Helper function to generate a random number in a given interval." alt="" coords="168,5,240,32"/>
</map>

View File

@ -1 +1 @@
f1133d56cd92d73cc3004300fc82db70
c2eb0142ff03bb12402faf86eee4032c

View File

@ -12,7 +12,7 @@
<!-- Node1 -->
<g id="node1" class="node">
<title>Node1</title>
<g id="a_node1"><a xlink:title=" ">
<g id="a_node1"><a xlink:title="Creates a random set of points distributed near the locus of the Lamniscate of Gerono.">
<polygon fill="#bfbfbf" stroke="black" points="0,-0.5 0,-19.5 86,-19.5 86,-0.5 0,-0.5"/>
<text text-anchor="middle" x="43" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">test_lamniscate</text>
</a>
@ -21,7 +21,7 @@
<!-- Node2 -->
<g id="node2" class="node">
<title>Node2</title>
<g id="a_node2"><a xlink:href="../../d0/d46/kohonen__som__trace_8c.html#af5ce14f026d6d231bef29161bac2b485" target="_top" xlink:title=" ">
<g id="a_node2"><a xlink:href="../../d0/d46/kohonen__som__trace_8c.html#af5ce14f026d6d231bef29161bac2b485" target="_top" xlink:title="Helper function to generate a random number in a given interval.">
<polygon fill="white" stroke="black" points="122,-0.5 122,-19.5 176,-19.5 176,-0.5 122,-0.5"/>
<text text-anchor="middle" x="149" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">_random</text>
</a>

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -1,5 +1,5 @@
<map id="kohonen_som_tracer" name="kohonen_som_tracer">
<area shape="rect" id="node1" title=" " alt="" coords="5,5,148,32"/>
<area shape="rect" id="node2" href="$d0/d46/kohonen__som__trace_8c.html#a9c98203f55242ff7a8f45a6370840e66" title=" " alt="" coords="196,5,309,32"/>
<area shape="rect" id="node3" href="$d0/d46/kohonen__som__trace_8c.html#a0a292ebd954c568934b1fd06666d27e6" title=" " alt="" coords="357,5,447,32"/>
<area shape="rect" id="node1" title="Apply incremental algorithm with updating neighborhood and learning rates on all samples in the given..." alt="" coords="5,5,148,32"/>
<area shape="rect" id="node2" href="$d0/d46/kohonen__som__trace_8c.html#a9c98203f55242ff7a8f45a6370840e66" title="Update weights of the SOM using Kohonen algorithm." alt="" coords="196,5,309,32"/>
<area shape="rect" id="node3" href="$d0/d46/kohonen__som__trace_8c.html#a0a292ebd954c568934b1fd06666d27e6" title="Get minimum value and index of the value in a vector." alt="" coords="357,5,447,32"/>
</map>

View File

@ -1 +1 @@
581ef7f0b2099f2c0ba66f8824e73bc9
0d1405ee9105e9b418204f2848cb998f

View File

@ -12,7 +12,7 @@
<!-- Node1 -->
<g id="node1" class="node">
<title>Node1</title>
<g id="a_node1"><a xlink:title=" ">
<g id="a_node1"><a xlink:title="Apply incremental algorithm with updating neighborhood and learning rates on all samples in the given...">
<polygon fill="#bfbfbf" stroke="black" points="0,-0.5 0,-19.5 107,-19.5 107,-0.5 0,-0.5"/>
<text text-anchor="middle" x="53.5" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">kohonen_som_tracer</text>
</a>
@ -21,7 +21,7 @@
<!-- Node2 -->
<g id="node2" class="node">
<title>Node2</title>
<g id="a_node2"><a xlink:href="../../d0/d46/kohonen__som__trace_8c.html#a9c98203f55242ff7a8f45a6370840e66" target="_top" xlink:title=" ">
<g id="a_node2"><a xlink:href="../../d0/d46/kohonen__som__trace_8c.html#a9c98203f55242ff7a8f45a6370840e66" target="_top" xlink:title="Update weights of the SOM using Kohonen algorithm.">
<polygon fill="white" stroke="black" points="143,-0.5 143,-19.5 228,-19.5 228,-0.5 143,-0.5"/>
<text text-anchor="middle" x="185.5" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">update_weights</text>
</a>
@ -36,7 +36,7 @@
<!-- Node3 -->
<g id="node3" class="node">
<title>Node3</title>
<g id="a_node3"><a xlink:href="../../d0/d46/kohonen__som__trace_8c.html#a0a292ebd954c568934b1fd06666d27e6" target="_top" xlink:title=" ">
<g id="a_node3"><a xlink:href="../../d0/d46/kohonen__som__trace_8c.html#a0a292ebd954c568934b1fd06666d27e6" target="_top" xlink:title="Get minimum value and index of the value in a vector.">
<polygon fill="white" stroke="black" points="264,-0.5 264,-19.5 331,-19.5 331,-0.5 264,-0.5"/>
<text text-anchor="middle" x="297.5" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">get_min_1d</text>
</a>

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -110,8 +110,11 @@ Include dependency graph for sol.c:</div>
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:adf9bea8d35848959bde5b3f277edf0c4"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d6c/problem__4_2sol_8c.html#adf9bea8d35848959bde5b3f277edf0c4">is_palindromic</a> (unsigned int n)</td></tr>
<tr class="memdesc:adf9bea8d35848959bde5b3f277edf0c4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Check if number is palindromic. <a href="../../d0/d6c/problem__4_2sol_8c.html#adf9bea8d35848959bde5b3f277edf0c4">More...</a><br /></td></tr>
<tr class="separator:adf9bea8d35848959bde5b3f277edf0c4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a840291bc02cba5474a4cb46a9b9566fe"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d6c/problem__4_2sol_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main</a> (void)</td></tr>
<tr class="memitem:a840291bc02cba5474a4cb46a9b9566fe"><td class="memItemLeft" align="right" valign="top"><a id="a840291bc02cba5474a4cb46a9b9566fe"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d6c/problem__4_2sol_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main</a> (void)</td></tr>
<tr class="memdesc:a840291bc02cba5474a4cb46a9b9566fe"><td class="mdescLeft">&#160;</td><td class="mdescRight">Main function. <br /></td></tr>
<tr class="separator:a840291bc02cba5474a4cb46a9b9566fe"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
@ -132,7 +135,9 @@ Functions</h2></td></tr>
</tr>
</table>
</div><div class="memdoc">
<p>Check if number is palindromic </p><dl class="params"><dt>Parameters</dt><dd>
<p>Check if number is palindromic. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">n</td><td>number to check </td></tr>
</table>
@ -152,53 +157,10 @@ Functions</h2></td></tr>
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160; <span class="keywordflow">return</span> reversed == n;</div>
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160;}</div>
</div><!-- fragment -->
</div>
</div>
<a id="a840291bc02cba5474a4cb46a9b9566fe"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a840291bc02cba5474a4cb46a9b9566fe">&#9670;&nbsp;</a></span>main()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int main </td>
<td>(</td>
<td class="paramtype">void&#160;</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Main function </p>
<div class="fragment"><div class="line"><a name="l00026"></a><span class="lineno"> 26</span>&#160;{</div>
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span>&#160; <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, j, <a class="code" href="../../d2/df6/kohonen__som__topology_8c.html#affe776513b24d84b39af8ab0930fef7f">max</a> = 0;</div>
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span>&#160; <span class="keywordflow">for</span> (i = 100; i &lt;= 999; i++)</div>
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>&#160; {</div>
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span>&#160; <span class="keywordflow">for</span> (j = 100; j &lt;= 999; j++)</div>
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>&#160; {</div>
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span>&#160; <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> p = i * j;</div>
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>&#160; <span class="keywordflow">if</span> (<a class="code" href="../../d0/d6c/problem__4_2sol_8c.html#adf9bea8d35848959bde5b3f277edf0c4">is_palindromic</a>(p) &amp;&amp; p &gt; <a class="code" href="../../d2/df6/kohonen__som__topology_8c.html#affe776513b24d84b39af8ab0930fef7f">max</a>)</div>
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span>&#160; {</div>
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>&#160; <a class="code" href="../../d2/df6/kohonen__som__topology_8c.html#affe776513b24d84b39af8ab0930fef7f">max</a> = p;</div>
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>&#160; }</div>
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>&#160; }</div>
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span>&#160; }</div>
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span>&#160; printf(<span class="stringliteral">&quot;%u\n&quot;</span>, <a class="code" href="../../d2/df6/kohonen__som__topology_8c.html#affe776513b24d84b39af8ab0930fef7f">max</a>);</div>
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>&#160;}</div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d0/d6c/problem__4_2sol_8c_a840291bc02cba5474a4cb46a9b9566fe_cgraph.svg" width="215" height="38"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
</div>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<div class="ttc" id="aproblem__4_2sol_8c_html_adf9bea8d35848959bde5b3f277edf0c4"><div class="ttname"><a href="../../d0/d6c/problem__4_2sol_8c.html#adf9bea8d35848959bde5b3f277edf0c4">is_palindromic</a></div><div class="ttdeci">int is_palindromic(unsigned int n)</div><div class="ttdef"><b>Definition:</b> sol.c:12</div></div>
<div class="ttc" id="akohonen__som__topology_8c_html_affe776513b24d84b39af8ab0930fef7f"><div class="ttname"><a href="../../d2/df6/kohonen__som__topology_8c.html#affe776513b24d84b39af8ab0930fef7f">max</a></div><div class="ttdeci">#define max(a, b)</div><div class="ttdef"><b>Definition:</b> kohonen_som_topology.c:31</div></div>
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>

View File

@ -1,4 +0,0 @@
<map id="main" name="main">
<area shape="rect" id="node1" title=" " alt="" coords="5,5,56,32"/>
<area shape="rect" id="node2" href="$d0/d6c/problem__4_2sol_8c.html#adf9bea8d35848959bde5b3f277edf0c4" title=" " alt="" coords="104,5,209,32"/>
</map>

View File

@ -1 +0,0 @@
07bb8195160f5fb1d7c64eb399aa64ee

View File

@ -1,37 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.44.0 (20200408.0750)
-->
<!-- Title: main Pages: 1 -->
<svg width="161pt" height="28pt"
viewBox="0.00 0.00 161.00 28.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 24)">
<title>main</title>
<polygon fill="white" stroke="transparent" points="-4,4 -4,-24 157,-24 157,4 -4,4"/>
<!-- Node1 -->
<g id="node1" class="node">
<title>Node1</title>
<g id="a_node1"><a xlink:title=" ">
<polygon fill="#bfbfbf" stroke="black" points="0,-0.5 0,-19.5 38,-19.5 38,-0.5 0,-0.5"/>
<text text-anchor="middle" x="19" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">main</text>
</a>
</g>
</g>
<!-- Node2 -->
<g id="node2" class="node">
<title>Node2</title>
<g id="a_node2"><a xlink:href="../../d0/d6c/problem__4_2sol_8c.html#adf9bea8d35848959bde5b3f277edf0c4" target="_top" xlink:title=" ">
<polygon fill="white" stroke="black" points="74,-0.5 74,-19.5 153,-19.5 153,-0.5 74,-0.5"/>
<text text-anchor="middle" x="113.5" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">is_palindromic</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node2 -->
<g id="edge1" class="edge">
<title>Node1&#45;&gt;Node2</title>
<path fill="none" stroke="midnightblue" d="M38.28,-10C45.7,-10 54.66,-10 63.75,-10"/>
<polygon fill="midnightblue" stroke="midnightblue" points="63.99,-13.5 73.99,-10 63.99,-6.5 63.99,-13.5"/>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -111,127 +111,24 @@ Include dependency graph for sol1.c:</div>
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:acc871ab6bfead702e983a7f9c412915f"><td class="memItemLeft" align="right" valign="top">char&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d6d/problem__10_2sol1_8c.html#acc871ab6bfead702e983a7f9c412915f">is_prime</a> (unsigned long n)</td></tr>
<tr class="memitem:acc871ab6bfead702e983a7f9c412915f"><td class="memItemLeft" align="right" valign="top"><a id="acc871ab6bfead702e983a7f9c412915f"></a>
char&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d6d/problem__10_2sol1_8c.html#acc871ab6bfead702e983a7f9c412915f">is_prime</a> (unsigned long n)</td></tr>
<tr class="memdesc:acc871ab6bfead702e983a7f9c412915f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Function to check if a number is prime. <br /></td></tr>
<tr class="separator:acc871ab6bfead702e983a7f9c412915f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae3d987cb2ad0ddb0c3caa4c2506a20e5"><td class="memItemLeft" align="right" valign="top">unsigned long long&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d6d/problem__10_2sol1_8c.html#ae3d987cb2ad0ddb0c3caa4c2506a20e5">sum_of_primes</a> (unsigned long <a class="el" href="../../db/d01/problem__13_2sol1_8c.html#a0240ac851181b84ac374872dc5434ee4">N</a>)</td></tr>
<tr class="memitem:ae3d987cb2ad0ddb0c3caa4c2506a20e5"><td class="memItemLeft" align="right" valign="top"><a id="ae3d987cb2ad0ddb0c3caa4c2506a20e5"></a>
unsigned long long&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d6d/problem__10_2sol1_8c.html#ae3d987cb2ad0ddb0c3caa4c2506a20e5">sum_of_primes</a> (unsigned long <a class="el" href="../../db/d01/problem__13_2sol1_8c.html#a0240ac851181b84ac374872dc5434ee4">N</a>)</td></tr>
<tr class="memdesc:ae3d987cb2ad0ddb0c3caa4c2506a20e5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Computes sum of prime numbers less than N. <br /></td></tr>
<tr class="separator:ae3d987cb2ad0ddb0c3caa4c2506a20e5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0ddf1224851353fc92bfbff6f499fa97"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d6d/problem__10_2sol1_8c.html#a0ddf1224851353fc92bfbff6f499fa97">main</a> (int argc, char *argv[])</td></tr>
<tr class="memitem:a0ddf1224851353fc92bfbff6f499fa97"><td class="memItemLeft" align="right" valign="top"><a id="a0ddf1224851353fc92bfbff6f499fa97"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d6d/problem__10_2sol1_8c.html#a0ddf1224851353fc92bfbff6f499fa97">main</a> (int argc, char *argv[])</td></tr>
<tr class="memdesc:a0ddf1224851353fc92bfbff6f499fa97"><td class="mdescLeft">&#160;</td><td class="mdescRight">Main function. <br /></td></tr>
<tr class="separator:a0ddf1224851353fc92bfbff6f499fa97"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p><a href="https://projecteuler.net/problem=10">Problem 10</a> solution </p>
<dl class="section author"><dt>Author</dt><dd><a href="https://github.com/kvedala">Krishna Vedala</a> </dd></dl>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="acc871ab6bfead702e983a7f9c412915f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#acc871ab6bfead702e983a7f9c412915f">&#9670;&nbsp;</a></span>is_prime()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">char is_prime </td>
<td>(</td>
<td class="paramtype">unsigned long&#160;</td>
<td class="paramname"><em>n</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Function to check if a number is prime </p>
<div class="fragment"><div class="line"><a name="l00012"></a><span class="lineno"> 12</span>&#160;{</div>
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span>&#160; <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> i = 2; i &lt; sqrtl(n) + 1; i++)</div>
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span>&#160; <span class="keywordflow">if</span> (n % i == 0)</div>
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span>&#160; </div>
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span>&#160; <span class="keywordflow">return</span> 1;</div>
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span>&#160;}</div>
</div><!-- fragment -->
</div>
</div>
<a id="a0ddf1224851353fc92bfbff6f499fa97"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0ddf1224851353fc92bfbff6f499fa97">&#9670;&nbsp;</a></span>main()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int main </td>
<td>(</td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>argc</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char *&#160;</td>
<td class="paramname"><em>argv</em>[]&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Main function </p>
<div class="fragment"><div class="line"><a name="l00034"></a><span class="lineno"> 34</span>&#160;{</div>
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>&#160; <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> n = 100;</div>
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>&#160; </div>
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>&#160; <span class="keywordflow">if</span> (argc == 2) <span class="comment">/* if command line argument is provided */</span></div>
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span>&#160; n = atol(argv[1]); <span class="comment">/* use that as the upper limit */</span></div>
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span>&#160; </div>
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span>&#160; printf(<span class="stringliteral">&quot;%ld: %llu\n&quot;</span>, n, <a class="code" href="../../d0/d6d/problem__10_2sol1_8c.html#ae3d987cb2ad0ddb0c3caa4c2506a20e5">sum_of_primes</a>(n));</div>
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>&#160; </div>
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>&#160;}</div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d0/d6d/problem__10_2sol1_8c_a0ddf1224851353fc92bfbff6f499fa97_cgraph.svg" width="339" height="38"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
</div>
</div>
</div>
<a id="ae3d987cb2ad0ddb0c3caa4c2506a20e5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae3d987cb2ad0ddb0c3caa4c2506a20e5">&#9670;&nbsp;</a></span>sum_of_primes()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">unsigned long long sum_of_primes </td>
<td>(</td>
<td class="paramtype">unsigned long&#160;</td>
<td class="paramname"><em>N</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Computes sum of prime numbers less than N </p>
<div class="fragment"><div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160;{</div>
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span>&#160; <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">long</span> sum = 2;</div>
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span>&#160; </div>
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span>&#160; <span class="keywordflow">for</span> (<span class="keywordtype">long</span> i = 3; i &lt; <a class="code" href="../../db/d01/problem__13_2sol1_8c.html#a0240ac851181b84ac374872dc5434ee4">N</a>; i += 2) <span class="comment">/* skip even numbers */</span></div>
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span>&#160; <span class="keywordflow">if</span> (<a class="code" href="../../d0/d6d/problem__10_2sol1_8c.html#acc871ab6bfead702e983a7f9c412915f">is_prime</a>(i))</div>
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span>&#160; sum += i;</div>
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span>&#160; </div>
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>&#160; <span class="keywordflow">return</span> sum;</div>
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span>&#160;}</div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d0/d6d/problem__10_2sol1_8c_ae3d987cb2ad0ddb0c3caa4c2506a20e5_cgraph.svg" width="240" height="38"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
</div>
</div>
</div>
</div><!-- contents -->
</div></div><!-- contents -->
</div><!-- doc-content -->
<div class="ttc" id="aproblem__10_2sol1_8c_html_acc871ab6bfead702e983a7f9c412915f"><div class="ttname"><a href="../../d0/d6d/problem__10_2sol1_8c.html#acc871ab6bfead702e983a7f9c412915f">is_prime</a></div><div class="ttdeci">char is_prime(unsigned long n)</div><div class="ttdef"><b>Definition:</b> sol1.c:11</div></div>
<div class="ttc" id="aproblem__13_2sol1_8c_html_a0240ac851181b84ac374872dc5434ee4"><div class="ttname"><a href="../../db/d01/problem__13_2sol1_8c.html#a0240ac851181b84ac374872dc5434ee4">N</a></div><div class="ttdeci">#define N</div><div class="ttdef"><b>Definition:</b> sol1.c:109</div></div>
<div class="ttc" id="aproblem__10_2sol1_8c_html_ae3d987cb2ad0ddb0c3caa4c2506a20e5"><div class="ttname"><a href="../../d0/d6d/problem__10_2sol1_8c.html#ae3d987cb2ad0ddb0c3caa4c2506a20e5">sum_of_primes</a></div><div class="ttdeci">unsigned long long sum_of_primes(unsigned long N)</div><div class="ttdef"><b>Definition:</b> sol1.c:21</div></div>
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>

View File

@ -1,5 +0,0 @@
<map id="main" name="main">
<area shape="rect" id="node1" title=" " alt="" coords="5,5,56,32"/>
<area shape="rect" id="node2" href="$d0/d6d/problem__10_2sol1_8c.html#ae3d987cb2ad0ddb0c3caa4c2506a20e5" title=" " alt="" coords="104,5,215,32"/>
<area shape="rect" id="node3" href="$d0/d6d/problem__10_2sol1_8c.html#acc871ab6bfead702e983a7f9c412915f" title=" " alt="" coords="263,5,333,32"/>
</map>

View File

@ -1 +0,0 @@
3783047503d9d2c2c0f5aee38d07ae3e

View File

@ -1,52 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.44.0 (20200408.0750)
-->
<!-- Title: main Pages: 1 -->
<svg width="254pt" height="28pt"
viewBox="0.00 0.00 254.00 28.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 24)">
<title>main</title>
<polygon fill="white" stroke="transparent" points="-4,4 -4,-24 250,-24 250,4 -4,4"/>
<!-- Node1 -->
<g id="node1" class="node">
<title>Node1</title>
<g id="a_node1"><a xlink:title=" ">
<polygon fill="#bfbfbf" stroke="black" points="0,-0.5 0,-19.5 38,-19.5 38,-0.5 0,-0.5"/>
<text text-anchor="middle" x="19" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">main</text>
</a>
</g>
</g>
<!-- Node2 -->
<g id="node2" class="node">
<title>Node2</title>
<g id="a_node2"><a xlink:href="../../d0/d6d/problem__10_2sol1_8c.html#ae3d987cb2ad0ddb0c3caa4c2506a20e5" target="_top" xlink:title=" ">
<polygon fill="white" stroke="black" points="74,-0.5 74,-19.5 157,-19.5 157,-0.5 74,-0.5"/>
<text text-anchor="middle" x="115.5" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">sum_of_primes</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node2 -->
<g id="edge1" class="edge">
<title>Node1&#45;&gt;Node2</title>
<path fill="none" stroke="midnightblue" d="M38.22,-10C45.55,-10 54.39,-10 63.43,-10"/>
<polygon fill="midnightblue" stroke="midnightblue" points="63.63,-13.5 73.63,-10 63.63,-6.5 63.63,-13.5"/>
</g>
<!-- Node3 -->
<g id="node3" class="node">
<title>Node3</title>
<g id="a_node3"><a xlink:href="../../d0/d6d/problem__10_2sol1_8c.html#acc871ab6bfead702e983a7f9c412915f" target="_top" xlink:title=" ">
<polygon fill="white" stroke="black" points="193,-0.5 193,-19.5 246,-19.5 246,-0.5 193,-0.5"/>
<text text-anchor="middle" x="219.5" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">is_prime</text>
</a>
</g>
</g>
<!-- Node2&#45;&gt;Node3 -->
<g id="edge2" class="edge">
<title>Node2&#45;&gt;Node3</title>
<path fill="none" stroke="midnightblue" d="M157.11,-10C165.62,-10 174.54,-10 182.86,-10"/>
<polygon fill="midnightblue" stroke="midnightblue" points="183,-13.5 193,-10 183,-6.5 183,-13.5"/>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -1,4 +0,0 @@
<map id="sum_of_primes" name="sum_of_primes">
<area shape="rect" id="node1" title=" " alt="" coords="5,5,116,32"/>
<area shape="rect" id="node2" href="$d0/d6d/problem__10_2sol1_8c.html#acc871ab6bfead702e983a7f9c412915f" title=" " alt="" coords="164,5,235,32"/>
</map>

View File

@ -1 +0,0 @@
991861bed63d549a266eca05653ceef3

View File

@ -1,37 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.44.0 (20200408.0750)
-->
<!-- Title: sum_of_primes Pages: 1 -->
<svg width="180pt" height="28pt"
viewBox="0.00 0.00 180.00 28.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 24)">
<title>sum_of_primes</title>
<polygon fill="white" stroke="transparent" points="-4,4 -4,-24 176,-24 176,4 -4,4"/>
<!-- Node1 -->
<g id="node1" class="node">
<title>Node1</title>
<g id="a_node1"><a xlink:title=" ">
<polygon fill="#bfbfbf" stroke="black" points="0,-0.5 0,-19.5 83,-19.5 83,-0.5 0,-0.5"/>
<text text-anchor="middle" x="41.5" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">sum_of_primes</text>
</a>
</g>
</g>
<!-- Node2 -->
<g id="node2" class="node">
<title>Node2</title>
<g id="a_node2"><a xlink:href="../../d0/d6d/problem__10_2sol1_8c.html#acc871ab6bfead702e983a7f9c412915f" target="_top" xlink:title=" ">
<polygon fill="white" stroke="black" points="119,-0.5 119,-19.5 172,-19.5 172,-0.5 119,-0.5"/>
<text text-anchor="middle" x="145.5" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">is_prime</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node2 -->
<g id="edge1" class="edge">
<title>Node1&#45;&gt;Node2</title>
<path fill="none" stroke="midnightblue" d="M83.11,-10C91.62,-10 100.54,-10 108.86,-10"/>
<polygon fill="midnightblue" stroke="midnightblue" points="109,-13.5 119,-10 109,-6.5 109,-13.5"/>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -109,53 +109,16 @@ Include dependency graph for so1.c:</div>
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d7f/so1_8c.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main</a> ()</td></tr>
<tr class="memitem:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="memItemLeft" align="right" valign="top"><a id="ae66f6b31b5ad750f1fe042a706a4e3d4"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d7f/so1_8c.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main</a> ()</td></tr>
<tr class="memdesc:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Main function. <br /></td></tr>
<tr class="separator:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p><a href="https://projecteuler.net/problem=2">Problem 2</a> solution </p>
<p>Problem:</p>
<p>Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: <code>1,2,3,5,8,13,21,34,55,89,..</code> By considering the terms in the Fibonacci sequence whose values do not exceed n, find the sum of the even-valued terms. e.g. for n=10, we have {2,8}, sum is 10. </p>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="ae66f6b31b5ad750f1fe042a706a4e3d4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae66f6b31b5ad750f1fe042a706a4e3d4">&#9670;&nbsp;</a></span>main()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int main </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Main function </p>
<div class="fragment"><div class="line"><a name="l00018"></a><span class="lineno"> 18</span>&#160;{</div>
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span>&#160; <span class="keywordtype">int</span> n = 0;</div>
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160; <span class="keywordtype">int</span> sum = 0;</div>
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160; <span class="keywordtype">int</span> i = 1;</div>
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160; <span class="keywordtype">int</span> j = 2;</div>
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span>&#160; <span class="keywordtype">int</span> temp;</div>
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span>&#160; scanf(<span class="stringliteral">&quot;%d&quot;</span>, &amp;n);</div>
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span>&#160; </div>
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span>&#160; <span class="keywordflow">while</span> (j &lt;= n)</div>
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span>&#160; {</div>
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span>&#160; <span class="keywordflow">if</span> ((j &amp; 1) == 0) <span class="comment">// can also use(j%2 == 0)</span></div>
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>&#160; sum += j;</div>
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span>&#160; temp = i;</div>
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>&#160; i = j;</div>
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span>&#160; j = temp + i;</div>
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>&#160; }</div>
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span>&#160; </div>
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>&#160; printf(<span class="stringliteral">&quot;%d\n&quot;</span>, sum);</div>
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>&#160;}</div>
</div><!-- fragment -->
</div>
</div>
</div><!-- contents -->
</div></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->

View File

@ -96,82 +96,32 @@ $(document).ready(function(){initNavTree('d0/dc8/structarray__3d.html','../../')
<div class="title">array_3d Struct Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>to store info regarding 3D arrays
<a href="../../d0/dc8/structarray__3d.html#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-attribs"></a>
Data Fields</h2></td></tr>
<tr class="memitem:ad5d3ee546eea3c05dc8f0dc90ec194f4"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/dc8/structarray__3d.html#ad5d3ee546eea3c05dc8f0dc90ec194f4">dim1</a></td></tr>
<tr class="memitem:ad5d3ee546eea3c05dc8f0dc90ec194f4"><td class="memItemLeft" align="right" valign="top"><a id="ad5d3ee546eea3c05dc8f0dc90ec194f4"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/dc8/structarray__3d.html#ad5d3ee546eea3c05dc8f0dc90ec194f4">dim1</a></td></tr>
<tr class="memdesc:ad5d3ee546eea3c05dc8f0dc90ec194f4"><td class="mdescLeft">&#160;</td><td class="mdescRight">lengths of first dimension <br /></td></tr>
<tr class="separator:ad5d3ee546eea3c05dc8f0dc90ec194f4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa431cc0a41fd379270dbd2b0e3ac1b45"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/dc8/structarray__3d.html#aa431cc0a41fd379270dbd2b0e3ac1b45">dim2</a></td></tr>
<tr class="memitem:aa431cc0a41fd379270dbd2b0e3ac1b45"><td class="memItemLeft" align="right" valign="top"><a id="aa431cc0a41fd379270dbd2b0e3ac1b45"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/dc8/structarray__3d.html#aa431cc0a41fd379270dbd2b0e3ac1b45">dim2</a></td></tr>
<tr class="memdesc:aa431cc0a41fd379270dbd2b0e3ac1b45"><td class="mdescLeft">&#160;</td><td class="mdescRight">lengths of second dimension <br /></td></tr>
<tr class="separator:aa431cc0a41fd379270dbd2b0e3ac1b45"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad823bd5424a0fc158da52a0497d8c10a"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/dc8/structarray__3d.html#ad823bd5424a0fc158da52a0497d8c10a">dim3</a></td></tr>
<tr class="memitem:ad823bd5424a0fc158da52a0497d8c10a"><td class="memItemLeft" align="right" valign="top"><a id="ad823bd5424a0fc158da52a0497d8c10a"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/dc8/structarray__3d.html#ad823bd5424a0fc158da52a0497d8c10a">dim3</a></td></tr>
<tr class="memdesc:ad823bd5424a0fc158da52a0497d8c10a"><td class="mdescLeft">&#160;</td><td class="mdescRight">lengths of thirddimension <br /></td></tr>
<tr class="separator:ad823bd5424a0fc158da52a0497d8c10a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac8967b2c72769f839c09fb4cebb4339f"><td class="memItemLeft" align="right" valign="top">double *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/dc8/structarray__3d.html#ac8967b2c72769f839c09fb4cebb4339f">data</a></td></tr>
<tr class="memitem:ac8967b2c72769f839c09fb4cebb4339f"><td class="memItemLeft" align="right" valign="top"><a id="ac8967b2c72769f839c09fb4cebb4339f"></a>
double *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/dc8/structarray__3d.html#ac8967b2c72769f839c09fb4cebb4339f">data</a></td></tr>
<tr class="memdesc:ac8967b2c72769f839c09fb4cebb4339f"><td class="mdescLeft">&#160;</td><td class="mdescRight">pointer to data <br /></td></tr>
<tr class="separator:ac8967b2c72769f839c09fb4cebb4339f"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>to store info regarding 3D arrays </p>
</div><h2 class="groupheader">Field Documentation</h2>
<a id="ac8967b2c72769f839c09fb4cebb4339f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac8967b2c72769f839c09fb4cebb4339f">&#9670;&nbsp;</a></span>data</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">double* array_3d::data</td>
</tr>
</table>
</div><div class="memdoc">
<p>pointer to data </p>
</div>
</div>
<a id="ad5d3ee546eea3c05dc8f0dc90ec194f4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad5d3ee546eea3c05dc8f0dc90ec194f4">&#9670;&nbsp;</a></span>dim1</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int array_3d::dim1</td>
</tr>
</table>
</div><div class="memdoc">
<p>lengths of first dimension </p>
</div>
</div>
<a id="aa431cc0a41fd379270dbd2b0e3ac1b45"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa431cc0a41fd379270dbd2b0e3ac1b45">&#9670;&nbsp;</a></span>dim2</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int array_3d::dim2</td>
</tr>
</table>
</div><div class="memdoc">
<p>lengths of second dimension </p>
</div>
</div>
<a id="ad823bd5424a0fc158da52a0497d8c10a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad823bd5424a0fc158da52a0497d8c10a">&#9670;&nbsp;</a></span>dim3</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int array_3d::dim3</td>
</tr>
</table>
</div><div class="memdoc">
<p>lengths of thirddimension </p>
</div>
</div>
<hr/>The documentation for this struct was generated from the following file:<ul>
</div><hr/>The documentation for this struct was generated from the following file:<ul>
<li>machine_learning/<a class="el" href="../../d2/df6/kohonen__som__topology_8c.html">kohonen_som_topology.c</a></li>
</ul>
</div><!-- contents -->

View File

@ -110,60 +110,14 @@ Include dependency graph for sol.c:</div>
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a840291bc02cba5474a4cb46a9b9566fe"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d2f/problem__7_2sol_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main</a> (void)</td></tr>
<tr class="memitem:a840291bc02cba5474a4cb46a9b9566fe"><td class="memItemLeft" align="right" valign="top"><a id="a840291bc02cba5474a4cb46a9b9566fe"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d2f/problem__7_2sol_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main</a> (void)</td></tr>
<tr class="memdesc:a840291bc02cba5474a4cb46a9b9566fe"><td class="mdescLeft">&#160;</td><td class="mdescRight">Main function. <br /></td></tr>
<tr class="separator:a840291bc02cba5474a4cb46a9b9566fe"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p><a href="https://projecteuler.net/problem=7">Problem 7</a> solution </p>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="a840291bc02cba5474a4cb46a9b9566fe"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a840291bc02cba5474a4cb46a9b9566fe">&#9670;&nbsp;</a></span>main()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int main </td>
<td>(</td>
<td class="paramtype">void&#160;</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Main function </p>
<div class="fragment"><div class="line"><a name="l00010"></a><span class="lineno"> 10</span>&#160;{</div>
<div class="line"><a name="l00011"></a><span class="lineno"> 11</span>&#160; <span class="keywordtype">char</span> *sieve;</div>
<div class="line"><a name="l00012"></a><span class="lineno"> 12</span>&#160; <span class="keywordtype">size_t</span> i;</div>
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span>&#160; <span class="keywordtype">unsigned</span> count = 0;</div>
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span>&#160; <span class="keywordtype">size_t</span> n = 1000000;</div>
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span>&#160; <span class="keyword">const</span> <span class="keywordtype">unsigned</span> target = 10001;</div>
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span>&#160; </div>
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span>&#160; sieve = (<span class="keywordtype">char</span> *)calloc(n, <span class="keyword">sizeof</span>(<span class="keywordtype">char</span>));</div>
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span>&#160; <span class="keywordflow">for</span> (i = 2; i &lt; n; i++)</div>
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span>&#160; {</div>
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160; <span class="keywordflow">if</span> (!sieve[i])</div>
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160; {</div>
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160; <span class="keywordtype">size_t</span> j;</div>
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span>&#160; count++;</div>
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span>&#160; <span class="keywordflow">if</span> (count == target)</div>
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span>&#160; {</div>
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span>&#160; printf(<span class="stringliteral">&quot;%lu\n&quot;</span>, i);</div>
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span>&#160; <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span>&#160; }</div>
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>&#160; <span class="keywordflow">for</span> (j = i * 2; j &lt; n; j += i)</div>
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span>&#160; {</div>
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>&#160; sieve[j] = 1;</div>
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span>&#160; }</div>
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>&#160; }</div>
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span>&#160; }</div>
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>&#160; free(sieve);</div>
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>&#160;}</div>
</div><!-- fragment -->
</div>
</div>
</div><!-- contents -->
</div></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->

View File

@ -113,16 +113,18 @@ Include dependency graph for ode_midpoint_euler.c:</div>
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:a9ceb646336224ee890a269d0b4600d09"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/dc2/ode__midpoint__euler_8c.html#a9ceb646336224ee890a269d0b4600d09">order</a>&#160;&#160;&#160;2</td></tr>
<tr class="memitem:a9ceb646336224ee890a269d0b4600d09"><td class="memItemLeft" align="right" valign="top"><a id="a9ceb646336224ee890a269d0b4600d09"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/dc2/ode__midpoint__euler_8c.html#a9ceb646336224ee890a269d0b4600d09">order</a>&#160;&#160;&#160;2</td></tr>
<tr class="memdesc:a9ceb646336224ee890a269d0b4600d09"><td class="mdescLeft">&#160;</td><td class="mdescRight">number of dependent variables in <a class="el" href="../../d1/dc2/ode__midpoint__euler_8c.html#a97075291390a68c262ed66e157a57eb4" title="Problem statement for a system with first-order differential equations.">problem</a> <br /></td></tr>
<tr class="separator:a9ceb646336224ee890a269d0b4600d09"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a97075291390a68c262ed66e157a57eb4"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/dc2/ode__midpoint__euler_8c.html#a97075291390a68c262ed66e157a57eb4">problem</a> (const double *x, double *y, double *dy)</td></tr>
<tr class="memdesc:a97075291390a68c262ed66e157a57eb4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Problem statement for a system with first-order differential equations. Updates the system differential variables. <a href="../../d1/dc2/ode__midpoint__euler_8c.html#a97075291390a68c262ed66e157a57eb4">More...</a><br /></td></tr>
<tr class="memdesc:a97075291390a68c262ed66e157a57eb4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Problem statement for a system with first-order differential equations. <a href="../../d1/dc2/ode__midpoint__euler_8c.html#a97075291390a68c262ed66e157a57eb4">More...</a><br /></td></tr>
<tr class="separator:a97075291390a68c262ed66e157a57eb4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8caee977b26888d34040b122e0e28e3a"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/dc2/ode__midpoint__euler_8c.html#a8caee977b26888d34040b122e0e28e3a">exact_solution</a> (const double *x, double *y)</td></tr>
<tr class="memdesc:a8caee977b26888d34040b122e0e28e3a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Exact solution of the problem. Used for solution comparison. <a href="../../d1/dc2/ode__midpoint__euler_8c.html#a8caee977b26888d34040b122e0e28e3a">More...</a><br /></td></tr>
<tr class="memdesc:a8caee977b26888d34040b122e0e28e3a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Exact solution of the problem. <a href="../../d1/dc2/ode__midpoint__euler_8c.html#a8caee977b26888d34040b122e0e28e3a">More...</a><br /></td></tr>
<tr class="separator:a8caee977b26888d34040b122e0e28e3a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:affe6cc2ab040b94a29e6c41782f72d51"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/dc2/ode__midpoint__euler_8c.html#affe6cc2ab040b94a29e6c41782f72d51">midpoint_euler_step</a> (double dx, double *x, double *y, double *dy)</td></tr>
<tr class="memdesc:affe6cc2ab040b94a29e6c41782f72d51"><td class="mdescLeft">&#160;</td><td class="mdescRight">Compute next step approximation using the midpoint-Euler method. <a href="../../d1/dc2/ode__midpoint__euler_8c.html#affe6cc2ab040b94a29e6c41782f72d51">More...</a><br /></td></tr>
@ -130,7 +132,9 @@ Functions</h2></td></tr>
<tr class="memitem:a148003d8b261d040c1c41e73b40af1dd"><td class="memItemLeft" align="right" valign="top">double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/dc2/ode__midpoint__euler_8c.html#a148003d8b261d040c1c41e73b40af1dd">midpoint_euler</a> (double dx, double x0, double x_max, double *y, char save_to_file)</td></tr>
<tr class="memdesc:a148003d8b261d040c1c41e73b40af1dd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Compute approximation using the midpoint-Euler method in the given limits. <a href="../../d1/dc2/ode__midpoint__euler_8c.html#a148003d8b261d040c1c41e73b40af1dd">More...</a><br /></td></tr>
<tr class="separator:a148003d8b261d040c1c41e73b40af1dd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0ddf1224851353fc92bfbff6f499fa97"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/dc2/ode__midpoint__euler_8c.html#a0ddf1224851353fc92bfbff6f499fa97">main</a> (int argc, char *argv[])</td></tr>
<tr class="memitem:a0ddf1224851353fc92bfbff6f499fa97"><td class="memItemLeft" align="right" valign="top"><a id="a0ddf1224851353fc92bfbff6f499fa97"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/dc2/ode__midpoint__euler_8c.html#a0ddf1224851353fc92bfbff6f499fa97">main</a> (int argc, char *argv[])</td></tr>
<tr class="memdesc:a0ddf1224851353fc92bfbff6f499fa97"><td class="mdescLeft">&#160;</td><td class="mdescRight">Main Function. <br /></td></tr>
<tr class="separator:a0ddf1224851353fc92bfbff6f499fa97"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
@ -143,27 +147,11 @@ Functions</h2></td></tr>
\begin{eqnarray*} u(x) &amp;=&amp; \cos(x)\\ v(x) &amp;=&amp; -\sin(x)\\ \end{eqnarray*}
</p>
<p> The computation results are stored to a text file <code>midpoint_euler.csv</code> and the exact soltuion results in <code>exact.csv</code> for comparison. <img src="https://raw.githubusercontent.com/TheAlgorithms/C/docs/images/numerical_methods/ode_midpoint_euler.svg" alt="Implementation solution" style="pointer-events: none;" class="inline"/></p>
<p>To implement <a href="https://en.wikipedia.org/wiki/Van_der_Pol_oscillator">Van der Pol oscillator</a>, change the <a class="el" href="../../d1/dc2/ode__midpoint__euler_8c.html#a97075291390a68c262ed66e157a57eb4" title="Problem statement for a system with first-order differential equations. Updates the system differenti...">problem</a> function to: </p><div class="fragment"><div class="line"><span class="keyword">const</span> <span class="keywordtype">double</span> mu = 2.0;</div>
<p>To implement <a href="https://en.wikipedia.org/wiki/Van_der_Pol_oscillator">Van der Pol oscillator</a>, change the <a class="el" href="../../d1/dc2/ode__midpoint__euler_8c.html#a97075291390a68c262ed66e157a57eb4" title="Problem statement for a system with first-order differential equations.">problem</a> function to: </p><div class="fragment"><div class="line"><span class="keyword">const</span> <span class="keywordtype">double</span> mu = 2.0;</div>
<div class="line">dy[0] = y[1];</div>
<div class="line">dy[1] = mu * (1.f - y[0] * y[0]) * y[1] - y[0];</div>
</div><!-- fragment --><dl class="section see"><dt>See also</dt><dd><a class="el" href="../../d4/d07/ode__forward__euler_8c.html" title="Solve a multivariable first order ordinary differential equation (ODEs) using forward Euler method">ode_forward_euler.c</a>, <a class="el" href="../../d4/d99/ode__semi__implicit__euler_8c.html" title="Solve a multivariable first order ordinary differential equation (ODEs) using semi implicit Euler met...">ode_semi_implicit_euler.c</a> </dd></dl>
</div><h2 class="groupheader">Macro Definition Documentation</h2>
<a id="a9ceb646336224ee890a269d0b4600d09"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9ceb646336224ee890a269d0b4600d09">&#9670;&nbsp;</a></span>order</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define order&#160;&#160;&#160;2</td>
</tr>
</table>
</div><div class="memdoc">
<p>number of dependent variables in <a class="el" href="../../d1/dc2/ode__midpoint__euler_8c.html#a97075291390a68c262ed66e157a57eb4" title="Problem statement for a system with first-order differential equations. Updates the system differenti...">problem</a> </p>
</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="a8caee977b26888d34040b122e0e28e3a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8caee977b26888d34040b122e0e28e3a">&#9670;&nbsp;</a></span>exact_solution()</h2>
@ -190,7 +178,8 @@ Functions</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Exact solution of the problem. Used for solution comparison. </p>
<p>Exact solution of the problem. </p>
<p>Used for solution comparison.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">x</td><td>independent variable </td></tr>
@ -203,86 +192,6 @@ Functions</h2></td></tr>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>&#160; y[1] = -sin(x[0]);</div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>&#160;}</div>
</div><!-- fragment -->
</div>
</div>
<a id="a0ddf1224851353fc92bfbff6f499fa97"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0ddf1224851353fc92bfbff6f499fa97">&#9670;&nbsp;</a></span>main()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int main </td>
<td>(</td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>argc</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char *&#160;</td>
<td class="paramname"><em>argv</em>[]&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Main Function </p>
<div class="fragment"><div class="line"><a name="l00145"></a><span class="lineno"> 145</span>&#160;{</div>
<div class="line"><a name="l00146"></a><span class="lineno"> 146</span>&#160; <span class="keywordtype">double</span> X0 = 0.f; <span class="comment">/* initial value of x0 */</span></div>
<div class="line"><a name="l00147"></a><span class="lineno"> 147</span>&#160; <span class="keywordtype">double</span> X_MAX = 10.F; <span class="comment">/* upper limit of integration */</span></div>
<div class="line"><a name="l00148"></a><span class="lineno"> 148</span>&#160; <span class="keywordtype">double</span> Y0[] = {1.f, 0.f}; <span class="comment">/* initial value Y = y(x = x_0) */</span></div>
<div class="line"><a name="l00149"></a><span class="lineno"> 149</span>&#160; <span class="keywordtype">double</span> step_size;</div>
<div class="line"><a name="l00150"></a><span class="lineno"> 150</span>&#160; </div>
<div class="line"><a name="l00151"></a><span class="lineno"> 151</span>&#160; <span class="keywordflow">if</span> (argc == 1)</div>
<div class="line"><a name="l00152"></a><span class="lineno"> 152</span>&#160; {</div>
<div class="line"><a name="l00153"></a><span class="lineno"> 153</span>&#160; printf(<span class="stringliteral">&quot;\nEnter the step size: &quot;</span>);</div>
<div class="line"><a name="l00154"></a><span class="lineno"> 154</span>&#160; scanf(<span class="stringliteral">&quot;%lg&quot;</span>, &amp;step_size);</div>
<div class="line"><a name="l00155"></a><span class="lineno"> 155</span>&#160; }</div>
<div class="line"><a name="l00156"></a><span class="lineno"> 156</span>&#160; <span class="keywordflow">else</span></div>
<div class="line"><a name="l00157"></a><span class="lineno"> 157</span>&#160; <span class="comment">// use commandline argument as independent variable step size</span></div>
<div class="line"><a name="l00158"></a><span class="lineno"> 158</span>&#160; step_size = atof(argv[1]);</div>
<div class="line"><a name="l00159"></a><span class="lineno"> 159</span>&#160; </div>
<div class="line"><a name="l00160"></a><span class="lineno"> 160</span>&#160; <span class="comment">// get approximate solution</span></div>
<div class="line"><a name="l00161"></a><span class="lineno"> 161</span>&#160; <span class="keywordtype">double</span> total_time = <a class="code" href="../../d1/dc2/ode__midpoint__euler_8c.html#a148003d8b261d040c1c41e73b40af1dd">midpoint_euler</a>(step_size, X0, X_MAX, Y0, 1);</div>
<div class="line"><a name="l00162"></a><span class="lineno"> 162</span>&#160; printf(<span class="stringliteral">&quot;\tTime = %.6g ms\n&quot;</span>, total_time);</div>
<div class="line"><a name="l00163"></a><span class="lineno"> 163</span>&#160; </div>
<div class="line"><a name="l00164"></a><span class="lineno"> 164</span>&#160; <span class="comment">/* compute exact solution for comparion */</span></div>
<div class="line"><a name="l00165"></a><span class="lineno"> 165</span>&#160; FILE *fp = fopen(<span class="stringliteral">&quot;exact.csv&quot;</span>, <span class="stringliteral">&quot;w+&quot;</span>);</div>
<div class="line"><a name="l00166"></a><span class="lineno"> 166</span>&#160; <span class="keywordflow">if</span> (fp == NULL)</div>
<div class="line"><a name="l00167"></a><span class="lineno"> 167</span>&#160; {</div>
<div class="line"><a name="l00168"></a><span class="lineno"> 168</span>&#160; perror(<span class="stringliteral">&quot;Error! &quot;</span>);</div>
<div class="line"><a name="l00169"></a><span class="lineno"> 169</span>&#160; <span class="keywordflow">return</span> -1;</div>
<div class="line"><a name="l00170"></a><span class="lineno"> 170</span>&#160; }</div>
<div class="line"><a name="l00171"></a><span class="lineno"> 171</span>&#160; <span class="keywordtype">double</span> x = X0;</div>
<div class="line"><a name="l00172"></a><span class="lineno"> 172</span>&#160; <span class="keywordtype">double</span> *y = &amp;(Y0[0]);</div>
<div class="line"><a name="l00173"></a><span class="lineno"> 173</span>&#160; printf(<span class="stringliteral">&quot;Finding exact solution\n&quot;</span>);</div>
<div class="line"><a name="l00174"></a><span class="lineno"> 174</span>&#160; clock_t t1 = clock();</div>
<div class="line"><a name="l00175"></a><span class="lineno"> 175</span>&#160; </div>
<div class="line"><a name="l00176"></a><span class="lineno"> 176</span>&#160; <span class="keywordflow">do</span></div>
<div class="line"><a name="l00177"></a><span class="lineno"> 177</span>&#160; {</div>
<div class="line"><a name="l00178"></a><span class="lineno"> 178</span>&#160; fprintf(fp, <span class="stringliteral">&quot;%.4g,%.4g,%.4g\n&quot;</span>, x, y[0], y[1]); <span class="comment">// write to file</span></div>
<div class="line"><a name="l00179"></a><span class="lineno"> 179</span>&#160; <a class="code" href="../../d1/dc2/ode__midpoint__euler_8c.html#a8caee977b26888d34040b122e0e28e3a">exact_solution</a>(&amp;x, y);</div>
<div class="line"><a name="l00180"></a><span class="lineno"> 180</span>&#160; x += step_size;</div>
<div class="line"><a name="l00181"></a><span class="lineno"> 181</span>&#160; } <span class="keywordflow">while</span> (x &lt;= X_MAX);</div>
<div class="line"><a name="l00182"></a><span class="lineno"> 182</span>&#160; </div>
<div class="line"><a name="l00183"></a><span class="lineno"> 183</span>&#160; clock_t t2 = clock();</div>
<div class="line"><a name="l00184"></a><span class="lineno"> 184</span>&#160; total_time = (t2 - t1) / CLOCKS_PER_SEC;</div>
<div class="line"><a name="l00185"></a><span class="lineno"> 185</span>&#160; printf(<span class="stringliteral">&quot;\tTime = %.6g ms\n&quot;</span>, total_time);</div>
<div class="line"><a name="l00186"></a><span class="lineno"> 186</span>&#160; fclose(fp);</div>
<div class="line"><a name="l00187"></a><span class="lineno"> 187</span>&#160; </div>
<div class="line"><a name="l00188"></a><span class="lineno"> 188</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00189"></a><span class="lineno"> 189</span>&#160;}</div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d1/dc2/ode__midpoint__euler_8c_a0ddf1224851353fc92bfbff6f499fa97_cgraph.svg" width="519" height="88"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
</div>
</div>
</div>
<a id="a148003d8b261d040c1c41e73b40af1dd"></a>
@ -485,8 +394,8 @@ Here is the call graph for this function:</div>
</table>
</div><div class="memdoc">
<p>Problem statement for a system with first-order differential equations. Updates the system differential variables. </p>
<dl class="section note"><dt>Note</dt><dd>This function can be updated to and ode of any order.</dd></dl>
<p>Problem statement for a system with first-order differential equations. </p>
<p>Updates the system differential variables. </p><dl class="section note"><dt>Note</dt><dd>This function can be updated to and ode of any order.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">x</td><td>independent variable(s) </td></tr>
@ -505,11 +414,9 @@ Here is the call graph for this function:</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<div class="ttc" id="aode__midpoint__euler_8c_html_a8caee977b26888d34040b122e0e28e3a"><div class="ttname"><a href="../../d1/dc2/ode__midpoint__euler_8c.html#a8caee977b26888d34040b122e0e28e3a">exact_solution</a></div><div class="ttdeci">void exact_solution(const double *x, double *y)</div><div class="ttdoc">Exact solution of the problem. Used for solution comparison.</div><div class="ttdef"><b>Definition:</b> ode_midpoint_euler.c:67</div></div>
<div class="ttc" id="aode__midpoint__euler_8c_html_affe6cc2ab040b94a29e6c41782f72d51"><div class="ttname"><a href="../../d1/dc2/ode__midpoint__euler_8c.html#affe6cc2ab040b94a29e6c41782f72d51">midpoint_euler_step</a></div><div class="ttdeci">void midpoint_euler_step(double dx, double *x, double *y, double *dy)</div><div class="ttdoc">Compute next step approximation using the midpoint-Euler method.</div><div class="ttdef"><b>Definition:</b> ode_midpoint_euler.c:83</div></div>
<div class="ttc" id="aode__midpoint__euler_8c_html_a9ceb646336224ee890a269d0b4600d09"><div class="ttname"><a href="../../d1/dc2/ode__midpoint__euler_8c.html#a9ceb646336224ee890a269d0b4600d09">order</a></div><div class="ttdeci">#define order</div><div class="ttdef"><b>Definition:</b> ode_midpoint_euler.c:43</div></div>
<div class="ttc" id="aode__midpoint__euler_8c_html_a148003d8b261d040c1c41e73b40af1dd"><div class="ttname"><a href="../../d1/dc2/ode__midpoint__euler_8c.html#a148003d8b261d040c1c41e73b40af1dd">midpoint_euler</a></div><div class="ttdeci">double midpoint_euler(double dx, double x0, double x_max, double *y, char save_to_file)</div><div class="ttdoc">Compute approximation using the midpoint-Euler method in the given limits.</div><div class="ttdef"><b>Definition:</b> ode_midpoint_euler.c:106</div></div>
<div class="ttc" id="aode__midpoint__euler_8c_html_a97075291390a68c262ed66e157a57eb4"><div class="ttname"><a href="../../d1/dc2/ode__midpoint__euler_8c.html#a97075291390a68c262ed66e157a57eb4">problem</a></div><div class="ttdeci">void problem(const double *x, double *y, double *dy)</div><div class="ttdoc">Problem statement for a system with first-order differential equations. Updates the system differenti...</div><div class="ttdef"><b>Definition:</b> ode_midpoint_euler.c:54</div></div>
<div class="ttc" id="aode__midpoint__euler_8c_html_a9ceb646336224ee890a269d0b4600d09"><div class="ttname"><a href="../../d1/dc2/ode__midpoint__euler_8c.html#a9ceb646336224ee890a269d0b4600d09">order</a></div><div class="ttdeci">#define order</div><div class="ttdoc">number of dependent variables in problem</div><div class="ttdef"><b>Definition:</b> ode_midpoint_euler.c:43</div></div>
<div class="ttc" id="aode__midpoint__euler_8c_html_a97075291390a68c262ed66e157a57eb4"><div class="ttname"><a href="../../d1/dc2/ode__midpoint__euler_8c.html#a97075291390a68c262ed66e157a57eb4">problem</a></div><div class="ttdeci">void problem(const double *x, double *y, double *dy)</div><div class="ttdoc">Problem statement for a system with first-order differential equations.</div><div class="ttdef"><b>Definition:</b> ode_midpoint_euler.c:54</div></div>
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>

View File

@ -1,7 +0,0 @@
<map id="main" name="main">
<area shape="rect" id="node1" title=" " alt="" coords="5,31,56,57"/>
<area shape="rect" id="node2" href="$d1/dc2/ode__midpoint__euler_8c.html#a8caee977b26888d34040b122e0e28e3a" title="Exact solution of the problem. Used for solution comparison." alt="" coords="104,5,211,32"/>
<area shape="rect" id="node3" href="$d1/dc2/ode__midpoint__euler_8c.html#a148003d8b261d040c1c41e73b40af1dd" title="Compute approximation using the midpoint&#45;Euler method in the given limits." alt="" coords="104,56,211,83"/>
<area shape="rect" id="node4" href="$d1/dc2/ode__midpoint__euler_8c.html#affe6cc2ab040b94a29e6c41782f72d51" title="Compute next step approximation using the midpoint&#45;Euler method." alt="" coords="259,56,397,83"/>
<area shape="rect" id="node5" href="$d1/dc2/ode__midpoint__euler_8c.html#a97075291390a68c262ed66e157a57eb4" title="Problem statement for a system with first&#45;order differential equations. Updates the system differenti..." alt="" coords="445,56,513,83"/>
</map>

View File

@ -1 +0,0 @@
7fb58c5b19ccdef17c146c91f9dc8a9f

View File

@ -1,82 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.44.0 (20200408.0750)
-->
<!-- Title: main Pages: 1 -->
<svg width="389pt" height="66pt"
viewBox="0.00 0.00 389.00 66.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 62)">
<title>main</title>
<polygon fill="white" stroke="transparent" points="-4,4 -4,-62 385,-62 385,4 -4,4"/>
<!-- Node1 -->
<g id="node1" class="node">
<title>Node1</title>
<g id="a_node1"><a xlink:title=" ">
<polygon fill="#bfbfbf" stroke="black" points="0,-19.5 0,-38.5 38,-38.5 38,-19.5 0,-19.5"/>
<text text-anchor="middle" x="19" y="-26.5" font-family="Helvetica,sans-Serif" font-size="10.00">main</text>
</a>
</g>
</g>
<!-- Node2 -->
<g id="node2" class="node">
<title>Node2</title>
<g id="a_node2"><a xlink:href="../../d1/dc2/ode__midpoint__euler_8c.html#a8caee977b26888d34040b122e0e28e3a" target="_top" xlink:title="Exact solution of the problem. Used for solution comparison.">
<polygon fill="white" stroke="black" points="74,-38.5 74,-57.5 154,-57.5 154,-38.5 74,-38.5"/>
<text text-anchor="middle" x="114" y="-45.5" font-family="Helvetica,sans-Serif" font-size="10.00">exact_solution</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node2 -->
<g id="edge1" class="edge">
<title>Node1&#45;&gt;Node2</title>
<path fill="none" stroke="midnightblue" d="M38.37,-32.75C45.84,-34.28 54.85,-36.12 63.99,-37.99"/>
<polygon fill="midnightblue" stroke="midnightblue" points="63.4,-41.44 73.9,-40.01 64.8,-34.58 63.4,-41.44"/>
</g>
<!-- Node3 -->
<g id="node3" class="node">
<title>Node3</title>
<g id="a_node3"><a xlink:href="../../d1/dc2/ode__midpoint__euler_8c.html#a148003d8b261d040c1c41e73b40af1dd" target="_top" xlink:title="Compute approximation using the midpoint&#45;Euler method in the given limits.">
<polygon fill="white" stroke="black" points="74,-0.5 74,-19.5 154,-19.5 154,-0.5 74,-0.5"/>
<text text-anchor="middle" x="114" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">midpoint_euler</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node3 -->
<g id="edge2" class="edge">
<title>Node1&#45;&gt;Node3</title>
<path fill="none" stroke="midnightblue" d="M38.37,-25.25C45.84,-23.72 54.85,-21.88 63.99,-20.01"/>
<polygon fill="midnightblue" stroke="midnightblue" points="64.8,-23.42 73.9,-17.99 63.4,-16.56 64.8,-23.42"/>
</g>
<!-- Node4 -->
<g id="node4" class="node">
<title>Node4</title>
<g id="a_node4"><a xlink:href="../../d1/dc2/ode__midpoint__euler_8c.html#affe6cc2ab040b94a29e6c41782f72d51" target="_top" xlink:title="Compute next step approximation using the midpoint&#45;Euler method.">
<polygon fill="white" stroke="black" points="190,-0.5 190,-19.5 294,-19.5 294,-0.5 190,-0.5"/>
<text text-anchor="middle" x="242" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">midpoint_euler_step</text>
</a>
</g>
</g>
<!-- Node3&#45;&gt;Node4 -->
<g id="edge3" class="edge">
<title>Node3&#45;&gt;Node4</title>
<path fill="none" stroke="midnightblue" d="M154.18,-10C162.28,-10 170.99,-10 179.67,-10"/>
<polygon fill="midnightblue" stroke="midnightblue" points="179.79,-13.5 189.79,-10 179.79,-6.5 179.79,-13.5"/>
</g>
<!-- Node5 -->
<g id="node5" class="node">
<title>Node5</title>
<g id="a_node5"><a xlink:href="../../d1/dc2/ode__midpoint__euler_8c.html#a97075291390a68c262ed66e157a57eb4" target="_top" xlink:title="Problem statement for a system with first&#45;order differential equations. Updates the system differenti...">
<polygon fill="white" stroke="black" points="330,-0.5 330,-19.5 381,-19.5 381,-0.5 330,-0.5"/>
<text text-anchor="middle" x="355.5" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">problem</text>
</a>
</g>
</g>
<!-- Node4&#45;&gt;Node5 -->
<g id="edge4" class="edge">
<title>Node4&#45;&gt;Node5</title>
<path fill="none" stroke="midnightblue" d="M294.18,-10C302.78,-10 311.52,-10 319.59,-10"/>
<polygon fill="midnightblue" stroke="midnightblue" points="319.73,-13.5 329.73,-10 319.73,-6.5 319.73,-13.5"/>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 4.1 KiB

View File

@ -1,5 +1,5 @@
<map id="midpoint_euler" name="midpoint_euler">
<area shape="rect" id="node1" title="Compute approximation using the midpoint&#45;Euler method in the given limits." alt="" coords="5,5,112,32"/>
<area shape="rect" id="node2" href="$d1/dc2/ode__midpoint__euler_8c.html#affe6cc2ab040b94a29e6c41782f72d51" title="Compute next step approximation using the midpoint&#45;Euler method." alt="" coords="160,5,299,32"/>
<area shape="rect" id="node3" href="$d1/dc2/ode__midpoint__euler_8c.html#a97075291390a68c262ed66e157a57eb4" title="Problem statement for a system with first&#45;order differential equations. Updates the system differenti..." alt="" coords="347,5,415,32"/>
<area shape="rect" id="node3" href="$d1/dc2/ode__midpoint__euler_8c.html#a97075291390a68c262ed66e157a57eb4" title="Problem statement for a system with first&#45;order differential equations." alt="" coords="347,5,415,32"/>
</map>

View File

@ -1 +1 @@
207821d0acb3c9a49f854fcc27611d32
b6931e654c43fe195ff7067e8c0fabab

View File

@ -36,7 +36,7 @@
<!-- Node3 -->
<g id="node3" class="node">
<title>Node3</title>
<g id="a_node3"><a xlink:href="../../d1/dc2/ode__midpoint__euler_8c.html#a97075291390a68c262ed66e157a57eb4" target="_top" xlink:title="Problem statement for a system with first&#45;order differential equations. Updates the system differenti...">
<g id="a_node3"><a xlink:href="../../d1/dc2/ode__midpoint__euler_8c.html#a97075291390a68c262ed66e157a57eb4" target="_top" xlink:title="Problem statement for a system with first&#45;order differential equations.">
<polygon fill="white" stroke="black" points="256,-0.5 256,-19.5 307,-19.5 307,-0.5 256,-0.5"/>
<text text-anchor="middle" x="281.5" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">problem</text>
</a>

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -1,4 +1,4 @@
<map id="midpoint_euler_step" name="midpoint_euler_step">
<area shape="rect" id="node1" title="Compute next step approximation using the midpoint&#45;Euler method." alt="" coords="5,5,144,32"/>
<area shape="rect" id="node2" href="$d1/dc2/ode__midpoint__euler_8c.html#a97075291390a68c262ed66e157a57eb4" title="Problem statement for a system with first&#45;order differential equations. Updates the system differenti..." alt="" coords="192,5,260,32"/>
<area shape="rect" id="node2" href="$d1/dc2/ode__midpoint__euler_8c.html#a97075291390a68c262ed66e157a57eb4" title="Problem statement for a system with first&#45;order differential equations." alt="" coords="192,5,260,32"/>
</map>

View File

@ -1 +1 @@
e7576c7adb9cabe9673b7b0ed5048bb8
2688ab56b9a1caf05047f19019caae53

View File

@ -21,7 +21,7 @@
<!-- Node2 -->
<g id="node2" class="node">
<title>Node2</title>
<g id="a_node2"><a xlink:href="../../d1/dc2/ode__midpoint__euler_8c.html#a97075291390a68c262ed66e157a57eb4" target="_top" xlink:title="Problem statement for a system with first&#45;order differential equations. Updates the system differenti...">
<g id="a_node2"><a xlink:href="../../d1/dc2/ode__midpoint__euler_8c.html#a97075291390a68c262ed66e157a57eb4" target="_top" xlink:title="Problem statement for a system with first&#45;order differential equations.">
<polygon fill="white" stroke="black" points="140,-0.5 140,-19.5 191,-19.5 191,-0.5 140,-0.5"/>
<text text-anchor="middle" x="165.5" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">problem</text>
</a>

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -113,188 +113,31 @@ Include dependency graph for sol1.c:</div>
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:a619eec3220cebd7c5e455edbb14e9b12"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/df9/problem__26_2sol1_8c.html#a619eec3220cebd7c5e455edbb14e9b12">MAX_DENO</a>&#160;&#160;&#160;2000</td></tr>
<tr class="memitem:a619eec3220cebd7c5e455edbb14e9b12"><td class="memItemLeft" align="right" valign="top"><a id="a619eec3220cebd7c5e455edbb14e9b12"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/df9/problem__26_2sol1_8c.html#a619eec3220cebd7c5e455edbb14e9b12">MAX_DENO</a>&#160;&#160;&#160;2000</td></tr>
<tr class="memdesc:a619eec3220cebd7c5e455edbb14e9b12"><td class="mdescLeft">&#160;</td><td class="mdescRight">limit of unit fractions <br /></td></tr>
<tr class="separator:a619eec3220cebd7c5e455edbb14e9b12"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aabf4f709c8199e41cf279c77112345fe"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/df9/problem__26_2sol1_8c.html#aabf4f709c8199e41cf279c77112345fe">MAX_LEN</a>&#160;&#160;&#160;(<a class="el" href="../../d1/df9/problem__26_2sol1_8c.html#a619eec3220cebd7c5e455edbb14e9b12">MAX_DENO</a> + 10)</td></tr>
<tr class="memitem:aabf4f709c8199e41cf279c77112345fe"><td class="memItemLeft" align="right" valign="top"><a id="aabf4f709c8199e41cf279c77112345fe"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/df9/problem__26_2sol1_8c.html#aabf4f709c8199e41cf279c77112345fe">MAX_LEN</a>&#160;&#160;&#160;(<a class="el" href="../../d1/df9/problem__26_2sol1_8c.html#a619eec3220cebd7c5e455edbb14e9b12">MAX_DENO</a> + 10)</td></tr>
<tr class="memdesc:aabf4f709c8199e41cf279c77112345fe"><td class="mdescLeft">&#160;</td><td class="mdescRight">length of resulting recurring fraction number <br /></td></tr>
<tr class="separator:aabf4f709c8199e41cf279c77112345fe"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ac70138609ef6aa6fabca57aca8681e83"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/df9/problem__26_2sol1_8c.html#ac70138609ef6aa6fabca57aca8681e83">compare</a> (const void *a, const void *b)</td></tr>
<tr class="memitem:ac70138609ef6aa6fabca57aca8681e83"><td class="memItemLeft" align="right" valign="top"><a id="ac70138609ef6aa6fabca57aca8681e83"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/df9/problem__26_2sol1_8c.html#ac70138609ef6aa6fabca57aca8681e83">compare</a> (const void *a, const void *b)</td></tr>
<tr class="memdesc:ac70138609ef6aa6fabca57aca8681e83"><td class="mdescLeft">&#160;</td><td class="mdescRight">comparison function for use with internal <code>qsort</code> algorithm <br /></td></tr>
<tr class="separator:ac70138609ef6aa6fabca57aca8681e83"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0ddf1224851353fc92bfbff6f499fa97"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/df9/problem__26_2sol1_8c.html#a0ddf1224851353fc92bfbff6f499fa97">main</a> (int argc, char *argv[])</td></tr>
<tr class="memitem:a0ddf1224851353fc92bfbff6f499fa97"><td class="memItemLeft" align="right" valign="top"><a id="a0ddf1224851353fc92bfbff6f499fa97"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/df9/problem__26_2sol1_8c.html#a0ddf1224851353fc92bfbff6f499fa97">main</a> (int argc, char *argv[])</td></tr>
<tr class="memdesc:a0ddf1224851353fc92bfbff6f499fa97"><td class="mdescLeft">&#160;</td><td class="mdescRight">Main function. <br /></td></tr>
<tr class="separator:a0ddf1224851353fc92bfbff6f499fa97"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p><a href="https://projecteuler.net/problem=26">Problem 26</a> solution </p>
<dl class="section author"><dt>Author</dt><dd><a href="https://github.com/kvedala">Krishna Vedala</a> </dd></dl>
</div><h2 class="groupheader">Macro Definition Documentation</h2>
<a id="a619eec3220cebd7c5e455edbb14e9b12"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a619eec3220cebd7c5e455edbb14e9b12">&#9670;&nbsp;</a></span>MAX_DENO</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define MAX_DENO&#160;&#160;&#160;2000</td>
</tr>
</table>
</div><div class="memdoc">
<p>limit of unit fractions </p>
</div>
</div>
<a id="aabf4f709c8199e41cf279c77112345fe"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aabf4f709c8199e41cf279c77112345fe">&#9670;&nbsp;</a></span>MAX_LEN</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define MAX_LEN&#160;&#160;&#160;(<a class="el" href="../../d1/df9/problem__26_2sol1_8c.html#a619eec3220cebd7c5e455edbb14e9b12">MAX_DENO</a> + 10)</td>
</tr>
</table>
</div><div class="memdoc">
<p>length of resulting recurring fraction number </p>
</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="ac70138609ef6aa6fabca57aca8681e83"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac70138609ef6aa6fabca57aca8681e83">&#9670;&nbsp;</a></span>compare()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int compare </td>
<td>(</td>
<td class="paramtype">const void *&#160;</td>
<td class="paramname"><em>a</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const void *&#160;</td>
<td class="paramname"><em>b</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>comparison function for use with internal <code>qsort</code> algorithm </p>
<div class="fragment"><div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160;{</div>
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160; <span class="keywordflow">return</span> (*(<span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> *)a - *(<span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> *)b);</div>
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160;}</div>
</div><!-- fragment -->
</div>
</div>
<a id="a0ddf1224851353fc92bfbff6f499fa97"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0ddf1224851353fc92bfbff6f499fa97">&#9670;&nbsp;</a></span>main()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int main </td>
<td>(</td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>argc</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char *&#160;</td>
<td class="paramname"><em>argv</em>[]&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Main function </p>
<div class="fragment"><div class="line"><a name="l00026"></a><span class="lineno"> 26</span>&#160;{</div>
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span>&#160; <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> max_digits = 0, max_idx_number = 0;</div>
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span>&#160; </div>
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>&#160; clock_t start_time = clock();</div>
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span>&#160; <span class="keywordtype">short</span> deno;</div>
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>&#160;<span class="preprocessor">#ifdef _OPENMP</span></div>
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span>&#160;<span class="preprocessor">#pragma omp for</span></div>
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span>&#160; <span class="keywordflow">for</span> (deno = 2; deno &lt; <a class="code" href="../../d1/df9/problem__26_2sol1_8c.html#a619eec3220cebd7c5e455edbb14e9b12">MAX_DENO</a>; deno++)</div>
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>&#160; {</div>
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>&#160; <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> remainders[<a class="code" href="../../d1/df9/problem__26_2sol1_8c.html#aabf4f709c8199e41cf279c77112345fe">MAX_LEN</a>];</div>
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>&#160; <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> rem = 1, *rem_ptr = remainders;</div>
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span>&#160; memset(remainders, (<span class="keywordtype">unsigned</span> <span class="keywordtype">short</span>)-1,</div>
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span>&#160; <a class="code" href="../../d1/df9/problem__26_2sol1_8c.html#aabf4f709c8199e41cf279c77112345fe">MAX_LEN</a> * <span class="keyword">sizeof</span>(<span class="keywordtype">unsigned</span> <span class="keywordtype">short</span>));</div>
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span>&#160; <span class="comment">// remainders[0] = 1;</span></div>
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>&#160; <span class="comment">// printf(&quot;1/%-4u\t &quot;, deno);</span></div>
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>&#160; <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> index = 0, num_digits;</div>
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>&#160; </div>
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span>&#160; <span class="keywordflow">while</span> (rem != 0)</div>
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>&#160; {</div>
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>&#160; rem = (rem * 10) % deno;</div>
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>&#160; <span class="keywordflow">if</span> (rem == 0)</div>
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>&#160; {</div>
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>&#160; index = 0;</div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>&#160; <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160; }</div>
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160; rem_ptr = (<span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> *)bsearch(</div>
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span>&#160; &amp;rem, remainders, <a class="code" href="../../d1/df9/problem__26_2sol1_8c.html#aabf4f709c8199e41cf279c77112345fe">MAX_LEN</a>, <span class="keyword">sizeof</span>(<span class="keywordtype">unsigned</span> <span class="keywordtype">short</span>), <a class="code" href="../../d1/df9/problem__26_2sol1_8c.html#ac70138609ef6aa6fabca57aca8681e83">compare</a>);</div>
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>&#160; <span class="comment">// printf(&quot;%2d, &quot;, rem);</span></div>
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>&#160; <span class="comment">// printf(&quot;(%14p), &quot;, rem_ptr);</span></div>
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>&#160; <span class="keywordflow">if</span> (rem_ptr != NULL)</div>
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>&#160; <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>&#160; remainders[index] = rem;</div>
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>&#160; rem_ptr = remainders;</div>
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>&#160; index++;</div>
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>&#160; }</div>
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>&#160; </div>
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>&#160; num_digits = index - (rem_ptr - remainders);</div>
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>&#160; <span class="comment">// printf(&quot;\n\t(%14p, %14p, %4u, %4u)\n&quot;, rem_ptr, remainders, index,</span></div>
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160; <span class="comment">// num_digits);</span></div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160;<span class="preprocessor">#ifdef _OPENMP</span></div>
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>&#160;<span class="preprocessor">#pragma omp critical</span></div>
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>&#160; {</div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>&#160; <span class="keywordflow">if</span> (num_digits &gt; max_digits)</div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>&#160; {</div>
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>&#160; max_digits = num_digits;</div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>&#160; max_idx_number = deno;</div>
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>&#160; <span class="comment">// printf(&quot;\t (%u, %u)\n &quot;, max_digits, max_idx_number);</span></div>
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>&#160; }</div>
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>&#160;<span class="preprocessor">#ifdef _OPENMP</span></div>
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>&#160; }</div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>&#160; }</div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>&#160; clock_t end_time = clock();</div>
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>&#160; </div>
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>&#160; printf(<span class="stringliteral">&quot;Time taken: %.4g ms\n&quot;</span>,</div>
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>&#160; 1e3 * (<span class="keywordtype">double</span>)(end_time - start_time) / CLOCKS_PER_SEC);</div>
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span>&#160; printf(<span class="stringliteral">&quot;Maximum digits: %hu\t Denominator: %hu\n&quot;</span>, max_digits,</div>
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>&#160; max_idx_number);</div>
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>&#160; </div>
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>&#160;}</div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d1/df9/problem__26_2sol1_8c_a0ddf1224851353fc92bfbff6f499fa97_cgraph.svg" width="182" height="38"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
</div>
</div>
</div>
</div><!-- contents -->
</div></div><!-- contents -->
</div><!-- doc-content -->
<div class="ttc" id="aproblem__26_2sol1_8c_html_ac70138609ef6aa6fabca57aca8681e83"><div class="ttname"><a href="../../d1/df9/problem__26_2sol1_8c.html#ac70138609ef6aa6fabca57aca8681e83">compare</a></div><div class="ttdeci">int compare(const void *a, const void *b)</div><div class="ttdef"><b>Definition:</b> sol1.c:19</div></div>
<div class="ttc" id="aproblem__26_2sol1_8c_html_aabf4f709c8199e41cf279c77112345fe"><div class="ttname"><a href="../../d1/df9/problem__26_2sol1_8c.html#aabf4f709c8199e41cf279c77112345fe">MAX_LEN</a></div><div class="ttdeci">#define MAX_LEN</div><div class="ttdef"><b>Definition:</b> sol1.c:15</div></div>
<div class="ttc" id="aproblem__26_2sol1_8c_html_a619eec3220cebd7c5e455edbb14e9b12"><div class="ttname"><a href="../../d1/df9/problem__26_2sol1_8c.html#a619eec3220cebd7c5e455edbb14e9b12">MAX_DENO</a></div><div class="ttdeci">#define MAX_DENO</div><div class="ttdef"><b>Definition:</b> sol1.c:14</div></div>
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>

View File

@ -1,4 +0,0 @@
<map id="main" name="main">
<area shape="rect" id="node1" title=" " alt="" coords="5,5,56,32"/>
<area shape="rect" id="node2" href="$d1/df9/problem__26_2sol1_8c.html#ac70138609ef6aa6fabca57aca8681e83" title=" " alt="" coords="104,5,176,32"/>
</map>

View File

@ -1 +0,0 @@
61295bfb88e6fba03d58f641426f44ca

View File

@ -1,37 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.44.0 (20200408.0750)
-->
<!-- Title: main Pages: 1 -->
<svg width="136pt" height="28pt"
viewBox="0.00 0.00 136.00 28.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 24)">
<title>main</title>
<polygon fill="white" stroke="transparent" points="-4,4 -4,-24 132,-24 132,4 -4,4"/>
<!-- Node1 -->
<g id="node1" class="node">
<title>Node1</title>
<g id="a_node1"><a xlink:title=" ">
<polygon fill="#bfbfbf" stroke="black" points="0,-0.5 0,-19.5 38,-19.5 38,-0.5 0,-0.5"/>
<text text-anchor="middle" x="19" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">main</text>
</a>
</g>
</g>
<!-- Node2 -->
<g id="node2" class="node">
<title>Node2</title>
<g id="a_node2"><a xlink:href="../../d1/df9/problem__26_2sol1_8c.html#ac70138609ef6aa6fabca57aca8681e83" target="_top" xlink:title=" ">
<polygon fill="white" stroke="black" points="74,-0.5 74,-19.5 128,-19.5 128,-0.5 74,-0.5"/>
<text text-anchor="middle" x="101" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">compare</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node2 -->
<g id="edge1" class="edge">
<title>Node1&#45;&gt;Node2</title>
<path fill="none" stroke="midnightblue" d="M38.15,-10C45.71,-10 54.76,-10 63.58,-10"/>
<polygon fill="midnightblue" stroke="midnightblue" points="63.73,-13.5 73.73,-10 63.73,-6.5 63.73,-13.5"/>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -111,160 +111,15 @@ Include dependency graph for sol2.c:</div>
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a0ddf1224851353fc92bfbff6f499fa97"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d2/d93/problem__8_2sol2_8c.html#a0ddf1224851353fc92bfbff6f499fa97">main</a> (int argc, char *argv[])</td></tr>
<tr class="memitem:a0ddf1224851353fc92bfbff6f499fa97"><td class="memItemLeft" align="right" valign="top"><a id="a0ddf1224851353fc92bfbff6f499fa97"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d2/d93/problem__8_2sol2_8c.html#a0ddf1224851353fc92bfbff6f499fa97">main</a> (int argc, char *argv[])</td></tr>
<tr class="memdesc:a0ddf1224851353fc92bfbff6f499fa97"><td class="mdescLeft">&#160;</td><td class="mdescRight">Main function. <br /></td></tr>
<tr class="separator:a0ddf1224851353fc92bfbff6f499fa97"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p><a href="https://projecteuler.net/problem=8">Problem 8</a> solution </p>
<dl class="section author"><dt>Author</dt><dd><a href="https://github.com/kvedala">Krishna Vedala</a> </dd></dl>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="a0ddf1224851353fc92bfbff6f499fa97"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0ddf1224851353fc92bfbff6f499fa97">&#9670;&nbsp;</a></span>main()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int main </td>
<td>(</td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>argc</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char *&#160;</td>
<td class="paramname"><em>argv</em>[]&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Main function </p>
<div class="fragment"><div class="line"><a name="l00012"></a><span class="lineno"> 12</span>&#160;{</div>
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span>&#160; <span class="keywordtype">int</span> position = 0, num_bad_chars = 0;</div>
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span>&#160; <span class="keywordtype">int</span> num_digits = 4;</div>
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span>&#160; <span class="keywordtype">char</span> ch;</div>
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span>&#160; <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> num, num_prev;</div>
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span>&#160; <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *buffer = NULL;</div>
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span>&#160; <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> prod = 1, max_prod = 0;</div>
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span>&#160; </div>
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160; <span class="comment">/* if second command-line argument is given,</span></div>
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160;<span class="comment"> * use it as the number of digits to compute</span></div>
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160;<span class="comment"> * successive product for</span></div>
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span>&#160; <span class="keywordflow">if</span> (argc == 2)</div>
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span>&#160; num_digits = atoi(argv[1]);</div>
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span>&#160; </div>
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span>&#160; <span class="comment">/* allocate memory to store past values */</span></div>
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span>&#160; buffer = calloc(num_digits, <span class="keyword">sizeof</span>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>));</div>
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>&#160; <span class="keywordflow">if</span> (!buffer)</div>
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span>&#160; {</div>
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>&#160; perror(<span class="stringliteral">&quot;Unable to allocate memory for buffer&quot;</span>);</div>
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span>&#160; <span class="keywordflow">return</span> -1;</div>
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>&#160; }</div>
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span>&#160; </div>
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>&#160; <span class="comment">/* open file to read digits from */</span></div>
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>&#160; FILE *fp = fopen(<span class="stringliteral">&quot;digits.txt&quot;</span>, <span class="stringliteral">&quot;rt&quot;</span>);</div>
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>&#160; <span class="keywordflow">if</span> (!fp)</div>
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span>&#160; {</div>
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span>&#160; perror(<span class="stringliteral">&quot;Unable to open file&quot;</span>);</div>
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span>&#160; free(buffer); <span class="comment">/* free allocated memory */</span></div>
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>&#160; <span class="keywordflow">return</span> -1;</div>
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>&#160; }</div>
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>&#160; </div>
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span>&#160; <span class="comment">/* loop through all digits in the file */</span></div>
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>&#160; <span class="keywordflow">do</span></div>
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>&#160; {</div>
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>&#160; <span class="comment">/* get character from file */</span></div>
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>&#160; ch = getc(fp);</div>
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>&#160; </div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>&#160; <span class="comment">/* the ASCII codes of digits is between 0x30 and 0x39.</span></div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160;<span class="comment"> * any character not in this range implies an invalid character</span></div>
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span>&#160; <span class="keywordflow">if</span> (ch &lt; 0x30 || ch &gt; 0x39)</div>
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>&#160; {</div>
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>&#160; num_bad_chars++; <span class="comment">/* this is used to get the bad characters in the</span></div>
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>&#160;<span class="comment"> sequence of 13 characters */</span></div>
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>&#160; <span class="keywordflow">continue</span>;</div>
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>&#160; }</div>
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>&#160; <span class="keywordflow">else</span> <span class="keywordflow">if</span> (num_bad_chars &gt; 0)</div>
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>&#160; num_bad_chars--;</div>
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>&#160; </div>
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>&#160; num = ch - 0x30; <span class="comment">/* convert character digit to number */</span></div>
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>&#160; num_prev = buffer[0]; <span class="comment">/* previous n^th digit */</span></div>
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>&#160; </div>
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160; <span class="comment">/* left shift the buffer -</span></div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160;<span class="comment"> * using a for loop or a faster memory move</span></div>
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>&#160; memmove(buffer, buffer + 1, num_digits - 1);</div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>&#160; <span class="comment">/*</span></div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>&#160;<span class="comment"> for (int i = 1; i &lt; num_digits; i++)</span></div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>&#160;<span class="comment"> buffer[i-1] = buffer[i];</span></div>
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>&#160; </div>
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>&#160; buffer[num_digits - 1] = num; <span class="comment">/* save the latest number in buffer */</span></div>
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>&#160; </div>
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>&#160; <span class="keywordflow">if</span> (num_prev != 0)</div>
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>&#160; {</div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>&#160; <span class="comment">/* since product is accumulated, the new product can be obtained by</span></div>
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>&#160;<span class="comment"> * simply multiplying the new digit and dividing with the oldest</span></div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>&#160;<span class="comment"> * digit</span></div>
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>&#160; prod /= num_prev; <span class="comment">/* divide first to avoid over-flows */</span></div>
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>&#160; prod *= num;</div>
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span>&#160; }</div>
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>&#160; <span class="keywordflow">else</span></div>
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>&#160; {</div>
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span>&#160; prod = 1;</div>
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>&#160; <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; num_digits; i++)</div>
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>&#160; {</div>
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span>&#160; <span class="keywordflow">if</span> (buffer[i] == 0)</div>
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>&#160; {</div>
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span>&#160; prod = 0;</div>
<div class="line"><a name="l00093"></a><span class="lineno"> 93</span>&#160; <span class="keywordflow">break</span>; <span class="comment">/* break innermost for-loop */</span></div>
<div class="line"><a name="l00094"></a><span class="lineno"> 94</span>&#160; }</div>
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span>&#160; prod *= buffer[i];</div>
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span>&#160; }</div>
<div class="line"><a name="l00097"></a><span class="lineno"> 97</span>&#160; }</div>
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span>&#160; </div>
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span>&#160; <span class="comment">/* check if a new maxima was found */</span></div>
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span>&#160; <span class="keywordflow">if</span> (prod &gt; max_prod)</div>
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span>&#160; {</div>
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span>&#160; max_prod = prod;</div>
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span>&#160; position = ftell(fp) - num_bad_chars - num_digits - 1;</div>
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span>&#160; }</div>
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>&#160; } <span class="keywordflow">while</span> (!feof(fp)); <span class="comment">/* loop till end of file is reached */</span></div>
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span>&#160; </div>
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>&#160; printf(<span class="stringliteral">&quot;Maximum product: %lld\t Location: %d^th position\n\t&quot;</span>, max_prod,</div>
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>&#160; position);</div>
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>&#160; fseek(fp, position,</div>
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>&#160; SEEK_SET); <span class="comment">/* move cursor to identified position in file */</span></div>
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>&#160; <span class="comment">/* loop through all digits */</span></div>
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span>&#160; <span class="keywordflow">for</span> (; num_digits &gt; 0; num_digits--)</div>
<div class="line"><a name="l00113"></a><span class="lineno"> 113</span>&#160; {</div>
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span>&#160; <span class="keywordtype">char</span> ch = getc(fp); <span class="comment">/* get character */</span></div>
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span>&#160; <span class="comment">/* skip invalid character */</span></div>
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>&#160; <span class="keywordflow">if</span> (ch &lt; 0x30 || ch &gt; 0x39)</div>
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>&#160; <span class="keywordflow">continue</span>;</div>
<div class="line"><a name="l00118"></a><span class="lineno"> 118</span>&#160; <span class="keywordflow">if</span> (num_digits &gt; 1)</div>
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span>&#160; printf(<span class="stringliteral">&quot;%c x &quot;</span>, ch);</div>
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span>&#160; <span class="keywordflow">else</span></div>
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span>&#160; printf(<span class="stringliteral">&quot;%c = %lld\n&quot;</span>, ch, max_prod);</div>
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span>&#160; }</div>
<div class="line"><a name="l00123"></a><span class="lineno"> 123</span>&#160; </div>
<div class="line"><a name="l00124"></a><span class="lineno"> 124</span>&#160; fclose(fp); <span class="comment">/* close file */</span></div>
<div class="line"><a name="l00125"></a><span class="lineno"> 125</span>&#160; free(buffer); <span class="comment">/* free allocated memory */</span></div>
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>&#160; </div>
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span>&#160;}</div>
</div><!-- fragment -->
</div>
</div>
</div><!-- contents -->
</div></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->

View File

@ -96,6 +96,9 @@ $(document).ready(function(){initNavTree('d2/daa/structadaline.html','../../');
<div class="title">adaline Struct Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>structure to hold adaline model parameters
<a href="../../d2/daa/structadaline.html#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-attribs"></a>
Data Fields</h2></td></tr>

View File

@ -109,47 +109,16 @@ Include dependency graph for sol2.c:</div>
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d2/dae/problem__1_2sol2_8c.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main</a> ()</td></tr>
<tr class="memitem:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="memItemLeft" align="right" valign="top"><a id="ae66f6b31b5ad750f1fe042a706a4e3d4"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d2/dae/problem__1_2sol2_8c.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main</a> ()</td></tr>
<tr class="memdesc:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Main function. <br /></td></tr>
<tr class="separator:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p><a href="https://projecteuler.net/problem=1">Problem 1</a> solution </p>
<p>If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3,5,6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below N.</p>
<p>This solution is based on the pattern that the successive numbers in the series follow: 0+3,+2,+1,+3,+1,+2,+3. </p>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="ae66f6b31b5ad750f1fe042a706a4e3d4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae66f6b31b5ad750f1fe042a706a4e3d4">&#9670;&nbsp;</a></span>main()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int main </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Main function </p>
<div class="fragment"><div class="line"><a name="l00016"></a><span class="lineno"> 16</span>&#160;{</div>
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span>&#160; <span class="keywordtype">int</span> n = 0;</div>
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span>&#160; <span class="keywordtype">int</span> sum = 0;</div>
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span>&#160; scanf(<span class="stringliteral">&quot;%d&quot;</span>, &amp;n);</div>
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160; </div>
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160; <span class="keywordtype">int</span> terms = (n - 1) / 3;</div>
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160; sum += ((terms) * (6 + (terms - 1) * 3)) / 2; <span class="comment">// sum of an A.P.</span></div>
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span>&#160; terms = (n - 1) / 5;</div>
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span>&#160; sum += ((terms) * (10 + (terms - 1) * 5)) / 2;</div>
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span>&#160; terms = (n - 1) / 15;</div>
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span>&#160; sum -= ((terms) * (30 + (terms - 1) * 15)) / 2;</div>
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span>&#160; </div>
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span>&#160; printf(<span class="stringliteral">&quot;%d\n&quot;</span>, sum);</div>
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>&#160;}</div>
</div><!-- fragment -->
</div>
</div>
</div><!-- contents -->
</div></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->

View File

@ -109,52 +109,16 @@ Include dependency graph for sol2.c:</div>
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d2/dbc/problem__3_2sol2_8c.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main</a> ()</td></tr>
<tr class="memitem:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="memItemLeft" align="right" valign="top"><a id="ae66f6b31b5ad750f1fe042a706a4e3d4"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d2/dbc/problem__3_2sol2_8c.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main</a> ()</td></tr>
<tr class="memdesc:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Main function. <br /></td></tr>
<tr class="separator:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p><a href="https://projecteuler.net/problem=3">Problem 3</a> solution </p>
<p>Problem:</p>
<p>The prime factors of 13195 are 5,7,13 and 29. What is the largest prime factor of a given number N? e.g. for 10, largest prime factor = 5. For 17, largest prime factor = 17. </p>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="ae66f6b31b5ad750f1fe042a706a4e3d4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae66f6b31b5ad750f1fe042a706a4e3d4">&#9670;&nbsp;</a></span>main()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int main </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Main function </p>
<div class="fragment"><div class="line"><a name="l00015"></a><span class="lineno"> 15</span>&#160;{</div>
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span>&#160; <span class="keywordtype">int</span> n = 0;</div>
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span>&#160; scanf(<span class="stringliteral">&quot;%d&quot;</span>, &amp;n);</div>
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span>&#160; <span class="keywordtype">int</span> prime = 1;</div>
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span>&#160; <span class="keywordtype">int</span> i = 2;</div>
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160; <span class="keywordflow">while</span> (i * i &lt;= n)</div>
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160; {</div>
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160; <span class="keywordflow">while</span> (n % i == 0)</div>
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span>&#160; {</div>
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span>&#160; prime = i;</div>
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span>&#160; n /= i;</div>
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span>&#160; }</div>
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span>&#160; i += 1;</div>
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span>&#160; }</div>
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>&#160; <span class="keywordflow">if</span> (n &gt; 1)</div>
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span>&#160; prime = n;</div>
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>&#160; printf(<span class="stringliteral">&quot;%d\n&quot;</span>, prime);</div>
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>&#160;}</div>
</div><!-- fragment -->
</div>
</div>
</div><!-- contents -->
</div></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->

View File

@ -181,14 +181,14 @@ $(document).ready(function(){initNavTree('d2/dc3/carray_8h_source.html','../../'
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>&#160;<span class="preprocessor">#endif</span></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<div class="ttc" id="akohonen__som__topology_8c_html_ac6afabdc09a49a433ee19d8a9486056d"><div class="ttname"><a href="../../d2/df6/kohonen__som__topology_8c.html#ac6afabdc09a49a433ee19d8a9486056d">min</a></div><div class="ttdeci">#define min(a, b)</div><div class="ttdef"><b>Definition:</b> kohonen_som_topology.c:37</div></div>
<div class="ttc" id="ac__atoi__str__to__integer_8c_html_abef225390e0b6e84ddfcb18fe573d9c5"><div class="ttname"><a href="../../d7/dd8/c__atoi__str__to__integer_8c.html#abef225390e0b6e84ddfcb18fe573d9c5">test_c_atoi</a></div><div class="ttdeci">int test_c_atoi()</div><div class="ttdef"><b>Definition:</b> c_atoi_str_to_integer.c:54</div></div>
<div class="ttc" id="ac__atoi__str__to__integer_8c_html_a3c04138a5bfe5d72780bb7e82a18e627"><div class="ttname"><a href="../../d7/dd8/c__atoi__str__to__integer_8c.html#a3c04138a5bfe5d72780bb7e82a18e627">main</a></div><div class="ttdeci">int main(int argc, char **argv)</div><div class="ttdef"><b>Definition:</b> c_atoi_str_to_integer.c:70</div></div>
<div class="ttc" id="ac__atoi__str__to__integer_8c_html_ad19049ebfc2088bc1e75e7e958f7b60f"><div class="ttname"><a href="../../d7/dd8/c__atoi__str__to__integer_8c.html#ad19049ebfc2088bc1e75e7e958f7b60f">c_atoi</a></div><div class="ttdeci">int c_atoi(const char *str)</div><div class="ttdef"><b>Definition:</b> c_atoi_str_to_integer.c:16</div></div>
<div class="ttc" id="akohonen__som__topology_8c_html_ac6afabdc09a49a433ee19d8a9486056d"><div class="ttname"><a href="../../d2/df6/kohonen__som__topology_8c.html#ac6afabdc09a49a433ee19d8a9486056d">min</a></div><div class="ttdeci">#define min(a, b)</div><div class="ttdoc">shorthand for minimum value</div><div class="ttdef"><b>Definition:</b> kohonen_som_topology.c:36</div></div>
<div class="ttc" id="ac__atoi__str__to__integer_8c_html_a3c04138a5bfe5d72780bb7e82a18e627"><div class="ttname"><a href="../../d7/dd8/c__atoi__str__to__integer_8c.html#a3c04138a5bfe5d72780bb7e82a18e627">main</a></div><div class="ttdeci">int main(int argc, char **argv)</div><div class="ttdoc">the main function take one argument of type char* example : .</div><div class="ttdef"><b>Definition:</b> c_atoi_str_to_integer.c:72</div></div>
<div class="ttc" id="ac__atoi__str__to__integer_8c_html_ad19049ebfc2088bc1e75e7e958f7b60f"><div class="ttname"><a href="../../d7/dd8/c__atoi__str__to__integer_8c.html#ad19049ebfc2088bc1e75e7e958f7b60f">c_atoi</a></div><div class="ttdeci">int c_atoi(const char *str)</div><div class="ttdoc">the function take a string and return an integer</div><div class="ttdef"><b>Definition:</b> c_atoi_str_to_integer.c:16</div></div>
<div class="ttc" id="astruct_c_array_html"><div class="ttname"><a href="../../d4/d2d/struct_c_array.html">CArray</a></div><div class="ttdef"><b>Definition:</b> carray.h:32</div></div>
<div class="ttc" id="anewton__raphson__root_8c_html_a72f87d423a488946b319627a454d3925"><div class="ttname"><a href="../../dd/d08/newton__raphson__root_8c.html#a72f87d423a488946b319627a454d3925">func</a></div><div class="ttdeci">double complex func(double complex x)</div><div class="ttdef"><b>Definition:</b> newton_raphson_root.c:22</div></div>
<div class="ttc" id="akohonen__som__topology_8c_html_affe776513b24d84b39af8ab0930fef7f"><div class="ttname"><a href="../../d2/df6/kohonen__som__topology_8c.html#affe776513b24d84b39af8ab0930fef7f">max</a></div><div class="ttdeci">#define max(a, b)</div><div class="ttdef"><b>Definition:</b> kohonen_som_topology.c:31</div></div>
<div class="ttc" id="ashell__sort2_8c_html_a4b9708d87be7a409eff20e5e7e8b43c8"><div class="ttname"><a href="../../d6/ded/shell__sort2_8c.html#a4b9708d87be7a409eff20e5e7e8b43c8">swap</a></div><div class="ttdeci">void swap(int *a, int *b)</div><div class="ttdef"><b>Definition:</b> shell_sort2.c:21</div></div>
<div class="ttc" id="anewton__raphson__root_8c_html_a72f87d423a488946b319627a454d3925"><div class="ttname"><a href="../../dd/d08/newton__raphson__root_8c.html#a72f87d423a488946b319627a454d3925">func</a></div><div class="ttdeci">double complex func(double complex x)</div><div class="ttdoc">Return value of the function to find the root for.</div><div class="ttdef"><b>Definition:</b> newton_raphson_root.c:22</div></div>
<div class="ttc" id="akohonen__som__topology_8c_html_affe776513b24d84b39af8ab0930fef7f"><div class="ttname"><a href="../../d2/df6/kohonen__som__topology_8c.html#affe776513b24d84b39af8ab0930fef7f">max</a></div><div class="ttdeci">#define max(a, b)</div><div class="ttdoc">shorthand for maximum value</div><div class="ttdef"><b>Definition:</b> kohonen_som_topology.c:32</div></div>
<div class="ttc" id="ashell__sort2_8c_html_a4b9708d87be7a409eff20e5e7e8b43c8"><div class="ttname"><a href="../../d6/ded/shell__sort2_8c.html#a4b9708d87be7a409eff20e5e7e8b43c8">swap</a></div><div class="ttdeci">void swap(int *a, int *b)</div><div class="ttdoc">Function to swap values of two integers.</div><div class="ttdef"><b>Definition:</b> shell_sort2.c:19</div></div>
<div class="ttc" id="ac__atoi__str__to__integer_8c_html_a8c66c03637e48e375b80b5d7791e57be"><div class="ttname"><a href="../../d7/dd8/c__atoi__str__to__integer_8c.html#a8c66c03637e48e375b80b5d7791e57be">test_c_atoi</a></div><div class="ttdeci">void test_c_atoi()</div><div class="ttdoc">test the function implementation</div><div class="ttdef"><b>Definition:</b> c_atoi_str_to_integer.c:56</div></div>
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,11 @@
<map id="test2" name="test2">
<area shape="rect" id="node1" title="Test that creates a random set of points distributed in 4 clusters in 3D space and trains an SOM that..." alt="" coords="5,112,56,139"/>
<area shape="rect" id="node2" href="$d2/df6/kohonen__som__topology_8c.html#af5ce14f026d6d231bef29161bac2b485" title="Helper function to generate a random number in a given interval." alt="" coords="297,112,369,139"/>
<area shape="rect" id="node3" href="$d2/df6/kohonen__som__topology_8c.html#a7237d2cf3b3f9d034477268c1d6631da" title="Function that returns the pointer to (x, y, z) ^th location in the linear 3D array given by:" alt="" coords="448,36,516,63"/>
<area shape="rect" id="node4" href="$d2/df6/kohonen__som__topology_8c.html#a1983dc0f35e734015772e9f8c0ff19f5" title="Apply incremental algorithm with updating neighborhood and learning rates on all samples in the given..." alt="" coords="115,239,217,265"/>
<area shape="rect" id="node7" href="$d2/df6/kohonen__som__topology_8c.html#a6824dc6d973eb3339af7aef5fea78b0c" title="Save a given n&#45;dimensional data martix to file." alt="" coords="115,137,217,164"/>
<area shape="rect" id="node8" href="$d2/df6/kohonen__som__topology_8c.html#adee1bc3871c881f6e04cb9e0b1d01158" title="Create the distance matrix or U&#45;matrix from the trained weights and save to disk." alt="" coords="279,36,386,63"/>
<area shape="rect" id="node9" href="$d2/df6/kohonen__som__topology_8c.html#ad9e25202bb8b481461f932668f249dbc" title="Creates a random set of points distributed in four clusters in 3D space with centroids at the points." alt="" coords="104,87,228,113"/>
<area shape="rect" id="node5" href="$d2/df6/kohonen__som__topology_8c.html#ad139de302fa8135a433d9c1bf971b13b" title="Update weights of the SOM using Kohonen algorithm." alt="" coords="276,213,389,240"/>
<area shape="rect" id="node6" href="$d2/df6/kohonen__som__topology_8c.html#adc22d512c00a9f5799ee067f4fb90b4b" title="Get minimum value and index of the value in a matrix." alt="" coords="437,213,527,240"/>
</map>

View File

@ -0,0 +1 @@
887d2d9f85e2d06eef7a62cc1b5b4828

View File

@ -0,0 +1,160 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.44.0 (20200408.0750)
-->
<!-- Title: test2 Pages: 1 -->
<svg width="399pt" height="203pt"
viewBox="0.00 0.00 399.00 202.90" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 198.9)">
<title>test2</title>
<polygon fill="white" stroke="transparent" points="-4,4 -4,-198.9 395,-198.9 395,4 -4,4"/>
<!-- Node1 -->
<g id="node1" class="node">
<title>Node1</title>
<g id="a_node1"><a xlink:title="Test that creates a random set of points distributed in 4 clusters in 3D space and trains an SOM that...">
<polygon fill="#bfbfbf" stroke="black" points="0,-95.5 0,-114.5 38,-114.5 38,-95.5 0,-95.5"/>
<text text-anchor="middle" x="19" y="-102.5" font-family="Helvetica,sans-Serif" font-size="10.00">test2</text>
</a>
</g>
</g>
<!-- Node2 -->
<g id="node2" class="node">
<title>Node2</title>
<g id="a_node2"><a xlink:href="../../d2/df6/kohonen__som__topology_8c.html#af5ce14f026d6d231bef29161bac2b485" target="_top" xlink:title="Helper function to generate a random number in a given interval.">
<polygon fill="white" stroke="black" points="218.5,-95.5 218.5,-114.5 272.5,-114.5 272.5,-95.5 218.5,-95.5"/>
<text text-anchor="middle" x="245.5" y="-102.5" font-family="Helvetica,sans-Serif" font-size="10.00">_random</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node2 -->
<g id="edge1" class="edge">
<title>Node1&#45;&gt;Node2</title>
<path fill="none" stroke="midnightblue" d="M29.71,-95.31C39.79,-86 56.51,-72.54 74,-67 113.41,-54.52 126.74,-57.66 167,-67 186.28,-71.47 206.29,-81.44 221.15,-90.05"/>
<polygon fill="midnightblue" stroke="midnightblue" points="219.74,-93.28 230.11,-95.44 223.35,-87.29 219.74,-93.28"/>
</g>
<!-- Node3 -->
<g id="node3" class="node">
<title>Node3</title>
<g id="a_node3"><a xlink:href="../../d2/df6/kohonen__som__topology_8c.html#a7237d2cf3b3f9d034477268c1d6631da" target="_top" xlink:title="Function that returns the pointer to (x, y, z) ^th location in the linear 3D array given by:">
<polygon fill="white" stroke="black" points="332,-152.5 332,-171.5 383,-171.5 383,-152.5 332,-152.5"/>
<text text-anchor="middle" x="357.5" y="-159.5" font-family="Helvetica,sans-Serif" font-size="10.00">data_3d</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node3 -->
<g id="edge2" class="edge">
<title>Node1&#45;&gt;Node3</title>
<path fill="none" stroke="midnightblue" d="M25.48,-114.82C33.9,-128.85 51.43,-154.22 74,-166 158.53,-210.11 193.53,-193.86 288,-181 299.21,-179.47 311.18,-176.6 321.93,-173.55"/>
<polygon fill="midnightblue" stroke="midnightblue" points="323.21,-176.82 331.79,-170.6 321.2,-170.11 323.21,-176.82"/>
</g>
<!-- Node4 -->
<g id="node4" class="node">
<title>Node4</title>
<g id="a_node4"><a xlink:href="../../d2/df6/kohonen__som__topology_8c.html#a1983dc0f35e734015772e9f8c0ff19f5" target="_top" xlink:title="Apply incremental algorithm with updating neighborhood and learning rates on all samples in the given...">
<polygon fill="white" stroke="black" points="82,-0.5 82,-19.5 159,-19.5 159,-0.5 82,-0.5"/>
<text text-anchor="middle" x="120.5" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">kohonen_som</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node4 -->
<g id="edge3" class="edge">
<title>Node1&#45;&gt;Node4</title>
<path fill="none" stroke="midnightblue" d="M25.54,-95.2C34.28,-80.42 52.5,-52.22 74,-34 78.07,-30.55 82.72,-27.41 87.45,-24.61"/>
<polygon fill="midnightblue" stroke="midnightblue" points="89.41,-27.53 96.53,-19.68 86.07,-21.38 89.41,-27.53"/>
</g>
<!-- Node7 -->
<g id="node7" class="node">
<title>Node7</title>
<g id="a_node7"><a xlink:href="../../d2/df6/kohonen__som__topology_8c.html#a6824dc6d973eb3339af7aef5fea78b0c" target="_top" xlink:title="Save a given n&#45;dimensional data martix to file.">
<polygon fill="white" stroke="black" points="82,-76.5 82,-95.5 159,-95.5 159,-76.5 82,-76.5"/>
<text text-anchor="middle" x="120.5" y="-83.5" font-family="Helvetica,sans-Serif" font-size="10.00">save_2d_data</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node7 -->
<g id="edge7" class="edge">
<title>Node1&#45;&gt;Node7</title>
<path fill="none" stroke="midnightblue" d="M38.25,-101.52C47.8,-99.69 59.99,-97.36 72.01,-95.07"/>
<polygon fill="midnightblue" stroke="midnightblue" points="72.83,-98.48 81.99,-93.16 71.52,-91.6 72.83,-98.48"/>
</g>
<!-- Node8 -->
<g id="node8" class="node">
<title>Node8</title>
<g id="a_node8"><a xlink:href="../../d2/df6/kohonen__som__topology_8c.html#adee1bc3871c881f6e04cb9e0b1d01158" target="_top" xlink:title="Create the distance matrix or U&#45;matrix from the trained weights and save to disk.">
<polygon fill="white" stroke="black" points="205.5,-152.5 205.5,-171.5 285.5,-171.5 285.5,-152.5 205.5,-152.5"/>
<text text-anchor="middle" x="245.5" y="-159.5" font-family="Helvetica,sans-Serif" font-size="10.00">save_u_matrix</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node8 -->
<g id="edge8" class="edge">
<title>Node1&#45;&gt;Node8</title>
<path fill="none" stroke="midnightblue" d="M30.24,-114.62C40.46,-123.61 57.06,-136.58 74,-143 112.87,-157.72 160.03,-162.04 194.89,-162.92"/>
<polygon fill="midnightblue" stroke="midnightblue" points="195.24,-166.43 205.3,-163.09 195.35,-159.43 195.24,-166.43"/>
</g>
<!-- Node9 -->
<g id="node9" class="node">
<title>Node9</title>
<g id="a_node9"><a xlink:href="../../d2/df6/kohonen__som__topology_8c.html#ad9e25202bb8b481461f932668f249dbc" target="_top" xlink:title="Creates a random set of points distributed in four clusters in 3D space with centroids at the points.">
<polygon fill="white" stroke="black" points="74,-114.5 74,-133.5 167,-133.5 167,-114.5 74,-114.5"/>
<text text-anchor="middle" x="120.5" y="-121.5" font-family="Helvetica,sans-Serif" font-size="10.00">test_3d_classes1</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node9 -->
<g id="edge10" class="edge">
<title>Node1&#45;&gt;Node9</title>
<path fill="none" stroke="midnightblue" d="M38.25,-108.48C45.58,-109.89 54.47,-111.58 63.64,-113.33"/>
<polygon fill="midnightblue" stroke="midnightblue" points="63.15,-116.8 73.63,-115.24 64.47,-109.93 63.15,-116.8"/>
</g>
<!-- Node5 -->
<g id="node5" class="node">
<title>Node5</title>
<g id="a_node5"><a xlink:href="../../d2/df6/kohonen__som__topology_8c.html#ad139de302fa8135a433d9c1bf971b13b" target="_top" xlink:title="Update weights of the SOM using Kohonen algorithm.">
<polygon fill="white" stroke="black" points="203,-19.5 203,-38.5 288,-38.5 288,-19.5 203,-19.5"/>
<text text-anchor="middle" x="245.5" y="-26.5" font-family="Helvetica,sans-Serif" font-size="10.00">update_weights</text>
</a>
</g>
</g>
<!-- Node4&#45;&gt;Node5 -->
<g id="edge4" class="edge">
<title>Node4&#45;&gt;Node5</title>
<path fill="none" stroke="midnightblue" d="M159.07,-15.8C169.67,-17.44 181.4,-19.25 192.68,-21"/>
<polygon fill="midnightblue" stroke="midnightblue" points="192.45,-24.5 202.87,-22.57 193.52,-17.58 192.45,-24.5"/>
</g>
<!-- Node5&#45;&gt;Node3 -->
<g id="edge5" class="edge">
<title>Node5&#45;&gt;Node3</title>
<path fill="none" stroke="midnightblue" d="M254.41,-38.57C272.71,-60.7 318.22,-115.71 341.8,-144.23"/>
<polygon fill="midnightblue" stroke="midnightblue" points="339.29,-146.69 348.36,-152.16 344.69,-142.23 339.29,-146.69"/>
</g>
<!-- Node6 -->
<g id="node6" class="node">
<title>Node6</title>
<g id="a_node6"><a xlink:href="../../d2/df6/kohonen__som__topology_8c.html#adc22d512c00a9f5799ee067f4fb90b4b" target="_top" xlink:title="Get minimum value and index of the value in a matrix.">
<polygon fill="white" stroke="black" points="324,-19.5 324,-38.5 391,-38.5 391,-19.5 324,-19.5"/>
<text text-anchor="middle" x="357.5" y="-26.5" font-family="Helvetica,sans-Serif" font-size="10.00">get_min_2d</text>
</a>
</g>
</g>
<!-- Node5&#45;&gt;Node6 -->
<g id="edge6" class="edge">
<title>Node5&#45;&gt;Node6</title>
<path fill="none" stroke="midnightblue" d="M288.09,-29C296.48,-29 305.31,-29 313.74,-29"/>
<polygon fill="midnightblue" stroke="midnightblue" points="313.77,-32.5 323.77,-29 313.77,-25.5 313.77,-32.5"/>
</g>
<!-- Node8&#45;&gt;Node3 -->
<g id="edge9" class="edge">
<title>Node8&#45;&gt;Node3</title>
<path fill="none" stroke="midnightblue" d="M285.59,-162C297.41,-162 310.3,-162 321.81,-162"/>
<polygon fill="midnightblue" stroke="midnightblue" points="321.93,-165.5 331.93,-162 321.93,-158.5 321.93,-165.5"/>
</g>
<!-- Node9&#45;&gt;Node2 -->
<g id="edge11" class="edge">
<title>Node9&#45;&gt;Node2</title>
<path fill="none" stroke="midnightblue" d="M167.3,-116.93C180.75,-114.85 195.27,-112.6 208.05,-110.63"/>
<polygon fill="midnightblue" stroke="midnightblue" points="208.96,-114.03 218.31,-109.05 207.89,-107.11 208.96,-114.03"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 8.6 KiB

View File

@ -0,0 +1,11 @@
<map id="test1" name="test1">
<area shape="rect" id="node1" title="Test that creates a random set of points distributed in four clusters in 2D space and trains an SOM t..." alt="" coords="5,111,56,137"/>
<area shape="rect" id="node2" href="$d2/df6/kohonen__som__topology_8c.html#af5ce14f026d6d231bef29161bac2b485" title="Helper function to generate a random number in a given interval." alt="" coords="290,111,362,137"/>
<area shape="rect" id="node3" href="$d2/df6/kohonen__som__topology_8c.html#a7237d2cf3b3f9d034477268c1d6631da" title="Function that returns the pointer to (x, y, z) ^th location in the linear 3D array given by:" alt="" coords="441,35,509,61"/>
<area shape="rect" id="node4" href="$d2/df6/kohonen__som__topology_8c.html#a1983dc0f35e734015772e9f8c0ff19f5" title="Apply incremental algorithm with updating neighborhood and learning rates on all samples in the given..." alt="" coords="111,237,214,264"/>
<area shape="rect" id="node7" href="$d2/df6/kohonen__som__topology_8c.html#a6824dc6d973eb3339af7aef5fea78b0c" title="Save a given n&#45;dimensional data martix to file." alt="" coords="111,136,214,163"/>
<area shape="rect" id="node8" href="$d2/df6/kohonen__som__topology_8c.html#adee1bc3871c881f6e04cb9e0b1d01158" title="Create the distance matrix or U&#45;matrix from the trained weights and save to disk." alt="" coords="273,35,379,61"/>
<area shape="rect" id="node9" href="$d2/df6/kohonen__som__topology_8c.html#adb5ded007be1fd666fab9affe6764018" title="Creates a random set of points distributed in four clusters in 3D space with centroids at the points." alt="" coords="104,85,221,112"/>
<area shape="rect" id="node5" href="$d2/df6/kohonen__som__topology_8c.html#ad139de302fa8135a433d9c1bf971b13b" title="Update weights of the SOM using Kohonen algorithm." alt="" coords="269,212,383,239"/>
<area shape="rect" id="node6" href="$d2/df6/kohonen__som__topology_8c.html#adc22d512c00a9f5799ee067f4fb90b4b" title="Get minimum value and index of the value in a matrix." alt="" coords="431,212,520,239"/>
</map>

View File

@ -0,0 +1 @@
9d86639866cabe777a0e2f4bcb0aece3

View File

@ -0,0 +1,160 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.44.0 (20200408.0750)
-->
<!-- Title: test1 Pages: 1 -->
<svg width="394pt" height="202pt"
viewBox="0.00 0.00 394.00 202.02" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 198.02)">
<title>test1</title>
<polygon fill="white" stroke="transparent" points="-4,4 -4,-198.02 390,-198.02 390,4 -4,4"/>
<!-- Node1 -->
<g id="node1" class="node">
<title>Node1</title>
<g id="a_node1"><a xlink:title="Test that creates a random set of points distributed in four clusters in 2D space and trains an SOM t...">
<polygon fill="#bfbfbf" stroke="black" points="0,-95.5 0,-114.5 38,-114.5 38,-95.5 0,-95.5"/>
<text text-anchor="middle" x="19" y="-102.5" font-family="Helvetica,sans-Serif" font-size="10.00">test1</text>
</a>
</g>
</g>
<!-- Node2 -->
<g id="node2" class="node">
<title>Node2</title>
<g id="a_node2"><a xlink:href="../../d2/df6/kohonen__som__topology_8c.html#af5ce14f026d6d231bef29161bac2b485" target="_top" xlink:title="Helper function to generate a random number in a given interval.">
<polygon fill="white" stroke="black" points="213.5,-95.5 213.5,-114.5 267.5,-114.5 267.5,-95.5 213.5,-95.5"/>
<text text-anchor="middle" x="240.5" y="-102.5" font-family="Helvetica,sans-Serif" font-size="10.00">_random</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node2 -->
<g id="edge1" class="edge">
<title>Node1&#45;&gt;Node2</title>
<path fill="none" stroke="midnightblue" d="M29.71,-95.31C39.79,-86 56.51,-72.54 74,-67 111.29,-55.2 123.9,-58.16 162,-67 181.28,-71.47 201.29,-81.44 216.15,-90.05"/>
<polygon fill="midnightblue" stroke="midnightblue" points="214.74,-93.28 225.11,-95.44 218.35,-87.29 214.74,-93.28"/>
</g>
<!-- Node3 -->
<g id="node3" class="node">
<title>Node3</title>
<g id="a_node3"><a xlink:href="../../d2/df6/kohonen__som__topology_8c.html#a7237d2cf3b3f9d034477268c1d6631da" target="_top" xlink:title="Function that returns the pointer to (x, y, z) ^th location in the linear 3D array given by:">
<polygon fill="white" stroke="black" points="327,-152.5 327,-171.5 378,-171.5 378,-152.5 327,-152.5"/>
<text text-anchor="middle" x="352.5" y="-159.5" font-family="Helvetica,sans-Serif" font-size="10.00">data_3d</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node3 -->
<g id="edge2" class="edge">
<title>Node1&#45;&gt;Node3</title>
<path fill="none" stroke="midnightblue" d="M25.55,-114.63C34.04,-128.38 51.66,-153.28 74,-165 156.5,-208.28 190.69,-193.56 283,-181 294.21,-179.47 306.18,-176.6 316.93,-173.55"/>
<polygon fill="midnightblue" stroke="midnightblue" points="318.21,-176.82 326.79,-170.6 316.2,-170.11 318.21,-176.82"/>
</g>
<!-- Node4 -->
<g id="node4" class="node">
<title>Node4</title>
<g id="a_node4"><a xlink:href="../../d2/df6/kohonen__som__topology_8c.html#a1983dc0f35e734015772e9f8c0ff19f5" target="_top" xlink:title="Apply incremental algorithm with updating neighborhood and learning rates on all samples in the given...">
<polygon fill="white" stroke="black" points="79.5,-0.5 79.5,-19.5 156.5,-19.5 156.5,-0.5 79.5,-0.5"/>
<text text-anchor="middle" x="118" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">kohonen_som</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node4 -->
<g id="edge3" class="edge">
<title>Node1&#45;&gt;Node4</title>
<path fill="none" stroke="midnightblue" d="M25.59,-95.26C34.4,-80.57 52.71,-52.47 74,-34 77.93,-30.59 82.43,-27.44 87,-24.62"/>
<polygon fill="midnightblue" stroke="midnightblue" points="88.8,-27.63 95.75,-19.63 85.33,-21.54 88.8,-27.63"/>
</g>
<!-- Node7 -->
<g id="node7" class="node">
<title>Node7</title>
<g id="a_node7"><a xlink:href="../../d2/df6/kohonen__som__topology_8c.html#a6824dc6d973eb3339af7aef5fea78b0c" target="_top" xlink:title="Save a given n&#45;dimensional data martix to file.">
<polygon fill="white" stroke="black" points="79.5,-76.5 79.5,-95.5 156.5,-95.5 156.5,-76.5 79.5,-76.5"/>
<text text-anchor="middle" x="118" y="-83.5" font-family="Helvetica,sans-Serif" font-size="10.00">save_2d_data</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node7 -->
<g id="edge7" class="edge">
<title>Node1&#45;&gt;Node7</title>
<path fill="none" stroke="midnightblue" d="M38.24,-101.43C47.07,-99.7 58.12,-97.53 69.12,-95.38"/>
<polygon fill="midnightblue" stroke="midnightblue" points="70.01,-98.77 79.15,-93.41 68.67,-91.9 70.01,-98.77"/>
</g>
<!-- Node8 -->
<g id="node8" class="node">
<title>Node8</title>
<g id="a_node8"><a xlink:href="../../d2/df6/kohonen__som__topology_8c.html#adee1bc3871c881f6e04cb9e0b1d01158" target="_top" xlink:title="Create the distance matrix or U&#45;matrix from the trained weights and save to disk.">
<polygon fill="white" stroke="black" points="200.5,-152.5 200.5,-171.5 280.5,-171.5 280.5,-152.5 200.5,-152.5"/>
<text text-anchor="middle" x="240.5" y="-159.5" font-family="Helvetica,sans-Serif" font-size="10.00">save_u_matrix</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node8 -->
<g id="edge8" class="edge">
<title>Node1&#45;&gt;Node8</title>
<path fill="none" stroke="midnightblue" d="M30.24,-114.61C40.47,-123.59 57.07,-136.56 74,-143 111.35,-157.22 156.61,-161.62 190.35,-162.67"/>
<polygon fill="midnightblue" stroke="midnightblue" points="190.36,-166.17 200.43,-162.89 190.51,-159.17 190.36,-166.17"/>
</g>
<!-- Node9 -->
<g id="node9" class="node">
<title>Node9</title>
<g id="a_node9"><a xlink:href="../../d2/df6/kohonen__som__topology_8c.html#adb5ded007be1fd666fab9affe6764018" target="_top" xlink:title="Creates a random set of points distributed in four clusters in 3D space with centroids at the points.">
<polygon fill="white" stroke="black" points="74,-114.5 74,-133.5 162,-133.5 162,-114.5 74,-114.5"/>
<text text-anchor="middle" x="118" y="-121.5" font-family="Helvetica,sans-Serif" font-size="10.00">test_2d_classes</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node9 -->
<g id="edge10" class="edge">
<title>Node1&#45;&gt;Node9</title>
<path fill="none" stroke="midnightblue" d="M38.24,-108.57C45.66,-110.03 54.65,-111.79 63.86,-113.59"/>
<polygon fill="midnightblue" stroke="midnightblue" points="63.39,-117.07 73.88,-115.55 64.74,-110.2 63.39,-117.07"/>
</g>
<!-- Node5 -->
<g id="node5" class="node">
<title>Node5</title>
<g id="a_node5"><a xlink:href="../../d2/df6/kohonen__som__topology_8c.html#ad139de302fa8135a433d9c1bf971b13b" target="_top" xlink:title="Update weights of the SOM using Kohonen algorithm.">
<polygon fill="white" stroke="black" points="198,-19.5 198,-38.5 283,-38.5 283,-19.5 198,-19.5"/>
<text text-anchor="middle" x="240.5" y="-26.5" font-family="Helvetica,sans-Serif" font-size="10.00">update_weights</text>
</a>
</g>
</g>
<!-- Node4&#45;&gt;Node5 -->
<g id="edge4" class="edge">
<title>Node4&#45;&gt;Node5</title>
<path fill="none" stroke="midnightblue" d="M156.8,-15.96C166.53,-17.49 177.17,-19.17 187.49,-20.8"/>
<polygon fill="midnightblue" stroke="midnightblue" points="187.23,-24.3 197.65,-22.4 188.32,-17.39 187.23,-24.3"/>
</g>
<!-- Node5&#45;&gt;Node3 -->
<g id="edge5" class="edge">
<title>Node5&#45;&gt;Node3</title>
<path fill="none" stroke="midnightblue" d="M249.41,-38.57C267.71,-60.7 313.22,-115.71 336.8,-144.23"/>
<polygon fill="midnightblue" stroke="midnightblue" points="334.29,-146.69 343.36,-152.16 339.69,-142.23 334.29,-146.69"/>
</g>
<!-- Node6 -->
<g id="node6" class="node">
<title>Node6</title>
<g id="a_node6"><a xlink:href="../../d2/df6/kohonen__som__topology_8c.html#adc22d512c00a9f5799ee067f4fb90b4b" target="_top" xlink:title="Get minimum value and index of the value in a matrix.">
<polygon fill="white" stroke="black" points="319,-19.5 319,-38.5 386,-38.5 386,-19.5 319,-19.5"/>
<text text-anchor="middle" x="352.5" y="-26.5" font-family="Helvetica,sans-Serif" font-size="10.00">get_min_2d</text>
</a>
</g>
</g>
<!-- Node5&#45;&gt;Node6 -->
<g id="edge6" class="edge">
<title>Node5&#45;&gt;Node6</title>
<path fill="none" stroke="midnightblue" d="M283.09,-29C291.48,-29 300.31,-29 308.74,-29"/>
<polygon fill="midnightblue" stroke="midnightblue" points="308.77,-32.5 318.77,-29 308.77,-25.5 308.77,-32.5"/>
</g>
<!-- Node8&#45;&gt;Node3 -->
<g id="edge9" class="edge">
<title>Node8&#45;&gt;Node3</title>
<path fill="none" stroke="midnightblue" d="M280.59,-162C292.41,-162 305.3,-162 316.81,-162"/>
<polygon fill="midnightblue" stroke="midnightblue" points="316.93,-165.5 326.93,-162 316.93,-158.5 316.93,-165.5"/>
</g>
<!-- Node9&#45;&gt;Node2 -->
<g id="edge11" class="edge">
<title>Node9&#45;&gt;Node2</title>
<path fill="none" stroke="midnightblue" d="M162.16,-117.19C175.7,-115.06 190.49,-112.73 203.47,-110.68"/>
<polygon fill="midnightblue" stroke="midnightblue" points="204.11,-114.12 213.44,-109.11 203.02,-107.21 204.11,-114.12"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 8.6 KiB

View File

@ -1,6 +1,6 @@
<map id="kohonen_som" name="kohonen_som">
<area shape="rect" id="node1" title=" " alt="" coords="5,31,108,57"/>
<area shape="rect" id="node2" href="$d2/df6/kohonen__som__topology_8c.html#ad139de302fa8135a433d9c1bf971b13b" title=" " alt="" coords="156,31,269,57"/>
<area shape="rect" id="node3" href="$d2/df6/kohonen__som__topology_8c.html#a7237d2cf3b3f9d034477268c1d6631da" title=" " alt="" coords="328,5,396,32"/>
<area shape="rect" id="node4" href="$d2/df6/kohonen__som__topology_8c.html#adc22d512c00a9f5799ee067f4fb90b4b" title=" " alt="" coords="317,56,407,83"/>
<area shape="rect" id="node1" title="Apply incremental algorithm with updating neighborhood and learning rates on all samples in the given..." alt="" coords="5,31,108,57"/>
<area shape="rect" id="node2" href="$d2/df6/kohonen__som__topology_8c.html#ad139de302fa8135a433d9c1bf971b13b" title="Update weights of the SOM using Kohonen algorithm." alt="" coords="156,31,269,57"/>
<area shape="rect" id="node3" href="$d2/df6/kohonen__som__topology_8c.html#a7237d2cf3b3f9d034477268c1d6631da" title="Function that returns the pointer to (x, y, z) ^th location in the linear 3D array given by:" alt="" coords="328,5,396,32"/>
<area shape="rect" id="node4" href="$d2/df6/kohonen__som__topology_8c.html#adc22d512c00a9f5799ee067f4fb90b4b" title="Get minimum value and index of the value in a matrix." alt="" coords="317,56,407,83"/>
</map>

View File

@ -1 +1 @@
32796a7eeeed8ad131219c20930cbdb0
ebe7a43578ca359380c31555bbb7e3eb

View File

@ -12,7 +12,7 @@
<!-- Node1 -->
<g id="node1" class="node">
<title>Node1</title>
<g id="a_node1"><a xlink:title=" ">
<g id="a_node1"><a xlink:title="Apply incremental algorithm with updating neighborhood and learning rates on all samples in the given...">
<polygon fill="#bfbfbf" stroke="black" points="0,-19.5 0,-38.5 77,-38.5 77,-19.5 0,-19.5"/>
<text text-anchor="middle" x="38.5" y="-26.5" font-family="Helvetica,sans-Serif" font-size="10.00">kohonen_som</text>
</a>
@ -21,7 +21,7 @@
<!-- Node2 -->
<g id="node2" class="node">
<title>Node2</title>
<g id="a_node2"><a xlink:href="../../d2/df6/kohonen__som__topology_8c.html#ad139de302fa8135a433d9c1bf971b13b" target="_top" xlink:title=" ">
<g id="a_node2"><a xlink:href="../../d2/df6/kohonen__som__topology_8c.html#ad139de302fa8135a433d9c1bf971b13b" target="_top" xlink:title="Update weights of the SOM using Kohonen algorithm.">
<polygon fill="white" stroke="black" points="113,-19.5 113,-38.5 198,-38.5 198,-19.5 113,-19.5"/>
<text text-anchor="middle" x="155.5" y="-26.5" font-family="Helvetica,sans-Serif" font-size="10.00">update_weights</text>
</a>
@ -36,7 +36,7 @@
<!-- Node3 -->
<g id="node3" class="node">
<title>Node3</title>
<g id="a_node3"><a xlink:href="../../d2/df6/kohonen__som__topology_8c.html#a7237d2cf3b3f9d034477268c1d6631da" target="_top" xlink:title=" ">
<g id="a_node3"><a xlink:href="../../d2/df6/kohonen__som__topology_8c.html#a7237d2cf3b3f9d034477268c1d6631da" target="_top" xlink:title="Function that returns the pointer to (x, y, z) ^th location in the linear 3D array given by:">
<polygon fill="white" stroke="black" points="242,-38.5 242,-57.5 293,-57.5 293,-38.5 242,-38.5"/>
<text text-anchor="middle" x="267.5" y="-45.5" font-family="Helvetica,sans-Serif" font-size="10.00">data_3d</text>
</a>
@ -51,7 +51,7 @@
<!-- Node4 -->
<g id="node4" class="node">
<title>Node4</title>
<g id="a_node4"><a xlink:href="../../d2/df6/kohonen__som__topology_8c.html#adc22d512c00a9f5799ee067f4fb90b4b" target="_top" xlink:title=" ">
<g id="a_node4"><a xlink:href="../../d2/df6/kohonen__som__topology_8c.html#adc22d512c00a9f5799ee067f4fb90b4b" target="_top" xlink:title="Get minimum value and index of the value in a matrix.">
<polygon fill="white" stroke="black" points="234,-0.5 234,-19.5 301,-19.5 301,-0.5 234,-0.5"/>
<text text-anchor="middle" x="267.5" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">get_min_2d</text>
</a>

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@ -0,0 +1,4 @@
<map id="test_3d_classes2" name="test_3d_classes2">
<area shape="rect" id="node1" title="Creates a random set of points distributed in four clusters in 3D space with centroids at the points." alt="" coords="5,5,129,32"/>
<area shape="rect" id="node2" href="$d2/df6/kohonen__som__topology_8c.html#af5ce14f026d6d231bef29161bac2b485" title="Helper function to generate a random number in a given interval." alt="" coords="177,5,249,32"/>
</map>

View File

@ -0,0 +1 @@
c7b68f9a8da0f9137833575c39d8c0ba

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.44.0 (20200408.0750)
-->
<!-- Title: test_3d_classes2 Pages: 1 -->
<svg width="191pt" height="28pt"
viewBox="0.00 0.00 191.00 28.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 24)">
<title>test_3d_classes2</title>
<polygon fill="white" stroke="transparent" points="-4,4 -4,-24 187,-24 187,4 -4,4"/>
<!-- Node1 -->
<g id="node1" class="node">
<title>Node1</title>
<g id="a_node1"><a xlink:title="Creates a random set of points distributed in four clusters in 3D space with centroids at the points.">
<polygon fill="#bfbfbf" stroke="black" points="0,-0.5 0,-19.5 93,-19.5 93,-0.5 0,-0.5"/>
<text text-anchor="middle" x="46.5" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">test_3d_classes2</text>
</a>
</g>
</g>
<!-- Node2 -->
<g id="node2" class="node">
<title>Node2</title>
<g id="a_node2"><a xlink:href="../../d2/df6/kohonen__som__topology_8c.html#af5ce14f026d6d231bef29161bac2b485" target="_top" xlink:title="Helper function to generate a random number in a given interval.">
<polygon fill="white" stroke="black" points="129,-0.5 129,-19.5 183,-19.5 183,-0.5 129,-0.5"/>
<text text-anchor="middle" x="156" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">_random</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node2 -->
<g id="edge1" class="edge">
<title>Node1&#45;&gt;Node2</title>
<path fill="none" stroke="midnightblue" d="M93.09,-10C101.7,-10 110.6,-10 118.87,-10"/>
<polygon fill="midnightblue" stroke="midnightblue" points="118.94,-13.5 128.94,-10 118.94,-6.5 118.94,-13.5"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -0,0 +1,11 @@
<map id="test3" name="test3">
<area shape="rect" id="node1" title="Test that creates a random set of points distributed in eight clusters in 3D space and trains an SOM ..." alt="" coords="5,112,56,139"/>
<area shape="rect" id="node2" href="$d2/df6/kohonen__som__topology_8c.html#af5ce14f026d6d231bef29161bac2b485" title="Helper function to generate a random number in a given interval." alt="" coords="297,112,369,139"/>
<area shape="rect" id="node3" href="$d2/df6/kohonen__som__topology_8c.html#a7237d2cf3b3f9d034477268c1d6631da" title="Function that returns the pointer to (x, y, z) ^th location in the linear 3D array given by:" alt="" coords="448,36,516,63"/>
<area shape="rect" id="node4" href="$d2/df6/kohonen__som__topology_8c.html#a1983dc0f35e734015772e9f8c0ff19f5" title="Apply incremental algorithm with updating neighborhood and learning rates on all samples in the given..." alt="" coords="115,239,217,265"/>
<area shape="rect" id="node7" href="$d2/df6/kohonen__som__topology_8c.html#a6824dc6d973eb3339af7aef5fea78b0c" title="Save a given n&#45;dimensional data martix to file." alt="" coords="115,137,217,164"/>
<area shape="rect" id="node8" href="$d2/df6/kohonen__som__topology_8c.html#adee1bc3871c881f6e04cb9e0b1d01158" title="Create the distance matrix or U&#45;matrix from the trained weights and save to disk." alt="" coords="279,36,386,63"/>
<area shape="rect" id="node9" href="$d2/df6/kohonen__som__topology_8c.html#a5bb02a8322d717ead1b11182c5f02a3a" title="Creates a random set of points distributed in four clusters in 3D space with centroids at the points." alt="" coords="104,87,228,113"/>
<area shape="rect" id="node5" href="$d2/df6/kohonen__som__topology_8c.html#ad139de302fa8135a433d9c1bf971b13b" title="Update weights of the SOM using Kohonen algorithm." alt="" coords="276,213,389,240"/>
<area shape="rect" id="node6" href="$d2/df6/kohonen__som__topology_8c.html#adc22d512c00a9f5799ee067f4fb90b4b" title="Get minimum value and index of the value in a matrix." alt="" coords="437,213,527,240"/>
</map>

View File

@ -0,0 +1 @@
77ccc6127aeb7c1c83c335aed6bb1d03

View File

@ -0,0 +1,160 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.44.0 (20200408.0750)
-->
<!-- Title: test3 Pages: 1 -->
<svg width="399pt" height="203pt"
viewBox="0.00 0.00 399.00 202.90" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 198.9)">
<title>test3</title>
<polygon fill="white" stroke="transparent" points="-4,4 -4,-198.9 395,-198.9 395,4 -4,4"/>
<!-- Node1 -->
<g id="node1" class="node">
<title>Node1</title>
<g id="a_node1"><a xlink:title="Test that creates a random set of points distributed in eight clusters in 3D space and trains an SOM ...">
<polygon fill="#bfbfbf" stroke="black" points="0,-95.5 0,-114.5 38,-114.5 38,-95.5 0,-95.5"/>
<text text-anchor="middle" x="19" y="-102.5" font-family="Helvetica,sans-Serif" font-size="10.00">test3</text>
</a>
</g>
</g>
<!-- Node2 -->
<g id="node2" class="node">
<title>Node2</title>
<g id="a_node2"><a xlink:href="../../d2/df6/kohonen__som__topology_8c.html#af5ce14f026d6d231bef29161bac2b485" target="_top" xlink:title="Helper function to generate a random number in a given interval.">
<polygon fill="white" stroke="black" points="218.5,-95.5 218.5,-114.5 272.5,-114.5 272.5,-95.5 218.5,-95.5"/>
<text text-anchor="middle" x="245.5" y="-102.5" font-family="Helvetica,sans-Serif" font-size="10.00">_random</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node2 -->
<g id="edge1" class="edge">
<title>Node1&#45;&gt;Node2</title>
<path fill="none" stroke="midnightblue" d="M29.71,-95.31C39.79,-86 56.51,-72.54 74,-67 113.41,-54.52 126.74,-57.66 167,-67 186.28,-71.47 206.29,-81.44 221.15,-90.05"/>
<polygon fill="midnightblue" stroke="midnightblue" points="219.74,-93.28 230.11,-95.44 223.35,-87.29 219.74,-93.28"/>
</g>
<!-- Node3 -->
<g id="node3" class="node">
<title>Node3</title>
<g id="a_node3"><a xlink:href="../../d2/df6/kohonen__som__topology_8c.html#a7237d2cf3b3f9d034477268c1d6631da" target="_top" xlink:title="Function that returns the pointer to (x, y, z) ^th location in the linear 3D array given by:">
<polygon fill="white" stroke="black" points="332,-152.5 332,-171.5 383,-171.5 383,-152.5 332,-152.5"/>
<text text-anchor="middle" x="357.5" y="-159.5" font-family="Helvetica,sans-Serif" font-size="10.00">data_3d</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node3 -->
<g id="edge2" class="edge">
<title>Node1&#45;&gt;Node3</title>
<path fill="none" stroke="midnightblue" d="M25.48,-114.82C33.9,-128.85 51.43,-154.22 74,-166 158.53,-210.11 193.53,-193.86 288,-181 299.21,-179.47 311.18,-176.6 321.93,-173.55"/>
<polygon fill="midnightblue" stroke="midnightblue" points="323.21,-176.82 331.79,-170.6 321.2,-170.11 323.21,-176.82"/>
</g>
<!-- Node4 -->
<g id="node4" class="node">
<title>Node4</title>
<g id="a_node4"><a xlink:href="../../d2/df6/kohonen__som__topology_8c.html#a1983dc0f35e734015772e9f8c0ff19f5" target="_top" xlink:title="Apply incremental algorithm with updating neighborhood and learning rates on all samples in the given...">
<polygon fill="white" stroke="black" points="82,-0.5 82,-19.5 159,-19.5 159,-0.5 82,-0.5"/>
<text text-anchor="middle" x="120.5" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">kohonen_som</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node4 -->
<g id="edge3" class="edge">
<title>Node1&#45;&gt;Node4</title>
<path fill="none" stroke="midnightblue" d="M25.54,-95.2C34.28,-80.42 52.5,-52.22 74,-34 78.07,-30.55 82.72,-27.41 87.45,-24.61"/>
<polygon fill="midnightblue" stroke="midnightblue" points="89.41,-27.53 96.53,-19.68 86.07,-21.38 89.41,-27.53"/>
</g>
<!-- Node7 -->
<g id="node7" class="node">
<title>Node7</title>
<g id="a_node7"><a xlink:href="../../d2/df6/kohonen__som__topology_8c.html#a6824dc6d973eb3339af7aef5fea78b0c" target="_top" xlink:title="Save a given n&#45;dimensional data martix to file.">
<polygon fill="white" stroke="black" points="82,-76.5 82,-95.5 159,-95.5 159,-76.5 82,-76.5"/>
<text text-anchor="middle" x="120.5" y="-83.5" font-family="Helvetica,sans-Serif" font-size="10.00">save_2d_data</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node7 -->
<g id="edge7" class="edge">
<title>Node1&#45;&gt;Node7</title>
<path fill="none" stroke="midnightblue" d="M38.25,-101.52C47.8,-99.69 59.99,-97.36 72.01,-95.07"/>
<polygon fill="midnightblue" stroke="midnightblue" points="72.83,-98.48 81.99,-93.16 71.52,-91.6 72.83,-98.48"/>
</g>
<!-- Node8 -->
<g id="node8" class="node">
<title>Node8</title>
<g id="a_node8"><a xlink:href="../../d2/df6/kohonen__som__topology_8c.html#adee1bc3871c881f6e04cb9e0b1d01158" target="_top" xlink:title="Create the distance matrix or U&#45;matrix from the trained weights and save to disk.">
<polygon fill="white" stroke="black" points="205.5,-152.5 205.5,-171.5 285.5,-171.5 285.5,-152.5 205.5,-152.5"/>
<text text-anchor="middle" x="245.5" y="-159.5" font-family="Helvetica,sans-Serif" font-size="10.00">save_u_matrix</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node8 -->
<g id="edge8" class="edge">
<title>Node1&#45;&gt;Node8</title>
<path fill="none" stroke="midnightblue" d="M30.24,-114.62C40.46,-123.61 57.06,-136.58 74,-143 112.87,-157.72 160.03,-162.04 194.89,-162.92"/>
<polygon fill="midnightblue" stroke="midnightblue" points="195.24,-166.43 205.3,-163.09 195.35,-159.43 195.24,-166.43"/>
</g>
<!-- Node9 -->
<g id="node9" class="node">
<title>Node9</title>
<g id="a_node9"><a xlink:href="../../d2/df6/kohonen__som__topology_8c.html#a5bb02a8322d717ead1b11182c5f02a3a" target="_top" xlink:title="Creates a random set of points distributed in four clusters in 3D space with centroids at the points.">
<polygon fill="white" stroke="black" points="74,-114.5 74,-133.5 167,-133.5 167,-114.5 74,-114.5"/>
<text text-anchor="middle" x="120.5" y="-121.5" font-family="Helvetica,sans-Serif" font-size="10.00">test_3d_classes2</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node9 -->
<g id="edge10" class="edge">
<title>Node1&#45;&gt;Node9</title>
<path fill="none" stroke="midnightblue" d="M38.25,-108.48C45.58,-109.89 54.47,-111.58 63.64,-113.33"/>
<polygon fill="midnightblue" stroke="midnightblue" points="63.15,-116.8 73.63,-115.24 64.47,-109.93 63.15,-116.8"/>
</g>
<!-- Node5 -->
<g id="node5" class="node">
<title>Node5</title>
<g id="a_node5"><a xlink:href="../../d2/df6/kohonen__som__topology_8c.html#ad139de302fa8135a433d9c1bf971b13b" target="_top" xlink:title="Update weights of the SOM using Kohonen algorithm.">
<polygon fill="white" stroke="black" points="203,-19.5 203,-38.5 288,-38.5 288,-19.5 203,-19.5"/>
<text text-anchor="middle" x="245.5" y="-26.5" font-family="Helvetica,sans-Serif" font-size="10.00">update_weights</text>
</a>
</g>
</g>
<!-- Node4&#45;&gt;Node5 -->
<g id="edge4" class="edge">
<title>Node4&#45;&gt;Node5</title>
<path fill="none" stroke="midnightblue" d="M159.07,-15.8C169.67,-17.44 181.4,-19.25 192.68,-21"/>
<polygon fill="midnightblue" stroke="midnightblue" points="192.45,-24.5 202.87,-22.57 193.52,-17.58 192.45,-24.5"/>
</g>
<!-- Node5&#45;&gt;Node3 -->
<g id="edge5" class="edge">
<title>Node5&#45;&gt;Node3</title>
<path fill="none" stroke="midnightblue" d="M254.41,-38.57C272.71,-60.7 318.22,-115.71 341.8,-144.23"/>
<polygon fill="midnightblue" stroke="midnightblue" points="339.29,-146.69 348.36,-152.16 344.69,-142.23 339.29,-146.69"/>
</g>
<!-- Node6 -->
<g id="node6" class="node">
<title>Node6</title>
<g id="a_node6"><a xlink:href="../../d2/df6/kohonen__som__topology_8c.html#adc22d512c00a9f5799ee067f4fb90b4b" target="_top" xlink:title="Get minimum value and index of the value in a matrix.">
<polygon fill="white" stroke="black" points="324,-19.5 324,-38.5 391,-38.5 391,-19.5 324,-19.5"/>
<text text-anchor="middle" x="357.5" y="-26.5" font-family="Helvetica,sans-Serif" font-size="10.00">get_min_2d</text>
</a>
</g>
</g>
<!-- Node5&#45;&gt;Node6 -->
<g id="edge6" class="edge">
<title>Node5&#45;&gt;Node6</title>
<path fill="none" stroke="midnightblue" d="M288.09,-29C296.48,-29 305.31,-29 313.74,-29"/>
<polygon fill="midnightblue" stroke="midnightblue" points="313.77,-32.5 323.77,-29 313.77,-25.5 313.77,-32.5"/>
</g>
<!-- Node8&#45;&gt;Node3 -->
<g id="edge9" class="edge">
<title>Node8&#45;&gt;Node3</title>
<path fill="none" stroke="midnightblue" d="M285.59,-162C297.41,-162 310.3,-162 321.81,-162"/>
<polygon fill="midnightblue" stroke="midnightblue" points="321.93,-165.5 331.93,-162 321.93,-158.5 321.93,-165.5"/>
</g>
<!-- Node9&#45;&gt;Node2 -->
<g id="edge11" class="edge">
<title>Node9&#45;&gt;Node2</title>
<path fill="none" stroke="midnightblue" d="M167.3,-116.93C180.75,-114.85 195.27,-112.6 208.05,-110.63"/>
<polygon fill="midnightblue" stroke="midnightblue" points="208.96,-114.03 218.31,-109.05 207.89,-107.11 208.96,-114.03"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 8.6 KiB

View File

@ -1,5 +1,5 @@
<map id="update_weights" name="update_weights">
<area shape="rect" id="node1" title=" " alt="" coords="5,31,119,57"/>
<area shape="rect" id="node2" href="$d2/df6/kohonen__som__topology_8c.html#a7237d2cf3b3f9d034477268c1d6631da" title=" " alt="" coords="177,5,245,32"/>
<area shape="rect" id="node3" href="$d2/df6/kohonen__som__topology_8c.html#adc22d512c00a9f5799ee067f4fb90b4b" title=" " alt="" coords="167,56,256,83"/>
<area shape="rect" id="node1" title="Update weights of the SOM using Kohonen algorithm." alt="" coords="5,31,119,57"/>
<area shape="rect" id="node2" href="$d2/df6/kohonen__som__topology_8c.html#a7237d2cf3b3f9d034477268c1d6631da" title="Function that returns the pointer to (x, y, z) ^th location in the linear 3D array given by:" alt="" coords="177,5,245,32"/>
<area shape="rect" id="node3" href="$d2/df6/kohonen__som__topology_8c.html#adc22d512c00a9f5799ee067f4fb90b4b" title="Get minimum value and index of the value in a matrix." alt="" coords="167,56,256,83"/>
</map>

View File

@ -1 +1 @@
07a32f64abe5218c6297b9c47659c7d0
2a3833a94d41d5a641f54b213be0594d

View File

@ -12,7 +12,7 @@
<!-- Node1 -->
<g id="node1" class="node">
<title>Node1</title>
<g id="a_node1"><a xlink:title=" ">
<g id="a_node1"><a xlink:title="Update weights of the SOM using Kohonen algorithm.">
<polygon fill="#bfbfbf" stroke="black" points="0,-19.5 0,-38.5 85,-38.5 85,-19.5 0,-19.5"/>
<text text-anchor="middle" x="42.5" y="-26.5" font-family="Helvetica,sans-Serif" font-size="10.00">update_weights</text>
</a>
@ -21,7 +21,7 @@
<!-- Node2 -->
<g id="node2" class="node">
<title>Node2</title>
<g id="a_node2"><a xlink:href="../../d2/df6/kohonen__som__topology_8c.html#a7237d2cf3b3f9d034477268c1d6631da" target="_top" xlink:title=" ">
<g id="a_node2"><a xlink:href="../../d2/df6/kohonen__som__topology_8c.html#a7237d2cf3b3f9d034477268c1d6631da" target="_top" xlink:title="Function that returns the pointer to (x, y, z) ^th location in the linear 3D array given by:">
<polygon fill="white" stroke="black" points="129,-38.5 129,-57.5 180,-57.5 180,-38.5 129,-38.5"/>
<text text-anchor="middle" x="154.5" y="-45.5" font-family="Helvetica,sans-Serif" font-size="10.00">data_3d</text>
</a>
@ -36,7 +36,7 @@
<!-- Node3 -->
<g id="node3" class="node">
<title>Node3</title>
<g id="a_node3"><a xlink:href="../../d2/df6/kohonen__som__topology_8c.html#adc22d512c00a9f5799ee067f4fb90b4b" target="_top" xlink:title=" ">
<g id="a_node3"><a xlink:href="../../d2/df6/kohonen__som__topology_8c.html#adc22d512c00a9f5799ee067f4fb90b4b" target="_top" xlink:title="Get minimum value and index of the value in a matrix.">
<polygon fill="white" stroke="black" points="121,-0.5 121,-19.5 188,-19.5 188,-0.5 121,-0.5"/>
<text text-anchor="middle" x="154.5" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">get_min_2d</text>
</a>

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -0,0 +1,4 @@
<map id="test_3d_classes1" name="test_3d_classes1">
<area shape="rect" id="node1" title="Creates a random set of points distributed in four clusters in 3D space with centroids at the points." alt="" coords="5,5,129,32"/>
<area shape="rect" id="node2" href="$d2/df6/kohonen__som__topology_8c.html#af5ce14f026d6d231bef29161bac2b485" title="Helper function to generate a random number in a given interval." alt="" coords="177,5,249,32"/>
</map>

View File

@ -0,0 +1 @@
862607947e449b8b4fdf4896e190417e

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.44.0 (20200408.0750)
-->
<!-- Title: test_3d_classes1 Pages: 1 -->
<svg width="191pt" height="28pt"
viewBox="0.00 0.00 191.00 28.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 24)">
<title>test_3d_classes1</title>
<polygon fill="white" stroke="transparent" points="-4,4 -4,-24 187,-24 187,4 -4,4"/>
<!-- Node1 -->
<g id="node1" class="node">
<title>Node1</title>
<g id="a_node1"><a xlink:title="Creates a random set of points distributed in four clusters in 3D space with centroids at the points.">
<polygon fill="#bfbfbf" stroke="black" points="0,-0.5 0,-19.5 93,-19.5 93,-0.5 0,-0.5"/>
<text text-anchor="middle" x="46.5" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">test_3d_classes1</text>
</a>
</g>
</g>
<!-- Node2 -->
<g id="node2" class="node">
<title>Node2</title>
<g id="a_node2"><a xlink:href="../../d2/df6/kohonen__som__topology_8c.html#af5ce14f026d6d231bef29161bac2b485" target="_top" xlink:title="Helper function to generate a random number in a given interval.">
<polygon fill="white" stroke="black" points="129,-0.5 129,-19.5 183,-19.5 183,-0.5 129,-0.5"/>
<text text-anchor="middle" x="156" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">_random</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node2 -->
<g id="edge1" class="edge">
<title>Node1&#45;&gt;Node2</title>
<path fill="none" stroke="midnightblue" d="M93.09,-10C101.7,-10 110.6,-10 118.87,-10"/>
<polygon fill="midnightblue" stroke="midnightblue" points="118.94,-13.5 128.94,-10 118.94,-6.5 118.94,-13.5"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -0,0 +1,4 @@
<map id="test_2d_classes" name="test_2d_classes">
<area shape="rect" id="node1" title="Creates a random set of points distributed in four clusters in 3D space with centroids at the points." alt="" coords="5,5,123,32"/>
<area shape="rect" id="node2" href="$d2/df6/kohonen__som__topology_8c.html#af5ce14f026d6d231bef29161bac2b485" title="Helper function to generate a random number in a given interval." alt="" coords="171,5,243,32"/>
</map>

View File

@ -0,0 +1 @@
93b513d8f4eec82d052fd7d4496ea62d

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.44.0 (20200408.0750)
-->
<!-- Title: test_2d_classes Pages: 1 -->
<svg width="186pt" height="28pt"
viewBox="0.00 0.00 186.00 28.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 24)">
<title>test_2d_classes</title>
<polygon fill="white" stroke="transparent" points="-4,4 -4,-24 182,-24 182,4 -4,4"/>
<!-- Node1 -->
<g id="node1" class="node">
<title>Node1</title>
<g id="a_node1"><a xlink:title="Creates a random set of points distributed in four clusters in 3D space with centroids at the points.">
<polygon fill="#bfbfbf" stroke="black" points="0,-0.5 0,-19.5 88,-19.5 88,-0.5 0,-0.5"/>
<text text-anchor="middle" x="44" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">test_2d_classes</text>
</a>
</g>
</g>
<!-- Node2 -->
<g id="node2" class="node">
<title>Node2</title>
<g id="a_node2"><a xlink:href="../../d2/df6/kohonen__som__topology_8c.html#af5ce14f026d6d231bef29161bac2b485" target="_top" xlink:title="Helper function to generate a random number in a given interval.">
<polygon fill="white" stroke="black" points="124,-0.5 124,-19.5 178,-19.5 178,-0.5 124,-0.5"/>
<text text-anchor="middle" x="151" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">_random</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node2 -->
<g id="edge1" class="edge">
<title>Node1&#45;&gt;Node2</title>
<path fill="none" stroke="midnightblue" d="M88.01,-10C96.53,-10 105.4,-10 113.67,-10"/>
<polygon fill="midnightblue" stroke="midnightblue" points="113.76,-13.5 123.76,-10 113.76,-6.5 113.76,-13.5"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -0,0 +1,4 @@
<map id="save_u_matrix" name="save_u_matrix">
<area shape="rect" id="node1" title="Create the distance matrix or U&#45;matrix from the trained weights and save to disk." alt="" coords="5,5,112,32"/>
<area shape="rect" id="node2" href="$d2/df6/kohonen__som__topology_8c.html#a7237d2cf3b3f9d034477268c1d6631da" title="Function that returns the pointer to (x, y, z) ^th location in the linear 3D array given by:" alt="" coords="160,5,228,32"/>
</map>

View File

@ -0,0 +1 @@
ab93983377112f8269722f9660f83dc5

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.44.0 (20200408.0750)
-->
<!-- Title: save_u_matrix Pages: 1 -->
<svg width="175pt" height="28pt"
viewBox="0.00 0.00 175.00 28.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 24)">
<title>save_u_matrix</title>
<polygon fill="white" stroke="transparent" points="-4,4 -4,-24 171,-24 171,4 -4,4"/>
<!-- Node1 -->
<g id="node1" class="node">
<title>Node1</title>
<g id="a_node1"><a xlink:title="Create the distance matrix or U&#45;matrix from the trained weights and save to disk.">
<polygon fill="#bfbfbf" stroke="black" points="0,-0.5 0,-19.5 80,-19.5 80,-0.5 0,-0.5"/>
<text text-anchor="middle" x="40" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">save_u_matrix</text>
</a>
</g>
</g>
<!-- Node2 -->
<g id="node2" class="node">
<title>Node2</title>
<g id="a_node2"><a xlink:href="../../d2/df6/kohonen__som__topology_8c.html#a7237d2cf3b3f9d034477268c1d6631da" target="_top" xlink:title="Function that returns the pointer to (x, y, z) ^th location in the linear 3D array given by:">
<polygon fill="white" stroke="black" points="116,-0.5 116,-19.5 167,-19.5 167,-0.5 116,-0.5"/>
<text text-anchor="middle" x="141.5" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">data_3d</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node2 -->
<g id="edge1" class="edge">
<title>Node1&#45;&gt;Node2</title>
<path fill="none" stroke="midnightblue" d="M80.04,-10C88.54,-10 97.47,-10 105.79,-10"/>
<polygon fill="midnightblue" stroke="midnightblue" points="105.92,-13.5 115.92,-10 105.92,-6.5 105.92,-13.5"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -96,48 +96,24 @@ $(document).ready(function(){initNavTree('d3/d5a/struct__large__num.html','../..
<div class="title">_large_num Struct Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>dynamically large number
<a href="../../d3/d5a/struct__large__num.html#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-attribs"></a>
Data Fields</h2></td></tr>
<tr class="memitem:afaf353a072cf050ac86ac6e39868bcc9"><td class="memItemLeft" align="right" valign="top">char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d5a/struct__large__num.html#afaf353a072cf050ac86ac6e39868bcc9">digits</a></td></tr>
<tr class="memitem:afaf353a072cf050ac86ac6e39868bcc9"><td class="memItemLeft" align="right" valign="top"><a id="afaf353a072cf050ac86ac6e39868bcc9"></a>
char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d5a/struct__large__num.html#afaf353a072cf050ac86ac6e39868bcc9">digits</a></td></tr>
<tr class="memdesc:afaf353a072cf050ac86ac6e39868bcc9"><td class="mdescLeft">&#160;</td><td class="mdescRight">array to store individual digits <br /></td></tr>
<tr class="separator:afaf353a072cf050ac86ac6e39868bcc9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3fd11c0b413bbabfb8737d4ae73e5aa0"><td class="memItemLeft" align="right" valign="top">unsigned int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d5a/struct__large__num.html#a3fd11c0b413bbabfb8737d4ae73e5aa0">num_digits</a></td></tr>
<tr class="memitem:a3fd11c0b413bbabfb8737d4ae73e5aa0"><td class="memItemLeft" align="right" valign="top"><a id="a3fd11c0b413bbabfb8737d4ae73e5aa0"></a>
unsigned int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d5a/struct__large__num.html#a3fd11c0b413bbabfb8737d4ae73e5aa0">num_digits</a></td></tr>
<tr class="memdesc:a3fd11c0b413bbabfb8737d4ae73e5aa0"><td class="mdescLeft">&#160;</td><td class="mdescRight">number of digits in the number <br /></td></tr>
<tr class="separator:a3fd11c0b413bbabfb8737d4ae73e5aa0"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>dynamically large number </p>
</div><h2 class="groupheader">Field Documentation</h2>
<a id="afaf353a072cf050ac86ac6e39868bcc9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#afaf353a072cf050ac86ac6e39868bcc9">&#9670;&nbsp;</a></span>digits</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">char* _large_num::digits</td>
</tr>
</table>
</div><div class="memdoc">
<p>array to store individual digits </p>
</div>
</div>
<a id="a3fd11c0b413bbabfb8737d4ae73e5aa0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3fd11c0b413bbabfb8737d4ae73e5aa0">&#9670;&nbsp;</a></span>num_digits</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">unsigned int _large_num::num_digits</td>
</tr>
</table>
</div><div class="memdoc">
<p>number of digits in the number </p>
</div>
</div>
<hr/>The documentation for this struct was generated from the following file:<ul>
</div><hr/>The documentation for this struct was generated from the following file:<ul>
<li>misc/<a class="el" href="../../d6/d3d/factorial__large__number_8c.html">factorial_large_number.c</a></li>
</ul>
</div><!-- contents -->

View File

@ -96,6 +96,9 @@ $(document).ready(function(){initNavTree('d4/d02/struct_b_s_t_iterator.html','..
<div class="title">BSTIterator Struct Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>Definition for a binary tree node.
<a href="../../d4/d02/struct_b_s_t_iterator.html#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-attribs"></a>
Data Fields</h2></td></tr>
@ -110,7 +113,8 @@ int&#160;</td><td class="memItemRight" valign="bottom"><b>NumberOfNodes</b></td>
<tr class="separator:ae02c531c71091f43880fd7eb8f13cc53"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Definition for a binary tree node. struct TreeNode { int val; struct TreeNode *left; struct TreeNode *right; }; </p>
<div class="textblock"><p>Definition for a binary tree node. </p>
<p>struct TreeNode { int val; struct TreeNode *left; struct TreeNode *right; }; </p>
</div><hr/>The documentation for this struct was generated from the following file:<ul>
<li>leetcode/src/173.c</li>
</ul>

View File

@ -113,16 +113,18 @@ Include dependency graph for ode_forward_euler.c:</div>
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:a9ceb646336224ee890a269d0b4600d09"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d4/d07/ode__forward__euler_8c.html#a9ceb646336224ee890a269d0b4600d09">order</a>&#160;&#160;&#160;2</td></tr>
<tr class="memitem:a9ceb646336224ee890a269d0b4600d09"><td class="memItemLeft" align="right" valign="top"><a id="a9ceb646336224ee890a269d0b4600d09"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d4/d07/ode__forward__euler_8c.html#a9ceb646336224ee890a269d0b4600d09">order</a>&#160;&#160;&#160;2</td></tr>
<tr class="memdesc:a9ceb646336224ee890a269d0b4600d09"><td class="mdescLeft">&#160;</td><td class="mdescRight">number of dependent variables in <a class="el" href="../../d4/d07/ode__forward__euler_8c.html#a97075291390a68c262ed66e157a57eb4" title="Problem statement for a system with first-order differential equations.">problem</a> <br /></td></tr>
<tr class="separator:a9ceb646336224ee890a269d0b4600d09"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a97075291390a68c262ed66e157a57eb4"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d4/d07/ode__forward__euler_8c.html#a97075291390a68c262ed66e157a57eb4">problem</a> (const double *x, double *y, double *dy)</td></tr>
<tr class="memdesc:a97075291390a68c262ed66e157a57eb4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Problem statement for a system with first-order differential equations. Updates the system differential variables. <a href="../../d4/d07/ode__forward__euler_8c.html#a97075291390a68c262ed66e157a57eb4">More...</a><br /></td></tr>
<tr class="memdesc:a97075291390a68c262ed66e157a57eb4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Problem statement for a system with first-order differential equations. <a href="../../d4/d07/ode__forward__euler_8c.html#a97075291390a68c262ed66e157a57eb4">More...</a><br /></td></tr>
<tr class="separator:a97075291390a68c262ed66e157a57eb4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8caee977b26888d34040b122e0e28e3a"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d4/d07/ode__forward__euler_8c.html#a8caee977b26888d34040b122e0e28e3a">exact_solution</a> (const double *x, double *y)</td></tr>
<tr class="memdesc:a8caee977b26888d34040b122e0e28e3a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Exact solution of the problem. Used for solution comparison. <a href="../../d4/d07/ode__forward__euler_8c.html#a8caee977b26888d34040b122e0e28e3a">More...</a><br /></td></tr>
<tr class="memdesc:a8caee977b26888d34040b122e0e28e3a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Exact solution of the problem. <a href="../../d4/d07/ode__forward__euler_8c.html#a8caee977b26888d34040b122e0e28e3a">More...</a><br /></td></tr>
<tr class="separator:a8caee977b26888d34040b122e0e28e3a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae6c9413953c8d9d4bc9e374b29586350"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d4/d07/ode__forward__euler_8c.html#ae6c9413953c8d9d4bc9e374b29586350">forward_euler_step</a> (const double dx, const double *x, double *y, double *dy)</td></tr>
<tr class="memdesc:ae6c9413953c8d9d4bc9e374b29586350"><td class="mdescLeft">&#160;</td><td class="mdescRight">Compute next step approximation using the forward-Euler method. <a href="../../d4/d07/ode__forward__euler_8c.html#ae6c9413953c8d9d4bc9e374b29586350">More...</a><br /></td></tr>
@ -130,7 +132,9 @@ Functions</h2></td></tr>
<tr class="memitem:aaf88ad8f9f7c39fc38f3f03d6fea9df9"><td class="memItemLeft" align="right" valign="top">double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d4/d07/ode__forward__euler_8c.html#aaf88ad8f9f7c39fc38f3f03d6fea9df9">forward_euler</a> (double dx, double x0, double x_max, double *y, char save_to_file)</td></tr>
<tr class="memdesc:aaf88ad8f9f7c39fc38f3f03d6fea9df9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Compute approximation using the forward-Euler method in the given limits. <a href="../../d4/d07/ode__forward__euler_8c.html#aaf88ad8f9f7c39fc38f3f03d6fea9df9">More...</a><br /></td></tr>
<tr class="separator:aaf88ad8f9f7c39fc38f3f03d6fea9df9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0ddf1224851353fc92bfbff6f499fa97"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d4/d07/ode__forward__euler_8c.html#a0ddf1224851353fc92bfbff6f499fa97">main</a> (int argc, char *argv[])</td></tr>
<tr class="memitem:a0ddf1224851353fc92bfbff6f499fa97"><td class="memItemLeft" align="right" valign="top"><a id="a0ddf1224851353fc92bfbff6f499fa97"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d4/d07/ode__forward__euler_8c.html#a0ddf1224851353fc92bfbff6f499fa97">main</a> (int argc, char *argv[])</td></tr>
<tr class="memdesc:a0ddf1224851353fc92bfbff6f499fa97"><td class="mdescLeft">&#160;</td><td class="mdescRight">Main Function. <br /></td></tr>
<tr class="separator:a0ddf1224851353fc92bfbff6f499fa97"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
@ -143,27 +147,11 @@ Functions</h2></td></tr>
\begin{eqnarray*} u(x) &amp;=&amp; \cos(x)\\ v(x) &amp;=&amp; -\sin(x)\\ \end{eqnarray*}
</p>
<p> The computation results are stored to a text file <code>forward_euler.csv</code> and the exact soltuion results in <code>exact.csv</code> for comparison. <img src="https://raw.githubusercontent.com/TheAlgorithms/C/docs/images/numerical_methods/ode_forward_euler.svg" alt="Implementation solution" style="pointer-events: none;" class="inline"/></p>
<p>To implement <a href="https://en.wikipedia.org/wiki/Van_der_Pol_oscillator">Van der Pol oscillator</a>, change the <a class="el" href="../../d4/d07/ode__forward__euler_8c.html#a97075291390a68c262ed66e157a57eb4" title="Problem statement for a system with first-order differential equations. Updates the system differenti...">problem</a> function to: </p><div class="fragment"><div class="line"><span class="keyword">const</span> <span class="keywordtype">double</span> mu = 2.0;</div>
<p>To implement <a href="https://en.wikipedia.org/wiki/Van_der_Pol_oscillator">Van der Pol oscillator</a>, change the <a class="el" href="../../d4/d07/ode__forward__euler_8c.html#a97075291390a68c262ed66e157a57eb4" title="Problem statement for a system with first-order differential equations.">problem</a> function to: </p><div class="fragment"><div class="line"><span class="keyword">const</span> <span class="keywordtype">double</span> mu = 2.0;</div>
<div class="line">dy[0] = y[1];</div>
<div class="line">dy[1] = mu * (1.f - y[0] * y[0]) * y[1] - y[0];</div>
</div><!-- fragment --><dl class="section see"><dt>See also</dt><dd><a class="el" href="../../d1/dc2/ode__midpoint__euler_8c.html" title="Solve a multivariable first order ordinary differential equation (ODEs) using midpoint Euler method">ode_midpoint_euler.c</a>, <a class="el" href="../../d4/d99/ode__semi__implicit__euler_8c.html" title="Solve a multivariable first order ordinary differential equation (ODEs) using semi implicit Euler met...">ode_semi_implicit_euler.c</a> </dd></dl>
</div><h2 class="groupheader">Macro Definition Documentation</h2>
<a id="a9ceb646336224ee890a269d0b4600d09"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9ceb646336224ee890a269d0b4600d09">&#9670;&nbsp;</a></span>order</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define order&#160;&#160;&#160;2</td>
</tr>
</table>
</div><div class="memdoc">
<p>number of dependent variables in <a class="el" href="../../d4/d07/ode__forward__euler_8c.html#a97075291390a68c262ed66e157a57eb4" title="Problem statement for a system with first-order differential equations. Updates the system differenti...">problem</a> </p>
</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="a8caee977b26888d34040b122e0e28e3a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8caee977b26888d34040b122e0e28e3a">&#9670;&nbsp;</a></span>exact_solution()</h2>
@ -190,7 +178,8 @@ Functions</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Exact solution of the problem. Used for solution comparison. </p>
<p>Exact solution of the problem. </p>
<p>Used for solution comparison.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">x</td><td>independent variable </td></tr>
@ -365,86 +354,6 @@ Here is the call graph for this function:</div>
</div>
</div>
</div>
</div>
<a id="a0ddf1224851353fc92bfbff6f499fa97"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0ddf1224851353fc92bfbff6f499fa97">&#9670;&nbsp;</a></span>main()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int main </td>
<td>(</td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>argc</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char *&#160;</td>
<td class="paramname"><em>argv</em>[]&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Main Function </p>
<div class="fragment"><div class="line"><a name="l00138"></a><span class="lineno"> 138</span>&#160;{</div>
<div class="line"><a name="l00139"></a><span class="lineno"> 139</span>&#160; <span class="keywordtype">double</span> X0 = 0.f; <span class="comment">/* initial value of x0 */</span></div>
<div class="line"><a name="l00140"></a><span class="lineno"> 140</span>&#160; <span class="keywordtype">double</span> X_MAX = 10.F; <span class="comment">/* upper limit of integration */</span></div>
<div class="line"><a name="l00141"></a><span class="lineno"> 141</span>&#160; <span class="keywordtype">double</span> Y0[] = {1.f, 0.f}; <span class="comment">/* initial value Y = y(x = x_0) */</span></div>
<div class="line"><a name="l00142"></a><span class="lineno"> 142</span>&#160; <span class="keywordtype">double</span> step_size;</div>
<div class="line"><a name="l00143"></a><span class="lineno"> 143</span>&#160; </div>
<div class="line"><a name="l00144"></a><span class="lineno"> 144</span>&#160; <span class="keywordflow">if</span> (argc == 1)</div>
<div class="line"><a name="l00145"></a><span class="lineno"> 145</span>&#160; {</div>
<div class="line"><a name="l00146"></a><span class="lineno"> 146</span>&#160; printf(<span class="stringliteral">&quot;\nEnter the step size: &quot;</span>);</div>
<div class="line"><a name="l00147"></a><span class="lineno"> 147</span>&#160; scanf(<span class="stringliteral">&quot;%lg&quot;</span>, &amp;step_size);</div>
<div class="line"><a name="l00148"></a><span class="lineno"> 148</span>&#160; }</div>
<div class="line"><a name="l00149"></a><span class="lineno"> 149</span>&#160; <span class="keywordflow">else</span></div>
<div class="line"><a name="l00150"></a><span class="lineno"> 150</span>&#160; <span class="comment">// use commandline argument as independent variable step size</span></div>
<div class="line"><a name="l00151"></a><span class="lineno"> 151</span>&#160; step_size = atof(argv[1]);</div>
<div class="line"><a name="l00152"></a><span class="lineno"> 152</span>&#160; </div>
<div class="line"><a name="l00153"></a><span class="lineno"> 153</span>&#160; <span class="comment">// get approximate solution</span></div>
<div class="line"><a name="l00154"></a><span class="lineno"> 154</span>&#160; <span class="keywordtype">double</span> total_time = <a class="code" href="../../d4/d07/ode__forward__euler_8c.html#aaf88ad8f9f7c39fc38f3f03d6fea9df9">forward_euler</a>(step_size, X0, X_MAX, Y0, 1);</div>
<div class="line"><a name="l00155"></a><span class="lineno"> 155</span>&#160; printf(<span class="stringliteral">&quot;\tTime = %.6g ms\n&quot;</span>, total_time);</div>
<div class="line"><a name="l00156"></a><span class="lineno"> 156</span>&#160; </div>
<div class="line"><a name="l00157"></a><span class="lineno"> 157</span>&#160; <span class="comment">/* compute exact solution for comparion */</span></div>
<div class="line"><a name="l00158"></a><span class="lineno"> 158</span>&#160; FILE *fp = fopen(<span class="stringliteral">&quot;exact.csv&quot;</span>, <span class="stringliteral">&quot;w+&quot;</span>);</div>
<div class="line"><a name="l00159"></a><span class="lineno"> 159</span>&#160; <span class="keywordflow">if</span> (fp == NULL)</div>
<div class="line"><a name="l00160"></a><span class="lineno"> 160</span>&#160; {</div>
<div class="line"><a name="l00161"></a><span class="lineno"> 161</span>&#160; perror(<span class="stringliteral">&quot;Error! &quot;</span>);</div>
<div class="line"><a name="l00162"></a><span class="lineno"> 162</span>&#160; <span class="keywordflow">return</span> -1;</div>
<div class="line"><a name="l00163"></a><span class="lineno"> 163</span>&#160; }</div>
<div class="line"><a name="l00164"></a><span class="lineno"> 164</span>&#160; <span class="keywordtype">double</span> x = X0;</div>
<div class="line"><a name="l00165"></a><span class="lineno"> 165</span>&#160; <span class="keywordtype">double</span> *y = &amp;(Y0[0]);</div>
<div class="line"><a name="l00166"></a><span class="lineno"> 166</span>&#160; printf(<span class="stringliteral">&quot;Finding exact solution\n&quot;</span>);</div>
<div class="line"><a name="l00167"></a><span class="lineno"> 167</span>&#160; clock_t t1 = clock();</div>
<div class="line"><a name="l00168"></a><span class="lineno"> 168</span>&#160; </div>
<div class="line"><a name="l00169"></a><span class="lineno"> 169</span>&#160; <span class="keywordflow">do</span></div>
<div class="line"><a name="l00170"></a><span class="lineno"> 170</span>&#160; {</div>
<div class="line"><a name="l00171"></a><span class="lineno"> 171</span>&#160; fprintf(fp, <span class="stringliteral">&quot;%.4g,%.4g,%.4g\n&quot;</span>, x, y[0], y[1]); <span class="comment">// write to file</span></div>
<div class="line"><a name="l00172"></a><span class="lineno"> 172</span>&#160; <a class="code" href="../../d4/d07/ode__forward__euler_8c.html#a8caee977b26888d34040b122e0e28e3a">exact_solution</a>(&amp;x, y);</div>
<div class="line"><a name="l00173"></a><span class="lineno"> 173</span>&#160; x += step_size;</div>
<div class="line"><a name="l00174"></a><span class="lineno"> 174</span>&#160; } <span class="keywordflow">while</span> (x &lt;= X_MAX);</div>
<div class="line"><a name="l00175"></a><span class="lineno"> 175</span>&#160; </div>
<div class="line"><a name="l00176"></a><span class="lineno"> 176</span>&#160; clock_t t2 = clock();</div>
<div class="line"><a name="l00177"></a><span class="lineno"> 177</span>&#160; total_time = (t2 - t1) / CLOCKS_PER_SEC;</div>
<div class="line"><a name="l00178"></a><span class="lineno"> 178</span>&#160; printf(<span class="stringliteral">&quot;\tTime = %.6g ms\n&quot;</span>, total_time);</div>
<div class="line"><a name="l00179"></a><span class="lineno"> 179</span>&#160; fclose(fp);</div>
<div class="line"><a name="l00180"></a><span class="lineno"> 180</span>&#160; </div>
<div class="line"><a name="l00181"></a><span class="lineno"> 181</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00182"></a><span class="lineno"> 182</span>&#160;}</div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d4/d07/ode__forward__euler_8c_a0ddf1224851353fc92bfbff6f499fa97_cgraph.svg" width="512" height="88"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
</div>
</div>
</div>
<a id="a97075291390a68c262ed66e157a57eb4"></a>
@ -479,8 +388,8 @@ Here is the call graph for this function:</div>
</table>
</div><div class="memdoc">
<p>Problem statement for a system with first-order differential equations. Updates the system differential variables. </p>
<dl class="section note"><dt>Note</dt><dd>This function can be updated to and ode of any order.</dd></dl>
<p>Problem statement for a system with first-order differential equations. </p>
<p>Updates the system differential variables. </p><dl class="section note"><dt>Note</dt><dd>This function can be updated to and ode of any order.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">x</td><td>independent variable(s) </td></tr>
@ -500,10 +409,8 @@ Here is the call graph for this function:</div>
</div><!-- contents -->
</div><!-- doc-content -->
<div class="ttc" id="aode__forward__euler_8c_html_ae6c9413953c8d9d4bc9e374b29586350"><div class="ttname"><a href="../../d4/d07/ode__forward__euler_8c.html#ae6c9413953c8d9d4bc9e374b29586350">forward_euler_step</a></div><div class="ttdeci">void forward_euler_step(const double dx, const double *x, double *y, double *dy)</div><div class="ttdoc">Compute next step approximation using the forward-Euler method.</div><div class="ttdef"><b>Definition:</b> ode_forward_euler.c:82</div></div>
<div class="ttc" id="aode__forward__euler_8c_html_aaf88ad8f9f7c39fc38f3f03d6fea9df9"><div class="ttname"><a href="../../d4/d07/ode__forward__euler_8c.html#aaf88ad8f9f7c39fc38f3f03d6fea9df9">forward_euler</a></div><div class="ttdeci">double forward_euler(double dx, double x0, double x_max, double *y, char save_to_file)</div><div class="ttdoc">Compute approximation using the forward-Euler method in the given limits.</div><div class="ttdef"><b>Definition:</b> ode_forward_euler.c:99</div></div>
<div class="ttc" id="aode__forward__euler_8c_html_a97075291390a68c262ed66e157a57eb4"><div class="ttname"><a href="../../d4/d07/ode__forward__euler_8c.html#a97075291390a68c262ed66e157a57eb4">problem</a></div><div class="ttdeci">void problem(const double *x, double *y, double *dy)</div><div class="ttdoc">Problem statement for a system with first-order differential equations. Updates the system differenti...</div><div class="ttdef"><b>Definition:</b> ode_forward_euler.c:55</div></div>
<div class="ttc" id="aode__forward__euler_8c_html_a8caee977b26888d34040b122e0e28e3a"><div class="ttname"><a href="../../d4/d07/ode__forward__euler_8c.html#a8caee977b26888d34040b122e0e28e3a">exact_solution</a></div><div class="ttdeci">void exact_solution(const double *x, double *y)</div><div class="ttdoc">Exact solution of the problem. Used for solution comparison.</div><div class="ttdef"><b>Definition:</b> ode_forward_euler.c:68</div></div>
<div class="ttc" id="aode__forward__euler_8c_html_a9ceb646336224ee890a269d0b4600d09"><div class="ttname"><a href="../../d4/d07/ode__forward__euler_8c.html#a9ceb646336224ee890a269d0b4600d09">order</a></div><div class="ttdeci">#define order</div><div class="ttdef"><b>Definition:</b> ode_forward_euler.c:44</div></div>
<div class="ttc" id="aode__forward__euler_8c_html_a97075291390a68c262ed66e157a57eb4"><div class="ttname"><a href="../../d4/d07/ode__forward__euler_8c.html#a97075291390a68c262ed66e157a57eb4">problem</a></div><div class="ttdeci">void problem(const double *x, double *y, double *dy)</div><div class="ttdoc">Problem statement for a system with first-order differential equations.</div><div class="ttdef"><b>Definition:</b> ode_forward_euler.c:55</div></div>
<div class="ttc" id="aode__forward__euler_8c_html_a9ceb646336224ee890a269d0b4600d09"><div class="ttname"><a href="../../d4/d07/ode__forward__euler_8c.html#a9ceb646336224ee890a269d0b4600d09">order</a></div><div class="ttdeci">#define order</div><div class="ttdoc">number of dependent variables in problem</div><div class="ttdef"><b>Definition:</b> ode_forward_euler.c:44</div></div>
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>

View File

@ -1,7 +0,0 @@
<map id="main" name="main">
<area shape="rect" id="node1" title=" " alt="" coords="5,31,56,57"/>
<area shape="rect" id="node2" href="$d4/d07/ode__forward__euler_8c.html#a8caee977b26888d34040b122e0e28e3a" title="Exact solution of the problem. Used for solution comparison." alt="" coords="104,5,211,32"/>
<area shape="rect" id="node3" href="$d4/d07/ode__forward__euler_8c.html#aaf88ad8f9f7c39fc38f3f03d6fea9df9" title="Compute approximation using the forward&#45;Euler method in the given limits." alt="" coords="107,56,207,83"/>
<area shape="rect" id="node4" href="$d4/d07/ode__forward__euler_8c.html#ae6c9413953c8d9d4bc9e374b29586350" title="Compute next step approximation using the forward&#45;Euler method." alt="" coords="259,56,391,83"/>
<area shape="rect" id="node5" href="$d4/d07/ode__forward__euler_8c.html#a97075291390a68c262ed66e157a57eb4" title="Problem statement for a system with first&#45;order differential equations. Updates the system differenti..." alt="" coords="439,56,507,83"/>
</map>

View File

@ -1 +0,0 @@
34fb83027affba576c2e2c74c02db47f

View File

@ -1,82 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.44.0 (20200408.0750)
-->
<!-- Title: main Pages: 1 -->
<svg width="384pt" height="66pt"
viewBox="0.00 0.00 384.00 66.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 62)">
<title>main</title>
<polygon fill="white" stroke="transparent" points="-4,4 -4,-62 380,-62 380,4 -4,4"/>
<!-- Node1 -->
<g id="node1" class="node">
<title>Node1</title>
<g id="a_node1"><a xlink:title=" ">
<polygon fill="#bfbfbf" stroke="black" points="0,-19.5 0,-38.5 38,-38.5 38,-19.5 0,-19.5"/>
<text text-anchor="middle" x="19" y="-26.5" font-family="Helvetica,sans-Serif" font-size="10.00">main</text>
</a>
</g>
</g>
<!-- Node2 -->
<g id="node2" class="node">
<title>Node2</title>
<g id="a_node2"><a xlink:href="../../d4/d07/ode__forward__euler_8c.html#a8caee977b26888d34040b122e0e28e3a" target="_top" xlink:title="Exact solution of the problem. Used for solution comparison.">
<polygon fill="white" stroke="black" points="74,-38.5 74,-57.5 154,-57.5 154,-38.5 74,-38.5"/>
<text text-anchor="middle" x="114" y="-45.5" font-family="Helvetica,sans-Serif" font-size="10.00">exact_solution</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node2 -->
<g id="edge1" class="edge">
<title>Node1&#45;&gt;Node2</title>
<path fill="none" stroke="midnightblue" d="M38.37,-32.75C45.84,-34.28 54.85,-36.12 63.99,-37.99"/>
<polygon fill="midnightblue" stroke="midnightblue" points="63.4,-41.44 73.9,-40.01 64.8,-34.58 63.4,-41.44"/>
</g>
<!-- Node3 -->
<g id="node3" class="node">
<title>Node3</title>
<g id="a_node3"><a xlink:href="../../d4/d07/ode__forward__euler_8c.html#aaf88ad8f9f7c39fc38f3f03d6fea9df9" target="_top" xlink:title="Compute approximation using the forward&#45;Euler method in the given limits.">
<polygon fill="white" stroke="black" points="76.5,-0.5 76.5,-19.5 151.5,-19.5 151.5,-0.5 76.5,-0.5"/>
<text text-anchor="middle" x="114" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">forward_euler</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node3 -->
<g id="edge2" class="edge">
<title>Node1&#45;&gt;Node3</title>
<path fill="none" stroke="midnightblue" d="M38.37,-25.25C46.47,-23.59 56.4,-21.56 66.33,-19.54"/>
<polygon fill="midnightblue" stroke="midnightblue" points="67.1,-22.95 76.2,-17.52 65.7,-16.09 67.1,-22.95"/>
</g>
<!-- Node4 -->
<g id="node4" class="node">
<title>Node4</title>
<g id="a_node4"><a xlink:href="../../d4/d07/ode__forward__euler_8c.html#ae6c9413953c8d9d4bc9e374b29586350" target="_top" xlink:title="Compute next step approximation using the forward&#45;Euler method.">
<polygon fill="white" stroke="black" points="190,-0.5 190,-19.5 289,-19.5 289,-0.5 190,-0.5"/>
<text text-anchor="middle" x="239.5" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">forward_euler_step</text>
</a>
</g>
</g>
<!-- Node3&#45;&gt;Node4 -->
<g id="edge3" class="edge">
<title>Node3&#45;&gt;Node4</title>
<path fill="none" stroke="midnightblue" d="M151.72,-10C160.49,-10 170.08,-10 179.57,-10"/>
<polygon fill="midnightblue" stroke="midnightblue" points="179.79,-13.5 189.79,-10 179.79,-6.5 179.79,-13.5"/>
</g>
<!-- Node5 -->
<g id="node5" class="node">
<title>Node5</title>
<g id="a_node5"><a xlink:href="../../d4/d07/ode__forward__euler_8c.html#a97075291390a68c262ed66e157a57eb4" target="_top" xlink:title="Problem statement for a system with first&#45;order differential equations. Updates the system differenti...">
<polygon fill="white" stroke="black" points="325,-0.5 325,-19.5 376,-19.5 376,-0.5 325,-0.5"/>
<text text-anchor="middle" x="350.5" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">problem</text>
</a>
</g>
</g>
<!-- Node4&#45;&gt;Node5 -->
<g id="edge4" class="edge">
<title>Node4&#45;&gt;Node5</title>
<path fill="none" stroke="midnightblue" d="M289.26,-10C297.85,-10 306.64,-10 314.75,-10"/>
<polygon fill="midnightblue" stroke="midnightblue" points="314.95,-13.5 324.95,-10 314.95,-6.5 314.95,-13.5"/>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 4.1 KiB

View File

@ -1,5 +1,5 @@
<map id="forward_euler" name="forward_euler">
<area shape="rect" id="node1" title="Compute approximation using the forward&#45;Euler method in the given limits." alt="" coords="5,5,105,32"/>
<area shape="rect" id="node2" href="$d4/d07/ode__forward__euler_8c.html#ae6c9413953c8d9d4bc9e374b29586350" title="Compute next step approximation using the forward&#45;Euler method." alt="" coords="153,5,285,32"/>
<area shape="rect" id="node3" href="$d4/d07/ode__forward__euler_8c.html#a97075291390a68c262ed66e157a57eb4" title="Problem statement for a system with first&#45;order differential equations. Updates the system differenti..." alt="" coords="333,5,401,32"/>
<area shape="rect" id="node3" href="$d4/d07/ode__forward__euler_8c.html#a97075291390a68c262ed66e157a57eb4" title="Problem statement for a system with first&#45;order differential equations." alt="" coords="333,5,401,32"/>
</map>

View File

@ -1 +1 @@
562daebf5751d81fd737ae9001e7d3ea
313b1e18b17a02fc3a07286de53db0dd

View File

@ -36,7 +36,7 @@
<!-- Node3 -->
<g id="node3" class="node">
<title>Node3</title>
<g id="a_node3"><a xlink:href="../../d4/d07/ode__forward__euler_8c.html#a97075291390a68c262ed66e157a57eb4" target="_top" xlink:title="Problem statement for a system with first&#45;order differential equations. Updates the system differenti...">
<g id="a_node3"><a xlink:href="../../d4/d07/ode__forward__euler_8c.html#a97075291390a68c262ed66e157a57eb4" target="_top" xlink:title="Problem statement for a system with first&#45;order differential equations.">
<polygon fill="white" stroke="black" points="246,-0.5 246,-19.5 297,-19.5 297,-0.5 246,-0.5"/>
<text text-anchor="middle" x="271.5" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">problem</text>
</a>

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Some files were not shown because too many files have changed in this diff Show More