sf_performance_basic.cpp 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. ///////////////////////////////////////////////////////////////
  2. // Copyright 2011 John Maddock. Distributed under the Boost
  3. // Software License, Version 1.0. (See accompanying file
  4. // LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt
  5. #include "sf_performance.hpp"
  6. void basic_tests()
  7. {
  8. std::cout << "Allocation Counts for Horner Evaluation:\n";
  9. #ifdef TEST_MPFR
  10. basic_allocation_test("mpfr_float_50", mpfr_float_50(2));
  11. basic_allocation_test("mpfr_float_50 - no expression templates", number<mpfr_float_backend<50>, et_off>(2));
  12. #endif
  13. #ifdef TEST_MPFR_CLASS
  14. basic_allocation_test("mpfr_class", mpfr_class(2));
  15. #endif
  16. #ifdef TEST_MPREAL
  17. basic_allocation_test("mpfr::mpreal", mpfr::mpreal(2));
  18. #endif
  19. std::cout << "Allocation Counts for boost::math::tools::evaluate_polynomial:\n";
  20. #ifdef TEST_MPFR
  21. poly_allocation_test("mpfr_float_50", mpfr_float_50(2));
  22. poly_allocation_test("mpfr_float_50 - no expression templates", number<mpfr_float_backend<50>, et_off>(2));
  23. #endif
  24. #ifdef TEST_MPFR_CLASS
  25. poly_allocation_test("mpfr_class", mpfr_class(2));
  26. #endif
  27. #ifdef TEST_MPREAL
  28. poly_allocation_test("mpfr::mpreal", mpfr::mpreal(2));
  29. #endif
  30. //
  31. // Comparison for builtin floats:
  32. //
  33. #ifdef TEST_FLOAT
  34. time_proc("Bessel Functions - double", test_bessel<double>);
  35. time_proc("Bessel Functions - real_concept", test_bessel<boost::math::concepts::real_concept>);
  36. time_proc("Bessel Functions - arithmetic_backend<double>", test_bessel<number<arithmetic_backend<double>, et_on> >);
  37. time_proc("Bessel Functions - arithmetic_backend<double> - no expression templates", test_bessel<number<arithmetic_backend<double>, et_off> >);
  38. time_proc("Non-central T - double", test_nct<double>);
  39. time_proc("Non-central T - real_concept", test_nct<boost::math::concepts::real_concept>);
  40. time_proc("Non-central T - arithmetic_backend<double>", test_nct<number<arithmetic_backend<double>, et_on> >);
  41. time_proc("Non-central T - arithmetic_backend<double> - no expression templates", test_nct<number<arithmetic_backend<double>, et_off> >);
  42. #endif
  43. }