// (C) Copyright Nick Thompson 2020. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include #include #include #include #include #include using boost::multiprecision::number; using boost::multiprecision::mpfr_float_backend; using boost::multiprecision::float128; using boost::multiprecision::cpp_bin_float_50; using boost::multiprecision::cpp_bin_float_100; using boost::math::jacobi_theta1; using boost::math::jacobi_theta1tau; template void JacobiTheta1(benchmark::State& state) { std::random_device rd; std::mt19937_64 mt(rd()); std::uniform_real_distribution unif(0,0.01); Real x = static_cast(unif(mt)); Real q = static_cast(unif(mt)); for (auto _ : state) { benchmark::DoNotOptimize(jacobi_theta1(x, q)); x += std::numeric_limits::epsilon(); } } BENCHMARK_TEMPLATE(JacobiTheta1, float); BENCHMARK_TEMPLATE(JacobiTheta1, double); BENCHMARK_TEMPLATE(JacobiTheta1, long double); BENCHMARK_TEMPLATE(JacobiTheta1, float128); BENCHMARK_TEMPLATE(JacobiTheta1, number>); BENCHMARK_TEMPLATE(JacobiTheta1, number>); BENCHMARK_TEMPLATE(JacobiTheta1, number>); BENCHMARK_TEMPLATE(JacobiTheta1, number>); BENCHMARK_TEMPLATE(JacobiTheta1, number>); BENCHMARK_TEMPLATE(JacobiTheta1, cpp_bin_float_50); BENCHMARK_TEMPLATE(JacobiTheta1, cpp_bin_float_100); template void JacobiTheta1Tau(benchmark::State& state) { std::random_device rd; std::mt19937_64 mt(rd()); std::uniform_real_distribution unif(0,0.01); Real x = static_cast(unif(mt)); Real q = static_cast(unif(mt)); for (auto _ : state) { benchmark::DoNotOptimize(jacobi_theta1tau(x, q)); x += std::numeric_limits::epsilon(); } } BENCHMARK_TEMPLATE(JacobiTheta1Tau, float); BENCHMARK_TEMPLATE(JacobiTheta1Tau, double); BENCHMARK_TEMPLATE(JacobiTheta1Tau, long double); BENCHMARK_TEMPLATE(JacobiTheta1Tau, float128); BENCHMARK_TEMPLATE(JacobiTheta1Tau, number>); BENCHMARK_TEMPLATE(JacobiTheta1Tau, number>); BENCHMARK_TEMPLATE(JacobiTheta1Tau, number>); BENCHMARK_TEMPLATE(JacobiTheta1Tau, number>); BENCHMARK_TEMPLATE(JacobiTheta1Tau, number>); BENCHMARK_TEMPLATE(JacobiTheta1Tau, cpp_bin_float_50); BENCHMARK_TEMPLATE(JacobiTheta1Tau, cpp_bin_float_100); BENCHMARK_MAIN();