[Vegan-commits] r1859 - in pkg/vegan: R src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Sep 20 05:29:03 CEST 2011
Author: jarioksa
Date: 2011-09-20 05:29:02 +0200 (Tue, 20 Sep 2011)
New Revision: 1859
Modified:
pkg/vegan/R/permatswap1.R
pkg/vegan/src/nestedness.c
Log:
quantitative swap uses integer data matrices
Modified: pkg/vegan/R/permatswap1.R
===================================================================
--- pkg/vegan/R/permatswap1.R 2011-09-19 16:08:14 UTC (rev 1858)
+++ pkg/vegan/R/permatswap1.R 2011-09-20 03:29:02 UTC (rev 1859)
@@ -83,7 +83,7 @@
if (count) {
if (method == "swap")
perm[id,] <- .C("swapcount",
- m = as.double(temp),
+ m = as.integer(temp),
as.integer(nn.row),
as.integer(nn.col),
as.integer(thin),
@@ -112,7 +112,7 @@
## if fills are equal, no need to restore fill
if (sum(tmp > 0) != ms) {
tmp <- .C("rswapcount",
- m = as.double(tmp),
+ m = as.integer(tmp),
as.integer(nn.row),
as.integer(nn.col),
as.integer(ms),
Modified: pkg/vegan/src/nestedness.c
===================================================================
--- pkg/vegan/src/nestedness.c 2011-09-19 16:08:14 UTC (rev 1858)
+++ pkg/vegan/src/nestedness.c 2011-09-20 03:29:02 UTC (rev 1859)
@@ -175,10 +175,10 @@
* way. The input is a 2x2 submatrix 'sm'.
*/
-double isDiag(double *sm, int *change)
+int isDiag(int *sm, int *change)
{
int i, sX;
- double retval;
+ int retval;
/* sX: number of non-zero cells */
for (i = 0, sX = 0; i < 4; i++)
@@ -235,10 +235,10 @@
* fill-neutral swapping
*/
-double isDiagFill(double *sm)
+int isDiagFill(int *sm)
{
int i, sX;
- double retval;
+ int retval;
/* sX: number of non-zero cells */
for (i = 0, sX = 0; i < 4; i++)
@@ -279,11 +279,11 @@
return retval;
}
-void swapcount(double *m, int *nr, int *nc, int *thin)
+void swapcount(int *m, int *nr, int *nc, int *thin)
{
int row[2], col[2], k, ij[4], changed, got,
pm[4] = {1, -1, -1, 1} ;
- double sm[4], ev;
+ int sm[4], ev;
GetRNGstate();
@@ -317,11 +317,11 @@
* is similar as quasiswap for presence/absence data.
*/
-void rswapcount(double *m, int *nr, int *nc, int *mfill)
+void rswapcount(int *m, int *nr, int *nc, int *mfill)
{
int row[2], col[2], i, k, ij[4], n, change, cfill,
pm[4] = {1, -1, -1, 1} ;
- double sm[4], ev;
+ int sm[4], ev;
/* Get the current fill 'cfill' */
n = (*nr) * (*nc);
@@ -365,10 +365,10 @@
/* 'isDiagSimple' needed for 'abuswap' */
-double isDiagSimple(double *sm)
+int isDiagSimple(double *sm)
{
int i, sX;
- double retval;
+ int retval;
/* sX: number of non-zero cells */
for (i = 0, sX = 0; i < 4; i++)
@@ -404,7 +404,7 @@
void abuswap(double *m, int *nr, int *nc, int *thin, int *direct)
{
- int row[2], col[2], k, ij[4], changed, ev ;
+ int row[2], col[2], k, ij[4], changed, ev;
double sm[4];
GetRNGstate();
More information about the Vegan-commits
mailing list