<divclass="center"><iframescrolling="no"frameborder="0"src="../../d1/d6b/group__kohonen__2d.svg"width="403"height="51"><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:gac78022076d889bf2ebfb2c41d4527ceb"><tdclass="memItemLeft"align="right"valign="top">double * </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="../../d1/d6b/group__kohonen__2d.html#gac78022076d889bf2ebfb2c41d4527ceb">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:gac78022076d889bf2ebfb2c41d4527ceb"><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#gac78022076d889bf2ebfb2c41d4527ceb">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"target="_blank">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>
<divclass="line"><spanclass="lineno"> 208</span><spanclass="keywordflow">for</span> (<spanclass="keywordtype">int</span> i = 0; i < N; i++) <spanclass="comment">// traverse each x-index</span></div>
<divclass="line"><spanclass="lineno"> 212</span><spanclass="keywordflow">if</span> (X[i][j] < val[0]) <spanclass="comment">// if a lower value is found</span></div>
<divclass="line"><spanclass="lineno"> 213</span> { <spanclass="comment">// save the value and its index</span></div>
<p> where \(L\), \(M\) and \(N\) are the 3D matrix dimensions. </p><dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramdir">[in]</td><tdclass="paramname">arr</td><td>pointer to <aclass="el"href="../../d8/db8/structkohonen__array__3d.html"title="to store info regarding 3D arrays">kohonen_array_3d</a> structure </td></tr>
<tr><tdclass="paramdir">[in]</td><tdclass="paramname">x</td><td>first index </td></tr>
<tr><tdclass="paramdir">[in]</td><tdclass="paramname">y</td><td>second index </td></tr>
<tr><tdclass="paramdir">[in]</td><tdclass="paramname">z</td><td>third index </td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>pointer to (x,y,z)^th location of data </dd></dl>
<divclass="ttc"id="astructkohonen__array__3d_html_a160f14830bdfbbf9f422f382ee754dbf"><divclass="ttname"><ahref="../../d8/db8/structkohonen__array__3d.html#a160f14830bdfbbf9f422f382ee754dbf">kohonen_array_3d::dim3</a></div><divclass="ttdeci">int dim3</div><divclass="ttdoc">lengths of thirddimension</div><divclass="ttdef"><b>Definition:</b> kohonen_som_topology.c:51</div></div>
<divclass="ttc"id="astructkohonen__array__3d_html_a888d7e007b38c91c7933e12a9566af1d"><divclass="ttname"><ahref="../../d8/db8/structkohonen__array__3d.html#a888d7e007b38c91c7933e12a9566af1d">kohonen_array_3d::dim2</a></div><divclass="ttdeci">int dim2</div><divclass="ttdoc">lengths of second dimension</div><divclass="ttdef"><b>Definition:</b> kohonen_som_topology.c:50</div></div>
<divclass="ttc"id="astructkohonen__array__3d_html_ad546baa2e81c6196d5f1dc0fe2e5bd59"><divclass="ttname"><ahref="../../d8/db8/structkohonen__array__3d.html#ad546baa2e81c6196d5f1dc0fe2e5bd59">kohonen_array_3d::data</a></div><divclass="ttdeci">double * data</div><divclass="ttdoc">pointer to data</div><divclass="ttdef"><b>Definition:</b> kohonen_som_topology.c:52</div></div>
<divclass="line"><spanclass="lineno"> 319</span><spanclass="keywordflow">for</span> (<spanclass="keywordtype">int</span> i = 0; i < num_out; i++)</div>
<divclass="line"><spanclass="lineno"> 322</span><spanclass="keywordtype">double</span> dmin = 1.f; <spanclass="comment">// average minimum distance of all samples</span></div>
<divclass="ttc"id="agroup__kohonen__2d_html_ga83abb572c60d202e100595a989dfe123"><divclass="ttname"><ahref="../../d1/d6b/group__kohonen__2d.html#ga83abb572c60d202e100595a989dfe123">kohonen_update_weights</a></div><divclass="ttdeci">double kohonen_update_weights(const double *X, struct kohonen_array_3d *W, double **D, int num_out, int num_features, double alpha, int R)</div><divclass="ttdoc">Update weights of the SOM using Kohonen algorithm.</div><divclass="ttdef"><b>Definition:</b> kohonen_som_topology.c:234</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="center"><iframescrolling="no"frameborder="0"src="../../d1/d6b/group__kohonen__2d_gacb42eda8af6ebd6a141a34ab00a0b710_cgraph.svg"width="503"height="88"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
<divclass="ttc"id="agroup__kohonen__2d_html_gac78022076d889bf2ebfb2c41d4527ceb"><divclass="ttname"><ahref="../../d1/d6b/group__kohonen__2d.html#gac78022076d889bf2ebfb2c41d4527ceb">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_gadc22d512c00a9f5799ee067f4fb90b4b"><divclass="ttname"><ahref="../../d1/d6b/group__kohonen__2d.html#gadc22d512c00a9f5799ee067f4fb90b4b">get_min_2d</a></div><divclass="ttdeci">void get_min_2d(double **X, int N, double *val, int *x_idx, int *y_idx)</div><divclass="ttdoc">Get minimum value and index of the value in a matrix.</div><divclass="ttdef"><b>Definition:</b> kohonen_som_topology.c:204</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="center"><iframescrolling="no"frameborder="0"src="../../d1/d6b/group__kohonen__2d_ga83abb572c60d202e100595a989dfe123_cgraph.svg"width="352"height="88"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
<divclass="line"><spanclass="lineno"> 114</span><spanclass="keywordflow">for</span> (<spanclass="keywordtype">int</span> i = 0; i < num_points; i++) <spanclass="comment">// for each point in the array</span></div>
<divclass="line"><spanclass="lineno"> 116</span><spanclass="keywordflow">for</span> (<spanclass="keywordtype">int</span> j = 0; j < num_features; j++) <spanclass="comment">// for each feature in the array</span></div>
<divclass="line"><spanclass="lineno"> 118</span> fprintf(fp, <spanclass="stringliteral">"%.4g"</span>, X[i][j]); <spanclass="comment">// print the feature value</span></div>
<divclass="line"><spanclass="lineno"> 119</span><spanclass="keywordflow">if</span> (j < num_features - 1) <spanclass="comment">// if not the last feature</span></div>
<divclass="line"><spanclass="lineno"> 122</span><spanclass="keywordflow">if</span> (i < num_points - 1) <spanclass="comment">// if not the last row</span></div>
<divclass="line"><spanclass="lineno"> 123</span> fputc(<spanclass="charliteral">'\n'</span>, fp); <spanclass="comment">// start a new line</span></div>
<p>Create the distance matrix or <ahref="https://en.wikipedia.org/wiki/U-matrix"target="_blank">U-matrix</a> from the trained weights and save to disk. </p>
<divclass="line"><spanclass="lineno"> 152</span><spanclass="keywordflow">for</span> (<spanclass="keywordtype">int</span> i = 0; i < W-><aclass="code hl_variable"href="../../d8/db8/structkohonen__array__3d.html#a16720581653fa9a34d1029e7229a7377">dim1</a>; i++) <spanclass="comment">// for each x</span></div>
<divclass="line"><spanclass="lineno"> 169</span><spanclass="keywordflow">for</span> (<spanclass="keywordtype">int</span> m = from_y; m < to_y; m++) <spanclass="comment">// scan neighborhood in y</span></div>
<divclass="line"><spanclass="lineno"> 171</span><spanclass="keywordtype">double</span> d = 0.f;</div>
<divclass="line"><spanclass="lineno"> 172</span><spanclass="keywordflow">for</span> (k = 0; k < W-><aclass="code hl_variable"href="../../d8/db8/structkohonen__array__3d.html#a160f14830bdfbbf9f422f382ee754dbf">dim3</a>; k++) <spanclass="comment">// for each feature</span></div>
<divclass="line"><spanclass="lineno"> 184</span> distance /= R * R; <spanclass="comment">// mean distance from neighbors</span></div>
<divclass="line"><spanclass="lineno"> 185</span> fprintf(fp, <spanclass="stringliteral">"%.4g"</span>, distance); <spanclass="comment">// print the mean separation</span></div>
<divclass="line"><spanclass="lineno"> 186</span><spanclass="keywordflow">if</span> (j < W->dim2 - 1) <spanclass="comment">// if not the last column</span></div>
<divclass="line"><spanclass="lineno"> 189</span><spanclass="keywordflow">if</span> (i < W->dim1 - 1) <spanclass="comment">// if not the last row</span></div>
<divclass="line"><spanclass="lineno"> 190</span> fputc(<spanclass="charliteral">'\n'</span>, fp); <spanclass="comment">// start a new line</span></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="../../d1/d6b/group__kohonen__2d_ga49d35f68f5d11d8ef6f8cce0d0e7bcba_cgraph.svg"width="290"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.4 </li>