naive_monte_carlo_incl_test.cpp 842 B

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * Copyright Nick Thompson, 2017
  3. * Use, modification and distribution are subject to the
  4. * Boost Software License, Version 1.0. (See accompanying file
  5. * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. */
  7. #ifdef _MSC_VER
  8. #pragma warning(disable:4459)
  9. #endif
  10. #if !defined(_MSC_VER) || (_MSC_VER >= 1900)
  11. #include <boost/math/quadrature/naive_monte_carlo.hpp>
  12. #include "test_compile_result.hpp"
  13. using boost::math::quadrature::naive_monte_carlo;
  14. void compile_and_link_test()
  15. {
  16. auto g = [&](std::vector<double> const & x)
  17. {
  18. return 1.873;
  19. };
  20. std::vector<std::pair<double, double>> bounds{{0, 1}, {0, 1}, {0, 1}};
  21. naive_monte_carlo<double, decltype(g)> mc(g, bounds, 1.0);
  22. auto task = mc.integrate();
  23. check_result<double>(task.get());
  24. }
  25. #else
  26. void compile_and_link_test()
  27. {
  28. }
  29. #endif