[mlpack-git] [mlpack] Fix bug #358 (CosineTreeTest/CosineNodeCosineSplit test sometimes fails, only on i386) (#581)

Ryan Curtin notifications at github.com
Wed Mar 23 11:12:10 EDT 2016


> -
> -      for (i = 0; i < leftIndices.size(); i++)
> -        BOOST_CHECK_LT(cosineMax - cosines(i), cosines(i) - cosineMin);
> -
> -      for (j = 0, k = i; j < rightIndices.size(); j++, k++)
> -        BOOST_CHECK_GT(cosineMax - cosines(k), cosines(k) - cosineMin);
> +      // If max(cosines) is close to 1.0 cosineMax and cosineMax2 may
> +      // differ significantly
> +      double cosineMax2 = arma::max(cosines % (cosines < 1.0 - precision));
> +
> +
> +      if(std::fabs(cosineMax - cosineMax2) < precision)
> +      {
> +        // Check with some precision
> +	    for (i = 0; i < leftIndices.size(); i++)
> +          BOOST_CHECK_LT(cosineMax - cosines(i), cosines(i) - cosineMin + precision);

Hm, these should be `BOOST_REQUIRE_LT` instead of `BOOST_CHECK_LT` like the rest of the mlpack tests, I'm not sure why the original code used `CHECK` instead of `REQUIRE`.  I'll go ahead and change this after the merge.

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/mlpack/mlpack/pull/581/files/e5076dbce032c7f66f295b10729f375ccfe89cec#r57175998
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160323/3fe9091f/attachment.html>


More information about the mlpack-git mailing list