<ul> <li> <font color="#800000"><b>Prolog</b></font> <p> <a href="http://maitra.public.iastate.edu/" target="_blank"> Dr. Ranjan Maitra</a> and <a href="http://www.ndsu.edu/statistics/dr_volodymyr_melnykov/" target="_blank"> Dr. Volodymyr Melnykov</a> developed a lot of C functions handling high dimensional data set, using EM Algorithm to find the classifications by Model-Based Clustering, and other related interesting studies requiring high performance computing. They also accomplish their achievements with R packages. Pointer arrays are heavily used in the researches, but skipped cleverly by some macros in C ... Dr. Maitra is a professor in <a href="http://www.stat.iastate.edu/" target="_blank"> Department of Statisitcs</a>, <a href="http://www.iastate.edu/" target="_blank">Iowa State University</a>, <a href="http://www.city.ames.ia.us/" target="_blank">Ames</a>, <a href="http://www.iowa.gov/" target="_blank">Iowa</a>, <a href="http://www.usa.gov/" target="_blank">USA</a>, and his student, Dr. Melnykov, is a professor in <a href="http://www.ndsu.edu/statistics/" target="_blank"> Department of Statisitcs</a>, <a href="http://www.ndsu.edu/" target="_blank"> North Dakota State University</a>, <a href="http://www.ci.fargo.nd.us/" target="_blank">Fargo</a>, <a href="http://www.nd.gov/" target="_blank">North Dakota</a>, <a href="http://www.usa.gov/" target="_blank">USA</a>. <br><br> <li> <font color="#800000"><b>Story</b></font> <p> This is an example for demonstrate C pointer arrays by an R package, and all the functions can be wrappers for other C functions. There are three main C functions to receive data (pointer) from R, and assign data into an array, a double pointer array, and a 3D pointer array by different ways including: <b> directly making a copy</b>, and <b> assigning pointer arrays to the addresses of R's objects</b>. R and C use different arrange methods to assign "array", so it should be manipulated carefully when they are communicating with each other. These techniques are useful when we are analyzing high dimensional data set. <br><br> <li> <font color="#800000"><b>Basic Ideas</b></font> <ul> <li> R use "first index goes first". <li> C use "last index goes first". <li> For 2D, make a transpose for data in R and pass to C with reversed order of dimension. <li> For 3D, make a permuation for data in R and pass to C with reversed order of dimension. </ul> <br> <li> <font color="#800000"><b>Code</b></font> <br> You can download the package <br> <b>Linux:</b> "<a href="./example/cpointer/CPointer.tar.gz">CPointer.tar.gz</a>" <br> <b>Windows:</b> "<a href="./example/cpointer/CPointer.zip">CPointer.zip</a>" <br><br> 3 main C functions are provided <code>test_1d()</code>, <code>test_2d()</code>, and <code>test_3d()</code> in <code>src/</code>. <br> 2 tool C functions in "src/R_tools.c" for allocating pointer arrays. <br> 3 R functions <code>test.1d()</code>, <code>test.2d()</code>, and <code>test.3d()</code> in "R/". <br> <code>.C()</code> is used in R, but the issues are all the same for <code>.Call()</code> or <code>.External()</code>. <br> <br> </ul> --- <div w3-include-html="../preamble_tail_date.html"></div>