[Vegan-commits] r700 - pkg/vegan/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Feb 24 11:02:53 CET 2009


Author: jarioksa
Date: 2009-02-24 11:02:53 +0100 (Tue, 24 Feb 2009)
New Revision: 700

Modified:
   pkg/vegan/src/nestedness.c
Log:
nestedness.c: indentation

Modified: pkg/vegan/src/nestedness.c
===================================================================
--- pkg/vegan/src/nestedness.c	2009-02-24 09:57:38 UTC (rev 699)
+++ pkg/vegan/src/nestedness.c	2009-02-24 10:02:53 UTC (rev 700)
@@ -258,7 +258,7 @@
 
 void rswapcount(double *m, int *nr, int *nc, int *mfill)
 {
-   int row[2], col[2], i, k, ij[4], n, change, cfill,
+    int row[2], col[2], i, k, ij[4], n, change, cfill,
        pm[4] = {1, -1, -1, 1} ;
     double sm[4], ev;
 
@@ -317,17 +317,17 @@
 
     /* sX: number of non-zero cells */
     for (i = 0, sX = 0; i++; i < 4)
-        if (sm[i] > 0)
-            sX++;
+	if (sm[i] > 0)
+	    sX++;
 
     if (sX == 4) {
-        return 1;
+	return 1;
     }
     if ((sm[0] == 0 && sm[1] > 0 && sm[2] > 0 && sm[3] == 0) ||
-    (sm[0] > 0 && sm[1] == 0 && sm[2] == 0 && sm[3] > 0))
-        return 1;
+	(sm[0] > 0 && sm[1] == 0 && sm[2] == 0 && sm[3] > 0))
+	return 1;
     else
-     return 0;
+	return 0;
 }
 
 /* 'abuswap' to do Hardy 2008 J Ecol 96: 914-926 */
@@ -341,36 +341,36 @@
 
     changed = 0;
     while (changed < *thin) {
-    /* Select a random 2x2 matrix*/
-    i2rand(row, *nr - 1);
-    i2rand(col, *nc - 1);
-    ij[0] = INDX(row[0], col[0], *nr);
-    ij[1] = INDX(row[1], col[0], *nr);
-    ij[2] = INDX(row[0], col[1], *nr);
-    ij[3] = INDX(row[1], col[1], *nr);
-    for (k = 0; k < 4; k ++)
-        sm[k] = m[ij[k]];
-    ev = isDiagSimple(sm);
-    /* Swap */
-    if (ev == 1) {
-        /* fixed column sums */
-        if (*direct == 0) {
-            m[ij[0]] = sm[1];
-            m[ij[1]] = sm[0];
-            m[ij[2]] = sm[3];
-            m[ij[3]] = sm[2];
-        }
-        /* fixed row sums */
-        else {
-            m[ij[0]] = sm[2];
-            m[ij[1]] = sm[3];
-            m[ij[2]] = sm[0];
-            m[ij[3]] = sm[1];
-        }
-        changed++;
+	/* Select a random 2x2 matrix*/
+	 i2rand(row, *nr - 1);
+	 i2rand(col, *nc - 1);
+	 ij[0] = INDX(row[0], col[0], *nr);
+	 ij[1] = INDX(row[1], col[0], *nr);
+	 ij[2] = INDX(row[0], col[1], *nr);
+	 ij[3] = INDX(row[1], col[1], *nr);
+	 for (k = 0; k < 4; k ++)
+	      sm[k] = m[ij[k]];
+	 ev = isDiagSimple(sm);
+	 /* Swap */
+	 if (ev == 1) {
+	      /* fixed column sums */
+	      if (*direct == 0) {
+		   m[ij[0]] = sm[1];
+		   m[ij[1]] = sm[0];
+		   m[ij[2]] = sm[3];
+		   m[ij[3]] = sm[2];
+	      }
+	      /* fixed row sums */
+	      else {
+		   m[ij[0]] = sm[2];
+		   m[ij[1]] = sm[3];
+		   m[ij[2]] = sm[0];
+		   m[ij[3]] = sm[1];
+	      }
+	      changed++;
+	 }
     }
-    }
-
+    
     PutRNGstate();
 }
 



More information about the Vegan-commits mailing list