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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Jan 25 13:07:42 CET 2013


Author: jarioksa
Date: 2013-01-25 13:07:42 +0100 (Fri, 25 Jan 2013)
New Revision: 2387

Modified:
   pkg/vegan/R/procrustes.R
Log:
slightly faster sum of squares of a matrix

Modified: pkg/vegan/R/procrustes.R
===================================================================
--- pkg/vegan/R/procrustes.R	2013-01-25 11:27:29 UTC (rev 2386)
+++ pkg/vegan/R/procrustes.R	2013-01-25 12:07:42 UTC (rev 2387)
@@ -11,7 +11,7 @@
         addcols <- ncol(Y) - ncol(X)
         for (i in 1:addcols) X <- cbind(X, 0)
     }
-    ctrace <- function(MAT) sum(diag(crossprod(MAT)))
+    ctrace <- function(MAT) sum(MAT^2)
     c <- 1
     if (symmetric) {
         X <- scale(X, scale = FALSE)



More information about the Vegan-commits mailing list