[Vegan-commits] r2496 - pkg/vegan/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat Apr 27 06:15:52 CEST 2013
Author: gsimpson
Date: 2013-04-27 06:15:52 +0200 (Sat, 27 Apr 2013)
New Revision: 2496
Modified:
pkg/vegan/R/indpower.R
Log:
use crossprod()
Modified: pkg/vegan/R/indpower.R
===================================================================
--- pkg/vegan/R/indpower.R 2013-04-24 08:16:04 UTC (rev 2495)
+++ pkg/vegan/R/indpower.R 2013-04-27 04:15:52 UTC (rev 2496)
@@ -8,7 +8,7 @@
if (!(type %in% 0:2))
stop("'type' must be in c(0, 1, 2)")
n <- nrow(x)
- j <- t(x) %*% x
+ j <- crossprod(x) ## faster t(x) %*% x
ip1 <- sweep(j, 1, diag(j), "/")
ip2 <- 1 - sweep(-sweep(j, 2, diag(j), "-"), 1, n - diag(j), "/")
out <- switch(as.character(type),
More information about the Vegan-commits
mailing list