xflouris / libpll

Phylogenetic Likelihood Library
GNU Affero General Public License v3.0
27 stars 6 forks source link

compute_empirical_frequencies return garbage when compiling libpll_optimize with -DNDEBUG #64

Closed pierrebarbera closed 8 years ago

pierrebarbera commented 8 years ago

When specifying -DNDEBUG during compilation of libpll_optimize.so, the output behaviour of pll_compute_empirical_frequencies changes.

Example outputs: With -DNDEBUG: 614500.3333 553325.5000 610387.5000 621018.6667 without: 0.2561 0.2306 0.2544 0.2588

The culprit seems to be this line, where the value of ther frequencies is manipulated during a debug portion:

#ifndef NDEBUG
  for (k = 0; k < states; ++k)
  {
    frequencies[k] /= sites * tips; //<- mistake?
    printf("%.4f ", frequencies[k]);
    sum_test += frequencies[k];
  }
  printf("\n");
  assert(fabs (sum_test - 1) < 1e-6);
#endif
ddarriba commented 8 years ago

fixed