[Adephylo-commits] r150 - pkg/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Mar 12 00:19:46 CET 2010


Author: jombart
Date: 2010-03-12 00:19:46 +0100 (Fri, 12 Mar 2010)
New Revision: 150

Modified:
   pkg/src/sptips.c
Log:
Yop ! spalltips works, all debugged, all nice. Bloody fast, like a few seconds for a tree with 1,000 tips. Problem is: the size of the vector for storing the results is huge, and grows exponentially with the size of the tree.
Will have to compute all, including the distances, in C, so that the vector size remains decent.


Modified: pkg/src/sptips.c
===================================================================
--- pkg/src/sptips.c	2010-03-11 22:15:43 UTC (rev 149)
+++ pkg/src/sptips.c	2010-03-11 23:19:46 UTC (rev 150)
@@ -38,7 +38,10 @@
 
 	int i=1;
 
+	/* printf("\n AinB debugging: a=%d", a); */
 	while(i <= lengthB){
+		/* printf("\t i=%d \t bi=%d ", a, b[i]); */
+
 		if(b[i]==a) {
 			return(i);
 		} else {
@@ -257,7 +260,7 @@
 			return(0);
 		}
 		i++;
-		idx = intAinB(pathAroot[i], pathBroot, *lengthPathA);
+		idx = intAinB(pathAroot[i], pathBroot, *lengthPathB);
 		/* printf("\ni: %d    idx: %d    node: %d", i, idx, pathAroot[i]); */
 	}
 
@@ -314,11 +317,11 @@
 		k++;
 	}
 
-	printf("\nsp step a:");
-	int i;
-	for(i=1; i<=*resSize; i++){
-		printf(" %d", res[i]);
-	}
+	/* printf("\nsp step a:"); */
+	/* int i; */
+	/* for(i=1; i<=*resSize; i++){ */
+	/* 	printf(" %d", res[i]); */
+	/* } */
 
 	/* for B */
 	k = 1;
@@ -329,19 +332,19 @@
 	}
 
 
-	printf("\nsp step b:");
-	for(i=1; i<=*resSize; i++){
-		printf(" %d", res[i]);
-	}
+	/* printf("\nsp step b:"); */
+	/* for(i=1; i<=*resSize; i++){ */
+	/* 	printf(" %d", res[i]); */
+	/* } */
 
 	/* add the MRCA */
 	*resSize = *resSize + 1;
 	res[*resSize] = myMrca;
 
-	printf("\nsp step mrca (%d):", myMrca);
-	for(i=1; i<=*resSize; i++){
-		printf(" %d", res[i]);
-	}
+	/* printf("\nsp step mrca (%d):", myMrca); */
+	/* for(i=1; i<=*resSize; i++){ */
+	/* 	printf(" %d", res[i]); */
+	/* } */
 
 
 	/* free memory */
@@ -423,7 +426,7 @@
 			}
 		}
 	}
-	printf("\ngot to 4");
+	/* printf("\ngot to 4"); */
 
 	/* free memory */
 	freeintvec(ancesLoc);
@@ -440,13 +443,13 @@
 /*
 
 library(adephylo)
-tre=rtree(10)
+tre=rtree(1000)
 plot(tre)
 nodelabels()
 tiplabels()
 
-res <- resId <- integer(1e5)
-resSize=as.integer(1e5)
+res <- resId <- integer(1e8)
+resSize=as.integer(1e8)
 
 # void spalltips(int *ances, int *desc, int *N, int *nTips, int *res, int *resId, int *resSize){
 
@@ -455,5 +458,6 @@
 toto[[6]] <- toto[[6]][1:toto[[7]]]
 
 res <- split(toto[[5]], toto[[6]])
+res
 
 */



More information about the Adephylo-commits mailing list