Permalink
Browse files

-code cosmetics and added a debug flag

  • Loading branch information...
1 parent 80baacc commit ea5ec49542b79a4da6eea0eb20ec4f013840cb7d @stamatak committed May 8, 2013
Showing with 26 additions and 4 deletions.
  1. +2 −0 axml.c
  2. +24 −4 searchAlgo.c
View
@@ -9056,9 +9056,11 @@ void writeBinaryModel(tree *tr)
myfwrite(tr->partitionData[model].weights, sizeof(double), 4, f);
myfwrite(tr->partitionData[model].gammaRates, sizeof(double), 4, f);
+
myfwrite(tr->partitionData[model].EIGN, sizeof(double), pLengths[dataType].eignLength, f);
myfwrite(tr->partitionData[model].EV, sizeof(double), pLengths[dataType].evLength, f);
myfwrite(tr->partitionData[model].EI, sizeof(double), pLengths[dataType].eiLength, f);
+
myfwrite(tr->partitionData[model].frequencies, sizeof(double), pLengths[dataType].frequenciesLength, f);
myfwrite(tr->partitionData[model].tipVector, sizeof(double), pLengths[dataType].tipVectorLength, f);
myfwrite(tr->partitionData[model].substRates, sizeof(double), pLengths[dataType].substRatesLength, f);
View
@@ -89,7 +89,7 @@ boolean initrav (tree *tr, nodeptr p)
-
+//#define _DEBUG_UPDATE
boolean update(tree *tr, nodeptr p)
@@ -100,6 +100,15 @@ boolean update(tree *tr, nodeptr p)
double z[NUM_BRANCHES], z0[NUM_BRANCHES];
double _deltaz;
+#ifdef _DEBUG_UPDATE
+ double
+ startLH;
+
+ evaluateGeneric(tr, p);
+
+ startLH = tr->likelihood;
+#endif
+
q = p->back;
for(i = 0; i < tr->numBranches; i++)
@@ -123,13 +132,24 @@ boolean update(tree *tr, nodeptr p)
{
smoothedPartitions[i] = FALSE;
}
-
-
-
+
p->z[i] = q->z[i] = z[i];
}
}
+#ifdef _DEBUG_UPDATE
+ evaluateGeneric(tr, p);
+
+ if(tr->likelihood <= startLH)
+ {
+ if(fabs(tr->likelihood - startLH) > 0.01)
+ {
+ printf("%f %f\n", startLH, tr->likelihood);
+ assert(0);
+ }
+ }
+#endif
+
for(i = 0; i < tr->numBranches; i++)
tr->partitionSmoothed[i] = smoothedPartitions[i];

0 comments on commit ea5ec49

Please sign in to comment.