[Vegan-commits] r626 - pkg/vegan/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Dec 8 10:18:31 CET 2008


Author: jarioksa
Date: 2008-12-08 10:18:30 +0100 (Mon, 08 Dec 2008)
New Revision: 626

Modified:
   pkg/vegan/R/permatswap.R
Log:
permatswap/quasiswap now 2x faster than in rev624: r2dtable moved out of the innermost loop

Modified: pkg/vegan/R/permatswap.R
===================================================================
--- pkg/vegan/R/permatswap.R	2008-12-08 09:06:07 UTC (rev 625)
+++ pkg/vegan/R/permatswap.R	2008-12-08 09:18:30 UTC (rev 626)
@@ -57,10 +57,11 @@
             temp <- perm[[i]][id,]
             } # for i end
         } else {
+            r2tabs <- r2dtable(times, rowSums(m[id,]), colSums(m[id,]))
             for (i in 1:times) {
                 if (count) {
                     ms <- sum(m[id,] > 0)
-                    tmp <- r2dtable(1, rowSums(m[id,]), colSums(m[id,]))[[1]]
+                    tmp <- r2tabs[[i]]
                     ## if fills are equal, no need to do it quasiswap
                     if (sum(tmp > 0) != ms) {
                         tmp <- .C("rswapcount",



More information about the Vegan-commits mailing list