[Adephylo-commits] r159 - pkg/man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Mar 14 20:59:51 CET 2010


Author: jombart
Date: 2010-03-14 20:59:51 +0100 (Sun, 14 Mar 2010)
New Revision: 159

Modified:
   pkg/man/distTips.Rd
Log:
Added a comparison of C/R code in the example of distTips.


Modified: pkg/man/distTips.Rd
===================================================================
--- pkg/man/distTips.Rd	2010-03-14 19:54:03 UTC (rev 158)
+++ pkg/man/distTips.Rd	2010-03-14 19:59:51 UTC (rev 159)
@@ -68,6 +68,19 @@
 distTips(x, 1:3, "nNodes")
 distTips(x, 1:3, "Abouheif")
 distTips(x, 1:3, "sumDD")
+
+## compare C and pure R code outputs
+x <- rtree(10)
+all.equal(as.matrix(distTips(x)), as.matrix(distTips(x, useC=FALSE)))
+all.equal(as.matrix(distTips(x, meth="nNode")), as.matrix(distTips(x, meth="nNode", useC=FALSE)))
+all.equal(as.matrix(distTips(x, meth="Abou")), as.matrix(distTips(x, meth="Abou", useC=FALSE)))
+all.equal(as.matrix(distTips(x, meth="sumDD")), as.matrix(distTips(x, meth="sumDD", useC=FALSE)))
+
+## compare speed
+x <- rtree(50)
+tim1 <- system.time(distTips(x, useC=FALSE)) # old pure R version
+tim2 <- system.time(distTips(x)) # new version using C
+tim1[c(1,3)]/tim2[c(1,3)] # C is about a thousand time faster in this case
 }
 }
 \keyword{manip}



More information about the Adephylo-commits mailing list