Include dependency graph for kohonen_som_topology.c:</div>
<divclass="dyncontent">
<divclass="center"><iframescrolling="no"frameborder="0"src="../../dc/dd4/kohonen__som__topology_8c__incl.svg"width="331"height="127"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
<trclass="memdesc:"><tdclass="mdescLeft"> </td><tdclass="mdescRight">to store info regarding 3D arrays <ahref="../../d8/db8/structkohonen__array__3d.html#details">More...</a><br/></td></tr>
<trclass="memdesc:gaffe776513b24d84b39af8ab0930fef7f"><tdclass="mdescLeft"> </td><tdclass="mdescRight">shorthand for maximum value <br/></td></tr>
<trclass="memdesc:gac6afabdc09a49a433ee19d8a9486056d"><tdclass="mdescLeft"> </td><tdclass="mdescRight">shorthand for minimum value <br/></td></tr>
<trclass="memitem:ga8df35f04c1762a01dcf108fa13b897d6"><tdclass="memItemLeft"align="right"valign="top">double * </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="../../d1/d6b/group__kohonen__2d.html#ga8df35f04c1762a01dcf108fa13b897d6">kohonen_data_3d</a> (const struct <aclass="el"href="../../d8/db8/structkohonen__array__3d.html">kohonen_array_3d</a> *arr, int x, int y, int z)</td></tr>
<trclass="memdesc:ga8df35f04c1762a01dcf108fa13b897d6"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Function that returns the pointer to (x, y, z) ^th location in the linear 3D array given by: <ahref="../../d1/d6b/group__kohonen__2d.html#ga8df35f04c1762a01dcf108fa13b897d6">More...</a><br/></td></tr>
<trclass="memitem:gaf5ce14f026d6d231bef29161bac2b485"><tdclass="memItemLeft"align="right"valign="top">double </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="../../d1/d6b/group__kohonen__2d.html#gaf5ce14f026d6d231bef29161bac2b485">_random</a> (double a, double b)</td></tr>
<trclass="memdesc:gaf5ce14f026d6d231bef29161bac2b485"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Helper function to generate a random number in a given interval. <ahref="../../d1/d6b/group__kohonen__2d.html#gaf5ce14f026d6d231bef29161bac2b485">More...</a><br/></td></tr>
<trclass="memitem:ga6824dc6d973eb3339af7aef5fea78b0c"><tdclass="memItemLeft"align="right"valign="top">int </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="../../d1/d6b/group__kohonen__2d.html#ga6824dc6d973eb3339af7aef5fea78b0c">save_2d_data</a> (const char *fname, double **X, int num_points, int num_features)</td></tr>
<trclass="memdesc:ga6824dc6d973eb3339af7aef5fea78b0c"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Save a given n-dimensional data martix to file. <ahref="../../d1/d6b/group__kohonen__2d.html#ga6824dc6d973eb3339af7aef5fea78b0c">More...</a><br/></td></tr>
<trclass="memdesc:ga49d35f68f5d11d8ef6f8cce0d0e7bcba"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Create the distance matrix or <ahref="https://en.wikipedia.org/wiki/U-matrix">U-matrix</a> from the trained weights and save to disk. <ahref="../../d1/d6b/group__kohonen__2d.html#ga49d35f68f5d11d8ef6f8cce0d0e7bcba">More...</a><br/></td></tr>
<trclass="memitem:gadc22d512c00a9f5799ee067f4fb90b4b"><tdclass="memItemLeft"align="right"valign="top">void </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="../../d1/d6b/group__kohonen__2d.html#gadc22d512c00a9f5799ee067f4fb90b4b">get_min_2d</a> (double **X, int N, double *val, int *x_idx, int *y_idx)</td></tr>
<trclass="memdesc:gadc22d512c00a9f5799ee067f4fb90b4b"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Get minimum value and index of the value in a matrix. <ahref="../../d1/d6b/group__kohonen__2d.html#gadc22d512c00a9f5799ee067f4fb90b4b">More...</a><br/></td></tr>
<trclass="memitem:ga83abb572c60d202e100595a989dfe123"><tdclass="memItemLeft"align="right"valign="top">double </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="../../d1/d6b/group__kohonen__2d.html#ga83abb572c60d202e100595a989dfe123">kohonen_update_weights</a> (const double *X, struct <aclass="el"href="../../d8/db8/structkohonen__array__3d.html">kohonen_array_3d</a> *W, double **D, int num_out, int num_features, double alpha, int R)</td></tr>
<trclass="memdesc:ga83abb572c60d202e100595a989dfe123"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Update weights of the SOM using Kohonen algorithm. <ahref="../../d1/d6b/group__kohonen__2d.html#ga83abb572c60d202e100595a989dfe123">More...</a><br/></td></tr>
<trclass="memitem:gacb42eda8af6ebd6a141a34ab00a0b710"><tdclass="memItemLeft"align="right"valign="top">void </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="../../d1/d6b/group__kohonen__2d.html#gacb42eda8af6ebd6a141a34ab00a0b710">kohonen_som</a> (double **X, struct <aclass="el"href="../../d8/db8/structkohonen__array__3d.html">kohonen_array_3d</a> *W, int num_samples, int num_features, int num_out, double alpha_min)</td></tr>
<trclass="memdesc:gacb42eda8af6ebd6a141a34ab00a0b710"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Apply incremental algorithm with updating neighborhood and learning rates on all samples in the given datset. <ahref="../../d1/d6b/group__kohonen__2d.html#gacb42eda8af6ebd6a141a34ab00a0b710">More...</a><br/></td></tr>
<trclass="memdesc:adb5ded007be1fd666fab9affe6764018"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Creates a random set of points distributed in four clusters in 3D space with centroids at the points. <ahref="../../d2/df6/kohonen__som__topology_8c.html#adb5ded007be1fd666fab9affe6764018">More...</a><br/></td></tr>
<trclass="memdesc:a1440a7779ac56f47a3f355ce4a8c7da0"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Test that creates a random set of points distributed in four clusters in 2D space and trains an SOM that finds the topological pattern. <ahref="../../d2/df6/kohonen__som__topology_8c.html#a1440a7779ac56f47a3f355ce4a8c7da0">More...</a><br/></td></tr>
<trclass="memdesc:ad9e25202bb8b481461f932668f249dbc"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Creates a random set of points distributed in four clusters in 3D space with centroids at the points. <ahref="../../d2/df6/kohonen__som__topology_8c.html#ad9e25202bb8b481461f932668f249dbc">More...</a><br/></td></tr>
<trclass="memdesc:a0283886819c7c140a023582b7269e2d0"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Test that creates a random set of points distributed in 4 clusters in 3D space and trains an SOM that finds the topological pattern. <ahref="../../d2/df6/kohonen__som__topology_8c.html#a0283886819c7c140a023582b7269e2d0">More...</a><br/></td></tr>
<trclass="memdesc:a5bb02a8322d717ead1b11182c5f02a3a"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Creates a random set of points distributed in four clusters in 3D space with centroids at the points. <ahref="../../d2/df6/kohonen__som__topology_8c.html#a5bb02a8322d717ead1b11182c5f02a3a">More...</a><br/></td></tr>
<trclass="memdesc:a6d0455dd5c30adda100e95f0423c786e"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Test that creates a random set of points distributed in eight clusters in 3D space and trains an SOM that finds the topological pattern. <ahref="../../d2/df6/kohonen__som__topology_8c.html#a6d0455dd5c30adda100e95f0423c786e">More...</a><br/></td></tr>
<trclass="memdesc:a2256c10b16edba377b64a44b6c656908"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Convert clock cycle difference to time in seconds. <ahref="../../d2/df6/kohonen__som__topology_8c.html#a2256c10b16edba377b64a44b6c656908">More...</a><br/></td></tr>
<p>This example implements a powerful unsupervised learning algorithm called as a self organizing map. The algorithm creates a connected network of weights that closely follows the given data points. This thus creates a topological map of the given data i.e., it maintains the relationship between various data points in a much higher dimensional space by creating an equivalent in a 2-dimensional space. <imgsrc="https://raw.githubusercontent.com/TheAlgorithms/C/docs/images/machine_learning/kohonen/2D_Kohonen_SOM.svg"alt="Trained topological maps for the test cases in the program"style="pointer-events: none;"class="inline"/></p><dlclass="section author"><dt>Author</dt><dd><ahref="https://github.com/kvedala">Krishna Vedala</a></dd></dl>
<dlclass="section warning"><dt>Warning</dt><dd>MSVC 2019 compiler generates code that does not execute as expected. However, MinGW, Clang for GCC and Clang for MSVC compilers on windows perform as expected. Any insights and suggestions should be directed to the author. </dd></dl>
<divclass="line"><aname="l00423"></a><spanclass="lineno"> 423</span> <spanclass="keywordflow">for</span> (<spanclass="keywordtype">int</span> i = 0; i <<aclass="code"href="../../d1/d6b/group__kohonen__2d.html#gaffe776513b24d84b39af8ab0930fef7f">max</a>(num_out, N); i++) <spanclass="comment">// loop till max(N, num_out)</span></div>
<divclass="line"><aname="l00425"></a><spanclass="lineno"> 425</span> <spanclass="keywordflow">if</span> (i < N) <spanclass="comment">// only add new arrays if i < N</span></div>
<divclass="line"><aname="l00427"></a><spanclass="lineno"> 427</span> <spanclass="keywordflow">if</span> (i < num_out) <spanclass="comment">// only add new arrays if i < num_out</span></div>
<divclass="line"><aname="l00429"></a><spanclass="lineno"> 429</span> <spanclass="keywordflow">for</span> (<spanclass="keywordtype">int</span> k = 0; k < num_out; k++)</div>
<divclass="line"><aname="l00444"></a><spanclass="lineno"> 444</span> <aclass="code"href="../../d2/df6/kohonen__som__topology_8c.html#adb5ded007be1fd666fab9affe6764018">test_2d_classes</a>(X, N); <spanclass="comment">// create test data around circumference of a circle</span></div>
<divclass="line"><aname="l00445"></a><spanclass="lineno"> 445</span> <aclass="code"href="../../d1/d6b/group__kohonen__2d.html#ga6824dc6d973eb3339af7aef5fea78b0c">save_2d_data</a>(<spanclass="stringliteral">"test1.csv"</span>, X, N, features); <spanclass="comment">// save test data points</span></div>
<divclass="line"><aname="l00446"></a><spanclass="lineno"> 446</span> <aclass="code"href="../../d1/d6b/group__kohonen__2d.html#ga49d35f68f5d11d8ef6f8cce0d0e7bcba">save_u_matrix</a>(<spanclass="stringliteral">"w11.csv"</span>, &W); <spanclass="comment">// save initial random weights</span></div>
<divclass="line"><aname="l00448"></a><spanclass="lineno"> 448</span> <aclass="code"href="../../d1/d6b/group__kohonen__2d.html#ga49d35f68f5d11d8ef6f8cce0d0e7bcba">save_u_matrix</a>(<spanclass="stringliteral">"w12.csv"</span>, &W); <spanclass="comment">// save the resultant weights</span></div>
<divclass="ttc"id="agroup__kohonen__2d_html_ga49d35f68f5d11d8ef6f8cce0d0e7bcba"><divclass="ttname"><ahref="../../d1/d6b/group__kohonen__2d.html#ga49d35f68f5d11d8ef6f8cce0d0e7bcba">save_u_matrix</a></div><divclass="ttdeci">int save_u_matrix(const char *fname, struct kohonen_array_3d *W)</div><divclass="ttdoc">Create the distance matrix or U-matrix from the trained weights and save to disk.</div><divclass="ttdef"><b>Definition:</b> kohonen_som_topology.c:139</div></div>
<divclass="ttc"id="agroup__kohonen__2d_html_ga6824dc6d973eb3339af7aef5fea78b0c"><divclass="ttname"><ahref="../../d1/d6b/group__kohonen__2d.html#ga6824dc6d973eb3339af7aef5fea78b0c">save_2d_data</a></div><divclass="ttdeci">int save_2d_data(const char *fname, double **X, int num_points, int num_features)</div><divclass="ttdoc">Save a given n-dimensional data martix to file.</div><divclass="ttdef"><b>Definition:</b> kohonen_som_topology.c:102</div></div>
<divclass="ttc"id="agroup__kohonen__2d_html_ga8df35f04c1762a01dcf108fa13b897d6"><divclass="ttname"><ahref="../../d1/d6b/group__kohonen__2d.html#ga8df35f04c1762a01dcf108fa13b897d6">kohonen_data_3d</a></div><divclass="ttdeci">double * kohonen_data_3d(const struct kohonen_array_3d *arr, int x, int y, int z)</div><divclass="ttdoc">Function that returns the pointer to (x, y, z) ^th location in the linear 3D array given by:</div><divclass="ttdef"><b>Definition:</b> kohonen_som_topology.c:67</div></div>
<divclass="ttc"id="agroup__kohonen__2d_html_gacb42eda8af6ebd6a141a34ab00a0b710"><divclass="ttname"><ahref="../../d1/d6b/group__kohonen__2d.html#gacb42eda8af6ebd6a141a34ab00a0b710">kohonen_som</a></div><divclass="ttdeci">void kohonen_som(double **X, struct kohonen_array_3d *W, int num_samples, int num_features, int num_out, double alpha_min)</div><divclass="ttdoc">Apply incremental algorithm with updating neighborhood and learning rates on all samples in the given...</div><divclass="ttdef"><b>Definition:</b> kohonen_som_topology.c:314</div></div>
<divclass="ttc"id="agroup__kohonen__2d_html_gaf5ce14f026d6d231bef29161bac2b485"><divclass="ttname"><ahref="../../d1/d6b/group__kohonen__2d.html#gaf5ce14f026d6d231bef29161bac2b485">_random</a></div><divclass="ttdeci">double _random(double a, double b)</div><divclass="ttdoc">Helper function to generate a random number in a given interval.</div><divclass="ttdef"><b>Definition:</b> kohonen_som_topology.c:87</div></div>
<divclass="ttc"id="agroup__kohonen__2d_html_gaffe776513b24d84b39af8ab0930fef7f"><divclass="ttname"><ahref="../../d1/d6b/group__kohonen__2d.html#gaffe776513b24d84b39af8ab0930fef7f">max</a></div><divclass="ttdeci">#define max(a, b)</div><divclass="ttdoc">shorthand for maximum value</div><divclass="ttdef"><b>Definition:</b> kohonen_som_topology.c:39</div></div>
<divclass="ttc"id="akohonen__som__topology_8c_html_adb5ded007be1fd666fab9affe6764018"><divclass="ttname"><ahref="../../d2/df6/kohonen__som__topology_8c.html#adb5ded007be1fd666fab9affe6764018">test_2d_classes</a></div><divclass="ttdeci">void test_2d_classes(double *const *data, int N)</div><divclass="ttdoc">Creates a random set of points distributed in four clusters in 3D space with centroids at the points.</div><divclass="ttdef"><b>Definition:</b> kohonen_som_topology.c:366</div></div>
<divclass="ttc"id="amalloc__dbg_8h_html_a725f50ecaf1959d96de79b36b4788fee"><divclass="ttname"><ahref="../../d2/ddd/malloc__dbg_8h.html#a725f50ecaf1959d96de79b36b4788fee">malloc</a></div><divclass="ttdeci">#define malloc(bytes)</div><divclass="ttdoc">This macro replace the standard malloc function with malloc_dbg.</div><divclass="ttdef"><b>Definition:</b> malloc_dbg.h:18</div></div>
<divclass="ttc"id="amalloc__dbg_8h_html_a9cc854374299a1dd933bf62029761768"><divclass="ttname"><ahref="../../d2/ddd/malloc__dbg_8h.html#a9cc854374299a1dd933bf62029761768">free</a></div><divclass="ttdeci">#define free(ptr)</div><divclass="ttdoc">This macro replace the standard free function with free_dbg.</div><divclass="ttdef"><b>Definition:</b> malloc_dbg.h:26</div></div>
<divclass="ttc"id="astructkohonen__array__3d_html"><divclass="ttname"><ahref="../../d8/db8/structkohonen__array__3d.html">kohonen_array_3d</a></div><divclass="ttdoc">to store info regarding 3D arrays</div><divclass="ttdef"><b>Definition:</b> kohonen_som_topology.c:48</div></div>
<divclass="ttc"id="astructkohonen__array__3d_html_a16720581653fa9a34d1029e7229a7377"><divclass="ttname"><ahref="../../d8/db8/structkohonen__array__3d.html#a16720581653fa9a34d1029e7229a7377">kohonen_array_3d::dim1</a></div><divclass="ttdeci">int dim1</div><divclass="ttdoc">lengths of first dimension</div><divclass="ttdef"><b>Definition:</b> kohonen_som_topology.c:49</div></div>
<divclass="center"><iframescrolling="no"frameborder="0"src="../../d2/df6/kohonen__som__topology_8c_a1440a7779ac56f47a3f355ce4a8c7da0_cgraph.svg"width="616"height="272"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
<divclass="line"><aname="l00512"></a><spanclass="lineno"> 512</span> <spanclass="comment">// 3D space, hence size = number of rows * 3</span></div>
<divclass="line"><aname="l00523"></a><spanclass="lineno"> 523</span> <spanclass="keywordflow">for</span> (<spanclass="keywordtype">int</span> i = 0; i <<aclass="code"href="../../d1/d6b/group__kohonen__2d.html#gaffe776513b24d84b39af8ab0930fef7f">max</a>(num_out, N); i++) <spanclass="comment">// loop till max(N, num_out)</span></div>
<divclass="line"><aname="l00525"></a><spanclass="lineno"> 525</span> <spanclass="keywordflow">if</span> (i < N) <spanclass="comment">// only add new arrays if i < N</span></div>
<divclass="line"><aname="l00527"></a><spanclass="lineno"> 527</span> <spanclass="keywordflow">if</span> (i < num_out) <spanclass="comment">// only add new arrays if i < num_out</span></div>
<divclass="line"><aname="l00529"></a><spanclass="lineno"> 529</span> <spanclass="keywordflow">for</span> (<spanclass="keywordtype">int</span> k = 0; k < num_out; k++)</div>
<divclass="line"><aname="l00535"></a><spanclass="lineno"> 535</span>  { <spanclass="comment">// preallocate with random initial weights</span></div>
<divclass="line"><aname="l00536"></a><spanclass="lineno"> 536</span> <spanclass="keywordtype">double</span> *w = <aclass="code"href="../../d1/d6b/group__kohonen__2d.html#ga8df35f04c1762a01dcf108fa13b897d6">kohonen_data_3d</a>(&W, i, k, j);</div>
<divclass="line"><aname="l00543"></a><spanclass="lineno"> 543</span> <aclass="code"href="../../d2/df6/kohonen__som__topology_8c.html#ad9e25202bb8b481461f932668f249dbc">test_3d_classes1</a>(X, N); <spanclass="comment">// create test data</span></div>
<divclass="line"><aname="l00544"></a><spanclass="lineno"> 544</span> <aclass="code"href="../../d1/d6b/group__kohonen__2d.html#ga6824dc6d973eb3339af7aef5fea78b0c">save_2d_data</a>(<spanclass="stringliteral">"test2.csv"</span>, X, N, features); <spanclass="comment">// save test data points</span></div>
<divclass="line"><aname="l00545"></a><spanclass="lineno"> 545</span> <aclass="code"href="../../d1/d6b/group__kohonen__2d.html#ga49d35f68f5d11d8ef6f8cce0d0e7bcba">save_u_matrix</a>(<spanclass="stringliteral">"w21.csv"</span>, &W); <spanclass="comment">// save initial random weights</span></div>
<divclass="line"><aname="l00547"></a><spanclass="lineno"> 547</span> <aclass="code"href="../../d1/d6b/group__kohonen__2d.html#ga49d35f68f5d11d8ef6f8cce0d0e7bcba">save_u_matrix</a>(<spanclass="stringliteral">"w22.csv"</span>, &W); <spanclass="comment">// save the resultant weights</span></div>
<divclass="ttc"id="akohonen__som__topology_8c_html_ad9e25202bb8b481461f932668f249dbc"><divclass="ttname"><ahref="../../d2/df6/kohonen__som__topology_8c.html#ad9e25202bb8b481461f932668f249dbc">test_3d_classes1</a></div><divclass="ttdeci">void test_3d_classes1(double *const *data, int N)</div><divclass="ttdoc">Creates a random set of points distributed in four clusters in 3D space with centroids at the points.</div><divclass="ttdef"><b>Definition:</b> kohonen_som_topology.c:465</div></div>
<divclass="center"><iframescrolling="no"frameborder="0"src="../../d2/df6/kohonen__som__topology_8c_a0283886819c7c140a023582b7269e2d0_cgraph.svg"width="623"height="272"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
<divclass="line"><aname="l00624"></a><spanclass="lineno"> 624</span> <spanclass="keywordflow">for</span> (<spanclass="keywordtype">int</span> i = 0; i <<aclass="code"href="../../d1/d6b/group__kohonen__2d.html#gaffe776513b24d84b39af8ab0930fef7f">max</a>(num_out, N); i++) <spanclass="comment">// loop till max(N, num_out)</span></div>
<divclass="line"><aname="l00626"></a><spanclass="lineno"> 626</span> <spanclass="keywordflow">if</span> (i < N) <spanclass="comment">// only add new arrays if i < N</span></div>
<divclass="line"><aname="l00628"></a><spanclass="lineno"> 628</span> <spanclass="keywordflow">if</span> (i < num_out) <spanclass="comment">// only add new arrays if i < num_out</span></div>
<divclass="line"><aname="l00630"></a><spanclass="lineno"> 630</span> <spanclass="keywordflow">for</span> (<spanclass="keywordtype">int</span> k = 0; k < num_out; k++)</div>
<divclass="line"><aname="l00645"></a><spanclass="lineno"> 645</span> <aclass="code"href="../../d2/df6/kohonen__som__topology_8c.html#a5bb02a8322d717ead1b11182c5f02a3a">test_3d_classes2</a>(X, N); <spanclass="comment">// create test data around the lamniscate</span></div>
<divclass="line"><aname="l00646"></a><spanclass="lineno"> 646</span> <aclass="code"href="../../d1/d6b/group__kohonen__2d.html#ga6824dc6d973eb3339af7aef5fea78b0c">save_2d_data</a>(<spanclass="stringliteral">"test3.csv"</span>, X, N, features); <spanclass="comment">// save test data points</span></div>
<divclass="line"><aname="l00647"></a><spanclass="lineno"> 647</span> <aclass="code"href="../../d1/d6b/group__kohonen__2d.html#ga49d35f68f5d11d8ef6f8cce0d0e7bcba">save_u_matrix</a>(<spanclass="stringliteral">"w31.csv"</span>, &W); <spanclass="comment">// save initial random weights</span></div>
<divclass="line"><aname="l00649"></a><spanclass="lineno"> 649</span> <aclass="code"href="../../d1/d6b/group__kohonen__2d.html#ga49d35f68f5d11d8ef6f8cce0d0e7bcba">save_u_matrix</a>(<spanclass="stringliteral">"w32.csv"</span>, &W); <spanclass="comment">// save the resultant weights</span></div>
<divclass="ttc"id="akohonen__som__topology_8c_html_a5bb02a8322d717ead1b11182c5f02a3a"><divclass="ttname"><ahref="../../d2/df6/kohonen__som__topology_8c.html#a5bb02a8322d717ead1b11182c5f02a3a">test_3d_classes2</a></div><divclass="ttdeci">void test_3d_classes2(double *const *data, int N)</div><divclass="ttdoc">Creates a random set of points distributed in four clusters in 3D space with centroids at the points.</div><divclass="ttdef"><b>Definition:</b> kohonen_som_topology.c:564</div></div>
<divclass="center"><iframescrolling="no"frameborder="0"src="../../d2/df6/kohonen__som__topology_8c_a6d0455dd5c30adda100e95f0423c786e_cgraph.svg"width="623"height="272"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
<divclass="line"><aname="l00368"></a><spanclass="lineno"> 368</span> <spanclass="keyword">const</span><spanclass="keywordtype">double</span> R = 0.3; <spanclass="comment">// radius of cluster</span></div>
<divclass="line"><aname="l00385"></a><spanclass="lineno"> 385</span>  rand() % num_classes; <spanclass="comment">// select a random class for the point</span></div>
<divclass="line"><aname="l00387"></a><spanclass="lineno"> 387</span> <spanclass="comment">// create random coordinates (x,y,z) around the centre of the class</span></div>
<divclass="center"><iframescrolling="no"frameborder="0"src="../../d2/df6/kohonen__som__topology_8c_adb5ded007be1fd666fab9affe6764018_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>
<divclass="line"><aname="l00467"></a><spanclass="lineno"> 467</span> <spanclass="keyword">const</span><spanclass="keywordtype">double</span> R = 0.2; <spanclass="comment">// radius of cluster</span></div>
<divclass="line"><aname="l00484"></a><spanclass="lineno"> 484</span>  rand() % num_classes; <spanclass="comment">// select a random class for the point</span></div>
<divclass="line"><aname="l00486"></a><spanclass="lineno"> 486</span> <spanclass="comment">// create random coordinates (x,y,z) around the centre of the class</span></div>
<divclass="center"><iframescrolling="no"frameborder="0"src="../../d2/df6/kohonen__som__topology_8c_ad9e25202bb8b481461f932668f249dbc_cgraph.svg"width="255"height="38"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
<divclass="line"><aname="l00566"></a><spanclass="lineno"> 566</span> <spanclass="keyword">const</span><spanclass="keywordtype">double</span> R = 0.2; <spanclass="comment">// radius of cluster</span></div>
<divclass="line"><aname="l00587"></a><spanclass="lineno"> 587</span>  rand() % num_classes; <spanclass="comment">// select a random class for the point</span></div>
<divclass="line"><aname="l00589"></a><spanclass="lineno"> 589</span> <spanclass="comment">// create random coordinates (x,y,z) around the centre of the class</span></div>
<divclass="center"><iframescrolling="no"frameborder="0"src="../../d2/df6/kohonen__som__topology_8c_a5bb02a8322d717ead1b11182c5f02a3a_cgraph.svg"width="255"height="38"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
<liclass="footer">Generated by <ahref="https://www.doxygen.org/index.html"><imgclass="footer"src="../../doxygen.svg"width="104"height="31"alt="doxygen"/></a> 1.9.1 </li>