[Picante-commits] r152 - branches/gsoc/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Jul 24 03:21:26 CEST 2008


Author: mrhelmus
Date: 2008-07-24 03:21:25 +0200 (Thu, 24 Jul 2008)
New Revision: 152

Modified:
   branches/gsoc/src/picante.c
Log:
Beginning code for richness randomization

Modified: branches/gsoc/src/picante.c
===================================================================
--- branches/gsoc/src/picante.c	2008-07-23 13:27:33 UTC (rev 151)
+++ branches/gsoc/src/picante.c	2008-07-24 01:21:25 UTC (rev 152)
@@ -76,3 +76,30 @@
     mattovec(v,m,row,column);
     PutRNGstate();
 }
+
+void richness(double *v, int * prow, int * pcolumn){
+    int i, j, k;
+    int row, column;
+    double **m;
+
+    row = *prow;
+    column = *pcolumn;
+
+    double randm[row][column];/*make an object to hold the random matrix*/
+
+    m = vectomat(v,row,column);
+
+    GetRNGstate();
+    for(i=1;i<row;i++){ /*for each row*/
+        /*Here I would do randperm in Matlab or sample in R*/
+        for(j=1;j<row;j++){/*Perhaps we need to do it elementwise across columns*/
+            k=intrand(column);
+            randm[i][k]
+
+            }
+
+        }
+
+    mattovec(v,m,row,column);
+    PutRNGstate();
+}



More information about the Picante-commits mailing list