From 483eb2f56657e8e7f419ab1a4fab8dce9ade8609 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 20:24:20 +0200 Subject: Adding upstream version 14.2.21. Signed-off-by: Daniel Baumann --- src/boost/libs/math/README.md | 121 + src/boost/libs/math/build/Jamfile.v2 | 123 + src/boost/libs/math/config/Jamfile.v2 | 52 + .../libs/math/config/has_128bit_floatmax_t.cpp | 19 + src/boost/libs/math/config/has_e_float.cpp | 15 + src/boost/libs/math/config/has_fftw3.cpp | 19 + src/boost/libs/math/config/has_float128.cpp | 17 + src/boost/libs/math/config/has_gcc_visibility.cpp | 13 + src/boost/libs/math/config/has_gmp.cpp | 33 + src/boost/libs/math/config/has_gmpxx.cpp | 7 + src/boost/libs/math/config/has_intel_quad.cpp | 16 + .../libs/math/config/has_long_double_support.cpp | 10 + src/boost/libs/math/config/has_mpfr.cpp | 47 + src/boost/libs/math/config/has_mpfr_class.cpp | 15 + src/boost/libs/math/config/has_mpreal.cpp | 14 + src/boost/libs/math/config/has_ntl_rr.cpp | 12 + .../dot_net_example/boost_math/AssemblyInfo.cpp | 44 + .../math/dot_net_example/boost_math/ReadMe.txt | 38 + .../math/dot_net_example/boost_math/Stdafx.cpp | 11 + .../libs/math/dot_net_example/boost_math/Stdafx.h | 54 + .../libs/math/dot_net_example/boost_math/app.ico | Bin 0 -> 1078 bytes .../libs/math/dot_net_example/boost_math/app.rc | 63 + .../math/dot_net_example/boost_math/boost_math.cpp | 255 + .../math/dot_net_example/boost_math/boost_math.h | 331 + .../math/dot_net_example/boost_math/boost_math.sln | 31 + .../dot_net_example/boost_math/boost_math.vcxproj | 142 + .../boost_math/boost_math.vcxproj.filters | 44 + .../math/dot_net_example/boost_math/resource.h | 9 + .../distribution_explorer/AboutDistEx.resx | 322 + .../AboutDistributionExplorer.Designer.cs | 193 + .../AboutDistributionExplorer.cs | 115 + .../AboutDistributionExplorer.resx | 781 + .../distribution_explorer/App.config | 3 + .../distribution_explorer/ClassDiagram1.cd | 11 + .../distribution_explorer/ClassDiagram2.cd | 1 + .../distribution_explorer/DistexForm.Designer.cs | 1094 + .../distribution_explorer/DistexForm.cs | 610 + .../distribution_explorer/DistexForm.resx | 294 + .../distribution_explorer/DistexSplash.Designer.cs | 141 + .../distribution_explorer/DistexSplash.cs | 126 + .../distribution_explorer/DistexSplash.resx | 384 + .../distribution_explorer/IconToolkit.ico | Bin 0 -> 1078 bytes .../distribution_explorer/Program.cs | 20 + .../Properties/AssemblyInfo.cs | 34 + .../Properties/Resources.Designer.cs | 70 + .../Properties/Resources.resx | 124 + .../Properties/Settings.Designer.cs | 26 + .../Properties/Settings.settings | 7 + .../distribution_explorer/Properties/app.manifest | 11 + .../distribution_explorer/Settings.cs | 28 + .../distribution_explorer/ToolkitLogo.bmp | Bin 0 -> 25398 bytes .../distribution_explorer/boost.png | Bin 0 -> 11789 bytes .../distexAboutBox.Designer.cs | 190 + .../distribution_explorer/distexAboutBox.cs | 116 + .../distribution_explorer/distexAboutBox.resx | 120 + .../distribution_explorer/distribution.txt | 10 + .../distribution_explorer.csproj | 216 + .../distribution_explorer.csproj.user | 21 + .../distribution_explorer.sln | 50 + .../distribution_explorer.suo | Bin 0 -> 74240 bytes .../distribution_explorer/readme.txt | 86 + src/boost/libs/math/example/HSO3.hpp | 509 + src/boost/libs/math/example/HSO3SO4.cpp | 445 + src/boost/libs/math/example/HSO4.hpp | 183 + src/boost/libs/math/example/Jamfile.v2 | 159 + src/boost/libs/math/example/airy_zeros_example.cpp | 165 + src/boost/libs/math/example/arcsine_example.cpp | 89 + .../libs/math/example/autodiff_black_scholes.cpp | 195 + .../math/example/autodiff_black_scholes_brief.cpp | 70 + .../libs/math/example/autodiff_fourth_power.cpp | 34 + .../libs/math/example/autodiff_mixed_partials.cpp | 293 + .../libs/math/example/autodiff_multiprecision.cpp | 46 + .../example/barycentric_interpolation_example.cpp | 92 + .../barycentric_interpolation_example_2.cpp | 108 + src/boost/libs/math/example/bernoulli_example.cpp | 207 + .../libs/math/example/bessel_errors_example.cpp | 171 + .../libs/math/example/bessel_zeros_example.cpp | 447 + .../libs/math/example/bessel_zeros_example_1.cpp | 213 + .../example/bessel_zeros_interator_example.cpp | 88 + src/boost/libs/math/example/big_seventh.cpp | 98 + .../math/example/binomial_coinflip_example.cpp | 243 + .../math/example/binomial_confidence_limits.cpp | 165 + .../libs/math/example/binomial_example_nag.cpp | 91 + .../libs/math/example/binomial_quiz_example.cpp | 525 + .../libs/math/example/binomial_sample_sizes.cpp | 176 + .../libs/math/example/brent_minimise_example.cpp | 730 + .../libs/math/example/c_error_policy_example.cpp | 83 + .../example/cardinal_cubic_b_spline_example.cpp | 147 + .../libs/math/example/catmull_rom_example.cpp | 45 + .../libs/math/example/chi_square_std_dev_test.cpp | 555 + src/boost/libs/math/example/constants_eg1.cpp | 192 + .../libs/math/example/continued_fractions.cpp | 150 + src/boost/libs/math/example/cstdfloat_example.cpp | 488 + .../libs/math/example/daubechies_coefficients.cpp | 221 + .../math/example/distribution_construction.cpp | 295 + src/boost/libs/math/example/double_exponential.cpp | 59 + .../libs/math/example/error_handling_example.cpp | 153 + .../libs/math/example/error_policies_example.cpp | 105 + .../libs/math/example/error_policy_example.cpp | 93 + src/boost/libs/math/example/f_test.cpp | 250 + src/boost/libs/math/example/factorial_example.cpp | 97 + src/boost/libs/math/example/fft_sines_table.cpp | 270 + .../libs/math/example/find_location_example.cpp | 174 + .../libs/math/example/find_mean_and_sd_normal.cpp | 413 + src/boost/libs/math/example/find_root_example.cpp | 169 + src/boost/libs/math/example/find_scale_example.cpp | 180 + src/boost/libs/math/example/float128_example.cpp | 289 + .../libs/math/example/float_comparison_example.cpp | 444 + src/boost/libs/math/example/gauss_example.cpp | 142 + src/boost/libs/math/example/geometric_examples.cpp | 364 + src/boost/libs/math/example/handle_test_result.hpp | 220 + .../math/example/hyperexponential_more_snips.cpp | 155 + .../libs/math/example/hyperexponential_snips.cpp | 103 + src/boost/libs/math/example/inspect_fp.cpp | 224 + .../math/example/inverse_chi_squared_bayes_eg.cpp | 338 + .../math/example/inverse_chi_squared_example.cpp | 171 + .../inverse_chi_squared_find_df_example.cpp | 186 + .../example/inverse_gamma_distribution_example.cpp | 103 + .../libs/math/example/inverse_gamma_example.cpp | 57 + .../libs/math/example/inverse_gaussian_example.cpp | 513 + .../libs/math/example/jacobi_zeta_example.cpp | 104 + .../libs/math/example/lambert_w_basic_example.cpp | 30 + src/boost/libs/math/example/lambert_w_diode.cpp | 165 + .../libs/math/example/lambert_w_diode_graph.cpp | 280 + src/boost/libs/math/example/lambert_w_example.cpp | 239 + src/boost/libs/math/example/lambert_w_graph.cpp | 286 + .../math/example/lambert_w_precision_example.cpp | 264 + .../math/example/lambert_w_simple_examples.cpp | 251 + src/boost/libs/math/example/laplace_example.cpp | 169 + .../math/example/legendre_stieltjes_example.cpp | 110 + .../libs/math/example/lexical_cast_native.cpp | 133 + .../math/example/lexical_cast_nonfinite_facets.cpp | 133 + .../math/example/naive_monte_carlo_example.cpp | 136 + src/boost/libs/math/example/nc_chi_sq_example.cpp | 115 + .../math/example/neg_binom_confidence_limits.cpp | 178 + .../math/example/neg_binomial_sample_sizes.cpp | 209 + .../math/example/negative_binomial_example1.cpp | 513 + .../math/example/negative_binomial_example2.cpp | 182 + .../libs/math/example/neumann_zeros_example_1.cpp | 85 + .../libs/math/example/nonfinite_facet_simple.cpp | 269 + .../libs/math/example/nonfinite_facet_sstream.cpp | 132 + src/boost/libs/math/example/nonfinite_legacy.cpp | 94 + .../libs/math/example/nonfinite_loopback_ok.cpp | 89 + .../libs/math/example/nonfinite_num_facet.cpp | 291 + .../example/nonfinite_num_facet_serialization.cpp | 433 + .../libs/math/example/nonfinite_num_facet_trap.cpp | 115 + .../example/nonfinite_serialization_archives.cpp | 136 + .../libs/math/example/nonfinite_signaling_NaN.cpp | 189 + .../libs/math/example/normal_misc_examples.cpp | 509 + src/boost/libs/math/example/normal_tables.cpp | 566 + .../math/example/numerical_derivative_example.cpp | 209 + .../ooura_fourier_integrals_cosine_example.cpp | 83 + .../example/ooura_fourier_integrals_example.cpp | 83 + ...ra_fourier_integrals_multiprecision_example.cpp | 98 + src/boost/libs/math/example/owens_t_example.cpp | 113 + src/boost/libs/math/example/policy_eg_1.cpp | 70 + src/boost/libs/math/example/policy_eg_10.cpp | 183 + src/boost/libs/math/example/policy_eg_2.cpp | 65 + src/boost/libs/math/example/policy_eg_3.cpp | 55 + src/boost/libs/math/example/policy_eg_4.cpp | 107 + src/boost/libs/math/example/policy_eg_5.cpp | 66 + src/boost/libs/math/example/policy_eg_6.cpp | 121 + src/boost/libs/math/example/policy_eg_7.cpp | 73 + src/boost/libs/math/example/policy_eg_8.cpp | 133 + src/boost/libs/math/example/policy_eg_9.cpp | 313 + src/boost/libs/math/example/policy_ref_snip1.cpp | 75 + src/boost/libs/math/example/policy_ref_snip10.cpp | 40 + src/boost/libs/math/example/policy_ref_snip11.cpp | 45 + src/boost/libs/math/example/policy_ref_snip12.cpp | 55 + src/boost/libs/math/example/policy_ref_snip13.cpp | 81 + src/boost/libs/math/example/policy_ref_snip2.cpp | 47 + src/boost/libs/math/example/policy_ref_snip3.cpp | 40 + src/boost/libs/math/example/policy_ref_snip4.cpp | 41 + src/boost/libs/math/example/policy_ref_snip5.cpp | 45 + src/boost/libs/math/example/policy_ref_snip6.cpp | 38 + src/boost/libs/math/example/policy_ref_snip7.cpp | 48 + src/boost/libs/math/example/policy_ref_snip8.cpp | 47 + src/boost/libs/math/example/policy_ref_snip9.cpp | 36 + .../libs/math/example/polynomial_arithmetic.cpp | 237 + .../libs/math/example/root_elliptic_finding.cpp | 878 + .../libs/math/example/root_finding_algorithms.cpp | 907 + .../libs/math/example/root_finding_example.cpp | 547 + src/boost/libs/math/example/root_finding_fifth.cpp | 485 + .../root_finding_multiprecision_example.cpp | 232 + .../libs/math/example/root_finding_n_example.cpp | 213 + .../math/example/root_finding_start_locations.cpp | 449 + .../math/example/root_n_finding_algorithms.cpp | 870 + src/boost/libs/math/example/series.cpp | 107 + src/boost/libs/math/example/sines.hpp | 47 + .../libs/math/example/skew_normal_example.cpp | 275 + src/boost/libs/math/example/special_data.cpp | 84 + .../libs/math/example/students_t_example1.cpp | 101 + .../libs/math/example/students_t_example2.cpp | 126 + .../libs/math/example/students_t_example3.cpp | 120 + .../libs/math/example/students_t_single_sample.cpp | 424 + .../libs/math/example/students_t_two_samples.cpp | 245 + src/boost/libs/math/example/table_type.hpp | 29 + .../math/example/test_cpp_float_close_fraction.cpp | 119 + .../libs/math/example/test_nonfinite_loopback.cpp | 97 + .../libs/math/example/trapezoidal_example.cpp | 29 + .../boost/math/constants/generate.hpp | 76 + .../boost/math/tools/iteration_logger.hpp | 77 + .../include_private/boost/math/tools/remez.hpp | 667 + .../include_private/boost/math/tools/solve.hpp | 79 + .../math/include_private/boost/math/tools/test.hpp | 311 + .../include_private/boost/math/tools/test_data.hpp | 967 + src/boost/libs/math/index.html | 14 + src/boost/libs/math/meta/libraries.json | 81 + src/boost/libs/math/minimax/Jamfile.v2 | 46 + src/boost/libs/math/minimax/f.cpp | 404 + src/boost/libs/math/minimax/main.cpp | 650 + src/boost/libs/math/minimax/multiprecision.hpp | 224 + src/boost/libs/math/reporting/accuracy/Jamfile.v2 | 161 + .../libs/math/reporting/accuracy/bindings.hpp | 765 + .../math/reporting/accuracy/handle_test_result.hpp | 515 + .../libs/math/reporting/accuracy/has_c99_cmath.cpp | 17 + .../math/reporting/accuracy/has_cxx17_cmath.cpp | 18 + src/boost/libs/math/reporting/accuracy/has_gsl.cpp | 12 + .../math/reporting/accuracy/has_libstdcxx_tr1.cpp | 17 + .../libs/math/reporting/accuracy/has_rmath.cpp | 13 + .../libs/math/reporting/accuracy/html/index.html | 27805 ++++++++++++++ .../libs/math/reporting/accuracy/test_bessel_i.cpp | 63 + .../reporting/accuracy/test_bessel_i_prime.cpp | 64 + .../libs/math/reporting/accuracy/test_bessel_j.cpp | 63 + .../reporting/accuracy/test_bessel_j_prime.cpp | 64 + .../libs/math/reporting/accuracy/test_bessel_k.cpp | 63 + .../reporting/accuracy/test_bessel_k_prime.cpp | 64 + .../libs/math/reporting/accuracy/test_bessel_y.cpp | 63 + .../reporting/accuracy/test_bessel_y_prime.cpp | 64 + .../libs/math/reporting/accuracy/test_beta.cpp | 63 + .../reporting/accuracy/test_binomial_coeff.cpp | 63 + .../libs/math/reporting/accuracy/test_carlson.cpp | 67 + .../libs/math/reporting/accuracy/test_cbrt.cpp | 66 + .../libs/math/reporting/accuracy/test_digamma.cpp | 63 + .../libs/math/reporting/accuracy/test_ellint_1.cpp | 63 + .../libs/math/reporting/accuracy/test_ellint_2.cpp | 63 + .../libs/math/reporting/accuracy/test_ellint_3.cpp | 63 + .../libs/math/reporting/accuracy/test_ellint_d.cpp | 63 + .../libs/math/reporting/accuracy/test_erf.cpp | 63 + .../libs/math/reporting/accuracy/test_expint.cpp | 63 + .../libs/math/reporting/accuracy/test_gamma.cpp | 66 + .../libs/math/reporting/accuracy/test_hermite.cpp | 63 + .../math/reporting/accuracy/test_heuman_lambda.cpp | 63 + .../libs/math/reporting/accuracy/test_ibeta.cpp | 63 + .../math/reporting/accuracy/test_ibeta_inv.cpp | 63 + .../math/reporting/accuracy/test_ibeta_inva.cpp | 63 + .../libs/math/reporting/accuracy/test_igamma.cpp | 61 + .../math/reporting/accuracy/test_igamma_inv.cpp | 61 + .../math/reporting/accuracy/test_igamma_inva.cpp | 63 + .../libs/math/reporting/accuracy/test_jacobi.cpp | 63 + .../math/reporting/accuracy/test_jacobi_zeta.cpp | 63 + .../libs/math/reporting/accuracy/test_laguerre.cpp | 63 + .../libs/math/reporting/accuracy/test_legendre.cpp | 63 + .../math/reporting/accuracy/test_log1p_expm1.cpp | 67 + .../libs/math/reporting/accuracy/test_nc_beta.cpp | 65 + .../reporting/accuracy/test_nc_chi_squared.cpp | 65 + .../libs/math/reporting/accuracy/test_nc_t.cpp | 65 + .../libs/math/reporting/accuracy/test_owens_t.cpp | 65 + .../math/reporting/accuracy/test_polygamma.cpp | 63 + .../libs/math/reporting/accuracy/test_powm1.cpp | 66 + .../reporting/accuracy/test_spherical_harmonic.cpp | 65 + .../math/reporting/accuracy/test_tgamma_ratio.cpp | 63 + .../libs/math/reporting/accuracy/test_trig.cpp | 64 + .../libs/math/reporting/accuracy/test_trigamma.cpp | 63 + .../libs/math/reporting/accuracy/test_zeta.cpp | 63 + .../accuracy/third_party/cephes_double/readme.txt | 7 + .../libs/math/reporting/performance/Jamfile.v2 | 188 + .../libs/math/reporting/performance/fibonacci.hpp | 1245 + .../math/reporting/performance/html/boostbook.css | 700 + .../math/reporting/performance/html/index.html | 36552 +++++++++++++++++++ .../math/reporting/performance/is_intel_win.cpp | 10 + .../math/reporting/performance/performance.hpp | 115 + .../math/reporting/performance/table_helper.cpp | 400 + .../math/reporting/performance/table_helper.hpp | 325 + .../reporting/performance/test_assoc_laguerre.cpp | 81 + .../reporting/performance/test_assoc_legendre.cpp | 80 + .../libs/math/reporting/performance/test_beta.cpp | 92 + .../math/reporting/performance/test_beta_inc.cpp | 81 + .../libs/math/reporting/performance/test_cbrt.cpp | 81 + .../libs/math/reporting/performance/test_cn.cpp | 135 + .../math/reporting/performance/test_digamma.cpp | 100 + .../reporting/performance/test_distributions.cpp | 750 + .../libs/math/reporting/performance/test_dn.cpp | 135 + .../math/reporting/performance/test_ellint_1.cpp | 102 + .../math/reporting/performance/test_ellint_1c.cpp | 92 + .../math/reporting/performance/test_ellint_2.cpp | 93 + .../math/reporting/performance/test_ellint_2c.cpp | 93 + .../math/reporting/performance/test_ellint_3.cpp | 162 + .../math/reporting/performance/test_ellint_3c.cpp | 80 + .../math/reporting/performance/test_ellint_rc.cpp | 72 + .../math/reporting/performance/test_ellint_rd.cpp | 82 + .../math/reporting/performance/test_ellint_rf.cpp | 80 + .../math/reporting/performance/test_ellint_rj.cpp | 80 + .../libs/math/reporting/performance/test_erf.cpp | 89 + .../libs/math/reporting/performance/test_erfc.cpp | 91 + .../math/reporting/performance/test_expint.cpp | 82 + .../math/reporting/performance/test_expint_n.cpp | 76 + .../libs/math/reporting/performance/test_expm1.cpp | 78 + .../math/reporting/performance/test_gamma_p.cpp | 86 + .../reporting/performance/test_gamma_p_inv.cpp | 78 + .../math/reporting/performance/test_gamma_q.cpp | 90 + .../reporting/performance/test_gamma_q_inv.cpp | 78 + .../libs/math/reporting/performance/test_gcd.cpp | 478 + .../libs/math/reporting/performance/test_ibeta.cpp | 81 + .../math/reporting/performance/test_ibeta_inv.cpp | 79 + .../math/reporting/performance/test_ibetac.cpp | 81 + .../math/reporting/performance/test_ibetac_inv.cpp | 75 + .../math/reporting/performance/test_igamma.cpp | 78 + .../libs/math/reporting/performance/test_in.cpp | 127 + .../libs/math/reporting/performance/test_iv.cpp | 113 + .../libs/math/reporting/performance/test_jn.cpp | 168 + .../libs/math/reporting/performance/test_js.cpp | 80 + .../libs/math/reporting/performance/test_jv.cpp | 119 + .../libs/math/reporting/performance/test_kn.cpp | 123 + .../libs/math/reporting/performance/test_kv.cpp | 114 + .../math/reporting/performance/test_laguerre.cpp | 81 + .../math/reporting/performance/test_legendre.cpp | 82 + .../math/reporting/performance/test_legendre_q.cpp | 74 + .../math/reporting/performance/test_lgamma.cpp | 98 + .../libs/math/reporting/performance/test_log1p.cpp | 77 + .../reporting/performance/test_poly_method.cpp | 371 + .../math/reporting/performance/test_polygamma.cpp | 221 + .../math/reporting/performance/test_polynomial.cpp | 263 + .../libs/math/reporting/performance/test_sn.cpp | 135 + .../math/reporting/performance/test_tgamma.cpp | 98 + .../math/reporting/performance/test_trigamma.cpp | 84 + .../libs/math/reporting/performance/test_yn.cpp | 135 + .../libs/math/reporting/performance/test_ys.cpp | 80 + .../libs/math/reporting/performance/test_yv.cpp | 118 + .../libs/math/reporting/performance/test_zeta.cpp | 82 + .../performance/third_party/dcdflib/readme.txt | 6 + src/boost/libs/math/src/tr1/acosh.cpp | 19 + src/boost/libs/math/src/tr1/acoshf.cpp | 19 + src/boost/libs/math/src/tr1/acoshl.cpp | 19 + src/boost/libs/math/src/tr1/asinh.cpp | 19 + src/boost/libs/math/src/tr1/asinhf.cpp | 19 + src/boost/libs/math/src/tr1/asinhl.cpp | 19 + src/boost/libs/math/src/tr1/assoc_laguerre.cpp | 19 + src/boost/libs/math/src/tr1/assoc_laguerref.cpp | 19 + src/boost/libs/math/src/tr1/assoc_laguerrel.cpp | 19 + src/boost/libs/math/src/tr1/assoc_legendre.cpp | 19 + src/boost/libs/math/src/tr1/assoc_legendref.cpp | 19 + src/boost/libs/math/src/tr1/assoc_legendrel.cpp | 19 + src/boost/libs/math/src/tr1/atanh.cpp | 19 + src/boost/libs/math/src/tr1/atanhf.cpp | 19 + src/boost/libs/math/src/tr1/atanhl.cpp | 19 + src/boost/libs/math/src/tr1/beta.cpp | 19 + src/boost/libs/math/src/tr1/betaf.cpp | 19 + src/boost/libs/math/src/tr1/betal.cpp | 19 + src/boost/libs/math/src/tr1/c_policy.hpp | 131 + src/boost/libs/math/src/tr1/cbrt.cpp | 19 + src/boost/libs/math/src/tr1/cbrtf.cpp | 19 + src/boost/libs/math/src/tr1/cbrtl.cpp | 19 + src/boost/libs/math/src/tr1/comp_ellint_1.cpp | 19 + src/boost/libs/math/src/tr1/comp_ellint_1f.cpp | 19 + src/boost/libs/math/src/tr1/comp_ellint_1l.cpp | 19 + src/boost/libs/math/src/tr1/comp_ellint_2.cpp | 19 + src/boost/libs/math/src/tr1/comp_ellint_2f.cpp | 19 + src/boost/libs/math/src/tr1/comp_ellint_2l.cpp | 19 + src/boost/libs/math/src/tr1/comp_ellint_3.cpp | 19 + src/boost/libs/math/src/tr1/comp_ellint_3f.cpp | 19 + src/boost/libs/math/src/tr1/comp_ellint_3l.cpp | 19 + src/boost/libs/math/src/tr1/copysign.cpp | 20 + src/boost/libs/math/src/tr1/copysignf.cpp | 20 + src/boost/libs/math/src/tr1/copysignl.cpp | 19 + src/boost/libs/math/src/tr1/cyl_bessel_i.cpp | 19 + src/boost/libs/math/src/tr1/cyl_bessel_if.cpp | 19 + src/boost/libs/math/src/tr1/cyl_bessel_il.cpp | 19 + src/boost/libs/math/src/tr1/cyl_bessel_j.cpp | 19 + src/boost/libs/math/src/tr1/cyl_bessel_jf.cpp | 19 + src/boost/libs/math/src/tr1/cyl_bessel_jl.cpp | 19 + src/boost/libs/math/src/tr1/cyl_bessel_k.cpp | 19 + src/boost/libs/math/src/tr1/cyl_bessel_kf.cpp | 19 + src/boost/libs/math/src/tr1/cyl_bessel_kl.cpp | 19 + src/boost/libs/math/src/tr1/cyl_neumann.cpp | 19 + src/boost/libs/math/src/tr1/cyl_neumannf.cpp | 19 + src/boost/libs/math/src/tr1/cyl_neumannl.cpp | 19 + src/boost/libs/math/src/tr1/ellint_1.cpp | 19 + src/boost/libs/math/src/tr1/ellint_1f.cpp | 19 + src/boost/libs/math/src/tr1/ellint_1l.cpp | 19 + src/boost/libs/math/src/tr1/ellint_2.cpp | 19 + src/boost/libs/math/src/tr1/ellint_2f.cpp | 19 + src/boost/libs/math/src/tr1/ellint_2l.cpp | 19 + src/boost/libs/math/src/tr1/ellint_3.cpp | 19 + src/boost/libs/math/src/tr1/ellint_3f.cpp | 19 + src/boost/libs/math/src/tr1/ellint_3l.cpp | 19 + src/boost/libs/math/src/tr1/erf.cpp | 19 + src/boost/libs/math/src/tr1/erfc.cpp | 19 + src/boost/libs/math/src/tr1/erfcf.cpp | 19 + src/boost/libs/math/src/tr1/erfcl.cpp | 19 + src/boost/libs/math/src/tr1/erff.cpp | 19 + src/boost/libs/math/src/tr1/erfl.cpp | 19 + src/boost/libs/math/src/tr1/expint.cpp | 19 + src/boost/libs/math/src/tr1/expintf.cpp | 19 + src/boost/libs/math/src/tr1/expintl.cpp | 19 + src/boost/libs/math/src/tr1/expm1.cpp | 19 + src/boost/libs/math/src/tr1/expm1f.cpp | 19 + src/boost/libs/math/src/tr1/expm1l.cpp | 19 + src/boost/libs/math/src/tr1/fmax.cpp | 23 + src/boost/libs/math/src/tr1/fmaxf.cpp | 24 + src/boost/libs/math/src/tr1/fmaxl.cpp | 23 + src/boost/libs/math/src/tr1/fmin.cpp | 23 + src/boost/libs/math/src/tr1/fminf.cpp | 24 + src/boost/libs/math/src/tr1/fminl.cpp | 23 + src/boost/libs/math/src/tr1/fpclassify.cpp | 56 + src/boost/libs/math/src/tr1/fpclassifyf.cpp | 58 + src/boost/libs/math/src/tr1/fpclassifyl.cpp | 57 + src/boost/libs/math/src/tr1/hermite.cpp | 19 + src/boost/libs/math/src/tr1/hermitef.cpp | 19 + src/boost/libs/math/src/tr1/hermitel.cpp | 19 + src/boost/libs/math/src/tr1/hypot.cpp | 23 + src/boost/libs/math/src/tr1/hypotf.cpp | 23 + src/boost/libs/math/src/tr1/hypotl.cpp | 23 + src/boost/libs/math/src/tr1/laguerre.cpp | 19 + src/boost/libs/math/src/tr1/laguerref.cpp | 19 + src/boost/libs/math/src/tr1/laguerrel.cpp | 19 + src/boost/libs/math/src/tr1/legendre.cpp | 19 + src/boost/libs/math/src/tr1/legendref.cpp | 19 + src/boost/libs/math/src/tr1/legendrel.cpp | 19 + src/boost/libs/math/src/tr1/lgamma.cpp | 23 + src/boost/libs/math/src/tr1/lgammaf.cpp | 23 + src/boost/libs/math/src/tr1/lgammal.cpp | 23 + src/boost/libs/math/src/tr1/llround.cpp | 23 + src/boost/libs/math/src/tr1/llroundf.cpp | 23 + src/boost/libs/math/src/tr1/llroundl.cpp | 23 + src/boost/libs/math/src/tr1/log1p.cpp | 23 + src/boost/libs/math/src/tr1/log1pf.cpp | 23 + src/boost/libs/math/src/tr1/log1pl.cpp | 23 + src/boost/libs/math/src/tr1/lround.cpp | 23 + src/boost/libs/math/src/tr1/lroundf.cpp | 23 + src/boost/libs/math/src/tr1/lroundl.cpp | 23 + src/boost/libs/math/src/tr1/nextafter.cpp | 23 + src/boost/libs/math/src/tr1/nextafterf.cpp | 23 + src/boost/libs/math/src/tr1/nextafterl.cpp | 23 + src/boost/libs/math/src/tr1/nexttoward.cpp | 27 + src/boost/libs/math/src/tr1/nexttowardf.cpp | 27 + src/boost/libs/math/src/tr1/nexttowardl.cpp | 23 + src/boost/libs/math/src/tr1/pch.hpp | 12 + src/boost/libs/math/src/tr1/riemann_zeta.cpp | 19 + src/boost/libs/math/src/tr1/riemann_zetaf.cpp | 19 + src/boost/libs/math/src/tr1/riemann_zetal.cpp | 19 + src/boost/libs/math/src/tr1/round.cpp | 23 + src/boost/libs/math/src/tr1/roundf.cpp | 23 + src/boost/libs/math/src/tr1/roundl.cpp | 23 + src/boost/libs/math/src/tr1/sph_bessel.cpp | 19 + src/boost/libs/math/src/tr1/sph_besself.cpp | 19 + src/boost/libs/math/src/tr1/sph_bessell.cpp | 19 + src/boost/libs/math/src/tr1/sph_legendre.cpp | 19 + src/boost/libs/math/src/tr1/sph_legendref.cpp | 19 + src/boost/libs/math/src/tr1/sph_legendrel.cpp | 19 + src/boost/libs/math/src/tr1/sph_neumann.cpp | 19 + src/boost/libs/math/src/tr1/sph_neumannf.cpp | 19 + src/boost/libs/math/src/tr1/sph_neumannl.cpp | 19 + src/boost/libs/math/src/tr1/tgamma.cpp | 23 + src/boost/libs/math/src/tr1/tgammaf.cpp | 23 + src/boost/libs/math/src/tr1/tgammal.cpp | 23 + src/boost/libs/math/src/tr1/trunc.cpp | 23 + src/boost/libs/math/src/tr1/truncf.cpp | 23 + src/boost/libs/math/src/tr1/truncl.cpp | 23 + src/boost/libs/math/test/Jamfile.v2 | 1358 + src/boost/libs/math/test/__temporary_test.cpp | 22 + src/boost/libs/math/test/acosh_data.ipp | 273 + src/boost/libs/math/test/acosh_test.hpp | 120 + .../adaptive_gauss_kronrod_quadrature_test.cpp | 315 + src/boost/libs/math/test/almost_equal.ipp | 20 + src/boost/libs/math/test/anderson_darling_test.cpp | 64 + src/boost/libs/math/test/asinh_data.ipp | 293 + src/boost/libs/math/test/asinh_test.hpp | 100 + src/boost/libs/math/test/assoc_legendre_p.ipp | 408 + src/boost/libs/math/test/atanh_data.ipp | 272 + src/boost/libs/math/test/atanh_test.hpp | 179 + src/boost/libs/math/test/bessel_i_data.ipp | 234 + src/boost/libs/math/test/bessel_i_int_data.ipp | 504 + src/boost/libs/math/test/bessel_i_prime_data.ipp | 477 + .../libs/math/test/bessel_i_prime_int_data.ipp | 1987 + src/boost/libs/math/test/bessel_j_data.ipp | 369 + src/boost/libs/math/test/bessel_j_int_data.ipp | 233 + src/boost/libs/math/test/bessel_j_large_data.ipp | 79 + src/boost/libs/math/test/bessel_j_prime_data.ipp | 733 + .../libs/math/test/bessel_j_prime_int_data.ipp | 903 + .../libs/math/test/bessel_j_prime_large_data.ipp | 147 + src/boost/libs/math/test/bessel_k_data.ipp | 272 + src/boost/libs/math/test/bessel_k_int_data.ipp | 489 + src/boost/libs/math/test/bessel_k_prime_data.ipp | 533 + .../libs/math/test/bessel_k_prime_int_data.ipp | 968 + src/boost/libs/math/test/bessel_y01_data.ipp | 109 + src/boost/libs/math/test/bessel_y01_prime_data.ipp | 207 + src/boost/libs/math/test/bessel_yn_data.ipp | 309 + src/boost/libs/math/test/bessel_yn_prime_data.ipp | 607 + src/boost/libs/math/test/bessel_yv_data.ipp | 441 + src/boost/libs/math/test/bessel_yv_prime_data.ipp | 871 + src/boost/libs/math/test/beta_exp_data.ipp | 362 + src/boost/libs/math/test/beta_med_data.ipp | 1837 + src/boost/libs/math/test/beta_small_data.ipp | 37 + src/boost/libs/math/test/binomial_data.ipp | 167 + src/boost/libs/math/test/binomial_large_data.ipp | 238 + src/boost/libs/math/test/binomial_quantile.ipp | 4042 ++ .../libs/math/test/bivariate_statistics_test.cpp | 170 + .../libs/math/test/cardinal_b_spline_test.cpp | 290 + .../math/test/cardinal_cubic_b_spline_test.cpp | 351 + .../math/test/cardinal_quadratic_b_spline_test.cpp | 130 + .../math/test/cardinal_quintic_b_spline_test.cpp | 296 + .../libs/math/test/cardinal_trigonometric_test.cpp | 233 + src/boost/libs/math/test/catmull_rom_test.cpp | 427 + src/boost/libs/math/test/cbrt_data.ipp | 93 + src/boost/libs/math/test/chebyshev_test.cpp | 147 + .../libs/math/test/chebyshev_transform_test.cpp | 263 + .../barycentric_rational_concept_test.cpp | 15 + .../barycentric_rational_incl_test.cpp | 27 + .../test/compile_test/catmull_rom_concept_test.cpp | 21 + .../test/compile_test/catmull_rom_incl_test.cpp | 28 + .../math/test/compile_test/compl_abs_incl_test.cpp | 28 + .../test/compile_test/compl_acos_incl_test.cpp | 28 + .../test/compile_test/compl_acosh_incl_test.cpp | 28 + .../test/compile_test/compl_asin_incl_test.cpp | 28 + .../test/compile_test/compl_asinh_incl_test.cpp | 28 + .../test/compile_test/compl_atan_incl_test.cpp | 28 + .../test/compile_test/compl_atanh_incl_test.cpp | 28 + .../math/test/compile_test/constants_incl_test.cpp | 24 + .../compile_test/cstdfloat_concept_check_1.cpp | 25 + .../compile_test/cstdfloat_concept_check_2.cpp | 26 + .../compile_test/cstdfloat_concept_check_3.cpp | 26 + .../compile_test/cstdfloat_concept_check_4.cpp | 26 + .../compile_test/cubic_spline_concept_test.cpp | 15 + .../test/compile_test/cubic_spline_incl_test.cpp | 22 + .../test/compile_test/dist_bernoulli_incl_test.cpp | 25 + .../math/test/compile_test/dist_beta_incl_test.cpp | 25 + .../test/compile_test/dist_binomial_incl_test.cpp | 25 + .../test/compile_test/dist_cauchy_incl_test.cpp | 26 + .../compile_test/dist_chi_squared_incl_test.cpp | 25 + .../compile_test/dist_complement_incl_test.cpp | 22 + .../compile_test/dist_exponential_incl_test.cpp | 25 + .../compile_test/dist_extreme_val_incl_test.cpp | 25 + .../compile_test/dist_find_location_incl_test.cpp | 61 + .../compile_test/dist_find_scale_incl_test.cpp | 62 + .../test/compile_test/dist_fisher_f_incl_test.cpp | 25 + .../test/compile_test/dist_gamma_incl_test.cpp | 25 + .../dist_hyperexponential_incl_test.cpp | 26 + .../test/compile_test/dist_hypergeo_incl_test.cpp | 25 + .../compile_test/dist_inv_chi_sq_incl_test.cpp | 25 + .../test/compile_test/dist_inv_gamma_incl_test.cpp | 25 + .../test/compile_test/dist_laplace_incl_test.cpp | 25 + .../test/compile_test/dist_logistic_incl_test.cpp | 25 + .../test/compile_test/dist_lognormal_incl_test.cpp | 25 + .../test/compile_test/dist_nc_beta_incl_test.cpp | 29 + .../compile_test/dist_nc_chi_squ_incl_test.cpp | 25 + .../math/test/compile_test/dist_nc_f_incl_test.cpp | 25 + .../math/test/compile_test/dist_nc_t_incl_test.cpp | 25 + .../test/compile_test/dist_neg_binom_incl_test.cpp | 25 + .../test/compile_test/dist_normal_incl_test.cpp | 25 + .../test/compile_test/dist_pareto_incl_test.cpp | 25 + .../test/compile_test/dist_poisson_incl_test.cpp | 25 + .../test/compile_test/dist_skew_norm_incl_test.cpp | 25 + .../compile_test/dist_students_t_incl_test.cpp | 25 + .../compile_test/dist_triangular_incl_test.cpp | 25 + .../test/compile_test/dist_uniform_incl_test.cpp | 25 + .../test/compile_test/dist_weibull_incl_test.cpp | 25 + .../compile_test/distribution_concept_check.cpp | 64 + .../test/compile_test/exp_sinh_concept_test.cpp | 16 + .../math/test/compile_test/exp_sinh_incl_test.cpp | 21 + .../math/test/compile_test/gauss_concept_test.cpp | 17 + .../compile_test/gauss_kronrod_concept_test.cpp | 17 + src/boost/libs/math/test/compile_test/generate.sh | 46 + .../libs/math/test/compile_test/instantiate.hpp | 1468 + src/boost/libs/math/test/compile_test/main.cpp | 13 + .../naive_monte_carlo_concept_test.cpp | 33 + .../compile_test/naive_monte_carlo_incl_test.cpp | 35 + .../numerical_differentiation_concept_test.cpp | 15 + .../numerical_differentiation_incl_test.cpp | 24 + src/boost/libs/math/test/compile_test/poison.hpp | 141 + .../math/test/compile_test/sf_airy_incl_test.cpp | 42 + .../test/compile_test/sf_bernoulli_incl_test.cpp | 37 + .../compile_test/sf_bessel_deriv_incl_test.cpp | 53 + .../math/test/compile_test/sf_bessel_incl_test.cpp | 53 + .../math/test/compile_test/sf_beta_incl_test.cpp | 42 + .../test/compile_test/sf_binomial_incl_test.cpp | 23 + .../math/test/compile_test/sf_cbrt_incl_test.cpp | 23 + .../math/test/compile_test/sf_cos_pi_incl_test.cpp | 23 + .../test/compile_test/sf_digamma_incl_test.cpp | 23 + .../test/compile_test/sf_ellint_1_incl_test.cpp | 29 + .../test/compile_test/sf_ellint_2_incl_test.cpp | 29 + .../test/compile_test/sf_ellint_3_incl_test.cpp | 29 + .../test/compile_test/sf_ellint_d_incl_test.cpp | 29 + .../test/compile_test/sf_ellint_rc_incl_test.cpp | 23 + .../test/compile_test/sf_ellint_rd_incl_test.cpp | 23 + .../test/compile_test/sf_ellint_rf_incl_test.cpp | 23 + .../test/compile_test/sf_ellint_rg_incl_test.cpp | 23 + .../test/compile_test/sf_ellint_rj_incl_test.cpp | 23 + .../math/test/compile_test/sf_erf_incl_test.cpp | 41 + .../math/test/compile_test/sf_expint_incl_test.cpp | 28 + .../math/test/compile_test/sf_expm1_incl_test.cpp | 23 + .../test/compile_test/sf_factorials_incl_test.cpp | 58 + .../test/compile_test/sf_fpclassify_incl_test.cpp | 43 + .../math/test/compile_test/sf_gamma_incl_test.cpp | 83 + .../math/test/compile_test/sf_hankel_incl_test.cpp | 46 + .../test/compile_test/sf_hermite_incl_test.cpp | 23 + .../compile_test/sf_heuman_lambda_incl_test.cpp | 23 + .../math/test/compile_test/sf_hypot_incl_test.cpp | 23 + .../math/test/compile_test/sf_jacobi_incl_test.cpp | 96 + .../test/compile_test/sf_jacobi_zeta_incl_test.cpp | 23 + .../test/compile_test/sf_laguerre_incl_test.cpp | 32 + .../test/compile_test/sf_lanczos_incl_test.cpp | 10 + .../test/compile_test/sf_legendre_incl_test.cpp | 40 + .../sf_legendre_stieltjes_concept_test.cpp | 13 + .../sf_legendre_stieltjes_incl_test.cpp | 26 + .../math/test/compile_test/sf_log1p_incl_test.cpp | 23 + .../test/compile_test/sf_math_fwd_incl_test.cpp | 10 + .../math/test/compile_test/sf_modf_incl_test.cpp | 50 + .../math/test/compile_test/sf_next_incl_test.cpp | 48 + .../test/compile_test/sf_owens_t_incl_test.cpp | 24 + .../test/compile_test/sf_polygamma_incl_test.cpp | 28 + .../math/test/compile_test/sf_powm1_incl_test.cpp | 23 + .../math/test/compile_test/sf_prime_incl_test.cpp | 28 + .../sf_relative_distance_incl_test.cpp | 28 + .../math/test/compile_test/sf_round_incl_test.cpp | 40 + .../math/test/compile_test/sf_sign_incl_test.cpp | 35 + .../math/test/compile_test/sf_sin_pi_incl_test.cpp | 23 + .../math/test/compile_test/sf_sinc_incl_test.cpp | 23 + .../math/test/compile_test/sf_sinhc_incl_test.cpp | 23 + .../test/compile_test/sf_sph_harm_incl_test.cpp | 43 + .../test/compile_test/sf_sqrt1pm1_incl_test.cpp | 23 + .../math/test/compile_test/sf_trunc_incl_test.cpp | 40 + .../math/test/compile_test/sf_ulp_incl_test.cpp | 23 + .../math/test/compile_test/sf_zeta_incl_test.cpp | 23 + .../test/compile_test/sinh_sinh_concept_test.cpp | 15 + .../math/test/compile_test/sinh_sinh_incl_test.cpp | 21 + .../test/compile_test/std_real_concept_check.cpp | 207 + .../test/compile_test/tanh_sinh_concept_test.cpp | 17 + .../math/test/compile_test/tanh_sinh_incl_test.cpp | 23 + .../math/test/compile_test/test_compile_result.hpp | 183 + .../libs/math/test/compile_test/test_traits.cpp | 56 + .../test/compile_test/tools_config_inc_test.cpp | 10 + .../test/compile_test/tools_fraction_inc_test.cpp | 10 + .../test/compile_test/tools_minima_inc_test.cpp | 10 + .../compile_test/tools_polynomial_inc_test.cpp | 10 + .../test/compile_test/tools_precision_inc_test.cpp | 10 + .../test/compile_test/tools_rational_inc_test.cpp | 10 + .../test/compile_test/tools_real_cast_inc_test.cpp | 10 + .../test/compile_test/tools_remez_inc_test.cpp | 10 + .../test/compile_test/tools_roots_inc_test.cpp | 40 + .../test/compile_test/tools_series_inc_test.cpp | 35 + .../test/compile_test/tools_solve_inc_test.cpp | 10 + .../test/compile_test/tools_stats_inc_test.cpp | 11 + .../test/compile_test/tools_test_data_inc_test.cpp | 21 + .../math/test/compile_test/tools_test_inc_test.cpp | 36 + .../test/compile_test/tools_toms748_inc_test.cpp | 18 + .../test/compile_test/tools_tuple_inc_test.cpp | 10 + .../libs/math/test/compile_test/tr1_incl_test.cpp | 366 + .../test/compile_test/trapezoidal_concept_test.cpp | 20 + .../test/compile_test/trapezoidal_incl_test.cpp | 23 + src/boost/libs/math/test/complex_test.cpp | 921 + src/boost/libs/math/test/condition_number_test.cpp | 122 + src/boost/libs/math/test/digamma_data.ipp | 507 + src/boost/libs/math/test/digamma_neg_data.ipp | 207 + src/boost/libs/math/test/digamma_root_data.ipp | 207 + src/boost/libs/math/test/digamma_small_data.ipp | 40 + src/boost/libs/math/test/e_float_concept_check.cpp | 40 + src/boost/libs/math/test/ellint_d2_data.ipp | 912 + src/boost/libs/math/test/ellint_d_data.ipp | 137 + src/boost/libs/math/test/ellint_e2_data.ipp | 532 + src/boost/libs/math/test/ellint_e_data.ipp | 112 + src/boost/libs/math/test/ellint_f_data.ipp | 624 + src/boost/libs/math/test/ellint_k_data.ipp | 107 + src/boost/libs/math/test/ellint_pi2_data.ipp | 512 + src/boost/libs/math/test/ellint_pi3_data.ipp | 412 + src/boost/libs/math/test/ellint_pi3_large_data.ipp | 392 + src/boost/libs/math/test/ellint_rc_data.ipp | 214 + src/boost/libs/math/test/ellint_rd_0xy.ipp | 327 + src/boost/libs/math/test/ellint_rd_0yy.ipp | 233 + src/boost/libs/math/test/ellint_rd_data.ipp | 214 + src/boost/libs/math/test/ellint_rd_xxx.ipp | 233 + src/boost/libs/math/test/ellint_rd_xxz.ipp | 2222 ++ src/boost/libs/math/test/ellint_rd_xyy.ipp | 4432 +++ src/boost/libs/math/test/ellint_rf_0yy.ipp | 233 + src/boost/libs/math/test/ellint_rf_data.ipp | 413 + src/boost/libs/math/test/ellint_rf_xxx.ipp | 233 + src/boost/libs/math/test/ellint_rf_xy0.ipp | 327 + src/boost/libs/math/test/ellint_rf_xyy.ipp | 6642 ++++ src/boost/libs/math/test/ellint_rg.ipp | 10005 +++++ src/boost/libs/math/test/ellint_rg_00x.ipp | 675 + src/boost/libs/math/test/ellint_rg_xxx.ipp | 675 + src/boost/libs/math/test/ellint_rg_xy0.ipp | 264 + src/boost/libs/math/test/ellint_rg_xyy.ipp | 6642 ++++ src/boost/libs/math/test/ellint_rj_data.ipp | 814 + src/boost/libs/math/test/ellint_rj_e2.ipp | 2812 ++ src/boost/libs/math/test/ellint_rj_e3.ipp | 2222 ++ src/boost/libs/math/test/ellint_rj_e4.ipp | 233 + src/boost/libs/math/test/ellint_rj_zp.ipp | 2012 + .../empirical_cumulative_distribution_test.cpp | 69 + src/boost/libs/math/test/erf_data.ipp | 507 + src/boost/libs/math/test/erf_inv_data.ipp | 108 + src/boost/libs/math/test/erf_large_data.ipp | 307 + src/boost/libs/math/test/erf_small_data.ipp | 159 + src/boost/libs/math/test/erfc_inv_big_data.ipp | 208 + src/boost/libs/math/test/erfc_inv_data.ipp | 107 + .../libs/math/test/exp_sinh_quadrature_test.cpp | 596 + src/boost/libs/math/test/expint_1_data.ipp | 87 + src/boost/libs/math/test/expint_data.ipp | 608 + src/boost/libs/math/test/expint_small_data.ipp | 388 + src/boost/libs/math/test/expinti_data.ipp | 344 + src/boost/libs/math/test/expinti_data_double.ipp | 108 + src/boost/libs/math/test/expinti_data_long.ipp | 108 + .../libs/math/test/float128/log1p_expm1_test.cpp | 79 + .../math/test/float128/powm1_sqrtp1m1_test.cpp | 82 + src/boost/libs/math/test/float128/setup.hpp | 29 + src/boost/libs/math/test/float128/table_type.hpp | 13 + .../libs/math/test/float128/test_bessel_i.cpp | 59 + .../libs/math/test/float128/test_bessel_j.cpp | 81 + .../libs/math/test/float128/test_bessel_k.cpp | 58 + .../libs/math/test/float128/test_bessel_y.cpp | 72 + src/boost/libs/math/test/float128/test_beta.cpp | 65 + .../math/test/float128/test_binomial_coeff.cpp | 52 + src/boost/libs/math/test/float128/test_carlson.cpp | 57 + src/boost/libs/math/test/float128/test_cbrt.cpp | 46 + src/boost/libs/math/test/float128/test_digamma.cpp | 51 + .../libs/math/test/float128/test_ellint_1.cpp | 44 + .../libs/math/test/float128/test_ellint_2.cpp | 44 + .../libs/math/test/float128/test_ellint_3.cpp | 58 + src/boost/libs/math/test/float128/test_erf.cpp | 59 + src/boost/libs/math/test/float128/test_expint.cpp | 44 + .../libs/math/test/float128/test_factorials.cpp | 296 + src/boost/libs/math/test/float128/test_gamma.cpp | 65 + src/boost/libs/math/test/float128/test_hermite.cpp | 44 + src/boost/libs/math/test/float128/test_ibeta.cpp | 59 + .../libs/math/test/float128/test_ibeta_inv_1.cpp | 44 + .../math/test/float128/test_ibeta_inv_ab_4.cpp | 54 + src/boost/libs/math/test/float128/test_igamma.cpp | 51 + .../libs/math/test/float128/test_igamma_inv.cpp | 51 + .../libs/math/test/float128/test_igamma_inva.cpp | 44 + .../libs/math/test/float128/test_laguerre.cpp | 44 + .../libs/math/test/float128/test_legendre.cpp | 44 + .../libs/math/test/float128/test_polygamma.cpp | 51 + src/boost/libs/math/test/float128/test_std_lib.cpp | 241 + .../libs/math/test/float128/test_tgamma_ratio.cpp | 44 + .../libs/math/test/float128/test_trigamma.cpp | 44 + src/boost/libs/math/test/float128/test_zeta.cpp | 44 + src/boost/libs/math/test/functor.hpp | 213 + src/boost/libs/math/test/gamma_inv_big_data.ipp | 139 + src/boost/libs/math/test/gamma_inv_data.ipp | 207 + src/boost/libs/math/test/gamma_inv_small_data.ipp | 237 + .../math/test/gauss_kronrod_quadrature_test.cpp | 528 + src/boost/libs/math/test/gauss_quadrature_test.cpp | 515 + src/boost/libs/math/test/gegenbauer_test.cpp | 126 + src/boost/libs/math/test/handle_test_result.hpp | 220 + src/boost/libs/math/test/hermite.ipp | 428 + src/boost/libs/math/test/heuman_lambda_data.ipp | 1088 + src/boost/libs/math/test/hypergeometric_0F2.ipp | 269 + src/boost/libs/math/test/hypergeometric_1F1.ipp | 2573 ++ .../libs/math/test/hypergeometric_1F1_big.ipp | 2397 ++ .../test/hypergeometric_1F1_big_double_limited.ipp | 21 + .../math/test/hypergeometric_1F1_big_unsolved.ipp | 35 + .../math/test/hypergeometric_1F1_small_random.ipp | 525 + src/boost/libs/math/test/hypergeometric_1F2.ipp | 217 + .../test/hypergeometric_1f1_large_regularized.ipp | 2022 + .../math/test/hypergeometric_1f1_log_large.ipp | 1954 + .../test/hypergeometric_1f1_log_large_unsolved.ipp | 42 + src/boost/libs/math/test/hypergeometric_2F0.ipp | 1293 + .../libs/math/test/hypergeometric_2F0_half.ipp | 165 + .../math/test/hypergeometric_2F0_integer_a2.ipp | 1293 + .../libs/math/test/hypergeometric_2F0_large_z.ipp | 1293 + src/boost/libs/math/test/hypergeometric_2F1.ipp | 515 + src/boost/libs/math/test/hypergeometric_2F2.ipp | 239 + .../libs/math/test/hypergeometric_dist_data2.ipp | 1557 + .../libs/math/test/hypergeometric_test_data.ipp | 412 + src/boost/libs/math/test/hypot_test.cpp | 130 + src/boost/libs/math/test/ibeta_data.ipp | 509 + src/boost/libs/math/test/ibeta_derivative_data.ipp | 509 + .../libs/math/test/ibeta_derivative_int_data.ipp | 1009 + .../libs/math/test/ibeta_derivative_large_data.ipp | 1219 + .../libs/math/test/ibeta_derivative_small_data.ipp | 509 + src/boost/libs/math/test/ibeta_int_data.ipp | 1008 + src/boost/libs/math/test/ibeta_inv_data.ipp | 1217 + src/boost/libs/math/test/ibeta_inva_data.ipp | 1108 + src/boost/libs/math/test/ibeta_large_data.ipp | 1219 + src/boost/libs/math/test/ibeta_small_data.ipp | 509 + src/boost/libs/math/test/igamma_big_data.ipp | 295 + src/boost/libs/math/test/igamma_int_data.ipp | 149 + src/boost/libs/math/test/igamma_inva_data.ipp | 443 + src/boost/libs/math/test/igamma_med_data.ipp | 710 + src/boost/libs/math/test/igamma_small_data.ipp | 261 + src/boost/libs/math/test/jacobi_elliptic.ipp | 414 + src/boost/libs/math/test/jacobi_elliptic_small.ipp | 1695 + src/boost/libs/math/test/jacobi_large_phi.ipp | 314 + src/boost/libs/math/test/jacobi_near_1.ipp | 354 + src/boost/libs/math/test/jacobi_test.cpp | 116 + src/boost/libs/math/test/jacobi_zeta_big_phi.ipp | 412 + src/boost/libs/math/test/jacobi_zeta_data.ipp | 2012 + src/boost/libs/math/test/laguerre2.ipp | 288 + src/boost/libs/math/test/laguerre3.ipp | 2248 ++ .../math/test/lambert_w_high_reference_values.ipp | 933 + .../math/test/lambert_w_low_reference_values.ipp | 236 + .../libs/math/test/lanczos_smoothing_test.cpp | 708 + src/boost/libs/math/test/legendre_p.ipp | 148 + src/boost/libs/math/test/legendre_p_large.ipp | 168 + .../libs/math/test/legendre_stieltjes_test.cpp | 141 + src/boost/libs/math/test/ljung_box_test.cpp | 54 + src/boost/libs/math/test/log1p_expm1_data.ipp | 91 + src/boost/libs/math/test/log1p_expm1_test.cpp | 93 + src/boost/libs/math/test/log1p_expm1_test.hpp | 93 + src/boost/libs/math/test/math_unit_test.hpp | 150 + src/boost/libs/math/test/mpfr_concept_check.cpp | 37 + src/boost/libs/math/test/mpreal_concept_check.cpp | 33 + .../libs/math/test/multiprc_concept_check_1.cpp | 41 + .../libs/math/test/multiprc_concept_check_2.cpp | 41 + .../libs/math/test/multiprc_concept_check_3.cpp | 45 + .../libs/math/test/multiprc_concept_check_4.cpp | 48 + .../libs/math/test/naive_monte_carlo_test.cpp | 544 + src/boost/libs/math/test/ncbeta.ipp | 3010 ++ src/boost/libs/math/test/ncbeta_big.ipp | 82 + src/boost/libs/math/test/nccs.ipp | 3210 ++ src/boost/libs/math/test/nccs_big.ipp | 240 + src/boost/libs/math/test/nct.ipp | 229 + src/boost/libs/math/test/nct_asym.ipp | 40 + src/boost/libs/math/test/nct_small_delta.ipp | 92 + .../libs/math/test/negative_binomial_quantile.ipp | 802 + src/boost/libs/math/test/noeh_support.cpp | 25 + src/boost/libs/math/test/norms_test.cpp | 912 + src/boost/libs/math/test/ntl_concept_check.cpp | 35 + src/boost/libs/math/test/octonion_test.cpp | 775 + .../libs/math/test/ooura_fourier_integral_test.cpp | 377 + src/boost/libs/math/test/owens_t.ipp | 410 + src/boost/libs/math/test/owens_t_T7.hpp | 224 + src/boost/libs/math/test/owens_t_large_data.ipp | 668 + src/boost/libs/math/test/pch.hpp | 22 + src/boost/libs/math/test/pch_light.hpp | 21 + src/boost/libs/math/test/poisson_quantile.ipp | 632 + .../libs/math/test/polynomial_concept_check.cpp | 57 + src/boost/libs/math/test/pow_test.cpp | 226 + src/boost/libs/math/test/powm1_data.ipp | 5468 +++ src/boost/libs/math/test/powm1_sqrtp1m1_test.cpp | 78 + src/boost/libs/math/test/powm1_sqrtp1m1_test.hpp | 1610 + .../libs/math/test/quaternion_constexpr_test.cpp | 165 + src/boost/libs/math/test/quaternion_mi1.cpp | 18 + src/boost/libs/math/test/quaternion_mi1.h | 13 + src/boost/libs/math/test/quaternion_mi2.cpp | 18 + src/boost/libs/math/test/quaternion_mi2.h | 13 + .../libs/math/test/quaternion_mult_incl_test.cpp | 37 + src/boost/libs/math/test/quaternion_test.cpp | 831 + src/boost/libs/math/test/s_.ipp | 68 + .../libs/math/test/signal_statistics_test.cpp | 331 + src/boost/libs/math/test/sinc_data.ipp | 99 + src/boost/libs/math/test/sinc_test.hpp | 92 + .../libs/math/test/sinh_sinh_quadrature_test.cpp | 307 + src/boost/libs/math/test/sinhc_test.hpp | 92 + .../libs/math/test/special_functions_test.cpp | 148 + src/boost/libs/math/test/sph_bessel_data.ipp | 491 + src/boost/libs/math/test/sph_bessel_prime_data.ipp | 492 + src/boost/libs/math/test/sph_neumann_data.ipp | 293 + .../libs/math/test/sph_neumann_prime_data.ipp | 273 + src/boost/libs/math/test/spherical_harmonic.ipp | 1010 + .../libs/math/test/std_real_concept_check.cpp | 199 + src/boost/libs/math/test/table_type.hpp | 29 + .../libs/math/test/tanh_sinh_quadrature_test.cpp | 989 + src/boost/libs/math/test/test_0F1.cpp | 93 + src/boost/libs/math/test/test_0F1.hpp | 219 + src/boost/libs/math/test/test_1F0.cpp | 29 + src/boost/libs/math/test/test_1F0.hpp | 60 + src/boost/libs/math/test/test_1F1.cpp | 194 + src/boost/libs/math/test/test_1F1.hpp | 381 + src/boost/libs/math/test/test_1F1_log.cpp | 194 + src/boost/libs/math/test/test_1F1_log.hpp | 88 + src/boost/libs/math/test/test_1F1_regularized.cpp | 194 + src/boost/libs/math/test/test_1F1_regularized.hpp | 77 + src/boost/libs/math/test/test_2F0.cpp | 97 + src/boost/libs/math/test/test_2F0.hpp | 102 + src/boost/libs/math/test/test_airy.cpp | 87 + src/boost/libs/math/test/test_archive.cpp | 239 + src/boost/libs/math/test/test_arcsine.cpp | 605 + src/boost/libs/math/test/test_autodiff.hpp | 225 + src/boost/libs/math/test/test_autodiff_1.cpp | 695 + src/boost/libs/math/test/test_autodiff_2.cpp | 512 + src/boost/libs/math/test/test_autodiff_3.cpp | 343 + src/boost/libs/math/test/test_autodiff_4.cpp | 194 + src/boost/libs/math/test/test_autodiff_5.cpp | 120 + src/boost/libs/math/test/test_autodiff_6.cpp | 280 + src/boost/libs/math/test/test_autodiff_7.cpp | 67 + src/boost/libs/math/test/test_autodiff_8.cpp | 506 + .../libs/math/test/test_barycentric_rational.cpp | 295 + src/boost/libs/math/test/test_basic_nonfinite.cpp | 272 + src/boost/libs/math/test/test_bernoulli.cpp | 328 + .../libs/math/test/test_bernoulli_constants.cpp | 236 + .../libs/math/test/test_bessel_airy_zeros.cpp | 985 + src/boost/libs/math/test/test_bessel_hooks.hpp | 97 + src/boost/libs/math/test/test_bessel_i.cpp | 154 + src/boost/libs/math/test/test_bessel_i.hpp | 180 + src/boost/libs/math/test/test_bessel_i_prime.cpp | 182 + src/boost/libs/math/test/test_bessel_i_prime.hpp | 183 + src/boost/libs/math/test/test_bessel_j.cpp | 309 + src/boost/libs/math/test/test_bessel_j.hpp | 274 + src/boost/libs/math/test/test_bessel_j_prime.cpp | 309 + src/boost/libs/math/test/test_bessel_j_prime.hpp | 276 + src/boost/libs/math/test/test_bessel_k.cpp | 138 + src/boost/libs/math/test/test_bessel_k.hpp | 175 + src/boost/libs/math/test/test_bessel_k_prime.cpp | 129 + src/boost/libs/math/test/test_bessel_k_prime.hpp | 179 + src/boost/libs/math/test/test_bessel_y.cpp | 269 + src/boost/libs/math/test/test_bessel_y.hpp | 218 + src/boost/libs/math/test/test_bessel_y_prime.cpp | 269 + src/boost/libs/math/test/test_bessel_y_prime.hpp | 221 + src/boost/libs/math/test/test_beta.cpp | 139 + src/boost/libs/math/test/test_beta.hpp | 103 + src/boost/libs/math/test/test_beta_dist.cpp | 664 + src/boost/libs/math/test/test_beta_hooks.hpp | 122 + src/boost/libs/math/test/test_binomial.cpp | 774 + src/boost/libs/math/test/test_binomial_coeff.cpp | 142 + src/boost/libs/math/test/test_binomial_coeff.hpp | 80 + src/boost/libs/math/test/test_carlson.cpp | 203 + src/boost/libs/math/test/test_carlson.hpp | 468 + src/boost/libs/math/test/test_cauchy.cpp | 741 + src/boost/libs/math/test/test_cbrt.cpp | 92 + src/boost/libs/math/test/test_cbrt.hpp | 87 + src/boost/libs/math/test/test_chi_squared.cpp | 594 + src/boost/libs/math/test/test_classify.cpp | 313 + .../libs/math/test/test_constant_generate.cpp | 192 + src/boost/libs/math/test/test_constants.cpp | 854 + src/boost/libs/math/test/test_cstdfloat.cpp | 562 + src/boost/libs/math/test/test_difference.cpp | 161 + src/boost/libs/math/test/test_digamma.cpp | 133 + src/boost/libs/math/test/test_digamma.hpp | 103 + src/boost/libs/math/test/test_dist_overloads.cpp | 101 + src/boost/libs/math/test/test_ellint_1.cpp | 101 + src/boost/libs/math/test/test_ellint_1.hpp | 149 + src/boost/libs/math/test/test_ellint_2.cpp | 102 + src/boost/libs/math/test/test_ellint_2.hpp | 141 + src/boost/libs/math/test/test_ellint_3.cpp | 106 + src/boost/libs/math/test/test_ellint_3.hpp | 224 + src/boost/libs/math/test/test_ellint_d.cpp | 100 + src/boost/libs/math/test/test_ellint_d.hpp | 124 + src/boost/libs/math/test/test_erf.cpp | 296 + src/boost/libs/math/test/test_erf.hpp | 215 + src/boost/libs/math/test/test_erf_hooks.hpp | 105 + src/boost/libs/math/test/test_error_handling.cpp | 470 + src/boost/libs/math/test/test_expint.cpp | 147 + src/boost/libs/math/test/test_expint.hpp | 194 + src/boost/libs/math/test/test_expint_hooks.hpp | 94 + src/boost/libs/math/test/test_exponential_dist.cpp | 303 + src/boost/libs/math/test/test_extreme_value.cpp | 247 + src/boost/libs/math/test/test_factorials.cpp | 386 + src/boost/libs/math/test/test_find_location.cpp | 177 + src/boost/libs/math/test/test_find_scale.cpp | 212 + src/boost/libs/math/test/test_fisher_f.cpp | 552 + src/boost/libs/math/test/test_gamma.cpp | 340 + src/boost/libs/math/test/test_gamma.hpp | 337 + src/boost/libs/math/test/test_gamma_data.ipp | 568 + src/boost/libs/math/test/test_gamma_dist.cpp | 268 + src/boost/libs/math/test/test_gamma_hooks.hpp | 281 + src/boost/libs/math/test/test_gamma_mp.cpp | 179 + src/boost/libs/math/test/test_geometric.cpp | 802 + src/boost/libs/math/test/test_hankel.cpp | 149 + src/boost/libs/math/test/test_hermite.cpp | 116 + src/boost/libs/math/test/test_hermite.hpp | 106 + src/boost/libs/math/test/test_heuman_lambda.cpp | 100 + src/boost/libs/math/test/test_heuman_lambda.hpp | 75 + .../libs/math/test/test_hyperexponential_dist.cpp | 388 + .../libs/math/test/test_hypergeometric_dist.cpp | 501 + src/boost/libs/math/test/test_ibeta.cpp | 332 + src/boost/libs/math/test/test_ibeta.hpp | 442 + src/boost/libs/math/test/test_ibeta_derivative.cpp | 188 + src/boost/libs/math/test/test_ibeta_derivative.hpp | 134 + src/boost/libs/math/test/test_ibeta_inv.cpp | 222 + src/boost/libs/math/test/test_ibeta_inv.hpp | 274 + src/boost/libs/math/test/test_ibeta_inv_ab.cpp | 131 + src/boost/libs/math/test/test_ibeta_inv_ab.hpp | 216 + src/boost/libs/math/test/test_igamma.cpp | 377 + src/boost/libs/math/test/test_igamma.hpp | 253 + src/boost/libs/math/test/test_igamma_inv.cpp | 230 + src/boost/libs/math/test/test_igamma_inv.hpp | 233 + src/boost/libs/math/test/test_igamma_inva.cpp | 139 + src/boost/libs/math/test/test_igamma_inva.hpp | 192 + src/boost/libs/math/test/test_instances/Jamfile.v2 | 39 + .../test_instances/double_test_instances_1.cpp | 16 + .../test_instances/double_test_instances_10.cpp | 16 + .../test_instances/double_test_instances_2.cpp | 16 + .../test_instances/double_test_instances_3.cpp | 19 + .../test_instances/double_test_instances_4.cpp | 27 + .../test_instances/double_test_instances_5.cpp | 18 + .../test_instances/double_test_instances_6.cpp | 23 + .../test_instances/double_test_instances_7.cpp | 17 + .../test_instances/double_test_instances_8.cpp | 16 + .../test_instances/double_test_instances_9.cpp | 17 + .../test/test_instances/float_test_instances_1.cpp | 16 + .../test_instances/float_test_instances_10.cpp | 16 + .../test/test_instances/float_test_instances_2.cpp | 16 + .../test/test_instances/float_test_instances_3.cpp | 19 + .../test/test_instances/float_test_instances_4.cpp | 27 + .../test/test_instances/float_test_instances_5.cpp | 18 + .../test/test_instances/float_test_instances_6.cpp | 23 + .../test/test_instances/float_test_instances_7.cpp | 17 + .../test/test_instances/float_test_instances_8.cpp | 16 + .../test/test_instances/float_test_instances_9.cpp | 17 + .../test_instances/ldouble_test_instances_10.cpp | 19 + .../test_instances/ldouble_test_instances_2.cpp | 19 + .../test_instances/ldouble_test_instances_3.cpp | 22 + .../test_instances/ldouble_test_instances_4.cpp | 30 + .../test_instances/ldouble_test_instances_5.cpp | 21 + .../test_instances/ldouble_test_instances_6.cpp | 26 + .../test_instances/ldouble_test_instances_7.cpp | 20 + .../test_instances/ldouble_test_instances_8.cpp | 19 + .../test_instances/ldouble_test_instances_9.cpp | 20 + .../long_double_test_instances_1.cpp | 19 + src/boost/libs/math/test/test_instances/pch.hpp | 10 + .../real_concept_test_instances_1.cpp | 22 + .../real_concept_test_instances_10.cpp | 22 + .../real_concept_test_instances_2.cpp | 22 + .../real_concept_test_instances_3.cpp | 25 + .../real_concept_test_instances_4.cpp | 33 + .../real_concept_test_instances_5.cpp | 24 + .../real_concept_test_instances_6.cpp | 29 + .../real_concept_test_instances_7.cpp | 23 + .../real_concept_test_instances_8.cpp | 22 + .../real_concept_test_instances_9.cpp | 23 + .../math/test/test_instances/test_instances.hpp | 467 + src/boost/libs/math/test/test_instantiate1.cpp | 22 + src/boost/libs/math/test/test_instantiate2.cpp | 16 + src/boost/libs/math/test/test_inv_hyp.cpp | 286 + .../test/test_inverse_chi_squared_distribution.cpp | 526 + .../math/test/test_inverse_gamma_distribution.cpp | 454 + src/boost/libs/math/test/test_inverse_gaussian.cpp | 355 + src/boost/libs/math/test/test_jacobi.cpp | 135 + src/boost/libs/math/test/test_jacobi.hpp | 190 + src/boost/libs/math/test/test_jacobi_zeta.cpp | 100 + src/boost/libs/math/test/test_jacobi_zeta.hpp | 94 + src/boost/libs/math/test/test_laguerre.cpp | 173 + src/boost/libs/math/test/test_laguerre.hpp | 139 + src/boost/libs/math/test/test_lambert_w.cpp | 1145 + .../libs/math/test/test_lambert_w_derivative.cpp | 124 + .../math/test/test_lambert_w_integrals_double.cpp | 266 + .../math/test/test_lambert_w_integrals_float.cpp | 267 + .../test/test_lambert_w_integrals_float128.cpp | 276 + .../test/test_lambert_w_integrals_long_double.cpp | 266 + .../math/test/test_lambert_w_integrals_quad.cpp | 269 + src/boost/libs/math/test/test_laplace.cpp | 585 + src/boost/libs/math/test/test_ldouble_simple.cpp | 33 + src/boost/libs/math/test/test_legacy_nonfinite.cpp | 185 + src/boost/libs/math/test/test_legendre.cpp | 231 + src/boost/libs/math/test/test_legendre.hpp | 367 + src/boost/libs/math/test/test_legendre_hooks.hpp | 41 + src/boost/libs/math/test/test_lexical_cast.cpp | 122 + src/boost/libs/math/test/test_logistic_dist.cpp | 378 + src/boost/libs/math/test/test_lognormal.cpp | 314 + .../libs/math/test/test_long_double_support.cpp | 364 + src/boost/libs/math/test/test_math_fwd.cpp | 62 + src/boost/libs/math/test/test_minima.cpp | 64 + src/boost/libs/math/test/test_nc_beta.cpp | 300 + src/boost/libs/math/test/test_nc_beta.hpp | 195 + src/boost/libs/math/test/test_nc_chi_squared.cpp | 154 + src/boost/libs/math/test/test_nc_chi_squared.hpp | 444 + src/boost/libs/math/test/test_nc_f.cpp | 314 + src/boost/libs/math/test/test_nc_t.cpp | 502 + src/boost/libs/math/test/test_nc_t.hpp | 731 + src/boost/libs/math/test/test_ncbeta_hooks.hpp | 39 + src/boost/libs/math/test/test_nccs_hooks.hpp | 61 + .../libs/math/test/test_negative_binomial.cpp | 861 + src/boost/libs/math/test/test_next.cpp | 273 + src/boost/libs/math/test/test_next_decimal.cpp | 207 + src/boost/libs/math/test/test_nonfinite_io.cpp | 342 + src/boost/libs/math/test/test_nonfinite_trap.cpp | 239 + src/boost/libs/math/test/test_normal.cpp | 391 + .../math/test/test_numerical_differentiation.cpp | 245 + src/boost/libs/math/test/test_out_of_range.hpp | 175 + src/boost/libs/math/test/test_owens_t.cpp | 247 + src/boost/libs/math/test/test_owens_t.hpp | 165 + src/boost/libs/math/test/test_pFq.cpp | 46 + src/boost/libs/math/test/test_pFq.hpp | 312 + src/boost/libs/math/test/test_pFq_precision.cpp | 247 + src/boost/libs/math/test/test_pareto.cpp | 365 + src/boost/libs/math/test/test_poisson.cpp | 650 + src/boost/libs/math/test/test_policy.cpp | 177 + src/boost/libs/math/test/test_policy_2.cpp | 47 + src/boost/libs/math/test/test_policy_3.cpp | 48 + src/boost/libs/math/test/test_policy_4.cpp | 47 + src/boost/libs/math/test/test_policy_5.cpp | 48 + src/boost/libs/math/test/test_policy_6.cpp | 47 + src/boost/libs/math/test/test_policy_7.cpp | 44 + src/boost/libs/math/test/test_policy_8.cpp | 50 + src/boost/libs/math/test/test_policy_9.cpp | 95 + src/boost/libs/math/test/test_policy_sf.cpp | 139 + src/boost/libs/math/test/test_polygamma.cpp | 96 + src/boost/libs/math/test/test_polygamma.hpp | 221 + src/boost/libs/math/test/test_polynomial.cpp | 614 + .../libs/math/test/test_print_info_on_type.cpp | 75 + .../test/test_rational_instances/test_rational.hpp | 5480 +++ .../test_rational_double1.cpp | 10 + .../test_rational_double2.cpp | 10 + .../test_rational_double3.cpp | 10 + .../test_rational_double4.cpp | 10 + .../test_rational_double5.cpp | 9 + .../test_rational_float1.cpp | 10 + .../test_rational_float2.cpp | 10 + .../test_rational_float3.cpp | 10 + .../test_rational_float4.cpp | 11 + .../test_rational_ldouble1.cpp | 10 + .../test_rational_ldouble2.cpp | 10 + .../test_rational_ldouble3.cpp | 10 + .../test_rational_ldouble4.cpp | 11 + .../test_rational_ldouble5.cpp | 9 + .../test_rational_real_concept1.cpp | 15 + .../test_rational_real_concept2.cpp | 15 + .../test_rational_real_concept3.cpp | 15 + .../test_rational_real_concept4.cpp | 16 + .../test_rational_real_concept5.cpp | 15 + src/boost/libs/math/test/test_rationals.cpp | 48 + src/boost/libs/math/test/test_rayleigh.cpp | 332 + src/boost/libs/math/test/test_real_concept.cpp | 578 + .../libs/math/test/test_real_concept_neg_bin.cpp | 52 + src/boost/libs/math/test/test_recurrence.cpp | 176 + src/boost/libs/math/test/test_remez.cpp | 187 + .../libs/math/test/test_root_finding_concepts.cpp | 254 + src/boost/libs/math/test/test_root_iterations.cpp | 325 + src/boost/libs/math/test/test_roots.cpp | 663 + src/boost/libs/math/test/test_round.cpp | 467 + src/boost/libs/math/test/test_runs_test.cpp | 77 + src/boost/libs/math/test/test_sign.cpp | 157 + src/boost/libs/math/test/test_signed_zero.cpp | 266 + src/boost/libs/math/test/test_sinc.cpp | 110 + src/boost/libs/math/test/test_sinc.hpp | 64 + src/boost/libs/math/test/test_skew_normal.cpp | 529 + .../libs/math/test/test_spherical_harmonic.cpp | 131 + .../libs/math/test/test_spherical_harmonic.hpp | 213 + src/boost/libs/math/test/test_students_t.cpp | 770 + src/boost/libs/math/test/test_t_test.cpp | 95 + src/boost/libs/math/test/test_tgamma_ratio.cpp | 180 + src/boost/libs/math/test/test_tgamma_ratio.hpp | 183 + src/boost/libs/math/test/test_toms748_solve.cpp | 273 + src/boost/libs/math/test/test_tr1.c | 1066 + src/boost/libs/math/test/test_tr1.cpp | 1627 + src/boost/libs/math/test/test_trapezoidal.cpp | 290 + src/boost/libs/math/test/test_triangular.cpp | 761 + src/boost/libs/math/test/test_trig.cpp | 82 + src/boost/libs/math/test/test_trig.hpp | 87 + src/boost/libs/math/test/test_trigamma.cpp | 56 + src/boost/libs/math/test/test_trigamma.hpp | 78 + src/boost/libs/math/test/test_uniform.cpp | 461 + src/boost/libs/math/test/test_value.hpp | 120 + .../math/test/test_vector_barycentric_rational.cpp | 385 + src/boost/libs/math/test/test_weibull.cpp | 399 + src/boost/libs/math/test/test_zeta.cpp | 133 + src/boost/libs/math/test/test_zeta.hpp | 177 + src/boost/libs/math/test/test_zeta_hooks.hpp | 56 + .../libs/math/test/tgamma_delta_ratio_data.ipp | 567 + .../libs/math/test/tgamma_delta_ratio_int.ipp | 352 + .../libs/math/test/tgamma_delta_ratio_int2.ipp | 197 + src/boost/libs/math/test/tgamma_mp_data.hpp | 417 + src/boost/libs/math/test/tgamma_ratio_data.ipp | 407 + src/boost/libs/math/test/trig_data.ipp | 426 + src/boost/libs/math/test/trig_data2.ipp | 160 + .../libs/math/test/univariate_statistics_test.cpp | 794 + .../libs/math/test/whittaker_shannon_test.cpp | 142 + src/boost/libs/math/test/zeta_1_below_data.ipp | 31 + src/boost/libs/math/test/zeta_1_up_data.ipp | 32 + src/boost/libs/math/test/zeta_data.ipp | 208 + src/boost/libs/math/test/zeta_neg_data.ipp | 207 + src/boost/libs/math/tools/Jamfile.v2 | 47 + src/boost/libs/math/tools/bessel_data.cpp | 355 + .../tools/bessel_derivative_append_negative.cpp | 305 + .../libs/math/tools/bessel_derivative_data.cpp | 166 + .../bessel_derivative_data_from_bessel_ipps.cpp | 213 + src/boost/libs/math/tools/beta_data.cpp | 68 + src/boost/libs/math/tools/carlson_ellint_data.cpp | 630 + src/boost/libs/math/tools/cbrt_data.cpp | 64 + src/boost/libs/math/tools/digamma_data.cpp | 64 + src/boost/libs/math/tools/ellint_d2_data.cpp | 64 + src/boost/libs/math/tools/ellint_d_data.cpp | 62 + src/boost/libs/math/tools/ellint_e_data.cpp | 60 + src/boost/libs/math/tools/ellint_f_data.cpp | 72 + src/boost/libs/math/tools/ellint_k_data.cpp | 60 + src/boost/libs/math/tools/ellint_pi2_data.cpp | 59 + src/boost/libs/math/tools/ellint_pi3_data.cpp | 75 + src/boost/libs/math/tools/erf_data.cpp | 218 + src/boost/libs/math/tools/expint_data.cpp | 64 + src/boost/libs/math/tools/expint_i_data.cpp | 50 + src/boost/libs/math/tools/factorial_tables.cpp | 41 + src/boost/libs/math/tools/gamma_P_inva_data.cpp | 69 + .../libs/math/tools/gauss_kronrod_constants.cpp | 158 + .../libs/math/tools/generate_rational_code.cpp | 738 + .../libs/math/tools/generate_rational_test.cpp | 524 + src/boost/libs/math/tools/generate_test_values.cpp | 41 + src/boost/libs/math/tools/hermite_data.cpp | 67 + src/boost/libs/math/tools/heuman_lambda_data.cpp | 67 + src/boost/libs/math/tools/hyp_0f2_data.cpp | 113 + src/boost/libs/math/tools/hyp_1f1_big_data.cpp | 179 + src/boost/libs/math/tools/hyp_1f1_data.cpp | 143 + src/boost/libs/math/tools/hyp_1f1_log_big_data.cpp | 132 + src/boost/libs/math/tools/hyp_1f1_reg_big_data.cpp | 127 + src/boost/libs/math/tools/hyp_1f2_data.cpp | 116 + src/boost/libs/math/tools/hyp_2f0_data.cpp | 85 + src/boost/libs/math/tools/hyp_2f1_data.cpp | 100 + src/boost/libs/math/tools/hyp_2f2_data.cpp | 121 + .../math/tools/hypergeometric_1F1_error_plot.cpp | 224 + ...hypergeometric_1F1_map_neg_b_fwd_recurrence.cpp | 193 + .../libs/math/tools/hypergeometric_dist_data.cpp | 95 + src/boost/libs/math/tools/ibeta_data.cpp | 303 + .../libs/math/tools/ibeta_derivative_data.cpp | 68 + src/boost/libs/math/tools/ibeta_inv_data.cpp | 86 + src/boost/libs/math/tools/ibeta_invab_data.cpp | 91 + src/boost/libs/math/tools/igamma_data.cpp | 177 + .../libs/math/tools/igamma_temme_large_coef.cpp | 206 + src/boost/libs/math/tools/inv_hyp_data.cpp | 131 + src/boost/libs/math/tools/jacobi_zeta_data.cpp | 64 + src/boost/libs/math/tools/laguerre_data.cpp | 101 + .../libs/math/tools/lambert_w_errors_graph.cpp | 262 + .../math/tools/lambert_w_high_reference_values.cpp | 182 + .../tools/lambert_w_lookup_table_generator.cpp | 469 + .../math/tools/lambert_w_low_reference_values.cpp | 237 + src/boost/libs/math/tools/lanczos_generator.cpp | 5198 +++ src/boost/libs/math/tools/legendre_data.cpp | 101 + src/boost/libs/math/tools/log1p_expm1_data.cpp | 59 + src/boost/libs/math/tools/mp_t.hpp | 71 + src/boost/libs/math/tools/process_perf_results.cpp | 142 + src/boost/libs/math/tools/rational_tests.cpp | 365 + src/boost/libs/math/tools/sinc_data.cpp | 71 + .../libs/math/tools/spherical_harmonic_data.cpp | 86 + src/boost/libs/math/tools/tgamma_large_data.cpp | 75 + src/boost/libs/math/tools/tgamma_ratio_data.cpp | 91 + src/boost/libs/math/tools/trig_data.cpp | 83 + src/boost/libs/math/tools/zeta_data.cpp | 72 + src/boost/libs/math/vc71_fix/Jamfile.v2 | 6 + src/boost/libs/math/vc71_fix/instantiate_all.cpp | 31 + 1218 files changed, 355929 insertions(+) create mode 100644 src/boost/libs/math/README.md create mode 100644 src/boost/libs/math/build/Jamfile.v2 create mode 100644 src/boost/libs/math/config/Jamfile.v2 create mode 100644 src/boost/libs/math/config/has_128bit_floatmax_t.cpp create mode 100644 src/boost/libs/math/config/has_e_float.cpp create mode 100644 src/boost/libs/math/config/has_fftw3.cpp create mode 100644 src/boost/libs/math/config/has_float128.cpp create mode 100644 src/boost/libs/math/config/has_gcc_visibility.cpp create mode 100644 src/boost/libs/math/config/has_gmp.cpp create mode 100644 src/boost/libs/math/config/has_gmpxx.cpp create mode 100644 src/boost/libs/math/config/has_intel_quad.cpp create mode 100644 src/boost/libs/math/config/has_long_double_support.cpp create mode 100644 src/boost/libs/math/config/has_mpfr.cpp create mode 100644 src/boost/libs/math/config/has_mpfr_class.cpp create mode 100644 src/boost/libs/math/config/has_mpreal.cpp create mode 100644 src/boost/libs/math/config/has_ntl_rr.cpp create mode 100644 src/boost/libs/math/dot_net_example/boost_math/AssemblyInfo.cpp create mode 100644 src/boost/libs/math/dot_net_example/boost_math/ReadMe.txt create mode 100644 src/boost/libs/math/dot_net_example/boost_math/Stdafx.cpp create mode 100644 src/boost/libs/math/dot_net_example/boost_math/Stdafx.h create mode 100644 src/boost/libs/math/dot_net_example/boost_math/app.ico create mode 100644 src/boost/libs/math/dot_net_example/boost_math/app.rc create mode 100644 src/boost/libs/math/dot_net_example/boost_math/boost_math.cpp create mode 100644 src/boost/libs/math/dot_net_example/boost_math/boost_math.h create mode 100644 src/boost/libs/math/dot_net_example/boost_math/boost_math.sln create mode 100644 src/boost/libs/math/dot_net_example/boost_math/boost_math.vcxproj create mode 100644 src/boost/libs/math/dot_net_example/boost_math/boost_math.vcxproj.filters create mode 100644 src/boost/libs/math/dot_net_example/boost_math/resource.h create mode 100644 src/boost/libs/math/dot_net_example/distribution_explorer/AboutDistEx.resx create mode 100644 src/boost/libs/math/dot_net_example/distribution_explorer/AboutDistributionExplorer.Designer.cs create mode 100644 src/boost/libs/math/dot_net_example/distribution_explorer/AboutDistributionExplorer.cs create mode 100644 src/boost/libs/math/dot_net_example/distribution_explorer/AboutDistributionExplorer.resx create mode 100644 src/boost/libs/math/dot_net_example/distribution_explorer/App.config create mode 100644 src/boost/libs/math/dot_net_example/distribution_explorer/ClassDiagram1.cd create mode 100644 src/boost/libs/math/dot_net_example/distribution_explorer/ClassDiagram2.cd create mode 100644 src/boost/libs/math/dot_net_example/distribution_explorer/DistexForm.Designer.cs create mode 100644 src/boost/libs/math/dot_net_example/distribution_explorer/DistexForm.cs create mode 100644 src/boost/libs/math/dot_net_example/distribution_explorer/DistexForm.resx create mode 100644 src/boost/libs/math/dot_net_example/distribution_explorer/DistexSplash.Designer.cs create mode 100644 src/boost/libs/math/dot_net_example/distribution_explorer/DistexSplash.cs create mode 100644 src/boost/libs/math/dot_net_example/distribution_explorer/DistexSplash.resx create mode 100644 src/boost/libs/math/dot_net_example/distribution_explorer/IconToolkit.ico create mode 100644 src/boost/libs/math/dot_net_example/distribution_explorer/Program.cs create mode 100644 src/boost/libs/math/dot_net_example/distribution_explorer/Properties/AssemblyInfo.cs create mode 100644 src/boost/libs/math/dot_net_example/distribution_explorer/Properties/Resources.Designer.cs create mode 100644 src/boost/libs/math/dot_net_example/distribution_explorer/Properties/Resources.resx create mode 100644 src/boost/libs/math/dot_net_example/distribution_explorer/Properties/Settings.Designer.cs create mode 100644 src/boost/libs/math/dot_net_example/distribution_explorer/Properties/Settings.settings create mode 100644 src/boost/libs/math/dot_net_example/distribution_explorer/Properties/app.manifest create mode 100644 src/boost/libs/math/dot_net_example/distribution_explorer/Settings.cs create mode 100644 src/boost/libs/math/dot_net_example/distribution_explorer/ToolkitLogo.bmp create mode 100644 src/boost/libs/math/dot_net_example/distribution_explorer/boost.png create mode 100644 src/boost/libs/math/dot_net_example/distribution_explorer/distexAboutBox.Designer.cs create mode 100644 src/boost/libs/math/dot_net_example/distribution_explorer/distexAboutBox.cs create mode 100644 src/boost/libs/math/dot_net_example/distribution_explorer/distexAboutBox.resx create mode 100644 src/boost/libs/math/dot_net_example/distribution_explorer/distribution.txt create mode 100644 src/boost/libs/math/dot_net_example/distribution_explorer/distribution_explorer.csproj create mode 100644 src/boost/libs/math/dot_net_example/distribution_explorer/distribution_explorer.csproj.user create mode 100644 src/boost/libs/math/dot_net_example/distribution_explorer/distribution_explorer.sln create mode 100644 src/boost/libs/math/dot_net_example/distribution_explorer/distribution_explorer.suo create mode 100644 src/boost/libs/math/dot_net_example/distribution_explorer/readme.txt create mode 100644 src/boost/libs/math/example/HSO3.hpp create mode 100644 src/boost/libs/math/example/HSO3SO4.cpp create mode 100644 src/boost/libs/math/example/HSO4.hpp create mode 100644 src/boost/libs/math/example/Jamfile.v2 create mode 100644 src/boost/libs/math/example/airy_zeros_example.cpp create mode 100644 src/boost/libs/math/example/arcsine_example.cpp create mode 100644 src/boost/libs/math/example/autodiff_black_scholes.cpp create mode 100644 src/boost/libs/math/example/autodiff_black_scholes_brief.cpp create mode 100644 src/boost/libs/math/example/autodiff_fourth_power.cpp create mode 100644 src/boost/libs/math/example/autodiff_mixed_partials.cpp create mode 100644 src/boost/libs/math/example/autodiff_multiprecision.cpp create mode 100644 src/boost/libs/math/example/barycentric_interpolation_example.cpp create mode 100644 src/boost/libs/math/example/barycentric_interpolation_example_2.cpp create mode 100644 src/boost/libs/math/example/bernoulli_example.cpp create mode 100644 src/boost/libs/math/example/bessel_errors_example.cpp create mode 100644 src/boost/libs/math/example/bessel_zeros_example.cpp create mode 100644 src/boost/libs/math/example/bessel_zeros_example_1.cpp create mode 100644 src/boost/libs/math/example/bessel_zeros_interator_example.cpp create mode 100644 src/boost/libs/math/example/big_seventh.cpp create mode 100644 src/boost/libs/math/example/binomial_coinflip_example.cpp create mode 100644 src/boost/libs/math/example/binomial_confidence_limits.cpp create mode 100644 src/boost/libs/math/example/binomial_example_nag.cpp create mode 100644 src/boost/libs/math/example/binomial_quiz_example.cpp create mode 100644 src/boost/libs/math/example/binomial_sample_sizes.cpp create mode 100644 src/boost/libs/math/example/brent_minimise_example.cpp create mode 100644 src/boost/libs/math/example/c_error_policy_example.cpp create mode 100644 src/boost/libs/math/example/cardinal_cubic_b_spline_example.cpp create mode 100644 src/boost/libs/math/example/catmull_rom_example.cpp create mode 100644 src/boost/libs/math/example/chi_square_std_dev_test.cpp create mode 100644 src/boost/libs/math/example/constants_eg1.cpp create mode 100644 src/boost/libs/math/example/continued_fractions.cpp create mode 100644 src/boost/libs/math/example/cstdfloat_example.cpp create mode 100644 src/boost/libs/math/example/daubechies_coefficients.cpp create mode 100644 src/boost/libs/math/example/distribution_construction.cpp create mode 100644 src/boost/libs/math/example/double_exponential.cpp create mode 100644 src/boost/libs/math/example/error_handling_example.cpp create mode 100644 src/boost/libs/math/example/error_policies_example.cpp create mode 100644 src/boost/libs/math/example/error_policy_example.cpp create mode 100644 src/boost/libs/math/example/f_test.cpp create mode 100644 src/boost/libs/math/example/factorial_example.cpp create mode 100644 src/boost/libs/math/example/fft_sines_table.cpp create mode 100644 src/boost/libs/math/example/find_location_example.cpp create mode 100644 src/boost/libs/math/example/find_mean_and_sd_normal.cpp create mode 100644 src/boost/libs/math/example/find_root_example.cpp create mode 100644 src/boost/libs/math/example/find_scale_example.cpp create mode 100644 src/boost/libs/math/example/float128_example.cpp create mode 100644 src/boost/libs/math/example/float_comparison_example.cpp create mode 100644 src/boost/libs/math/example/gauss_example.cpp create mode 100644 src/boost/libs/math/example/geometric_examples.cpp create mode 100644 src/boost/libs/math/example/handle_test_result.hpp create mode 100644 src/boost/libs/math/example/hyperexponential_more_snips.cpp create mode 100644 src/boost/libs/math/example/hyperexponential_snips.cpp create mode 100644 src/boost/libs/math/example/inspect_fp.cpp create mode 100644 src/boost/libs/math/example/inverse_chi_squared_bayes_eg.cpp create mode 100644 src/boost/libs/math/example/inverse_chi_squared_example.cpp create mode 100644 src/boost/libs/math/example/inverse_chi_squared_find_df_example.cpp create mode 100644 src/boost/libs/math/example/inverse_gamma_distribution_example.cpp create mode 100644 src/boost/libs/math/example/inverse_gamma_example.cpp create mode 100644 src/boost/libs/math/example/inverse_gaussian_example.cpp create mode 100644 src/boost/libs/math/example/jacobi_zeta_example.cpp create mode 100644 src/boost/libs/math/example/lambert_w_basic_example.cpp create mode 100644 src/boost/libs/math/example/lambert_w_diode.cpp create mode 100644 src/boost/libs/math/example/lambert_w_diode_graph.cpp create mode 100644 src/boost/libs/math/example/lambert_w_example.cpp create mode 100644 src/boost/libs/math/example/lambert_w_graph.cpp create mode 100644 src/boost/libs/math/example/lambert_w_precision_example.cpp create mode 100644 src/boost/libs/math/example/lambert_w_simple_examples.cpp create mode 100644 src/boost/libs/math/example/laplace_example.cpp create mode 100644 src/boost/libs/math/example/legendre_stieltjes_example.cpp create mode 100644 src/boost/libs/math/example/lexical_cast_native.cpp create mode 100644 src/boost/libs/math/example/lexical_cast_nonfinite_facets.cpp create mode 100644 src/boost/libs/math/example/naive_monte_carlo_example.cpp create mode 100644 src/boost/libs/math/example/nc_chi_sq_example.cpp create mode 100644 src/boost/libs/math/example/neg_binom_confidence_limits.cpp create mode 100644 src/boost/libs/math/example/neg_binomial_sample_sizes.cpp create mode 100644 src/boost/libs/math/example/negative_binomial_example1.cpp create mode 100644 src/boost/libs/math/example/negative_binomial_example2.cpp create mode 100644 src/boost/libs/math/example/neumann_zeros_example_1.cpp create mode 100644 src/boost/libs/math/example/nonfinite_facet_simple.cpp create mode 100644 src/boost/libs/math/example/nonfinite_facet_sstream.cpp create mode 100644 src/boost/libs/math/example/nonfinite_legacy.cpp create mode 100644 src/boost/libs/math/example/nonfinite_loopback_ok.cpp create mode 100644 src/boost/libs/math/example/nonfinite_num_facet.cpp create mode 100644 src/boost/libs/math/example/nonfinite_num_facet_serialization.cpp create mode 100644 src/boost/libs/math/example/nonfinite_num_facet_trap.cpp create mode 100644 src/boost/libs/math/example/nonfinite_serialization_archives.cpp create mode 100644 src/boost/libs/math/example/nonfinite_signaling_NaN.cpp create mode 100644 src/boost/libs/math/example/normal_misc_examples.cpp create mode 100644 src/boost/libs/math/example/normal_tables.cpp create mode 100644 src/boost/libs/math/example/numerical_derivative_example.cpp create mode 100644 src/boost/libs/math/example/ooura_fourier_integrals_cosine_example.cpp create mode 100644 src/boost/libs/math/example/ooura_fourier_integrals_example.cpp create mode 100644 src/boost/libs/math/example/ooura_fourier_integrals_multiprecision_example.cpp create mode 100644 src/boost/libs/math/example/owens_t_example.cpp create mode 100644 src/boost/libs/math/example/policy_eg_1.cpp create mode 100644 src/boost/libs/math/example/policy_eg_10.cpp create mode 100644 src/boost/libs/math/example/policy_eg_2.cpp create mode 100644 src/boost/libs/math/example/policy_eg_3.cpp create mode 100644 src/boost/libs/math/example/policy_eg_4.cpp create mode 100644 src/boost/libs/math/example/policy_eg_5.cpp create mode 100644 src/boost/libs/math/example/policy_eg_6.cpp create mode 100644 src/boost/libs/math/example/policy_eg_7.cpp create mode 100644 src/boost/libs/math/example/policy_eg_8.cpp create mode 100644 src/boost/libs/math/example/policy_eg_9.cpp create mode 100644 src/boost/libs/math/example/policy_ref_snip1.cpp create mode 100644 src/boost/libs/math/example/policy_ref_snip10.cpp create mode 100644 src/boost/libs/math/example/policy_ref_snip11.cpp create mode 100644 src/boost/libs/math/example/policy_ref_snip12.cpp create mode 100644 src/boost/libs/math/example/policy_ref_snip13.cpp create mode 100644 src/boost/libs/math/example/policy_ref_snip2.cpp create mode 100644 src/boost/libs/math/example/policy_ref_snip3.cpp create mode 100644 src/boost/libs/math/example/policy_ref_snip4.cpp create mode 100644 src/boost/libs/math/example/policy_ref_snip5.cpp create mode 100644 src/boost/libs/math/example/policy_ref_snip6.cpp create mode 100644 src/boost/libs/math/example/policy_ref_snip7.cpp create mode 100644 src/boost/libs/math/example/policy_ref_snip8.cpp create mode 100644 src/boost/libs/math/example/policy_ref_snip9.cpp create mode 100644 src/boost/libs/math/example/polynomial_arithmetic.cpp create mode 100644 src/boost/libs/math/example/root_elliptic_finding.cpp create mode 100644 src/boost/libs/math/example/root_finding_algorithms.cpp create mode 100644 src/boost/libs/math/example/root_finding_example.cpp create mode 100644 src/boost/libs/math/example/root_finding_fifth.cpp create mode 100644 src/boost/libs/math/example/root_finding_multiprecision_example.cpp create mode 100644 src/boost/libs/math/example/root_finding_n_example.cpp create mode 100644 src/boost/libs/math/example/root_finding_start_locations.cpp create mode 100644 src/boost/libs/math/example/root_n_finding_algorithms.cpp create mode 100644 src/boost/libs/math/example/series.cpp create mode 100644 src/boost/libs/math/example/sines.hpp create mode 100644 src/boost/libs/math/example/skew_normal_example.cpp create mode 100644 src/boost/libs/math/example/special_data.cpp create mode 100644 src/boost/libs/math/example/students_t_example1.cpp create mode 100644 src/boost/libs/math/example/students_t_example2.cpp create mode 100644 src/boost/libs/math/example/students_t_example3.cpp create mode 100644 src/boost/libs/math/example/students_t_single_sample.cpp create mode 100644 src/boost/libs/math/example/students_t_two_samples.cpp create mode 100644 src/boost/libs/math/example/table_type.hpp create mode 100644 src/boost/libs/math/example/test_cpp_float_close_fraction.cpp create mode 100644 src/boost/libs/math/example/test_nonfinite_loopback.cpp create mode 100644 src/boost/libs/math/example/trapezoidal_example.cpp create mode 100644 src/boost/libs/math/include_private/boost/math/constants/generate.hpp create mode 100644 src/boost/libs/math/include_private/boost/math/tools/iteration_logger.hpp create mode 100644 src/boost/libs/math/include_private/boost/math/tools/remez.hpp create mode 100644 src/boost/libs/math/include_private/boost/math/tools/solve.hpp create mode 100644 src/boost/libs/math/include_private/boost/math/tools/test.hpp create mode 100644 src/boost/libs/math/include_private/boost/math/tools/test_data.hpp create mode 100644 src/boost/libs/math/index.html create mode 100644 src/boost/libs/math/meta/libraries.json create mode 100644 src/boost/libs/math/minimax/Jamfile.v2 create mode 100644 src/boost/libs/math/minimax/f.cpp create mode 100644 src/boost/libs/math/minimax/main.cpp create mode 100644 src/boost/libs/math/minimax/multiprecision.hpp create mode 100644 src/boost/libs/math/reporting/accuracy/Jamfile.v2 create mode 100644 src/boost/libs/math/reporting/accuracy/bindings.hpp create mode 100644 src/boost/libs/math/reporting/accuracy/handle_test_result.hpp create mode 100644 src/boost/libs/math/reporting/accuracy/has_c99_cmath.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/has_cxx17_cmath.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/has_gsl.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/has_libstdcxx_tr1.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/has_rmath.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/html/index.html create mode 100644 src/boost/libs/math/reporting/accuracy/test_bessel_i.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/test_bessel_i_prime.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/test_bessel_j.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/test_bessel_j_prime.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/test_bessel_k.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/test_bessel_k_prime.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/test_bessel_y.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/test_bessel_y_prime.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/test_beta.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/test_binomial_coeff.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/test_carlson.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/test_cbrt.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/test_digamma.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/test_ellint_1.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/test_ellint_2.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/test_ellint_3.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/test_ellint_d.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/test_erf.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/test_expint.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/test_gamma.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/test_hermite.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/test_heuman_lambda.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/test_ibeta.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/test_ibeta_inv.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/test_ibeta_inva.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/test_igamma.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/test_igamma_inv.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/test_igamma_inva.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/test_jacobi.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/test_jacobi_zeta.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/test_laguerre.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/test_legendre.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/test_log1p_expm1.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/test_nc_beta.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/test_nc_chi_squared.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/test_nc_t.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/test_owens_t.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/test_polygamma.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/test_powm1.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/test_spherical_harmonic.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/test_tgamma_ratio.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/test_trig.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/test_trigamma.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/test_zeta.cpp create mode 100644 src/boost/libs/math/reporting/accuracy/third_party/cephes_double/readme.txt create mode 100644 src/boost/libs/math/reporting/performance/Jamfile.v2 create mode 100644 src/boost/libs/math/reporting/performance/fibonacci.hpp create mode 100644 src/boost/libs/math/reporting/performance/html/boostbook.css create mode 100644 src/boost/libs/math/reporting/performance/html/index.html create mode 100644 src/boost/libs/math/reporting/performance/is_intel_win.cpp create mode 100644 src/boost/libs/math/reporting/performance/performance.hpp create mode 100644 src/boost/libs/math/reporting/performance/table_helper.cpp create mode 100644 src/boost/libs/math/reporting/performance/table_helper.hpp create mode 100644 src/boost/libs/math/reporting/performance/test_assoc_laguerre.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_assoc_legendre.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_beta.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_beta_inc.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_cbrt.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_cn.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_digamma.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_distributions.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_dn.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_ellint_1.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_ellint_1c.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_ellint_2.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_ellint_2c.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_ellint_3.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_ellint_3c.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_ellint_rc.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_ellint_rd.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_ellint_rf.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_ellint_rj.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_erf.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_erfc.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_expint.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_expint_n.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_expm1.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_gamma_p.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_gamma_p_inv.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_gamma_q.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_gamma_q_inv.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_gcd.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_ibeta.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_ibeta_inv.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_ibetac.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_ibetac_inv.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_igamma.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_in.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_iv.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_jn.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_js.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_jv.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_kn.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_kv.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_laguerre.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_legendre.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_legendre_q.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_lgamma.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_log1p.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_poly_method.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_polygamma.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_polynomial.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_sn.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_tgamma.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_trigamma.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_yn.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_ys.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_yv.cpp create mode 100644 src/boost/libs/math/reporting/performance/test_zeta.cpp create mode 100644 src/boost/libs/math/reporting/performance/third_party/dcdflib/readme.txt create mode 100644 src/boost/libs/math/src/tr1/acosh.cpp create mode 100644 src/boost/libs/math/src/tr1/acoshf.cpp create mode 100644 src/boost/libs/math/src/tr1/acoshl.cpp create mode 100644 src/boost/libs/math/src/tr1/asinh.cpp create mode 100644 src/boost/libs/math/src/tr1/asinhf.cpp create mode 100644 src/boost/libs/math/src/tr1/asinhl.cpp create mode 100644 src/boost/libs/math/src/tr1/assoc_laguerre.cpp create mode 100644 src/boost/libs/math/src/tr1/assoc_laguerref.cpp create mode 100644 src/boost/libs/math/src/tr1/assoc_laguerrel.cpp create mode 100644 src/boost/libs/math/src/tr1/assoc_legendre.cpp create mode 100644 src/boost/libs/math/src/tr1/assoc_legendref.cpp create mode 100644 src/boost/libs/math/src/tr1/assoc_legendrel.cpp create mode 100644 src/boost/libs/math/src/tr1/atanh.cpp create mode 100644 src/boost/libs/math/src/tr1/atanhf.cpp create mode 100644 src/boost/libs/math/src/tr1/atanhl.cpp create mode 100644 src/boost/libs/math/src/tr1/beta.cpp create mode 100644 src/boost/libs/math/src/tr1/betaf.cpp create mode 100644 src/boost/libs/math/src/tr1/betal.cpp create mode 100644 src/boost/libs/math/src/tr1/c_policy.hpp create mode 100644 src/boost/libs/math/src/tr1/cbrt.cpp create mode 100644 src/boost/libs/math/src/tr1/cbrtf.cpp create mode 100644 src/boost/libs/math/src/tr1/cbrtl.cpp create mode 100644 src/boost/libs/math/src/tr1/comp_ellint_1.cpp create mode 100644 src/boost/libs/math/src/tr1/comp_ellint_1f.cpp create mode 100644 src/boost/libs/math/src/tr1/comp_ellint_1l.cpp create mode 100644 src/boost/libs/math/src/tr1/comp_ellint_2.cpp create mode 100644 src/boost/libs/math/src/tr1/comp_ellint_2f.cpp create mode 100644 src/boost/libs/math/src/tr1/comp_ellint_2l.cpp create mode 100644 src/boost/libs/math/src/tr1/comp_ellint_3.cpp create mode 100644 src/boost/libs/math/src/tr1/comp_ellint_3f.cpp create mode 100644 src/boost/libs/math/src/tr1/comp_ellint_3l.cpp create mode 100644 src/boost/libs/math/src/tr1/copysign.cpp create mode 100644 src/boost/libs/math/src/tr1/copysignf.cpp create mode 100644 src/boost/libs/math/src/tr1/copysignl.cpp create mode 100644 src/boost/libs/math/src/tr1/cyl_bessel_i.cpp create mode 100644 src/boost/libs/math/src/tr1/cyl_bessel_if.cpp create mode 100644 src/boost/libs/math/src/tr1/cyl_bessel_il.cpp create mode 100644 src/boost/libs/math/src/tr1/cyl_bessel_j.cpp create mode 100644 src/boost/libs/math/src/tr1/cyl_bessel_jf.cpp create mode 100644 src/boost/libs/math/src/tr1/cyl_bessel_jl.cpp create mode 100644 src/boost/libs/math/src/tr1/cyl_bessel_k.cpp create mode 100644 src/boost/libs/math/src/tr1/cyl_bessel_kf.cpp create mode 100644 src/boost/libs/math/src/tr1/cyl_bessel_kl.cpp create mode 100644 src/boost/libs/math/src/tr1/cyl_neumann.cpp create mode 100644 src/boost/libs/math/src/tr1/cyl_neumannf.cpp create mode 100644 src/boost/libs/math/src/tr1/cyl_neumannl.cpp create mode 100644 src/boost/libs/math/src/tr1/ellint_1.cpp create mode 100644 src/boost/libs/math/src/tr1/ellint_1f.cpp create mode 100644 src/boost/libs/math/src/tr1/ellint_1l.cpp create mode 100644 src/boost/libs/math/src/tr1/ellint_2.cpp create mode 100644 src/boost/libs/math/src/tr1/ellint_2f.cpp create mode 100644 src/boost/libs/math/src/tr1/ellint_2l.cpp create mode 100644 src/boost/libs/math/src/tr1/ellint_3.cpp create mode 100644 src/boost/libs/math/src/tr1/ellint_3f.cpp create mode 100644 src/boost/libs/math/src/tr1/ellint_3l.cpp create mode 100644 src/boost/libs/math/src/tr1/erf.cpp create mode 100644 src/boost/libs/math/src/tr1/erfc.cpp create mode 100644 src/boost/libs/math/src/tr1/erfcf.cpp create mode 100644 src/boost/libs/math/src/tr1/erfcl.cpp create mode 100644 src/boost/libs/math/src/tr1/erff.cpp create mode 100644 src/boost/libs/math/src/tr1/erfl.cpp create mode 100644 src/boost/libs/math/src/tr1/expint.cpp create mode 100644 src/boost/libs/math/src/tr1/expintf.cpp create mode 100644 src/boost/libs/math/src/tr1/expintl.cpp create mode 100644 src/boost/libs/math/src/tr1/expm1.cpp create mode 100644 src/boost/libs/math/src/tr1/expm1f.cpp create mode 100644 src/boost/libs/math/src/tr1/expm1l.cpp create mode 100644 src/boost/libs/math/src/tr1/fmax.cpp create mode 100644 src/boost/libs/math/src/tr1/fmaxf.cpp create mode 100644 src/boost/libs/math/src/tr1/fmaxl.cpp create mode 100644 src/boost/libs/math/src/tr1/fmin.cpp create mode 100644 src/boost/libs/math/src/tr1/fminf.cpp create mode 100644 src/boost/libs/math/src/tr1/fminl.cpp create mode 100644 src/boost/libs/math/src/tr1/fpclassify.cpp create mode 100644 src/boost/libs/math/src/tr1/fpclassifyf.cpp create mode 100644 src/boost/libs/math/src/tr1/fpclassifyl.cpp create mode 100644 src/boost/libs/math/src/tr1/hermite.cpp create mode 100644 src/boost/libs/math/src/tr1/hermitef.cpp create mode 100644 src/boost/libs/math/src/tr1/hermitel.cpp create mode 100644 src/boost/libs/math/src/tr1/hypot.cpp create mode 100644 src/boost/libs/math/src/tr1/hypotf.cpp create mode 100644 src/boost/libs/math/src/tr1/hypotl.cpp create mode 100644 src/boost/libs/math/src/tr1/laguerre.cpp create mode 100644 src/boost/libs/math/src/tr1/laguerref.cpp create mode 100644 src/boost/libs/math/src/tr1/laguerrel.cpp create mode 100644 src/boost/libs/math/src/tr1/legendre.cpp create mode 100644 src/boost/libs/math/src/tr1/legendref.cpp create mode 100644 src/boost/libs/math/src/tr1/legendrel.cpp create mode 100644 src/boost/libs/math/src/tr1/lgamma.cpp create mode 100644 src/boost/libs/math/src/tr1/lgammaf.cpp create mode 100644 src/boost/libs/math/src/tr1/lgammal.cpp create mode 100644 src/boost/libs/math/src/tr1/llround.cpp create mode 100644 src/boost/libs/math/src/tr1/llroundf.cpp create mode 100644 src/boost/libs/math/src/tr1/llroundl.cpp create mode 100644 src/boost/libs/math/src/tr1/log1p.cpp create mode 100644 src/boost/libs/math/src/tr1/log1pf.cpp create mode 100644 src/boost/libs/math/src/tr1/log1pl.cpp create mode 100644 src/boost/libs/math/src/tr1/lround.cpp create mode 100644 src/boost/libs/math/src/tr1/lroundf.cpp create mode 100644 src/boost/libs/math/src/tr1/lroundl.cpp create mode 100644 src/boost/libs/math/src/tr1/nextafter.cpp create mode 100644 src/boost/libs/math/src/tr1/nextafterf.cpp create mode 100644 src/boost/libs/math/src/tr1/nextafterl.cpp create mode 100644 src/boost/libs/math/src/tr1/nexttoward.cpp create mode 100644 src/boost/libs/math/src/tr1/nexttowardf.cpp create mode 100644 src/boost/libs/math/src/tr1/nexttowardl.cpp create mode 100644 src/boost/libs/math/src/tr1/pch.hpp create mode 100644 src/boost/libs/math/src/tr1/riemann_zeta.cpp create mode 100644 src/boost/libs/math/src/tr1/riemann_zetaf.cpp create mode 100644 src/boost/libs/math/src/tr1/riemann_zetal.cpp create mode 100644 src/boost/libs/math/src/tr1/round.cpp create mode 100644 src/boost/libs/math/src/tr1/roundf.cpp create mode 100644 src/boost/libs/math/src/tr1/roundl.cpp create mode 100644 src/boost/libs/math/src/tr1/sph_bessel.cpp create mode 100644 src/boost/libs/math/src/tr1/sph_besself.cpp create mode 100644 src/boost/libs/math/src/tr1/sph_bessell.cpp create mode 100644 src/boost/libs/math/src/tr1/sph_legendre.cpp create mode 100644 src/boost/libs/math/src/tr1/sph_legendref.cpp create mode 100644 src/boost/libs/math/src/tr1/sph_legendrel.cpp create mode 100644 src/boost/libs/math/src/tr1/sph_neumann.cpp create mode 100644 src/boost/libs/math/src/tr1/sph_neumannf.cpp create mode 100644 src/boost/libs/math/src/tr1/sph_neumannl.cpp create mode 100644 src/boost/libs/math/src/tr1/tgamma.cpp create mode 100644 src/boost/libs/math/src/tr1/tgammaf.cpp create mode 100644 src/boost/libs/math/src/tr1/tgammal.cpp create mode 100644 src/boost/libs/math/src/tr1/trunc.cpp create mode 100644 src/boost/libs/math/src/tr1/truncf.cpp create mode 100644 src/boost/libs/math/src/tr1/truncl.cpp create mode 100644 src/boost/libs/math/test/Jamfile.v2 create mode 100644 src/boost/libs/math/test/__temporary_test.cpp create mode 100644 src/boost/libs/math/test/acosh_data.ipp create mode 100644 src/boost/libs/math/test/acosh_test.hpp create mode 100644 src/boost/libs/math/test/adaptive_gauss_kronrod_quadrature_test.cpp create mode 100644 src/boost/libs/math/test/almost_equal.ipp create mode 100644 src/boost/libs/math/test/anderson_darling_test.cpp create mode 100644 src/boost/libs/math/test/asinh_data.ipp create mode 100644 src/boost/libs/math/test/asinh_test.hpp create mode 100644 src/boost/libs/math/test/assoc_legendre_p.ipp create mode 100644 src/boost/libs/math/test/atanh_data.ipp create mode 100644 src/boost/libs/math/test/atanh_test.hpp create mode 100644 src/boost/libs/math/test/bessel_i_data.ipp create mode 100644 src/boost/libs/math/test/bessel_i_int_data.ipp create mode 100644 src/boost/libs/math/test/bessel_i_prime_data.ipp create mode 100644 src/boost/libs/math/test/bessel_i_prime_int_data.ipp create mode 100644 src/boost/libs/math/test/bessel_j_data.ipp create mode 100644 src/boost/libs/math/test/bessel_j_int_data.ipp create mode 100644 src/boost/libs/math/test/bessel_j_large_data.ipp create mode 100644 src/boost/libs/math/test/bessel_j_prime_data.ipp create mode 100644 src/boost/libs/math/test/bessel_j_prime_int_data.ipp create mode 100644 src/boost/libs/math/test/bessel_j_prime_large_data.ipp create mode 100644 src/boost/libs/math/test/bessel_k_data.ipp create mode 100644 src/boost/libs/math/test/bessel_k_int_data.ipp create mode 100644 src/boost/libs/math/test/bessel_k_prime_data.ipp create mode 100644 src/boost/libs/math/test/bessel_k_prime_int_data.ipp create mode 100644 src/boost/libs/math/test/bessel_y01_data.ipp create mode 100644 src/boost/libs/math/test/bessel_y01_prime_data.ipp create mode 100644 src/boost/libs/math/test/bessel_yn_data.ipp create mode 100644 src/boost/libs/math/test/bessel_yn_prime_data.ipp create mode 100644 src/boost/libs/math/test/bessel_yv_data.ipp create mode 100644 src/boost/libs/math/test/bessel_yv_prime_data.ipp create mode 100644 src/boost/libs/math/test/beta_exp_data.ipp create mode 100644 src/boost/libs/math/test/beta_med_data.ipp create mode 100644 src/boost/libs/math/test/beta_small_data.ipp create mode 100644 src/boost/libs/math/test/binomial_data.ipp create mode 100644 src/boost/libs/math/test/binomial_large_data.ipp create mode 100644 src/boost/libs/math/test/binomial_quantile.ipp create mode 100644 src/boost/libs/math/test/bivariate_statistics_test.cpp create mode 100644 src/boost/libs/math/test/cardinal_b_spline_test.cpp create mode 100644 src/boost/libs/math/test/cardinal_cubic_b_spline_test.cpp create mode 100644 src/boost/libs/math/test/cardinal_quadratic_b_spline_test.cpp create mode 100644 src/boost/libs/math/test/cardinal_quintic_b_spline_test.cpp create mode 100644 src/boost/libs/math/test/cardinal_trigonometric_test.cpp create mode 100644 src/boost/libs/math/test/catmull_rom_test.cpp create mode 100644 src/boost/libs/math/test/cbrt_data.ipp create mode 100644 src/boost/libs/math/test/chebyshev_test.cpp create mode 100644 src/boost/libs/math/test/chebyshev_transform_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/barycentric_rational_concept_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/barycentric_rational_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/catmull_rom_concept_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/catmull_rom_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/compl_abs_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/compl_acos_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/compl_acosh_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/compl_asin_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/compl_asinh_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/compl_atan_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/compl_atanh_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/constants_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/cstdfloat_concept_check_1.cpp create mode 100644 src/boost/libs/math/test/compile_test/cstdfloat_concept_check_2.cpp create mode 100644 src/boost/libs/math/test/compile_test/cstdfloat_concept_check_3.cpp create mode 100644 src/boost/libs/math/test/compile_test/cstdfloat_concept_check_4.cpp create mode 100644 src/boost/libs/math/test/compile_test/cubic_spline_concept_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/cubic_spline_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/dist_bernoulli_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/dist_beta_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/dist_binomial_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/dist_cauchy_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/dist_chi_squared_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/dist_complement_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/dist_exponential_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/dist_extreme_val_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/dist_find_location_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/dist_find_scale_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/dist_fisher_f_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/dist_gamma_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/dist_hyperexponential_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/dist_hypergeo_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/dist_inv_chi_sq_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/dist_inv_gamma_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/dist_laplace_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/dist_logistic_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/dist_lognormal_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/dist_nc_beta_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/dist_nc_chi_squ_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/dist_nc_f_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/dist_nc_t_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/dist_neg_binom_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/dist_normal_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/dist_pareto_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/dist_poisson_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/dist_skew_norm_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/dist_students_t_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/dist_triangular_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/dist_uniform_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/dist_weibull_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/distribution_concept_check.cpp create mode 100644 src/boost/libs/math/test/compile_test/exp_sinh_concept_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/exp_sinh_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/gauss_concept_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/gauss_kronrod_concept_test.cpp create mode 100755 src/boost/libs/math/test/compile_test/generate.sh create mode 100644 src/boost/libs/math/test/compile_test/instantiate.hpp create mode 100644 src/boost/libs/math/test/compile_test/main.cpp create mode 100644 src/boost/libs/math/test/compile_test/naive_monte_carlo_concept_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/naive_monte_carlo_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/numerical_differentiation_concept_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/numerical_differentiation_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/poison.hpp create mode 100644 src/boost/libs/math/test/compile_test/sf_airy_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_bernoulli_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_bessel_deriv_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_bessel_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_beta_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_binomial_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_cbrt_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_cos_pi_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_digamma_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_ellint_1_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_ellint_2_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_ellint_3_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_ellint_d_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_ellint_rc_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_ellint_rd_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_ellint_rf_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_ellint_rg_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_ellint_rj_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_erf_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_expint_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_expm1_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_factorials_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_fpclassify_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_gamma_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_hankel_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_hermite_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_heuman_lambda_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_hypot_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_jacobi_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_jacobi_zeta_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_laguerre_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_lanczos_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_legendre_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_legendre_stieltjes_concept_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_legendre_stieltjes_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_log1p_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_math_fwd_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_modf_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_next_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_owens_t_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_polygamma_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_powm1_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_prime_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_relative_distance_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_round_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_sign_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_sin_pi_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_sinc_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_sinhc_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_sph_harm_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_sqrt1pm1_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_trunc_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_ulp_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sf_zeta_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sinh_sinh_concept_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/sinh_sinh_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/std_real_concept_check.cpp create mode 100644 src/boost/libs/math/test/compile_test/tanh_sinh_concept_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/tanh_sinh_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/test_compile_result.hpp create mode 100644 src/boost/libs/math/test/compile_test/test_traits.cpp create mode 100644 src/boost/libs/math/test/compile_test/tools_config_inc_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/tools_fraction_inc_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/tools_minima_inc_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/tools_polynomial_inc_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/tools_precision_inc_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/tools_rational_inc_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/tools_real_cast_inc_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/tools_remez_inc_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/tools_roots_inc_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/tools_series_inc_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/tools_solve_inc_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/tools_stats_inc_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/tools_test_data_inc_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/tools_test_inc_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/tools_toms748_inc_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/tools_tuple_inc_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/tr1_incl_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/trapezoidal_concept_test.cpp create mode 100644 src/boost/libs/math/test/compile_test/trapezoidal_incl_test.cpp create mode 100644 src/boost/libs/math/test/complex_test.cpp create mode 100644 src/boost/libs/math/test/condition_number_test.cpp create mode 100644 src/boost/libs/math/test/digamma_data.ipp create mode 100644 src/boost/libs/math/test/digamma_neg_data.ipp create mode 100644 src/boost/libs/math/test/digamma_root_data.ipp create mode 100644 src/boost/libs/math/test/digamma_small_data.ipp create mode 100644 src/boost/libs/math/test/e_float_concept_check.cpp create mode 100644 src/boost/libs/math/test/ellint_d2_data.ipp create mode 100644 src/boost/libs/math/test/ellint_d_data.ipp create mode 100644 src/boost/libs/math/test/ellint_e2_data.ipp create mode 100644 src/boost/libs/math/test/ellint_e_data.ipp create mode 100644 src/boost/libs/math/test/ellint_f_data.ipp create mode 100644 src/boost/libs/math/test/ellint_k_data.ipp create mode 100644 src/boost/libs/math/test/ellint_pi2_data.ipp create mode 100644 src/boost/libs/math/test/ellint_pi3_data.ipp create mode 100644 src/boost/libs/math/test/ellint_pi3_large_data.ipp create mode 100644 src/boost/libs/math/test/ellint_rc_data.ipp create mode 100644 src/boost/libs/math/test/ellint_rd_0xy.ipp create mode 100644 src/boost/libs/math/test/ellint_rd_0yy.ipp create mode 100644 src/boost/libs/math/test/ellint_rd_data.ipp create mode 100644 src/boost/libs/math/test/ellint_rd_xxx.ipp create mode 100644 src/boost/libs/math/test/ellint_rd_xxz.ipp create mode 100644 src/boost/libs/math/test/ellint_rd_xyy.ipp create mode 100644 src/boost/libs/math/test/ellint_rf_0yy.ipp create mode 100644 src/boost/libs/math/test/ellint_rf_data.ipp create mode 100644 src/boost/libs/math/test/ellint_rf_xxx.ipp create mode 100644 src/boost/libs/math/test/ellint_rf_xy0.ipp create mode 100644 src/boost/libs/math/test/ellint_rf_xyy.ipp create mode 100644 src/boost/libs/math/test/ellint_rg.ipp create mode 100644 src/boost/libs/math/test/ellint_rg_00x.ipp create mode 100644 src/boost/libs/math/test/ellint_rg_xxx.ipp create mode 100644 src/boost/libs/math/test/ellint_rg_xy0.ipp create mode 100644 src/boost/libs/math/test/ellint_rg_xyy.ipp create mode 100644 src/boost/libs/math/test/ellint_rj_data.ipp create mode 100644 src/boost/libs/math/test/ellint_rj_e2.ipp create mode 100644 src/boost/libs/math/test/ellint_rj_e3.ipp create mode 100644 src/boost/libs/math/test/ellint_rj_e4.ipp create mode 100644 src/boost/libs/math/test/ellint_rj_zp.ipp create mode 100644 src/boost/libs/math/test/empirical_cumulative_distribution_test.cpp create mode 100644 src/boost/libs/math/test/erf_data.ipp create mode 100644 src/boost/libs/math/test/erf_inv_data.ipp create mode 100644 src/boost/libs/math/test/erf_large_data.ipp create mode 100644 src/boost/libs/math/test/erf_small_data.ipp create mode 100644 src/boost/libs/math/test/erfc_inv_big_data.ipp create mode 100644 src/boost/libs/math/test/erfc_inv_data.ipp create mode 100644 src/boost/libs/math/test/exp_sinh_quadrature_test.cpp create mode 100644 src/boost/libs/math/test/expint_1_data.ipp create mode 100644 src/boost/libs/math/test/expint_data.ipp create mode 100644 src/boost/libs/math/test/expint_small_data.ipp create mode 100644 src/boost/libs/math/test/expinti_data.ipp create mode 100644 src/boost/libs/math/test/expinti_data_double.ipp create mode 100644 src/boost/libs/math/test/expinti_data_long.ipp create mode 100644 src/boost/libs/math/test/float128/log1p_expm1_test.cpp create mode 100644 src/boost/libs/math/test/float128/powm1_sqrtp1m1_test.cpp create mode 100644 src/boost/libs/math/test/float128/setup.hpp create mode 100644 src/boost/libs/math/test/float128/table_type.hpp create mode 100644 src/boost/libs/math/test/float128/test_bessel_i.cpp create mode 100644 src/boost/libs/math/test/float128/test_bessel_j.cpp create mode 100644 src/boost/libs/math/test/float128/test_bessel_k.cpp create mode 100644 src/boost/libs/math/test/float128/test_bessel_y.cpp create mode 100644 src/boost/libs/math/test/float128/test_beta.cpp create mode 100644 src/boost/libs/math/test/float128/test_binomial_coeff.cpp create mode 100644 src/boost/libs/math/test/float128/test_carlson.cpp create mode 100644 src/boost/libs/math/test/float128/test_cbrt.cpp create mode 100644 src/boost/libs/math/test/float128/test_digamma.cpp create mode 100644 src/boost/libs/math/test/float128/test_ellint_1.cpp create mode 100644 src/boost/libs/math/test/float128/test_ellint_2.cpp create mode 100644 src/boost/libs/math/test/float128/test_ellint_3.cpp create mode 100644 src/boost/libs/math/test/float128/test_erf.cpp create mode 100644 src/boost/libs/math/test/float128/test_expint.cpp create mode 100644 src/boost/libs/math/test/float128/test_factorials.cpp create mode 100644 src/boost/libs/math/test/float128/test_gamma.cpp create mode 100644 src/boost/libs/math/test/float128/test_hermite.cpp create mode 100644 src/boost/libs/math/test/float128/test_ibeta.cpp create mode 100644 src/boost/libs/math/test/float128/test_ibeta_inv_1.cpp create mode 100644 src/boost/libs/math/test/float128/test_ibeta_inv_ab_4.cpp create mode 100644 src/boost/libs/math/test/float128/test_igamma.cpp create mode 100644 src/boost/libs/math/test/float128/test_igamma_inv.cpp create mode 100644 src/boost/libs/math/test/float128/test_igamma_inva.cpp create mode 100644 src/boost/libs/math/test/float128/test_laguerre.cpp create mode 100644 src/boost/libs/math/test/float128/test_legendre.cpp create mode 100644 src/boost/libs/math/test/float128/test_polygamma.cpp create mode 100644 src/boost/libs/math/test/float128/test_std_lib.cpp create mode 100644 src/boost/libs/math/test/float128/test_tgamma_ratio.cpp create mode 100644 src/boost/libs/math/test/float128/test_trigamma.cpp create mode 100644 src/boost/libs/math/test/float128/test_zeta.cpp create mode 100644 src/boost/libs/math/test/functor.hpp create mode 100644 src/boost/libs/math/test/gamma_inv_big_data.ipp create mode 100644 src/boost/libs/math/test/gamma_inv_data.ipp create mode 100644 src/boost/libs/math/test/gamma_inv_small_data.ipp create mode 100644 src/boost/libs/math/test/gauss_kronrod_quadrature_test.cpp create mode 100644 src/boost/libs/math/test/gauss_quadrature_test.cpp create mode 100644 src/boost/libs/math/test/gegenbauer_test.cpp create mode 100644 src/boost/libs/math/test/handle_test_result.hpp create mode 100644 src/boost/libs/math/test/hermite.ipp create mode 100644 src/boost/libs/math/test/heuman_lambda_data.ipp create mode 100644 src/boost/libs/math/test/hypergeometric_0F2.ipp create mode 100644 src/boost/libs/math/test/hypergeometric_1F1.ipp create mode 100644 src/boost/libs/math/test/hypergeometric_1F1_big.ipp create mode 100644 src/boost/libs/math/test/hypergeometric_1F1_big_double_limited.ipp create mode 100644 src/boost/libs/math/test/hypergeometric_1F1_big_unsolved.ipp create mode 100644 src/boost/libs/math/test/hypergeometric_1F1_small_random.ipp create mode 100644 src/boost/libs/math/test/hypergeometric_1F2.ipp create mode 100644 src/boost/libs/math/test/hypergeometric_1f1_large_regularized.ipp create mode 100644 src/boost/libs/math/test/hypergeometric_1f1_log_large.ipp create mode 100644 src/boost/libs/math/test/hypergeometric_1f1_log_large_unsolved.ipp create mode 100644 src/boost/libs/math/test/hypergeometric_2F0.ipp create mode 100644 src/boost/libs/math/test/hypergeometric_2F0_half.ipp create mode 100644 src/boost/libs/math/test/hypergeometric_2F0_integer_a2.ipp create mode 100644 src/boost/libs/math/test/hypergeometric_2F0_large_z.ipp create mode 100644 src/boost/libs/math/test/hypergeometric_2F1.ipp create mode 100644 src/boost/libs/math/test/hypergeometric_2F2.ipp create mode 100644 src/boost/libs/math/test/hypergeometric_dist_data2.ipp create mode 100644 src/boost/libs/math/test/hypergeometric_test_data.ipp create mode 100644 src/boost/libs/math/test/hypot_test.cpp create mode 100644 src/boost/libs/math/test/ibeta_data.ipp create mode 100644 src/boost/libs/math/test/ibeta_derivative_data.ipp create mode 100644 src/boost/libs/math/test/ibeta_derivative_int_data.ipp create mode 100644 src/boost/libs/math/test/ibeta_derivative_large_data.ipp create mode 100644 src/boost/libs/math/test/ibeta_derivative_small_data.ipp create mode 100644 src/boost/libs/math/test/ibeta_int_data.ipp create mode 100644 src/boost/libs/math/test/ibeta_inv_data.ipp create mode 100644 src/boost/libs/math/test/ibeta_inva_data.ipp create mode 100644 src/boost/libs/math/test/ibeta_large_data.ipp create mode 100644 src/boost/libs/math/test/ibeta_small_data.ipp create mode 100644 src/boost/libs/math/test/igamma_big_data.ipp create mode 100644 src/boost/libs/math/test/igamma_int_data.ipp create mode 100644 src/boost/libs/math/test/igamma_inva_data.ipp create mode 100644 src/boost/libs/math/test/igamma_med_data.ipp create mode 100644 src/boost/libs/math/test/igamma_small_data.ipp create mode 100644 src/boost/libs/math/test/jacobi_elliptic.ipp create mode 100644 src/boost/libs/math/test/jacobi_elliptic_small.ipp create mode 100644 src/boost/libs/math/test/jacobi_large_phi.ipp create mode 100644 src/boost/libs/math/test/jacobi_near_1.ipp create mode 100644 src/boost/libs/math/test/jacobi_test.cpp create mode 100644 src/boost/libs/math/test/jacobi_zeta_big_phi.ipp create mode 100644 src/boost/libs/math/test/jacobi_zeta_data.ipp create mode 100644 src/boost/libs/math/test/laguerre2.ipp create mode 100644 src/boost/libs/math/test/laguerre3.ipp create mode 100644 src/boost/libs/math/test/lambert_w_high_reference_values.ipp create mode 100644 src/boost/libs/math/test/lambert_w_low_reference_values.ipp create mode 100644 src/boost/libs/math/test/lanczos_smoothing_test.cpp create mode 100644 src/boost/libs/math/test/legendre_p.ipp create mode 100644 src/boost/libs/math/test/legendre_p_large.ipp create mode 100644 src/boost/libs/math/test/legendre_stieltjes_test.cpp create mode 100644 src/boost/libs/math/test/ljung_box_test.cpp create mode 100644 src/boost/libs/math/test/log1p_expm1_data.ipp create mode 100644 src/boost/libs/math/test/log1p_expm1_test.cpp create mode 100644 src/boost/libs/math/test/log1p_expm1_test.hpp create mode 100644 src/boost/libs/math/test/math_unit_test.hpp create mode 100644 src/boost/libs/math/test/mpfr_concept_check.cpp create mode 100644 src/boost/libs/math/test/mpreal_concept_check.cpp create mode 100644 src/boost/libs/math/test/multiprc_concept_check_1.cpp create mode 100644 src/boost/libs/math/test/multiprc_concept_check_2.cpp create mode 100644 src/boost/libs/math/test/multiprc_concept_check_3.cpp create mode 100644 src/boost/libs/math/test/multiprc_concept_check_4.cpp create mode 100644 src/boost/libs/math/test/naive_monte_carlo_test.cpp create mode 100644 src/boost/libs/math/test/ncbeta.ipp create mode 100644 src/boost/libs/math/test/ncbeta_big.ipp create mode 100644 src/boost/libs/math/test/nccs.ipp create mode 100644 src/boost/libs/math/test/nccs_big.ipp create mode 100644 src/boost/libs/math/test/nct.ipp create mode 100644 src/boost/libs/math/test/nct_asym.ipp create mode 100644 src/boost/libs/math/test/nct_small_delta.ipp create mode 100644 src/boost/libs/math/test/negative_binomial_quantile.ipp create mode 100644 src/boost/libs/math/test/noeh_support.cpp create mode 100644 src/boost/libs/math/test/norms_test.cpp create mode 100644 src/boost/libs/math/test/ntl_concept_check.cpp create mode 100644 src/boost/libs/math/test/octonion_test.cpp create mode 100644 src/boost/libs/math/test/ooura_fourier_integral_test.cpp create mode 100644 src/boost/libs/math/test/owens_t.ipp create mode 100644 src/boost/libs/math/test/owens_t_T7.hpp create mode 100644 src/boost/libs/math/test/owens_t_large_data.ipp create mode 100644 src/boost/libs/math/test/pch.hpp create mode 100644 src/boost/libs/math/test/pch_light.hpp create mode 100644 src/boost/libs/math/test/poisson_quantile.ipp create mode 100644 src/boost/libs/math/test/polynomial_concept_check.cpp create mode 100644 src/boost/libs/math/test/pow_test.cpp create mode 100644 src/boost/libs/math/test/powm1_data.ipp create mode 100644 src/boost/libs/math/test/powm1_sqrtp1m1_test.cpp create mode 100644 src/boost/libs/math/test/powm1_sqrtp1m1_test.hpp create mode 100644 src/boost/libs/math/test/quaternion_constexpr_test.cpp create mode 100644 src/boost/libs/math/test/quaternion_mi1.cpp create mode 100644 src/boost/libs/math/test/quaternion_mi1.h create mode 100644 src/boost/libs/math/test/quaternion_mi2.cpp create mode 100644 src/boost/libs/math/test/quaternion_mi2.h create mode 100644 src/boost/libs/math/test/quaternion_mult_incl_test.cpp create mode 100644 src/boost/libs/math/test/quaternion_test.cpp create mode 100644 src/boost/libs/math/test/s_.ipp create mode 100644 src/boost/libs/math/test/signal_statistics_test.cpp create mode 100644 src/boost/libs/math/test/sinc_data.ipp create mode 100644 src/boost/libs/math/test/sinc_test.hpp create mode 100644 src/boost/libs/math/test/sinh_sinh_quadrature_test.cpp create mode 100644 src/boost/libs/math/test/sinhc_test.hpp create mode 100644 src/boost/libs/math/test/special_functions_test.cpp create mode 100644 src/boost/libs/math/test/sph_bessel_data.ipp create mode 100644 src/boost/libs/math/test/sph_bessel_prime_data.ipp create mode 100644 src/boost/libs/math/test/sph_neumann_data.ipp create mode 100644 src/boost/libs/math/test/sph_neumann_prime_data.ipp create mode 100644 src/boost/libs/math/test/spherical_harmonic.ipp create mode 100644 src/boost/libs/math/test/std_real_concept_check.cpp create mode 100644 src/boost/libs/math/test/table_type.hpp create mode 100644 src/boost/libs/math/test/tanh_sinh_quadrature_test.cpp create mode 100644 src/boost/libs/math/test/test_0F1.cpp create mode 100644 src/boost/libs/math/test/test_0F1.hpp create mode 100644 src/boost/libs/math/test/test_1F0.cpp create mode 100644 src/boost/libs/math/test/test_1F0.hpp create mode 100644 src/boost/libs/math/test/test_1F1.cpp create mode 100644 src/boost/libs/math/test/test_1F1.hpp create mode 100644 src/boost/libs/math/test/test_1F1_log.cpp create mode 100644 src/boost/libs/math/test/test_1F1_log.hpp create mode 100644 src/boost/libs/math/test/test_1F1_regularized.cpp create mode 100644 src/boost/libs/math/test/test_1F1_regularized.hpp create mode 100644 src/boost/libs/math/test/test_2F0.cpp create mode 100644 src/boost/libs/math/test/test_2F0.hpp create mode 100644 src/boost/libs/math/test/test_airy.cpp create mode 100644 src/boost/libs/math/test/test_archive.cpp create mode 100644 src/boost/libs/math/test/test_arcsine.cpp create mode 100644 src/boost/libs/math/test/test_autodiff.hpp create mode 100644 src/boost/libs/math/test/test_autodiff_1.cpp create mode 100644 src/boost/libs/math/test/test_autodiff_2.cpp create mode 100644 src/boost/libs/math/test/test_autodiff_3.cpp create mode 100644 src/boost/libs/math/test/test_autodiff_4.cpp create mode 100644 src/boost/libs/math/test/test_autodiff_5.cpp create mode 100644 src/boost/libs/math/test/test_autodiff_6.cpp create mode 100644 src/boost/libs/math/test/test_autodiff_7.cpp create mode 100644 src/boost/libs/math/test/test_autodiff_8.cpp create mode 100644 src/boost/libs/math/test/test_barycentric_rational.cpp create mode 100644 src/boost/libs/math/test/test_basic_nonfinite.cpp create mode 100644 src/boost/libs/math/test/test_bernoulli.cpp create mode 100644 src/boost/libs/math/test/test_bernoulli_constants.cpp create mode 100644 src/boost/libs/math/test/test_bessel_airy_zeros.cpp create mode 100644 src/boost/libs/math/test/test_bessel_hooks.hpp create mode 100644 src/boost/libs/math/test/test_bessel_i.cpp create mode 100644 src/boost/libs/math/test/test_bessel_i.hpp create mode 100644 src/boost/libs/math/test/test_bessel_i_prime.cpp create mode 100644 src/boost/libs/math/test/test_bessel_i_prime.hpp create mode 100644 src/boost/libs/math/test/test_bessel_j.cpp create mode 100644 src/boost/libs/math/test/test_bessel_j.hpp create mode 100644 src/boost/libs/math/test/test_bessel_j_prime.cpp create mode 100644 src/boost/libs/math/test/test_bessel_j_prime.hpp create mode 100644 src/boost/libs/math/test/test_bessel_k.cpp create mode 100644 src/boost/libs/math/test/test_bessel_k.hpp create mode 100644 src/boost/libs/math/test/test_bessel_k_prime.cpp create mode 100644 src/boost/libs/math/test/test_bessel_k_prime.hpp create mode 100644 src/boost/libs/math/test/test_bessel_y.cpp create mode 100644 src/boost/libs/math/test/test_bessel_y.hpp create mode 100644 src/boost/libs/math/test/test_bessel_y_prime.cpp create mode 100644 src/boost/libs/math/test/test_bessel_y_prime.hpp create mode 100644 src/boost/libs/math/test/test_beta.cpp create mode 100644 src/boost/libs/math/test/test_beta.hpp create mode 100644 src/boost/libs/math/test/test_beta_dist.cpp create mode 100644 src/boost/libs/math/test/test_beta_hooks.hpp create mode 100644 src/boost/libs/math/test/test_binomial.cpp create mode 100644 src/boost/libs/math/test/test_binomial_coeff.cpp create mode 100644 src/boost/libs/math/test/test_binomial_coeff.hpp create mode 100644 src/boost/libs/math/test/test_carlson.cpp create mode 100644 src/boost/libs/math/test/test_carlson.hpp create mode 100644 src/boost/libs/math/test/test_cauchy.cpp create mode 100644 src/boost/libs/math/test/test_cbrt.cpp create mode 100644 src/boost/libs/math/test/test_cbrt.hpp create mode 100644 src/boost/libs/math/test/test_chi_squared.cpp create mode 100644 src/boost/libs/math/test/test_classify.cpp create mode 100644 src/boost/libs/math/test/test_constant_generate.cpp create mode 100644 src/boost/libs/math/test/test_constants.cpp create mode 100644 src/boost/libs/math/test/test_cstdfloat.cpp create mode 100644 src/boost/libs/math/test/test_difference.cpp create mode 100644 src/boost/libs/math/test/test_digamma.cpp create mode 100644 src/boost/libs/math/test/test_digamma.hpp create mode 100644 src/boost/libs/math/test/test_dist_overloads.cpp create mode 100644 src/boost/libs/math/test/test_ellint_1.cpp create mode 100644 src/boost/libs/math/test/test_ellint_1.hpp create mode 100644 src/boost/libs/math/test/test_ellint_2.cpp create mode 100644 src/boost/libs/math/test/test_ellint_2.hpp create mode 100644 src/boost/libs/math/test/test_ellint_3.cpp create mode 100644 src/boost/libs/math/test/test_ellint_3.hpp create mode 100644 src/boost/libs/math/test/test_ellint_d.cpp create mode 100644 src/boost/libs/math/test/test_ellint_d.hpp create mode 100644 src/boost/libs/math/test/test_erf.cpp create mode 100644 src/boost/libs/math/test/test_erf.hpp create mode 100644 src/boost/libs/math/test/test_erf_hooks.hpp create mode 100644 src/boost/libs/math/test/test_error_handling.cpp create mode 100644 src/boost/libs/math/test/test_expint.cpp create mode 100644 src/boost/libs/math/test/test_expint.hpp create mode 100644 src/boost/libs/math/test/test_expint_hooks.hpp create mode 100644 src/boost/libs/math/test/test_exponential_dist.cpp create mode 100644 src/boost/libs/math/test/test_extreme_value.cpp create mode 100644 src/boost/libs/math/test/test_factorials.cpp create mode 100644 src/boost/libs/math/test/test_find_location.cpp create mode 100644 src/boost/libs/math/test/test_find_scale.cpp create mode 100644 src/boost/libs/math/test/test_fisher_f.cpp create mode 100644 src/boost/libs/math/test/test_gamma.cpp create mode 100644 src/boost/libs/math/test/test_gamma.hpp create mode 100644 src/boost/libs/math/test/test_gamma_data.ipp create mode 100644 src/boost/libs/math/test/test_gamma_dist.cpp create mode 100644 src/boost/libs/math/test/test_gamma_hooks.hpp create mode 100644 src/boost/libs/math/test/test_gamma_mp.cpp create mode 100644 src/boost/libs/math/test/test_geometric.cpp create mode 100644 src/boost/libs/math/test/test_hankel.cpp create mode 100644 src/boost/libs/math/test/test_hermite.cpp create mode 100644 src/boost/libs/math/test/test_hermite.hpp create mode 100644 src/boost/libs/math/test/test_heuman_lambda.cpp create mode 100644 src/boost/libs/math/test/test_heuman_lambda.hpp create mode 100644 src/boost/libs/math/test/test_hyperexponential_dist.cpp create mode 100644 src/boost/libs/math/test/test_hypergeometric_dist.cpp create mode 100644 src/boost/libs/math/test/test_ibeta.cpp create mode 100644 src/boost/libs/math/test/test_ibeta.hpp create mode 100644 src/boost/libs/math/test/test_ibeta_derivative.cpp create mode 100644 src/boost/libs/math/test/test_ibeta_derivative.hpp create mode 100644 src/boost/libs/math/test/test_ibeta_inv.cpp create mode 100644 src/boost/libs/math/test/test_ibeta_inv.hpp create mode 100644 src/boost/libs/math/test/test_ibeta_inv_ab.cpp create mode 100644 src/boost/libs/math/test/test_ibeta_inv_ab.hpp create mode 100644 src/boost/libs/math/test/test_igamma.cpp create mode 100644 src/boost/libs/math/test/test_igamma.hpp create mode 100644 src/boost/libs/math/test/test_igamma_inv.cpp create mode 100644 src/boost/libs/math/test/test_igamma_inv.hpp create mode 100644 src/boost/libs/math/test/test_igamma_inva.cpp create mode 100644 src/boost/libs/math/test/test_igamma_inva.hpp create mode 100644 src/boost/libs/math/test/test_instances/Jamfile.v2 create mode 100644 src/boost/libs/math/test/test_instances/double_test_instances_1.cpp create mode 100644 src/boost/libs/math/test/test_instances/double_test_instances_10.cpp create mode 100644 src/boost/libs/math/test/test_instances/double_test_instances_2.cpp create mode 100644 src/boost/libs/math/test/test_instances/double_test_instances_3.cpp create mode 100644 src/boost/libs/math/test/test_instances/double_test_instances_4.cpp create mode 100644 src/boost/libs/math/test/test_instances/double_test_instances_5.cpp create mode 100644 src/boost/libs/math/test/test_instances/double_test_instances_6.cpp create mode 100644 src/boost/libs/math/test/test_instances/double_test_instances_7.cpp create mode 100644 src/boost/libs/math/test/test_instances/double_test_instances_8.cpp create mode 100644 src/boost/libs/math/test/test_instances/double_test_instances_9.cpp create mode 100644 src/boost/libs/math/test/test_instances/float_test_instances_1.cpp create mode 100644 src/boost/libs/math/test/test_instances/float_test_instances_10.cpp create mode 100644 src/boost/libs/math/test/test_instances/float_test_instances_2.cpp create mode 100644 src/boost/libs/math/test/test_instances/float_test_instances_3.cpp create mode 100644 src/boost/libs/math/test/test_instances/float_test_instances_4.cpp create mode 100644 src/boost/libs/math/test/test_instances/float_test_instances_5.cpp create mode 100644 src/boost/libs/math/test/test_instances/float_test_instances_6.cpp create mode 100644 src/boost/libs/math/test/test_instances/float_test_instances_7.cpp create mode 100644 src/boost/libs/math/test/test_instances/float_test_instances_8.cpp create mode 100644 src/boost/libs/math/test/test_instances/float_test_instances_9.cpp create mode 100644 src/boost/libs/math/test/test_instances/ldouble_test_instances_10.cpp create mode 100644 src/boost/libs/math/test/test_instances/ldouble_test_instances_2.cpp create mode 100644 src/boost/libs/math/test/test_instances/ldouble_test_instances_3.cpp create mode 100644 src/boost/libs/math/test/test_instances/ldouble_test_instances_4.cpp create mode 100644 src/boost/libs/math/test/test_instances/ldouble_test_instances_5.cpp create mode 100644 src/boost/libs/math/test/test_instances/ldouble_test_instances_6.cpp create mode 100644 src/boost/libs/math/test/test_instances/ldouble_test_instances_7.cpp create mode 100644 src/boost/libs/math/test/test_instances/ldouble_test_instances_8.cpp create mode 100644 src/boost/libs/math/test/test_instances/ldouble_test_instances_9.cpp create mode 100644 src/boost/libs/math/test/test_instances/long_double_test_instances_1.cpp create mode 100644 src/boost/libs/math/test/test_instances/pch.hpp create mode 100644 src/boost/libs/math/test/test_instances/real_concept_test_instances_1.cpp create mode 100644 src/boost/libs/math/test/test_instances/real_concept_test_instances_10.cpp create mode 100644 src/boost/libs/math/test/test_instances/real_concept_test_instances_2.cpp create mode 100644 src/boost/libs/math/test/test_instances/real_concept_test_instances_3.cpp create mode 100644 src/boost/libs/math/test/test_instances/real_concept_test_instances_4.cpp create mode 100644 src/boost/libs/math/test/test_instances/real_concept_test_instances_5.cpp create mode 100644 src/boost/libs/math/test/test_instances/real_concept_test_instances_6.cpp create mode 100644 src/boost/libs/math/test/test_instances/real_concept_test_instances_7.cpp create mode 100644 src/boost/libs/math/test/test_instances/real_concept_test_instances_8.cpp create mode 100644 src/boost/libs/math/test/test_instances/real_concept_test_instances_9.cpp create mode 100644 src/boost/libs/math/test/test_instances/test_instances.hpp create mode 100644 src/boost/libs/math/test/test_instantiate1.cpp create mode 100644 src/boost/libs/math/test/test_instantiate2.cpp create mode 100644 src/boost/libs/math/test/test_inv_hyp.cpp create mode 100644 src/boost/libs/math/test/test_inverse_chi_squared_distribution.cpp create mode 100644 src/boost/libs/math/test/test_inverse_gamma_distribution.cpp create mode 100644 src/boost/libs/math/test/test_inverse_gaussian.cpp create mode 100644 src/boost/libs/math/test/test_jacobi.cpp create mode 100644 src/boost/libs/math/test/test_jacobi.hpp create mode 100644 src/boost/libs/math/test/test_jacobi_zeta.cpp create mode 100644 src/boost/libs/math/test/test_jacobi_zeta.hpp create mode 100644 src/boost/libs/math/test/test_laguerre.cpp create mode 100644 src/boost/libs/math/test/test_laguerre.hpp create mode 100644 src/boost/libs/math/test/test_lambert_w.cpp create mode 100644 src/boost/libs/math/test/test_lambert_w_derivative.cpp create mode 100644 src/boost/libs/math/test/test_lambert_w_integrals_double.cpp create mode 100644 src/boost/libs/math/test/test_lambert_w_integrals_float.cpp create mode 100644 src/boost/libs/math/test/test_lambert_w_integrals_float128.cpp create mode 100644 src/boost/libs/math/test/test_lambert_w_integrals_long_double.cpp create mode 100644 src/boost/libs/math/test/test_lambert_w_integrals_quad.cpp create mode 100644 src/boost/libs/math/test/test_laplace.cpp create mode 100644 src/boost/libs/math/test/test_ldouble_simple.cpp create mode 100644 src/boost/libs/math/test/test_legacy_nonfinite.cpp create mode 100644 src/boost/libs/math/test/test_legendre.cpp create mode 100644 src/boost/libs/math/test/test_legendre.hpp create mode 100644 src/boost/libs/math/test/test_legendre_hooks.hpp create mode 100644 src/boost/libs/math/test/test_lexical_cast.cpp create mode 100644 src/boost/libs/math/test/test_logistic_dist.cpp create mode 100644 src/boost/libs/math/test/test_lognormal.cpp create mode 100644 src/boost/libs/math/test/test_long_double_support.cpp create mode 100644 src/boost/libs/math/test/test_math_fwd.cpp create mode 100644 src/boost/libs/math/test/test_minima.cpp create mode 100644 src/boost/libs/math/test/test_nc_beta.cpp create mode 100644 src/boost/libs/math/test/test_nc_beta.hpp create mode 100644 src/boost/libs/math/test/test_nc_chi_squared.cpp create mode 100644 src/boost/libs/math/test/test_nc_chi_squared.hpp create mode 100644 src/boost/libs/math/test/test_nc_f.cpp create mode 100644 src/boost/libs/math/test/test_nc_t.cpp create mode 100644 src/boost/libs/math/test/test_nc_t.hpp create mode 100644 src/boost/libs/math/test/test_ncbeta_hooks.hpp create mode 100644 src/boost/libs/math/test/test_nccs_hooks.hpp create mode 100644 src/boost/libs/math/test/test_negative_binomial.cpp create mode 100644 src/boost/libs/math/test/test_next.cpp create mode 100644 src/boost/libs/math/test/test_next_decimal.cpp create mode 100644 src/boost/libs/math/test/test_nonfinite_io.cpp create mode 100644 src/boost/libs/math/test/test_nonfinite_trap.cpp create mode 100644 src/boost/libs/math/test/test_normal.cpp create mode 100644 src/boost/libs/math/test/test_numerical_differentiation.cpp create mode 100644 src/boost/libs/math/test/test_out_of_range.hpp create mode 100644 src/boost/libs/math/test/test_owens_t.cpp create mode 100644 src/boost/libs/math/test/test_owens_t.hpp create mode 100644 src/boost/libs/math/test/test_pFq.cpp create mode 100644 src/boost/libs/math/test/test_pFq.hpp create mode 100644 src/boost/libs/math/test/test_pFq_precision.cpp create mode 100644 src/boost/libs/math/test/test_pareto.cpp create mode 100644 src/boost/libs/math/test/test_poisson.cpp create mode 100644 src/boost/libs/math/test/test_policy.cpp create mode 100644 src/boost/libs/math/test/test_policy_2.cpp create mode 100644 src/boost/libs/math/test/test_policy_3.cpp create mode 100644 src/boost/libs/math/test/test_policy_4.cpp create mode 100644 src/boost/libs/math/test/test_policy_5.cpp create mode 100644 src/boost/libs/math/test/test_policy_6.cpp create mode 100644 src/boost/libs/math/test/test_policy_7.cpp create mode 100644 src/boost/libs/math/test/test_policy_8.cpp create mode 100644 src/boost/libs/math/test/test_policy_9.cpp create mode 100644 src/boost/libs/math/test/test_policy_sf.cpp create mode 100644 src/boost/libs/math/test/test_polygamma.cpp create mode 100644 src/boost/libs/math/test/test_polygamma.hpp create mode 100644 src/boost/libs/math/test/test_polynomial.cpp create mode 100644 src/boost/libs/math/test/test_print_info_on_type.cpp create mode 100644 src/boost/libs/math/test/test_rational_instances/test_rational.hpp create mode 100644 src/boost/libs/math/test/test_rational_instances/test_rational_double1.cpp create mode 100644 src/boost/libs/math/test/test_rational_instances/test_rational_double2.cpp create mode 100644 src/boost/libs/math/test/test_rational_instances/test_rational_double3.cpp create mode 100644 src/boost/libs/math/test/test_rational_instances/test_rational_double4.cpp create mode 100644 src/boost/libs/math/test/test_rational_instances/test_rational_double5.cpp create mode 100644 src/boost/libs/math/test/test_rational_instances/test_rational_float1.cpp create mode 100644 src/boost/libs/math/test/test_rational_instances/test_rational_float2.cpp create mode 100644 src/boost/libs/math/test/test_rational_instances/test_rational_float3.cpp create mode 100644 src/boost/libs/math/test/test_rational_instances/test_rational_float4.cpp create mode 100644 src/boost/libs/math/test/test_rational_instances/test_rational_ldouble1.cpp create mode 100644 src/boost/libs/math/test/test_rational_instances/test_rational_ldouble2.cpp create mode 100644 src/boost/libs/math/test/test_rational_instances/test_rational_ldouble3.cpp create mode 100644 src/boost/libs/math/test/test_rational_instances/test_rational_ldouble4.cpp create mode 100644 src/boost/libs/math/test/test_rational_instances/test_rational_ldouble5.cpp create mode 100644 src/boost/libs/math/test/test_rational_instances/test_rational_real_concept1.cpp create mode 100644 src/boost/libs/math/test/test_rational_instances/test_rational_real_concept2.cpp create mode 100644 src/boost/libs/math/test/test_rational_instances/test_rational_real_concept3.cpp create mode 100644 src/boost/libs/math/test/test_rational_instances/test_rational_real_concept4.cpp create mode 100644 src/boost/libs/math/test/test_rational_instances/test_rational_real_concept5.cpp create mode 100644 src/boost/libs/math/test/test_rationals.cpp create mode 100644 src/boost/libs/math/test/test_rayleigh.cpp create mode 100644 src/boost/libs/math/test/test_real_concept.cpp create mode 100644 src/boost/libs/math/test/test_real_concept_neg_bin.cpp create mode 100644 src/boost/libs/math/test/test_recurrence.cpp create mode 100644 src/boost/libs/math/test/test_remez.cpp create mode 100644 src/boost/libs/math/test/test_root_finding_concepts.cpp create mode 100644 src/boost/libs/math/test/test_root_iterations.cpp create mode 100644 src/boost/libs/math/test/test_roots.cpp create mode 100644 src/boost/libs/math/test/test_round.cpp create mode 100644 src/boost/libs/math/test/test_runs_test.cpp create mode 100644 src/boost/libs/math/test/test_sign.cpp create mode 100644 src/boost/libs/math/test/test_signed_zero.cpp create mode 100644 src/boost/libs/math/test/test_sinc.cpp create mode 100644 src/boost/libs/math/test/test_sinc.hpp create mode 100644 src/boost/libs/math/test/test_skew_normal.cpp create mode 100644 src/boost/libs/math/test/test_spherical_harmonic.cpp create mode 100644 src/boost/libs/math/test/test_spherical_harmonic.hpp create mode 100644 src/boost/libs/math/test/test_students_t.cpp create mode 100644 src/boost/libs/math/test/test_t_test.cpp create mode 100644 src/boost/libs/math/test/test_tgamma_ratio.cpp create mode 100644 src/boost/libs/math/test/test_tgamma_ratio.hpp create mode 100644 src/boost/libs/math/test/test_toms748_solve.cpp create mode 100644 src/boost/libs/math/test/test_tr1.c create mode 100644 src/boost/libs/math/test/test_tr1.cpp create mode 100644 src/boost/libs/math/test/test_trapezoidal.cpp create mode 100644 src/boost/libs/math/test/test_triangular.cpp create mode 100644 src/boost/libs/math/test/test_trig.cpp create mode 100644 src/boost/libs/math/test/test_trig.hpp create mode 100644 src/boost/libs/math/test/test_trigamma.cpp create mode 100644 src/boost/libs/math/test/test_trigamma.hpp create mode 100644 src/boost/libs/math/test/test_uniform.cpp create mode 100644 src/boost/libs/math/test/test_value.hpp create mode 100644 src/boost/libs/math/test/test_vector_barycentric_rational.cpp create mode 100644 src/boost/libs/math/test/test_weibull.cpp create mode 100644 src/boost/libs/math/test/test_zeta.cpp create mode 100644 src/boost/libs/math/test/test_zeta.hpp create mode 100644 src/boost/libs/math/test/test_zeta_hooks.hpp create mode 100644 src/boost/libs/math/test/tgamma_delta_ratio_data.ipp create mode 100644 src/boost/libs/math/test/tgamma_delta_ratio_int.ipp create mode 100644 src/boost/libs/math/test/tgamma_delta_ratio_int2.ipp create mode 100644 src/boost/libs/math/test/tgamma_mp_data.hpp create mode 100644 src/boost/libs/math/test/tgamma_ratio_data.ipp create mode 100644 src/boost/libs/math/test/trig_data.ipp create mode 100644 src/boost/libs/math/test/trig_data2.ipp create mode 100644 src/boost/libs/math/test/univariate_statistics_test.cpp create mode 100644 src/boost/libs/math/test/whittaker_shannon_test.cpp create mode 100644 src/boost/libs/math/test/zeta_1_below_data.ipp create mode 100644 src/boost/libs/math/test/zeta_1_up_data.ipp create mode 100644 src/boost/libs/math/test/zeta_data.ipp create mode 100644 src/boost/libs/math/test/zeta_neg_data.ipp create mode 100644 src/boost/libs/math/tools/Jamfile.v2 create mode 100644 src/boost/libs/math/tools/bessel_data.cpp create mode 100644 src/boost/libs/math/tools/bessel_derivative_append_negative.cpp create mode 100644 src/boost/libs/math/tools/bessel_derivative_data.cpp create mode 100644 src/boost/libs/math/tools/bessel_derivative_data_from_bessel_ipps.cpp create mode 100644 src/boost/libs/math/tools/beta_data.cpp create mode 100644 src/boost/libs/math/tools/carlson_ellint_data.cpp create mode 100644 src/boost/libs/math/tools/cbrt_data.cpp create mode 100644 src/boost/libs/math/tools/digamma_data.cpp create mode 100644 src/boost/libs/math/tools/ellint_d2_data.cpp create mode 100644 src/boost/libs/math/tools/ellint_d_data.cpp create mode 100644 src/boost/libs/math/tools/ellint_e_data.cpp create mode 100644 src/boost/libs/math/tools/ellint_f_data.cpp create mode 100644 src/boost/libs/math/tools/ellint_k_data.cpp create mode 100644 src/boost/libs/math/tools/ellint_pi2_data.cpp create mode 100644 src/boost/libs/math/tools/ellint_pi3_data.cpp create mode 100644 src/boost/libs/math/tools/erf_data.cpp create mode 100644 src/boost/libs/math/tools/expint_data.cpp create mode 100644 src/boost/libs/math/tools/expint_i_data.cpp create mode 100644 src/boost/libs/math/tools/factorial_tables.cpp create mode 100644 src/boost/libs/math/tools/gamma_P_inva_data.cpp create mode 100644 src/boost/libs/math/tools/gauss_kronrod_constants.cpp create mode 100644 src/boost/libs/math/tools/generate_rational_code.cpp create mode 100644 src/boost/libs/math/tools/generate_rational_test.cpp create mode 100644 src/boost/libs/math/tools/generate_test_values.cpp create mode 100644 src/boost/libs/math/tools/hermite_data.cpp create mode 100644 src/boost/libs/math/tools/heuman_lambda_data.cpp create mode 100644 src/boost/libs/math/tools/hyp_0f2_data.cpp create mode 100644 src/boost/libs/math/tools/hyp_1f1_big_data.cpp create mode 100644 src/boost/libs/math/tools/hyp_1f1_data.cpp create mode 100644 src/boost/libs/math/tools/hyp_1f1_log_big_data.cpp create mode 100644 src/boost/libs/math/tools/hyp_1f1_reg_big_data.cpp create mode 100644 src/boost/libs/math/tools/hyp_1f2_data.cpp create mode 100644 src/boost/libs/math/tools/hyp_2f0_data.cpp create mode 100644 src/boost/libs/math/tools/hyp_2f1_data.cpp create mode 100644 src/boost/libs/math/tools/hyp_2f2_data.cpp create mode 100644 src/boost/libs/math/tools/hypergeometric_1F1_error_plot.cpp create mode 100644 src/boost/libs/math/tools/hypergeometric_1F1_map_neg_b_fwd_recurrence.cpp create mode 100644 src/boost/libs/math/tools/hypergeometric_dist_data.cpp create mode 100644 src/boost/libs/math/tools/ibeta_data.cpp create mode 100644 src/boost/libs/math/tools/ibeta_derivative_data.cpp create mode 100644 src/boost/libs/math/tools/ibeta_inv_data.cpp create mode 100644 src/boost/libs/math/tools/ibeta_invab_data.cpp create mode 100644 src/boost/libs/math/tools/igamma_data.cpp create mode 100644 src/boost/libs/math/tools/igamma_temme_large_coef.cpp create mode 100644 src/boost/libs/math/tools/inv_hyp_data.cpp create mode 100644 src/boost/libs/math/tools/jacobi_zeta_data.cpp create mode 100644 src/boost/libs/math/tools/laguerre_data.cpp create mode 100644 src/boost/libs/math/tools/lambert_w_errors_graph.cpp create mode 100644 src/boost/libs/math/tools/lambert_w_high_reference_values.cpp create mode 100644 src/boost/libs/math/tools/lambert_w_lookup_table_generator.cpp create mode 100644 src/boost/libs/math/tools/lambert_w_low_reference_values.cpp create mode 100644 src/boost/libs/math/tools/lanczos_generator.cpp create mode 100644 src/boost/libs/math/tools/legendre_data.cpp create mode 100644 src/boost/libs/math/tools/log1p_expm1_data.cpp create mode 100644 src/boost/libs/math/tools/mp_t.hpp create mode 100644 src/boost/libs/math/tools/process_perf_results.cpp create mode 100644 src/boost/libs/math/tools/rational_tests.cpp create mode 100644 src/boost/libs/math/tools/sinc_data.cpp create mode 100644 src/boost/libs/math/tools/spherical_harmonic_data.cpp create mode 100644 src/boost/libs/math/tools/tgamma_large_data.cpp create mode 100644 src/boost/libs/math/tools/tgamma_ratio_data.cpp create mode 100644 src/boost/libs/math/tools/trig_data.cpp create mode 100644 src/boost/libs/math/tools/zeta_data.cpp create mode 100644 src/boost/libs/math/vc71_fix/Jamfile.v2 create mode 100644 src/boost/libs/math/vc71_fix/instantiate_all.cpp (limited to 'src/boost/libs/math') diff --git a/src/boost/libs/math/README.md b/src/boost/libs/math/README.md new file mode 100644 index 00000000..abeaf7a3 --- /dev/null +++ b/src/boost/libs/math/README.md @@ -0,0 +1,121 @@ +Boost Math Library [![Build Status](https://travis-ci.org/boostorg/math.svg?branch=develop)](https://travis-ci.org/boostorg/math) +================== + +This library is divided into several interconnected parts: + +### Floating Point Utilities + +Utility functions for dealing with floating point arithmetic, includes functions for floating point classification (fpclassify, isnan, isinf etc), sign manipulation, rounding, comparison, and computing the distance between floating point numbers. + +### Specific Width Floating Point Types + +A set of typedefs similar to those provided by but for floating point types. + +### Mathematical Constants + +A wide range of constants ranging from various multiples of Ï€, fractions, Euler's constant, etc. + +These are of course usable from template code, or as non-templates with a simplified interface if that is more appropriate. + +### Statistical Distributions + +Provides a reasonably comprehensive set of statistical distributions, upon which higher level statistical tests can be built. + +The initial focus is on the central univariate distributions. Both continuous (like normal & Fisher) and discrete (like binomial & Poisson) distributions are provided. + +A comprehensive tutorial is provided, along with a series of worked examples illustrating how the library is used to conduct statistical tests. + +### Special Functions + +Provides a small number of high quality special functions; initially these were concentrated on functions used in statistical applications along with those in the Technical Report on C++ Library Extensions. + +The function families currently implemented are the gamma, beta & error functions along with the incomplete gamma and beta functions (four variants of each) and all the possible inverses of these, plus the digamma, various factorial functions, Bessel functions, elliptic integrals, sinus cardinals (along with their hyperbolic variants), inverse hyperbolic functions, Legrendre/Laguerre/Hermite/Chebyshev polynomials and various special power and logarithmic functions. + +All the implementations are fully generic and support the use of arbitrary "real-number" types, including Boost.Multiprecision, although they are optimised for use with types with known significand (or mantissa) sizes: typically float, double or long double. + +These functions also provide the basis of support for the TR1 special functions. + +### Root Finding and Function Minimisation + +A comprehensive set of root-finding algorithms over the real line, both with derivatives and derivative free. + +Also function minimisation via Brent's Method. + +### Polynomials and Rational Functions + +Tools for manipulating polynomials and for efficient evaluation of rationals or polynomials. + +### Interpolation + +Function interpolation via barycentric rational interpolation, compactly supported cubic B-splines, and the Chebyshev transform. + +### Numerical Integration and Differentiation + +A reasonably comprehensive set of routines for integration (trapezoidal, Gauss-Legendre, Gauss-Kronrod, Gauss-Chebyshev, double-exponential, and Monte-Carlo) and differentiation (Chebyshev transform, finite difference, and the complex step derivative). + +The integration routines are usable for functions returning complex results - and hence can be used for computation of contour integrals. + +### Quaternions and Octonions + +Quaternion and Octonians as class templates similar to std::complex. + +The full documentation is available on [boost.org](http://www.boost.org/doc/libs/release/libs/math). + +| | Master | Develop | +|------------------|----------|-------------| +| Travis | [![Build Status](https://travis-ci.org/boostorg/math.svg?branch=master)](https://travis-ci.org/boostorg/math) | [![Build Status](https://travis-ci.org/boostorg/math.svg)](https://travis-ci.org/boostorg/math) | +| Appveyor | [![Build status](https://ci.appveyor.com/api/projects/status/cnugjx9dt7cou7nj/branch/master?svg=true)](https://ci.appveyor.com/project/jzmaddock/math/branch/master) | [![Build status](https://ci.appveyor.com/api/projects/status/cnugjx9dt7cou7nj/branch/develop?svg=true)](https://ci.appveyor.com/project/jzmaddock/math/branch/develop) | + + + +## Support, bugs and feature requests ## + +Bugs and feature requests can be reported through the [Gitub issue tracker](https://github.com/boostorg/math/issues) +(see [open issues](https://github.com/boostorg/math/issues) and +[closed issues](https://github.com/boostorg/math/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aclosed)). + +You can submit your changes through a [pull request](https://github.com/boostorg/math/pulls). + +There is no mailing-list specific to Boost Math, although you can use the general-purpose Boost [mailing-list](http://lists.boost.org/mailman/listinfo.cgi/boost-users) using the tag [math]. + + +## Development ## + +Clone the whole boost project, which includes the individual Boost projects as submodules ([see boost+git doc](https://github.com/boostorg/boost/wiki/Getting-Started)): + + $ git clone https://github.com/boostorg/boost + $ cd boost + $ git submodule update --init + +The Boost Math Library is located in `libs/math/`. + +### Running tests ### +First, make sure you are in `libs/math/test`. +You can either run all the tests listed in `Jamfile.v2` or run a single test: + + test$ ../../../b2 <- run all tests + test$ ../../../b2 static_assert_test <- single test + test$ # A more advanced syntax, demoing various options for building the tests: + test$ ../../../b2 -a -j2 -q --reconfigure toolset=clang cxxflags="--std=c++14 -fsanitize=address -fsanitize=undefined" linkflags="-fsanitize=undefined -fsanitize=address" + +### Building documentation ### + +Full instructions can be found [here](https://svn.boost.org/trac10/wiki/BoostDocs/GettingStarted), but to reiterate slightly: + +```bash +libs/math/doc$ brew install docbook-xsl # on mac +libs/math/doc$ touch ~/user-config.jam +libs/math/doc$ # now edit so that: +libs/math/doc$ cat ~/user-config.jam +using darwin ; + +using xsltproc ; + +using boostbook + : /usr/local/opt/docbook-xsl/docbook-xsl + ; + +using doxygen ; +using quickbook ; +libs/math/doc$ ../../../b2 +``` diff --git a/src/boost/libs/math/build/Jamfile.v2 b/src/boost/libs/math/build/Jamfile.v2 new file mode 100644 index 00000000..3537e9f5 --- /dev/null +++ b/src/boost/libs/math/build/Jamfile.v2 @@ -0,0 +1,123 @@ +# copyright John Maddock 2008 +# Distributed under 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. + +import testing ; +import pch ; + +project + : requirements + intel-win:-nologo + intel-win:-nologo + #intel-linux:off + intel-darwin:off + msvc-7.1:off + gcc,windows:off + #gcc:-fvisibility=hidden + intel-linux:-fvisibility=hidden + #sun:-xldscope=hidden + [ check-target-builds ../config//has_gcc_visibility "gcc visibility" : gcc:-fvisibility=hidden : ] + ; + +cpp-pch pch : ../src/tr1/pch.hpp : ../src/tr1 shared:BOOST_MATH_TR1_DYN_LINK=1 ; + +C99_SOURCES = acosh +asinh +atanh +cbrt +copysign +erfc +erf +expm1 +fmax +fmin +fpclassify +hypot +lgamma +llround +log1p +lround +nextafter +nexttoward +round +tgamma +trunc ; + +TR1_SOURCES = +assoc_laguerre +assoc_legendre +beta +comp_ellint_1 +comp_ellint_2 +comp_ellint_3 +cyl_bessel_i +cyl_bessel_j +cyl_bessel_k +cyl_neumann +ellint_1 +ellint_2 +ellint_3 +expint +hermite +laguerre +legendre +riemann_zeta +sph_bessel +sph_legendre +sph_neumann +; + +# Configure checks. + +import project ; +import configure ; +import property ; +import property-set ; +import targets ; + +obj long_double_check : ../config/has_long_double_support.cpp ; +explicit long_double_check ; + +# Library targets +lib boost_math_tr1 : ../src/tr1/$(TR1_SOURCES).cpp pch + : + shared:BOOST_MATH_TR1_DYN_LINK=1 + ../src/tr1 + ; + +lib boost_math_tr1f : ../src/tr1/$(TR1_SOURCES)f.cpp pch + : + shared:BOOST_MATH_TR1_DYN_LINK=1 + ../src/tr1 + ; + +lib boost_math_tr1l : ../src/tr1/$(TR1_SOURCES)l.cpp pch + : + shared:BOOST_MATH_TR1_DYN_LINK=1 + ../config//has_long_double_support + ../src/tr1 + [ check-target-builds ../config//has_long_double_support "long double support" : : no ] + ; + +lib boost_math_c99 : ../src/tr1/$(C99_SOURCES).cpp pch + : + shared:BOOST_MATH_TR1_DYN_LINK=1 + ../src/tr1 + ; + +lib boost_math_c99f : ../src/tr1/$(C99_SOURCES)f.cpp pch + : + shared:BOOST_MATH_TR1_DYN_LINK=1 + ../src/tr1 + ; + +lib boost_math_c99l : ../src/tr1/$(C99_SOURCES)l.cpp pch + : + shared:BOOST_MATH_TR1_DYN_LINK=1 + ../config//has_long_double_support + ../src/tr1 + [ check-target-builds ../config//has_long_double_support "long double support" : : no ] + ; + +boost-install boost_math_c99 boost_math_c99f boost_math_c99l boost_math_tr1 boost_math_tr1f boost_math_tr1l ; diff --git a/src/boost/libs/math/config/Jamfile.v2 b/src/boost/libs/math/config/Jamfile.v2 new file mode 100644 index 00000000..86db7150 --- /dev/null +++ b/src/boost/libs/math/config/Jamfile.v2 @@ -0,0 +1,52 @@ +# copyright John Maddock 2008 +# Distributed under 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. + +import modules ; +import path ; + +local ntl-path = [ modules.peek : NTL_PATH ] ; +local gmp_path = [ modules.peek : GMP_PATH ] ; +local e_float_path = [ modules.peek : E_FLOAT_PATH ] ; + +lib quadmath ; +lib fftw3 ; +lib fftw3f ; +lib fftw3l ; +lib fftw3q ; + +obj has_long_double_support : has_long_double_support.cpp ; +obj has_mpfr_class : has_mpfr_class.cpp : + $(gmp_path) $(gmp_path)/mpfr $(gmp_path)/gmpfrxx ; +obj has_mpreal : has_mpreal.cpp : + $(gmp_path) $(gmp_path)/mpfr $(gmp_path)/mpfrc++ ; +obj has_ntl_rr : has_ntl_rr.cpp : $(ntl-path)/include ; +obj has_gmpxx : has_gmpxx.cpp : + $(gmp_path) $(gmp_path)/mpfr $(gmp_path)/gmpfrxx ; +obj has_gcc_visibility : has_gcc_visibility.cpp : + gcc:-fvisibility=hidden gcc:-Werror ; +obj has_e_float : has_e_float.cpp : $(e_float_path) ; +exe has_float128 : has_float128.cpp quadmath ; +exe has_fftw3 : has_fftw3.cpp fftw3 fftw3f fftw3l ; +exe has_intel_quad : has_intel_quad.cpp : -Qoption,cpp,--extended_float_type ; +obj has_128bit_floatmax_t : has_128bit_floatmax_t.cpp ; +obj has_mpfr : has_mpfr.cpp : + $(gmp_path) $(gmp_path)/mpfr $(gmp_path)/gmpfrxx ; +obj has_gmp : has_gmp.cpp : + $(gmp_path) $(gmp_path)/mpfr $(gmp_path)/gmpfrxx ; + +explicit has_long_double_support ; +explicit has_mpfr_class ; +explicit has_mpfr ; +explicit has_gmp ; +explicit has_mpreal ; +explicit has_ntl_rr ; +explicit has_gmpxx ; +explicit has_gcc_visibility ; +explicit has_e_float ; +explicit has_float128 ; +explicit has_intel_quad ; +explicit has_128bit_floatmax_t ; +explicit has_fftw3 ; + diff --git a/src/boost/libs/math/config/has_128bit_floatmax_t.cpp b/src/boost/libs/math/config/has_128bit_floatmax_t.cpp new file mode 100644 index 00000000..aee4837c --- /dev/null +++ b/src/boost/libs/math/config/has_128bit_floatmax_t.cpp @@ -0,0 +1,19 @@ +// Copyright John Maddock 2014. +// 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 + +#ifndef BOOST_FLOAT128_C +#error "There is no 128 bit floating point type" +#endif + +BOOST_STATIC_ASSERT(sizeof(boost::floatmax_t) * CHAR_BIT == 128); + +int main() +{ + return 0; +} + diff --git a/src/boost/libs/math/config/has_e_float.cpp b/src/boost/libs/math/config/has_e_float.cpp new file mode 100644 index 00000000..1f3b3053 --- /dev/null +++ b/src/boost/libs/math/config/has_e_float.cpp @@ -0,0 +1,15 @@ +// Copyright John Maddock 2011. +// 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) + + +#ifdef _MSC_VER +# pragma warning (disable : 4100) // unreferenced formal parameter +#endif + +#define E_FLOAT_TYPE_EFX + +#include +#include + diff --git a/src/boost/libs/math/config/has_fftw3.cpp b/src/boost/libs/math/config/has_fftw3.cpp new file mode 100644 index 00000000..80456857 --- /dev/null +++ b/src/boost/libs/math/config/has_fftw3.cpp @@ -0,0 +1,19 @@ +// Copyright John Maddock 2017. +// 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 + +int main() +{ + fftwq_plan plan; // early versions don't have this it seems. + + fftw_cleanup(); + fftwf_cleanup(); + fftwl_cleanup(); + + + return 0; +} + diff --git a/src/boost/libs/math/config/has_float128.cpp b/src/boost/libs/math/config/has_float128.cpp new file mode 100644 index 00000000..60a2e2e4 --- /dev/null +++ b/src/boost/libs/math/config/has_float128.cpp @@ -0,0 +1,17 @@ +// Copyright John Maddock 2013. +// 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) + +extern "C" { +#include +} + +int main() +{ + __float128 f = -2.0Q; + f = fabsq(f); + + return 0; +} + diff --git a/src/boost/libs/math/config/has_gcc_visibility.cpp b/src/boost/libs/math/config/has_gcc_visibility.cpp new file mode 100644 index 00000000..6c7d6f91 --- /dev/null +++ b/src/boost/libs/math/config/has_gcc_visibility.cpp @@ -0,0 +1,13 @@ +// Copyright John Maddock 20010. +// 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) + +#ifndef __GNUC__ +# error "This is a GCC specific test case". +#endif + +int main() +{ + return 0; +} diff --git a/src/boost/libs/math/config/has_gmp.cpp b/src/boost/libs/math/config/has_gmp.cpp new file mode 100644 index 00000000..196b6e2f --- /dev/null +++ b/src/boost/libs/math/config/has_gmp.cpp @@ -0,0 +1,33 @@ +// Copyright John Maddock 2008. +// 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 // See https://gcc.gnu.org/gcc-4.9/porting_to.html +#include +#include + +#ifdef __GNUC__ +#pragma message "__GNU_MP_VERSION=" BOOST_STRINGIZE(__GNU_MP_VERSION) +#pragma message "__GNU_MP_VERSION_MINOR=" BOOST_STRINGIZE(__GNU_MP_VERSION_MINOR) +#endif + +#if (__GNU_MP_VERSION < 4) || ((__GNU_MP_VERSION == 4) && (__GNU_MP_VERSION_MINOR < 2)) +#error "Incompatible GMP version" +#endif + +int main() +{ + void* (*alloc_func_ptr)(size_t); + void* (*realloc_func_ptr)(void*, size_t, size_t); + void (*free_func_ptr)(void*, size_t); + + mp_get_memory_functions(&alloc_func_ptr, &realloc_func_ptr, &free_func_ptr); + + mpz_t integ; + mpz_init(integ); + if (integ[0]._mp_d) + mpz_clear(integ); + + return 0; +} diff --git a/src/boost/libs/math/config/has_gmpxx.cpp b/src/boost/libs/math/config/has_gmpxx.cpp new file mode 100644 index 00000000..edf62d8c --- /dev/null +++ b/src/boost/libs/math/config/has_gmpxx.cpp @@ -0,0 +1,7 @@ +// Copyright John Maddock 2008. +// 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 + diff --git a/src/boost/libs/math/config/has_intel_quad.cpp b/src/boost/libs/math/config/has_intel_quad.cpp new file mode 100644 index 00000000..a2db80cc --- /dev/null +++ b/src/boost/libs/math/config/has_intel_quad.cpp @@ -0,0 +1,16 @@ +// Copyright John Maddock 2013. +// 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) + +extern "C" _Quad __fabs(_Quad); + +int main() +{ + _Quad f = -2.0Q; + f = __fabsq(f); + + return 0; +} + + diff --git a/src/boost/libs/math/config/has_long_double_support.cpp b/src/boost/libs/math/config/has_long_double_support.cpp new file mode 100644 index 00000000..d314cf38 --- /dev/null +++ b/src/boost/libs/math/config/has_long_double_support.cpp @@ -0,0 +1,10 @@ +// Copyright John Maddock 2008. +// 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 + +#ifdef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS +#error "long double support is not supported by Boost.Math on this Plaform: the long double version of the TR1 library will not be built." +#endif diff --git a/src/boost/libs/math/config/has_mpfr.cpp b/src/boost/libs/math/config/has_mpfr.cpp new file mode 100644 index 00000000..c82f28d7 --- /dev/null +++ b/src/boost/libs/math/config/has_mpfr.cpp @@ -0,0 +1,47 @@ +// Copyright John Maddock 2012. +// 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 // See https://gcc.gnu.org/gcc-4.9/porting_to.html +#include +#include + +#ifdef __GNUC__ +#pragma message "MPFR_VERSION_STRING=" MPFR_VERSION_STRING +#endif + +#if (__GNU_MP_VERSION < 4) || ((__GNU_MP_VERSION == 4) && (__GNU_MP_VERSION_MINOR < 2)) +#error "Incompatible GMP version" +#endif + +#if (MPFR_VERSION < 3) +#error "Incompatible MPFR version" +#endif + +#ifdef __GNUC__ +#pragma message "__GNU_MP_VERSION=" BOOST_STRINGIZE(__GNU_MP_VERSION) +#pragma message "__GNU_MP_VERSION_MINOR=" BOOST_STRINGIZE(__GNU_MP_VERSION_MINOR) +#endif + +#if (__GNU_MP_VERSION < 4) || ((__GNU_MP_VERSION == 4) && (__GNU_MP_VERSION_MINOR < 2)) +#error "Incompatible GMP version" +#endif + +int main() +{ + void* (*alloc_func_ptr)(size_t); + void* (*realloc_func_ptr)(void*, size_t, size_t); + void (*free_func_ptr)(void*, size_t); + + mp_get_memory_functions(&alloc_func_ptr, &realloc_func_ptr, &free_func_ptr); + + mpfr_buildopt_tls_p(); + + mpfr_t t; + mpfr_init2(t, 128); + if (t[0]._mpfr_d) + mpfr_clear(t); + + return 0; +} diff --git a/src/boost/libs/math/config/has_mpfr_class.cpp b/src/boost/libs/math/config/has_mpfr_class.cpp new file mode 100644 index 00000000..376b022d --- /dev/null +++ b/src/boost/libs/math/config/has_mpfr_class.cpp @@ -0,0 +1,15 @@ +// Copyright John Maddock 2008. +// Copyright Paul A. Britow 2009 +// 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) + +#ifdef _MSC_VER +# pragma warning (disable : 4127) // conditional expression is constant +# pragma warning (disable : 4800) // 'int' : forcing value to bool 'true' or 'false' (performance warning) +# pragma warning (disable : 4512) // assignment operator could not be generated +#endif + +#include +#include + diff --git a/src/boost/libs/math/config/has_mpreal.cpp b/src/boost/libs/math/config/has_mpreal.cpp new file mode 100644 index 00000000..8ee8897d --- /dev/null +++ b/src/boost/libs/math/config/has_mpreal.cpp @@ -0,0 +1,14 @@ +// Copyright John Maddock 2008. +// Copyright Paul A. Britow 2009 +// 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) + +#ifdef _MSC_VER +# pragma warning (disable : 4127) // conditional expression is constant +# pragma warning (disable : 4800) // 'int' : forcing value to bool 'true' or 'false' (performance warning) +# pragma warning (disable : 4512) // assignment operator could not be generated +#endif + +#include + diff --git a/src/boost/libs/math/config/has_ntl_rr.cpp b/src/boost/libs/math/config/has_ntl_rr.cpp new file mode 100644 index 00000000..f3844217 --- /dev/null +++ b/src/boost/libs/math/config/has_ntl_rr.cpp @@ -0,0 +1,12 @@ +// Copyright John Maddock 2008. +// 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) + + +#ifdef _MSC_VER +# pragma warning (disable : 4100) // unreferenced formal parameter +#endif + +#include + diff --git a/src/boost/libs/math/dot_net_example/boost_math/AssemblyInfo.cpp b/src/boost/libs/math/dot_net_example/boost_math/AssemblyInfo.cpp new file mode 100644 index 00000000..f8bcf174 --- /dev/null +++ b/src/boost/libs/math/dot_net_example/boost_math/AssemblyInfo.cpp @@ -0,0 +1,44 @@ +#include "stdafx.h" + +// Copyright Paul A. Bristow & John Maddock 2009, 2010 +// 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) + +using namespace System; +using namespace System::Reflection; +using namespace System::Runtime::CompilerServices; +using namespace System::Runtime::InteropServices; +using namespace System::Security::Permissions; + +// General Information about an assembly is controlled through the following set of attributes. +// Change these attribute values to modify the information associated with an assembly. + +[assembly:AssemblyTitleAttribute("boost_math")]; +[assembly:AssemblyDescriptionAttribute("Math Toolkit")]; +[assembly:AssemblyConfigurationAttribute("")]; +[assembly:AssemblyCompanyAttribute("jmc")]; +[assembly:AssemblyProductAttribute("boost_math")]; +[assembly:AssemblyCopyrightAttribute("Copyright (c) jmc 2007 - 2010")]; +[assembly:AssemblyTrademarkAttribute("")]; +[assembly:AssemblyCultureAttribute("")]; + +// +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the value or you can default the Revision and Build Numbers +// by using the '*' as shown below: + +[assembly:AssemblyVersionAttribute("1.1.*")]; + +[assembly:ComVisible(false)]; + +[assembly:CLSCompliantAttribute(true)]; +// Deprecated: +//[assembly:SecurityPermission(SecurityAction::RequestMinimum, UnmanagedCode = true)]; diff --git a/src/boost/libs/math/dot_net_example/boost_math/ReadMe.txt b/src/boost/libs/math/dot_net_example/boost_math/ReadMe.txt new file mode 100644 index 00000000..a7a5a5d7 --- /dev/null +++ b/src/boost/libs/math/dot_net_example/boost_math/ReadMe.txt @@ -0,0 +1,38 @@ +======================================================================== + DYNAMIC LINK LIBRARY : boost_math Project Overview +======================================================================== + +AppWizard has created this boost_math DLL for you. + +// Copyright Paul A. Bristow & John Maddock 2009 +// 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) + +This file contains a summary of what you will find in each of the files that +make up your boost_math application. + +boost_math.vcproj + This is the main project file for VC++ projects generated using an Application Wizard. + It contains information about the version of Visual C++ that generated the file, and + information about the platforms, configurations, and project features selected with the + Application Wizard. + +boost_math.cpp + This is the main DLL source file. + +boost_math.h + This file contains a class declaration. + +AssemblyInfo.cpp + Contains custom attributes for modifying assembly metadata. + +///////////////////////////////////////////////////////////////////////////// +Other notes: + +AppWizard uses "TODO:" to indicate parts of the source code you +should add to or customize. + +///////////////////////////////////////////////////////////////////////////// + diff --git a/src/boost/libs/math/dot_net_example/boost_math/Stdafx.cpp b/src/boost/libs/math/dot_net_example/boost_math/Stdafx.cpp new file mode 100644 index 00000000..f65a89a5 --- /dev/null +++ b/src/boost/libs/math/dot_net_example/boost_math/Stdafx.cpp @@ -0,0 +1,11 @@ +// stdafx.cpp : source file that includes just the standard includes +// boost_math.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +// Copyright Paul A. Bristow & John Maddock 2009 +// 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 "stdafx.h" diff --git a/src/boost/libs/math/dot_net_example/boost_math/Stdafx.h b/src/boost/libs/math/dot_net_example/boost_math/Stdafx.h new file mode 100644 index 00000000..f463f27f --- /dev/null +++ b/src/boost/libs/math/dot_net_example/boost_math/Stdafx.h @@ -0,0 +1,54 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, +// but are changed infrequently. + +// Copyright John Maddock 2007. +// Copyright Paul A. Bristow 2007, 2009, 2010, 2012 + +// 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) + +// Laplace added Aug 2009 PAB, and several others Nov 2010, +// added skew_normal 2012. + +#ifdef _MSC_VER +# pragma once +# pragma warning (disable : 4127) +#endif + +#define BOOST_MATH_ASSERT_UNDEFINED_POLICY false +#define BOOST_MATH_OVERFLOW_ERROR_POLICY errno_on_error + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include diff --git a/src/boost/libs/math/dot_net_example/boost_math/app.ico b/src/boost/libs/math/dot_net_example/boost_math/app.ico new file mode 100644 index 00000000..3a5525fd Binary files /dev/null and b/src/boost/libs/math/dot_net_example/boost_math/app.ico differ diff --git a/src/boost/libs/math/dot_net_example/boost_math/app.rc b/src/boost/libs/math/dot_net_example/boost_math/app.rc new file mode 100644 index 00000000..0bc391bd --- /dev/null +++ b/src/boost/libs/math/dot_net_example/boost_math/app.rc @@ -0,0 +1,63 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon placed first or with lowest ID value becomes application icon + +LANGUAGE 9, 2 +#pragma code_page(1252) +1 ICON "app.ico" + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" + "\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\0" +END + +#endif // APSTUDIO_INVOKED + +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/src/boost/libs/math/dot_net_example/boost_math/boost_math.cpp b/src/boost/libs/math/dot_net_example/boost_math/boost_math.cpp new file mode 100644 index 00000000..a7fabade --- /dev/null +++ b/src/boost/libs/math/dot_net_example/boost_math/boost_math.cpp @@ -0,0 +1,255 @@ +// Copyright John Maddock 2007. +// Copyright Paul A. Bristow 2007, 2009, 2012. + +// 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) + +// boost_math.cpp This is the main DLL file. + +//#define BOOST_MATH_OVERFLOW_ERROR_POLICY errno_on_error +//#define BOOST_MATH_ASSERT_UNDEFINED_POLICY false +// These are now defined in project properties +// to avoid complications with pre-compiled headers: +// "BOOST_MATH_ASSERT_UNDEFINED_POLICY=0" +// "BOOST_MATH_OVERFLOW_ERROR_POLICY="errno_on_error"" +// so command line shows: +// /D "BOOST_MATH_ASSERT_UNDEFINED_POLICY=0" +// /D "BOOST_MATH_OVERFLOW_ERROR_POLICY="errno_on_error"" + +#include "stdafx.h" + +#ifdef _MSC_VER +# pragma warning(disable: 4400) // 'const boost_math::any_distribution ^' : const/volatile qualifiers on this type are not supported +# pragma warning(disable: 4244) // 'argument' : conversion from 'double' to 'unsigned int', possible loss of data +# pragma warning(disable: 4512) // assignment operator could not be generated +// hypergeometric expects integer parameters. +# pragma warning(disable: 4127) // constant +#endif + +#include "boost_math.h" + +namespace boost_math +{ + +any_distribution::any_distribution(int t, double arg1, double arg2, double arg3) +{ + TRANSLATE_EXCEPTIONS_BEGIN + // This is where all the work gets done: + switch(t) // index of distribution to distribution_info distributions[] + { // New entries must match distribution names, parameter name(s) and defaults defined below. + case 0: + this->reset(new concrete_distribution(boost::math::bernoulli(arg1))); + break; + case 1: + this->reset(new concrete_distribution >(boost::math::beta_distribution<>(arg1, arg2))); + break; // Note - no typedef, so need explicit type <> but rely on default = double. + case 2: + this->reset(new concrete_distribution >(boost::math::binomial_distribution<>(arg1, arg2))); + break; // Note - no typedef, so need explicit type <> but rely on default = double. + case 3: + this->reset(new concrete_distribution(boost::math::cauchy(arg1, arg2))); + break; + case 4: + this->reset(new concrete_distribution(boost::math::chi_squared(arg1))); + break; + case 5: + this->reset(new concrete_distribution(boost::math::exponential(arg1))); + break; + case 6: + this->reset(new concrete_distribution(boost::math::extreme_value(arg1))); + break; + case 7: + this->reset(new concrete_distribution(boost::math::fisher_f(arg1, arg2))); + break; + case 8: + this->reset(new concrete_distribution >(boost::math::gamma_distribution<>(arg1, arg2))); + break; + case 9: + this->reset(new concrete_distribution >(boost::math::geometric_distribution<>(arg1))); + break; + case 10: + this->reset(new concrete_distribution >(boost::math::hypergeometric_distribution<>(arg1, arg2, arg3))); + break; + case 11: + this->reset(new concrete_distribution >(boost::math::inverse_chi_squared_distribution<>(arg1, arg2))); + break; + case 12: + this->reset(new concrete_distribution >(boost::math::inverse_gamma_distribution<>(arg1, arg2))); + break; + case 13: + this->reset(new concrete_distribution >(boost::math::inverse_gaussian_distribution<>(arg1, arg2))); + break; + case 14: + this->reset(new concrete_distribution >(boost::math::laplace_distribution<>(arg1, arg2))); + break; + case 15: + this->reset(new concrete_distribution >(boost::math::logistic_distribution<>(arg1, arg2))); + break; + case 16: + this->reset(new concrete_distribution >(boost::math::lognormal_distribution<>(arg1, arg2))); + break; + case 17: + this->reset(new concrete_distribution >(boost::math::negative_binomial_distribution<>(arg1, arg2))); + break; + case 18: + this->reset(new concrete_distribution >(boost::math::non_central_beta_distribution<>(arg1, arg2, arg3))); + break; + case 19: + this->reset(new concrete_distribution >(boost::math::non_central_chi_squared_distribution<>(arg1, arg2))); + break; + case 20: + this->reset(new concrete_distribution >(boost::math::non_central_f_distribution<>(arg1, arg2, arg3))); + break; + case 21: + this->reset(new concrete_distribution >(boost::math::non_central_t_distribution<>(arg1, arg2))); + break; + case 22: + this->reset(new concrete_distribution >(boost::math::normal_distribution<>(arg1, arg2))); + break; + case 23: + this->reset(new concrete_distribution(boost::math::pareto(arg1, arg2))); + break; + case 24: + this->reset(new concrete_distribution(boost::math::poisson(arg1))); + break; + case 25: + this->reset(new concrete_distribution(boost::math::rayleigh(arg1))); + break; + case 26: + this->reset(new concrete_distribution(boost::math::skew_normal(arg1, arg2, arg3))); + break; + case 27: + this->reset(new concrete_distribution(boost::math::students_t(arg1))); + break; + case 28: + this->reset(new concrete_distribution(boost::math::triangular(arg1, arg2, arg3))); + break; + case 29: + this->reset(new concrete_distribution(boost::math::uniform(arg1, arg2))); + break; + case 30: + this->reset(new concrete_distribution(boost::math::weibull(arg1, arg2))); + break; + + + default: + // TODO Need some proper error handling here? + BOOST_ASSERT(0); + } + TRANSLATE_EXCEPTIONS_END +} // any_distribution constructor. + +struct distribution_info +{ + const char* name; // of distribution. + const char* first_param; // Parameters' name like "degrees of freedom", + const char* second_param; // if required, else "", + const char* third_param; // if required, else "". + // triangular and non-centrals need 3 parameters. + // (Only the Bi-Weibull would need 5 parameters?) + double first_default; // distribution parameter value, often 0, 0.5 or 1. + double second_default; // 0 if there isn't a second argument. + // Note that defaults below follow default argument in constructors, + // if any, but need not be the same. + double third_default; // 0 if there isn't a third argument. +}; + +distribution_info distributions[] = +{ // distribution name, parameter name(s) and default(s) + // Order must match any_distribution constructor above! + // Null string "" and zero default for un-used arguments. + { "Bernoulli", "Probability", "", "",0.5, 0, 0}, // case 0 + { "Beta", "Alpha", "Beta", "", 1, 1, 0}, // case 1 + { "Binomial", "Trials", "Probability of success", "", 1, 0.5, 0}, // case 2 + { "Cauchy", "Location", "Scale", "", 0, 1, 0}, // case 3 + { "Chi_squared", "Degrees of freedom", "", "", 1, 0, 0}, // case 4 + { "Exponential", "lambda", "", "", 1, 0, 0}, // case 5 + { "Extreme value", "Location", "Scale", "", 0, 1, 0}, // case 6 + { "Fisher-F", "Degrees of freedom 1", "Degrees of freedom 2", "", 1, 1, 0}, // case 7 + { "Gamma (Erlang)", "Shape", "Scale", "", 1, 1, 0}, // case 8 + { "Geometric", "Probability", "", "", 1, 0, 0}, // case 9 + { "HyperGeometric", "Defects", "Samples", "Objects", 1, 0, 1}, // case 10 + { "InverseChiSq", "Degrees of Freedom", "Scale", "", 1, 1, 0}, // case 11 + { "InverseGamma", "Shape", "Scale", "", 1, 1, 0}, // case 12 + { "InverseGaussian", "Mean", "Scale", "", 1, 1, 0}, // case 13 + { "Laplace", "Location", "Scale", "", 0, 1, 0}, // case 14 + { "Logistic", "Location", "Scale", "", 0, 1, 0}, // case 15 + { "LogNormal", "Location", "Scale", "", 0, 1, 0}, // case 16 + { "Negative Binomial", "Successes", "Probability of success", "", 1, 0.5, 0}, // case 17 + { "Noncentral Beta", "Shape alpha", "Shape beta", "Non-centrality", 1, 1, 0}, // case 18 + { "Noncentral ChiSquare", "Degrees of Freedom", "Non-centrality", "", 1, 0, 0}, // case 19 + { "Noncentral F", "Degrees of Freedom 1", "Degrees of Freedom 2", "Non-centrality", 1, 1, 0}, // case 20 + { "Noncentral t", "Degrees of Freedom", "Non-centrality", "", 1, 0, 0}, // case 21 + { "Normal (Gaussian)", "Mean", "Standard Deviation", "", 0, 1, 0}, // case 22 + { "Pareto", "Location", "Shape","", 1, 1, 0}, // case 23 + { "Poisson", "Mean", "", "", 1, 0, 0}, // case 24 + { "Rayleigh", "Shape", "", "", 1, 0, 0}, // case 25 + { "Skew Normal", "Location", "Shape", "Skew", 0, 1, 0}, // case 27 (defaults to Gaussian). + { "Student's t", "Degrees of Freedom", "", "", 1, 0, 0}, // case 28 + { "Triangular", "Lower", "Mode", "Upper", -1, 0, +1 }, // case 29 3rd parameter! + // 0, 0.5, 1 also said to be 'standard' but this is most like an approximation to Gaussian distribution. + { "Uniform", "Lower", "Upper", "", 0, 1, 0}, // case 30 + { "Weibull", "Shape", "Scale", "", 1, 1, 0}, // case 31 +}; + +// How many distributions are supported: +int any_distribution::size() +{ + return sizeof(distributions) / sizeof(distributions[0]); +} + +// Display name of i'th distribution: +System::String^ any_distribution::distribution_name(int i) +{ + if(i >= size()) + return ""; + return gcnew System::String(distributions[i].name); +} +// Name of first distribution parameter, or null if not supported: +System::String^ any_distribution::first_param_name(int i) +{ + if(i >= size()) + return ""; + return gcnew System::String(distributions[i].first_param); +} +// Name of second distribution parameter, or null if not supported: +System::String^ any_distribution::second_param_name(int i) +{ + if(i >= size()) + return ""; + return gcnew System::String(distributions[i].second_param); +} +// Name of third distribution parameter, or null if not supported: +System::String^ any_distribution::third_param_name(int i) +{ + if(i >= size()) + return ""; + return gcnew System::String(distributions[i].third_param); +} +// default value for first parameter: +double any_distribution::first_param_default(int i) +{ + if(i >= size()) + return 0; + return distributions[i].first_default; +} +// default value for second parameter: +double any_distribution::second_param_default(int i) +{ + if(i >= size()) + return 0; + return distributions[i].second_default; +} +// default value for third parameter: +double any_distribution::third_param_default(int i) +{ + if(i >= size()) + return 0; + return distributions[i].third_default; +} + +} // namespace boost_math + + diff --git a/src/boost/libs/math/dot_net_example/boost_math/boost_math.h b/src/boost/libs/math/dot_net_example/boost_math/boost_math.h new file mode 100644 index 00000000..1f9b0156 --- /dev/null +++ b/src/boost/libs/math/dot_net_example/boost_math/boost_math.h @@ -0,0 +1,331 @@ +// boost_math.h + +// Copyright John Maddock 2007. +// Copyright Paul A. Bristow 2007. + +// 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) + +//#define BOOST_MATH_OVERFLOW_ERROR_POLICY errno_on_error +//#define BOOST_MATH_ASSERT_UNDEFINED_POLICY false +// These are now defined in project properties +// "BOOST_MATH_ASSERT_UNDEFINED_POLICY=0" +// "BOOST_MATH_OVERFLOW_ERROR_POLICY=errno_on_error" +// to avoid complications with pre-compiled headers. + +#ifdef _MSC_VER +# pragma once +# pragma warning (disable : 4127) +#endif + +using namespace System; + +#define TRANSLATE_EXCEPTIONS_BEGIN try{ + +#define TRANSLATE_EXCEPTIONS_END \ + }catch(const std::exception& e){ \ + System::String^ s = gcnew System::String(e.what());\ + InvalidOperationException^ se = gcnew InvalidOperationException(s);\ + throw se; \ + } + +namespace boost_math { + + class any_imp + { + public: + // Distribution properties. + virtual double mean()const = 0; + virtual double mode()const = 0; + virtual double median()const = 0; + virtual double variance()const = 0; + virtual double standard_deviation()const = 0; + virtual double skewness()const = 0; + virtual double kurtosis()const = 0; + virtual double kurtosis_excess()const = 0; + virtual double coefficient_of_variation()const = 0; + // Values computed from random variate x. + virtual double hazard(double x)const = 0; + virtual double chf(double x)const = 0; + virtual double cdf(double x)const = 0; + virtual double ccdf(double x)const = 0; + virtual double pdf(double x)const = 0; + virtual double quantile(double x)const = 0; + virtual double quantile_c(double x)const = 0; + // Range & support of x + virtual double lowest()const = 0; + virtual double uppermost()const = 0; + virtual double lower()const = 0; + virtual double upper()const = 0; + }; + + template + class concrete_distribution : public any_imp + { + public: + concrete_distribution(const Distribution& d) : m_dist(d) {} + // Distribution properties. + virtual double mean()const + { + return boost::math::mean(m_dist); + } + virtual double median()const + { + return boost::math::median(m_dist); + } + virtual double mode()const + { + return boost::math::mode(m_dist); + } + virtual double variance()const + { + return boost::math::variance(m_dist); + } + virtual double skewness()const + { + return boost::math::skewness(m_dist); + } + virtual double standard_deviation()const + { + return boost::math::standard_deviation(m_dist); + } + virtual double coefficient_of_variation()const + { + return boost::math::coefficient_of_variation(m_dist); + } + virtual double kurtosis()const + { + return boost::math::kurtosis(m_dist); + } + virtual double kurtosis_excess()const + { + return boost::math::kurtosis_excess(m_dist); + } + // Range of x for the distribution. + virtual double lowest()const + { + return boost::math::range(m_dist).first; + } + virtual double uppermost()const + { + return boost::math::range(m_dist).second; + } + // Support of x for the distribution. + virtual double lower()const + { + return boost::math::support(m_dist).first; + } + virtual double upper()const + { + return boost::math::support(m_dist).second; + } + + // Values computed from random variate x. + virtual double hazard(double x)const + { + return boost::math::hazard(m_dist, x); + } + virtual double chf(double x)const + { + return boost::math::chf(m_dist, x); + } + virtual double cdf(double x)const + { + return boost::math::cdf(m_dist, x); + } + virtual double ccdf(double x)const + { + return boost::math::cdf(complement(m_dist, x)); + } + virtual double pdf(double x)const + { + return boost::math::pdf(m_dist, x); + } + virtual double quantile(double x)const + { + return boost::math::quantile(m_dist, x); + } + virtual double quantile_c(double x)const + { + return boost::math::quantile(complement(m_dist, x)); + } + private: + Distribution m_dist; + }; + + public ref class any_distribution + { + public: + // Added methods for this class here. + any_distribution(int t, double arg1, double arg2, double arg3); + ~any_distribution() + { + reset(0); + } + // Is it OK for these to be inline? + // Distribution properties as 'pointer-to-implementions'. + double mean() + { + TRANSLATE_EXCEPTIONS_BEGIN + return pimpl->mean(); + TRANSLATE_EXCEPTIONS_END + } + double median() + { + TRANSLATE_EXCEPTIONS_BEGIN + return pimpl->median(); + TRANSLATE_EXCEPTIONS_END + } + double mode() + { + TRANSLATE_EXCEPTIONS_BEGIN + return pimpl->mode(); + TRANSLATE_EXCEPTIONS_END + } + double variance() + { + TRANSLATE_EXCEPTIONS_BEGIN + return pimpl->variance(); + TRANSLATE_EXCEPTIONS_END + } + double standard_deviation() + { + TRANSLATE_EXCEPTIONS_BEGIN + return pimpl->standard_deviation(); + TRANSLATE_EXCEPTIONS_END + } + double coefficient_of_variation() + { // aka Relative Standard deviation. + TRANSLATE_EXCEPTIONS_BEGIN + return pimpl->coefficient_of_variation(); + TRANSLATE_EXCEPTIONS_END + } + double skewness() + { + TRANSLATE_EXCEPTIONS_BEGIN + return pimpl->skewness(); + TRANSLATE_EXCEPTIONS_END + } + double kurtosis() + { + TRANSLATE_EXCEPTIONS_BEGIN + return pimpl->kurtosis(); + TRANSLATE_EXCEPTIONS_END + } + double kurtosis_excess() + { + TRANSLATE_EXCEPTIONS_BEGIN + return pimpl->kurtosis_excess(); + TRANSLATE_EXCEPTIONS_END + } + // Values computed from random variate x. + double hazard(double x) + { + TRANSLATE_EXCEPTIONS_BEGIN + return pimpl->hazard(x); + TRANSLATE_EXCEPTIONS_END + } + double chf(double x) + { + TRANSLATE_EXCEPTIONS_BEGIN + return pimpl->chf(x); + TRANSLATE_EXCEPTIONS_END + } + double cdf(double x) + { + TRANSLATE_EXCEPTIONS_BEGIN + return pimpl->cdf(x); + TRANSLATE_EXCEPTIONS_END + } + double ccdf(double x) + { + TRANSLATE_EXCEPTIONS_BEGIN + return pimpl->ccdf(x); + TRANSLATE_EXCEPTIONS_END + } + double pdf(double x) + { + TRANSLATE_EXCEPTIONS_BEGIN + return pimpl->pdf(x); + TRANSLATE_EXCEPTIONS_END + } + double quantile(double x) + { + TRANSLATE_EXCEPTIONS_BEGIN + return pimpl->quantile(x); + TRANSLATE_EXCEPTIONS_END + } + double quantile_c(double x) + { + TRANSLATE_EXCEPTIONS_BEGIN + return pimpl->quantile_c(x); + TRANSLATE_EXCEPTIONS_END + } + + double lowest() + { + TRANSLATE_EXCEPTIONS_BEGIN + return pimpl->lowest(); + TRANSLATE_EXCEPTIONS_END + } + + double uppermost() + { + TRANSLATE_EXCEPTIONS_BEGIN + return pimpl->uppermost(); + TRANSLATE_EXCEPTIONS_END + } + + double lower() + { + TRANSLATE_EXCEPTIONS_BEGIN + return pimpl->lower(); + TRANSLATE_EXCEPTIONS_END + } + double upper() + { + TRANSLATE_EXCEPTIONS_BEGIN + return pimpl->upper(); + TRANSLATE_EXCEPTIONS_END + } + + // How many distributions are supported: + static int size(); + // Display name of i'th distribution: + static System::String^ distribution_name(int i); + // Name of first distribution parameter, or null if not supported: + static System::String^ first_param_name(int i); + // Name of second distribution parameter, or null if not supported: + static System::String^ second_param_name(int i); + // Name of third distribution parameter, or null if not supported: + static System::String^ third_param_name(int i); + // Default value for first parameter: + static double first_param_default(int i); + // Default value for second parameter: + static double second_param_default(int i); + // Default value for third parameter: + static double third_param_default(int i); + + private: + any_distribution(const any_distribution^) + { // Constructor is private. + } + const any_distribution^ operator=(const any_distribution^ d) + { // Copy Constructor is private too. + return d; + } + // We really should use a shared_ptr here, + // but apparently it's not allowed in a managed class like this :-( + void reset(any_imp* p) + { + if(pimpl) + { // Exists already, so + delete pimpl; + } + pimpl = p; + } + any_imp* pimpl; + }; +} diff --git a/src/boost/libs/math/dot_net_example/boost_math/boost_math.sln b/src/boost/libs/math/dot_net_example/boost_math/boost_math.sln new file mode 100644 index 00000000..4730d9ef --- /dev/null +++ b/src/boost/libs/math/dot_net_example/boost_math/boost_math.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27130.2024 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "boost_math", "boost_math.vcxproj", "{80E5F29C-93FB-4C84-A818-D2B8263C7CA1}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {80E5F29C-93FB-4C84-A818-D2B8263C7CA1}.Debug|x64.ActiveCfg = Debug|x64 + {80E5F29C-93FB-4C84-A818-D2B8263C7CA1}.Debug|x64.Build.0 = Debug|x64 + {80E5F29C-93FB-4C84-A818-D2B8263C7CA1}.Debug|x86.ActiveCfg = Debug|Win32 + {80E5F29C-93FB-4C84-A818-D2B8263C7CA1}.Debug|x86.Build.0 = Debug|Win32 + {80E5F29C-93FB-4C84-A818-D2B8263C7CA1}.Release|x64.ActiveCfg = Release|x64 + {80E5F29C-93FB-4C84-A818-D2B8263C7CA1}.Release|x64.Build.0 = Release|x64 + {80E5F29C-93FB-4C84-A818-D2B8263C7CA1}.Release|x86.ActiveCfg = Release|Win32 + {80E5F29C-93FB-4C84-A818-D2B8263C7CA1}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {3ECDFDBF-9C5F-4C39-B5E5-581C15299AD1} + EndGlobalSection +EndGlobal diff --git a/src/boost/libs/math/dot_net_example/boost_math/boost_math.vcxproj b/src/boost/libs/math/dot_net_example/boost_math/boost_math.vcxproj new file mode 100644 index 00000000..65b7679a --- /dev/null +++ b/src/boost/libs/math/dot_net_example/boost_math/boost_math.vcxproj @@ -0,0 +1,142 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {80E5F29C-93FB-4C84-A818-D2B8263C7CA1} + ManagedCProj + 8.1 + + + + DynamicLibrary + true + v141 + true + + + DynamicLibrary + false + v141 + true + + + DynamicLibrary + true + v141 + true + + + DynamicLibrary + false + v141 + true + + + + + + + + + + + + + + + + + + + + + true + + + true + + + + WIN32;_DEBUG;_WINDOWS;_USRDLL;BOOST_MATH_EXPORTS;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + ../../../.. + Use + + + MachineX86 + true + Windows + + + + + WIN32;NDEBUG;_WINDOWS;_USRDLL;BOOST_MATH_EXPORTS;%(PreprocessorDefinitions) + MultiThreadedDLL + Level3 + ProgramDatabase + ../../../.. + Use + + + MachineX86 + true + Windows + true + true + + + + + ../../../.. + Use + + + + + ../../../.. + Use + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/boost/libs/math/dot_net_example/boost_math/boost_math.vcxproj.filters b/src/boost/libs/math/dot_net_example/boost_math/boost_math.vcxproj.filters new file mode 100644 index 00000000..001f2489 --- /dev/null +++ b/src/boost/libs/math/dot_net_example/boost_math/boost_math.vcxproj.filters @@ -0,0 +1,44 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/src/boost/libs/math/dot_net_example/boost_math/resource.h b/src/boost/libs/math/dot_net_example/boost_math/resource.h new file mode 100644 index 00000000..c775cb92 --- /dev/null +++ b/src/boost/libs/math/dot_net_example/boost_math/resource.h @@ -0,0 +1,9 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by app.rc + +// Copyright Paul A. Bristow & John Maddock 2009 +// 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) diff --git a/src/boost/libs/math/dot_net_example/distribution_explorer/AboutDistEx.resx b/src/boost/libs/math/dot_net_example/distribution_explorer/AboutDistEx.resx new file mode 100644 index 00000000..804e65e0 --- /dev/null +++ b/src/boost/libs/math/dot_net_example/distribution_explorer/AboutDistEx.resx @@ -0,0 +1,322 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + iVBORw0KGgoAAAANSUhEUgAAARUAAABWCAIAAABuN5XDAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAASdAAA + EnQB3mYfeAAALWZJREFUeF7tnfuPJNd138n8TyvSNiQIMSDBtCHEgJNAMIQAgmEESKIgCIIktBMBUeAf + iFAGlAB2nMQOaYoUl6ReJHdtSUvxqdeSS1rSkhIpSqQs8xVZj92e6Znurpp8zvnee+t23arq6p7u5VJq + orCc6am6dev0/dY553se98aTk5Mb9v/tJXBDWAashxtvlDjyhcHPdvhf+TP/r+MJ4U832FUnN4TP7Vp+ + 0VUaj1/tyvirfRJGCze78YYbOZt/4725Ez/rav/hxn9g/9rY+jz86Ub/PI6W/0kP4gOe3OAzbz7Zzndu + Itn/90stgRowxKM6OeFYZMf85GR2cnJ8cnLkx/Tk5LCuD+p6cnJyta5/zlHVP63rn3BU9Y/r+v/V9VtV + /WZVv1HVr1f1a7Udf1fVP6qqv63rv63qH9q/1Q/zI/ucE37E+X4VByMwzpuMycg+vm7EHe3WPocJ82FW + PjdNktkyZ2aeP4geLX/YLXzr/krZ//dLKYG6biOnrjuRY+CpaxYoyxTkBNjULOITVvPfV6zsiiUOZl5n + xfvq/1HlUKmqV6rqB358v6peruqXq+p7VfWSH/ygI/5qf+XgTF3ySs0INagTosASg7/Jvbgj9/W7ByAx + qzg95ikItVHkT7eEIpfAqf7b4+dU4nsnXxzAU9daUqZ2In6Szjmua1M4rnN4zV85OblS1z9zJfD3rmqk + Z16r0DCVtIoBpq7BgIDxYlV/d1G9UFUvLKrnF9Xlyo5v+3F5sbB/m1/5pHrez3yBq+xah5mPZnDy8YEl + 2gzV9AZ39zkwE+bzM58bB4pRE2bmSyiKT2cP60+dXh+bf417/Gwuu3folaXacTtHZluDHH+Lm6l2cmLI + cXtJdtqPXQOwfF+rKqwyVMSrQb0IMNV3wIDBo/r2YvHNRfU3i8WzflxaLJ5ZLJ5eVE/bv/kRPuGvnOMn + 21VcK4AxGmMKTq6g7I5gCb0EdN9w7SfTTuoInCejrtRFetLtKKI9ft6hKNh42h1qxzXPvK5ndR38HLfW + OCa1vdRxM1iXpnB8pb5eVWibBBvpme+46hBgnltUAOAZx8k3FouvLaqvzRdfmS+eWiyenC+e9H+fWMTD + f06fP8WZnG9XcS0j2DiM9hwj2/h2F7Ak8y8Bya07m5upI5/tz5k58/dXgCw6TFDUKc+Y/KItKKL18HP1 + YPrs89/Xcd/5r6Tj9bd+uvH3ub/wGkqg5AkatVPXrDAxBEYPSOck5LixxMveFY5ZU+gBg03lsKlQF7bK + HTDV1w0DhhaA8fh88eh88Ygd8y/N51+cz78wX3xhPv9r+1eHfuZz++uXwsmLR7nWRxCivh7h9Cz38jsm + IDET5gOeTR0loy6gKFh0aNFpfMBELXQoonW/i1H4AS23/N5/HTg4Yd0b78+/5hLoINmC2nE/Ibo6LDUx + BKZzKiO+pHNwb16talYqsPnuYiFtg6q5BGzmC2kY1Mhj88WXHS1fdHj81Xxxfj5/eDZ/cG7H5+fzz83m + n53PPzubf0aH/8wnn/O/PuhnPmxX2bWMwDjAjzEZmfG5CwoNvYSl91zUSDhLL/ncsOvgG5xmsJmjM00X + 8UTOLjROUamINnOHRuEHPTOMn2u+FPY3XEsCJUO9rHacXnNW2pBzciKGwOgBd3JYkebhLIJvg0PyTfdS + 0DYsZRb0E65kLszmX5jN/2o2P+cY+LzD49Oz+f2z+X3Hs3tn80/5cc9sdvdsfvfx7JOz2Sft3/nd/sk9 + 4QQ78z6/imtBF+MAKsZkZOB0we/FHdFv2HgACY2EacessCHxkb7vs2XOSRf9xJ+INwJPxzOaOeeaNldE + G7Lbo/Bz/rFLt97+SY6PfOz/lED68H/8H2t9mfuTr60ElhweOKhEsrm3E9RONNiEHHzxt6qK9Ye1Jm6A + dYkT73aacQB4NV81p2X+KBbXzAwwlMxDM9MtAsxZ8AA2jo7/ZHp82+H03x1Mf/9g+sHJ4S2Tw9/04x9e + PXiXDn7WhweHt3AOZ3I+V3GtowtcMZrghI56iHvZHc0a5O4YeMyE+TwT7TrmaShi5j5/ngJFJHaBpwsE + ndg5l4C5Q1Esa/Nyo/CTf9+lLvqjP33g2i6I/d3GS6DXZvPVE+KhzlYFg81XG9waHDF+Dg76S84+47hj + qoEc/JCn5nNMqUcWWFZzrCxggwH2gCsNMHPn9OiPDqb/4uDwt68e/OrVgzNXD24CJFcmZyaHQEU/nLky + uWlyGA7/mU/CCZMJl4ArruKHX2UcRmNMRnYscRfuxR1RcYAWjYSt+Ji7W193ssGMOkN7jZ3J/AnXwi7w + RLk5J47bPCKXQ5tUGG/LrY2fJy4+31JBIGr897k/c2MJIGdZAX9+/4Vxg3RmFTT5BLLZorcjtUN0EoNN + DMH3FlhEFqKBG2BdGnIWOCFz7DQUzjm3rD49m0nV/Mnh9F8fHP6jK5ObWfqTA/BgUOFfsOF4CECKaodf + AYxAohN06BO7qhlB105uZvzp8b/iXm4Ect9Pm8u0wLRDHV1gbjZD5lmZLmLmzN9pOmcXTBElmluJC8GW + KyKtLVtuSNhr46fUPyBq3Ne5P+tUEgA5enN94s6HRwzUCx5/6Sq2I5LNbDa87aqy1AEnCWSwEe6EjL40 + DzrHPJz54q9nZqfx+segwpn5s8Ppv5kcfkCL3tHCQs/x8K4JYDBEmfIBFfx7lWNih/3sP/BJ+ms6PwMV + 5xjYGF9Q5I7cl7v7HJgJ88GuA9UXMOqiLoLYwC+C5yCGK3OOpyOJAUW0ZMsV7lA7OjQg7bXxg7XW0j8v + vfLaiK9zf8qpJEDkIIl9hMLvB4+5ztgtiormNhuvZxg2o9cw2Dz0CR990fku0zm2Og05n4kK57aD6T+N + DowjISiZMwDAgSRgOGDCnxw59uuZKwaqcPCzwS/8SZrKL0dx+Tg2Wjgn/CmO+S7mcDy7LaojyAZHkc0W + CxPW+6I/BYoIExRzjsQI8QpLtpwrIuXO5Vlzo7TQ2vgpKYRTrYv9xeMkAIWT8LMqWjBkttUY/SGHLVEF + Cuy4txPUDsaPKGloLrhjfAwIaMi0sxBl06P/fHD4W64EzlwxbXPTVTfDrrjN5prEfjZ1xDkOEqHF9ZLh + RCpI7tDNN9+cPrG/omfi+f5DHAcsOZD8E362+3J3Nw7PMB9m5SQeRt1nmK3PmZnDLoijI2Tkiih4RLkt + hxzEbivfZz0IrY2flvLBqBi3APZnnUoCyXhD/gPR6iw3J8+kTj6PYqMK74ihFlWAzUYUEm/nW05MfwN2 + 2NitxRdnhGKMVTNu4PDoDyaHv+6mlC1l1yQOD9lgIMSR0wAmmGpRBTkGdBX/ghz9lz7xv0blA9gEswgn + Q45cKfOspJHshKjruMuvM0NxDD5nUATDIXMOgo7n+pYFfOuXIbgjqYAEkINR2ysh1Jlsuh5+ykDqOFv8 + VEtnf3Eu9n/ykf82KBBTPnXMB11OaXPw4DefsFwsMOrpzCRKk5fpNhupN8ZNkz3whJlAFm/5/Gz2wPEM + euDj8MumZAwqWsfgBM0j5Ej/SMnohGCSBSNNvybCWrS1H4YfXRj/dc0W/prGsTEdM8HYMzpB6HK+wSw9 + n5td+5vMljkzc+bPUzi1gCKC/+Dp8OjMlqtrkrt5drlDpHKT79MLIZentHr7v/Xwk1sRUkQjbPH9+j+t + BHLlM6jwHTwhn1qVCMuaJ4LHHQCWDrnMcnigCmSzfcW4acujgV777PHs7NHxnx1M/5mQowXqyAnWV7Po + o+pgfUsFiUWAgtP5AVfSWpEw4Iegf9LnESd+R2kbKTTDp1Rc0ntykwQ2TSxNkjkzc+bPU/iz8ETuES2e + djoRW87yFdwd4iUyAkJNvvbSt7kefkrybZUtftqls7++FTDoJ68bt2e5DCGmtAXwYK5YbNQTxszhoabA + 03CgCsg0I02GHAJCKwQr75ke/aerB+/2ZRpiOLaIAwkWVm3g00Sy5VRBNK7MxJJ2UvzHzwz6R/6Pf5Kf + 4KZaYyIm+sGhYtcGl0nI1GGukeAaZsvMmT9P4c/yoHtEPB0EN6QCMSLyFcTLidp2Um5JCzV0Qiwc6qh3 + WA8/+YtQ+mefObpThMNtYrDlPmenwm+5PR5NN83jGZNLZlsCz8I8acDjPJvZNqSWPTKzeChRHRjh/zuZ + /q5MKZlGhHQSctyJt+hn0C1hEbu6cNIsmHNutomIiyoixXncQov4yUy4oKwciu5oSbc4ldfweMHYUwQJ + 7EXj0OcpIzOMMP1dnoUn8ufi6Qj7kgDO8xovhwScNUkQagw5ZykNQp4iuMRo547QevhpfZerbPGdLq1f + /MFL8ACkHoWvV2NWCReLrlNWmydTBs0DeBYVOZfERp+1dEzj2eB8yYuBZLv3+Pg25dfIYFMcU+Bx/SPf + g5BOiHU6bOxDN94CQhrNkFRE6wcfUPpn4EjjBOfHbx3Plw/m84GOS4oo+kKKF/EsPBHP5dQcEJI79DWe + 3SWAHJYhFDPlVMdamyQTftqO0Br4yUMQeiPmtnirooHXJM7SVkJD3JehsFsUfU8Htzh96HYXgzMmE2N6 + xMrKOSMTTkiP0/cIXN56W0nmXa+NTrdHlTxew1P/rBJh4GabwGPheYrVLKuAEgNy2Jyhnt0zPf639kb3 + V7jbWoEMkLsv8uCKZxiEle2csiw3PydQZCGME0C4hJCGrxN+gmfVPiciJ0A33dGVUlSG5h3ZfEQhhEmK + JZfLFLB0E8/F0/kLAl7uS1YcYc9OEvcShJxW4UVDNatyfFR+15QMZYWr9lWsgZ+SfGMRYL/xb+c3re+b + 7FJW/2bKgjuW4doWgc6tN+MwdjE40oCQHM5V56+5uHLhqLyKx0FofYO0AJl+femVH8V2GdgblttWhwyD + QFU722aEgWsefB4SC4jw4FVDUhMYNYeH3M1AfxkeCLAEulluT1QvjbEUwjjBfQ9+iLyRQLgJGzLDSCDI + iAfpkOD/RNdI5wTnJ2YbBLsx+l2JwIjsn4BnaEnzlI9k83evTLYcT+fsNk9KmJWyCJ4d3XvJS2W/KzrB + pZRIbcoHydKwwrscQuLiZMWtgZ+SPCCWmi8FflZ2Vhlj5ZO1dBELsfS1wJJ0TonYtcbf0eAt+YAB5smH + QAKQgKvOt0xuj62sExlA5mtvkr0W3B5/ZXqc1KpHKYDhT8R5KC+DbcPiN7PNq9wMPJ5VANV752T6Qdc8 + 9i6PKiIyaVG9BGwkSCSF42CI+TUJbFEv6fKkowKdbYyZ4ycQ1s058fxAu0XkNOPH+wpsIQkoMeDuswWP + S8Eiz1g1LE0/yJPyvJ6pYBBCDtGQexH5uJSQFRKjO8oVZJjiqnKElrmEdfAz8GYtlQzLonSWRkKI1da6 + FuS0iApe1S3VxCVjxt/R4EAlLW5m0qlymfNw9kaqE5FWKbUQn3Tpn7tuvf0uKR9PJRZngO1BnJTgOtYI + GQbkIFucxzUPhAHvXcy2AJ7j2V9MLKUgLfGQw2Zujy/l5KArAyClzwS/Xw6S8BMTCzKXJoZEHWP5tU0I + Nfu8TeIllSVGTiRbip/GMUP2g2AsG9JzvR3w7ialpzv8LZ43QcirXJEGvhCMnOJCyAqJyYojKGRVdy5V + OULmCyUrbg39UyqElM7IyigttNL9ZWF1nplfmy9EjT9g/rUgxPIaHn9Hg+cU8zCMmV6OCuA0YNmWAi+c + pUQbpGiPek3lSQYws/CzlPEAnueNqiZCOn98NpfZRnj0Dk8ATavTGQK9ywN4miSDGOhMTk5UO4EoiwgM + JlPGtgVqO7pJ+a8hgBOJh+xPWvRBccXJBOsusgU+VYeojMwmzBrSFxxCIfc0MgofOJ5ByqF1kQAvESCE + LwSpbXEhz06IjPYyl1BacWvgp9N4GPZtynjrcLFQqeKGx2c5tjTVQD7E7gbPIbHS2cuNtGFplPbesoJd + 4txEWHs1ixKr5fYoTgo/SzECGQaA5xvUnM2s6I3EHDyBOykKSMs0BDoVYwkZOkZVi/JaotREMIQkgF7Y + tBRO+WtSU7le6jwtB5KwHZIhGr8oJfWYqeZ5CSlaZRxdHvblqXl2lwDECaV4MHLk+BAHIzvhe141pLiq + snuQJ/rcsuNczonnrMfiB/OpxM+YQpTSCOkLuZZgGzN+iYrOkNTuBm/FN1cyJTkNM8B8lGxnQb4tKZ9k + ubnyCW6PlySQVQ0/S24b6TlkGBAkJc5DzQxM1Ccn09+R5gkpbcEFF38Vl6MzBwFRgRuIplpjdy3VLGTG + Wwc33YLKAKh6xolZ2AlFcVYZyZ74QDlIIX0hf9LD6e8ggbnJ4Zwnm5ImR0U6JQ9UDVEEjtyQnjtCJk/L + 0W5ZcdbEeOX3rRPKsrmRZdulydSpInizlsTaSmOvc2Il6nY6eMvpXynP/E00wL+XbOeysRfAEz3aeW2R + imS5BbfH+7MZZ+Bs9TNejPBlwogOnk9NDj8keirpFtcwiuRYxY77EhmQEkngiGo5KktO0bINNgynlX/t + GTmgKHBuy1ooZsopZc4DRPGJggnq1Nzh4Ye8gghpEBciO4EEH3Lk4FdgWZAbXEJwhELvBCTsdHYiEsbi + p6SGRmaOlsDrjLqWjvVIVnrVOrP1vNPBW17KymnnEx7I3lgl8FaeG5Zbaj0VLDeP9pjbs1gYZyC2mlJN + 71Jwb4jzKDEn0tMCT8iRSQmaiRvIGDYxwlr6pT4ZVillaHUg2Lpq8IbMiOyCVGWe3upPlCAU1akVXxx4 + XMhCq8iE8jsx2vArxiW49BpHKCZoK68nEAlj8VPGYVYuFL2JO3tftRRLaVyhi8Yon77xcyWw08G5Uenl + owAHJp8EMpy9UertTODdtIF/wfBFKB9ahNJxilApVQkUw5EbinFPkgGMLb1s6IZz29WDm4UBJ6zdYQi8 + Vojux0yCFOxX+U3I18x9+tUKRObf6GN17kKGW0+KC5l1OcEd+i7EmwYI2bvAntfpbGHvZq/Auw/JIB9P + TaCFHfVCyA3p4TqaFYdUYxOspYjqWPyUr/CRmaOd+GldW/pI48uKVo6/08HBTx+tr2gV0xv5ImgZfiUs + M6G18NNJG1Cr7JabZbhh1uP2kKGD2wPh9j8nh+8VABKD/Mv5QyRO3otMjNGmqYNl97gjZFEys+Kczu4g + EqSCxuKnJA9GZo52vv5z/HQCYKRy69M/afydDj6gYFviAsPAbK1so36B9ykfaDfRBnTZVT0prTMgrC3a + 462eqOdxt2dqhFtwqfOCgkQBJ0WRApeZ6sg1j/KyW8dI7TFeHbWpv6RSxApmwVmNmXLwsoTXkMMaSPn4 + 1Erw4ZKDKXScOUJeL0TJnSJC0NnGxbkVR1KCEQmtpJ5R+ClX4fjM0c6Yeo6f0lDpz5LscM6Hx9/p4Gk2 + fZGxEgMAaYzeLtnOTOBdyocYX+hnoGgptAFJbvQTpFyMwgSz3LwY7uzh0b8P6W1aeaq1DqlujoTk+jfg + iRzDEitwjZCTw6wHmc1MEpaMM8g5w/hcMQnVnzr2ZnCr7yYk460daOiDlfuElTmY9MTFJSKBMjtL6omV + 3uP0T6lDxttXneZNvoY6c71WsljphOHxdzp4mkNnYsFArs3KGFH5wooCb2i3WB4X8kQ92YSUE16TThtY + 9zPSukhyg3ODsCbK8cDR8Z9ePXhPSOyPRTjxJe0JBKaCFDxJizLljxV6ZjkkupY+Oc3JOYr62AX/vHkE + J99ignbMcI2x4OQIvQf5eFCVBFPobNqPWGqcS9IjqsjWJLykgkbpn/IdPyYyo+XV+W7OXYJynQ1H5VvQ + 6myJms7Z6eCtmfRlTHcCaTjVqF/gpfLxPNFM+XijapSP0Qa0nnJOidbsn6Ok2TPcQqp/zj6HqjjlAWTd + p4zFtvB/h6o5DQDGXxsaJIwmHtLI3pzRmevGFvWMOI+oRgMvZ8DdFJx+EClZJ24rtkNutJKjWJWIKgE0 + KlXFZScVZETcKPyUGBjvn3TaMGnldfonazU0HRh/p4N3akhVQ6ASBxKoy9KPcqhOtjMWyaXgN4FwKZ8U + MHXlU79KG2hv2kTAx6Kl3j3nvqPj/+KMk72GPTEsZjrH1m2N2+A8dZ4rHWP/bwOQVhYILaOx0Zaasz9s + oznTr6HE1eNd1ufRrFlTREjJuTipIIpVaRyJJKlUVVJP8oKgOo2IG4WfMpFkjBHf59zngaNd+Pdp/J0O + vtLCXFmMMMDL9bCdS8rn1tv/Use5R7/qm5Dmno9Sdcjp4iVKWIP2gvdMDn9DmkRMbkpvM7MtpOpkSQYd + 6WpvA3jEEI7XV36mQyhXWXqWhKKYhypnz53AWFJuWus3rOR78Vnk5g1NLS9OKkhekMs5ZPSQjrAaPyMS + SXrXUqf7ntNQp1zineRB8i52Onj+dljJpvDIa72DSqXqIm4S3q5MrqZzHr/4TKDd5PlYPxDLNvBG1fTa + JUUS5fNRVZKGWmin2pRbEJZRtuDSCztLTWiYrkR5rbms14j/5COPwU/yguIPIXkifb5c+BA4kiUJuGQk + H2Tl/boe8sY9cNmmgkI4NVNBntEzAj/lKhyZucMXXr5HW9eujN4Mv+bL8fOlvNPBmViO3pXqqMwh6tPh + 5ZkutDxbdPHs8y8l/Lz2FsmOqs022s1T3ZLnQzNOlM/dk8P3xWhpLIPLU8IcPGGlLuXmNIt+F6z0GASO + wc8wRycrrtE/eneoFMJUUCi8E3jc6nsfErPGPaa63QtaEE41Is4zelKzHsqrpqv1T/mOH0m+leugLEbo + VG4jjcPOlNbcMdvp4AAm91JW4qeMtPY9Zg/buWS8nT3/RMKPF/n8OJSXkmdt2TqUJUO7ETA1z8fb6ETl + E7LdPD3Zq6DxBJo6nFjAk3JzxizxnZ6zLn66JrPUdFsnxArw2MguENxBStOjP4xeECqIpDjkSUYPOxmr + QJWkUutaCnOzGj8lQTySPCid4E5irXS1V9K7WqzlxMr6n2s2+BjMt1IB+/yf8oXlAm/0Dyn0n7jjwchD + 3FGp+7sxB1TIETKnh+hFalpsX0RL66Iq+5bwco1biTg94JlvWWcctSIYMM94N29jNa9nyK11x046u3mi + 5QrwqIKsNCg0vlIjyAnh1Fu88RXbDSFDqoMuIlXvd/WKyxlp0+wKIvtgNX5K8m3M+u60nTpJ25EJ2q0X + fKdyKxfxTgfPvZQx75QcGAMcfYmfhx99JrXX8frheXov/PkD5+sT8MO+I5G2NuaAVFGyiZWt83FbE0r3 + DNRtLI9x6yW8sL2VYYtzy0IoYdGvtZpPr5fyAtWNRmsivw0X1xAJqSGWCSTaeEFWyC1m9HzZ0xECi2By + hsg++cnJSPyUvuzKzOuyrG2gjHQw1t5tFnXGKztX8O4Gb70gxti0uTIcwFuJn2effznix3KuLmXOz+MX + n3ZzQkVyxhzMQ5EPFXJ0PLv38Oj3VM9s/WtizVlwZrzsJ/S1mZgVJx9pYKVeY/xshJk+/ZasOLXpCY3p + XDKxx51LQ9YdcvO8bNIR2NKYMIAy4uhaqtK6YMKt0D+dPgZgGAj/dS7uYZU1mGvcAaHSMhyA9I4GL72U + 4YTA/PzhOvYSP09cvJy1d1vc+vG/1Evtw//hv1tE3DxamDeyRb/rKSd0f3fa2rLd7owJB5goWZ5LYN6W + kv8TNvqsoI3Y5PWsta0CJiM/Ih2fh4NiHsYS2S0p+Z/eQ2U7MhSLgFR9NyFaF5FR6kUNJvkrK/BTVu/o + m8P86Ot5sIHLMR5yrNGScxtOhtjR4OUqHzDJWq0ghhNJS2T62yG0R8yZg3OPfcW3vkoJb+QcPDdffHU+ + J/ZH0+f7j47+0PcXCZ1BQ7eamBjmAdPQYYMYiFrhlCt4IDW7RTS/s5K41fJqKS6UDFrrJncT0kOGLknk + +VXfwTIEglzmlHavwk9rleS+UKtllBrBlXnHYxxrVAwrrAQe6ya91DsbzfEiH5PUvIvBO/OS+LDsE9SS + 4UrvsdP6PfcYLlB137knk4Rvvf0OD+TBXNNvCaOcbGsS3pRzQEG/G2/Tf6wt39Q3xxsGhNdtquSJfFTT + iu0X0n5rYkEpfTtv+uNASlJyFvsM0kOGvkWkmXC+LSTpcMbCucwtkLpC/+SWkkz2FusFivi8czENl5GV + ZhnrpnMccNWZDsNMxpfWbH3wVuO7/MXBUyATdRjNPx+J9r68jfyOH/nY/7oy+XF9QmPRPGfnW55tTW8d + ikxlvP1a6uHkqPCdp2J7p2D6+9LBBxjj24w5Z0c22JaGjZtBZLHjtmSanSN+zZvFIUlMOPqVkpGNhEMu + j0n+5Gcr8JPazOYOxnCiJGudE0ZWB5UoQl8NlwOoL+Fm429x8AQMPezKOXPaeLQLQn1JdOTsXJmY8WAs + qnGpbIBFV1ECfNSZkjD6qLcHeWB6RA1v9HDUK0fdQMOLNrgHqWnbGGyMOWdLC73Xcdo4qVQTU8JOykgI + HlEmGWXQyjtChp6RTV0dRUF0WvRAKm0oY1Hdav66LzLIF8yayA8+2WxZd+qicnxMtTEdEleGMlNmWj75 + dQdP16bb8ezYZtuVCc+L5Xb2/FMcGG84Py/+4NXY4U3bYLnzY/twkPNGkwNVK1jOznT6z8OKCQ0+U5vP + rAGvLLp8N7jBZOfrAT+noTGa5iH+4FlSQtzUKMpKokOGIZdHFQ1WVPcC0naZWzr25vhZuUz3J2xJAnnm + juVchy1J3Pmp6jdsGyxr72bOj+e8eamctdf5gMpgPD6Y1krBEMT20LvWG1sc/3QwjkR2+00RmkIGcYXa + jQ94XSr72NEaIbpAVpQaXKA9fra0yHc4TGi1o8iptyBTh0RL2/FYBH1CPGe0os8BpaZU+5DzdhfOj2+v + m7ryhiadStcPfaqahJ3lnOX1S262CI+VQ22Mn0b/hFCYv1+8oCOW02USM+nhAt3luXBfsNYiSNjkTI/S + EAXa42eHC38bQy8VnHoLZvq8gR+Sr8CPqk0tbcciP9Zkh67W9Dn49NHxH8ecN2usk3WoSpu3eRrYciPp + lQv3OjlhY/yk+acU0uQRedg0VtepPiqkY/8x8kSq3ilbUSCSpGiTbeVAe/xsY5HvcIzOVjvWp4qaBd/7 + 1iKniTxYLNg0m/aI95MBqZZUqvNRo4zULqMFg1SncMpS01N69uPBuRl+rCg1UQilgo3yUZQsluLe5Lmk + RIHOI1tRCC5ti6Ii/z1+drj2tzH0UtlC2JIxFJyqvXUg3zxBi7S3UG16OP2XMbDjeaJpTXiIsClGGGz0 + Pn5BpzM3W9nr3miDu7SSKsTCRX4l5AE27xp1LXWMIclUkYqEXc5Gwamv1R4/21jkOxyjjR8VbJO8SAqj + k9eq+SHzIJFvD85m906mH5qkva+bfXZTCqkvndgJoF2weQrnp29lb7Di+0B1yqRSNVtM1lp8y4hfifs4 + BImdQYZIEnn6DsRqKuIUnO0ea7VAe/zscO1vY+gO/MQO8Z52beTby74BPa12IN/IPKDD6KcODn87kG+h + etnaNTlmwsa6YXV6n411X/8D518D/Gxltq5/UkJg2CbZRvZ9IA1dTl1yGpJEnkjVZGsUHJte0hfuZafg + 3tzjZxuLfIdjLJX9+EaCahJPq0T0D2ULkG9OXlt7+CehWT1zB/y8XyFCo+CUVR3bAOSAyXuGbGVdvlPw + E/RPyuXxvjyOnyArUZdWC3T4fsePUdhI2Mu5rZYOye/xs8OFv6WhM/xAXnvwx/BzQvKBgj8/DJlvVrYA + fqxVlXULOXhv4KnL7hmZeRaYg6KF58ZYauGnM6NUg7/tyabt90ircWTo3YOv+N5YS0dTK/DztLLgXPJv + 7PXPltb5robpCJ7GjU1D8DQL/jxJmGJG8Gd299WDd+sN6uSbKZ+gajLC2sjruN2iewWdfUbXs+6uT/2T + XhOi4NJTN51SYiK2iBZJLGjvg3cjT6TqIaAnUwjILOcx+Gnl0QwncZFvkiewbCXdhpWpjJuRqdydOXW6 + fOWxrQmnOSRppDzxPMdnBOgK/JywVSb2W8i85luM+MF+Y2M5MketYcjVg1+hlCWuA+3ekeyTLPNNSaXL + e5Bs7BENePZb5A820I35E8Wfg3nWjLakfyj6UMY6PtKvIE+XKlmkhFDVEY4QqqUgrNY/LCmWXUq7Hl7E + ytcm8ZHlwplrZUz2LSaWoGp+xtR4dqbSaUraDVuHcpmVPK5DMx/fV3XE0rdTUsZqkhvyVKHHypJvydyL + 59Qz0ZN3Wvgx/yeVnYIf1z+GHxXMRcIt0bU5aRtA1cbPBgt05SXXAD8jo085fpb2IZZklF0a1JHw866I + H+w30jtCCoL7PyPwo4WihPzhb12tN8esjL7FN1Abs/GwIBngtZCs7OlW7ZCANBIY409T/U9+vmq/V6pT + TVKVPzl+zj/2tetT/6xE0a5P6EPp26l/En5Ui9rXXDe1rh1odbByzfW9/lVGvrLyrHP8vAhPJ6Si9Fa2 + uCzVlZNc9wS1882vUoXpylx1TnPwhMpT6Z8Xf/DKOfBD/Ccmj15X/s+uETI8/jB+3O3p83+Cibt9/yfh + R8uur3mi6ltUBrPyzdq5BFVF0/mnkS/szmtLwKfWH63zT+NiDYCKh2o9V6mR+i9v82+fuOPzly6/cN3y + b9cnftKs+vjGVmV75F2UV7oN/k0vZrkN5YsT5MgWksmx7hta56tss/PadRbc0gBMtRxTo5VY3RF+Ssuz + RNQo/NTzS5dfZLRR8Z/p2xP/uc7xk08vj30ZrvriP9NTx39weQUPqZey5YDWqBRUXxsN/soC7SS4+FAj + M44Wces0dEgaVnzGSuNHKxJglxxGH1XQebLmM0yEDJyjPnUtifEaSpZqohbLQfwx6TNm9tvVgwPq57gQ + /Y/+uXT58qXL3/z5hBDE9ZV/sBZ+Rnr848ccz1L05x/4PrCBkNxS/kGqzdSbu/VG14JmsfY5SKLvsObl + YLACcnjoQ+EnUWQtCxDwsOjFXHEXtWPf2FcRmzd8OcuaOXMwE27H3UvfbMw5kkn+vOoqnO7Oi0B12lK/ + ei+kHVAoOxV+AI+ah9D54L5zj913/pGz5y+syH+z+I9SRVPC6M7z38av9RRFXfeSgfPH4Gdk/ltsh72N + /Lf0ZWs1lNZ88pHKdcmCYK3nrj+Lo2yAJnKvz4wRb5G/xYfPHzYgZWQOOGlqN9VSGjx13gRizDlMYyX5 + JqexnEx0+VLnRFTQhGmfPfe4xU9D/s51l3+9Lhi2GG8dzitdlX/t0dJU6xH24dtS/nX+suQrbO1xkF6u + sotKUrjF2mlJtVYMa6jP8JMJ1KIBpK82cLRS498+k0yALxsyatp62DHnaG655Zm/ZXR3aebOmeh2Vw/Y + alP8G3sufM/F+038n83rf7o6vG2r/mdd8CiLp/OqMZpk3dutqP8J9XNeJbXd+p/c1JGxkdyP/E+yizob + oOVLRKqjdVrnktWCE9vbgqWaWm2AH6nQgR17FMIq/bTcdh1zjuYmyzOfZ6KzZbX2PUI8rak/lf32+ls0 + X/7FqT+9lvjJ8bZcf2rZBhZx3lH9aQ6SXMmwFnMYyC4qF4RIMPk2vHEFs/w0EQ/D5FsZAN0sHaGPfEvz + 6XuKHD9jztGA5XNJ0yJGqdA+IiTj6EL/g0/c8RDnj+p/YBvOvTP6H4zMN91usmnTwsqyAb0oNaYFqv91 + pLlj/wPbjm7T/gctVjctIxZ0vuJlr5drGti0fAn0Ruu0VniHJZWvKk5uqQudvxl/kIi+zhd/31Nwcgpt + jTlHg3eGrSQlpKe3Rl/n7uwBgwq69fa7OFL/nUuXv63mo+q/o+ajvf13Yn5kR4fet7X/ztuhfzr674Sd + +aL+8V9Fvp26/w7mU76a0+rh81wnyMpqrYYy5Ufsk05LJpkwme7SumOJN91rs3QE2Z9912pNd2o2PpfF + OOac3PLMpddKpJAdWJIHy6cF/LjcHkolQGfPPbJp/7eYSxp7oCX/Z12P4pTnX/t80/7+b0YeeB2uuuSF + Ll/0f5uznTB7OebFp2v1f2vxtgJA6ZB0UtulnSP3Q6ojKZAWSZUrFt2uNQfBcrNcaU1pgHwDJCWT0eI8 + xpyjB2xZqnr8dPc+KC6z3g1+cIHUAuG1N+mr+JSX0IX+o77BYH//UXYpXNV/9JRg2O7lpV7aVrCoMd48 + Ib2j/2jT9Iv+o2zH/cA89h+l+cF6/UcVnWj5Hp2rR15Nvi619HPTSwETYS83/yLXZJRUK2Og01TbmHxL + 20kMEA/ckTnnD8LPyihPV405R+RBS5WVtLuepaUPl4EX8MOs/uL+L4EfTDhCQFvvf3397NnYB8VtkHLX + qv+10pb1tuaby9cBvm9aXjot7SmiM9Nq4K+sPJ2vuKdWlXpkp+UoXCmAmD5XUoIyhpIJlzdlZ5yR5Qby + xdPjpAH5pC8fgjkzJdEenY3wuXDgHC5JMpFAONIE0szzHSvkFOm0VF7Br7AHorApZPjIx/43ECIE9OIP + 6P9CC8Wh/Rfmg/svyEtOjXhSMsvGxT/b1T9rkdpjcJWeq3nSEfsvIMNT7b+wAUG8v2QHEuiqQo1dELa1 + /4+vsKHN564BQjZLrx6DHx+52YJOvw7t/3Owjf1/drAU9kNuIIGuLnDCz+D+c+ygNn7/uetfBW1M1uXK + p6nZ9veF7+XY1KirYM43fXn3Fvaf2+Cr3l+yAwmUXUiPQhQ1dsHu3//0wwP7n4aOpEYtWMX/da6CRgaL + epRYpnz8eZPy8b3s1RM8MG/wb4dHH97C/qc7WAr7IdeWQHKB8ILURR4K4cQLuWMjxS3sv+27r4XeGikB + +W232fIJrK9/Ntl/Wy+Rgf23aVu1xv7ba3/b+wt2IoGORnDWSMQaWdFIERabdszWSL5ij7TFxfn88Tn9 + LryXFTxoyCb2nrTW18qgop9lvWQ7Ai33ElnKedlqp8V1kTkmWJTstBxp/Bw+n6R0OzPbZMghB9+wRJ1H + rWOE9Xyb3hJ7ViFD2sZfRKomWyTsba9t57KR+9fvZDHsB11bAitMuMo2MvGNgBb0Ury0sI20LswXD9O7 + +ej4D2xZZF0UtVBid5Hl7bSueyuuBN4q/iBZbs2GWW6z6cUBlrwRqctHUkJisef1BSTp8rSeib7PbLN5 + PSb06v47a3/R+wt2IoEWhRB68XgvOLHYb1WVemF/Z7H4m7lt5Gi72Pv2nXcfHL5PZomMNE8xDhZ/ewuT + aMW1lmnuZK+rOq7l+eU8efAlns0Jg6h8ghxCFNUJOmTlDXfCzvVIEnl6eBrZWs9rkzYyN8lP9/jZyWLf + zaBtE85zSVUL9FP2ojHTonq1qrWXlnLhLljuiamgj4btgKy/c6h1MW8nNoVb5qACH5Xl9dgbOllH11uM + qJhYe5+SxLm5kRZ2XhCuwoPbPmKeomHK56MhZ2eO8rE955AnUnXZ2p4/Lm1kjuSP9vjZzVLfyahLJhx7 + aWW52D+nna/5tb4dw8L2Qn2OzWoWroLmlo599+Tw/drex8wVvZKjP6MthIOWaNoARBSFSKuubajea6lV + xtwrbiBnnMHSPMsOxlk3yVjtoxcE19Lt4G4khtyQnsuQDUtswwVkaw3Hfdt6D15TRXL0/wHYXYwXw5hb + FgAAAABJRU5ErkJggg== + + + \ No newline at end of file diff --git a/src/boost/libs/math/dot_net_example/distribution_explorer/AboutDistributionExplorer.Designer.cs b/src/boost/libs/math/dot_net_example/distribution_explorer/AboutDistributionExplorer.Designer.cs new file mode 100644 index 00000000..dc2740ae --- /dev/null +++ b/src/boost/libs/math/dot_net_example/distribution_explorer/AboutDistributionExplorer.Designer.cs @@ -0,0 +1,193 @@ +namespace distribution_explorer +{ + partial class AboutDistributionExplorer + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AboutDistributionExplorer)); + this.tableLayoutPanel = new System.Windows.Forms.TableLayoutPanel(); + this.logoPictureBox = new System.Windows.Forms.PictureBox(); + this.labelProductName = new System.Windows.Forms.Label(); + this.labelVersion = new System.Windows.Forms.Label(); + this.labelCopyright = new System.Windows.Forms.Label(); + this.labelCompanyName = new System.Windows.Forms.Label(); + this.textBoxDescription = new System.Windows.Forms.TextBox(); + this.okButton = new System.Windows.Forms.Button(); + this.tableLayoutPanel.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.logoPictureBox)).BeginInit(); + this.SuspendLayout(); + // + // tableLayoutPanel + // + this.tableLayoutPanel.ColumnCount = 2; + this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33F)); + this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 67F)); + this.tableLayoutPanel.Controls.Add(this.logoPictureBox, 0, 0); + this.tableLayoutPanel.Controls.Add(this.labelProductName, 1, 0); + this.tableLayoutPanel.Controls.Add(this.labelVersion, 1, 1); + this.tableLayoutPanel.Controls.Add(this.labelCopyright, 1, 2); + this.tableLayoutPanel.Controls.Add(this.labelCompanyName, 1, 3); + this.tableLayoutPanel.Controls.Add(this.textBoxDescription, 1, 4); + this.tableLayoutPanel.Controls.Add(this.okButton, 1, 5); + this.tableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel.Location = new System.Drawing.Point(12, 11); + this.tableLayoutPanel.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.tableLayoutPanel.Name = "tableLayoutPanel"; + this.tableLayoutPanel.RowCount = 6; + this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); + this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); + this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); + this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); + this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); + this.tableLayoutPanel.Size = new System.Drawing.Size(556, 326); + this.tableLayoutPanel.TabIndex = 0; + // + // logoPictureBox + // + this.logoPictureBox.Dock = System.Windows.Forms.DockStyle.Fill; + this.logoPictureBox.Image = ((System.Drawing.Image)(resources.GetObject("logoPictureBox.Image"))); + this.logoPictureBox.InitialImage = ((System.Drawing.Image)(resources.GetObject("logoPictureBox.InitialImage"))); + this.logoPictureBox.Location = new System.Drawing.Point(4, 4); + this.logoPictureBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.logoPictureBox.Name = "logoPictureBox"; + this.tableLayoutPanel.SetRowSpan(this.logoPictureBox, 6); + this.logoPictureBox.Size = new System.Drawing.Size(175, 318); + this.logoPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.logoPictureBox.TabIndex = 12; + this.logoPictureBox.TabStop = false; + // + // labelProductName + // + this.labelProductName.Dock = System.Windows.Forms.DockStyle.Fill; + this.labelProductName.Location = new System.Drawing.Point(191, 0); + this.labelProductName.Margin = new System.Windows.Forms.Padding(8, 0, 4, 0); + this.labelProductName.MaximumSize = new System.Drawing.Size(0, 21); + this.labelProductName.Name = "labelProductName"; + this.labelProductName.Size = new System.Drawing.Size(361, 21); + this.labelProductName.TabIndex = 19; + this.labelProductName.Text = "Product Name Distribution Explorer"; + this.labelProductName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // labelVersion + // + this.labelVersion.Dock = System.Windows.Forms.DockStyle.Fill; + this.labelVersion.Location = new System.Drawing.Point(191, 32); + this.labelVersion.Margin = new System.Windows.Forms.Padding(8, 0, 4, 0); + this.labelVersion.MaximumSize = new System.Drawing.Size(0, 21); + this.labelVersion.Name = "labelVersion"; + this.labelVersion.Size = new System.Drawing.Size(361, 21); + this.labelVersion.TabIndex = 0; + this.labelVersion.Text = "Version 1.1"; + this.labelVersion.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // labelCopyright + // + this.labelCopyright.Dock = System.Windows.Forms.DockStyle.Fill; + this.labelCopyright.Location = new System.Drawing.Point(191, 64); + this.labelCopyright.Margin = new System.Windows.Forms.Padding(8, 0, 4, 0); + this.labelCopyright.MaximumSize = new System.Drawing.Size(0, 21); + this.labelCopyright.Name = "labelCopyright"; + this.labelCopyright.Size = new System.Drawing.Size(361, 21); + this.labelCopyright.TabIndex = 21; + this.labelCopyright.Text = "Copyright John Maddock and Paul A. Bristow 2007"; + this.labelCopyright.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // labelCompanyName + // + this.labelCompanyName.AutoSize = true; + this.labelCompanyName.Dock = System.Windows.Forms.DockStyle.Bottom; + this.labelCompanyName.Location = new System.Drawing.Point(191, 111); + this.labelCompanyName.Margin = new System.Windows.Forms.Padding(8, 0, 4, 0); + this.labelCompanyName.MaximumSize = new System.Drawing.Size(0, 21); + this.labelCompanyName.Name = "labelCompanyName"; + this.labelCompanyName.Size = new System.Drawing.Size(361, 17); + this.labelCompanyName.TabIndex = 22; + this.labelCompanyName.Text = "Company Name"; + this.labelCompanyName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // textBoxDescription + // + this.textBoxDescription.Dock = System.Windows.Forms.DockStyle.Fill; + this.textBoxDescription.Location = new System.Drawing.Point(191, 132); + this.textBoxDescription.Margin = new System.Windows.Forms.Padding(8, 4, 4, 4); + this.textBoxDescription.Multiline = true; + this.textBoxDescription.Name = "textBoxDescription"; + this.textBoxDescription.ReadOnly = true; + this.textBoxDescription.ScrollBars = System.Windows.Forms.ScrollBars.Both; + this.textBoxDescription.Size = new System.Drawing.Size(361, 155); + this.textBoxDescription.TabIndex = 23; + this.textBoxDescription.TabStop = false; + this.textBoxDescription.Text = resources.GetString("textBoxDescription.Text"); + // + // okButton + // + this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.okButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.okButton.Location = new System.Drawing.Point(452, 295); + this.okButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.okButton.Name = "okButton"; + this.okButton.Size = new System.Drawing.Size(100, 27); + this.okButton.TabIndex = 24; + this.okButton.Text = "&OK"; + // + // AboutDistributionExplorer + // + this.AcceptButton = this.okButton; + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(580, 348); + this.Controls.Add(this.tableLayoutPanel); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "AboutDistributionExplorer"; + this.Padding = new System.Windows.Forms.Padding(12, 11, 12, 11); + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "AboutDistributionExplorer"; + this.tableLayoutPanel.ResumeLayout(false); + this.tableLayoutPanel.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.logoPictureBox)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel; + private System.Windows.Forms.PictureBox logoPictureBox; + private System.Windows.Forms.Label labelProductName; + private System.Windows.Forms.Label labelVersion; + private System.Windows.Forms.Label labelCopyright; + private System.Windows.Forms.Label labelCompanyName; + private System.Windows.Forms.TextBox textBoxDescription; + private System.Windows.Forms.Button okButton; + } +} diff --git a/src/boost/libs/math/dot_net_example/distribution_explorer/AboutDistributionExplorer.cs b/src/boost/libs/math/dot_net_example/distribution_explorer/AboutDistributionExplorer.cs new file mode 100644 index 00000000..3db49d9f --- /dev/null +++ b/src/boost/libs/math/dot_net_example/distribution_explorer/AboutDistributionExplorer.cs @@ -0,0 +1,115 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Windows.Forms; +using System.Reflection; + +namespace distribution_explorer +{ + partial class AboutDistributionExplorer : Form + { + public AboutDistributionExplorer() + { + InitializeComponent(); + + // Initialize the AboutBox to display the product information from the assembly information. + // Change assembly information settings for your application through either: + // - Project->Properties->Application->Assembly Information + // - AssemblyInfo.cs + this.Text = String.Format("About {0}", AssemblyTitle); + this.labelProductName.Text = AssemblyProduct; + this.labelVersion.Text = String.Format("Version {0}", AssemblyVersion); + this.labelCopyright.Text = AssemblyCopyright; + this.labelCompanyName.Text = AssemblyCompany; + this.textBoxDescription.Text = AssemblyDescription; + } + + #region Assembly Attribute Accessors + + public string AssemblyTitle + { + get + { + // Get all Title attributes on this assembly + object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false); + // If there is at least one Title attribute + if (attributes.Length > 0) + { + // Select the first one + AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0]; + // If it is not an empty string, return it + if (titleAttribute.Title != "") + return titleAttribute.Title; + } + // If there was no Title attribute, or if the Title attribute was the empty string, return the .exe name + return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase); + } + } + + public string AssemblyVersion + { + get + { + return Assembly.GetExecutingAssembly().GetName().Version.ToString(); + } + } + + public string AssemblyDescription + { + get + { + // Get all Description attributes on this assembly + object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false); + // If there aren't any Description attributes, return an empty string + if (attributes.Length == 0) + return ""; + // If there is a Description attribute, return its value + return ((AssemblyDescriptionAttribute)attributes[0]).Description; + } + } + + public string AssemblyProduct + { + get + { + // Get all Product attributes on this assembly + object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false); + // If there aren't any Product attributes, return an empty string + if (attributes.Length == 0) + return ""; + // If there is a Product attribute, return its value + return ((AssemblyProductAttribute)attributes[0]).Product; + } + } + + public string AssemblyCopyright + { + get + { + // Get all Copyright attributes on this assembly + object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false); + // If there aren't any Copyright attributes, return an empty string + if (attributes.Length == 0) + return ""; + // If there is a Copyright attribute, return its value + return ((AssemblyCopyrightAttribute)attributes[0]).Copyright; + } + } + + public string AssemblyCompany + { + get + { + // Get all Company attributes on this assembly + object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false); + // If there aren't any Company attributes, return an empty string + if (attributes.Length == 0) + return ""; + // If there is a Company attribute, return its value + return ((AssemblyCompanyAttribute)attributes[0]).Company; + } + } + #endregion + } +} diff --git a/src/boost/libs/math/dot_net_example/distribution_explorer/AboutDistributionExplorer.resx b/src/boost/libs/math/dot_net_example/distribution_explorer/AboutDistributionExplorer.resx new file mode 100644 index 00000000..8642ec38 --- /dev/null +++ b/src/boost/libs/math/dot_net_example/distribution_explorer/AboutDistributionExplorer.resx @@ -0,0 +1,781 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + Qk02YwAAAAAAADYAAAAoAAAAYAAAAFgAAAABABgAAAAAAAAAAAB0EgAAdBIAAAAAAAAAAAAA//////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////N/X0NvbzNvXyNvbzNvXzNvXzNvTyNvbzNvXzNvXz + NvTzNvXzNvbzNvXzNvXzNvXzNvX0Nvb0N/X0NvXzNvX0NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvX0NvXzN/X0Nvb0NvX0NvXzNvXzNvXzNvbzNvXzNvTzNvXzNvXzNvbzNvTyNvXzNvXzNvbz + NvXyNvbzN/X0NvXzN/b0R/b0NvTzNvXzNvX0NvXyNvX0NvXzNvbzNvX0NvXzNvXzNvXzNvTyNvXzNvXz + Nvb0NvXzNvX0N/XzNvXzNvb0NvXzNvXzNvb0NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvb0NvXzNvXzNvb0 + NvXzN/XzNvX0NvXzNvb0NvXzNvXzNvTyNvXzNvXzNvXzNvX0NvbzNvXzNvb0NvXyNvX0NvXzNvTzNfbz + NvTyNfXzNvXyNvXyNfbzNvXyNvXzNvTyNvX0NvXzNvXzNvXzNvTzNvXyNvb0NvXzNvXzNvXzNvXzNvXz + NvX0NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvX0NvXzNvXzNvXz + NvXzNvXzNvb0NvXyNvTzNvXzNvXzNvXzNvX0NvTyNvXzNvXyNfbzNvXyNvXyNvTyNfXzNvb0NvXzN/X0 + NfXzNfXzNvTzNfXyNvXzNvXzNvTzNvTzNvbzNvb0NfXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzODg4NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNfXzNvb0 + NvbzNvTzNvTzNvXzNvXzNfXyNvTzNfXzNfXzN/X0NvXzNvbzNfXzNvbyNfTyNvTyN/XyNvXzNvTyNvX0 + NfXzNvXzNvXzNvTzNvXzNvb0NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvb0NvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzODg4ODg4ODg4NvXzNvXz + NvXzNvXzNvXzNvXzODg4NvXzNvXzNvb0NvXzNvXzODg4NvXzNvXzNvXzODg4Nvb0NvXzNvTzODg4NvXz + NfXzNvX0NvTyNvXzN/XyNvTyNfTyNvXzN/X0NfXzN/XzN/XzNfXzNvXzNfbzNvXzNvXzNvTzNvTyNvXy + Nvb0Nvb0NvXzNvb0N/XzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzODg4NvXzNvXzNvXzNvXzNvXzNvXzNvXz + ODg4NvXzNvXzNvXzNvXzNvXzNvXzNvXzN/XzNvb0NvXzNvb0Nvb0NvXyNvTyNvTzNvXzNvXzNfbzNvXz + NfXzN/XzN/XzNvXyNvTzNfXzNfTzNvX0NvXzNvTzNvXyNfTzNvTzNfTzNvbzNvb0NfXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzODg4NvXzNvXzNvXzNvXzODg4ODg4ODg4ODg4ODg4ODg4ODg4 + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNfXzNvb0NvbzNfTzNvTzNfTzNvXyNvTzNvXzNfXyNfTzNvXy + NvXzNfX0NvXzNvX0NvX0NfXzNvb0NvXzNvXzNvTyNvXyNvXzNvXzNvb0NvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzODg4NvXzNvXzNvXzNvXzNvXzNvXzNvXzODg4NvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvb0NvXzNvXzNvXyNvTyNvXzNvXzNvb0NfXzNvX0NvX0NvXzNvXzNvXzN/TyNvXzNvXz + NvTzNvXyNfXzNvXzNfTzNvbzNvb0NfXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + ODg4NvXzNvXzNvXzNvXzNvXzNvXzNvXzODg4NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNfXzNvb0NvbzNfTzNvXzNfXzNvXyNvTzNvXzNvXzNvbzNvXyNfbzNvX0NvXzNvXzNvb0NvX0NvXz + NvXzNvXyNvXzNvXzNvb0NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzODg4NvXzNvXzNvXz + NvXzNvXzNvXzNvXzODg4NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvb0NvXzNvXzNvXy + NvXzNvXzNvX0Nvb0NvXzNvXzNvX0NvTzNvTyNfXyNfXzNvXzNvbzNvXzNvX0NvXzNvTzNvX0NfXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzODg4NvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNfXzNvX0NvTzNvXzNvX0NvXz + NvbzNvXzNfXzN/bzNfXzNvXzNvTzNvTyNvXyNvXzNvXzNvTyNvbzNvb0NvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzODg4NvXzNvXzNvXzNvXzNvXzODg4ODg4NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvb0NvbzNvTyNvXzNvXzNvXyNvTyNvTzNvTy + NvTzNvTyNvXzNvXzNvXzNvTzNvTzNvTzNvb0NvXzNvX0NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzODg4ODg4ODg4NvXzNvXzNvXzNvXzNvXzNvXzODg4NvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvX0NvXzNvb0NvTzNvTzNvTzNvXzNvXzNvXzNvX0Nvb0NfX0NvXzNvXz + NvXzNvXzNvXzNvbzNvb0NfXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzODg4NvXzNvXzNvXzNvXzNvXzNvXzNvXzODg4NvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNfXzNvb0NvbzNvXzNvXzNvXzNvXzNvTyNfXzNvXzNvTzNfTyNvXyN/XzNvTzNvTyNvbz + Nvb0NvXzNvX0NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzODg4NvXzNvXzNvXzNvXzODg4ODg4ODg4ODg4ODg4ODg4ODg4NvXzODg4ODg4ODg4ODg4ODg4ODg4 + ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4 + Nvb0NvbzNvTyNvTzN/X0NvX0NvTzNvX0NvXzNfX0NvbzNvb0NvXzNvXzNvTyNvX0NvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzODg4NvXzNvXz + NvXzNvXzNvXzNvXzNvXzODg4NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvX0NvTyNvXz + NvXzN/b0NvbzNvXzNvXyNvTzNvXzNvXzNvXzNvXzNvXzNvXzNvb0NvXzNvX0N/b0NvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzODg4NvXzNvXzNvXzNvXzNvXzNvXz + NvXzODg4NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzN/b0NvX0NvXzNvb0NvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXyNfTzNfbzNvX0NvXzNvXzNvbzNvb0NvXzNvXzNvXzNvXzNvb0NvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzODg4NvXzNvXzNvXzNvXzNvXzNvXzNvXzODg4NvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzODg4ODg4ODg4NvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvb0NvXzNvXzNvXzNvXzNvb0NvbzNvXzNvXzNvX0NvbzNvXzNvX0NvbzNvXyNvXz + NvXzNvTzNvXyNvXzNvb0NvX0NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzODg4NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzODg4NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvX0Nvb0NvXzNvXyNvTzNvXzNvXzNvXyNvTzNfXzNvXzNvb0NfXzNvXzNvXzN/bzNvb0 + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + ODg4ODg4NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzODg4NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvb0N/bzNvXzNvXzNfXzNvb0NfTzNvXzN/bzNvb0NvXzNvXzNvXzNvXyNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzODg4NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXyNvXz + NvXzNvXzNvb0NvTzNvXzNvbzNvXyNvXzNvXzNvXzNvb0NvXzNvb0NvXzNvb0NvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzODg4 + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvb0NvXzNvb0NvXzNvb0NvXzNvXzNvXzNvXyNvbz + NvXzNvXzNvX0NvXzNvXzNvTyNvb0Nvb0Nvb0NvX0N/b0Nvb0NvXzNvb0NvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzODg4NvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvb0NvXzNvb0N/b0NvX0Nvb0Nvb0Nvb0NvTyNvXzNvXzN/X0NvTzNvXzNvXyNvXzNvXz + NvXzNvTyNvXzNfXzNvXzNvb0NvXzNvXzNvXzNvb0NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzODg4NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvb0 + NvXzNvXzNvXzNvb0NvXzNfXzNvXzNvTyNvXzNvXzNvXzNvbzNvXzNvXzNvXzNvXzNvX0NvTzNvXzNfXz + NvXzNvb0NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzODg4NvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzODg4ODg4NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvb0 + NvXzNfXzNvXzNvTzNvX0NvXzNvXzNvbzNvXzNvbzNvXzNvXzNvXzNvTyNvXzNfXzNvXzNvb0NvXzNvXz + NvXzNvb0NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + ODg4ODg4ODg4NvXzNvXzNvXzNvXzNvXzNvXzODg4NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvb0NvXzNvXzNvXzNvb0NvXzNfXzNvXzNvTy + NvXzNvXzNvXzNvbzNvXzNvXzNvX0NvXzNvXzNvTyNvb0Nvb0Nvb0NvX0N/b0Nvb0NvXzNvb0NvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzODg4NvXzNvXz + NvXzNvXzNvXzNvXzNvXzODg4NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvb0NvXzNvb0N/b0NvX0Nvb0Nvb0Nvb0NvTyNvXzNvXzNvX0NvTz + NvXzNvXyNvXyNvXzNvXzNvXzNvb0NvXzNvb0NvXzNvb0NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzODg4NvXzNvXzNvXzNvXzODg4ODg4 + ODg4ODg4ODg4ODg4ODg4NvXzNvXzODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4 + ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4 + ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4Nvb0NvXzNvXzNvXzNvXyNvbzNvXzNvXzNvb0NvXz + NvXzNvXzNvXyNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzODg4NvXzNvXzNvXzNvXzNvXzNvXzNvXzODg4NvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXyNvXzNvXzNvXzNvb0NvTzNvXzNvbzNvb0NfXzNvXzNvXzN/bzNvb0 + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzODg4NvXzNvXzNvXzNvXzNvXzNvXzNvXzODg4NvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvb0N/bzNvXzNvXzNfXzNvb0NfTzNvXzNfbzNvXyNvXzNvXzNvTzNvXyNvXzNvb0NvX0NvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzODg4NvXzNvXzNvXzNvXzNvXzNvXzNvXzODg4NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzODg4ODg4ODg4NvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvX0Nvb0NvXzNvXyNvTz + NvXzNvXzNvXyNvTzNfXzNvXzNfbzNvX0NvXzNvXzNvbzNvb0NvXzNvXzNvXzNvXzNvb0NvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzODg4NvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzODg4NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvb0NvXzNvXzNvXzNvXzNvb0NvbzNvXzNvXzNvX0NfbzNvXz + NvX0NvbzNvXzNvXzNvXzNvXzNvXzNvXzNvb0NvXzNvX0N/b0NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzODg4ODg4NvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzODg4NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzN/b0NvX0NvXzNvb0NvXzNvXzNvXzNvXzNvXzNvXzNfTzNvXyNfTzNvbzNvb0 + NvXzNvXzNvTyNvX0NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzODg4NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvX0NvTyNvXzNvXzNvb0NvbzNvXzNvXyNvTzNfTyNvXyN/XzNvTzNvTyNvbz + Nvb0NvXzNvX0NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzODg4 + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvX0NvXz + Nvb0NvbzNvTyNvTzN/XzNvXyNfTyNvX0NvXzNfX0NvXzNvXzNvXzNvXzNvXzNvbzNvb0NfXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzODg4NvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNfXzNvb0NvbzNvXzNvXz + NvXzNvXzNvXzNfXzNvXzNvTzNfXzNvXzNvXzNvTzNvTzNvTzNvb0ODg4ODg4ODg4NvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzODg4NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzODg4NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvX0NvXzNvb0NvTzNvTzNvTzNvXzNvXzNfXzNvX0 + Nvb0NfX0NvTzNvTyNvXyNvXzNvXzNvTyNvbzNvb0ODg4NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzODg4NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzODg4ODg4NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvb0NvbzNvTyNvXzNvXzNvXyNvTyNvTzNvTyNvTzNvTyNfXzNvXz + NvbzNvXzNvX0NvXzNvTzNvX0ODg4NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzODg4NvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNfXzNvX0NvTzNvXzNvX0NvXzNvbzNvXzNfXzN/bzNfXzNvXzNvX0NvXzNvXyNvb0NvX0NvXz + NvXzNvXyODg4NvXzNvb0NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzODg4NvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvb0NvXzNvXzNvXy + NvXzNvXzNvX0Nvb0NvXzNvXzNvX0NvTzNvTyNfXyNvXzNvXzNvTzNvXyNfXzNvXzNfTzNvbzODg4NfXz + NvXzNvXzNvXzNvXzNvXzNvXzODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4NvXzNvXzNvXzNvXzODg4 + ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4 + ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4 + ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4NfXzNvXy + NvTzNvXzNvXzNvbzNvXyNfbzNvXzNvX0NvX0NfXzNvb0NvXzNvXzNvTyODg4NvXzNvXzNvb0NvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzODg4NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvb0NvXzNvXzNvXyNvTyNvXzNvXzNvb0NfXzNvX0NvX0NvXzNvXz + NvXzN/TyNfTzNvX0NvXzNvTzNvb0NfX0NvX0NfTzODg4Nvb0NfXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzODg4NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNfXzNvb0NvbzNfTzNvX0NfX0Nvb0NvTzNvXzNvX0NfTzNvTyNvb0NfX0N/XzN/Xz + NfXzNvXzNfbzNvXzNvXzNvTzODg4NvXyNvb0Nvb0NvXzNvb0N/XzNvXzNvXzNvXzNvXzNvXzODg4NvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzODg4ODg4ODg4NvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzN/XzNvb0NvXzNvb0 + Nvb0NvXyNvTyNvTzNvXzNvXzNfbzNvXzNfXzN/XzN/XzNvXyNvTzNfXzNfTyNvTyN/XyNvXzNvTyNvX0 + NfXzNvXzODg4NvTzNvXzNvb0NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvb0ODg4NvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzODg4NvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvb0NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvb0NvXzNvTzNvXzNvXz + NfXzNvX0NvTyNvXzN/XyNvTyNfTyNvXzN/X0NfXzNvXzN/X0NfXzNfXzNvTzNfXyODg4ODg4ODg4NvTz + NvbzNvb0NfXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzODg4NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNfXzNvb0NvbzNvTzNvTzNvXzNvXzNfXyNvTzNfXz + NfXzN/X0NvXzNvbzNfXzNvTyNvXyNvXyNfTzNvXyNvXzNvTyNvX0NvXzODg4NvXzNvTzNvXyNvb0NvXz + NvXzNvXzNvXzNvXzNvX0NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzODg4NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvX0NvXzNvXzNvXzNvXzNvXzNvb0NvXyNvTzNvXzNvXzNvXzNvX0NvTyNvXzNvXyNfbzNvXyNvXyNvTy + NfXzNvb0NvTzNvXzNvX0NvXyNvX0NvXzNvbzNvX0NvXzNvXzNvXzNvTyNvXzNvXzNvb0NvXzNvX0N/Xz + NvXzNvb0NvXzNvXzNvb0NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + ODg4NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvb0NvXzNvXzNvb0NvXzN/XzNvX0NvXz + Nvb0NvXzNvXzNvTyNvXzNvXzNvXzNvX0NvbzNvXzNvX0NvXyNvX0NvXzNvTzNfXzNvTyNfXzN/X0NvTz + NvX0NvbzNvXzNvXzNvTyNvbzNvXzNvXzNvTzNvXzNvbzNvXzNvXzNvXzNvX0Nvb0N/XzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzODg4NvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzN/XzNvb0NvX0NvXzNvXzNvXzNvbzNvXz + NvTzNvXzNvXzNvbzNvTyNvXzNvXzNvbzNvb0NvbzN/X0NvXzN/b0Sfb0NvXyNfTyN/XzNvXyNvbzNfXy + NvXzNvTyNvXyNvXzNvXzNvXzNvTyNvXyNvb0Nvb0NvXzNvb0Nvb0N/XzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzODg4NvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzN/XzNvb0Nvb0NvXzNvb0Nvb0NvXyNvTyNvXzNvXzNvXzNvXyNvTy + NvXzNfXyNvbzNvXyN/XzNfTyNvXyN/b0NfXzgvn4N/TzNvXyNvb0NvXzNfXzNvXzNvXyNvTzNvbzNvX0 + NfTzNvXzNvXzNvXzN/XyNvb0N/b0NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzODg4ODg4NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzN/b0Nvb0N/XyNvXzNvXzNvXzNfTzNvX0NvbzNvTzNvXyNvXzNfXzNvXz + Nvb0NvXyN/TzNvXzWff0p/r5Nvb0NfXzN/X0NvXzNvX0NvTzNvXzNfXzNvXzNvXyN/X0N/XzN/XzNvXz + NvXzN/XzNvb0Nvb0NvXzNvXzNvXzNvXzNvXzNvXzNvb0NvXzNvXzNvXzNvX0NvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvX0NvXzNvXzNvXzNvb0NvXzNvXzNvXzNvXzNvXz + NvXzNvb0Nvb0N/XzNvXzNvXzN/XzN/XzN/X0NvXyNvXzNfXzNvXzNvTzNvX0NvXzN/X0NfXzNvb0PvXz + mPn4rfv6N/XzNvTyNvXzNvb0NfbzNfXyNfTzNvXyNvX0NvXzNvbzNvXzNvXzNvTzNvXzNvXzN/XyNvb0 + NvXzNvb0NvXzNvXzNvXzN/XzNvXzNvXzNvXzNvXzNvXzNvXzNvX0NvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvX0NvXzNvXzNvXzNvXzNvXzNvXzN/XzNvXzNvXzNvXzNvb0NvXzNvb0N/XyNvXz + NvXzNvTzNvXzNvXzNvbzNvXzNvX0NvXyNfTzNfXyNfbzNvb0NvXzNvTyN/Xzd/j2qvr6svv6UPf0NvXz + NfTzNvXyNvTzNvbzNvTzNvbzNvX0NvX0NvTzNvXyNvXzNvXzNvTzNvXzNvXzNvXyNvXzNvXzNvXzNvb0 + NvXzNvb0NvXzN/b0NvXzNvXzNvXzNvXzNvXzNvXzNvX0NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvX0NvXz + NvXzNvXzNvXzNvXzNvXzN/b0NvXzNvb0NvXzNvb0NvXzNvXzNvXzNvXyNvXzNvXzNvTzNvXzNvXzNvXy + NvTzNvX0NvX0NvbzNvTzNvbzNvTzNvXyNfTzNvXzUPf1qPv6r/v6uPv7mfr5QPb0Nvb0NvXzODg4ODg4 + ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4 + ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4 + ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4 + ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4 + ODg4ODg4ODg4NvXzNvb0QPb0mfr5rfv6tvz7vfz7q/v6ivr5OPXzNvb0NfXzN/TyN/bzN/XzNfTzNvTz + N/X0NvXzNvXzNvXyNvXzN/XzNvXzNvXzNvXzNvTyNvXyNvb0NvX0Nvb0NvXzNvb0NvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvX0NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvX0NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvb0NvXzNvb0 + NvX0Nvb0NvXyNvTyNvXzNvXzNvXzN/XzNvXzNvXyNvXzNvXzN/X0NvTzNfTzN/XzN/bzN/TyNfXzNvb0 + OPXzivr5q/v6s/z7u/z7w/z8sfv6qfv6c/n3N/XzN/byNvXzNvXyNvTzNvXyN/XzNvTzN/X0NvXzNvTz + NvbzN/X0NfTzNvXzNvTyNvXzNvTyNvXzNvXzNvb0NfXzNvXzNvXzNvb0NvXzNvXzNvXzNvXzNvXzNvXz + Nvb0NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvX0NvXzNvXzNvXzNvXzNvXzNvX0NvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvb0NvXzNvXzNvXzNvXzNvXzNvXzNvb0NvXzNvXzNfXzNvb0NvXzNvXzNvTyNvXz + NvTyNvXzNfTzN/X0NvbzNvTzNvXzN/X0NvTzN/XzNvX0NvTzNvXyNvXzN/byN/Xzc/n3qfv6sfv6ufv6 + wfz7yPz7t/v6r/v6qPv6Xfb0N/XzNvb0NvXzNvX0NvXzNvX0N/XzNvTzN/XyNvX0NvXzNvXyNvX0NvX0 + NvXzNvXzNvXzNvTyNvTzNvXyNvb0NvXzNfXzNvXzNvXzNvb0NvXzNvXzNvXzNvb0NvXzNvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvb0NvXzNvXzNvXzNvb0NvXzNvXzNfXzNvXzNvb0NvXyNvTzNvTyNvXzNvXzNvXzNvX0NvX0NvXy + NvXzNvX0N/XyNvTzN/XzNvX0NvXzNvX0NvXzNvb0N/XzXfb2qPv6r/v6t/v6v/z7xvz7zfz8vvz7tvv6 + r/v6pfv6VPf0NvXzNvTyNvb0NvTyNvXzNvXyNfTzNvbzNvX0NvX0NvXzNvTzNvXyNvXzNvTzNvXzNvTz + NvXzNvTyNvbzNvX0Nvb0NvXzNfXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvb0NvXzNvXzNvXzNvXzNvXzNvb0NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXz + NvXzNvXzNfXzNvXzNvb0NvX0NvbzNvTyNvXzNvTzNvXzNvTzNvXzNvXyNvTzNvXzNvX0NvX0NvbzNfTz + NvXyNvXzNvTyNvb0NvTyNvXzVPf2pfv6r/v7tvv6vvz7xfz7zPz80vz8w/v7vPv6tfv6rvv7ovv6UPb1 + NvXzNvb0Nvb0NvX0NvTzN/XzNvXzNvTzNvbzNfXzN/XzN/bzNvXzNvX0NvXzNvXzNvXzNvTzNfTzNvTy + NvbzNvX0Nvb0NvXzNvb0Nvb0NvXzNvXzNvXzNvXzNvXzNvb0NvXzNvXzNvXzNvXzNvb0NvXzNvXzNvXz + NvXzNvXzNvXzNvXzNvb0NvXzNvXzNvXzNvXzNvb0NvXzNvXzNvXzNvXzNvXzNvb0Nvb0NvXzNvb0NvX0 + NvbzNvTyNfTzNvTzNvXzNvXzNvXzNvX0NvXzN/bzN/XzNfXzNvbzNvTzNvXzN/XzNvTzNvX0Nvb0Nvb0 + NvXzUPb1ovv6rvv7tfv6vPv6w/v7yvz80Pz81/38yfz8wvv7u/v6tPv6rfv6ofr5Tvb0NvXzNvTyNvXz + NvTyN/TzNvXzNvX0NvbzNvXzNvXyNvX0NvTyNvTzNvX0NvXzNfX0NvXzNvTzNvXzNvXzNvTyNvbzNvXy + NvXzNvb0NvXzNvb0Nvb0NvXzNvXzNvXzNvXzNvb0NvXzNvXzNvXzNvX0Nvb0NvXzNvXzNvXzNvb0NvX0 + NvXzNvXzNvXzNvb0NvXzNvXzNvXzNvXzNvb0Nvb0NvXzNvb0NvXzNvXyNvbzNvTyNvXzNvXzNvTzNvXz + NfX0NvXzNvX0NvTzNvTyNvX0NvXyNvXzNvbzNvX0NvXzN/TzNvTyNvXzNvTyNvXzTvb0oPr5rfv6tPv6 + u/v6wvv7yfz80Pz81v392/39z/z8yPz8wvz8u/z7tPv7rfv6n/r5TPb0NvXzNvb0NvXzN/X0NfTzNvXz + NfTyNvbzNvXzNfXyNvXzNvXzNvTyNfXyNvb0NvXzNvXzNvXzNvX0NvTzNfTyNvXzNvTyNvbzNvb0Nvb0 + NvXzNvXzNvXzNfXzNvXzNvb0NvXzNvXzNvb0NvXzNvXzNvXzODg4ODg4ODg4NvXzNvb0NvXzNvXzNvb0 + NvXzNfXzNvXzNvXzNvXzNvb0Nvb0NvbzNvTyNvXzNfTyNvTzNvX0NvXzNvXzNvXzNvb0NfXyNvTyNvXz + NvXzNfXyNvXzNvbzNfTyNvXzNfTzN/X0NvXzNvb0NvXzTPb0n/r5rfv6tPv7u/z7wvz8yPz8z/z81f39 + 2/394P7+1P39z/39yf38wfz7u/z7tPv7rfv6ovv6Wff0N/XzN/TyNfbzNvTyNvTzNfXzNvX0NfTzNvbz + NvXzNvX0NvXzNvTzNvTzNvbzNvXyNvXzNfX0NvXzNvXzNvXzNvTyNvXzNvXzNvTzNvXyNfXyNvb0NvXz + Nvb0NvXzNvb0NvXzNvX0Nvb0NfXzNfXzNfXzODg4NfXzNvb0NvX0NvXzNvb0NvXzNvb0NvXzNvb0NfXy + NvXyNvTzNvXzNvXzNvTyNvXzNvXzNvXzNfX0NvXzNvXyNvbzNvTzNvTzNvXzNvX0NvXzNvbzNfTzNvX0 + NfXzNvTzNvTyNfb0N/TyN/XzWff0ovv6rfv6tPv7u/z7wfz7yf38z/391P392v393/7+5P7+2f381f39 + zvz8yPz7wfz7u/z7tPv6rvv6p/v6Zvf1NfXzNvb0Nvb0N/XzNvbyNvbzNvXzNvXyNvTzNvXyNvXyNfXz + NvXzNvXzNvTzNvbzNvb0NvX0NfXzNvXzNvXzNvTzNvXzNvTzNfXzNvXzNvTzNvTyNvbzNvXyN/bzNvXy + Nvb0Nvb0NvXzNvXzNvXzODg4NvXzNvb0Nvb0NvXyN/bzNvXyNvbzNvTyNvTzNvXzNfXzNvTzNvXzNvTz + NvXzNvXzNfXzNvX0Nvb0NvbzNvTzNvXzNvXzNfXzNvXyNvXyNvTzNvXyNvXzNvbzNvbyN/XzNvb0Nvb0 + NfXzZvf1p/v6rvv6tPv6u/z7wfz7yPz7zvz81f392f383/794/7+5/793v382f381Pz8zvz8yf38wvz8 + vPz7tfv6r/v6p/r6c/n3N/XzNvTyNfTzNvXyNfX0NvbzNfXzNvX0NvX0NfTzNfbzN/XyNfX0NvX0NvXz + NvTzNfXyNvb0NvXzNvX0NfX0NvXzNvTzNfXzNvXzNvX0NvTyNvXzNvXzNvXzNvXzNvXzNvTyNvTzNvXz + NvXzODg4NvTzNvTyNvXzNvXzNvXzNvXzNvXzNvTyNvX0NvXzNfXzNvTzNvXzNfX0NvX0NvXzNvb0NfXy + NvTzNvXzNfTzNfX0N/XyNfbzNfTzNvX0NvX0NfXzNvbzNfX0NvXyNfTzNvTyN/Xzc/n3p/r6r/v6tfv6 + vPz7wvz8yf38zvz81Pz82f393v394v395v396v794v393v382f381P39z/39yPz7w/z8vfz7t/z7r/v6 + qfv6ivn5Qvb0NvXzNvTyNfXzNvTyNfTyNvTzNvXzNvXyN/TzNvTzN/bzN/X0NfXzNvXzNvXzN/bzNvTz + NvXyNvXyNvXzNvXzNvX0NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvTzNvXzODg4NvXzNvXz + NvXzNvXzNvXzNvXzNvXzNvXzNvXzNvXzNvX0NvXzNvXzNvX0NvXyNvTzN/bzNvXzNvXzNfXzN/X0N/bz + NvTzN/TzNvXyNvXzNvTzNfTyNvTyNfXzNvTyNvXzQvb0ivn5qfv6r/v6t/z7vfz7w/z8yPz8z/391P39 + 2f393v394v395v396v7+7f7+5v394v393v382v791P38z/z8yfz8xPz8vvz7t/v6svz7rPv6oPv6W/f0 + NfXzNvb0NfTzNvTyNfX0NvTzNvXzNvXzNfXyN/XzN/b0NfXzNvX0NvXzNvXzNfXzNvXzNfbzNvTzNfXz + NvXyNvb0NfXzNvb0NvTzNvX0NfXzNvXzNvXzNvXzNvXzNvX0Nvb0ODg4NvXzNvXzNvX0NvXzNfX0NvX0 + NvTzNvb0NfXzNvb0NvXyNfXzNvTzNfbzNvXzNfXzNvXzNvXzNvX0NfXzN/b0N/XzNfXyNvXzNvXzNvTz + NfX0NvTyNfTzNvb0NfXzW/f0oPv6rPv6svz7t/v6vvz7xPz8yfz8z/z81P382v793v394v395v396v7+ + 7f7+8f/+6v7+5v394v393v792v391f380Pz8y/38xfz7v/z7uvz7s/v6rvv7p/v6ffj3PfXzNvXzN/b0 + NvXzNfTyNvXyNvTzNvXzNvXzNvX0NfXzNvb0NvbzNvXzN/X0Nvb0NvXzNfXzNvXzNvXzNvbzNvTyNvbz + NfXyNvXyNvb0Nvb0NvXyN/X0NvXzNvX0Nvb0ODg4NvXzN/X0NvXyNvb0Nvb0NvXyNfXyNvbzNvTyNvbz + NvXzNvXzNfXzNvXzNvb0N/X0NvXzNvbzNvb0NfXzNvX0NvXzNvXzNvTzNvXyNfTyNvXzN/b0NvXzPfXz + ffj3p/v6rvv7s/v6uvz7v/z7xfz7y/380Pz81f392v393v794v395v396v7+7v7+8f/+8//+7f7+6v7+ + 5/7+4/793/792/391v380f38zPz8xvz7wfv7u/v7tvv7sPv7qvr5mvn4X/f1NfXzNvTyNvTyNfXzNfXz + NvX0Nvb0Nvb0NvXzNvX0NvXzNvbzNfbzNvXzNvXyNfXyNvX0NfTzNvXzNfTyNfXzNvX0NvTzNfTzNvTz + NvbzNvTzNvbzNvb0NvTzODg4NvbzNvTzNvbzNvTzNfTzNvTzNvX0NfXzNfTyNvXzNfTzNvX0NfXyNvXy + NvXzNfbzNvbzNvXzNvX0NvXzNvb0Nvb0NvX0NfXzNfXzNvTyNvTyNfXzX/f1mvn4qvr5sPv7tvv7u/v7 + wfv7xvz7zPz80f391v382/393/794/7+5/7+6v7+7f7+8f/+8//+9f//8f/+7f7+6v795/795P7+4P79 + 2/391/380vz8zfz8yfz8w/z7vfv7uPv7svv6rfr6p/r5jvr5S/b0NfXzNvTyNfTzNfbzNfXzN/X0Nvbz + NvTzN/XzNfXzNvXyNvX0NvTzNfTzNvbzNfXzNvbzNvX0NvX0Nvb0NfXzNvXzNvXzNvXzNvX0NvXzNvX0 + NvX0ODg4NvXzNvX0NvXzNvX0NvXzNfXzNvb0NvX0NvX0NvbzNfXzNvbzNfTzNvTzNvX0NvXyNfXzN/Xz + NvTzNvbzN/X0NfXzNfbzNfTzNvTyNfXzS/b0jvr5p/r5rfr6svv6uPv7vfv7w/z8yfz8zfz80vz81/38 + 2/394P7+5P7+5/796v797f7+8f/+8//+9f//9///8/7+8f7+7v7+6/7+6P7+5f7+4f793f792P390/z8 + z/z8yvz8xfz7wPv7u/z7tfv6sfv7q/v6p/v6e/j2Q/b0NfTzNvb0NvTyNvbzNvXzNvX0NvTyNvTzNvXz + NfbzNfXyNvX0NvXyNvX0NvbzNvbzNfTzNvb0NvXzNfbzNvbzNvbzNvXzNvbzODg4ODg4ODg4NvbzNvXz + NvbzNvbzNfbzNvXzNvb0NfTzNvbzNvbzNvX0NvXyNvX0NfXyNfbzNvXzNvTzNvTyNvX0NvXzNvbzNvTy + Nvb0NfTzQ/b0e/j2p/v6q/v6sfv7tfv6u/z7wPv7xfz8yvz8z/z80/z82P393f794f7+5f7+6P7+6/7+ + 7v7+8f7+8/7+9f//9///+f//9f/+8/7+8P7+7v7+7P7+6f7+5v7+4v793v392v391v390f38zPz8yPz7 + w/z7vvz7uvz7tfz7r/v6qvv6pvr6fvj3TPb1NfXzNfb0N/byN/TzN/bzNfXzNfXyNvTyNvbzNfb0NfXy + NvXzNfXyNvX0NvX0NvXyNvX0NfTzNfXzNvbzNvb0NvbzNvb0Nvb0ODg4NvbzNvb0NvbzNfXzNfTzNvX0 + NvXyNvX0NvX0NfXyNvXzNfXyNfb0NvbzNvTyNfXyNfXzN/bzN/TzN/byNfb0NfXzTPb1fvj3pvr6qvv6 + r/v6tfz7uvz7vvz7w/z7yPz8zPz80f381v392v393v394v795v7+6f7+7P7+7v7+8P7+8/7+9f//9/// + +f//+v//9/7+9f7+9P//8f7+7/7+7f7+6v7+5v7+4/7+3/392/391/381P38z/z8y/38xvz7wfz7vfv7 + ufz7tPv7r/v6qvr6p/v6ivr5V/f1NvXzNvXzNvb0Nvb0NvXzNfXzNfXzNvX0NvTyNvb0NvTzNfbzNvb0 + NvXzNfXzNvXzNvbzNvbzNfXzNvXyNvX0NvX0NvX0NvXyNfXzNvbzNvbzNvXzNfXzNvXzNvb0NfbzNvTz + Nvb0NvTyNvX0NfXzNfbzNvXzNvb0Nvb0NvXzNvXzV/f1ivr5p/v6qvr6r/v6tPv7ufz7vfv7wfz7xvz7 + y/38z/z81P381/382/393/394/7+5v7+6v7+7f7+7/7+8f7+9P//9f7+9/7++P//+v//+///+P7++P// + 9v//9P7+8v7+8P7+7v7+6v795/395f7+4f393v792v391v390v38zv38yfz7xfz8wPv7vfz7ufz7tPv6 + sPv6rPv6qPv6mvv6cff2Tvb0NfXzNvXzNvTyN/b0NfTzNvXzNvXzNvXzNvXzNvX0N/X0NvX0Nvb0Nfb0 + Nvb0NvbzNvTzNvTzNvb0NvTzNvTzNvbzNvb0Nfb0Nvb0NvX0N/X0NvX0NvXzNvXzNvXzNvXzNfTzN/b0 + NvTyNvXzNfXzTvb0cff2mvv6qPv6rPv6sPv6tPv6ufz7vfz7wPv7xfz8yfz8zv380v381v392v393v79 + 4f395f7+5/396v797v7+8P7+8v7+9P7+9v//+P//+P7++v//+////P//+v//+f//+P//9v7+9f7+8/// + 8f7+7v7+7P7+6f7+5v394v393/393P392P381Pz80f39zf38yf38xfz8wfz8vfv7ufv6tvz7svv7rvv6 + qvr6p/v6l/r5b/f2UPb1OPTyN/XzNfX0NvTyNfTyNvTyNfb0NvXzNfXzN/XzNvXzNvXzNvXzNfXzNfXz + N/b0NfXzNfXzNvXzNvXzNvXzN/XzNfXzNvXzNfb0NvTyNfTyNvTyNfX0N/XzOPTzUPb1bfn3l/r5p/v6 + qvr6rvv6svv7tvz7ufv6vfv7wfz8xfz8yf38zf380f391Pz82P383P393/394v395v396f7+7P7+7v7+ + 8f7+8///9f7+9v7++P//+f//+v//+////P///P//+/7++v7++f//+P7+9///9v//9P//8f7+7/7+7f7+ + 6v7+6P7+5f7+4v793v392/791/381P390P38zf38yfz8xfz8wfv7vvz7u/z8t/v7tPz7sPv6rfv6q/v6 + p/v6ovr5hvj3a/f1Ufb1OvXzNfXzN/XzNvXzNfTyNvb0Nvb0NfTyNfb0N/TyN/b0N/b0N/b0N/TyNfb0 + NfTyNvb0Nvb0NfT0NvXzN/XzNfXzOvXzUfb1a/f1hvj3ovr5p/v6q/v6rfv6sPv6s/v6t/v7uvv7vvz7 + wfv7xfz8yfz8zf380P381P391/392/793v394v795f7+6P7+6v7+7f7+7/7+8f7+9P//9v//9///+P7+ + +f//+v7++/7+/P///P///f///P7+/P//+///+f7++f//9/7+9v//9P7+8v7+8P7+7v7+7P7+6v7+5v39 + 5P7+4f393v392v391/391P390f39zfz8yvz8x/z8xPz8wPv7vPv7ufv6t/z7tPv7sfv6rvv6rPv6qvv6 + p/v6pfr5l/n4ivn3dff2Zvf1Wff1Svb0S/b0S/b0Qvb0NvXzNvXzNvXzQvb0S/b0S/b0Svb1Wff1Zvf1 + dff2ivn3l/n4pfr5p/v6qvv6rPv6rvv6sfv6tPv7t/z7ufv6vPv7wPv7w/v7x/z8yvz8zfz80f391P39 + 1/392v393v394f395P7+5v396v7+7P7+7v7+8P7+8v7+9P7+9v//9/7++f//+f7++////P///P7+/P7+ + /f///f7+/f///f///P//+///+v//+P7++P/+9v7+9f7+8/7+8f7+8P//7v7+6/7+6f7+5v7+4/394f7+ + 3v392v382P391f390v39z/z8zPz8yPz8xv38w/z7wPz7vfz7uvv6uPv6tvv6s/v6svv7r/v6rvv6rPv6 + q/v6qfr5qPv6qPv6p/v6pvr6pvv6pfr5pfr6pfr5pvv6pvr6p/v6qPv6qPv6qfr6q/v6rPv6rvv6r/v6 + svv7s/v6tvv6uPv6uvv6vfz7wPz7w/z7xfz7yPz8zPz8z/380v391f392P392v383v394f7+4/395v7+ + 6f7+6/7+7v7+8P//8f7+8/7+9f7+9v7++P//+P7++v//+////P///f///f///f///v///v///f///f// + /P///P//+/7++v7++f/++f//9/7+9v//9f//8///8f7+7/7+7f7+6v796f7+5/7+4/394f393/792/39 + 2f391vz81P390Pz8zv38zP38yPz7xvz7xPz7wfz7v/z7vvz7u/v7uvz7uPz7t/z7tfv7s/v6s/v7svv7 + sfv7sPv6sPv7r/v6r/v6r/v6sPv7sPv6sfv7svv7s/v7s/v6tfv7t/z7uPz7uvz7u/z7vvz7v/z7wfz7 + xPz7xvz7yPz7zP38zv380Pz81P391v382f392/393/794f394/395/7+6f7+6v797f7+7/7+8f7+8/// + 9f//9v//9/7++f//+f//+v7++/7+/P///P///f///f///v///v///v///v///f///f///P///f///P// + +///+v//+P7++P7+9///9f//9P7+8v7+8f7+7///7f7+6/7+6f7+5v7+5P794v393/393f392/392P39 + 1v391P390f39z/38zP38yvz8yf38xvz7xfz8w/z8wvz8wPz7vvz7vvz7vPv7u/v7uvv7uvz7ufv7uvz7 + uvz7uvz7ufv7uvz7uvv7u/v7vPv7vvz7vvz7wPz7wvz8w/z8xfz8xvz7yf38yvz8zP38z/380f391P39 + 1v392P392/393f393/394v395P795v7+6f7+6/7+7f7+7///8f7+8v7+9P7+9f//9///+P7++P7++v// + +////P///f///P///f///f///v///v///v///////v///v///f7+/f///f///P///P//+/7++v7++f7+ + +P//+P//9v7+9v//9P//8v/+8f7+7///7f7+6/7+6f395/7+5f394v394f793v393P392/392P391v38 + 1P390vz80P38z/38zf38zP38yvz8yPz8yP38xvz7xfz7xPz8xPz7xPz8w/z7w/z8w/z8w/z8w/z7xPz8 + xPz7xPz8xfz7xvz7yP38yPz8yvz8zP38zf38z/380P380vz81P391v382P392/393P393v394f794v39 + 5f395/7+6f396/7+7f7+7///8f7+8v/+9P//9v//9v7++P//+P//+f7++v7++/7+/P///P///f///f// + /f7+/v///v///v///////////v7+/v///v///v///f///f///P///f///P//+///+v//+f//+f//+P// + 9v//9f7+9P//8v7+8f7+7/7+7v7+7P7+6f396P795v7+5P394v394f793v393f392/392v392P391/39 + 1f391P380vz80f38z/z8z/z8zvz8zfz8zPz8zP38zPz8zPz8zPz8zPz8zPz8zP38zPz8zfz8zvz8z/z8 + z/z80f380vz81P381f391/392P392v392/393f393v394f794v395P395v7+6P796f397P7+7v7+7/7+ + 8f7+8v7+9P//9f7+9v//+P//+f//+f//+v//+////P///f///P///f///f///v///v///v///v7+//// + /////////////////v///v///v///f7+/f///f///P///P7+/P//+///+v//+f//+f//9/7+9v//9v// + 9P7+8v7+8v//8P7+7v7+7f7+6/7+6f7+6P795v795f794/394v394P393/393v7+3P392/392v392f79 + 1/381/391v381f381f391P391P391f391Pz81f391P391P391f391f381v381/391/382f792v392/39 + 3P393v7+3/394P394v394/395f795v796P7+6f7+6/7+7f7+7v7+8P7+8v//8v7+9P7+9v//9v//9/7+ + +f//+f//+v//+////P///P7+/P///f///f///f7+/v///v///v////////////////////////////// + /////v7+/v///v///v///f///f///P7+/P///P///P//+///+v//+f//+f//+P//9v7+9f//9f//8/7+ + 8f7+8f7+7/7+7v/+7f7+6/796f396f7+5/795/7+5f7+5P7+4/794v794P393/393/393v393f393f79 + 3P392/392/393P393P393P392/392/393P393f793f393v393/393/394P394v7+4/795P7+5f7+5/7+ + 5/796f7+6f396/797f7+7v/+7/7+8f7+8f7+8/7+9f//9f//9v7++P//+f//+f//+v//+////P///P// + /P///P7+/f///f///v///v///v///v7+/////////////////////////////////////////////v// + /v///v///v///f///f///P///P///P///P//+///+v//+f//+P//+P//9///9v//9f7+9P7+8///8f7+ + 8f7+7/797v7+7v7+7P796/7+6v7+6f796P795/795v795v7+5f7+5P794/394/7+4v794/7+4v394v39 + 4v394v394v394/7+4v794/7+4/395P795f7+5v7+5v7+5/7+6P796f796v7+6/7+7P797v7+7v7+7/79 + 8f7+8f7+8///9P7+9f7+9v//9///+P//+P//+f//+v//+////P///P///P///P///f///f///v///v// + /v///v///////////////////////////////////////////////////////////////v///v///v// + /f7+/f///f///P///P///P///P//+///+v//+f//+P7++f//+P//9v7+9f7+9f7+9P7+8/7+8v7+8v/+ + 8f/+7/7+7v7+7f7+7f7+7P796/796v796v7+6v7+6f796f7+6P796P7+6P7+6P7+5/396P7+6P7+6P7+ + 6P796f7+6f796v7+6v7+6v796/797P7+7f7+7f7+7v7+7/7+8f/+8v/+8v7+8/7+9P7+9f7+9f7+9v7+ + +P//+f//+P7++f//+v//+////P///P///P///P///f///f///f7+/v///v///v////////////////// + //////////////////////// + + + + + iVBORw0KGgoAAAANSUhEUgAAARUAAABWCAIAAABuN5XDAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAASdAAA + EnQB3mYfeAAALWZJREFUeF7tnfuPJNd138n8TyvSNiQIMSDBtCHEgJNAMIQAgmEESKIgCIIktBMBUeAf + iFAGlAB2nMQOaYoUl6ReJHdtSUvxqdeSS1rSkhIpSqQs8xVZj92e6Znurpp8zvnee+t23arq6p7u5VJq + orCc6am6dev0/dY553se98aTk5Mb9v/tJXBDWAashxtvlDjyhcHPdvhf+TP/r+MJ4U832FUnN4TP7Vp+ + 0VUaj1/tyvirfRJGCze78YYbOZt/4725Ez/rav/hxn9g/9rY+jz86Ub/PI6W/0kP4gOe3OAzbz7Zzndu + Itn/90stgRowxKM6OeFYZMf85GR2cnJ8cnLkx/Tk5LCuD+p6cnJyta5/zlHVP63rn3BU9Y/r+v/V9VtV + /WZVv1HVr1f1a7Udf1fVP6qqv63rv63qH9q/1Q/zI/ucE37E+X4VByMwzpuMycg+vm7EHe3WPocJ82FW + PjdNktkyZ2aeP4geLX/YLXzr/krZ//dLKYG6biOnrjuRY+CpaxYoyxTkBNjULOITVvPfV6zsiiUOZl5n + xfvq/1HlUKmqV6rqB358v6peruqXq+p7VfWSH/ygI/5qf+XgTF3ySs0INagTosASg7/Jvbgj9/W7ByAx + qzg95ikItVHkT7eEIpfAqf7b4+dU4nsnXxzAU9daUqZ2In6Szjmua1M4rnN4zV85OblS1z9zJfD3rmqk + Z16r0DCVtIoBpq7BgIDxYlV/d1G9UFUvLKrnF9Xlyo5v+3F5sbB/m1/5pHrez3yBq+xah5mPZnDy8YEl + 2gzV9AZ39zkwE+bzM58bB4pRE2bmSyiKT2cP60+dXh+bf417/Gwuu3folaXacTtHZluDHH+Lm6l2cmLI + cXtJdtqPXQOwfF+rKqwyVMSrQb0IMNV3wIDBo/r2YvHNRfU3i8WzflxaLJ5ZLJ5eVE/bv/kRPuGvnOMn + 21VcK4AxGmMKTq6g7I5gCb0EdN9w7SfTTuoInCejrtRFetLtKKI9ft6hKNh42h1qxzXPvK5ndR38HLfW + OCa1vdRxM1iXpnB8pb5eVWibBBvpme+46hBgnltUAOAZx8k3FouvLaqvzRdfmS+eWiyenC+e9H+fWMTD + f06fP8WZnG9XcS0j2DiM9hwj2/h2F7Ak8y8Bya07m5upI5/tz5k58/dXgCw6TFDUKc+Y/KItKKL18HP1 + YPrs89/Xcd/5r6Tj9bd+uvH3ub/wGkqg5AkatVPXrDAxBEYPSOck5LixxMveFY5ZU+gBg03lsKlQF7bK + HTDV1w0DhhaA8fh88eh88Ygd8y/N51+cz78wX3xhPv9r+1eHfuZz++uXwsmLR7nWRxCivh7h9Cz38jsm + IDET5gOeTR0loy6gKFh0aNFpfMBELXQoonW/i1H4AS23/N5/HTg4Yd0b78+/5hLoINmC2nE/Ibo6LDUx + BKZzKiO+pHNwb16talYqsPnuYiFtg6q5BGzmC2kY1Mhj88WXHS1fdHj81Xxxfj5/eDZ/cG7H5+fzz83m + n53PPzubf0aH/8wnn/O/PuhnPmxX2bWMwDjAjzEZmfG5CwoNvYSl91zUSDhLL/ncsOvgG5xmsJmjM00X + 8UTOLjROUamINnOHRuEHPTOMn2u+FPY3XEsCJUO9rHacXnNW2pBzciKGwOgBd3JYkebhLIJvg0PyTfdS + 0DYsZRb0E65kLszmX5jN/2o2P+cY+LzD49Oz+f2z+X3Hs3tn80/5cc9sdvdsfvfx7JOz2Sft3/nd/sk9 + 4QQ78z6/imtBF+MAKsZkZOB0we/FHdFv2HgACY2EacessCHxkb7vs2XOSRf9xJ+INwJPxzOaOeeaNldE + G7Lbo/Bz/rFLt97+SY6PfOz/lED68H/8H2t9mfuTr60ElhweOKhEsrm3E9RONNiEHHzxt6qK9Ye1Jm6A + dYkT73aacQB4NV81p2X+KBbXzAwwlMxDM9MtAsxZ8AA2jo7/ZHp82+H03x1Mf/9g+sHJ4S2Tw9/04x9e + PXiXDn7WhweHt3AOZ3I+V3GtowtcMZrghI56iHvZHc0a5O4YeMyE+TwT7TrmaShi5j5/ngJFJHaBpwsE + ndg5l4C5Q1Esa/Nyo/CTf9+lLvqjP33g2i6I/d3GS6DXZvPVE+KhzlYFg81XG9waHDF+Dg76S84+47hj + qoEc/JCn5nNMqUcWWFZzrCxggwH2gCsNMHPn9OiPDqb/4uDwt68e/OrVgzNXD24CJFcmZyaHQEU/nLky + uWlyGA7/mU/CCZMJl4ArruKHX2UcRmNMRnYscRfuxR1RcYAWjYSt+Ji7W193ssGMOkN7jZ3J/AnXwi7w + RLk5J47bPCKXQ5tUGG/LrY2fJy4+31JBIGr897k/c2MJIGdZAX9+/4Vxg3RmFTT5BLLZorcjtUN0EoNN + DMH3FlhEFqKBG2BdGnIWOCFz7DQUzjm3rD49m0nV/Mnh9F8fHP6jK5ObWfqTA/BgUOFfsOF4CECKaodf + AYxAohN06BO7qhlB105uZvzp8b/iXm4Ect9Pm8u0wLRDHV1gbjZD5lmZLmLmzN9pOmcXTBElmluJC8GW + KyKtLVtuSNhr46fUPyBq3Ne5P+tUEgA5enN94s6HRwzUCx5/6Sq2I5LNbDa87aqy1AEnCWSwEe6EjL40 + DzrHPJz54q9nZqfx+segwpn5s8Ppv5kcfkCL3tHCQs/x8K4JYDBEmfIBFfx7lWNih/3sP/BJ+ms6PwMV + 5xjYGF9Q5I7cl7v7HJgJ88GuA9UXMOqiLoLYwC+C5yCGK3OOpyOJAUW0ZMsV7lA7OjQg7bXxg7XW0j8v + vfLaiK9zf8qpJEDkIIl9hMLvB4+5ztgtiormNhuvZxg2o9cw2Dz0CR990fku0zm2Og05n4kK57aD6T+N + DowjISiZMwDAgSRgOGDCnxw59uuZKwaqcPCzwS/8SZrKL0dx+Tg2Wjgn/CmO+S7mcDy7LaojyAZHkc0W + CxPW+6I/BYoIExRzjsQI8QpLtpwrIuXO5Vlzo7TQ2vgpKYRTrYv9xeMkAIWT8LMqWjBkttUY/SGHLVEF + Cuy4txPUDsaPKGloLrhjfAwIaMi0sxBl06P/fHD4W64EzlwxbXPTVTfDrrjN5prEfjZ1xDkOEqHF9ZLh + RCpI7tDNN9+cPrG/omfi+f5DHAcsOZD8E362+3J3Nw7PMB9m5SQeRt1nmK3PmZnDLoijI2Tkiih4RLkt + hxzEbivfZz0IrY2flvLBqBi3APZnnUoCyXhD/gPR6iw3J8+kTj6PYqMK74ihFlWAzUYUEm/nW05MfwN2 + 2NitxRdnhGKMVTNu4PDoDyaHv+6mlC1l1yQOD9lgIMSR0wAmmGpRBTkGdBX/ghz9lz7xv0blA9gEswgn + Q45cKfOspJHshKjruMuvM0NxDD5nUATDIXMOgo7n+pYFfOuXIbgjqYAEkINR2ysh1Jlsuh5+ykDqOFv8 + VEtnf3Eu9n/ykf82KBBTPnXMB11OaXPw4DefsFwsMOrpzCRKk5fpNhupN8ZNkz3whJlAFm/5/Gz2wPEM + euDj8MumZAwqWsfgBM0j5Ej/SMnohGCSBSNNvybCWrS1H4YfXRj/dc0W/prGsTEdM8HYMzpB6HK+wSw9 + n5td+5vMljkzc+bPUzi1gCKC/+Dp8OjMlqtrkrt5drlDpHKT79MLIZentHr7v/Xwk1sRUkQjbPH9+j+t + BHLlM6jwHTwhn1qVCMuaJ4LHHQCWDrnMcnigCmSzfcW4acujgV777PHs7NHxnx1M/5mQowXqyAnWV7Po + o+pgfUsFiUWAgtP5AVfSWpEw4Iegf9LnESd+R2kbKTTDp1Rc0ntykwQ2TSxNkjkzc+bPU/iz8ETuES2e + djoRW87yFdwd4iUyAkJNvvbSt7kefkrybZUtftqls7++FTDoJ68bt2e5DCGmtAXwYK5YbNQTxszhoabA + 03CgCsg0I02GHAJCKwQr75ke/aerB+/2ZRpiOLaIAwkWVm3g00Sy5VRBNK7MxJJ2UvzHzwz6R/6Pf5Kf + 4KZaYyIm+sGhYtcGl0nI1GGukeAaZsvMmT9P4c/yoHtEPB0EN6QCMSLyFcTLidp2Um5JCzV0Qiwc6qh3 + WA8/+YtQ+mefObpThMNtYrDlPmenwm+5PR5NN83jGZNLZlsCz8I8acDjPJvZNqSWPTKzeChRHRjh/zuZ + /q5MKZlGhHQSctyJt+hn0C1hEbu6cNIsmHNutomIiyoixXncQov4yUy4oKwciu5oSbc4ldfweMHYUwQJ + 7EXj0OcpIzOMMP1dnoUn8ufi6Qj7kgDO8xovhwScNUkQagw5ZykNQp4iuMRo547QevhpfZerbPGdLq1f + /MFL8ACkHoWvV2NWCReLrlNWmydTBs0DeBYVOZfERp+1dEzj2eB8yYuBZLv3+Pg25dfIYFMcU+Bx/SPf + g5BOiHU6bOxDN94CQhrNkFRE6wcfUPpn4EjjBOfHbx3Plw/m84GOS4oo+kKKF/EsPBHP5dQcEJI79DWe + 3SWAHJYhFDPlVMdamyQTftqO0Br4yUMQeiPmtnirooHXJM7SVkJD3JehsFsUfU8Htzh96HYXgzMmE2N6 + xMrKOSMTTkiP0/cIXN56W0nmXa+NTrdHlTxew1P/rBJh4GabwGPheYrVLKuAEgNy2Jyhnt0zPf639kb3 + V7jbWoEMkLsv8uCKZxiEle2csiw3PydQZCGME0C4hJCGrxN+gmfVPiciJ0A33dGVUlSG5h3ZfEQhhEmK + JZfLFLB0E8/F0/kLAl7uS1YcYc9OEvcShJxW4UVDNatyfFR+15QMZYWr9lWsgZ+SfGMRYL/xb+c3re+b + 7FJW/2bKgjuW4doWgc6tN+MwdjE40oCQHM5V56+5uHLhqLyKx0FofYO0AJl+femVH8V2GdgblttWhwyD + QFU722aEgWsefB4SC4jw4FVDUhMYNYeH3M1AfxkeCLAEulluT1QvjbEUwjjBfQ9+iLyRQLgJGzLDSCDI + iAfpkOD/RNdI5wTnJ2YbBLsx+l2JwIjsn4BnaEnzlI9k83evTLYcT+fsNk9KmJWyCJ4d3XvJS2W/KzrB + pZRIbcoHydKwwrscQuLiZMWtgZ+SPCCWmi8FflZ2Vhlj5ZO1dBELsfS1wJJ0TonYtcbf0eAt+YAB5smH + QAKQgKvOt0xuj62sExlA5mtvkr0W3B5/ZXqc1KpHKYDhT8R5KC+DbcPiN7PNq9wMPJ5VANV752T6Qdc8 + 9i6PKiIyaVG9BGwkSCSF42CI+TUJbFEv6fKkowKdbYyZ4ycQ1s058fxAu0XkNOPH+wpsIQkoMeDuswWP + S8Eiz1g1LE0/yJPyvJ6pYBBCDtGQexH5uJSQFRKjO8oVZJjiqnKElrmEdfAz8GYtlQzLonSWRkKI1da6 + FuS0iApe1S3VxCVjxt/R4EAlLW5m0qlymfNw9kaqE5FWKbUQn3Tpn7tuvf0uKR9PJRZngO1BnJTgOtYI + GQbkIFucxzUPhAHvXcy2AJ7j2V9MLKUgLfGQw2Zujy/l5KArAyClzwS/Xw6S8BMTCzKXJoZEHWP5tU0I + Nfu8TeIllSVGTiRbip/GMUP2g2AsG9JzvR3w7ialpzv8LZ43QcirXJEGvhCMnOJCyAqJyYojKGRVdy5V + OULmCyUrbg39UyqElM7IyigttNL9ZWF1nplfmy9EjT9g/rUgxPIaHn9Hg+cU8zCMmV6OCuA0YNmWAi+c + pUQbpGiPek3lSQYws/CzlPEAnueNqiZCOn98NpfZRnj0Dk8ATavTGQK9ywN4miSDGOhMTk5UO4EoiwgM + JlPGtgVqO7pJ+a8hgBOJh+xPWvRBccXJBOsusgU+VYeojMwmzBrSFxxCIfc0MgofOJ5ByqF1kQAvESCE + LwSpbXEhz06IjPYyl1BacWvgp9N4GPZtynjrcLFQqeKGx2c5tjTVQD7E7gbPIbHS2cuNtGFplPbesoJd + 4txEWHs1ixKr5fYoTgo/SzECGQaA5xvUnM2s6I3EHDyBOykKSMs0BDoVYwkZOkZVi/JaotREMIQkgF7Y + tBRO+WtSU7le6jwtB5KwHZIhGr8oJfWYqeZ5CSlaZRxdHvblqXl2lwDECaV4MHLk+BAHIzvhe141pLiq + snuQJ/rcsuNczonnrMfiB/OpxM+YQpTSCOkLuZZgGzN+iYrOkNTuBm/FN1cyJTkNM8B8lGxnQb4tKZ9k + ubnyCW6PlySQVQ0/S24b6TlkGBAkJc5DzQxM1Ccn09+R5gkpbcEFF38Vl6MzBwFRgRuIplpjdy3VLGTG + Wwc33YLKAKh6xolZ2AlFcVYZyZ74QDlIIX0hf9LD6e8ggbnJ4Zwnm5ImR0U6JQ9UDVEEjtyQnjtCJk/L + 0W5ZcdbEeOX3rRPKsrmRZdulydSpInizlsTaSmOvc2Il6nY6eMvpXynP/E00wL+XbOeysRfAEz3aeW2R + imS5BbfH+7MZZ+Bs9TNejPBlwogOnk9NDj8keirpFtcwiuRYxY77EhmQEkngiGo5KktO0bINNgynlX/t + GTmgKHBuy1ooZsopZc4DRPGJggnq1Nzh4Ye8gghpEBciO4EEH3Lk4FdgWZAbXEJwhELvBCTsdHYiEsbi + p6SGRmaOlsDrjLqWjvVIVnrVOrP1vNPBW17KymnnEx7I3lgl8FaeG5Zbaj0VLDeP9pjbs1gYZyC2mlJN + 71Jwb4jzKDEn0tMCT8iRSQmaiRvIGDYxwlr6pT4ZVillaHUg2Lpq8IbMiOyCVGWe3upPlCAU1akVXxx4 + XMhCq8iE8jsx2vArxiW49BpHKCZoK68nEAlj8VPGYVYuFL2JO3tftRRLaVyhi8Yon77xcyWw08G5Uenl + owAHJp8EMpy9UertTODdtIF/wfBFKB9ahNJxilApVQkUw5EbinFPkgGMLb1s6IZz29WDm4UBJ6zdYQi8 + Vojux0yCFOxX+U3I18x9+tUKRObf6GN17kKGW0+KC5l1OcEd+i7EmwYI2bvAntfpbGHvZq/Auw/JIB9P + TaCFHfVCyA3p4TqaFYdUYxOspYjqWPyUr/CRmaOd+GldW/pI48uKVo6/08HBTx+tr2gV0xv5ImgZfiUs + M6G18NNJG1Cr7JabZbhh1uP2kKGD2wPh9j8nh+8VABKD/Mv5QyRO3otMjNGmqYNl97gjZFEys+Kczu4g + EqSCxuKnJA9GZo52vv5z/HQCYKRy69M/afydDj6gYFviAsPAbK1so36B9ykfaDfRBnTZVT0prTMgrC3a + 462eqOdxt2dqhFtwqfOCgkQBJ0WRApeZ6sg1j/KyW8dI7TFeHbWpv6RSxApmwVmNmXLwsoTXkMMaSPn4 + 1Erw4ZKDKXScOUJeL0TJnSJC0NnGxbkVR1KCEQmtpJ5R+ClX4fjM0c6Yeo6f0lDpz5LscM6Hx9/p4Gk2 + fZGxEgMAaYzeLtnOTOBdyocYX+hnoGgptAFJbvQTpFyMwgSz3LwY7uzh0b8P6W1aeaq1DqlujoTk+jfg + iRzDEitwjZCTw6wHmc1MEpaMM8g5w/hcMQnVnzr2ZnCr7yYk460daOiDlfuElTmY9MTFJSKBMjtL6omV + 3uP0T6lDxttXneZNvoY6c71WsljphOHxdzp4mkNnYsFArs3KGFH5wooCb2i3WB4X8kQ92YSUE16TThtY + 9zPSukhyg3ODsCbK8cDR8Z9ePXhPSOyPRTjxJe0JBKaCFDxJizLljxV6ZjkkupY+Oc3JOYr62AX/vHkE + J99ignbMcI2x4OQIvQf5eFCVBFPobNqPWGqcS9IjqsjWJLykgkbpn/IdPyYyo+XV+W7OXYJynQ1H5VvQ + 6myJms7Z6eCtmfRlTHcCaTjVqF/gpfLxPNFM+XijapSP0Qa0nnJOidbsn6Ok2TPcQqp/zj6HqjjlAWTd + p4zFtvB/h6o5DQDGXxsaJIwmHtLI3pzRmevGFvWMOI+oRgMvZ8DdFJx+EClZJ24rtkNutJKjWJWIKgE0 + KlXFZScVZETcKPyUGBjvn3TaMGnldfonazU0HRh/p4N3akhVQ6ASBxKoy9KPcqhOtjMWyaXgN4FwKZ8U + MHXlU79KG2hv2kTAx6Kl3j3nvqPj/+KMk72GPTEsZjrH1m2N2+A8dZ4rHWP/bwOQVhYILaOx0Zaasz9s + oznTr6HE1eNd1ufRrFlTREjJuTipIIpVaRyJJKlUVVJP8oKgOo2IG4WfMpFkjBHf59zngaNd+Pdp/J0O + vtLCXFmMMMDL9bCdS8rn1tv/Use5R7/qm5Dmno9Sdcjp4iVKWIP2gvdMDn9DmkRMbkpvM7MtpOpkSQYd + 6WpvA3jEEI7XV36mQyhXWXqWhKKYhypnz53AWFJuWus3rOR78Vnk5g1NLS9OKkhekMs5ZPSQjrAaPyMS + SXrXUqf7ntNQp1zineRB8i52Onj+dljJpvDIa72DSqXqIm4S3q5MrqZzHr/4TKDd5PlYPxDLNvBG1fTa + JUUS5fNRVZKGWmin2pRbEJZRtuDSCztLTWiYrkR5rbms14j/5COPwU/yguIPIXkifb5c+BA4kiUJuGQk + H2Tl/boe8sY9cNmmgkI4NVNBntEzAj/lKhyZucMXXr5HW9eujN4Mv+bL8fOlvNPBmViO3pXqqMwh6tPh + 5ZkutDxbdPHs8y8l/Lz2FsmOqs022s1T3ZLnQzNOlM/dk8P3xWhpLIPLU8IcPGGlLuXmNIt+F6z0GASO + wc8wRycrrtE/eneoFMJUUCi8E3jc6nsfErPGPaa63QtaEE41Is4zelKzHsqrpqv1T/mOH0m+leugLEbo + VG4jjcPOlNbcMdvp4AAm91JW4qeMtPY9Zg/buWS8nT3/RMKPF/n8OJSXkmdt2TqUJUO7ETA1z8fb6ETl + E7LdPD3Zq6DxBJo6nFjAk3JzxizxnZ6zLn66JrPUdFsnxArw2MguENxBStOjP4xeECqIpDjkSUYPOxmr + QJWkUutaCnOzGj8lQTySPCid4E5irXS1V9K7WqzlxMr6n2s2+BjMt1IB+/yf8oXlAm/0Dyn0n7jjwchD + 3FGp+7sxB1TIETKnh+hFalpsX0RL66Iq+5bwco1biTg94JlvWWcctSIYMM94N29jNa9nyK11x046u3mi + 5QrwqIKsNCg0vlIjyAnh1Fu88RXbDSFDqoMuIlXvd/WKyxlp0+wKIvtgNX5K8m3M+u60nTpJ25EJ2q0X + fKdyKxfxTgfPvZQx75QcGAMcfYmfhx99JrXX8frheXov/PkD5+sT8MO+I5G2NuaAVFGyiZWt83FbE0r3 + DNRtLI9x6yW8sL2VYYtzy0IoYdGvtZpPr5fyAtWNRmsivw0X1xAJqSGWCSTaeEFWyC1m9HzZ0xECi2By + hsg++cnJSPyUvuzKzOuyrG2gjHQw1t5tFnXGKztX8O4Gb70gxti0uTIcwFuJn2effznix3KuLmXOz+MX + n3ZzQkVyxhzMQ5EPFXJ0PLv38Oj3VM9s/WtizVlwZrzsJ/S1mZgVJx9pYKVeY/xshJk+/ZasOLXpCY3p + XDKxx51LQ9YdcvO8bNIR2NKYMIAy4uhaqtK6YMKt0D+dPgZgGAj/dS7uYZU1mGvcAaHSMhyA9I4GL72U + 4YTA/PzhOvYSP09cvJy1d1vc+vG/1Evtw//hv1tE3DxamDeyRb/rKSd0f3fa2rLd7owJB5goWZ5LYN6W + kv8TNvqsoI3Y5PWsta0CJiM/Ih2fh4NiHsYS2S0p+Z/eQ2U7MhSLgFR9NyFaF5FR6kUNJvkrK/BTVu/o + m8P86Ot5sIHLMR5yrNGScxtOhtjR4OUqHzDJWq0ghhNJS2T62yG0R8yZg3OPfcW3vkoJb+QcPDdffHU+ + J/ZH0+f7j47+0PcXCZ1BQ7eamBjmAdPQYYMYiFrhlCt4IDW7RTS/s5K41fJqKS6UDFrrJncT0kOGLknk + +VXfwTIEglzmlHavwk9rleS+UKtllBrBlXnHYxxrVAwrrAQe6ya91DsbzfEiH5PUvIvBO/OS+LDsE9SS + 4UrvsdP6PfcYLlB137knk4Rvvf0OD+TBXNNvCaOcbGsS3pRzQEG/G2/Tf6wt39Q3xxsGhNdtquSJfFTT + iu0X0n5rYkEpfTtv+uNASlJyFvsM0kOGvkWkmXC+LSTpcMbCucwtkLpC/+SWkkz2FusFivi8czENl5GV + ZhnrpnMccNWZDsNMxpfWbH3wVuO7/MXBUyATdRjNPx+J9r68jfyOH/nY/7oy+XF9QmPRPGfnW55tTW8d + ikxlvP1a6uHkqPCdp2J7p2D6+9LBBxjj24w5Z0c22JaGjZtBZLHjtmSanSN+zZvFIUlMOPqVkpGNhEMu + j0n+5Gcr8JPazOYOxnCiJGudE0ZWB5UoQl8NlwOoL+Fm429x8AQMPezKOXPaeLQLQn1JdOTsXJmY8WAs + qnGpbIBFV1ECfNSZkjD6qLcHeWB6RA1v9HDUK0fdQMOLNrgHqWnbGGyMOWdLC73Xcdo4qVQTU8JOykgI + HlEmGWXQyjtChp6RTV0dRUF0WvRAKm0oY1Hdav66LzLIF8yayA8+2WxZd+qicnxMtTEdEleGMlNmWj75 + dQdP16bb8ezYZtuVCc+L5Xb2/FMcGG84Py/+4NXY4U3bYLnzY/twkPNGkwNVK1jOznT6z8OKCQ0+U5vP + rAGvLLp8N7jBZOfrAT+noTGa5iH+4FlSQtzUKMpKokOGIZdHFQ1WVPcC0naZWzr25vhZuUz3J2xJAnnm + juVchy1J3Pmp6jdsGyxr72bOj+e8eamctdf5gMpgPD6Y1krBEMT20LvWG1sc/3QwjkR2+00RmkIGcYXa + jQ94XSr72NEaIbpAVpQaXKA9fra0yHc4TGi1o8iptyBTh0RL2/FYBH1CPGe0os8BpaZU+5DzdhfOj2+v + m7ryhiadStcPfaqahJ3lnOX1S262CI+VQ22Mn0b/hFCYv1+8oCOW02USM+nhAt3luXBfsNYiSNjkTI/S + EAXa42eHC38bQy8VnHoLZvq8gR+Sr8CPqk0tbcciP9Zkh67W9Dn49NHxH8ecN2usk3WoSpu3eRrYciPp + lQv3OjlhY/yk+acU0uQRedg0VtepPiqkY/8x8kSq3ilbUSCSpGiTbeVAe/xsY5HvcIzOVjvWp4qaBd/7 + 1iKniTxYLNg0m/aI95MBqZZUqvNRo4zULqMFg1SncMpS01N69uPBuRl+rCg1UQilgo3yUZQsluLe5Lmk + RIHOI1tRCC5ti6Ii/z1+drj2tzH0UtlC2JIxFJyqvXUg3zxBi7S3UG16OP2XMbDjeaJpTXiIsClGGGz0 + Pn5BpzM3W9nr3miDu7SSKsTCRX4l5AE27xp1LXWMIclUkYqEXc5Gwamv1R4/21jkOxyjjR8VbJO8SAqj + k9eq+SHzIJFvD85m906mH5qkva+bfXZTCqkvndgJoF2weQrnp29lb7Di+0B1yqRSNVtM1lp8y4hfifs4 + BImdQYZIEnn6DsRqKuIUnO0ea7VAe/zscO1vY+gO/MQO8Z52beTby74BPa12IN/IPKDD6KcODn87kG+h + etnaNTlmwsa6YXV6n411X/8D518D/Gxltq5/UkJg2CbZRvZ9IA1dTl1yGpJEnkjVZGsUHJte0hfuZafg + 3tzjZxuLfIdjLJX9+EaCahJPq0T0D2ULkG9OXlt7+CehWT1zB/y8XyFCo+CUVR3bAOSAyXuGbGVdvlPw + E/RPyuXxvjyOnyArUZdWC3T4fsePUdhI2Mu5rZYOye/xs8OFv6WhM/xAXnvwx/BzQvKBgj8/DJlvVrYA + fqxVlXULOXhv4KnL7hmZeRaYg6KF58ZYauGnM6NUg7/tyabt90ircWTo3YOv+N5YS0dTK/DztLLgXPJv + 7PXPltb5robpCJ7GjU1D8DQL/jxJmGJG8Gd299WDd+sN6uSbKZ+gajLC2sjruN2iewWdfUbXs+6uT/2T + XhOi4NJTN51SYiK2iBZJLGjvg3cjT6TqIaAnUwjILOcx+Gnl0QwncZFvkiewbCXdhpWpjJuRqdydOXW6 + fOWxrQmnOSRppDzxPMdnBOgK/JywVSb2W8i85luM+MF+Y2M5MketYcjVg1+hlCWuA+3ekeyTLPNNSaXL + e5Bs7BENePZb5A820I35E8Wfg3nWjLakfyj6UMY6PtKvIE+XKlmkhFDVEY4QqqUgrNY/LCmWXUq7Hl7E + ytcm8ZHlwplrZUz2LSaWoGp+xtR4dqbSaUraDVuHcpmVPK5DMx/fV3XE0rdTUsZqkhvyVKHHypJvydyL + 59Qz0ZN3Wvgx/yeVnYIf1z+GHxXMRcIt0bU5aRtA1cbPBgt05SXXAD8jo085fpb2IZZklF0a1JHw866I + H+w30jtCCoL7PyPwo4WihPzhb12tN8esjL7FN1Abs/GwIBngtZCs7OlW7ZCANBIY409T/U9+vmq/V6pT + TVKVPzl+zj/2tetT/6xE0a5P6EPp26l/En5Ui9rXXDe1rh1odbByzfW9/lVGvrLyrHP8vAhPJ6Si9Fa2 + uCzVlZNc9wS1882vUoXpylx1TnPwhMpT6Z8Xf/DKOfBD/Ccmj15X/s+uETI8/jB+3O3p83+Cibt9/yfh + R8uur3mi6ltUBrPyzdq5BFVF0/mnkS/szmtLwKfWH63zT+NiDYCKh2o9V6mR+i9v82+fuOPzly6/cN3y + b9cnftKs+vjGVmV75F2UV7oN/k0vZrkN5YsT5MgWksmx7hta56tss/PadRbc0gBMtRxTo5VY3RF+Ssuz + RNQo/NTzS5dfZLRR8Z/p2xP/uc7xk08vj30ZrvriP9NTx39weQUPqZey5YDWqBRUXxsN/soC7SS4+FAj + M44Wces0dEgaVnzGSuNHKxJglxxGH1XQebLmM0yEDJyjPnUtifEaSpZqohbLQfwx6TNm9tvVgwPq57gQ + /Y/+uXT58qXL3/z5hBDE9ZV/sBZ+Rnr848ccz1L05x/4PrCBkNxS/kGqzdSbu/VG14JmsfY5SKLvsObl + YLACcnjoQ+EnUWQtCxDwsOjFXHEXtWPf2FcRmzd8OcuaOXMwE27H3UvfbMw5kkn+vOoqnO7Oi0B12lK/ + ei+kHVAoOxV+AI+ah9D54L5zj913/pGz5y+syH+z+I9SRVPC6M7z38av9RRFXfeSgfPH4Gdk/ltsh72N + /Lf0ZWs1lNZ88pHKdcmCYK3nrj+Lo2yAJnKvz4wRb5G/xYfPHzYgZWQOOGlqN9VSGjx13gRizDlMYyX5 + JqexnEx0+VLnRFTQhGmfPfe4xU9D/s51l3+9Lhi2GG8dzitdlX/t0dJU6xH24dtS/nX+suQrbO1xkF6u + sotKUrjF2mlJtVYMa6jP8JMJ1KIBpK82cLRS498+k0yALxsyatp62DHnaG655Zm/ZXR3aebOmeh2Vw/Y + alP8G3sufM/F+038n83rf7o6vG2r/mdd8CiLp/OqMZpk3dutqP8J9XNeJbXd+p/c1JGxkdyP/E+yizob + oOVLRKqjdVrnktWCE9vbgqWaWm2AH6nQgR17FMIq/bTcdh1zjuYmyzOfZ6KzZbX2PUI8rak/lf32+ls0 + X/7FqT+9lvjJ8bZcf2rZBhZx3lH9aQ6SXMmwFnMYyC4qF4RIMPk2vHEFs/w0EQ/D5FsZAN0sHaGPfEvz + 6XuKHD9jztGA5XNJ0yJGqdA+IiTj6EL/g0/c8RDnj+p/YBvOvTP6H4zMN91usmnTwsqyAb0oNaYFqv91 + pLlj/wPbjm7T/gctVjctIxZ0vuJlr5drGti0fAn0Ruu0VniHJZWvKk5uqQudvxl/kIi+zhd/31Nwcgpt + jTlHg3eGrSQlpKe3Rl/n7uwBgwq69fa7OFL/nUuXv63mo+q/o+ajvf13Yn5kR4fet7X/ztuhfzr674Sd + +aL+8V9Fvp26/w7mU76a0+rh81wnyMpqrYYy5Ufsk05LJpkwme7SumOJN91rs3QE2Z9912pNd2o2PpfF + OOac3PLMpddKpJAdWJIHy6cF/LjcHkolQGfPPbJp/7eYSxp7oCX/Z12P4pTnX/t80/7+b0YeeB2uuuSF + Ll/0f5uznTB7OebFp2v1f2vxtgJA6ZB0UtulnSP3Q6ojKZAWSZUrFt2uNQfBcrNcaU1pgHwDJCWT0eI8 + xpyjB2xZqnr8dPc+KC6z3g1+cIHUAuG1N+mr+JSX0IX+o77BYH//UXYpXNV/9JRg2O7lpV7aVrCoMd48 + Ib2j/2jT9Iv+o2zH/cA89h+l+cF6/UcVnWj5Hp2rR15Nvi619HPTSwETYS83/yLXZJRUK2Og01TbmHxL + 20kMEA/ckTnnD8LPyihPV405R+RBS5WVtLuepaUPl4EX8MOs/uL+L4EfTDhCQFvvf3397NnYB8VtkHLX + qv+10pb1tuaby9cBvm9aXjot7SmiM9Nq4K+sPJ2vuKdWlXpkp+UoXCmAmD5XUoIyhpIJlzdlZ5yR5Qby + xdPjpAH5pC8fgjkzJdEenY3wuXDgHC5JMpFAONIE0szzHSvkFOm0VF7Br7AHorApZPjIx/43ECIE9OIP + 6P9CC8Wh/Rfmg/svyEtOjXhSMsvGxT/b1T9rkdpjcJWeq3nSEfsvIMNT7b+wAUG8v2QHEuiqQo1dELa1 + /4+vsKHN564BQjZLrx6DHx+52YJOvw7t/3Owjf1/drAU9kNuIIGuLnDCz+D+c+ygNn7/uetfBW1M1uXK + p6nZ9veF7+XY1KirYM43fXn3Fvaf2+Cr3l+yAwmUXUiPQhQ1dsHu3//0wwP7n4aOpEYtWMX/da6CRgaL + epRYpnz8eZPy8b3s1RM8MG/wb4dHH97C/qc7WAr7IdeWQHKB8ILURR4K4cQLuWMjxS3sv+27r4XeGikB + +W232fIJrK9/Ntl/Wy+Rgf23aVu1xv7ba3/b+wt2IoGORnDWSMQaWdFIERabdszWSL5ij7TFxfn88Tn9 + LryXFTxoyCb2nrTW18qgop9lvWQ7Ai33ElnKedlqp8V1kTkmWJTstBxp/Bw+n6R0OzPbZMghB9+wRJ1H + rWOE9Xyb3hJ7ViFD2sZfRKomWyTsba9t57KR+9fvZDHsB11bAitMuMo2MvGNgBb0Ury0sI20LswXD9O7 + +ej4D2xZZF0UtVBid5Hl7bSueyuuBN4q/iBZbs2GWW6z6cUBlrwRqctHUkJisef1BSTp8rSeib7PbLN5 + PSb06v47a3/R+wt2IoEWhRB68XgvOLHYb1WVemF/Z7H4m7lt5Gi72Pv2nXcfHL5PZomMNE8xDhZ/ewuT + aMW1lmnuZK+rOq7l+eU8efAlns0Jg6h8ghxCFNUJOmTlDXfCzvVIEnl6eBrZWs9rkzYyN8lP9/jZyWLf + zaBtE85zSVUL9FP2ojHTonq1qrWXlnLhLljuiamgj4btgKy/c6h1MW8nNoVb5qACH5Xl9dgbOllH11uM + qJhYe5+SxLm5kRZ2XhCuwoPbPmKeomHK56MhZ2eO8rE955AnUnXZ2p4/Lm1kjuSP9vjZzVLfyahLJhx7 + aWW52D+nna/5tb4dw8L2Qn2OzWoWroLmlo599+Tw/drex8wVvZKjP6MthIOWaNoARBSFSKuubajea6lV + xtwrbiBnnMHSPMsOxlk3yVjtoxcE19Lt4G4khtyQnsuQDUtswwVkaw3Hfdt6D15TRXL0/wHYXYwXw5hb + FgAAAABJRU5ErkJggg== + + + + Description: Statistical Distribution Explorer. +Allows calculation, display and save to file +of a wide variety of statistical distributions +with given parameters and values of random variate, +Probability Density, Cumulative Distribution, complement, +and quantiles and critical values. + + + + + AAABAAIAEBAQAAAABAAoAQAAJgAAACAgEAAAAAQA6AIAAE4BAAAoAAAAEAAAACAAAAABAAQAAAAAAMAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAgAAAAICAAIAAAACAAIAAgIAAAICAgADAwMAAAAD/AAD/ + AAAA//8A/wAAAP8A/wD//wAA////AAAAAAAAAAAAAH//j/j/jwAAf/+P+P+PAAB4iIiIiIgAAH93h3h3 + jwAAf3eHeHePAAB4iIiIiIgAAH93h3h3jwAAf3eHeHePAAB4iIiIiIgAAH93h3h3jwAAf3eHeHePAAB4 + iIiIgAAAAH//j/j39wAAf/+P+PdwAAB3d3d3dwAAwAEAAMABAADAAQAAwAEAAMABAADAAQAAwAEAAMAB + AADAAQAAwAEAAMABAADAAQAAwAEAAMADAADABwAAwA8AACgAAAAgAAAAQAAAAAEABAAAAAAAAAIAAAAA + AAAAAAAAEAAAABAAAAAAAAAAAACAAACAAAAAgIAAgAAAAIAAgACAgAAAgICAAMDAwAAAAP8AAP8AAAD/ + /wD/AAAA/wD/AP//AAD///8Au7u7u7u7u7u7u7u7RLREu7u7u7u7u7u7u7u7u7S7S7u7u7u7u7u7u7u7 + u7u7u7u7u7u7u7u7u7u7u7u0RERES7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u0RLu7u0RLu7u7u7u7u7 + u7u0u7S7u0u7u7u7u7u7u7u7RLtES7RLu7u7u7u7u7u7u7S7tLu7S7u7u7u7u7u7u7u7u7u7u7u7u7u7 + u7u7u7u0REREREREREu7u7u7u7u7u7u7u7u7u7u7u7u7u0RLu7u7u7u0RLu7u7u7u7u0u7S7u7u7u0u7 + u7u7u7u7RLtES7u7u7RLu7u7u7u7u7S7tLu7u7u7S7u7u7u7u7u7u7u7u7u7u7u7u7u0RLu7RERERERE + RERERERLu0u7u7u7u7u7u7u7u7u7u7tLu0u7u7u7u0RLu7u7u7u7S7REu7u7u7u0u7u7u7u7tEu7S7u7 + u7u7RLu7u7u7u7tLu7u7u7u7u7S7u7u7u7u7u7u7u7u7u7u7u7u7u7u7tERERERERERERERERERES7u7 + u7u7u7u7u7u7u7u7u7u7u7u7u7u7REu7u7u7u7u7u7u7u7u7u7S7u7u7u7u7u7u7u7u7u7u0u7u7u7u7 + u7u7u7u7u7u7tLu7u7u7u7u7u7u7u7u7u0S7u7u7u7u7u7u7u7u7u7u0u7u7u7u7u7sAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== + + + \ No newline at end of file diff --git a/src/boost/libs/math/dot_net_example/distribution_explorer/App.config b/src/boost/libs/math/dot_net_example/distribution_explorer/App.config new file mode 100644 index 00000000..49cc43e1 --- /dev/null +++ b/src/boost/libs/math/dot_net_example/distribution_explorer/App.config @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/src/boost/libs/math/dot_net_example/distribution_explorer/ClassDiagram1.cd b/src/boost/libs/math/dot_net_example/distribution_explorer/ClassDiagram1.cd new file mode 100644 index 00000000..b6a6fb0d --- /dev/null +++ b/src/boost/libs/math/dot_net_example/distribution_explorer/ClassDiagram1.cd @@ -0,0 +1,11 @@ + + + + + + + DistexSplash.cs + AAAAAACAACAAABQAAACAAAACAAAAAAAAAAAAAAAAAIA= + + + \ No newline at end of file diff --git a/src/boost/libs/math/dot_net_example/distribution_explorer/ClassDiagram2.cd b/src/boost/libs/math/dot_net_example/distribution_explorer/ClassDiagram2.cd new file mode 100644 index 00000000..0519ecba --- /dev/null +++ b/src/boost/libs/math/dot_net_example/distribution_explorer/ClassDiagram2.cd @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/boost/libs/math/dot_net_example/distribution_explorer/DistexForm.Designer.cs b/src/boost/libs/math/dot_net_example/distribution_explorer/DistexForm.Designer.cs new file mode 100644 index 00000000..62106a83 --- /dev/null +++ b/src/boost/libs/math/dot_net_example/distribution_explorer/DistexForm.Designer.cs @@ -0,0 +1,1094 @@ +namespace distribution_explorer +{ + partial class DistexForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DistexForm)); + this.modeLabel = new System.Windows.Forms.Label(); + this.propertiesTab = new System.Windows.Forms.TabControl(); + this.DistributionTab = new System.Windows.Forms.TabPage(); + this.parameter3 = new System.Windows.Forms.TextBox(); + this.parameter3Label = new System.Windows.Forms.Label(); + this.distributionNameLabel = new System.Windows.Forms.Label(); + this.parameter2Label = new System.Windows.Forms.Label(); + this.parameter1Label = new System.Windows.Forms.Label(); + this.parameter2 = new System.Windows.Forms.TextBox(); + this.parameter1 = new System.Windows.Forms.TextBox(); + this.distribution = new System.Windows.Forms.ComboBox(); + this.PropertiesTabPage = new System.Windows.Forms.TabPage(); + this.toLabel2 = new System.Windows.Forms.Label(); + this.toLabel1 = new System.Windows.Forms.Label(); + this.supportUpperLabel = new System.Windows.Forms.Label(); + this.supportLowerLabel = new System.Windows.Forms.Label(); + this.supportLabel = new System.Windows.Forms.Label(); + this.rangeGreatestLabel = new System.Windows.Forms.Label(); + this.rangeLowestLabel = new System.Windows.Forms.Label(); + this.rangeLabel = new System.Windows.Forms.Label(); + this.parameter3ValueLabel = new System.Windows.Forms.Label(); + this.parameter2ValueLabel = new System.Windows.Forms.Label(); + this.parameter1ValueLabel = new System.Windows.Forms.Label(); + this.distributionValueLabel = new System.Windows.Forms.Label(); + this.parameterLabel3 = new System.Windows.Forms.Label(); + this.parameterLabel2 = new System.Windows.Forms.Label(); + this.parameterLabel1 = new System.Windows.Forms.Label(); + this.DistributionLabel = new System.Windows.Forms.Label(); + this.coefficient_of_variation = new System.Windows.Forms.Label(); + this.CVlabel = new System.Windows.Forms.Label(); + this.kurtosis_excess = new System.Windows.Forms.Label(); + this.kurtosisExcessLabel = new System.Windows.Forms.Label(); + this.kurtosis = new System.Windows.Forms.Label(); + this.kurtosisLabel = new System.Windows.Forms.Label(); + this.skewness = new System.Windows.Forms.Label(); + this.skewnessLabel = new System.Windows.Forms.Label(); + this.median = new System.Windows.Forms.Label(); + this.standard_deviation = new System.Windows.Forms.Label(); + this.stddevLabel = new System.Windows.Forms.Label(); + this.variance = new System.Windows.Forms.Label(); + this.varianceLabel = new System.Windows.Forms.Label(); + this.medianLabel = new System.Windows.Forms.Label(); + this.mode = new System.Windows.Forms.Label(); + this.mean = new System.Windows.Forms.Label(); + this.meanLabel = new System.Windows.Forms.Label(); + this.cdfTabPage = new System.Windows.Forms.TabPage(); + this.CDF_data = new System.Windows.Forms.DataGridView(); + this.RandomVariable = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.PDF = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.CDF = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.CCDF = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.QuantileTabPage = new System.Windows.Forms.TabPage(); + this.QuantileData = new System.Windows.Forms.DataGridView(); + this.RiskLevel = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.LowerCriticalValue = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.UpperCriticalValue = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.menuStrip1 = new System.Windows.Forms.MenuStrip(); + this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.newToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator = new System.Windows.Forms.ToolStripSeparator(); + this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); + this.printToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.printPreviewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); + this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.undoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.redoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); + this.cutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.pasteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); + this.selectAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.contentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator(); + this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.customizeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); + this.saveFileDialog = new System.Windows.Forms.SaveFileDialog(); + this.propertiesTab.SuspendLayout(); + this.DistributionTab.SuspendLayout(); + this.PropertiesTabPage.SuspendLayout(); + this.cdfTabPage.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.CDF_data)).BeginInit(); + this.QuantileTabPage.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.QuantileData)).BeginInit(); + this.menuStrip1.SuspendLayout(); + this.SuspendLayout(); + // + // modeLabel + // + this.modeLabel.AutoSize = true; + this.modeLabel.Location = new System.Drawing.Point(45, 197); + this.modeLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.modeLabel.Name = "modeLabel"; + this.modeLabel.Size = new System.Drawing.Size(44, 18); + this.modeLabel.TabIndex = 0; + this.modeLabel.Text = "Mode"; + // + // propertiesTab + // + this.propertiesTab.AccessibleDescription = "Statistical distribution properties tab"; + this.propertiesTab.AccessibleName = "Properties tab"; + this.propertiesTab.Controls.Add(this.DistributionTab); + this.propertiesTab.Controls.Add(this.PropertiesTabPage); + this.propertiesTab.Controls.Add(this.cdfTabPage); + this.propertiesTab.Controls.Add(this.QuantileTabPage); + this.propertiesTab.Dock = System.Windows.Forms.DockStyle.Fill; + this.propertiesTab.Font = new System.Drawing.Font("Tahoma", 8.400001F); + this.propertiesTab.Location = new System.Drawing.Point(0, 26); + this.propertiesTab.Margin = new System.Windows.Forms.Padding(4); + this.propertiesTab.Name = "propertiesTab"; + this.propertiesTab.SelectedIndex = 0; + this.propertiesTab.ShowToolTips = true; + this.propertiesTab.Size = new System.Drawing.Size(642, 585); + this.propertiesTab.TabIndex = 0; + this.propertiesTab.Deselecting += new System.Windows.Forms.TabControlCancelEventHandler(this.properties_tab_Deselecting); + this.propertiesTab.SelectedIndexChanged += new System.EventHandler(this.properties_tab_SelectedIndexChanged); + // + // DistributionTab + // + this.DistributionTab.AccessibleDescription = "Distribution Tab"; + this.DistributionTab.AccessibleName = "DistributionTab"; + this.DistributionTab.BackColor = System.Drawing.SystemColors.Control; + this.DistributionTab.Controls.Add(this.parameter3); + this.DistributionTab.Controls.Add(this.parameter3Label); + this.DistributionTab.Controls.Add(this.distributionNameLabel); + this.DistributionTab.Controls.Add(this.parameter2Label); + this.DistributionTab.Controls.Add(this.parameter1Label); + this.DistributionTab.Controls.Add(this.parameter2); + this.DistributionTab.Controls.Add(this.parameter1); + this.DistributionTab.Controls.Add(this.distribution); + this.DistributionTab.Location = new System.Drawing.Point(4, 26); + this.DistributionTab.Margin = new System.Windows.Forms.Padding(700, 4, 4, 4); + this.DistributionTab.Name = "DistributionTab"; + this.DistributionTab.Padding = new System.Windows.Forms.Padding(4); + this.DistributionTab.Size = new System.Drawing.Size(634, 555); + this.DistributionTab.TabIndex = 0; + this.DistributionTab.Text = "Distribution"; + this.DistributionTab.ToolTipText = "Choose the Statistical Distribution and provide parameter(s)"; + this.DistributionTab.UseVisualStyleBackColor = true; + this.DistributionTab.Click += new System.EventHandler(this.tabPage1_Click); + // + // parameter3 + // + this.parameter3.Location = new System.Drawing.Point(200, 232); + this.parameter3.Name = "parameter3"; + this.parameter3.Size = new System.Drawing.Size(341, 24); + this.parameter3.TabIndex = 6; + // + // parameter3Label + // + this.parameter3Label.AutoSize = true; + this.parameter3Label.Location = new System.Drawing.Point(31, 232); + this.parameter3Label.Name = "parameter3Label"; + this.parameter3Label.Size = new System.Drawing.Size(170, 18); + this.parameter3Label.TabIndex = 5; + this.parameter3Label.Text = "Parameter 3 (if required)"; + this.parameter3Label.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + this.toolTip1.SetToolTip(this.parameter3Label, "Enter value of 3nd Parameter of the chosen distribution"); + // + // distributionNameLabel + // + this.distributionNameLabel.AutoSize = true; + this.distributionNameLabel.Location = new System.Drawing.Point(31, 58); + this.distributionNameLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.distributionNameLabel.Name = "distributionNameLabel"; + this.distributionNameLabel.Size = new System.Drawing.Size(78, 18); + this.distributionNameLabel.TabIndex = 2; + this.distributionNameLabel.Text = "Distribution"; + this.distributionNameLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // parameter2Label + // + this.parameter2Label.AutoSize = true; + this.parameter2Label.Location = new System.Drawing.Point(28, 174); + this.parameter2Label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.parameter2Label.Name = "parameter2Label"; + this.parameter2Label.Size = new System.Drawing.Size(170, 18); + this.parameter2Label.TabIndex = 4; + this.parameter2Label.Text = "Parameter 2 (if required)"; + this.parameter2Label.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + this.toolTip1.SetToolTip(this.parameter2Label, "Enter value of 2nd Parameter of the chosen distribution"); + // + // parameter1Label + // + this.parameter1Label.AutoSize = true; + this.parameter1Label.ForeColor = System.Drawing.Color.Black; + this.parameter1Label.Location = new System.Drawing.Point(28, 116); + this.parameter1Label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.parameter1Label.Name = "parameter1Label"; + this.parameter1Label.Size = new System.Drawing.Size(89, 18); + this.parameter1Label.TabIndex = 3; + this.parameter1Label.Text = "Parameter 1"; + this.parameter1Label.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // parameter2 + // + this.parameter2.Location = new System.Drawing.Point(200, 171); + this.parameter2.Margin = new System.Windows.Forms.Padding(4); + this.parameter2.Name = "parameter2"; + this.parameter2.Size = new System.Drawing.Size(341, 24); + this.parameter2.TabIndex = 2; + // + // parameter1 + // + this.parameter1.Location = new System.Drawing.Point(200, 110); + this.parameter1.Margin = new System.Windows.Forms.Padding(4); + this.parameter1.Name = "parameter1"; + this.parameter1.Size = new System.Drawing.Size(341, 24); + this.parameter1.TabIndex = 1; + // + // distribution + // + this.distribution.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.distribution.FormattingEnabled = true; + this.distribution.Location = new System.Drawing.Point(200, 51); + this.distribution.Margin = new System.Windows.Forms.Padding(4); + this.distribution.MaxDropDownItems = 20; + this.distribution.Name = "distribution"; + this.distribution.Size = new System.Drawing.Size(341, 25); + this.distribution.TabIndex = 0; + this.distribution.SelectedIndexChanged += new System.EventHandler(this.distribution_SelectedIndexChanged); + // + // PropertiesTabPage + // + this.PropertiesTabPage.AccessibleDescription = "Show properties of distribution "; + this.PropertiesTabPage.AccessibleName = "PropertiesTabPage"; + this.PropertiesTabPage.AccessibleRole = System.Windows.Forms.AccessibleRole.None; + this.PropertiesTabPage.BackColor = System.Drawing.SystemColors.Control; + this.PropertiesTabPage.Controls.Add(this.toLabel2); + this.PropertiesTabPage.Controls.Add(this.toLabel1); + this.PropertiesTabPage.Controls.Add(this.supportUpperLabel); + this.PropertiesTabPage.Controls.Add(this.supportLowerLabel); + this.PropertiesTabPage.Controls.Add(this.supportLabel); + this.PropertiesTabPage.Controls.Add(this.rangeGreatestLabel); + this.PropertiesTabPage.Controls.Add(this.rangeLowestLabel); + this.PropertiesTabPage.Controls.Add(this.rangeLabel); + this.PropertiesTabPage.Controls.Add(this.parameter3ValueLabel); + this.PropertiesTabPage.Controls.Add(this.parameter2ValueLabel); + this.PropertiesTabPage.Controls.Add(this.parameter1ValueLabel); + this.PropertiesTabPage.Controls.Add(this.distributionValueLabel); + this.PropertiesTabPage.Controls.Add(this.parameterLabel3); + this.PropertiesTabPage.Controls.Add(this.parameterLabel2); + this.PropertiesTabPage.Controls.Add(this.parameterLabel1); + this.PropertiesTabPage.Controls.Add(this.DistributionLabel); + this.PropertiesTabPage.Controls.Add(this.coefficient_of_variation); + this.PropertiesTabPage.Controls.Add(this.CVlabel); + this.PropertiesTabPage.Controls.Add(this.kurtosis_excess); + this.PropertiesTabPage.Controls.Add(this.kurtosisExcessLabel); + this.PropertiesTabPage.Controls.Add(this.kurtosis); + this.PropertiesTabPage.Controls.Add(this.kurtosisLabel); + this.PropertiesTabPage.Controls.Add(this.skewness); + this.PropertiesTabPage.Controls.Add(this.skewnessLabel); + this.PropertiesTabPage.Controls.Add(this.median); + this.PropertiesTabPage.Controls.Add(this.standard_deviation); + this.PropertiesTabPage.Controls.Add(this.stddevLabel); + this.PropertiesTabPage.Controls.Add(this.variance); + this.PropertiesTabPage.Controls.Add(this.varianceLabel); + this.PropertiesTabPage.Controls.Add(this.medianLabel); + this.PropertiesTabPage.Controls.Add(this.mode); + this.PropertiesTabPage.Controls.Add(this.modeLabel); + this.PropertiesTabPage.Controls.Add(this.mean); + this.PropertiesTabPage.Controls.Add(this.meanLabel); + this.PropertiesTabPage.ForeColor = System.Drawing.SystemColors.WindowText; + this.PropertiesTabPage.Location = new System.Drawing.Point(4, 26); + this.PropertiesTabPage.Margin = new System.Windows.Forms.Padding(4); + this.PropertiesTabPage.Name = "PropertiesTabPage"; + this.PropertiesTabPage.Padding = new System.Windows.Forms.Padding(4); + this.PropertiesTabPage.Size = new System.Drawing.Size(634, 555); + this.PropertiesTabPage.TabIndex = 1; + this.PropertiesTabPage.Text = "Properties"; + this.PropertiesTabPage.ToolTipText = "Shows properties of chosen distribution."; + this.PropertiesTabPage.UseVisualStyleBackColor = true; + this.PropertiesTabPage.Enter += new System.EventHandler(this.tabPage2_Enter); + // + // toLabel2 + // + this.toLabel2.AutoSize = true; + this.toLabel2.Location = new System.Drawing.Point(384, 483); + this.toLabel2.Name = "toLabel2"; + this.toLabel2.Size = new System.Drawing.Size(21, 18); + this.toLabel2.TabIndex = 25; + this.toLabel2.Text = "to"; + // + // toLabel1 + // + this.toLabel1.AutoSize = true; + this.toLabel1.Location = new System.Drawing.Point(384, 449); + this.toLabel1.Name = "toLabel1"; + this.toLabel1.Size = new System.Drawing.Size(21, 18); + this.toLabel1.TabIndex = 24; + this.toLabel1.Text = "to"; + // + // supportUpperLabel + // + this.supportUpperLabel.AutoSize = true; + this.supportUpperLabel.Location = new System.Drawing.Point(411, 483); + this.supportUpperLabel.Name = "supportUpperLabel"; + this.supportUpperLabel.Size = new System.Drawing.Size(131, 18); + this.supportUpperLabel.TabIndex = 23; + this.supportUpperLabel.Text = "supportUpperValue"; + this.toolTip1.SetToolTip(this.supportUpperLabel, "PDF and CDF are unity for x argument values greater than this value."); + // + // supportLowerLabel + // + this.supportLowerLabel.AutoSize = true; + this.supportLowerLabel.Location = new System.Drawing.Point(207, 483); + this.supportLowerLabel.Name = "supportLowerLabel"; + this.supportLowerLabel.Size = new System.Drawing.Size(130, 18); + this.supportLowerLabel.TabIndex = 22; + this.supportLowerLabel.Text = "supportLowerValue"; + this.toolTip1.SetToolTip(this.supportLowerLabel, "PDF and CDF are zero for values of argument X less than this value."); + // + // supportLabel + // + this.supportLabel.AutoSize = true; + this.supportLabel.Location = new System.Drawing.Point(45, 483); + this.supportLabel.Name = "supportLabel"; + this.supportLabel.Size = new System.Drawing.Size(74, 18); + this.supportLabel.TabIndex = 21; + this.supportLabel.Text = "Supported"; + this.toolTip1.SetToolTip(this.supportLabel, "Range over which pdf is >0 but not yet =1"); + // + // rangeGreatestLabel + // + this.rangeGreatestLabel.AutoSize = true; + this.rangeGreatestLabel.Location = new System.Drawing.Point(411, 449); + this.rangeGreatestLabel.Name = "rangeGreatestLabel"; + this.rangeGreatestLabel.Size = new System.Drawing.Size(136, 18); + this.rangeGreatestLabel.TabIndex = 20; + this.rangeGreatestLabel.Text = "rangeGreatestValue"; + this.toolTip1.SetToolTip(this.rangeGreatestLabel, "Greatest argument X for calculating PDF and CDF."); + // + // rangeLowestLabel + // + this.rangeLowestLabel.AllowDrop = true; + this.rangeLowestLabel.AutoSize = true; + this.rangeLowestLabel.Location = new System.Drawing.Point(207, 449); + this.rangeLowestLabel.Name = "rangeLowestLabel"; + this.rangeLowestLabel.Size = new System.Drawing.Size(125, 18); + this.rangeLowestLabel.TabIndex = 19; + this.rangeLowestLabel.Text = "rangeLowestValue"; + this.toolTip1.SetToolTip(this.rangeLowestLabel, "Lowest argument X for calculating PDF and CDF."); + // + // rangeLabel + // + this.rangeLabel.AutoSize = true; + this.rangeLabel.Location = new System.Drawing.Point(45, 449); + this.rangeLabel.Name = "rangeLabel"; + this.rangeLabel.Size = new System.Drawing.Size(49, 18); + this.rangeLabel.TabIndex = 18; + this.rangeLabel.Text = "Range"; + this.toolTip1.SetToolTip(this.rangeLabel, "Lowest and greatest possible value of x argument for PDF & CDF."); + // + // parameter3ValueLabel + // + this.parameter3ValueLabel.AutoSize = true; + this.parameter3ValueLabel.Location = new System.Drawing.Point(204, 118); + this.parameter3ValueLabel.Name = "parameter3ValueLabel"; + this.parameter3ValueLabel.Size = new System.Drawing.Size(128, 18); + this.parameter3ValueLabel.TabIndex = 17; + this.parameter3ValueLabel.Text = "parameter 3 value"; + this.toolTip1.SetToolTip(this.parameter3ValueLabel, "Show 3rd parameter provided (if any)."); + // + // parameter2ValueLabel + // + this.parameter2ValueLabel.AutoSize = true; + this.parameter2ValueLabel.Location = new System.Drawing.Point(204, 87); + this.parameter2ValueLabel.Name = "parameter2ValueLabel"; + this.parameter2ValueLabel.Size = new System.Drawing.Size(128, 18); + this.parameter2ValueLabel.TabIndex = 16; + this.parameter2ValueLabel.Text = "parameter 2 value"; + this.toolTip1.SetToolTip(this.parameter2ValueLabel, "Show 2nd parameter provided (if any)."); + // + // parameter1ValueLabel + // + this.parameter1ValueLabel.AutoSize = true; + this.parameter1ValueLabel.Location = new System.Drawing.Point(204, 54); + this.parameter1ValueLabel.Name = "parameter1ValueLabel"; + this.parameter1ValueLabel.Size = new System.Drawing.Size(128, 18); + this.parameter1ValueLabel.TabIndex = 15; + this.parameter1ValueLabel.Text = "parameter 1 value"; + this.toolTip1.SetToolTip(this.parameter1ValueLabel, "Show 1st parameter provided."); + // + // distributionValueLabel + // + this.distributionValueLabel.AutoSize = true; + this.distributionValueLabel.Location = new System.Drawing.Point(204, 24); + this.distributionValueLabel.Name = "distributionValueLabel"; + this.distributionValueLabel.Size = new System.Drawing.Size(118, 18); + this.distributionValueLabel.TabIndex = 14; + this.distributionValueLabel.Text = "distribution name"; + this.toolTip1.SetToolTip(this.distributionValueLabel, "Show name of chosen distribution"); + // + // parameterLabel3 + // + this.parameterLabel3.AutoSize = true; + this.parameterLabel3.Location = new System.Drawing.Point(45, 118); + this.parameterLabel3.Name = "parameterLabel3"; + this.parameterLabel3.Size = new System.Drawing.Size(142, 18); + this.parameterLabel3.TabIndex = 13; + this.parameterLabel3.Text = "Parameter 3 (if any)"; + // + // parameterLabel2 + // + this.parameterLabel2.AutoSize = true; + this.parameterLabel2.Location = new System.Drawing.Point(45, 87); + this.parameterLabel2.Name = "parameterLabel2"; + this.parameterLabel2.Size = new System.Drawing.Size(142, 18); + this.parameterLabel2.TabIndex = 12; + this.parameterLabel2.Text = "Parameter 2 (if any)"; + // + // parameterLabel1 + // + this.parameterLabel1.AutoSize = true; + this.parameterLabel1.Location = new System.Drawing.Point(45, 54); + this.parameterLabel1.Name = "parameterLabel1"; + this.parameterLabel1.Size = new System.Drawing.Size(89, 18); + this.parameterLabel1.TabIndex = 11; + this.parameterLabel1.Text = "Parameter 1"; + // + // DistributionLabel + // + this.DistributionLabel.AutoSize = true; + this.DistributionLabel.Location = new System.Drawing.Point(45, 24); + this.DistributionLabel.Name = "DistributionLabel"; + this.DistributionLabel.Size = new System.Drawing.Size(78, 18); + this.DistributionLabel.TabIndex = 10; + this.DistributionLabel.Text = "Distribution"; + // + // coefficient_of_variation + // + this.coefficient_of_variation.AutoSize = true; + this.coefficient_of_variation.Location = new System.Drawing.Point(204, 318); + this.coefficient_of_variation.Name = "coefficient_of_variation"; + this.coefficient_of_variation.Size = new System.Drawing.Size(65, 18); + this.coefficient_of_variation.TabIndex = 9; + this.coefficient_of_variation.Text = "CV value"; + // + // CVlabel + // + this.CVlabel.AutoSize = true; + this.CVlabel.Location = new System.Drawing.Point(45, 318); + this.CVlabel.Name = "CVlabel"; + this.CVlabel.Size = new System.Drawing.Size(152, 18); + this.CVlabel.TabIndex = 8; + this.CVlabel.Text = "Coefficient of variation"; + this.toolTip1.SetToolTip(this.CVlabel, "or relative standard deviation that is standard deviation/mean"); + // + // kurtosis_excess + // + this.kurtosis_excess.AutoSize = true; + this.kurtosis_excess.Location = new System.Drawing.Point(204, 414); + this.kurtosis_excess.Name = "kurtosis_excess"; + this.kurtosis_excess.Size = new System.Drawing.Size(146, 18); + this.kurtosis_excess.TabIndex = 7; + this.kurtosis_excess.Text = "kurtosis excess value"; + // + // kurtosisExcessLabel + // + this.kurtosisExcessLabel.AutoSize = true; + this.kurtosisExcessLabel.Location = new System.Drawing.Point(45, 414); + this.kurtosisExcessLabel.Name = "kurtosisExcessLabel"; + this.kurtosisExcessLabel.Size = new System.Drawing.Size(109, 18); + this.kurtosisExcessLabel.TabIndex = 6; + this.kurtosisExcessLabel.Text = "Kurtosis excess"; + // + // kurtosis + // + this.kurtosis.AutoSize = true; + this.kurtosis.Location = new System.Drawing.Point(204, 383); + this.kurtosis.Name = "kurtosis"; + this.kurtosis.Size = new System.Drawing.Size(96, 18); + this.kurtosis.TabIndex = 5; + this.kurtosis.Text = "kurtosis value"; + // + // kurtosisLabel + // + this.kurtosisLabel.AutoSize = true; + this.kurtosisLabel.Location = new System.Drawing.Point(45, 383); + this.kurtosisLabel.Name = "kurtosisLabel"; + this.kurtosisLabel.Size = new System.Drawing.Size(59, 18); + this.kurtosisLabel.TabIndex = 4; + this.kurtosisLabel.Text = "Kurtosis"; + // + // skewness + // + this.skewness.AutoSize = true; + this.skewness.Location = new System.Drawing.Point(204, 351); + this.skewness.Name = "skewness"; + this.skewness.Size = new System.Drawing.Size(109, 18); + this.skewness.TabIndex = 3; + this.skewness.Text = "skewness value"; + // + // skewnessLabel + // + this.skewnessLabel.AutoSize = true; + this.skewnessLabel.Location = new System.Drawing.Point(45, 351); + this.skewnessLabel.Name = "skewnessLabel"; + this.skewnessLabel.Size = new System.Drawing.Size(71, 18); + this.skewnessLabel.TabIndex = 0; + this.skewnessLabel.Text = "Skewness"; + // + // median + // + this.median.AutoSize = true; + this.median.Location = new System.Drawing.Point(204, 228); + this.median.Name = "median"; + this.median.Size = new System.Drawing.Size(94, 18); + this.median.TabIndex = 1; + this.median.Text = "median value"; + // + // standard_deviation + // + this.standard_deviation.AutoSize = true; + this.standard_deviation.Location = new System.Drawing.Point(204, 286); + this.standard_deviation.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.standard_deviation.Name = "standard_deviation"; + this.standard_deviation.Size = new System.Drawing.Size(94, 18); + this.standard_deviation.TabIndex = 0; + this.standard_deviation.Text = "StdDev value"; + // + // stddevLabel + // + this.stddevLabel.AutoSize = true; + this.stddevLabel.Location = new System.Drawing.Point(45, 286); + this.stddevLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.stddevLabel.Name = "stddevLabel"; + this.stddevLabel.Size = new System.Drawing.Size(130, 18); + this.stddevLabel.TabIndex = 0; + this.stddevLabel.Text = "Standard Deviation"; + this.toolTip1.SetToolTip(this.stddevLabel, "sqrt("); + // + // variance + // + this.variance.AutoSize = true; + this.variance.Location = new System.Drawing.Point(204, 257); + this.variance.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.variance.Name = "variance"; + this.variance.Size = new System.Drawing.Size(101, 18); + this.variance.TabIndex = 0; + this.variance.Text = "variance value"; + // + // varianceLabel + // + this.varianceLabel.AutoSize = true; + this.varianceLabel.Location = new System.Drawing.Point(45, 257); + this.varianceLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.varianceLabel.Name = "varianceLabel"; + this.varianceLabel.Size = new System.Drawing.Size(63, 18); + this.varianceLabel.TabIndex = 0; + this.varianceLabel.Text = "Variance"; + this.toolTip1.SetToolTip(this.varianceLabel, "standard deviation squared"); + // + // medianLabel + // + this.medianLabel.AutoSize = true; + this.medianLabel.Location = new System.Drawing.Point(45, 228); + this.medianLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.medianLabel.Name = "medianLabel"; + this.medianLabel.Size = new System.Drawing.Size(54, 18); + this.medianLabel.TabIndex = 0; + this.medianLabel.Text = "Median"; + this.toolTip1.SetToolTip(this.medianLabel, "media is quantile(0.5)"); + // + // mode + // + this.mode.AutoSize = true; + this.mode.Location = new System.Drawing.Point(204, 197); + this.mode.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.mode.Name = "mode"; + this.mode.Size = new System.Drawing.Size(84, 18); + this.mode.TabIndex = 0; + this.mode.Text = "mode value"; + // + // mean + // + this.mean.AutoSize = true; + this.mean.Location = new System.Drawing.Point(204, 169); + this.mean.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.mean.Name = "mean"; + this.mean.Size = new System.Drawing.Size(84, 18); + this.mean.TabIndex = 0; + this.mean.Text = "mean value"; + // + // meanLabel + // + this.meanLabel.AutoSize = true; + this.meanLabel.Location = new System.Drawing.Point(45, 169); + this.meanLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.meanLabel.Name = "meanLabel"; + this.meanLabel.Size = new System.Drawing.Size(44, 18); + this.meanLabel.TabIndex = 0; + this.meanLabel.Text = "Mean"; + // + // cdfTabPage + // + this.cdfTabPage.Controls.Add(this.CDF_data); + this.cdfTabPage.Location = new System.Drawing.Point(4, 26); + this.cdfTabPage.Margin = new System.Windows.Forms.Padding(4); + this.cdfTabPage.Name = "cdfTabPage"; + this.cdfTabPage.Padding = new System.Windows.Forms.Padding(4); + this.cdfTabPage.Size = new System.Drawing.Size(634, 555); + this.cdfTabPage.TabIndex = 2; + this.cdfTabPage.Text = "PDF and CDF"; + this.cdfTabPage.ToolTipText = "Probability Density and Cumulative Distribution Function (and complement) for ran" + + "dom variate x"; + this.cdfTabPage.UseVisualStyleBackColor = true; + // + // CDF_data + // + this.CDF_data.AccessibleDescription = "PDF, CDF & complement Data Page"; + this.CDF_data.AccessibleName = "CDF Tab"; + this.CDF_data.AccessibleRole = System.Windows.Forms.AccessibleRole.PageTab; + this.CDF_data.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.CDF_data.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.RandomVariable, + this.PDF, + this.CDF, + this.CCDF}); + this.CDF_data.Dock = System.Windows.Forms.DockStyle.Fill; + this.CDF_data.Location = new System.Drawing.Point(4, 4); + this.CDF_data.Margin = new System.Windows.Forms.Padding(4); + this.CDF_data.Name = "CDF_data"; + this.CDF_data.RowTemplate.Height = 24; + this.CDF_data.Size = new System.Drawing.Size(626, 547); + this.CDF_data.TabIndex = 0; + this.CDF_data.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellEndEdit); + this.CDF_data.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.CDF_data_CellContentClick); + // + // RandomVariable + // + this.RandomVariable.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.RandomVariable.HeaderText = "Random Variable"; + this.RandomVariable.Name = "RandomVariable"; + // + // PDF + // + this.PDF.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.PDF.HeaderText = "PDF"; + this.PDF.Name = "PDF"; + this.PDF.ReadOnly = true; + // + // CDF + // + this.CDF.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.CDF.HeaderText = "CDF"; + this.CDF.Name = "CDF"; + this.CDF.ReadOnly = true; + // + // CCDF + // + this.CCDF.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.CCDF.HeaderText = "1-CDF"; + this.CCDF.Name = "CCDF"; + this.CCDF.ReadOnly = true; + // + // QuantileTabPage + // + this.QuantileTabPage.Controls.Add(this.QuantileData); + this.QuantileTabPage.Location = new System.Drawing.Point(4, 26); + this.QuantileTabPage.Margin = new System.Windows.Forms.Padding(4); + this.QuantileTabPage.Name = "QuantileTabPage"; + this.QuantileTabPage.Padding = new System.Windows.Forms.Padding(4); + this.QuantileTabPage.Size = new System.Drawing.Size(634, 555); + this.QuantileTabPage.TabIndex = 3; + this.QuantileTabPage.Text = "Critical Values"; + this.QuantileTabPage.ToolTipText = "Critical values (quantiles or percentiles of probability 1 - alpha)"; + this.QuantileTabPage.UseVisualStyleBackColor = true; + this.QuantileTabPage.Enter += new System.EventHandler(this.QuantileTab_Enter); + // + // QuantileData + // + this.QuantileData.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.QuantileData.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.RiskLevel, + this.LowerCriticalValue, + this.UpperCriticalValue}); + this.QuantileData.Dock = System.Windows.Forms.DockStyle.Fill; + this.QuantileData.Location = new System.Drawing.Point(4, 4); + this.QuantileData.Margin = new System.Windows.Forms.Padding(4); + this.QuantileData.Name = "QuantileData"; + this.QuantileData.RowTemplate.Height = 24; + this.QuantileData.Size = new System.Drawing.Size(626, 547); + this.QuantileData.TabIndex = 0; + this.QuantileData.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.QuantileData_CellEndEdit); + // + // RiskLevel + // + this.RiskLevel.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.RiskLevel.HeaderText = "Risk Level (alpha)"; + this.RiskLevel.Name = "RiskLevel"; + // + // LowerCriticalValue + // + this.LowerCriticalValue.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.LowerCriticalValue.HeaderText = "Lower Critical Value"; + this.LowerCriticalValue.Name = "LowerCriticalValue"; + this.LowerCriticalValue.ReadOnly = true; + // + // UpperCriticalValue + // + this.UpperCriticalValue.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.UpperCriticalValue.HeaderText = "Upper Critical Value"; + this.UpperCriticalValue.Name = "UpperCriticalValue"; + this.UpperCriticalValue.ReadOnly = true; + // + // menuStrip1 + // + this.menuStrip1.BackColor = System.Drawing.SystemColors.Control; + this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.fileToolStripMenuItem, + this.editToolStripMenuItem, + this.helpToolStripMenuItem}); + this.menuStrip1.Location = new System.Drawing.Point(0, 0); + this.menuStrip1.Name = "menuStrip1"; + this.menuStrip1.Size = new System.Drawing.Size(642, 26); + this.menuStrip1.TabIndex = 1; + this.menuStrip1.Text = "menuStrip1"; + // + // fileToolStripMenuItem + // + this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.newToolStripMenuItem, + this.openToolStripMenuItem, + this.toolStripSeparator, + this.saveToolStripMenuItem, + this.toolStripSeparator1, + this.printToolStripMenuItem, + this.printPreviewToolStripMenuItem, + this.toolStripSeparator2, + this.exitToolStripMenuItem}); + this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; + this.fileToolStripMenuItem.Size = new System.Drawing.Size(40, 22); + this.fileToolStripMenuItem.Text = "&File"; + // + // newToolStripMenuItem + // + this.newToolStripMenuItem.Enabled = false; + this.newToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("newToolStripMenuItem.Image"))); + this.newToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; + this.newToolStripMenuItem.Name = "newToolStripMenuItem"; + this.newToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N))); + this.newToolStripMenuItem.Size = new System.Drawing.Size(177, 22); + this.newToolStripMenuItem.Text = "&New"; + this.newToolStripMenuItem.ToolTipText = "New is not yet implementd. Enter data into dialog boxes."; + this.newToolStripMenuItem.Click += new System.EventHandler(this.newToolStripMenuItem_Click); + // + // openToolStripMenuItem + // + this.openToolStripMenuItem.Enabled = false; + this.openToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("openToolStripMenuItem.Image"))); + this.openToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; + this.openToolStripMenuItem.Name = "openToolStripMenuItem"; + this.openToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O))); + this.openToolStripMenuItem.Size = new System.Drawing.Size(177, 22); + this.openToolStripMenuItem.Text = "&Open"; + this.openToolStripMenuItem.ToolTipText = "Open is not yet implementd. Enter data into dialog boxes."; + this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click); + // + // toolStripSeparator + // + this.toolStripSeparator.Name = "toolStripSeparator"; + this.toolStripSeparator.Size = new System.Drawing.Size(174, 6); + // + // saveToolStripMenuItem + // + this.saveToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("saveToolStripMenuItem.Image"))); + this.saveToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; + this.saveToolStripMenuItem.Name = "saveToolStripMenuItem"; + this.saveToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S))); + this.saveToolStripMenuItem.Size = new System.Drawing.Size(177, 22); + this.saveToolStripMenuItem.Text = "&Save"; + this.saveToolStripMenuItem.ToolTipText = "Save all values, input and output, to a file."; + this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click); + // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; + this.toolStripSeparator1.Size = new System.Drawing.Size(174, 6); + // + // printToolStripMenuItem + // + this.printToolStripMenuItem.Enabled = false; + this.printToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("printToolStripMenuItem.Image"))); + this.printToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; + this.printToolStripMenuItem.Name = "printToolStripMenuItem"; + this.printToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.P))); + this.printToolStripMenuItem.Size = new System.Drawing.Size(177, 22); + this.printToolStripMenuItem.Text = "&Print"; + this.printToolStripMenuItem.ToolTipText = "Printing not yet available. Output to a file and print that instead."; + this.printToolStripMenuItem.Click += new System.EventHandler(this.printToolStripMenuItem_Click); + // + // printPreviewToolStripMenuItem + // + this.printPreviewToolStripMenuItem.Enabled = false; + this.printPreviewToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("printPreviewToolStripMenuItem.Image"))); + this.printPreviewToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; + this.printPreviewToolStripMenuItem.Name = "printPreviewToolStripMenuItem"; + this.printPreviewToolStripMenuItem.Size = new System.Drawing.Size(177, 22); + this.printPreviewToolStripMenuItem.Text = "Print Pre&view"; + this.printPreviewToolStripMenuItem.ToolTipText = "Printing not yet available. Output to a file and print that instead."; + this.printPreviewToolStripMenuItem.Visible = false; + this.printPreviewToolStripMenuItem.Click += new System.EventHandler(this.printPreviewToolStripMenuItem_Click); + // + // toolStripSeparator2 + // + this.toolStripSeparator2.Name = "toolStripSeparator2"; + this.toolStripSeparator2.Size = new System.Drawing.Size(174, 6); + // + // exitToolStripMenuItem + // + this.exitToolStripMenuItem.AutoToolTip = true; + this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; + this.exitToolStripMenuItem.Size = new System.Drawing.Size(177, 22); + this.exitToolStripMenuItem.Text = "E&xit"; + this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); + // + // editToolStripMenuItem + // + this.editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.undoToolStripMenuItem, + this.redoToolStripMenuItem, + this.toolStripSeparator3, + this.cutToolStripMenuItem, + this.copyToolStripMenuItem, + this.pasteToolStripMenuItem, + this.toolStripSeparator4, + this.selectAllToolStripMenuItem}); + this.editToolStripMenuItem.Enabled = false; + this.editToolStripMenuItem.Name = "editToolStripMenuItem"; + this.editToolStripMenuItem.Size = new System.Drawing.Size(43, 22); + this.editToolStripMenuItem.Text = "&Edit"; + this.editToolStripMenuItem.Visible = false; + // + // undoToolStripMenuItem + // + this.undoToolStripMenuItem.Name = "undoToolStripMenuItem"; + this.undoToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Z))); + this.undoToolStripMenuItem.Size = new System.Drawing.Size(176, 22); + this.undoToolStripMenuItem.Text = "&Undo"; + // + // redoToolStripMenuItem + // + this.redoToolStripMenuItem.Name = "redoToolStripMenuItem"; + this.redoToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Y))); + this.redoToolStripMenuItem.Size = new System.Drawing.Size(176, 22); + this.redoToolStripMenuItem.Text = "&Redo"; + // + // toolStripSeparator3 + // + this.toolStripSeparator3.Name = "toolStripSeparator3"; + this.toolStripSeparator3.Size = new System.Drawing.Size(173, 6); + // + // cutToolStripMenuItem + // + this.cutToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("cutToolStripMenuItem.Image"))); + this.cutToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; + this.cutToolStripMenuItem.Name = "cutToolStripMenuItem"; + this.cutToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.X))); + this.cutToolStripMenuItem.Size = new System.Drawing.Size(176, 22); + this.cutToolStripMenuItem.Text = "Cu&t"; + // + // copyToolStripMenuItem + // + this.copyToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("copyToolStripMenuItem.Image"))); + this.copyToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; + this.copyToolStripMenuItem.Name = "copyToolStripMenuItem"; + this.copyToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C))); + this.copyToolStripMenuItem.Size = new System.Drawing.Size(176, 22); + this.copyToolStripMenuItem.Text = "&Copy"; + // + // pasteToolStripMenuItem + // + this.pasteToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("pasteToolStripMenuItem.Image"))); + this.pasteToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; + this.pasteToolStripMenuItem.Name = "pasteToolStripMenuItem"; + this.pasteToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.V))); + this.pasteToolStripMenuItem.Size = new System.Drawing.Size(176, 22); + this.pasteToolStripMenuItem.Text = "&Paste"; + // + // toolStripSeparator4 + // + this.toolStripSeparator4.Name = "toolStripSeparator4"; + this.toolStripSeparator4.Size = new System.Drawing.Size(173, 6); + // + // selectAllToolStripMenuItem + // + this.selectAllToolStripMenuItem.Name = "selectAllToolStripMenuItem"; + this.selectAllToolStripMenuItem.Size = new System.Drawing.Size(176, 22); + this.selectAllToolStripMenuItem.Text = "Select &All"; + // + // helpToolStripMenuItem + // + this.helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.contentsToolStripMenuItem, + this.toolStripSeparator5, + this.aboutToolStripMenuItem}); + this.helpToolStripMenuItem.Name = "helpToolStripMenuItem"; + this.helpToolStripMenuItem.Size = new System.Drawing.Size(48, 22); + this.helpToolStripMenuItem.Text = "&Help"; + // + // contentsToolStripMenuItem + // + this.contentsToolStripMenuItem.AutoToolTip = true; + this.contentsToolStripMenuItem.Name = "contentsToolStripMenuItem"; + this.contentsToolStripMenuItem.Size = new System.Drawing.Size(149, 22); + this.contentsToolStripMenuItem.Text = "&Contents"; + this.contentsToolStripMenuItem.Click += new System.EventHandler(this.contentsToolStripMenuItem_Click); + // + // toolStripSeparator5 + // + this.toolStripSeparator5.Name = "toolStripSeparator5"; + this.toolStripSeparator5.Size = new System.Drawing.Size(146, 6); + // + // aboutToolStripMenuItem + // + this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; + this.aboutToolStripMenuItem.Size = new System.Drawing.Size(149, 22); + this.aboutToolStripMenuItem.Text = "&About..."; + this.aboutToolStripMenuItem.ToolTipText = "About this program"; + this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click); + // + // customizeToolStripMenuItem + // + this.customizeToolStripMenuItem.Name = "customizeToolStripMenuItem"; + this.customizeToolStripMenuItem.Size = new System.Drawing.Size(32, 19); + this.customizeToolStripMenuItem.Text = "&Customize"; + // + // saveFileDialog + // + this.saveFileDialog.FileOk += new System.ComponentModel.CancelEventHandler(this.saveFileDialog1_FileOk); + // + // DistexForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 17F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.SystemColors.ControlLight; + this.ClientSize = new System.Drawing.Size(642, 611); + this.Controls.Add(this.propertiesTab); + this.Controls.Add(this.menuStrip1); + this.Font = new System.Drawing.Font("Tahoma", 8.400001F); + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MainMenuStrip = this.menuStrip1; + this.Margin = new System.Windows.Forms.Padding(4); + this.MaximizeBox = false; + this.MinimumSize = new System.Drawing.Size(650, 645); + this.Name = "DistexForm"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Statistical Distribution Explorer"; + this.toolTip1.SetToolTip(this, "Statistical Distribution Explorer main form"); + this.Activated += new System.EventHandler(this.DistexForm_Activated); + this.Load += new System.EventHandler(this.Form_Load); + this.propertiesTab.ResumeLayout(false); + this.DistributionTab.ResumeLayout(false); + this.DistributionTab.PerformLayout(); + this.PropertiesTabPage.ResumeLayout(false); + this.PropertiesTabPage.PerformLayout(); + this.cdfTabPage.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.CDF_data)).EndInit(); + this.QuantileTabPage.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.QuantileData)).EndInit(); + this.menuStrip1.ResumeLayout(false); + this.menuStrip1.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TabControl propertiesTab; + private System.Windows.Forms.TabPage DistributionTab; + private System.Windows.Forms.TabPage PropertiesTabPage; + private System.Windows.Forms.Label distributionNameLabel; + private System.Windows.Forms.Label parameter2Label; + private System.Windows.Forms.Label parameter1Label; + private System.Windows.Forms.TextBox parameter2; + private System.Windows.Forms.TextBox parameter1; + private System.Windows.Forms.ComboBox distribution; + private System.Windows.Forms.Label standard_deviation; + private System.Windows.Forms.Label stddevLabel; + private System.Windows.Forms.Label variance; + private System.Windows.Forms.Label varianceLabel; + private System.Windows.Forms.Label medianLabel; + private System.Windows.Forms.Label mode; + private System.Windows.Forms.Label mean; + private System.Windows.Forms.Label meanLabel; + private System.Windows.Forms.TabPage cdfTabPage; + private System.Windows.Forms.DataGridView CDF_data; + private System.Windows.Forms.DataGridViewTextBoxColumn RandomVariable; + private System.Windows.Forms.DataGridViewTextBoxColumn PDF; + private System.Windows.Forms.DataGridViewTextBoxColumn CDF; + private System.Windows.Forms.DataGridViewTextBoxColumn CCDF; + private System.Windows.Forms.TabPage QuantileTabPage; + private System.Windows.Forms.DataGridView QuantileData; + private System.Windows.Forms.DataGridViewTextBoxColumn RiskLevel; + private System.Windows.Forms.DataGridViewTextBoxColumn LowerCriticalValue; + private System.Windows.Forms.DataGridViewTextBoxColumn UpperCriticalValue; + private System.Windows.Forms.MenuStrip menuStrip1; + private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem newToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator; + private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; + private System.Windows.Forms.ToolStripMenuItem printToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem printPreviewToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; + private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem undoToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem redoToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator3; + private System.Windows.Forms.ToolStripMenuItem cutToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem copyToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem pasteToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator4; + private System.Windows.Forms.ToolStripMenuItem selectAllToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem customizeToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem contentsToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator5; + private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem; + private System.Windows.Forms.Label median; + private System.Windows.Forms.Label skewness; + private System.Windows.Forms.Label skewnessLabel; + private System.Windows.Forms.Label kurtosis; + private System.Windows.Forms.Label kurtosisLabel; + private System.Windows.Forms.Label kurtosis_excess; + private System.Windows.Forms.Label kurtosisExcessLabel; + private System.Windows.Forms.Label modeLabel; + private System.Windows.Forms.ToolTip toolTip1; + private System.Windows.Forms.Label CVlabel; + private System.Windows.Forms.Label coefficient_of_variation; + private System.Windows.Forms.Label parameter3Label; + private System.Windows.Forms.TextBox parameter3; + private System.Windows.Forms.Label parameterLabel3; + private System.Windows.Forms.Label parameterLabel2; + private System.Windows.Forms.Label parameterLabel1; + private System.Windows.Forms.Label DistributionLabel; + private System.Windows.Forms.Label parameter3ValueLabel; + private System.Windows.Forms.Label parameter2ValueLabel; + private System.Windows.Forms.Label parameter1ValueLabel; + private System.Windows.Forms.Label distributionValueLabel; + private System.Windows.Forms.SaveFileDialog saveFileDialog; + private System.Windows.Forms.Label supportLabel; + private System.Windows.Forms.Label rangeGreatestLabel; + private System.Windows.Forms.Label rangeLowestLabel; + private System.Windows.Forms.Label rangeLabel; + private System.Windows.Forms.Label supportUpperLabel; + private System.Windows.Forms.Label supportLowerLabel; + private System.Windows.Forms.Label toLabel2; + private System.Windows.Forms.Label toLabel1; + } +} + diff --git a/src/boost/libs/math/dot_net_example/distribution_explorer/DistexForm.cs b/src/boost/libs/math/dot_net_example/distribution_explorer/DistexForm.cs new file mode 100644 index 00000000..eaccfeac --- /dev/null +++ b/src/boost/libs/math/dot_net_example/distribution_explorer/DistexForm.cs @@ -0,0 +1,610 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; +using System.Threading; +using System.Diagnostics; +using System.IO; +using System.Reflection; + +namespace distribution_explorer +{ + /// + /// Main distribution explorer. + /// + public partial class DistexForm : Form + { + + EventLog log = new EventLog(); + /// + /// Main form + /// + public DistexForm() + { + if (!EventLog.SourceExists("EventLogDistex")) + { + EventLog.CreateEventSource("EventLogDistex", "Application"); + } + log.Source = "EventLogDistex"; + log.WriteEntry("DistexForm"); + + InitializeComponent(); + + Application.DoEvents(); + } + + private void Form_Load(object sender, EventArgs e) + { // Load distribution & parameters names, and default values. + try + { + // Create and show splash screen: + this.Hide(); + distexSplash frmSplash = new distexSplash(); + frmSplash.Show(); + frmSplash.Update(); + // Now load our data while the splash is showing: + if (boost_math.any_distribution.size() <= 0) + { + MessageBox.Show("Problem loading any distributions, size = " + boost_math.any_distribution.size().ToString()); + } + for (int i = 0; i < boost_math.any_distribution.size(); ++i) + { + distribution.Items.Add(boost_math.any_distribution.distribution_name(i)); + } + distribution.SelectedIndex = 0; // 1st in array, but could be any other. + // All parameters are made zero by default, but updated from chosen distribution. + parameter1.Text = boost_math.any_distribution.first_param_default(0).ToString(); + parameter2.Text = boost_math.any_distribution.second_param_default(0).ToString(); + parameter3.Text = boost_math.any_distribution.third_param_default(0).ToString(); + // + // Sleep and then close splash; + Thread.Sleep(3000); + frmSplash.Close(); + this.Visible = true; + } + catch + { // + log.WriteEntry("DistexForm_load exception!"); + MessageBox.Show("Problem loading distributions, size = " + boost_math.any_distribution.size().ToString()); + } + } + + private void distribution_SelectedIndexChanged(object sender, EventArgs e) + { + int i = distribution.SelectedIndex; // distribution tab. + parameter1Label.Text = boost_math.any_distribution.first_param_name(i); + parameterLabel1.Text = boost_math.any_distribution.first_param_name(i); // properties tab. + parameter2Label.Text = boost_math.any_distribution.second_param_name(i); + parameter3Label.Text = boost_math.any_distribution.third_param_name(i); + if (boost_math.any_distribution.first_param_name(i).Length.CompareTo(0) != 0) + { // Actually all the distributions have at least one parameters, + parameter1.Visible = true; // so should always be true. + parameterLabel1.Visible = true; + } + else + { // If distribution chosen has no parameter name(s) then hide. + parameter1.Visible = false; + parameterLabel1.Visible = false; + } + parameter1.Text = boost_math.any_distribution.first_param_default(i).ToString(); + // Update parameter default to match distribution. + if (boost_math.any_distribution.second_param_name(i).Length.CompareTo(0) != 0) + { + parameter2.Visible = true; + parameterLabel2.Visible = true; + parameter2ValueLabel.Visible = true; + } + else + { // hide + parameter2.Visible = false; + parameterLabel2.Visible = false; + parameter2ValueLabel.Visible = false; + + } + parameter2.Text = boost_math.any_distribution.second_param_default(i).ToString(); + if (boost_math.any_distribution.third_param_name(i).Length.CompareTo(0) != 0) + { + parameter3.Visible = true; + parameterLabel3.Visible = true; + parameter3ValueLabel.Visible = true; + } + else + { // hide + parameter3.Visible = false; + parameterLabel3.Visible = false; + parameter3ValueLabel.Visible = false; + } + parameter3.Text = boost_math.any_distribution.third_param_default(i).ToString(); + // Update tool tips to show total and supported ranges. + PropertiesTabPage.ToolTipText = "Shows properties and ranges of chosen distribution."; + } + + private boost_math.any_distribution dist; + + private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e) + { // Display a grid of pdf, cdf... values from user's random variate x value. + try + { + if (e.ColumnIndex == 0) + { // Clicked on left-most random variate x column to enter a value. + int i = e.RowIndex; + string s = CDF_data.Rows[i].Cells[0].Value.ToString(); + double x = double.Parse(s); // Get value of users random variate x. + double pdf = dist.pdf(x); // Compute pdf values from x + double cdf = dist.cdf(x); // & cdf + double ccdf = dist.ccdf(x); // & complements. + CDF_data.Rows[i].Cells[1].Value = pdf; // and display values. + CDF_data.Rows[i].Cells[2].Value = cdf; + CDF_data.Rows[i].Cells[3].Value = ccdf; + } + } + catch (SystemException se) + { + MessageBox.Show("Error in random variable value: " + se.Message, "Calculation Error"); + } + } + + private void tabPage2_Enter(object sender, EventArgs e) + { // Properties tab shows distribution's mean, mode, median... + try + { // Show chosen distribution name, and parameter names & values. + int i = distribution.SelectedIndex; + distributionValueLabel.Text = boost_math.any_distribution.distribution_name(i).ToString(); + parameterLabel1.Text = boost_math.any_distribution.first_param_name(i).ToString(); + parameter1ValueLabel.Text = double.Parse(parameter1.Text).ToString(); + parameterLabel2.Text = boost_math.any_distribution.second_param_name(i).ToString(); + parameter2ValueLabel.Text = double.Parse(parameter2.Text).ToString(); + parameterLabel3.Text = boost_math.any_distribution.third_param_name(i).ToString(); + parameter3ValueLabel.Text = double.Parse(parameter3.Text).ToString(); + + // Show computed properties of distribution. + try + { + mean.Text = dist.mean().ToString(); + } + catch + { + mean.Text = "Undefined."; + } + try + { + mode.Text = dist.mode().ToString(); + } + catch + { + mode.Text = "Undefined."; + } + try + { + median.Text = dist.median().ToString(); + } + catch + { + median.Text = "Undefined."; + } + try + { + variance.Text = dist.variance().ToString(); + } + catch + { + variance.Text = "Undefined."; + } + try + { + standard_deviation.Text = dist.standard_deviation().ToString(); + } + catch + { + standard_deviation.Text = "Undefined."; + } + try + { + skewness.Text = dist.skewness().ToString(); + } + catch + { + skewness.Text = "Undefined."; + } + try + { + kurtosis.Text = dist.kurtosis().ToString(); + } + catch + { + kurtosis.Text = "Undefined."; + } + try + { + kurtosis_excess.Text = dist.kurtosis_excess().ToString(); + } + catch + { + kurtosis_excess.Text = "Undefined."; + } + try + { + coefficient_of_variation.Text = dist.coefficient_of_variation().ToString(); + } + catch + { + coefficient_of_variation.Text = "Undefined."; + } + + rangeLowestLabel.Text = dist.lowest().ToString(); + rangeGreatestLabel.Text = dist.uppermost().ToString(); + supportLowerLabel.Text = dist.lower().ToString(); + supportUpperLabel.Text = dist.upper().ToString(); + cdfTabPage.ToolTipText = "Random variate can range from " + rangeLowestLabel.Text + + " to " + rangeGreatestLabel.Text + + ",\nbut is said to be supported from " + supportLowerLabel.Text + + " to " + supportUpperLabel.Text + + "\nWithin this supported range the PDF and CDF have values between 0 and 1,\nbut below " + supportLowerLabel.Text + " both are zero, and above " + + supportUpperLabel.Text + " both are unity"; + } + catch (SystemException se) + { + MessageBox.Show(se.Message, "Calculation Error!"); + } + } + + private void properties_tab_Deselecting(object sender, TabControlCancelEventArgs e) + { + try + { + if (e.TabPageIndex == 0) + { // Update selected distribution object: + double x = double.Parse(parameter1.Text); + double y = double.Parse(parameter2.Text); + double z = double.Parse(parameter3.Text); + int i = distribution.SelectedIndex; + dist = new boost_math.any_distribution(i, x, y, z); + // Clear existing CDF data (has to be a better way?): + while (CDF_data.Rows.Count > 1) + { + CDF_data.Rows.Remove(CDF_data.Rows[0]); + } + // Clear existing quantile data (has to be a better way?): + while (QuantileData.Rows.Count > 1) + { + QuantileData.Rows.Remove(QuantileData.Rows[0]); + } + } + } + catch (SystemException se) + { + MessageBox.Show(se.Message + + " Please check the distribution's parameters and try again.", "Distribution Error"); + this.propertiesTab.SelectedIndex = 0; + e.Cancel = true; + } + } + + private void QuantileData_CellEndEdit(object sender, DataGridViewCellEventArgs e) + { // aka Risk & critical values tab. + try + { + if (e.ColumnIndex == 0) + { + int i = e.RowIndex; + string s = QuantileData.Rows[i].Cells[0].Value.ToString(); + double x = double.Parse(s); + // Remember x is alpha: 1 - the probability: + double lcv = dist.quantile(x); + double ucv = dist.quantile_c(x); + QuantileData.Rows[i].Cells[1].Value = lcv; + QuantileData.Rows[i].Cells[2].Value = ucv; + } + } + catch (SystemException se) + { + // TODO add some proper handling here! + MessageBox.Show("Error in probability value: " + se.Message, "Calculation Error"); + } + } + + private void QuantileTab_Enter(object sender, EventArgs e) + { // Evaluate critical values (quantiles) for pre-chosen risk level. + // and then, optionally, for other user-provided risk levels. + try + { + if (QuantileData.Rows.Count == 1) + { + // Add some defaults: + QuantileData.Rows.Add(5); // 5 Risk levels. + QuantileData.Rows[0].Cells[0].Value = "0.001"; // Risk values as text, + QuantileData.Rows[0].Cells[1].Value = dist.quantile(0.001); // & as double. + QuantileData.Rows[0].Cells[2].Value = dist.quantile_c(0.001); + QuantileData.Rows[1].Cells[0].Value = "0.01"; + QuantileData.Rows[1].Cells[1].Value = dist.quantile(0.01); // 99% confidence. + QuantileData.Rows[1].Cells[2].Value = dist.quantile_c(0.01); + QuantileData.Rows[2].Cells[0].Value = "0.05"; + QuantileData.Rows[2].Cells[1].Value = dist.quantile(0.05); + QuantileData.Rows[2].Cells[2].Value = dist.quantile_c(0.05); + QuantileData.Rows[3].Cells[0].Value = "0.1"; + QuantileData.Rows[3].Cells[1].Value = dist.quantile(0.1); + QuantileData.Rows[3].Cells[2].Value = dist.quantile_c(0.1); + QuantileData.Rows[4].Cells[0].Value = "0.33333333333333333"; + QuantileData.Rows[4].Cells[1].Value = dist.quantile(0.33333333333333333); + QuantileData.Rows[4].Cells[2].Value = dist.quantile_c(0.33333333333333333); + } + } + catch (SystemException se) + { + // TODO add some proper handling here! + MessageBox.Show(se.Message, "Calculation Error"); + } + } + + + private void properties_tab_SelectedIndexChanged(object sender, EventArgs e) + { + } + + private void tabPage1_Click(object sender, EventArgs e) + { + } + + private void CDF_data_CellContentClick(object sender, DataGridViewCellEventArgs e) + { + } + + distexAboutBox DistexAboutBox = new distexAboutBox(); + + private void aboutToolStripMenuItem_Click(object sender, EventArgs e) + { + DistexAboutBox.ShowDialog(); + } + + private void DistexForm_Activated(object sender, EventArgs e) + { + } + + /// get AssemblyDescription + public string AssemblyDescription + { + get + { + // Get all Description attributes on this assembly + object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false); + // If there aren't any Description attributes, return an empty string + if (attributes.Length == 0) + return ""; + // If there is a Description attribute, return its value + return ((AssemblyDescriptionAttribute)attributes[0]).Description; + } + } + + private void saveFileDialog1_FileOk(object sender, CancelEventArgs e) + { + using (StreamWriter sw = new StreamWriter(this.saveFileDialog.FileName)) + { // Write distribution info and properties to file. + sw.WriteLine( AssemblyDescription); + sw.WriteLine("Version " + Assembly.GetExecutingAssembly().GetName().Version.ToString()); + // Get parameter names (null "" if no parameter). + int i = distribution.SelectedIndex; + distributionValueLabel.Text = boost_math.any_distribution.distribution_name(i).ToString(); + sw.WriteLine(distributionValueLabel.Text + " distribution"); + parameterLabel1.Text = boost_math.any_distribution.first_param_name(i).ToString(); + parameterLabel2.Text = boost_math.any_distribution.second_param_name(i).ToString(); + parameterLabel3.Text = boost_math.any_distribution.third_param_name(i).ToString(); + string separator = "\t "; // , or tab or space? + // Write parameter name & value. + sw.WriteLine(parameterLabel1.Text + separator + this.parameter1.Text); + if (boost_math.any_distribution.second_param_name(i).Length.CompareTo(0) != 0) + { // Is a 2nd parameter. + sw.WriteLine(parameterLabel2.Text + separator + this.parameter2.Text); + } + if (boost_math.any_distribution.third_param_name(i).Length.CompareTo(0) != 0) + { // Is a 3rd parameter. + sw.WriteLine(parameterLabel3.Text + separator + this.parameter3.Text); + } + sw.WriteLine(); + sw.WriteLine("Properties"); + // Show computed properties of distribution. + double x = double.Parse(parameter1.Text); + double y = double.Parse(parameter2.Text); + double z = double.Parse(parameter3.Text); + dist = new boost_math.any_distribution(i, x, y, z); + // Note global dist might not have been calculated yet if no of the tabs clicked. + try + { + mean.Text = dist.mean().ToString(); + } + catch + { + mean.Text = "Undefined"; + } + sw.WriteLine("Mean" + separator + mean.Text); + try + { + mode.Text = dist.mode().ToString(); + } + catch + { + mode.Text = "Undefined"; + } + sw.WriteLine("mode" + separator + mode.Text); + try + { + median.Text = dist.median().ToString(); + } + catch + { + median.Text = "Undefined"; + } + sw.WriteLine("Median" + separator + median.Text); + try + { + variance.Text = dist.variance().ToString(); + } + catch + { + variance.Text = "Undefined"; + } + sw.WriteLine("Variance" + separator + variance.Text); + try + { + standard_deviation.Text = dist.standard_deviation().ToString(); + } + catch + { + standard_deviation.Text = "Undefined"; + } + sw.WriteLine("Standard Deviation" + separator + standard_deviation.Text); + try + { + skewness.Text = dist.skewness().ToString(); + } + catch + { + skewness.Text = "Undefined"; + } + sw.WriteLine("Skewness" + separator + skewness.Text); + try + { + coefficient_of_variation.Text = dist.coefficient_of_variation().ToString(); + } + catch + { + coefficient_of_variation.Text = "Undefined"; + } + sw.WriteLine("Cofficient of variation" + separator + coefficient_of_variation.Text); + try + { + kurtosis.Text = dist.kurtosis().ToString(); + } + catch + { + kurtosis.Text = "Undefined"; + } + sw.WriteLine("Kurtosis" + separator + kurtosis.Text); + try + { + kurtosis_excess.Text = dist.kurtosis_excess().ToString(); + } + catch + { + kurtosis_excess.Text = "Undefined"; + } + sw.WriteLine("Kurtosis excess" + separator + kurtosis_excess.Text); + sw.WriteLine(); + + sw.WriteLine("Range from" + separator + dist.lowest().ToString() + separator + + "to" + separator + dist.uppermost().ToString()); + sw.WriteLine("Support from " + separator + dist.lower().ToString() +separator+ + "to " + separator + dist.upper().ToString()); + sw.WriteLine(); + + // + sw.WriteLine("Quantiles"); + if (QuantileData.Rows.Count == 1) + { // Add some defaults: + QuantileData.Rows.Add(5); // 5 Risk levels. + QuantileData.Rows[0].Cells[0].Value = "0.001"; // Risk values as text, + QuantileData.Rows[0].Cells[1].Value = dist.quantile(0.001); // & as double. + QuantileData.Rows[0].Cells[2].Value = dist.quantile_c(0.001); + QuantileData.Rows[1].Cells[0].Value = "0.01"; + QuantileData.Rows[1].Cells[1].Value = dist.quantile(0.01); // 99% confidence. + QuantileData.Rows[1].Cells[2].Value = dist.quantile_c(0.01); + QuantileData.Rows[2].Cells[0].Value = "0.05"; + QuantileData.Rows[2].Cells[1].Value = dist.quantile(0.05); + QuantileData.Rows[2].Cells[2].Value = dist.quantile_c(0.05); + QuantileData.Rows[3].Cells[0].Value = "0.1"; + QuantileData.Rows[3].Cells[1].Value = dist.quantile(0.1); + QuantileData.Rows[3].Cells[2].Value = dist.quantile_c(0.1); + QuantileData.Rows[4].Cells[0].Value = "0.33333333333333333"; + QuantileData.Rows[4].Cells[1].Value = dist.quantile(0.33333333333333333); + QuantileData.Rows[4].Cells[2].Value = dist.quantile_c(0.33333333333333333); + } + // else have already been calculated by entering the quantile tab. + for (int r = 0; r < QuantileData.Rows.Count-1; r++) + { // Show all the rows of quantiles, including any optional user values. + sw.WriteLine(QuantileData.Rows[r].Cells[0].Value.ToString() + separator + + QuantileData.Rows[r].Cells[1].Value.ToString() + separator + + QuantileData.Rows[r].Cells[2].Value.ToString()); + } + sw.WriteLine(); + sw.WriteLine("PDF, CDF & complement(s)"); + for (int r = 0; r < CDF_data.Rows.Count-1; r++) + { // Show all the rows of pdf, cdf, including any optional user values. + sw.WriteLine(CDF_data.Rows[r].Cells[0].Value.ToString() + separator + // x value. + CDF_data.Rows[r].Cells[1].Value.ToString() + separator + // pdf + CDF_data.Rows[r].Cells[2].Value.ToString() + separator + // cdf + CDF_data.Rows[r].Cells[3].Value.ToString());// cdf complement. + } + sw.WriteLine(); + } + + } // saveFileDialog1_FileOk + + private void saveToolStripMenuItem_Click(object sender, EventArgs e) + { + this.saveFileDialog.ShowDialog(); + } + + private void saveAsToolStripMenuItem_Click(object sender, EventArgs e) + { // Same as Save. + this.saveFileDialog.ShowDialog(); + } + + private void contentsToolStripMenuItem_Click(object sender, EventArgs e) + { // In lieu of proper help. + string helpText = "\n" + AssemblyDescription + + "\nVersion " + Assembly.GetExecutingAssembly().GetName().Version.ToString() + + "\nA Windows utility to show the properties of distributions " + + "\nand permit calculation of probability density (or mass) function (PDF) " + + "\nand cumulative distribution function (CDF) and complements from values provided." + + "\nQuantiles are also calculated for typical risk (alpha) probabilities" + + "\nand for probabilities provided by the user." + + "\n" + + "\nResults can be saved to text files using Save or SaveAs." + + "\nAll the values on the four tabs are output to the file chosen," + + "\nand are tab separated to assist input to other programs," + + "\nfor example, spreadsheets or text editors." + + "\nNote: when importing to Excel, by default only 10 decimal digits are shown by Excel:" + + "\nit is necessary to format all cells to display the full 15 decimal digits," + + "\nalthough not all computed values will be as accurate as this." + + "\n\nValues shown as NaN cannot be calculated for the value given," + + "\nmost commonly because the value is outside the range for the distribution." + + "\n" + + "\nFor more information, including downloads, see " + + "\nhttp://sourceforge.net/projects/distexplorer/" + + "\n(Note that .NET framework 4.0 and VC Redistribution X86 are requirements for this program.)" + + "\n\nCopyright John Maddock & Paul A. Bristow 2007, 2009, 2010, 2012"; + + MessageBox.Show("Statistical Distribution Explorer\n" + helpText); + } + + private void newToolStripMenuItem_Click(object sender, EventArgs e) + { + MessageBox.Show("New is not yet implemented."); + } + + private void openToolStripMenuItem_Click(object sender, EventArgs e) + { + MessageBox.Show("Open is not yet implemented."); + } + + private void printToolStripMenuItem_Click(object sender, EventArgs e) + { + MessageBox.Show("Print is not yet implemented." + + "\nSave all values to a text file and print that file."); + } + + private void printPreviewToolStripMenuItem_Click(object sender, EventArgs e) + { + MessageBox.Show("Print Preview is not yet implemented." + + "\nSave all values to a text file and print that file."); + } + + + private void exitToolStripMenuItem_Click(object sender, EventArgs e) + { // exit DistexForm + this.Close(); + } + } // class DistexForm +} // namespace distribution_explorer \ No newline at end of file diff --git a/src/boost/libs/math/dot_net_example/distribution_explorer/DistexForm.resx b/src/boost/libs/math/dot_net_example/distribution_explorer/DistexForm.resx new file mode 100644 index 00000000..5019fd5c --- /dev/null +++ b/src/boost/libs/math/dot_net_example/distribution_explorer/DistexForm.resx @@ -0,0 +1,294 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 284, 17 + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + 159, 17 + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAASdAAA + EnQB3mYfeAAAAQ9JREFUOE+t09lqwkAUBmBfyr5DfY32jaReSOmFCyKCgkKLFrVUBZeKiEbshqRuaNw1 + xiXmLxMJBJ0Zc+GBw9zMfDPnHMZmu1ZE35s4zXCqjmC8Al+sgHLjD9y7yGFWPIbecOO45yORtMAEHnxx + JHL1IyKI9JeEXqtMwOl50Q8bSS0l8PzBBPbqAQQxICrgjeapgKZpkJUdBmNZB+y3d/QSnsIZKrDdqZjM + FYj9OR9wB1NngHrQsJC36EkrfIkTPuDyJ84AZbOHNF2j1Z2h9i3xAVKfOUjjZssN2oMFmq0xSkLfOmBu + 3E97iurnENlKxzpgbpzwO0Kh1kOyKFoDjHmzVuYYjRmTDZfyWh9Yd/4B2Mz2w1z7EGUAAAAASUVORK5C + YII= + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAASdAAA + EnQB3mYfeAAAAlpJREFUOE+tk21Ik1EYhif0oyA0sqIQCix/+GcQFFH9CCmiUBTLLEjShJofVBgL2fxo + U9Pp5ubUlS5rU9f8rCyjsA+pUCRCTR1ppmVFUSlmhq78unrnQF1KGHTg/nEOz30993PO+7qJFrmUeiv2 + n+Mij+XLRLLYULdF2pxlEVIDcw0pAsyxD5fmI/rQ94pqi26eOlsfuZj+7BgSm01QdA4ih7m73Yx9qGpa + vwatjPebqCzOprPt8YKQgzFagqL0BEjyEFWVaBkdLHMxT34uYNwWR9nVTEoL0zHlp2DMSeaSRk6eKt4V + Wm5WM/rVPNN5SjDTLQebZEHNA1wrUvHjk3E6tsNcV62e1r3KLGqtKm6WplNpSsVqVFJsOM8VfSKFWjkG + tcyZptSYzvC7XByx3zQoqCnTMvlGCX1prnornPUmQJcUXsbSVhGK5bIOkcmQyveeTHiv4VZ5Nk33Nc6i + uSO8CIfmECYa/bE/8ON1iRipJNh5F0V6Bd86lfQ1JlFj1TDVq4COKCegLVIwHmGiKRB7/V6G7+5koHoz + ymgfYRy5E1CgTWKgXcZ1i5qWp0KSrjgBcAJawph6FszYk/2M1O1isGYLX8p9ab6wgqP+3rMvYciS01Gf + zA1LFvQkQ6sQ9/khxhoCGHnox1DtNvorxXw0b8Km8UQh2cip6GOzgNyMeKqKM7HdjqFZJ5pRk2YJ9aql + 3EnxoCJxNaZ4Ly6e3UDY3O6OEXRp59ApTpIhiyDh9GHORAZyPHQPB/ZtZ/cOMVvFPvh6e7F+3SrWrHRn + raf7Xz/xf/rJ/kvxb84I3U1y+9/WAAAAAElFTkSuQmCC + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAASdAAA + EnQB3mYfeAAAAixJREFUOE+tk91Lk3EUx/cvdN9N0EW3NTWGa7EaPOUcyqphWBG9PZEv5dJlmqhYmUYt + XyBb4dJJy+kknFT4BqZIjaFMJUszV7TEoabYRDD49ju/6Pm1Mi+iH5zLz+c855zvo1L9j/fsaRRUvvZl + tHmX8Ni9gMaGCO47ZlBb8wn22yHcKJ9CackECgteIy93FBfOB6H0JrC3B6ipXsVGb2V1Dca0XhxOe8JL + EXhbF7mgsuLLX3mCIwsr2G1+DrVahuWQRwjcj+a5oLTk87qCn/D78CLiTD4UXJ7GAXOTEDjrZ7ngku3d + H4Jf4ZHJCLZJXlhzxpGa4hSCurthLsjOGo0R/A4PBsPYrHdDlgMwmRxCUF31kQvkMwFFsB7c4/+ATYkN + OHL0BZKSaoXgZuU0urvATgkcP/kKlmMDfNu0MJqZPps6/4D7cNDSCUmyC8HVskl0+MAyADS5vrG7f0X5 + 9Tm+VFoYzZyZEVTg5NR2GAwVQnClcByeZuChc40FJwpjek5MmU/YkH6uiHdOTmHwfg/0+jIhsOWNMRio + uhPlnUnAQoI4rYSht7MYm5qDnHsNe41tHNbucUGnKxICiqXjHpTPJgHBZ/Nv4U1oHqGZJVwstiNe72Jw + I+J3PYA2MV8IMjOG2dzLfOatBg+27JDQ0tEPX9cguvv8GHg5hH0mC9S6eiQweLumDhqNVQgo06dP9fN4 + UsIoJHRnOhVtmxZGM1NXKoJ3JmTHCv71r/4OTrQ4xWMwWlcAAAAASUVORK5CYII= + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAASdAAA + EnQB3mYfeAAAAi1JREFUOE+1k/9PUlEYxv2nWK2tVlttGmpltrCcEQ1XUjSMaUHJNLIpNcnCragplBvU + oC/okJhZLG92ySUpU8RNICdIhAioEF+e7r1UZMDW1jrb+8t7z/N83vucc8rK/sdyeYIwvpopWYbRaZTk + 0uIx0o0/V/JbGt7lVTwxT6CKKyltoLd8xGYihS/hKGz2WaaeWUnoTATsMz7UCztx9Ex7cYN3jkUQU4tb + 4DR5LZaAcyEAg4VE5YlLMFmJQoNQJA61gUA6k4XPH9pCN9s+gZz2oq5Jjlq+DDfUz3Fba86bOGY9jHiU + dDF0mvqT7A/F4fKEcE9nZf5d1jOIB4ZxVJ2U5gyc8z70akegMX3AXb0ND1+8R6/GgvZbeog61OA2K3CA + 2lxR34JjZ69B2T8EsVyN/Q0XcwY3B14iGk8UpE43UukMNqhA6QyC4Q0srcQg7dagsbWHmuDHScj7jDC9 + nsJTqx0a4xjuaIfRqXoMSXc/hG0q8C4owGnqwEGeFOXHxThH9eoEV7G7VpiboE2pK0qnm9H1JLz+NUzO + BfHWEcAQsQSuqAuVDa1gVZzKGUgUjwoMqAzxNZbC3Od1jDvDYPdth+7NCpP8Yf4V7KoR5A1arg8gmQIo + GMLxLJYjWSwEMphwb2J4MoZB2yqULBZUIxHGYB9HlBfTE4jl9+GmBPTHv6lfo//+GGoaZajmXQabumXl + 1HHt5TRjz5Hz2HlIgB3Vp7GNzWeoRcX/+pq/AwHYL0leVl8fAAAAAElFTkSuQmCC + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAASdAAA + EnQB3mYfeAAAAY5JREFUOE+d081LAkEUAPD1T+hYhzoERV77OHUo8JBBt+4RRkSQ4U0SunaJOkSRKQWZ + WCiF5kdroa0WRAoRFXXoEEkWCUFYWbvrvnqz7NK6OxANPIZh5v1m3uyOKZK5AaamiaLICILACDzPtDXX + M+3mRlPtGnWMAK15g4fQabVBYDej20QFdtJXVGBxg4Xk8aWMRDhjJLh/TgUW1hPQ1T+ihmEZgXieCghi + FRBRIEPAFzkxBO4fSsByOfBsRkkE4xkoFEv6Mla3szoAF2Jy+E2A0KMc/nyRINe3BS2yspXSAf4YR5Kf + q/LUE1QJopxEU8qSP6kD5nwxFUAEA0E8hdM1rz0BXtDvhheHwMEnwKkkJ2OPAJMuw+TUDB2QJAneKzxg + CRNnHwTBUJJd3ijYx8fowBcvwstrBXIXdxBOZAmCu2JgssMxBGvOOmNA+d5KP+sJw17qiJRjn3bDwOAo + cF4LQMWtRTABf9W/hLWjFcpsA0Fctm76+6C+vJ+J4b4WgmAp/0bMTXVg6ekFNrQM3y3xMcC3lb+tAAAA + AElFTkSuQmCC + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAASdAAA + EnQB3mYfeAAAAYdJREFUOE+t001LQlEQBuB+TdCmRVEJRRIWtRAUlKsQhFmkpZQtIiWyAlMwP5KkXS0s + hLqGFkgoFqWQmaRR2qIvU7FMwWhd8JZXkFx0uVGzOcNh5jkDw6mr+++4SN7B6fbju/uQecYm6a25+/Hd + l2IJptWNmmJyL4DwWZwZUJbtayT8RxGqIV8oQaaaRfrxkTmw4z2G+WuKbC6PYDgOkUSJp6ccc+AgdI4l + uwPbHh/UCxb0S0aZN5fHTmefMTVvwfDEHIiBMegMpt8BZUShNoGQTIKQGxA8TTIHMoUPGF1vEOvTWHTc + gqeJQahNwLqVQiRRpIdS+XcM2l4h1t2DI3WAP7oGoSYE3kwSPQofljcqm/kxjK4SCH0OXSMetItsUC26 + wZuOVptYhI0eEOuz1YI2gZnKBdpr6iR9V2jkKOkBQpeiCryhFFr4eioft16iU7qNho4h1Dc00QOqlRuw + pSSa+UawuZXdByIZsPoUaOmWwrUfowcOozlwZeto7ZXDuXvCfHV/+dGfqqrf44qgu28AAAAASUVORK5C + YII= + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAASdAAA + EnQB3mYfeAAAAeJJREFUOE+lk9FPklEYxv1TSsecde0f0FpZrTbbal7URVvZuuJCr7pq2WzLNWy0iSHN + wtIB9qG0ltLSYRJpBomUgZPMGSyU8SmJIOiv7zssCdrAzXd77s77e5/nnPdUVR20HBPfUCWNB4QsI176 + HB8IL/9iX2y1ubTMwx6utz0nuLhcGWIfCxT153Z26ep/g9Md4FJLZ2WIZdQnAM4QSJ/BH5Z5aH6NNClj + m0hgdSV4MppAPxQXCq5kil31OTx7DjLbOeSNNJFYUgBKq31glfpmN76F9QLEZHOJc73ubXQjMreln7Q+ + DdP/du0/QIsxhmNK5mjTMJ/m43mIQcmr5t5MZVlNpFiKrPM1vIbpVVQAOqSckF+ZekUX5UjTS+ouDFLb + +CwPUPNupbN7k7WmEDcMX3hgXSpyIP/OsrCyhXtuA6M0g+bc4wJATqaZ/x7DF4zg8f9g/OMibb355701 + kERriHL5fojzd2aFjNI0mjPdBUD96auUqlU/KwBZJV4skWUuvMmYV8b+Ls6jQQ81DfryO3KtfUoA/p38 + 10G37T3VJ3TlARdvukhldjANeemxz2B8MS0mq80GyySHj98rD2jQOpXbtgrVNprRnO2h5lQX1Sc7leYO + Dh27W3nN9/WZDnroDx0A5wwhdtmtAAAAAElFTkSuQmCC + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAASdAAA + EnQB3mYfeAAAAlBJREFUOE+1k1lIlGEUhn/owm6KFuqqq4LoJooIqouMwixMM4zEjKyJGJUSlcnSITU1 + RSe3SdPGyGVQc6tEUSkSIXFo13CMFonUyGmy5p9xz+Lp/z8ZbGjzpgMv5+a8z1n4Pkn6H9HZnEH7zVQa + yxKYF7+hMg+3ynKO4LBVMWa7xmBfNme1vuSl67hi0GNMj/sVqBon5XqmnXVMOqoxF+sYH6kgJyWKF13x + nD/tT7xmM7bOY4y0riY6bL8nRAWo5mlnDUUZR+m2ZCO/L2C4T89bywmaSgIJD/WmKnEVT/MkIg/v8wTU + VeTMAuQbGBLDSNaFoI8K5lxkEDptIDEafyJCfciPXiMAIX7enoDqUgNTci1TdhPjQ5nYn0dhrVgu1Fu+ + jO7iRTwyegmzKp9tGz0BZlMGE/YyJgbSGH95irFnB5GbF5Nb3kqmqZELl2uJN5iJSS0hPMFIWGyWJ6C0 + MJXRQSNjfVpGH/vjur+Jj7dXCLM7pme+4XBOMjDsIDgihYDj+jlISW4S8qs0XA99cXWsx9m2ksFySXRW + o/RWp5Cppp3efpsw3+2ysidIMwspzErgc88ZnO3rkFuWYq/3ov+6JMb+OvOdLy6l8wcHvW9sWHre4Rca + g69i3rX3AN7bdyDlX4zD/iBCMS/hU8NChioXYC2SiFZ2Vsd2T3BVmaDA3EZTh1VkVVs3rEW6lBwrHoj7 + yu6sVQ72c+d7ltfCXH+nm5rWJ3MAdY3cpJPKCwtEE7SbgJ1bBFm9trqzu9vvspjgT3FIubZa8C/N67P9 + regHTvjvLQ3rR38AAAAASUVORK5CYII= + + + + 17, 17 + + + + AAABAAIAEBAQAAAABAAoAQAAJgAAACAgEAAAAAQA6AIAAE4BAAAoAAAAEAAAACAAAAABAAQAAAAAAMAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAgAAAAICAAIAAAACAAIAAgIAAAICAgADAwMAAAAD/AAD/ + AAAA//8A/wAAAP8A/wD//wAA////AAAAAAAAAAAAAH//j/j/jwAAf/+P+P+PAAB4iIiIiIgAAH93h3h3 + jwAAf3eHeHePAAB4iIiIiIgAAH93h3h3jwAAf3eHeHePAAB4iIiIiIgAAH93h3h3jwAAf3eHeHePAAB4 + iIiIgAAAAH//j/j39wAAf/+P+PdwAAB3d3d3dwAAwAEAAMABAADAAQAAwAEAAMABAADAAQAAwAEAAMAB + AADAAQAAwAEAAMABAADAAQAAwAEAAMADAADABwAAwA8AACgAAAAgAAAAQAAAAAEABAAAAAAAAAIAAAAA + AAAAAAAAEAAAABAAAAAAAAAAAACAAACAAAAAgIAAgAAAAIAAgACAgAAAgICAAMDAwAAAAP8AAP8AAAD/ + /wD/AAAA/wD/AP//AAD///8Au7u7u7u7u7u7u7u7RLREu7u7u7u7u7u7u7u7u7S7S7u7u7u7u7u7u7u7 + u7u7u7u7u7u7u7u7u7u7u7u0RERES7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u0RLu7u0RLu7u7u7u7u7 + u7u0u7S7u0u7u7u7u7u7u7u7RLtES7RLu7u7u7u7u7u7u7S7tLu7S7u7u7u7u7u7u7u7u7u7u7u7u7u7 + u7u7u7u0REREREREREu7u7u7u7u7u7u7u7u7u7u7u7u7u0RLu7u7u7u0RLu7u7u7u7u0u7S7u7u7u0u7 + u7u7u7u7RLtES7u7u7RLu7u7u7u7u7S7tLu7u7u7S7u7u7u7u7u7u7u7u7u7u7u7u7u0RLu7RERERERE + RERERERLu0u7u7u7u7u7u7u7u7u7u7tLu0u7u7u7u0RLu7u7u7u7S7REu7u7u7u0u7u7u7u7tEu7S7u7 + u7u7RLu7u7u7u7tLu7u7u7u7u7S7u7u7u7u7u7u7u7u7u7u7u7u7u7u7tERERERERERERERERERES7u7 + u7u7u7u7u7u7u7u7u7u7u7u7u7u7REu7u7u7u7u7u7u7u7u7u7S7u7u7u7u7u7u7u7u7u7u0u7u7u7u7 + u7u7u7u7u7u7tLu7u7u7u7u7u7u7u7u7u0S7u7u7u7u7u7u7u7u7u7u0u7u7u7u7u7sAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== + + + \ No newline at end of file diff --git a/src/boost/libs/math/dot_net_example/distribution_explorer/DistexSplash.Designer.cs b/src/boost/libs/math/dot_net_example/distribution_explorer/DistexSplash.Designer.cs new file mode 100644 index 00000000..a37157eb --- /dev/null +++ b/src/boost/libs/math/dot_net_example/distribution_explorer/DistexSplash.Designer.cs @@ -0,0 +1,141 @@ +namespace distribution_explorer +{ + partial class distexSplash + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(distexSplash)); + this.labelApplicationTitle = new System.Windows.Forms.Label(); + this.labelApplicationVersion = new System.Windows.Forms.Label(); + this.labelApplicationCopyright = new System.Windows.Forms.Label(); + this.labelApplicationDescription = new System.Windows.Forms.Label(); + this.pictureBox1 = new System.Windows.Forms.PictureBox(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); + this.groupBox1.SuspendLayout(); + this.SuspendLayout(); + // + // labelApplicationTitle + // + this.labelApplicationTitle.BackColor = System.Drawing.SystemColors.Control; + this.labelApplicationTitle.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F); + this.labelApplicationTitle.ForeColor = System.Drawing.Color.Black; + this.labelApplicationTitle.Location = new System.Drawing.Point(331, 27); + this.labelApplicationTitle.Name = "labelApplicationTitle"; + this.labelApplicationTitle.Size = new System.Drawing.Size(313, 133); + this.labelApplicationTitle.TabIndex = 0; + this.labelApplicationTitle.Text = "labelApplicationTitle"; + this.labelApplicationTitle.TextAlign = System.Drawing.ContentAlignment.TopCenter; + // + // labelApplicationVersion + // + this.labelApplicationVersion.BackColor = System.Drawing.SystemColors.Control; + this.labelApplicationVersion.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.labelApplicationVersion.ForeColor = System.Drawing.SystemColors.ControlText; + this.labelApplicationVersion.Location = new System.Drawing.Point(302, 158); + this.labelApplicationVersion.Name = "labelApplicationVersion"; + this.labelApplicationVersion.Size = new System.Drawing.Size(320, 20); + this.labelApplicationVersion.TabIndex = 1; + this.labelApplicationVersion.Text = "labelApplicationVersion"; + this.labelApplicationVersion.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + this.labelApplicationVersion.Click += new System.EventHandler(this.labelApplicationVersion_Click); + // + // labelApplicationCopyright + // + this.labelApplicationCopyright.BackColor = System.Drawing.SystemColors.Control; + this.labelApplicationCopyright.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F); + this.labelApplicationCopyright.ForeColor = System.Drawing.SystemColors.ControlText; + this.labelApplicationCopyright.Location = new System.Drawing.Point(59, 191); + this.labelApplicationCopyright.Name = "labelApplicationCopyright"; + this.labelApplicationCopyright.Size = new System.Drawing.Size(563, 20); + this.labelApplicationCopyright.TabIndex = 2; + this.labelApplicationCopyright.Text = "labelApplicationCopyright"; + this.labelApplicationCopyright.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // labelApplicationDescription + // + this.labelApplicationDescription.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F); + this.labelApplicationDescription.ForeColor = System.Drawing.SystemColors.ControlText; + this.labelApplicationDescription.Location = new System.Drawing.Point(27, 234); + this.labelApplicationDescription.Name = "labelApplicationDescription"; + this.labelApplicationDescription.Size = new System.Drawing.Size(608, 29); + this.labelApplicationDescription.TabIndex = 3; + this.labelApplicationDescription.Text = "labelApplicationDescription"; + this.labelApplicationDescription.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // pictureBox1 + // + this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); + this.pictureBox1.Location = new System.Drawing.Point(27, 27); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(282, 92); + this.pictureBox1.TabIndex = 4; + this.pictureBox1.TabStop = false; + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.labelApplicationVersion); + this.groupBox1.Controls.Add(this.labelApplicationCopyright); + this.groupBox1.Location = new System.Drawing.Point(13, 12); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(644, 254); + this.groupBox1.TabIndex = 5; + this.groupBox1.TabStop = false; + // + // distexSplash + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.SystemColors.Control; + this.ClientSize = new System.Drawing.Size(669, 276); + this.Controls.Add(this.pictureBox1); + this.Controls.Add(this.labelApplicationDescription); + this.Controls.Add(this.labelApplicationTitle); + this.Controls.Add(this.groupBox1); + this.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.Name = "distexSplash"; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Statistical Distribution Explorer"; + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); + this.groupBox1.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Label labelApplicationTitle; + private System.Windows.Forms.Label labelApplicationVersion; + private System.Windows.Forms.Label labelApplicationCopyright; + private System.Windows.Forms.Label labelApplicationDescription; + private System.Windows.Forms.PictureBox pictureBox1; + private System.Windows.Forms.GroupBox groupBox1; + } +} \ No newline at end of file diff --git a/src/boost/libs/math/dot_net_example/distribution_explorer/DistexSplash.cs b/src/boost/libs/math/dot_net_example/distribution_explorer/DistexSplash.cs new file mode 100644 index 00000000..9aa07084 --- /dev/null +++ b/src/boost/libs/math/dot_net_example/distribution_explorer/DistexSplash.cs @@ -0,0 +1,126 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; +using System.Reflection; + +namespace distribution_explorer +{ /// namespace distribution_explorer + public partial class distexSplash : Form + { /// Splash + public distexSplash() + { + InitializeComponent(); + this.labelApplicationTitle.Text = AssemblyTitle; + this.labelApplicationDescription.Text = AssemblyDescription; + this.labelApplicationCopyright.Text = AssemblyCopyright; + this.labelApplicationVersion.Text = "Version " + AssemblyVersion; + } + + #region Assembly Attribute Accessors + /// get AssemblyTitle + public string AssemblyTitle + { + get + { + // Get all Title attributes on this assembly + object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false); + // If there is at least one Title attribute + if (attributes.Length > 0) + { + // Select the first one + AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0]; + // If it is not an empty string, return it + if (titleAttribute.Title != "") + return titleAttribute.Title; + } + // If there was no Title attribute, or if the Title attribute was the empty string, return the .exe name + return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase); + } + } + /// get AssemblyVersion + public string AssemblyVersion + { + get + { + return Assembly.GetExecutingAssembly().GetName().Version.ToString(); + } + } + + //public string AssemblyGuid + //{ // error CS0117: 'System.Reflection.AssemblyName' does not contain a definition for 'Guid' + // get + // { + // return Assembly.GetExecutingAssembly().GetName().Guid.ToString(); + // } + //} + /// get AssemblyDescription + public string AssemblyDescription + { + get + { + // Get all Description attributes on this assembly + object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false); + // If there aren't any Description attributes, return an empty string + if (attributes.Length == 0) + return ""; + // If there is a Description attribute, return its value + return ((AssemblyDescriptionAttribute)attributes[0]).Description; + } + } + /// get AssemblyProduct + public string AssemblyProduct + { + get + { + // Get all Product attributes on this assembly + object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false); + // If there aren't any Product attributes, return an empty string + if (attributes.Length == 0) + return ""; + // If there is a Product attribute, return its value + return ((AssemblyProductAttribute)attributes[0]).Product; + } + } + /// get AssemblyCopyright + public string AssemblyCopyright + { + get + { + // Get all Copyright attributes on this assembly + object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false); + // If there aren't any Copyright attributes, return an empty string + if (attributes.Length == 0) + return ""; + // If there is a Copyright attribute, return its value + return ((AssemblyCopyrightAttribute)attributes[0]).Copyright; + } + } + /// get AssemblyCompany + public string AssemblyCompany + { + get + { + // Get all Company attributes on this assembly + object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false); + // If there aren't any Company attributes, return an empty string + if (attributes.Length == 0) + return ""; + // If there is a Company attribute, return its value + return ((AssemblyCompanyAttribute)attributes[0]).Company; + } + } + #endregion + + private void labelApplicationVersion_Click(object sender, EventArgs e) + { + + } + } +} + + + diff --git a/src/boost/libs/math/dot_net_example/distribution_explorer/DistexSplash.resx b/src/boost/libs/math/dot_net_example/distribution_explorer/DistexSplash.resx new file mode 100644 index 00000000..d12898c4 --- /dev/null +++ b/src/boost/libs/math/dot_net_example/distribution_explorer/DistexSplash.resx @@ -0,0 +1,384 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + iVBORw0KGgoAAAANSUhEUgAAARUAAABWCAYAAADhVQKUAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAAScwAA + EnMBjCK5BwAANsVJREFUeF7tfWuMZVd1ZhMMIWDC2JgeOwZsYgPjtN2m676qqhvTgA0Yu9vGT2wMxq92 + 26aN3UnwA2y32/mRRBoN0iQ/UDL5MUyYEYpGmow0migkSBMpihQGjYIsETkGEgti7HR3Vd1bVd0Wmpv1 + rbXX3uvsOvucfe691VXdXEtX5b73PPZe6+zvrPWtx94yHA63TD9TGdQ9A1s20X/0yL5OP4cObfkF+n/9 + vJ7+nz67z5BP6w3D4bY3DocX/+IPf3jhm+g7+sz90ssvb3/LK69sO/PVV3e+9ciR3i8fPdp627FjH/g3 + C8NdZy0O585eWmqd0+/veEe/v33rYND7t68MOue+utw679XlHb+yTJ+Vlbnzj6z03rlCnyMrnXetmA9d + 69323/I7jsPxc+fjfFwH1xvQdXF93Af3w31xf4wD48G4MD6ME+PFuDF+zEPmc/EvyvwwT50z5s8flomT + j5fXSVFj3cM0/X0KOHgGNsN/Fkzc/9eCyXCIxYeF2HrzcLj9LQok9O+3LSxcdtbi4tzZP/EgMr8VALJM + Cx6LH0AAUDi62nr3sdUdF6yuzl64utp9z8Lxzq8uLLQuOn68ddHi8ZmLjx+fu3hxsffe+MPf8++ti3A8 + zsP5ch1cr/VuXB/3wf1wX9y/359nkMG4MD6ME+NVgME8ZD6YVx64xLJbV31OQWMKGjnPwLo+hPUX929a + Cybf/Ka+lddaJtYqobf5mcPhzrfiza9AwtbIcMc7YCnAaviXf7n8fFgUAJDV1Xla8N33HCcQWGRg6L13 + aan9fjrn3/X7s5f0+71f6/c72/on6NNvXzoYtC6Tz5z5yHf4XY7DB+fNXoLr4HrH6bq4Pu4jYDN/Ae6P + cWA8Ys2QJUPjZCvGAQzmgflgXtZ6SVkuTk4KwNZqeV296Ec4IueBmh4zBZ4RHq2JnFLl6nz72+Vg8pOf + iFVCwHIm3u5wJYbkUiwtdd8OCwALFVbBysrl5MZ03gUrZAEWCFkTsDaw4LH4T5wACAA0etsHg+7lg9c6 + H1hYbs0sL/daC8vd9uJyp7NMn5WVdlc+c93Fxdke/up3+B3H4Xg5rzWD6/D16Lq4vtwHYNN+P+7PVg2N + B+MSV+pycpscwLCb1H075oN5YX6YJ+Yr84aLV3SLRE4n0SWaAsYUMHKegYkgRLOLlFonsjhudrxJ4EzU + MlEXZzgUMMHbXTiSeeJHOufCAgCQwP1YWCBLZHHm4qXj3ff1+zNkgXS2icXRvXx5ub0DIMCgsDLbo4U8 + t7TSmadr7aL//yAdewV9PkSgsLu/Sp9+78NrPvw9PjiucwXO4/P5Ot05XBfXl/u0dwjQwLqBVTNzCcaF + 8WGcGC/GjfFjHpiPWi8CmsK9CJgK77LWcoHcArhYwCbVTM5qyXmgpsdMgacZHox3dDURu/uM73yn9Ybn + n9/2xhdewBtZOBNxA/DGJjAZCpgQ73COWiX0Rn8nOIyFhe57ikAilggWNawJWBgCIO2dS6sEHqsECKu9 + D9NC/uhg0L5qcLz3scVB5xOLy+2r6ZxPLi53r1mmz9Jy91r66z/u39fI7ziufTXOw/l8Hboerovr4z58 + P7ov7i9WDUBGLJkiwMBNIi6G5qPWC+aJ+WLemD/kENyiC98EOUFekJsQuutstdQBxifv/a0tFZ+z6Lcr + zecx+n/7+dWa86uuPf2tWvanjHyaQExEKBoitmidIPrx0ktKwG7zbk4MJuAn2CoBP8KuDXgRWCQCJAQE + BCRwWch6YBBp72YAOd67CiBAVsQnBSxm9xJQXN9f6dzQX+nd2O93b6br3EKfW+m7W2nxf5q+Dx/+N77n + Dx1Hx+M8Oh/XwfXkur1POrBxQNPejXFgPBgXxhcAprMN42cXiXkYuEcl4OLdInBJrTdDThItspGiSqul + icrWHjsCqABEhpkfHHvKPPzTsa6PrnKf0DSgGOuE+YLdbwq8CUz+1tvUzRHiFWFfgMk8uTiti8gCeF// + xOwl4toQL7IgQEIcxk6yFK6AxbBA1oNYILA62nuXVrqfEvAgQCCwGKx2bx+s9u4gF+VzS4PO5+k+dxEg + 3E2L/h4CiXvp771Ly5379CP/5u/vwXE4Xs7rfo6vQ9cTEOLr34j74b64P8aB8ThLhtym9k6MFxYMxs8u + Es0H88L8ME/MF/PG/NUtglyE0C3yLSmrJXKHctU2EVCBJZILKlNAmYJq7cOZDhWXWCfO1QF/oNGc4RAE + 7PxWIV+dZcIhX3AlvV87OphxVglIVXJtmBOBSwN3pvMJuCpihbRvXCDLYnHQvX1x0PssQACAAKDoL3fv + 7y93Hugv9x5a7HcPEBg8PFjpfZE+jxBQPDpY6T66NOgepP8/yH/p3/I9/U7H4XiyVg7gfLlO935cl69P + 98H9cF/cH+PAeDAuuE0YJ8YrFkx3TniY9g7MC/PDPAVcguUCeUAuiHZBTpCXukQJq2VNdAh6qVVe2QEj + WCr7CFT+3H2+UwEwL07f/Ovz5j/V5Fr1YJbxJwiB2siOcCfBOtGITojmdM5FYtmxYzsuQHiWLRNabAMG + k9aMRGI68yBMhRvpfpx5kCUCkn77pkVyVQarnc/Q93fSQr6HFv0+Xvgr3S8MVjpfBEjQwn+O/v4+/f3v + dMz/IVD4OzrmxwQS7tNdoO+G5kP/lt8GfFz373Aeny/XwfUIfDoEON0vCNB09uH+GAfGg3FhfBgnfa7F + uJmLoXmIe9TuYn6YJ+aLeWP+kAPkIYSuRItCpChYLSJX4Vkgbw09j50wNwKoxNZHynL55qn28E/Huz4g + mAKVHHcHEYzAnQgRi7cvTHwhYeHqIJpDBCzlfYDUHJxoXYbQLZOuRICCDKUFdiW93a8mV2IveA065xb6 + 7jPkhgBI7qVFvx9WhIBI5zdpwX+N/v45LfR/oN9eo78EGD0GDfp+SJYIf+T/O/S3R3/DR/6N78OxdD8H + OrgO/z+u+w+4j7vflxhk2Jrp7se4xGXqfMZxNzdg/JgH5sMkL83PgwvNG/OHHCAPyAXyUZdIkug0BC1c + C+Q7cXdoAqByc8JaAdhM3Z/TVwbQr1qsv12l63ILOaTaF9Psi+n1GtmRcKlwJ5JrAuuk985jx2Yv5GgO + E7DtS4+RW7C46CwTgMlxARP67KW3+U3kYtxGnMZn4XawS9OHNQIXBZZD53/RIn+RFvjPACBkYRAoCHDg + L0BCLJEAMMEywXcAEAUMPVatFw8kDmzMdfV6fN/Oi3Sf/43xYFwYH8bJvAyNG+PHPDAfBheaH8AFlgvm + jflDDkLozlwM+UBOarU4IrvgDq0NPSfDznne0ARAJWWpAGymoHL6ygCAotza15qASpWFovU64vfjTbr9 + LUV3Z34rCEnU2OBtLCQsXB3klnTbRHjOgXxdCJbJdUSE3kRWxW0EDM4qgWsDTqTzDAHG/6SF/CNnOTjw + IADwVkVwaQYEKAMGG7FSADL4S+4LHS8f/rf7f3xvj7PnR64S3w+ABPAKwNX5EcaHcTInQy6SWC/kHtF8 + MC+yXK4zlssVmD/kAHlALpAP5AR5QW6S31J0hyDntTzLGMAyAVCBm1NG3LamoHLagipSCazOK61S+3rL + AhTKPUF0B0V0sbsDrgCEJOpp8DZGJASujktQo5Bw9yOIniCSgjc6Fp9wJUS29tvk3sAq6f4eLdzndWGr + K2MWMwOHWCcOJBRAvKXiwAS/w6JhwAkf/JuBSkHHnCdARL+56/N9/PFi4RTHxEDzPMYt1kv7IcyHuReA + C82TI0c0b8wfRDTkwdm7JB/ICfISIhdci0SI1B2CnCWaFoedRwSWCYBKiqydWimnr5UCst6CSmXqgIJK + DqAwIUu5Fa9QXQuiFouL2wruDorxhDux1glI2PbuhUHvY4iYuFwShIE/J5EbAhOKxNDi/S/k0vyTuCkE + BHBViPugN74DBnFzxMIAUMgCx18FDAUPsWQENNRaUSCYnZ0tfM/HwRLha1ngMdcHyDBHI/eTa8v4ME5x + vXCNzj/xPGg+mBeDC83ThaeRA0OEbu9jkAcyd73VQvISriV2h7adLbVEktMimbg2n2UEYJkAqJRZKTCN + p6By+srAuj7Qf2WSowMVm3Zvktosh4IHGg+2AorwJxIqFjKWU+qpQA8h1cXFFtLnP4iICEKvHM0hAnZx + 0CbOhKM4D+LNTovwv9L/HxEXQxYuWxBugfO/1e1wYGIBwFsb7ny2aBwI6HXwF2CiH/u9nB8sEAYkZ8HY + +zCYKG/DXI5aMDLeYDkxwBzBvNhyoXlivpg35g85OJfoo2y1kJwgL8gN4edA4rbOg3zBszQFlsq0/jFB + JZUIV+ljTwHnlAbcWOdH6/QJUPH9Twq9TxKAAkKW+oqgzwjzJ5SWzqHi4+33i7vTayGlXULEvavYOum3 + b6S39+3EQdxF5OZ+cgUoh6T7H2jBvcTuCQOHLlq88WGhKJiopeIWsT82uDDetXHujuVExHUJFghbKu7f + 9q9YSOE4AR4HMBibAxHvOmGMajlx5MmN3xHHwgN1XsI8MV/MG/OHHCAPZOxCPpAT5AW5QX7HSY6QJ+Qq + PMv2rZD3UU6Wq7ZYDon++AWRZG3HBJXYDFarZRr5+fmxUmqt0pKGSlFBoLFQDKAgHMr1OuBPToA/6W1H + VinMeiSDMXey1LsOWa/0G6yTeykx7Qu0sA7RwvxbBRMhP9V9KPIVCgjWmsCiVpdHCVtEgMT9UCJWQMAD + k7pB9J26P4XfDWjIuFx0yLtFwssUrCALTEr6em5GI1Oe0/lbzBvzhxwgD8gF8mGuheSFCJFk5fa2Q57C + s7TeDTk3AhZpjJUGljFBJRX5mabnn56gUpY+UBlOjnkUSbCyFgrIQefyeEBBduyOX0ESF8Ki/ROUe0LR + DLQQoEWyi8lYqplxqfSflszX7v0uUe2PKRy8KmRnyCvhBesjK4EY9dEbjew4t0ijQbLIg8sEsGFeRPNU + 3HneUnFukPyb+JDoWHFxii5YIIjddV0+jOdrFMwUdJh3kZC0nSfmTQD6x5AD5AG5gGuBnCAvIXF7u5CR + K9EhymnhsPOOCwRY5kssliJ5a3qzpLvJjQkqsW+tlsq0kPD0AxVE8+DqxBxa0iqF321AhXkUZG5Ktey2 + NyKMKVEH4lAiC0UB5QgI2dcIUKR6GPwJ5Z10r0G9DL2BP7O8inyTHnEn3Sdoof0/dTFgYQgn4SwKtyCF + BJUkNW956GJ1xKxGZnxUx7kpGgnykRp/nnF/DKgUXaBg5fB1nCvkXR22ejS3JeS46L1kvAApk//i5qeu + nV4XcoA8IBfIB3KCvCA3yE+iQ+0u5ArCuwgsRVcI+tFwM/TmerMUUvrX8CtjgkrZQ1brY9f54NPfNx3n + kgIUAEzSKo0BRfugPO/6xiI/AuFMifIIh2ItFADKMSqgQ8YokYsfRJEdeALOO6GiPI7srHQP0Fv392mR + HpVsV+cOuKQ1tU7EUlGOArkmIRlNrBH5TVwfzRUxRGkEIGvyTIwlpJxK6TElQORD23pvBhixstSKEQ7I + jR8RIWu1GI7F5LkcZbmQfCRC1LsDchOepX0V5Am5okCxFFgceSthfZd5y3qDlckVzjGwBIplDFCJcxX0 + DRb72Hjo4pYI+Df4mPXMZcH4cA+Y55r5af9iDOuVoHey7437YS6YE/KGUvOFvHGslUmdDHDNspeH6rs0 + ylfNo6DmRBLbkIeCsPHLjpS1FgoABZ3U0OAIrQjIbN9Di+Rmyir9HL2F99GCABn7P2jh/X99W0vI1pGf + JhSsJO2Sy5T1XIoL4cpbXklU5TuUi5Hvw4INoOOBzLhWDCouelMGLIWojrGkMG5P+sJFslYWcy9wvQAu + IUQd8ltk3gKejpgmuUA+kBPkxXIj+UGOkCfkCvnGwALyFvqAXiStXxs/hVoh7cli64Q8qowBKqnIDx5Y + uD/4W/Uw6kOJwkMs/kmFoDGuVEJeWfgbY5wUsXyy7w05I9KWWzWO42KdxLLXHjmQCXRTd+0yAPPfferB + ZzryAAqPgiI21Jy87DJlkYClYWOJ8rQuQlm/WChzXTz4kn/CNTu3IJuUFirxJwgV9/7KR1QYFJDTEcLF + yqME66PoOviMV09+OrBQgPAEr/AxGorm6yL71fAlFjx89MfwLnq851M8CBn3zACTumaFjF1jufg5OevK + cz9ODiF5juuS/kpCz+BZSH6QI8kTcoV8IWfIG3KH/KEHhPGhF+gHGc3QF/RmixBNsyclbSUiNAaopEha + JMPFDy7+jQcNQJNKlsP341guWGApjgcgo5ZJCuzGuf9G3LtM/gABzA+/AeAAGACdKnCP3ZcmrS3qAGd4 + w4NPvNfyKJJc1Xrzq9TnA53KpDAQdTyddyHMeYKjPN3L1eXBG1UBBRmktDD204L5Ei2q7zGIcPKahowd + V+He1jYXhRed5qOwFaCWiQGa2Brx7pBLx3cgIuRokUfR6BL+CqiE8HHheD3PWSIxgRxbQ2x1qVukIXAH + PoXIlYsiSaKd5rRIoaNwMd3vQW4sPwMskG9whbqXQ/7QA/QBvUA/0BP0ZZPjlF+JidtxQSXnDZmyQvAg + p/iYUYAFi6fsegCTMtIYb+MyawbXaHr/jbg3gMMuaIy7ytrDfHMzn21rC7U4UhYLvk9YKs9965r7nvuW + WimohA3ELKqNW29DDQpSxqUHCrrXIw8FHdkQ5QEpCw4FLg9CxgIotOiepL+Ue2IXdqjV4YiIW7iW1NRM + VQUDy2PIInSLV/NCNERc4EBMApuCko8WCcgUEuDMGO14C5Ela+1oVIjBLeStWCuIk/c078aNwc+Tz7eh + auFlzJxfcvLzwMKuEMkZ8paoUG879CAJcihEREo/Gm0jh2U3p/NDj9CnbU1ZcIPGsFRSVoEtMsPDnHJr + UuQfFkjVefH14gWm989xqcqABQsl9/4bce84rJsLhJhTDA4Amhy3M6XrNXxMRM6a8LHwKEVidn6r1PLM + XohMTyRmcVEghT0lStHZQ02L1OUBoDxGi+QfAyHrXBJ+GztS1QOK4UFMZqq++W14ueDWRNZIDELRIg08 + TAQumuQWA0LMsdgaH72XuFcRh+OtEwdszvJSfibkuBhyGYSuO89YQP9I/0+RIQboO1m+JGeRN8LNyGNB + ghwyb5HSP3c+h5pLiNuwiZlP5Rc3aAxQqTJ9cxY0HuZU8lxuL5aUtZR7fyy0MgsnJyN4o+4dA0PuXCHv + 2LXJlXPKfSpYdWXRHg0fw+1B5zH454FHQXLb/AVSy9O+VDJl2zuRdo+mRAvU1xXkouSgsOn+A13UftHy + onGREk1Gc2FjjaB4N8FETDyZqRmuxi0pA5IyMEl9lwMkZQRuDDA8bgUXZ7kUrq3zceHmkJ2rRLJEi0JV + tSeYfwB5Qq6QL+QsTaAg9/ZO6AH6kFqheZfDYvgVaTLONUKi32I0aFRQgUuRApXKZKiSN2PKtK5LoEsB + UtP7p8ChKtdmo+5dlnyWY2noMTG5nkNQp6J80H/h3mVWinV70BMFHciUR0E5PhOzFDpGbYqk3lOmLBK1 + OA+FskIR5Vnp/ToRsH+vFoqv31Guwbk8mkqv/IkNu3pORXmTCExil6Rs0ae+awJC+dcNrlYBXJQbMn8t + L+NlwPxLyNLVuiG1WGjMfw+5Up8WigqRnCFvyB1tK0kPXCvErSqJuCU9eX6F9Ac9ptygcSyVVGOmUVpI + plyIKmsBb8hUJCfXddEFkZpLCpw28t5lJGoTUIlfBnXhZFw7FeUruE4WUEI7SIr2oHObcXssj4L9bKR9 + ASW3Sej4Q5x6jwxQStji/Arq70pk43clYS2Qo97dcfUxEiqW3yWsvDbHRAsHNWojC9wkmpW4MPkgUAwz + NzlvDc9TGEcAFx/NKkSJ4nYLzu3TuiEjFxuuZnmSXFm+JGeWt8idUvpJDxxq7l4O/UBPll9BXhHcWOgV + +oUbZNtRjmqppCIEOW5DvAhSi7oqiS5FOua8eeP7Zy0a81beyHuXcRtN5hzPNSfzOUvXABWzWbrjUkDm + aRr+zrdatwcdydBACP774qIQsxI6Rq0KNVRClTES21a6fyqhYpdyr1wCA4Ka90X3hxPFLPEaRXU089ST + tRGY1Lkva3iRApnbLHEuZeWsda1CBGoNp8QyiYskpUxAuCMHuCb8LPJkoP5TSZBDlTPk3ruO9cDVzSBu + 0Y+l+z7oS1L5xQ2SLv22B0vYT2hUUEnlgTR5wFMmubVAyqyOlOuB85paKVVv4jXmfQUHdDLujbGmCFNY + VTlzt6CSm/mcsiS9ruvIWVf5StEDRHs658KcRmr4Edp/B42bUSAIf16yZSnSs0o1K9wvFpmy3Z/59HPf + +8SBBvMFIfM0ZMLabFTtUaJ1NSZqVAEmSVcnASC5lskafifjet5CMy6b1P7E1pEBXo1OKbAwyEpWroSZ + PUhBviRnkjfkTvKXrFviV7gfS2sGeoK+1A2CHiUaFLJtLWk7Kqik3tZ1PEiZqV61j1DZ9VIcTG21bCLS + 0eT+G3lvyK4ujK/5OJhTDsjkuE4pIPO6KQcVDjl6clbS8DXagzaQzu2hDmVoKIT+H9iaAn1YEZmgB/1Z + WgADXVA2VDv9/9C3ZRxZeGtI5Pwsyx3yJz2wPkgv6CCnbpCEmUM0iJPiDGmrIeZRQSVF0uaY0/GDXGV5 + xKBSBQCjWEl1loq9/0beO8eqK9MJQBBAlMOdpACmUtf1VsruM5WcRZYmp+G7aI+Ej5GPwub29dwPRXmU + FYn0eLJRIzuaR6Kcic0otSSmkrjGErBvfFlQRYumNLKSYUnkWilVx1VZMDrOePx6PVurVAiVO3kUyVuX + caxy85XOXYoICb/CemB9iBsEPWk0SCqaW+dxUhzv4YycI6kNUmtlFFBJLa5cczp3i4+yYrWUKV5Z2FaT + i1GVQWpBZSPvbWVWlx+UAgEATFNLMhXl87qutFKQis+1PXNna5IbsjWxjQS6vkuTairHd26Pa7BE/VC6 + fyLZso6Y5dR7197RRTQK2aQ2VOzJWkPsrnFzNg+Y5PIzclxx3BZkuCaoRA6FDncepKXZk8+LcbwLy136 + 0dwlqfzkjkI/pCfp0j9DafyBtIVeoV+k8Ic2lLvPGAVUUpbFqO5HlUkfL4KqWpQcU77smNz7b+S97bir + smNr0+ZrMm9zSWzWdRzxCX1StGCQrBSk4tMG4svD1nlovMzkLO1Pg+xNdL3naAPtw8OtEDkhq3OYFs+K + 8ijKmfjmSCZiI1EeIRyLC04AJZ8EbViNfBKsl9hyqZuL/G5BxxGxkqLvq501tB661Vl+pbci8kfnPG5N + SXpBM+3OFZxtS3qT7vxkrZA+oVfZFL5orYwCKqk3e9P8EH2Aq968MS+QWjS5maFloFK1y6I9fiPvXTbu + uurhKoDJLUWo1HXaSrnwTVwwGFkp2JoTuQ/o8g4SENtoSF1P79PSY5U28uKaHrg9oWDPhn59ToYjLeOt + NDi0zICStkYm4a5M4hq+n+0EQEo2MkM4PZq31gS5uqEYYOQckbcLx38PeuAev2jwxIWHpCfuGteaYf2R + HjXEXLRWpKHTKKCSAoFROY0qc90upipOIzcztGxx5tx/I+9dZYFpiwVYWzkVxan2FKl7JKN8pgGT66uB + rEpkV6qVsq3ApbCVQqnf2P8XDYKwARaaVSPpirvBc5Pq7h9JVEIARepY3JvW1bxoOLXAI7hISFw1HKyV + zQswTXqvrAWyokWm8y2LDNnvfPc551LxZmmeY2K3CHp40HXpp6Q40hP0RXqD/qBHtlYK3EqIBI0CKqmU + 7ab+eh1JGue8nGyi1N5/I+/dxK1r0rYgJzqUjPKVWSnX3vfcX/Bn33N/ecvDTz+Mt9hPXcGgcCnOSpFU + fOwcuJce4NuWV6mnqnSF/4knJX0OiiMWlSvxqfjOpNewapy4xotkLQ8xCQtjktcYD1RcDopabdbiUXnY + sHNcT6QuIp+vxYfsDkEPj4heSD/QE9cGIYVfrBXlVqBftlZcJAjFhk1BJTtlO7NQrYr8jCMW67Gwq0ha + W1OzkfeOwbcJIQ4ZjvMSSFlxBT4FtR/7v3Jwq81y/uxvPPl5RAg44qNcChLdYKVQxqaELGkTLK4+Zivl + 69qoWsv3OULjojiWmI35Bpuv4clLQ2xaPqKKm5gkWOReqymolM8lZBPb39e2UQgAvUaurneMds5z+niQ + 9SPbrJK+xFrxCXGRtcJZttRzpSmopBbXKOn5WCypN2HZ9Zrkk+S+3VP3jxfuRt4bc4nBL3d+OC5VVlBn + WabOe3Ft4eDuM246cOgTFlSe+o8PULRgO1chI80bkQOp7wlcirwF2Uo5SEDyUyVnpU2B+vpR/Yp7G/vF + 6I5NgcUoyWa5gDCJ45qCSm60KHAlxQQ528FOqqFFvsE90qgQ9NE7KPpBpq3jVkh/Uhc0c4mk7yNvZfvW + heFlZ6HnCjaCawoqqTf7KJGf1EOLt2NZ5W2VlVS3QMoWYVVRZMwPbeS9MfaY22gCKqmkuTqZJaN8Za7P + 3v2Hn7SgIjU+lD3L3dzmLuY8B0r75taQHPFBoptwKQQi1AFfWyCGfiihj6xrPOQaIHmC0/Q+GacgcBLg + MOo1xgWV9H3X7vMc8lq02xw4K5fezwAjtVBqrdDfbwRuBfsqcV0QtaCEHtuXQq/QrxQbdt+OmiAQ9E1B + JRV+HYWkTZGAVZGcFBnZpPxfF2RqLql+Kpvp3nWAEINOWX1VHaeSeoE8VgSVm1+P8vc9+w7/oYLKnvsP + f/ufqUYEvU6PUU8O2QQM3dx6s5QHQdtEUOOlfpsjPthOgt6EP/Zmt/PtmTxkK8RFJXxPFCmw0z6wksRW + XcyH39dv8Y5eSOjnMWL0J2feGkIO4OO2X9U+Ky4fyG/3wfJ2OxGQXtx2H/dAX6K37kegR86yJb1Cv9Az + 9C3h5W1nNgWVVOSn6aKucieqwp2jVDSXvdWrrKTUgt3Ie8fcRlMQjwEiJwRfCipX3/Pc/Q5U/JYbiPpc + c99v/UBBhVyhr/aH81uPUOewEEZGrxQ0X6IsTaqGpTqTO5APQSb2V/khdm9J7Wgfck9cFbHfvgLhTwGJ + smhPnCCmi2kzgkrcJW5Ua6d4XjHpT90grdD2xxa2A5GcltBCIehD9IP0/c4drDfOsu3tkp4rEl6GnqHv + 4XAXFxo2BZUUcdekOjnVGCnl9lhQqM3wzCCIq5LHqhbrRt27DICbupuxlZUDSqWgQhbJVQZUuBr5hgPP + FPiUzz/25N0wibH7HVLyuRKZCL5jqCXhXinUFIizNlGF3PtrbYfI3eRNUyLb8Z7DpdptnqwYLEjlYHIW + 42YElZxxj3+MdYN0o3n3ne11q/skOTlLzgqH9/+aq5hFXzdDf6xHR9hKI6eiC9QEVKo4CABCTkJV1YLO + tXZqq2ZrgCXlduUA40bcO8Vt5NZZxefntussBZVr9x2+JYAKclN2n0Eh5L9QK4X60v6QM2h5y1K0N0Dh + YOcDSPWmt91HQfgJQYteKejmptmzyEuJ0tBd9MdU1EqClrNUdMHVuQHjuhnjL+zxXKRR71+IBDm5FWWm + IFMcn+rBheQpy7b7mNMXE7asR+gTeiX9Qs/QN2fYUj1QE1BJ9T1R6wUmdV1P2knwEqMCExZhKtqTmw28 + EfdOcRs5LkxZH+Dc4sIUmH3NgkpM0N726NOPoBoZJnHITSHXZ7W3i/p1fJyIvhtQCUsP6QPkl3+DMznV + FHeRCK1XUT5AEt1CQ2f8rh3rUwsup3o3PjfnnNPlGHY5OZPWAIpm1xp9QD/QE+sLFcykP+gR+lQXCHpm + F4j0vrCw66wmoFL2cMccS9k2F7oHUKqKtinpqGHSFEDB4rBv8ao9iPDWzl1k6oZhoZ7Me1eVMeC31G4B + ZfrKtQYx16SbStYIeJVf2LPvuSdsxAcEbSgexJYbFPU50b7U1flQBq24PvSGE9dnuft9IgK9y+O7xJtG + 1Z43MWQmvrN76+S8yX9e3Z/YWvGWSkRwa22V7jqg7SdZP6Qn2QkyuEDIsGW9kn6hZ9nSQxLhmoBK7Dao + X14WRQG44PeqBZHbWCgVPsVDX3V9LPyq1HWMuy4CshnuXbaHUgzQkAPkrTsPxr+PAp51Gc+FcRHQfPf3 + /vOdFyxRA59XKeFN0/KPoVUkoj5cjdzZI93FvOvzmt1SQh54hJQlAsH/jlpIaiPnpiDR9PgcoDq1jgl7 + OXPETEHaR84iufvOeVwq8RpcVWk7yfrbA31Cr9Cvpu1D79B/E1CxW2XG/ENucRsWOY7N5QNy8jFg6eS2 + A9DNtiZ1/5NxbwsQKrsm88U5o4KnAktlXRFS83/na3e9E/40Qovwrxeooc8SbUyFknl6i1FnN2wK1r2e + itU46kNvwj8scCW6VSfCyDDJ3V9b46NbaYwSIj7VQGWSxYYFHiVK1fdJb5HctVDTJCSSvlC9TFEg0iP0 + Cb1yQiPpGfrWdpNNQCV3geMhjj9YfJNayFXWA+5Tdn+4ODlEcs4cy46xNTfx/ce9t71eHAmDO3Oy5N2C + 20Ofx/GB67OHEt5ue/TJOTTpQYd16UG7PfApJ9AlH6Fk6nfKCW+9GyUtn1oXDjrfDqa47uZnd/WLtih1 + QKOA0nTRnWqgMmlyudD02smywKfovtMaZTNRILZsWF+9h1h/vNMBNSjnBk4UWiY9B15l+9ZJg8qoi3J6 + Xt6mXhsqpzjpTauSsV0D8hOUTzlC/vWiZtFK3xTyv7H9Axr/9O4mYvZhelB/pAV/7Mfrg25J2TgpzPdI + KW5Vemq5IfmRoMkDoQkvlybchY3pvU7CLgY/gt5Yf6RH1qfyKrxHUOBVpqByCizmjNybkwI2tmM+tmQA + qKAqVTcJ09R85C0cp/yFo7SFJnqc9ld7H5am1tw3BbUkvy5+enEbUd09UOpTtOZHOsJb16fACYyYjXoq + ANEkQaVgqfhcIKly1jYToXFTpBfWE/MqtE9Q916nR+oKR3s0kX6hZ+hb81WmoDIFlSxAKuvy5vbT5YZM + qPsASYeqZOnwJqn5Lp+BOuXPUn5D93ZazPcTYPz7UGMinfE1vOk5lKhzG0cjTmMAKQO5SYKKvb4tKmSA + BlnrCNuCHrSfja9ght5ot0jSI+uTO+4jXwX7A2H/ZemxMgWVKag0BhXddB1dvtCbFCXvsuF66xzUgWjS + myVp6Q13PeU5EEnbeUAK1QRM/O57nDOh4JJ2bzREys2c16G7W1OuZj0tnkmBCneFc4BcmSho5C8VzA7I + A7igwBD5KnewPh1Zy/2GXRIc9D8FlSmojAAqkkkLUEH/jFeoiAyRH2w0JZm03ff0T8xesrA8O8P1Psd7 + H0O/U6lKBtnX+TNdjL5g0D7EriS/YJlElkuTbNqmC39Si7npfcuS8ca9RhmIWMvEu5Lqijo9qMVo21OK + 3rA/EOkR+iS9Sh3Q7Az0Db1D/1NQmYLKWKAi2zPAUiFQGe54B/dPcV3eOPKzaiM/tFlVn3fD+y6Zzq7s + XnJTAoBomwNDaJptOKQGKJ/sHGVR1oFK3e+j3LMMUCZtNYl1J7KLs2ltMWHgrFQv9FesmO+y/gbYdMxF + gEi/HAFCcSF32p87fwoqU1AZG1QknLyLwsmuMpk3Xe9sW8B+MeiYz13DkEnbw9YPiPy86CM/vu2hbBvB + iwtukVYt+yStUH07iUVbdY060Kj7fb3HN+71xVKxdVZaYGgqwjX5zbXkdGD0IvTHeiR9ut61V7CeoW/S + OxpiT0FlCiojgQp6qLzwgjS5tqCCh4q3yESYEeFktCBcbnM4md5od2PDKoryvBz29NGmTKE5E2fNRj1S + 4kbX4y6sn2dQ8ZaKsfhY3oV+v6IPjdAJUd55GfqDHqFPp1fSrzRtgt6noDIFlCxAQUh7TWMmCie/QJ3z + kaPCoEK9NNAEWXJUZkLND7c76F5DD+Gt0pQJDa57fR8y9pZKSWFb/NAb8z2nMnlU4CmzRKoKCfU+p1Kx + YSloWyA3AKMhZ+iNG2Jj+w7Sp+gVW9ZKDRD0Dv1PLZUpsGQBS1XiG3qTAlRQUKaJb0e1yfUqHjp6+FY6 + t9LDeS+FHx+lh3NV34B4Gxa3jJA3puVNQnGb3WS9agfC8TiXOvem7vdRwWzS5/lIGVscEgFiTsp9Cg3D + TcWyRn5ULxJ25lyVVegPeoQ+Wa+kX9m6g3rmUALcKKBSlgafW1eCNPk4pXw9U+e10hZjHqUSOrXY9HpN + /673XO14rZxtFXac1p8FKGWWis+mpUbHNpsW1ap4uAKozO6mh/DaRbQjlMQ3gMrP0LMjPLSS4OYXVez6 + +N+KSVnrEQHK6cZ2qoHKWjmJHONu+3HLCQ77O9CXHiu9n0F/0KPTJyXAzXpQ0WrlppYKFgYWk61Mzl2w + WuWM4jQ86DgvF5CyH36TfYqFpf1TmnZKq6ovQoGfFibaxatVu1qhrb/pvHN7towy1/gcW+ho9QP9aaOp + nO5vel3Wt2vQRG0kw8Zh6J6+BlQWkU2r3d56HxZQwW53CirakMlEekwCln24y7Y7XU/XJ8da2AygMkpk + KMgtpOPHYXuev9NFob2ka6AVQIX1ee2xPrJqnaVCesdLpSmo6EOmZfZYYDkPJ96QCkQ5x+curJz+ILlj + zLknwBAAVQaGWk1c1p9FASbnHpM6RvuplAFO0w3teW7aRyUGlVsfeYY3DpNN2E9tSyUHVDbLMXXgFoNv + DCqbxVKxoKKd4Oq2HLVbc+b0oW2yqOre/toCMwd8cu4bN4DSc2yrzbJqbHUbc+4xqWN0K9T4etrRrUnV + +D4HKK9DcyYLKnd+6YmdtxConE6cymYBjbpx5IKKcCh1nEpwQU82p2JBRRdS3UZi2s9De4Dkukt1iwv3 + r3NrtGn0pO6ZAlDbnLps3JPmdepkg98hmzL5pCyYymumoj977z/8n+78zS/vPZ2iP3WLebP8XgcqdpyW + tBXiNepLaxpiSa6Q+505Fb+v9bpGf9SFUR4h9daDlaLugLoHOQsi5xjtdlZ17EgLKFEVjDmmXDe9Twrk + NgJUUm5fCmyagQrlqdz0haevhlvUOE9lZXPnqWwW0KgbRxNQia8V5/1k5amQ3tYrTwVknwKFWh+pPq+6 + CNWqqWvWjOOwAKsiJfhN74vr64ItOweWhb2nEs1NTH9dbADIFLFcR8ZWnavjzyWtc47XfY3K9IIXgXUb + tcGUjWbFY7nyuv2HLtKG1/d9+alzXH/ao9jvB5bKPU88cf2Dz3zppj/51s2cWXkqZ9TWLea6xLlxFnuT + e496n/qMWin2DBaND9+vW0at7WSmb+iyN7guYCzKOv5FI0rw95V/gFsVA4X+pqCCxaEkaJmLA0DBgteo + B8ahm5ZPkjDWKFPuNbFowXngg3FjTBhniiNqerzKO5afbt9qxwmA1XaRav0p6CovA5L2cQUV7vrmml6j + N+2NDx166tYvPn3otkefOpxd+8N5D6a2xCe6bXztT5OFXXbsqIu96X2b3meU2p+wYfv61v7YB1If3pTv + bjmYlDmOBxhvz5hMxQOd2qNGw6J1bhLuicUav7Fzz6+7vv6url0Od6PbZpRZEZBj3P+36fEYU5PIjzYQ + T42d+aLiJmI3v/7A4cfege+vf+DZr5xuVcpNF3d8fN1ir/s95/45+TRl3In/znAq2n6Cf4uqlGU/a1eE + uI5VyvFbDgsKi98uwNiFUfcgFW7VxW+voQuj7GHH4qtzpdQFKCNX1dLJBY2q4+wWqnUujAJoauMynbNa + GE2P13HGbl8M7jpOtRCrxs1juunAU2fbnQlveOjZj8v3h26feD8V7aRfUo283v1UchZ03TF1oFH3e931 + m/6e3U/FVy+7vjYnsZ9KbOKr6Wx5ivgYdQ+q9qiJH2y1JsrOAYjV7SioodMyINPtOyYBKmqtxcBadm3N + 1UlxRrE72fR4vae6ffEYbJgZ96qLnuF8Pifu/KbuzwPPPH7JtPNbMZJSBxp1vzcFjabHr+38JpmzuM5G + dX6LASO2QrDIYiCoi/xoZEU5ErxBFYjihaGkbx1/oQs0laiWs6ByQKcu8mOvUSeHGFSaHm/dsTL5qIUH + nam1Vkda+2iR7VFLXMofwFJp3KN29fTvUTtKQeLJKkbUBk3aaBzujWYtZ/WoJf1NukdtWWjULgQs4Phh + 1hyO1CIGkJRtdgVrouycstwTLIx4ceDcMutBz68DpRxA0XyQnKzdOjnYa6mccd0q8CvL/anKzdHrQU8K + znUWn5+btVYo6vMtfIauUhmp+vd9+fFP2axalMPr7oS13fRtbkTK/TlFuunXWSJ1vze1PPKPT3fTV0JW + c1T8fkCumz4Bzrp104dLES9eu1jwe2wZqBtS9vCm6lA0SqHnWBdGQcyOo2xcKVDS8Uwqy1bdv7rr6SKu + AgmtKwLAND1eQTCVMVuWXazuVYqkLZxjQQVWCm3M/ge2p8otDz99aHL7/hQ7v3Eylumzst7d3/IX6lrX + p64uZyNApX7fHyFppbNe2IdJ5YB9f+jFQPs1mX1/tOvbmPv+lIU8FQCwIKqI2DLLIGXeK0+h59hzyyIb + 8bV1TGXjVSCbVNVwk8gPAChFMJcR002Pr4r8qEwtgNQBVyE0HYMKeBXtU/vw4Ucuve3Rr9Dm7MUdCrGD + XdYOhdic3exMWLdD4aiLfjOclwKVOjAad+wF10cjOlqtHO9QWNg+hXXzR3T//QQufodC6qC/c9wdCjWf + oYyjqHr4lRuJ34a68GMXRXMyFKRilyrmSsoyXatcnElGfnTRYaw57hLGhfnGssC/tXo7jqI1OR7nQt5l + 1lAqjK7yKLO0CgAegcpRApXf1Y76yFU5mXsp+72W17lf7bgLuen562fFbK69lLUyV9/IeMjjhxbEn10o + eo4CioadcZ59eHEcFpOer8lpujh072W70BR0NFHLWimabavlA9YFijcvx9jqChLLgEKJS12MKhe9F76v + ywjGfOF6YOwYQ9Vm9bhWzvG4hpW3yhrytmO181ag0TngOC0AVU4Kv+GcfVu2bEFBIRcVog0CcSr/F8By + 3f5nv3z344/tOnKk98u2Whn9NdARTHmVRexqt4JetZ27Vla6B8jc/j6a/+ANyjvikdkdCMTgVsTNrm2K + +Ua3QWgKGnXH14FK3e/x9a18CnKL6n+UrLV6kEJEBqPvs75Ib9Af61F3JyT9ah8V8GnQf23rgyE9QdPP + VAYEKPxfZQe4qAE29tflLuvcVb+3a3HQ/Til79NWHb3PEtA8QP75N/ro06ENr+EClRS2yWIITbGld6r5 + 7jSyVupAo+73ctAyBK1Lv+fN3ArkuPRREfmbBtggaklPrC/SG/QHPUKf0Cv0G/ZRnt+KBuhTwJiCZtYz + kAYVs/8PbSqG/X+Whq1zZP+f2QuxyRS94T7AO9mt0o52y+29BAi30UN6H70VH6NuYiv6NpXuYsZC0QxP + RxyGzE738LtjTydrpQ406n4vyM9kzYZojshXQZnJ2QiUVQ/oI4wWktAT9AW9sf6gR96ZkPTqNhGDvqF3 + 6D/rgZpaKlNLpRxUtvhNxYZD2lNZtz9d6r6dHrhzsbfuIu2xO/Bd4NAEW1wgemBhSh+gbM+/4baS/HAH + V8jvXujepvJWlbog/nuaWiuj5LhUu1SRleLkZ60Ulr/fu1r0EPTR+xvoyemLXZ9jaGZO3d5Yr2YPZeyl + je1vp6AytVSyngEFFcurgFvRjdqRr0J9a7m15JCaYPeH81uxXcPCAiqWnQuE3QoHtKvdSvdT9LajLVAp + mrDS+yqb4urO+I3DuCdqcHvUJFeQccdpE+fw9i1aO3Ucxmb7vc4SqfsdMis2vNZ+KKZHinVxGEBE1rZ9 + pLdkWD+kJ9IX6w36410J3QZipF/oGfqG3qH/rAdqaqlMLRUDKmu36zB7AGG3wmO0W+E/U2gZ++oegwt0 + XDZrp4dvljah+sjSUmcPJcZ9Wrbs6HyRHuAf+2pYV8DGW3gwcAhIhA3azT7LrpFQnftT9/tmAZacIkEL + KnZeMdjg3/53klP4XaJA2koS8mU5a6sDB+RuB4MfQz+yJQc1Lme9dT8CPfKm7KRX6Bd6hr6hd+h/CipT + SyXrGUiDSrULdJRcII4C8WZTvLnYFeQafaK/0r5R9lbuPEgP/38rWCuOC5AKWWmRwHkrNtPW5bScrm5Q + CujqLRXlpKzbU7RSxN1Rohsg46w7Zy2q1ej08qDsnUz6gt5If6JHifpAv3B11fWBC5z1QE0tlamlUgEq + 1LMWZG3rDZyyTy6Q7AN0GW2Dup1cINpbeQFRoJlLOFFqqTO/MOhcqYQtPeBEAPYOkh//UzW5xUIJkQgN + hQZrpZhti99T1shmzbydlHWUmh+H6ePojiNlg5UikR6VdeidwrwK6aN3UPQjBC3rjfQHPUKf0Cv0Cz1D + 39A79D8FlamlkvUMWFApCy3rNqgvvTT3S2iFwFGgJUSBWucdW91xAb3J3jc4Idt2SI4D9lfu3YS0b4os + wFr5OlsreIOCP1HXxoGLXzxajm8iFoVNsbyVA+CRN7AFnFPFFUqBTvlcXFFgNNe4W36hb4oDHS9XJ3cD + LF9nvSAtn/TE+iK9MUFLeoQ+oVfoF3qGvqF36D/rgZpaKlNLpRpUxAV6/vltb7RVy0iEwlaoIPJCzkpr + BundZDJfSQ+qhJe5crl3kEAFPVBd5EE3snL70GhaOT/8UV1QnNvi3siSNKfXG2/XwklZFpO6TqgoFmJ2 + jcWiMoo2aSsAjc9LMXJi+bMeDopeEP4nPbGV0t65sNya0dwU6BX6hZ6R+Pjyy9vfAv3/K8WJNkqxisLA + AAAAAElFTkSuQmCC + + + + + AAABAAIAEBAQAAAABAAoAQAAJgAAACAgEAAAAAQA6AIAAE4BAAAoAAAAEAAAACAAAAABAAQAAAAAAMAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAgAAAAICAAIAAAACAAIAAgIAAAICAgADAwMAAAAD/AAD/ + AAAA//8A/wAAAP8A/wD//wAA////AAAAAAAAAAAAAH//j/j/jwAAf/+P+P+PAAB4iIiIiIgAAH93h3h3 + jwAAf3eHeHePAAB4iIiIiIgAAH93h3h3jwAAf3eHeHePAAB4iIiIiIgAAH93h3h3jwAAf3eHeHePAAB4 + iIiIgAAAAH//j/j39wAAf/+P+PdwAAB3d3d3dwAAwAEAAMABAADAAQAAwAEAAMABAADAAQAAwAEAAMAB + AADAAQAAwAEAAMABAADAAQAAwAEAAMADAADABwAAwA8AACgAAAAgAAAAQAAAAAEABAAAAAAAAAIAAAAA + AAAAAAAAEAAAABAAAAAAAAAAAACAAACAAAAAgIAAgAAAAIAAgACAgAAAgICAAMDAwAAAAP8AAP8AAAD/ + /wD/AAAA/wD/AP//AAD///8Au7u7u7u7u7u7u7u7RLREu7u7u7u7u7u7u7u7u7S7S7u7u7u7u7u7u7u7 + u7u7u7u7u7u7u7u7u7u7u7u0RERES7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u0RLu7u0RLu7u7u7u7u7 + u7u0u7S7u0u7u7u7u7u7u7u7RLtES7RLu7u7u7u7u7u7u7S7tLu7S7u7u7u7u7u7u7u7u7u7u7u7u7u7 + u7u7u7u0REREREREREu7u7u7u7u7u7u7u7u7u7u7u7u7u0RLu7u7u7u0RLu7u7u7u7u0u7S7u7u7u0u7 + u7u7u7u7RLtES7u7u7RLu7u7u7u7u7S7tLu7u7u7S7u7u7u7u7u7u7u7u7u7u7u7u7u0RLu7RERERERE + RERERERLu0u7u7u7u7u7u7u7u7u7u7tLu0u7u7u7u0RLu7u7u7u7S7REu7u7u7u0u7u7u7u7tEu7S7u7 + u7u7RLu7u7u7u7tLu7u7u7u7u7S7u7u7u7u7u7u7u7u7u7u7u7u7u7u7tERERERERERERERERERES7u7 + u7u7u7u7u7u7u7u7u7u7u7u7u7u7REu7u7u7u7u7u7u7u7u7u7S7u7u7u7u7u7u7u7u7u7u0u7u7u7u7 + u7u7u7u7u7u7tLu7u7u7u7u7u7u7u7u7u0S7u7u7u7u7u7u7u7u7u7u0u7u7u7u7u7sAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== + + + \ No newline at end of file diff --git a/src/boost/libs/math/dot_net_example/distribution_explorer/IconToolkit.ico b/src/boost/libs/math/dot_net_example/distribution_explorer/IconToolkit.ico new file mode 100644 index 00000000..bfd8035c Binary files /dev/null and b/src/boost/libs/math/dot_net_example/distribution_explorer/IconToolkit.ico differ diff --git a/src/boost/libs/math/dot_net_example/distribution_explorer/Program.cs b/src/boost/libs/math/dot_net_example/distribution_explorer/Program.cs new file mode 100644 index 00000000..3a44ac76 --- /dev/null +++ b/src/boost/libs/math/dot_net_example/distribution_explorer/Program.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Windows.Forms; + +namespace distribution_explorer +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new DistexForm()); + } + } +} \ No newline at end of file diff --git a/src/boost/libs/math/dot_net_example/distribution_explorer/Properties/AssemblyInfo.cs b/src/boost/libs/math/dot_net_example/distribution_explorer/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..1f6d55db --- /dev/null +++ b/src/boost/libs/math/dot_net_example/distribution_explorer/Properties/AssemblyInfo.cs @@ -0,0 +1,34 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Statistical Distribution Explorer")] +[assembly: AssemblyDescription("Shows most properties for 31 Statistical Distributions (mean, mode, median, variance, skewness, kurtosis, range).\n Calculates probability distribution function (PDF), cumulative distribution function (CDF), quantiles, and complements, and upper and lower critical values for given risk levels (alpha).")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Boost 1.52")] +[assembly: AssemblyProduct("Statistical Distribution Explorer")] +[assembly: AssemblyCopyright("Copyright © John Maddock & Paul A. Bristow 2007 - 2012")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("a8cd54bd-81b1-4bd3-be18-2cd56fffa1f1")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("1.0.1.52")] +[assembly: AssemblyFileVersion("1.0.1.52")] +[assembly: AssemblyInformationalVersion("From Boost 1.52")] \ No newline at end of file diff --git a/src/boost/libs/math/dot_net_example/distribution_explorer/Properties/Resources.Designer.cs b/src/boost/libs/math/dot_net_example/distribution_explorer/Properties/Resources.Designer.cs new file mode 100644 index 00000000..cb5a05a2 --- /dev/null +++ b/src/boost/libs/math/dot_net_example/distribution_explorer/Properties/Resources.Designer.cs @@ -0,0 +1,70 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.1 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace distribution_explorer.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("distribution_explorer.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + internal static System.Drawing.Bitmap ToolkitLogo { + get { + object obj = ResourceManager.GetObject("ToolkitLogo", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/src/boost/libs/math/dot_net_example/distribution_explorer/Properties/Resources.resx b/src/boost/libs/math/dot_net_example/distribution_explorer/Properties/Resources.resx new file mode 100644 index 00000000..0eba41ff --- /dev/null +++ b/src/boost/libs/math/dot_net_example/distribution_explorer/Properties/Resources.resx @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\ToolkitLogo.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/src/boost/libs/math/dot_net_example/distribution_explorer/Properties/Settings.Designer.cs b/src/boost/libs/math/dot_net_example/distribution_explorer/Properties/Settings.Designer.cs new file mode 100644 index 00000000..14afa0d7 --- /dev/null +++ b/src/boost/libs/math/dot_net_example/distribution_explorer/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.1 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace distribution_explorer.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/src/boost/libs/math/dot_net_example/distribution_explorer/Properties/Settings.settings b/src/boost/libs/math/dot_net_example/distribution_explorer/Properties/Settings.settings new file mode 100644 index 00000000..39645652 --- /dev/null +++ b/src/boost/libs/math/dot_net_example/distribution_explorer/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/boost/libs/math/dot_net_example/distribution_explorer/Properties/app.manifest b/src/boost/libs/math/dot_net_example/distribution_explorer/Properties/app.manifest new file mode 100644 index 00000000..a78d4c9a --- /dev/null +++ b/src/boost/libs/math/dot_net_example/distribution_explorer/Properties/app.manifest @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/boost/libs/math/dot_net_example/distribution_explorer/Settings.cs b/src/boost/libs/math/dot_net_example/distribution_explorer/Settings.cs new file mode 100644 index 00000000..d5d2b073 --- /dev/null +++ b/src/boost/libs/math/dot_net_example/distribution_explorer/Settings.cs @@ -0,0 +1,28 @@ +namespace distribution_explorer.Properties { + + + // This class allows you to handle specific events on the settings class: + // The SettingChanging event is raised before a setting's value is changed. + // The PropertyChanged event is raised after a setting's value is changed. + // The SettingsLoaded event is raised after the setting values are loaded. + // The SettingsSaving event is raised before the setting values are saved. + internal sealed partial class Settings { + + public Settings() { + // // To add event handlers for saving and changing settings, uncomment the lines below: + // + // this.SettingChanging += this.SettingChangingEventHandler; + // + // this.SettingsSaving += this.SettingsSavingEventHandler; + // + } + + private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) { + // Add code to handle the SettingChangingEvent event here. + } + + private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) { + // Add code to handle the SettingsSaving event here. + } + } +} diff --git a/src/boost/libs/math/dot_net_example/distribution_explorer/ToolkitLogo.bmp b/src/boost/libs/math/dot_net_example/distribution_explorer/ToolkitLogo.bmp new file mode 100644 index 00000000..c712ff58 Binary files /dev/null and b/src/boost/libs/math/dot_net_example/distribution_explorer/ToolkitLogo.bmp differ diff --git a/src/boost/libs/math/dot_net_example/distribution_explorer/boost.png b/src/boost/libs/math/dot_net_example/distribution_explorer/boost.png new file mode 100644 index 00000000..461cf27b Binary files /dev/null and b/src/boost/libs/math/dot_net_example/distribution_explorer/boost.png differ diff --git a/src/boost/libs/math/dot_net_example/distribution_explorer/distexAboutBox.Designer.cs b/src/boost/libs/math/dot_net_example/distribution_explorer/distexAboutBox.Designer.cs new file mode 100644 index 00000000..5d05ce64 --- /dev/null +++ b/src/boost/libs/math/dot_net_example/distribution_explorer/distexAboutBox.Designer.cs @@ -0,0 +1,190 @@ +namespace distribution_explorer +{ + partial class distexAboutBox + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.tableLayoutPanel = new System.Windows.Forms.TableLayoutPanel(); + this.logoPictureBox = new System.Windows.Forms.PictureBox(); + this.labelProductName = new System.Windows.Forms.Label(); + this.labelVersion = new System.Windows.Forms.Label(); + this.labelCopyright = new System.Windows.Forms.Label(); + this.labelCompanyName = new System.Windows.Forms.Label(); + this.textBoxDescription = new System.Windows.Forms.TextBox(); + this.okButton = new System.Windows.Forms.Button(); + this.tableLayoutPanel.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.logoPictureBox)).BeginInit(); + this.SuspendLayout(); + // + // tableLayoutPanel + // + this.tableLayoutPanel.ColumnCount = 2; + this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33F)); + this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 67F)); + this.tableLayoutPanel.Controls.Add(this.logoPictureBox, 0, 0); + this.tableLayoutPanel.Controls.Add(this.labelProductName, 1, 0); + this.tableLayoutPanel.Controls.Add(this.labelVersion, 1, 1); + this.tableLayoutPanel.Controls.Add(this.labelCopyright, 1, 2); + this.tableLayoutPanel.Controls.Add(this.labelCompanyName, 1, 3); + this.tableLayoutPanel.Controls.Add(this.textBoxDescription, 1, 4); + this.tableLayoutPanel.Controls.Add(this.okButton, 1, 5); + this.tableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel.Location = new System.Drawing.Point(12, 11); + this.tableLayoutPanel.Margin = new System.Windows.Forms.Padding(4); + this.tableLayoutPanel.Name = "tableLayoutPanel"; + this.tableLayoutPanel.RowCount = 6; + this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); + this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); + this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); + this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); + this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); + this.tableLayoutPanel.Size = new System.Drawing.Size(556, 326); + this.tableLayoutPanel.TabIndex = 0; + // + // logoPictureBox + // + this.logoPictureBox.Dock = System.Windows.Forms.DockStyle.Fill; + this.logoPictureBox.Image = global::distribution_explorer.Properties.Resources.ToolkitLogo; + this.logoPictureBox.InitialImage = global::distribution_explorer.Properties.Resources.ToolkitLogo; + this.logoPictureBox.Location = new System.Drawing.Point(4, 4); + this.logoPictureBox.Margin = new System.Windows.Forms.Padding(4); + this.logoPictureBox.Name = "logoPictureBox"; + this.tableLayoutPanel.SetRowSpan(this.logoPictureBox, 6); + this.logoPictureBox.Size = new System.Drawing.Size(175, 318); + this.logoPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.logoPictureBox.TabIndex = 12; + this.logoPictureBox.TabStop = false; + // + // labelProductName + // + this.labelProductName.Dock = System.Windows.Forms.DockStyle.Fill; + this.labelProductName.Location = new System.Drawing.Point(191, 0); + this.labelProductName.Margin = new System.Windows.Forms.Padding(8, 0, 4, 0); + this.labelProductName.MaximumSize = new System.Drawing.Size(0, 21); + this.labelProductName.Name = "labelProductName"; + this.labelProductName.Size = new System.Drawing.Size(361, 21); + this.labelProductName.TabIndex = 19; + this.labelProductName.Text = "Product Name"; + this.labelProductName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // labelVersion + // + this.labelVersion.Dock = System.Windows.Forms.DockStyle.Fill; + this.labelVersion.Location = new System.Drawing.Point(191, 32); + this.labelVersion.Margin = new System.Windows.Forms.Padding(8, 0, 4, 0); + this.labelVersion.MaximumSize = new System.Drawing.Size(0, 21); + this.labelVersion.Name = "labelVersion"; + this.labelVersion.Size = new System.Drawing.Size(361, 21); + this.labelVersion.TabIndex = 0; + this.labelVersion.Text = "Version"; + this.labelVersion.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // labelCopyright + // + this.labelCopyright.Dock = System.Windows.Forms.DockStyle.Fill; + this.labelCopyright.Location = new System.Drawing.Point(191, 64); + this.labelCopyright.Margin = new System.Windows.Forms.Padding(8, 0, 4, 0); + this.labelCopyright.MaximumSize = new System.Drawing.Size(0, 21); + this.labelCopyright.Name = "labelCopyright"; + this.labelCopyright.Size = new System.Drawing.Size(361, 21); + this.labelCopyright.TabIndex = 21; + this.labelCopyright.Text = "Copyright"; + this.labelCopyright.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // labelCompanyName + // + this.labelCompanyName.Dock = System.Windows.Forms.DockStyle.Fill; + this.labelCompanyName.Location = new System.Drawing.Point(191, 96); + this.labelCompanyName.Margin = new System.Windows.Forms.Padding(8, 0, 4, 0); + this.labelCompanyName.MaximumSize = new System.Drawing.Size(0, 21); + this.labelCompanyName.Name = "labelCompanyName"; + this.labelCompanyName.Size = new System.Drawing.Size(361, 21); + this.labelCompanyName.TabIndex = 22; + this.labelCompanyName.Text = "Company Name"; + this.labelCompanyName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // textBoxDescription + // + this.textBoxDescription.Dock = System.Windows.Forms.DockStyle.Fill; + this.textBoxDescription.Location = new System.Drawing.Point(191, 132); + this.textBoxDescription.Margin = new System.Windows.Forms.Padding(8, 4, 4, 4); + this.textBoxDescription.Multiline = true; + this.textBoxDescription.Name = "textBoxDescription"; + this.textBoxDescription.ReadOnly = true; + this.textBoxDescription.ScrollBars = System.Windows.Forms.ScrollBars.Both; + this.textBoxDescription.Size = new System.Drawing.Size(361, 155); + this.textBoxDescription.TabIndex = 23; + this.textBoxDescription.TabStop = false; + this.textBoxDescription.Text = "Description"; + // + // okButton + // + this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.okButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.okButton.Location = new System.Drawing.Point(452, 295); + this.okButton.Margin = new System.Windows.Forms.Padding(4); + this.okButton.Name = "okButton"; + this.okButton.Size = new System.Drawing.Size(100, 27); + this.okButton.TabIndex = 24; + this.okButton.Text = "&OK"; + // + // distexAboutBox + // + this.AcceptButton = this.okButton; + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(580, 348); + this.Controls.Add(this.tableLayoutPanel); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.Margin = new System.Windows.Forms.Padding(4); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "distexAboutBox"; + this.Padding = new System.Windows.Forms.Padding(12, 11, 12, 11); + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "About Statistical Distribution Explorer"; + this.tableLayoutPanel.ResumeLayout(false); + this.tableLayoutPanel.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.logoPictureBox)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel; + private System.Windows.Forms.PictureBox logoPictureBox; + private System.Windows.Forms.Label labelProductName; + private System.Windows.Forms.Label labelVersion; + private System.Windows.Forms.Label labelCopyright; + private System.Windows.Forms.Label labelCompanyName; + private System.Windows.Forms.TextBox textBoxDescription; + private System.Windows.Forms.Button okButton; + } +} diff --git a/src/boost/libs/math/dot_net_example/distribution_explorer/distexAboutBox.cs b/src/boost/libs/math/dot_net_example/distribution_explorer/distexAboutBox.cs new file mode 100644 index 00000000..b8aa9249 --- /dev/null +++ b/src/boost/libs/math/dot_net_example/distribution_explorer/distexAboutBox.cs @@ -0,0 +1,116 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Windows.Forms; +using System.Reflection; + +namespace distribution_explorer +{ + partial class distexAboutBox : Form + { + public distexAboutBox() + { + InitializeComponent(); + + // Initialize the AboutBox to display the product information from the assembly information. + // Change assembly information settings for your application through either: + // - Project->Properties->Application->Assembly Information + // - AssemblyInfo.cs + this.Text = String.Format("About {0}", AssemblyTitle); + this.labelProductName.Text = AssemblyProduct; + this.labelVersion.Text = String.Format("Version {0}", AssemblyVersion); + this.labelCopyright.Text = AssemblyCopyright; + this.labelCompanyName.Text = AssemblyCompany; + this.textBoxDescription.Text = AssemblyDescription; + // URL http://sourceforge.net/projects/distexplorer + } + + #region Assembly Attribute Accessors + + public string AssemblyTitle + { + get + { + // Get all Title attributes on this assembly + object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false); + // If there is at least one Title attribute + if (attributes.Length > 0) + { + // Select the first one + AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0]; + // If it is not an empty string, return it + if (titleAttribute.Title != "") + return titleAttribute.Title; + } + // If there was no Title attribute, or if the Title attribute was the empty string, return the .exe name + return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase); + } + } + + public string AssemblyVersion + { + get + { + return Assembly.GetExecutingAssembly().GetName().Version.ToString(); + } + } + + public string AssemblyDescription + { + get + { + // Get all Description attributes on this assembly + object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false); + // If there aren't any Description attributes, return an empty string + if (attributes.Length == 0) + return ""; + // If there is a Description attribute, return its value + return ((AssemblyDescriptionAttribute)attributes[0]).Description; + } + } + + public string AssemblyProduct + { + get + { + // Get all Product attributes on this assembly + object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false); + // If there aren't any Product attributes, return an empty string + if (attributes.Length == 0) + return ""; + // If there is a Product attribute, return its value + return ((AssemblyProductAttribute)attributes[0]).Product; + } + } + + public string AssemblyCopyright + { + get + { + // Get all Copyright attributes on this assembly + object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false); + // If there aren't any Copyright attributes, return an empty string + if (attributes.Length == 0) + return ""; + // If there is a Copyright attribute, return its value + return ((AssemblyCopyrightAttribute)attributes[0]).Copyright; + } + } + + public string AssemblyCompany + { + get + { + // Get all Company attributes on this assembly + object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false); + // If there aren't any Company attributes, return an empty string + if (attributes.Length == 0) + return ""; + // If there is a Company attribute, return its value + return ((AssemblyCompanyAttribute)attributes[0]).Company; + } + } + #endregion + } +} diff --git a/src/boost/libs/math/dot_net_example/distribution_explorer/distexAboutBox.resx b/src/boost/libs/math/dot_net_example/distribution_explorer/distexAboutBox.resx new file mode 100644 index 00000000..d58980a3 --- /dev/null +++ b/src/boost/libs/math/dot_net_example/distribution_explorer/distexAboutBox.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/src/boost/libs/math/dot_net_example/distribution_explorer/distribution.txt b/src/boost/libs/math/dot_net_example/distribution_explorer/distribution.txt new file mode 100644 index 00000000..f99b6b2e --- /dev/null +++ b/src/boost/libs/math/dot_net_example/distribution_explorer/distribution.txt @@ -0,0 +1,10 @@ +Statistical Distribution Explorer +Version 1.0.1.52 +Company Boost 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) +Copyright Copyright © John Maddock and Paul A. Bristow 2009, 2010, 2012 +Product Distribution_Explorer +Title Distribution_Explorer +Mean +MeanParameter 1 0 +Parameter 2 1 + diff --git a/src/boost/libs/math/dot_net_example/distribution_explorer/distribution_explorer.csproj b/src/boost/libs/math/dot_net_example/distribution_explorer/distribution_explorer.csproj new file mode 100644 index 00000000..591341b0 --- /dev/null +++ b/src/boost/libs/math/dot_net_example/distribution_explorer/distribution_explorer.csproj @@ -0,0 +1,216 @@ + + + + Debug + AnyCPU + 9.0.21022 + 2.0 + {77742493-4236-4975-9BD9-AA3611F0DC0E} + WinExe + Properties + distribution_explorer + distribution_explorer + + + false + 393B9B4A721C946375D6D44F80492CFFA03E57B5 + distribution_explorer_TemporaryKey.pfx + true + LocalIntranet + false + + + + + 3.5 + v4.0 + Client + \\hetpA\H%24\Distex\ + true + Unc + false + Foreground + 7 + Days + false + false + true + http://sourceforge.net/projects/distexplorer/ + Statistical Distribution Explorer + hetp + 8 + 1.0.1.8 + false + true + true + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + false + + + none + true + bin\Release\ + + + prompt + 4 + x86 + bin\Release\distribution_explorer.XML + false + + + true + bin\x64\Debug\ + DEBUG;TRACE + full + x64 + false + prompt + MinimumRecommendedRules.ruleset + + + bin\x64\Release\ + bin\Release\distribution_explorer.XML + true + x64 + false + prompt + MinimumRecommendedRules.ruleset + + + + + + + + + + + + Form + + + distexAboutBox.cs + + + Form + + + DistexForm.cs + + + + + Designer + distexAboutBox.cs + + + Designer + DistexForm.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + Designer + DistexSplash.cs + + + True + Resources.resx + True + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + Form + + + DistexSplash.cs + + + + + + PreserveNewest + + + + + + + + False + Microsoft .NET Framework 4 Client Profile %28x86 and x64%29 + true + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 2.0 %28x86%29 + false + + + False + .NET Framework 3.0 %28x86%29 + false + + + False + .NET Framework 3.5 + false + + + False + .NET Framework 3.5 SP1 + false + + + False + Visual C++ 2010 Runtime Libraries %28x86%29 + true + + + False + Windows Installer 4.5 + true + + + + + {cee4bad0-967a-4193-9edb-c0dd6c3b05c9} + boost_math + + + + + \ No newline at end of file diff --git a/src/boost/libs/math/dot_net_example/distribution_explorer/distribution_explorer.csproj.user b/src/boost/libs/math/dot_net_example/distribution_explorer/distribution_explorer.csproj.user new file mode 100644 index 00000000..39565271 --- /dev/null +++ b/src/boost/libs/math/dot_net_example/distribution_explorer/distribution_explorer.csproj.user @@ -0,0 +1,21 @@ + + + + ProjectFiles + \\hetpA\H%24\Distex\|\\hetp7\H%24\Distex\|\\hetp7\H%24\|I:\boost-sandbox\libs\math_functions\dot_net_example\Distex\|publish\ + \\hetp7\H%24\ + + + + + + + en-US + false + false + + + + I:\boost-trunk\libs\math\dot_net_example\boost_math\ + + \ No newline at end of file diff --git a/src/boost/libs/math/dot_net_example/distribution_explorer/distribution_explorer.sln b/src/boost/libs/math/dot_net_example/distribution_explorer/distribution_explorer.sln new file mode 100644 index 00000000..6e3c9017 --- /dev/null +++ b/src/boost/libs/math/dot_net_example/distribution_explorer/distribution_explorer.sln @@ -0,0 +1,50 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27130.2024 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "distribution_explorer", "distribution_explorer.csproj", "{77742493-4236-4975-9BD9-AA3611F0DC0E}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "boost_math", "..\boost_math\boost_math.vcxproj", "{80E5F29C-93FB-4C84-A818-D2B8263C7CA1}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + Description = Statistical Distribution Explorer + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {77742493-4236-4975-9BD9-AA3611F0DC0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {77742493-4236-4975-9BD9-AA3611F0DC0E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {77742493-4236-4975-9BD9-AA3611F0DC0E}.Debug|x64.ActiveCfg = Debug|x64 + {77742493-4236-4975-9BD9-AA3611F0DC0E}.Debug|x64.Build.0 = Debug|x64 + {77742493-4236-4975-9BD9-AA3611F0DC0E}.Debug|x86.ActiveCfg = Debug|Any CPU + {77742493-4236-4975-9BD9-AA3611F0DC0E}.Debug|x86.Build.0 = Debug|Any CPU + {77742493-4236-4975-9BD9-AA3611F0DC0E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {77742493-4236-4975-9BD9-AA3611F0DC0E}.Release|Any CPU.Build.0 = Release|Any CPU + {77742493-4236-4975-9BD9-AA3611F0DC0E}.Release|x64.ActiveCfg = Release|x64 + {77742493-4236-4975-9BD9-AA3611F0DC0E}.Release|x64.Build.0 = Release|x64 + {77742493-4236-4975-9BD9-AA3611F0DC0E}.Release|x86.ActiveCfg = Release|Any CPU + {77742493-4236-4975-9BD9-AA3611F0DC0E}.Release|x86.Build.0 = Release|Any CPU + {80E5F29C-93FB-4C84-A818-D2B8263C7CA1}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {80E5F29C-93FB-4C84-A818-D2B8263C7CA1}.Debug|x64.ActiveCfg = Debug|x64 + {80E5F29C-93FB-4C84-A818-D2B8263C7CA1}.Debug|x64.Build.0 = Debug|x64 + {80E5F29C-93FB-4C84-A818-D2B8263C7CA1}.Debug|x86.ActiveCfg = Debug|Win32 + {80E5F29C-93FB-4C84-A818-D2B8263C7CA1}.Debug|x86.Build.0 = Debug|Win32 + {80E5F29C-93FB-4C84-A818-D2B8263C7CA1}.Release|Any CPU.ActiveCfg = Release|Win32 + {80E5F29C-93FB-4C84-A818-D2B8263C7CA1}.Release|x64.ActiveCfg = Release|x64 + {80E5F29C-93FB-4C84-A818-D2B8263C7CA1}.Release|x64.Build.0 = Release|x64 + {80E5F29C-93FB-4C84-A818-D2B8263C7CA1}.Release|x86.ActiveCfg = Release|Win32 + {80E5F29C-93FB-4C84-A818-D2B8263C7CA1}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {E7B27F35-B063-4E0E-AA07-9A53BEA22670} + EndGlobalSection +EndGlobal diff --git a/src/boost/libs/math/dot_net_example/distribution_explorer/distribution_explorer.suo b/src/boost/libs/math/dot_net_example/distribution_explorer/distribution_explorer.suo new file mode 100644 index 00000000..d2c71687 Binary files /dev/null and b/src/boost/libs/math/dot_net_example/distribution_explorer/distribution_explorer.suo differ diff --git a/src/boost/libs/math/dot_net_example/distribution_explorer/readme.txt b/src/boost/libs/math/dot_net_example/distribution_explorer/readme.txt new file mode 100644 index 00000000..d483173d --- /dev/null +++ b/src/boost/libs/math/dot_net_example/distribution_explorer/readme.txt @@ -0,0 +1,86 @@ +Statistical Distribution Explorer + +Paul A. Bristow +John Maddock + +Copyright © 2008 , 2009, 2010, 2012 Paul A. Bristow, John Maddock + +Distributed under 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) + +A Windows utility to show the properties of statistical distributions using parameters provided interactively by the user. + +The 31 distributions provided (by version 1.0.1.52) are: + + * bernoulli + * beta + * binomial + * cauchy + * chi_squared + * exponential + * extreme_value + * fisher_f + * gamma + * geometric + * hypergeometric + * inverse_chi_squared + * inverse_gamma + * inverse_gaussian + * laplace + * logistic + * lognormal + * negative_binomial + * non-central beta + * non-central_chi_squared + * non-central_F + * non-central_t + * normal (Gaussian) + * pareto + * poisson + * rayleigh + * students_t + * skew_normal + * triangular + * uniform + * weibull + +Properties of distributions computed (where possible) are: + + * mean + * mode + * median + * variance + * standard deviation + * coefficient of variation, + * skewness + * kurtosis + * excess + * range supported + +Calculated, from values provided, are: + + * probability density (or mass) function (PDF) + * cumulative distribution function (CDF), and complement + * Quantiles (percentiles) are calculated for typical risk (alpha) probabilities (0.001, 0.01, 0.5, 0.1, 0.333) and for additional probabilities that can be requested by the user. + +Results can be saved to text files using Save or SaveAs. All the values on the four tabs are output to the file chosen, and are tab separated to assist input to other programs, for example, spreadsheets or text editors. + +Note: Excel (for example), by default, only shows 10 decimal digits: to display the maximum possible precision (about 15 decimal digits), it is necessary to format all cells to display this precision. Although unusually accurate, not all values computed by Statistical Distribution Explorer will be as accurate as 15 decimal digits. Values shown as NaN cannot be calculated from the value(s) given, most commonly because the value input is outside the range for the distribution. + +For more information, including downloads, and this index.html file, see Distexplorer at Sourceforge. + +This Microsoft Windows 32 package was generated from a C# program and uses a boost_math.dll generated using the Boost.Math C++ source code containing the underlying statistical distribution classes and functions (C++ was compiled in CLI mode). + +All source code is freely available for view and for use under the Boost Open Source License. + +Math Toolkit C++ source code to produce boost_math.dll is in the most recent Boost release, currently 1.52.0 (and the Boost version used to build the explorer is embedded in its version number). You can download the current Boost library and find the source to build the Distribution Explorer at /libs/math/dot_net_example/. + +Installation +============ +Statistical Distribution Explorer is distributed as a single Windows Installer package setupdistex.msi. Unzip the distexplorer.zip file to a temporary location of your choice and run setupdistex.msi. + +(If the program installs OK, but does not run, it will be necessary to run setup.exe to install Microsoft redistributables. This is because .NET Framework 4.0 Client Profile and VC Redistributable X86 are requirements for this program. Most recent and updated Windows environments will already have these installed, but they are quickly, easily and safely installed from the Microsoft site if required. This program has been tested on Windows 200 up to Windows 8). + +(The package cannot be run on other platforms at present but it should be possible to build an equivalent utility on any C/C++ platform if anyone would like to undertake this task.) + +Last revised: 15 Oct 2012 + diff --git a/src/boost/libs/math/example/HSO3.hpp b/src/boost/libs/math/example/HSO3.hpp new file mode 100644 index 00000000..4e4ead7a --- /dev/null +++ b/src/boost/libs/math/example/HSO3.hpp @@ -0,0 +1,509 @@ + +/********************************************************************************************/ +/* */ +/* HSO3.hpp header file */ +/* */ +/* This file is not currently part of the Boost library. It is simply an example of the use */ +/* quaternions can be put to. Hopefully it will be useful too. */ +/* */ +/* This file provides tools to convert between quaternions and R^3 rotation matrices. */ +/* */ +/********************************************************************************************/ + +// (C) Copyright Hubert Holin 2001. +// Distributed under 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) + +#ifndef TEST_HSO3_HPP +#define TEST_HSO3_HPP + +#include + +#if defined(__GNUC__) && (__GNUC__ < 3) +#include +#else +#include +#endif + +#include +#include + +#include + + +#if defined(__GNUC__) && (__GNUC__ < 3) +// gcc 2.x ignores function scope using declarations, put them here instead: +using namespace ::std; +using namespace ::boost::math; +#endif + +template +struct R3_matrix +{ + TYPE_FLOAT a11, a12, a13; + TYPE_FLOAT a21, a22, a23; + TYPE_FLOAT a31, a32, a33; +}; + + +// Note: the input quaternion need not be of norm 1 for the following function + +template +R3_matrix quaternion_to_R3_rotation(::boost::math::quaternion const & q) +{ + using ::std::numeric_limits; + + TYPE_FLOAT a = q.R_component_1(); + TYPE_FLOAT b = q.R_component_2(); + TYPE_FLOAT c = q.R_component_3(); + TYPE_FLOAT d = q.R_component_4(); + + TYPE_FLOAT aa = a*a; + TYPE_FLOAT ab = a*b; + TYPE_FLOAT ac = a*c; + TYPE_FLOAT ad = a*d; + TYPE_FLOAT bb = b*b; + TYPE_FLOAT bc = b*c; + TYPE_FLOAT bd = b*d; + TYPE_FLOAT cc = c*c; + TYPE_FLOAT cd = c*d; + TYPE_FLOAT dd = d*d; + + TYPE_FLOAT norme_carre = aa+bb+cc+dd; + + if (norme_carre <= numeric_limits::epsilon()) + { + ::std::string error_reporting("Argument to quaternion_to_R3_rotation is too small!"); + ::std::underflow_error bad_argument(error_reporting); + + throw(bad_argument); + } + + R3_matrix out_matrix; + + out_matrix.a11 = (aa+bb-cc-dd)/norme_carre; + out_matrix.a12 = 2*(-ad+bc)/norme_carre; + out_matrix.a13 = 2*(ac+bd)/norme_carre; + out_matrix.a21 = 2*(ad+bc)/norme_carre; + out_matrix.a22 = (aa-bb+cc-dd)/norme_carre; + out_matrix.a23 = 2*(-ab+cd)/norme_carre; + out_matrix.a31 = 2*(-ac+bd)/norme_carre; + out_matrix.a32 = 2*(ab+cd)/norme_carre; + out_matrix.a33 = (aa-bb-cc+dd)/norme_carre; + + return(out_matrix); +} + + + template + void find_invariant_vector( R3_matrix const & rot, + TYPE_FLOAT & x, + TYPE_FLOAT & y, + TYPE_FLOAT & z) + { + using ::std::sqrt; + + using ::std::numeric_limits; + + TYPE_FLOAT b11 = rot.a11 - static_cast(1); + TYPE_FLOAT b12 = rot.a12; + TYPE_FLOAT b13 = rot.a13; + TYPE_FLOAT b21 = rot.a21; + TYPE_FLOAT b22 = rot.a22 - static_cast(1); + TYPE_FLOAT b23 = rot.a23; + TYPE_FLOAT b31 = rot.a31; + TYPE_FLOAT b32 = rot.a32; + TYPE_FLOAT b33 = rot.a33 - static_cast(1); + + TYPE_FLOAT minors[9] = + { + b11*b22-b12*b21, + b11*b23-b13*b21, + b12*b23-b13*b22, + b11*b32-b12*b31, + b11*b33-b13*b31, + b12*b33-b13*b32, + b21*b32-b22*b31, + b21*b33-b23*b31, + b22*b33-b23*b32 + }; + + TYPE_FLOAT * where = ::std::max_element(minors, minors+9); + + TYPE_FLOAT det = *where; + + if (det <= numeric_limits::epsilon()) + { + ::std::string error_reporting("Underflow error in find_invariant_vector!"); + ::std::underflow_error processing_error(error_reporting); + + throw(processing_error); + } + + switch (where-minors) + { + case 0: + + z = static_cast(1); + + x = (-b13*b22+b12*b23)/det; + y = (-b11*b23+b13*b21)/det; + + break; + + case 1: + + y = static_cast(1); + + x = (-b12*b23+b13*b22)/det; + z = (-b11*b22+b12*b21)/det; + + break; + + case 2: + + x = static_cast(1); + + y = (-b11*b23+b13*b21)/det; + z = (-b12*b21+b11*b22)/det; + + break; + + case 3: + + z = static_cast(1); + + x = (-b13*b32+b12*b33)/det; + y = (-b11*b33+b13*b31)/det; + + break; + + case 4: + + y = static_cast(1); + + x = (-b12*b33+b13*b32)/det; + z = (-b11*b32+b12*b31)/det; + + break; + + case 5: + + x = static_cast(1); + + y = (-b11*b33+b13*b31)/det; + z = (-b12*b31+b11*b32)/det; + + break; + + case 6: + + z = static_cast(1); + + x = (-b23*b32+b22*b33)/det; + y = (-b21*b33+b23*b31)/det; + + break; + + case 7: + + y = static_cast(1); + + x = (-b22*b33+b23*b32)/det; + z = (-b21*b32+b22*b31)/det; + + break; + + case 8: + + x = static_cast(1); + + y = (-b21*b33+b23*b31)/det; + z = (-b22*b31+b21*b32)/det; + + break; + + default: + + ::std::string error_reporting("Impossible condition in find_invariant_vector"); + ::std::logic_error processing_error(error_reporting); + + throw(processing_error); + + break; + } + + TYPE_FLOAT vecnorm = sqrt(x*x+y*y+z*z); + + if (vecnorm <= numeric_limits::epsilon()) + { + ::std::string error_reporting("Overflow error in find_invariant_vector!"); + ::std::overflow_error processing_error(error_reporting); + + throw(processing_error); + } + + x /= vecnorm; + y /= vecnorm; + z /= vecnorm; + } + + + template + void find_orthogonal_vector( TYPE_FLOAT x, + TYPE_FLOAT y, + TYPE_FLOAT z, + TYPE_FLOAT & u, + TYPE_FLOAT & v, + TYPE_FLOAT & w) + { + using ::std::abs; + using ::std::sqrt; + + using ::std::numeric_limits; + + TYPE_FLOAT vecnormsqr = x*x+y*y+z*z; + + if (vecnormsqr <= numeric_limits::epsilon()) + { + ::std::string error_reporting("Underflow error in find_orthogonal_vector!"); + ::std::underflow_error processing_error(error_reporting); + + throw(processing_error); + } + + TYPE_FLOAT lambda; + + TYPE_FLOAT components[3] = + { + abs(x), + abs(y), + abs(z) + }; + + TYPE_FLOAT * where = ::std::min_element(components, components+3); + + switch (where-components) + { + case 0: + + if (*where <= numeric_limits::epsilon()) + { + v = + w = static_cast(0); + u = static_cast(1); + } + else + { + lambda = -x/vecnormsqr; + + u = static_cast(1) + lambda*x; + v = lambda*y; + w = lambda*z; + } + + break; + + case 1: + + if (*where <= numeric_limits::epsilon()) + { + u = + w = static_cast(0); + v = static_cast(1); + } + else + { + lambda = -y/vecnormsqr; + + u = lambda*x; + v = static_cast(1) + lambda*y; + w = lambda*z; + } + + break; + + case 2: + + if (*where <= numeric_limits::epsilon()) + { + u = + v = static_cast(0); + w = static_cast(1); + } + else + { + lambda = -z/vecnormsqr; + + u = lambda*x; + v = lambda*y; + w = static_cast(1) + lambda*z; + } + + break; + + default: + + ::std::string error_reporting("Impossible condition in find_invariant_vector"); + ::std::logic_error processing_error(error_reporting); + + throw(processing_error); + + break; + } + + TYPE_FLOAT vecnorm = sqrt(u*u+v*v+w*w); + + if (vecnorm <= numeric_limits::epsilon()) + { + ::std::string error_reporting("Underflow error in find_orthogonal_vector!"); + ::std::underflow_error processing_error(error_reporting); + + throw(processing_error); + } + + u /= vecnorm; + v /= vecnorm; + w /= vecnorm; + } + + + // Note: we want [[v, v, w], [r, s, t], [x, y, z]] to be a direct orthogonal basis + // of R^3. It might not be orthonormal, however, and we do not check if the + // two input vectors are colinear or not. + + template + void find_vector_for_BOD(TYPE_FLOAT x, + TYPE_FLOAT y, + TYPE_FLOAT z, + TYPE_FLOAT u, + TYPE_FLOAT v, + TYPE_FLOAT w, + TYPE_FLOAT & r, + TYPE_FLOAT & s, + TYPE_FLOAT & t) + { + r = +y*w-z*v; + s = -x*w+z*u; + t = +x*v-y*u; + } + + + +template +inline bool is_R3_rotation_matrix(R3_matrix const & mat) +{ + using ::std::abs; + + using ::std::numeric_limits; + + return ( + !( + (abs(mat.a11*mat.a11+mat.a21*mat.a21+mat.a31*mat.a31 - static_cast(1)) > static_cast(10)*numeric_limits::epsilon())|| + (abs(mat.a11*mat.a12+mat.a21*mat.a22+mat.a31*mat.a32 - static_cast(0)) > static_cast(10)*numeric_limits::epsilon())|| + (abs(mat.a11*mat.a13+mat.a21*mat.a23+mat.a31*mat.a33 - static_cast(0)) > static_cast(10)*numeric_limits::epsilon())|| + //(abs(mat.a11*mat.a12+mat.a21*mat.a22+mat.a31*mat.a32 - static_cast(0)) > static_cast(10)*numeric_limits::epsilon())|| + (abs(mat.a12*mat.a12+mat.a22*mat.a22+mat.a32*mat.a32 - static_cast(1)) > static_cast(10)*numeric_limits::epsilon())|| + (abs(mat.a12*mat.a13+mat.a22*mat.a23+mat.a32*mat.a33 - static_cast(0)) > static_cast(10)*numeric_limits::epsilon())|| + //(abs(mat.a11*mat.a13+mat.a21*mat.a23+mat.a31*mat.a33 - static_cast(0)) > static_cast(10)*numeric_limits::epsilon())|| + //(abs(mat.a12*mat.a13+mat.a22*mat.a23+mat.a32*mat.a33 - static_cast(0)) > static_cast(10)*numeric_limits::epsilon())|| + (abs(mat.a13*mat.a13+mat.a23*mat.a23+mat.a33*mat.a33 - static_cast(1)) > static_cast(10)*numeric_limits::epsilon()) + ) + ); +} + + +template +::boost::math::quaternion R3_rotation_to_quaternion( R3_matrix const & rot, + ::boost::math::quaternion const * hint = 0) +{ + using ::boost::math::abs; + + using ::std::abs; + using ::std::sqrt; + + using ::std::numeric_limits; + + if (!is_R3_rotation_matrix(rot)) + { + ::std::string error_reporting("Argument to R3_rotation_to_quaternion is not an R^3 rotation matrix!"); + ::std::range_error bad_argument(error_reporting); + + throw(bad_argument); + } + + ::boost::math::quaternion q; + + if ( + (abs(rot.a11 - static_cast(1)) <= numeric_limits::epsilon())&& + (abs(rot.a22 - static_cast(1)) <= numeric_limits::epsilon())&& + (abs(rot.a33 - static_cast(1)) <= numeric_limits::epsilon()) + ) + { + q = ::boost::math::quaternion(1); + } + else + { + TYPE_FLOAT cos_theta = (rot.a11+rot.a22+rot.a33-static_cast(1))/static_cast(2); + TYPE_FLOAT stuff = (cos_theta+static_cast(1))/static_cast(2); + TYPE_FLOAT cos_theta_sur_2 = sqrt(stuff); + TYPE_FLOAT sin_theta_sur_2 = sqrt(1-stuff); + + TYPE_FLOAT x; + TYPE_FLOAT y; + TYPE_FLOAT z; + + find_invariant_vector(rot, x, y, z); + + TYPE_FLOAT u; + TYPE_FLOAT v; + TYPE_FLOAT w; + + find_orthogonal_vector(x, y, z, u, v, w); + + TYPE_FLOAT r; + TYPE_FLOAT s; + TYPE_FLOAT t; + + find_vector_for_BOD(x, y, z, u, v, w, r, s, t); + + TYPE_FLOAT ru = rot.a11*u+rot.a12*v+rot.a13*w; + TYPE_FLOAT rv = rot.a21*u+rot.a22*v+rot.a23*w; + TYPE_FLOAT rw = rot.a31*u+rot.a32*v+rot.a33*w; + + TYPE_FLOAT angle_sign_determinator = r*ru+s*rv+t*rw; + + if (angle_sign_determinator > +numeric_limits::epsilon()) + { + q = ::boost::math::quaternion(cos_theta_sur_2, +x*sin_theta_sur_2, +y*sin_theta_sur_2, +z*sin_theta_sur_2); + } + else if (angle_sign_determinator < -numeric_limits::epsilon()) + { + q = ::boost::math::quaternion(cos_theta_sur_2, -x*sin_theta_sur_2, -y*sin_theta_sur_2, -z*sin_theta_sur_2); + } + else + { + TYPE_FLOAT desambiguator = u*ru+v*rv+w*rw; + + if (desambiguator >= static_cast(1)) + { + q = ::boost::math::quaternion(0, +x, +y, +z); + } + else + { + q = ::boost::math::quaternion(0, -x, -y, -z); + } + } + } + + if ((hint != 0) && (abs(*hint+q) < abs(*hint-q))) + { + return(-q); + } + + return(q); +} + +#endif /* TEST_HSO3_HPP */ + diff --git a/src/boost/libs/math/example/HSO3SO4.cpp b/src/boost/libs/math/example/HSO3SO4.cpp new file mode 100644 index 00000000..c4462c79 --- /dev/null +++ b/src/boost/libs/math/example/HSO3SO4.cpp @@ -0,0 +1,445 @@ +// test file for HSO3.hpp and HSO4.hpp + +// (C) Copyright Hubert Holin 2001. +// Distributed under 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 "HSO3.hpp" +#include "HSO4.hpp" + + +const int number_of_intervals = 5; + +const float pi = ::std::atan(1.0f)*4; + + + +void test_SO3(); + +void test_SO4(); + + +int main() + +{ + test_SO3(); + + test_SO4(); + + ::std::cout << "That's all folks!" << ::std::endl; +} + + +// +// Test of quaternion and R^3 rotation relationship +// + +void test_SO3_spherical() +{ + ::std::cout << "Testing spherical:" << ::std::endl; + ::std::cout << ::std::endl; + + const float rho = 1.0f; + + float theta; + float phi1; + float phi2; + + for (int idxphi2 = 0; idxphi2 <= number_of_intervals; idxphi2++) + { + phi2 = (-pi/2)+(idxphi2*pi)/number_of_intervals; + + for (int idxphi1 = 0; idxphi1 <= number_of_intervals; idxphi1++) + { + phi1 = (-pi/2)+(idxphi1*pi)/number_of_intervals; + + for (int idxtheta = 0; idxtheta <= number_of_intervals; idxtheta++) + { + theta = -pi+(idxtheta*(2*pi))/number_of_intervals; + + ::std::cout << "theta = " << theta << " ; "; + ::std::cout << "phi1 = " << phi1 << " ; "; + ::std::cout << "phi2 = " << phi2; + ::std::cout << ::std::endl; + + ::boost::math::quaternion q = ::boost::math::spherical(rho, theta, phi1, phi2); + + ::std::cout << "q = " << q << ::std::endl; + + R3_matrix rot = quaternion_to_R3_rotation(q); + + ::std::cout << "rot = "; + ::std::cout << "\t" << rot.a11 << "\t" << rot.a12 << "\t" << rot.a13 << ::std::endl; + ::std::cout << "\t"; + ::std::cout << "\t" << rot.a21 << "\t" << rot.a22 << "\t" << rot.a23 << ::std::endl; + ::std::cout << "\t"; + ::std::cout << "\t" << rot.a31 << "\t" << rot.a32 << "\t" << rot.a33 << ::std::endl; + + ::boost::math::quaternion p = R3_rotation_to_quaternion(rot, &q); + + ::std::cout << "p = " << p << ::std::endl; + + ::std::cout << "round trip discrepancy: " << ::boost::math::abs(q-p) << ::std::endl; + + ::std::cout << ::std::endl; + } + } + } + + ::std::cout << ::std::endl; +} + + +void test_SO3_semipolar() +{ + ::std::cout << "Testing semipolar:" << ::std::endl; + ::std::cout << ::std::endl; + + const float rho = 1.0f; + + float alpha; + float theta1; + float theta2; + + for (int idxalpha = 0; idxalpha <= number_of_intervals; idxalpha++) + { + alpha = (idxalpha*(pi/2))/number_of_intervals; + + for (int idxtheta1 = 0; idxtheta1 <= number_of_intervals; idxtheta1++) + { + theta1 = -pi+(idxtheta1*(2*pi))/number_of_intervals; + + for (int idxtheta2 = 0; idxtheta2 <= number_of_intervals; idxtheta2++) + { + theta2 = -pi+(idxtheta2*(2*pi))/number_of_intervals; + + ::std::cout << "alpha = " << alpha << " ; "; + ::std::cout << "theta1 = " << theta1 << " ; "; + ::std::cout << "theta2 = " << theta2; + ::std::cout << ::std::endl; + + ::boost::math::quaternion q = ::boost::math::semipolar(rho, alpha, theta1, theta2); + + ::std::cout << "q = " << q << ::std::endl; + + R3_matrix rot = quaternion_to_R3_rotation(q); + + ::std::cout << "rot = "; + ::std::cout << "\t" << rot.a11 << "\t" << rot.a12 << "\t" << rot.a13 << ::std::endl; + ::std::cout << "\t"; + ::std::cout << "\t" << rot.a21 << "\t" << rot.a22 << "\t" << rot.a23 << ::std::endl; + ::std::cout << "\t"; + ::std::cout << "\t" << rot.a31 << "\t" << rot.a32 << "\t" << rot.a33 << ::std::endl; + + ::boost::math::quaternion p = R3_rotation_to_quaternion(rot, &q); + + ::std::cout << "p = " << p << ::std::endl; + + ::std::cout << "round trip discrepancy: " << ::boost::math::abs(q-p) << ::std::endl; + + ::std::cout << ::std::endl; + } + } + } + + ::std::cout << ::std::endl; +} + + +void test_SO3_multipolar() +{ + ::std::cout << "Testing multipolar:" << ::std::endl; + ::std::cout << ::std::endl; + + float rho1; + float rho2; + + float theta1; + float theta2; + + for (int idxrho = 0; idxrho <= number_of_intervals; idxrho++) + { + rho1 = (idxrho*1.0f)/number_of_intervals; + rho2 = ::std::sqrt(1.0f-rho1*rho1); + + for (int idxtheta1 = 0; idxtheta1 <= number_of_intervals; idxtheta1++) + { + theta1 = -pi+(idxtheta1*(2*pi))/number_of_intervals; + + for (int idxtheta2 = 0; idxtheta2 <= number_of_intervals; idxtheta2++) + { + theta2 = -pi+(idxtheta2*(2*pi))/number_of_intervals; + + ::std::cout << "rho1 = " << rho1 << " ; "; + ::std::cout << "theta1 = " << theta1 << " ; "; + ::std::cout << "theta2 = " << theta2; + ::std::cout << ::std::endl; + + ::boost::math::quaternion q = ::boost::math::multipolar(rho1, theta1, rho2, theta2); + + ::std::cout << "q = " << q << ::std::endl; + + R3_matrix rot = quaternion_to_R3_rotation(q); + + ::std::cout << "rot = "; + ::std::cout << "\t" << rot.a11 << "\t" << rot.a12 << "\t" << rot.a13 << ::std::endl; + ::std::cout << "\t"; + ::std::cout << "\t" << rot.a21 << "\t" << rot.a22 << "\t" << rot.a23 << ::std::endl; + ::std::cout << "\t"; + ::std::cout << "\t" << rot.a31 << "\t" << rot.a32 << "\t" << rot.a33 << ::std::endl; + + ::boost::math::quaternion p = R3_rotation_to_quaternion(rot, &q); + + ::std::cout << "p = " << p << ::std::endl; + + ::std::cout << "round trip discrepancy: " << ::boost::math::abs(q-p) << ::std::endl; + + ::std::cout << ::std::endl; + } + } + } + + ::std::cout << ::std::endl; +} + + +void test_SO3_cylindrospherical() +{ + ::std::cout << "Testing cylindrospherical:" << ::std::endl; + ::std::cout << ::std::endl; + + float t; + + float radius; + float longitude; + float latitude; + + for (int idxt = 0; idxt <= number_of_intervals; idxt++) + { + t = -1.0f+(idxt*2.0f)/number_of_intervals; + radius = ::std::sqrt(1.0f-t*t); + + for (int idxlatitude = 0; idxlatitude <= number_of_intervals; idxlatitude++) + { + latitude = (-pi/2)+(idxlatitude*pi)/number_of_intervals; + + for (int idxlongitude = 0; idxlongitude <= number_of_intervals; idxlongitude++) + { + longitude = -pi+(idxlongitude*(2*pi))/number_of_intervals; + + ::std::cout << "t = " << t << " ; "; + ::std::cout << "longitude = " << longitude; + ::std::cout << "latitude = " << latitude; + ::std::cout << ::std::endl; + + ::boost::math::quaternion q = ::boost::math::cylindrospherical(t, radius, longitude, latitude); + + ::std::cout << "q = " << q << ::std::endl; + + R3_matrix rot = quaternion_to_R3_rotation(q); + + ::std::cout << "rot = "; + ::std::cout << "\t" << rot.a11 << "\t" << rot.a12 << "\t" << rot.a13 << ::std::endl; + ::std::cout << "\t"; + ::std::cout << "\t" << rot.a21 << "\t" << rot.a22 << "\t" << rot.a23 << ::std::endl; + ::std::cout << "\t"; + ::std::cout << "\t" << rot.a31 << "\t" << rot.a32 << "\t" << rot.a33 << ::std::endl; + + ::boost::math::quaternion p = R3_rotation_to_quaternion(rot, &q); + + ::std::cout << "p = " << p << ::std::endl; + + ::std::cout << "round trip discrepancy: " << ::boost::math::abs(q-p) << ::std::endl; + + ::std::cout << ::std::endl; + } + } + } + + ::std::cout << ::std::endl; +} + + +void test_SO3_cylindrical() +{ + ::std::cout << "Testing cylindrical:" << ::std::endl; + ::std::cout << ::std::endl; + + float r; + float angle; + + float h1; + float h2; + + for (int idxh2 = 0; idxh2 <= number_of_intervals; idxh2++) + { + h2 = -1.0f+(idxh2*2.0f)/number_of_intervals; + + for (int idxh1 = 0; idxh1 <= number_of_intervals; idxh1++) + { + h1 = ::std::sqrt(1.0f-h2*h2)*(-1.0f+(idxh2*2.0f)/number_of_intervals); + r = ::std::sqrt(1.0f-h1*h1-h2*h2); + + for (int idxangle = 0; idxangle <= number_of_intervals; idxangle++) + { + angle = -pi+(idxangle*(2*pi))/number_of_intervals; + + ::std::cout << "angle = " << angle << " ; "; + ::std::cout << "h1 = " << h1; + ::std::cout << "h2 = " << h2; + ::std::cout << ::std::endl; + + ::boost::math::quaternion q = ::boost::math::cylindrical(r, angle, h1, h2); + + ::std::cout << "q = " << q << ::std::endl; + + R3_matrix rot = quaternion_to_R3_rotation(q); + + ::std::cout << "rot = "; + ::std::cout << "\t" << rot.a11 << "\t" << rot.a12 << "\t" << rot.a13 << ::std::endl; + ::std::cout << "\t"; + ::std::cout << "\t" << rot.a21 << "\t" << rot.a22 << "\t" << rot.a23 << ::std::endl; + ::std::cout << "\t"; + ::std::cout << "\t" << rot.a31 << "\t" << rot.a32 << "\t" << rot.a33 << ::std::endl; + + ::boost::math::quaternion p = R3_rotation_to_quaternion(rot, &q); + + ::std::cout << "p = " << p << ::std::endl; + + ::std::cout << "round trip discrepancy: " << ::boost::math::abs(q-p) << ::std::endl; + + ::std::cout << ::std::endl; + } + } + } + + ::std::cout << ::std::endl; +} + + +void test_SO3() +{ + ::std::cout << "Testing SO3:" << ::std::endl; + ::std::cout << ::std::endl; + + test_SO3_spherical(); + + test_SO3_semipolar(); + + test_SO3_multipolar(); + + test_SO3_cylindrospherical(); + + test_SO3_cylindrical(); +} + + +// +// Test of quaternion and R^4 rotation relationship +// + +void test_SO4_spherical() +{ + ::std::cout << "Testing spherical:" << ::std::endl; + ::std::cout << ::std::endl; + + const float rho1 = 1.0f; + const float rho2 = 1.0f; + + float theta1; + float phi11; + float phi21; + + float theta2; + float phi12; + float phi22; + + for (int idxphi21 = 0; idxphi21 <= number_of_intervals; idxphi21++) + { + phi21 = (-pi/2)+(idxphi21*pi)/number_of_intervals; + + for (int idxphi22 = 0; idxphi22 <= number_of_intervals; idxphi22++) + { + phi22 = (-pi/2)+(idxphi22*pi)/number_of_intervals; + + for (int idxphi11 = 0; idxphi11 <= number_of_intervals; idxphi11++) + { + phi11 = (-pi/2)+(idxphi11*pi)/number_of_intervals; + + for (int idxphi12 = 0; idxphi12 <= number_of_intervals; idxphi12++) + { + phi12 = (-pi/2)+(idxphi12*pi)/number_of_intervals; + + for (int idxtheta1 = 0; idxtheta1 <= number_of_intervals; idxtheta1++) + { + theta1 = -pi+(idxtheta1*(2*pi))/number_of_intervals; + + for (int idxtheta2 = 0; idxtheta2 <= number_of_intervals; idxtheta2++) + { + theta2 = -pi+(idxtheta2*(2*pi))/number_of_intervals; + + ::std::cout << "theta1 = " << theta1 << " ; "; + ::std::cout << "phi11 = " << phi11 << " ; "; + ::std::cout << "phi21 = " << phi21; + ::std::cout << "theta2 = " << theta2 << " ; "; + ::std::cout << "phi12 = " << phi12 << " ; "; + ::std::cout << "phi22 = " << phi22; + ::std::cout << ::std::endl; + + ::boost::math::quaternion p1 = ::boost::math::spherical(rho1, theta1, phi11, phi21); + + ::std::cout << "p1 = " << p1 << ::std::endl; + + ::boost::math::quaternion q1 = ::boost::math::spherical(rho2, theta2, phi12, phi22); + + ::std::cout << "q1 = " << q1 << ::std::endl; + + ::std::pair< ::boost::math::quaternion , ::boost::math::quaternion > pq1 = + ::std::make_pair(p1,q1); + + R4_matrix rot = quaternions_to_R4_rotation(pq1); + + ::std::cout << "rot = "; + ::std::cout << "\t" << rot.a11 << "\t" << rot.a12 << "\t" << rot.a13 << "\t" << rot.a14 << ::std::endl; + ::std::cout << "\t"; + ::std::cout << "\t" << rot.a21 << "\t" << rot.a22 << "\t" << rot.a23 << "\t" << rot.a24 << ::std::endl; + ::std::cout << "\t"; + ::std::cout << "\t" << rot.a31 << "\t" << rot.a32 << "\t" << rot.a33 << "\t" << rot.a34 << ::std::endl; + ::std::cout << "\t"; + ::std::cout << "\t" << rot.a41 << "\t" << rot.a42 << "\t" << rot.a43 << "\t" << rot.a44 << ::std::endl; + + ::std::pair< ::boost::math::quaternion , ::boost::math::quaternion > pq2 = + R4_rotation_to_quaternions(rot, &pq1); + + ::std::cout << "p1 = " << pq2.first << ::std::endl; + ::std::cout << "p2 = " << pq2.second << ::std::endl; + + ::std::cout << "round trip discrepancy: " << ::std::sqrt(::boost::math::norm(pq1.first-pq2.first)+::boost::math::norm(pq1.second-pq2.second)) << ::std::endl; + + ::std::cout << ::std::endl; + } + } + } + } + } + } + + ::std::cout << ::std::endl; +} + + +void test_SO4() +{ + ::std::cout << "Testing SO4:" << ::std::endl; + ::std::cout << ::std::endl; + + test_SO4_spherical(); +} + + diff --git a/src/boost/libs/math/example/HSO4.hpp b/src/boost/libs/math/example/HSO4.hpp new file mode 100644 index 00000000..37b7e59b --- /dev/null +++ b/src/boost/libs/math/example/HSO4.hpp @@ -0,0 +1,183 @@ + +/********************************************************************************************/ +/* */ +/* HSO4.hpp header file */ +/* */ +/* This file is not currently part of the Boost library. It is simply an example of the use */ +/* quaternions can be put to. Hopefully it will be usefull too. */ +/* */ +/* This file provides tools to convert between quaternions and R^4 rotation matrices. */ +/* */ +/********************************************************************************************/ + +// (C) Copyright Hubert Holin 2001. +// Distributed under 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) + +#ifndef TEST_HSO4_HPP +#define TEST_HSO4_HPP + +#include + +#include "HSO3.hpp" + + +template +struct R4_matrix +{ + TYPE_FLOAT a11, a12, a13, a14; + TYPE_FLOAT a21, a22, a23, a24; + TYPE_FLOAT a31, a32, a33, a34; + TYPE_FLOAT a41, a42, a43, a44; +}; + + +// Note: the input quaternions need not be of norm 1 for the following function + +template +R4_matrix quaternions_to_R4_rotation(::std::pair< ::boost::math::quaternion , ::boost::math::quaternion > const & pq) +{ + using ::std::numeric_limits; + + TYPE_FLOAT a0 = pq.first.R_component_1(); + TYPE_FLOAT b0 = pq.first.R_component_2(); + TYPE_FLOAT c0 = pq.first.R_component_3(); + TYPE_FLOAT d0 = pq.first.R_component_4(); + + TYPE_FLOAT norme_carre0 = a0*a0+b0*b0+c0*c0+d0*d0; + + if (norme_carre0 <= numeric_limits::epsilon()) + { + ::std::string error_reporting("Argument to quaternions_to_R4_rotation is too small!"); + ::std::underflow_error bad_argument(error_reporting); + + throw(bad_argument); + } + + TYPE_FLOAT a1 = pq.second.R_component_1(); + TYPE_FLOAT b1 = pq.second.R_component_2(); + TYPE_FLOAT c1 = pq.second.R_component_3(); + TYPE_FLOAT d1 = pq.second.R_component_4(); + + TYPE_FLOAT norme_carre1 = a1*a1+b1*b1+c1*c1+d1*d1; + + if (norme_carre1 <= numeric_limits::epsilon()) + { + ::std::string error_reporting("Argument to quaternions_to_R4_rotation is too small!"); + ::std::underflow_error bad_argument(error_reporting); + + throw(bad_argument); + } + + TYPE_FLOAT prod_norm = norme_carre0*norme_carre1; + + TYPE_FLOAT a0a1 = a0*a1; + TYPE_FLOAT a0b1 = a0*b1; + TYPE_FLOAT a0c1 = a0*c1; + TYPE_FLOAT a0d1 = a0*d1; + TYPE_FLOAT b0a1 = b0*a1; + TYPE_FLOAT b0b1 = b0*b1; + TYPE_FLOAT b0c1 = b0*c1; + TYPE_FLOAT b0d1 = b0*d1; + TYPE_FLOAT c0a1 = c0*a1; + TYPE_FLOAT c0b1 = c0*b1; + TYPE_FLOAT c0c1 = c0*c1; + TYPE_FLOAT c0d1 = c0*d1; + TYPE_FLOAT d0a1 = d0*a1; + TYPE_FLOAT d0b1 = d0*b1; + TYPE_FLOAT d0c1 = d0*c1; + TYPE_FLOAT d0d1 = d0*d1; + + R4_matrix out_matrix; + + out_matrix.a11 = (+a0a1+b0b1+c0c1+d0d1)/prod_norm; + out_matrix.a12 = (+a0b1-b0a1-c0d1+d0c1)/prod_norm; + out_matrix.a13 = (+a0c1+b0d1-c0a1-d0b1)/prod_norm; + out_matrix.a14 = (+a0d1-b0c1+c0b1-d0a1)/prod_norm; + out_matrix.a21 = (-a0b1+b0a1-c0d1+d0c1)/prod_norm; + out_matrix.a22 = (+a0a1+b0b1-c0c1-d0d1)/prod_norm; + out_matrix.a23 = (-a0d1+b0c1+c0b1-d0a1)/prod_norm; + out_matrix.a24 = (+a0c1+b0d1+c0a1+d0b1)/prod_norm; + out_matrix.a31 = (-a0c1+b0d1+c0a1-d0b1)/prod_norm; + out_matrix.a32 = (+a0d1+b0c1+c0b1+d0a1)/prod_norm; + out_matrix.a33 = (+a0a1-b0b1+c0c1-d0d1)/prod_norm; + out_matrix.a34 = (-a0b1-b0a1+c0d1+d0c1)/prod_norm; + out_matrix.a41 = (-a0d1-b0c1+c0b1+d0a1)/prod_norm; + out_matrix.a42 = (-a0c1+b0d1-c0a1+d0b1)/prod_norm; + out_matrix.a43 = (+a0b1+b0a1+c0d1+d0c1)/prod_norm; + out_matrix.a44 = (+a0a1-b0b1-c0c1+d0d1)/prod_norm; + + return(out_matrix); +} + + +template +inline bool is_R4_rotation_matrix(R4_matrix const & mat) +{ + using ::std::abs; + + using ::std::numeric_limits; + + return ( + !( + (abs(mat.a11*mat.a11+mat.a21*mat.a21+mat.a31*mat.a31+mat.a41*mat.a41 - static_cast(1)) > static_cast(10)*numeric_limits::epsilon())|| + (abs(mat.a11*mat.a12+mat.a21*mat.a22+mat.a31*mat.a32+mat.a41*mat.a42 - static_cast(0)) > static_cast(10)*numeric_limits::epsilon())|| + (abs(mat.a11*mat.a13+mat.a21*mat.a23+mat.a31*mat.a33+mat.a41*mat.a43 - static_cast(0)) > static_cast(10)*numeric_limits::epsilon())|| + (abs(mat.a11*mat.a14+mat.a21*mat.a24+mat.a31*mat.a34+mat.a41*mat.a44 - static_cast(0)) > static_cast(10)*numeric_limits::epsilon())|| + //(abs(mat.a11*mat.a12+mat.a21*mat.a22+mat.a31*mat.a32+mat.a41*mat.a42 - static_cast(0)) > static_cast(10)*numeric_limits::epsilon())|| + (abs(mat.a12*mat.a12+mat.a22*mat.a22+mat.a32*mat.a32+mat.a42*mat.a42 - static_cast(1)) > static_cast(10)*numeric_limits::epsilon())|| + (abs(mat.a12*mat.a13+mat.a22*mat.a23+mat.a32*mat.a33+mat.a42*mat.a43 - static_cast(0)) > static_cast(10)*numeric_limits::epsilon())|| + (abs(mat.a12*mat.a14+mat.a22*mat.a24+mat.a32*mat.a34+mat.a42*mat.a44 - static_cast(0)) > static_cast(10)*numeric_limits::epsilon())|| + //(abs(mat.a11*mat.a13+mat.a21*mat.a23+mat.a31*mat.a33+mat.a41*mat.a43 - static_cast(0)) > static_cast(10)*numeric_limits::epsilon())|| + //(abs(mat.a12*mat.a13+mat.a22*mat.a23+mat.a32*mat.a33+mat.a42*mat.a43 - static_cast(0)) > static_cast(10)*numeric_limits::epsilon())|| + (abs(mat.a13*mat.a13+mat.a23*mat.a23+mat.a33*mat.a33+mat.a43*mat.a43 - static_cast(1)) > static_cast(10)*numeric_limits::epsilon())|| + (abs(mat.a13*mat.a14+mat.a23*mat.a24+mat.a33*mat.a34+mat.a43*mat.a44 - static_cast(0)) > static_cast(10)*numeric_limits::epsilon())|| + //(abs(mat.a11*mat.a14+mat.a21*mat.a24+mat.a31*mat.a34+mat.a41*mat.a44 - static_cast(0)) > static_cast(10)*numeric_limits::epsilon())|| + //(abs(mat.a12*mat.a14+mat.a22*mat.a24+mat.a32*mat.a34+mat.a42*mat.a44 - static_cast(0)) > static_cast(10)*numeric_limits::epsilon())|| + //(abs(mat.a13*mat.a14+mat.a23*mat.a24+mat.a33*mat.a34+mat.a43*mat.a44 - static_cast(0)) > static_cast(10)*numeric_limits::epsilon())|| + (abs(mat.a14*mat.a14+mat.a24*mat.a24+mat.a34*mat.a34+mat.a44*mat.a44 - static_cast(1)) > static_cast(10)*numeric_limits::epsilon()) + ) + ); +} + + +template +::std::pair< ::boost::math::quaternion , ::boost::math::quaternion > R4_rotation_to_quaternions( R4_matrix const & rot, + ::std::pair< ::boost::math::quaternion , ::boost::math::quaternion > const * hint = 0) +{ + if (!is_R4_rotation_matrix(rot)) + { + ::std::string error_reporting("Argument to R4_rotation_to_quaternions is not an R^4 rotation matrix!"); + ::std::range_error bad_argument(error_reporting); + + throw(bad_argument); + } + + R3_matrix mat; + + mat.a11 = -rot.a31*rot.a42+rot.a32*rot.a41+rot.a22*rot.a11-rot.a21*rot.a12; + mat.a12 = -rot.a31*rot.a43+rot.a33*rot.a41+rot.a23*rot.a11-rot.a21*rot.a13; + mat.a13 = -rot.a31*rot.a44+rot.a34*rot.a41+rot.a24*rot.a11-rot.a21*rot.a14; + mat.a21 = -rot.a31*rot.a12-rot.a22*rot.a41+rot.a32*rot.a11+rot.a21*rot.a42; + mat.a22 = -rot.a31*rot.a13-rot.a23*rot.a41+rot.a33*rot.a11+rot.a21*rot.a43; + mat.a23 = -rot.a31*rot.a14-rot.a24*rot.a41+rot.a34*rot.a11+rot.a21*rot.a44; + mat.a31 = +rot.a31*rot.a22-rot.a12*rot.a41+rot.a42*rot.a11-rot.a21*rot.a32; + mat.a32 = +rot.a31*rot.a23-rot.a13*rot.a41+rot.a43*rot.a11-rot.a21*rot.a33; + mat.a33 = +rot.a31*rot.a24-rot.a14*rot.a41+rot.a44*rot.a11-rot.a21*rot.a34; + + ::boost::math::quaternion q = R3_rotation_to_quaternion(mat); + + ::boost::math::quaternion p = + ::boost::math::quaternion(rot.a11,rot.a12,rot.a13,rot.a14)*q; + + if ((hint != 0) && (abs(hint->second+q) < abs(hint->second-q))) + { + return(::std::make_pair(-p,-q)); + } + + return(::std::make_pair(p,q)); +} + +#endif /* TEST_HSO4_HPP */ + diff --git a/src/boost/libs/math/example/Jamfile.v2 b/src/boost/libs/math/example/Jamfile.v2 new file mode 100644 index 00000000..fd40f398 --- /dev/null +++ b/src/boost/libs/math/example/Jamfile.v2 @@ -0,0 +1,159 @@ +# \libs\math\example\jamfile.v2 +# Runs statistics and floating-point examples. +# Copyright 2007 John Maddock +# Copyright Paul A. Bristow 2007, 2010, 2011. +# Distributed under 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) + +# bring in the rules for testing +import testing ; +import ../../config/checks/config : requires ; + +project + : requirements + gcc:-Wno-missing-braces + darwin:-Wno-missing-braces + acc:+W2068,2461,2236,4070 + intel:-Qwd264,239 + msvc:all + msvc:on + msvc:_CRT_SECURE_NO_DEPRECATE + msvc:_SCL_SECURE_NO_DEPRECATE + msvc:_SCL_SECURE_NO_WARNINGS + msvc:_CRT_SECURE_NO_WARNINGS + msvc:/wd4996 + msvc:/wd4512 + msvc:/wd4610 + msvc:/wd4510 + msvc:/wd4127 + msvc:/wd4701 + msvc:/wd4127 + msvc:/wd4305 + msvc:/wd4459 + msvc:/wd4456 # declaration of hides previous local declaration. + #-msvc:/Za # nonfinite Serialization examples fail link if disable MS extensions, + # because serialization library is built with MS extensions enabled (default). + clang:-Wno-unknown-pragmas + clang:-Wno-language-extension-token + + ../../.. + ../include_private + off:../test//no_eh + ; + +test-suite examples : + [ run bessel_zeros_example_1.cpp : : : off:no ] + [ run bessel_zeros_interator_example.cpp : : : off:no ] + [ run neumann_zeros_example_1.cpp : : : off:no ] + + [ run test_cpp_float_close_fraction.cpp ../../test/build//boost_unit_test_framework/static : : : off:no ] + [ run binomial_coinflip_example.cpp : : : off:no ] + [ run binomial_confidence_limits.cpp ] + [ run binomial_example_nag.cpp ] + [ run binomial_quiz_example.cpp : : : off:no ] + [ run binomial_sample_sizes.cpp ] + [ run brent_minimise_example.cpp : : : [ requires cxx11_hdr_tuple ] ] + + [ run c_error_policy_example.cpp ] + [ run chi_square_std_dev_test.cpp : : : off:no ] + [ run distribution_construction.cpp : : : off:no ] + [ run error_handling_example.cpp : : : off:no ] + [ run error_policies_example.cpp ] + [ run error_policy_example.cpp : : : off:no ] + [ run f_test.cpp ] + # [ run fft_sines_table.cpp : : : [ requires cxx11_numeric_limits ] ] + # No need to re-run this routinely as it only creates a table of sines for a documentation example. + + [ run find_location_example.cpp : : : off:no ] + [ run find_mean_and_sd_normal.cpp : : : off:no ] + [ run find_root_example.cpp : : : off:no ] + [ run find_scale_example.cpp : : : off:no ] + [ run geometric_examples.cpp : : : off:no ] + [ run hyperexponential_snips.cpp ] + [ run hyperexponential_more_snips.cpp ] + [ run inverse_chi_squared_example.cpp ] + [ run legendre_stieltjes_example.cpp : : : [ requires cxx11_auto_declarations cxx11_defaulted_functions cxx11_lambdas ] ] + #[ # run inverse_chi_squared_find_df_example.cpp ] + #[ run lambert_w_basic_example.cpp ] + [ run lambert_w_basic_example.cpp : : : [ requires cxx11_numeric_limits ] ] + [ run lambert_w_simple_examples.cpp : : : [ requires cxx11_numeric_limits ] ] + [ run lambert_w_precision_example.cpp : : : [ check-target-builds ../config//has_float128 "GCC libquadmath and __float128 support" : -lquadmath ] [ requires cxx11_numeric_limits cxx11_explicit_conversion_operators ] ] + + [ run inverse_gamma_example.cpp ] + [ run inverse_gamma_distribution_example.cpp : : : off:no ] + [ run laplace_example.cpp : : : off:no ] + [ run nc_chi_sq_example.cpp ] + [ run neg_binom_confidence_limits.cpp ] + [ run neg_binomial_sample_sizes.cpp ] + [ run negative_binomial_example1.cpp : : : off:no ] + [ run negative_binomial_example2.cpp ] + + [ run nonfinite_num_facet.cpp ] + [ run nonfinite_facet_simple.cpp ] + [ run nonfinite_num_facet_serialization.cpp ../../serialization/build//boost_serialization : : : off:no gcc-mingw:static ] + #[ # run lexical_cast_native.cpp ] # Expected to fail on some (but not all) platforms. + [ run lexical_cast_nonfinite_facets.cpp ] + [ run nonfinite_loopback_ok.cpp ] + [ run nonfinite_serialization_archives.cpp ../../serialization/build//boost_serialization : : : off:no gcc-mingw:static ] + [ run nonfinite_facet_sstream.cpp ] + + [ run constants_eg1.cpp ] + + [ run normal_misc_examples.cpp : : : off:no ] + [ run owens_t_example.cpp ] + [ run policy_eg_1.cpp ] + [ run policy_eg_10.cpp : : : vxworks:no ] # VxWorks' complex.h has conflicting declaration of real + [ run policy_eg_2.cpp ] + [ run policy_eg_3.cpp ] + [ run policy_eg_4.cpp ] + [ run policy_eg_5.cpp ] + [ run policy_eg_6.cpp ] + [ run policy_eg_7.cpp ] + [ run policy_eg_8.cpp ] + [ run policy_eg_9.cpp ] + [ run policy_ref_snip1.cpp : : : off:no ] + [ run policy_ref_snip10.cpp ] + [ run policy_ref_snip11.cpp ] + [ run policy_ref_snip12.cpp ] + [ run policy_ref_snip13.cpp : : : off:no ] # Fails clang-win - thrown exception from no Cauchy mean. + [ run policy_ref_snip2.cpp ] + [ run policy_ref_snip3.cpp : : : off:no ] + [ run policy_ref_snip4.cpp ] + [ run policy_ref_snip5.cpp : : : vxworks:no ] + [ run policy_ref_snip6.cpp ] + [ run policy_ref_snip7.cpp ] + [ run policy_ref_snip8.cpp ] + [ run policy_ref_snip9.cpp ] + [ run skew_normal_example.cpp ] + [ run students_t_example1.cpp ] + [ run students_t_example2.cpp ] + [ run students_t_example3.cpp ] + [ run students_t_single_sample.cpp ] + [ run students_t_two_samples.cpp ] + [ run HSO3SO4.cpp ] + [ run series.cpp ] + [ run continued_fractions.cpp ] + + [ run barycentric_interpolation_example.cpp : : : [ requires cxx11_smart_ptr cxx11_function_template_default_args cxx11_unified_initialization_syntax cxx11_defaulted_functions cxx11_allocator cxx11_auto_declarations cxx11_lambdas ] ] + [ run barycentric_interpolation_example_2.cpp : : : [ requires cxx11_smart_ptr cxx11_function_template_default_args cxx11_unified_initialization_syntax cxx11_defaulted_functions cxx11_allocator cxx11_auto_declarations cxx11_lambdas ] ] + [ run cardinal_cubic_b_spline_example.cpp : : : [ requires cxx11_smart_ptr cxx11_hdr_random cxx11_defaulted_functions ] ] + [ compile naive_monte_carlo_example.cpp : [ requires cxx11_auto_declarations cxx11_lambdas cxx11_unified_initialization_syntax cxx11_hdr_thread cxx11_hdr_atomic cxx11_decltype cxx11_hdr_future cxx11_hdr_chrono cxx11_hdr_random cxx11_allocator ] ] # requires user input, can't run it, take a long time too! + [ run catmull_rom_example.cpp : : : [ requires cxx17_if_constexpr cxx11_auto_declarations cxx17_std_apply ] ] # Actually the C++17 features used is std::size, not if constexpr; looks like there isn't yet a test for it. + [ run autodiff_black_scholes_brief.cpp : : : [ requires cxx11_inline_namespaces ] ] + [ run autodiff_black_scholes.cpp : : : [ requires cxx11_inline_namespaces ] ] + [ run autodiff_fourth_power.cpp : : : [ requires cxx11_inline_namespaces ] ] + [ run autodiff_mixed_partials.cpp : : : [ requires cxx11_inline_namespaces ] ] + [ run autodiff_multiprecision.cpp : : : [ requires cxx11_inline_namespaces ] ] + [ run ooura_fourier_integrals_example.cpp : : : [ requires cxx11_hdr_mutex cxx11_lambdas cxx11_inline_namespaces cxx11_auto_declarations ] ] + [ run ooura_fourier_integrals_cosine_example.cpp : : : [ requires cxx11_hdr_mutex cxx11_inline_namespaces cxx11_auto_declarations cxx17_std_apply ] ] + [ run ooura_fourier_integrals_multiprecision_example.cpp : : : [ check-target-builds ../config//has_float128 "GCC libquadmath and __float128 support" : -lquadmath ] [ requires cxx11_hdr_mutex cxx11_inline_namespaces cxx11_auto_declarations cxx17_std_apply ] ] + +; + +run root_elliptic_finding.cpp /boost/timer : : : release static [ requires cxx11_unified_initialization_syntax cxx11_defaulted_functions ] freebsd:"-lrt" linux:"-lrt -lpthread" ; +run root_finding_algorithms.cpp /boost/timer : : : release static [ requires cxx11_hdr_tuple cxx11_unified_initialization_syntax ] freebsd:"-lrt" linux:"-lrt -lpthread" ; +run root_n_finding_algorithms.cpp /boost/timer : : : release static [ requires cxx11_unified_initialization_syntax cxx11_defaulted_functions ] freebsd:"-lrt" linux:"-lrt -lpthread" ; + +explicit root_elliptic_finding ; +explicit root_finding_algorithms ; +explicit root_n_finding_algorithms ; diff --git a/src/boost/libs/math/example/airy_zeros_example.cpp b/src/boost/libs/math/example/airy_zeros_example.cpp new file mode 100644 index 00000000..3ab2c77d --- /dev/null +++ b/src/boost/libs/math/example/airy_zeros_example.cpp @@ -0,0 +1,165 @@ + +// Copyright Christopher Kormanyos 2013. +// Copyright Paul A. Bristow 2013. +// Copyright John Maddock 2013. + +// Distributed under 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). + +#ifdef _MSC_VER +# pragma warning (disable : 4512) // assignment operator could not be generated. +# pragma warning (disable : 4996) // assignment operator could not be generated. +#endif + +#include +#include +#include +#include +#include +#include + +// Weisstein, Eric W. "Bessel Function Zeros." From MathWorld--A Wolfram Web Resource. +// http://mathworld.wolfram.com/BesselFunctionZeros.html +// Test values can be calculated using [@wolframalpha.com WolframAplha] +// See also http://dlmf.nist.gov/10.21 + +//[airy_zeros_example_1 + +/*`This example demonstrates calculating zeros of the Airy functions. +It also shows how Boost.Math and Boost.Multiprecision can be combined to provide +a many decimal digit precision. For 50 decimal digit precision we need to include +*/ + + #include + +/*`and a `typedef` for `float_type` may be convenient +(allowing a quick switch to re-compute at built-in `double` or other precision) +*/ + typedef boost::multiprecision::cpp_dec_float_50 float_type; + +//`To use the functions for finding zeros of the functions we need + + #include + +/*`This example shows obtaining both a single zero of the Airy functions, +and then placing multiple zeros into a container like `std::vector` by providing an iterator. +The signature of the single-value Airy Ai function is: + + template + T airy_ai_zero(unsigned m); // 1-based index of the zero. + +The signature of multiple zeros Airy Ai function is: + + template + OutputIterator airy_ai_zero( + unsigned start_index, // 1-based index of the zero. + unsigned number_of_zeros, // How many zeros to generate. + OutputIterator out_it); // Destination for zeros. + +There are also versions which allows control of the __policy_section for error handling and precision. + + template + OutputIterator airy_ai_zero( + unsigned start_index, // 1-based index of the zero. + unsigned number_of_zeros, // How many zeros to generate. + OutputIterator out_it, // Destination for zeros. + const Policy& pol); // Policy to use. +*/ +//] [/airy_zeros_example_1] + +int main() +{ + try + { +//[airy_zeros_example_2 + +/*`[tip It is always wise to place code using Boost.Math inside `try'n'catch` blocks; +this will ensure that helpful error messages are shown when exceptional conditions arise.] + +First, evaluate a single Airy zero. + +The precision is controlled by the template parameter `T`, +so this example has `double` precision, at least 15 but up to 17 decimal digits +(for the common 64-bit double). +*/ + double aiz1 = boost::math::airy_ai_zero(1); + std::cout << "boost::math::airy_ai_zero(1) = " << aiz1 << std::endl; + double aiz2 = boost::math::airy_ai_zero(2); + std::cout << "boost::math::airy_ai_zero(2) = " << aiz2 << std::endl; + double biz3 = boost::math::airy_bi_zero(3); + std::cout << "boost::math::airy_bi_zero(3) = " << biz3 << std::endl; + +/*`Other versions of `airy_ai_zero` and `airy_bi_zero` +allow calculation of multiple zeros with one call, +placing the results in a container, often `std::vector`. +For example, generate and display the first five `double` roots +[@http://mathworld.wolfram.com/AiryFunctionZeros.html Wolfram Airy Functions Zeros]. +*/ + unsigned int n_roots = 5U; + std::vector roots; + boost::math::airy_ai_zero(1U, n_roots, std::back_inserter(roots)); + std::cout << "airy_ai_zeros:" << std::endl; + std::copy(roots.begin(), + roots.end(), + std::ostream_iterator(std::cout, "\n")); + +/*`The first few real roots of Ai(x) are approximately -2.33811, -4.08795, -5.52056, -6.7867144, -7.94413, -9.02265 ... + +Or we can use Boost.Multiprecision to generate 50 decimal digit roots. + +We set the precision of the output stream, and show trailing zeros to display a fixed 50 decimal digits. +*/ + std::cout.precision(std::numeric_limits::digits10); // float_type has 50 decimal digits. + std::cout << std::showpoint << std::endl; // Show trailing zeros too. + + unsigned int m = 1U; + float_type r = boost::math::airy_ai_zero(1U); // 1st root. + std::cout << "boost::math::airy_bi_zero(" << m << ") = " << r << std::endl; + m = 2; + r = boost::math::airy_ai_zero(2U); // 2nd root. + std::cout << "boost::math::airy_bi_zero(" << m << ") = " << r << std::endl; + m = 7U; + r = boost::math::airy_bi_zero(7U); // 7th root. + std::cout << "boost::math::airy_bi_zero(" << m << ") = " << r << std::endl; + + std::vector zeros; + boost::math::airy_ai_zero(1U, 3, std::back_inserter(zeros)); + std::cout << "airy_ai_zeros:" << std::endl; + // Print the roots to the output stream. + std::copy(zeros.begin(), zeros.end(), + std::ostream_iterator(std::cout, "\n")); +//] [/airy_zeros_example_2] + } + catch (std::exception ex) + { + std::cout << "Thrown exception " << ex.what() << std::endl; + } + + } // int main() + +/* + + Output: + + Description: Autorun "J:\Cpp\big_number\Debug\airy_zeros_example.exe" + boost::math::airy_ai_zero(1) = -2.33811 + boost::math::airy_ai_zero(2) = -4.08795 + boost::math::airy_bi_zero(3) = -4.83074 + airy_ai_zeros: + -2.33811 + -4.08795 + -5.52056 + -6.78671 + -7.94413 + + boost::math::airy_bi_zero(1) = -2.3381074104597670384891972524467354406385401456711 + boost::math::airy_bi_zero(2) = -4.0879494441309706166369887014573910602247646991085 + boost::math::airy_bi_zero(7) = -9.5381943793462388866329885451560196208390720763825 + airy_ai_zeros: + -2.3381074104597670384891972524467354406385401456711 + -4.0879494441309706166369887014573910602247646991085 + -5.5205598280955510591298555129312935737972142806175 + +*/ + diff --git a/src/boost/libs/math/example/arcsine_example.cpp b/src/boost/libs/math/example/arcsine_example.cpp new file mode 100644 index 00000000..a0070526 --- /dev/null +++ b/src/boost/libs/math/example/arcsine_example.cpp @@ -0,0 +1,89 @@ +// arcsine_example.cpp + +// Copyright John Maddock 2014. +// Copyright Paul A. Bristow 2014. + +// 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) + +// Example for the arcsine Distribution. + +// Note: Contains Quickbook snippets in comments. + +//[arcsine_snip_1 +#include // For arcsine_distribution. +//] [/arcsine_snip_1] + +#include +#include +#include + +int main() +{ + std::cout << "Examples of Arcsine distribution." << std::endl; + std::cout.precision(3); // Avoid uninformative decimal digits. + + using boost::math::arcsine; + + arcsine as; // Construct a default `double` standard [0, 1] arcsine distribution. + +//[arcsine_snip_2 + std::cout << pdf(as, 1. / 2) << std::endl; // 0.637 + // pdf has a minimum at x = 0.5 +//] [/arcsine_snip_2] + +//[arcsine_snip_3 + std::cout << pdf(as, 1. / 4) << std::endl; // 0.735 +//] [/arcsine_snip_3] + + +//[arcsine_snip_4 + std::cout << cdf(as, 0.05) << std::endl; // 0.144 +//] [/arcsine_snip_4] + +//[arcsine_snip_5 + std::cout << 2 * cdf(as, 1 - 0.975) << std::endl; // 0.202 +//] [/arcsine_snip_5] + + +//[arcsine_snip_6 + std::cout << 2 * cdf(complement(as, 0.975)) << std::endl; // 0.202 +//] [/arcsine_snip_6] + +//[arcsine_snip_7 + std::cout << quantile(as, 1 - 0.2 / 2) << std::endl; // 0.976 + + std::cout << quantile(complement(as, 0.2 / 2)) << std::endl; // 0.976 +//] [/arcsine_snip_7] + +{ +//[arcsine_snip_8 + using boost::math::arcsine_distribution; + + arcsine_distribution<> as(2, 5); // Cconstructs a double arcsine distribution. + BOOST_ASSERT(as.x_min() == 2.); // as.x_min() returns 2. + BOOST_ASSERT(as.x_max() == 5.); // as.x_max() returns 5. +//] [/arcsine_snip_8] +} + return 0; + +} // int main() + +/* +[arcsine_output + +Example of Arcsine distribution +0.637 +0.735 +0.144 +0.202 +0.202 +0.976 +0.976 + +] [/arcsine_output] +*/ + + diff --git a/src/boost/libs/math/example/autodiff_black_scholes.cpp b/src/boost/libs/math/example/autodiff_black_scholes.cpp new file mode 100644 index 00000000..b7fcd9c0 --- /dev/null +++ b/src/boost/libs/math/example/autodiff_black_scholes.cpp @@ -0,0 +1,195 @@ +// Copyright Matthew Pulver 2018 - 2019. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +#include +#include +#include + +using namespace boost::math::constants; +using namespace boost::math::differentiation; + +// Equations and function/variable names are from +// https://en.wikipedia.org/wiki/Greeks_(finance)#Formulas_for_European_option_Greeks + +// Standard normal probability density function +template +X phi(X const& x) { + return one_div_root_two_pi() * exp(-0.5 * x * x); +} + +// Standard normal cumulative distribution function +template +X Phi(X const& x) { + return 0.5 * erfc(-one_div_root_two() * x); +} + +enum class CP { call, put }; + +// Assume zero annual dividend yield (q=0). +template +promote black_scholes_option_price(CP cp, + double K, + Price const& S, + Sigma const& sigma, + Tau const& tau, + Rate const& r) { + using namespace std; + auto const d1 = (log(S / K) + (r + sigma * sigma / 2) * tau) / (sigma * sqrt(tau)); + auto const d2 = (log(S / K) + (r - sigma * sigma / 2) * tau) / (sigma * sqrt(tau)); + switch (cp) { + case CP::call: + return S * Phi(d1) - exp(-r * tau) * K * Phi(d2); + case CP::put: + return exp(-r * tau) * K * Phi(-d2) - S * Phi(-d1); + default: + throw std::runtime_error("Invalid CP value."); + } +} + +int main() { + double const K = 100.0; // Strike price. + auto const variables = make_ftuple(105, 5, 30.0 / 365, 1.25 / 100); + auto const& S = std::get<0>(variables); // Stock price. + auto const& sigma = std::get<1>(variables); // Volatility. + auto const& tau = std::get<2>(variables); // Time to expiration in years. (30 days). + auto const& r = std::get<3>(variables); // Interest rate. + auto const call_price = black_scholes_option_price(CP::call, K, S, sigma, tau, r); + auto const put_price = black_scholes_option_price(CP::put, K, S, sigma, tau, r); + + double const d1 = static_cast((log(S / K) + (r + sigma * sigma / 2) * tau) / (sigma * sqrt(tau))); + double const d2 = static_cast((log(S / K) + (r - sigma * sigma / 2) * tau) / (sigma * sqrt(tau))); + double const formula_call_delta = +Phi(+d1); + double const formula_put_delta = -Phi(-d1); + double const formula_vega = static_cast(S * phi(d1) * sqrt(tau)); + double const formula_call_theta = + static_cast(-S * phi(d1) * sigma / (2 * sqrt(tau)) - r * K * exp(-r * tau) * Phi(+d2)); + double const formula_put_theta = + static_cast(-S * phi(d1) * sigma / (2 * sqrt(tau)) + r * K * exp(-r * tau) * Phi(-d2)); + double const formula_call_rho = static_cast(+K * tau * exp(-r * tau) * Phi(+d2)); + double const formula_put_rho = static_cast(-K * tau * exp(-r * tau) * Phi(-d2)); + double const formula_gamma = static_cast(phi(d1) / (S * sigma * sqrt(tau))); + double const formula_vanna = static_cast(-phi(d1) * d2 / sigma); + double const formula_charm = + static_cast(phi(d1) * (d2 * sigma * sqrt(tau) - 2 * r * tau) / (2 * tau * sigma * sqrt(tau))); + double const formula_vomma = static_cast(S * phi(d1) * sqrt(tau) * d1 * d2 / sigma); + double const formula_veta = static_cast(-S * phi(d1) * sqrt(tau) * + (r * d1 / (sigma * sqrt(tau)) - (1 + d1 * d2) / (2 * tau))); + double const formula_speed = + static_cast(-phi(d1) * (d1 / (sigma * sqrt(tau)) + 1) / (S * S * sigma * sqrt(tau))); + double const formula_zomma = static_cast(phi(d1) * (d1 * d2 - 1) / (S * sigma * sigma * sqrt(tau))); + double const formula_color = + static_cast(-phi(d1) / (2 * S * tau * sigma * sqrt(tau)) * + (1 + (2 * r * tau - d2 * sigma * sqrt(tau)) * d1 / (sigma * sqrt(tau)))); + double const formula_ultima = + -formula_vega * static_cast((d1 * d2 * (1 - d1 * d2) + d1 * d1 + d2 * d2) / (sigma * sigma)); + + std::cout << std::setprecision(std::numeric_limits::digits10) + << "autodiff black-scholes call price = " << call_price.derivative(0, 0, 0, 0) << '\n' + << "autodiff black-scholes put price = " << put_price.derivative(0, 0, 0, 0) << '\n' + << "\n## First-order Greeks\n" + << "autodiff call delta = " << call_price.derivative(1, 0, 0, 0) << '\n' + << " formula call delta = " << formula_call_delta << '\n' + << "autodiff call vega = " << call_price.derivative(0, 1, 0, 0) << '\n' + << " formula call vega = " << formula_vega << '\n' + << "autodiff call theta = " << -call_price.derivative(0, 0, 1, 0) + << '\n' // minus sign due to tau = T-time + << " formula call theta = " << formula_call_theta << '\n' + << "autodiff call rho = " << call_price.derivative(0, 0, 0, 1) << '\n' + << " formula call rho = " << formula_call_rho << '\n' + << '\n' + << "autodiff put delta = " << put_price.derivative(1, 0, 0, 0) << '\n' + << " formula put delta = " << formula_put_delta << '\n' + << "autodiff put vega = " << put_price.derivative(0, 1, 0, 0) << '\n' + << " formula put vega = " << formula_vega << '\n' + << "autodiff put theta = " << -put_price.derivative(0, 0, 1, 0) << '\n' + << " formula put theta = " << formula_put_theta << '\n' + << "autodiff put rho = " << put_price.derivative(0, 0, 0, 1) << '\n' + << " formula put rho = " << formula_put_rho << '\n' + << "\n## Second-order Greeks\n" + << "autodiff call gamma = " << call_price.derivative(2, 0, 0, 0) << '\n' + << "autodiff put gamma = " << put_price.derivative(2, 0, 0, 0) << '\n' + << " formula gamma = " << formula_gamma << '\n' + << "autodiff call vanna = " << call_price.derivative(1, 1, 0, 0) << '\n' + << "autodiff put vanna = " << put_price.derivative(1, 1, 0, 0) << '\n' + << " formula vanna = " << formula_vanna << '\n' + << "autodiff call charm = " << -call_price.derivative(1, 0, 1, 0) << '\n' + << "autodiff put charm = " << -put_price.derivative(1, 0, 1, 0) << '\n' + << " formula charm = " << formula_charm << '\n' + << "autodiff call vomma = " << call_price.derivative(0, 2, 0, 0) << '\n' + << "autodiff put vomma = " << put_price.derivative(0, 2, 0, 0) << '\n' + << " formula vomma = " << formula_vomma << '\n' + << "autodiff call veta = " << call_price.derivative(0, 1, 1, 0) << '\n' + << "autodiff put veta = " << put_price.derivative(0, 1, 1, 0) << '\n' + << " formula veta = " << formula_veta << '\n' + << "\n## Third-order Greeks\n" + << "autodiff call speed = " << call_price.derivative(3, 0, 0, 0) << '\n' + << "autodiff put speed = " << put_price.derivative(3, 0, 0, 0) << '\n' + << " formula speed = " << formula_speed << '\n' + << "autodiff call zomma = " << call_price.derivative(2, 1, 0, 0) << '\n' + << "autodiff put zomma = " << put_price.derivative(2, 1, 0, 0) << '\n' + << " formula zomma = " << formula_zomma << '\n' + << "autodiff call color = " << call_price.derivative(2, 0, 1, 0) << '\n' + << "autodiff put color = " << put_price.derivative(2, 0, 1, 0) << '\n' + << " formula color = " << formula_color << '\n' + << "autodiff call ultima = " << call_price.derivative(0, 3, 0, 0) << '\n' + << "autodiff put ultima = " << put_price.derivative(0, 3, 0, 0) << '\n' + << " formula ultima = " << formula_ultima << '\n'; + return 0; +} +/* +Output: +autodiff black-scholes call price = 56.5136030677739 +autodiff black-scholes put price = 51.4109161009333 + +## First-order Greeks +autodiff call delta = 0.773818444921273 + formula call delta = 0.773818444921274 +autodiff call vega = 9.05493427705736 + formula call vega = 9.05493427705736 +autodiff call theta = -275.73013426444 + formula call theta = -275.73013426444 +autodiff call rho = 2.03320550539396 + formula call rho = 2.03320550539396 + +autodiff put delta = -0.226181555078726 + formula put delta = -0.226181555078726 +autodiff put vega = 9.05493427705736 + formula put vega = 9.05493427705736 +autodiff put theta = -274.481417851526 + formula put theta = -274.481417851526 +autodiff put rho = -6.17753255212599 + formula put rho = -6.17753255212599 + +## Second-order Greeks +autodiff call gamma = 0.00199851912993254 +autodiff put gamma = 0.00199851912993254 + formula gamma = 0.00199851912993254 +autodiff call vanna = 0.0410279463126531 +autodiff put vanna = 0.0410279463126531 + formula vanna = 0.0410279463126531 +autodiff call charm = -1.2505564233679 +autodiff put charm = -1.2505564233679 + formula charm = -1.2505564233679 +autodiff call vomma = -0.928114149313108 +autodiff put vomma = -0.928114149313108 + formula vomma = -0.928114149313107 +autodiff call veta = 26.7947073115641 +autodiff put veta = 26.7947073115641 + formula veta = 26.7947073115641 + +## Third-order Greeks +autodiff call speed = -2.90117322380992e-05 +autodiff put speed = -2.90117322380992e-05 + formula speed = -2.90117322380992e-05 +autodiff call zomma = -0.000604548369901419 +autodiff put zomma = -0.000604548369901419 + formula zomma = -0.000604548369901419 +autodiff call color = -0.0184014426606065 +autodiff put color = -0.0184014426606065 + formula color = -0.0184014426606065 +autodiff call ultima = -0.0922426864775683 +autodiff put ultima = -0.0922426864775683 + formula ultima = -0.0922426864775685 +**/ diff --git a/src/boost/libs/math/example/autodiff_black_scholes_brief.cpp b/src/boost/libs/math/example/autodiff_black_scholes_brief.cpp new file mode 100644 index 00000000..7078217b --- /dev/null +++ b/src/boost/libs/math/example/autodiff_black_scholes_brief.cpp @@ -0,0 +1,70 @@ +// Copyright Matthew Pulver 2018 - 2019. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +#include +#include +#include + +using namespace boost::math::constants; +using namespace boost::math::differentiation; + +// Equations and function/variable names are from +// https://en.wikipedia.org/wiki/Greeks_(finance)#Formulas_for_European_option_Greeks + +// Standard normal cumulative distribution function +template +X Phi(X const& x) { + return 0.5 * erfc(-one_div_root_two() * x); +} + +enum class CP { call, put }; + +// Assume zero annual dividend yield (q=0). +template +promote black_scholes_option_price(CP cp, + double K, + Price const& S, + Sigma const& sigma, + Tau const& tau, + Rate const& r) { + using namespace std; + auto const d1 = (log(S / K) + (r + sigma * sigma / 2) * tau) / (sigma * sqrt(tau)); + auto const d2 = (log(S / K) + (r - sigma * sigma / 2) * tau) / (sigma * sqrt(tau)); + switch (cp) { + case CP::call: + return S * Phi(d1) - exp(-r * tau) * K * Phi(d2); + case CP::put: + return exp(-r * tau) * K * Phi(-d2) - S * Phi(-d1); + default: + throw std::runtime_error("Invalid CP value."); + } +} + +int main() { + double const K = 100.0; // Strike price. + auto const S = make_fvar(105); // Stock price. + double const sigma = 5; // Volatility. + double const tau = 30.0 / 365; // Time to expiration in years. (30 days). + double const r = 1.25 / 100; // Interest rate. + auto const call_price = black_scholes_option_price(CP::call, K, S, sigma, tau, r); + auto const put_price = black_scholes_option_price(CP::put, K, S, sigma, tau, r); + + std::cout << "black-scholes call price = " << call_price.derivative(0) << '\n' + << "black-scholes put price = " << put_price.derivative(0) << '\n' + << "call delta = " << call_price.derivative(1) << '\n' + << "put delta = " << put_price.derivative(1) << '\n' + << "call gamma = " << call_price.derivative(2) << '\n' + << "put gamma = " << put_price.derivative(2) << '\n'; + return 0; +} +/* +Output: +black-scholes call price = 56.5136 +black-scholes put price = 51.4109 +call delta = 0.773818 +put delta = -0.226182 +call gamma = 0.00199852 +put gamma = 0.00199852 +**/ diff --git a/src/boost/libs/math/example/autodiff_fourth_power.cpp b/src/boost/libs/math/example/autodiff_fourth_power.cpp new file mode 100644 index 00000000..50f280b6 --- /dev/null +++ b/src/boost/libs/math/example/autodiff_fourth_power.cpp @@ -0,0 +1,34 @@ +// Copyright Matthew Pulver 2018 - 2019. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +#include +#include + +template +T fourth_power(T const& x) { + T x4 = x * x; // retval in operator*() uses x4's memory via NRVO. + x4 *= x4; // No copies of x4 are made within operator*=() even when squaring. + return x4; // x4 uses y's memory in main() via NRVO. +} + +int main() { + using namespace boost::math::differentiation; + + constexpr unsigned Order = 5; // Highest order derivative to be calculated. + auto const x = make_fvar(2.0); // Find derivatives at x=2. + auto const y = fourth_power(x); + for (unsigned i = 0; i <= Order; ++i) + std::cout << "y.derivative(" << i << ") = " << y.derivative(i) << std::endl; + return 0; +} +/* +Output: +y.derivative(0) = 16 +y.derivative(1) = 32 +y.derivative(2) = 48 +y.derivative(3) = 48 +y.derivative(4) = 24 +y.derivative(5) = 0 +**/ diff --git a/src/boost/libs/math/example/autodiff_mixed_partials.cpp b/src/boost/libs/math/example/autodiff_mixed_partials.cpp new file mode 100644 index 00000000..551429e0 --- /dev/null +++ b/src/boost/libs/math/example/autodiff_mixed_partials.cpp @@ -0,0 +1,293 @@ +// Copyright Matthew Pulver 2018 - 2019. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +#include +#include +#include +#include +#include +#include + +using namespace boost::math::differentiation; + +struct f { + template + promote operator()(W const& w, X const& x, Y const& y, Z const& z) const { + return exp(w * sin(x * log(y) / z) + sqrt(w * z / (x * y))) + w * w / tan(z); + } +}; + +// Derivatives calculated from symbolic differentiation by Mathematica for comparison. Script: +// mixed_partials.nb +static constexpr std::array answers{ + {"19878.40628980434922342465374997798674242532797789489", + "20731.74838274939517275508122761443159515217855975002", + "14667.60767623939014840117674691707821648144188283774", + "1840.559936449813118734351750381849294157477519107602", + "-9219.318005237072129605008516120710807803827373819700", + "-7272.300634012811783845589472196110804386170683300081", + "-2135.296370062283924160196772166043360841114107521292", + "3095.081027251846799545897828297310835169325417217168", + "4249.026762908615627428402369471953790564918480025345", + "2063.989061062734416582172072883742097425754355167541", + "-885.5284114876496084068555333811894392182458751895290", + "-1962.133420441743158021558423645064067562765178375508", + "-1846.899830787084518564013512948598850243350915531775", + "-160.9590127603295755195950112199107484483554942817846", + "1091.039412341633994110997652976585409621806446647794", + "452.4395574345229946707651998323417632800605985181691", + "666.4013922727704990031159406121675703174518834914461", + "-415.6464114333629107803309520898363153301435468382605", + "-625.1464179039986361267627631122900331946746137220517", + "369.9491669772617110087494756677334192842413470837587", + "-24330.89613849389343130420303653062335840497802221681", + "-18810.41605175626752065686192937776868736029049989926", + "-4890.406122702359099863022925593448420259414896197252", + "8833.005054768976417065486877649473665597894570245307", + "8484.350739681613747819854384228795938450532463850094", + "3097.204151240398893507362023543393154680147349049848", + "-3255.045136783440612110181337652522080890693968833148", + "-4342.778553332193097878812792875447018366988006584840", + "-2407.987237906523486012534085031032446996713414362131", + "861.1173916470300084261504495377425043024739914571554", + "2436.743725763308619092960749816106318692933687303014", + "-19.24649610733827783846392798978023489104363382129689", + "187.7855148870511714395275130898958731897480766620821", + "-1259.466063335212195169531010871023748854744563232277", + "-709.6860523972158261343923419671629587637051060458295", + "1423.000558608604536932163648918899935569543711292466", + "484.9208133389233959103861107714757012185008046446372", + "763.9746885074453180462508029718247316712990115789154", + "-327.4162918228055568224139277603073169658358026440432", + "-1122.337707248494521123614369562896901904418640152220", + "23973.06007192346989337502250398494874845408708506720", + "8840.543151778796869949670401421984604862699128880003", + "-9082.571033221549378277312292526023838132689941236879", + "-12270.27378289258717737657881957466807305650429436397", + "-4320.434071420599854743576892819691675331049612545664", + "3281.351967707280898543984556670710235259118405463698", + "5880.336263083418767219493592767818708317492833223933", + "-1288.482785219706549809211085113790275109642879331959", + "-803.9713537626580526627976840414468844364935388365037", + "-2986.387245331698390346145949708414455858834967096376", + "-586.7316859822658306283656047992829723003491823675739", + "3929.073189280739356198769778905960586080418779863615", + "1453.728280983826630077825553258703050898056317382483", + "1037.878071685953829685046234106860743366780050925514", + "-1482.745805277401336553926171580259185140208053329753", + "-1877.134792933828810602377451370316364621357891989679", + "-931.7138710369298207131581126980851620513905805624544", + "254.6565590420322632851077818917210811815919344882311", + "1391.248064745611663849820246430123214796614030838600", + "-431.4820563154137955051720207563800896297257103310465", + "16975.34005365179555009050533000516107937041784876054", + "19662.60356303341709846238790020024593550984564081068", + "15765.85130704020004301064240357947656083104783442825", + "3972.155036195937013764185795634749937308876197976202", + "-8681.748539789720512499473840242996096730194203989543", + "-7703.183042460387656743498394861780784700076575106134", + "-3049.708696569518774040135942468704911634779352213044", + "2971.469685992270876159892302788930292108129670398058", + "4370.196499857550025657084783894747734031876677385611", + "2524.632473357435670756946837415389227139966527203701", + "-656.6080000236679071742450437463693211275208125750923", + "-2423.452917325258132591368397957959217829861665178601", + "-2074.987664204263204162199830716851483704870169031179", + "-381.2253794988132984501358802316138392247470857452486", + "1219.507245791997351017860252538035146744682380716428", + "805.3802239840836877339667281819652171888443003165988", + "838.4004190058912380470543219448821914235443115661655", + "-390.6125197108983831575656956558201636111305409512701", + "-828.2085489298235758253219930356006757081473789845849", + "293.8999854454994790079171865082094494146506490533363", + "-22965.85985843951977785883587223006628792405076928067", + "-20026.69101529929621743747554537576887048069629325374", + "-7316.092745063355996548975300169565482331369744607021", + "8632.466133972614659252310985982644793465043032940318", + "8987.046882870452266200748127338744248816756004290490", + "4199.925399536137541108783465785304128965582292174062", + "-2958.429850896062893179851696175634522187021390095560", + "-5665.563891218624062243686482808197054863235184904433", + "-2945.404552250341615883104643651287431663294281737652", + "555.6566272478262524735403145861484390537770707372992", + "2936.796403550079139218970638242013974322758744804216", + "651.5191650747110008135060635556227666232180743487328", + "444.7629427486155148584918602702161457622049333694568", + "-1390.989671799095801316658971275073184600067187023729", + "-1142.861468946763860859271224968631944511098747155437", + "1541.978723117340843491920690654997335632919116206279", + "455.7146063293814470171599782651235242129856311098151", + "998.7943503940357037260061331795191352937661538946216", + "-204.8485581981121295383497187536442450324011940647949", + "-1560.354115460478786113711476250386112014306509906244", + "25278.29450605247223516529112562423587288781657290275", + "11873.22337179046469888005044109378787446671408425048", + "-8242.187303368878103323785658604027555126374435611949", + "-15939.98056417465751946455567789306872745912255628512", + "-5648.833539698031486810309720694416837861242341227280", + "2751.513926122717118525029734574022921057261239749143", + "7349.432002479077129245930487320138527887196396579062", + "194.9972545980371127390142753318206783334452047502143", + "-402.8156857682688265622049800462325595907987257153782", + "-3518.871908683063371167722463713374376552181380727802", + "-1494.304793474682619087166400375396721307777439607909", + "4640.927509426080087451995953783429589632369803588940", + "1585.757705203227141964561144798400703219894640413562", + "1565.169992404407137888592924342582799362959736185298", + "-1513.259809733540018859089666188672238777297615451800", + "-2974.437872674680092826212901753475972242208819679978", + "-1203.236292653823441598437153564865951527142648802876", + "72.52425949879153384040698301599842998884036742649047", + "1871.625274253419949517250818647194858608124560073483", + "-2.489984337379681666361341362948045621969765070197429", + "14462.74423518633102580192225823524237502860825596609", + "18367.74740916432711689913219912502810575714860430297", + "16565.76324499673961400925630526921000337443450249297", + "6054.315252651102952034254100792777051580892954459740", + "-8084.981271982030146065497115893934803061545998433631", + "-7988.314359128201297240919364015959817416101519999194", + "-3989.319346941492698525859335371231602272119870228687", + "2616.721186534649016680934493970036169897788778926434", + "4420.859270970486562095630193355634655337290952862363", + "2973.033519764547909146474824627687039969488363657908", + "-324.1453016982713707989332262410969595194473127209825", + "-2843.242039958969221918101261762794653424879358390111", + "-2281.461806143289517702658392470195144560150025832652", + "-642.9353229582055924928927665183236308235598082837497", + "1299.287274176955358490409470855361289523321919337117", + "1238.597083372069762230817383681570828675426312803376", + "1021.334042770848165110529668635291528449691525937968", + "-329.0529345069271079573348500899329811170455711610811", + "-1046.254301544052075124857362060924818517694048905299", + "134.7343039554480655186788228552325941588620079791654", + "-21431.41643507661192392650726158493697457993678274754", + "-20856.88281479015784660571401663659059349708627445067", + "-9829.261970591930907585958999196966814861251125275804", + "7806.858647077811827981774785577363365546600234846335", + "9319.700085649568180114405924685286453652118439999060", + "5319.898768025758256383579171601100187435481641933401", + "-2387.954826466841736373447020403170264502066930376059", + "-6958.298525165359760665355886221309296550746152109847", + "-3468.539106391972560670887295398968213297736424267559", + "130.4167253342709401698825285623058661085645012029873", + "3371.139930235175987370940343096776588915600470241960", + "1569.232678004908105313880673484968847566948896728142", + "750.0912101179065245750415609380442359608197763310413", + "-1462.257209626597452197736652121394535208578921869658", + "-1661.577809630240615684355192771059515041884351493459", + "1509.628528603869133250456671040505284128185908768108", + "383.8950902580816259502239917715884779698864996879279", + "1248.051096343638013308778159911906703363730187986273", + "17.18569564265260274901760034571610990094333217519021", + "-2038.024598002604853054532645991188063394308018947374", + "26118.98132017823514803387529120810044029492871875474", + "14943.61943482227903328457116850255971625430735856355", + "-6650.686262276131072415580833374348889422387492668440", + "-19519.81529547404067945704333355155941895199228108631", + "-6983.190236500848647457042860591724089812405118922223", + "1899.297502873688983038424995203515277346497811783168", + "8715.003652642963488202943622358986745434720576722170", + "2368.150690681864301926962120618658083737878227231428", + "136.8920793093482831910443246272238406481527839521448", + "-3954.732706163417141961077488373290331419627965482785", + "-2673.556440231186786375595871506657802723673830409989", + "5078.483935249043594670125721926702845818403229980691", + "1643.459143721204817182772630730123271413273760820347", + "2182.216979506380293664703833586468523416961563720645", + "-1345.838830963620501537777318021157952722412472356094", + "-4309.285350629108413525304135326225818270616857298235", + "-1488.050869922417817689426519211523527088509094291312", + "-228.0584943070343720919835603886532454450555855354340", + "2373.398940425709177876367020236623713151456855728138", + "773.8481328103928058186643458500631723389600248582833", + "12294.40387737855548614823173849184004455244840062464", + "16977.34966571858301862913845572077593071467784570724", + "17057.17475622503175013658695220988017704387344177727", + "8121.189758511830935868344768490586007624092305459885", + "-7458.443541406284389918808653948439156033975014107187", + "-8134.131160882738058651976911725365291142418949378248", + "-4912.881158613784419581465435995807691111897279859302", + "2030.653136098933717888434825960516061206391833398177", + "4407.490527709412730881592594976776779312299897714205", + "3392.434568825892752350943548729559313328141534290860", + "104.0372355841506198680609232049783930050635078746762", + "-3180.817620484463214391157460812371170723810181051096", + "-2460.523987075069437321629265332968914260047631079537", + "-938.2209314069133432825590545267820890922150850657831", + "1315.246905571876456706320919211807375254975062430487", + "1735.862392405992188189147617586418269768276241147998", + "1209.759657223166954850207025399731503326968841680649", + "-227.3320054566642297128407910803774238020746116287390", + "-1266.126209991929259396966729664100401813091860201682", + "-123.0794572338149156803989321165094334755661021559442", + "-19806.90794333834685506732819834090525250045748665845", + "-21314.81635440575229337844631555492486744407550254908", + "-12317.58384430130805020250005527399703840208659666608", + "6349.418659888281474363154227419204673663621492760982", + "9489.819687696527735093973063679592839666155440941289", + "6409.538948456309994399374417972222747225748405617373", + "-1550.281799013125267606263057621300789555474258987989", + "-8109.711199785217512061886243157800006692908759687186", + "-3957.840330296874877742767473517819198882831790006004", + "-404.0796555836667858753163727999380679499192203780272", + "3693.614351301181980145006883746936633676934626580499", + "2716.146658322790064799415509615557123789406209068981", + "1094.591086641398900496318896947912437274250932576747", + "-1456.269645549946420883827817869876763706452982413420", + "-2244.380608735636962338392373719455877272151458411079", + "1268.593891556261871090883000459505759446497182073132", + "265.2206730327749346649809229271069944357537135668622", + "1496.091578778639488439197917198148587432113387871024", + "354.6137351047722781932932090799444060236757625488818", + "-2508.477110048684129181005769771219369377836598443263", + "26517.86140875157324686379805134248778305979287686214", + "17922.98387741915144079932445041215068937644694653527", + "-4328.259142127668040873054918170572859673703425721293", + "-22704.70245940080949074466622805971940616027152354999", + "-8268.613747173738971390434576274225941735552759965376", + "740.4056074392611464740778308961471299437619012164253", + "9848.900182836035080973766381422758538530595451048714", + "5213.598341476210337710365441072904970861063876340963", + "801.2462923723508233330997243930793458484750729415321", + "-4241.870133920767845856621968904769727964770527614244", + "-4092.241355868550570635569815488217469506874233892269", + "5074.435909206083943809967780457349942315503368249477", + "1607.765329254820915989772546102530187884674235100928", + "2861.155651116567526208762405651011317435252198548496", + "-918.9310546317296090214320737728927500362088478158839", + "-5803.211323646092019259074499814222806376618363553826", + "-1767.541897994477314401145980308432268207111761980100", + "-663.0646207520075726320417301262932382663072876188661", + "2837.903194613938414496183429129769829434890424213252", + "1976.319600747797717779881875290418720908121189218755"}}; + +int main() { + using float50 = boost::multiprecision::cpp_bin_float_50; + constexpr std::size_t Nw = 3; // Max order of derivative to calculate for w + constexpr std::size_t Nx = 2; // Max order of derivative to calculate for x + constexpr std::size_t Ny = 4; // Max order of derivative to calculate for y + constexpr std::size_t Nz = 3; // Max order of derivative to calculate for z + auto const variables = make_ftuple(11, 12, 13, 14); + auto const v = boost::mp11::tuple_apply(f{}, variables); + std::size_t ia = 0; + double max_relative_error = 0; + for (std::size_t iw = 0; iw <= Nw; ++iw) + for (std::size_t ix = 0; ix <= Nx; ++ix) + for (std::size_t iy = 0; iy <= Ny; ++iy) + for (std::size_t iz = 0; iz <= Nz; ++iz) { + float50 const value = v.derivative(iw, ix, iy, iz); + float50 const answer = boost::lexical_cast(answers[ia++]); + double const error = static_cast(fabs(value / answer - 1)); + max_relative_error = (std::max)(error, max_relative_error); + } + std::cout << "max_relative_error = " << std::setprecision(3) << max_relative_error << " out of " << ia + << " calculated values." << std::endl; + return 0; +} +/* +Output: +max_relative_error = 6.82e-13 out of 240 calculated values. (for double) +max_relative_error = 3.36e-47 out of 240 calculated values. (for cpp_bin_float_50) +**/ diff --git a/src/boost/libs/math/example/autodiff_multiprecision.cpp b/src/boost/libs/math/example/autodiff_multiprecision.cpp new file mode 100644 index 00000000..81c7c27c --- /dev/null +++ b/src/boost/libs/math/example/autodiff_multiprecision.cpp @@ -0,0 +1,46 @@ +// Copyright Matthew Pulver 2018 - 2019. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +#include +#include +#include + +using namespace boost::math::differentiation; + +template +promote f(const W& w, const X& x, const Y& y, const Z& z) { + using namespace std; + return exp(w * sin(x * log(y) / z) + sqrt(w * z / (x * y))) + w * w / tan(z); +} + +int main() { + using float50 = boost::multiprecision::cpp_bin_float_50; + + constexpr unsigned Nw = 3; // Max order of derivative to calculate for w + constexpr unsigned Nx = 2; // Max order of derivative to calculate for x + constexpr unsigned Ny = 4; // Max order of derivative to calculate for y + constexpr unsigned Nz = 3; // Max order of derivative to calculate for z + // Declare 4 independent variables together into a std::tuple. + auto const variables = make_ftuple(11, 12, 13, 14); + auto const& w = std::get<0>(variables); // Up to Nw derivatives at w=11 + auto const& x = std::get<1>(variables); // Up to Nx derivatives at x=12 + auto const& y = std::get<2>(variables); // Up to Ny derivatives at y=13 + auto const& z = std::get<3>(variables); // Up to Nz derivatives at z=14 + auto const v = f(w, x, y, z); + // Calculated from Mathematica symbolic differentiation. + float50 const answer("1976.319600747797717779881875290418720908121189218755"); + std::cout << std::setprecision(std::numeric_limits::digits10) + << "mathematica : " << answer << '\n' + << "autodiff : " << v.derivative(Nw, Nx, Ny, Nz) << '\n' + << std::setprecision(3) + << "relative error: " << (v.derivative(Nw, Nx, Ny, Nz) / answer - 1) << '\n'; + return 0; +} +/* +Output: +mathematica : 1976.3196007477977177798818752904187209081211892188 +autodiff : 1976.3196007477977177798818752904187209081211892188 +relative error: 2.67e-50 +**/ diff --git a/src/boost/libs/math/example/barycentric_interpolation_example.cpp b/src/boost/libs/math/example/barycentric_interpolation_example.cpp new file mode 100644 index 00000000..263e20f1 --- /dev/null +++ b/src/boost/libs/math/example/barycentric_interpolation_example.cpp @@ -0,0 +1,92 @@ + +// Copyright Nick Thompson, 2017 + +// Distributed under 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 + +//[barycentric_rational_example + +/*` +This example shows how to use barycentric rational interpolation, using Walter Kohn's classic paper +"Solution of the Schrodinger Equation in Periodic Lattices with an Application to Metallic Lithium" +In this paper, Kohn needs to repeatedly solve an ODE (the radial Schrodinger equation) given a potential +which is only known at non-equally samples data. + +If he'd only had the barycentric rational interpolant of Boost.Math! + +References: Kohn, W., and N. Rostoker. "Solution of the Schrodinger equation in periodic lattices with an application to metallic lithium." Physical Review 94.5 (1954): 1111. +*/ + +#include + +int main() +{ + // The lithium potential is given in Kohn's paper, Table I: + std::vector r(45); + std::vector mrV(45); + + // We'll skip the code for filling the above vectors with data for now... + //<- + + r[0] = 0.02; mrV[0] = 5.727; + r[1] = 0.04, mrV[1] = 5.544; + r[2] = 0.06, mrV[2] = 5.450; + r[3] = 0.08, mrV[3] = 5.351; + r[4] = 0.10, mrV[4] = 5.253; + r[5] = 0.12, mrV[5] = 5.157; + r[6] = 0.14, mrV[6] = 5.058; + r[7] = 0.16, mrV[7] = 4.960; + r[8] = 0.18, mrV[8] = 4.862; + r[9] = 0.20, mrV[9] = 4.762; + r[10] = 0.24, mrV[10] = 4.563; + r[11] = 0.28, mrV[11] = 4.360; + r[12] = 0.32, mrV[12] = 4.1584; + r[13] = 0.36, mrV[13] = 3.9463; + r[14] = 0.40, mrV[14] = 3.7360; + r[15] = 0.44, mrV[15] = 3.5429; + r[16] = 0.48, mrV[16] = 3.3797; + r[17] = 0.52, mrV[17] = 3.2417; + r[18] = 0.56, mrV[18] = 3.1209; + r[19] = 0.60, mrV[19] = 3.0138; + r[20] = 0.68, mrV[20] = 2.8342; + r[21] = 0.76, mrV[21] = 2.6881; + r[22] = 0.84, mrV[22] = 2.5662; + r[23] = 0.92, mrV[23] = 2.4242; + r[24] = 1.00, mrV[24] = 2.3766; + r[25] = 1.08, mrV[25] = 2.3058; + r[26] = 1.16, mrV[26] = 2.2458; + r[27] = 1.24, mrV[27] = 2.2035; + r[28] = 1.32, mrV[28] = 2.1661; + r[29] = 1.40, mrV[29] = 2.1350; + r[30] = 1.48, mrV[30] = 2.1090; + r[31] = 1.64, mrV[31] = 2.0697; + r[32] = 1.80, mrV[32] = 2.0466; + r[33] = 1.96, mrV[33] = 2.0325; + r[34] = 2.12, mrV[34] = 2.0288; + r[35] = 2.28, mrV[35] = 2.0292; + r[36] = 2.44, mrV[36] = 2.0228; + r[37] = 2.60, mrV[37] = 2.0124; + r[38] = 2.76, mrV[38] = 2.0065; + r[39] = 2.92, mrV[39] = 2.0031; + r[40] = 3.08, mrV[40] = 2.0015; + r[41] = 3.24, mrV[41] = 2.0008; + r[42] = 3.40, mrV[42] = 2.0004; + r[43] = 3.56, mrV[43] = 2.0002; + r[44] = 3.72, mrV[44] = 2.0001; + //-> + + // Now we want to interpolate this potential at any r: + boost::math::barycentric_rational b(r.data(), mrV.data(), r.size()); + + for (size_t i = 1; i < 8; ++i) + { + double r = i*0.5; + std::cout << "(r, V) = (" << r << ", " << -b(r)/r << ")\n"; + } +} +//] [/barycentric_rational_example] diff --git a/src/boost/libs/math/example/barycentric_interpolation_example_2.cpp b/src/boost/libs/math/example/barycentric_interpolation_example_2.cpp new file mode 100644 index 00000000..c7e834ec --- /dev/null +++ b/src/boost/libs/math/example/barycentric_interpolation_example_2.cpp @@ -0,0 +1,108 @@ + +// Copyright Nick Thompson, 2017 + +// Distributed under 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 + +//[barycentric_rational_example2 + +/*`This further example shows how to use the iterator based constructor, and then uses the +function object in our root finding algorithms to locate the points where the potential +achieves a specific value. +*/ + +#include +#include +#include + +int main() +{ + // The lithium potential is given in Kohn's paper, Table I. + // (We could equally easily use an unordered_map, a list of tuples or pairs, or a 2-dimentional array). + std::map r; + + r[0.02] = 5.727; + r[0.04] = 5.544; + r[0.06] = 5.450; + r[0.08] = 5.351; + r[0.10] = 5.253; + r[0.12] = 5.157; + r[0.14] = 5.058; + r[0.16] = 4.960; + r[0.18] = 4.862; + r[0.20] = 4.762; + r[0.24] = 4.563; + r[0.28] = 4.360; + r[0.32] = 4.1584; + r[0.36] = 3.9463; + r[0.40] = 3.7360; + r[0.44] = 3.5429; + r[0.48] = 3.3797; + r[0.52] = 3.2417; + r[0.56] = 3.1209; + r[0.60] = 3.0138; + r[0.68] = 2.8342; + r[0.76] = 2.6881; + r[0.84] = 2.5662; + r[0.92] = 2.4242; + r[1.00] = 2.3766; + r[1.08] = 2.3058; + r[1.16] = 2.2458; + r[1.24] = 2.2035; + r[1.32] = 2.1661; + r[1.40] = 2.1350; + r[1.48] = 2.1090; + r[1.64] = 2.0697; + r[1.80] = 2.0466; + r[1.96] = 2.0325; + r[2.12] = 2.0288; + r[2.28] = 2.0292; + r[2.44] = 2.0228; + r[2.60] = 2.0124; + r[2.76] = 2.0065; + r[2.92] = 2.0031; + r[3.08] = 2.0015; + r[3.24] = 2.0008; + r[3.40] = 2.0004; + r[3.56] = 2.0002; + r[3.72] = 2.0001; + + // Let's discover the absissa that will generate a potential of exactly 3.0, + // start by creating 2 ranges for the x and y values: + auto x_range = boost::adaptors::keys(r); + auto y_range = boost::adaptors::values(r); + boost::math::barycentric_rational b(x_range.begin(), x_range.end(), y_range.begin()); + // + // We'll use a lamda expression to provide the functor to our root finder, since we want + // the abscissa value that yields 3, not zero. We pass the functor b by value to the + // lambda expression since barycentric_rational is trivial to copy. + // Here we're using simple bisection to find the root: + boost::uintmax_t iterations = (std::numeric_limits::max)(); + double abscissa_3 = boost::math::tools::bisect([=](double x) { return b(x) - 3; }, 0.44, 1.24, boost::math::tools::eps_tolerance(), iterations).first; + std::cout << "Abscissa value that yields a potential of 3 = " << abscissa_3 << std::endl; + std::cout << "Root was found in " << iterations << " iterations." << std::endl; + // + // However, we have a more efficient root finding algorithm than simple bisection: + iterations = (std::numeric_limits::max)(); + abscissa_3 = boost::math::tools::bracket_and_solve_root([=](double x) { return b(x) - 3; }, 0.6, 1.2, false, boost::math::tools::eps_tolerance(), iterations).first; + std::cout << "Abscissa value that yields a potential of 3 = " << abscissa_3 << std::endl; + std::cout << "Root was found in " << iterations << " iterations." << std::endl; +} +//] [/barycentric_rational_example2] + + +//[barycentric_rational_example2_out +/*` Program output is: +[pre +Abscissa value that yields a potential of 3 = 0.604728 +Root was found in 54 iterations. +Abscissa value that yields a potential of 3 = 0.604728 +Root was found in 10 iterations. +] +*/ +//] diff --git a/src/boost/libs/math/example/bernoulli_example.cpp b/src/boost/libs/math/example/bernoulli_example.cpp new file mode 100644 index 00000000..5a2c5896 --- /dev/null +++ b/src/boost/libs/math/example/bernoulli_example.cpp @@ -0,0 +1,207 @@ +// Copyright Paul A. Bristow 2013. +// Copyright Nakhar Agrawal 2013. +// Copyright John Maddock 2013. +// Copyright Christopher Kormanyos 2013. + +// 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) + +#pragma warning (disable : 4100) // unreferenced formal parameter. +#pragma warning (disable : 4127) // conditional expression is constant. + +//#define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error + +#include +#include + +#include + +/* First 50 from 2 to 100 inclusive: */ +/* TABLE[N[BernoulliB[n], 200], {n,2,100,2}] */ + +//SC_(0.1666666666666666666666666666666666666666), +//SC_(-0.0333333333333333333333333333333333333333), +//SC_(0.0238095238095238095238095238095238095238), +//SC_(-0.0333333333333333333333333333333333333333), +//SC_(0.0757575757575757575757575757575757575757), +//SC_(-0.2531135531135531135531135531135531135531), +//SC_(1.1666666666666666666666666666666666666666), +//SC_(-7.0921568627450980392156862745098039215686), +//SC_(54.9711779448621553884711779448621553884711), + +int main() +{ + //[bernoulli_example_1 + +/*`A simple example computes the value of B[sub 4] where the return type is `double`, +note that the argument to bernoulli_b2n is ['2] not ['4] since it computes B[sub 2N]. + + +*/ + try + { // It is always wise to use try'n'catch blocks around Boost.Math functions + // so that any informative error messages can be displayed in the catch block. + std::cout + << std::setprecision(std::numeric_limits::digits10) + << boost::math::bernoulli_b2n(2) << std::endl; + +/*`So B[sub 4] == -1/30 == -0.0333333333333333 + +If we use Boost.Multiprecision and its 50 decimal digit floating-point type `cpp_dec_float_50`, +we can calculate the value of much larger numbers like B[sub 200] +and also obtain much higher precision. +*/ + + std::cout + << std::setprecision(std::numeric_limits::digits10) + << boost::math::bernoulli_b2n(100) << std::endl; + +//] //[/bernoulli_example_1] + +//[bernoulli_example_2 +/*`We can compute and save all the float-precision Bernoulli numbers from one call. +*/ + std::vector bn; // Space for 32-bit `float` precision Bernoulli numbers. + + // Start with Bernoulli number 0. + boost::math::bernoulli_b2n(0, 32, std::back_inserter(bn)); // Fill vector with even Bernoulli numbers. + + for(size_t i = 0; i < bn.size(); i++) + { // Show vector of even Bernoulli numbers, showing all significant decimal digits. + std::cout << std::setprecision(std::numeric_limits::digits10) + << i*2 << ' ' + << bn[i] + << std::endl; + } +//] //[/bernoulli_example_2] + + } + catch(const std::exception& ex) + { + std::cout << "Thrown Exception caught: " << ex.what() << std::endl; + } + + +//[bernoulli_example_3 +/*`Of course, for any floating-point type, there is a maximum Bernoulli number that can be computed + before it overflows the exponent. + By default policy, if we try to compute too high a Bernoulli number, an exception will be thrown. +*/ + try + { + std::cout + << std::setprecision(std::numeric_limits::digits10) + << "Bernoulli number " << 33 * 2 <(33) << std::endl; + } + catch (std::exception ex) + { + std::cout << "Thrown Exception caught: " << ex.what() << std::endl; + } + +/*` +and we will get a helpful error message (provided try'n'catch blocks are used). +*/ + +//] //[/bernoulli_example_3] + +//[bernoulli_example_4 +/*For example: +*/ + std::cout << "boost::math::max_bernoulli_b2n::value = " << boost::math::max_bernoulli_b2n::value << std::endl; + std::cout << "Maximum Bernoulli number using float is " << boost::math::bernoulli_b2n( boost::math::max_bernoulli_b2n::value) << std::endl; + std::cout << "boost::math::max_bernoulli_b2n::value = " << boost::math::max_bernoulli_b2n::value << std::endl; + std::cout << "Maximum Bernoulli number using double is " << boost::math::bernoulli_b2n( boost::math::max_bernoulli_b2n::value) << std::endl; + //] //[/bernoulli_example_4] + +//[tangent_example_1 + +/*`We can compute and save a few Tangent numbers. +*/ + std::vector tn; // Space for some `float` precision Tangent numbers. + + // Start with Bernoulli number 0. + boost::math::tangent_t2n(1, 6, std::back_inserter(tn)); // Fill vector with even Tangent numbers. + + for(size_t i = 0; i < tn.size(); i++) + { // Show vector of even Tangent numbers, showing all significant decimal digits. + std::cout << std::setprecision(std::numeric_limits::digits10) + << " " + << tn[i]; + } + std::cout << std::endl; + +//] [/tangent_example_1] + +// 1, 2, 16, 272, 7936, 353792, 22368256, 1903757312 + + + +} // int main() + +/* + +//[bernoulli_output_1 + -3.6470772645191354362138308865549944904868234686191e+215 +//] //[/bernoulli_output_1] + +//[bernoulli_output_2 + + 0 1 + 2 0.166667 + 4 -0.0333333 + 6 0.0238095 + 8 -0.0333333 + 10 0.0757576 + 12 -0.253114 + 14 1.16667 + 16 -7.09216 + 18 54.9712 + 20 -529.124 + 22 6192.12 + 24 -86580.3 + 26 1.42552e+006 + 28 -2.72982e+007 + 30 6.01581e+008 + 32 -1.51163e+010 + 34 4.29615e+011 + 36 -1.37117e+013 + 38 4.88332e+014 + 40 -1.92966e+016 + 42 8.41693e+017 + 44 -4.03381e+019 + 46 2.11507e+021 + 48 -1.20866e+023 + 50 7.50087e+024 + 52 -5.03878e+026 + 54 3.65288e+028 + 56 -2.84988e+030 + 58 2.38654e+032 + 60 -2.14e+034 + 62 2.0501e+036 +//] //[/bernoulli_output_2] + +//[bernoulli_output_3 + Bernoulli number 66 + Thrown Exception caught: Error in function boost::math::bernoulli_b2n(n): + Overflow evaluating function at 33 +//] //[/bernoulli_output_3] +//[bernoulli_output_4 + boost::math::max_bernoulli_b2n::value = 32 + Maximum Bernoulli number using float is -2.0938e+038 + boost::math::max_bernoulli_b2n::value = 129 + Maximum Bernoulli number using double is 1.33528e+306 +//] //[/bernoulli_output_4] + + +//[tangent_output_1 + 1 2 16 272 7936 353792 +//] [/tangent_output_1] + + + +*/ + + diff --git a/src/boost/libs/math/example/bessel_errors_example.cpp b/src/boost/libs/math/example/bessel_errors_example.cpp new file mode 100644 index 00000000..1b772926 --- /dev/null +++ b/src/boost/libs/math/example/bessel_errors_example.cpp @@ -0,0 +1,171 @@ +// Copyright Christopher Kormanyos 2013. +// Copyright Paul A. Bristow 2013. +// Copyright John Maddock 2013. + +// Distributed under 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). + +#ifdef _MSC_VER +# pragma warning (disable : 4512) // assignment operator could not be generated. +# pragma warning (disable : 4996) // assignment operator could not be generated. +#endif + +#include +#include +#include +#include +#include +#include + +// Weisstein, Eric W. "Bessel Function Zeros." From MathWorld--A Wolfram Web Resource. +// http://mathworld.wolfram.com/BesselFunctionZeros.html +// Test values can be calculated using [@wolframalpha.com WolframAplha] +// See also http://dlmf.nist.gov/10.21 + +//[bessel_errors_example_1 + +/*`[h5 Error messages from 'bad' input] + +Another example demonstrates calculating zeros of the Bessel functions +showing the error messages from 'bad' input is handled by throwing exceptions. + +To use the functions for finding zeros of the functions we need: +*/ + #include + #include + +//] [/bessel_errors_example_1] + +int main() +{ +//[bessel_errors_example_2 + +/*`[tip It is always wise to place all code using Boost.Math inside try'n'catch blocks; +this will ensure that helpful error messages can be shown when exceptional conditions arise.] + +Examples below show messages from several 'bad' arguments that throw a `domain_error` exception. +*/ + try + { // Try a zero order v. + float dodgy_root = boost::math::cyl_bessel_j_zero(0.F, 0); + std::cout << "boost::math::cyl_bessel_j_zero(0.F, 0) " << dodgy_root << std::endl; + // Thrown exception Error in function boost::math::cyl_bessel_j_zero(double, int): + // Requested the 0'th zero of J0, but the rank must be > 0 ! + } + catch (std::exception& ex) + { + std::cout << "Thrown exception " << ex.what() << std::endl; + } + +/*`[note The type shown in the error message is the type [*after promotion], +using __precision_policy and __promotion_policy, from `float` to `double` in this case.] + +In this example the promotion goes: + +# Arguments are `float` and `int`. +# Treat `int` "as if" it were a `double`, so arguments are `float` and `double`. +# Common type is `double` - so that's the precision we want (and the type that will be returned). +# Evaluate internally as `double` for full `float` precision. + +See full code for other examples that promote from `double` to `long double`. + +Other examples of 'bad' inputs like infinity and NaN are below. +Some compiler warnings indicate that 'bad' values are detected at compile time. +*/ + + try + { // order v = inf + std::cout << "boost::math::cyl_bessel_j_zero(inf, 1) " << std::endl; + double inf = std::numeric_limits::infinity(); + double inf_root = boost::math::cyl_bessel_j_zero(inf, 1); + std::cout << "boost::math::cyl_bessel_j_zero(inf, 1) " << inf_root << std::endl; + // Throw exception Error in function boost::math::cyl_bessel_j_zero(long double, unsigned): + // Order argument is 1.#INF, but must be finite >= 0 ! + } + catch (std::exception& ex) + { + std::cout << "Thrown exception " << ex.what() << std::endl; + } + + try + { // order v = NaN, rank m = 1 + std::cout << "boost::math::cyl_bessel_j_zero(nan, 1) " << std::endl; + double nan = std::numeric_limits::quiet_NaN(); + double nan_root = boost::math::cyl_bessel_j_zero(nan, 1); + std::cout << "boost::math::cyl_bessel_j_zero(nan, 1) " << nan_root << std::endl; + // Throw exception Error in function boost::math::cyl_bessel_j_zero(long double, unsigned): + // Order argument is 1.#QNAN, but must be finite >= 0 ! + } + catch (std::exception& ex) + { + std::cout << "Thrown exception " << ex.what() << std::endl; + } + +/*`The output from other examples are shown appended to the full code listing. +*/ +//] [/bessel_errors_example_2] + try + { // Try a zero rank m. + std::cout << "boost::math::cyl_neumann_zero(0.0, 0) " << std::endl; + double dodgy_root = boost::math::cyl_bessel_j_zero(0.0, 0); + // warning C4146: unary minus operator applied to unsigned type, result still unsigned. + std::cout << "boost::math::cyl_neumann_zero(0.0, -1) " << dodgy_root << std::endl; + // boost::math::cyl_neumann_zero(0.0, -1) 6.74652e+009 + // This *should* fail because m is unreasonably large. + + } + catch (std::exception& ex) + { + std::cout << "Thrown exception " << ex.what() << std::endl; + } + + try + { // m = inf + std::cout << "boost::math::cyl_bessel_j_zero(0.0, inf) " << std::endl; + double inf = std::numeric_limits::infinity(); + double inf_root = boost::math::cyl_bessel_j_zero(0.0, inf); + // warning C4244: 'argument' : conversion from 'double' to 'int', possible loss of data. + std::cout << "boost::math::cyl_bessel_j_zero(0.0, inf) " << inf_root << std::endl; + // Throw exception Error in function boost::math::cyl_bessel_j_zero(long double, int): + // Requested the 0'th zero, but must be > 0 ! + + } + catch (std::exception& ex) + { + std::cout << "Thrown exception " << ex.what() << std::endl; + } + + try + { // m = NaN + double nan = std::numeric_limits::quiet_NaN(); + double nan_root = boost::math::airy_ai_zero(nan); + // warning C4244: 'argument' : conversion from 'double' to 'int', possible loss of data. + std::cout << "boost::math::airy_ai_zero(nan) " << nan_root << std::endl; + // Thrown exception Error in function boost::math::airy_ai_zero(double,double): + // The requested rank of the zero is 0, but must be 1 or more ! + } + catch (std::exception& ex) + { + std::cout << "Thrown exception " << ex.what() << std::endl; + } + } // int main() + +/* +Output: + + Description: Autorun "J:\Cpp\big_number\Debug\bessel_errors_example.exe" + Thrown exception Error in function boost::math::cyl_bessel_j_zero(double, int): Requested the 0'th zero of J0, but the rank must be > 0 ! + boost::math::cyl_bessel_j_zero(inf, 1) + Thrown exception Error in function boost::math::cyl_bessel_j_zero(long double, int): Order argument is 1.#INF, but must be finite >= 0 ! + boost::math::cyl_bessel_j_zero(nan, 1) + Thrown exception Error in function boost::math::cyl_bessel_j_zero(long double, int): Order argument is 1.#QNAN, but must be finite >= 0 ! + boost::math::cyl_neumann_zero(0.0, 0) + Thrown exception Error in function boost::math::cyl_bessel_j_zero(long double, int): Requested the 0'th zero of J0, but the rank must be > 0 ! + boost::math::cyl_bessel_j_zero(0.0, inf) + Thrown exception Error in function boost::math::cyl_bessel_j_zero(long double, int): Requested the -2147483648'th zero, but the rank must be positive ! + Thrown exception Error in function boost::math::airy_ai_zero(double,double): The requested rank of the zero is 0, but must be 1 or more ! + + +*/ + diff --git a/src/boost/libs/math/example/bessel_zeros_example.cpp b/src/boost/libs/math/example/bessel_zeros_example.cpp new file mode 100644 index 00000000..0d3ec3cc --- /dev/null +++ b/src/boost/libs/math/example/bessel_zeros_example.cpp @@ -0,0 +1,447 @@ +// Copyright Christopher Kormanyos 2013. +// Copyright Paul A. Bristow 2013. +// Copyright John Maddock 2013. + +// Distributed under 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). + +#ifdef _MSC_VER +# pragma warning (disable : 4512) // assignment operator could not be generated. +# pragma warning (disable : 4996) // assignment operator could not be generated. +#endif + +#include +#include +#include +#include +#include +#include + +// Weisstein, Eric W. "Bessel Function Zeros." From MathWorld--A Wolfram Web Resource. +// http://mathworld.wolfram.com/BesselFunctionZeros.html +// Test values can be calculated using [@wolframalpha.com WolframAplha] +// See also http://dlmf.nist.gov/10.21 + +//[bessel_zero_example_1 + +/*`This example demonstrates calculating zeros of the Bessel, Neumann and Airy functions. +It also shows how Boost.Math and Boost.Multiprecision can be combined to provide +a many decimal digit precision. For 50 decimal digit precision we need to include +*/ + + #include + +/*`and a `typedef` for `float_type` may be convenient +(allowing a quick switch to re-compute at built-in `double` or other precision) +*/ + typedef boost::multiprecision::cpp_dec_float_50 float_type; + +//`To use the functions for finding zeros of the functions we need + + #include + +//`This file includes the forward declaration signatures for the zero-finding functions: + +// #include + +/*`but more details are in the full documentation, for example at +[@http://www.boost.org/doc/libs/1_53_0/libs/math/doc/sf_and_dist/html/math_toolkit/special/bessel/bessel_over.html Boost.Math Bessel functions] +*/ + +/*`This example shows obtaining both a single zero of the Bessel function, +and then placing multiple zeros into a container like `std::vector` by providing an iterator. +The signature of the single value function is: + + template + inline typename detail::bessel_traits >::result_type + cyl_bessel_j_zero(T v, // Floating-point value for Jv. + int m); // start index. + +The result type is controlled by the floating-point type of parameter `v` +(but subject to the usual __precision_policy and __promotion_policy). + +The signature of multiple zeros function is: + + template + inline OutputIterator cyl_bessel_j_zero(T v, // Floating-point value for Jv. + int start_index, // 1-based start index. + unsigned number_of_zeros, + OutputIterator out_it); // iterator into container for zeros. + +There is also a version which allows control of the __policy_section for error handling and precision. + + template + inline OutputIterator cyl_bessel_j_zero(T v, // Floating-point value for Jv. + int start_index, // 1-based start index. + unsigned number_of_zeros, + OutputIterator out_it, + const Policy& pol); // iterator into container for zeros. + +*/ +//] [/bessel_zero_example_1] + +//[bessel_zero_example_iterator_1] +/*`We use the `cyl_bessel_j_zero` output iterator parameter `out_it` +to create a sum of 1/zeros[super 2] by defining a custom output iterator: +*/ + +template +struct output_summation_iterator +{ + output_summation_iterator(T* p) : p_sum(p) + {} + output_summation_iterator& operator*() + { return *this; } + output_summation_iterator& operator++() + { return *this; } + output_summation_iterator& operator++(int) + { return *this; } + output_summation_iterator& operator = (T const& val) + { + *p_sum += 1./ (val * val); // Summing 1/zero^2. + return *this; + } +private: + T* p_sum; +}; + + +//] [/bessel_zero_example_iterator_1] + +int main() +{ + try + { +//[bessel_zero_example_2] + +/*`[tip It is always wise to place code using Boost.Math inside try'n'catch blocks; +this will ensure that helpful error messages can be shown when exceptional conditions arise.] + +First, evaluate a single Bessel zero. + +The precision is controlled by the float-point type of template parameter `T` of `v` +so this example has `double` precision, at least 15 but up to 17 decimal digits (for the common 64-bit double). +*/ + double root = boost::math::cyl_bessel_j_zero(0.0, 1); + // Displaying with default precision of 6 decimal digits: + std::cout << "boost::math::cyl_bessel_j_zero(0.0, 1) " << root << std::endl; // 2.40483 + // And with all the guaranteed (15) digits: + std::cout.precision(std::numeric_limits::digits10); + std::cout << "boost::math::cyl_bessel_j_zero(0.0, 1) " << root << std::endl; // 2.40482555769577 +/*`But note that because the parameter `v` controls the precision of the result, +`v` [*must be a floating-point type]. +So if you provide an integer type, say 0, rather than 0.0, then it will fail to compile thus: +`` + root = boost::math::cyl_bessel_j_zero(0, 1); +`` +with this error message +`` + error C2338: Order must be a floating-point type. +`` + +Optionally, we can use a policy to ignore errors, C-style, returning some value +perhaps infinity or NaN, or the best that can be done. (See __user_error_handling). + +To create a (possibly unwise!) policy that ignores all errors: +*/ + + typedef boost::math::policies::policy + < + boost::math::policies::domain_error, + boost::math::policies::overflow_error, + boost::math::policies::underflow_error, + boost::math::policies::denorm_error, + boost::math::policies::pole_error, + boost::math::policies::evaluation_error + > ignore_all_policy; + + double inf = std::numeric_limits::infinity(); + double nan = std::numeric_limits::quiet_NaN(); + + std::cout << "boost::math::cyl_bessel_j_zero(-1.0, 0) " << std::endl; + double dodgy_root = boost::math::cyl_bessel_j_zero(-1.0, 0, ignore_all_policy()); + std::cout << "boost::math::cyl_bessel_j_zero(-1.0, 1) " << dodgy_root << std::endl; // 1.#QNAN + double inf_root = boost::math::cyl_bessel_j_zero(inf, 1, ignore_all_policy()); + std::cout << "boost::math::cyl_bessel_j_zero(inf, 1) " << inf_root << std::endl; // 1.#QNAN + double nan_root = boost::math::cyl_bessel_j_zero(nan, 1, ignore_all_policy()); + std::cout << "boost::math::cyl_bessel_j_zero(nan, 1) " << nan_root << std::endl; // 1.#QNAN + +/*`Another version of `cyl_bessel_j_zero` allows calculation of multiple zeros with one call, +placing the results in a container, often `std::vector`. +For example, generate five `double` roots of J[sub v] for integral order 2. + +showing the same results as column J[sub 2](x) in table 1 of +[@ http://mathworld.wolfram.com/BesselFunctionZeros.html Wolfram Bessel Function Zeros]. + +*/ + unsigned int n_roots = 5U; + std::vector roots; + boost::math::cyl_bessel_j_zero(2.0, 1, n_roots, std::back_inserter(roots)); + std::copy(roots.begin(), + roots.end(), + std::ostream_iterator(std::cout, "\n")); + +/*`Or generate 50 decimal digit roots of J[sub v] for non-integral order `v = 71/19`. + +We set the precision of the output stream and show trailing zeros to display a fixed 50 decimal digits. +*/ + std::cout.precision(std::numeric_limits::digits10); // 50 decimal digits. + std::cout << std::showpoint << std::endl; // Show trailing zeros. + + float_type x = float_type(71) / 19; + float_type r = boost::math::cyl_bessel_j_zero(x, 1); // 1st root. + std::cout << "x = " << x << ", r = " << r << std::endl; + + r = boost::math::cyl_bessel_j_zero(x, 20U); // 20th root. + std::cout << "x = " << x << ", r = " << r << std::endl; + + std::vector zeros; + boost::math::cyl_bessel_j_zero(x, 1, 3, std::back_inserter(zeros)); + + std::cout << "cyl_bessel_j_zeros" << std::endl; + // Print the roots to the output stream. + std::copy(zeros.begin(), zeros.end(), + std::ostream_iterator(std::cout, "\n")); + +/*`The Neumann function zeros are evaluated very similarly: +*/ + using boost::math::cyl_neumann_zero; + + double zn = cyl_neumann_zero(2., 1); + + std::cout << "cyl_neumann_zero(2., 1) = " << std::endl; + //double zn0 = zn; + // std::cout << "zn0 = " << std::endl; + // std::cout << zn0 << std::endl; + // + std::cout << zn << std::endl; + // std::cout << cyl_neumann_zero(2., 1) << std::endl; + + std::vector nzeros(3); // Space for 3 zeros. + cyl_neumann_zero(2.F, 1, nzeros.size(), nzeros.begin()); + + std::cout << "cyl_neumann_zero(2.F, 1, " << std::endl; + // Print the zeros to the output stream. + std::copy(nzeros.begin(), nzeros.end(), + std::ostream_iterator(std::cout, "\n")); + + std::cout << cyl_neumann_zero(static_cast(220)/100, 1) << std::endl; + // 3.6154383428745996706772556069431792744372398748422 + +/*`Finally we show how the output iterator can be used to compute a sum of zeros. + +(See [@https://doi.org/10.1017/S2040618500034067 Ian N. Sneddon, Infinite Sums of Bessel Zeros], +page 150 equation 40). +*/ +//] [/bessel_zero_example_2] + + { +//[bessel_zero_example_iterator_2] +/*`The sum is calculated for many values, converging on the analytical exact value of `1/8`. +*/ + using boost::math::cyl_bessel_j_zero; + double nu = 1.; + double sum = 0; + output_summation_iterator it(&sum); // sum of 1/zeros^2 + cyl_bessel_j_zero(nu, 1, 10000, it); + + double s = 1/(4 * (nu + 1)); // 0.125 = 1/8 is exact analytical solution. + std::cout << std::setprecision(6) << "nu = " << nu << ", sum = " << sum + << ", exact = " << s << std::endl; + // nu = 1.00000, sum = 0.124990, exact = 0.125000 +//] [/bessel_zero_example_iterator_2] + } + } + catch (std::exception& ex) + { + std::cout << "Thrown exception " << ex.what() << std::endl; + } + +//[bessel_zero_example_iterator_3] + +/*`Examples below show effect of 'bad' arguments that throw a `domain_error` exception. +*/ + try + { // Try a negative rank m. + std::cout << "boost::math::cyl_bessel_j_zero(-1.F, -1) " << std::endl; + float dodgy_root = boost::math::cyl_bessel_j_zero(-1.F, -1); + std::cout << "boost::math::cyl_bessel_j_zero(-1.F, -1) " << dodgy_root << std::endl; + // Throw exception Error in function boost::math::cyl_bessel_j_zero(double, int): + // Order argument is -1, but must be >= 0 ! + } + catch (std::exception& ex) + { + std::cout << "Throw exception " << ex.what() << std::endl; + } + +/*`[note The type shown is the type [*after promotion], +using __precision_policy and __promotion_policy, from `float` to `double` in this case.] + +In this example the promotion goes: + +# Arguments are `float` and `int`. +# Treat `int` "as if" it were a `double`, so arguments are `float` and `double`. +# Common type is `double` - so that's the precision we want (and the type that will be returned). +# Evaluate internally as `long double` for full `double` precision. + +See full code for other examples that promote from `double` to `long double`. + +*/ + +//] [/bessel_zero_example_iterator_3] + try + { // order v = inf + std::cout << "boost::math::cyl_bessel_j_zero(infF, 1) " << std::endl; + float infF = std::numeric_limits::infinity(); + float inf_root = boost::math::cyl_bessel_j_zero(infF, 1); + std::cout << "boost::math::cyl_bessel_j_zero(infF, 1) " << inf_root << std::endl; + // boost::math::cyl_bessel_j_zero(-1.F, -1) + //Thrown exception Error in function boost::math::cyl_bessel_j_zero(double, int): + // Requested the -1'th zero, but the rank must be positive ! + } + catch (std::exception& ex) + { + std::cout << "Thrown exception " << ex.what() << std::endl; + } + try + { // order v = inf + double inf = std::numeric_limits::infinity(); + double inf_root = boost::math::cyl_bessel_j_zero(inf, 1); + std::cout << "boost::math::cyl_bessel_j_zero(inf, 1) " << inf_root << std::endl; + // Throw exception Error in function boost::math::cyl_bessel_j_zero(long double, unsigned): + // Order argument is 1.#INF, but must be finite >= 0 ! + } + catch (std::exception& ex) + { + std::cout << "Thrown exception " << ex.what() << std::endl; + } + + try + { // order v = NaN + double nan = std::numeric_limits::quiet_NaN(); + double nan_root = boost::math::cyl_bessel_j_zero(nan, 1); + std::cout << "boost::math::cyl_bessel_j_zero(nan, 1) " << nan_root << std::endl; + // Throw exception Error in function boost::math::cyl_bessel_j_zero(long double, unsigned): + // Order argument is 1.#QNAN, but must be finite >= 0 ! + } + catch (std::exception& ex) + { + std::cout << "Thrown exception " << ex.what() << std::endl; + } + + try + { // Try a negative m. + double dodgy_root = boost::math::cyl_bessel_j_zero(0.0, -1); + // warning C4146: unary minus operator applied to unsigned type, result still unsigned. + std::cout << "boost::math::cyl_bessel_j_zero(0.0, -1) " << dodgy_root << std::endl; + // boost::math::cyl_bessel_j_zero(0.0, -1) 6.74652e+009 + // This *should* fail because m is unreasonably large. + + } + catch (std::exception& ex) + { + std::cout << "Thrown exception " << ex.what() << std::endl; + } + + try + { // m = inf + double inf = std::numeric_limits::infinity(); + double inf_root = boost::math::cyl_bessel_j_zero(0.0, inf); + // warning C4244: 'argument' : conversion from 'double' to 'int', possible loss of data. + std::cout << "boost::math::cyl_bessel_j_zero(0.0, inf) " << inf_root << std::endl; + // Throw exception Error in function boost::math::cyl_bessel_j_zero(long double, int): + // Requested the 0'th zero, but must be > 0 ! + + } + catch (std::exception& ex) + { + std::cout << "Thrown exception " << ex.what() << std::endl; + } + + try + { // m = NaN + std::cout << "boost::math::cyl_bessel_j_zero(0.0, nan) " << std::endl ; + double nan = std::numeric_limits::quiet_NaN(); + double nan_root = boost::math::cyl_bessel_j_zero(0.0, nan); + // warning C4244: 'argument' : conversion from 'double' to 'int', possible loss of data. + std::cout << nan_root << std::endl; + // Throw exception Error in function boost::math::cyl_bessel_j_zero(long double, int): + // Requested the 0'th zero, but must be > 0 ! + } + catch (std::exception& ex) + { + std::cout << "Thrown exception " << ex.what() << std::endl; + } + + } // int main() + +/* +Mathematica: Table[N[BesselJZero[71/19, n], 50], {n, 1, 20, 1}] + +7.2731751938316489503185694262290765588963196701623 +10.724858308883141732536172745851416647110749599085 +14.018504599452388106120459558042660282427471931581 +17.25249845917041718216248716654977734919590383861 +20.456678874044517595180234083894285885460502077814 +23.64363089714234522494551422714731959985405172504 +26.819671140255087745421311470965019261522390519297 +29.988343117423674742679141796661432043878868194142 +33.151796897690520871250862469973445265444791966114 +36.3114160002162074157243540350393860813165201842 +39.468132467505236587945197808083337887765967032029 +42.622597801391236474855034831297954018844433480227 +45.775281464536847753390206207806726581495950012439 +48.926530489173566198367766817478553992471739894799 +52.076607045343002794279746041878924876873478063472 +55.225712944912571393594224327817265689059002890192 +58.374006101538886436775188150439025201735151418932 +61.521611873000965273726742659353136266390944103571 +64.66863105379093036834648221487366079456596628716 +67.815145619696290925556791375555951165111460585458 + +Mathematica: Table[N[BesselKZero[2, n], 50], {n, 1, 5, 1}] +n | +1 | 3.3842417671495934727014260185379031127323883259329 +2 | 6.7938075132682675382911671098369487124493222183854 +3 | 10.023477979360037978505391792081418280789658279097 + + +*/ + + /* +[bessel_zero_output] + + boost::math::cyl_bessel_j_zero(0.0, 1) 2.40483 + boost::math::cyl_bessel_j_zero(0.0, 1) 2.40482555769577 + boost::math::cyl_bessel_j_zero(-1.0, 1) 1.#QNAN + boost::math::cyl_bessel_j_zero(inf, 1) 1.#QNAN + boost::math::cyl_bessel_j_zero(nan, 1) 1.#QNAN + 5.13562230184068 + 8.41724414039986 + 11.6198411721491 + 14.7959517823513 + 17.9598194949878 + + x = 3.7368421052631578947368421052631578947368421052632, r = 7.2731751938316489503185694262290765588963196701623 + x = 3.7368421052631578947368421052631578947368421052632, r = 67.815145619696290925556791375555951165111460585458 + 7.2731751938316489503185694262290765588963196701623 + 10.724858308883141732536172745851416647110749599085 + 14.018504599452388106120459558042660282427471931581 + cyl_neumann_zero(2., 1) = 3.3842417671495935000000000000000000000000000000000 + 3.3842418193817139000000000000000000000000000000000 + 6.7938075065612793000000000000000000000000000000000 + 10.023477554321289000000000000000000000000000000000 + 3.6154383428745996706772556069431792744372398748422 + nu = 1.00000, sum = 0.124990, exact = 0.125000 + Throw exception Error in function boost::math::cyl_bessel_j_zero(double, int): Order argument is -1, but must be >= 0 ! + Throw exception Error in function boost::math::cyl_bessel_j_zero(long double, int): Order argument is 1.#INF, but must be finite >= 0 ! + Throw exception Error in function boost::math::cyl_bessel_j_zero(long double, int): Order argument is 1.#QNAN, but must be finite >= 0 ! + Throw exception Error in function boost::math::cyl_bessel_j_zero(long double, int): Requested the -1'th zero, but must be > 0 ! + Throw exception Error in function boost::math::cyl_bessel_j_zero(long double, int): Requested the -2147483648'th zero, but must be > 0 ! + Throw exception Error in function boost::math::cyl_bessel_j_zero(long double, int): Requested the -2147483648'th zero, but must be > 0 ! + + +] [/bessel_zero_output] +*/ + diff --git a/src/boost/libs/math/example/bessel_zeros_example_1.cpp b/src/boost/libs/math/example/bessel_zeros_example_1.cpp new file mode 100644 index 00000000..59172cd0 --- /dev/null +++ b/src/boost/libs/math/example/bessel_zeros_example_1.cpp @@ -0,0 +1,213 @@ + +// Copyright Christopher Kormanyos 2013. +// Copyright Paul A. Bristow 2013. +// Copyright John Maddock 2013. + +// Distributed under 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). + +#ifdef _MSC_VER +# pragma warning (disable : 4512) // assignment operator could not be generated. +# pragma warning (disable : 4996) // assignment operator could not be generated. +#endif + +#include +#include +#include +#include +#include +#include + +// Weisstein, Eric W. "Bessel Function Zeros." From MathWorld--A Wolfram Web Resource. +// http://mathworld.wolfram.com/BesselFunctionZeros.html +// Test values can be calculated using [@wolframalpha.com WolframAplha] +// See also http://dlmf.nist.gov/10.21 + +//[bessel_zeros_example_1 + +/*`This example demonstrates calculating zeros of the Bessel and Neumann functions. +It also shows how Boost.Math and Boost.Multiprecision can be combined to provide +a many decimal digit precision. For 50 decimal digit precision we need to include +*/ + + #include + +/*`and a `typedef` for `float_type` may be convenient +(allowing a quick switch to re-compute at built-in `double` or other precision) +*/ + typedef boost::multiprecision::cpp_dec_float_50 float_type; + +//`To use the functions for finding zeros of the functions we need + + #include + +//`This file includes the forward declaration signatures for the zero-finding functions: + +// #include + +/*`but more details are in the full documentation, for example at +[@http://www.boost.org/doc/libs/1_53_0/libs/math/doc/sf_and_dist/html/math_toolkit/special/bessel/bessel_over.html Boost.Math Bessel functions]. +*/ + +/*`This example shows obtaining both a single zero of the Bessel function, +and then placing multiple zeros into a container like `std::vector` by providing an iterator. +*/ +//] [/bessel_zeros_example_1] + +/*The signature of the single value function is: + + template + inline typename detail::bessel_traits >::result_type + cyl_bessel_j_zero( + T v, // Floating-point value for Jv. + int m); // start index. + +The result type is controlled by the floating-point type of parameter `v` +(but subject to the usual __precision_policy and __promotion_policy). + +The signature of multiple zeros function is: + + template + inline OutputIterator cyl_bessel_j_zero( + T v, // Floating-point value for Jv. + int start_index, // 1-based start index. + unsigned number_of_zeros, // How many zeros to generate + OutputIterator out_it); // Destination for zeros. + +There is also a version which allows control of the __policy_section for error handling and precision. + + template + inline OutputIterator cyl_bessel_j_zero( + T v, // Floating-point value for Jv. + int start_index, // 1-based start index. + unsigned number_of_zeros, // How many zeros to generate + OutputIterator out_it, // Destination for zeros. + const Policy& pol); // Policy to use. +*/ + +int main() +{ + try + { +//[bessel_zeros_example_2 + +/*`[tip It is always wise to place code using Boost.Math inside try'n'catch blocks; +this will ensure that helpful error messages are shown when exceptional conditions arise.] + +First, evaluate a single Bessel zero. + +The precision is controlled by the float-point type of template parameter `T` of `v` +so this example has `double` precision, at least 15 but up to 17 decimal digits (for the common 64-bit double). +*/ +// double root = boost::math::cyl_bessel_j_zero(0.0, 1); +// // Displaying with default precision of 6 decimal digits: +// std::cout << "boost::math::cyl_bessel_j_zero(0.0, 1) " << root << std::endl; // 2.40483 +// // And with all the guaranteed (15) digits: +// std::cout.precision(std::numeric_limits::digits10); +// std::cout << "boost::math::cyl_bessel_j_zero(0.0, 1) " << root << std::endl; // 2.40482555769577 +/*`But note that because the parameter `v` controls the precision of the result, +`v` [*must be a floating-point type]. +So if you provide an integer type, say 0, rather than 0.0, then it will fail to compile thus: +`` + root = boost::math::cyl_bessel_j_zero(0, 1); +`` +with this error message +`` + error C2338: Order must be a floating-point type. +`` + +Optionally, we can use a policy to ignore errors, C-style, returning some value, +perhaps infinity or NaN, or the best that can be done. (See __user_error_handling). + +To create a (possibly unwise!) policy `ignore_all_policy` that ignores all errors: +*/ + + typedef boost::math::policies::policy< + boost::math::policies::domain_error, + boost::math::policies::overflow_error, + boost::math::policies::underflow_error, + boost::math::policies::denorm_error, + boost::math::policies::pole_error, + boost::math::policies::evaluation_error + > ignore_all_policy; + //`Examples of use of this `ignore_all_policy` are + + double inf = std::numeric_limits::infinity(); + double nan = std::numeric_limits::quiet_NaN(); + + double dodgy_root = boost::math::cyl_bessel_j_zero(-1.0, 1, ignore_all_policy()); + std::cout << "boost::math::cyl_bessel_j_zero(-1.0, 1) " << dodgy_root << std::endl; // 1.#QNAN + double inf_root = boost::math::cyl_bessel_j_zero(inf, 1, ignore_all_policy()); + std::cout << "boost::math::cyl_bessel_j_zero(inf, 1) " << inf_root << std::endl; // 1.#QNAN + double nan_root = boost::math::cyl_bessel_j_zero(nan, 1, ignore_all_policy()); + std::cout << "boost::math::cyl_bessel_j_zero(nan, 1) " << nan_root << std::endl; // 1.#QNAN + +/*`Another version of `cyl_bessel_j_zero` allows calculation of multiple zeros with one call, +placing the results in a container, often `std::vector`. +For example, generate and display the first five `double` roots of J[sub v] for integral order 2, +as column ['J[sub 2](x)] in table 1 of +[@ http://mathworld.wolfram.com/BesselFunctionZeros.html Wolfram Bessel Function Zeros]. +*/ + unsigned int n_roots = 5U; + std::vector roots; + boost::math::cyl_bessel_j_zero(2.0, 1, n_roots, std::back_inserter(roots)); + std::copy(roots.begin(), + roots.end(), + std::ostream_iterator(std::cout, "\n")); + +/*`Or we can use Boost.Multiprecision to generate 50 decimal digit roots of ['J[sub v]] +for non-integral order `v= 71/19 == 3.736842`, expressed as an exact-integer fraction +to generate the most accurate value possible for all floating-point types. + +We set the precision of the output stream, and show trailing zeros to display a fixed 50 decimal digits. +*/ + std::cout.precision(std::numeric_limits::digits10); // 50 decimal digits. + std::cout << std::showpoint << std::endl; // Show trailing zeros. + + float_type x = float_type(71) / 19; + float_type r = boost::math::cyl_bessel_j_zero(x, 1); // 1st root. + std::cout << "x = " << x << ", r = " << r << std::endl; + + r = boost::math::cyl_bessel_j_zero(x, 20U); // 20th root. + std::cout << "x = " << x << ", r = " << r << std::endl; + + std::vector zeros; + boost::math::cyl_bessel_j_zero(x, 1, 3, std::back_inserter(zeros)); + + std::cout << "cyl_bessel_j_zeros" << std::endl; + // Print the roots to the output stream. + std::copy(zeros.begin(), zeros.end(), + std::ostream_iterator(std::cout, "\n")); +//] [/bessel_zeros_example_2] + } + catch (std::exception const& ex) + { + std::cout << "Thrown exception " << ex.what() << std::endl; + } + + } // int main() + + /* + + Output: + + Description: Autorun "J:\Cpp\big_number\Debug\bessel_zeros_example_1.exe" + boost::math::cyl_bessel_j_zero(-1.0, 1) 3.83171 + boost::math::cyl_bessel_j_zero(inf, 1) 1.#QNAN + boost::math::cyl_bessel_j_zero(nan, 1) 1.#QNAN + 5.13562 + 8.41724 + 11.6198 + 14.796 + 17.9598 + + x = 3.7368421052631578947368421052631578947368421052632, r = 7.2731751938316489503185694262290765588963196701623 + x = 3.7368421052631578947368421052631578947368421052632, r = 67.815145619696290925556791375555951165111460585458 + cyl_bessel_j_zeros + 7.2731751938316489503185694262290765588963196701623 + 10.724858308883141732536172745851416647110749599085 + 14.018504599452388106120459558042660282427471931581 + +*/ + diff --git a/src/boost/libs/math/example/bessel_zeros_interator_example.cpp b/src/boost/libs/math/example/bessel_zeros_interator_example.cpp new file mode 100644 index 00000000..a92a2704 --- /dev/null +++ b/src/boost/libs/math/example/bessel_zeros_interator_example.cpp @@ -0,0 +1,88 @@ +// Copyright Christopher Kormanyos 2013. +// Copyright Paul A. Bristow 2013. +// Copyright John Maddock 2013. + +// Distributed under 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). + +#ifdef _MSC_VER +# pragma warning (disable : 4512) // assignment operator could not be generated. +# pragma warning (disable : 4996) // assignment operator could not be generated. +#endif + +#include +#include +#include +#include +#include +#include + +//[bessel_zeros_iterator_example_1 + +/*`[h5 Using Output Iterator to sum zeros of Bessel Functions] + +This example demonstrates summing zeros of the Bessel functions. +To use the functions for finding zeros of the functions we need + */ + +#include + +/*`We use the `cyl_bessel_j_zero` output iterator parameter `out_it` +to create a sum of ['1/zeros[super 2]] by defining a custom output iterator: +*/ + +template +struct output_summation_iterator +{ + output_summation_iterator(T* p) : p_sum(p) + {} + output_summation_iterator& operator*() + { return *this; } + output_summation_iterator& operator++() + { return *this; } + output_summation_iterator& operator++(int) + { return *this; } + output_summation_iterator& operator = (T const& val) + { + *p_sum += 1./ (val * val); // Summing 1/zero^2. + return *this; + } +private: + T* p_sum; +}; + +//] [/bessel_zeros_iterator_example_1] + +int main() +{ + try + { +//[bessel_zeros_iterator_example_2 + +/*`The sum is calculated for many values, converging on the analytical exact value of `1/8`. +*/ + using boost::math::cyl_bessel_j_zero; + double nu = 1.; + double sum = 0; + output_summation_iterator it(&sum); // sum of 1/zeros^2 + cyl_bessel_j_zero(nu, 1, 10000, it); + + double s = 1/(4 * (nu + 1)); // 0.125 = 1/8 is exact analytical solution. + std::cout << std::setprecision(6) << "nu = " << nu << ", sum = " << sum + << ", exact = " << s << std::endl; + // nu = 1.00000, sum = 0.124990, exact = 0.125000 +//] [/bessel_zeros_iterator_example_2] + } + catch (std::exception const& ex) + { + std::cout << "Thrown exception " << ex.what() << std::endl; + } + return 0; + } // int_main() + +/* + Output: + + nu = 1, sum = 0.12499, exact = 0.125 +*/ diff --git a/src/boost/libs/math/example/big_seventh.cpp b/src/boost/libs/math/example/big_seventh.cpp new file mode 100644 index 00000000..58c55901 --- /dev/null +++ b/src/boost/libs/math/example/big_seventh.cpp @@ -0,0 +1,98 @@ +// 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) + +// Copyright Paul A. Bristow 2012. +// Copyright Christopher Kormanyos 2012. + +// This file is written to be included from a Quickbook .qbk document. +// It can be compiled by the C++ compiler, and run. Any output can +// also be added here as comment or included or pasted in elsewhere. +// Caution: this file contains Quickbook markup as well as code +// and comments: don't change any of the special comment markups! + +#ifdef _MSC_VER +# pragma warning (disable : 4512) // assignment operator could not be generated. +# pragma warning (disable : 4996) +#endif + +//[big_seventh_example_1 + +/*`[h5 Using Boost.Multiprecision `cpp_float` for numerical calculations with high precision.] + +The Boost.Multiprecision library can be used for computations requiring precision +exceeding that of standard built-in types such as float, double +and long double. For extended-precision calculations, Boost.Multiprecision +supplies a template data type called cpp_dec_float. The number of decimal +digits of precision is fixed at compile-time via template parameter. + +To use these floating-point types and constants, we need some includes: + +*/ + +#include + +#include +// using boost::multiprecision::cpp_dec_float + +#include +#include + +/*` So now we can demonstrate with some trivial calculations: +*/ + +//] //[big_seventh_example_1] + +int main() +{ + +//[big_seventh_example_2 +/*`Using `typedef cpp_dec_float_50` hides the complexity of multiprecision, +allows us to define variables with 50 decimal digit precision just like built-in `double`. +*/ + using boost::multiprecision::cpp_dec_float_50; + + cpp_dec_float_50 seventh = cpp_dec_float_50(1) / 7; // 1 / 7 + +/*`By default, output would only show the standard 6 decimal digits, + so set precision to show all 50 significant digits, including any trailing zeros. +*/ + std::cout.precision(std::numeric_limits::digits10); + std::cout << std::showpoint << std::endl; // Append any trailing zeros. + std::cout << seventh << std::endl; +/*`which outputs: + + 0.14285714285714285714285714285714285714285714285714 + +We can also use Boost.Math __constants like [pi], +guaranteed to be initialized with the very last bit of precision for the floating-point type. +*/ + + std::cout << "pi = " << boost::math::constants::pi() << std::endl; + cpp_dec_float_50 circumference = boost::math::constants::pi() * 2 * seventh; + std::cout << "c = "<< circumference << std::endl; + +/*`which outputs + + pi = 3.1415926535897932384626433832795028841971693993751 + + c = 0.89759790102565521098932668093700082405633411410717 +*/ +//] [/big_seventh_example_2] + + return 0; +} // int main() + + +/* +//[big_seventh_example_output + +0.14285714285714285714285714285714285714285714285714 +pi = 3.1415926535897932384626433832795028841971693993751 +c = 0.89759790102565521098932668093700082405633411410717 + +//] //[big_seventh_example_output] + +*/ + diff --git a/src/boost/libs/math/example/binomial_coinflip_example.cpp b/src/boost/libs/math/example/binomial_coinflip_example.cpp new file mode 100644 index 00000000..14940cb9 --- /dev/null +++ b/src/boost/libs/math/example/binomial_coinflip_example.cpp @@ -0,0 +1,243 @@ +// Copyright Paul A. 2007, 2010 +// Copyright John Maddock 2006 + +// 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) + +// Simple example of computing probabilities and quantiles for +// a Bernoulli random variable representing the flipping of a coin. + +// http://mathworld.wolfram.com/CoinTossing.html +// http://en.wikipedia.org/wiki/Bernoulli_trial +// Weisstein, Eric W. "Dice." From MathWorld--A Wolfram Web Resource. +// http://mathworld.wolfram.com/Dice.html +// http://en.wikipedia.org/wiki/Bernoulli_distribution +// http://mathworld.wolfram.com/BernoulliDistribution.html +// +// An idealized coin consists of a circular disk of zero thickness which, +// when thrown in the air and allowed to fall, will rest with either side face up +// ("heads" H or "tails" T) with equal probability. A coin is therefore a two-sided die. +// Despite slight differences between the sides and nonzero thickness of actual coins, +// the distribution of their tosses makes a good approximation to a p==1/2 Bernoulli distribution. + +//[binomial_coinflip_example1 + +/*`An example of a [@http://en.wikipedia.org/wiki/Bernoulli_process Bernoulli process] +is coin flipping. +A variable in such a sequence may be called a Bernoulli variable. + +This example shows using the Binomial distribution to predict the probability +of heads and tails when throwing a coin. + +The number of correct answers (say heads), +X, is distributed as a binomial random variable +with binomial distribution parameters number of trials (flips) n = 10 and probability (success_fraction) of getting a head p = 0.5 (a 'fair' coin). + +(Our coin is assumed fair, but we could easily change the success_fraction parameter p +from 0.5 to some other value to simulate an unfair coin, +say 0.6 for one with chewing gum on the tail, +so it is more likely to fall tails down and heads up). + +First we need some includes and using statements to be able to use the binomial distribution, some std input and output, and get started: +*/ + +#include + using boost::math::binomial; + +#include + using std::cout; using std::endl; using std::left; +#include + using std::setw; + +int main() +{ + cout << "Using Binomial distribution to predict how many heads and tails." << endl; + try + { +/*` +See note [link coinflip_eg_catch with the catch block] +about why a try and catch block is always a good idea. + +First, construct a binomial distribution with parameters success_fraction +1/2, and how many flips. +*/ + const double success_fraction = 0.5; // = 50% = 1/2 for a 'fair' coin. + int flips = 10; + binomial flip(flips, success_fraction); + + cout.precision(4); +/*` + Then some examples of using Binomial moments (and echoing the parameters). +*/ + cout << "From " << flips << " one can expect to get on average " + << mean(flip) << " heads (or tails)." << endl; + cout << "Mode is " << mode(flip) << endl; + cout << "Standard deviation is " << standard_deviation(flip) << endl; + cout << "So about 2/3 will lie within 1 standard deviation and get between " + << ceil(mean(flip) - standard_deviation(flip)) << " and " + << floor(mean(flip) + standard_deviation(flip)) << " correct." << endl; + cout << "Skewness is " << skewness(flip) << endl; + // Skewness of binomial distributions is only zero (symmetrical) + // if success_fraction is exactly one half, + // for example, when flipping 'fair' coins. + cout << "Skewness if success_fraction is " << flip.success_fraction() + << " is " << skewness(flip) << endl << endl; // Expect zero for a 'fair' coin. +/*` +Now we show a variety of predictions on the probability of heads: +*/ + cout << "For " << flip.trials() << " coin flips: " << endl; + cout << "Probability of getting no heads is " << pdf(flip, 0) << endl; + cout << "Probability of getting at least one head is " << 1. - pdf(flip, 0) << endl; +/*` +When we want to calculate the probability for a range or values we can sum the PDF's: +*/ + cout << "Probability of getting 0 or 1 heads is " + << pdf(flip, 0) + pdf(flip, 1) << endl; // sum of exactly == probabilities +/*` +Or we can use the cdf. +*/ + cout << "Probability of getting 0 or 1 (<= 1) heads is " << cdf(flip, 1) << endl; + cout << "Probability of getting 9 or 10 heads is " << pdf(flip, 9) + pdf(flip, 10) << endl; +/*` +Note that using +*/ + cout << "Probability of getting 9 or 10 heads is " << 1. - cdf(flip, 8) << endl; +/*` +is less accurate than using the complement +*/ + cout << "Probability of getting 9 or 10 heads is " << cdf(complement(flip, 8)) << endl; +/*` +Since the subtraction may involve +[@http://docs.sun.com/source/806-3568/ncg_goldberg.html cancellation error], +where as `cdf(complement(flip, 8))` +does not use such a subtraction internally, and so does not exhibit the problem. + +To get the probability for a range of heads, we can either add the pdfs for each number of heads +*/ + cout << "Probability of between 4 and 6 heads (4 or 5 or 6) is " + // P(X == 4) + P(X == 5) + P(X == 6) + << pdf(flip, 4) + pdf(flip, 5) + pdf(flip, 6) << endl; +/*` +But this is probably less efficient than using the cdf +*/ + cout << "Probability of between 4 and 6 heads (4 or 5 or 6) is " + // P(X <= 6) - P(X <= 3) == P(X < 4) + << cdf(flip, 6) - cdf(flip, 3) << endl; +/*` +Certainly for a bigger range like, 3 to 7 +*/ + cout << "Probability of between 3 and 7 heads (3, 4, 5, 6 or 7) is " + // P(X <= 7) - P(X <= 2) == P(X < 3) + << cdf(flip, 7) - cdf(flip, 2) << endl; + cout << endl; + +/*` +Finally, print two tables of probability for the /exactly/ and /at least/ a number of heads. +*/ + // Print a table of probability for the exactly a number of heads. + cout << "Probability of getting exactly (==) heads" << endl; + for (int successes = 0; successes <= flips; successes++) + { // Say success means getting a head (or equally success means getting a tail). + double probability = pdf(flip, successes); + cout << left << setw(2) << successes << " " << setw(10) + << probability << " or 1 in " << 1. / probability + << ", or " << probability * 100. << "%" << endl; + } // for i + cout << endl; + + // Tabulate the probability of getting between zero heads and 0 upto 10 heads. + cout << "Probability of getting upto (<=) heads" << endl; + for (int successes = 0; successes <= flips; successes++) + { // Say success means getting a head + // (equally success could mean getting a tail). + double probability = cdf(flip, successes); // P(X <= heads) + cout << setw(2) << successes << " " << setw(10) << left + << probability << " or 1 in " << 1. / probability << ", or " + << probability * 100. << "%"<< endl; + } // for i +/*` +The last (0 to 10 heads) must, of course, be 100% probability. +*/ + double probability = 0.3; + double q = quantile(flip, probability); + std::cout << "Quantile (flip, " << probability << ") = " << q << std::endl; // Quantile (flip, 0.3) = 3 + probability = 0.6; + q = quantile(flip, probability); + std::cout << "Quantile (flip, " << probability << ") = " << q << std::endl; // Quantile (flip, 0.6) = 5 + } + catch(const std::exception& e) + { + // + /*` + [#coinflip_eg_catch] + It is always essential to include try & catch blocks because + default policies are to throw exceptions on arguments that + are out of domain or cause errors like numeric-overflow. + + Lacking try & catch blocks, the program will abort, whereas the + message below from the thrown exception will give some helpful + clues as to the cause of the problem. + */ + std::cout << + "\n""Message from thrown exception was:\n " << e.what() << std::endl; + } +//] [binomial_coinflip_example1] + return 0; +} // int main() + +// Output: + +//[binomial_coinflip_example_output +/*` + +[pre +Using Binomial distribution to predict how many heads and tails. +From 10 one can expect to get on average 5 heads (or tails). +Mode is 5 +Standard deviation is 1.581 +So about 2/3 will lie within 1 standard deviation and get between 4 and 6 correct. +Skewness is 0 +Skewness if success_fraction is 0.5 is 0 + +For 10 coin flips: +Probability of getting no heads is 0.0009766 +Probability of getting at least one head is 0.999 +Probability of getting 0 or 1 heads is 0.01074 +Probability of getting 0 or 1 (<= 1) heads is 0.01074 +Probability of getting 9 or 10 heads is 0.01074 +Probability of getting 9 or 10 heads is 0.01074 +Probability of getting 9 or 10 heads is 0.01074 +Probability of between 4 and 6 heads (4 or 5 or 6) is 0.6562 +Probability of between 4 and 6 heads (4 or 5 or 6) is 0.6563 +Probability of between 3 and 7 heads (3, 4, 5, 6 or 7) is 0.8906 + +Probability of getting exactly (==) heads +0 0.0009766 or 1 in 1024, or 0.09766% +1 0.009766 or 1 in 102.4, or 0.9766% +2 0.04395 or 1 in 22.76, or 4.395% +3 0.1172 or 1 in 8.533, or 11.72% +4 0.2051 or 1 in 4.876, or 20.51% +5 0.2461 or 1 in 4.063, or 24.61% +6 0.2051 or 1 in 4.876, or 20.51% +7 0.1172 or 1 in 8.533, or 11.72% +8 0.04395 or 1 in 22.76, or 4.395% +9 0.009766 or 1 in 102.4, or 0.9766% +10 0.0009766 or 1 in 1024, or 0.09766% + +Probability of getting upto (<=) heads +0 0.0009766 or 1 in 1024, or 0.09766% +1 0.01074 or 1 in 93.09, or 1.074% +2 0.05469 or 1 in 18.29, or 5.469% +3 0.1719 or 1 in 5.818, or 17.19% +4 0.377 or 1 in 2.653, or 37.7% +5 0.623 or 1 in 1.605, or 62.3% +6 0.8281 or 1 in 1.208, or 82.81% +7 0.9453 or 1 in 1.058, or 94.53% +8 0.9893 or 1 in 1.011, or 98.93% +9 0.999 or 1 in 1.001, or 99.9% +10 1 or 1 in 1, or 100% +] +*/ +//][/binomial_coinflip_example_output] diff --git a/src/boost/libs/math/example/binomial_confidence_limits.cpp b/src/boost/libs/math/example/binomial_confidence_limits.cpp new file mode 100644 index 00000000..56ab48c3 --- /dev/null +++ b/src/boost/libs/math/example/binomial_confidence_limits.cpp @@ -0,0 +1,165 @@ +// Copyright John Maddock 2006 +// Copyright Paul A. Bristow 2010 + +// 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) + +#ifdef _MSC_VER +# pragma warning(disable: 4512) // assignment operator could not be generated. +# pragma warning(disable: 4510) // default constructor could not be generated. +# pragma warning(disable: 4610) // can never be instantiated - user defined constructor required. +#endif + +#include +using std::cout; using std::endl; +#include +using std::fixed; using std::left; using std::right; using std::right; using std::setw; +using std::setprecision; + +#include + +void confidence_limits_on_frequency(unsigned trials, unsigned successes) +{ + // + // trials = Total number of trials. + // successes = Total number of observed successes. + // + // Calculate confidence limits for an observed + // frequency of occurrence that follows a binomial distribution. + // + //using namespace std; // Avoid + // using namespace boost::math; // potential name ambiguity with std + using boost::math::binomial_distribution; + + // Print out general info: + cout << + "___________________________________________\n" + "2-Sided Confidence Limits For Success Ratio\n" + "___________________________________________\n\n"; + cout << setprecision(7); + cout << setw(40) << left << "Number of Observations" << "= " << trials << "\n"; + cout << setw(40) << left << "Number of successes" << "= " << successes << "\n"; + cout << setw(40) << left << "Sample frequency of occurrence" << "= " << double(successes) / trials << "\n"; + // + // Define a table of significance levels: + // + double alpha[] = { 0.5, 0.25, 0.1, 0.05, 0.01, 0.001, 0.0001, 0.00001 }; + // + // Print table header: + // + cout << "\n\n" + "_______________________________________________________________________\n" + "Confidence Lower CP Upper CP Lower JP Upper JP\n" + " Value (%) Limit Limit Limit Limit\n" + "_______________________________________________________________________\n"; + // + // Now print out the data for the table rows. + // + for(unsigned i = 0; i < sizeof(alpha)/sizeof(alpha[0]); ++i) + { + // Confidence value: + cout << fixed << setprecision(3) << setw(10) << right << 100 * (1-alpha[i]); + // Calculate Clopper Pearson bounds: + double l = binomial_distribution<>::find_lower_bound_on_p(trials, successes, alpha[i]/2); + double u = binomial_distribution<>::find_upper_bound_on_p(trials, successes, alpha[i]/2); + // Print Clopper Pearson Limits: + cout << fixed << setprecision(5) << setw(15) << right << l; + cout << fixed << setprecision(5) << setw(15) << right << u; + // Calculate Jeffreys Prior Bounds: + l = binomial_distribution<>::find_lower_bound_on_p(trials, successes, alpha[i]/2, binomial_distribution<>::jeffreys_prior_interval); + u = binomial_distribution<>::find_upper_bound_on_p(trials, successes, alpha[i]/2, binomial_distribution<>::jeffreys_prior_interval); + // Print Jeffreys Prior Limits: + cout << fixed << setprecision(5) << setw(15) << right << l; + cout << fixed << setprecision(5) << setw(15) << right << u << std::endl; + } + cout << endl; +} // void confidence_limits_on_frequency() + +int main() +{ + confidence_limits_on_frequency(20, 4); + confidence_limits_on_frequency(200, 40); + confidence_limits_on_frequency(2000, 400); + + return 0; +} // int main() + +/* + +------ Build started: Project: binomial_confidence_limits, Configuration: Debug Win32 ------ +Compiling... +binomial_confidence_limits.cpp +Linking... +Autorun "i:\boost-06-05-03-1300\libs\math\test\Math_test\debug\binomial_confidence_limits.exe" +___________________________________________ +2-Sided Confidence Limits For Success Ratio +___________________________________________ + +Number of Observations = 20 +Number of successes = 4 +Sample frequency of occurrence = 0.2 + + +_______________________________________________________________________ +Confidence Lower CP Upper CP Lower JP Upper JP + Value (%) Limit Limit Limit Limit +_______________________________________________________________________ + 50.000 0.12840 0.29588 0.14974 0.26916 + 75.000 0.09775 0.34633 0.11653 0.31861 + 90.000 0.07135 0.40103 0.08734 0.37274 + 95.000 0.05733 0.43661 0.07152 0.40823 + 99.000 0.03576 0.50661 0.04655 0.47859 + 99.900 0.01905 0.58632 0.02634 0.55960 + 99.990 0.01042 0.64997 0.01530 0.62495 + 99.999 0.00577 0.70216 0.00901 0.67897 + +___________________________________________ +2-Sided Confidence Limits For Success Ratio +___________________________________________ + +Number of Observations = 200 +Number of successes = 40 +Sample frequency of occurrence = 0.2000000 + + +_______________________________________________________________________ +Confidence Lower CP Upper CP Lower JP Upper JP + Value (%) Limit Limit Limit Limit +_______________________________________________________________________ + 50.000 0.17949 0.22259 0.18190 0.22001 + 75.000 0.16701 0.23693 0.16934 0.23429 + 90.000 0.15455 0.25225 0.15681 0.24956 + 95.000 0.14689 0.26223 0.14910 0.25951 + 99.000 0.13257 0.28218 0.13468 0.27940 + 99.900 0.11703 0.30601 0.11902 0.30318 + 99.990 0.10489 0.32652 0.10677 0.32366 + 99.999 0.09492 0.34485 0.09670 0.34197 + +___________________________________________ +2-Sided Confidence Limits For Success Ratio +___________________________________________ + +Number of Observations = 2000 +Number of successes = 400 +Sample frequency of occurrence = 0.2000000 + + +_______________________________________________________________________ +Confidence Lower CP Upper CP Lower JP Upper JP + Value (%) Limit Limit Limit Limit +_______________________________________________________________________ + 50.000 0.19382 0.20638 0.19406 0.20613 + 75.000 0.18965 0.21072 0.18990 0.21047 + 90.000 0.18537 0.21528 0.18561 0.21503 + 95.000 0.18267 0.21821 0.18291 0.21796 + 99.000 0.17745 0.22400 0.17769 0.22374 + 99.900 0.17150 0.23079 0.17173 0.23053 + 99.990 0.16658 0.23657 0.16681 0.23631 + 99.999 0.16233 0.24169 0.16256 0.24143 + +*/ + + + diff --git a/src/boost/libs/math/example/binomial_example_nag.cpp b/src/boost/libs/math/example/binomial_example_nag.cpp new file mode 100644 index 00000000..c1d7ee35 --- /dev/null +++ b/src/boost/libs/math/example/binomial_example_nag.cpp @@ -0,0 +1,91 @@ +// Copyright Paul A. 2007, 2010 +// Copyright John Maddock 2007 +// 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) + +// Simple example of computing probabilities for a binomial random variable. +// Replication of source nag_binomial_dist (g01bjc). + +// Shows how to replace NAG C library calls by Boost Math Toolkit C++ calls. +// Note that the default policy does not replicate the way that NAG +// library calls handle 'bad' arguments, but you can define policies that do, +// as well as other policies that may suit your application even better. +// See the examples of changing default policies for details. + +#include + +#include + using std::cout; using std::endl; using std::ios; using std::showpoint; +#include + using std::fixed; using std::setw; + +int main() +{ + cout << "Using the binomial distribution to replicate a NAG library call." << endl; + using boost::math::binomial_distribution; + + // This replicates the computation of the examples of using nag-binomial_dist + // using g01bjc in section g01 Somple Calculations on Statistical Data. + // http://www.nag.co.uk/numeric/cl/manual/pdf/G01/g01bjc.pdf + // Program results section 8.3 page 3.g01bjc.3 + //8.2. Program Data + //g01bjc Example Program Data + //4 0.50 2 : n, p, k + //19 0.44 13 + //100 0.75 67 + //2000 0.33 700 + //8.3. Program Results + //g01bjc Example Program Results + //n p k plek pgtk peqk + //4 0.500 2 0.68750 0.31250 0.37500 + //19 0.440 13 0.99138 0.00862 0.01939 + //100 0.750 67 0.04460 0.95540 0.01700 + //2000 0.330 700 0.97251 0.02749 0.00312 + + cout.setf(ios::showpoint); // Trailing zeros to show significant decimal digits. + cout.precision(5); // Might calculate this from trials in distribution? + cout << fixed; + // Binomial distribution. + + // Note that cdf(dist, k) is equivalent to NAG library plek probability of <= k + // cdf(complement(dist, k)) is equivalent to NAG library pgtk probability of > k + // pdf(dist, k) is equivalent to NAG library peqk probability of == k + + cout << " n p k plek pgtk peqk " << endl; + binomial_distribution<>my_dist(4, 0.5); + cout << setw(4) << (int)my_dist.trials() << " " << my_dist.success_fraction() + << " " << 2 << " " << cdf(my_dist, 2) << " " + << cdf(complement(my_dist, 2)) << " " << pdf(my_dist, 2) << endl; + + binomial_distribution<>two(19, 0.440); + cout << setw(4) << (int)two.trials() << " " << two.success_fraction() + << " " << 13 << " " << cdf(two, 13) << " " + << cdf(complement(two, 13)) << " " << pdf(two, 13) << endl; + + binomial_distribution<>three(100, 0.750); + cout << setw(4) << (int)three.trials() << " " << three.success_fraction() + << " " << 67 << " " << cdf(three, 67) << " " << cdf(complement(three, 67)) + << " " << pdf(three, 67) << endl; + binomial_distribution<>four(2000, 0.330); + cout << setw(4) << (int)four.trials() << " " << four.success_fraction() + << " " << 700 << " " + << cdf(four, 700) << " " << cdf(complement(four, 700)) + << " " << pdf(four, 700) << endl; + + return 0; +} // int main() + +/* + +Example of using the binomial distribution to replicate a NAG library call. + n p k plek pgtk peqk + 4 0.50000 2 0.68750 0.31250 0.37500 + 19 0.44000 13 0.99138 0.00862 0.01939 + 100 0.75000 67 0.04460 0.95540 0.01700 +2000 0.33000 700 0.97251 0.02749 0.00312 + + + */ + diff --git a/src/boost/libs/math/example/binomial_quiz_example.cpp b/src/boost/libs/math/example/binomial_quiz_example.cpp new file mode 100644 index 00000000..acf06e2d --- /dev/null +++ b/src/boost/libs/math/example/binomial_quiz_example.cpp @@ -0,0 +1,525 @@ +// Copyright Paul A. Bristow 2007, 2009, 2010 +// Copyright John Maddock 2006 + +// 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) + +// binomial_examples_quiz.cpp + +// Simple example of computing probabilities and quantiles for a binomial random variable +// representing the correct guesses on a multiple-choice test. + +// source http://www.stat.wvu.edu/SRS/Modules/Binomial/test.html + +//[binomial_quiz_example1 +/*` +A multiple choice test has four possible answers to each of 16 questions. +A student guesses the answer to each question, +so the probability of getting a correct answer on any given question is +one in four, a quarter, 1/4, 25% or fraction 0.25. +The conditions of the binomial experiment are assumed to be met: +n = 16 questions constitute the trials; +each question results in one of two possible outcomes (correct or incorrect); +the probability of being correct is 0.25 and is constant if no knowledge about the subject is assumed; +the questions are answered independently if the student's answer to a question +in no way influences his/her answer to another question. + +First, we need to be able to use the binomial distribution constructor +(and some std input/output, of course). +*/ + +#include + using boost::math::binomial; + +#include + using std::cout; using std::endl; + using std::ios; using std::flush; using std::left; using std::right; using std::fixed; +#include + using std::setw; using std::setprecision; +#include + + + +//][/binomial_quiz_example1] + +int main() +{ + try + { + cout << "Binomial distribution example - guessing in a quiz." << endl; +//[binomial_quiz_example2 +/*` +The number of correct answers, X, is distributed as a binomial random variable +with binomial distribution parameters: questions n and success fraction probability p. +So we construct a binomial distribution: +*/ + int questions = 16; // All the questions in the quiz. + int answers = 4; // Possible answers to each question. + double success_fraction = 1. / answers; // If a random guess, p = 1/4 = 0.25. + binomial quiz(questions, success_fraction); +/*` +and display the distribution parameters we used thus: +*/ + cout << "In a quiz with " << quiz.trials() + << " questions and with a probability of guessing right of " + << quiz.success_fraction() * 100 << " %" + << " or 1 in " << static_cast(1. / quiz.success_fraction()) << endl; +/*` +Show a few probabilities of just guessing: +*/ + cout << "Probability of getting none right is " << pdf(quiz, 0) << endl; // 0.010023 + cout << "Probability of getting exactly one right is " << pdf(quiz, 1) << endl; + cout << "Probability of getting exactly two right is " << pdf(quiz, 2) << endl; + int pass_score = 11; + cout << "Probability of getting exactly " << pass_score << " answers right by chance is " + << pdf(quiz, pass_score) << endl; + cout << "Probability of getting all " << questions << " answers right by chance is " + << pdf(quiz, questions) << endl; +/*` +[pre +Probability of getting none right is 0.0100226 +Probability of getting exactly one right is 0.0534538 +Probability of getting exactly two right is 0.133635 +Probability of getting exactly 11 right is 0.000247132 +Probability of getting exactly all 16 answers right by chance is 2.32831e-010 +] +These don't give any encouragement to guessers! + +We can tabulate the 'getting exactly right' ( == ) probabilities thus: +*/ + cout << "\n" "Guessed Probability" << right << endl; + for (int successes = 0; successes <= questions; successes++) + { + double probability = pdf(quiz, successes); + cout << setw(2) << successes << " " << probability << endl; + } + cout << endl; +/*` +[pre +Guessed Probability + 0 0.0100226 + 1 0.0534538 + 2 0.133635 + 3 0.207876 + 4 0.225199 + 5 0.180159 + 6 0.110097 + 7 0.0524273 + 8 0.0196602 + 9 0.00582526 +10 0.00135923 +11 0.000247132 +12 3.43239e-005 +13 3.5204e-006 +14 2.51457e-007 +15 1.11759e-008 +16 2.32831e-010 +] +Then we can add the probabilities of some 'exactly right' like this: +*/ + cout << "Probability of getting none or one right is " << pdf(quiz, 0) + pdf(quiz, 1) << endl; + +/*` +[pre +Probability of getting none or one right is 0.0634764 +] +But if more than a couple of scores are involved, it is more convenient (and may be more accurate) +to use the Cumulative Distribution Function (cdf) instead: +*/ + cout << "Probability of getting none or one right is " << cdf(quiz, 1) << endl; +/*` +[pre +Probability of getting none or one right is 0.0634764 +] +Since the cdf is inclusive, we can get the probability of getting up to 10 right ( <= ) +*/ + cout << "Probability of getting <= 10 right (to fail) is " << cdf(quiz, 10) << endl; +/*` +[pre +Probability of getting <= 10 right (to fail) is 0.999715 +] +To get the probability of getting 11 or more right (to pass), +it is tempting to use ``1 - cdf(quiz, 10)`` to get the probability of > 10 +*/ + cout << "Probability of getting > 10 right (to pass) is " << 1 - cdf(quiz, 10) << endl; +/*` +[pre +Probability of getting > 10 right (to pass) is 0.000285239 +] +But this should be resisted in favor of using the __complements function (see __why_complements). +*/ + cout << "Probability of getting > 10 right (to pass) is " << cdf(complement(quiz, 10)) << endl; +/*` +[pre +Probability of getting > 10 right (to pass) is 0.000285239 +] +And we can check that these two, <= 10 and > 10, add up to unity. +*/ +BOOST_ASSERT((cdf(quiz, 10) + cdf(complement(quiz, 10))) == 1.); +/*` +If we want a < rather than a <= test, because the CDF is inclusive, we must subtract one from the score. +*/ + cout << "Probability of getting less than " << pass_score + << " (< " << pass_score << ") answers right by guessing is " + << cdf(quiz, pass_score -1) << endl; +/*` +[pre +Probability of getting less than 11 (< 11) answers right by guessing is 0.999715 +] +and similarly to get a >= rather than a > test +we also need to subtract one from the score (and can again check the sum is unity). +This is because if the cdf is /inclusive/, +then its complement must be /exclusive/ otherwise there would be one possible +outcome counted twice! +*/ + cout << "Probability of getting at least " << pass_score + << "(>= " << pass_score << ") answers right by guessing is " + << cdf(complement(quiz, pass_score-1)) + << ", only 1 in " << 1/cdf(complement(quiz, pass_score-1)) << endl; + + BOOST_ASSERT((cdf(quiz, pass_score -1) + cdf(complement(quiz, pass_score-1))) == 1); + +/*` +[pre +Probability of getting at least 11 (>= 11) answers right by guessing is 0.000285239, only 1 in 3505.83 +] +Finally we can tabulate some probabilities: +*/ + cout << "\n" "At most (<=)""\n""Guessed OK Probability" << right << endl; + for (int score = 0; score <= questions; score++) + { + cout << setw(2) << score << " " << setprecision(10) + << cdf(quiz, score) << endl; + } + cout << endl; +/*` +[pre +At most (<=) +Guessed OK Probability + 0 0.01002259576 + 1 0.0634764398 + 2 0.1971110499 + 3 0.4049871101 + 4 0.6301861752 + 5 0.8103454274 + 6 0.9204427481 + 7 0.9728700437 + 8 0.9925302796 + 9 0.9983555346 +10 0.9997147608 +11 0.9999618928 +12 0.9999962167 +13 0.9999997371 +14 0.9999999886 +15 0.9999999998 +16 1 +] +*/ + cout << "\n" "At least (>)""\n""Guessed OK Probability" << right << endl; + for (int score = 0; score <= questions; score++) + { + cout << setw(2) << score << " " << setprecision(10) + << cdf(complement(quiz, score)) << endl; + } +/*` +[pre +At least (>) +Guessed OK Probability + 0 0.9899774042 + 1 0.9365235602 + 2 0.8028889501 + 3 0.5950128899 + 4 0.3698138248 + 5 0.1896545726 + 6 0.07955725188 + 7 0.02712995629 + 8 0.00746972044 + 9 0.001644465374 +10 0.0002852391917 +11 3.810715862e-005 +12 3.783265129e-006 +13 2.628657967e-007 +14 1.140870154e-008 +15 2.328306437e-010 +16 0 +] +We now consider the probabilities of *ranges* of correct guesses. + +First, calculate the probability of getting a range of guesses right, +by adding the exact probabilities of each from low ... high. +*/ + int low = 3; // Getting at least 3 right. + int high = 5; // Getting as most 5 right. + double sum = 0.; + for (int i = low; i <= high; i++) + { + sum += pdf(quiz, i); + } + cout.precision(4); + cout << "Probability of getting between " + << low << " and " << high << " answers right by guessing is " + << sum << endl; // 0.61323 +/*` +[pre +Probability of getting between 3 and 5 answers right by guessing is 0.6132 +] +Or, usually better, we can use the difference of cdfs instead: +*/ + cout << "Probability of getting between " << low << " and " << high << " answers right by guessing is " + << cdf(quiz, high) - cdf(quiz, low - 1) << endl; // 0.61323 +/*` +[pre +Probability of getting between 3 and 5 answers right by guessing is 0.6132 +] +And we can also try a few more combinations of high and low choices: +*/ + low = 1; high = 6; + cout << "Probability of getting between " << low << " and " << high << " answers right by guessing is " + << cdf(quiz, high) - cdf(quiz, low - 1) << endl; // 1 and 6 P= 0.91042 + low = 1; high = 8; + cout << "Probability of getting between " << low << " and " << high << " answers right by guessing is " + << cdf(quiz, high) - cdf(quiz, low - 1) << endl; // 1 <= x 8 P = 0.9825 + low = 4; high = 4; + cout << "Probability of getting between " << low << " and " << high << " answers right by guessing is " + << cdf(quiz, high) - cdf(quiz, low - 1) << endl; // 4 <= x 4 P = 0.22520 + +/*` +[pre +Probability of getting between 1 and 6 answers right by guessing is 0.9104 +Probability of getting between 1 and 8 answers right by guessing is 0.9825 +Probability of getting between 4 and 4 answers right by guessing is 0.2252 +] +[h4 Using Binomial distribution moments] +Using moments of the distribution, we can say more about the spread of results from guessing. +*/ + cout << "By guessing, on average, one can expect to get " << mean(quiz) << " correct answers." << endl; + cout << "Standard deviation is " << standard_deviation(quiz) << endl; + cout << "So about 2/3 will lie within 1 standard deviation and get between " + << ceil(mean(quiz) - standard_deviation(quiz)) << " and " + << floor(mean(quiz) + standard_deviation(quiz)) << " correct." << endl; + cout << "Mode (the most frequent) is " << mode(quiz) << endl; + cout << "Skewness is " << skewness(quiz) << endl; + +/*` +[pre +By guessing, on average, one can expect to get 4 correct answers. +Standard deviation is 1.732 +So about 2/3 will lie within 1 standard deviation and get between 3 and 5 correct. +Mode (the most frequent) is 4 +Skewness is 0.2887 +] +[h4 Quantiles] +The quantiles (percentiles or percentage points) for a few probability levels: +*/ + cout << "Quartiles " << quantile(quiz, 0.25) << " to " + << quantile(complement(quiz, 0.25)) << endl; // Quartiles + cout << "1 standard deviation " << quantile(quiz, 0.33) << " to " + << quantile(quiz, 0.67) << endl; // 1 sd + cout << "Deciles " << quantile(quiz, 0.1) << " to " + << quantile(complement(quiz, 0.1))<< endl; // Deciles + cout << "5 to 95% " << quantile(quiz, 0.05) << " to " + << quantile(complement(quiz, 0.05))<< endl; // 5 to 95% + cout << "2.5 to 97.5% " << quantile(quiz, 0.025) << " to " + << quantile(complement(quiz, 0.025)) << endl; // 2.5 to 97.5% + cout << "2 to 98% " << quantile(quiz, 0.02) << " to " + << quantile(complement(quiz, 0.02)) << endl; // 2 to 98% + + cout << "If guessing then percentiles 1 to 99% will get " << quantile(quiz, 0.01) + << " to " << quantile(complement(quiz, 0.01)) << " right." << endl; +/*` +Notice that these output integral values because the default policy is `integer_round_outwards`. +[pre +Quartiles 2 to 5 +1 standard deviation 2 to 5 +Deciles 1 to 6 +5 to 95% 0 to 7 +2.5 to 97.5% 0 to 8 +2 to 98% 0 to 8 +] +*/ + +//] [/binomial_quiz_example2] + +//[discrete_quantile_real +/*` +Quantiles values are controlled by the __understand_dis_quant quantile policy chosen. +The default is `integer_round_outwards`, +so the lower quantile is rounded down, and the upper quantile is rounded up. + +But we might believe that the real values tell us a little more - see __math_discrete. + +We could control the policy for *all* distributions by + + #define BOOST_MATH_DISCRETE_QUANTILE_POLICY real + + at the head of the program would make this policy apply +to this *one, and only*, translation unit. + +Or we can now create a (typedef for) policy that has discrete quantiles real +(here avoiding any 'using namespaces ...' statements): +*/ + using boost::math::policies::policy; + using boost::math::policies::discrete_quantile; + using boost::math::policies::real; + using boost::math::policies::integer_round_outwards; // Default. + typedef boost::math::policies::policy > real_quantile_policy; +/*` +Add a custom binomial distribution called ``real_quantile_binomial`` that uses ``real_quantile_policy`` +*/ + using boost::math::binomial_distribution; + typedef binomial_distribution real_quantile_binomial; +/*` +Construct an object of this custom distribution: +*/ + real_quantile_binomial quiz_real(questions, success_fraction); +/*` +And use this to show some quantiles - that now have real rather than integer values. +*/ + cout << "Quartiles " << quantile(quiz, 0.25) << " to " + << quantile(complement(quiz_real, 0.25)) << endl; // Quartiles 2 to 4.6212 + cout << "1 standard deviation " << quantile(quiz_real, 0.33) << " to " + << quantile(quiz_real, 0.67) << endl; // 1 sd 2.6654 4.194 + cout << "Deciles " << quantile(quiz_real, 0.1) << " to " + << quantile(complement(quiz_real, 0.1))<< endl; // Deciles 1.3487 5.7583 + cout << "5 to 95% " << quantile(quiz_real, 0.05) << " to " + << quantile(complement(quiz_real, 0.05))<< endl; // 5 to 95% 0.83739 6.4559 + cout << "2.5 to 97.5% " << quantile(quiz_real, 0.025) << " to " + << quantile(complement(quiz_real, 0.025)) << endl; // 2.5 to 97.5% 0.42806 7.0688 + cout << "2 to 98% " << quantile(quiz_real, 0.02) << " to " + << quantile(complement(quiz_real, 0.02)) << endl; // 2 to 98% 0.31311 7.7880 + + cout << "If guessing, then percentiles 1 to 99% will get " << quantile(quiz_real, 0.01) + << " to " << quantile(complement(quiz_real, 0.01)) << " right." << endl; +/*` +[pre +Real Quantiles +Quartiles 2 to 4.621 +1 standard deviation 2.665 to 4.194 +Deciles 1.349 to 5.758 +5 to 95% 0.8374 to 6.456 +2.5 to 97.5% 0.4281 to 7.069 +2 to 98% 0.3131 to 7.252 +If guessing then percentiles 1 to 99% will get 0 to 7.788 right. +] +*/ + +//] [/discrete_quantile_real] + } + catch(const std::exception& e) + { // Always useful to include try & catch blocks because + // default policies are to throw exceptions on arguments that cause + // errors like underflow, overflow. + // Lacking try & catch blocks, the program will abort without a message below, + // which may give some helpful clues as to the cause of the exception. + std::cout << + "\n""Message from thrown exception was:\n " << e.what() << std::endl; + } + return 0; +} // int main() + + + +/* + +Output is: + +BAutorun "i:\boost-06-05-03-1300\libs\math\test\Math_test\debug\binomial_quiz_example.exe" +Binomial distribution example - guessing in a quiz. +In a quiz with 16 questions and with a probability of guessing right of 25 % or 1 in 4 +Probability of getting none right is 0.0100226 +Probability of getting exactly one right is 0.0534538 +Probability of getting exactly two right is 0.133635 +Probability of getting exactly 11 answers right by chance is 0.000247132 +Probability of getting all 16 answers right by chance is 2.32831e-010 +Guessed Probability + 0 0.0100226 + 1 0.0534538 + 2 0.133635 + 3 0.207876 + 4 0.225199 + 5 0.180159 + 6 0.110097 + 7 0.0524273 + 8 0.0196602 + 9 0.00582526 +10 0.00135923 +11 0.000247132 +12 3.43239e-005 +13 3.5204e-006 +14 2.51457e-007 +15 1.11759e-008 +16 2.32831e-010 +Probability of getting none or one right is 0.0634764 +Probability of getting none or one right is 0.0634764 +Probability of getting <= 10 right (to fail) is 0.999715 +Probability of getting > 10 right (to pass) is 0.000285239 +Probability of getting > 10 right (to pass) is 0.000285239 +Probability of getting less than 11 (< 11) answers right by guessing is 0.999715 +Probability of getting at least 11(>= 11) answers right by guessing is 0.000285239, only 1 in 3505.83 +At most (<=) +Guessed OK Probability + 0 0.01002259576 + 1 0.0634764398 + 2 0.1971110499 + 3 0.4049871101 + 4 0.6301861752 + 5 0.8103454274 + 6 0.9204427481 + 7 0.9728700437 + 8 0.9925302796 + 9 0.9983555346 +10 0.9997147608 +11 0.9999618928 +12 0.9999962167 +13 0.9999997371 +14 0.9999999886 +15 0.9999999998 +16 1 +At least (>) +Guessed OK Probability + 0 0.9899774042 + 1 0.9365235602 + 2 0.8028889501 + 3 0.5950128899 + 4 0.3698138248 + 5 0.1896545726 + 6 0.07955725188 + 7 0.02712995629 + 8 0.00746972044 + 9 0.001644465374 +10 0.0002852391917 +11 3.810715862e-005 +12 3.783265129e-006 +13 2.628657967e-007 +14 1.140870154e-008 +15 2.328306437e-010 +16 0 +Probability of getting between 3 and 5 answers right by guessing is 0.6132 +Probability of getting between 3 and 5 answers right by guessing is 0.6132 +Probability of getting between 1 and 6 answers right by guessing is 0.9104 +Probability of getting between 1 and 8 answers right by guessing is 0.9825 +Probability of getting between 4 and 4 answers right by guessing is 0.2252 +By guessing, on average, one can expect to get 4 correct answers. +Standard deviation is 1.732 +So about 2/3 will lie within 1 standard deviation and get between 3 and 5 correct. +Mode (the most frequent) is 4 +Skewness is 0.2887 +Quartiles 2 to 5 +1 standard deviation 2 to 5 +Deciles 1 to 6 +5 to 95% 0 to 7 +2.5 to 97.5% 0 to 8 +2 to 98% 0 to 8 +If guessing then percentiles 1 to 99% will get 0 to 8 right. +Quartiles 2 to 4.621 +1 standard deviation 2.665 to 4.194 +Deciles 1.349 to 5.758 +5 to 95% 0.8374 to 6.456 +2.5 to 97.5% 0.4281 to 7.069 +2 to 98% 0.3131 to 7.252 +If guessing, then percentiles 1 to 99% will get 0 to 7.788 right. + +*/ + diff --git a/src/boost/libs/math/example/binomial_sample_sizes.cpp b/src/boost/libs/math/example/binomial_sample_sizes.cpp new file mode 100644 index 00000000..db9f8597 --- /dev/null +++ b/src/boost/libs/math/example/binomial_sample_sizes.cpp @@ -0,0 +1,176 @@ +// Copyright John Maddock 2006 +// Copyright Paul A. Bristow 2010 + +// 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) + +#ifdef _MSC_VER +# pragma warning(disable: 4512) // assignment operator could not be generated. +# pragma warning(disable: 4510) // default constructor could not be generated. +# pragma warning(disable: 4610) // can never be instantiated - user defined constructor required. +#endif + +#include +using std::cout; using std::endl; +#include +using std::fixed; using std::left; using std::right; using std::right; using std::setw; +using std::setprecision; + +#include + +void find_max_sample_size(double p, unsigned successes) +{ + // + // p = success ratio. + // successes = Total number of observed successes. + // + // Calculate how many trials we can have to ensure the + // maximum number of successes does not exceed "successes". + // A typical use would be failure analysis, where you want + // zero or fewer "successes" with some probability. + // + // using namespace boost::math; + // Avoid potential binomial_distribution name ambiguity with std + using boost::math::binomial_distribution; + + // Print out general info: + cout << + "________________________\n" + "Maximum Number of Trials\n" + "________________________\n\n"; + cout << setprecision(7); + cout << setw(40) << left << "Success ratio" << "= " << p << "\n"; + cout << setw(40) << left << "Maximum Number of \"successes\" permitted" << "= " << successes << "\n"; + // + // Define a table of confidence intervals: + // + double alpha[] = { 0.5, 0.25, 0.1, 0.05, 0.01, 0.001, 0.0001, 0.00001 }; + // + // Print table header: + // + cout << "\n\n" + "____________________________\n" + "Confidence Max Number\n" + " Value (%) Of Trials \n" + "____________________________\n"; + // + // Now print out the data for the table rows. + // + for(unsigned i = 0; i < sizeof(alpha)/sizeof(alpha[0]); ++i) + { + // Confidence value: + cout << fixed << setprecision(3) << setw(10) << right << 100 * (1-alpha[i]); + // calculate trials: + double t = binomial_distribution<>::find_maximum_number_of_trials(successes, p, alpha[i]); + t = floor(t); + // Print Trials: + cout << fixed << setprecision(0) << setw(15) << right << t << endl; + } + cout << endl; +} + +int main() +{ + find_max_sample_size(1.0/1000, 0); + find_max_sample_size(1.0/10000, 0); + find_max_sample_size(1.0/100000, 0); + find_max_sample_size(1.0/1000000, 0); + + return 0; +} + + +/* + +Output: + + binomial_sample_sizes.cpp + binomial_sample_sizes_example.vcxproj -> J:\Cpp\MathToolkit\test\Math_test\Debug\binomial_sample_sizes_example.exe + ________________________ + Maximum Number of Trials + ________________________ + + Success ratio = 0.001 + Maximum Number of "successes" permitted = 0 + + + ____________________________ + Confidence Max Number + Value (%) Of Trials + ____________________________ + 50.000 692 + 75.000 287 + 90.000 105 + 95.000 51 + 99.000 10 + 99.900 0 + 99.990 0 + 99.999 0 + + ________________________ + Maximum Number of Trials + ________________________ + + Success ratio = 0.0001000 + Maximum Number of "successes" permitted = 0 + + + ____________________________ + Confidence Max Number + Value (%) Of Trials + ____________________________ + 50.000 6931 + 75.000 2876 + 90.000 1053 + 95.000 512 + 99.000 100 + 99.900 10 + 99.990 0 + 99.999 0 + + ________________________ + Maximum Number of Trials + ________________________ + + Success ratio = 0.0000100 + Maximum Number of "successes" permitted = 0 + + + ____________________________ + Confidence Max Number + Value (%) Of Trials + ____________________________ + 50.000 69314 + 75.000 28768 + 90.000 10535 + 95.000 5129 + 99.000 1005 + 99.900 100 + 99.990 10 + 99.999 1 + + ________________________ + Maximum Number of Trials + ________________________ + + Success ratio = 0.0000010 + Maximum Number of "successes" permitted = 0 + + + ____________________________ + Confidence Max Number + Value (%) Of Trials + ____________________________ + 50.000 693146 + 75.000 287681 + 90.000 105360 + 95.000 51293 + 99.000 10050 + 99.900 1000 + 99.990 100 + 99.999 10 + + +*/ diff --git a/src/boost/libs/math/example/brent_minimise_example.cpp b/src/boost/libs/math/example/brent_minimise_example.cpp new file mode 100644 index 00000000..09053bd0 --- /dev/null +++ b/src/boost/libs/math/example/brent_minimise_example.cpp @@ -0,0 +1,730 @@ +//! \file +//! \brief Brent_minimise_example.cpp + +// Copyright Paul A. Bristow 2015, 2018. + +// 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) + +// Note that this file contains Quickbook mark-up as well as code +// and comments, don't change any of the special comment mark-ups! + +// For some diagnostic information: +//#define BOOST_MATH_INSTRUMENT +// If quadmath float128 is available: +//#define BOOST_HAVE_QUADMATH + +// Example of finding minimum of a function with Brent's method. +//[brent_minimise_include_1 +#include +//] [/brent_minimise_include_1] + +#include +#include +#include +#include +#include // For is_close_at)tolerance and is_small + +//[brent_minimise_mp_include_0 +#include // For decimal boost::multiprecision::cpp_dec_float_50. +#include // For binary boost::multiprecision::cpp_bin_float_50; +//] [/brent_minimise_mp_include_0] + +//#ifndef _MSC_VER // float128 is not yet supported by Microsoft compiler at 2018. +#ifdef BOOST_HAVE_QUADMATH // Define only if GCC or Intel, and have quadmath.lib or .dll library available. +# include +#endif + +#include +// using std::cout; using std::endl; +#include +// using std::setw; using std::setprecision; +#include +using std::numeric_limits; +#include +#include // pair, make_pair +#include +#include + + //typedef boost::multiprecision::number, + // boost::multiprecision::et_off> + // cpp_dec_float_50_et_off; + // + // typedef boost::multiprecision::number, + // boost::multiprecision::et_off> + // cpp_bin_float_50_et_off; + +// http://en.wikipedia.org/wiki/Brent%27s_method Brent's method + +// An example of a function for which we want to find a minimum. +double f(double x) +{ + return (x + 3) * (x - 1) * (x - 1); +} + +//[brent_minimise_double_functor +struct funcdouble +{ + double operator()(double const& x) + { + return (x + 3) * (x - 1) * (x - 1); // (x + 3)(x - 1)^2 + } +}; +//] [/brent_minimise_double_functor] + +//[brent_minimise_T_functor +struct func +{ + template + T operator()(T const& x) + { + return (x + 3) * (x - 1) * (x - 1); // (x + 3)(x - 1)^2 + } +}; +//] [/brent_minimise_T_functor] + +//! Test if two values are close within a given tolerance. +template +inline bool +is_close_to(FPT left, FPT right, FPT tolerance) +{ + return boost::math::fpc::close_at_tolerance(tolerance) (left, right); +} + +//[brent_minimise_close + +//! Compare if value got is close to expected, +//! checking first if expected is very small +//! (to avoid divide by tiny or zero during comparison) +//! before comparing expect with value got. + +template +bool is_close(T expect, T got, T tolerance) +{ + using boost::math::fpc::close_at_tolerance; + using boost::math::fpc::is_small; + using boost::math::fpc::FPC_STRONG; + + if (is_small(expect, tolerance)) + { + return is_small(got, tolerance); + } + + return close_at_tolerance(tolerance, FPC_STRONG) (expect, got); +} // bool is_close(T expect, T got, T tolerance) + +//] [/brent_minimise_close] + +//[brent_minimise_T_show + +//! Example template function to find and show minima. +//! \tparam T floating-point or fixed_point type. +template +void show_minima() +{ + using boost::math::tools::brent_find_minima; + using std::sqrt; + try + { // Always use try'n'catch blocks with Boost.Math to ensure you get any error messages. + + int bits = std::numeric_limits::digits/2; // Maximum is digits/2; + std::streamsize prec = static_cast(2 + sqrt((double)bits)); // Number of significant decimal digits. + std::streamsize precision = std::cout.precision(prec); // Save and set. + + std::cout << "\n\nFor type: " << typeid(T).name() + << ",\n epsilon = " << std::numeric_limits::epsilon() + // << ", precision of " << bits << " bits" + << ",\n the maximum theoretical precision from Brent's minimization is " + << sqrt(std::numeric_limits::epsilon()) + << "\n Displaying to std::numeric_limits::digits10 " << prec << ", significant decimal digits." + << std::endl; + + const boost::uintmax_t maxit = 20; + boost::uintmax_t it = maxit; + // Construct using string, not double, avoids loss of precision. + //T bracket_min = static_cast("-4"); + //T bracket_max = static_cast("1.3333333333333333333333333333333333333333333333333"); + + // Construction from double may cause loss of precision for multiprecision types like cpp_bin_float, + // but brackets values are good enough for using Brent minimization. + T bracket_min = static_cast(-4); + T bracket_max = static_cast(1.3333333333333333333333333333333333333333333333333); + + std::pair r = brent_find_minima(func(), bracket_min, bracket_max, bits, it); + + std::cout << " x at minimum = " << r.first << ", f(" << r.first << ") = " << r.second; + if (it < maxit) + { + std::cout << ",\n met " << bits << " bits precision" << ", after " << it << " iterations." << std::endl; + } + else + { + std::cout << ",\n did NOT meet " << bits << " bits precision" << " after " << it << " iterations!" << std::endl; + } + // Check that result is that expected (compared to theoretical uncertainty). + T uncertainty = sqrt(std::numeric_limits::epsilon()); + std::cout << std::boolalpha << "x == 1 (compared to uncertainty " << uncertainty << ") is " + << is_close(static_cast(1), r.first, uncertainty) << std::endl; + std::cout << std::boolalpha << "f(x) == (0 compared to uncertainty " << uncertainty << ") is " + << is_close(static_cast(0), r.second, uncertainty) << std::endl; + // Problems with this using multiprecision with expression template on? + std::cout.precision(precision); // Restore. + } + catch (const std::exception& e) + { // Always useful to include try & catch blocks because default policies + // are to throw exceptions on arguments that cause errors like underflow, overflow. + // Lacking try & catch blocks, the program will abort without a message below, + // which may give some helpful clues as to the cause of the exception. + std::cout << + "\n""Message from thrown exception was:\n " << e.what() << std::endl; + } +} // void show_minima() + +//] [/brent_minimise_T_show] + +int main() +{ + using boost::math::tools::brent_find_minima; + using std::sqrt; + std::cout << "Brent's minimisation examples." << std::endl; + std::cout << std::boolalpha << std::endl; + std::cout << std::showpoint << std::endl; // Show trailing zeros. + + // Tip - using + // std::cout.precision(std::numeric_limits::digits10); + // during debugging is wise because it warns + // if construction of multiprecision involves conversion from double + // by finding random or zero digits after 17th decimal digit. + + // Specific type double - unlimited iterations (unwise?). + { + std::cout << "\nType double - unlimited iterations (unwise?)" << std::endl; + //[brent_minimise_double_1 + const int double_bits = std::numeric_limits::digits; + std::pair r = brent_find_minima(funcdouble(), -4., 4. / 3, double_bits); + + std::streamsize precision_1 = std::cout.precision(std::numeric_limits::digits10); + // Show all double precision decimal digits and trailing zeros. + std::cout << "x at minimum = " << r.first + << ", f(" << r.first << ") = " << r.second << std::endl; + //] [/brent_minimise_double_1] + std::cout << "x at minimum = " << (r.first - 1.) / r.first << std::endl; + // x at minimum = 1.00000000112345, f(1.00000000112345) = 5.04852568272458e-018 + double uncertainty = sqrt(std::numeric_limits::epsilon()); + std::cout << "Uncertainty sqrt(epsilon) = " << uncertainty << std::endl; + // sqrt(epsilon) = 1.49011611938477e-008 + // (epsilon is always > 0, so no need to take abs value). + + std::cout.precision(precision_1); // Restore. + //[brent_minimise_double_1a + + using boost::math::fpc::close_at_tolerance; + using boost::math::fpc::is_small; + + std::cout << "x = " << r.first << ", f(x) = " << r.second << std::endl; + std::cout << std::boolalpha << "x == 1 (compared to uncertainty " + << uncertainty << ") is " << is_close(1., r.first, uncertainty) << std::endl; // true + std::cout << std::boolalpha << "f(x) == 0 (compared to uncertainty " + << uncertainty << ") is " << is_close(0., r.second, uncertainty) << std::endl; // true +//] [/brent_minimise_double_1a] + + } + std::cout << "\nType double with limited iterations." << std::endl; + { + const int bits = std::numeric_limits::digits; + // Specific type double - limit maxit to 20 iterations. + std::cout << "Precision bits = " << bits << std::endl; + //[brent_minimise_double_2 + const boost::uintmax_t maxit = 20; + boost::uintmax_t it = maxit; + std::pair r = brent_find_minima(funcdouble(), -4., 4. / 3, bits, it); + std::cout << "x at minimum = " << r.first << ", f(" << r.first << ") = " << r.second + << " after " << it << " iterations. " << std::endl; + //] [/brent_minimise_double_2] + // x at minimum = 1.00000000112345, f(1.00000000112345) = 5.04852568272458e-018 +//[brent_minimise_double_3 + std::streamsize prec = static_cast(2 + sqrt((double)bits)); // Number of significant decimal digits. + std::streamsize precision_3 = std::cout.precision(prec); // Save and set new precision. + std::cout << "Showing " << bits << " bits " + "precision with " << prec + << " decimal digits from tolerance " << sqrt(std::numeric_limits::epsilon()) + << std::endl; + + std::cout << "x at minimum = " << r.first + << ", f(" << r.first << ") = " << r.second + << " after " << it << " iterations. " << std::endl; + std::cout.precision(precision_3); // Restore. +//] [/brent_minimise_double_3] + // Showing 53 bits precision with 9 decimal digits from tolerance 1.49011611938477e-008 + // x at minimum = 1, f(1) = 5.04852568e-018 + } + + std::cout << "\nType double with limited iterations and half double bits." << std::endl; + { + +//[brent_minimise_double_4 + const int bits_div_2 = std::numeric_limits::digits / 2; // Half digits precision (effective maximum). + double epsilon_2 = boost::math::pow<-(std::numeric_limits::digits/2 - 1), double>(2); + std::streamsize prec = static_cast(2 + sqrt((double)bits_div_2)); // Number of significant decimal digits. + + std::cout << "Showing " << bits_div_2 << " bits precision with " << prec + << " decimal digits from tolerance " << sqrt(epsilon_2) + << std::endl; + std::streamsize precision_4 = std::cout.precision(prec); // Save. + const boost::uintmax_t maxit = 20; + boost::uintmax_t it_4 = maxit; + std::pair r = brent_find_minima(funcdouble(), -4., 4. / 3, bits_div_2, it_4); + std::cout << "x at minimum = " << r.first << ", f(" << r.first << ") = " << r.second << std::endl; + std::cout << it_4 << " iterations. " << std::endl; + std::cout.precision(precision_4); // Restore. + +//] [/brent_minimise_double_4] + } + // x at minimum = 1, f(1) = 5.04852568e-018 + + { + std::cout << "\nType double with limited iterations and quarter double bits." << std::endl; + //[brent_minimise_double_5 + const int bits_div_4 = std::numeric_limits::digits / 4; // Quarter precision. + double epsilon_4 = boost::math::pow<-(std::numeric_limits::digits / 4 - 1), double>(2); + std::streamsize prec = static_cast(2 + sqrt((double)bits_div_4)); // Number of significant decimal digits. + std::cout << "Showing " << bits_div_4 << " bits precision with " << prec + << " decimal digits from tolerance " << sqrt(epsilon_4) + << std::endl; + std::streamsize precision_5 = std::cout.precision(prec); // Save & set. + const boost::uintmax_t maxit = 20; + + boost::uintmax_t it_5 = maxit; + std::pair r = brent_find_minima(funcdouble(), -4., 4. / 3, bits_div_4, it_5); + std::cout << "x at minimum = " << r.first << ", f(" << r.first << ") = " << r.second + << ", after " << it_5 << " iterations. " << std::endl; + std::cout.precision(precision_5); // Restore. + + //] [/brent_minimise_double_5] + } + + // Showing 13 bits precision with 9 decimal digits from tolerance 0.015625 + // x at minimum = 0.9999776, f(0.9999776) = 2.0069572e-009 + // 7 iterations. + + { + std::cout << "\nType long double with limited iterations and all long double bits." << std::endl; +//[brent_minimise_template_1 + std::streamsize precision_t1 = std::cout.precision(std::numeric_limits::digits10); // Save & set. + long double bracket_min = -4.; + long double bracket_max = 4. / 3; + const int bits = std::numeric_limits::digits; + const boost::uintmax_t maxit = 20; + boost::uintmax_t it = maxit; + + std::pair r = brent_find_minima(func(), bracket_min, bracket_max, bits, it); + std::cout << "x at minimum = " << r.first << ", f(" << r.first << ") = " << r.second + << ", after " << it << " iterations. " << std::endl; + std::cout.precision(precision_t1); // Restore. +//] [/brent_minimise_template_1] + } + + // Show use of built-in type Template versions. + // (Will not work if construct bracket min and max from string). + +//[brent_minimise_template_fd + show_minima(); + show_minima(); + show_minima(); + + //] [/brent_minimise_template_fd] + +//[brent_minimise_mp_include_1 +#ifdef BOOST_HAVE_QUADMATH // Defined only if GCC or Intel and have quadmath.lib or .dll library available. + using boost::multiprecision::float128; +#endif +//] [/brent_minimise_mp_include_1] + +//[brent_minimise_template_quad +#ifdef BOOST_HAVE_QUADMATH // Defined only if GCC or Intel and have quadmath.lib or .dll library available. + show_minima(); // Needs quadmath_snprintf, sqrtQ, fabsq that are in in quadmath library. +#endif +//] [/brent_minimise_template_quad + + // User-defined floating-point template. + +//[brent_minimise_mp_typedefs + using boost::multiprecision::cpp_bin_float_50; // binary multiprecision typedef. + using boost::multiprecision::cpp_dec_float_50; // decimal multiprecision typedef. + + // One might also need typedefs like these to switch expression templates off and on (default is on). + typedef boost::multiprecision::number, + boost::multiprecision::et_on> + cpp_bin_float_50_et_on; // et_on is default so is same as cpp_bin_float_50. + + typedef boost::multiprecision::number, + boost::multiprecision::et_off> + cpp_bin_float_50_et_off; + + typedef boost::multiprecision::number, + boost::multiprecision::et_on> // et_on is default so is same as cpp_dec_float_50. + cpp_dec_float_50_et_on; + + typedef boost::multiprecision::number, + boost::multiprecision::et_off> + cpp_dec_float_50_et_off; +//] [/brent_minimise_mp_typedefs] + + { // binary ET on by default. +//[brent_minimise_mp_1 + std::cout.precision(std::numeric_limits::digits10); + int bits = std::numeric_limits::digits / 2 - 2; + cpp_bin_float_50 bracket_min = static_cast("-4"); + cpp_bin_float_50 bracket_max = static_cast("1.3333333333333333333333333333333333333333333333333"); + + std::cout << "Bracketing " << bracket_min << " to " << bracket_max << std::endl; + const boost::uintmax_t maxit = 20; + boost::uintmax_t it = maxit; // Will be updated with actual iteration count. + std::pair r + = brent_find_minima(func(), bracket_min, bracket_max, bits, it); + + std::cout << "x at minimum = " << r.first << ",\n f(" << r.first << ") = " << r.second + // x at minimum = 1, f(1) = 5.04853e-018 + << ", after " << it << " iterations. " << std::endl; + + is_close_to(static_cast("1"), r.first, sqrt(std::numeric_limits::epsilon())); + is_close_to(static_cast("0"), r.second, sqrt(std::numeric_limits::epsilon())); + +//] [/brent_minimise_mp_1] + +/* +//[brent_minimise_mp_output_1 +For type class boost::multiprecision::number,1>, +epsilon = 5.3455294202e-51, +the maximum theoretical precision from Brent minimization is 7.311312755e-26 +Displaying to std::numeric_limits::digits10 11 significant decimal digits. +x at minimum = 1, f(1) = 5.6273022713e-58, +met 84 bits precision, after 14 iterations. +x == 1 (compared to uncertainty 7.311312755e-26) is true +f(x) == (0 compared to uncertainty 7.311312755e-26) is true +-4 1.3333333333333333333333333333333333333333333333333 +x at minimum = 0.99999999999999999999999999998813903221565569205253, +f(0.99999999999999999999999999998813903221565569205253) = + 5.6273022712501408640665300316078046703496236636624e-58 +14 iterations +//] [/brent_minimise_mp_output_1] +*/ +//[brent_minimise_mp_2 + show_minima(); // +//] [/brent_minimise_mp_2] + +/* +//[brent_minimise_mp_output_2 + For type class boost::multiprecision::number, 1>, + +//] [/brent_minimise_mp_output_1] +*/ + } + + { // binary ET on explicit + std::cout.precision(std::numeric_limits::digits10); + + int bits = std::numeric_limits::digits / 2 - 2; + + cpp_bin_float_50_et_on bracket_min = static_cast("-4"); + cpp_bin_float_50_et_on bracket_max = static_cast("1.3333333333333333333333333333333333333333333333333"); + + std::cout << bracket_min << " " << bracket_max << std::endl; + const boost::uintmax_t maxit = 20; + boost::uintmax_t it = maxit; + std::pair r = brent_find_minima(func(), bracket_min, bracket_max, bits, it); + + std::cout << "x at minimum = " << r.first << ", f(" << r.first << ") = " << r.second << std::endl; + // x at minimum = 1, f(1) = 5.04853e-018 + std::cout << it << " iterations. " << std::endl; + + show_minima(); // + + } + return 0; + + // Some examples of switching expression templates on and off follow. + + { // binary ET off + std::cout.precision(std::numeric_limits::digits10); + + int bits = std::numeric_limits::digits / 2 - 2; + cpp_bin_float_50_et_off bracket_min = static_cast("-4"); + cpp_bin_float_50_et_off bracket_max = static_cast("1.3333333333333333333333333333333333333333333333333"); + + std::cout << bracket_min << " " << bracket_max << std::endl; + const boost::uintmax_t maxit = 20; + boost::uintmax_t it = maxit; + std::pair r = brent_find_minima(func(), bracket_min, bracket_max, bits, it); + + std::cout << "x at minimum = " << r.first << ", f(" << r.first << ") = " << r.second << std::endl; + // x at minimum = 1, f(1) = 5.04853e-018 + std::cout << it << " iterations. " << std::endl; + + show_minima(); // + } + + { // decimal ET on by default + std::cout.precision(std::numeric_limits::digits10); + + int bits = std::numeric_limits::digits / 2 - 2; + + cpp_dec_float_50 bracket_min = static_cast("-4"); + cpp_dec_float_50 bracket_max = static_cast("1.3333333333333333333333333333333333333333333333333"); + + std::cout << bracket_min << " " << bracket_max << std::endl; + const boost::uintmax_t maxit = 20; + boost::uintmax_t it = maxit; + std::pair r = brent_find_minima(func(), bracket_min, bracket_max, bits, it); + + std::cout << "x at minimum = " << r.first << ", f(" << r.first << ") = " << r.second << std::endl; + // x at minimum = 1, f(1) = 5.04853e-018 + std::cout << it << " iterations. " << std::endl; + + show_minima(); + } + + { // decimal ET on + std::cout.precision(std::numeric_limits::digits10); + + int bits = std::numeric_limits::digits / 2 - 2; + + cpp_dec_float_50_et_on bracket_min = static_cast("-4"); + cpp_dec_float_50_et_on bracket_max = static_cast("1.3333333333333333333333333333333333333333333333333"); + std::cout << bracket_min << " " << bracket_max << std::endl; + const boost::uintmax_t maxit = 20; + boost::uintmax_t it = maxit; + std::pair r = brent_find_minima(func(), bracket_min, bracket_max, bits, it); + + std::cout << "x at minimum = " << r.first << ", f(" << r.first << ") = " << r.second << std::endl; + // x at minimum = 1, f(1) = 5.04853e-018 + std::cout << it << " iterations. " << std::endl; + + show_minima(); + + } + + { // decimal ET off + std::cout.precision(std::numeric_limits::digits10); + + int bits = std::numeric_limits::digits / 2 - 2; + + cpp_dec_float_50_et_off bracket_min = static_cast("-4"); + cpp_dec_float_50_et_off bracket_max = static_cast("1.3333333333333333333333333333333333333333333333333"); + + std::cout << bracket_min << " " << bracket_max << std::endl; + const boost::uintmax_t maxit = 20; + boost::uintmax_t it = maxit; + std::pair r = brent_find_minima(func(), bracket_min, bracket_max, bits, it); + + std::cout << "x at minimum = " << r.first << ", f(" << r.first << ") = " << r.second << std::endl; + // x at minimum = 1, f(1) = 5.04853e-018 + std::cout << it << " iterations. " << std::endl; + + show_minima(); + } + + return 0; +} // int main() + + +/* + +Typical output MSVC 15.7.3 + +brent_minimise_example.cpp +Generating code +7 of 2746 functions ( 0.3%) were compiled, the rest were copied from previous compilation. +0 functions were new in current compilation +1 functions had inline decision re-evaluated but remain unchanged +Finished generating code +brent_minimise_example.vcxproj -> J:\Cpp\MathToolkit\test\Math_test\Release\brent_minimise_example.exe +Autorun "J:\Cpp\MathToolkit\test\Math_test\Release\brent_minimise_example.exe" +Brent's minimisation examples. + + + +Type double - unlimited iterations (unwise?) +x at minimum = 1.00000000112345, f(1.00000000112345) = 5.04852568272458e-18 +x at minimum = 1.12344622367552e-09 +Uncertainty sqrt(epsilon) = 1.49011611938477e-08 +x = 1.00000, f(x) = 5.04853e-18 +x == 1 (compared to uncertainty 1.49012e-08) is true +f(x) == 0 (compared to uncertainty 1.49012e-08) is true + +Type double with limited iterations. +Precision bits = 53 +x at minimum = 1.00000, f(1.00000) = 5.04853e-18 after 10 iterations. +Showing 53 bits precision with 9 decimal digits from tolerance 1.49011612e-08 +x at minimum = 1.00000000, f(1.00000000) = 5.04852568e-18 after 10 iterations. + +Type double with limited iterations and half double bits. +Showing 26 bits precision with 7 decimal digits from tolerance 0.000172633 +x at minimum = 1.000000, f(1.000000) = 5.048526e-18 +10 iterations. + +Type double with limited iterations and quarter double bits. +Showing 13 bits precision with 5 decimal digits from tolerance 0.0156250 +x at minimum = 0.99998, f(0.99998) = 2.0070e-09, after 7 iterations. + +Type long double with limited iterations and all long double bits. +x at minimum = 1.00000000112345, f(1.00000000112345) = 5.04852568272458e-18, after 10 iterations. + + +For type: float, +epsilon = 1.1921e-07, +the maximum theoretical precision from Brent's minimization is 0.00034527 +Displaying to std::numeric_limits::digits10 5, significant decimal digits. +x at minimum = 1.0002, f(1.0002) = 1.9017e-07, +met 12 bits precision, after 7 iterations. +x == 1 (compared to uncertainty 0.00034527) is true +f(x) == (0 compared to uncertainty 0.00034527) is true + + +For type: double, +epsilon = 2.220446e-16, +the maximum theoretical precision from Brent's minimization is 1.490116e-08 +Displaying to std::numeric_limits::digits10 7, significant decimal digits. +x at minimum = 1.000000, f(1.000000) = 5.048526e-18, +met 26 bits precision, after 10 iterations. +x == 1 (compared to uncertainty 1.490116e-08) is true +f(x) == (0 compared to uncertainty 1.490116e-08) is true + + +For type: long double, +epsilon = 2.220446e-16, +the maximum theoretical precision from Brent's minimization is 1.490116e-08 +Displaying to std::numeric_limits::digits10 7, significant decimal digits. +x at minimum = 1.000000, f(1.000000) = 5.048526e-18, +met 26 bits precision, after 10 iterations. +x == 1 (compared to uncertainty 1.490116e-08) is true +f(x) == (0 compared to uncertainty 1.490116e-08) is true +Bracketing -4.0000000000000000000000000000000000000000000000000 to 1.3333333333333333333333333333333333333333333333333 +x at minimum = 0.99999999999999999999999999998813903221565569205253, +f(0.99999999999999999999999999998813903221565569205253) = 5.6273022712501408640665300316078046703496236636624e-58, after 14 iterations. + + +For type: class boost::multiprecision::number,1>, +epsilon = 5.3455294202e-51, +the maximum theoretical precision from Brent's minimization is 7.3113127550e-26 +Displaying to std::numeric_limits::digits10 11, significant decimal digits. +x at minimum = 1.0000000000, f(1.0000000000) = 5.6273022713e-58, +met 84 bits precision, after 14 iterations. +x == 1 (compared to uncertainty 7.3113127550e-26) is true +f(x) == (0 compared to uncertainty 7.3113127550e-26) is true +-4.0000000000000000000000000000000000000000000000000 1.3333333333333333333333333333333333333333333333333 +x at minimum = 0.99999999999999999999999999998813903221565569205253, f(0.99999999999999999999999999998813903221565569205253) = 5.6273022712501408640665300316078046703496236636624e-58 +14 iterations. + + +For type: class boost::multiprecision::number,1>, +epsilon = 5.3455294202e-51, +the maximum theoretical precision from Brent's minimization is 7.3113127550e-26 +Displaying to std::numeric_limits::digits10 11, significant decimal digits. +x at minimum = 1.0000000000, f(1.0000000000) = 5.6273022713e-58, +met 84 bits precision, after 14 iterations. +x == 1 (compared to uncertainty 7.3113127550e-26) is true +f(x) == (0 compared to uncertainty 7.3113127550e-26) is true + + +============================================================================================================ + + // GCC 7.2.0 with quadmath + +Brent's minimisation examples. + +Type double - unlimited iterations (unwise?) +x at minimum = 1.00000000112345, f(1.00000000112345) = 5.04852568272458e-018 +x at minimum = 1.12344622367552e-009 +Uncertainty sqrt(epsilon) = 1.49011611938477e-008 +x = 1.00000, f(x) = 5.04853e-018 +x == 1 (compared to uncertainty 1.49012e-008) is true +f(x) == 0 (compared to uncertainty 1.49012e-008) is true + +Type double with limited iterations. +Precision bits = 53 +x at minimum = 1.00000, f(1.00000) = 5.04853e-018 after 10 iterations. +Showing 53 bits precision with 9 decimal digits from tolerance 1.49011612e-008 +x at minimum = 1.00000000, f(1.00000000) = 5.04852568e-018 after 10 iterations. + +Type double with limited iterations and half double bits. +Showing 26 bits precision with 7 decimal digits from tolerance 0.000172633 +x at minimum = 1.000000, f(1.000000) = 5.048526e-018 +10 iterations. + +Type double with limited iterations and quarter double bits. +Showing 13 bits precision with 5 decimal digits from tolerance 0.0156250 +x at minimum = 0.99998, f(0.99998) = 2.0070e-009, after 7 iterations. + +Type long double with limited iterations and all long double bits. +x at minimum = 1.00000000000137302, f(1.00000000000137302) = 7.54079013697311930e-024, after 10 iterations. + + +For type: f, +epsilon = 1.1921e-007, +the maximum theoretical precision from Brent's minimization is 0.00034527 +Displaying to std::numeric_limits::digits10 5, significant decimal digits. +x at minimum = 1.0002, f(1.0002) = 1.9017e-007, +met 12 bits precision, after 7 iterations. +x == 1 (compared to uncertainty 0.00034527) is true +f(x) == (0 compared to uncertainty 0.00034527) is true + + +For type: d, +epsilon = 2.220446e-016, +the maximum theoretical precision from Brent's minimization is 1.490116e-008 +Displaying to std::numeric_limits::digits10 7, significant decimal digits. +x at minimum = 1.000000, f(1.000000) = 5.048526e-018, +met 26 bits precision, after 10 iterations. +x == 1 (compared to uncertainty 1.490116e-008) is true +f(x) == (0 compared to uncertainty 1.490116e-008) is true + + +For type: e, +epsilon = 1.084202e-019, +the maximum theoretical precision from Brent's minimization is 3.292723e-010 +Displaying to std::numeric_limits::digits10 7, significant decimal digits. +x at minimum = 1.000000, f(1.000000) = 7.540790e-024, +met 32 bits precision, after 10 iterations. +x == 1 (compared to uncertainty 3.292723e-010) is true +f(x) == (0 compared to uncertainty 3.292723e-010) is true + + +For type: N5boost14multiprecision6numberINS0_8backends16float128_backendELNS0_26expression_template_optionE0EEE, +epsilon = 1.92592994e-34, +the maximum theoretical precision from Brent's minimization is 1.38777878e-17 +Displaying to std::numeric_limits::digits10 9, significant decimal digits. +x at minimum = 1.00000000, f(1.00000000) = 1.48695468e-43, +met 56 bits precision, after 12 iterations. +x == 1 (compared to uncertainty 1.38777878e-17) is true +f(x) == (0 compared to uncertainty 1.38777878e-17) is true +Bracketing -4.0000000000000000000000000000000000000000000000000 to 1.3333333333333333333333333333333333333333333333333 +x at minimum = 0.99999999999999999999999999998813903221565569205253, +f(0.99999999999999999999999999998813903221565569205253) = 5.6273022712501408640665300316078046703496236636624e-58, after 14 iterations. + + +For type: N5boost14multiprecision6numberINS0_8backends13cpp_bin_floatILj50ELNS2_15digit_base_typeE10EviLi0ELi0EEELNS0_26expression_template_optionE1EEE, +epsilon = 5.3455294202e-51, +the maximum theoretical precision from Brent's minimization is 7.3113127550e-26 +Displaying to std::numeric_limits::digits10 11, significant decimal digits. +x at minimum = 1.0000000000, f(1.0000000000) = 5.6273022713e-58, +met 84 bits precision, after 14 iterations. +x == 1 (compared to uncertainty 7.3113127550e-26) is true +f(x) == (0 compared to uncertainty 7.3113127550e-26) is true +-4.0000000000000000000000000000000000000000000000000 1.3333333333333333333333333333333333333333333333333 +x at minimum = 0.99999999999999999999999999998813903221565569205253, f(0.99999999999999999999999999998813903221565569205253) = 5.6273022712501408640665300316078046703496236636624e-58 +14 iterations. + + +For type: N5boost14multiprecision6numberINS0_8backends13cpp_bin_floatILj50ELNS2_15digit_base_typeE10EviLi0ELi0EEELNS0_26expression_template_optionE1EEE, +epsilon = 5.3455294202e-51, +the maximum theoretical precision from Brent's minimization is 7.3113127550e-26 +Displaying to std::numeric_limits::digits10 11, significant decimal digits. +x at minimum = 1.0000000000, f(1.0000000000) = 5.6273022713e-58, +met 84 bits precision, after 14 iterations. +x == 1 (compared to uncertainty 7.3113127550e-26) is true +f(x) == (0 compared to uncertainty 7.3113127550e-26) is true + +*/ diff --git a/src/boost/libs/math/example/c_error_policy_example.cpp b/src/boost/libs/math/example/c_error_policy_example.cpp new file mode 100644 index 00000000..6d5b2158 --- /dev/null +++ b/src/boost/libs/math/example/c_error_policy_example.cpp @@ -0,0 +1,83 @@ +// C_error_policy_example.cpp + +// Copyright Paul A. Bristow 2007, 2010. +// Copyright John Maddock 2007. + +// 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) + +// Suppose we want a call to tgamma to behave in a C-compatible way +// and set global ::errno rather than throw an exception. + +#include // for ::errno + +#include +using boost::math::tgamma; + +using boost::math::policies::policy; +// Possible errors +using boost::math::policies::overflow_error; +using boost::math::policies::underflow_error; +using boost::math::policies::domain_error; +using boost::math::policies::pole_error; +using boost::math::policies::denorm_error; +using boost::math::policies::evaluation_error; + +using boost::math::policies::errno_on_error; +using boost::math::policies::ignore_error; + +//using namespace boost::math::policies; +//using namespace boost::math; // avoid potential ambiuity with std:: + +// Define a policy: +typedef policy< + domain_error, // 'bad' arguments. + pole_error, // argument is pole value. + overflow_error, // argument value causes overflow. + evaluation_error // evaluation does not converge and may be inaccurate, or worse, + // or there is no way known (yet) to implement this evaluation, + // for example, kurtosis of non-central beta distribution. + > C_error_policy; + +// std +#include + using std::cout; + using std::endl; + +int main() +{ + // We can achieve this at the function call site + // with the previously defined policy C_error_policy. + double t = tgamma(4., C_error_policy()); + cout << "tgamma(4., C_error_policy() = " << t << endl; // 6 + + // Alternatively we could use the function make_policy, + // provided for convenience, + // and define everything at the call site: + t = tgamma(4., make_policy( + domain_error(), + pole_error(), + overflow_error(), + evaluation_error() + )); + cout << "tgamma(4., make_policy(...) = " << t << endl; // 6 + + return 0; +} // int main() + +/* + +Output + + c_error_policy_example.cpp + Generating code + Finished generating code + c_error_policy_example.vcxproj -> J:\Cpp\MathToolkit\test\Math_test\Release\c_error_policy_example.exe + tgamma(4., C_error_policy() = 6 + tgamma(4., make_policy(...) = 6 + tgamma(4., C_error_policy() = 6 + tgamma(4., make_policy(...) = 6 + +*/ diff --git a/src/boost/libs/math/example/cardinal_cubic_b_spline_example.cpp b/src/boost/libs/math/example/cardinal_cubic_b_spline_example.cpp new file mode 100644 index 00000000..3a709f44 --- /dev/null +++ b/src/boost/libs/math/example/cardinal_cubic_b_spline_example.cpp @@ -0,0 +1,147 @@ +// Copyright Nicholas Thompson 2017. +// Copyright Paul A. Bristow 2017. +// Copyright John Maddock 2017. + +// Distributed under 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 +#include +#include +#include +#include +#include + +//[cubic_b_spline_example + +/*`This example demonstrates how to use the cubic b spline interpolator for regularly spaced data. +*/ +#include + +int main() +{ + // We begin with an array of samples: + std::vector v(500); + // And decide on a stepsize: + double step = 0.01; + + // Initialize the vector with a function we'd like to interpolate: + for (size_t i = 0; i < v.size(); ++i) + { + v[i] = sin(i*step); + } + // We could define an arbitrary start time, but for now we'll just use 0: + boost::math::interpolators::cardinal_cubic_b_spline spline(v.data(), v.size(), 0 /* start time */, step); + + // Now we can evaluate the spline wherever we please. + std::mt19937 gen; + boost::random::uniform_real_distribution absissa(0, v.size()*step); + for (size_t i = 0; i < 10; ++i) + { + double x = absissa(gen); + std::cout << "sin(" << x << ") = " << sin(x) << ", spline interpolation gives " << spline(x) << std::endl; + std::cout << "cos(" << x << ") = " << cos(x) << ", spline derivative interpolation gives " << spline.prime(x) << std::endl; + } + + // The next example is less trivial: + // We will try to figure out when the population of the United States crossed 100 million. + // Since the census is taken every 10 years, the data is equally spaced, so we can use the cubic b spline. + // Data taken from https://en.wikipedia.org/wiki/United_States_Census + // We'll start at the year 1860: + double t0 = 1860; + double time_step = 10; + std::vector population{31443321, /* 1860 */ + 39818449, /* 1870 */ + 50189209, /* 1880 */ + 62947714, /* 1890 */ + 76212168, /* 1900 */ + 92228496, /* 1910 */ + 106021537, /* 1920 */ + 122775046, /* 1930 */ + 132164569, /* 1940 */ + 150697361, /* 1950 */ + 179323175};/* 1960 */ + + // An eyeball estimate indicates that the population crossed 100 million around 1915. + // Let's see what interpolation says: + boost::math::interpolators::cardinal_cubic_b_spline p(population.data(), population.size(), t0, time_step); + + // Now create a function which has a zero at p = 100,000,000: + auto f = [=](double t){ return p(t) - 100000000; }; + + // Boost includes a bisection algorithm, which is robust, though not as fast as some others + // we provide, but let's try that first. We need a termination condition for it, which + // takes the two endpoints of the range and returns either true (stop) or false (keep going), + // we could use a predefined one such as boost::math::tools::eps_tolerance, but that + // won't stop until we have full double precision which is overkill, since we just need the + // endpoint to yield the same month. While we're at it, we'll keep track of the number of + // iterations required too, though this is strictly optional: + + auto termination = [](double left, double right) + { + double left_month = std::round((left - std::floor(left)) * 12 + 1); + double right_month = std::round((right - std::floor(right)) * 12 + 1); + return (left_month == right_month) && (std::floor(left) == std::floor(right)); + }; + std::uintmax_t iterations = 1000; + auto result = boost::math::tools::bisect(f, 1910.0, 1920.0, termination, iterations); + auto time = result.first; // termination condition ensures that both endpoints yield the same result + auto month = std::round((time - std::floor(time))*12 + 1); + auto year = std::floor(time); + std::cout << "The population of the United States surpassed 100 million on the "; + std::cout << month << "th month of " << year << std::endl; + std::cout << "Found in " << iterations << " iterations" << std::endl; + + // Since the cubic B spline offers the first derivative, we could equally have used Newton iterations, + // this takes "number of bits correct" as a termination condition - 20 should be plenty for what we need, + // and once again, we track how many iterations are taken: + + auto f_n = [=](double t) { return std::make_pair(p(t) - 100000000, p.prime(t)); }; + iterations = 1000; + time = boost::math::tools::newton_raphson_iterate(f_n, 1910.0, 1900.0, 2000.0, 20, iterations); + month = std::round((time - std::floor(time))*12 + 1); + year = std::floor(time); + std::cout << "The population of the United States surpassed 100 million on the "; + std::cout << month << "th month of " << year << std::endl; + std::cout << "Found in " << iterations << " iterations" << std::endl; + +} + +//] [/cubic_b_spline_example] + +//[cubic_b_spline_example_out +/*` Program output is: +[pre +sin(4.07362) = -0.802829, spline interpolation gives - 0.802829 +cos(4.07362) = -0.596209, spline derivative interpolation gives - 0.596209 +sin(0.677385) = 0.626758, spline interpolation gives 0.626758 +cos(0.677385) = 0.779214, spline derivative interpolation gives 0.779214 +sin(4.52896) = -0.983224, spline interpolation gives - 0.983224 +cos(4.52896) = -0.182402, spline derivative interpolation gives - 0.182402 +sin(4.17504) = -0.85907, spline interpolation gives - 0.85907 +cos(4.17504) = -0.511858, spline derivative interpolation gives - 0.511858 +sin(0.634934) = 0.593124, spline interpolation gives 0.593124 +cos(0.634934) = 0.805111, spline derivative interpolation gives 0.805111 +sin(4.84434) = -0.991307, spline interpolation gives - 0.991307 +cos(4.84434) = 0.131567, spline derivative interpolation gives 0.131567 +sin(4.56688) = -0.989432, spline interpolation gives - 0.989432 +cos(4.56688) = -0.144997, spline derivative interpolation gives - 0.144997 +sin(1.10517) = 0.893541, spline interpolation gives 0.893541 +cos(1.10517) = 0.448982, spline derivative interpolation gives 0.448982 +sin(3.1618) = -0.0202022, spline interpolation gives - 0.0202022 +cos(3.1618) = -0.999796, spline derivative interpolation gives - 0.999796 +sin(1.54084) = 0.999551, spline interpolation gives 0.999551 +cos(1.54084) = 0.0299566, spline derivative interpolation gives 0.0299566 +The population of the United States surpassed 100 million on the 11th month of 1915 +Found in 12 iterations +The population of the United States surpassed 100 million on the 11th month of 1915 +Found in 3 iterations +] +*/ +//] diff --git a/src/boost/libs/math/example/catmull_rom_example.cpp b/src/boost/libs/math/example/catmull_rom_example.cpp new file mode 100644 index 00000000..69a49707 --- /dev/null +++ b/src/boost/libs/math/example/catmull_rom_example.cpp @@ -0,0 +1,45 @@ +// Copyright Nick Thompson, 2017 + +// Distributed under 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 std::sin; +using std::cos; +using boost::math::catmull_rom; + +int main() +{ + std::cout << "This shows how to use Boost's Catmull-Rom spline to create an Archimedean spiral.\n"; + + // The Archimedean spiral is given by r = a*theta. We have set a = 1. + std::vector> spiral_points(500); + double theta_max = boost::math::constants::pi(); + for (size_t i = 0; i < spiral_points.size(); ++i) + { + double theta = ((double) i/ (double) spiral_points.size())*theta_max; + spiral_points[i] = {theta*cos(theta), theta*sin(theta)}; + } + + auto archimedean = catmull_rom>(std::move(spiral_points)); + double max_s = archimedean.max_parameter(); + std::cout << "Max s = " << max_s << std::endl; + for (double s = 0; s < max_s; s += 0.01) + { + auto p = archimedean(s); + double x = p[0]; + double y = p[1]; + double r = sqrt(x*x + y*y); + double theta = atan2(y/r, x/r); + std::cout << "r = " << r << ", theta = " << theta << ", r - theta = " << r - theta << std::endl; + } + + return 0; +} diff --git a/src/boost/libs/math/example/chi_square_std_dev_test.cpp b/src/boost/libs/math/example/chi_square_std_dev_test.cpp new file mode 100644 index 00000000..e9747a3f --- /dev/null +++ b/src/boost/libs/math/example/chi_square_std_dev_test.cpp @@ -0,0 +1,555 @@ +// Copyright John Maddock 2006, 2007 +// Copyright Paul A. Bristow 2010 + +// 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 +using std::cout; using std::endl; +using std::left; using std::fixed; using std::right; using std::scientific; +#include +using std::setw; +using std::setprecision; + +#include + +int error_result = 0; + +void confidence_limits_on_std_deviation( + double Sd, // Sample Standard Deviation + unsigned N) // Sample size +{ + // Calculate confidence intervals for the standard deviation. + // For example if we set the confidence limit to + // 0.95, we know that if we repeat the sampling + // 100 times, then we expect that the true standard deviation + // will be between out limits on 95 occations. + // Note: this is not the same as saying a 95% + // confidence interval means that there is a 95% + // probability that the interval contains the true standard deviation. + // The interval computed from a given sample either + // contains the true standard deviation or it does not. + // See http://www.itl.nist.gov/div898/handbook/eda/section3/eda358.htm + + // using namespace boost::math; // potential name ambiguity with std + using boost::math::chi_squared; + using boost::math::quantile; + using boost::math::complement; + + // Print out general info: + cout << + "________________________________________________\n" + "2-Sided Confidence Limits For Standard Deviation\n" + "________________________________________________\n\n"; + cout << setprecision(7); + cout << setw(40) << left << "Number of Observations" << "= " << N << "\n"; + cout << setw(40) << left << "Standard Deviation" << "= " << Sd << "\n"; + // + // Define a table of significance/risk levels: + double alpha[] = { 0.5, 0.25, 0.1, 0.05, 0.01, 0.001, 0.0001, 0.00001 }; + // + // Start by declaring the distribution we'll need: + chi_squared dist(N - 1); + // + // Print table header: + // + cout << "\n\n" + "_____________________________________________\n" + "Confidence Lower Upper\n" + " Value (%) Limit Limit\n" + "_____________________________________________\n"; + // + // Now print out the data for the table rows. + for(unsigned i = 0; i < sizeof(alpha)/sizeof(alpha[0]); ++i) + { + // Confidence value: + cout << fixed << setprecision(3) << setw(10) << right << 100 * (1-alpha[i]); + // Calculate limits: + double lower_limit = sqrt((N - 1) * Sd * Sd / quantile(complement(dist, alpha[i] / 2))); + double upper_limit = sqrt((N - 1) * Sd * Sd / quantile(dist, alpha[i] / 2)); + // Print Limits: + cout << fixed << setprecision(5) << setw(15) << right << lower_limit; + cout << fixed << setprecision(5) << setw(15) << right << upper_limit << endl; + } + cout << endl; +} // void confidence_limits_on_std_deviation + +void confidence_limits_on_std_deviation_alpha( + double Sd, // Sample Standard Deviation + double alpha // confidence + ) +{ // Calculate confidence intervals for the standard deviation. + // for the alpha parameter, for a range number of observations, + // from a mere 2 up to a million. + // O. L. Davies, Statistical Methods in Research and Production, ISBN 0 05 002437 X, + // 4.33 Page 68, Table H, pp 452 459. + + // using namespace std; + // using namespace boost::math; + using boost::math::chi_squared; + using boost::math::quantile; + using boost::math::complement; + + // Define a table of numbers of observations: + unsigned int obs[] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 30, 40 , 50, 60, 100, 120, 1000, 10000, 50000, 100000, 1000000}; + + cout << // Print out heading: + "________________________________________________\n" + "2-Sided Confidence Limits For Standard Deviation\n" + "________________________________________________\n\n"; + cout << setprecision(7); + cout << setw(40) << left << "Confidence level (two-sided) " << "= " << alpha << "\n"; + cout << setw(40) << left << "Standard Deviation" << "= " << Sd << "\n"; + + cout << "\n\n" // Print table header: + "_____________________________________________\n" + "Observations Lower Upper\n" + " Limit Limit\n" + "_____________________________________________\n"; + for(unsigned i = 0; i < sizeof(obs)/sizeof(obs[0]); ++i) + { + unsigned int N = obs[i]; // Observations + // Start by declaring the distribution with the appropriate : + chi_squared dist(N - 1); + + // Now print out the data for the table row. + cout << fixed << setprecision(3) << setw(10) << right << N; + // Calculate limits: (alpha /2 because it is a two-sided (upper and lower limit) test. + double lower_limit = sqrt((N - 1) * Sd * Sd / quantile(complement(dist, alpha / 2))); + double upper_limit = sqrt((N - 1) * Sd * Sd / quantile(dist, alpha / 2)); + // Print Limits: + cout << fixed << setprecision(4) << setw(15) << right << lower_limit; + cout << fixed << setprecision(4) << setw(15) << right << upper_limit << endl; + } + cout << endl; +}// void confidence_limits_on_std_deviation_alpha + +void chi_squared_test( + double Sd, // Sample std deviation + double D, // True std deviation + unsigned N, // Sample size + double alpha) // Significance level +{ + // + // A Chi Squared test applied to a single set of data. + // We are testing the null hypothesis that the true + // standard deviation of the sample is D, and that any variation is down + // to chance. We can also test the alternative hypothesis + // that any difference is not down to chance. + // See http://www.itl.nist.gov/div898/handbook/eda/section3/eda358.htm + // + // using namespace boost::math; + using boost::math::chi_squared; + using boost::math::quantile; + using boost::math::complement; + using boost::math::cdf; + + // Print header: + cout << + "______________________________________________\n" + "Chi Squared test for sample standard deviation\n" + "______________________________________________\n\n"; + cout << setprecision(5); + cout << setw(55) << left << "Number of Observations" << "= " << N << "\n"; + cout << setw(55) << left << "Sample Standard Deviation" << "= " << Sd << "\n"; + cout << setw(55) << left << "Expected True Standard Deviation" << "= " << D << "\n\n"; + // + // Now we can calculate and output some stats: + // + // test-statistic: + double t_stat = (N - 1) * (Sd / D) * (Sd / D); + cout << setw(55) << left << "Test Statistic" << "= " << t_stat << "\n"; + // + // Finally define our distribution, and get the probability: + // + chi_squared dist(N - 1); + double p = cdf(dist, t_stat); + cout << setw(55) << left << "CDF of test statistic: " << "= " + << setprecision(3) << scientific << p << "\n"; + double ucv = quantile(complement(dist, alpha)); + double ucv2 = quantile(complement(dist, alpha / 2)); + double lcv = quantile(dist, alpha); + double lcv2 = quantile(dist, alpha / 2); + cout << setw(55) << left << "Upper Critical Value at alpha: " << "= " + << setprecision(3) << scientific << ucv << "\n"; + cout << setw(55) << left << "Upper Critical Value at alpha/2: " << "= " + << setprecision(3) << scientific << ucv2 << "\n"; + cout << setw(55) << left << "Lower Critical Value at alpha: " << "= " + << setprecision(3) << scientific << lcv << "\n"; + cout << setw(55) << left << "Lower Critical Value at alpha/2: " << "= " + << setprecision(3) << scientific << lcv2 << "\n\n"; + // + // Finally print out results of alternative hypothesis: + // + cout << setw(55) << left << + "Results for Alternative Hypothesis and alpha" << "= " + << setprecision(4) << fixed << alpha << "\n\n"; + cout << "Alternative Hypothesis Conclusion\n"; + cout << "Standard Deviation != " << setprecision(3) << fixed << D << " "; + if((ucv2 < t_stat) || (lcv2 > t_stat)) + cout << "NOT REJECTED\n"; + else + cout << "REJECTED\n"; + cout << "Standard Deviation < " << setprecision(3) << fixed << D << " "; + if(lcv > t_stat) + cout << "NOT REJECTED\n"; + else + cout << "REJECTED\n"; + cout << "Standard Deviation > " << setprecision(3) << fixed << D << " "; + if(ucv < t_stat) + cout << "NOT REJECTED\n"; + else + cout << "REJECTED\n"; + cout << endl << endl; +} // void chi_squared_test + +void chi_squared_sample_sized( + double diff, // difference from variance to detect + double variance) // true variance +{ + using namespace std; + // using boost::math; + using boost::math::chi_squared; + using boost::math::quantile; + using boost::math::complement; + using boost::math::cdf; + + try + { + cout << // Print out general info: + "_____________________________________________________________\n" + "Estimated sample sizes required for various confidence levels\n" + "_____________________________________________________________\n\n"; + cout << setprecision(5); + cout << setw(40) << left << "True Variance" << "= " << variance << "\n"; + cout << setw(40) << left << "Difference to detect" << "= " << diff << "\n"; + // + // Define a table of significance levels: + // + double alpha[] = { 0.5, 0.33333333333333333333333, 0.25, 0.1, 0.05, 0.01, 0.001, 0.0001, 0.00001 }; + // + // Print table header: + // + cout << "\n\n" + "_______________________________________________________________\n" + "Confidence Estimated Estimated\n" + " Value (%) Sample Size Sample Size\n" + " (lower one- (upper one-\n" + " sided test) sided test)\n" + "_______________________________________________________________\n"; + // + // Now print out the data for the table rows. + // + for(unsigned i = 0; i < sizeof(alpha)/sizeof(alpha[0]); ++i) + { + // Confidence value: + cout << fixed << setprecision(3) << setw(10) << right << 100 * (1-alpha[i]); + // Calculate df for a lower single-sided test: + double df = chi_squared::find_degrees_of_freedom( + -diff, alpha[i], alpha[i], variance); + // Convert to integral sample size (df is a floating point value in this implementation): + double size = ceil(df) + 1; + // Print size: + cout << fixed << setprecision(0) << setw(16) << right << size; + // Calculate df for an upper single-sided test: + df = chi_squared::find_degrees_of_freedom( + diff, alpha[i], alpha[i], variance); + // Convert to integral sample size: + size = ceil(df) + 1; + // Print size: + cout << fixed << setprecision(0) << setw(16) << right << size << endl; + } + cout << endl; + } + catch(const std::exception& e) + { // Always useful to include try & catch blocks because default policies + // are to throw exceptions on arguments that cause errors like underflow, overflow. + // Lacking try & catch blocks, the program will abort without a message below, + // which may give some helpful clues as to the cause of the exception. + std::cout << + "\n""Message from thrown exception was:\n " << e.what() << std::endl; + ++error_result; + } +} // chi_squared_sample_sized + +int main() +{ + // Run tests for Gear data + // see http://www.itl.nist.gov/div898/handbook/eda/section3/eda3581.htm + // Tests measurements of gear diameter. + // + confidence_limits_on_std_deviation(0.6278908E-02, 100); + chi_squared_test(0.6278908E-02, 0.1, 100, 0.05); + chi_squared_sample_sized(0.1 - 0.6278908E-02, 0.1); + // + // Run tests for silicon wafer fabrication data. + // see http://www.itl.nist.gov/div898/handbook/prc/section2/prc23.htm + // A supplier of 100 ohm.cm silicon wafers claims that his fabrication + // process can produce wafers with sufficient consistency so that the + // standard deviation of resistivity for the lot does not exceed + // 10 ohm.cm. A sample of N = 10 wafers taken from the lot has a + // standard deviation of 13.97 ohm.cm + // + confidence_limits_on_std_deviation(13.97, 10); + chi_squared_test(13.97, 10.0, 10, 0.05); + chi_squared_sample_sized(13.97 * 13.97 - 100, 100); + chi_squared_sample_sized(55, 100); + chi_squared_sample_sized(1, 100); + + // List confidence interval multipliers for standard deviation + // for a range of numbers of observations from 2 to a million, + // and for a few alpha values, 0.1, 0.05, 0.01 for condfidences 90, 95, 99 % + confidence_limits_on_std_deviation_alpha(1., 0.1); + confidence_limits_on_std_deviation_alpha(1., 0.05); + confidence_limits_on_std_deviation_alpha(1., 0.01); + + return error_result; +} + +/* + +________________________________________________ +2-Sided Confidence Limits For Standard Deviation +________________________________________________ +Number of Observations = 100 +Standard Deviation = 0.006278908 +_____________________________________________ +Confidence Lower Upper + Value (%) Limit Limit +_____________________________________________ + 50.000 0.00601 0.00662 + 75.000 0.00582 0.00685 + 90.000 0.00563 0.00712 + 95.000 0.00551 0.00729 + 99.000 0.00530 0.00766 + 99.900 0.00507 0.00812 + 99.990 0.00489 0.00855 + 99.999 0.00474 0.00895 +______________________________________________ +Chi Squared test for sample standard deviation +______________________________________________ +Number of Observations = 100 +Sample Standard Deviation = 0.00628 +Expected True Standard Deviation = 0.10000 +Test Statistic = 0.39030 +CDF of test statistic: = 1.438e-099 +Upper Critical Value at alpha: = 1.232e+002 +Upper Critical Value at alpha/2: = 1.284e+002 +Lower Critical Value at alpha: = 7.705e+001 +Lower Critical Value at alpha/2: = 7.336e+001 +Results for Alternative Hypothesis and alpha = 0.0500 +Alternative Hypothesis Conclusion +Standard Deviation != 0.100 NOT REJECTED +Standard Deviation < 0.100 NOT REJECTED +Standard Deviation > 0.100 REJECTED +_____________________________________________________________ +Estimated sample sizes required for various confidence levels +_____________________________________________________________ +True Variance = 0.10000 +Difference to detect = 0.09372 +_______________________________________________________________ +Confidence Estimated Estimated + Value (%) Sample Size Sample Size + (lower one- (upper one- + sided test) sided test) +_______________________________________________________________ + 50.000 2 2 + 66.667 2 5 + 75.000 2 10 + 90.000 4 32 + 95.000 5 52 + 99.000 8 102 + 99.900 13 178 + 99.990 18 257 + 99.999 23 337 +________________________________________________ +2-Sided Confidence Limits For Standard Deviation +________________________________________________ +Number of Observations = 10 +Standard Deviation = 13.9700000 +_____________________________________________ +Confidence Lower Upper + Value (%) Limit Limit +_____________________________________________ + 50.000 12.41880 17.25579 + 75.000 11.23084 19.74131 + 90.000 10.18898 22.98341 + 95.000 9.60906 25.50377 + 99.000 8.62898 31.81825 + 99.900 7.69466 42.51593 + 99.990 7.04085 55.93352 + 99.999 6.54517 73.00132 +______________________________________________ +Chi Squared test for sample standard deviation +______________________________________________ +Number of Observations = 10 +Sample Standard Deviation = 13.97000 +Expected True Standard Deviation = 10.00000 +Test Statistic = 17.56448 +CDF of test statistic: = 9.594e-001 +Upper Critical Value at alpha: = 1.692e+001 +Upper Critical Value at alpha/2: = 1.902e+001 +Lower Critical Value at alpha: = 3.325e+000 +Lower Critical Value at alpha/2: = 2.700e+000 +Results for Alternative Hypothesis and alpha = 0.0500 +Alternative Hypothesis Conclusion +Standard Deviation != 10.000 REJECTED +Standard Deviation < 10.000 REJECTED +Standard Deviation > 10.000 NOT REJECTED +_____________________________________________________________ +Estimated sample sizes required for various confidence levels +_____________________________________________________________ +True Variance = 100.00000 +Difference to detect = 95.16090 +_______________________________________________________________ +Confidence Estimated Estimated + Value (%) Sample Size Sample Size + (lower one- (upper one- + sided test) sided test) +_______________________________________________________________ + 50.000 2 2 + 66.667 2 5 + 75.000 2 10 + 90.000 4 32 + 95.000 5 51 + 99.000 7 99 + 99.900 11 174 + 99.990 15 251 + 99.999 20 330 +_____________________________________________________________ +Estimated sample sizes required for various confidence levels +_____________________________________________________________ +True Variance = 100.00000 +Difference to detect = 55.00000 +_______________________________________________________________ +Confidence Estimated Estimated + Value (%) Sample Size Sample Size + (lower one- (upper one- + sided test) sided test) +_______________________________________________________________ + 50.000 2 2 + 66.667 4 10 + 75.000 8 21 + 90.000 23 71 + 95.000 36 115 + 99.000 71 228 + 99.900 123 401 + 99.990 177 580 + 99.999 232 762 +_____________________________________________________________ +Estimated sample sizes required for various confidence levels +_____________________________________________________________ +True Variance = 100.00000 +Difference to detect = 1.00000 +_______________________________________________________________ +Confidence Estimated Estimated + Value (%) Sample Size Sample Size + (lower one- (upper one- + sided test) sided test) +_______________________________________________________________ + 50.000 2 2 + 66.667 14696 14993 + 75.000 36033 36761 + 90.000 130079 132707 + 95.000 214283 218612 + 99.000 428628 437287 + 99.900 756333 771612 + 99.990 1095435 1117564 + 99.999 1440608 1469711 +________________________________________________ +2-Sided Confidence Limits For Standard Deviation +________________________________________________ +Confidence level (two-sided) = 0.1000000 +Standard Deviation = 1.0000000 +_____________________________________________ +Observations Lower Upper + Limit Limit +_____________________________________________ + 2 0.5102 15.9472 + 3 0.5778 4.4154 + 4 0.6196 2.9200 + 5 0.6493 2.3724 + 6 0.6720 2.0893 + 7 0.6903 1.9154 + 8 0.7054 1.7972 + 9 0.7183 1.7110 + 10 0.7293 1.6452 + 15 0.7688 1.4597 + 20 0.7939 1.3704 + 30 0.8255 1.2797 + 40 0.8454 1.2320 + 50 0.8594 1.2017 + 60 0.8701 1.1805 + 100 0.8963 1.1336 + 120 0.9045 1.1203 + 1000 0.9646 1.0383 + 10000 0.9885 1.0118 + 50000 0.9948 1.0052 + 100000 0.9963 1.0037 + 1000000 0.9988 1.0012 +________________________________________________ +2-Sided Confidence Limits For Standard Deviation +________________________________________________ +Confidence level (two-sided) = 0.0500000 +Standard Deviation = 1.0000000 +_____________________________________________ +Observations Lower Upper + Limit Limit +_____________________________________________ + 2 0.4461 31.9102 + 3 0.5207 6.2847 + 4 0.5665 3.7285 + 5 0.5991 2.8736 + 6 0.6242 2.4526 + 7 0.6444 2.2021 + 8 0.6612 2.0353 + 9 0.6755 1.9158 + 10 0.6878 1.8256 + 15 0.7321 1.5771 + 20 0.7605 1.4606 + 30 0.7964 1.3443 + 40 0.8192 1.2840 + 50 0.8353 1.2461 + 60 0.8476 1.2197 + 100 0.8780 1.1617 + 120 0.8875 1.1454 + 1000 0.9580 1.0459 + 10000 0.9863 1.0141 + 50000 0.9938 1.0062 + 100000 0.9956 1.0044 + 1000000 0.9986 1.0014 +________________________________________________ +2-Sided Confidence Limits For Standard Deviation +________________________________________________ +Confidence level (two-sided) = 0.0100000 +Standard Deviation = 1.0000000 +_____________________________________________ +Observations Lower Upper + Limit Limit +_____________________________________________ + 2 0.3562 159.5759 + 3 0.4344 14.1244 + 4 0.4834 6.4675 + 5 0.5188 4.3960 + 6 0.5464 3.4848 + 7 0.5688 2.9798 + 8 0.5875 2.6601 + 9 0.6036 2.4394 + 10 0.6177 2.2776 + 15 0.6686 1.8536 + 20 0.7018 1.6662 + 30 0.7444 1.4867 + 40 0.7718 1.3966 + 50 0.7914 1.3410 + 60 0.8065 1.3026 + 100 0.8440 1.2200 + 120 0.8558 1.1973 + 1000 0.9453 1.0609 + 10000 0.9821 1.0185 + 50000 0.9919 1.0082 + 100000 0.9943 1.0058 + 1000000 0.9982 1.0018 +*/ + diff --git a/src/boost/libs/math/example/constants_eg1.cpp b/src/boost/libs/math/example/constants_eg1.cpp new file mode 100644 index 00000000..53516145 --- /dev/null +++ b/src/boost/libs/math/example/constants_eg1.cpp @@ -0,0 +1,192 @@ +// Copyright Paul Bristow 2013. +// Copyright John Maddock 2010. + +// 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) + +/*! \brief Examples of using the enhanced math constants. + \details This allows for access to constants via functions like @c pi(), + and also via namespaces, @c using @c namespace boost::math::double_constants; + called simply @c pi. +*/ + +#include + +#include +using std::cout; +using std::endl; + +#include +using std::numeric_limits; + +/*! \brief Examples of a template function using constants. + \details This example shows using of constants from function calls like @c pi(), + rather than the 'cute' plain @c pi use in non-template applications. + + \tparam Real radius parameter that can be a built-in like float, double, + or a user-defined type like multiprecision. + \returns Area = pi * radius ^ 2 +*/ + +//[math_constants_eg1 +template +Real area(Real r) +{ + using namespace boost::math::constants; + + return pi() * r * r; +} +//] [/math_constants_eg1] + +int main() +{ + + { // Boost.Math constants using function calls like pi(). + // using namespace boost::math::constants; + + using boost::math::constants::pi; + using boost::math::constants::one_div_two_pi; + +#ifdef BOOST_NO_CXX11_NUMERIC_LIMITS + std::size_t max_digits10 = 2 + std::numeric_limits::digits * 3010/10000; +#else + std::size_t max_digits10 = std::numeric_limits::max_digits10; +#endif + + std::cout.precision(max_digits10); + cout << "double pi = boost::math::double_constants::pi = " << pi() << endl; + // double pi = boost::math::double_constants::pi = 3.1415926535897931 + double r = 1.234567890123456789; + double d = pi() * r * r; + + cout << "d = " << d << ", r = " << r << endl; + + float rf = 0.987654321987654321f; + + float pif = boost::math::constants::pi(); + cout << "pidf = boost::math::constants::pi() = " << pif << endl; + // pidf = boost::math::float_constants::pi = 3.1415927410125732 + + //float df = pi * rf * rf; // conversion from 'const double' to 'float', possible loss of data. + float df = pif * rf * rf; + + cout << "df = " << df << ", rf = " << rf << endl; + + cout << "one_div_two_pi " << one_div_two_pi() << endl; + + using boost::math::constants::one_div_two_pi; + + cout << "one_div_root_two_pi " << one_div_two_pi() << endl; + } + + { // Boost math new constants using namespace selected values, like pi. + + //using namespace boost::math::float_constants; + using namespace boost::math::double_constants; + + double my2pi = two_pi; // Uses boost::math::double_constants::two_pi; + + cout << "double my2pi = " << my2pi << endl; + + using boost::math::float_constants::e; + float my_e = e; + cout << "float my_e " << my_e << endl; + + double my_pi = boost::math::double_constants::pi; + cout << "double my_pi = boost::math::double_constants::pi = " << my_pi << endl; + + // If you try to use two namespaces, this may, of course, create ambiguity: + // it is not too difficult to do this inadvertently. + using namespace boost::math::float_constants; + //cout << pi << endl; // error C2872: 'pi' : ambiguous symbol. + + } + { + +//[math_constants_ambiguity + // If you use more than one namespace, this will, of course, create ambiguity: + using namespace boost::math::double_constants; + using namespace boost::math::constants; + + //double my_pi = pi(); // error C2872: 'pi' : ambiguous symbol + //double my_pi2 = pi; // Context does not allow for disambiguation of overloaded function + + // It is also possible to create ambiguity inadvertently, + // perhaps in other peoples code, + // by making the scope of a namespace declaration wider than necessary, + // therefore is it prudent to avoid this risk by localising the scope of such definitions. +//] [/math_constants_ambiguity] + + } + + { // You can, of course, use both methods of access if both are fully qualified, for examples: + + //cout.precision(std::numeric_limits::max_digits10);// Ideally. + cout.precision(2 + std::numeric_limits::digits * 3010/10000); // If no max_digits10. + + double my_pi1 = boost::math::constants::pi(); + double my_pid = boost::math::double_constants::pi; + cout << "boost::math::constants::pi() = " << my_pi1 << endl + << "boost::math::double_constants::pi = " << my_pid << endl; + + // cout.precision(std::numeric_limits::max_digits10); // Ideally. + cout.precision(2 + std::numeric_limits::digits * 3010/10000); // If no max_digits10. + float my_pif = boost::math::float_constants::pi; + cout << "boost::math::float_constants::pi = " << my_pif << endl; + + } + + { // Use with templates + + // \warning it is important to be very careful with the type provided as parameter. + // For example, naively providing an @b integer instead of a floating-point type can be disastrous. + // cout << "Area = " << area(2) << endl; // warning : 'return' : conversion from 'double' to 'int', possible loss of data + // Failure to heed this warning can lead to very wrong answers! + // Area = 12 !! = 3 * 2 * 2 +//[math_constants_template_integer_type + //cout << "Area = " << area(2) << endl; // Area = 12! + cout << "Area = " << area(2.) << endl; // Area = 12.566371 + + // You can also avoid this by being explicit about the type of @c area. + cout << "Area = " << area(2) << endl; + +//] [/math_constants_template_integer_type] + + + } +/* +{ + using boost::math::constants::pi; + //double my_pi3 = pi(); // OK + //double my_pi4 = pi<>(); cannot find template type. + //double my_pi4 = pi(); // Can't find a function. + + } +*/ + +} // int main() + +/*[constants_eq1_output + +Output: + + double pi = boost::math::double_constants::pi = 3.1415926535897931 + d = 4.7882831840285398, r = 1.2345678901234567 + pidf = boost::math::constants::pi() = 3.1415927410125732 + df = 3.0645015239715576, rf = 0.98765432834625244 + one_div_two_pi 0.15915494309189535 + one_div_root_two_pi 0.15915494309189535 + double my2pi = 6.2831853071795862 + float my_e 2.7182817459106445 + double my_pi = boost::math::double_constants::pi = 3.1415926535897931 + boost::math::constants::pi() = 3.1415926535897931 + boost::math::double_constants::pi = 3.1415926535897931 + boost::math::float_constants::pi = 3.1415927410125732 + Area = 12.566370614359172 + Area = 12.566370614359172 + + +] [/constants_eq1_output] +*/ diff --git a/src/boost/libs/math/example/continued_fractions.cpp b/src/boost/libs/math/example/continued_fractions.cpp new file mode 100644 index 00000000..23f479fc --- /dev/null +++ b/src/boost/libs/math/example/continued_fractions.cpp @@ -0,0 +1,150 @@ +// (C) Copyright John Maddock 2018. +// 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 + +//[golden_ratio_1 +template +struct golden_ratio_fraction +{ + typedef T result_type; + + result_type operator()() + { + return 1; + } +}; +//] + +//[cf_tan_fraction +template +struct tan_fraction +{ +private: + T a, b; +public: + tan_fraction(T v) + : a(-v * v), b(-1) + {} + + typedef std::pair result_type; + + std::pair operator()() + { + b += 2; + return std::make_pair(a, b); + } +}; +//] +//[cf_tan +template +T tan(T a) +{ + tan_fraction fract(a); + return a / continued_fraction_b(fract, std::numeric_limits::epsilon()); +} +//] +//[cf_expint_fraction +template +struct expint_fraction +{ + typedef std::pair result_type; + expint_fraction(unsigned n_, T z_) : b(z_ + T(n_)), i(-1), n(n_) {} + std::pair operator()() + { + std::pair result = std::make_pair(-static_cast((i + 1) * (n + i)), b); + b += 2; + ++i; + return result; + } +private: + T b; + int i; + unsigned n; +}; +//] +//[cf_expint +template +inline std::complex expint_as_fraction(unsigned n, std::complex const& z) +{ + boost::uintmax_t max_iter = 1000; + expint_fraction > f(n, z); + std::complex result = boost::math::tools::continued_fraction_b( + f, + std::complex(std::numeric_limits::epsilon()), + max_iter); + result = exp(-z) / result; + return result; +} +//] +//[cf_upper_gamma_fraction +template +struct upper_incomplete_gamma_fract +{ +private: + typedef typename T::value_type scalar_type; + T z, a; + int k; +public: + typedef std::pair result_type; + + upper_incomplete_gamma_fract(T a1, T z1) + : z(z1 - a1 + scalar_type(1)), a(a1), k(0) + { + } + + result_type operator()() + { + ++k; + z += scalar_type(2); + return result_type(scalar_type(k) * (a - scalar_type(k)), z); + } +}; +//] +//[cf_gamma_Q +template +inline std::complex gamma_Q_as_fraction(const std::complex& a, const std::complex& z) +{ + upper_incomplete_gamma_fract > f(a, z); + std::complex eps(std::numeric_limits::epsilon()); + return pow(z, a) / (exp(z) *(z - a + T(1) + boost::math::tools::continued_fraction_a(f, eps))); +} +//] +inline boost::multiprecision::cpp_complex_50 gamma_Q_as_fraction(const boost::multiprecision::cpp_complex_50& a, const boost::multiprecision::cpp_complex_50& z) +{ + upper_incomplete_gamma_fract f(a, z); + boost::multiprecision::cpp_complex_50 eps(std::numeric_limits::epsilon()); + return pow(z, a) / (exp(z) * (z - a + 1 + boost::math::tools::continued_fraction_a(f, eps))); +} + + +int main() +{ + using namespace boost::math::tools; + + //[cf_gr + golden_ratio_fraction func; + double gr = continued_fraction_a( + func, + std::numeric_limits::epsilon()); + std::cout << "The golden ratio is: " << gr << std::endl; + //] + + std::cout << tan(0.5) << std::endl; + + std::complex arg(3, 2); + std::cout << expint_as_fraction(5, arg) << std::endl; + + std::complex a(3, 3), z(3, 2); + std::cout << gamma_Q_as_fraction(a, z) << std::endl; + + boost::multiprecision::cpp_complex_50 am(3, 3), zm(3, 2); + std::cout << gamma_Q_as_fraction(am, zm) << std::endl; + + return 0; +} diff --git a/src/boost/libs/math/example/cstdfloat_example.cpp b/src/boost/libs/math/example/cstdfloat_example.cpp new file mode 100644 index 00000000..761e811b --- /dev/null +++ b/src/boost/libs/math/example/cstdfloat_example.cpp @@ -0,0 +1,488 @@ +// Copyright John Maddock 2014 +// Copyright Christopher Kormanyos 2014. +// Copyright Paul A. Bristow 2016. + +// 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) + +// Contains Quickbook snippets as C++ comments - do not remove. + +/* +`This example shows use of a specified-width floating-point typedef +to evaluate a moderately complex math function using +[@http://en.wikipedia.org/wiki/Double-precision_floating-point_format IEEE754 64-bit double-precision]. +about 15 decimal digits `std::numeric_limits::digits10`, +(but never exceeding 17 decimal digits `std::numeric_limits::max_digits10`). + +The Jahnke-Emden lambda function is described at + +Weisstein, Eric W. "Lambda Function." From MathWorld--A Wolfram Web Resource. +http://mathworld.wolfram.com/LambdaFunction.html + +E. Jahnke and F. Emden, "Tables of Functions with Formulae and Curves," +Dover, New York, 4th ed., (1945), pages 180-188. + +*/ + +//[cstdfloat_example_1 +#include // For float_64_t, float128_t. Must be first include! +#include // for pow function. +#include // For gamma function. +//] [/cstdfloat_example_1] +#include + +#include + +/*! +Function max_digits10 +Returns maximum number of possibly significant decimal digits for a floating-point type FPT, +even for older compilers/standard libraries that +lack support for std::numeric_limits::max_digits10, +when the Kahan formula 2 + binary_digits * 0.3010 is used instead. +Also provides the correct result for Visual Studio 2010 +(where the value 8 provided for float is wrong). +*/ +namespace boost +{ +template +const int max_digits10() +{ +// Since max_digits10 is not defined (or wrong) on older systems, define a local max_digits10. + // Usage: int m = max_digits10(); + const int m = +#if (defined BOOST_NO_CXX11_NUMERIC_LIMITS) || (_MSC_VER == 1600) // is wrongly 8 not 9 for VS2010. + 2 + std::numeric_limits::digits * 3010/10000; +#else + std::numeric_limits::max_digits10; +#endif + return m; +} +} // namespace boost + +//`Define the Jahnke-Emden_lambda function. +//[cstdfloat_example_2 +boost::float64_t jahnke_emden_lambda(boost::float64_t v, boost::float64_t x) +{ + const boost::float64_t gamma_v_plus_one = boost::math::tgamma(v + 1); + const boost::float64_t x_half_pow_v = std::pow(x /2, v); + + return gamma_v_plus_one * boost::math::cyl_bessel_j(x, v) / x_half_pow_v; +} +//] [/cstdfloat_example_2] + +int main() +{ + std::cout.setf(std::ios::showpoint); // show all significant trailing zeros. + + long double p = 1.L; + //std::cout.precision(std::numeric_limits::digits10); + + std::cout << "pi = " << p << std::endl; + +//[cstdfloat_example_3 +//`Ensure that all possibly significant digits (17) including trailing zeros are shown. + + std::cout.precision(std::numeric_limits::max_digits10); + std::cout.setf(std::ios::showpoint); // Show trailing zeros. + + try + { // Always use try'n'catch blocks to ensure any error messages are displayed. + + // Evaluate and display an evaluation of the Jahnke-Emden lambda function: + boost::float64_t v = 1.; + boost::float64_t x = 1.; + std::cout << jahnke_emden_lambda(v, x) << std::endl; // 0.88010117148986700 +//] [/cstdfloat_example_3] + + // We can show some evaluations with various precisions: + { // float64_t + for (int i = 0; i < 10; i++) + { + std::cout << std::setprecision(2) << boost::float64_t(i) << ' ' + << std::setprecision(std::numeric_limits::max_digits10) + << jahnke_emden_lambda(boost::float64_t(i), v) << std::endl; // + } + } + { // floatmax_t = the maximum available on this platform. + for (int i = 0; i < 10; i++) + { + std::cout << std::setprecision(2) << boost::floatmax_t(i) << ' ' + << std::setprecision(std::numeric_limits::max_digits10) + << jahnke_emden_lambda(boost::floatmax_t(i), v) << std::endl; // + } + } + // Show the precision of long double (this might be 64, 80 or 128 bits). + std::cout << "Floating-point type long double is available with:" << std::endl; + std::cout << " std::numeric_limits::digits10 == " + << std::numeric_limits::digits10 << std::endl; // 18 + std::cout << " std::numeric_limits::max_digits10 == " + << std::numeric_limits::max_digits10 << std::endl; // 21 + long double p = boost::math::constants::pi(); + std::cout.precision(std::numeric_limits::digits10); + std::cout << "pi = " << p << std::endl; + +//[cstdfloat_constant_2 +//`These allow floating-point [*constants of at least the specified width] to be declared: + + // Declare Archimedes' constant using float32_t with approximately 7 decimal digits of precision. + static const boost::float32_t pi = BOOST_FLOAT32_C(3.1415926536); + + // Declare the Euler-gamma constant with approximately 15 decimal digits of precision. + static const boost::float64_t euler = + BOOST_FLOAT64_C(0.57721566490153286060651209008240243104216); + + // Declare the Golden Ratio constant with the maximum decimal digits of precision that the platform supports. + static const boost::floatmax_t golden_ratio = + BOOST_FLOATMAX_C(1.61803398874989484820458683436563811772); +//] [/cstdfloat_constant_2] + +// http://www.boost.org/doc/libs/1_55_0/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/float128.html +//[cstdfloat_constant_1 +// Display the constant pi to the maximum available precision. + boost::floatmax_t pi_max = boost::math::constants::pi(); + std::cout.precision(std::numeric_limits::digits10); + std::cout << "Most precise pi = " << pi_max << std::endl; +// If floatmax_t is float_128_t, then +// Most precise pi = 3.141592653589793238462643383279503 +//] [/cstdfloat_constant_1] + +// Test all the floating-point precisions in turn, and if they are available +// then display how many decimal digits of precision. +#ifdef BOOST_FLOAT16_C + std::cout << "Floating-point type boost::float16_t is available." << std::endl; +#else + std::cout << "Floating-point type boost::float16_t is NOT available." << std::endl; +#endif + +#ifdef BOOST_FLOAT32_C + std::cout << "Floating-point type boost::float32_t is available." << std::endl; + std::cout << " std::numeric_limits::digits10 == " + << std::numeric_limits::digits10 << std::endl; + std::cout << " std::numeric_limits::max_digits10 == " + << std::numeric_limits::max_digits10 << std::endl; +#else + std::cout << "Floating-point type boost::float32_t is NOT available." << std::endl; +#endif + +#ifdef BOOST_FLOAT64_C + std::cout << "Floating-point type boost::float64_t is available." << std::endl; + std::cout << " std::numeric_limits::digits10 == " + << std::numeric_limits::digits10 << std::endl; + std::cout << " std::numeric_limits::max_digits10 == " + << std::numeric_limits::max_digits10 << std::endl; +#else + std::cout << "Floating-point type boost::float64_t is NOT available." << std::endl; +#endif + +#ifdef BOOST_FLOAT80_C + std::cout << "Floating-point type boost::float80_t is available." << std::endl; + std::cout << " std::numeric_limits::digits10 == " + << std::numeric_limits::digits10 << std::endl; + std::cout << " std::numeric_limits::max_digits10 == " + << std::numeric_limits::max_digits10 << std::endl; +#else + std::cout << "Floating-point type boost::float80_t is NOT available." << std::endl; +#endif + +#ifdef BOOST_FLOAT128_C + std::cout << "Floating-point type boost::float128_t is available." << std::endl; + std::cout << " std::numeric_limits::digits10 == " + << std::numeric_limits::digits10 << std::endl; + std::cout << " std::numeric_limits::max_digits10 == " + << std::numeric_limits::max_digits10 << std::endl; +#else + std::cout << "Floating-point type boost::float128_t is NOT available." << std::endl; +#endif + +// Show some constants at a precision depending on the available type(s). +#ifdef BOOST_FLOAT16_C + std::cout.precision(boost::max_digits10()); // Show all significant decimal digits, + std::cout.setf(std::ios::showpoint); // including all significant trailing zeros. + + std::cout << "BOOST_FLOAT16_C(123.456789012345678901234567890) = " + << BOOST_FLOAT16_C(123.456789012345678901234567890) << std::endl; + // BOOST_FLOAT16_C(123.456789012345678901234567890) = 123.45678901234568 +#endif + +//[floatmax_widths_1 +#ifdef BOOST_FLOAT32_C + std::cout.precision(boost::max_digits10()); // Show all significant decimal digits, + std::cout.setf(std::ios::showpoint); // including all significant trailing zeros. + std::cout << "BOOST_FLOAT32_C(123.4567890123456789012345678901234567890) = " + << BOOST_FLOAT32_C(123.4567890123456789012345678901234567890) << std::endl; + // BOOST_FLOAT32_C(123.4567890123456789012345678901234567890) = 123.456787 +#endif +//] [/floatmax_widths_1] + +#ifdef BOOST_FLOAT64_C + std::cout.precision(boost::max_digits10()); // Show all significant decimal digits, + std::cout.setf(std::ios::showpoint); // including all significant trailing zeros. + std::cout << "BOOST_FLOAT64_C(123.4567890123456789012345678901234567890) = " + << BOOST_FLOAT64_C(123.4567890123456789012345678901234567890) << std::endl; + // BOOST_FLOAT64_C(123.4567890123456789012345678901234567890) = 123.45678901234568 +#endif + +#ifdef BOOST_FLOAT80_C + std::cout.precision(boost::max_digits10()); // Show all significant decimal digits, + std::cout.setf(std::ios::showpoint); // including all significant trailing zeros. + std::cout << "BOOST_FLOAT80_C(123.4567890123456789012345678901234567890) = " + << BOOST_FLOAT80_C(123.4567890123456789012345678901234567890) << std::endl; + // BOOST_FLOAT80_C(123.4567890123456789012345678901234567890) = 123.456789012345678903 +#endif + +#ifdef BOOST_FLOAT128_C + std::cout.precision(boost::max_digits10()); // Show all significant decimal digits, + std::cout.setf(std::ios::showpoint); // including all significant trailing zeros. + std::cout << "BOOST_FLOAT128_C(123.4567890123456789012345678901234567890) = " + << BOOST_FLOAT128_C(123.4567890123456789012345678901234567890) << std::endl; + // BOOST_FLOAT128_C(123.4567890123456789012345678901234567890) = 123.456789012345678901234567890123453 +#endif + +/* +//[floatmax_widths_2 +BOOST_FLOAT32_C(123.4567890123456789012345678901234567890) = 123.456787 +BOOST_FLOAT64_C(123.4567890123456789012345678901234567890) = 123.45678901234568 +BOOST_FLOAT80_C(123.4567890123456789012345678901234567890) = 123.456789012345678903 +BOOST_FLOAT128_C(123.4567890123456789012345678901234567890) = 123.456789012345678901234567890123453 +//] [/floatmax_widths_2] +*/ + +// Display the precisions available for floatmax_t + +#ifdef BOOST_FLOATMAX_C + BOOST_ASSERT(std::numeric_limits::is_specialized == true); + BOOST_ASSERT(std::numeric_limits::is_iec559 == true); + BOOST_ASSERT(BOOST_FLOATMAX_C(0.) == 0); + + std::cout << "floatmax_t " << std::numeric_limits::digits << " bits\n" // 113 + << std::numeric_limits::digits10 << " decimal digits\n" // 34 + << std::numeric_limits::max_digits10 << " max_digits\n" // 36 + << std::numeric_limits::radix << " radix\n" + << std::endl; + + int significand_bits = std::numeric_limits::digits; + int exponent_max = std::numeric_limits::max_exponent; + int exponent_min = std::numeric_limits::min_exponent; + int exponent_bits = 1 + static_cast(std::log2(std::numeric_limits::max_exponent)); + int sign_bits = std::numeric_limits::is_signed; + + std::cout << "significand_bits (including one implicit bit)" << significand_bits + << ", exponent_bits " << exponent_bits + << ", sign_bits " << sign_bits << std::endl; + + // One can compute the total number of bits in the floatmax_t, + // but probably not at compile time. + + std::cout << "bits = " << significand_bits + exponent_bits + sign_bits -1 << std::endl; + // -1 to take account of the implicit bit that is not part of the physical layout. + + // One can compare typedefs (but, of course, only those that are defined for the platform in use.) + std::cout.setf(std::ios::boolalpha); + std::cout << "double, double: " << std::is_same::value << std::endl; + bool b = boost::is_same::value; + std::cout << "boost::is_same::value; " << b << std::endl; + std::cout << "floatmax_t, float64_t: " + << std::is_same::value << std::endl; + +/*`So the simplest way of obtaining the total number of bits in the floatmax_t +is to infer it from the std::numeric_limits<>::digits value. +This is possible because the type, must be a IEEE754 layout. */ +//[floatmax_1 + const int fpbits = + (std::numeric_limits::digits == 113) ? 128 : + (std::numeric_limits::digits == 64) ? 80 : + (std::numeric_limits::digits == 53) ? 64 : + (std::numeric_limits::digits == 24) ? 32 : + (std::numeric_limits::digits == 11) ? 16 : + 0; // Unknown - not IEEE754 format. + std::cout << fpbits << " bits." << std::endl; +//] [/floatmax_1] +#endif + + } + catch (std::exception ex) + { // Display details about why any exceptions are thrown. + std::cout << "Thrown exception " << ex.what() << std::endl; + } + +} // int main() + +/* +[cstdfloat_output + +GCC 4.8.1 with quadmath + + pi = 1.00000 + 0.88010117148986700 + 0.0 0.0000000000000000 + 1.0 0.88010117148986700 + 2.0 4.6137984620549872 + 3.0 16.274830009244951 + 4.0 -25.360637961042869 + 5.0 -1257.9038883512264 + 6.0 -12749.592182518225 + 7.0 -3020.9830849309437 + 8.0 2421897.6013183584 + 9.0 45577595.449204877 + 0.0 0.00000000000000000000000000000000000 + 1.0 0.880101171489866995756301548681221902 + 2.0 4.61379846205498722611082484945654869 + 3.0 16.2748300092449511566883302293717861 + 4.0 -25.3606379610428689375112298876047134 + 5.0 -1257.90388835122644195507746189832687 + 6.0 -12749.5921825182249449426308274269104 + 7.0 -3020.98308493094373261556029319763184 + 8.0 2421897.60131835844367742538452148438 + 9.0 45577595.4492048770189285278320312500 + Floating-point type long double is available with: + std::numeric_limits::digits10 == 18 + std::numeric_limits::max_digits10 == 21 + pi = 3.14159265358979312 + Most precise pi = 3.141592653589793238462643383279503 + Floating-point type boost::float16_t is NOT available. + Floating-point type boost::float32_t is available. + std::numeric_limits::digits10 == 6 + std::numeric_limits::max_digits10 == 9 + Floating-point type boost::float64_t is available. + std::numeric_limits::digits10 == 15 + std::numeric_limits::max_digits10 == 17 + Floating-point type boost::float80_t is available. + std::numeric_limits::digits10 == 18 + std::numeric_limits::max_digits10 == 21 + Floating-point type boost::float128_t is available. + std::numeric_limits::digits10 == 34 + std::numeric_limits::max_digits10 == 36 + BOOST_FLOAT32_C(123.4567890123456789012345678901234567890) = 123.456787 + BOOST_FLOAT64_C(123.4567890123456789012345678901234567890) = 123.45678901234568 + BOOST_FLOAT80_C(123.4567890123456789012345678901234567890) = 123.456789012345678903 + BOOST_FLOAT128_C(123.4567890123456789012345678901234567890) = 123.456789012345678901234567890123453 + floatmax_t 113 bits + 34 decimal digits + 36 max_digits + 2 radix + + significand_bits (including one implicit bit)113, exponent_bits 15, sign_bits 1 + bits = 128 + double, double: true + boost::is_same::value; false + floatmax_t, float64_t: false + 128 bits. + + RUN SUCCESSFUL (total time: 53ms) + +GCC 6.1.1 + +pi = 1.00000 +0.88010117148986700 +0.0 0.0000000000000000 +1.0 0.88010117148986700 +2.0 4.6137984620549872 +3.0 16.274830009244951 +4.0 -25.360637961042869 +5.0 -1257.9038883512264 +6.0 -12749.592182518225 +7.0 -3020.9830849309437 +8.0 2421897.6013183584 +9.0 45577595.449204877 +0.0 0.00000000000000000000000000000000000 +1.0 0.880101171489866995756301548681221902 +2.0 4.61379846205498722611082484945654869 +3.0 16.2748300092449511566883302293717861 +4.0 -25.3606379610428689375112298876047134 +5.0 -1257.90388835122644195507746189832687 +6.0 -12749.5921825182249449426308274269104 +7.0 -3020.98308493094373261556029319763184 +8.0 2421897.60131835844367742538452148438 +9.0 45577595.4492048770189285278320312500 +Floating-point type long double is available with: + std::numeric_limits::digits10 == 18 + std::numeric_limits::max_digits10 == 21 +pi = 3.14159265358979312 +Most precise pi = 3.14159265358979323846264338327950 +Floating-point type boost::float16_t is NOT available. +Floating-point type boost::float32_t is available. + std::numeric_limits::digits10 == 6 + std::numeric_limits::max_digits10 == 9 +Floating-point type boost::float64_t is available. + std::numeric_limits::digits10 == 15 + std::numeric_limits::max_digits10 == 17 +Floating-point type boost::float80_t is available. + std::numeric_limits::digits10 == 18 + std::numeric_limits::max_digits10 == 21 +Floating-point type boost::float128_t is available. + std::numeric_limits::digits10 == 33 + std::numeric_limits::max_digits10 == 36 +BOOST_FLOAT32_C(123.4567890123456789012345678901234567890) = 123.456787 +BOOST_FLOAT64_C(123.4567890123456789012345678901234567890) = 123.45678901234568 +BOOST_FLOAT80_C(123.4567890123456789012345678901234567890) = 123.456789012345678903 +BOOST_FLOAT128_C(123.4567890123456789012345678901234567890) = 123.456789012345678901234567890123453 +floatmax_t 113 bits +33 decimal digits +36 max_digits +2 radix + +significand_bits (including one implicit bit)113, exponent_bits 15, sign_bits 1 +bits = 128 +double, double: true +boost::is_same::value; false +floatmax_t, float64_t: false +128 bits. + + + MSVC 2013 64-bit + + 1> pi = 1.00000 + 1> 0.88010117148986700 + 1> 0.00 0.00000000000000000 + 1> 1.0 0.88010117148986700 + 1> 2.0 4.6137984620549854 + 1> 3.0 16.274830009244948 + 1> 4.0 -25.360637961042869 + 1> 5.0 -1257.9038883512258 + 1> 6.0 -12749.592182518225 + 1> 7.0 -3020.9830849309396 + 1> 8.0 2421897.6013183575 + 1> 9.0 45577595.449204892 + 1> 0.00 0.00000000000000000 + 1> 1.0 0.88010117148986700 + 1> 2.0 4.6137984620549854 + 1> 3.0 16.274830009244948 + 1> 4.0 -25.360637961042869 + 1> 5.0 -1257.9038883512258 + 1> 6.0 -12749.592182518225 + 1> 7.0 -3020.9830849309396 + 1> 8.0 2421897.6013183575 + 1> 9.0 45577595.449204892 + 1> Floating-point type long double is available with: + 1> std::numeric_limits::digits10 == 15 + 1> std::numeric_limits::max_digits10 == 17 + 1> pi = 3.14159265358979 + 1> Most precise pi = 3.14159265358979 + 1> Floating-point type boost::float16_t is NOT available. + 1> Floating-point type boost::float32_t is available. + 1> std::numeric_limits::digits10 == 6 + 1> std::numeric_limits::max_digits10 == 9 + 1> Floating-point type boost::float64_t is available. + 1> std::numeric_limits::digits10 == 15 + 1> std::numeric_limits::max_digits10 == 17 + 1> Floating-point type boost::float80_t is NOT available. + 1> Floating-point type boost::float128_t is NOT available. + 1> BOOST_FLOAT32_C(123.4567890123456789012345678901234567890) = 123.456787 + 1> BOOST_FLOAT64_C(123.4567890123456789012345678901234567890) = 123.45678901234568 + 1> floatmax_t 53 bits + 1> 15 decimal digits + 1> 17 max_digits + 1> 2 radix + 1> + 1> significand_bits (including one implicit bit)53, exponent_bits 11, sign_bits 1 + 1> bits = 64 + 1> double, double: true + 1> boost::is_same::value; true + 1> floatmax_t, float64_t: true + 1> 64 bits. +] [/cstdfloat_output] + + +*/ + diff --git a/src/boost/libs/math/example/daubechies_coefficients.cpp b/src/boost/libs/math/example/daubechies_coefficients.cpp new file mode 100644 index 00000000..4a8c4110 --- /dev/null +++ b/src/boost/libs/math/example/daubechies_coefficients.cpp @@ -0,0 +1,221 @@ +/* + * Copyright Nick Thompson, 2018 + * 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 +#include +#include +#include +#include +#include +#include +#include +#include + +using std::string; +using boost::math::tools::polynomial; +using boost::math::binomial_coefficient; +using boost::math::tools::schroder_iterate; +using boost::math::tools::halley_iterate; +using boost::math::tools::newton_raphson_iterate; +using boost::math::tools::complex_newton; +using boost::math::constants::half; +using boost::math::constants::root_two; +using boost::math::constants::pi; +using boost::math::quadrature::gauss_kronrod; +using boost::multiprecision::cpp_bin_float_100; +using boost::multiprecision::cpp_complex_100; + +template +std::vector> find_roots(size_t p) +{ + // Initialize the polynomial; see Mallat, A Wavelet Tour of Signal Processing, equation 7.96 + BOOST_ASSERT(p>0); + typedef typename Complex::value_type Real; + std::vector coeffs(p); + for (size_t k = 0; k < coeffs.size(); ++k) + { + coeffs[k] = Complex(binomial_coefficient(p-1+k, k), 0); + } + + polynomial P(std::move(coeffs)); + polynomial Pcopy = P; + polynomial Pcopy_prime = P.prime(); + auto orig = [&](Complex z) { return std::make_pair(Pcopy(z), Pcopy_prime(z)); }; + + polynomial P_prime = P.prime(); + + // Polynomial is of degree p-1. + + std::vector roots(p-1, {std::numeric_limits::quiet_NaN(),std::numeric_limits::quiet_NaN()}); + size_t i = 0; + while(P.size() > 1) + { + Complex guess = {0.0, 1.0}; + std::cout << std::setprecision(std::numeric_limits::digits10+3); + + auto f = [&](Complex x)->std::pair + { + return std::make_pair(P(x), P_prime(x)); + }; + + Complex r = complex_newton(f, guess); + using std::isnan; + if(isnan(r.real())) + { + int i = 50; + do { + // Try a different guess + guess *= Complex(1.0,-1.0); + r = complex_newton(f, guess); + std::cout << "New guess: " << guess << ", result? " << r << std::endl; + + } while (isnan(r.real()) && i-- > 0); + + if (isnan(r.real())) + { + std::cout << "Polynomial that killed the process: " << P << std::endl; + throw std::logic_error("Newton iteration did not converge"); + } + } + // Refine r with the original function. + // We only use the polynomial division to ensure we don't get the same root over and over. + // However, the division induces error which can grow quickly-or slowly! See Numerical Recipes, section 9.5.1. + r = complex_newton(orig, r); + if (isnan(r.real())) + { + throw std::logic_error("Found a root for the deflated polynomial which is not a root for the original. Indicative of catastrophic numerical error."); + } + // Test the root: + using std::sqrt; + Real tol = sqrt(sqrt(std::numeric_limits::epsilon())); + if (norm(Pcopy(r)) > tol) + { + std::cout << "This is a bad root: P" << r << " = " << Pcopy(r) << std::endl; + std::cout << "Reduced polynomial leading to bad root: " << P << std::endl; + throw std::logic_error("Donezo."); + } + + BOOST_ASSERT(i < roots.size()); + roots[i] = r; + ++i; + polynomial q{-r, {1,0}}; + // This optimization breaks at p = 11. I have no clue why. + // Unfortunate, because I expect it to be considerably more stable than + // repeatedly dividing by the complex root. + /*polynomial q; + if (r.imag() > sqrt(std::numeric_limits::epsilon())) + { + // Then the complex conjugate is also a root: + using std::conj; + using std::norm; + BOOST_ASSERT(i < roots.size()); + roots[i] = conj(r); + ++i; + q = polynomial({{norm(r), 0}, {-2*r.real(),0}, {1,0}}); + } + else + { + // The imaginary part is numerical noise: + r.imag() = 0; + q = polynomial({-r, {1,0}}); + }*/ + + + auto PR = quotient_remainder(P, q); + // I should validate that the remainder is small, but . . . + //std::cout << "Remainder = " << PR.second<< std::endl; + + P = PR.first; + P_prime = P.prime(); + } + + std::vector> Qroots(p-1); + for (size_t i = 0; i < Qroots.size(); ++i) + { + Complex y = roots[i]; + Complex z1 = static_cast(1) - static_cast(2)*y + static_cast(2)*sqrt(y*(y-static_cast(1))); + Complex z2 = static_cast(1) - static_cast(2)*y - static_cast(2)*sqrt(y*(y-static_cast(1))); + Qroots[i] = {z1, z2}; + } + + return Qroots; +} + +template +std::vector daubechies_coefficients(std::vector> const & Qroots) +{ + typedef typename Complex::value_type Real; + size_t p = Qroots.size() + 1; + // Choose the minimum abs root; see Mallat, discussion just after equation 7.98 + std::vector chosen_roots(p-1); + for (size_t i = 0; i < p - 1; ++i) + { + if(norm(Qroots[i].first) <= 1) + { + chosen_roots[i] = Qroots[i].first; + } + else + { + BOOST_ASSERT(norm(Qroots[i].second) <= 1); + chosen_roots[i] = Qroots[i].second; + } + } + + polynomial R{1}; + for (size_t i = 0; i < p-1; ++i) + { + Complex ak = chosen_roots[i]; + R *= polynomial({-ak/(static_cast(1)-ak), static_cast(1)/(static_cast(1)-ak)}); + } + polynomial a{{half(), 0}, {half(),0}}; + polynomial poly = root_two()*pow(a, p)*R; + std::vector result = poly.data(); + // If we reverse, we get the Numerical Recipes and Daubechies convention. + // If we don't reverse, we get the Pywavelets and Mallat convention. + // I believe this is because of the sign convention on the DFT, which differs between Daubechies and Mallat. + // You implement a dot product in Daubechies/NR convention, and a convolution in PyWavelets/Mallat convention. + // I won't reverse so I can spot check against Pywavelets: http://wavelets.pybytes.com/wavelet/ + //std::reverse(result.begin(), result.end()); + std::vector h(result.size()); + for (size_t i = 0; i < result.size(); ++i) + { + Complex r = result[i]; + BOOST_ASSERT(r.imag() < sqrt(std::numeric_limits::epsilon())); + h[i] = r.real(); + } + + // Quick sanity check: We could check all vanishing moments, but that sum is horribly ill-conditioned too! + Real sum = 0; + Real scale = 0; + for (size_t i = 0; i < h.size(); ++i) + { + sum += h[i]; + scale += h[i]*h[i]; + } + BOOST_ASSERT(abs(scale -1) < sqrt(std::numeric_limits::epsilon())); + BOOST_ASSERT(abs(sum - root_two()) < sqrt(std::numeric_limits::epsilon())); + return h; +} + +int main() +{ + typedef boost::multiprecision::cpp_complex<100> Complex; + for(size_t p = 1; p < 200; ++p) + { + auto roots = find_roots(p); + auto h = daubechies_coefficients(roots); + std::cout << "h_" << p << "[] = {"; + for (auto& x : h) { + std::cout << x << ", "; + } + std::cout << "} // = h_" << p << "\n\n\n\n"; + } +} diff --git a/src/boost/libs/math/example/distribution_construction.cpp b/src/boost/libs/math/example/distribution_construction.cpp new file mode 100644 index 00000000..a3d1a635 --- /dev/null +++ b/src/boost/libs/math/example/distribution_construction.cpp @@ -0,0 +1,295 @@ +// distribution_construction.cpp + +// Copyright Paul A. Bristow 2007, 2010, 2012. + +// 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) + +// Caution: this file contains Quickbook markup as well as code +// and comments, don't change any of the special comment markups! + +#ifdef _MSC_VER +# pragma warning (disable : 4996) // disable -D_SCL_SECURE_NO_WARNINGS C++ 'Checked Iterators' +#endif + +#include +#include + +//[distribution_construction_1 + +/*` +The structure of distributions is rather different from some other statistical libraries, +for example, those written in less object-oriented language like FORTRAN and C that +provide a few arguments to each free function. + +Boost.Math library instead provides each distribution as a template C++ class. +A distribution is constructed with a few arguments, and then +member and non-member functions are used to find values of the +distribution, often a function of a random variate. + +For this demonstration, first we need some includes to access the +negative binomial distribution (and the binomial, beta and gamma distributions too). + +To demonstrate the use with a high precision User-defined floating-point type +`cpp_bin_float`, we also need an include from Boost.Multiprecision. +(We could equally well have used a `cpp_dec_float` multiprecision type). + +We choose a typedef `cpp_bin_float_50` to provide a 50 decimal digit type, +but we could equally have chosen at 128-bit type `cpp_bin_float_quad`, +or on some platforms `__float128`, providing about 35 decimal digits. +*/ + +#include // for negative_binomial_distribution + using boost::math::negative_binomial_distribution; // default type is double. + using boost::math::negative_binomial; // typedef provides default type is double. +#include // for binomial_distribution. +#include // for beta_distribution. +#include // for gamma_distribution. +#include // for normal_distribution. + +#include // for cpp_bin_float_50 +/*` +Several examples of constructing distributions follow: +*/ +//] [/distribution_construction_1 end of Quickbook in C++ markup] + +int main() +{ + try + { +//[distribution_construction_2 +/*` +First, a negative binomial distribution with 8 successes +and a success fraction 0.25, 25% or 1 in 4, is constructed like this: +*/ + boost::math::negative_binomial_distribution mydist0(8., 0.25); + /*` + But this is inconveniently long, so we might be tempted to write + */ + using namespace boost::math; + /*` + but this might risk ambiguity with names in `std random` so + [*much] better is explicit `using boost::math::` statements, for example: + */ + using boost::math::negative_binomial_distribution; + /*` + and we can still reduce typing. + + Since the vast majority of applications use will be using `double` precision, + the template argument to the distribution (`RealType`) defaults + to type `double`, so we can also write: + */ + + negative_binomial_distribution<> mydist9(8., 0.25); // Uses default `RealType = double`. + + /*` + But the name `negative_binomial_distribution` is still inconveniently long, + so, for most distributions, a convenience `typedef` is provided, for example: + + typedef negative_binomial_distribution negative_binomial; // Reserved name of type double. + + [caution + This convenience typedef is [*not provided] if a clash would occur + with the name of a function; currently only `beta` and `gamma` + fall into this category. + ] + + So, after a using statement, + */ + + using boost::math::negative_binomial; + + /*` + we have a convenient typedef to `negative_binomial_distribution`: + */ + negative_binomial mydist(8., 0.25); + + /*` + Some more examples using the convenience typedef: + */ + negative_binomial mydist10(5., 0.4); // Both arguments double. + /*` + And automatic conversion of arguments takes place, so you can use integers and floats: + */ + negative_binomial mydist11(5, 0.4); // Using provided typedef of type double, and int and double arguments. + /*` + This is probably the most common usage. + Other combination are possible too: + */ + negative_binomial mydist12(5., 0.4F); // Double and float arguments. + negative_binomial mydist13(5, 1); // Both arguments integer. + + /*` + Similarly for most other distributions like the binomial. + */ + binomial mybinomial(1, 0.5); // is more concise than + binomial_distribution<> mybinomd1(1, 0.5); + + /*` + For cases when the typdef distribution name would clash with a math special function + (currently only beta and gamma) + the typedef is deliberately not provided, and the longer version of the name + must be used, so for example, do not use: + + using boost::math::beta; + beta mybetad0(1, 0.5); // Error beta is a math FUNCTION! + + Which produces the error messages: + + [pre + error C2146: syntax error : missing ';' before identifier 'mybetad0' + warning C4551: function call missing argument list + error C3861: 'mybetad0': identifier not found + ] + + Instead you should use: + */ + using boost::math::beta_distribution; + beta_distribution<> mybetad1(1, 0.5); + /*` + or for the gamma distribution: + */ + gamma_distribution<> mygammad1(1, 0.5); + + /*` + We can, of course, still provide the type explicitly thus: + */ + + // Explicit double precision: both arguments are double: + negative_binomial_distribution mydist1(8., 0.25); + + // Explicit float precision, double arguments are truncated to float: + negative_binomial_distribution mydist2(8., 0.25); + + // Explicit float precision, integer & double arguments converted to float: + negative_binomial_distribution mydist3(8, 0.25); + + // Explicit float precision, float arguments, so no conversion: + negative_binomial_distribution mydist4(8.F, 0.25F); + + // Explicit float precision, integer arguments promoted to float. + negative_binomial_distribution mydist5(8, 1); + + // Explicit double precision: + negative_binomial_distribution mydist6(5., 0.4); + + // Explicit long double precision: + negative_binomial_distribution mydist7(8., 0.25); + + /*` + And you can use your own template RealType, + for example, `boost::math::cpp_bin_float_50` (an arbitrary 50 decimal digits precision type), + then we can write: + */ + using namespace boost::multiprecision; + negative_binomial_distribution mydist8(8, 0.25); + + // `integer` arguments are promoted to your RealType exactly, but + // `double` argument are converted to RealType, + // most likely losing precision! + + // So DON'T be tempted to write the 'obvious': + negative_binomial_distribution mydist20(8, 0.23456789012345678901234567890); + // to avoid truncation of second parameter to `0.2345678901234567` and loss of precision. + + // Instead pass a quoted decimal digit string: + negative_binomial_distribution mydist21(8, cpp_bin_float_50("0.23456789012345678901234567890") ); + + // Ensure that all potentially significant digits are shown. + std::cout.precision(std::numeric_limits::digits10); + // + cpp_bin_float_50 x("1.23456789012345678901234567890"); + std::cout << pdf(mydist8, x) << std::endl; +/*` showing 0.00012630010495970320103876754721976419438231705359935 + 0.00012630010495970320103876754721976419438231528547467 + +[warning When using multiprecision, it is all too easy to get accidental truncation!] + +For example, if you write +*/ + std::cout << pdf(mydist8, 1.23456789012345678901234567890) << std::endl; +/*` +showing 0.00012630010495970318465064569310967179576805651692929, +which is wrong at about the 17th decimal digit! + +This is because the value provided is truncated to a `double`, effectively + `double x = 1.23456789012345678901234567890;` + +Then the now `double x` is passed to function `pdf`, +and this truncated `double` value is finally promoted to `cpp_bin_float_50`. + +Another way of quietly getting the wrong answer is to write: +*/ + std::cout << pdf(mydist8, cpp_bin_float_50(1.23456789012345678901234567890)) << std::endl; +/*` +A correct way from a multi-digit string value is +*/ + std::cout << pdf(mydist8, cpp_bin_float_50("1.23456789012345678901234567890")) << std::endl; +/*` + +[tip Getting about 17 decimal digits followed by many zeros is often a sign of accidental truncation.] +*/ + +/*` +[h4 Default arguments to distribution constructors.] + +Note that default constructor arguments are only provided for some distributions. +So if you wrongly assume a default argument, you will get an error message, for example: + + negative_binomial_distribution<> mydist8; + +[pre error C2512 no appropriate default constructor available.] + +No default constructors are provided for the `negative binomial` distribution, +because it is difficult to chose any sensible default values for this distribution. + +For other distributions, like the normal distribution, +it is obviously very useful to provide 'standard' +defaults for the mean (zero) and standard deviation (unity) thus: + + normal_distribution(RealType mean = 0, RealType sd = 1); + +So in this case we can more tersely write: +*/ + using boost::math::normal; + + normal norm1; // Standard normal distribution N[0,1]. + normal norm2(2); // Mean = 2, std deviation = 1. + normal norm3(2, 3); // Mean = 2, std deviation = 3. + + } + catch(std::exception &ex) + { + std::cout << ex.what() << std::endl; + } + + return 0; +} // int main() + +/*`There is no useful output from this demonstration program, of course. */ + +//] [/end of distribution_construction_2] + +/* +//[distribution_construction_output + + 0.00012630010495970320103876754721976419438231705359935 + 0.00012630010495970318465064569310967179576805651692929 + 0.00012630010495970318465064569310967179576805651692929 + 0.00012630010495970320103876754721976419438231705359935 + +//] [/distribution_construction_output] + + + 0.00012630010495970320103876754721976419438231528547467 + 0.0001263001049597031846506456931096717957680547488046 + 0.0001263001049597031846506456931096717957680547488046 + 0.00012630010495970320103876754721976419438231528547467 + + +*/ + + + diff --git a/src/boost/libs/math/example/double_exponential.cpp b/src/boost/libs/math/example/double_exponential.cpp new file mode 100644 index 00000000..87e21b18 --- /dev/null +++ b/src/boost/libs/math/example/double_exponential.cpp @@ -0,0 +1,59 @@ +// Copyright Nick Thompson, 2017 +// 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 + +using boost::math::quadrature::tanh_sinh; +using boost::math::quadrature::sinh_sinh; +using boost::math::quadrature::exp_sinh; +using boost::math::constants::pi; +using boost::math::constants::half_pi; +using boost::math::constants::half; +using boost::math::constants::third; +using boost::math::constants::root_pi; +using std::log; +using std::cos; +using std::cosh; +using std::exp; +using std::sqrt; + +int main() +{ + std::cout << std::setprecision(std::numeric_limits::digits10); + double tol = sqrt(std::numeric_limits::epsilon()); + // For an integral over a finite domain, use tanh_sinh: + tanh_sinh tanh_integrator(tol, 10); + auto f1 = [](double x) { return log(x)*log(1-x); }; + double Q = tanh_integrator.integrate(f1, (double) 0, (double) 1); + double Q_expected = 2 - pi()*pi()*half()*third(); + + std::cout << "tanh_sinh quadrature of log(x)log(1-x) gives " << Q << std::endl; + std::cout << "The exact integral is " << Q_expected << std::endl; + + // For an integral over the entire real line, use sinh-sinh quadrature: + sinh_sinh sinh_integrator(tol, 10); + auto f2 = [](double t) { return cos(t)/cosh(t);}; + Q = sinh_integrator.integrate(f2); + Q_expected = pi()/cosh(half_pi()); + std::cout << "sinh_sinh quadrature of cos(x)/cosh(x) gives " << Q << std::endl; + std::cout << "The exact integral is " << Q_expected << std::endl; + + // For half-infinite intervals, use exp-sinh. + // Endpoint singularities are handled well: + exp_sinh exp_integrator(tol, 10); + auto f3 = [](double t) { return exp(-t)/sqrt(t); }; + Q = exp_integrator.integrate(f3, 0, std::numeric_limits::infinity()); + Q_expected = root_pi(); + std::cout << "exp_sinh quadrature of exp(-t)/sqrt(t) gives " << Q << std::endl; + std::cout << "The exact integral is " << Q_expected << std::endl; + + + +} diff --git a/src/boost/libs/math/example/error_handling_example.cpp b/src/boost/libs/math/example/error_handling_example.cpp new file mode 100644 index 00000000..24543cdf --- /dev/null +++ b/src/boost/libs/math/example/error_handling_example.cpp @@ -0,0 +1,153 @@ +// example_error_handling.cpp + +// Copyright Paul A. Bristow 2007, 2010. +// Copyright John Maddock 2007. + +// 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) + +// Note that this file contains quickbook markup as well as code +// and comments, don't change any of the special comment markups! + +// Optional macro definitions described in text below: +// #define BOOST_MATH_DOMAIN_ERROR_POLICY ignore_error +// #define BOOST_MATH_DOMAIN_ERROR_POLICY errno_on_error +// #define BOOST_MATH_DOMAIN_ERROR_POLICY is set to: throw_on_error + +//[error_handling_example +/*` +The following example demonstrates the effect of +setting the macro BOOST_MATH_DOMAIN_ERROR_POLICY +when an invalid argument is encountered. For the +purposes of this example, we'll pass a negative +degrees of freedom parameter to the student's t +distribution. + +Since we know that this is a single file program we could +just add: + + #define BOOST_MATH_DOMAIN_ERROR_POLICY ignore_error + +to the top of the source file to change the default policy +to one that simply returns a NaN when a domain error occurs. +Alternatively we could use: + + #define BOOST_MATH_DOMAIN_ERROR_POLICY errno_on_error + +To ensure the `::errno` is set when a domain error occurs +as well as returning a NaN. + +This is safe provided the program consists of a single +translation unit /and/ we place the define /before/ any +#includes. Note that should we add the define after the includes +then it will have no effect! A warning such as: + +[pre warning C4005: 'BOOST_MATH_OVERFLOW_ERROR_POLICY' : macro redefinition] + +is a certain sign that it will /not/ have the desired effect. + +We'll begin our sample program with the needed includes: +*/ + + + #define BOOST_MATH_DOMAIN_ERROR_POLICY ignore_error + +// Boost +#include + using boost::math::students_t; // Probability of students_t(df, t). + +// std +#include + using std::cout; + using std::endl; + +#include + + +#include + // using ::errno + +/*` +Next we'll define the program's main() to call the student's t +distribution with an invalid degrees of freedom parameter, +the program is set up to handle either an exception or a NaN: +*/ + +int main() +{ + cout << "Example error handling using Student's t function. " << endl; + cout << "BOOST_MATH_DOMAIN_ERROR_POLICY is set to: " + << BOOST_STRINGIZE(BOOST_MATH_DOMAIN_ERROR_POLICY) << endl; + + double degrees_of_freedom = -1; // A bad argument! + double t = 10; + + try + { + errno = 0; // Clear/reset. + students_t dist(degrees_of_freedom); // exception is thrown here if enabled. + double p = cdf(dist, t); + // Test for error reported by other means: + if((boost::math::isnan)(p)) + { + cout << "cdf returned a NaN!" << endl; + if (errno != 0) + { // So errno has been set. + cout << "errno is set to: " << errno << endl; + } + } + else + cout << "Probability of Student's t is " << p << endl; + } + catch(const std::exception& e) + { + std::cout << + "\n""Message from thrown exception was:\n " << e.what() << std::endl; + } + return 0; +} // int main() + +/*` + +Here's what the program output looks like with a default build +(one that *does throw exceptions*): + +[pre +Example error handling using Student's t function. +BOOST_MATH_DOMAIN_ERROR_POLICY is set to: throw_on_error + +Message from thrown exception was: + Error in function boost::math::students_t_distribution::students_t_distribution: + Degrees of freedom argument is -1, but must be > 0 ! +] + +Alternatively let's build with: + + #define BOOST_MATH_DOMAIN_ERROR_POLICY ignore_error + +Now the program output is: + +[pre +Example error handling using Student's t function. +BOOST_MATH_DOMAIN_ERROR_POLICY is set to: ignore_error +cdf returned a NaN! +] + +And finally let's build with: + + #define BOOST_MATH_DOMAIN_ERROR_POLICY errno_on_error + +Which gives the output show errno: + +[pre +Example error handling using Student's t function. +BOOST_MATH_DOMAIN_ERROR_POLICY is set to: errno_on_error +cdf returned a NaN! +errno is set to: 33 +] + +*/ + +//] [error_handling_eg end quickbook markup] diff --git a/src/boost/libs/math/example/error_policies_example.cpp b/src/boost/libs/math/example/error_policies_example.cpp new file mode 100644 index 00000000..289d1016 --- /dev/null +++ b/src/boost/libs/math/example/error_policies_example.cpp @@ -0,0 +1,105 @@ +// error_policies_example.cpp + +// Copyright Paul A. Bristow 2007, 2010. +// Copyright John Maddock 2007. + +// 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 + using boost::math::normal_distribution; + +#include + using boost::math::students_t; // Probability of students_t(df, t). + using boost::math::students_t_distribution; + +// using namespace boost::math; causes: +//.\error_policy_normal.cpp(30) : error C2872: 'policy' : ambiguous symbol +// could be '\boost/math/policies/policy.hpp(392) : boost::math::policies::policy' +// or 'boost::math::policies' + +// So should not use this 'using namespace boost::math;' command. + +// Suppose we want a statistical distribution to return infinities, +// rather than throw exceptions (the default policy), then we can use: + +// std +#include + using std::cout; + using std::endl; + +// using namespace boost::math::policies; or + +using boost::math::policies::policy; +// Possible errors +using boost::math::policies::overflow_error; +using boost::math::policies::underflow_error; +using boost::math::policies::domain_error; +using boost::math::policies::pole_error; +using boost::math::policies::denorm_error; +using boost::math::policies::evaluation_error; +using boost::math::policies::ignore_error; + +// Define a custom policy to ignore just overflow: +typedef policy< +overflow_error + > my_policy; + +// Define another custom policy (perhaps ill-advised?) +// to ignore all errors: domain, pole, overflow, underflow, denorm & evaluation: +typedef policy< +domain_error, +pole_error, +overflow_error, +underflow_error, +denorm_error, +evaluation_error + > my_ignoreall_policy; + +// Define a new distribution with a custom policy to ignore_error +// (& thus perhaps return infinity for some arguments): +typedef boost::math::normal_distribution my_normal; +// Note: uses default parameters zero mean and unit standard deviation. + +// We could also do the same for another distribution, for example: +using boost::math::students_t_distribution; +typedef students_t_distribution my_students_t; + +int main() +{ + cout << "quantile(my_normal(), 0.05); = " << quantile(my_normal(), 0.05) << endl; // 0.05 is argument within normal range. + cout << "quantile(my_normal(), 0.); = " << quantile(my_normal(), 0.) << endl; // argument zero, so expect infinity. + cout << "quantile(my_normal(), 0.); = " << quantile(my_normal(), 0.F) << endl; // argument zero, so expect infinity. + + cout << "quantile(my_students_t(), 0.); = " << quantile(my_students_t(-1), 0.F) << endl; // 'bad' argument negative, so expect NaN. + +#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS + // Construct a (0, 1) normal distribution that ignores all errors, + // returning NaN, infinity, zero, or best guess, + // and NOT setting errno. + normal_distribution my_normal2(0.L, 1.L); // explicit parameters for distribution. + cout << "quantile(my_normal2(), 0.); = " << quantile(my_normal2, 0.01) << endl; // argument 0.01, so result finite. + cout << "quantile(my_normal2(), 0.); = " << quantile(my_normal2, 0.) << endl; // argument zero, so expect infinity. +#endif + + return 0; +} + +/* + +Output: + +error_policies_example.cpp + Generating code + Finished generating code + error_policy_normal_example.vcxproj -> J:\Cpp\MathToolkit\test\Math_test\Release\error_policies_example.exe + quantile(my_normal(), 0.05); = -1.64485 + quantile(my_normal(), 0.); = -1.#INF + quantile(my_normal(), 0.); = -1.#INF + quantile(my_students_t(), 0.); = 1.#QNAN + quantile(my_normal2(), 0.); = -2.32635 + quantile(my_normal2(), 0.); = -1.#INF + +*/ diff --git a/src/boost/libs/math/example/error_policy_example.cpp b/src/boost/libs/math/example/error_policy_example.cpp new file mode 100644 index 00000000..37cb5163 --- /dev/null +++ b/src/boost/libs/math/example/error_policy_example.cpp @@ -0,0 +1,93 @@ +// example_policy_handling.cpp + +// Copyright Paul A. Bristow 2007, 2010. +// Copyright John Maddock 2007. + +// 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) + +// See error_handling_example.cpp for use of +// macro definition to change policy for +// domain_error - negative degrees of freedom argument +// for student's t distribution CDF, +// and catching the exception. + +// See error_handling_policies.cpp for more examples. + +// Boost +#include +using boost::math::students_t_distribution; // Probability of students_t(df, t). +using boost::math::students_t; // Probability of students_t(df, t) convenience typedef for double. + +using boost::math::policies::policy; +using boost::math::policies::domain_error; +using boost::math::policies::ignore_error; + +// std +#include + using std::cout; + using std::endl; + +#include + + +// Define a (bad?) policy to ignore domain errors ('bad' arguments): +typedef policy< + domain_error + > my_policy; + +// Define my_students_t distribution with this different domain error policy: +typedef students_t_distribution my_students_t; + +int main() +{ // Example of error handling of bad argument(s) to a distribution. + cout << "Example error handling using Student's t function. " << endl; + + double degrees_of_freedom = -1; double t = -1.; // Two 'bad' arguments! + + try + { + cout << "Probability of ignore_error Student's t is " + << cdf(my_students_t(degrees_of_freedom), t) << endl; + cout << "Probability of default error policy Student's t is " << endl; + // By contrast the students_t distribution default domain error policy is to throw, + cout << cdf(students_t(-1), -1) << endl; // so this will throw. +/*` + Message from thrown exception was: + Error in function boost::math::students_t_distribution::students_t_distribution: + Degrees of freedom argument is -1, but must be > 0 ! +*/ + + // We could also define a 'custom' distribution + // with an "ignore overflow error policy" in a single statement: + using boost::math::policies::overflow_error; + students_t_distribution > > students_t_no_throw(-1); + + } + catch(const std::exception& e) + { + std::cout << + "\n""Message from thrown exception was:\n " << e.what() << std::endl; + } + + return 0; +} // int main() + +/* + +Output: + + error_policy_example.cpp + Generating code + Finished generating code + error_policy_example.vcxproj -> J:\Cpp\MathToolkit\test\Math_test\Release\error_policy_example.exe + Example error handling using Student's t function. + Probability of ignore_error Student's t is 1.#QNAN + Probability of default error policy Student's t is + + Message from thrown exception was: + Error in function boost::math::students_t_distribution::students_t_distribution: Degrees of freedom argument is -1, but must be > 0 ! + +*/ diff --git a/src/boost/libs/math/example/f_test.cpp b/src/boost/libs/math/example/f_test.cpp new file mode 100644 index 00000000..f7fabdee --- /dev/null +++ b/src/boost/libs/math/example/f_test.cpp @@ -0,0 +1,250 @@ +// Copyright John Maddock 2006 +// Copyright Paul A. Bristow 2007, 2008, 2010 + +// 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) + +#ifdef _MSC_VER +# pragma warning(disable: 4512) // assignment operator could not be generated. +# pragma warning(disable: 4510) // default constructor could not be generated. +# pragma warning(disable: 4610) // can never be instantiated - user defined constructor required. +# pragma warning(disable: 4180) // qualifier has no effect (in Fusion). +#endif + +#include +using std::cout; using std::endl; +using std::left; using std::fixed; using std::right; using std::scientific; +#include +using std::setw; +using std::setprecision; + +#include + +void f_test( + double sd1, // Sample 1 std deviation + double sd2, // Sample 2 std deviation + double N1, // Sample 1 size + double N2, // Sample 2 size + double alpha) // Significance level +{ + // + // An F test applied to two sets of data. + // We are testing the null hypothesis that the + // standard deviation of the samples is equal, and + // that any variation is down to chance. We can + // also test the alternative hypothesis that any + // difference is not down to chance. + // See http://www.itl.nist.gov/div898/handbook/eda/section3/eda359.htm + // + // Avoid "using namespace boost::math;" because of potential name ambiguity. + using boost::math::fisher_f; + + // Print header: + cout << + "____________________________________\n" + "F test for equal standard deviations\n" + "____________________________________\n\n"; + cout << setprecision(5); + cout << "Sample 1:\n"; + cout << setw(55) << left << "Number of Observations" << "= " << N1 << "\n"; + cout << setw(55) << left << "Sample Standard Deviation" << "= " << sd1 << "\n\n"; + cout << "Sample 2:\n"; + cout << setw(55) << left << "Number of Observations" << "= " << N2 << "\n"; + cout << setw(55) << left << "Sample Standard Deviation" << "= " << sd2 << "\n\n"; + // + // Now we can calculate and output some stats: + // + // F-statistic: + double F = (sd1 / sd2); + F *= F; + cout << setw(55) << left << "Test Statistic" << "= " << F << "\n\n"; + // + // Finally define our distribution, and get the probability: + // + fisher_f dist(N1 - 1, N2 - 1); + double p = cdf(dist, F); + cout << setw(55) << left << "CDF of test statistic: " << "= " + << setprecision(3) << scientific << p << "\n"; + double ucv = quantile(complement(dist, alpha)); + double ucv2 = quantile(complement(dist, alpha / 2)); + double lcv = quantile(dist, alpha); + double lcv2 = quantile(dist, alpha / 2); + cout << setw(55) << left << "Upper Critical Value at alpha: " << "= " + << setprecision(3) << scientific << ucv << "\n"; + cout << setw(55) << left << "Upper Critical Value at alpha/2: " << "= " + << setprecision(3) << scientific << ucv2 << "\n"; + cout << setw(55) << left << "Lower Critical Value at alpha: " << "= " + << setprecision(3) << scientific << lcv << "\n"; + cout << setw(55) << left << "Lower Critical Value at alpha/2: " << "= " + << setprecision(3) << scientific << lcv2 << "\n\n"; + // + // Finally print out results of null and alternative hypothesis: + // + cout << setw(55) << left << + "Results for Alternative Hypothesis and alpha" << "= " + << setprecision(4) << fixed << alpha << "\n\n"; + cout << "Alternative Hypothesis Conclusion\n"; + cout << "Standard deviations are unequal (two sided test) "; + if((ucv2 < F) || (lcv2 > F)) + cout << "NOT REJECTED\n"; + else + cout << "REJECTED\n"; + cout << "Standard deviation 1 is less than standard deviation 2 "; + if(lcv > F) + cout << "NOT REJECTED\n"; + else + cout << "REJECTED\n"; + cout << "Standard deviation 1 is greater than standard deviation 2 "; + if(ucv < F) + cout << "NOT REJECTED\n"; + else + cout << "REJECTED\n"; + cout << endl << endl; +} + +int main() +{ + // + // Run tests for ceramic strength data: + // see http://www.itl.nist.gov/div898/handbook/eda/section4/eda42a1.htm + // The data for this case study were collected by Said Jahanmir of the + // NIST Ceramics Division in 1996 in connection with a NIST/industry + // ceramics consortium for strength optimization of ceramic strength. + // + f_test(65.54909, 61.85425, 240, 240, 0.05); + // + // And again for the process change comparison: + // see http://www.itl.nist.gov/div898/handbook/prc/section3/prc32.htm + // A new procedure to assemble a device is introduced and tested for + // possible improvement in time of assembly. The question being addressed + // is whether the standard deviation of the new assembly process (sample 2) is + // better (i.e., smaller) than the standard deviation for the old assembly + // process (sample 1). + // + f_test(4.9082, 2.5874, 11, 9, 0.05); + return 0; +} + +/* + +Output: + + f_test.cpp + F-test_example1.vcxproj -> J:\Cpp\MathToolkit\test\Math_test\Debug\F_test_example1.exe + ____________________________________ + F test for equal standard deviations + ____________________________________ + + Sample 1: + Number of Observations = 240 + Sample Standard Deviation = 65.549 + + Sample 2: + Number of Observations = 240 + Sample Standard Deviation = 61.854 + + Test Statistic = 1.123 + + CDF of test statistic: = 8.148e-001 + Upper Critical Value at alpha: = 1.238e+000 + Upper Critical Value at alpha/2: = 1.289e+000 + Lower Critical Value at alpha: = 8.080e-001 + Lower Critical Value at alpha/2: = 7.756e-001 + + Results for Alternative Hypothesis and alpha = 0.0500 + + Alternative Hypothesis Conclusion + Standard deviations are unequal (two sided test) REJECTED + Standard deviation 1 is less than standard deviation 2 REJECTED + Standard deviation 1 is greater than standard deviation 2 REJECTED + + + ____________________________________ + F test for equal standard deviations + ____________________________________ + + Sample 1: + Number of Observations = 11.00000 + Sample Standard Deviation = 4.90820 + + Sample 2: + Number of Observations = 9.00000 + Sample Standard Deviation = 2.58740 + + Test Statistic = 3.59847 + + CDF of test statistic: = 9.589e-001 + Upper Critical Value at alpha: = 3.347e+000 + Upper Critical Value at alpha/2: = 4.295e+000 + Lower Critical Value at alpha: = 3.256e-001 + Lower Critical Value at alpha/2: = 2.594e-001 + + Results for Alternative Hypothesis and alpha = 0.0500 + + Alternative Hypothesis Conclusion + Standard deviations are unequal (two sided test) REJECTED + Standard deviation 1 is less than standard deviation 2 REJECTED + Standard deviation 1 is greater than standard deviation 2 NOT REJECTED + + + ____________________________________ + F test for equal standard deviations + ____________________________________ + + Sample 1: + Number of Observations = 240 + Sample Standard Deviation = 65.549 + + Sample 2: + Number of Observations = 240 + Sample Standard Deviation = 61.854 + + Test Statistic = 1.123 + + CDF of test statistic: = 8.148e-001 + Upper Critical Value at alpha: = 1.238e+000 + Upper Critical Value at alpha/2: = 1.289e+000 + Lower Critical Value at alpha: = 8.080e-001 + Lower Critical Value at alpha/2: = 7.756e-001 + + Results for Alternative Hypothesis and alpha = 0.0500 + + Alternative Hypothesis Conclusion + Standard deviations are unequal (two sided test) REJECTED + Standard deviation 1 is less than standard deviation 2 REJECTED + Standard deviation 1 is greater than standard deviation 2 REJECTED + + + ____________________________________ + F test for equal standard deviations + ____________________________________ + + Sample 1: + Number of Observations = 11.00000 + Sample Standard Deviation = 4.90820 + + Sample 2: + Number of Observations = 9.00000 + Sample Standard Deviation = 2.58740 + + Test Statistic = 3.59847 + + CDF of test statistic: = 9.589e-001 + Upper Critical Value at alpha: = 3.347e+000 + Upper Critical Value at alpha/2: = 4.295e+000 + Lower Critical Value at alpha: = 3.256e-001 + Lower Critical Value at alpha/2: = 2.594e-001 + + Results for Alternative Hypothesis and alpha = 0.0500 + + Alternative Hypothesis Conclusion + Standard deviations are unequal (two sided test) REJECTED + Standard deviation 1 is less than standard deviation 2 REJECTED + Standard deviation 1 is greater than standard deviation 2 NOT REJECTED + + + +*/ + diff --git a/src/boost/libs/math/example/factorial_example.cpp b/src/boost/libs/math/example/factorial_example.cpp new file mode 100644 index 00000000..7a51e074 --- /dev/null +++ b/src/boost/libs/math/example/factorial_example.cpp @@ -0,0 +1,97 @@ +// TestFactorial.cpp +// +// Factorials and Binomial Coefficients. +// +// Copyright Datasim Education BV 2009-2010 +// Copyright John Maddock and Paul A. Bristow 2010 + +// 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 +using namespace std; + +int main() +{ + using namespace boost::math; + + // Factorials + unsigned int n = 3; + + try + { + cout << "Factorial: " << factorial(n) << endl; + + // Caution: You must provide a return type template value, so this will not compile + // unsigned int nfac = factorial(n); // could not deduce template argument for 'T' + // You must provide an explicit floating-point (not integer) return type. + // If you do provide an integer type, like this: + // unsigned int uintfac = factorial(n); + // you will also get a compile error, for MSVC C2338. + // If you really want an integer type, you can convert from double: + unsigned int intfac = static_cast(factorial(n)); + // this will be exact, until the result of the factorial overflows the integer type. + + cout << "Unchecked factorial: " << boost::math::unchecked_factorial(n) << endl; + // Note: + // unsigned int unfac = boost::math::unchecked_factorial(n); + // also fails to compile for the same reasons. + } + catch(exception& e) + { + cout << e.what() << endl; + } + + // Double factorial n!! + try + { + //cout << "Double factorial: " << boost::math::double_factorial(n); + } + catch(exception& e) + { + cout << e.what() << endl; + } + + // Rising and falling factorials + try + { + int i = 2; double x = 8; + cout << "Rising factorial: " << rising_factorial(x,i) << endl; + cout << "Falling factorial: " << falling_factorial(x,i) << endl; + } + catch(exception& e) + { + cout << e.what() << endl; + } + + // Binomial coefficients + try + { + unsigned n = 10; unsigned k = 2; + // cout << "Binomial coefficient: " << boost::math::binomial_coefficient(n,k) << endl; + } + catch(exception& e) + { + cout << e.what() << endl; + } + return 0; +} + +/* + +Output: + + factorial_example.vcxproj -> J:\Cpp\MathToolkit\test\Math_test\Release\factorial_example.exe + Factorial: 6 + Unchecked factorial: 6 + Rising factorial: 72 + Falling factorial: 56 + +*/ + + diff --git a/src/boost/libs/math/example/fft_sines_table.cpp b/src/boost/libs/math/example/fft_sines_table.cpp new file mode 100644 index 00000000..cd04642a --- /dev/null +++ b/src/boost/libs/math/example/fft_sines_table.cpp @@ -0,0 +1,270 @@ +// 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) + +// Copyright Paul A. Bristow 2013. +// Copyright Christopher Kormanyos 2012, 2013. +// Copyright John Maddock 2013. + +// This file is written to be included from a Quickbook .qbk document. +// It can be compiled by the C++ compiler, and run. Any output can +// also be added here as comment or included or pasted in elsewhere. +// Caution: this file contains Quickbook markup as well as code +// and comments: don't change any of the special comment markups! + +#ifdef _MSC_VER +# pragma warning (disable : 4996) // -D_SCL_SECURE_NO_WARNINGS. +#endif + +//[fft_sines_table_example_1 + +/*`[h5 Using Boost.Multiprecision to generate a high-precision array of sine coefficents for use with FFT.] + +The Boost.Multiprecision library can be used for computations requiring precision +exceeding that of standard built-in types such as `float`, `double` +and `long double`. For extended-precision calculations, Boost.Multiprecision +supplies a template data type called `cpp_bin_float`. The number of decimal +digits of precision is fixed at compile-time via a template parameter. + +One often needs to compute tables of numbers in mathematical software. +To avoid the +[@https://en.wikipedia.org/wiki/Rounding#Table-maker's_dilemma Table-maker's dilemma] +it is necessary to use a higher precision type to compute the table values so that they have +the nearest representable bit-pattern for the type, say `double`, of the table value. + +This example is a program `fft_since_table.cpp` that writes a header file `sines.hpp` +containing an array of sine coefficients for use with a Fast Fourier Transform (FFT), +that can be included by the FFT program. + +To use Boost.Multiprecision's high-precision floating-point types and constants, we need some includes: +*/ +#include +// using boost::math::constants::pi; + +#include // for +// using boost::multiprecision::cpp_bin_float and +// using boost::multiprecision::cpp_bin_float_50; +// using boost::multiprecision::cpp_bin_float_quad; + +#include // or for std::array + +#include +#include +#include +#include +#include +#include +#include + +/*`First, this example defines a prolog text string which is a C++ comment with the program licence, copyright etc. +(You would of course, tailor this to your needs, including *your* copyright claim). +This will appear at the top of the written header file `sines.hpp`. +*/ + +//] [fft_sines_table_example_1] + +static const char* prolog = +{ + "// Use, modification and distribution are subject to the\n" + "// Boost Software License, Version 1.0.\n" + "// (See accompanying file LICENSE_1_0.txt\n" + "// or copy at ""http://www.boost.org/LICENSE_1_0.txt)\n\n" + + "// Copyright A N Other, 2019.\n\n" +}; + +//[fft_sines_table_example_2 + +using boost::multiprecision::cpp_bin_float_50; +using boost::math::constants::pi; + +//] [fft_sines_table_example_2] + +// VS 2010 (wrongly) requires these at file scope, not local scope in `main`. +// This program also requires `-std=c++11` option to compile using Clang and GCC. + +int main() +{ +//[fft_sines_table_example_3 +/*`A fast Fourier transform (FFT), for example, may use a table of the values of +sin(([pi]/2[super n]) in its implementation details. In order to maximize the precision in +the FFT implementation, the precision of the tabulated trigonometric values +should exceed that of the built-in floating-point type used in the FFT. + +The sample below computes a table of the values of sin([pi]/2[super n]) +in the range 1 <= n <= 31. + +This program makes use of, among other program elements, the data type +`boost::multiprecision::cpp_bin_float_50` +for a precision of 50 decimal digits from Boost.Multiprecision, +the value of constant [pi] retrieved from Boost.Math, +guaranteed to be initialized with the very last bit of precision for the type, +here `cpp_bin_float_50`, +and a C++11 lambda function combined with `std::for_each()`. +*/ + +/*`define the number of values (32) in the array of sines. +*/ + + std::size_t size = 32U; + //cpp_bin_float_50 p = pi(); + cpp_bin_float_50 p = boost::math::constants::pi(); + + std::vector sin_values (size); + unsigned n = 1U; + // Generate the sine values. + std::for_each + ( + sin_values.begin (), + sin_values.end (), + [&n](cpp_bin_float_50& y) + { + y = sin( pi() / pow(cpp_bin_float_50 (2), n)); + ++n; + } + ); + +/*`Define the floating-point type for the generated file, either built-in +`double, `float, or `long double`, or a user defined type like `cpp_bin_float_50`. +*/ + +std::string fp_type = "double"; + +std::cout << "Generating an `std::array` or `boost::array` for floating-point type: " + << fp_type << ". " << std::endl; + +/*`By default, output would only show the standard 6 decimal digits, +so set precision to show enough significant digits for the chosen floating-point type. +For `cpp_bin_float_50` is 50. (50 decimal digits should be ample for most applications). + +*/ + std::streamsize precision = std::numeric_limits::digits10; + + std::cout << "Sines table precision is " << precision << " decimal digits. " << std::endl; + +/*`Of course, one could also choose a lower precision for the table values, for example, + +`std::streamsize precision = std::numeric_limits::max_digits10;` + +128-bit 'quad' precision of 36 decimal digits would be sufficient +for the most precise current `long double` implementations using 128-bit. +In general, it should be a couple of decimal digits more (guard digits) than +`std::numeric_limits::max_digits10` for the target system floating-point type. +(If the implementation does not provide `max_digits10`, the the Kahan formula +`std::numeric_limits::digits * 3010/10000 + 2` can be used instead). + +The compiler will read these values as decimal digits strings and +use the nearest representation for the floating-point type. + +Now output all the sine table, to a file of your chosen name. +*/ + const char sines_name[] = "sines.hpp"; // Assuming in same directory as .exe + + std::ofstream fout(sines_name, std::ios_base::out); // Creates if no file exists, + // & uses default overwrite/ ios::replace. + if (fout.is_open() == false) + { // failed to open OK! + std::cout << "Open file " << sines_name << " failed!" << std::endl; + return EXIT_FAILURE; + } + else + { // Write prolog etc as a C++ comment. + std::cout << "Open file " << sines_name << " for output OK." << std::endl; + fout << prolog + << "// Table of " << sin_values.size() << " values with " + << precision << " decimal digits precision,\n" + "// generated by program fft_sines_table.cpp.\n" << std::endl; + + fout << "#include // std::array" << std::endl; + + // Write the table of sines as a C++ array. + fout << "\nstatic const std::array sines =\n" + "{{\n"; // 2nd { needed for some old GCC compiler versions. + fout.precision(precision); + + for (unsigned int i = 0U; ;) + { + fout << " " << sin_values[i]; + if (i == sin_values.size()-1) + { // next is last value. + fout << "\n}}; // array sines\n"; // 2nd } needed for some old GCC compiler versions. + break; + } + else + { + fout << ",\n"; + i++; + } + } // for + + fout.close(); + std::cout << "Closed file " << sines_name << " for output." << std::endl; + } +//`The output file generated can be seen at [@../../example/sines.hpp] + +//] [/fft_sines_table_example_3] + + return EXIT_SUCCESS; + +} // int main() + +/* +//[fft_sines_table_example_output + +The printed table is: + + 1 + 0.70710678118654752440084436210484903928483593768847 + 0.38268343236508977172845998403039886676134456248563 + 0.19509032201612826784828486847702224092769161775195 + 0.098017140329560601994195563888641845861136673167501 + 0.049067674327418014254954976942682658314745363025753 + 0.024541228522912288031734529459282925065466119239451 + 0.012271538285719926079408261951003212140372319591769 + 0.0061358846491544753596402345903725809170578863173913 + 0.003067956762965976270145365490919842518944610213452 + 0.0015339801862847656123036971502640790799548645752374 + 0.00076699031874270452693856835794857664314091945206328 + 0.00038349518757139558907246168118138126339502603496474 + 0.00019174759731070330743990956198900093346887403385916 + 9.5873799095977345870517210976476351187065612851145e-05 + 4.7936899603066884549003990494658872746866687685767e-05 + 2.3968449808418218729186577165021820094761474895673e-05 + 1.1984224905069706421521561596988984804731977538387e-05 + 5.9921124526424278428797118088908617299871778780951e-06 + 2.9960562263346607504548128083570598118251878683408e-06 + 1.4980281131690112288542788461553611206917585861527e-06 + 7.4901405658471572113049856673065563715595930217207e-07 + 3.7450702829238412390316917908463317739740476297248e-07 + 1.8725351414619534486882457659356361712045272098287e-07 + 9.3626757073098082799067286680885620193236507169473e-08 + 4.681337853654909269511551813854009695950362701667e-08 + 2.3406689268274552759505493419034844037886207223779e-08 + 1.1703344634137277181246213503238103798093456639976e-08 + 5.8516723170686386908097901008341396943900085051757e-09 + 2.9258361585343193579282304690689559020175857150074e-09 + 1.4629180792671596805295321618659637103742615227834e-09 +*/ + +//] [/fft_sines_table_example_output] + +//[fft_sines_table_example_check + +/*` +The output can be copied as text and readily integrated into a given source +code. Alternatively, the output can be written to a text or even be used +within a self-written automatic code generator as this example. + +A computer algebra system can be used to verify the results obtained from +Boost.Math and Boost.Multiprecision. For example, the __Mathematica +computer algebra system can obtain a similar table with the command: + + Table[N[Sin[Pi / (2^n)], 50], {n, 1, 31, 1}] + +The __WolframAlpha computational knowledge engine can also be used to generate +this table. The same command can be pasted into the compute box. + +*/ + +//] [/fft_sines_table_example_check] diff --git a/src/boost/libs/math/example/find_location_example.cpp b/src/boost/libs/math/example/find_location_example.cpp new file mode 100644 index 00000000..a20edb8c --- /dev/null +++ b/src/boost/libs/math/example/find_location_example.cpp @@ -0,0 +1,174 @@ +// find_location.cpp + +// Copyright Paul A. Bristow 2008, 2010. + +// 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) + +// Example of finding location (mean) +// for normal (Gaussian) & Cauchy distribution. + +// Note that this file contains Quickbook mark-up as well as code +// and comments, don't change any of the special comment mark-ups! + +//#ifdef _MSC_VER +//# pragma warning(disable: 4180) // qualifier has no effect (in Fusion). +//#endif + +//[find_location1 +/*` +First we need some includes to access the normal distribution, +the algorithms to find location (and some std output of course). +*/ + +#include // for normal_distribution + using boost::math::normal; // typedef provides default type is double. +#include // for cauchy_distribution + using boost::math::cauchy; // typedef provides default type is double. +#include + using boost::math::find_location; // for mean +#include + using boost::math::find_scale; // for standard devation + using boost::math::complement; // Needed if you want to use the complement version. + using boost::math::policies::policy; + +#include + using std::cout; using std::endl; +#include + using std::setw; using std::setprecision; +#include + using std::numeric_limits; + +//] [/find_location1] + +int main() +{ + cout << "Example: Find location (or mean)." << endl; + try + { +//[find_location2 +/*` +For this example, we will use the standard normal distribution, +with mean (location) zero and standard deviation (scale) unity. +This is also the default for this implementation. +*/ + normal N01; // Default 'standard' normal distribution with zero mean and + double sd = 1.; // normal default standard deviation is 1. +/*`Suppose we want to find a different normal distribution whose mean is shifted +so that only fraction p (here 0.001 or 0.1%) are below a certain chosen limit +(here -2, two standard deviations). +*/ + double z = -2.; // z to give prob p + double p = 0.001; // only 0.1% below z + + cout << "Normal distribution with mean = " << N01.location() + << ", standard deviation " << N01.scale() + << ", has " << "fraction <= " << z + << ", p = " << cdf(N01, z) << endl; + cout << "Normal distribution with mean = " << N01.location() + << ", standard deviation " << N01.scale() + << ", has " << "fraction > " << z + << ", p = " << cdf(complement(N01, z)) << endl; // Note: uses complement. +/*` +[pre +Normal distribution with mean = 0, standard deviation 1, has fraction <= -2, p = 0.0227501 +Normal distribution with mean = 0, standard deviation 1, has fraction > -2, p = 0.97725 +] +We can now use ''find_location'' to give a new offset mean. +*/ + double l = find_location(z, p, sd); + cout << "offset location (mean) = " << l << endl; +/*` +that outputs: +[pre +offset location (mean) = 1.09023 +] +showing that we need to shift the mean just over one standard deviation from its previous value of zero. + +Then we can check that we have achieved our objective +by constructing a new distribution +with the offset mean (but same standard deviation): +*/ + normal np001pc(l, sd); // Same standard_deviation (scale) but with mean (location) shifted. +/*` +And re-calculating the fraction below our chosen limit. +*/ +cout << "Normal distribution with mean = " << l + << " has " << "fraction <= " << z + << ", p = " << cdf(np001pc, z) << endl; + cout << "Normal distribution with mean = " << l + << " has " << "fraction > " << z + << ", p = " << cdf(complement(np001pc, z)) << endl; +/*` +[pre +Normal distribution with mean = 1.09023 has fraction <= -2, p = 0.001 +Normal distribution with mean = 1.09023 has fraction > -2, p = 0.999 +] + +[h4 Controlling Error Handling from find_location] +We can also control the policy for handling various errors. +For example, we can define a new (possibly unwise) +policy to ignore domain errors ('bad' arguments). + +Unless we are using the boost::math namespace, we will need: +*/ + using boost::math::policies::policy; + using boost::math::policies::domain_error; + using boost::math::policies::ignore_error; + +/*` +Using a typedef is often convenient, especially if it is re-used, +although it is not required, as the various examples below show. +*/ + typedef policy > ignore_domain_policy; + // find_location with new policy, using typedef. + l = find_location(z, p, sd, ignore_domain_policy()); + // Default policy policy<>, needs "using boost::math::policies::policy;" + l = find_location(z, p, sd, policy<>()); + // Default policy, fully specified. + l = find_location(z, p, sd, boost::math::policies::policy<>()); + // A new policy, ignoring domain errors, without using a typedef. + l = find_location(z, p, sd, policy >()); +/*` +If we want to use a probability that is the __complements of our probability, +we should not even think of writing `find_location(z, 1 - p, sd)`, +but use the complement version, see __why_complements. +*/ + z = 2.; + double q = 0.95; // = 1 - p; // complement. + l = find_location(complement(z, q, sd)); + + normal np95pc(l, sd); // Same standard_deviation (scale) but with mean(location) shifted + cout << "Normal distribution with mean = " << l << " has " + << "fraction <= " << z << " = " << cdf(np95pc, z) << endl; + cout << "Normal distribution with mean = " << l << " has " + << "fraction > " << z << " = " << cdf(complement(np95pc, z)) << endl; + //] [/find_location2] + } + catch(const std::exception& e) + { // Always useful to include try & catch blocks because default policies + // are to throw exceptions on arguments that cause errors like underflow, overflow. + // Lacking try & catch blocks, the program will abort without a message below, + // which may give some helpful clues as to the cause of the exception. + std::cout << + "\n""Message from thrown exception was:\n " << e.what() << std::endl; + } + return 0; +} // int main() + +//[find_location_example_output +/*` +[pre +Example: Find location (mean). +Normal distribution with mean = 0, standard deviation 1, has fraction <= -2, p = 0.0227501 +Normal distribution with mean = 0, standard deviation 1, has fraction > -2, p = 0.97725 +offset location (mean) = 1.09023 +Normal distribution with mean = 1.09023 has fraction <= -2, p = 0.001 +Normal distribution with mean = 1.09023 has fraction > -2, p = 0.999 +Normal distribution with mean = 0.355146 has fraction <= 2 = 0.95 +Normal distribution with mean = 0.355146 has fraction > 2 = 0.05 +] +*/ +//] [/find_location_example_output] diff --git a/src/boost/libs/math/example/find_mean_and_sd_normal.cpp b/src/boost/libs/math/example/find_mean_and_sd_normal.cpp new file mode 100644 index 00000000..752c06a7 --- /dev/null +++ b/src/boost/libs/math/example/find_mean_and_sd_normal.cpp @@ -0,0 +1,413 @@ +// find_mean_and_sd_normal.cpp + +// Copyright Paul A. Bristow 2007, 2010. + +// 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) + +// Example of finding mean or sd for normal distribution. + +// Note that this file contains Quickbook mark-up as well as code +// and comments, don't change any of the special comment mark-ups! + +//[normal_std +/*` +First we need some includes to access the normal distribution, +the algorithms to find location and scale +(and some std output of course). +*/ + +#include // for normal_distribution + using boost::math::normal; // typedef provides default type is double. +#include // for cauchy_distribution + using boost::math::cauchy; // typedef provides default type is double. +#include + using boost::math::find_location; +#include + using boost::math::find_scale; + using boost::math::complement; + using boost::math::policies::policy; + +#include + using std::cout; using std::endl; using std::left; using std::showpoint; using std::noshowpoint; +#include + using std::setw; using std::setprecision; +#include + using std::numeric_limits; +#include + +//] [/normal_std Quickbook] + +int main() +{ + cout << "Find_location (mean) and find_scale (standard deviation) examples." << endl; + try + { + +//[normal_find_location_and_scale_eg + +/*` +[h4 Using find_location and find_scale to meet dispensing and measurement specifications] + +Consider an example from K Krishnamoorthy, +Handbook of Statistical Distributions with Applications, +ISBN 1-58488-635-8, (2006) p 126, example 10.3.7. + +"A machine is set to pack 3 kg of ground beef per pack. +Over a long period of time it is found that the average packed was 3 kg +with a standard deviation of 0.1 kg. +Assume the packing is normally distributed." + +We start by constructing a normal distribution with the given parameters: +*/ + +double mean = 3.; // kg +double standard_deviation = 0.1; // kg +normal packs(mean, standard_deviation); +/*`We can then find the fraction (or %) of packages that weigh more than 3.1 kg. +*/ + +double max_weight = 3.1; // kg +cout << "Percentage of packs > " << max_weight << " is " +<< cdf(complement(packs, max_weight)) * 100. << endl; // P(X > 3.1) + +/*`We might want to ensure that 95% of packs are over a minimum weight specification, +then we want the value of the mean such that P(X < 2.9) = 0.05. + +Using the mean of 3 kg, we can estimate +the fraction of packs that fail to meet the specification of 2.9 kg. +*/ + +double minimum_weight = 2.9; +cout <<"Fraction of packs <= " << minimum_weight << " with a mean of " << mean + << " is " << cdf(complement(packs, minimum_weight)) << endl; +// fraction of packs <= 2.9 with a mean of 3 is 0.841345 + +/*`This is 0.84 - more than the target fraction of 0.95. +If we want 95% to be over the minimum weight, +what should we set the mean weight to be? + +Using the KK StatCalc program supplied with the book and the method given on page 126 gives 3.06449. + +We can confirm this by constructing a new distribution which we call 'xpacks' +with a safety margin mean of 3.06449 thus: +*/ +double over_mean = 3.06449; +normal xpacks(over_mean, standard_deviation); +cout << "Fraction of packs >= " << minimum_weight +<< " with a mean of " << xpacks.mean() + << " is " << cdf(complement(xpacks, minimum_weight)) << endl; +// fraction of packs >= 2.9 with a mean of 3.06449 is 0.950005 + +/*`Using this Math Toolkit, we can calculate the required mean directly thus: +*/ +double under_fraction = 0.05; // so 95% are above the minimum weight mean - sd = 2.9 +double low_limit = standard_deviation; +double offset = mean - low_limit - quantile(packs, under_fraction); +double nominal_mean = mean + offset; +// mean + (mean - low_limit - quantile(packs, under_fraction)); + +normal nominal_packs(nominal_mean, standard_deviation); +cout << "Setting the packer to " << nominal_mean << " will mean that " + << "fraction of packs >= " << minimum_weight + << " is " << cdf(complement(nominal_packs, minimum_weight)) << endl; +// Setting the packer to 3.06449 will mean that fraction of packs >= 2.9 is 0.95 + +/*` +This calculation is generalized as the free function called `find_location`, +see __algorithms. + +To use this we will need to +*/ + +#include + using boost::math::find_location; +/*`and then use find_location function to find safe_mean, +& construct a new normal distribution called 'goodpacks'. +*/ +double safe_mean = find_location(minimum_weight, under_fraction, standard_deviation); +normal good_packs(safe_mean, standard_deviation); +/*`with the same confirmation as before: +*/ +cout << "Setting the packer to " << nominal_mean << " will mean that " + << "fraction of packs >= " << minimum_weight + << " is " << cdf(complement(good_packs, minimum_weight)) << endl; +// Setting the packer to 3.06449 will mean that fraction of packs >= 2.9 is 0.95 + +/*` +[h4 Using Cauchy-Lorentz instead of normal distribution] + +After examining the weight distribution of a large number of packs, we might decide that, +after all, the assumption of a normal distribution is not really justified. +We might find that the fit is better to a __cauchy_distrib. +This distribution has wider 'wings', so that whereas most of the values +are closer to the mean than the normal, there are also more values than 'normal' +that lie further from the mean than the normal. + +This might happen because a larger than normal lump of meat is either included or excluded. + +We first create a __cauchy_distrib with the original mean and standard deviation, +and estimate the fraction that lie below our minimum weight specification. +*/ + +cauchy cpacks(mean, standard_deviation); +cout << "Cauchy Setting the packer to " << mean << " will mean that " + << "fraction of packs >= " << minimum_weight + << " is " << cdf(complement(cpacks, minimum_weight)) << endl; +// Cauchy Setting the packer to 3 will mean that fraction of packs >= 2.9 is 0.75 + +/*`Note that far fewer of the packs meet the specification, only 75% instead of 95%. +Now we can repeat the find_location, using the cauchy distribution as template parameter, +in place of the normal used above. +*/ + +double lc = find_location(minimum_weight, under_fraction, standard_deviation); +cout << "find_location(minimum_weight, over fraction, standard_deviation); " << lc << endl; +// find_location(minimum_weight, over fraction, packs.standard_deviation()); 3.53138 +/*`Note that the safe_mean setting needs to be much higher, 3.53138 instead of 3.06449, +so we will make rather less profit. + +And again confirm that the fraction meeting specification is as expected. +*/ +cauchy goodcpacks(lc, standard_deviation); +cout << "Cauchy Setting the packer to " << lc << " will mean that " + << "fraction of packs >= " << minimum_weight + << " is " << cdf(complement(goodcpacks, minimum_weight)) << endl; +// Cauchy Setting the packer to 3.53138 will mean that fraction of packs >= 2.9 is 0.95 + +/*`Finally we could estimate the effect of a much tighter specification, +that 99% of packs met the specification. +*/ + +cout << "Cauchy Setting the packer to " + << find_location(minimum_weight, 0.99, standard_deviation) + << " will mean that " + << "fraction of packs >= " << minimum_weight + << " is " << cdf(complement(goodcpacks, minimum_weight)) << endl; + +/*`Setting the packer to 3.13263 will mean that fraction of packs >= 2.9 is 0.99, +but will more than double the mean loss from 0.0644 to 0.133 kg per pack. + +Of course, this calculation is not limited to packs of meat, it applies to dispensing anything, +and it also applies to a 'virtual' material like any measurement. + +The only caveat is that the calculation assumes that the standard deviation (scale) is known with +a reasonably low uncertainty, something that is not so easy to ensure in practice. +And that the distribution is well defined, __normal_distrib or __cauchy_distrib, or some other. + +If one is simply dispensing a very large number of packs, +then it may be feasible to measure the weight of hundreds or thousands of packs. +With a healthy 'degrees of freedom', the confidence intervals for the standard deviation +are not too wide, typically about + and - 10% for hundreds of observations. + +For other applications, where it is more difficult or expensive to make many observations, +the confidence intervals are depressingly wide. + +See [link math_toolkit.stat_tut.weg.cs_eg.chi_sq_intervals Confidence Intervals on the standard deviation] +for a worked example +[@../../example/chi_square_std_dev_test.cpp chi_square_std_dev_test.cpp] +of estimating these intervals. + + +[h4 Changing the scale or standard deviation] + +Alternatively, we could invest in a better (more precise) packer +(or measuring device) with a lower standard deviation, or scale. + +This might cost more, but would reduce the amount we have to 'give away' +in order to meet the specification. + +To estimate how much better (how much smaller standard deviation) it would have to be, +we need to get the 5% quantile to be located at the under_weight limit, 2.9 +*/ +double p = 0.05; // wanted p th quantile. +cout << "Quantile of " << p << " = " << quantile(packs, p) + << ", mean = " << packs.mean() << ", sd = " << packs.standard_deviation() << endl; +/*` +Quantile of 0.05 = 2.83551, mean = 3, sd = 0.1 + +With the current packer (mean = 3, sd = 0.1), the 5% quantile is at 2.8551 kg, +a little below our target of 2.9 kg. +So we know that the standard deviation is going to have to be smaller. + +Let's start by guessing that it (now 0.1) needs to be halved, to a standard deviation of 0.05 kg. +*/ +normal pack05(mean, 0.05); +cout << "Quantile of " << p << " = " << quantile(pack05, p) + << ", mean = " << pack05.mean() << ", sd = " << pack05.standard_deviation() << endl; +// Quantile of 0.05 = 2.91776, mean = 3, sd = 0.05 + +cout <<"Fraction of packs >= " << minimum_weight << " with a mean of " << mean + << " and standard deviation of " << pack05.standard_deviation() + << " is " << cdf(complement(pack05, minimum_weight)) << endl; +// Fraction of packs >= 2.9 with a mean of 3 and standard deviation of 0.05 is 0.97725 +/*` +So 0.05 was quite a good guess, but we are a little over the 2.9 target, +so the standard deviation could be a tiny bit more. So we could do some +more guessing to get closer, say by increasing standard deviation to 0.06 kg, +constructing another new distribution called pack06. +*/ +normal pack06(mean, 0.06); +cout << "Quantile of " << p << " = " << quantile(pack06, p) + << ", mean = " << pack06.mean() << ", sd = " << pack06.standard_deviation() << endl; +// Quantile of 0.05 = 2.90131, mean = 3, sd = 0.06 + +cout <<"Fraction of packs >= " << minimum_weight << " with a mean of " << mean + << " and standard deviation of " << pack06.standard_deviation() + << " is " << cdf(complement(pack06, minimum_weight)) << endl; +// Fraction of packs >= 2.9 with a mean of 3 and standard deviation of 0.06 is 0.95221 +/*` +Now we are getting really close, but to do the job properly, +we might need to use root finding method, for example the tools provided, +and used elsewhere, in the Math Toolkit, see __root_finding_without_derivatives + +But in this (normal) distribution case, we can and should be even smarter +and make a direct calculation. +*/ + +/*`Our required limit is minimum_weight = 2.9 kg, often called the random variate z. +For a standard normal distribution, then probability p = N((minimum_weight - mean) / sd). + +We want to find the standard deviation that would be required to meet this limit, +so that the p th quantile is located at z (minimum_weight). +In this case, the 0.05 (5%) quantile is at 2.9 kg pack weight, when the mean is 3 kg, +ensuring that 0.95 (95%) of packs are above the minimum weight. + +Rearranging, we can directly calculate the required standard deviation: +*/ +normal N01; // standard normal distribution with mean zero and unit standard deviation. +p = 0.05; +double qp = quantile(N01, p); +double sd95 = (minimum_weight - mean) / qp; + +cout << "For the "<< p << "th quantile to be located at " + << minimum_weight << ", would need a standard deviation of " << sd95 << endl; +// For the 0.05th quantile to be located at 2.9, would need a standard deviation of 0.0607957 + +/*`We can now construct a new (normal) distribution pack95 for the 'better' packer, +and check that our distribution will meet the specification. +*/ + +normal pack95(mean, sd95); +cout <<"Fraction of packs >= " << minimum_weight << " with a mean of " << mean + << " and standard deviation of " << pack95.standard_deviation() + << " is " << cdf(complement(pack95, minimum_weight)) << endl; +// Fraction of packs >= 2.9 with a mean of 3 and standard deviation of 0.0607957 is 0.95 + +/*`This calculation is generalized in the free function find_scale, +as shown below, giving the same standard deviation. +*/ +double ss = find_scale(minimum_weight, under_fraction, packs.mean()); +cout << "find_scale(minimum_weight, under_fraction, packs.mean()); " << ss << endl; +// find_scale(minimum_weight, under_fraction, packs.mean()); 0.0607957 + +/*`If we had defined an over_fraction, or percentage that must pass specification +*/ +double over_fraction = 0.95; +/*`And (wrongly) written + + double sso = find_scale(minimum_weight, over_fraction, packs.mean()); + +With the default policy, we would get a message like + +[pre +Message from thrown exception was: + Error in function boost::math::find_scale(double, double, double, Policy): + Computed scale (-0.060795683191176959) is <= 0! Was the complement intended? +] + +But this would return a *negative* standard deviation - obviously impossible. +The probability should be 1 - over_fraction, not over_fraction, thus: +*/ + +double ss1o = find_scale(minimum_weight, 1 - over_fraction, packs.mean()); +cout << "find_scale(minimum_weight, under_fraction, packs.mean()); " << ss1o << endl; +// find_scale(minimum_weight, under_fraction, packs.mean()); 0.0607957 + +/*`But notice that using '1 - over_fraction' - will lead to a +loss of accuracy, especially if over_fraction was close to unity. (See __why_complements). +In this (very common) case, we should instead use the __complements, +giving the most accurate result. +*/ + +double ssc = find_scale(complement(minimum_weight, over_fraction, packs.mean())); +cout << "find_scale(complement(minimum_weight, over_fraction, packs.mean())); " << ssc << endl; +// find_scale(complement(minimum_weight, over_fraction, packs.mean())); 0.0607957 + +/*`Note that our guess of 0.06 was close to the accurate value of 0.060795683191176959. + +We can again confirm our prediction thus: +*/ + +normal pack95c(mean, ssc); +cout <<"Fraction of packs >= " << minimum_weight << " with a mean of " << mean + << " and standard deviation of " << pack95c.standard_deviation() + << " is " << cdf(complement(pack95c, minimum_weight)) << endl; +// Fraction of packs >= 2.9 with a mean of 3 and standard deviation of 0.0607957 is 0.95 + +/*`Notice that these two deceptively simple questions: + +* Do we over-fill to make sure we meet a minimum specification (or under-fill to avoid an overdose)? + +and/or + +* Do we measure better? + +are actually extremely common. + +The weight of beef might be replaced by a measurement of more or less anything, +from drug tablet content, Apollo landing rocket firing, X-ray treatment doses... + +The scale can be variation in dispensing or uncertainty in measurement. +*/ +//] [/normal_find_location_and_scale_eg Quickbook end] + + } + catch(const std::exception& e) + { // Always useful to include try & catch blocks because default policies + // are to throw exceptions on arguments that cause errors like underflow, overflow. + // Lacking try & catch blocks, the program will abort without a message below, + // which may give some helpful clues as to the cause of the exception. + cout << + "\n""Message from thrown exception was:\n " << e.what() << endl; + } + return 0; +} // int main() + + +/* + +Output is: + +//[normal_find_location_and_scale_output + +Find_location (mean) and find_scale (standard deviation) examples. +Percentage of packs > 3.1 is 15.8655 +Fraction of packs <= 2.9 with a mean of 3 is 0.841345 +Fraction of packs >= 2.9 with a mean of 3.06449 is 0.950005 +Setting the packer to 3.06449 will mean that fraction of packs >= 2.9 is 0.95 +Setting the packer to 3.06449 will mean that fraction of packs >= 2.9 is 0.95 +Cauchy Setting the packer to 3 will mean that fraction of packs >= 2.9 is 0.75 +find_location(minimum_weight, over fraction, standard_deviation); 3.53138 +Cauchy Setting the packer to 3.53138 will mean that fraction of packs >= 2.9 is 0.95 +Cauchy Setting the packer to -0.282052 will mean that fraction of packs >= 2.9 is 0.95 +Quantile of 0.05 = 2.83551, mean = 3, sd = 0.1 +Quantile of 0.05 = 2.91776, mean = 3, sd = 0.05 +Fraction of packs >= 2.9 with a mean of 3 and standard deviation of 0.05 is 0.97725 +Quantile of 0.05 = 2.90131, mean = 3, sd = 0.06 +Fraction of packs >= 2.9 with a mean of 3 and standard deviation of 0.06 is 0.95221 +For the 0.05th quantile to be located at 2.9, would need a standard deviation of 0.0607957 +Fraction of packs >= 2.9 with a mean of 3 and standard deviation of 0.0607957 is 0.95 +find_scale(minimum_weight, under_fraction, packs.mean()); 0.0607957 +find_scale(minimum_weight, under_fraction, packs.mean()); 0.0607957 +find_scale(complement(minimum_weight, over_fraction, packs.mean())); 0.0607957 +Fraction of packs >= 2.9 with a mean of 3 and standard deviation of 0.0607957 is 0.95 + +//] [/normal_find_location_and_scale_eg_output] + +*/ + + + diff --git a/src/boost/libs/math/example/find_root_example.cpp b/src/boost/libs/math/example/find_root_example.cpp new file mode 100644 index 00000000..e944e09e --- /dev/null +++ b/src/boost/libs/math/example/find_root_example.cpp @@ -0,0 +1,169 @@ +// find_root_example.cpp + +// Copyright Paul A. Bristow 2007, 2010. + +// 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) + +// Example of using root finding. + +// Note that this file contains Quickbook mark-up as well as code +// and comments, don't change any of the special comment mark-ups! + +//[root_find1 +/*` +First we need some includes to access the normal distribution +(and some std output of course). +*/ + +#include // root finding. + +#include // for normal_distribution + using boost::math::normal; // typedef provides default type is double. + +#include + using std::cout; using std::endl; using std::left; using std::showpoint; using std::noshowpoint; +#include + using std::setw; using std::setprecision; +#include + using std::numeric_limits; +#include + + +//] //[/root_find1] + +int main() +{ + cout << "Example: Normal distribution, root finding."; + try + { + +//[root_find2 + +/*`A machine is set to pack 3 kg of ground beef per pack. +Over a long period of time it is found that the average packed was 3 kg +with a standard deviation of 0.1 kg. +Assuming the packing is normally distributed, +we can find the fraction (or %) of packages that weigh more than 3.1 kg. +*/ + +double mean = 3.; // kg +double standard_deviation = 0.1; // kg +normal packs(mean, standard_deviation); + +double max_weight = 3.1; // kg +cout << "Percentage of packs > " << max_weight << " is " +<< cdf(complement(packs, max_weight)) << endl; // P(X > 3.1) + +double under_weight = 2.9; +cout <<"fraction of packs <= " << under_weight << " with a mean of " << mean + << " is " << cdf(complement(packs, under_weight)) << endl; +// fraction of packs <= 2.9 with a mean of 3 is 0.841345 +// This is 0.84 - more than the target 0.95 +// Want 95% to be over this weight, so what should we set the mean weight to be? +// KK StatCalc says: +double over_mean = 3.0664; +normal xpacks(over_mean, standard_deviation); +cout << "fraction of packs >= " << under_weight +<< " with a mean of " << xpacks.mean() + << " is " << cdf(complement(xpacks, under_weight)) << endl; +// fraction of packs >= 2.9 with a mean of 3.06449 is 0.950005 +double under_fraction = 0.05; // so 95% are above the minimum weight mean - sd = 2.9 +double low_limit = standard_deviation; +double offset = mean - low_limit - quantile(packs, under_fraction); +double nominal_mean = mean + offset; + +normal nominal_packs(nominal_mean, standard_deviation); +cout << "Setting the packer to " << nominal_mean << " will mean that " + << "fraction of packs >= " << under_weight + << " is " << cdf(complement(nominal_packs, under_weight)) << endl; + +/*` +Setting the packer to 3.06449 will mean that fraction of packs >= 2.9 is 0.95. + +Setting the packer to 3.13263 will mean that fraction of packs >= 2.9 is 0.99, +but will more than double the mean loss from 0.0644 to 0.133. + +Alternatively, we could invest in a better (more precise) packer with a lower standard deviation. + +To estimate how much better (how much smaller standard deviation) it would have to be, +we need to get the 5% quantile to be located at the under_weight limit, 2.9 +*/ +double p = 0.05; // wanted p th quantile. +cout << "Quantile of " << p << " = " << quantile(packs, p) + << ", mean = " << packs.mean() << ", sd = " << packs.standard_deviation() << endl; // +/*` +Quantile of 0.05 = 2.83551, mean = 3, sd = 0.1 + +With the current packer (mean = 3, sd = 0.1), the 5% quantile is at 2.8551 kg, +a little below our target of 2.9 kg. +So we know that the standard deviation is going to have to be smaller. + +Let's start by guessing that it (now 0.1) needs to be halved, to a standard deviation of 0.05 +*/ +normal pack05(mean, 0.05); +cout << "Quantile of " << p << " = " << quantile(pack05, p) + << ", mean = " << pack05.mean() << ", sd = " << pack05.standard_deviation() << endl; + +cout <<"Fraction of packs >= " << under_weight << " with a mean of " << mean + << " and standard deviation of " << pack05.standard_deviation() + << " is " << cdf(complement(pack05, under_weight)) << endl; +// +/*` +Fraction of packs >= 2.9 with a mean of 3 and standard deviation of 0.05 is 0.9772 + +So 0.05 was quite a good guess, but we are a little over the 2.9 target, +so the standard deviation could be a tiny bit more. So we could do some +more guessing to get closer, say by increasing to 0.06 +*/ + +normal pack06(mean, 0.06); +cout << "Quantile of " << p << " = " << quantile(pack06, p) + << ", mean = " << pack06.mean() << ", sd = " << pack06.standard_deviation() << endl; + +cout <<"Fraction of packs >= " << under_weight << " with a mean of " << mean + << " and standard deviation of " << pack06.standard_deviation() + << " is " << cdf(complement(pack06, under_weight)) << endl; +/*` +Fraction of packs >= 2.9 with a mean of 3 and standard deviation of 0.06 is 0.9522 + +Now we are getting really close, but to do the job properly, +we could use root finding method, for example the tools provided, and used elsewhere, +in the Math Toolkit, see __root_finding_without_derivatives. + +But in this normal distribution case, we could be even smarter and make a direct calculation. +*/ +//] [/root_find2] + + } + catch(const std::exception& e) + { // Always useful to include try & catch blocks because default policies + // are to throw exceptions on arguments that cause errors like underflow, overflow. + // Lacking try & catch blocks, the program will abort without a message below, + // which may give some helpful clues as to the cause of the exception. + std::cout << + "\n""Message from thrown exception was:\n " << e.what() << std::endl; + } + return 0; +} // int main() + +/* +Output is: + +//[root_find_output + +Autorun "i:\boost-06-05-03-1300\libs\math\test\Math_test\debug\find_root_example.exe" +Example: Normal distribution, root finding.Percentage of packs > 3.1 is 0.158655 +fraction of packs <= 2.9 with a mean of 3 is 0.841345 +fraction of packs >= 2.9 with a mean of 3.0664 is 0.951944 +Setting the packer to 3.06449 will mean that fraction of packs >= 2.9 is 0.95 +Quantile of 0.05 = 2.83551, mean = 3, sd = 0.1 +Quantile of 0.05 = 2.91776, mean = 3, sd = 0.05 +Fraction of packs >= 2.9 with a mean of 3 and standard deviation of 0.05 is 0.97725 +Quantile of 0.05 = 2.90131, mean = 3, sd = 0.06 +Fraction of packs >= 2.9 with a mean of 3 and standard deviation of 0.06 is 0.95221 + +//] [/root_find_output] +*/ diff --git a/src/boost/libs/math/example/find_scale_example.cpp b/src/boost/libs/math/example/find_scale_example.cpp new file mode 100644 index 00000000..29e474f0 --- /dev/null +++ b/src/boost/libs/math/example/find_scale_example.cpp @@ -0,0 +1,180 @@ +// find_scale.cpp + +// Copyright Paul A. Bristow 2007, 2010. + +// 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) + +// Example of finding scale (standard deviation) for normal (Gaussian). + +// Note that this file contains Quickbook mark-up as well as code +// and comments, don't change any of the special comment mark-ups! + +//[find_scale1 +/*` +First we need some includes to access the __normal_distrib, +the algorithms to find scale (and some std output of course). +*/ + +#include // for normal_distribution + using boost::math::normal; // typedef provides default type is double. +#include + using boost::math::find_scale; + using boost::math::complement; // Needed if you want to use the complement version. + using boost::math::policies::policy; // Needed to specify the error handling policy. + +#include + using std::cout; using std::endl; +#include + using std::setw; using std::setprecision; +#include + using std::numeric_limits; +//] [/find_scale1] + +int main() +{ + cout << "Example: Find scale (standard deviation)." << endl; + try + { +//[find_scale2 +/*` +For this example, we will use the standard __normal_distrib, +with location (mean) zero and standard deviation (scale) unity. +Conveniently, this is also the default for this implementation's constructor. +*/ + normal N01; // Default 'standard' normal distribution with zero mean + double sd = 1.; // and standard deviation is 1. +/*`Suppose we want to find a different normal distribution with standard deviation +so that only fraction p (here 0.001 or 0.1%) are below a certain chosen limit +(here -2. standard deviations). +*/ + double z = -2.; // z to give prob p + double p = 0.001; // only 0.1% below z = -2 + + cout << "Normal distribution with mean = " << N01.location() // aka N01.mean() + << ", standard deviation " << N01.scale() // aka N01.standard_deviation() + << ", has " << "fraction <= " << z + << ", p = " << cdf(N01, z) << endl; + cout << "Normal distribution with mean = " << N01.location() + << ", standard deviation " << N01.scale() + << ", has " << "fraction > " << z + << ", p = " << cdf(complement(N01, z)) << endl; // Note: uses complement. +/*` +[pre +Normal distribution with mean = 0 has fraction <= -2, p = 0.0227501 +Normal distribution with mean = 0 has fraction > -2, p = 0.97725 +] +Noting that p = 0.02 instead of our target of 0.001, +we can now use `find_scale` to give a new standard deviation. +*/ + double l = N01.location(); + double s = find_scale(z, p, l); + cout << "scale (standard deviation) = " << s << endl; +/*` +that outputs: +[pre +scale (standard deviation) = 0.647201 +] +showing that we need to reduce the standard deviation from 1. to 0.65. + +Then we can check that we have achieved our objective +by constructing a new distribution +with the new standard deviation (but same zero mean): +*/ + normal np001pc(N01.location(), s); +/*` +And re-calculating the fraction below (and above) our chosen limit. +*/ + cout << "Normal distribution with mean = " << l + << " has " << "fraction <= " << z + << ", p = " << cdf(np001pc, z) << endl; + cout << "Normal distribution with mean = " << l + << " has " << "fraction > " << z + << ", p = " << cdf(complement(np001pc, z)) << endl; +/*` +[pre +Normal distribution with mean = 0 has fraction <= -2, p = 0.001 +Normal distribution with mean = 0 has fraction > -2, p = 0.999 +] + +[h4 Controlling how Errors from find_scale are handled] +We can also control the policy for handling various errors. +For example, we can define a new (possibly unwise) +policy to ignore domain errors ('bad' arguments). + +Unless we are using the boost::math namespace, we will need: +*/ + using boost::math::policies::policy; + using boost::math::policies::domain_error; + using boost::math::policies::ignore_error; + +/*` +Using a typedef is convenient, especially if it is re-used, +although it is not required, as the various examples below show. +*/ + typedef policy > ignore_domain_policy; + // find_scale with new policy, using typedef. + l = find_scale(z, p, l, ignore_domain_policy()); + // Default policy policy<>, needs using boost::math::policies::policy; + + l = find_scale(z, p, l, policy<>()); + // Default policy, fully specified. + l = find_scale(z, p, l, boost::math::policies::policy<>()); + // New policy, without typedef. + l = find_scale(z, p, l, policy >()); +/*` +If we want to express a probability, say 0.999, that is a complement, `1 - p` +we should not even think of writing `find_scale(z, 1 - p, l)`, +but use the __complements version (see __why_complements). +*/ + z = -2.; + double q = 0.999; // = 1 - p; // complement of 0.001. + sd = find_scale(complement(z, q, l)); + + normal np95pc(l, sd); // Same standard_deviation (scale) but with mean(scale) shifted + cout << "Normal distribution with mean = " << l << " has " + << "fraction <= " << z << " = " << cdf(np95pc, z) << endl; + cout << "Normal distribution with mean = " << l << " has " + << "fraction > " << z << " = " << cdf(complement(np95pc, z)) << endl; + +/*` +Sadly, it is all too easy to get probabilities the wrong way round, +when you may get a warning like this: +[pre +Message from thrown exception was: + Error in function boost::math::find_scale(complement(double, double, double, Policy)): + Computed scale (-0.48043523852179076) is <= 0! Was the complement intended? +] +The default error handling policy is to throw an exception with this message, +but if you chose a policy to ignore the error, +the (impossible) negative scale is quietly returned. +*/ +//] [/find_scale2] + } + catch(const std::exception& e) + { // Always useful to include try & catch blocks because default policies + // are to throw exceptions on arguments that cause errors like underflow, overflow. + // Lacking try & catch blocks, the program will abort without a message below, + // which may give some helpful clues as to the cause of the exception. + std::cout << + "\n""Message from thrown exception was:\n " << e.what() << std::endl; + } + return 0; +} // int main() + +//[find_scale_example_output +/*` +[pre +Example: Find scale (standard deviation). +Normal distribution with mean = 0, standard deviation 1, has fraction <= -2, p = 0.0227501 +Normal distribution with mean = 0, standard deviation 1, has fraction > -2, p = 0.97725 +scale (standard deviation) = 0.647201 +Normal distribution with mean = 0 has fraction <= -2, p = 0.001 +Normal distribution with mean = 0 has fraction > -2, p = 0.999 +Normal distribution with mean = 0.946339 has fraction <= -2 = 0.001 +Normal distribution with mean = 0.946339 has fraction > -2 = 0.999 +] +*/ +//] [/find_scale_example_output] diff --git a/src/boost/libs/math/example/float128_example.cpp b/src/boost/libs/math/example/float128_example.cpp new file mode 100644 index 00000000..23e01666 --- /dev/null +++ b/src/boost/libs/math/example/float128_example.cpp @@ -0,0 +1,289 @@ +// Copyright John Maddock 2016 +// Copyright Christopher Kormanyos 2016. +// Copyright Paul A. Bristow 2016. + +// 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) + +// Contains Quickbook snippets as C++ comments - do not remove. + +// http://gcc.gnu.org/onlinedocs/libquadmath/ GCC Quad-Precision Math Library +// https://en.wikipedia.org/wiki/Quadruple-precision_floating-point_format + +// https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Dialect-Options.html#C_002b_002b-Dialect-Options GNU 3.5 Options Controlling C++ Dialect +// https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html#C-Dialect-Options 3.4 Options Controlling C Dialect + +//[float128_includes_1 + +#include // For float_64_t, float128_t. Must be first include! +//#include +#include +#include // For gamma function. +#include // For constants pi, e ... +#include // + +#include // for pow function. + +// #include +// C:\program files\gcc-6-win64\lib\gcc\x86_64-w64-mingw32\6.1.1\include\quadmath.h + +// i:\modular-boost\boost\multiprecision\float128.hpp|210| undefined reference to `quadmath_snprintf'. + +//] [/float128_includes_1] + +//[float128_dialect_1 +/*`To make float128 available it is vital to get the dialect and options on the command line correct. + +Quad type is forbidden by all the strict C++ standards, so using or adding -std=c++11 and later standards will prevent its use. +so explicitly use -std=gnu++11, 1y, 14, 17, or 1z or ... + +For GCC 6.1.1, for example, the default is if no C++ language dialect options are given, is -std=gnu++14. + +See https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html#C-Dialect-Options +https://gcc.gnu.org/onlinedocs/gcc/Standards.html#Standards 2 Language Standards Supported by GCC + + g++.exe -Wall -fexceptions -std=gnu++17 -g -fext-numeric-literals -fpermissive -lquadmath + -II:\modular-boost\libs\math\include -Ii:\modular-boost -c J:\Cpp\float128\float128\float128_example.cpp -o obj\Debug\float128_example.o + +Requires GCC linker option -lquadmath + +If this is missing, then get errors like: + + \modular-boost\boost\multiprecision\float128.hpp|210|undefined reference to `quadmath_snprintf'| + \modular-boost\boost\multiprecision\float128.hpp|351|undefined reference to `sqrtq'| + +Requires compile option + + -fext-numeric-literals + +If missing, then get errors like: + +\modular-boost\libs\math\include/boost/math/cstdfloat/cstdfloat_types.hpp:229:43: error: unable to find numeric literal operator 'operator""Q' + +A successful build log was: + + g++.exe -Wall -std=c++11 -fexceptions -std=gnu++17 -g -fext-numeric-literals -II:\modular-boost\libs\math\include -Ii:\modular-boost -c J:\Cpp\float128\float128\float128_example.cpp -o obj\Debug\float128_example.o + g++.exe -o bin\Debug\float128.exe obj\Debug\float128_example.o -lquadmath +*/ + +//] [/float128_dialect_1] + +void show_versions(std::string title) +{ + std::cout << title << std::endl; + + std::cout << "Platform: " << BOOST_PLATFORM << '\n' + << "Compiler: " << BOOST_COMPILER << '\n' + << "STL : " << BOOST_STDLIB << '\n' + << "Boost : " << BOOST_VERSION / 100000 << "." + << BOOST_VERSION / 100 % 1000 << "." + << BOOST_VERSION % 100 + << std::endl; +#ifdef _MSC_VER + std::cout << "_MSC_FULL_VER = " << _MSC_FULL_VER << std::endl; // VS 2015 190023026 +#if defined _M_IX86 + std::cout << "(x86)" << std::endl; +#endif +#if defined _M_X64 + std::cout << " (x64)" << std::endl; +#endif +#if defined _M_IA64 + std::cout << " (Itanium)" << std::endl; +#endif + // Something very wrong if more than one is defined (so show them in all just in case)! +#endif // _MSC_VER +#ifdef __GNUC__ +//PRINT_MACRO(__GNUC__); +//PRINT_MACRO(__GNUC_MINOR__); +//PRINT_MACRO(__GNUC_PATCH__); +std::cout << "GCC " << __VERSION__ << std::endl; +//PRINT_MACRO(LONG_MAX); +#endif // __GNUC__ + return; +} // void show_version(std::string title) + +int main() +{ + try + { + +//[float128_example_3 +// Always use try'n'catch blocks to ensure any error messages are displayed. +//`Ensure that all possibly significant digits (17) including trailing zeros are shown. + + std::cout.precision(std::numeric_limits::max_digits10); + std::cout.setf(std::ios::showpoint); // Show all significant trailing zeros. + //] [/ float128_example_3] + +#ifdef BOOST_FLOAT128_C + std::cout << "Floating-point type boost::float128_t is available." << std::endl; + std::cout << " std::numeric_limits::digits10 == " + << std::numeric_limits::digits10 << std::endl; + std::cout << " std::numeric_limits::max_digits10 == " + << std::numeric_limits::max_digits10 << std::endl; +#else + std::cout << "Floating-point type boost::float128_t is NOT available." << std::endl; +#endif + + show_versions(""); + + using boost::multiprecision::float128; // Wraps, for example, __float128 or _Quad. + // or + //using namespace boost::multiprecision; + + std::cout.precision(std::numeric_limits::max_digits10); // Show all potentially meaningful digits. + std::cout.setf(std::ios::showpoint); // Show all significant trailing zeros. + + // float128 pi0 = boost::math::constants::pi(); // Compile fails - need to specify a type for the constant! + + float128 pi1 = boost::math::constants::pi(); // Returns a constant of type float128. + std::cout << sqrt(pi1) << std::endl; // 1.77245385090551602729816748334114514 + + float128 pi2 = boost::math::constants::pi<__float128>(); // Constant of type __float128 gets converted to float128 on the assignment. + std::cout << sqrt(pi2) << std::endl; // 1.77245385090551602729816748334114514 + + // DIY decimal digit literal constant, with suffix Q. + float128 pi3 = 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348Q; + std::cout << sqrt(pi3) << std::endl; // 1.77245385090551602729816748334114514 + + // Compare to ready-rolled sqrt(pi) constant from Boost.Math: + std::cout << boost::math::constants::root_pi() << std::endl; // 1.77245385090551602729816748334114514 + + // DIY decimal digit literal constant, without suffix Q, suffering seventeen silent digits loss of precision! + float128 pi4 = 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348; + std::cout << sqrt(pi4) << std::endl; // 1.77245385090551599275151910313924857 + + // float128 variables constructed from a quad-type literal can be declared constexpr if required: + +#ifndef BOOST_NO_CXX11_CONSTEXPR + constexpr float128 pi_constexpr = 3.1415926535897932384626433832795028841971693993751058Q; +#endif + std::cout << pi_constexpr << std::endl; // 3.14159265358979323846264338327950280 + + // But sadly functions like sqrt are not yet available constexpr for float128. + + // constexpr float128 root_pi_constexpr = sqrt(pi_constexpr); // Fails - not constexpr (yet). + // constexpr float128 root_pi_constexpr = std::sqrt(pi_constexpr); // Fails - no known conversion for argument 1 from 'const float128'. + // constexpr float128 root_pi_constexpr = sqrt(pi_constexpr); // Call to non-constexpr + // constexpr float128 root_pi_constexpr = boost::math::constants::root_pi(); // Missing type for constant. + + // Best current way to get a constexpr is to use a Boost.Math constant if one is available. + constexpr float128 root_pi_constexpr = boost::math::constants::root_pi(); + std::cout << root_pi_constexpr << std::endl; // 1.77245385090551602729816748334114514 + + // Note that casts within the sqrt call are NOT NEEDED (nor allowed), + // since all the variables are the correct type to begin with. + // std::cout << sqrt(pi3) << std::endl; + // But note examples of catastrophic (but hard to see) loss of precision below. + + // Note also that the library functions, here sqrt, is NOT defined using std::sqrt, + // so that the correct overload is found using Argument Dependent LookUp (ADL). + + float128 ee = boost::math::constants::e(); + std::cout << ee << std::endl; // 2.71828182845904523536028747135266231 + + float128 e1 = exp(1.Q); // Note argument to exp is type float128. + std::cout << e1 << std::endl; // 2.71828182845904523536028747135266231 + + // Beware - it is all too easy to silently get a much lower precision by mistake. + + float128 e1d = exp(1.); // Caution - only double 17 decimal digits precision! + std::cout << e1d << std::endl; // 2.71828182845904509079559829842764884 + + float128 e1i = exp(1); // Caution int promoted to double so only 17 decimal digits precision! + std::cout << e1i << std::endl; // 2.71828182845904509079559829842764884 + + float f1 = 1.F; + float128 e1f = exp(f1); // Caution float so only 6 decimal digits precision out of 36! + std::cout << e1f << std::endl; // 2.71828174591064453125000000000000000 + + // In all these cases you get what you asked for and not what you expected or wanted. + + // Casting is essential if you start with a lower precision type. + + float128 e1q = exp(static_cast(f1)); // Full 36 decimal digits precision! + std::cout << e1q << std::endl; // 2.71828182845904523536028747135266231 + + float128 e1qc = exp((float128)f1); // Full 36 decimal digits precision! + std::cout << e1qc << std::endl; // 2.71828182845904523536028747135266231 + + float128 e1qcc = exp(float128(f1)); // Full 36 decimal digits precision! + std::cout << e1qcc << std::endl; // 2.71828182845904523536028747135266231 + + //float128 e1q = exp(1.); // Compile fails. + // std::cout << e1q << std::endl; // + +// http://en.cppreference.com/w/cpp/language/typeid +// The name()is implementation-dependent mangled, and may not be able to be output. +// The example showing output using one of the implementations where type_info::name prints full type names; +// filter through c++filt -t if using gcc or similar. + +//[float128_type_info +const std::type_info& tifu128 = typeid(__float128); // OK. +//std::cout << tifu128.name() << std::endl; // On GCC, aborts (because not printable string). +//std::cout << typeid(__float128).name() << std::endl; // Aborts - +// string name cannot be output. + +const std::type_info& tif128 = typeid(float128); // OK. +std::cout << tif128.name() << std::endl; // OK. +std::cout << typeid(float128).name() << std::endl; // OK. + +const std::type_info& tpi = typeid(pi1); // OK using GCC 6.1.1. +// (from GCC 5 according to http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43622) +std::cout << tpi.name() << std::endl; // OK, Output implementation-dependent mangled name: + +// N5boost14multiprecision6numberINS0_8backends16float128_backendELNS0_26expression_template_optionE0EEE + +//] [/float128_type_info] + + } + catch (std::exception ex) + { // Display details about why any exceptions are thrown. + std::cout << "Thrown exception " << ex.what() << std::endl; + } +} // int main() + +/* +[float128_output + +-std=c++11 or -std=c++17 don't work + +Floating-point type boost::float128_t is NOT available. + +Platform: Win32 +Compiler: GNU C++ version 6.1.1 20160609 +STL : GNU libstdc++ version 20160609 +Boost : 1.62.0 +GCC 6.1.1 20160609 + + +Added -fext-numeric-literals to + +-std=gnu++11 -fext-numeric-literals -lquadmath + +Floating-point type boost::float128_t is available. + std::numeric_limits::digits10 == 33 + std::numeric_limits::max_digits10 == 36 + +Platform: Win32 +Compiler: GNU C++ version 6.1.1 20160609 +STL : GNU libstdc++ version 20160609 +Boost : 1.62.0 +GCC 6.1.1 20160609 +1.77245385090551602729816748334114514 +1.77245385090551602729816748334114514 +1.77245385090551602729816748334114514 +1.77245385090551602729816748334114514 +N5boost14multiprecision6numberINS0_8backends16float128_backendELNS0_26expression_template_optionE0EEE +N5boost14multiprecision6numberINS0_8backends16float128_backendELNS0_26expression_template_optionE0EEE +N5boost14multiprecision6numberINS0_8backends16float128_backendELNS0_26expression_template_optionE0EEE + +Process returned 0 (0x0) execution time : 0.033 s +Press any key to continue. + + + +//] [/float128_output] + +*/ diff --git a/src/boost/libs/math/example/float_comparison_example.cpp b/src/boost/libs/math/example/float_comparison_example.cpp new file mode 100644 index 00000000..6c892fa2 --- /dev/null +++ b/src/boost/libs/math/example/float_comparison_example.cpp @@ -0,0 +1,444 @@ +//!file +//! \brief floating-point comparison from Boost.Test +// Copyright Paul A. Bristow 2015. +// Copyright John Maddock 2015. + +// 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) + +// Note that this file contains Quickbook mark-up as well as code +// and comments, don't change any of the special comment mark-ups! + +#include +#include + +#include +#include // for std::numeric_limits::epsilon(). + +int main() +{ + std::cout << "Compare floats using Boost.Math functions/classes" << std::endl; + + +//[compare_floats_using +/*`Some using statements will ensure that the functions we need are accessible. +*/ + + using namespace boost::math; + +//`or + + using boost::math::relative_difference; + using boost::math::epsilon_difference; + using boost::math::float_next; + using boost::math::float_prior; + +//] [/compare_floats_using] + + +//[compare_floats_example_1 +/*`The following examples display values with all possibly significant digits. +Newer compilers should provide `std::numeric_limits::max_digits10` +for this purpose, and here we use `float` precision where `max_digits10` = 9 +to avoid displaying a distracting number of decimal digits. + +[note Older compilers can use this formula to calculate `max_digits10` +from `std::numeric_limits::digits10`: +__spaces `int max_digits10 = 2 + std::numeric_limits::digits10 * 3010/10000;` +] [/note] + +One can set the display including all trailing zeros +(helpful for this example to show all potentially significant digits), +and also to display `bool` values as words rather than integers: +*/ + std::cout.precision(std::numeric_limits::max_digits10); + std::cout << std::boolalpha << std::showpoint << std::endl; + +//] [/compare_floats_example_1] + +//[compare_floats_example_2] +/*` +When comparing values that are ['quite close] or ['approximately equal], +we could use either `float_distance` or `relative_difference`/`epsilon_difference`, for example +with type `float`, these two values are adjacent to each other: +*/ + + float a = 1; + float b = 1 + std::numeric_limits::epsilon(); + std::cout << "a = " << a << std::endl; + std::cout << "b = " << b << std::endl; + std::cout << "float_distance = " << float_distance(a, b) << std::endl; + std::cout << "relative_difference = " << relative_difference(a, b) << std::endl; + std::cout << "epsilon_difference = " << epsilon_difference(a, b) << std::endl; + +/*` +Which produces the output: + +[pre +a = 1.00000000 +b = 1.00000012 +float_distance = 1.00000000 +relative_difference = 1.19209290e-007 +epsilon_difference = 1.00000000 +] +*/ + //] [/compare_floats_example_2] + +//[compare_floats_example_3] +/*` +In the example above, it just so happens that the edit distance as measured by `float_distance`, and the +difference measured in units of epsilon were equal. However, due to the way floating point +values are represented, that is not always the case:*/ + + a = 2.0f / 3.0f; // 2/3 inexactly represented as a float + b = float_next(float_next(float_next(a))); // 3 floating point values above a + std::cout << "a = " << a << std::endl; + std::cout << "b = " << b << std::endl; + std::cout << "float_distance = " << float_distance(a, b) << std::endl; + std::cout << "relative_difference = " << relative_difference(a, b) << std::endl; + std::cout << "epsilon_difference = " << epsilon_difference(a, b) << std::endl; + +/*` +Which produces the output: + +[pre +a = 0.666666687 +b = 0.666666865 +float_distance = 3.00000000 +relative_difference = 2.68220901e-007 +epsilon_difference = 2.25000000 +] + +There is another important difference between `float_distance` and the +`relative_difference/epsilon_difference` functions in that `float_distance` +returns a signed result that reflects which argument is larger in magnitude, +where as `relative_difference/epsilon_difference` simply return an unsigned +value that represents how far apart the values are. For example if we swap +the order of the arguments: +*/ + + std::cout << "float_distance = " << float_distance(b, a) << std::endl; + std::cout << "relative_difference = " << relative_difference(b, a) << std::endl; + std::cout << "epsilon_difference = " << epsilon_difference(b, a) << std::endl; + + /*` + The output is now: + + [pre + float_distance = -3.00000000 + relative_difference = 2.68220901e-007 + epsilon_difference = 2.25000000 + ] +*/ + //] [/compare_floats_example_3] + +//[compare_floats_example_4] +/*` +Zeros are always treated as equal, as are infinities as long as they have the same sign:*/ + + a = 0; + b = -0; // signed zero + std::cout << "relative_difference = " << relative_difference(a, b) << std::endl; + a = b = std::numeric_limits::infinity(); + std::cout << "relative_difference = " << relative_difference(a, b) << std::endl; + std::cout << "relative_difference = " << relative_difference(a, -b) << std::endl; + +/*` +Which produces the output: + +[pre +relative_difference = 0.000000000 +relative_difference = 0.000000000 +relative_difference = 3.40282347e+038 +] +*/ +//] [/compare_floats_example_4] + +//[compare_floats_example_5] +/*` +Note that finite values are always infinitely far away from infinities even if those finite values are very large:*/ + + a = (std::numeric_limits::max)(); + b = std::numeric_limits::infinity(); + std::cout << "a = " << a << std::endl; + std::cout << "b = " << b << std::endl; + std::cout << "relative_difference = " << relative_difference(a, b) << std::endl; + std::cout << "epsilon_difference = " << epsilon_difference(a, b) << std::endl; + +/*` +Which produces the output: + +[pre +a = 3.40282347e+038 +b = 1.#INF0000 +relative_difference = 3.40282347e+038 +epsilon_difference = 3.40282347e+038 +] +*/ +//] [/compare_floats_example_5] + +//[compare_floats_example_6] +/*` +Finally, all denormalized values and zeros are treated as being effectively equal:*/ + + a = std::numeric_limits::denorm_min(); + b = a * 2; + std::cout << "a = " << a << std::endl; + std::cout << "b = " << b << std::endl; + std::cout << "float_distance = " << float_distance(a, b) << std::endl; + std::cout << "relative_difference = " << relative_difference(a, b) << std::endl; + std::cout << "epsilon_difference = " << epsilon_difference(a, b) << std::endl; + a = 0; + std::cout << "a = " << a << std::endl; + std::cout << "b = " << b << std::endl; + std::cout << "float_distance = " << float_distance(a, b) << std::endl; + std::cout << "relative_difference = " << relative_difference(a, b) << std::endl; + std::cout << "epsilon_difference = " << epsilon_difference(a, b) << std::endl; + +/*` +Which produces the output: + +[pre +a = 1.40129846e-045 +b = 2.80259693e-045 +float_distance = 1.00000000 +relative_difference = 0.000000000 +epsilon_difference = 0.000000000 +a = 0.000000000 +b = 2.80259693e-045 +float_distance = 2.00000000 +relative_difference = 0.000000000 +epsilon_difference = 0.000000000] + +Notice how, in the above example, two denormalized values that are a factor of 2 apart are +none the less only one representation apart! + +*/ +//] [/compare_floats_example_6] + + +#if 0 +//[old_compare_floats_example_3 +//`The simplest use is to compare two values with a tolerance thus: + + bool is_close = is_close_to(1.F, 1.F + epsilon, epsilon); // One epsilon apart is close enough. + std::cout << "is_close_to(1.F, 1.F + epsilon, epsilon); is " << is_close << std::endl; // true + + is_close = is_close_to(1.F, 1.F + 2 * epsilon, epsilon); // Two epsilon apart isn't close enough. + std::cout << "is_close_to(1.F, 1.F + epsilon, epsilon); is " << is_close << std::endl; // false + +/*` +[note The type FPT of the tolerance and the type of the values [*must match]. + +So `is_close(0.1F, 1., 1.)` will fail to compile because "template parameter 'FPT' is ambiguous". +Always provide the same type, using `static_cast` if necessary.] +*/ + + +/*`An instance of class `close_at_tolerance` is more convenient +when multiple tests with the same conditions are planned. +A class that stores a tolerance of three epsilon (and the default ['strong] test) is: +*/ + + close_at_tolerance three_rounds(3 * epsilon); // 'strong' by default. + +//`and we can confirm these settings: + + std::cout << "fraction_tolerance = " + << three_rounds.fraction_tolerance() + << std::endl; // +3.57627869e-007 + std::cout << "strength = " + << (three_rounds.strength() == FPC_STRONG ? "strong" : "weak") + << std::endl; // strong + +//`To start, let us use two values that are truly equal (having identical bit patterns) + + float a = 1.23456789F; + float b = 1.23456789F; + +//`and make a comparison using our 3*epsilon `three_rounds` functor: + + bool close = three_rounds(a, b); + std::cout << "three_rounds(a, b) = " << close << std::endl; // true + +//`Unsurprisingly, the result is true, and the failed fraction is zero. + + std::cout << "failed_fraction = " << three_rounds.failed_fraction() << std::endl; + +/*`To get some nearby values, it is convenient to use the Boost.Math __next_float functions, +for which we need an include + + #include + +and some using declarations: +*/ + + using boost::math::float_next; + using boost::math::float_prior; + using boost::math::nextafter; + using boost::math::float_distance; + +//`To add a few __ulp to one value: + b = float_next(a); // Add just one ULP to a. + b = float_next(b); // Add another one ULP. + b = float_next(b); // Add another one ULP. + // 3 epsilon would pass. + b = float_next(b); // Add another one ULP. + +//`and repeat our comparison: + + close = three_rounds(a, b); + std::cout << "three_rounds(a, b) = " << close << std::endl; // false + std::cout << "failed_fraction = " << three_rounds.failed_fraction() + << std::endl; // abs(u-v) / abs(v) = 3.86237957e-007 + +//`We can also 'measure' the number of bits different using the `float_distance` function: + + std::cout << "float_distance = " << float_distance(a, b) << std::endl; // 4 + +/*`Now consider two values that are much further apart +than one might expect from ['computational noise], +perhaps the result of two measurements of some physical property like length +where an uncertainty of a percent or so might be expected. +*/ + float fp1 = 0.01000F; + float fp2 = 0.01001F; // Slightly different. + + float tolerance = 0.0001F; + + close_at_tolerance strong(epsilon); // Default is strong. + bool rs = strong(fp1, fp2); + std::cout << "strong(fp1, fp2) is " << rs << std::endl; + +//`Or we could contrast using the ['weak] criterion: + close_at_tolerance weak(epsilon, FPC_WEAK); // Explicitly weak. + bool rw = weak(fp1, fp2); // + std::cout << "weak(fp1, fp2) is " << rw << std::endl; + +//`We can also construct, setting tolerance and strength, and compare in one statement: + + std::cout << a << " #= " << b << " is " + << close_at_tolerance(epsilon, FPC_STRONG)(a, b) << std::endl; + std::cout << a << " ~= " << b << " is " + << close_at_tolerance(epsilon, FPC_WEAK)(a, b) << std::endl; + +//`but this has little advantage over using function `is_close_to` directly. + +//] [/old_compare_floats_example_3] + + +/*When the floating-point values become very small and near zero, using +//a relative test becomes unhelpful because one is dividing by zero or tiny, + +//Instead, an absolute test is needed, comparing one (or usually both) values with zero, +//using a tolerance. +//This is provided by the `small_with_tolerance` class and `is_small` function. + + namespace boost { + namespace math { + namespace fpc { + + + template + class small_with_tolerance + { + public: + // Public typedefs. + typedef bool result_type; + + // Constructor. + explicit small_with_tolerance(FPT tolerance); // tolerance >= 0 + + // Functor + bool operator()(FPT value) const; // return true if <= absolute tolerance (near zero). + }; + + template + bool + is_small(FPT value, FPT tolerance); // return true if value <= absolute tolerance (near zero). + + }}} // namespaces. + +/*` +[note The type FPT of the tolerance and the type of the value [*must match]. + +So `is_small(0.1F, 0.000001)` will fail to compile because "template parameter 'FPT' is ambiguous". +Always provide the same type, using `static_cast` if necessary.] + +A few values near zero are tested with varying tolerance below. +*/ +//[compare_floats_small_1 + + float c = 0; + std::cout << "0 is_small " << is_small(c, epsilon) << std::endl; // true + + c = std::numeric_limits::denorm_min(); // 1.40129846e-045 + std::cout << "denorm_ min =" << c << ", is_small is " << is_small(c, epsilon) << std::endl; // true + + c = (std::numeric_limits::min)(); // 1.17549435e-038 + std::cout << "min = " << c << ", is_small is " << is_small(c, epsilon) << std::endl; // true + + c = 1 * epsilon; // 1.19209290e-007 + std::cout << "epsilon = " << c << ", is_small is " << is_small(c, epsilon) << std::endl; // false + + c = 1 * epsilon; // 1.19209290e-007 + std::cout << "2 epsilon = " << c << ", is_small is " << is_small(c, 2 * epsilon) << std::endl; // true + + c = 2 * epsilon; //2.38418579e-007 + std::cout << "4 epsilon = " << c << ", is_small is " << is_small(c, 2 * epsilon) << std::endl; // false + + c = 0.00001F; + std::cout << "0.00001 = " << c << ", is_small is " << is_small(c, 0.0001F) << std::endl; // true + + c = -0.00001F; + std::cout << "0.00001 = " << c << ", is_small is " << is_small(c, 0.0001F) << std::endl; // true + +/*`Using the class `small_with_tolerance` allows storage of the tolerance, +convenient if you make repeated tests with the same tolerance. +*/ + + small_with_tolerancemy_test(0.01F); + + std::cout << "my_test(0.001F) is " << my_test(0.001F) << std::endl; // true + std::cout << "my_test(0.001F) is " << my_test(0.01F) << std::endl; // false + + //] [/compare_floats_small_1] +#endif + return 0; +} // int main() + +/* + +Example output is: + +//[compare_floats_output +Compare floats using Boost.Test functions/classes + +float epsilon = 1.19209290e-007 +is_close_to(1.F, 1.F + epsilon, epsilon); is true +is_close_to(1.F, 1.F + epsilon, epsilon); is false +fraction_tolerance = 3.57627869e-007 +strength = strong +three_rounds(a, b) = true +failed_fraction = 0.000000000 +three_rounds(a, b) = false +failed_fraction = 3.86237957e-007 +float_distance = 4.00000000 +strong(fp1, fp2) is false +weak(fp1, fp2) is false +1.23456788 #= 1.23456836 is false +1.23456788 ~= 1.23456836 is false +0 is_small true +denorm_ min =1.40129846e-045, is_small is true +min = 1.17549435e-038, is_small is true +epsilon = 1.19209290e-007, is_small is false +2 epsilon = 1.19209290e-007, is_small is true +4 epsilon = 2.38418579e-007, is_small is false +0.00001 = 9.99999975e-006, is_small is true +0.00001 = -9.99999975e-006, is_small is true +my_test(0.001F) is true + +my_test(0.001F) is false//] [/compare_floats_output] +*/ diff --git a/src/boost/libs/math/example/gauss_example.cpp b/src/boost/libs/math/example/gauss_example.cpp new file mode 100644 index 00000000..466d58b4 --- /dev/null +++ b/src/boost/libs/math/example/gauss_example.cpp @@ -0,0 +1,142 @@ +/* + * Copyright John Maddock, 2017 + * 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) + * + * This example Illustrates numerical integration via Gauss and Gauss-Kronrod quadrature. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +void gauss_examples() +{ + //[gauss_example + + /*` + We'll begin by integrating t[super 2] atan(t) over (0,1) using a 7 term Gauss-Legendre rule, + and begin by defining the function to integrate as a C++ lambda expression: + */ + using namespace boost::math::quadrature; + + auto f = [](const double& t) { return t * t * std::atan(t); }; + + /*` + Integration is simply a matter of calling the `gauss::integrate` method: + */ + + double Q = gauss::integrate(f, 0, 1); + + /*` + Which yields a value 0.2106572512 accurate to 1e-10. + + For more accurate evaluations, we'll move to a multiprecision type and use a 20-point integration scheme: + */ + + using boost::multiprecision::cpp_bin_float_quad; + + auto f2 = [](const cpp_bin_float_quad& t) { return t * t * atan(t); }; + + cpp_bin_float_quad Q2 = gauss::integrate(f2, 0, 1); + + /*` + Which yields 0.2106572512258069881080923020669, which is accurate to 5e-28. + */ + + //] + + std::cout << std::setprecision(18) << Q << std::endl; + std::cout << boost::math::relative_difference(Q, (boost::math::constants::pi() - 2 + 2 * boost::math::constants::ln_two()) / 12) << std::endl; + + std::cout << std::setprecision(34) << Q2 << std::endl; + std::cout << boost::math::relative_difference(Q2, (boost::math::constants::pi() - 2 + 2 * boost::math::constants::ln_two()) / 12) << std::endl; +} + +void gauss_kronrod_examples() +{ + //[gauss_kronrod_example + + /*` + We'll begin by integrating exp(-t[super 2]/2) over (0,+[infin]) using a 7 term Gauss rule + and 15 term Kronrod rule, + and begin by defining the function to integrate as a C++ lambda expression: + */ + using namespace boost::math::quadrature; + + auto f1 = [](double t) { return std::exp(-t*t / 2); }; + + //<- + double Q_expected = sqrt(boost::math::constants::half_pi()); + //-> + + /*` + We'll start off with a one shot (ie non-adaptive) + integration, and keep track of the estimated error: + */ + double error; + double Q = gauss_kronrod::integrate(f1, 0, std::numeric_limits::infinity(), 0, 0, &error); + + /*` + This yields Q = 1.25348207361, which has an absolute error of 1e-4 compared to the estimated error + of 5e-3: this is fairly typical, with the difference between Gauss and Gauss-Kronrod schemes being + much higher than the actual error. Before moving on to adaptive quadrature, lets try again + with more points, in fact with the largest Gauss-Kronrod scheme we have cached (30/61): + */ + //<- + std::cout << std::setprecision(16) << Q << std::endl; + std::cout << boost::math::relative_difference(Q, Q_expected) << std::endl; + std::cout << fabs(Q - Q_expected) << std::endl; + std::cout << error << std::endl; + //-> + Q = gauss_kronrod::integrate(f1, 0, std::numeric_limits::infinity(), 0, 0, &error); + //<- + std::cout << std::setprecision(16) << Q << std::endl; + std::cout << boost::math::relative_difference(Q, Q_expected) << std::endl; + std::cout << fabs(Q - Q_expected) << std::endl; + std::cout << error << std::endl; + //-> + /*` + This yields an absolute error of 3e-15 against an estimate of 1e-8, which is about as good as we're going to get + at double precision + + However, instead of continuing with ever more points, lets switch to adaptive integration, and set the desired relative + error to 1e-14 against a maximum depth of 5: + */ + Q = gauss_kronrod::integrate(f1, 0, std::numeric_limits::infinity(), 5, 1e-14, &error); + //<- + std::cout << std::setprecision(16) << Q << std::endl; + std::cout << boost::math::relative_difference(Q, Q_expected) << std::endl; + std::cout << fabs(Q - Q_expected) << std::endl; + std::cout << error << std::endl; + //-> + /*` + This yields an actual error of zero, against an estimate of 4e-15. In fact in this case the requested tolerance was almost + certainly set too low: as we've seen above, for smooth functions, the precision achieved is often double + that of the estimate, so if we integrate with a tolerance of 1e-9: + */ + Q = gauss_kronrod::integrate(f1, 0, std::numeric_limits::infinity(), 5, 1e-9, &error); + //<- + std::cout << std::setprecision(16) << Q << std::endl; + std::cout << boost::math::relative_difference(Q, Q_expected) << std::endl; + std::cout << fabs(Q - Q_expected) << std::endl; + std::cout << error << std::endl; + //-> + /*` + We still achieve 1e-15 precision, with an error estimate of 1e-10. + */ + //] +} + +int main() +{ + gauss_examples(); + gauss_kronrod_examples(); + return 0; +} diff --git a/src/boost/libs/math/example/geometric_examples.cpp b/src/boost/libs/math/example/geometric_examples.cpp new file mode 100644 index 00000000..14dbe9eb --- /dev/null +++ b/src/boost/libs/math/example/geometric_examples.cpp @@ -0,0 +1,364 @@ +// geometric_examples.cpp + +// Copyright Paul A. Bristow 2010. + +// 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) + +// This file is written to be included from a Quickbook .qbk document. +// It can still be compiled by the C++ compiler, and run. +// Any output can also be added here as comment or included or pasted in elsewhere. +// Caution: this file contains Quickbook markup as well as code +// and comments: don't change any of the special comment markups! + +// Examples of using the geometric distribution. + +//[geometric_eg1_1 +/*` +For this example, we will opt to #define two macros to control +the error and discrete handling policies. +For this simple example, we want to avoid throwing +an exception (the default policy) and just return infinity. +We want to treat the distribution as if it was continuous, +so we choose a discrete_quantile policy of real, +rather than the default policy integer_round_outwards. +*/ +#define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error +#define BOOST_MATH_DISCRETE_QUANTILE_POLICY real +/*` +[caution It is vital to #include distributions etc *after* the above #defines] +After that we need some includes to provide easy access to the negative binomial distribution, +and we need some std library iostream, of course. +*/ +#include + // for geometric_distribution + using ::boost::math::geometric_distribution; // + using ::boost::math::geometric; // typedef provides default type is double. + using ::boost::math::pdf; // Probability mass function. + using ::boost::math::cdf; // Cumulative density function. + using ::boost::math::quantile; + +#include + // for negative_binomial_distribution + using boost::math::negative_binomial; // typedef provides default type is double. + +#include + // for negative_binomial_distribution + using boost::math::normal; // typedef provides default type is double. + +#include + using std::cout; using std::endl; + using std::noshowpoint; using std::fixed; using std::right; using std::left; +#include + using std::setprecision; using std::setw; + +#include + using std::numeric_limits; +//] [geometric_eg1_1] + +int main() +{ + cout <<"Geometric distribution example" << endl; + cout << endl; + + cout.precision(4); // But only show a few for this example. + try + { +//[geometric_eg1_2 +/*` +It is always sensible to use try and catch blocks because defaults policies are to +throw an exception if anything goes wrong. + +Simple try'n'catch blocks (see below) will ensure that you get a +helpful error message instead of an abrupt (and silent) program abort. + +[h6 Throwing a dice] +The Geometric distribution describes the probability (/p/) of a number of failures +to get the first success in /k/ Bernoulli trials. +(A [@http://en.wikipedia.org/wiki/Bernoulli_distribution Bernoulli trial] +is one with only two possible outcomes, success of failure, +and /p/ is the probability of success). + +Suppose an 'fair' 6-face dice is thrown repeatedly: +*/ + double success_fraction = 1./6; // success_fraction (p) = 0.1666 + // (so failure_fraction is 1 - success_fraction = 5./6 = 1- 0.1666 = 0.8333) + +/*`If the dice is thrown repeatedly until the *first* time a /three/ appears. +The probablility distribution of the number of times it is thrown *not* getting a /three/ + (/not-a-threes/ number of failures to get a /three/) +is a geometric distribution with the success_fraction = 1/6 = 0.1666[recur]. + +We therefore start by constructing a geometric distribution +with the one parameter success_fraction, the probability of success. +*/ + geometric g6(success_fraction); // type double by default. +/*` +To confirm, we can echo the success_fraction parameter of the distribution. +*/ + cout << "success fraction of a six-sided dice is " << g6.success_fraction() << endl; +/*`So the probability of getting a three at the first throw (zero failures) is +*/ + cout << pdf(g6, 0) << endl; // 0.1667 + cout << cdf(g6, 0) << endl; // 0.1667 +/*`Note that the cdf and pdf are identical because the is only one throw. +If we want the probability of getting the first /three/ on the 2nd throw: +*/ + cout << pdf(g6, 1) << endl; // 0.1389 + +/*`If we want the probability of getting the first /three/ on the 1st or 2nd throw +(allowing one failure): +*/ + cout << "pdf(g6, 0) + pdf(g6, 1) = " << pdf(g6, 0) + pdf(g6, 1) << endl; +/*`Or more conveniently, and more generally, +we can use the Cumulative Distribution Function CDF.*/ + + cout << "cdf(g6, 1) = " << cdf(g6, 1) << endl; // 0.3056 + +/*`If we allow many more (12) throws, the probability of getting our /three/ gets very high:*/ + cout << "cdf(g6, 12) = " << cdf(g6, 12) << endl; // 0.9065 or 90% probability. +/*`If we want to be much more confident, say 99%, +we can estimate the number of throws to be this sure +using the inverse or quantile. +*/ + cout << "quantile(g6, 0.99) = " << quantile(g6, 0.99) << endl; // 24.26 +/*`Note that the value returned is not an integer: +if you want an integer result you should use either floor, round or ceil functions, +or use the policies mechanism. + +See __understand_dis_quant. + +The geometric distribution is related to the negative binomial +__spaces `negative_binomial_distribution(RealType r, RealType p);` with parameter /r/ = 1. +So we could get the same result using the negative binomial, +but using the geometric the results will be faster, and may be more accurate. +*/ + negative_binomial nb(1, success_fraction); + cout << pdf(nb, 1) << endl; // 0.1389 + cout << cdf(nb, 1) << endl; // 0.3056 +/*`We could also the complement to express the required probability +as 1 - 0.99 = 0.01 (and get the same result): +*/ + cout << "quantile(complement(g6, 1 - p)) " << quantile(complement(g6, 0.01)) << endl; // 24.26 +/*` +Note too that Boost.Math geometric distribution is implemented as a continuous function. +Unlike other implementations (for example R) it *uses* the number of failures as a *real* parameter, +not as an integer. If you want this integer behaviour, you may need to enforce this by +rounding the parameter you pass, probably rounding down, to the nearest integer. +For example, R returns the success fraction probability for all values of failures +from 0 to 0.999999 thus: +[pre +__spaces R> formatC(pgeom(0.0001,0.5, FALSE), digits=17) " 0.5" +] [/pre] +So in Boost.Math the equivalent is +*/ + geometric g05(0.5); // Probability of success = 0.5 or 50% + // Output all potentially significant digits for the type, here double. + +#ifdef BOOST_NO_CXX11_NUMERIC_LIMITS + int max_digits10 = 2 + (boost::math::policies::digits >() * 30103UL) / 100000UL; + cout << "BOOST_NO_CXX11_NUMERIC_LIMITS is defined" << endl; +#else + int max_digits10 = std::numeric_limits::max_digits10; +#endif + cout << "Show all potentially significant decimal digits std::numeric_limits::max_digits10 = " + << max_digits10 << endl; + cout.precision(max_digits10); // + + cout << cdf(g05, 0.0001) << endl; // returns 0.5000346561579232, not exact 0.5. +/*`To get the R discrete behaviour, you simply need to round with, +for example, the `floor` function. +*/ + cout << cdf(g05, floor(0.0001)) << endl; // returns exactly 0.5 +/*` +[pre +`> formatC(pgeom(0.9999999,0.5, FALSE), digits=17) [1] " 0.25"` +`> formatC(pgeom(1.999999,0.5, FALSE), digits=17)[1] " 0.25" k = 1` +`> formatC(pgeom(1.9999999,0.5, FALSE), digits=17)[1] "0.12500000000000003" k = 2` +] [/pre] +shows that R makes an arbitrary round-up decision at about 1e7 from the next integer above. +This may be convenient in practice, and could be replicated in C++ if desired. + +[h6 Surveying customers to find one with a faulty product] +A company knows from warranty claims that 2% of their products will be faulty, +so the 'success_fraction' of finding a fault is 0.02. +It wants to interview a purchaser of faulty products to assess their 'user experience'. + +To estimate how many customers they will probably need to contact +in order to find one who has suffered from the fault, +we first construct a geometric distribution with probability 0.02, +and then chose a confidence, say 80%, 95%, or 99% to finding a customer with a fault. +Finally, we probably want to round up the result to the integer above using the `ceil` function. +(We could also use a policy, but that is hardly worthwhile for this simple application.) + +(This also assumes that each customer only buys one product: +if customers bought more than one item, +the probability of finding a customer with a fault obviously improves.) +*/ + cout.precision(5); + geometric g(0.02); // On average, 2 in 100 products are faulty. + double c = 0.95; // 95% confidence. + cout << " quantile(g, " << c << ") = " << quantile(g, c) << endl; + + cout << "To be " << c * 100 + << "% confident of finding we customer with a fault, need to survey " + << ceil(quantile(g, c)) << " customers." << endl; // 148 + c = 0.99; // Very confident. + cout << "To be " << c * 100 + << "% confident of finding we customer with a fault, need to survey " + << ceil(quantile(g, c)) << " customers." << endl; // 227 + c = 0.80; // Only reasonably confident. + cout << "To be " << c * 100 + << "% confident of finding we customer with a fault, need to survey " + << ceil(quantile(g, c)) << " customers." << endl; // 79 + +/*`[h6 Basket Ball Shooters] +According to Wikipedia, average pro basket ball players get +[@http://en.wikipedia.org/wiki/Free_throw free throws] +in the baskets 70 to 80 % of the time, +but some get as high as 95%, and others as low as 50%. +Suppose we want to compare the probabilities +of failing to get a score only on the first or on the fifth shot? +To start we will consider the average shooter, say 75%. +So we construct a geometric distribution +with success_fraction parameter 75/100 = 0.75. +*/ + cout.precision(2); + geometric gav(0.75); // Shooter averages 7.5 out of 10 in the basket. +/*`What is probability of getting 1st try in the basket, that is with no failures? */ + cout << "Probability of score on 1st try = " << pdf(gav, 0) << endl; // 0.75 +/*`This is, of course, the success_fraction probability 75%. +What is the probability that the shooter only scores on the fifth shot? +So there are 5-1 = 4 failures before the first success.*/ + cout << "Probability of score on 5th try = " << pdf(gav, 4) << endl; // 0.0029 +/*`Now compare this with the poor and the best players success fraction. +We need to constructing new distributions with the different success fractions, +and then get the corresponding probability density functions values: +*/ + geometric gbest(0.95); + cout << "Probability of score on 5th try = " << pdf(gbest, 4) << endl; // 5.9e-6 + geometric gmediocre(0.50); + cout << "Probability of score on 5th try = " << pdf(gmediocre, 4) << endl; // 0.031 +/*`So we can see the very much smaller chance (0.000006) of 4 failures by the best shooters, +compared to the 0.03 of the mediocre.*/ + +/*`[h6 Estimating failures] +Of course one man's failure is an other man's success. +So a fault can be defined as a 'success'. + +If a fault occurs once after 100 flights, then one might naively say +that the risk of fault is obviously 1 in 100 = 1/100, a probability of 0.01. + +This is the best estimate we can make, but while it is the truth, +it is not the whole truth, +for it hides the big uncertainty when estimating from a single event. +"One swallow doesn't make a summer." +To show the magnitude of the uncertainty, the geometric +(or the negative binomial) distribution can be used. + +If we chose the popular 95% confidence in the limits, corresponding to an alpha of 0.05, +because we are calculating a two-sided interval, we must divide alpha by two. +*/ + double alpha = 0.05; + double k = 100; // So frequency of occurrence is 1/100. + cout << "Probability is failure is " << 1/k << endl; + double t = geometric::find_lower_bound_on_p(k, alpha/2); + cout << "geometric::find_lower_bound_on_p(" << int(k) << ", " << alpha/2 << ") = " + << t << endl; // 0.00025 + t = geometric::find_upper_bound_on_p(k, alpha/2); + cout << "geometric::find_upper_bound_on_p(" << int(k) << ", " << alpha/2 << ") = " + << t << endl; // 0.037 +/*`So while we estimate the probability is 0.01, it might lie between 0.0003 and 0.04. +Even if we relax our confidence to alpha = 90%, the bounds only contract to 0.0005 and 0.03. +And if we require a high confidence, they widen to 0.00005 to 0.05. +*/ + alpha = 0.1; // 90% confidence. + t = geometric::find_lower_bound_on_p(k, alpha/2); + cout << "geometric::find_lower_bound_on_p(" << int(k) << ", " << alpha/2 << ") = " + << t << endl; // 0.0005 + t = geometric::find_upper_bound_on_p(k, alpha/2); + cout << "geometric::find_upper_bound_on_p(" << int(k) << ", " << alpha/2 << ") = " + << t << endl; // 0.03 + + alpha = 0.01; // 99% confidence. + t = geometric::find_lower_bound_on_p(k, alpha/2); + cout << "geometric::find_lower_bound_on_p(" << int(k) << ", " << alpha/2 << ") = " + << t << endl; // 5e-005 + t = geometric::find_upper_bound_on_p(k, alpha/2); + cout << "geometric::find_upper_bound_on_p(" << int(k) << ", " << alpha/2 << ") = " + << t << endl; // 0.052 +/*`In real life, there will usually be more than one event (fault or success), +when the negative binomial, which has the neccessary extra parameter, will be needed. +*/ + +/*`As noted above, using a catch block is always a good idea, +even if you hope not to use it! +*/ + } + catch(const std::exception& e) + { // Since we have set an overflow policy of ignore_error, + // an overflow exception should never be thrown. + std::cout << "\nMessage from thrown exception was:\n " << e.what() << std::endl; +/*` +For example, without a ignore domain error policy, +if we asked for ``pdf(g, -1)`` for example, +we would get an unhelpful abort, but with a catch: +[pre +Message from thrown exception was: + Error in function boost::math::pdf(const exponential_distribution&, double): + Number of failures argument is -1, but must be >= 0 ! +] [/pre] +*/ +//] [/ geometric_eg1_2] + } + return 0; +} // int main() + + +/* +Output is: + + Geometric distribution example + + success fraction of a six-sided dice is 0.1667 + 0.1667 + 0.1667 + 0.1389 + pdf(g6, 0) + pdf(g6, 1) = 0.3056 + cdf(g6, 1) = 0.3056 + cdf(g6, 12) = 0.9065 + quantile(g6, 0.99) = 24.26 + 0.1389 + 0.3056 + quantile(complement(g6, 1 - p)) 24.26 + 0.5000346561579232 + 0.5 + quantile(g, 0.95) = 147.28 + To be 95% confident of finding we customer with a fault, need to survey 148 customers. + To be 99% confident of finding we customer with a fault, need to survey 227 customers. + To be 80% confident of finding we customer with a fault, need to survey 79 customers. + Probability of score on 1st try = 0.75 + Probability of score on 5th try = 0.0029 + Probability of score on 5th try = 5.9e-006 + Probability of score on 5th try = 0.031 + Probability is failure is 0.01 + geometric::find_lower_bound_on_p(100, 0.025) = 0.00025 + geometric::find_upper_bound_on_p(100, 0.025) = 0.037 + geometric::find_lower_bound_on_p(100, 0.05) = 0.00051 + geometric::find_upper_bound_on_p(100, 0.05) = 0.03 + geometric::find_lower_bound_on_p(100, 0.005) = 5e-005 + geometric::find_upper_bound_on_p(100, 0.005) = 0.052 + +*/ + + + + + + + + + + diff --git a/src/boost/libs/math/example/handle_test_result.hpp b/src/boost/libs/math/example/handle_test_result.hpp new file mode 100644 index 00000000..cb1432a5 --- /dev/null +++ b/src/boost/libs/math/example/handle_test_result.hpp @@ -0,0 +1,220 @@ +// (C) Copyright John Maddock 2006-7. +// 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) + +#ifndef BOOST_MATH_HANDLE_TEST_RESULT +#define BOOST_MATH_HANDLE_TEST_RESULT + +#include +#include +#include +#include +#include +#include +#include + +#if defined(BOOST_INTEL) +# pragma warning(disable:239) +# pragma warning(disable:264) +#endif + +// +// Every client of this header has to define this function, +// and initialise the table of expected results: +// +void expected_results(); + +typedef std::pair > expected_data_type; +typedef std::list list_type; + +inline list_type& + get_expected_data() +{ + static list_type data; + return data; +} + +inline void add_expected_result( + const char* compiler, + const char* library, + const char* platform, + const char* type_name, + const char* test_name, + const char* group_name, + boost::uintmax_t max_peek_error, + boost::uintmax_t max_mean_error) +{ + std::string re("(?:"); + re += compiler; + re += ")"; + re += "\\|"; + re += "(?:"; + re += library; + re += ")"; + re += "\\|"; + re += "(?:"; + re += platform; + re += ")"; + re += "\\|"; + re += "(?:"; + re += type_name; + re += ")"; + re += "\\|"; + re += "(?:"; + re += test_name; + re += ")"; + re += "\\|"; + re += "(?:"; + re += group_name; + re += ")"; + get_expected_data().push_back( + std::make_pair(boost::regex(re, boost::regex::perl | boost::regex::icase), + std::make_pair(max_peek_error, max_mean_error))); +} + +inline std::string build_test_name(const char* type_name, const char* test_name, const char* group_name) +{ + std::string result(BOOST_COMPILER); + result += "|"; + result += BOOST_STDLIB; + result += "|"; + result += BOOST_PLATFORM; + result += "|"; + result += type_name; + result += "|"; + result += group_name; + result += "|"; + result += test_name; + return result; +} + +inline const std::pair& + get_max_errors(const char* type_name, const char* test_name, const char* group_name) +{ + static const std::pair defaults(1, 1); + std::string name = build_test_name(type_name, test_name, group_name); + list_type& l = get_expected_data(); + list_type::const_iterator a(l.begin()), b(l.end()); + while(a != b) + { + if(regex_match(name, a->first)) + { +#if 0 + std::cout << name << std::endl; + std::cout << a->first.str() << std::endl; +#endif + return a->second; + } + ++a; + } + return defaults; +} + +template +void handle_test_result(const boost::math::tools::test_result& result, + const Seq& worst, int row, + const char* type_name, + const char* test_name, + const char* group_name) +{ +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4127) +#endif + using namespace std; // To aid selection of the right pow. + T eps = boost::math::tools::epsilon(); + std::cout << std::setprecision(4); + + T max_error_found = (result.max)()/eps; + T mean_error_found = result.rms()/eps; + // + // Begin by printing the main tag line with the results: + // + std::cout << test_name << "<" << type_name << "> Max = " << max_error_found + << " RMS Mean=" << mean_error_found; + // + // If the max error is non-zero, give the row of the table that + // produced the worst error: + // + if((result.max)() != 0) + { + std::cout << "\n worst case at row: " + << row << "\n { "; + if(std::numeric_limits::digits10) + { + std::cout << std::setprecision(std::numeric_limits::digits10 + 2); + } + else + { + std::cout << std::setprecision(std::numeric_limits::digits10 + 2); + } + for(unsigned i = 0; i < worst.size(); ++i) + { + if(i) + std::cout << ", "; +#if defined(__SGI_STL_PORT) + std::cout << boost::math::tools::real_cast(worst[i]); +#else + std::cout << worst[i]; +#endif + } + std::cout << " }"; + } + std::cout << std::endl; + // + // Now verify that the results are within our expected bounds: + // + std::pair const& bounds = get_max_errors(type_name, test_name, group_name); + if(bounds.first < max_error_found) + { + std::cerr << "Peak error greater than expected value of " << bounds.first << std::endl; + BOOST_CHECK(bounds.first >= max_error_found); + } + if(bounds.second < mean_error_found) + { + std::cerr << "Mean error greater than expected value of " << bounds.second << std::endl; + BOOST_CHECK(bounds.second >= mean_error_found); + } + std::cout << std::endl; +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif +} + +template +void print_test_result(const boost::math::tools::test_result& result, + const Seq& worst, int row, const char* name, const char* test) +{ + using namespace std; // To aid selection of the right pow. + T eps = boost::math::tools::epsilon(); + std::cout << std::setprecision(4); + + T max_error_found = (result.max)()/eps; + T mean_error_found = result.rms()/eps; + // + // Begin by printing the main tag line with the results: + // + std::cout << test << "(" << name << ") Max = " << max_error_found + << " RMS Mean=" << mean_error_found; + // + // If the max error is non-zero, give the row of the table that + // produced the worst error: + // + if((result.max)() != 0) + { + std::cout << "\n worst case at row: " + << row << "\n { "; + for(unsigned i = 0; i < worst.size(); ++i) + { + if(i) + std::cout << ", "; + std::cout << worst[i]; + } + std::cout << " }"; + } + std::cout << std::endl; +} + +#endif // BOOST_MATH_HANDLE_TEST_RESULT + diff --git a/src/boost/libs/math/example/hyperexponential_more_snips.cpp b/src/boost/libs/math/example/hyperexponential_more_snips.cpp new file mode 100644 index 00000000..ba9d5010 --- /dev/null +++ b/src/boost/libs/math/example/hyperexponential_more_snips.cpp @@ -0,0 +1,155 @@ +// Copyright 2014 Marco Guazzone (marco.guazzone@gmail.com). + +// 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) + +// Caution: this file contains Quickbook markup as well as code +// and comments, don't change any of the special comment markups! + + +//[hyperexponential_more_snip1 +#include +#include +#include + +struct ds_info +{ + std::string name; + double iat_sample_mean; + double iat_sample_sd; + boost::math::hyperexponential iat_he; + double multi_lt_sample_mean; + double multi_lt_sample_sd; + boost::math::hyperexponential multi_lt_he; + double single_lt_sample_mean; + double single_lt_sample_sd; + boost::math::hyperexponential single_lt_he; +}; + +// DS1 dataset +ds_info make_ds1() +{ + ds_info ds; + + ds.name = "DS1"; + + // VM interarrival time distribution + const double iat_fit_probs[] = { 0.34561,0.08648,0.56791 }; + const double iat_fit_rates[] = { 0.0008,0.00005,0.02894 }; + ds.iat_sample_mean = 2202.1; + ds.iat_sample_sd = 2.2e+4; + ds.iat_he = boost::math::hyperexponential(iat_fit_probs, iat_fit_rates); + + // Multi-core VM lifetime distribution + const double multi_lt_fit_probs[] = { 0.24667,0.37948,0.37385 }; + const double multi_lt_fit_rates[] = { 0.00004,0.000002,0.00059 }; + ds.multi_lt_sample_mean = 257173; + ds.multi_lt_sample_sd = 4.6e+5; + ds.multi_lt_he = boost::math::hyperexponential(multi_lt_fit_probs, multi_lt_fit_rates); + + // Single-core VM lifetime distribution + const double single_lt_fit_probs[] = { 0.09325,0.22251,0.68424 }; + const double single_lt_fit_rates[] = { 0.000003,0.00109,0.00109 }; + ds.single_lt_sample_mean = 28754.4; + ds.single_lt_sample_sd = 1.6e+5; + ds.single_lt_he = boost::math::hyperexponential(single_lt_fit_probs, single_lt_fit_rates); + + return ds; +} + +// DS2 dataset +ds_info make_ds2() +{ + ds_info ds; + + ds.name = "DS2"; + + // VM interarrival time distribution + const double iat_fit_probs[] = { 0.38881,0.18227,0.42892 }; + const double iat_fit_rates[] = { 0.000006,0.05228,0.00081 }; + ds.iat_sample_mean = 41285.7; + ds.iat_sample_sd = 1.1e+05; + ds.iat_he = boost::math::hyperexponential(iat_fit_probs, iat_fit_rates); + + // Multi-core VM lifetime distribution + const double multi_lt_fit_probs[] = { 0.42093,0.43960,0.13947 }; + const double multi_lt_fit_rates[] = { 0.00186,0.00008,0.0000008 }; + ds.multi_lt_sample_mean = 144669.0; + ds.multi_lt_sample_sd = 7.9e+05; + ds.multi_lt_he = boost::math::hyperexponential(multi_lt_fit_probs, multi_lt_fit_rates); + + // Single-core VM lifetime distribution + const double single_lt_fit_probs[] = { 0.44885,0.30675,0.2444 }; + const double single_lt_fit_rates[] = { 0.00143,0.00005,0.0000004 }; + ds.single_lt_sample_mean = 599815.0; + ds.single_lt_sample_sd = 1.7e+06; + ds.single_lt_he = boost::math::hyperexponential(single_lt_fit_probs, single_lt_fit_rates); + + return ds; +} + +// DS3 dataset +ds_info make_ds3() +{ + ds_info ds; + + ds.name = "DS3"; + + // VM interarrival time distribution + const double iat_fit_probs[] = { 0.39442,0.24644,0.35914 }; + const double iat_fit_rates[] = { 0.00030,0.00003,0.00257 }; + ds.iat_sample_mean = 11238.8; + ds.iat_sample_sd = 3.0e+04; + ds.iat_he = boost::math::hyperexponential(iat_fit_probs, iat_fit_rates); + + // Multi-core VM lifetime distribution + const double multi_lt_fit_probs[] = { 0.37621,0.14838,0.47541 }; + const double multi_lt_fit_rates[] = { 0.00498,0.000005,0.00022 }; + ds.multi_lt_sample_mean = 30739.2; + ds.multi_lt_sample_sd = 1.6e+05; + ds.multi_lt_he = boost::math::hyperexponential(multi_lt_fit_probs, multi_lt_fit_rates); + + // Single-core VM lifetime distribution + const double single_lt_fit_probs[] = { 0.34131,0.12544,0.53325 }; + const double single_lt_fit_rates[] = { 0.000297,0.000003,0.00410 }; + ds.single_lt_sample_mean = 44447.8; + ds.single_lt_sample_sd = 2.2e+05; + ds.single_lt_he = boost::math::hyperexponential(single_lt_fit_probs, single_lt_fit_rates); + + return ds; +} + +void print_fitted(ds_info const& ds) +{ + const double secs_in_a_hour = 3600; + const double secs_in_a_month = 30 * 24 * secs_in_a_hour; + + std::cout << "### " << ds.name << std::endl; + std::cout << "* Fitted Request Interarrival Time" << std::endl; + std::cout << " - Mean (SD): " << boost::math::mean(ds.iat_he) << " (" << boost::math::standard_deviation(ds.iat_he) << ") seconds." << std::endl; + std::cout << " - 99th Percentile: " << boost::math::quantile(ds.iat_he, 0.99) << " seconds." << std::endl; + std::cout << " - Probability that a VM will arrive within 30 minutes: " << boost::math::cdf(ds.iat_he, secs_in_a_hour / 2.0) << std::endl; + std::cout << " - Probability that a VM will arrive after 1 hour: " << boost::math::cdf(boost::math::complement(ds.iat_he, secs_in_a_hour)) << std::endl; + std::cout << "* Fitted Multi-core VM Lifetime" << std::endl; + std::cout << " - Mean (SD): " << boost::math::mean(ds.multi_lt_he) << " (" << boost::math::standard_deviation(ds.multi_lt_he) << ") seconds." << std::endl; + std::cout << " - 99th Percentile: " << boost::math::quantile(ds.multi_lt_he, 0.99) << " seconds." << std::endl; + std::cout << " - Probability that a VM will last for less than 1 month: " << boost::math::cdf(ds.multi_lt_he, secs_in_a_month) << std::endl; + std::cout << " - Probability that a VM will last for more than 3 months: " << boost::math::cdf(boost::math::complement(ds.multi_lt_he, 3.0*secs_in_a_month)) << std::endl; + std::cout << "* Fitted Single-core VM Lifetime" << std::endl; + std::cout << " - Mean (SD): " << boost::math::mean(ds.single_lt_he) << " (" << boost::math::standard_deviation(ds.single_lt_he) << ") seconds." << std::endl; + std::cout << " - 99th Percentile: " << boost::math::quantile(ds.single_lt_he, 0.99) << " seconds." << std::endl; + std::cout << " - Probability that a VM will last for less than 1 month: " << boost::math::cdf(ds.single_lt_he, secs_in_a_month) << std::endl; + std::cout << " - Probability that a VM will last for more than 3 months: " << boost::math::cdf(boost::math::complement(ds.single_lt_he, 3.0*secs_in_a_month)) << std::endl; +} + +int main() +{ + print_fitted(make_ds1()); + + print_fitted(make_ds2()); + + print_fitted(make_ds3()); +} +//] diff --git a/src/boost/libs/math/example/hyperexponential_snips.cpp b/src/boost/libs/math/example/hyperexponential_snips.cpp new file mode 100644 index 00000000..785e500d --- /dev/null +++ b/src/boost/libs/math/example/hyperexponential_snips.cpp @@ -0,0 +1,103 @@ +// Copyright John Maddock 2014. + +// 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) + +// Caution: this file contains Quickbook markup as well as code +// and comments, don't change any of the special comment markups! + +#ifdef _MSC_VER +# pragma warning (disable : 4996) // disable -D_SCL_SECURE_NO_WARNINGS C++ 'Checked Iterators' +#endif + +#include +#include + +#ifndef BOOST_NO_CXX11_HDR_ARRAY +#include +#endif + +int main() +{ + { +//[hyperexponential_snip1 +//=#include +//=#include +//=int main() +//={ + const double rates[] = { 1.0 / 10.0, 1.0 / 12.0 }; + + boost::math::hyperexponential he(rates); + + std::cout << "Average lifetime: " + << boost::math::mean(he) + << " years" << std::endl; + std::cout << "Probability that the appliance will work for more than 15 years: " + << boost::math::cdf(boost::math::complement(he, 15.0)) + << std::endl; +//=} +//] + } + using namespace boost::math; +#ifndef BOOST_NO_CXX11_HDR_ARRAY + { + //[hyperexponential_snip2 + std::array phase_prob = { 0.5, 0.5 }; + std::array rates = { 1.0 / 10, 1.0 / 12 }; + + hyperexponential he(phase_prob.begin(), phase_prob.end(), rates.begin(), rates.end()); + //] + } + + { + //[hyperexponential_snip3 + // We could be using any standard library container here... vector, deque, array, list etc: + std::array phase_prob = { 0.5, 0.5 }; + std::array rates = { 1.0 / 10, 1.0 / 12 }; + + hyperexponential he1(phase_prob, rates); // Construct from standard library container. + + double phase_probs2[] = { 0.5, 0.5 }; + double rates2[] = { 1.0 / 10, 1.0 / 12 }; + + hyperexponential he2(phase_probs2, rates2); // Construct from native C++ array. + //] + } + { + //[hyperexponential_snip4 + // We could be using any standard library container here... vector, deque, array, list etc: + std::array rates = { 1.0 / 10, 1.0 / 12 }; + + hyperexponential he(rates.begin(), rates.end()); + + BOOST_ASSERT(he.probabilities()[0] == 0.5); // Phase probabilities will be equal and normalised to unity. + //] + } + { + //[hyperexponential_snip5 + std::array rates = { 1.0 / 10, 1.0 / 12 }; + + hyperexponential he(rates); + + BOOST_ASSERT(he.probabilities()[0] == 0.5); // Phase probabilities will be equal and normalised to unity. + //] + } +#endif +#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) && !(defined(BOOST_GCC_VERSION) && (BOOST_GCC_VERSION < 40500)) + { + //[hyperexponential_snip6 + hyperexponential he = { { 0.5, 0.5 }, { 1.0 / 10, 1.0 / 12 } }; + //] + } + { + //[hyperexponential_snip7 + hyperexponential he = { 1.0 / 10, 1.0 / 12 }; + + BOOST_ASSERT(he.probabilities()[0] == 0.5); + //] + } +#endif + return 0; +} diff --git a/src/boost/libs/math/example/inspect_fp.cpp b/src/boost/libs/math/example/inspect_fp.cpp new file mode 100644 index 00000000..0838b8dd --- /dev/null +++ b/src/boost/libs/math/example/inspect_fp.cpp @@ -0,0 +1,224 @@ +// inspect.cpp + +// Copyright (c) 2006 Johan Rade + +// Distributed under 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 + +//------------------------------------------------------------------------------ + +bool is_big_endian() +{ + float x = 1.0f; + unsigned char first_byte; + memcpy(&first_byte, &x, 1); + return first_byte != 0; +} + +//------------------------------------------------------------------------------ + +void print_processor(); +void print_endianness(); +template void print_table(); +template void print_row(const char* name, T val, bool ok = true); + +//------------------------------------------------------------------------------ + +int main() +{ + std::cout << '\n'; + + print_processor(); + + print_endianness(); + + std::cout << "---------- float --------------------\n\n"; + print_table(); + + std::cout << "---------- double -------------------\n\n"; + print_table(); + + std::cout << "---------- long double --------------\n\n"; + print_table(); + + return 0; +} + +//------------------------------------------------------------------------------ + +void print_processor() +{ +#if defined(__i386) || defined(__i386__) || defined(_M_IX86) \ + || defined(__amd64) || defined(__amd64__) || defined(_M_AMD64) \ + || defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) + + std::cout << "Processor: x86 or x64\n\n"; + +#elif defined(__ia64) || defined(__ia64__) || defined(_M_IA64) + + std::cout << "Processor: ia64\n\n"; + +#elif defined(__powerpc) || defined(__powerpc__) || defined(__POWERPC__) \ + || defined(__ppc) || defined(__ppc__) || defined(__PPC__) + + std::cout << "Processor: PowerPC\n\n"; + +#elif defined(__m68k) || defined(__m68k__) \ + || defined(__mc68000) || defined(__mc68000__) \ + + std::cout << "Processor: Motorola 68K\n\n"; + +#else + + std::cout << "Processor: Unknown\n\n"; + +#endif +} + +void print_endianness() +{ + if(is_big_endian()) + std::cout << "This platform is big-endian.\n"; + else + std::cout << "This platform is little-endian.\n"; + +#ifdef BOOST_BIG_ENDIAN + std::cout << "BOOST_BIG_ENDIAN is defined.\n\n"; +#endif +#if defined BOOST_LITTLE_ENDIAN + std::cout << "BOOST_LITTTLE_ENDIAN is defined.\n\n"; +#endif +} + +//.............................................................................. + +template void print_table() +{ + print_row("0", (T)0); + print_row("sn.min", std::numeric_limits::denorm_min(), + std::numeric_limits::has_denorm); + print_row("-sn.min", -std::numeric_limits::denorm_min(), + std::numeric_limits::has_denorm); + print_row("n.min/256", (std::numeric_limits::min)()/256); + print_row("n.min/2", (std::numeric_limits::min)()/2); + print_row("-n.min/2", -(std::numeric_limits::min)()/2); + print_row("n.min", (std::numeric_limits::min)()); + print_row("1", (T)1); + print_row("3/4", (T)3/(T)4); + print_row("4/3", (T)4/(T)3); + print_row("max", (std::numeric_limits::max)()); + print_row("inf", std::numeric_limits::infinity(), + std::numeric_limits::has_infinity); + print_row("q.nan", std::numeric_limits::quiet_NaN(), + std::numeric_limits::has_quiet_NaN); + print_row("s.nan", std::numeric_limits::signaling_NaN(), + std::numeric_limits::has_signaling_NaN); + + std::cout << "\n\n"; +} + +template +void print_row(const char* name, T val, bool ok) +{ + std::cout << std::left << std::setw(10) << name << std::right; + + std::cout << std::hex << std::setfill('0'); + + if(ok) { + if(is_big_endian()) { + for(size_t i = 0; i < sizeof(T); ++i) { + unsigned char c = *(reinterpret_cast(&val) + i); + std::cout << std::setw(2) + << static_cast(c) << ' '; + } + } + else { + for(size_t i = sizeof(T) - 1; i < sizeof(T); --i) { + unsigned char c = *(reinterpret_cast(&val) + i); + std::cout << std::setw(2) + << static_cast(c) << ' '; + } + } + } + else { + for(size_t i = 0; i < sizeof(T); ++i) + std::cout << "-- "; + } + + std::cout << '\n'; + std::cout << std::dec << std::setfill(' '); +} + +/* + +Sample output on an AMD Quadcore running MSVC 10 + + Processor: x86 or x64 + + This platform is little-endian. + BOOST_LITTTLE_ENDIAN is defined. + + ---------- float -------------------- + + 0 00 00 00 00 + sn.min 00 00 00 01 + -sn.min 80 00 00 01 + n.min/256 00 00 80 00 + n.min/2 00 40 00 00 + -n.min/2 80 40 00 00 + n.min 00 80 00 00 + 1 3f 80 00 00 + 3/4 3f 40 00 00 + 4/3 3f aa aa ab + max 7f 7f ff ff + inf 7f 80 00 00 + q.nan 7f c0 00 00 + s.nan 7f c0 00 01 + + + ---------- double ------------------- + + 0 00 00 00 00 00 00 00 00 + sn.min 00 00 00 00 00 00 00 01 + -sn.min 80 00 00 00 00 00 00 01 + n.min/256 00 00 10 00 00 00 00 00 + n.min/2 00 08 00 00 00 00 00 00 + -n.min/2 80 08 00 00 00 00 00 00 + n.min 00 10 00 00 00 00 00 00 + 1 3f f0 00 00 00 00 00 00 + 3/4 3f e8 00 00 00 00 00 00 + 4/3 3f f5 55 55 55 55 55 55 + max 7f ef ff ff ff ff ff ff + inf 7f f0 00 00 00 00 00 00 + q.nan 7f f8 00 00 00 00 00 00 + s.nan 7f f8 00 00 00 00 00 01 + + + ---------- long double -------------- + + 0 00 00 00 00 00 00 00 00 + sn.min 00 00 00 00 00 00 00 01 + -sn.min 80 00 00 00 00 00 00 01 + n.min/256 00 00 10 00 00 00 00 00 + n.min/2 00 08 00 00 00 00 00 00 + -n.min/2 80 08 00 00 00 00 00 00 + n.min 00 10 00 00 00 00 00 00 + 1 3f f0 00 00 00 00 00 00 + 3/4 3f e8 00 00 00 00 00 00 + 4/3 3f f5 55 55 55 55 55 55 + max 7f ef ff ff ff ff ff ff + inf 7f f0 00 00 00 00 00 00 + q.nan 7f f8 00 00 00 00 00 00 + s.nan 7f f8 00 00 00 00 00 01 + + */ diff --git a/src/boost/libs/math/example/inverse_chi_squared_bayes_eg.cpp b/src/boost/libs/math/example/inverse_chi_squared_bayes_eg.cpp new file mode 100644 index 00000000..6323d0ee --- /dev/null +++ b/src/boost/libs/math/example/inverse_chi_squared_bayes_eg.cpp @@ -0,0 +1,338 @@ +// inverse_chi_squared_bayes_eg.cpp + +// Copyright Thomas Mang 2011. +// Copyright Paul A. Bristow 2011. + +// 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) + +// This file is written to be included from a Quickbook .qbk document. +// It can still be compiled by the C++ compiler, and run. +// Any output can also be added here as comment or included or pasted in elsewhere. +// Caution: this file contains Quickbook markup as well as code +// and comments: don't change any of the special comment markups! + +#include +// using std::cout; using std::endl; + +//#define define possible error-handling macros here? + +#include "boost/math/distributions.hpp" +// using ::boost::math::inverse_chi_squared; + +int main() +{ + using std::cout; using std::endl; + + using ::boost::math::inverse_chi_squared; + using ::boost::math::inverse_gamma; + using ::boost::math::quantile; + using ::boost::math::cdf; + + cout << "Inverse_chi_squared_distribution Bayes example: " << endl < 50. +For this task, we use calls to the `boost::math::` functions `cdf` and `complement`, +respectively, and find a probability of about 0.031 (3.1%) for each case. +*/ + + cout << " probability variance <= 15: " << boost::math::cdf(prior, 15.0) << endl; + cout << " probability variance <= 25: " << boost::math::cdf(prior, 25.0) << endl; + cout << " probability variance > 50: " + << boost::math::cdf(boost::math::complement(prior, 50.0)) + << endl << endl; + //] [/inverse_chi_squared_bayes_eg_2] + +//[inverse_chi_squared_bayes_eg_output_2 +/*`This produces this output: + + probability variance <= 15: 0.031 + probability variance <= 25: 0.458 + probability variance > 50: 0.0318 + +*/ +//] [/inverse_chi_squared_bayes_eg_output_2] + +//[inverse_chi_squared_bayes_eg_3 +/*`Therefore, only 3.1% of all precision machines produce balls with a variance of 15 or less +(particularly precise machines), +but also only 3.2% of all machines produce balls +with a variance of as high as 50 or more (particularly imprecise machines). Moreover, slightly more than +one-half (1 - 0.458 = 54.2%) of the machines work at a variance greater than 25. + +Notice here the distinction between a +[@http://en.wikipedia.org/wiki/Bayesian_inference Bayesian] analysis and a +[@http://en.wikipedia.org/wiki/Frequentist_inference frequentist] analysis: +because we model the variance as random variable itself, +we can calculate and straightforwardly interpret probabilities for given parameter values directly, +while such an approach is not possible (and interpretationally a strict ['must-not]) in the frequentist +world. + +[h5 Step 2: Investigate a single machine] + +In the second step, we investigate a single machine, +which is suspected to suffer from a major fault +as the produced balls show fairly high size variability. +Based on the prior distribution of generic machinery performance (derived above) +and data on balls produced by the suspect machine, we calculate the posterior distribution for that +machine and use its properties for guidance regarding continued machine operation or suspension. + +It can be shown that if the prior distribution +was chosen to be scaled-inverse-chi-square distributed, +then the posterior distribution is also scaled-inverse-chi-squared-distributed +(prior and posterior distributions are hence conjugate). +For more details regarding conjugacy and formula to derive the parameters set +for the posterior distribution see +[@http://en.wikipedia.org/wiki/Conjugate_prior Conjugate prior]. + + +Given the prior distribution parameters and sample data (of size n), the posterior distribution parameters +are given by the two expressions: + +__spaces [nu][sub posterior] = [nu][sub prior] + n + +which gives the posteriorDF below, and + +__spaces s[sub posterior] = ([nu][sub prior]s[sub prior] + [Sigma][super n][sub i=1](x[sub i] - [mu])[super 2]) / ([nu][sub prior] + n) + +which after some rearrangement gives the formula for the posteriorScale below. + +Machine-specific data consist of 100 balls which were accurately measured +and show the expected mean of 3000 [mu]m and a sample variance of 55 (calculated for a sample mean defined to be 3000 exactly). +From these data, the prior parameterization, and noting that the term +[Sigma][super n][sub i=1](x[sub i] - [mu])[super 2] equals the sample variance multiplied by n - 1, +it follows that the posterior distribution of the variance parameter +is scaled-inverse-chi-squared distribution with degrees-of-freedom ([nu][sub posterior]) = 120 and +scale (s[sub posterior]) = 49.54. +*/ + + int ballsSampleSize = 100; + cout <<"balls sample size: " << ballsSampleSize << endl; + double ballsSampleVariance = 55.0; + cout <<"balls sample variance: " << ballsSampleVariance << endl; + + double posteriorDF = priorDF + ballsSampleSize; + cout << "prior degrees-of-freedom: " << priorDF << endl; + cout << "posterior degrees-of-freedom: " << posteriorDF << endl; + + double posteriorScale = + (priorDF * priorScale + (ballsSampleVariance * (ballsSampleSize - 1))) / posteriorDF; + cout << "prior scale: " << priorScale << endl; + cout << "posterior scale: " << posteriorScale << endl; + +/*`An interesting feature here is that one needs only to know a summary statistics of the sample +to parameterize the posterior distribution: the 100 individual ball measurements are irrelevant, +just knowledge of the sample variance and number of measurements is sufficient. +*/ + +//] [/inverse_chi_squared_bayes_eg_3] + +//[inverse_chi_squared_bayes_eg_output_3 +/*`That produces this output: + + + balls sample size: 100 + balls sample variance: 55 + prior degrees-of-freedom: 20 + posterior degrees-of-freedom: 120 + prior scale: 25 + posterior scale: 49.5 + + */ +//] [/inverse_chi_squared_bayes_eg_output_3] + +//[inverse_chi_squared_bayes_eg_4 +/*`To compare the generic machinery performance with our suspect machine, +we calculate again the same quantiles and probabilities as above, +and find a distribution clearly shifted to greater values (see figure). + +[graph prior_posterior_plot] + +*/ + + inverse_chi_squared posterior(posteriorDF, posteriorScale); + + cout << "Posterior distribution:" << endl << endl; + cout << " 2.5% quantile: " << boost::math::quantile(posterior, 0.025) << endl; + cout << " 50% quantile: " << boost::math::quantile(posterior, 0.5) << endl; + cout << " 97.5% quantile: " << boost::math::quantile(posterior, 0.975) << endl << endl; + + cout << " probability variance <= 15: " << boost::math::cdf(posterior, 15.0) << endl; + cout << " probability variance <= 25: " << boost::math::cdf(posterior, 25.0) << endl; + cout << " probability variance > 50: " + << boost::math::cdf(boost::math::complement(posterior, 50.0)) << endl; + +//] [/inverse_chi_squared_bayes_eg_4] + +//[inverse_chi_squared_bayes_eg_output_4 +/*`This produces this output: + + Posterior distribution: + + 2.5% quantile: 39.1 + 50% quantile: 49.8 + 97.5% quantile: 64.9 + + probability variance <= 15: 2.97e-031 + probability variance <= 25: 8.85e-010 + probability variance > 50: 0.489 + +*/ +//] [/inverse_chi_squared_bayes_eg_output_4] + +//[inverse_chi_squared_bayes_eg_5 +/*`Indeed, the probability that the machine works at a low variance (<= 15) is almost zero, +and even the probability of working at average or better performance is negligibly small +(less than one-millionth of a permille). +On the other hand, with an almost near-half probability (49%), the machine operates in the +extreme high variance range of > 50 characteristic for poorly performing machines. + +Based on this information the operation of the machine is taken out of use and serviced. + +In summary, the Bayesian analysis allowed us to make exact probabilistic statements about a +parameter of interest, and hence provided us results with straightforward interpretation. + +*/ +//] [/inverse_chi_squared_bayes_eg_5] + +} // int main() + +//[inverse_chi_squared_bayes_eg_output +/*` +[pre + Inverse_chi_squared_distribution Bayes example: + + Prior distribution: + + 2.5% quantile: 14.6 + 50% quantile: 25.9 + 97.5% quantile: 52.1 + + probability variance <= 15: 0.031 + probability variance <= 25: 0.458 + probability variance > 50: 0.0318 + + balls sample size: 100 + balls sample variance: 55 + prior degrees-of-freedom: 20 + posterior degrees-of-freedom: 120 + prior scale: 25 + posterior scale: 49.5 + Posterior distribution: + + 2.5% quantile: 39.1 + 50% quantile: 49.8 + 97.5% quantile: 64.9 + + probability variance <= 15: 2.97e-031 + probability variance <= 25: 8.85e-010 + probability variance > 50: 0.489 + +] [/pre] +*/ +//] [/inverse_chi_squared_bayes_eg_output] diff --git a/src/boost/libs/math/example/inverse_chi_squared_example.cpp b/src/boost/libs/math/example/inverse_chi_squared_example.cpp new file mode 100644 index 00000000..d21b0dc0 --- /dev/null +++ b/src/boost/libs/math/example/inverse_chi_squared_example.cpp @@ -0,0 +1,171 @@ +// inverse_chi_squared_distribution_example.cpp + +// Copyright Paul A. Bristow 2010. +// Copyright Thomas Mang 2010. + +// 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) + +// Example 1 of using inverse chi squared distribution +#include +using boost::math::inverse_chi_squared_distribution; // inverse_chi_squared_distribution. +using boost::math::inverse_chi_squared; //typedef for nverse_chi_squared_distribution double. + +#include +using std::cout; using std::endl; +#include +using std::setprecision; +using std::setw; +#include +using std::sqrt; + +template +RealType naive_pdf1(RealType df, RealType x) +{ // Formula from Wikipedia http://en.wikipedia.org/wiki/Inverse-chi-square_distribution + // definition 1 using tgamma for simplicity as a check. + using namespace std; // For ADL of std functions. + using boost::math::tgamma; + RealType df2 = df / 2; + RealType result = (pow(2., -df2) * pow(x, (-df2 -1)) * exp(-1/(2 * x) ) ) + / tgamma(df2); // + return result; +} + +template +RealType naive_pdf2(RealType df, RealType x) +{ // Formula from Wikipedia http://en.wikipedia.org/wiki/Inverse-chi-square_distribution + // Definition 2, using tgamma for simplicity as a check. + // Not scaled, so assumes scale = 1 and only uses nu aka df. + using namespace std; // For ADL of std functions. + using boost::math::tgamma; + RealType df2 = df / 2; + RealType result = (pow(df2, df2) * pow(x, (-df2 -1)) * exp(-df/(2*x) ) ) + / tgamma(df2); + return result; +} + +template +RealType naive_pdf3(RealType df, RealType scale, RealType x) +{ // Formula from Wikipedia http://en.wikipedia.org/wiki/Scaled-inverse-chi-square_distribution + // *Scaled* version, definition 3, df aka nu, scale aka sigma^2 + // using tgamma for simplicity as a check. + using namespace std; // For ADL of std functions. + using boost::math::tgamma; + RealType df2 = df / 2; + RealType result = (pow(scale * df2, df2) * exp(-df2 * scale/x) ) + / (tgamma(df2) * pow(x, 1+df2)); + return result; +} + +template +RealType naive_pdf4(RealType df, RealType scale, RealType x) +{ // Formula from http://mathworld.wolfram.com/InverseChi-SquaredDistribution.html + // Weisstein, Eric W. "Inverse Chi-Squared Distribution." From MathWorld--A Wolfram Web Resource. + // *Scaled* version, definition 3, df aka nu, scale aka sigma^2 + // using tgamma for simplicity as a check. + using namespace std; // For ADL of std functions. + using boost::math::tgamma; + RealType nu = df; // Wolfram uses greek symbols nu, + RealType xi = scale; // and xi. + RealType result = + pow(2, -nu/2) * exp(- (nu * xi)/(2 * x)) * pow(x, -1-nu/2) * pow((nu * xi), nu/2) + / tgamma(nu/2); + return result; +} + +int main() +{ + + cout << "Example (basic) using Inverse chi squared distribution. " << endl; + + // TODO find a more practical/useful example. Suggestions welcome? + +#ifdef BOOST_NO_CXX11_NUMERIC_LIMITS + int max_digits10 = 2 + (boost::math::policies::digits >() * 30103UL) / 100000UL; + cout << "BOOST_NO_CXX11_NUMERIC_LIMITS is defined" << endl; +#else + int max_digits10 = std::numeric_limits::max_digits10; +#endif + cout << "Show all potentially significant decimal digits std::numeric_limits::max_digits10 = " + << max_digits10 << endl; + cout.precision(max_digits10); // + + inverse_chi_squared ichsqdef; // All defaults - not very useful! + cout << "default df = " << ichsqdef.degrees_of_freedom() + << ", default scale = " << ichsqdef.scale() << endl; // default df = 1, default scale = 0.5 + + inverse_chi_squared ichsqdef4(4); // Unscaled version, default scale = 1 / degrees_of_freedom + cout << "default df = " << ichsqdef4.degrees_of_freedom() + << ", default scale = " << ichsqdef4.scale() << endl; // default df = 4, default scale = 2 + + inverse_chi_squared ichsqdef32(3, 2); // Scaled version, both degrees_of_freedom and scale specified. + cout << "default df = " << ichsqdef32.degrees_of_freedom() + << ", default scale = " << ichsqdef32.scale() << endl; // default df = 3, default scale = 2 + + { + cout.precision(3); + double nu = 5.; + //double scale1 = 1./ nu; // 1st definition sigma^2 = 1/df; + //double scale2 = 1.; // 2nd definition sigma^2 = 1 + inverse_chi_squared ichsq(nu, 1/nu); // Not scaled + inverse_chi_squared sichsq(nu, 1/nu); // scaled + + cout << "nu = " << ichsq.degrees_of_freedom() << ", scale = " << ichsq.scale() << endl; + + int width = 8; + + cout << " x pdf pdf1 pdf2 pdf(scaled) pdf pdf cdf cdf" << endl; + for (double x = 0.0; x < 1.; x += 0.1) + { + cout + << setw(width) << x + << ' ' << setw(width) << pdf(ichsq, x) // unscaled + << ' ' << setw(width) << naive_pdf1(nu, x) // Wiki def 1 unscaled matches graph + << ' ' << setw(width) << naive_pdf2(nu, x) // scale = 1 - 2nd definition. + << ' ' << setw(width) << naive_pdf3(nu, 1/nu, x) // scaled + << ' ' << setw(width) << naive_pdf4(nu, 1/nu, x) // scaled + << ' ' << setw(width) << pdf(sichsq, x) // scaled + << ' ' << setw(width) << cdf(sichsq, x) // scaled + << ' ' << setw(width) << cdf(ichsq, x) // unscaled + << endl; + } + } + + cout.precision(max_digits10); + + inverse_chi_squared ichisq(2., 0.5); + cout << "pdf(ichisq, 1.) = " << pdf(ichisq, 1.) << endl; + cout << "cdf(ichisq, 1.) = " << cdf(ichisq, 1.) << endl; + + return 0; +} // int main() + +/* + +Output is: + Example (basic) using Inverse chi squared distribution. + Show all potentially significant decimal digits std::numeric_limits::max_digits10 = 17 + default df = 1, default scale = 1 + default df = 4, default scale = 0.25 + default df = 3, default scale = 2 + nu = 5, scale = 0.2 + x pdf pdf1 pdf2 pdf(scaled) pdf pdf cdf cdf + 0 0 -1.#J -1.#J -1.#J -1.#J 0 0 0 + 0.1 2.83 2.83 3.26e-007 2.83 2.83 2.83 0.0752 0.0752 + 0.2 3.05 3.05 0.00774 3.05 3.05 3.05 0.416 0.416 + 0.3 1.7 1.7 0.121 1.7 1.7 1.7 0.649 0.649 + 0.4 0.941 0.941 0.355 0.941 0.941 0.941 0.776 0.776 + 0.5 0.553 0.553 0.567 0.553 0.553 0.553 0.849 0.849 + 0.6 0.345 0.345 0.689 0.345 0.345 0.345 0.893 0.893 + 0.7 0.227 0.227 0.728 0.227 0.227 0.227 0.921 0.921 + 0.8 0.155 0.155 0.713 0.155 0.155 0.155 0.94 0.94 + 0.9 0.11 0.11 0.668 0.11 0.11 0.11 0.953 0.953 + 1 0.0807 0.0807 0.61 0.0807 0.0807 0.0807 0.963 0.963 + pdf(ichisq, 1.) = 0.30326532985631671 + cdf(ichisq, 1.) = 0.60653065971263365 + + +*/ + diff --git a/src/boost/libs/math/example/inverse_chi_squared_find_df_example.cpp b/src/boost/libs/math/example/inverse_chi_squared_find_df_example.cpp new file mode 100644 index 00000000..ea0f932d --- /dev/null +++ b/src/boost/libs/math/example/inverse_chi_squared_find_df_example.cpp @@ -0,0 +1,186 @@ +// inverse_chi_squared_distribution_find_df_example.cpp + +// Copyright Paul A. Bristow 2010. +// Copyright Thomas Mang 2010. + +// 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) + +//#define BOOST_MATH_INSTRUMENT + +// Example 1 of using inverse chi squared distribution +#include +using boost::math::inverse_chi_squared_distribution; // inverse_chi_squared_distribution. +using boost::math::inverse_chi_squared; //typedef for nverse_chi_squared_distribution double. + +#include +using std::cout; using std::endl; +#include +using std::setprecision; +using std::setw; +#include +using std::sqrt; + +int main() +{ + cout << "Example using Inverse chi squared distribution to find df. " << endl; + try + { + cout.precision(std::numeric_limits::max_digits10); // + int i = std::numeric_limits::max_digits10; + cout << "Show all potentially significant decimal digits std::numeric_limits::max_digits10 = " << i << endl; + + cout.precision(3); + double nu = 10.; + double scale1 = 1./ nu; // 1st definition sigma^2 = 1/df; + double scale2 = 1.; // 2nd definition sigma^2 = 1 + inverse_chi_squared sichsq(nu, 1/nu); // Explicitly scaled to default scale = 1/df. + inverse_chi_squared ichsq(nu); // Implicitly scaled to default scale = 1/df. + // Try degrees of freedom estimator + + //double df = chi_squared::find_degrees_of_freedom(-diff, alpha[i], alpha[i], variance); + + cout << "ichsq.degrees_of_freedom() = " << ichsq.degrees_of_freedom() << endl; + + double diff = 0.5; // difference from variance to detect (delta). + double variance = 1.; // true variance + double alpha = 0.9; + double beta = 0.9; + + cout << "diff = " << diff + << ", variance = " << variance << ", ratio = " << diff/variance + << ", alpha = " << alpha << ", beta = " << beta << endl; + using boost::math::detail::inverse_chi_square_df_estimator; + using boost::math::policies::default_policy; + inverse_chi_square_df_estimator<> a_df(alpha, beta, variance, diff); + + cout << "df est" << endl; + for (double df = 1; df < 3; df += 0.1) + { + double est_df = a_df(1); + cout << df << " " << a_df(df) << endl; + } + + //template std::pair + // bracket_and_solve_root(F f, const T& guess, T factor, bool rising, Tol tol, boost::uintmax_t& max_iter, const Policy& pol) + + + //double df = inverse_chi_squared_distribution<>::find_degrees_of_freedom(diff, alpha, beta, variance, 0); + + double df = inverse_chi_squared::find_degrees_of_freedom(diff, alpha, beta, variance, 100); + + cout << df << endl; + } + catch(const std::exception& e) + { // Always useful to include try & catch blocks because default policies + // are to throw exceptions on arguments that cause errors like underflow, overflow. + // Lacking try & catch blocks, the program will abort without a message below, + // which may give some helpful clues as to the cause of the exception. + std::cout << + "\n""Message from thrown exception was:\n " << e.what() << std::endl; + } + return 0; +} // int main() + +/* + +Output is: + + Example using Inverse chi squared distribution to find df. + Show all potentially significant decimal digits std::numeric_limits::max_digits10 = 17 + 10 + + Message from thrown exception was: + Error in function boost::math::inverse_chi_squared_distribution::inverse_chi_squared_distribution: Degrees of freedom argument is 1.#INF, but must be > 0 ! +diff = 0.5, variance = 1, ratio = 0.5, alpha = 0.1, beta = 0.1 + df est + 1 1 + ratio+1 = 1.5, quantile(0.1) = 0.00618, cdf = 6.5e-037, result = -0.1 + 1.1 -0.1 + ratio+1 = 1.5, quantile(0.1) = 0.00903, cdf = 1.2e-025, result = -0.1 + 1.2 -0.1 + ratio+1 = 1.5, quantile(0.1) = 0.0125, cdf = 8.25e-019, result = -0.1 + 1.3 -0.1 + ratio+1 = 1.5, quantile(0.1) = 0.0166, cdf = 2.17e-014, result = -0.1 + 1.4 -0.1 + ratio+1 = 1.5, quantile(0.1) = 0.0212, cdf = 2.2e-011, result = -0.1 + 1.5 -0.1 + ratio+1 = 1.5, quantile(0.1) = 0.0265, cdf = 3e-009, result = -0.1 + 1.6 -0.1 + ratio+1 = 1.5, quantile(0.1) = 0.0323, cdf = 1.11e-007, result = -0.1 + 1.7 -0.1 + ratio+1 = 1.5, quantile(0.1) = 0.0386, cdf = 1.7e-006, result = -0.1 + 1.8 -0.1 + ratio+1 = 1.5, quantile(0.1) = 0.0454, cdf = 1.41e-005, result = -0.1 + 1.9 -0.1 + ratio+1 = 1.5, quantile(0.1) = 0.0527, cdf = 7.55e-005, result = -0.1 + 2 -0.1 + ratio+1 = 1.5, quantile(0.1) = 0.0604, cdf = 0.000291, result = -0.1 + 2.1 -0.1 + ratio+1 = 1.5, quantile(0.1) = 0.0685, cdf = 0.00088, result = -0.1 + 2.2 -0.1 + ratio+1 = 1.5, quantile(0.1) = 0.0771, cdf = 0.0022, result = -0.0999 + 2.3 -0.0999 + ratio+1 = 1.5, quantile(0.1) = 0.0859, cdf = 0.00475, result = -0.0997 + 2.4 -0.0997 + ratio+1 = 1.5, quantile(0.1) = 0.0952, cdf = 0.00911, result = -0.0993 + 2.5 -0.0993 + ratio+1 = 1.5, quantile(0.1) = 0.105, cdf = 0.0159, result = -0.0984 + 2.6 -0.0984 + ratio+1 = 1.5, quantile(0.1) = 0.115, cdf = 0.0257, result = -0.0967 + 2.7 -0.0967 + ratio+1 = 1.5, quantile(0.1) = 0.125, cdf = 0.039, result = -0.094 + 2.8 -0.094 + ratio+1 = 1.5, quantile(0.1) = 0.135, cdf = 0.056, result = -0.0897 + 2.9 -0.0897 + ratio+1 = 1.5, quantile(0.1) = 20.6, cdf = 1, result = 0.9 + + ichsq.degrees_of_freedom() = 10 + diff = 0.5, variance = 1, ratio = 0.5, alpha = 0.9, beta = 0.9 + df est + 1 1 + ratio+1 = 1.5, quantile(0.9) = 0.729, cdf = 0.269, result = -0.729 + 1.1 -0.729 + ratio+1 = 1.5, quantile(0.9) = 0.78, cdf = 0.314, result = -0.693 + 1.2 -0.693 + ratio+1 = 1.5, quantile(0.9) = 0.83, cdf = 0.36, result = -0.655 + 1.3 -0.655 + ratio+1 = 1.5, quantile(0.9) = 0.879, cdf = 0.405, result = -0.615 + 1.4 -0.615 + ratio+1 = 1.5, quantile(0.9) = 0.926, cdf = 0.449, result = -0.575 + 1.5 -0.575 + ratio+1 = 1.5, quantile(0.9) = 0.973, cdf = 0.492, result = -0.535 + 1.6 -0.535 + ratio+1 = 1.5, quantile(0.9) = 1.02, cdf = 0.534, result = -0.495 + 1.7 -0.495 + ratio+1 = 1.5, quantile(0.9) = 1.06, cdf = 0.574, result = -0.455 + 1.8 -0.455 + ratio+1 = 1.5, quantile(0.9) = 1.11, cdf = 0.612, result = -0.417 + 1.9 -0.417 + ratio+1 = 1.5, quantile(0.9) = 1.15, cdf = 0.648, result = -0.379 + 2 -0.379 + ratio+1 = 1.5, quantile(0.9) = 1.19, cdf = 0.681, result = -0.342 + 2.1 -0.342 + ratio+1 = 1.5, quantile(0.9) = 1.24, cdf = 0.713, result = -0.307 + 2.2 -0.307 + ratio+1 = 1.5, quantile(0.9) = 1.28, cdf = 0.742, result = -0.274 + 2.3 -0.274 + ratio+1 = 1.5, quantile(0.9) = 1.32, cdf = 0.769, result = -0.242 + 2.4 -0.242 + ratio+1 = 1.5, quantile(0.9) = 1.36, cdf = 0.793, result = -0.212 + 2.5 -0.212 + ratio+1 = 1.5, quantile(0.9) = 1.4, cdf = 0.816, result = -0.184 + 2.6 -0.184 + ratio+1 = 1.5, quantile(0.9) = 1.44, cdf = 0.836, result = -0.157 + 2.7 -0.157 + ratio+1 = 1.5, quantile(0.9) = 1.48, cdf = 0.855, result = -0.133 + 2.8 -0.133 + ratio+1 = 1.5, quantile(0.9) = 1.52, cdf = 0.872, result = -0.11 + 2.9 -0.11 + ratio+1 = 1.5, quantile(0.9) = 29.6, cdf = 1, result = 0.1 + + + */ + diff --git a/src/boost/libs/math/example/inverse_gamma_distribution_example.cpp b/src/boost/libs/math/example/inverse_gamma_distribution_example.cpp new file mode 100644 index 00000000..53e5ccf0 --- /dev/null +++ b/src/boost/libs/math/example/inverse_gamma_distribution_example.cpp @@ -0,0 +1,103 @@ +// inverse_gamma_distribution_example.cpp + +// Copyright Paul A. Bristow 2010. +// Copyright Thomas Mang 2010. + +// 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) + +// Example 1 of using inverse gamma +#include +using boost::math::inverse_gamma_distribution; // inverse_gamma_distribution. +using boost::math::inverse_gamma; + +#include +using boost::math::tgamma; // Used for naive pdf as a comparison. + +#include +using boost::math::inverse_gamma_distribution; + +#include +using std::cout; using std::endl; +#include +using std::setprecision; +#include +using std::sqrt; + +int main() +{ + + cout << "Example using Inverse Gamma distribution. " << endl; + // TODO - awaiting a real example using Bayesian statistics. + +#ifdef BOOST_NO_CXX11_NUMERIC_LIMITS + int max_digits10 = 2 + (boost::math::policies::digits >() * 30103UL) / 100000UL; + cout << "BOOST_NO_CXX11_NUMERIC_LIMITS is defined" << endl; +#else + int max_digits10 = std::numeric_limits::max_digits10; +#endif + cout << "Show all potentially significant decimal digits std::numeric_limits::max_digits10 = " + << max_digits10 << endl; + cout.precision(max_digits10); // + + double shape = 1.; + double scale = 1.; + double x = 0.5; + // Construction using default RealType double, and default shape and scale.. + inverse_gamma_distribution<> my_inverse_gamma(shape, scale); // (alpha, beta) + + cout << "my_inverse_gamma.shape() = " << my_inverse_gamma.shape() + << ", scale = "<< my_inverse_gamma.scale() << endl; + cout << "x = " << x << ", pdf = " << pdf(my_inverse_gamma, x) + << ", cdf = " << cdf(my_inverse_gamma, x) << endl; + + // Construct using typedef and default shape and scale parameters. + inverse_gamma my_ig; + + inverse_gamma my_ig23(2, 3); + cout << "my_inverse_gamma.shape() = " << my_ig23.shape() + << ", scale = "<< my_ig23.scale() << endl; + cout << "x = " << x << ", pdf = " << pdf(my_ig23, x) + << ", cdf = " << cdf(my_ig23, x) << endl; + + // Example of providing an 'out of domain' or 'bad' parameter, + // here a shape < 1, for which mean is not defined. + // Try block is essential to catch the exception message. + // (Uses the default policy which is to throw on all errors). + try + { + inverse_gamma if051(0.5, 1); + //inverse_gamma if051(0.5, 1); + cout << "mean(if051) = " << mean(if051) << endl; + } + catch(const std::exception& e) + { // Always useful to include try & catch blocks because default policies + // are to throw exceptions on arguments that cause errors like underflow, overflow. + // Lacking try & catch blocks, the program will abort without a message below, + // which may give some helpful clues as to the cause of the exception. + std::cout << + "\n""Message from thrown exception was:\n " << e.what() << std::endl; + } + + return 0; +} // int main() + +/* + +Output is: + Example using Inverse Gamma distribution. + std::numeric_limits::max_digits10 = 17 + my_inverse_gamma.shape() = 1, scale = 1 + x = 0.5, pdf = 0.54134113294645081, cdf = 0.1353352832366127 + my_inverse_gamma.shape() = 2, scale = 3 + x = 0.5, pdf = 0.17847015671997774, cdf = 0.017351265236664509 + + Message from thrown exception was: + Error in function boost::math::mean(const inverse_gamma_distribution&): Shape parameter is 0.5, but for a defined mean it must be > 1 + + +*/ + + diff --git a/src/boost/libs/math/example/inverse_gamma_example.cpp b/src/boost/libs/math/example/inverse_gamma_example.cpp new file mode 100644 index 00000000..5ec49665 --- /dev/null +++ b/src/boost/libs/math/example/inverse_gamma_example.cpp @@ -0,0 +1,57 @@ +// inverse_gamma_example.cpp + +// Copyright Paul A. Bristow 2010. + +// 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) + +// Example 1 of using inverse gamma functions. + +#include + +using boost::math::gamma_p_inv; // Compute x given a +//using boost::math::gamma_q_inv; +//using boost::math::gamma_p_inva; // Compute a given x +//using boost::math::gamma_q_inva; + +#include + using std::cout; using std::endl; +#include + using std::setprecision; +#include + using std::sqrt; +#include + +int main() +{ + cout << "Example 1 using Inverse Gamma function. " << endl; + + #ifdef BOOST_NO_CXX11_NUMERIC_LIMITS + int max_digits10 = 2 + (boost::math::policies::digits >() * 30103UL) / 100000UL; + cout << "BOOST_NO_CXX11_NUMERIC_LIMITS is defined" << endl; +#else + int max_digits10 = std::numeric_limits::max_digits10; +#endif + cout << "Show all potentially significant decimal digits std::numeric_limits::max_digits10 = " + << max_digits10 << endl; + cout.precision(max_digits10); // + + double x = 1.; + double a = 10; + + double r = boost::math::gamma_q_inv(a ,x); + + cout << " x = " << x << ", = gamma_q_inv(a,x)" << r << endl; // + + return 0; +} // int main() + +/* + +Output is: + +*/ + + diff --git a/src/boost/libs/math/example/inverse_gaussian_example.cpp b/src/boost/libs/math/example/inverse_gaussian_example.cpp new file mode 100644 index 00000000..4f212aa5 --- /dev/null +++ b/src/boost/libs/math/example/inverse_gaussian_example.cpp @@ -0,0 +1,513 @@ +// wald_example.cpp or inverse_gaussian_example.cpp + +// Copyright Paul A. Bristow 2010. + +// 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) + +// Example of using the Inverse Gaussian (or Inverse Normal) distribution. +// The Wald Distribution is + + +// Note that this file contains Quickbook mark-up as well as code +// and comments, don't change any of the special comment mark-ups! + +//[inverse_gaussian_basic1 +/*` +First we need some includes to access the normal distribution +(and some std output of course). +*/ + +#ifdef _MSC_VER +# pragma warning (disable : 4224) +# pragma warning (disable : 4189) +# pragma warning (disable : 4100) +# pragma warning (disable : 4224) +# pragma warning (disable : 4512) +# pragma warning (disable : 4702) +# pragma warning (disable : 4127) +#endif + +//#define BOOST_MATH_INSTRUMENT + +#define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error +#define BOOST_MATH_DOMAIN_ERROR_POLICY ignore_error + +#include // for inverse_gaussian_distribution + using boost::math::inverse_gaussian; // typedef provides default type is double. + using boost::math::inverse_gaussian_distribution; // for inverse gaussian distribution. + +#include // for normal_distribution +using boost::math::normal; // typedef provides default type is double. + +#include +using boost::array; + +#include + using std::cout; using std::endl; using std::left; using std::showpoint; using std::noshowpoint; +#include + using std::setw; using std::setprecision; +#include + using std::numeric_limits; +#include + using std::string; +#include + using std::stringstream; + +// const double tol = 3 * numeric_limits::epsilon(); + +int main() +{ + cout << "Example: Inverse Gaussian Distribution."<< endl; + + try + { + + double tolfeweps = numeric_limits::epsilon(); + //cout << "Tolerance = " << tol << endl; + + int precision = 17; // traditional tables are only computed to much lower precision. + cout.precision(17); // std::numeric_limits::max_digits10; for 64-bit doubles. + + // Traditional tables and values. + double step = 0.2; // in z + double range = 4; // min and max z = -range to +range. + // Construct a (standard) inverse gaussian distribution s + inverse_gaussian w11(1, 1); + // (default mean = units, and standard deviation = unity) + cout << "(Standard) Inverse Gaussian distribution, mean = "<< w11.mean() + << ", scale = " << w11.scale() << endl; + +/*` First the probability distribution function (pdf). + */ + cout << "Probability distribution function (pdf) values" << endl; + cout << " z " " pdf " << endl; + cout.precision(5); + for (double z = (numeric_limits::min)(); z < range + step; z += step) + { + cout << left << setprecision(3) << setw(6) << z << " " + << setprecision(precision) << setw(12) << pdf(w11, z) << endl; + } + cout.precision(6); // default + /*`And the area under the normal curve from -[infin] up to z, + the cumulative distribution function (cdf). +*/ + + // For a (default) inverse gaussian distribution. + cout << "Integral (area under the curve) from 0 up to z (cdf) " << endl; + cout << " z " " cdf " << endl; + for (double z = (numeric_limits::min)(); z < range + step; z += step) + { + cout << left << setprecision(3) << setw(6) << z << " " + << setprecision(precision) << setw(12) << cdf(w11, z) << endl; + } + /*`giving the following table: +[pre + z pdf + 2.23e-308 -1.#IND + 0.2 0.90052111680384117 + 0.4 1.0055127039453111 + 0.6 0.75123750098955733 + 0.8 0.54377310461643302 + 1 0.3989422804014327 + 1.2 0.29846949816803292 + 1.4 0.2274579835638664 + 1.6 0.17614566625628389 + 1.8 0.13829083543591469 + 2 0.10984782236693062 + 2.2 0.088133964251182237 + 2.4 0.071327382959107177 + 2.6 0.058162562161661699 + 2.8 0.047742223328567722 + 3 0.039418357969819712 + 3.2 0.032715223861241892 + 3.4 0.027278388940958308 + 3.6 0.022840312999395804 + 3.8 0.019196657941016954 + 4 0.016189699458236451 + Integral (area under the curve) from 0 up to z (cdf) + z cdf + 2.23e-308 0 + 0.2 0.063753567519976254 + 0.4 0.2706136704424541 + 0.6 0.44638391340412931 + 0.8 0.57472390962590925 + 1 0.66810200122317065 + 1.2 0.73724578422952536 + 1.4 0.78944214237790356 + 1.6 0.82953458108474554 + 1.8 0.86079282968276671 + 2 0.88547542598600626 + 2.2 0.90517870624273966 + 2.4 0.92105495653509362 + 2.6 0.93395164268166786 + 2.8 0.94450240360053817 + 3 0.95318792074278835 + 3.2 0.96037753019309191 + 3.4 0.96635823989417369 + 3.6 0.97135533107998406 + 3.8 0.97554722413538364 + 4 0.97907636417888622 +] + +/*`We can get the inverse, the quantile, percentile, percentage point, or critical value +for a probability for a few probability from the above table, for z = 0.4, 1.0, 2.0: +*/ + cout << quantile(w11, 0.27061367044245421 ) << endl; // 0.4 + cout << quantile(w11, 0.66810200122317065) << endl; // 1.0 + cout << quantile(w11, 0.88547542598600615) << endl; // 2.0 +/*`turning the expect values apart from some 'computational noise' in the least significant bit or two. + +[pre + 0.40000000000000008 + 0.99999999999999967 + 1.9999999999999973 +] + +*/ + + // cout << "pnorm01(-0.406053) " << pnorm01(-0.406053) << ", cdfn01(-0.406053) = " << cdf(n01, -0.406053) << endl; + //cout << "pnorm01(0.5) = " << pnorm01(0.5) << endl; // R pnorm(0.5,0,1) = 0.6914625 == 0.69146246127401312 + // R qnorm(0.6914625,0,1) = 0.5 + + // formatC(SuppDists::qinvGauss(0.3649755481729598, 1, 1), digits=17) [1] "0.50000000969034875" + + + + // formatC(SuppDists::dinvGauss(0.01, 1, 1), digits=17) [1] "2.0811768202028392e-19" + // formatC(SuppDists::pinvGauss(0.01, 1, 1), digits=17) [1] "4.122313403318778e-23" + + + + //cout << " qinvgauss(0.3649755481729598, 1, 1) = " << qinvgauss(0.3649755481729598, 1, 1) << endl; // 0.5 + // cout << quantile(s, 0.66810200122317065) << endl; // expect 1, get 0.50517388467190727 + //cout << " qinvgauss(0.62502320258649202, 1, 1) = " << qinvgauss(0.62502320258649202, 1, 1) << endl; // 0.9 + //cout << " qinvgauss(0.063753567519976254, 1, 1) = " << qinvgauss(0.063753567519976254, 1, 1) << endl; // 0.2 + //cout << " qinvgauss(0.0040761113207110162, 1, 1) = " << qinvgauss(0.0040761113207110162, 1, 1) << endl; // 0.1 + + //double x = 1.; // SuppDists::pinvGauss(0.4, 1,1) [1] 0.2706137 + //double c = pinvgauss(x, 1, 1); // 0.3649755481729598 == cdf(x, 1,1) 0.36497554817295974 + //cout << " pinvgauss(x, 1, 1) = " << c << endl; // pinvgauss(x, 1, 1) = 0.27061367044245421 + //double p = pdf(w11, x); + //double c = cdf(w11, x); // cdf(1, 1, 1) = 0.66810200122317065 + //cout << "cdf(" << x << ", " << w11.mean() << ", "<< w11.scale() << ") = " << c << endl; // cdf(x, 1, 1) 0.27061367044245421 + //cout << "pdf(" << x << ", " << w11.mean() << ", "<< w11.scale() << ") = " << p << endl; + //double q = quantile(w11, c); + //cout << "quantile(w11, " << c << ") = " << q << endl; + + //cout << "quantile(w11, 4.122313403318778e-23) = "<< quantile(w11, 4.122313403318778e-23) << endl; // quantile + //cout << "quantile(w11, 4.8791443010851493e-219) = " << quantile(w11, 4.8791443010851493e-219) << endl; // quantile + + //double c1 = 1 - cdf(w11, x); // 1 - cdf(1, 1, 1) = 0.33189799877682935 + //cout << "1 - cdf(" << x << ", " << w11.mean() << ", " << w11.scale() << ") = " << c1 << endl; // cdf(x, 1, 1) 0.27061367044245421 + //double cc = cdf(complement(w11, x)); + //cout << "cdf(complement(" << x << ", " << w11.mean() << ", "<< w11.scale() << ")) = " << cc << endl; // cdf(x, 1, 1) 0.27061367044245421 + //// 1 - cdf(1000, 1, 1) = 0 + //// cdf(complement(1000, 1, 1)) = 4.8694344366900402e-222 + + //cout << "quantile(w11, " << c << ") = "<< quantile(w11, c) << endl; // quantile = 0.99999999999999978 == x = 1 + //cout << "quantile(w11, " << c << ") = "<< quantile(w11, 1 - c) << endl; // quantile complement. quantile(w11, 0.66810200122317065) = 0.46336593652340152 +// cout << "quantile(complement(w11, " << c << ")) = " << quantile(complement(w11, c)) << endl; // quantile complement = 0.46336593652340163 + + // cdf(1, 1, 1) = 0.66810200122317065 + // 1 - cdf(1, 1, 1) = 0.33189799877682935 + // cdf(complement(1, 1, 1)) = 0.33189799877682929 + + // quantile(w11, 0.66810200122317065) = 0.99999999999999978 + // 1 - quantile(w11, 0.66810200122317065) = 2.2204460492503131e-016 + // quantile(complement(w11, 0.33189799877682929)) = 0.99999999999999989 + + + // qinvgauss(c, 1, 1) = 0.3999999999999998 + // SuppDists::qinvGauss(0.270613670442454, 1, 1) [1] 0.4 + + + /* + double qs = pinvgaussU(c, 1, 1); // + cout << "qinvgaussU(c, 1, 1) = " << qs << endl; // qinvgaussU(c, 1, 1) = 0.86567442459240929 + // > z=q - exp(c) * p [1] 0.8656744 qs 0.86567442459240929 double + // Is this the complement? + cout << "qgamma(0.2, 0.5, 1) expect 0.0320923 = " << qgamma(0.2, 0.5, 1) << endl; + // qgamma(0.2, 0.5, 1) expect 0.0320923 = 0.032092377333650807 + + + cout << "qinvgauss(pinvgauss(x, 1, 1) = " << q + << ", diff = " << x - q << ", fraction = " << (x - q) /x << endl; // 0.5 + + */ // > SuppDists::pinvGauss(0.02, 1,1) [1] 4.139176e-12 + // > SuppDists::qinvGauss(4.139176e-12, 1,1) [1] 0.02000000 + + + // pinvGauss(1,1,1) = 0.668102 C++ == 0.66810200122317065 + // qinvGauss(0.668102,1,1) = 1 + + // SuppDists::pinvGauss(0.3,1,1) = 0.1657266 + // cout << "qinvGauss(0.0040761113207110162, 1, 1) = " << qinvgauss(0.0040761113207110162, 1, 1) << endl; + //cout << "quantile(s, 0.1657266) = " << quantile(s, 0.1657266) << endl; // expect 1. + + //wald s12(2, 1); + //cout << "qinvGauss(0.3, 2, 1) = " << qinvgauss(0.3, 2, 1) << endl; // SuppDists::qinvGauss(0.3,2,1) == 0.58288065635052944 + //// but actually get qinvGauss(0.3, 2, 1) = 0.58288064777632187 + //cout << "cdf(s12, 0.3) = " << cdf(s12, 0.3) << endl; // cdf(s12, 0.3) = 0.10895339868447573 + + // using boost::math::wald; + //cout.precision(6); + + /* + double m = 1; + double l = 1; + double x = 0.1; + //c = cdf(w, x); + double p = pinvgauss(x, m, l); + cout << "x = " << x << ", pinvgauss(x, m, l) = " << p << endl; // R 0.4 0.2706137 + double qg = qgamma(1.- p, 0.5, 1.0, true, false); + cout << " qgamma(1.- p, 0.5, 1.0, true, false) = " << qg << endl; // 0.606817 + double g = guess_whitmore(p, m, l); + cout << "m = " << m << ", l = " << l << ", x = " << x << ", guess = " << g + << ", diff = " << (x - g) << endl; + + g = guess_wheeler(p, m, l); + cout << "m = " << m << ", l = " << l << ", x = " << x << ", guess = " << g + << ", diff = " << (x - g) << endl; + + g = guess_bagshaw(p, m, l); + cout << "m = " << m << ", l = " << l << ", x = " << x << ", guess = " << g + << ", diff = " << (x - g) << endl; + + // m = 1, l = 10, x = 0.9, guess = 0.89792, diff = 0.00231075 so a better fit. + // x = 0.9, guess = 0.887907 + // x = 0.5, guess = 0.474977 + // x = 0.4, guess = 0.369597 + // x = 0.2, guess = 0.155196 + + // m = 1, l = 2, x = 0.9, guess = 1.0312, diff = -0.145778 + // m = 1, l = 2, x = 0.1, guess = 0.122201, diff = -0.222013 + // m = 1, l = 2, x = 0.2, guess = 0.299326, diff = -0.49663 + // m = 1, l = 2, x = 0.5, guess = 1.00437, diff = -1.00875 + // m = 1, l = 2, x = 0.7, guess = 1.01517, diff = -0.450247 + + double ls[7] = {0.1, 0.2, 0.5, 1., 2., 10, 100}; // scale values. + double ms[10] = {0.001, 0.02, 0.1, 0.2, 0.5, 0.9, 1., 2., 10, 100}; // mean values. + */ + + cout.precision(6); // Restore to default. + } // try + catch(const std::exception& e) + { // Always useful to include try & catch blocks because default policies + // are to throw exceptions on arguments that cause errors like underflow, overflow. + // Lacking try & catch blocks, the program will abort without a message below, + // which may give some helpful clues as to the cause of the exception. + std::cout << + "\n""Message from thrown exception was:\n " << e.what() << std::endl; + } + return 0; +} // int main() + + +/* + +Output is: + +inverse_gaussian_example.cpp + inverse_gaussian_example.vcxproj -> J:\Cpp\MathToolkit\test\Math_test\Debug\inverse_gaussian_example.exe + Example: Inverse Gaussian Distribution. + (Standard) Inverse Gaussian distribution, mean = 1, scale = 1 + Probability distribution function (pdf) values + z pdf + 2.23e-308 -1.#IND + 0.2 0.90052111680384117 + 0.4 1.0055127039453111 + 0.6 0.75123750098955733 + 0.8 0.54377310461643302 + 1 0.3989422804014327 + 1.2 0.29846949816803292 + 1.4 0.2274579835638664 + 1.6 0.17614566625628389 + 1.8 0.13829083543591469 + 2 0.10984782236693062 + 2.2 0.088133964251182237 + 2.4 0.071327382959107177 + 2.6 0.058162562161661699 + 2.8 0.047742223328567722 + 3 0.039418357969819712 + 3.2 0.032715223861241892 + 3.4 0.027278388940958308 + 3.6 0.022840312999395804 + 3.8 0.019196657941016954 + 4 0.016189699458236451 + Integral (area under the curve) from 0 up to z (cdf) + z cdf + 2.23e-308 0 + 0.2 0.063753567519976254 + 0.4 0.2706136704424541 + 0.6 0.44638391340412931 + 0.8 0.57472390962590925 + 1 0.66810200122317065 + 1.2 0.73724578422952536 + 1.4 0.78944214237790356 + 1.6 0.82953458108474554 + 1.8 0.86079282968276671 + 2 0.88547542598600626 + 2.2 0.90517870624273966 + 2.4 0.92105495653509362 + 2.6 0.93395164268166786 + 2.8 0.94450240360053817 + 3 0.95318792074278835 + 3.2 0.96037753019309191 + 3.4 0.96635823989417369 + 3.6 0.97135533107998406 + 3.8 0.97554722413538364 + 4 0.97907636417888622 + 0.40000000000000008 + 0.99999999999999967 + 1.9999999999999973 + + + +> SuppDists::dinvGauss(2, 1, 1) [1] 0.1098478 +> SuppDists::dinvGauss(0.4, 1, 1) [1] 1.005513 +> SuppDists::dinvGauss(0.5, 1, 1) [1] 0.8787826 +> SuppDists::dinvGauss(0.39, 1, 1) [1] 1.016559 +> SuppDists::dinvGauss(0.38, 1, 1) [1] 1.027006 +> SuppDists::dinvGauss(0.37, 1, 1) [1] 1.036748 +> SuppDists::dinvGauss(0.36, 1, 1) [1] 1.045661 +> SuppDists::dinvGauss(0.35, 1, 1) [1] 1.053611 +> SuppDists::dinvGauss(0.3, 1, 1) [1] 1.072888 +> SuppDists::dinvGauss(0.1, 1, 1) [1] 0.2197948 +> SuppDists::dinvGauss(0.2, 1, 1) [1] 0.9005211 +> +x = 0.3 [1, 1] 1.0728879234594337 // R SuppDists::dinvGauss(0.3, 1, 1) [1] 1.072888 + +x = 1 [1, 1] 0.3989422804014327 + + + 0 " NA" + 1 "0.3989422804014327" + 2 "0.10984782236693059" + 3 "0.039418357969819733" + 4 "0.016189699458236468" + 5 "0.007204168934430732" + 6 "0.003379893528659049" + 7 "0.0016462878258114036" + 8 "0.00082460931140859956" + 9 "0.00042207355643694234" +10 "0.00021979480031862676" + + +[1] " NA" " 0.690988298942671" "0.11539974210409144" + [4] "0.01799698883772935" "0.0029555399206496469" "0.00050863023587406587" + [7] "9.0761842931362914e-05" "1.6655279133132795e-05" "3.1243174913715429e-06" +[10] "5.96530227727434e-07" "1.1555606328299836e-07" + + +matC(dinvGauss(0:10, 1, 3), digits=17) df = 3 +[1] " NA" " 0.690988298942671" "0.11539974210409144" + [4] "0.01799698883772935" "0.0029555399206496469" "0.00050863023587406587" + [7] "9.0761842931362914e-05" "1.6655279133132795e-05" "3.1243174913715429e-06" +[10] "5.96530227727434e-07" "1.1555606328299836e-07" +$title +[1] "Inverse Gaussian" + +$nu +[1] 1 + +$lambda +[1] 3 + +$Mean +[1] 1 + +$Median +[1] 0.8596309 + +$Mode +[1] 0.618034 + +$Variance +[1] 0.3333333 + +$SD +[1] 0.5773503 + +$ThirdCentralMoment +[1] 0.3333333 + +$FourthCentralMoment +[1] 0.8888889 + +$PearsonsSkewness...mean.minus.mode.div.SD +[1] 0.6615845 + +$Skewness...sqrtB1 +[1] 1.732051 + +$Kurtosis...B2.minus.3 +[1] 5 + + Example: Wald distribution. + (Standard) Wald distribution, mean = 1, scale = 1 + 1 dx = 0.24890250442652451, x = 0.70924622051646713 + 2 dx = -0.038547954953794553, x = 0.46034371608994262 + 3 dx = -0.0011074090830291131, x = 0.49889167104373716 + 4 dx = -9.1987259926368029e-007, x = 0.49999908012676625 + 5 dx = -6.346513344581067e-013, x = 0.49999999999936551 + dx = 6.3168242705156857e-017 at i = 6 + qinvgauss(0.3649755481729598, 1, 1) = 0.50000000000000011 + 1 dx = 0.6719944578376621, x = 1.3735318786222666 + 2 dx = -0.16997432635769361, x = 0.70153742078460446 + 3 dx = -0.027865119206495724, x = 0.87151174714229807 + 4 dx = -0.00062283290009492603, x = 0.89937686634879377 + 5 dx = -3.0075104108208687e-007, x = 0.89999969924888867 + 6 dx = -7.0485322513588089e-014, x = 0.89999999999992975 + 7 dx = 9.557331866250277e-016, x = 0.90000000000000024 + dx = 0 at i = 8 + qinvgauss(0.62502320258649202, 1, 1) = 0.89999999999999925 + 1 dx = -0.0052296256747447678, x = 0.19483508278446249 + 2 dx = 6.4699046853900505e-005, x = 0.20006470845920726 + 3 dx = 9.4123530465288137e-009, x = 0.20000000941235335 + 4 dx = 2.7739513919147025e-016, x = 0.20000000000000032 + dx = 1.5410841066192808e-016 at i = 5 + qinvgauss(0.063753567519976254, 1, 1) = 0.20000000000000004 + 1 dx = -1, x = -0.46073286697416105 + 2 dx = 0.47665501251497061, x = 0.53926713302583895 + 3 dx = -0.171105768635964, x = 0.062612120510868341 + 4 dx = 0.091490360797512563, x = 0.23371788914683234 + 5 dx = 0.029410311722649803, x = 0.14222752834931979 + 6 dx = 0.010761845493592421, x = 0.11281721662666999 + 7 dx = 0.0019864890597643035, x = 0.10205537113307757 + 8 dx = 6.8800383732599561e-005, x = 0.10006888207331327 + 9 dx = 8.1689466405590418e-008, x = 0.10000008168958067 + 10 dx = 1.133634672475146e-013, x = 0.10000000000011428 + 11 dx = 5.9588135045224526e-016, x = 0.10000000000000091 + 12 dx = 3.433223674791152e-016, x = 0.10000000000000031 + dx = 9.0763384505974048e-017 at i = 13 + qinvgauss(0.0040761113207110162, 1, 1) = 0.099999999999999964 + + + wald_example.vcxproj -> J:\Cpp\MathToolkit\test\Math_test\Debug\wald_example.exe + Example: Wald distribution. + Tolerance = 6.66134e-016 + (Standard) Wald distribution, mean = 1, scale = 1 + cdf(x, 1,1) 4.1390252102096375e-012 + qinvgauss(pinvgauss(x, 1, 1) = 0.020116801973767886, diff = -0.00011680197376788548, fraction = -0.005840098688394274 + ____________________________________________________________ + wald 1, 1 + x = 0.02, diff x - qinvgauss(cdf) = -0.00011680197376788548 + x = 0.10000000000000001, diff x - qinvgauss(cdf) = 8.7430063189231078e-016 + x = 0.20000000000000001, diff x - qinvgauss(cdf) = -1.1102230246251565e-016 + x = 0.29999999999999999, diff x - qinvgauss(cdf) = 0 + x = 0.40000000000000002, diff x - qinvgauss(cdf) = 2.2204460492503131e-016 + x = 0.5, diff x - qinvgauss(cdf) = -1.1102230246251565e-016 + x = 0.59999999999999998, diff x - qinvgauss(cdf) = 1.1102230246251565e-016 + x = 0.80000000000000004, diff x - qinvgauss(cdf) = 1.1102230246251565e-016 + x = 0.90000000000000002, diff x - qinvgauss(cdf) = 0 + x = 0.98999999999999999, diff x - qinvgauss(cdf) = -1.1102230246251565e-016 + x = 0.999, diff x - qinvgauss(cdf) = -1.1102230246251565e-016 + + +*/ + + + diff --git a/src/boost/libs/math/example/jacobi_zeta_example.cpp b/src/boost/libs/math/example/jacobi_zeta_example.cpp new file mode 100644 index 00000000..062f27ba --- /dev/null +++ b/src/boost/libs/math/example/jacobi_zeta_example.cpp @@ -0,0 +1,104 @@ +// Copyright Paul A. Bristow, 2019 + +// 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) + +/*! \title Simple example of computation of the Jacobi Zeta function using Boost.Math, +and also using corresponding WolframAlpha commands. +*/ + +#ifdef BOOST_NO_CXX11_NUMERIC_LIMITS +# error "This example requires a C++ compiler that supports C++11 numeric_limits. Try C++11 or later." +#endif + +#include // For jacobi_zeta function. +#include // For cpp_bin_float_50. + +#include +#include +#include +#include + +int main() +{ + try + { + std::cout.precision(std::numeric_limits::max_digits10); // Show all potentially significant digits. + std::cout.setf(std::ios_base::showpoint); // Include any significant trailing zeros. + + using boost::math::jacobi_zeta; // jacobi_zeta(T1 k, T2 phi) |k| <=1, k = sqrt(m) + using boost::multiprecision::cpp_bin_float_50; + + // Wolfram Mathworld function JacobiZeta[phi, m] where m = k^2 + // JacobiZeta[phi,m] gives the Jacobi zeta function Z(phi | m) + + // If phi = 2, and elliptic modulus k = 0.9 so m = 0.9 * 0.9 = 0.81 + + // https://reference.wolfram.com/language/ref/JacobiZeta.html // Function information. + // A simple computation using phi = 2. and m = 0.9 * 0.9 + // JacobiZeta[2, 0.9 * 0.9] + // https://www.wolframalpha.com/input/?i=JacobiZeta%5B2,+0.9+*+0.9%5D + // -0.248584... + // To get the expected 17 decimal digits precision for a 64-bit double type, + // we need to ask thus: + // N[JacobiZeta[2, 0.9 * 0.9],17] + // https://www.wolframalpha.com/input/?i=N%5BJacobiZeta%5B2,+0.9+*+0.9%5D,17%5D + + double k = 0.9; + double m = k * k; + double phi = 2.; + + std::cout << "m = k^2 = " << m << std::endl; // m = k^2 = 0.81000000000000005 + std::cout << "jacobi_zeta(" << k << ", " << phi << " ) = " << jacobi_zeta(k, phi) << std::endl; + // jacobi_zeta(0.90000000000000002, 2.0000000000000000 ) = + // -0.24858442708494899 Boost.Math + // -0.24858442708494893 Wolfram + // that agree within the expected precision of 17 decimal digits for 64-bit type double. + + // We can also easily get a higher precision too: + // For example, to get 50 decimal digit precision using WolframAlpha: + // N[JacobiZeta[2, 0.9 * 0.9],50] + // https://www.wolframalpha.com/input/?i=N%5BJacobiZeta%5B2,+0.9+*+0.9%5D,50%5D + // -0.24858442708494893408462856109734087389683955309853 + + // Using Boost.Multiprecision we can do them same almost as easily. + + // To check that we are not losing precision, we show all the significant digits of the arguments ad result: + std::cout.precision(std::numeric_limits::digits10); // Show all significant digits. + + // We can force the computation to use 50 decimal digit precision thus: + cpp_bin_float_50 k50("0.9"); + cpp_bin_float_50 phi50("2."); + + std::cout << "jacobi_zeta(" << k50 << ", " << phi50 << " ) = " << jacobi_zeta(k50, phi50) << std::endl; + // jacobi_zeta(0.90000000000000000000000000000000000000000000000000, + // 2.0000000000000000000000000000000000000000000000000 ) + // = -0.24858442708494893408462856109734087389683955309853 + + // and a comparison with Wolfram shows agreement to the expected precision. + // -0.24858442708494893408462856109734087389683955309853 Boost.Math + // -0.24858442708494893408462856109734087389683955309853 Wolfram + + // Taking care not to fall into the awaiting pit, we ensure that ALL arguments passed are of the + // appropriate 50-digit precision and do NOT suffer from precision reduction to that of type double, + // We do NOT write: + std::cout << "jacobi_zeta(0.9, 2.) = " << jacobi_zeta(0.9, 2) << std::endl; + // jacobi_zeta(0.90000000000000000000000000000000000000000000000000, + // 2.0000000000000000000000000000000000000000000000000 ) + // = -0.24858442708494895921459900494815797085727097762164 << Wrong at about 17th digit! + // -0.24858442708494893408462856109734087389683955309853 Wolfram + } + catch (std::exception const& ex) + { + // Lacking try&catch blocks, the program will abort after any throw, whereas the + // message below from the thrown exception will give some helpful clues as to the cause of the problem. + std::cout << "\n""Message from thrown exception was:\n " << ex.what() << std::endl; + // An example of message: + // std::cout << " = " << jacobi_zeta(2, 0.5) << std::endl; + // Message from thrown exception was: + // Error in function boost::math::ellint_k(long double) : Got k = 2, function requires |k| <= 1 + // Shows that first parameter is k and is out of range, as the definition in docs jacobi_zeta(T1 k, T2 phi); + } +} // int main() diff --git a/src/boost/libs/math/example/lambert_w_basic_example.cpp b/src/boost/libs/math/example/lambert_w_basic_example.cpp new file mode 100644 index 00000000..86941619 --- /dev/null +++ b/src/boost/libs/math/example/lambert_w_basic_example.cpp @@ -0,0 +1,30 @@ +// Copyright Paul A. Bristow 2018 + +// Distributed under 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) + +// Example of most basic call of both lambert W functions. +// Only requires C++03 +// (and optionally a call of max_digits10 to show precision). + +#include // For lambert_w0 and wm1 functions. + +#include +#include + +int main() +{ + double z = 2.0; + double w0 = boost::math::lambert_w0(z); + std::cout.setf(std::ios_base::showpoint); // Include any trailing zeros. + std::cout.precision(std::numeric_limits::max_digits10); // Show all possibly significant digits. + // Avoid using max_digfigs10 so as many old compilers can run the most basic lambert_w0 test? + // Require to get max_digits10 + // [ run lambert_w_basic_example.cpp : : : [ requires cxx11_numeric_limits ] ] + std::cout << " lambert_w0(" << z << ") = " << w0 << std::endl; // lambert_w0(2.00000) = 0.852606 + z = -0.2; + double wm1 = boost::math::lambert_wm1(z); + std::cout << " lambert_wm1(" << z << ") = " << wm1 << std::endl; // lambert_wm1(-0.200000) = -2.54264 + return 0; +} // int main() diff --git a/src/boost/libs/math/example/lambert_w_diode.cpp b/src/boost/libs/math/example/lambert_w_diode.cpp new file mode 100644 index 00000000..cad03b1c --- /dev/null +++ b/src/boost/libs/math/example/lambert_w_diode.cpp @@ -0,0 +1,165 @@ +// Copyright Paul A. Bristow 2016 +// Copyright John Z. Maddock 2016 + +// Distributed under 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). + +/*! brief Example of using Lambert W function to compute current through a diode connected transistor with preset series resistance. + \details T. C. Banwell and A. Jayakumar, + Exact analytical solution of current flow through diode with series resistance, + Electron Letters, 36(4):291-2 (2000) + DOI: doi.org/10.1049/el:20000301 + + The current through a diode connected NPN bipolar junction transistor (BJT) + type 2N2222 (See https://en.wikipedia.org/wiki/2N2222 and + https://www.fairchildsemi.com/datasheets/PN/PN2222.pdf Datasheet) + was measured, for a voltage between 0.3 to 1 volt, see Fig 2 for a log plot, + showing a knee visible at about 0.6 V. + + The transistor parameter isat was estimated to be 25 fA and the ideality factor = 1.0. + The intrinsic emitter resistance re was estimated from the rsat = 0 data to be 0.3 ohm. + + The solid curves in Figure 2 are calculated using equation 5 with rsat included with re. + + http://www3.imperial.ac.uk/pls/portallive/docs/1/7292572.PDF +*/ + +#include +using boost::math::lambert_w0; + +#include +// using std::cout; +// using std::endl; +#include +#include +#include +#include +#include + +/*! +Compute thermal voltage as a function of temperature, +about 25 mV at room temperature. +https://en.wikipedia.org/wiki/Boltzmann_constant#Role_in_semiconductor_physics:_the_thermal_voltage + +\param temperature Temperature (degrees centigrade). +*/ +const double v_thermal(double temperature) +{ + constexpr const double boltzmann_k = 1.38e-23; // joules/kelvin. + const double charge_q = 1.6021766208e-19; // Charge of an electron (columb). + double temp =+ 273; // Degrees C to K. + return boltzmann_k * temp / charge_q; +} // v_thermal + +/*! +Banwell & Jayakumar, equation 2 +*/ +double i(double isat, double vd, double vt, double nu) +{ + double i = isat * (exp(vd / (nu * vt)) - 1); + return i; +} // + +/*! + +Banwell & Jayakumar, Equation 4. +i current flow = isat +v voltage source. +isat reverse saturation current in equation 4. +(might implement equation 4 instead of simpler equation 5?). +vd voltage drop = v - i* rs (equation 1). +vt thermal voltage, 0.0257025 = 25 mV. +nu junction ideality factor (default = unity), also known as the emission coefficient. +re intrinsic emitter resistance, estimated to be 0.3 ohm from low current. +rsat reverse saturation current + +\param v Voltage V to compute current I(V). +\param vt Thermal voltage, for example 0.0257025 = 25 mV, computed from boltzmann_k * temp / charge_q; +\param rsat Resistance in series with the diode. +\param re Instrinsic emitter resistance (estimated to be 0.3 ohm from the Rs = 0 data) +\param isat Reverse saturation current (See equation 2). +\param nu Ideality factor (default = unity). + +\returns I amp as function of V volt. + +*/ +double iv(double v, double vt, double rsat, double re, double isat, double nu = 1.) +{ + // V thermal 0.0257025 = 25 mV + // was double i = (nu * vt/r) * lambert_w((i0 * r) / (nu * vt)); equ 5. + + rsat = rsat + re; + double i = nu * vt / rsat; + std::cout << "nu * vt / rsat = " << i << std::endl; // 0.000103223 + + double x = isat * rsat / (nu * vt); + std::cout << "isat * rsat / (nu * vt) = " << x << std::endl; + + double eterm = (v + isat * rsat) / (nu * vt); + std::cout << "(v + isat * rsat) / (nu * vt) = " << eterm << std::endl; + + double e = exp(eterm); + std::cout << "exp(eterm) = " << e << std::endl; + + double w0 = lambert_w0(x * e); + std::cout << "w0 = " << w0 << std::endl; + return i * w0 - isat; + +} // double iv + +std::array rss = {0., 2.18, 10., 51., 249}; // series resistance (ohm). +std::array vds = { 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9 }; // Diode voltage. + +int main() +{ + try + { + std::cout << "Lambert W diode current example." << std::endl; + + //[lambert_w_diode_example_1 + double x = 0.01; + //std::cout << "Lambert W (" << x << ") = " << lambert_w(x) << std::endl; // 0.00990147 + + double nu = 1.0; // Assumed ideal. + double vt = v_thermal(25); // v thermal, Shockley equation, expect about 25 mV at room temperature. + double boltzmann_k = 1.38e-23; // joules/kelvin + double temp = 273 + 25; + double charge_q = 1.6e-19; // column + vt = boltzmann_k * temp / charge_q; + std::cout << "V thermal " + << vt << std::endl; // V thermal 0.0257025 = 25 mV + double rsat = 0.; + double isat = 25.e-15; // 25 fA; + std::cout << "Isat = " << isat << std::endl; + + double re = 0.3; // Estimated from slope of straight section of graph (equation 6). + + double v = 0.9; + double icalc = iv(v, vt, 249., re, isat); + + std::cout << "voltage = " << v << ", current = " << icalc << ", " << log(icalc) << std::endl; // voltage = 0.9, current = 0.00108485, -6.82631 + //] [/lambert_w_diode_example_1] + } + catch (std::exception& ex) + { + std::cout << ex.what() << std::endl; + } +} // int main() + +/* + Output: +//[lambert_w_output_1 + Lambert W diode current example. + V thermal 0.0257025 + Isat = 2.5e-14 + nu * vt / rsat = 0.000103099 + isat * rsat / (nu * vt) = 2.42486e-10 + (v + isat * rsat) / (nu * vt) = 35.016 + exp(eterm) = 1.61167e+15 + w0 = 10.5225 + voltage = 0.9, current = 0.00108485, -6.82631 + +//] [/lambert_w_output_1] +*/ + diff --git a/src/boost/libs/math/example/lambert_w_diode_graph.cpp b/src/boost/libs/math/example/lambert_w_diode_graph.cpp new file mode 100644 index 00000000..76b4159c --- /dev/null +++ b/src/boost/libs/math/example/lambert_w_diode_graph.cpp @@ -0,0 +1,280 @@ +// Copyright Paul A. Bristow 2016 +// Copyright John Z. Maddock 2016 + +// Distributed under 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). + +/*! \brief Graph showing use of Lambert W function to compute current +through a diode-connected transistor with preset series resistance. + +\details T. C. Banwell and A. Jayakumar, +Exact analytical solution of current flow through diode with series resistance, +Electron Letters, 36(4):291-2 (2000). +DOI: doi.org/10.1049/el:20000301 + +The current through a diode connected NPN bipolar junction transistor (BJT) +type 2N2222 (See https://en.wikipedia.org/wiki/2N2222 and +https://www.fairchildsemi.com/datasheets/PN/PN2222.pdf Datasheet) +was measured, for a voltage between 0.3 to 1 volt, see Fig 2 for a log plot, showing a knee visible at about 0.6 V. + +The transistor parameter I sat was estimated to be 25 fA and the ideality factor = 1.0. +The intrinsic emitter resistance re was estimated from the rsat = 0 data to be 0.3 ohm. + +The solid curves in Figure 2 are calculated using equation 5 with rsat included with re. + +http://www3.imperial.ac.uk/pls/portallive/docs/1/7292572.PDF + +*/ + +#include +using boost::math::lambert_w0; +#include +using boost::math::isfinite; +#include +using namespace boost::svg; + +#include +// using std::cout; +// using std::endl; +#include +#include +#include +#include +#include +#include +using std::pair; +#include +using std::map; +#include +using std::multiset; +#include +using std::numeric_limits; +#include // + +/*! +Compute thermal voltage as a function of temperature, +about 25 mV at room temperature. +https://en.wikipedia.org/wiki/Boltzmann_constant#Role_in_semiconductor_physics:_the_thermal_voltage + +\param temperature Temperature (degrees Celsius). +*/ +const double v_thermal(double temperature) +{ + BOOST_CONSTEXPR const double boltzmann_k = 1.38e-23; // joules/kelvin. + BOOST_CONSTEXPR double charge_q = 1.6021766208e-19; // Charge of an electron (columb). + double temp = +273; // Degrees C to K. + return boltzmann_k * temp / charge_q; +} // v_thermal + + /*! + Banwell & Jayakumar, equation 2, page 291. + */ +double i(double isat, double vd, double vt, double nu) +{ + double i = isat * (exp(vd / (nu * vt)) - 1); + return i; +} // + + /*! + Banwell & Jayakumar, Equation 4, page 291. + i current flow = isat + v voltage source. + isat reverse saturation current in equation 4. + (might implement equation 4 instead of simpler equation 5?). + vd voltage drop = v - i* rs (equation 1). + vt thermal voltage, 0.0257025 = 25 mV. + nu junction ideality factor (default = unity), also known as the emission coefficient. + re intrinsic emitter resistance, estimated to be 0.3 ohm from low current. + rsat reverse saturation current + + \param v Voltage V to compute current I(V). + \param vt Thermal voltage, for example 0.0257025 = 25 mV, computed from boltzmann_k * temp / charge_q; + \param rsat Resistance in series with the diode. + \param re Instrinsic emitter resistance (estimated to be 0.3 ohm from the Rs = 0 data) + \param isat Reverse saturation current (See equation 2). + \param nu Ideality factor (default = unity). + + \returns I amp as function of V volt. + */ + +//[lambert_w_diode_graph_2 +double iv(double v, double vt, double rsat, double re, double isat, double nu = 1.) +{ + // V thermal 0.0257025 = 25 mV + // was double i = (nu * vt/r) * lambert_w((i0 * r) / (nu * vt)); equ 5. + + rsat = rsat + re; + double i = nu * vt / rsat; + // std::cout << "nu * vt / rsat = " << i << std::endl; // 0.000103223 + + double x = isat * rsat / (nu * vt); +// std::cout << "isat * rsat / (nu * vt) = " << x << std::endl; + + double eterm = (v + isat * rsat) / (nu * vt); + // std::cout << "(v + isat * rsat) / (nu * vt) = " << eterm << std::endl; + + double e = exp(eterm); +// std::cout << "exp(eterm) = " << e << std::endl; + + double w0 = lambert_w0(x * e); +// std::cout << "w0 = " << w0 << std::endl; + return i * w0 - isat; +} // double iv + +//] [\lambert_w_diode_graph_2] + + +std::array rss = { 0., 2.18, 10., 51., 249 }; // series resistance (ohm). +std::array vds = { 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9 }; // Diode voltage. +std::array lni = { -19.65, -15.75, -11.86, -7.97, -4.08, -0.0195, 3.6 }; // ln(current). + +int main() +{ + try + { + std::cout << "Lambert W diode current example." << std::endl; + +//[lambert_w_diode_graph_1 + double nu = 1.0; // Assumed ideal. + double vt = v_thermal(25); // v thermal, Shockley equation, expect about 25 mV at room temperature. + double boltzmann_k = 1.38e-23; // joules/kelvin + double temp = 273 + 25; + double charge_q = 1.6e-19; // column + vt = boltzmann_k * temp / charge_q; + std::cout << "V thermal " << vt << std::endl; // V thermal 0.0257025 = 25 mV + double rsat = 0.; + double isat = 25.e-15; // 25 fA; + std::cout << "Isat = " << isat << std::endl; + double re = 0.3; // Estimated from slope of straight section of graph (equation 6). + double v = 0.9; + double icalc = iv(v, vt, 249., re, isat); + std::cout << "voltage = " << v << ", current = " << icalc << ", " << log(icalc) << std::endl; // voltage = 0.9, current = 0.00108485, -6.82631 +//] [/lambert_w_diode_graph_1] + + // Plot a few measured data points. + std::map zero_data; // Extrapolated from slope of measurements with no external resistor. + zero_data[0.3] = -19.65; + zero_data[0.4] = -15.75; + zero_data[0.5] = -11.86; + zero_data[0.6] = -7.97; + zero_data[0.7] = -4.08; + zero_data[0.8] = -0.0195; + zero_data[0.9] = 3.9; + + std::map measured_zero_data; // No external series resistor. + measured_zero_data[0.3] = -19.65; + measured_zero_data[0.4] = -15.75; + measured_zero_data[0.5] = -11.86; + measured_zero_data[0.6] = -7.97; + measured_zero_data[0.7] = -4.2; + measured_zero_data[0.72] = -3.5; + measured_zero_data[0.74] = -2.8; + measured_zero_data[0.76] = -2.3; + measured_zero_data[0.78] = -2.0; + // Measured from Fig 2 as raw data not available. + + double step = 0.1; + for (int i = 0; i < vds.size(); i++) + { + zero_data[vds[i]] = lni[i]; + std::cout << lni[i] << " " << vds[i] << std::endl; + } + step = 0.01; + + std::map data_2; + for (double v = 0.3; v < 1.; v += step) + { + double current = iv(v, vt, 2., re, isat); + data_2[v] = log(current); + // std::cout << "v " << v << ", current = " << current << " log current = " << log(current) << std::endl; + } + std::map data_10; + for (double v = 0.3; v < 1.; v += step) + { + double current = iv(v, vt, 10., re, isat); + data_10[v] = log(current); + // std::cout << "v " << v << ", current = " << current << " log current = " << log(current) << std::endl; + } + std::map data_51; + for (double v = 0.3; v < 1.; v += step) + { + double current = iv(v, vt, 51., re, isat); + data_51[v] = log(current); + // std::cout << "v " << v << ", current = " << current << " log current = " << log(current) << std::endl; + } + std::map data_249; + for (double v = 0.3; v < 1.; v += step) + { + double current = iv(v, vt, 249., re, isat); + data_249[v] = log(current); + // std::cout << "v " << v << ", current = " << current << " log current = " << log(current) << std::endl; + } + + svg_2d_plot data_plot; + + data_plot.title("Diode current versus voltage") + .x_size(400) + .y_size(300) + .legend_on(true) + .legend_lines(true) + .x_label("voltage (V)") + .y_label("log(current) (A)") + //.x_label_on(true) + //.y_label_on(true) + //.xy_values_on(false) + .x_range(0.25, 1.) + .y_range(-20., +4.) + .x_major_interval(0.1) + .y_major_interval(4) + .x_major_grid_on(true) + .y_major_grid_on(true) + //.x_values_on(true) + //.y_values_on(true) + .y_values_rotation(horizontal) + //.plot_window_on(true) + .x_values_precision(3) + .y_values_precision(3) + .coord_precision(4) // Needed to avoid stepping on curves. + .copyright_holder("Paul A. Bristow") + .copyright_date("2016") + //.background_border_color(black); + ; + + // ₀ = subscript zero. + data_plot.plot(zero_data, "I₀(V)").fill_color(lightgray).shape(none).size(3).line_on(true).line_width(0.5); + data_plot.plot(measured_zero_data, "Rs=0 Ω").fill_color(lightgray).shape(square).size(3).line_on(true).line_width(0.5); + data_plot.plot(data_2, "Rs=2 Ω").line_color(blue).shape(none).line_on(true).bezier_on(false).line_width(1); + data_plot.plot(data_10, "Rs=10 Ω").line_color(purple).shape(none).line_on(true).bezier_on(false).line_width(1); + data_plot.plot(data_51, "Rs=51 Ω").line_color(green).shape(none).line_on(true).line_width(1); + data_plot.plot(data_249, "Rs=249 Ω").line_color(red).shape(none).line_on(true).line_width(1); + data_plot.write("./diode_iv_plot"); + + // bezier_on(true); + } + catch (std::exception& ex) + { + std::cout << ex.what() << std::endl; + } + + +} // int main() + + /* + + //[lambert_w_output_1 + Output: + Lambert W diode current example. + V thermal 0.0257025 + Isat = 2.5e-14 + voltage = 0.9, current = 0.00108485, -6.82631 + -19.65 0.3 + -15.75 0.4 + -11.86 0.5 + -7.97 0.6 + -4.08 0.7 + -0.0195 0.8 + 3.6 0.9 + + //] [/lambert_w_output_1] + */ diff --git a/src/boost/libs/math/example/lambert_w_example.cpp b/src/boost/libs/math/example/lambert_w_example.cpp new file mode 100644 index 00000000..28dbdf8a --- /dev/null +++ b/src/boost/libs/math/example/lambert_w_example.cpp @@ -0,0 +1,239 @@ +// Copyright Paul A. Bristow 2016. + +// Distributed under 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). + +// Test that can build and run a simple example of Lambert W function, +// using algorithm of Thomas Luu. +// https://svn.boost.org/trac/boost/ticket/11027 + +#include // for BOOST_PLATFORM, BOOST_COMPILER, BOOST_STDLIB ... +#include // for BOOST_MSVC versions. +#include +#include // boost::exception +#include // For exp_minus_one == 3.67879441171442321595523770161460867e-01. + +#define BOOST_MATH_INSTRUMENT_LAMBERT_W // #define only for diagnostic output. + +// For lambert_w function. +#include + +#include +// using std::cout; +// using std::endl; +#include +#include +#include +#include // For std::numeric_limits. + +//! Show information about build, architecture, address model, platform, ... +std::string show_versions() +{ + std::ostringstream message; + + message << "Program: " << __FILE__ << "\n"; +#ifdef __TIMESTAMP__ + message << __TIMESTAMP__; +#endif + message << "\nBuildInfo:\n" " Platform " << BOOST_PLATFORM; + // http://stackoverflow.com/questions/1505582/determining-32-vs-64-bit-in-c +#if defined(__LP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__) +#define IS64BIT 1 + message << ", 64-bit."; +#else +#define IS32BIT 1 + message << ", 32-bit."; +#endif + + message << "\n Compiler " BOOST_COMPILER; +#ifdef BOOST_MSC_VER +#ifdef _MSC_FULL_VER + message << "\n MSVC version " << BOOST_STRINGIZE(_MSC_FULL_VER) << "."; +#endif +#ifdef __WIN64 + mess age << "\n WIN64" << std::endl; +#endif // __WIN64 +#ifdef _WIN32 + message << "\n WIN32" << std::endl; +#endif // __WIN32 +#endif +#ifdef __GNUC__ + //PRINT_MACRO(__GNUC__); + //PRINT_MACRO(__GNUC_MINOR__); + //PRINT_MACRO(__GNUC_PATCH__); + std::cout << "GCC " << __VERSION__ << std::endl; + //PRINT_MACRO(LONG_MAX); +#endif // __GNUC__ + + message << "\n STL " << BOOST_STDLIB; + + message << "\n Boost version " << BOOST_VERSION / 100000 << "." << BOOST_VERSION / 100 % 1000 << "." << BOOST_VERSION % 100; + +#ifdef BOOST_HAS_FLOAT128 + message << ", BOOST_HAS_FLOAT128" << std::endl; +#endif + message << std::endl; + return message.str(); +} // std::string versions() + +int main() +{ + try + { + //std::cout << "Lambert W example basic!" << std::endl; + //std::cout << show_versions() << std::endl; + + //std::cout << exp(1) << std::endl; // 2.71828 + //std::cout << exp(-1) << std::endl; // 0.367879 + //std::cout << std::numeric_limits::epsilon() / 2 << std::endl; // 1.11022e-16 + + using namespace boost::math; + using boost::math::constants::exp_minus_one; + double x = 1.; + + double W1 = lambert_w(1.); + // Note, NOT integer X, for example: lambert_w(1); or will get message like + // error C2338: Must be floating-point, not integer type, for example W(1.), not W(1)! + // + + std::cout << "Lambert W (" << x << ") = " << lambert_w(x) << std::endl; // 0.567143 + // This 'golden ratio' for exponentials is http://mathworld.wolfram.com/OmegaConstant.html + // since exp[-W(1)] = W(1) + // A030178 Decimal expansion of LambertW(1): the solution to x*exp(x) + // = 0.5671432904097838729999686622103555497538157871865125081351310792230457930866 + // http://oeis.org/A030178 + + double expplogone = exp(-lambert_w(1.)); + if (expplogone != W1) + { + std::cout << expplogone << " " << W1 << std::endl; // + } + + +//[lambert_w_example_1 + + x = 0.01; + std::cout << "Lambert W (" << x << ") = " << lambert_w(x) << std::endl; // 0.00990147 +//] [/lambert_w_example_1] + x = -0.01; + std::cout << "Lambert W (" << x << ") = " << lambert_w(x) << std::endl; // -0.0101015 + x = -0.1; + std::cout << "Lambert W (" << x << ") = " << lambert_w(x) << std::endl; // + /**/ + + for (double xd = 1.; xd < 1e20; xd *= 10) + { + + // 1. 0.56714329040978387 + // 0.56714329040978384 + + // 10 1.7455280027406994 + // 1.7455280027406994 + + // 100 3.3856301402900502 + // 3.3856301402900502 + // 1000 5.2496028524015959 + // 5.249602852401596227126056319697306282521472386059592844451465483991362228320942832739693150854347718 + + // 1e19 40.058769161984308 + // 40.05876916198431163898797971203180915622644925765346546858291325452428038208071849105889199253335063 + std::cout << "Lambert W (" << xd << ") = " << lambert_w(xd) << std::endl; // + } + // + // Test near singularity. + + // http://www.wolframalpha.com/input/?i=N%5Blambert_w%5B-0.367879%5D,17%5D test value N[lambert_w[-0.367879],17] + // -0.367879441171442321595523770161460867445811131031767834 + x = -0.367879; // < -exp(1) = -0.367879 + std::cout << "Lambert W (" << x << ") = " << lambert_w(x) << std::endl; // Lambert W (-0.36787900000000001) = -0.99845210378080340 + // -0.99845210378080340 + // -0.99845210378072726 N[lambert_w[-0.367879],17] wolfram so very close. + + x = -0.3678794; // expect -0.99952696660756813 + std::cout << "Lambert W (" << x << ") = " << lambert_w(x) << std::endl; // 0.0 + x = -0.36787944; // expect -0.99992019848408340 + std::cout << "Lambert W (" << x << ") = " << lambert_w(x) << std::endl; // 0.0 + x = -0.367879441; // -0.99996947070054883 + std::cout << "Lambert W (" << x << ") = " << lambert_w(x) << std::endl; // 0.0 + x = -0.36787944117; // -0.99999719977527159 + std::cout << "Lambert W (" << x << ") = " << lambert_w(x) << std::endl; // 0.0 + x = -0.367879441171; // -0.99999844928821992 + std::cout << "Lambert W (" << x << ") = " << lambert_w(x) << std::endl; // 0.0 + + x = -exp_minus_one() + std::numeric_limits::epsilon(); + // Lambert W (-0.36787944117144211) = -0.99999996349975895 + // N[lambert_w[-0.36787944117144211],17] == -0.99999996608315303 + std::cout << "Lambert W (" << x << ") = " << lambert_w(x) << std::endl; // 0.0 + std::cout << " 1 - sqrt(eps) = " << static_cast(1) - sqrt(std::numeric_limits::epsilon()) << std::endl; + x = -exp_minus_one(); + // N[lambert_w[-0.36787944117144233],17] == -1.000000000000000 + 6.7595465843924897*10^-9i + std::cout << "Lambert W (" << x << ") = " << lambert_w(x) << std::endl; // 0.0 + // At Singularity - 0.36787944117144233 == -0.36787944117144233 returned - 1.0000000000000000 + // Lambert W(-0.36787944117144233) = -1.0000000000000000 + + + x = (std::numeric_limits::max)()/4; + std::cout << "Lambert W (" << x << ") = " << lambert_w(x) << std::endl; // OK 702.023799146706 + x = (std::numeric_limits::max)()/2; + std::cout << "Lambert W (" << x << ") = " << lambert_w(x) << std::endl; // + x = (std::numeric_limits::max)(); + std::cout << "Lambert W (" << x << ") = " << lambert_w(x) << std::endl; // + // Error in function boost::math::log1p(double): numeric overflow + /* */ + + } + catch (std::exception& ex) + { + std::cout << ex.what() << std::endl; + } + + +} // int main() + + /* + +//[lambert_w_output_1 + Output: + + 1> example_basic.cpp +1> Generating code +1> All 237 functions were compiled because no usable IPDB/IOBJ from previous compilation was found. +1> Finished generating code +1> LambertW.vcxproj -> J:\Cpp\Misc\x64\Release\LambertW.exe +1> LambertW.vcxproj -> J:\Cpp\Misc\x64\Release\LambertW.pdb (Full PDB) +1> Lambert W example basic! +1> Platform: Win32 +1> Compiler: Microsoft Visual C++ version 14.0 +1> STL : Dinkumware standard library version 650 +1> Boost : 1.63.0 +1> _MSC_FULL_VER = 190024123 +1> Win32 +1> x64 +1> (x64) +1> Iteration #0, w0 0.577547206058041, w1 = 0.567143616915443, difference = 0.0289944962755619, relative 0.018343835374856 +1> Iteration #1, w0 0.567143616915443, w1 = 0.567143290409784, difference = 9.02208135089566e-07, relative 5.75702234328901e-07 +1> Final 0.567143290409784 after 2 iterations, difference = 0 +1> Iteration #0, w0 0.577547206058041, w1 = 0.567143616915443, difference = 0.0289944962755619, relative 0.018343835374856 +1> Iteration #1, w0 0.567143616915443, w1 = 0.567143290409784, difference = 9.02208135089566e-07, relative 5.75702234328901e-07 +1> Final 0.567143290409784 after 2 iterations, difference = 0 +1> Lambert W (1) = 0.567143290409784 +1> Iteration #0, w0 0.577547206058041, w1 = 0.567143616915443, difference = 0.0289944962755619, relative 0.018343835374856 +1> Iteration #1, w0 0.567143616915443, w1 = 0.567143290409784, difference = 9.02208135089566e-07, relative 5.75702234328901e-07 +1> Final 0.567143290409784 after 2 iterations, difference = 0 +1> Iteration #0, w0 0.0099072820916067, w1 = 0.00990147384359511, difference = 5.92416060777624e-06, relative 0.000586604388734591 +1> Final 0.00990147384359511 after 1 iterations, difference = 0 +1> Lambert W (0.01) = 0.00990147384359511 +1> Iteration #0, w0 -0.0101016472705154, w1 = -0.0101015271985388, difference = -1.17664437923951e-07, relative 1.18865171889748e-05 +1> Final -0.0101015271985388 after 1 iterations, difference = 0 +1> Lambert W (-0.01) = -0.0101015271985388 +1> Iteration #0, w0 -0.111843322610692, w1 = -0.111832559158964, difference = -8.54817065376601e-06, relative 9.62461362694622e-05 +1> Iteration #1, w0 -0.111832559158964, w1 = -0.111832559158963, difference = -5.68989300120393e-16, relative 6.43929354282591e-15 +1> Final -0.111832559158963 after 2 iterations, difference = 0 +1> Lambert W (-0.1) = -0.111832559158963 +1> Iteration #0, w0 -0.998452103785573, w1 = -0.998452103780803, difference = -2.72004641033163e-15, relative 4.77662354114727e-12 +1> Final -0.998452103780803 after 1 iterations, difference = 0 +1> Lambert W (-0.367879) = -0.998452103780803 + +//] [/lambert_w_output_1] + */ diff --git a/src/boost/libs/math/example/lambert_w_graph.cpp b/src/boost/libs/math/example/lambert_w_graph.cpp new file mode 100644 index 00000000..3eb43f75 --- /dev/null +++ b/src/boost/libs/math/example/lambert_w_graph.cpp @@ -0,0 +1,286 @@ +// Copyright Paul A. Bristow 2017 +// Copyright John Z. Maddock 2017 + +// Distributed under 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). + +/*! \brief Graph showing use of Lambert W function. + +\details + +Both Lambert W0 and W-1 branches can be shown on one graph. +But useful to have another graph for larger values of argument z. +Need two separate graphs for Lambert W0 and -1 prime because +the sensible ranges and axes are too different. + +One would get too small LambertW0 in top right and W-1 in bottom left. + +*/ + +#include +using boost::math::lambert_w0; +using boost::math::lambert_wm1; +using boost::math::lambert_w0_prime; +using boost::math::lambert_wm1_prime; + +#include +using boost::math::isfinite; +#include +using namespace boost::svg; +#include +using boost::svg::show_2d_plot_settings; + +#include +// using std::cout; +// using std::endl; +#include +#include +#include +#include +#include +#include +using std::pair; +#include +using std::map; +#include +using std::multiset; +#include +using std::numeric_limits; +#include // + + /*! + */ +int main() +{ + try + { + std::cout << "Lambert W graph example." << std::endl; + +//[lambert_w_graph_1 +//] [/lambert_w_graph_1] + { + std::map wm1s; // Lambert W-1 branch values. + std::map w0s; // Lambert W0 branch values. + + std::cout.precision(std::numeric_limits::max_digits10); + + int count = 0; + for (double z = -0.36787944117144232159552377016146086744581113103176804; z < 2.8; z += 0.001) + { + double w0 = lambert_w0(z); + w0s[z] = w0; + // std::cout << "z " << z << ", w = " << w0 << std::endl; + count++; + } + std::cout << "points " << count << std::endl; + + count = 0; + for (double z = -0.3678794411714423215955237701614608727; z < -0.001; z += 0.001) + { + double wm1 = lambert_wm1(z); + wm1s[z] = wm1; + count++; + } + std::cout << "points " << count << std::endl; + + svg_2d_plot data_plot; + data_plot.title("Lambert W function.") + .x_size(400) + .y_size(300) + .legend_on(true) + .legend_lines(true) + .x_label("z") + .y_label("W") + .x_range(-1, 3.) + .y_range(-4., +1.) + .x_major_interval(1.) + .y_major_interval(1.) + .x_major_grid_on(true) + .y_major_grid_on(true) + //.x_values_on(true) + //.y_values_on(true) + .y_values_rotation(horizontal) + //.plot_window_on(true) + .x_values_precision(3) + .y_values_precision(3) + .coord_precision(4) // Needed to avoid stepping on curves. + .copyright_holder("Paul A. Bristow") + .copyright_date("2018") + //.background_border_color(black); + ; + data_plot.plot(w0s, "W0 branch").line_color(red).shape(none).line_on(true).bezier_on(false).line_width(1); + data_plot.plot(wm1s, "W-1 branch").line_color(blue).shape(none).line_on(true).bezier_on(false).line_width(1); + data_plot.write("./lambert_w_graph"); + + show_2d_plot_settings(data_plot); // For plot diagnosis only. + + } // small z Lambert W + + { // bigger argument z Lambert W + + std::map w0s_big; // Lambert W0 branch values for large z and W. + std::map wm1s_big; // Lambert W-1 branch values for small z and large -W. + int count = 0; + for (double z = -0.3678794411714423215955237701614608727; z < 10000.; z += 50.) + { + double w0 = lambert_w0(z); + w0s_big[z] = w0; + count++; + } + std::cout << "points " << count << std::endl; + + count = 0; + for (double z = -0.3678794411714423215955237701614608727; z < -0.001; z += 0.001) + { + double wm1 = lambert_wm1(z); + wm1s_big[z] = wm1; + count++; + } + std::cout << "Lambert W0 large z argument points = " << count << std::endl; + + svg_2d_plot data_plot2; + data_plot2.title("Lambert W0 function for larger z.") + .x_size(400) + .y_size(300) + .legend_on(false) + .x_label("z") + .y_label("W") + //.x_label_on(true) + //.y_label_on(true) + //.xy_values_on(false) + .x_range(-1, 10000.) + .y_range(-1., +8.) + .x_major_interval(2000.) + .y_major_interval(1.) + .x_major_grid_on(true) + .y_major_grid_on(true) + //.x_values_on(true) + //.y_values_on(true) + .y_values_rotation(horizontal) + //.plot_window_on(true) + .x_values_precision(3) + .y_values_precision(3) + .coord_precision(4) // Needed to avoid stepping on curves. + .copyright_holder("Paul A. Bristow") + .copyright_date("2018") + //.background_border_color(black); + ; + + data_plot2.plot(w0s_big, "W0 branch").line_color(red).shape(none).line_on(true).bezier_on(false).line_width(1); + // data_plot2.plot(wm1s_big, "W-1 branch").line_color(blue).shape(none).line_on(true).bezier_on(false).line_width(1); + // This wouldn't show anything useful. + data_plot2.write("./lambert_w_graph_big_w"); + } // Big argument z Lambert W + + { // Lambert W0 Derivative plots + + // std::map wm1ps; // Lambert W-1 prime branch values. + std::map w0ps; // Lambert W0 prime branch values. + + std::cout.precision(std::numeric_limits::max_digits10); + + int count = 0; + for (double z = -0.36; z < 3.; z += 0.001) + { + double w0p = lambert_w0_prime(z); + w0ps[z] = w0p; + // std::cout << "z " << z << ", w0 = " << w0 << std::endl; + count++; + } + std::cout << "points " << count << std::endl; + + //count = 0; + //for (double z = -0.36; z < -0.1; z += 0.001) + //{ + // double wm1p = lambert_wm1_prime(z); + // std::cout << "z " << z << ", w-1 = " << wm1p << std::endl; + // wm1ps[z] = wm1p; + // count++; + //} + //std::cout << "points " << count << std::endl; + + svg_2d_plot data_plotp; + data_plotp.title("Lambert W0 prime function.") + .x_size(400) + .y_size(300) + .legend_on(false) + .x_label("z") + .y_label("W0'") + .x_range(-0.3, +1.) + .y_range(0., +5.) + .x_major_interval(0.2) + .y_major_interval(2.) + .x_major_grid_on(true) + .y_major_grid_on(true) + .y_values_rotation(horizontal) + .x_values_precision(3) + .y_values_precision(3) + .coord_precision(4) // Needed to avoid stepping on curves. + .copyright_holder("Paul A. Bristow") + .copyright_date("2018") + ; + + // derivative of N[productlog(0, x), 55] at x=0 to 10 + // Plot[D[N[ProductLog[0, x], 55], x], {x, 0, 10}] + // Plot[ProductLog[x]/(x + x ProductLog[x]), {x, 0, 10}] + data_plotp.plot(w0ps, "W0 prime branch").line_color(red).shape(none).line_on(true).bezier_on(false).line_width(1); + data_plotp.write("./lambert_w0_prime_graph"); + } // Lambert W0 Derivative plots + + { // Lambert Wm1 Derivative plots + + std::map wm1ps; // Lambert W-1 prime branch values. + + std::cout.precision(std::numeric_limits::max_digits10); + + int count = 0; + for (double z = -0.3678; z < -0.00001; z += 0.001) + { + double wm1p = lambert_wm1_prime(z); + // std::cout << "z " << z << ", w-1 = " << wm1p << std::endl; + wm1ps[z] = wm1p; + count++; + } + std::cout << "Lambert W-1 prime points = " << count << std::endl; + + svg_2d_plot data_plotp; + data_plotp.title("Lambert W-1 prime function.") + .x_size(400) + .y_size(300) + .legend_on(false) + .x_label("z") + .y_label("W-1'") + .x_range(-0.4, +0.01) + .x_major_interval(0.1) + .y_range(-20., -5.) + .y_major_interval(5.) + .x_major_grid_on(true) + .y_major_grid_on(true) + .y_values_rotation(horizontal) + .x_values_precision(3) + .y_values_precision(3) + .coord_precision(4) // Needed to avoid stepping on curves. + .copyright_holder("Paul A. Bristow") + .copyright_date("2018") + ; + + // derivative of N[productlog(0, x), 55] at x=0 to 10 + // Plot[D[N[ProductLog[0, x], 55], x], {x, 0, 10}] + // Plot[ProductLog[x]/(x + x ProductLog[x]), {x, 0, 10}] + data_plotp.plot(wm1ps, "W-1 prime branch").line_color(blue).shape(none).line_on(true).bezier_on(false).line_width(1); + data_plotp.write("./lambert_wm1_prime_graph"); + } // Lambert W-1 prime graph + } // try + catch (std::exception& ex) + { + std::cout << ex.what() << std::endl; + } +} // int main() + + /* + + //[lambert_w_graph_1_output + + //] [/lambert_w_graph_1_output] + */ diff --git a/src/boost/libs/math/example/lambert_w_precision_example.cpp b/src/boost/libs/math/example/lambert_w_precision_example.cpp new file mode 100644 index 00000000..be4791bc --- /dev/null +++ b/src/boost/libs/math/example/lambert_w_precision_example.cpp @@ -0,0 +1,264 @@ +// Copyright Paul A. Bristow 2016, 2018. + +// Distributed under 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). + +//! Lambert W examples of controlling precision + +// #define BOOST_MATH_INSTRUMENT_LAMBERT_W // #define only for (much) diagnostic output. + +#include // for BOOST_PLATFORM, BOOST_COMPILER, BOOST_STDLIB ... +#include // for BOOST_MSVC versions. +#include +#include // boost::exception +#include // For exp_minus_one == 3.67879441171442321595523770161460867e-01. +#include +#include // for float_distance. +#include // for relative and epsilon difference. + +// Built-in/fundamental GCC float128 or Intel Quad 128-bit type, if available. +#ifdef BOOST_HAS_FLOAT128 +#include // Not available for MSVC. +// sets BOOST_MP_USE_FLOAT128 for GCC +using boost::multiprecision::float128; +#endif //# NOT _MSC_VER + +#include // boost::multiprecision::cpp_dec_float_50 +using boost::multiprecision::cpp_dec_float_50; // 50 decimal digits type. +using boost::multiprecision::cpp_dec_float_100; // 100 decimal digits type. + +#include +using boost::multiprecision::cpp_bin_float_double_extended; +using boost::multiprecision::cpp_bin_float_double; +using boost::multiprecision::cpp_bin_float_quad; +// For lambert_w function. +#include +// using boost::math::lambert_w0; +// using boost::math::lambert_wm1; + +#include +#include +#include +#include +#include // For std::numeric_limits. + +int main() +{ + try + { + std::cout << "Lambert W examples of precision control." << std::endl; + std::cout.precision(std::numeric_limits::max_digits10); + std::cout << std::showpoint << std::endl; // Show any trailing zeros. + + using boost::math::constants::exp_minus_one; + + using boost::math::lambert_w0; + using boost::math::lambert_wm1; + + // Error handling policy examples. + using namespace boost::math::policies; + using boost::math::policies::make_policy; + using boost::math::policies::policy; + using boost::math::policies::evaluation_error; + using boost::math::policies::domain_error; + using boost::math::policies::overflow_error; + using boost::math::policies::domain_error; + using boost::math::policies::throw_on_error; + +//[lambert_w_precision_reference_w + + using boost::multiprecision::cpp_bin_float_50; + using boost::math::float_distance; + + cpp_bin_float_50 z("10."); // Note use a decimal digit string, not a double 10. + cpp_bin_float_50 r; + std::cout.precision(std::numeric_limits::digits10); + + r = lambert_w0(z); // Default policy. + std::cout << "lambert_w0(z) cpp_bin_float_50 = " << r << std::endl; + //lambert_w0(z) cpp_bin_float_50 = 1.7455280027406993830743012648753899115352881290809 + // [N[productlog[10], 50]] == 1.7455280027406993830743012648753899115352881290809 + std::cout.precision(std::numeric_limits::max_digits10); + std::cout << "lambert_w0(z) static_cast from cpp_bin_float_50 = " + << static_cast(r) << std::endl; + // double lambert_w0(z) static_cast from cpp_bin_float_50 = 1.7455280027406994 + // [N[productlog[10], 17]] == 1.7455280027406994 + std::cout << "bits different from Wolfram = " + << static_cast(float_distance(static_cast(r), 1.7455280027406994)) + << std::endl; // 0 + + +//] [/lambert_w_precision_reference_w] + +//[lambert_w_precision_0 + std::cout.precision(std::numeric_limits::max_digits10); // Show all potentially significant decimal digits, + std::cout << std::showpoint << std::endl; // and show any significant trailing zeros too. + + float x = 10.; + std::cout << "Lambert W (" << x << ") = " << lambert_w0(x) << std::endl; +//] [/lambert_w_precision_0] + +/* +//[lambert_w_precision_output_0 +Lambert W (10.0000000) = 1.74552800 +//] [/lambert_w_precision_output_0] +*/ + { // Lambert W0 Halley step example +//[lambert_w_precision_1 + using boost::math::lambert_w_detail::lambert_w_halley_step; + using boost::math::epsilon_difference; + using boost::math::relative_difference; + + std::cout << std::showpoint << std::endl; // and show any significant trailing zeros too. + std::cout.precision(std::numeric_limits::max_digits10); // 17 decimal digits for double. + + cpp_bin_float_50 z50("1.23"); // Note: use a decimal digit string, not a double 1.23! + double z = static_cast(z50); + cpp_bin_float_50 w50; + w50 = lambert_w0(z50); + std::cout.precision(std::numeric_limits::max_digits10); // 50 decimal digits. + std::cout << "Reference Lambert W (" << z << ") =\n " + << w50 << std::endl; + std::cout.precision(std::numeric_limits::max_digits10); // 17 decimal digits for double. + double wr = static_cast(w50); + std::cout << "Reference Lambert W (" << z << ") = " << wr << std::endl; + + double w = lambert_w0(z); + std::cout << "Rat/poly Lambert W (" << z << ") = " << lambert_w0(z) << std::endl; + // Add a Halley step to the value obtained from rational polynomial approximation. + double ww = lambert_w_halley_step(lambert_w0(z), z); + std::cout << "Halley Step Lambert W (" << z << ") = " << lambert_w_halley_step(lambert_w0(z), z) << std::endl; + + std::cout << "absolute difference from Halley step = " << w - ww << std::endl; + std::cout << "relative difference from Halley step = " << relative_difference(w, ww) << std::endl; + std::cout << "epsilon difference from Halley step = " << epsilon_difference(w, ww) << std::endl; + std::cout << "epsilon for float = " << std::numeric_limits::epsilon() << std::endl; + std::cout << "bits different from Halley step = " << static_cast(float_distance(w, ww)) << std::endl; +//] [/lambert_w_precision_1] + + +/* +//[lambert_w_precision_output_1 + Reference Lambert W (1.2299999999999999822364316059974953532218933105468750) = + 0.64520356959320237759035605255334853830173300262666480 + Reference Lambert W (1.2300000000000000) = 0.64520356959320235 + Rat/poly Lambert W (1.2300000000000000) = 0.64520356959320224 + Halley Step Lambert W (1.2300000000000000) = 0.64520356959320235 + absolute difference from Halley step = -1.1102230246251565e-16 + relative difference from Halley step = 1.7207329236029286e-16 + epsilon difference from Halley step = 0.77494921535422934 + epsilon for float = 2.2204460492503131e-16 + bits different from Halley step = 1 +//] [/lambert_w_precision_output_1] +*/ + + } // Lambert W0 Halley step example + + { // Lambert W-1 Halley step example + //[lambert_w_precision_2 + using boost::math::lambert_w_detail::lambert_w_halley_step; + using boost::math::epsilon_difference; + using boost::math::relative_difference; + + std::cout << std::showpoint << std::endl; // and show any significant trailing zeros too. + std::cout.precision(std::numeric_limits::max_digits10); // 17 decimal digits for double. + + cpp_bin_float_50 z50("-0.123"); // Note: use a decimal digit string, not a double -1.234! + double z = static_cast(z50); + cpp_bin_float_50 wm1_50; + wm1_50 = lambert_wm1(z50); + std::cout.precision(std::numeric_limits::max_digits10); // 50 decimal digits. + std::cout << "Reference Lambert W-1 (" << z << ") =\n " + << wm1_50 << std::endl; + std::cout.precision(std::numeric_limits::max_digits10); // 17 decimal digits for double. + double wr = static_cast(wm1_50); + std::cout << "Reference Lambert W-1 (" << z << ") = " << wr << std::endl; + + double w = lambert_wm1(z); + std::cout << "Rat/poly Lambert W-1 (" << z << ") = " << lambert_wm1(z) << std::endl; + // Add a Halley step to the value obtained from rational polynomial approximation. + double ww = lambert_w_halley_step(lambert_wm1(z), z); + std::cout << "Halley Step Lambert W (" << z << ") = " << lambert_w_halley_step(lambert_wm1(z), z) << std::endl; + + std::cout << "absolute difference from Halley step = " << w - ww << std::endl; + std::cout << "relative difference from Halley step = " << relative_difference(w, ww) << std::endl; + std::cout << "epsilon difference from Halley step = " << epsilon_difference(w, ww) << std::endl; + std::cout << "epsilon for float = " << std::numeric_limits::epsilon() << std::endl; + std::cout << "bits different from Halley step = " << static_cast(float_distance(w, ww)) << std::endl; + //] [/lambert_w_precision_2] + } + /* + //[lambert_w_precision_output_2 + Reference Lambert W-1 (-0.12299999999999999822364316059974953532218933105468750) = + -3.2849102557740360179084675531714935199110302996513384 + Reference Lambert W-1 (-0.12300000000000000) = -3.2849102557740362 + Rat/poly Lambert W-1 (-0.12300000000000000) = -3.2849102557740357 + Halley Step Lambert W (-0.12300000000000000) = -3.2849102557740362 + absolute difference from Halley step = 4.4408920985006262e-16 + relative difference from Halley step = 1.3519066740696092e-16 + epsilon difference from Halley step = 0.60884463935795785 + epsilon for float = 2.2204460492503131e-16 + bits different from Halley step = -1 + //] [/lambert_w_precision_output_2] + */ + + + + // Similar example using cpp_bin_float_quad (128-bit floating-point types). + + cpp_bin_float_quad zq = 10.; + std::cout << "\nTest evaluation of cpp_bin_float_quad Lambert W(" << zq << ")" + << std::endl; + std::cout << std::setprecision(3) << "std::numeric_limits::digits = " << std::numeric_limits::digits << std::endl; + std::cout << std::setprecision(3) << "std::numeric_limits::epsilon() = " << std::numeric_limits::epsilon() << std::endl; + std::cout << std::setprecision(3) << "std::numeric_limits::max_digits10 = " << std::numeric_limits::max_digits10 << std::endl; + std::cout << std::setprecision(3) << "std::numeric_limits::digits10 = " << std::numeric_limits::digits10 << std::endl; + std::cout.precision(std::numeric_limits::max_digits10); + // All are same precision because double precision first approximation used before Halley. + + /* + + */ + + { // Reference value for lambert_w0(10) + cpp_dec_float_50 z("10"); + cpp_dec_float_50 r; + std::cout.precision(std::numeric_limits::digits10); + + r = lambert_w0(z); // Default policy. + std::cout << "lambert_w0(z) cpp_dec_float_50 = " << r << std::endl; // 0.56714329040978387299996866221035554975381578718651 + std::cout.precision(std::numeric_limits::max_digits10); + + std::cout << "lambert_w0(z) cpp_dec_float_50 cast to quad (max_digits10(" << std::numeric_limits::max_digits10 << + " ) = " << static_cast(r) << std::endl; // 1.7455280027406993830743012648753899115352881290809 + std::cout.precision(std::numeric_limits::digits10); // 1.745528002740699383074301264875389837 + std::cout << "lambert_w0(z) cpp_dec_float_50 cast to quad (digits10(" << std::numeric_limits::digits10 << + " ) = " << static_cast(r) << std::endl; // 1.74552800274069938307430126487539 + std::cout.precision(std::numeric_limits::digits10 + 1); // + + std::cout << "lambert_w0(z) cpp_dec_float_50 cast to quad (digits10(" << std::numeric_limits::digits10 << + " ) = " << static_cast(r) << std::endl; // 1.74552800274069938307430126487539 + + // [N[productlog[10], 50]] == 1.7455280027406993830743012648753899115352881290809 + + // [N[productlog[10], 37]] == 1.745528002740699383074301264875389912 + // [N[productlog[10], 34]] == 1.745528002740699383074301264875390 + // [N[productlog[10], 33]] == 1.74552800274069938307430126487539 + + // lambert_w0(z) cpp_dec_float_50 cast to quad = 1.745528002740699383074301264875389837 + + // lambert_w0(z) cpp_dec_float_50 = 1.7455280027406993830743012648753899115352881290809 + // lambert_w0(z) cpp_dec_float_50 cast to quad = 1.745528002740699383074301264875389837 + // lambert_w0(z) cpp_dec_float_50 cast to quad = 1.74552800274069938307430126487539 + } + } + catch (std::exception& ex) + { + std::cout << ex.what() << std::endl; + } +} // int main() + + + + diff --git a/src/boost/libs/math/example/lambert_w_simple_examples.cpp b/src/boost/libs/math/example/lambert_w_simple_examples.cpp new file mode 100644 index 00000000..d7a4416e --- /dev/null +++ b/src/boost/libs/math/example/lambert_w_simple_examples.cpp @@ -0,0 +1,251 @@ +// Copyright Paul A. Bristow 2016, 2017. + +// Distributed under 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). + +// Build and run a simple examples of Lambert W function. + +// Some macros that will show some(or much) diagnostic values if #defined. +//#define-able macros +//#define BOOST_MATH_INSTRUMENT_LAMBERT_W0 // W0 branch diagnostics. +//#define BOOST_MATH_INSTRUMENT_LAMBERT_Wm1 // W1 branch diagnostics. +//#define BOOST_MATH_INSTRUMENT_LAMBERT_W_HALLEY // Halley refinement diagnostics. +//#define BOOST_MATH_INSTRUMENT_LAMBERT_W_SCHROEDER // Schroeder refinement diagnostics. +//#define BOOST_MATH_INSTRUMENT_LAMBERT_W_TERMS // Number of terms used for near-singularity series. +//#define BOOST_MATH_INSTRUMENT_LAMBERT_W0_NOT_BUILTIN // higher than built-in precision types approximation and refinement. +//#define BOOST_MATH_INSTRUMENT_LAMBERT_W_SINGULARITY_SERIES // Show evaluation of series near branch singularity. +//#define BOOST_MATH_INSTRUMENT_LAMBERT_W_SMALL_Z_SERIES_ITERATIONS // Show evaluation of series for small z. +//#define BOOST_MATH_INSTRUMENT_LAMBERT_W0_LOOKUP // Show results from lookup table. + +#include // for BOOST_PLATFORM, BOOST_COMPILER, BOOST_STDLIB ... +#include // for BOOST_MSVC versions. +#include +#include // boost::exception +#include // For exp_minus_one == 3.67879441171442321595523770161460867e-01. +#include + +#include // boost::multiprecision::cpp_dec_float_50 +using boost::multiprecision::cpp_dec_float_50; // 50 decimal digits type. +using boost::multiprecision::cpp_dec_float_100; // 100 decimal digits type. +using boost::multiprecision::backends::cpp_dec_float; +using boost::multiprecision::number; +typedef number > cpp_dec_float_1000; // 1000 decimal digit types + +#include +using boost::multiprecision::cpp_bin_float_double; // == double +using boost::multiprecision::cpp_bin_float_double_extended; // 80-bit long double emulation. +using boost::multiprecision::cpp_bin_float_quad; // 128-bit quad precision. + +//[lambert_w_simple_examples_includes +#include // For lambert_w function. + +using boost::math::lambert_w0; +using boost::math::lambert_wm1; +//] //[/lambert_w_simple_examples_includes] + +#include +// using std::cout; +// using std::endl; +#include +#include +#include +#include // For std::numeric_limits. + +//! Show value of z to the full possibly-significant max_digits10 precision of type T. +template +void show_value(T z) +{ + std::streamsize precision = std::cout.precision(std::numeric_limits::max_digits10); // Save. + std::cout.precision(std::numeric_limits::max_digits10); // Show all posssibly significant digits. + std::ios::fmtflags flags(std::cout.flags()); + std::cout.setf(std::ios_base::showpoint); // Include any trailing zeros. + std::cout << z; + // Restore: + std::cout.precision(precision); + std::cout.flags(flags); +} // template void show_value(T z) + +int main() +{ + try + { + std::cout << "Lambert W simple examples." << std::endl; + + using boost::math::constants::exp_minus_one; //-1/e, the branch point, a singularity ~= -0.367879. + + // using statements needed for changing error handling policy. + using boost::math::policies::policy; + using boost::math::policies::make_policy; + using boost::math::policies::evaluation_error; + using boost::math::policies::domain_error; + using boost::math::policies::overflow_error; + using boost::math::policies::ignore_error; + using boost::math::policies::throw_on_error; + + { +//[lambert_w_simple_examples_0 + std::cout.precision(std::numeric_limits::max_digits10); + // Show all potentially significant decimal digits, + std::cout << std::showpoint << std::endl; + // and show significant trailing zeros too. + + double z = 10.; + double r = lambert_w0(z); // Default policy for double. + std::cout << "lambert_w0(z) = " << r << std::endl; + // lambert_w0(z) = 1.7455280027406994 +//] [/lambert_w_simple_examples_0] + } + { + // Other floating-point types can be used too, here float. + // It is convenient to use a function like `show_value` + // to display all potentially significant decimal digits + // for the type, including any significant trailing zeros. + //[lambert_w_simple_examples_1 + float z = 10.F; + float r; + r = lambert_w0(z); // Default policy digits10 = 7, digits2 = 24 + std::cout << "lambert_w0("; + show_value(z); + std::cout << ") = "; + show_value(r); + std::cout << std::endl; // lambert_w0(10.0000000) = 1.74552798 + //] //[/lambert_w_simple_examples_1] + } + { + // Example of an integer argument to lambert_w, + // showing that an integer is correctly promoted to a double. +//[lambert_w_simple_examples_2 + std::cout.precision(std::numeric_limits::max_digits10); + double r = lambert_w0(10); // Pass an int argument "10" that should be promoted to double argument. + std::cout << "lambert_w0(10) = " << r << std::endl; // lambert_w0(10) = 1.7455280027406994 + double rp = lambert_w0(10); + std::cout << "lambert_w0(10) = " << rp << std::endl; + // lambert_w0(10) = 1.7455280027406994 + auto rr = lambert_w0(10); // C++11 needed. + std::cout << "lambert_w0(10) = " << rr << std::endl; + // lambert_w0(10) = 1.7455280027406994 too, showing that rr has been promoted to double. +//] //[/lambert_w_simple_examples_2] + } + { + // Using multiprecision types to get much higher precision is painless. + //[lambert_w_simple_examples_3 + cpp_dec_float_50 z("10"); + // Note construction using a decimal digit string "10", + // NOT a floating-point double literal 10. + cpp_dec_float_50 r; + r = lambert_w0(z); + std::cout << "lambert_w0("; show_value(z); std::cout << ") = "; + show_value(r); + std::cout << std::endl; + // lambert_w0(10.000000000000000000000000000000000000000000000000000000000000000000000000000000) = + // 1.7455280027406993830743012648753899115352881290809413313533156980404446940000000 + //] //[/lambert_w_simple_examples_3] + } + // Using multiprecision types to get multiprecision precision wrong! + { + //[lambert_w_simple_examples_4 + cpp_dec_float_50 z(0.7777777777777777777777777777777777777777777777777777777777777777777777777); + // Compiler evaluates the nearest double-precision binary representation, + // from the max_digits10 of the floating_point literal double 0.7777777777777777777777777777..., + // so any extra digits in the multiprecision type + // beyond max_digits10 (usually 17) are random and meaningless. + cpp_dec_float_50 r; + r = lambert_w0(z); + std::cout << "lambert_w0("; + show_value(z); + std::cout << ") = "; show_value(r); + std::cout << std::endl; + // lambert_w0(0.77777777777777779011358916250173933804035186767578125000000000000000000000000000) + // = 0.48086152073210493501934682309060873341910109230469724725005039758139532631901386 + //] //[/lambert_w_simple_examples_4] + } + { + //[lambert_w_simple_examples_4a + cpp_dec_float_50 z(0.9); // Construct from floating_point literal double 0.9. + cpp_dec_float_50 r; + r = lambert_w0(0.9); + std::cout << "lambert_w0("; + show_value(z); + std::cout << ") = "; show_value(r); + std::cout << std::endl; + // lambert_w0(0.90000000000000002220446049250313080847263336181640625000000000000000000000000000) + // = 0.52983296563343440510607251781038939952850341796875000000000000000000000000000000 + std::cout << "lambert_w0(0.9) = " << lambert_w0(static_cast(0.9)) + // lambert_w0(0.9) + // = 0.52983296563343441 + << std::endl; + //] //[/lambert_w_simple_examples_4a] + } + { + // Using multiprecision types to get multiprecision precision right! + //[lambert_w_simple_examples_4b + cpp_dec_float_50 z("0.9"); // Construct from decimal digit string. + cpp_dec_float_50 r; + r = lambert_w0(z); + std::cout << "lambert_w0("; + show_value(z); + std::cout << ") = "; show_value(r); + std::cout << std::endl; + // 0.90000000000000000000000000000000000000000000000000000000000000000000000000000000) + // = 0.52983296563343441213336643954546304857788132269804249284012528304239956413801252 + //] //[/lambert_w_simple_examples_4b] + } + // Getting extreme precision (1000 decimal digits) Lambert W values. + { + std::cout.precision(std::numeric_limits::digits10); + cpp_dec_float_1000 z("2.0"); + cpp_dec_float_1000 r; + r = lambert_w0(z); + std::cout << "lambert_w0(z) = " << r << std::endl; + // 0.8526055020137254913464724146953174668984533001514035087721073946525150656742630448965773783502494847334503972691804119834761668851953598826198984364998343940330324849743119327028383008883133161249045727544669202220292076639777316648311871183719040610274221013237163543451621208284315007250267190731048119566857455987975973474411544571619699938899354169616378479326962044241495398851839432070255805880208619490399218130868317114428351234208216131218024303904457925834743326836272959669122797896855064630871955955318383064292191644322931561534814178034773896739684452724587331245831001449498844495771266728242975586931792421997636537572767708722190588748148949667744956650966402600446780664924889043543203483210769017254907808218556111831854276511280553252641907484685164978750601216344998778097446525021666473925144772131644151718261199915247932015387685261438125313159125475113124470774926288823525823567568542843625471594347837868505309329628014463491611881381186810879712667681285740515197493390563 + // Wolfram alpha command N[productlog[0, 2.0],1000] gives the identical result: + // 0.8526055020137254913464724146953174668984533001514035087721073946525150656742630448965773783502494847334503972691804119834761668851953598826198984364998343940330324849743119327028383008883133161249045727544669202220292076639777316648311871183719040610274221013237163543451621208284315007250267190731048119566857455987975973474411544571619699938899354169616378479326962044241495398851839432070255805880208619490399218130868317114428351234208216131218024303904457925834743326836272959669122797896855064630871955955318383064292191644322931561534814178034773896739684452724587331245831001449498844495771266728242975586931792421997636537572767708722190588748148949667744956650966402600446780664924889043543203483210769017254907808218556111831854276511280553252641907484685164978750601216344998778097446525021666473925144772131644151718261199915247932015387685261438125313159125475113124470774926288823525823567568542843625471594347837868505309329628014463491611881381186810879712667681285740515197493390563 + } + { +//[lambert_w_simple_examples_error_policies + // Define an error handling policy: + typedef policy< + domain_error, + overflow_error // possibly unwise? + > my_throw_policy; + + std::cout.precision(std::numeric_limits::max_digits10); + // Show all potentially significant decimal digits, + std::cout << std::showpoint << std::endl; + // and show significant trailing zeros too. + double z = +1; + std::cout << "Lambert W (" << z << ") = " << lambert_w0(z) << std::endl; + // Lambert W (1.0000000000000000) = 0.56714329040978384 + std::cout << "\nLambert W (" << z << ", my_throw_policy()) = " + << lambert_w0(z, my_throw_policy()) << std::endl; + // Lambert W (1.0000000000000000, my_throw_policy()) = 0.56714329040978384 + //] //[/lambert_w_simple_example_error_policies] + } + { + // Show error reporting from passing a value to lambert_wm1 that is out of range, + // (and probably was meant to be passed to lambert_0 instead). +//[lambert_w_simple_examples_out_of_range + double z = +1.; + double r = lambert_wm1(z); + std::cout << "lambert_wm1(+1.) = " << r << std::endl; + //] [/lambert_w_simple_examples_out_of_range] + // Error in function boost::math::lambert_wm1(): + // Argument z = 1 is out of range (z <= 0) for Lambert W-1 branch! (Try Lambert W0 branch?) + } + } + catch (std::exception& ex) + { + std::cout << ex.what() << std::endl; + } +} // int main() + + /* + + Output: +//[lambert_w_simple_examples_error_message_1 +Error in function boost::math::lambert_wm1(): +Argument z = 1 is out of range (z <= 0) for Lambert W-1 branch! (Try Lambert W0 branch?) +//] [/lambert_w_simple_examples_error_message_1] + + */ diff --git a/src/boost/libs/math/example/laplace_example.cpp b/src/boost/libs/math/example/laplace_example.cpp new file mode 100644 index 00000000..ed99dba2 --- /dev/null +++ b/src/boost/libs/math/example/laplace_example.cpp @@ -0,0 +1,169 @@ +// laplace_example.cpp + +// Copyright Paul A. Bristow 2008, 2010. + +// 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) + +// Example of using laplace (& comparing with normal) distribution. + +// Note that this file contains Quickbook mark-up as well as code +// and comments, don't change any of the special comment mark-ups! + +//[laplace_example1 +/*` +First we need some includes to access the laplace & normal distributions +(and some std output of course). +*/ + +#include // for laplace_distribution + using boost::math::laplace; // typedef provides default type is double. +#include // for normal_distribution + using boost::math::normal; // typedef provides default type is double. + +#include + using std::cout; using std::endl; using std::left; using std::showpoint; using std::noshowpoint; +#include + using std::setw; using std::setprecision; +#include + using std::numeric_limits; + +int main() +{ + cout << "Example: Laplace distribution." << endl; + + try + { + { // Traditional tables and values. +/*`Let's start by printing some traditional tables. +*/ + double step = 1.; // in z + double range = 4; // min and max z = -range to +range. + //int precision = 17; // traditional tables are only computed to much lower precision. + int precision = 4; // traditional table at much lower precision. + int width = 10; // for use with setw. + + // Construct standard laplace & normal distributions l & s + normal s; // (default location or mean = zero, and scale or standard deviation = unity) + cout << "Standard normal distribution, mean or location = "<< s.location() + << ", standard deviation or scale = " << s.scale() << endl; + laplace l; // (default mean = zero, and standard deviation = unity) + cout << "Laplace normal distribution, location = "<< l.location() + << ", scale = " << l.scale() << endl; + +/*` First the probability distribution function (pdf). +*/ + cout << "Probability distribution function values" << endl; + cout << " z PDF normal laplace (difference)" << endl; + cout.precision(5); + for (double z = -range; z < range + step; z += step) + { + cout << left << setprecision(3) << setw(6) << z << " " + << setprecision(precision) << setw(width) << pdf(s, z) << " " + << setprecision(precision) << setw(width) << pdf(l, z)<< " (" + << setprecision(precision) << setw(width) << pdf(l, z) - pdf(s, z) // difference. + << ")" << endl; + } + cout.precision(6); // default +/*`Notice how the laplace is less at z = 1 , but has 'fatter' tails at 2 and 3. + + And the area under the normal curve from -[infin] up to z, + the cumulative distribution function (cdf). +*/ + // For a standard distribution + cout << "Standard location = "<< s.location() + << ", scale = " << s.scale() << endl; + cout << "Integral (area under the curve) from - infinity up to z " << endl; + cout << " z CDF normal laplace (difference)" << endl; + for (double z = -range; z < range + step; z += step) + { + cout << left << setprecision(3) << setw(6) << z << " " + << setprecision(precision) << setw(width) << cdf(s, z) << " " + << setprecision(precision) << setw(width) << cdf(l, z) << " (" + << setprecision(precision) << setw(width) << cdf(l, z) - cdf(s, z) // difference. + << ")" << endl; + } + cout.precision(6); // default + +/*` +Pretty-printing a traditional 2-dimensional table is left as an exercise for the student, +but why bother now that the Boost Math Toolkit lets you write +*/ + double z = 2.; + cout << "Area for gaussian z = " << z << " is " << cdf(s, z) << endl; // to get the area for z. + cout << "Area for laplace z = " << z << " is " << cdf(l, z) << endl; // +/*` +Correspondingly, we can obtain the traditional 'critical' values for significance levels. +For the 95% confidence level, the significance level usually called alpha, +is 0.05 = 1 - 0.95 (for a one-sided test), so we can write +*/ + cout << "95% of gaussian area has a z below " << quantile(s, 0.95) << endl; + cout << "95% of laplace area has a z below " << quantile(l, 0.95) << endl; + // 95% of area has a z below 1.64485 + // 95% of laplace area has a z below 2.30259 +/*`and a two-sided test (a comparison between two levels, rather than a one-sided test) + +*/ + cout << "95% of gaussian area has a z between " << quantile(s, 0.975) + << " and " << -quantile(s, 0.975) << endl; + cout << "95% of laplace area has a z between " << quantile(l, 0.975) + << " and " << -quantile(l, 0.975) << endl; + // 95% of area has a z between 1.95996 and -1.95996 + // 95% of laplace area has a z between 2.99573 and -2.99573 +/*`Notice how much wider z has to be to enclose 95% of the area. +*/ + } +//] [/[laplace_example1] + } + catch(const std::exception& e) + { // Always useful to include try & catch blocks because default policies + // are to throw exceptions on arguments that cause errors like underflow, overflow. + // Lacking try & catch blocks, the program will abort without a message below, + // which may give some helpful clues as to the cause of the exception. + std::cout << + "\n""Message from thrown exception was:\n " << e.what() << std::endl; + } + return 0; +} // int main() + +/* + +Output is: + +Example: Laplace distribution. +Standard normal distribution, mean or location = 0, standard deviation or scale = 1 +Laplace normal distribution, location = 0, scale = 1 +Probability distribution function values + z PDF normal laplace (difference) +-4 0.0001338 0.009158 (0.009024 ) +-3 0.004432 0.02489 (0.02046 ) +-2 0.05399 0.06767 (0.01368 ) +-1 0.242 0.1839 (-0.05803 ) +0 0.3989 0.5 (0.1011 ) +1 0.242 0.1839 (-0.05803 ) +2 0.05399 0.06767 (0.01368 ) +3 0.004432 0.02489 (0.02046 ) +4 0.0001338 0.009158 (0.009024 ) +Standard location = 0, scale = 1 +Integral (area under the curve) from - infinity up to z + z CDF normal laplace (difference) +-4 3.167e-005 0.009158 (0.009126 ) +-3 0.00135 0.02489 (0.02354 ) +-2 0.02275 0.06767 (0.04492 ) +-1 0.1587 0.1839 (0.02528 ) +0 0.5 0.5 (0 ) +1 0.8413 0.8161 (-0.02528 ) +2 0.9772 0.9323 (-0.04492 ) +3 0.9987 0.9751 (-0.02354 ) +4 1 0.9908 (-0.009126 ) +Area for gaussian z = 2 is 0.97725 +Area for laplace z = 2 is 0.932332 +95% of gaussian area has a z below 1.64485 +95% of laplace area has a z below 2.30259 +95% of gaussian area has a z between 1.95996 and -1.95996 +95% of laplace area has a z between 2.99573 and -2.99573 + +*/ + diff --git a/src/boost/libs/math/example/legendre_stieltjes_example.cpp b/src/boost/libs/math/example/legendre_stieltjes_example.cpp new file mode 100644 index 00000000..00ceba27 --- /dev/null +++ b/src/boost/libs/math/example/legendre_stieltjes_example.cpp @@ -0,0 +1,110 @@ +// Copyright Nick Thompson 2017. +// 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::math::legendre_p; +using boost::math::legendre_p_zeros; +using boost::math::legendre_p_prime; +using boost::math::legendre_stieltjes; +using boost::multiprecision::cpp_bin_float_quad; +using boost::multiprecision::cpp_bin_float_100; +using boost::multiprecision::cpp_dec_float_100; + +template +void gauss_kronrod_rule(size_t order) +{ + std::cout << std::setprecision(std::numeric_limits::digits10); + std::cout << std::fixed; + auto gauss_nodes = boost::math::legendre_p_zeros(order); + auto E = legendre_stieltjes(order + 1); + std::vector gauss_weights(gauss_nodes.size(), std::numeric_limits::quiet_NaN()); + std::vector gauss_kronrod_weights(gauss_nodes.size(), std::numeric_limits::quiet_NaN()); + for (size_t i = 0; i < gauss_nodes.size(); ++i) + { + Real node = gauss_nodes[i]; + Real lp = legendre_p_prime(order, node); + gauss_weights[i] = 2/( (1-node*node)*lp*lp); + // P_n(x) = (2n)!/(2^n (n!)^2) pi_n(x), where pi_n is the monic Legendre polynomial. + gauss_kronrod_weights[i] = gauss_weights[i] + static_cast(2)/(static_cast(order+1)*legendre_p_prime(order, node)*E(node)); + } + + std::cout << "static const std::vector gauss_nodes {\n"; + for (auto const & node : gauss_nodes) + { + std::cout << " boost::lexical_cast(\"" << node << "\"),\n"; + } + std::cout << "};\n\n"; + + std::cout << "static const std::vector gauss_weights {\n"; + for (auto const & weight : gauss_weights) + { + std::cout << " boost::lexical_cast(\"" << weight << "\"),\n"; + } + std::cout << "};\n\n"; + + std::cout << "static const std::vector gauss_kronrod_weights {\n"; + for (auto const & weight : gauss_kronrod_weights) + { + std::cout << " boost::lexical_cast(\"" << weight << "\"),\n"; + } + std::cout << "};\n\n"; + + auto kronrod_nodes = E.zeros(); + std::vector kronrod_weights(kronrod_nodes.size()); + for (size_t i = 0; i < kronrod_weights.size(); ++i) + { + Real node = kronrod_nodes[i]; + kronrod_weights[i] = static_cast(2)/(static_cast(order+1)*legendre_p(order, node)*E.prime(node)); + } + + std::cout << "static const std::vector kronrod_nodes {\n"; + for (auto node : kronrod_nodes) + { + std::cout << " boost::lexical_cast(\"" << node << "\"),\n"; + } + std::cout << "};\n\n"; + + std::cout << "static const std::vector kronrod_weights {\n"; + for (auto const & weight : kronrod_weights) + { + std::cout << " boost::lexical_cast(\"" << weight << "\"),\n"; + } + std::cout << "};\n\n"; + +} + +int main() +{ + //std::cout << "Gauss-Kronrod 7-15 Rule:\n"; + //gauss_kronrod_rule(7); + + //std::cout << "\n\nGauss-Kronrod 10-21 Rule:\n"; + //gauss_kronrod_rule(10); + + std::cout << "\n\nGauss-Kronrod 15-31 Rule:\n"; + gauss_kronrod_rule(15); + /* + std::cout << "\n\nGauss-Kronrod 20-41 Rule:\n"; + gauss_kronrod_rule(20); + + std::cout << "\n\nGauss-Kronrod 25-51 Rule:\n"; + gauss_kronrod_rule(25); + + std::cout << "\n\nGauss-Kronrod 30-61 Rule:\n"; + gauss_kronrod_rule(30); + + std::cout << "\n\nGauss-Kronrod 35-71 Rule:\n"; + gauss_kronrod_rule(35); + + std::cout << "\n\nGauss-Kronrod 40-81 Rule:\n"; + gauss_kronrod_rule(40);*/ +} diff --git a/src/boost/libs/math/example/lexical_cast_native.cpp b/src/boost/libs/math/example/lexical_cast_native.cpp new file mode 100644 index 00000000..aaee6b5d --- /dev/null +++ b/src/boost/libs/math/example/lexical_cast_native.cpp @@ -0,0 +1,133 @@ +/** lexical_cast_nonfinite_facets.cpp +* +* Copyright (c) 2011 Paul A. Bristow +* +* Distributed under 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) +* +* This very simple program illustrates how to use the +* `boost/math/nonfinite_num_facets.hpp' with lexical cast +* to obtain C99 representation of infinity and NaN. +* This example is from the original Floating Point Utilities contribution by Johan Rade. +* Floating Point Utility library has been accepted into Boost, +* but the utilities are incorporated into Boost.Math library. +* +\file + +\brief A very simple example of using lexical cast with +non_finite_num facet for C99 standard output of infinity and NaN. + +\detail This example shows how to create a C99 non-finite locale, +and imbue input and output streams with the non_finite_num put and get facets. +This allows lexical_cast output and input of infinity and NaN in a Standard portable way, +This permits 'loop-back' of output back into input (and portably across different system too). + +*/ + +#include +using boost::math::nonfinite_num_get; +using boost::math::nonfinite_num_put; + +#include +using boost::lexical_cast; + +#include +using std::cout; +using std::endl; +using std::cerr; + +#include +using std::setw; +using std::left; +using std::right; +using std::internal; + +#include +using std::string; + +#include +using std::istringstream; + +#include +using std::numeric_limits; + +#include +using std::locale; + +#include + +int main () +{ + std::cout << "lexical_cast example (NOT using finite_num_facet)." << std::endl; + + if((std::numeric_limits::has_infinity == false) || (std::numeric_limits::infinity() == 0)) + { + std::cout << "Infinity not supported on this platform." << std::endl; + return 0; + } + + if((std::numeric_limits::has_quiet_NaN == false) || (std::numeric_limits::quiet_NaN() == 0)) + { + std::cout << "NaN not supported on this platform." << std::endl; + return 0; + } + + // Some tests that are expected to fail on some platforms. + // (But these tests are expected to pass using non_finite num_put and num_get facets). + + // Use the current 'native' default locale. + std::locale default_locale (std::locale::classic ()); // Note the currrent (default C) locale. + + // Create plus and minus infinity. + double plus_infinity = +std::numeric_limits::infinity(); + double minus_infinity = -std::numeric_limits::infinity(); + + // and create a NaN (NotANumber). + double NaN = +std::numeric_limits::quiet_NaN (); + + // Output the nonfinite values using the current (default C) locale. + // The default representations differ from system to system, + // for example, using Microsoft compilers, 1.#INF, -1.#INF, and 1.#QNAN. + cout << "Using default locale" << endl; + cout << "+std::numeric_limits::infinity() = " << plus_infinity << endl; + cout << "-std::numeric_limits::infinity() = " << minus_infinity << endl; + cout << "+std::numeric_limits::quiet_NaN () = " << NaN << endl; + + // Checks below are expected to fail on some platforms! + + // Now try some 'round-tripping', 'reading' "inf" + double x = boost::lexical_cast("inf"); + // and check we get a floating-point infinity. + BOOST_ASSERT(x == std::numeric_limits::infinity()); + + // Check we can convert the other way from floating-point infinity, + string s = boost::lexical_cast(numeric_limits::infinity()); + // to a C99 string representation as "inf". + BOOST_ASSERT(s == "inf"); + + // Finally try full 'round-tripping' (in both directions): + BOOST_ASSERT(lexical_cast(lexical_cast(numeric_limits::infinity())) + == numeric_limits::infinity()); + BOOST_ASSERT(lexical_cast(lexical_cast("inf")) == "inf"); + + return 0; +} // int main() + +/* + +Output: + +from MSVC 10, fails (as expected) + + lexical_cast_native.vcxproj -> J:\Cpp\fp_facet\fp_facet\Debug\lexical_cast_native.exe + lexical_cast example (NOT using finite_num_facet). + Using default locale + +std::numeric_limits::infinity() = 1.#INF + -std::numeric_limits::infinity() = -1.#INF + +std::numeric_limits::quiet_NaN () = 1.#QNAN +C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(183,5): error MSB3073: The command ""J:\Cpp\fp_facet\fp_facet\Debug\lexical_cast_native.exe" +C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(183,5): error MSB3073: :VCEnd" exited with code 3. + + +*/ diff --git a/src/boost/libs/math/example/lexical_cast_nonfinite_facets.cpp b/src/boost/libs/math/example/lexical_cast_nonfinite_facets.cpp new file mode 100644 index 00000000..ecbda89a --- /dev/null +++ b/src/boost/libs/math/example/lexical_cast_nonfinite_facets.cpp @@ -0,0 +1,133 @@ +/** lexical_cast_nonfinite_facets.cpp +* +* Copyright (c) 2011 Paul A. Bristow +* +* Distributed under 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) +* +* This very simple program illustrates how to use the +* `boost/math/nonfinite_num_facets.hpp' with lexical cast +* to obtain C99 representation of infinity and NaN. +* This example is from the original Floating Point Utilities contribution by Johan Rade. +* Floating Point Utility library has been accepted into Boost, +* but the utilities are incorporated into Boost.Math library. +* +\file + +\brief A very simple example of using lexical cast with +non_finite_num facet for C99 standard output of infinity and NaN. + +\detail This example shows how to create a C99 non-finite locale, +and imbue input and output streams with the non_finite_num put and get facets. +This allows lexical_cast output and input of infinity and NaN in a Standard portable way, +This permits 'loop-back' of output back into input (and portably across different system too). + +See also lexical_cast_native.cpp which is expected to fail on many systems, +but might succeed if the default locale num_put and num_get facets +comply with C99 nonfinite input and output specification. + +*/ + +#include +using boost::math::nonfinite_num_get; +using boost::math::nonfinite_num_put; + +#include +using boost::lexical_cast; + +#include +using std::cout; +using std::endl; +using std::cerr; + +#include +using std::setw; +using std::left; +using std::right; +using std::internal; + +#include +using std::string; + +#include +using std::istringstream; + +#include +using std::numeric_limits; + +#include +using std::locale; + +#include + +int main () +{ + std::cout << "finite_num_facet with lexical_cast example." << std::endl; + + // Example of using non_finite num_put and num_get facets with lexical_cast. + //locale old_locale; + //locale tmp_locale(old_locale, new nonfinite_num_put); + //// Create a new temporary output locale, and add the output nonfinite_num_put facet. + + //locale new_locale(tmp_locale, new nonfinite_num_get); + // Create a new output locale (from the tmp locale), and add the input nonfinite_num_get facet. + + // Note that you can only add facets one at a time, + // unless you chain thus: + + std::locale new_locale(std::locale(std::locale(), + new boost::math::nonfinite_num_put), + new boost::math::nonfinite_num_get); + + locale::global(new_locale); // Newly constructed streams + // (including those streams inside lexical_cast) + // now use new_locale with nonfinite facets. + + // Output using the new locale. + cout << "Using C99_out_locale " << endl; + cout.imbue(new_locale); + // Necessary because cout already constructed using default C locale, + // and default facets for nonfinites. + + // Create plus and minus infinity. + double plus_infinity = +std::numeric_limits::infinity(); + double minus_infinity = -std::numeric_limits::infinity(); + + // and create a NaN (NotANumber) + double NaN = +std::numeric_limits::quiet_NaN (); + cout << "+std::numeric_limits::infinity() = " << plus_infinity << endl; + cout << "-std::numeric_limits::infinity() = " << minus_infinity << endl; + cout << "+std::numeric_limits::quiet_NaN () = " << NaN << endl; + + // Now try some 'round-tripping', 'reading' "inf". + double x = boost::lexical_cast("inf"); + // and check we get a floating-point infinity. + BOOST_ASSERT(x == std::numeric_limits::infinity()); + cout << "boost::lexical_cast(\"inf\") = " << x << endl; + + // Check we can convert the other way from floating-point infinity, + string s = boost::lexical_cast(numeric_limits::infinity()); + // to a C99 string representation as "inf". + BOOST_ASSERT(s == "inf"); + + // Finally try full 'round-tripping' (in both directions): + BOOST_ASSERT(lexical_cast(lexical_cast(numeric_limits::infinity())) + == numeric_limits::infinity()); + BOOST_ASSERT(lexical_cast(lexical_cast("inf")) == "inf"); + + return 0; +} // int main() + +/* + +Output: + finite_num_facet with lexical_cast example. + Using C99_out_locale + +std::numeric_limits::infinity() = inf + -std::numeric_limits::infinity() = -inf + +std::numeric_limits::quiet_NaN () = nan + boost::lexical_cast("inf") = inf + + +*/ diff --git a/src/boost/libs/math/example/naive_monte_carlo_example.cpp b/src/boost/libs/math/example/naive_monte_carlo_example.cpp new file mode 100644 index 00000000..800eb679 --- /dev/null +++ b/src/boost/libs/math/example/naive_monte_carlo_example.cpp @@ -0,0 +1,136 @@ +/* + * Copyright Nick Thompson, 2017 + * 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 +#include +#include +#include +#include +#include + +using std::vector; +using std::pair; +using boost::math::quadrature::naive_monte_carlo; + +void display_progress(double progress, + double error_estimate, + double current_estimate, + std::chrono::duration estimated_time_to_completion) +{ + int barWidth = 70; + + std::cout << "["; + int pos = barWidth * progress; + for (int i = 0; i < barWidth; ++i) { + if (i < pos) std::cout << "="; + else if (i == pos) std::cout << ">"; + else std::cout << " "; + } + std::cout << "] " + << int(progress * 100.0) + << "%, E = " + << std::setprecision(3) + << error_estimate + << ", time to completion: " + << estimated_time_to_completion.count() + << " seconds, estimate: " + << std::setprecision(5) + << current_estimate + << " \r"; + + std::cout.flush(); +} + +int main() +{ + double exact = 1.3932039296856768591842462603255; + double A = 1.0 / boost::math::pow<3>(boost::math::constants::pi()); + auto g = [&](std::vector const & x) + { + return A / (1.0 - cos(x[0])*cos(x[1])*cos(x[2])); + }; + vector> bounds{{0, boost::math::constants::pi() }, {0, boost::math::constants::pi() }, {0, boost::math::constants::pi() }}; + naive_monte_carlo mc(g, bounds, 0.001); + + auto task = mc.integrate(); + + int s = 0; + std::cout << "Hit ctrl-c to cancel.\n"; + while (task.wait_for(std::chrono::seconds(1)) != std::future_status::ready) + { + display_progress(mc.progress(), + mc.current_error_estimate(), + mc.current_estimate(), + mc.estimated_time_to_completion()); + // TODO: The following shows that cancellation works, + // but it would be nice to show how it works with a ctrl-c signal handler. + if (s++ > 25){ + mc.cancel(); + std::cout << "\nCancelling because this is too slow!\n"; + } + } + double y = task.get(); + display_progress(mc.progress(), + mc.current_error_estimate(), + mc.current_estimate(), + mc.estimated_time_to_completion()); + std::cout << std::setprecision(std::numeric_limits::digits10) << std::fixed; + std::cout << "\nFinal value: " << y << std::endl; + std::cout << "Exact : " << exact << std::endl; + std::cout << "Final error estimate: " << mc.current_error_estimate() << std::endl; + std::cout << "Actual error : " << abs(y - exact) << std::endl; + std::cout << "Function calls: " << mc.calls() << std::endl; + std::cout << "Is this good enough? [y/N] "; + bool goodenough = true; + std::string line; + std::getline(std::cin, line); + if (line[0] != 'y') + { + goodenough = false; + } + double new_error = -1; + if (!goodenough) + { + std::cout << "What is the new target error? "; + std::getline(std::cin, line); + new_error = atof(line.c_str()); + if (new_error >= mc.current_error_estimate()) + { + std::cout << "That error bound is already satisfied.\n"; + return 0; + } + } + if (new_error > 0) + { + mc.update_target_error(new_error); + auto task = mc.integrate(); + std::cout << "Hit ctrl-c to cancel.\n"; + while (task.wait_for(std::chrono::seconds(1)) != std::future_status::ready) + { + display_progress(mc.progress(), + mc.current_error_estimate(), + mc.current_estimate(), + mc.estimated_time_to_completion()); + } + double y = task.get(); + display_progress(mc.progress(), + mc.current_error_estimate(), + mc.current_estimate(), + mc.estimated_time_to_completion()); + std::cout << std::setprecision(std::numeric_limits::digits10) << std::fixed; + std::cout << "\nFinal value: " << y << std::endl; + std::cout << "Exact : " << exact << std::endl; + std::cout << "Final error estimate: " << mc.current_error_estimate() << std::endl; + std::cout << "Actual error : " << abs(y - exact) << std::endl; + std::cout << "Function calls: " << mc.calls() << std::endl; + } +} diff --git a/src/boost/libs/math/example/nc_chi_sq_example.cpp b/src/boost/libs/math/example/nc_chi_sq_example.cpp new file mode 100644 index 00000000..75bfa944 --- /dev/null +++ b/src/boost/libs/math/example/nc_chi_sq_example.cpp @@ -0,0 +1,115 @@ +// Copyright John Maddock 2008 +// Copyright Paul A. Bristow 2010, 2013 +// 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) + +// Caution: this file contains Quickbook markup as well as code +// and comments, don't change any of the special comment markups! + +//[nccs_eg + +/*` + +This example computes a table of the power of the [chi][super 2] +test at the 5% significance level, for various degrees of freedom +and non-centrality parameters. The table is deliberately the same +as Table 6 from "The Non-Central [chi][super 2] and F-Distributions and +their applications.", P. B. Patnaik, Biometrika, Vol. 36, No. 1/2 (June 1949), +202-232. + +First we need some includes to access the non-central chi squared distribution +(and some basic std output of course). + +*/ + +#include +using boost::math::chi_squared; +using boost::math::non_central_chi_squared; + +#include +using std::cout; using std::endl; +using std::setprecision; + +int main() +{ + /*` + Create a table of the power of the [chi][super 2] test at + 5% significance level, start with a table header: + */ + cout << "[table\n[[[nu]]"; + for(int lam = 2; lam <= 20; lam += 2) + { + cout << "[[lambda]=" << lam << "]"; + } + cout << "]\n"; + + /*` + (Note: the enclosing [] brackets are to format as a table in Boost.Quickbook). + + Enumerate the rows and columns and print the power of the test + for each table cell: + */ + + for(int n = 2; n <= 20; ++n) + { + cout << "[[" << n << "]"; + for(int lam = 2; lam <= 20; lam += 2) + { + /*` + Calculate the [chi][super 2] statistic for a 5% significance: + */ + double cs = quantile(complement(chi_squared(n), 0.05)); + /*` + The power of the test is given by the complement of the CDF + of the non-central [chi][super 2] distribution: + */ + double beta = cdf(complement(non_central_chi_squared(n, lam), cs)); + /*` + Then output the cell value: + */ + cout << "[" << setprecision(3) << beta << "]"; + } + cout << "]" << endl; + } + cout << "]" << endl; +} + +/*` +The output from this program is a table in Boost.Quickbook format as shown below. + +We can interpret this as follows - for example if [nu]=10 and [lambda]=10 +then the power of the test is 0.542 - so we have only a 54% chance of +correctly detecting that our null hypothesis is false, and a 46% chance +of incurring a type II error (failing to reject the null hypothesis when +it is in fact false): + +[table +[[[nu]][[lambda]=2][[lambda]=4][[lambda]=6][[lambda]=8][[lambda]=10][[lambda]=12][[lambda]=14][[lambda]=16][[lambda]=18][[lambda]=20]] +[[2][0.226][0.415][0.584][0.718][0.815][0.883][0.928][0.957][0.974][0.985]] +[[3][0.192][0.359][0.518][0.654][0.761][0.84][0.896][0.934][0.959][0.975]] +[[4][0.171][0.32][0.47][0.605][0.716][0.802][0.866][0.912][0.943][0.964]] +[[5][0.157][0.292][0.433][0.564][0.677][0.769][0.839][0.89][0.927][0.952]] +[[6][0.146][0.27][0.403][0.531][0.644][0.738][0.813][0.869][0.911][0.94]] +[[7][0.138][0.252][0.378][0.502][0.614][0.71][0.788][0.849][0.895][0.928]] +[[8][0.131][0.238][0.357][0.477][0.588][0.685][0.765][0.829][0.879][0.915]] +[[9][0.125][0.225][0.339][0.454][0.564][0.661][0.744][0.811][0.863][0.903]] +[[10][0.121][0.215][0.323][0.435][0.542][0.64][0.723][0.793][0.848][0.891]] +[[11][0.117][0.206][0.309][0.417][0.523][0.62][0.704][0.775][0.833][0.878]] +[[12][0.113][0.198][0.297][0.402][0.505][0.601][0.686][0.759][0.818][0.866]] +[[13][0.11][0.191][0.286][0.387][0.488][0.584][0.669][0.743][0.804][0.854]] +[[14][0.108][0.185][0.276][0.374][0.473][0.567][0.653][0.728][0.791][0.842]] +[[15][0.105][0.179][0.267][0.362][0.459][0.552][0.638][0.713][0.777][0.83]] +[[16][0.103][0.174][0.259][0.351][0.446][0.538][0.623][0.699][0.764][0.819]] +[[17][0.101][0.169][0.251][0.341][0.434][0.525][0.609][0.686][0.752][0.807]] +[[18][0.0992][0.165][0.244][0.332][0.423][0.512][0.596][0.673][0.74][0.796]] +[[19][0.0976][0.161][0.238][0.323][0.412][0.5][0.584][0.66][0.728][0.786]] +[[20][0.0961][0.158][0.232][0.315][0.402][0.489][0.572][0.648][0.716][0.775]] +] + +See [@../../example/nc_chi_sq_example.cpp nc_chi_sq_example.cpp] for the full C++ source code. + +*/ + +//] diff --git a/src/boost/libs/math/example/neg_binom_confidence_limits.cpp b/src/boost/libs/math/example/neg_binom_confidence_limits.cpp new file mode 100644 index 00000000..6cca70cb --- /dev/null +++ b/src/boost/libs/math/example/neg_binom_confidence_limits.cpp @@ -0,0 +1,178 @@ +// neg_binomial_confidence_limits.cpp + +// Copyright John Maddock 2006 +// Copyright Paul A. Bristow 2007, 2010 +// 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) + +// Caution: this file contains quickbook markup as well as code +// and comments, don't change any of the special comment markups! + +//[neg_binomial_confidence_limits + +/*` + +First we need some includes to access the negative binomial distribution +(and some basic std output of course). + +*/ + +#include +using boost::math::negative_binomial; + +#include +using std::cout; using std::endl; +#include +using std::setprecision; +using std::setw; using std::left; using std::fixed; using std::right; + +/*` +First define a table of significance levels: these are the +probabilities that the true occurrence frequency lies outside the calculated +interval: +*/ + + double alpha[] = { 0.5, 0.25, 0.1, 0.05, 0.01, 0.001, 0.0001, 0.00001 }; + +/*` +Confidence value as % is (1 - alpha) * 100, so alpha 0.05 == 95% confidence +that the true occurrence frequency lies *inside* the calculated interval. + +We need a function to calculate and print confidence limits +for an observed frequency of occurrence +that follows a negative binomial distribution. + +*/ + +void confidence_limits_on_frequency(unsigned trials, unsigned successes) +{ + // trials = Total number of trials. + // successes = Total number of observed successes. + // failures = trials - successes. + // success_fraction = successes /trials. + // Print out general info: + cout << + "______________________________________________\n" + "2-Sided Confidence Limits For Success Fraction\n" + "______________________________________________\n\n"; + cout << setprecision(7); + cout << setw(40) << left << "Number of trials" << " = " << trials << "\n"; + cout << setw(40) << left << "Number of successes" << " = " << successes << "\n"; + cout << setw(40) << left << "Number of failures" << " = " << trials - successes << "\n"; + cout << setw(40) << left << "Observed frequency of occurrence" << " = " << double(successes) / trials << "\n"; + + // Print table header: + cout << "\n\n" + "___________________________________________\n" + "Confidence Lower Upper\n" + " Value (%) Limit Limit\n" + "___________________________________________\n"; + + +/*` +And now for the important part - the bounds themselves. +For each value of /alpha/, we call `find_lower_bound_on_p` and +`find_upper_bound_on_p` to obtain lower and upper bounds respectively. +Note that since we are calculating a two-sided interval, +we must divide the value of alpha in two. Had we been calculating a +single-sided interval, for example: ['"Calculate a lower bound so that we are P% +sure that the true occurrence frequency is greater than some value"] +then we would *not* have divided by two. +*/ + + // Now print out the upper and lower limits for the alpha table values. + for(unsigned i = 0; i < sizeof(alpha)/sizeof(alpha[0]); ++i) + { + // Confidence value: + cout << fixed << setprecision(3) << setw(10) << right << 100 * (1-alpha[i]); + // Calculate bounds: + double lower = negative_binomial::find_lower_bound_on_p(trials, successes, alpha[i]/2); + double upper = negative_binomial::find_upper_bound_on_p(trials, successes, alpha[i]/2); + // Print limits: + cout << fixed << setprecision(5) << setw(15) << right << lower; + cout << fixed << setprecision(5) << setw(15) << right << upper << endl; + } + cout << endl; +} // void confidence_limits_on_frequency(unsigned trials, unsigned successes) + +/*` + +And then call confidence_limits_on_frequency with increasing numbers of trials, +but always the same success fraction 0.1, or 1 in 10. + +*/ + +int main() +{ + confidence_limits_on_frequency(20, 2); // 20 trials, 2 successes, 2 in 20, = 1 in 10 = 0.1 success fraction. + confidence_limits_on_frequency(200, 20); // More trials, but same 0.1 success fraction. + confidence_limits_on_frequency(2000, 200); // Many more trials, but same 0.1 success fraction. + + return 0; +} // int main() + +//] [/negative_binomial_confidence_limits_eg end of Quickbook in C++ markup] + +/* + +______________________________________________ +2-Sided Confidence Limits For Success Fraction +______________________________________________ +Number of trials = 20 +Number of successes = 2 +Number of failures = 18 +Observed frequency of occurrence = 0.1 +___________________________________________ +Confidence Lower Upper + Value (%) Limit Limit +___________________________________________ + 50.000 0.04812 0.13554 + 75.000 0.03078 0.17727 + 90.000 0.01807 0.22637 + 95.000 0.01235 0.26028 + 99.000 0.00530 0.33111 + 99.900 0.00164 0.41802 + 99.990 0.00051 0.49202 + 99.999 0.00016 0.55574 +______________________________________________ +2-Sided Confidence Limits For Success Fraction +______________________________________________ +Number of trials = 200 +Number of successes = 20 +Number of failures = 180 +Observed frequency of occurrence = 0.1000000 +___________________________________________ +Confidence Lower Upper + Value (%) Limit Limit +___________________________________________ + 50.000 0.08462 0.11350 + 75.000 0.07580 0.12469 + 90.000 0.06726 0.13695 + 95.000 0.06216 0.14508 + 99.000 0.05293 0.16170 + 99.900 0.04343 0.18212 + 99.990 0.03641 0.20017 + 99.999 0.03095 0.21664 +______________________________________________ +2-Sided Confidence Limits For Success Fraction +______________________________________________ +Number of trials = 2000 +Number of successes = 200 +Number of failures = 1800 +Observed frequency of occurrence = 0.1000000 +___________________________________________ +Confidence Lower Upper + Value (%) Limit Limit +___________________________________________ + 50.000 0.09536 0.10445 + 75.000 0.09228 0.10776 + 90.000 0.08916 0.11125 + 95.000 0.08720 0.11352 + 99.000 0.08344 0.11802 + 99.900 0.07921 0.12336 + 99.990 0.07577 0.12795 + 99.999 0.07282 0.13206 +*/ + diff --git a/src/boost/libs/math/example/neg_binomial_sample_sizes.cpp b/src/boost/libs/math/example/neg_binomial_sample_sizes.cpp new file mode 100644 index 00000000..d01089e9 --- /dev/null +++ b/src/boost/libs/math/example/neg_binomial_sample_sizes.cpp @@ -0,0 +1,209 @@ +// neg_binomial_sample_sizes.cpp + +// Copyright John Maddock 2006 +// Copyright Paul A. Bristow 2007, 2010 + +// 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 +using boost::math::negative_binomial; + +// Default RealType is double so this permits use of: +double find_minimum_number_of_trials( +double k, // number of failures (events), k >= 0. +double p, // fraction of trails for which event occurs, 0 <= p <= 1. +double probability); // probability threshold, 0 <= probability <= 1. + +#include +using std::cout; +using std::endl; +using std::fixed; +using std::right; +#include +using std::setprecision; +using std::setw; + +//[neg_binomial_sample_sizes + +/*` +It centres around a routine that prints out a table of +minimum sample sizes (number of trials) for various probability thresholds: +*/ + void find_number_of_trials(double failures, double p); +/*` +First define a table of significance levels: these are the maximum +acceptable probability that /failure/ or fewer events will be observed. +*/ + double alpha[] = { 0.5, 0.25, 0.1, 0.05, 0.01, 0.001, 0.0001, 0.00001 }; +/*` +Confidence value as % is (1 - alpha) * 100, so alpha 0.05 == 95% confidence +that the desired number of failures will be observed. +The values range from a very low 0.5 or 50% confidence up to an extremely high +confidence of 99.999. + +Much of the rest of the program is pretty-printing, the important part +is in the calculation of minimum number of trials required for each +value of alpha using: + + (int)ceil(negative_binomial::find_minimum_number_of_trials(failures, p, alpha[i]); + +find_minimum_number_of_trials returns a double, +so `ceil` rounds this up to ensure we have an integral minimum number of trials. +*/ + +void find_number_of_trials(double failures, double p) +{ + // trials = number of trials + // failures = number of failures before achieving required success(es). + // p = success fraction (0 <= p <= 1.). + // + // Calculate how many trials we need to ensure the + // required number of failures DOES exceed "failures". + + cout << "\n""Target number of failures = " << (int)failures; + cout << ", Success fraction = " << fixed << setprecision(1) << 100 * p << "%" << endl; + // Print table header: + cout << "____________________________\n" + "Confidence Min Number\n" + " Value (%) Of Trials \n" + "____________________________\n"; + // Now print out the data for the alpha table values. + for(unsigned i = 0; i < sizeof(alpha)/sizeof(alpha[0]); ++i) + { // Confidence values %: + cout << fixed << setprecision(3) << setw(10) << right << 100 * (1-alpha[i]) << " " + // find_minimum_number_of_trials + << setw(6) << right + << (int)ceil(negative_binomial::find_minimum_number_of_trials(failures, p, alpha[i])) + << endl; + } + cout << endl; +} // void find_number_of_trials(double failures, double p) + +/*` finally we can produce some tables of minimum trials for the chosen confidence levels: +*/ + +int main() +{ + find_number_of_trials(5, 0.5); + find_number_of_trials(50, 0.5); + find_number_of_trials(500, 0.5); + find_number_of_trials(50, 0.1); + find_number_of_trials(500, 0.1); + find_number_of_trials(5, 0.9); + + return 0; +} // int main() + +//] [/neg_binomial_sample_sizes.cpp end of Quickbook in C++ markup] + +/* + +Output is: +Target number of failures = 5, Success fraction = 50.0% + ____________________________ + Confidence Min Number + Value (%) Of Trials + ____________________________ + 50.000 11 + 75.000 14 + 90.000 17 + 95.000 18 + 99.000 22 + 99.900 27 + 99.990 31 + 99.999 36 + + + Target number of failures = 50, Success fraction = 50.0% + ____________________________ + Confidence Min Number + Value (%) Of Trials + ____________________________ + 50.000 101 + 75.000 109 + 90.000 115 + 95.000 119 + 99.000 128 + 99.900 137 + 99.990 146 + 99.999 154 + + + Target number of failures = 500, Success fraction = 50.0% + ____________________________ + Confidence Min Number + Value (%) Of Trials + ____________________________ + 50.000 1001 + 75.000 1023 + 90.000 1043 + 95.000 1055 + 99.000 1078 + 99.900 1104 + 99.990 1126 + 99.999 1146 + + + Target number of failures = 50, Success fraction = 10.0% + ____________________________ + Confidence Min Number + Value (%) Of Trials + ____________________________ + 50.000 56 + 75.000 58 + 90.000 60 + 95.000 61 + 99.000 63 + 99.900 66 + 99.990 68 + 99.999 71 + + + Target number of failures = 500, Success fraction = 10.0% + ____________________________ + Confidence Min Number + Value (%) Of Trials + ____________________________ + 50.000 556 + 75.000 562 + 90.000 567 + 95.000 570 + 99.000 576 + 99.900 583 + 99.990 588 + 99.999 594 + + + Target number of failures = 5, Success fraction = 90.0% + ____________________________ + Confidence Min Number + Value (%) Of Trials + ____________________________ + 50.000 57 + 75.000 73 + 90.000 91 + 95.000 103 + 99.000 127 + 99.900 159 + 99.990 189 + 99.999 217 + + + Target number of failures = 5, Success fraction = 95.0% + ____________________________ + Confidence Min Number + Value (%) Of Trials + ____________________________ + 50.000 114 + 75.000 148 + 90.000 184 + 95.000 208 + 99.000 259 + 99.900 324 + 99.990 384 + 99.999 442 + +*/ diff --git a/src/boost/libs/math/example/negative_binomial_example1.cpp b/src/boost/libs/math/example/negative_binomial_example1.cpp new file mode 100644 index 00000000..0895742a --- /dev/null +++ b/src/boost/libs/math/example/negative_binomial_example1.cpp @@ -0,0 +1,513 @@ +// negative_binomial_example1.cpp + +// Copyright Paul A. Bristow 2007, 2010. + +// 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) + +// Example 1 of using negative_binomial distribution. + +//[negative_binomial_eg1_1 + +/*` +Based on [@http://en.wikipedia.org/wiki/Negative_binomial_distribution +a problem by Dr. Diane Evans, +Professor of Mathematics at Rose-Hulman Institute of Technology]. + +Pat is required to sell candy bars to raise money for the 6th grade field trip. +There are thirty houses in the neighborhood, +and Pat is not supposed to return home until five candy bars have been sold. +So the child goes door to door, selling candy bars. +At each house, there is a 0.4 probability (40%) of selling one candy bar +and a 0.6 probability (60%) of selling nothing. + +What is the probability mass (density) function (pdf) for selling the last (fifth) +candy bar at the nth house? + +The Negative Binomial(r, p) distribution describes the probability of k failures +and r successes in k+r Bernoulli(p) trials with success on the last trial. +(A [@http://en.wikipedia.org/wiki/Bernoulli_distribution Bernoulli trial] +is one with only two possible outcomes, success of failure, +and p is the probability of success). +See also [@ http://en.wikipedia.org/wiki/Bernoulli_distribution Bernoulli distribution] +and [@http://www.math.uah.edu/stat/bernoulli/Introduction.xhtml Bernoulli applications]. + +In this example, we will deliberately produce a variety of calculations +and outputs to demonstrate the ways that the negative binomial distribution +can be implemented with this library: it is also deliberately over-commented. + +First we need to #define macros to control the error and discrete handling policies. +For this simple example, we want to avoid throwing +an exception (the default policy) and just return infinity. +We want to treat the distribution as if it was continuous, +so we choose a discrete_quantile policy of real, +rather than the default policy integer_round_outwards. +*/ +#define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error +#define BOOST_MATH_DISCRETE_QUANTILE_POLICY real +/*` +After that we need some includes to provide easy access to the negative binomial distribution, +[caution It is vital to #include distributions etc *after* the above #defines] +and we need some std library iostream, of course. +*/ +#include + // for negative_binomial_distribution + using boost::math::negative_binomial; // typedef provides default type is double. + using ::boost::math::pdf; // Probability mass function. + using ::boost::math::cdf; // Cumulative density function. + using ::boost::math::quantile; + +#include + using std::cout; using std::endl; + using std::noshowpoint; using std::fixed; using std::right; using std::left; +#include + using std::setprecision; using std::setw; + +#include + using std::numeric_limits; +//] [negative_binomial_eg1_1] + +int main() +{ + cout <<"Selling candy bars - using the negative binomial distribution." + << "\nby Dr. Diane Evans," + "\nProfessor of Mathematics at Rose-Hulman Institute of Technology," + << "\nsee http://en.wikipedia.org/wiki/Negative_binomial_distribution\n" + << endl; + cout << endl; + cout.precision(5); + // None of the values calculated have a useful accuracy as great this, but + // INF shows wrongly with < 5 ! + // https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=240227 +//[negative_binomial_eg1_2 +/*` +It is always sensible to use try and catch blocks because defaults policies are to +throw an exception if anything goes wrong. + +A simple catch block (see below) will ensure that you get a +helpful error message instead of an abrupt program abort. +*/ + try + { +/*` +Selling five candy bars means getting five successes, so successes r = 5. +The total number of trials (n, in this case, houses visited) this takes is therefore + = sucesses + failures or k + r = k + 5. +*/ + double sales_quota = 5; // Pat's sales quota - successes (r). +/*` +At each house, there is a 0.4 probability (40%) of selling one candy bar +and a 0.6 probability (60%) of selling nothing. +*/ + double success_fraction = 0.4; // success_fraction (p) - so failure_fraction is 0.6. +/*` +The Negative Binomial(r, p) distribution describes the probability of k failures +and r successes in k+r Bernoulli(p) trials with success on the last trial. +(A [@http://en.wikipedia.org/wiki/Bernoulli_distribution Bernoulli trial] +is one with only two possible outcomes, success of failure, +and p is the probability of success). + +We therefore start by constructing a negative binomial distribution +with parameters sales_quota (required successes) and probability of success. +*/ + negative_binomial nb(sales_quota, success_fraction); // type double by default. +/*` +To confirm, display the success_fraction & successes parameters of the distribution. +*/ + cout << "Pat has a sales per house success rate of " << success_fraction + << ".\nTherefore he would, on average, sell " << nb.success_fraction() * 100 + << " bars after trying 100 houses." << endl; + + int all_houses = 30; // The number of houses on the estate. + + cout << "With a success rate of " << nb.success_fraction() + << ", he might expect, on average,\n" + "to need to visit about " << success_fraction * all_houses + << " houses in order to sell all " << nb.successes() << " bars. " << endl; +/*` +[pre +Pat has a sales per house success rate of 0.4. +Therefore he would, on average, sell 40 bars after trying 100 houses. +With a success rate of 0.4, he might expect, on average, +to need to visit about 12 houses in order to sell all 5 bars. +] + +The random variable of interest is the number of houses +that must be visited to sell five candy bars, +so we substitute k = n - 5 into a negative_binomial(5, 0.4) +and obtain the __pdf of the distribution of houses visited. +Obviously, the best possible case is that Pat makes sales on all the first five houses. + +We calculate this using the pdf function: +*/ + cout << "Probability that Pat finishes on the " << sales_quota << "th house is " + << pdf(nb, 5 - sales_quota) << endl; // == pdf(nb, 0) +/*` +Of course, he could not finish on fewer than 5 houses because he must sell 5 candy bars. +So the 5th house is the first that he could possibly finish on. + +To finish on or before the 8th house, Pat must finish at the 5th, 6th, 7th or 8th house. +The probability that he will finish on *exactly* ( == ) on any house +is the Probability Density Function (pdf). +*/ + cout << "Probability that Pat finishes on the 6th house is " + << pdf(nb, 6 - sales_quota) << endl; + cout << "Probability that Pat finishes on the 7th house is " + << pdf(nb, 7 - sales_quota) << endl; + cout << "Probability that Pat finishes on the 8th house is " + << pdf(nb, 8 - sales_quota) << endl; +/*` +[pre +Probability that Pat finishes on the 6th house is 0.03072 +Probability that Pat finishes on the 7th house is 0.055296 +Probability that Pat finishes on the 8th house is 0.077414 +] + +The sum of the probabilities for these houses is the Cumulative Distribution Function (cdf). +We can calculate it by adding the individual probabilities. +*/ + cout << "Probability that Pat finishes on or before the 8th house is sum " + "\n" << "pdf(sales_quota) + pdf(6) + pdf(7) + pdf(8) = " + // Sum each of the mass/density probabilities for houses sales_quota = 5, 6, 7, & 8. + << pdf(nb, 5 - sales_quota) // 0 failures. + + pdf(nb, 6 - sales_quota) // 1 failure. + + pdf(nb, 7 - sales_quota) // 2 failures. + + pdf(nb, 8 - sales_quota) // 3 failures. + << endl; +/*`[pre +pdf(sales_quota) + pdf(6) + pdf(7) + pdf(8) = 0.17367 +] + +Or, usually better, by using the negative binomial *cumulative* distribution function. +*/ + cout << "\nProbability of selling his quota of " << sales_quota + << " bars\non or before the " << 8 << "th house is " + << cdf(nb, 8 - sales_quota) << endl; +/*`[pre +Probability of selling his quota of 5 bars on or before the 8th house is 0.17367 +]*/ + cout << "\nProbability that Pat finishes exactly on the 10th house is " + << pdf(nb, 10 - sales_quota) << endl; + cout << "\nProbability of selling his quota of " << sales_quota + << " bars\non or before the " << 10 << "th house is " + << cdf(nb, 10 - sales_quota) << endl; +/*` +[pre +Probability that Pat finishes exactly on the 10th house is 0.10033 +Probability of selling his quota of 5 bars on or before the 10th house is 0.3669 +]*/ + cout << "Probability that Pat finishes exactly on the 11th house is " + << pdf(nb, 11 - sales_quota) << endl; + cout << "\nProbability of selling his quota of " << sales_quota + << " bars\non or before the " << 11 << "th house is " + << cdf(nb, 11 - sales_quota) << endl; +/*`[pre +Probability that Pat finishes on the 11th house is 0.10033 +Probability of selling his quota of 5 candy bars +on or before the 11th house is 0.46723 +]*/ + cout << "Probability that Pat finishes exactly on the 12th house is " + << pdf(nb, 12 - sales_quota) << endl; + + cout << "\nProbability of selling his quota of " << sales_quota + << " bars\non or before the " << 12 << "th house is " + << cdf(nb, 12 - sales_quota) << endl; +/*`[pre +Probability that Pat finishes on the 12th house is 0.094596 +Probability of selling his quota of 5 candy bars +on or before the 12th house is 0.56182 +] +Finally consider the risk of Pat not selling his quota of 5 bars +even after visiting all the houses. +Calculate the probability that he /will/ sell on +or before the last house: +Calculate the probability that he would sell all his quota on the very last house. +*/ + cout << "Probability that Pat finishes on the " << all_houses + << " house is " << pdf(nb, all_houses - sales_quota) << endl; +/*` +Probability of selling his quota of 5 bars on the 30th house is +[pre +Probability that Pat finishes on the 30 house is 0.00069145 +] +when he'd be very unlucky indeed! + +What is the probability that Pat exhausts all 30 houses in the neighborhood, +and *still* doesn't sell the required 5 candy bars? +*/ + cout << "\nProbability of selling his quota of " << sales_quota + << " bars\non or before the " << all_houses << "th house is " + << cdf(nb, all_houses - sales_quota) << endl; +/*` +[pre +Probability of selling his quota of 5 bars +on or before the 30th house is 0.99849 +] + +So the risk of failing even after visiting all the houses is 1 - this probability, + ``1 - cdf(nb, all_houses - sales_quota`` +But using this expression may cause serious inaccuracy, +so it would be much better to use the complement of the cdf: +So the risk of failing even at, or after, the 31th (non-existent) houses is 1 - this probability, + ``1 - cdf(nb, all_houses - sales_quota)`` +But using this expression may cause serious inaccuracy. +So it would be much better to use the __complement of the cdf (see __why_complements). +*/ + cout << "\nProbability of failing to sell his quota of " << sales_quota + << " bars\neven after visiting all " << all_houses << " houses is " + << cdf(complement(nb, all_houses - sales_quota)) << endl; +/*` +[pre +Probability of failing to sell his quota of 5 bars +even after visiting all 30 houses is 0.0015101 +] +We can also use the quantile (percentile), the inverse of the cdf, to +predict which house Pat will finish on. So for the 8th house: +*/ + double p = cdf(nb, (8 - sales_quota)); + cout << "Probability of meeting sales quota on or before 8th house is "<< p << endl; +/*` +[pre +Probability of meeting sales quota on or before 8th house is 0.174 +] +*/ + cout << "If the confidence of meeting sales quota is " << p + << ", then the finishing house is " << quantile(nb, p) + sales_quota << endl; + + cout<< " quantile(nb, p) = " << quantile(nb, p) << endl; +/*` +[pre +If the confidence of meeting sales quota is 0.17367, then the finishing house is 8 +] +Demanding absolute certainty that all 5 will be sold, +implies an infinite number of trials. +(Of course, there are only 30 houses on the estate, +so he can't ever be *certain* of selling his quota). +*/ + cout << "If the confidence of meeting sales quota is " << 1. + << ", then the finishing house is " << quantile(nb, 1) + sales_quota << endl; + // 1.#INF == infinity. +/*`[pre +If the confidence of meeting sales quota is 1, then the finishing house is 1.#INF +] +And similarly for a few other probabilities: +*/ + cout << "If the confidence of meeting sales quota is " << 0. + << ", then the finishing house is " << quantile(nb, 0.) + sales_quota << endl; + + cout << "If the confidence of meeting sales quota is " << 0.5 + << ", then the finishing house is " << quantile(nb, 0.5) + sales_quota << endl; + + cout << "If the confidence of meeting sales quota is " << 1 - 0.00151 // 30 th + << ", then the finishing house is " << quantile(nb, 1 - 0.00151) + sales_quota << endl; +/*` +[pre +If the confidence of meeting sales quota is 0, then the finishing house is 5 +If the confidence of meeting sales quota is 0.5, then the finishing house is 11.337 +If the confidence of meeting sales quota is 0.99849, then the finishing house is 30 +] + +Notice that because we chose a discrete quantile policy of real, +the result can be an 'unreal' fractional house. + +If the opposite is true, we don't want to assume any confidence, then this is tantamount +to assuming that all the first sales_quota trials will be successful sales. +*/ + cout << "If confidence of meeting quota is zero\n(we assume all houses are successful sales)" + ", then finishing house is " << sales_quota << endl; +/*` +[pre +If confidence of meeting quota is zero (we assume all houses are successful sales), then finishing house is 5 +If confidence of meeting quota is 0, then finishing house is 5 +] +We can list quantiles for a few probabilities: +*/ + + double ps[] = {0., 0.001, 0.01, 0.05, 0.1, 0.5, 0.9, 0.95, 0.99, 0.999, 1.}; + // Confidence as fraction = 1-alpha, as percent = 100 * (1-alpha[i]) % + cout.precision(3); + for (unsigned i = 0; i < sizeof(ps)/sizeof(ps[0]); i++) + { + cout << "If confidence of meeting quota is " << ps[i] + << ", then finishing house is " << quantile(nb, ps[i]) + sales_quota + << endl; + } + +/*` +[pre +If confidence of meeting quota is 0, then finishing house is 5 +If confidence of meeting quota is 0.001, then finishing house is 5 +If confidence of meeting quota is 0.01, then finishing house is 5 +If confidence of meeting quota is 0.05, then finishing house is 6.2 +If confidence of meeting quota is 0.1, then finishing house is 7.06 +If confidence of meeting quota is 0.5, then finishing house is 11.3 +If confidence of meeting quota is 0.9, then finishing house is 17.8 +If confidence of meeting quota is 0.95, then finishing house is 20.1 +If confidence of meeting quota is 0.99, then finishing house is 24.8 +If confidence of meeting quota is 0.999, then finishing house is 31.1 +If confidence of meeting quota is 1, then finishing house is 1.#INF +] + +We could have applied a ceil function to obtain a 'worst case' integer value for house. +``ceil(quantile(nb, ps[i]))`` + +Or, if we had used the default discrete quantile policy, integer_outside, by omitting +``#define BOOST_MATH_DISCRETE_QUANTILE_POLICY real`` +we would have achieved the same effect. + +The real result gives some suggestion which house is most likely. +For example, compare the real and integer_outside for 95% confidence. + +[pre +If confidence of meeting quota is 0.95, then finishing house is 20.1 +If confidence of meeting quota is 0.95, then finishing house is 21 +] +The real value 20.1 is much closer to 20 than 21, so integer_outside is pessimistic. +We could also use integer_round_nearest policy to suggest that 20 is more likely. + +Finally, we can tabulate the probability for the last sale being exactly on each house. +*/ + cout << "\nHouse for " << sales_quota << "th (last) sale. Probability (%)" << endl; + cout.precision(5); + for (int i = (int)sales_quota; i < all_houses+1; i++) + { + cout << left << setw(3) << i << " " << setw(8) << cdf(nb, i - sales_quota) << endl; + } + cout << endl; +/*` +[pre +House for 5 th (last) sale. Probability (%) +5 0.01024 +6 0.04096 +7 0.096256 +8 0.17367 +9 0.26657 +10 0.3669 +11 0.46723 +12 0.56182 +13 0.64696 +14 0.72074 +15 0.78272 +16 0.83343 +17 0.874 +18 0.90583 +19 0.93039 +20 0.94905 +21 0.96304 +22 0.97342 +23 0.98103 +24 0.98655 +25 0.99053 +26 0.99337 +27 0.99539 +28 0.99681 +29 0.9978 +30 0.99849 +] + +As noted above, using a catch block is always a good idea, even if you do not expect to use it. +*/ + } + catch(const std::exception& e) + { // Since we have set an overflow policy of ignore_error, + // an overflow exception should never be thrown. + std::cout << "\nMessage from thrown exception was:\n " << e.what() << std::endl; +/*` +For example, without a ignore domain error policy, if we asked for ``pdf(nb, -1)`` for example, we would get: +[pre +Message from thrown exception was: + Error in function boost::math::pdf(const negative_binomial_distribution&, double): + Number of failures argument is -1, but must be >= 0 ! +] +*/ +//] [/ negative_binomial_eg1_2] + } + return 0; +} // int main() + + +/* + +Output is: + +Selling candy bars - using the negative binomial distribution. +by Dr. Diane Evans, +Professor of Mathematics at Rose-Hulman Institute of Technology, +see http://en.wikipedia.org/wiki/Negative_binomial_distribution +Pat has a sales per house success rate of 0.4. +Therefore he would, on average, sell 40 bars after trying 100 houses. +With a success rate of 0.4, he might expect, on average, +to need to visit about 12 houses in order to sell all 5 bars. +Probability that Pat finishes on the 5th house is 0.01024 +Probability that Pat finishes on the 6th house is 0.03072 +Probability that Pat finishes on the 7th house is 0.055296 +Probability that Pat finishes on the 8th house is 0.077414 +Probability that Pat finishes on or before the 8th house is sum +pdf(sales_quota) + pdf(6) + pdf(7) + pdf(8) = 0.17367 +Probability of selling his quota of 5 bars +on or before the 8th house is 0.17367 +Probability that Pat finishes exactly on the 10th house is 0.10033 +Probability of selling his quota of 5 bars +on or before the 10th house is 0.3669 +Probability that Pat finishes exactly on the 11th house is 0.10033 +Probability of selling his quota of 5 bars +on or before the 11th house is 0.46723 +Probability that Pat finishes exactly on the 12th house is 0.094596 +Probability of selling his quota of 5 bars +on or before the 12th house is 0.56182 +Probability that Pat finishes on the 30 house is 0.00069145 +Probability of selling his quota of 5 bars +on or before the 30th house is 0.99849 +Probability of failing to sell his quota of 5 bars +even after visiting all 30 houses is 0.0015101 +Probability of meeting sales quota on or before 8th house is 0.17367 +If the confidence of meeting sales quota is 0.17367, then the finishing house is 8 + quantile(nb, p) = 3 +If the confidence of meeting sales quota is 1, then the finishing house is 1.#INF +If the confidence of meeting sales quota is 0, then the finishing house is 5 +If the confidence of meeting sales quota is 0.5, then the finishing house is 11.337 +If the confidence of meeting sales quota is 0.99849, then the finishing house is 30 +If confidence of meeting quota is zero +(we assume all houses are successful sales), then finishing house is 5 +If confidence of meeting quota is 0, then finishing house is 5 +If confidence of meeting quota is 0.001, then finishing house is 5 +If confidence of meeting quota is 0.01, then finishing house is 5 +If confidence of meeting quota is 0.05, then finishing house is 6.2 +If confidence of meeting quota is 0.1, then finishing house is 7.06 +If confidence of meeting quota is 0.5, then finishing house is 11.3 +If confidence of meeting quota is 0.9, then finishing house is 17.8 +If confidence of meeting quota is 0.95, then finishing house is 20.1 +If confidence of meeting quota is 0.99, then finishing house is 24.8 +If confidence of meeting quota is 0.999, then finishing house is 31.1 +If confidence of meeting quota is 1, then finishing house is 1.#J +House for 5th (last) sale. Probability (%) +5 0.01024 +6 0.04096 +7 0.096256 +8 0.17367 +9 0.26657 +10 0.3669 +11 0.46723 +12 0.56182 +13 0.64696 +14 0.72074 +15 0.78272 +16 0.83343 +17 0.874 +18 0.90583 +19 0.93039 +20 0.94905 +21 0.96304 +22 0.97342 +23 0.98103 +24 0.98655 +25 0.99053 +26 0.99337 +27 0.99539 +28 0.99681 +29 0.9978 +30 0.99849 + +*/ diff --git a/src/boost/libs/math/example/negative_binomial_example2.cpp b/src/boost/libs/math/example/negative_binomial_example2.cpp new file mode 100644 index 00000000..601180c3 --- /dev/null +++ b/src/boost/libs/math/example/negative_binomial_example2.cpp @@ -0,0 +1,182 @@ +// negative_binomial_example2.cpp + +// Copyright Paul A. Bristow 2007, 2010. + +// 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) + +// Simple example demonstrating use of the Negative Binomial Distribution. + +#include + using boost::math::negative_binomial_distribution; + using boost::math::negative_binomial; // typedef + +// In a sequence of trials or events +// (Bernoulli, independent, yes or no, succeed or fail) +// with success_fraction probability p, +// negative_binomial is the probability that k or fewer failures +// preceed the r th trial's success. + +#include +using std::cout; +using std::endl; +using std::setprecision; +using std::showpoint; +using std::setw; +using std::left; +using std::right; +#include +using std::numeric_limits; + +int main() +{ + cout << "Negative_binomial distribution - simple example 2" << endl; + // Construct a negative binomial distribution with: + // 8 successes (r), success fraction (p) 0.25 = 25% or 1 in 4 successes. + negative_binomial mynbdist(8, 0.25); // Shorter method using typedef. + + // Display (to check) properties of the distribution just constructed. + cout << "mean(mynbdist) = " << mean(mynbdist) << endl; // 24 + cout << "mynbdist.successes() = " << mynbdist.successes() << endl; // 8 + // r th successful trial, after k failures, is r + k th trial. + cout << "mynbdist.success_fraction() = " << mynbdist.success_fraction() << endl; + // success_fraction = failures/successes or k/r = 0.25 or 25%. + cout << "mynbdist.percent success = " << mynbdist.success_fraction() * 100 << "%" << endl; + // Show as % too. + // Show some cumulative distribution function values for failures k = 2 and 8 + cout << "cdf(mynbdist, 2.) = " << cdf(mynbdist, 2.) << endl; // 0.000415802001953125 + cout << "cdf(mynbdist, 8.) = " << cdf(mynbdist, 8.) << endl; // 0.027129956288263202 + cout << "cdf(complement(mynbdist, 8.)) = " << cdf(complement(mynbdist, 8.)) << endl; // 0.9728700437117368 + // Check that cdf plus its complement is unity. + cout << "cdf + complement = " << cdf(mynbdist, 8.) + cdf(complement(mynbdist, 8.)) << endl; // 1 + // Note: No complement for pdf! + + // Compare cdf with sum of pdfs. + double sum = 0.; // Calculate the sum of all the pdfs, + int k = 20; // for 20 failures + for(signed i = 0; i <= k; ++i) + { + sum += pdf(mynbdist, double(i)); + } + // Compare with the cdf + double cdf8 = cdf(mynbdist, static_cast(k)); + double diff = sum - cdf8; // Expect the diference to be very small. + cout << setprecision(17) << "Sum pdfs = " << sum << ' ' // sum = 0.40025683281803698 + << ", cdf = " << cdf(mynbdist, static_cast(k)) // cdf = 0.40025683281803687 + << ", difference = " // difference = 0.50000000000000000 + << setprecision(1) << diff/ (std::numeric_limits::epsilon() * sum) + << " in epsilon units." << endl; + + // Note: Use boost::math::tools::epsilon rather than std::numeric_limits + // to cover RealTypes that do not specialize numeric_limits. + +//[neg_binomial_example2 + + // Print a table of values that can be used to plot + // using Excel, or some other superior graphical display tool. + + cout.precision(17); // Use max_digits10 precision, the maximum available for a reference table. + cout << showpoint << endl; // include trailing zeros. + // This is a maximum possible precision for the type (here double) to suit a reference table. + int maxk = static_cast(2. * mynbdist.successes() / mynbdist.success_fraction()); + // This maxk shows most of the range of interest, probability about 0.0001 to 0.999. + cout << "\n"" k pdf cdf""\n" << endl; + for (int k = 0; k < maxk; k++) + { + cout << right << setprecision(17) << showpoint + << right << setw(3) << k << ", " + << left << setw(25) << pdf(mynbdist, static_cast(k)) + << left << setw(25) << cdf(mynbdist, static_cast(k)) + << endl; + } + cout << endl; +//] [/ neg_binomial_example2] + return 0; +} // int main() + +/* + +Output is: + +negative_binomial distribution - simple example 2 +mean(mynbdist) = 24 +mynbdist.successes() = 8 +mynbdist.success_fraction() = 0.25 +mynbdist.percent success = 25% +cdf(mynbdist, 2.) = 0.000415802001953125 +cdf(mynbdist, 8.) = 0.027129956288263202 +cdf(complement(mynbdist, 8.)) = 0.9728700437117368 +cdf + complement = 1 +Sum pdfs = 0.40025683281803692 , cdf = 0.40025683281803687, difference = 0.25 in epsilon units. + +//[neg_binomial_example2_1 + k pdf cdf + 0, 1.5258789062500000e-005 1.5258789062500003e-005 + 1, 9.1552734375000000e-005 0.00010681152343750000 + 2, 0.00030899047851562522 0.00041580200195312500 + 3, 0.00077247619628906272 0.0011882781982421875 + 4, 0.0015932321548461918 0.0027815103530883789 + 5, 0.0028678178787231476 0.0056493282318115234 + 6, 0.0046602040529251142 0.010309532284736633 + 7, 0.0069903060793876605 0.017299838364124298 + 8, 0.0098301179241389001 0.027129956288263202 + 9, 0.013106823898851871 0.040236780187115073 + 10, 0.016711200471036140 0.056947980658151209 + 11, 0.020509200578089786 0.077457181236241013 + 12, 0.024354675686481652 0.10181185692272265 + 13, 0.028101548869017230 0.12991340579173993 + 14, 0.031614242477644432 0.16152764826938440 + 15, 0.034775666725408917 0.19630331499479325 + 16, 0.037492515688331451 0.23379583068312471 + 17, 0.039697957787645101 0.27349378847076977 + 18, 0.041352039362130305 0.31484582783290005 + 19, 0.042440250924291580 0.35728607875719176 + 20, 0.042970754060845245 0.40025683281803687 + 21, 0.042970754060845225 0.44322758687888220 + 22, 0.042482450037426581 0.48571003691630876 + 23, 0.041558918514873783 0.52726895543118257 + 24, 0.040260202311284021 0.56752915774246648 + 25, 0.038649794218832620 0.60617895196129912 + 26, 0.036791631035234917 0.64297058299653398 + 27, 0.034747651533277427 0.67771823452981139 + 28, 0.032575923312447595 0.71029415784225891 + 29, 0.030329307911589130 0.74062346575384819 + 30, 0.028054609818219924 0.76867807557206813 + 31, 0.025792141284492545 0.79447021685656061 + 32, 0.023575629142856460 0.81804584599941710 + 33, 0.021432390129869489 0.83947823612928651 + 34, 0.019383705779220189 0.85886194190850684 + 35, 0.017445335201298231 0.87630727710980494 + 36, 0.015628112784496322 0.89193538989430121 + 37, 0.013938587078064250 0.90587397697236549 + 38, 0.012379666154859701 0.91825364312722524 + 39, 0.010951243136991251 0.92920488626421649 + 40, 0.0096507830144735539 0.93885566927869002 + 41, 0.0084738582566109364 0.94732952753530097 + 42, 0.0074146259745345548 0.95474415350983555 + 43, 0.0064662435824429246 0.96121039709227851 + 44, 0.0056212231142827853 0.96683162020656122 + 45, 0.0048717266990450708 0.97170334690560634 + 46, 0.0042098073105878630 0.97591315421619418 + 47, 0.0036275999165703964 0.97954075413276465 + 48, 0.0031174686783026818 0.98265822281106729 + 49, 0.0026721160099737302 0.98533033882104104 + 50, 0.0022846591885275322 0.98761499800956853 + 51, 0.0019486798960970148 0.98956367790566557 + 52, 0.0016582516423517923 0.99122192954801736 + 53, 0.0014079495076571762 0.99262987905567457 + 54, 0.0011928461106539983 0.99382272516632852 + 55, 0.0010084971662802015 0.99483122233260868 + 56, 0.00085091948404891532 0.99568214181665760 + 57, 0.00071656377604119542 0.99639870559269883 + 58, 0.00060228420831048650 0.99700098980100937 + 59, 0.00050530624256557675 0.99750629604357488 + 60, 0.00042319397814867202 0.99792949002172360 + 61, 0.00035381791615708398 0.99828330793788067 + 62, 0.00029532382517950324 0.99857863176306016 + 63, 0.00024610318764958566 0.99882473495070978 +//] [neg_binomial_example2_1 end of Quickbook] + +*/ diff --git a/src/boost/libs/math/example/neumann_zeros_example_1.cpp b/src/boost/libs/math/example/neumann_zeros_example_1.cpp new file mode 100644 index 00000000..b8042d96 --- /dev/null +++ b/src/boost/libs/math/example/neumann_zeros_example_1.cpp @@ -0,0 +1,85 @@ + +// Copyright Christopher Kormanyos 2013. +// Copyright Paul A. Bristow 2013. +// Copyright John Maddock 2013. + +// Distributed under 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). + +#ifdef _MSC_VER +# pragma warning (disable : 4512) // assignment operator could not be generated. +# pragma warning (disable : 4996) // assignment operator could not be generated. +#endif + +#include +#include +#include +#include +#include +#include + +//[neumann_zeros_example_1 + +/*`[h5 Calculating zeros of the Neumann function.] +This example also shows how Boost.Math and Boost.Multiprecision can be combined to provide +a many decimal digit precision. For 50 decimal digit precision we need to include +*/ + + #include + +/*`and a `typedef` for `float_type` may be convenient +(allowing a quick switch to re-compute at built-in `double` or other precision) +*/ + typedef boost::multiprecision::cpp_dec_float_50 float_type; + +//`To use the functions for finding zeros of the `cyl_neumann` function we need: + + #include +//] [/neumann_zerso_example_1] + +int main() +{ + try + { + { +//[neumann_zeros_example_2 +/*`The Neumann (Bessel Y) function zeros are evaluated very similarly: +*/ + using boost::math::cyl_neumann_zero; + double zn = cyl_neumann_zero(2., 1); + std::cout << "cyl_neumann_zero(2., 1) = " << zn << std::endl; + + std::vector nzeros(3); // Space for 3 zeros. + cyl_neumann_zero(2.F, 1, nzeros.size(), nzeros.begin()); + + std::cout << "cyl_neumann_zero(2.F, 1, "; + // Print the zeros to the output stream. + std::copy(nzeros.begin(), nzeros.end(), + std::ostream_iterator(std::cout, ", ")); + + std::cout << "\n""cyl_neumann_zero(static_cast(220)/100, 1) = " + << cyl_neumann_zero(static_cast(220)/100, 1) << std::endl; + // 3.6154383428745996706772556069431792744372398748422 + +//] //[/neumann_zeros_example_2] + } + } + catch (std::exception const& ex) + { + std::cout << "Thrown exception " << ex.what() << std::endl; + } +} // int main() + +/* + Output: + +cyl_neumann_zero(2., 1) = 3.38424 +cyl_neumann_zero(2.F, 1, +3.38424 +6.79381 +10.0235 +3.61544 +*/ + + diff --git a/src/boost/libs/math/example/nonfinite_facet_simple.cpp b/src/boost/libs/math/example/nonfinite_facet_simple.cpp new file mode 100644 index 00000000..3be01c2d --- /dev/null +++ b/src/boost/libs/math/example/nonfinite_facet_simple.cpp @@ -0,0 +1,269 @@ +/** nonfinite_num_facet.cpp +* +* Copyright (c) 2011 Paul A. Bristow +* +* Distributed under 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) +* +* This very simple program illustrates how to use the +* `boost/math/nonfinite_num_facets.hpp' to obtain C99 +* representation of infinity and NaN. +* (from the original +* Floating Point Utilities contribution by Johan Rade. +* Floating Point Utility library has been accepted into Boost, +* but the utilities are incorporated into Boost.Math library. +* +\file + +\brief A very simple example of using non_finite_num facet for +C99 standard output of infinity and NaN. + +\detail Provided infinity and nan are supported, +this example shows how to create a C99 non-finite locale, +and imbue input and output streams with the non_finite_num put and get facets. +This allow output and input of infinity and NaN in a Standard portable way, +This permits 'loop-back' of output back into input (and portably across different system too). +This is particularly useful when used with Boost.Serialization so that non-finite NaNs and infinity +values in text and xml archives can be handled correctly and portably. + +*/ + +#ifdef _MSC_VER +# pragma warning (disable : 4127) // conditional expression is constant. +#endif + +#include +using std::cout; +using std::endl; +using std::cerr; + +#include +using std::setw; +using std::left; +using std::right; +using std::internal; + +#include +using std::string; + +#include +using std::istringstream; + +#include +using std::numeric_limits; + +#include +using std::locale; + +#include +// from Johan Rade Floating Point Utilities. + +int main () +{ + std::cout << "Nonfinite_num_facet very simple example." << std::endl; + + if((std::numeric_limits::has_infinity == 0) || (std::numeric_limits::infinity() == 0)) + { + std::cout << "Infinity not supported on this platform." << std::endl; + return 0; + } + + if((std::numeric_limits::has_quiet_NaN == 0) || (std::numeric_limits::quiet_NaN() == 0)) + { + std::cout << "NaN not supported on this platform." << std::endl; + return 0; + } + + std::locale default_locale (std::locale::classic ()); // Note the currrent (default C) locale. + + // Create plus and minus infinity. + double plus_infinity = +std::numeric_limits::infinity(); + double minus_infinity = -std::numeric_limits::infinity(); + + // and create a NaN (NotANumber) + double NaN = +std::numeric_limits::quiet_NaN (); + + double negated_NaN = (boost::math::changesign)(std::numeric_limits::quiet_NaN ()); + + + // Output the nonfinite values using the current (default C) locale. + // The default representations differ from system to system, + // for example, using Microsoft compilers, 1.#INF, -1.#INF, and 1.#QNAN, + // Linux "inf", "-inf", "nan" + cout << "Using C locale" << endl; + cout << "+std::numeric_limits::infinity() = " << plus_infinity << endl; + cout << "-std::numeric_limits::infinity() = " << minus_infinity << endl; + cout << "+std::numeric_limits::quiet_NaN () = " << NaN << endl; + + // Display negated NaN. + cout << "negated NaN " << negated_NaN << endl; // "-1.IND" or "-nan". + + // Create a new output locale, and add the nonfinite_num_put facet + std::locale C99_out_locale (default_locale, new boost::math::nonfinite_num_put); + // and imbue the cout stream with the new locale. + cout.imbue (C99_out_locale); + + // Or for the same effect more concisely: + cout.imbue (locale(locale(), new boost::math::nonfinite_num_put)); + + // Output using the new locale: + cout << "Using C99_out_locale " << endl; + cout << "+std::numeric_limits::infinity() = " << plus_infinity << endl; + cout << "-std::numeric_limits::infinity() = " << minus_infinity << endl; + cout << "+std::numeric_limits::quiet_NaN () = " << NaN << endl; + // Expect "inf", "-inf", "nan". + + // Display negated NaN. + cout << "negated NaN " << negated_NaN << endl; // Expect "-nan". + + // Create a string with the expected C99 representation of plus infinity. + std::string inf = "inf"; + { // Try to read an infinity value using the default C locale. + // Create an input stream which will provide "inf" + std::istringstream iss (inf); + + // Create a double ready to take the input, + double infinity; + // and read "inf" from the stringstream: + iss >> infinity; + + // This will not work on all platforms! (Intel-Linux-13.0.1 fails EXIT STATUS: 139) + if (! iss) + { // Reading infinity went wrong! + std::cerr << "C locale input format error!" << std::endl; + } + } // Using default C locale. + + { // Now retry using C99 facets. + // Create a new input locale and add the nonfinite_num_get facet. + std::locale C99_in_locale (default_locale, new boost::math::nonfinite_num_get); + + // Create an input stream which will provide "inf". + std::istringstream iss (inf); + // Imbue the stream with the C99 input locale. + iss.imbue (C99_in_locale); + + // Create a double ready to take the input, + double infinity; + // and read from the stringstream: + iss >> infinity; + + if (! iss) + { // Reading infinity went wrong! + std::cout << "C99 input format error!" << std::endl; + } + // Expect to get an infinity, which will display still using the C99 locale as "inf" + cout << "infinity in C99 representation is " << infinity << endl; + + // To check, we can switch back to the default C locale. + cout.imbue (default_locale); + cout << "infinity in default C representation is " << infinity << endl; + } // using C99 locale. + + { + // A 'loop-back example, output to a stringstream, and reading it back in. + // Create C99 input and output locales. + std::locale C99_out_locale (default_locale, new boost::math::nonfinite_num_put); + std::locale C99_in_locale (default_locale, new boost::math::nonfinite_num_get); + + std::ostringstream oss; + oss.imbue(C99_out_locale); + oss << plus_infinity; + + std::istringstream iss(oss.str()); // So stream contains "inf". + iss.imbue (C99_in_locale); + + std::string s; + + iss >> s; + + cout.imbue(C99_out_locale); + if (oss.str() != s) + { + cout << plus_infinity << " != " << s << " loopback failed!" << endl; + } + else + { + cout << plus_infinity << " == " << s << " as expected." << endl; + } + } + + + // Example varying the width and position of the nonfinite representations. + // With the nonfinite_num_put and _get facets, the width of the output is constant. + + #ifdef BOOST_NO_CXX11_NUMERIC_LIMITS + cout << "BOOST_NO_CXX11_NUMERIC_LIMITS is defined, so no max_digits10 available." << endl; + std::streamsize max_digits10 = 2 + std::numeric_limits::digits * 30103UL / 100000UL; +#else + // Can use new C++0X max_digits10 (the maximum potentially significant digits). + std::streamsize max_digits10 = std::numeric_limits::max_digits10; +#endif + cout << "std::numeric_limits::max_digits10 is " << max_digits10 << endl; + cout.precision(max_digits10); + + double pi = 3.141592653589793238462643383279502884197169399375105820974944; + // Expect 17 (probably) decimal digits (regardless of locale). + // cout has the default locale. + cout << "pi = " << pi << endl; // pi = 3.1415926535897931 + cout.imbue (C99_out_locale); // Use cout with the C99 locale + // (expect the same output for a double). + cout << "pi = " << pi << endl; // pi = 3.1415926535897931 + + cout << "infinity in C99 representation is " << plus_infinity << endl; + + //int width = 2; // Check effect if width too small is OK. + // (There was a disturbed layout on older MSVC?). + int width = 20; + + // Similarly if we can switch back to the default C locale. + cout.imbue (default_locale); + cout << "infinity in default C representation is " << plus_infinity << endl; + cout << "infinity in default C representation (setw(" << width << ") is |" << setw(width) << plus_infinity <<'|' << endl; + cout << "infinity in default C representation (setw(" << width << ") is |" << left << setw(width) << plus_infinity <<'|' << endl; + cout << "infinity in default C representation (setw(" << width << ") is |" << internal << setw(width) << plus_infinity <<'|' << endl; + + cout.imbue (C99_out_locale); + cout << "infinity in C99 representation (setw(" << width << ") is |" << right << setw(width) << plus_infinity <<'|'<< endl; + cout << "infinity in C99 representation (setw(" << width << ") is |" << left << setw(width) << plus_infinity <<'|'<< endl; + cout << "infinity in C99 representation (setw(" << width << ") is |" << internal << setw(width) << plus_infinity <<'|'<< endl; + + return 0; +} // int main() + +// end of test_nonfinite_num_facets.cpp + +/* + +Output: + +simple_nonfinite_facet.vcxproj -> J:\Cpp\MathToolkit\test\Math_test\Release\nonfinite_facet_simple.exe + Nonfinite_num_facet very simple example. + Using C locale + +std::numeric_limits::infinity() = 1.#INF + -std::numeric_limits::infinity() = -1.#INF + +std::numeric_limits::quiet_NaN () = 1.#QNAN + Using C99_out_locale + +std::numeric_limits::infinity() = inf + -std::numeric_limits::infinity() = -inf + +std::numeric_limits::quiet_NaN () = nan + infinity in C99 representation is inf + infinity in default C representation is 1.#INF + 3 + 3 + inf == inf as expected. + std::numeric_limits::max_digits10 is 17 + pi = 3.1415926535897931 + C locale input format error! + pi = 3.1415926535897931 + infinity in C99 representation is inf + infinity in default C representation is 1.#INF + infinity in default C representation (setw(20) is 1.#INF| + infinity in default C representation (setw(20) is 1.#INF | + infinity in default C representation (setw(20) is 1.#INF| + infinity in C99 representation (setw(20) is inf| + infinity in C99 representation (setw(20) is inf | + infinity in C99 representation (setw(20) is inf| + +*/ diff --git a/src/boost/libs/math/example/nonfinite_facet_sstream.cpp b/src/boost/libs/math/example/nonfinite_facet_sstream.cpp new file mode 100644 index 00000000..9c44edb7 --- /dev/null +++ b/src/boost/libs/math/example/nonfinite_facet_sstream.cpp @@ -0,0 +1,132 @@ +// nonfinite_facet_sstream.cpp + +// Distributed under 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) + +// Copyright (c) 2006 Johan Rade +// Copyright (c) 2011 Paul A. Bristow + +/*! +\file +\brief Examples of nonfinite with output and input facets and stringstreams. + +\detail Contruct a new locale with the nonfinite_num_put and nonfinite_num_get +facets and imbue istringstream, ostringstream and stringstreams, +showing output and input (and loopback for the stringstream). + +*/ + +#include +using boost::math::nonfinite_num_put; +using boost::math::nonfinite_num_get; + +using boost::math::legacy; + +#include +using std::cout; +using std::endl; +#include +using std::locale; + +#include +using std::stringstream; +using std::istringstream; +using std::ostringstream; + +#include +using std::numeric_limits; + +#include + +int main() +{ + //[nonfinite_facets_sstream_1 + locale old_locale; + locale tmp_locale(old_locale, new nonfinite_num_put); + locale new_locale(tmp_locale, new nonfinite_num_get); + //] [/nonfinite_facets_sstream_1] + + // Note that to add two facets, nonfinite_num_put and nonfinite_num_get, + // you have to add one at a time, using a temporary locale. + + { + ostringstream oss; + oss.imbue(new_locale); + double inf = numeric_limits::infinity(); + oss << inf; // Write out. + cout << "infinity output was " << oss.str() << endl; + BOOST_ASSERT(oss.str() == "inf"); + } + { + istringstream iss; + iss.str("inf"); + iss.imbue(new_locale); + double inf; + iss >> inf; // Read from "inf" + cout << "Infinity input was " << iss.str() << endl; + BOOST_ASSERT(inf == numeric_limits::infinity()); + } + + { + //[nonfinite_facets_sstream_2 + stringstream ss; + ss.imbue(new_locale); + double inf = numeric_limits::infinity(); + ss << inf; // Write out. + BOOST_ASSERT(ss.str() == "inf"); + double r; + ss >> r; // Read back in. + BOOST_ASSERT(inf == r); // Confirms that the double values really are identical. + + cout << "infinity output was " << ss.str() << endl; + cout << "infinity input was " << r << endl; + // But the string representation of r displayed will be the native type + // because, when it was constructed, cout had NOT been imbued + // with the new locale containing the nonfinite_numput facet. + // So the cout output will be "1.#INF on MS platforms + // and may be "inf" or other string representation on other platforms. + + //] [/nonfinite_facets_sstream_2] + } + + { + stringstream ss; + ss.imbue(new_locale); + + double nan = numeric_limits::quiet_NaN(); + ss << nan; // Write out. + BOOST_ASSERT(ss.str() == "nan"); + + double v; + ss >> v; // Read back in. + + cout << "NaN output was " << ss.str() << endl; + cout << "NaN input was " << v << endl; + + // assert(nan == v); // Always fails because NaN == NaN fails! + // assert(nan == numeric_limits::quiet_NaN()); asserts! + + // And the string representation will be the native type + // because cout has NOT been imbued with a locale containing + // the nonfinite_numput facet. + // So the output will be "1.#QNAN on MS platforms + // and may be "nan" or other string representation on other platforms. + } + +} // int main() + + +/* +//[nonfinite_facet_sstream_output + +infinity output was inf +Infinity input was inf +infinity output was inf +infinity input was 1.#INF +NaN output was nan +NaN input was 1.#QNAN + +//] [nonfinite_facet_sstream_output] +*/ + diff --git a/src/boost/libs/math/example/nonfinite_legacy.cpp b/src/boost/libs/math/example/nonfinite_legacy.cpp new file mode 100644 index 00000000..2e73fc2f --- /dev/null +++ b/src/boost/libs/math/example/nonfinite_legacy.cpp @@ -0,0 +1,94 @@ +// nonfinite_legacy.cpp + +// Distributed under 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) + +// Copyright (c) 2006 Johan Rade +// Copyright (c) 2011 Paul A. Bristow + +/*! +\file +\brief Basic tests of nonfinite loopback with output and input facet. + +\detail Basic loopback test outputs using the so-called 'legacy' facets, +"1.#INF" and "1.#QNAN". + +and reads back in using nonfinite input 'legacy' facet, and +(if possible) checks if loopback OK. + +*/ + +#include +using boost::math::nonfinite_num_put; +using boost::math::nonfinite_num_get; + +using boost::math::legacy; + +#include +using std::cout; +using std::endl; + +#include +using std::setfill; +using std::setw; + +#include +using std::locale; + +#include +using std::stringstream; +#include +using std::numeric_limits; + +#include + +int main() +{ + // Create a new locale with both the nonfinite facets. + std::locale new_locale(std::locale(std::locale(), + new boost::math::nonfinite_num_put), + new boost::math::nonfinite_num_get); + + { + stringstream ss; + ss.imbue(new_locale); + double inf = numeric_limits::infinity(); + ss << inf; // Write out. + double r; + ss >> r; // Read back in. + + cout << "infinity output was " << inf << endl; + cout << "infinity input was " << r << endl; + + BOOST_ASSERT(inf == r); + } + { + stringstream ss; + ss.imbue(new_locale); + + double nan = numeric_limits::quiet_NaN(); + ss << nan; // Write out. + double v; + ss >> v; // Read back in. + + cout << "NaN output was " << nan << endl; + cout << "NaN input was " << v << endl; + + // BOOST_ASSERT(nan == v); // Always fails because NaN == NaN fails! + // BOOST_ASSERT(nan == numeric_limits::quiet_NaN()); asserts! + } + +} // int main() + +/* + +Output: + +infinity output was 1.#INF +infinity input was 1.#INF +NaN output was 1.#QNAN +NaN input was 1.#QNAN + +*/ + diff --git a/src/boost/libs/math/example/nonfinite_loopback_ok.cpp b/src/boost/libs/math/example/nonfinite_loopback_ok.cpp new file mode 100644 index 00000000..70ccd24b --- /dev/null +++ b/src/boost/libs/math/example/nonfinite_loopback_ok.cpp @@ -0,0 +1,89 @@ +// Distributed under 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) + +// Copyright (c) 2006 Johan Rade +// Copyright (c) 2011 Paul A. Bristow + +/*! +\file +\brief Basic tests of nonfinite loopback. + +\detail Basic loopback test outputs using nonfinite facets +(output and input) and reads back in, and checks if loopback OK. + +Expected to work portably on all platforms. + +*/ + +#ifdef _MSC_VER +# pragma warning(disable : 4702) +# pragma warning(disable : 4127) // conditional expression is constant. +#endif + +#include +using boost::math::nonfinite_num_get; +using boost::math::nonfinite_num_put; + +#include +using std::cout; +using std::endl; + +#include +using std::locale; + +#include +using std::stringstream; +#include +using std::numeric_limits; + +#include + +int main() +{ + + if((std::numeric_limits::has_infinity == false) || (std::numeric_limits::infinity() == 0)) + { + std::cout << "Infinity not supported on this platform." << std::endl; + return 0; + } + + if((std::numeric_limits::has_quiet_NaN == false) || (std::numeric_limits::quiet_NaN() == 0)) + { + std::cout << "NaN not supported on this platform." << std::endl; + return 0; + } + //locale old_locale; // Current global locale. + // Create tmp_locale and store the output nonfinite_num_put facet in it. + //locale tmp_locale(old_locale, new nonfinite_num_put); + // Create new_locale and store the input nonfinite_num_get facet in it. + //locale new_locale(tmp_locale, new nonfinite_num_get); + // Can only add one facet at a time, hence need a tmp_locale, + // unless we write: + + std::locale new_locale(std::locale(std::locale(std::locale(), + new boost::math::nonfinite_num_put), + new boost::math::nonfinite_num_get)); + + stringstream ss; // Both input and output, so need both get and put facets. + + ss.imbue(new_locale); + + double inf = numeric_limits::infinity(); + ss << inf; // Write out. + double r; + ss >> r; // Read back in. + + BOOST_ASSERT(inf == r); // OK MSVC <= 10.0! + +} // int main() + +/* + +Output: + +nonfinite_loopback_ok.vcxproj -> J:\Cpp\fp_facet\fp_facet\Debug\nonfinite_loopback_ok.exe + +*/ + + diff --git a/src/boost/libs/math/example/nonfinite_num_facet.cpp b/src/boost/libs/math/example/nonfinite_num_facet.cpp new file mode 100644 index 00000000..80e4e814 --- /dev/null +++ b/src/boost/libs/math/example/nonfinite_num_facet.cpp @@ -0,0 +1,291 @@ +/** nonfinite_num_facet.cpp + * + * Copyright (c) 2011 Francois Mauger + * Copyright (c) 2011 Paul A. Bristow + * + * Distributed under 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) + * + * This simple program illustrates how to use the + * `boost/math/nonfinite_num_facets.hpp' material from the original + * Floating Point Utilities contribution by Johan Rade. + * Floating Point Utility library has been accepted into Boost, + * but the utilities have been/will be incorporated into Boost.Math library. + * +\file + +\brief A fairly simple example of using non_finite_num facet for +C99 standard output of infinity and NaN. + +\detail This program illustrates how to use the + `boost/math/nonfinite_num_facets.hpp' material from the original + Floating Point Utilities contribution by Johan Rade. + Floating Point Utility library has been accepted into Boost, + but the utilities have been/will be incorporated into Boost.Math library. + + Based on an example from Francois Mauger. + + Double and float variables are assigned ordinary finite values (pi), + and nonfinite like infinity and NaN. + + These values are then output and read back in, and then redisplayed. + +*/ + +#ifdef _MSC_VER +# pragma warning(disable : 4127) // conditional expression is constant. +#endif + +#include +#include +using std::cout; +using std::endl; + +#include // numeric_limits +using std::numeric_limits; + +#include + +#include + +static const char sep = ','; // Separator of bracketed float and double values. + +// Use max_digits10 (or equivalent) to obtain +// all potentially significant decimal digits for the floating-point types. + +#ifdef BOOST_NO_CXX11_NUMERIC_LIMITS + std::streamsize max_digits10_float = 2 + std::numeric_limits::digits * 30103UL / 100000UL; + std::streamsize max_digits10_double = 2 + std::numeric_limits::digits * 30103UL / 100000UL; +#else + // Can use new C++0X max_digits10 (the maximum potentially significant digits). + std::streamsize max_digits10_float = std::numeric_limits::max_digits10; + std::streamsize max_digits10_double = std::numeric_limits::max_digits10; +#endif + + +/* A class with a float and a double */ +struct foo +{ + foo () : fvalue (3.1415927F), dvalue (3.1415926535897931) + { + } + // Set both the values to -infinity : + void minus_infinity () + { + fvalue = -std::numeric_limits::infinity (); + dvalue = -std::numeric_limits::infinity (); + return; + } + // Set the values to +infinity : + void plus_infinity () + { + fvalue = +std::numeric_limits::infinity (); + dvalue = +std::numeric_limits::infinity (); + return; + } + // Set the values to NaN : + void nan () + { + fvalue = +std::numeric_limits::quiet_NaN (); + dvalue = +std::numeric_limits::quiet_NaN (); + return; + } + // Print a foo: + void print (std::ostream & a_out, const std::string & a_title) + { + if (a_title.empty ()) a_out << "foo"; + else a_out << a_title; + a_out << " : " << std::endl; + a_out << "|-- " << "fvalue = "; + + a_out.precision (max_digits10_float); + a_out << fvalue << std::endl; + a_out << "`-- " << "dvalue = "; + a_out.precision (max_digits10_double); + a_out << dvalue << std::endl; + return; + } + + // I/O operators for a foo structure of a float and a double : + friend std::ostream & operator<< (std::ostream & a_out, const foo & a_foo); + friend std::istream & operator>> (std::istream & a_in, foo & a_foo); + + // Attributes : + float fvalue; // Single precision floating number. + double dvalue; // Double precision floating number. +}; + +std::ostream & operator<< (std::ostream & a_out, const foo & a_foo) +{ // Output bracketed FPs, for example "(3.1415927,3.1415926535897931)" + a_out.precision (max_digits10_float); + a_out << "(" << a_foo.fvalue << sep ; + a_out.precision (max_digits10_double); + a_out << a_foo.dvalue << ")"; + return a_out; +} + +std::istream & operator>> (std::istream & a_in, foo & a_foo) +{ // Input bracketed floating-point values into a foo structure, + // for example from "(3.1415927,3.1415926535897931)" + char c = 0; + a_in.get (c); + if (c != '(') + { + std::cerr << "ERROR: operator>> No ( " << std::endl; + a_in.setstate(std::ios::failbit); + return a_in; + } + float f; + a_in >> std::ws >> f; + if (! a_in) + { + return a_in; + } + a_in >> std::ws; + a_in.get (c); + if (c != sep) + { + std::cerr << "ERROR: operator>> c='" << c << "'" << std::endl; + std::cerr << "ERROR: operator>> No '" << sep << "'" << std::endl; + a_in.setstate(std::ios::failbit); + return a_in; + } + double d; + a_in >> std::ws >> d; + if (! a_in) + { + return a_in; + } + a_in >> std::ws; + a_in.get (c); + if (c != ')') + { + std::cerr << "ERROR: operator>> No ) " << std::endl; + a_in.setstate(std::ios::failbit); + return a_in; + } + a_foo.fvalue = f; + a_foo.dvalue = d; + return a_in; +} // std::istream & operator>> (std::istream & a_in, foo & a_foo) + +int main () +{ + std::cout << "nonfinite_num_facet simple example." << std::endl; + + if((std::numeric_limits::has_infinity == false) || (std::numeric_limits::infinity() == 0)) + { + std::cout << "Infinity not supported on this platform." << std::endl; + return 0; + } + + if((std::numeric_limits::has_quiet_NaN == false) || (std::numeric_limits::quiet_NaN() == 0)) + { + std::cout << "NaN not supported on this platform." << std::endl; + return 0; + } + +#ifdef BOOST_NO_CXX11_NUMERIC_LIMITS + cout << "BOOST_NO_CXX11_NUMERIC_LIMITS is defined, so no max_digits10 available either:" + "\n we'll have to calculate our own version." << endl; +#endif + std::cout << "std::numeric_limits::max_digits10 is " << max_digits10_float << endl; + std::cout << "std::numeric_limits::max_digits10 is " << max_digits10_double << endl; + + std::locale the_default_locale (std::locale::classic ()); + + { + std::cout << "Write to a string buffer (using default locale) :" << std::endl; + foo f0; // pi + foo f1; f1.minus_infinity (); + foo f2; f2.plus_infinity (); + foo f3; f3.nan (); + + f0.print (std::cout, "f0"); // pi + f1.print (std::cout, "f1"); // +inf + f2.print (std::cout, "f2"); // -inf + f3.print (std::cout, "f3"); // NaN + + std::ostringstream oss; + std::locale C99_out_locale (the_default_locale, new boost::math::nonfinite_num_put); + oss.imbue (C99_out_locale); + oss.precision (15); + oss << f0 << f1 << f2 << f3; + std::cout << "Output in C99 format is: \"" << oss.str () << "\"" << std::endl; + std::cout << "Output done." << std::endl; + } + + { + std::string the_string = "(3.1415927,3.1415926535897931)(-inf,-inf)(inf,inf)(nan,nan)"; // C99 format + // Must have correct separator! + std::cout << "Read C99 format from a string buffer containing \"" << the_string << "\""<< std::endl; + + std::locale C99_in_locale (the_default_locale, new boost::math::nonfinite_num_get); + std::istringstream iss (the_string); + iss.imbue (C99_in_locale); + + foo f0, f1, f2, f3; + iss >> f0 >> f1 >> f2 >> f3; + if (! iss) + { + std::cerr << "Input Format error !" << std::endl; + } + else + { + std::cerr << "Input OK." << std::endl; + cout << "Display in default locale format " << endl; + f0.print (std::cout, "f0"); + f1.print (std::cout, "f1"); + f2.print (std::cout, "f2"); + f3.print (std::cout, "f3"); + } + std::cout << "Input done." << std::endl; + } + + std::cout << "End nonfinite_num_facet.cpp" << std::endl; + return 0; +} // int main() + + // end of test_nonfinite_num_facets.cpp + +/* + +Output: + +nonfinite_num_facet simple example. + std::numeric_limits::max_digits10 is 8 + std::numeric_limits::max_digits10 is 17 + Write to a string buffer (using default locale) : + f0 : + |-- fvalue = 3.1415927 + `-- dvalue = 3.1415926535897931 + f1 : + |-- fvalue = -1.#INF + `-- dvalue = -1.#INF + f2 : + |-- fvalue = 1.#INF + `-- dvalue = 1.#INF + f3 : + |-- fvalue = 1.#QNAN + `-- dvalue = 1.#QNAN + Output in C99 format is: "(3.1415927,3.1415926535897931)(-inf,-inf)(inf,inf)(nan,nan)" + Output done. + Read C99 format from a string buffer containing "(3.1415927,3.1415926535897931)(-inf,-inf)(inf,inf)(nan,nan)" + Display in default locale format + f0 : + |-- fvalue = 3.1415927 + `-- dvalue = 3.1415926535897931 + f1 : + |-- fvalue = -1.#INF + `-- dvalue = -1.#INF + f2 : + |-- fvalue = 1.#INF + `-- dvalue = 1.#INF + f3 : + |-- fvalue = 1.#QNAN + `-- dvalue = 1.#QNAN + Input done. + End nonfinite_num_facet.cpp + +*/ diff --git a/src/boost/libs/math/example/nonfinite_num_facet_serialization.cpp b/src/boost/libs/math/example/nonfinite_num_facet_serialization.cpp new file mode 100644 index 00000000..e2972a10 --- /dev/null +++ b/src/boost/libs/math/example/nonfinite_num_facet_serialization.cpp @@ -0,0 +1,433 @@ +/** nonfinite_num_facet_serialization.cpp + * + * Copyright (c) 2011 Francois Mauger + * Copyright (c) 2011 Paul A. Bristow + * + * Distributed under 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) + * + * This sample program by Francois Mauger illustrates how to use the + * `boost/math/nonfinite_num_facets.hpp' material from the original + * Floating Point Utilities contribution by Johan Rade. Here it is + * shown how non finite floating number can be serialized and + * deserialized from I/O streams and/or Boost text/XML archives. It + * produces two archives stored in `test.txt' and `test.xml' files. + * + * Tested with Boost 1.44, gcc 4.4.1, Linux/i686 (32bits). + * Tested with Boost.1.46.1 MSVC 10.0 32 bit. + */ + +#ifdef _MSC_VER +# pragma warning(push) +//# pragma warning(disable : 4100) // unreferenced formal parameter. +#endif + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +// from the Floating Point Utilities : +#include + +static const char sep = ','; // Separator of bracketed float and double values. + +// Use max_digits10 (or equivalent) to obtain +// all potentially significant decimal digits for the floating-point types. + +#ifdef BOOST_NO_CXX11_NUMERIC_LIMITS + std::streamsize max_digits10_float = 2 + std::numeric_limits::digits * 30103UL / 100000UL; + std::streamsize max_digits10_double = 2 + std::numeric_limits::digits * 30103UL / 100000UL; +#else + // Can use new C++0X max_digits10 (the maximum potentially significant digits). + std::streamsize max_digits10_float = std::numeric_limits::max_digits10; + std::streamsize max_digits10_double = std::numeric_limits::max_digits10; +#endif + + +/* A class with a float and a double */ +struct foo +{ + foo () : fvalue (3.1415927F), dvalue (3.1415926535897931) + { // Construct using 32 and 64-bit max_digits10 decimal digits value of pi. + } + // Set the values at -infinity : + void minus_infinity () + { + fvalue = -std::numeric_limits::infinity (); + dvalue = -std::numeric_limits::infinity (); + return; + } + // Set the values at +infinity : + void plus_infinity () + { + fvalue = +std::numeric_limits::infinity (); + dvalue = +std::numeric_limits::infinity (); + return; + } + // Set the values at NaN : + void nan () + { + fvalue = +std::numeric_limits::quiet_NaN (); + dvalue = +std::numeric_limits::quiet_NaN (); + return; + } + // Print : + void print (std::ostream & a_out, const std::string & a_title) + { + if (a_title.empty ()) a_out << "foo"; + else a_out << a_title; + a_out << " : " << std::endl; + a_out << "|-- " << "fvalue = "; + a_out.precision (7); + a_out << fvalue << std::endl; + a_out << "`-- " << "dvalue = "; + a_out.precision (15); + a_out << dvalue << std::endl; + return; + } + + // I/O operators : + friend std::ostream & operator<< (std::ostream & a_out, const foo & a_foo); + friend std::istream & operator>> (std::istream & a_in, foo & a_foo); + + // Boost serialization : + template + void serialize (Archive & ar, int /*version*/) + { + ar & BOOST_SERIALIZATION_NVP (fvalue); + ar & BOOST_SERIALIZATION_NVP (dvalue); + return; + } + + // Attributes : + float fvalue; // Single precision floating-point number. + double dvalue; // Double precision floating-point number. +}; + +std::ostream & operator<< (std::ostream & a_out, const foo & a_foo) +{ // Output bracketed FPs, for example "(3.1415927,3.1415926535897931)" + a_out.precision (max_digits10_float); + a_out << "(" << a_foo.fvalue << sep ; + a_out.precision (max_digits10_double); + a_out << a_foo.dvalue << ")"; + return a_out; +} + +std::istream & operator>> (std::istream & a_in, foo & a_foo) +{ // Input bracketed floating-point values into a foo structure, + // for example from "(3.1415927,3.1415926535897931)" + char c = 0; + a_in.get (c); + if (c != '(') + { + std::cerr << "ERROR: operator>> No ( " << std::endl; + a_in.setstate(std::ios::failbit); + return a_in; + } + float f; + a_in >> std::ws >> f; + if (! a_in) + { + return a_in; + } + a_in >> std::ws; + a_in.get (c); + if (c != sep) + { + std::cerr << "ERROR: operator>> c='" << c << "'" << std::endl; + std::cerr << "ERROR: operator>> No '" << sep << "'" << std::endl; + a_in.setstate(std::ios::failbit); + return a_in; + } + double d; + a_in >> std::ws >> d; + if (! a_in) + { + return a_in; + } + a_in >> std::ws; + a_in.get (c); + if (c != ')') + { + std::cerr << "ERROR: operator>> No ) " << std::endl; + a_in.setstate(std::ios::failbit); + return a_in; + } + a_foo.fvalue = f; + a_foo.dvalue = d; + return a_in; +} + +int main (void) +{ + std::clog << std::endl + << "Nonfinite_serialization.cpp' example program." << std::endl; + +#ifdef BOOST_NO_CXX11_NUMERIC_LIMITS + std::cout << "BOOST_NO_CXX11_NUMERIC_LIMITS is defined, so no max_digits10 available either," + "using our own version instead." << std::endl; +#endif + std::cout << "std::numeric_limits::max_digits10 is " << max_digits10_float << std::endl; + std::cout << "std::numeric_limits::max_digits10 is " << max_digits10_double << std::endl; + + std::locale the_default_locale (std::locale::classic (), + new boost::archive::codecvt_null); + + // Demonstrate use of nonfinite facets with stringstreams. + { + std::clog << "Construct some foo structures with a finite and nonfinites." << std::endl; + foo f0; + foo f1; f1.minus_infinity (); + foo f2; f2.plus_infinity (); + foo f3; f3.nan (); + // Display them. + f0.print (std::clog, "f0"); + f1.print (std::clog, "f1"); + f2.print (std::clog, "f2"); + f3.print (std::clog, "f3"); + std::clog << " Write to a string buffer." << std::endl; + + std::ostringstream oss; + std::locale the_out_locale (the_default_locale, new boost::math::nonfinite_num_put); + oss.imbue (the_out_locale); + oss.precision (max_digits10_double); + oss << f0 << f1 << f2 << f3; + std::clog << "Output is: `" << oss.str () << "'" << std::endl; + std::clog << "Done output to ostringstream." << std::endl; + } + + { + std::clog << "Read foo structures from a string buffer." << std::endl; + + std::string the_string = "(3.1415927,3.1415926535897931)(-inf,-inf)(inf,inf)(nan,nan)"; + std::clog << "Input is: `" << the_string << "'" << std::endl; + + std::locale the_in_locale (the_default_locale, new boost::math::nonfinite_num_get); + std::istringstream iss (the_string); + iss.imbue (the_in_locale); + + foo f0, f1, f2, f3; + iss >> f0 >> f1 >> f2 >> f3; + if (! iss) + { + std::cerr << "Format error !" << std::endl; + } + else + { + std::cerr << "Read OK." << std::endl; + f0.print (std::clog, "f0"); + f1.print (std::clog, "f1"); + f2.print (std::clog, "f2"); + f3.print (std::clog, "f3"); + } + std::clog << "Done input from istringstream." << std::endl; + } + + { // Demonstrate use of nonfinite facets for Serialization with Boost text archives. + std::clog << "Serialize (using Boost text archive)." << std::endl; + // Construct some foo structures with a finite and nonfinites. + foo f0; + foo f1; f1.minus_infinity (); + foo f2; f2.plus_infinity (); + foo f3; f3.nan (); + // Display them. + f0.print (std::clog, "f0"); + f1.print (std::clog, "f1"); + f2.print (std::clog, "f2"); + f3.print (std::clog, "f3"); + + std::locale the_out_locale (the_default_locale, new boost::math::nonfinite_num_put); + // Use a temporary folder .temps (which contains "boost-no-inspect" so that it will not be inspected, and made 'hidden' too). + std::ofstream fout ("./.temps/nonfinite_archive_test.txt"); + fout.imbue (the_out_locale); + boost::archive::text_oarchive toar (fout, boost::archive::no_codecvt); + // Write to archive. + toar & f0; + toar & f1; + toar & f2; + toar & f3; + std::clog << "Done." << std::endl; + } + + { + std::clog << "Deserialize (Boost text archive)..." << std::endl; + std::locale the_in_locale (the_default_locale, new boost::math::nonfinite_num_get); + // Use a temporary folder .temps (which contains "boost-no-inspect" so that it will not be inspected, and made 'hidden' too). + std::ifstream fin ("./.temps/nonfinite_archive_test.txt"); + fin.imbue (the_in_locale); + boost::archive::text_iarchive tiar (fin, boost::archive::no_codecvt); + foo f0, f1, f2, f3; + // Read from archive. + tiar & f0; + tiar & f1; + tiar & f2; + tiar & f3; + // Display foos. + f0.print (std::clog, "f0"); + f1.print (std::clog, "f1"); + f2.print (std::clog, "f2"); + f3.print (std::clog, "f3"); + + std::clog << "Done." << std::endl; + } + + { // Demonstrate use of nonfinite facets for Serialization with Boost XML Archive. + std::clog << "Serialize (Boost XML archive)..." << std::endl; + // Construct some foo structures with a finite and nonfinites. + foo f0; + foo f1; f1.minus_infinity (); + foo f2; f2.plus_infinity (); + foo f3; f3.nan (); + // Display foos. + f0.print (std::clog, "f0"); + f1.print (std::clog, "f1"); + f2.print (std::clog, "f2"); + f3.print (std::clog, "f3"); + + std::locale the_out_locale (the_default_locale, new boost::math::nonfinite_num_put); + // Use a temporary folder /.temps (which contains "boost-no-inspect" so that it will not be inspected, and made 'hidden' too). + std::ofstream fout ("./.temps/nonfinite_XML_archive_test.txt"); + fout.imbue (the_out_locale); + boost::archive::xml_oarchive xoar (fout, boost::archive::no_codecvt); + + xoar & BOOST_SERIALIZATION_NVP (f0); + xoar & BOOST_SERIALIZATION_NVP (f1); + xoar & BOOST_SERIALIZATION_NVP (f2); + xoar & BOOST_SERIALIZATION_NVP (f3); + std::clog << "Done." << std::endl; + } + + { + std::clog << "Deserialize (Boost XML archive)..." << std::endl; + std::locale the_in_locale (the_default_locale, new boost::math::nonfinite_num_get); + // Use a temporary folder /.temps (which contains "boost-no-inspect" so that it will not be inspected, and made 'hidden' too). + std::ifstream fin ("./.temps/nonfinite_XML_archive_test.txt"); // Previously written above. + fin.imbue (the_in_locale); + boost::archive::xml_iarchive xiar (fin, boost::archive::no_codecvt); + foo f0, f1, f2, f3; + + xiar & BOOST_SERIALIZATION_NVP (f0); + xiar & BOOST_SERIALIZATION_NVP (f1); + xiar & BOOST_SERIALIZATION_NVP (f2); + xiar & BOOST_SERIALIZATION_NVP (f3); + + f0.print (std::clog, "f0"); + f1.print (std::clog, "f1"); + f2.print (std::clog, "f2"); + f3.print (std::clog, "f3"); + + std::clog << "Done." << std::endl; + } + + std::clog << "End nonfinite_serialization.cpp' example program." << std::endl; + return 0; +} + +/* + +Output: + + Nonfinite_serialization.cpp' example program. + std::numeric_limits::max_digits10 is 8 + std::numeric_limits::max_digits10 is 17 + Construct some foo structures with a finite and nonfinites. + f0 : + |-- fvalue = 3.141593 + `-- dvalue = 3.14159265358979 + f1 : + |-- fvalue = -1.#INF + `-- dvalue = -1.#INF + f2 : + |-- fvalue = 1.#INF + `-- dvalue = 1.#INF + f3 : + |-- fvalue = 1.#QNAN + `-- dvalue = 1.#QNAN + Write to a string buffer. + Output is: `(3.1415927,3.1415926535897931)(-inf,-inf)(inf,inf)(nan,nan)' + Done output to ostringstream. + Read foo structures from a string buffer. + Input is: `(3.1415927,3.1415926535897931)(-inf,-inf)(inf,inf)(nan,nan)' + Read OK. + f0 : + |-- fvalue = 3.141593 + `-- dvalue = 3.14159265358979 + f1 : + |-- fvalue = -1.#INF + `-- dvalue = -1.#INF + f2 : + |-- fvalue = 1.#INF + `-- dvalue = 1.#INF + f3 : + |-- fvalue = 1.#QNAN + `-- dvalue = 1.#QNAN + Done input from istringstream. + Serialize (using Boost text archive). + f0 : + |-- fvalue = 3.141593 + `-- dvalue = 3.14159265358979 + f1 : + |-- fvalue = -1.#INF + `-- dvalue = -1.#INF + f2 : + |-- fvalue = 1.#INF + `-- dvalue = 1.#INF + f3 : + |-- fvalue = 1.#QNAN + `-- dvalue = 1.#QNAN + Done. + Deserialize (Boost text archive)... + f0 : + |-- fvalue = 3.141593 + `-- dvalue = 3.14159265358979 + f1 : + |-- fvalue = -1.#INF + `-- dvalue = -1.#INF + f2 : + |-- fvalue = 1.#INF + `-- dvalue = 1.#INF + f3 : + |-- fvalue = 1.#QNAN + `-- dvalue = 1.#QNAN + Done. + Serialize (Boost XML archive)... + f0 : + |-- fvalue = 3.141593 + `-- dvalue = 3.14159265358979 + f1 : + |-- fvalue = -1.#INF + `-- dvalue = -1.#INF + f2 : + |-- fvalue = 1.#INF + `-- dvalue = 1.#INF + f3 : + |-- fvalue = 1.#QNAN + `-- dvalue = 1.#QNAN + Done. + Deserialize (Boost XML archive)... + f0 : + |-- fvalue = 3.141593 + `-- dvalue = 3.14159265358979 + f1 : + |-- fvalue = -1.#INF + `-- dvalue = -1.#INF + f2 : + |-- fvalue = 1.#INF + `-- dvalue = 1.#INF + f3 : + |-- fvalue = 1.#QNAN + `-- dvalue = 1.#QNAN + Done. + End nonfinite_serialization.cpp' example program. + + */ diff --git a/src/boost/libs/math/example/nonfinite_num_facet_trap.cpp b/src/boost/libs/math/example/nonfinite_num_facet_trap.cpp new file mode 100644 index 00000000..9a4b2d58 --- /dev/null +++ b/src/boost/libs/math/example/nonfinite_num_facet_trap.cpp @@ -0,0 +1,115 @@ + +/** nonfinite_num_facet_trap.cpp +* +* Copyright (c) 2012 Paul A. Bristow +* +* Distributed under 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) +* +* This very simple program illustrates how to use the +* `boost/math/nonfinite_num_facets.hpp` trapping output of infinity and/or NaNs. +* +\file + +\brief A very simple example of using non_finite_num facet for +trapping output of infinity and/or NaNs. + +\note To actually get an exception throw by the iostream library +one must enable exceptions. + `oss.exceptions(std::ios_base::failbit | std::ios_base::badbit);` +\note Which bit is set is implementation dependent, so enable exceptions for both. + +This is a fairly brutal method of catching nonfinites on output, +but may suit some applications. + +*/ + +#ifdef _MSC_VER +# pragma warning(disable : 4127) // conditional expression is constant. +// assumes C++ exceptions enabled /EHsc +#endif + +#include +#include + +#include +#include +using std::cout; +using std::endl; +using std::hex; +#include +#include // numeric_limits +using std::numeric_limits; + +int main() +{ + using namespace boost::math; + + std::cout << "nonfinite_num_facet_trap.cpp" << std::endl; + + const double inf = +std::numeric_limits::infinity (); + const double nan = +std::numeric_limits::quiet_NaN (); + + { // Output infinity and NaN with default flags (no trapping). + std::ostringstream oss; + std::locale default_locale (std::locale::classic ()); + std::locale C99_out_locale (default_locale, new boost::math::nonfinite_num_put); + oss.imbue (C99_out_locale); + oss.exceptions(std::ios_base::failbit | std::ios_base::badbit); + oss << inf << ' ' << nan; + cout << "oss.rdstate() = " << hex << oss.rdstate() << endl; // 0 + cout << "os.str() = " << oss.str() << endl; // os.str() = inf nan + } + + try + { // // Output infinity with flags set to trap and catch any infinity. + std::ostringstream oss; + std::locale default_locale (std::locale::classic ()); + std::locale C99_out_locale (default_locale, new boost::math::nonfinite_num_put(trap_infinity)); + oss.imbue (C99_out_locale); + oss.exceptions(std::ios_base::failbit | std::ios_base::badbit); + // Note that which bit is set is implementation dependent, so enable exceptions for both. + oss << inf; + cout << "oss.rdstate() = " << hex << oss.rdstate() << endl; + cout << "oss.str() = " << oss.str() << endl; + } + catch(const std::ios_base::failure& e) + { // Expect "Infinity". + std::cout << "\n""Message from thrown exception was: " << e.what() << std::endl; + } + + try + { // // Output NaN with flags set to catch any NaNs. + std::ostringstream oss; + std::locale default_locale (std::locale::classic ()); + std::locale C99_out_locale (default_locale, new boost::math::nonfinite_num_put(trap_nan)); + oss.imbue (C99_out_locale); + oss.exceptions(std::ios_base::failbit | std::ios_base::badbit); + // Note that which bit is set is implementation dependent, so enable exceptions for both. + oss << nan; + cout << "oss.str() = " << oss.str() << endl; + } + catch(const std::ios_base::failure& e) + { // Expect "Infinity". + std::cout << "\n""Message from thrown exception was: " << e.what() << std::endl; + } + + + return 0; // end of nonfinite_num_facet_trap.cpp +} // int main() + + +/* + +Output: + + nonfinite_num_facet_trap.cpp + oss.rdstate() = 0 + os.str() = inf nan + + Message from thrown exception was: Infinity + + Message from thrown exception was: NaN + +*/ diff --git a/src/boost/libs/math/example/nonfinite_serialization_archives.cpp b/src/boost/libs/math/example/nonfinite_serialization_archives.cpp new file mode 100644 index 00000000..f39a8a61 --- /dev/null +++ b/src/boost/libs/math/example/nonfinite_serialization_archives.cpp @@ -0,0 +1,136 @@ +/** nonfinite_serialization_archives.cpp +* +* Copyright (c) 2011 Paul A. Bristow +* +* Distributed under 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) +* +* This very simple program illustrates how to use the +* `boost/math/nonfinite_num_facets.hpp' to obtain C99 +* representation of infinity and NaN. +* From the original Floating Point Utilities contribution by Johan Rade. +* Floating Point Utility library has been accepted into Boost, +* but the utilities are incorporated into Boost.Math library. +* +\file + +\brief A simple example of using non_finite_num facet for +C99 standard output of infinity and NaN in serialization archives. + +\detail This example shows how to create a C99 non-finite locale, +and imbue input and output streams with the non_finite_num put and get facets. +This allow output and input of infinity and NaN in a Standard portable way, +This permits 'loop-back' of output back into input (and portably across different system too). +This is particularly useful when used with Boost.Seralization so that non-finite NaNs and infinity +values in text and xml archives can be handled correctly and portably. + +*/ + + +#ifdef _MSC_VER +# pragma warning(disable : 4127) // conditional expression is constant. +#endif + + +#include +using boost::archive::text_oarchive; +#include +using boost::archive::codecvt_null; +using boost::archive::no_codecvt; + +#include +using boost::math::nonfinite_num_get; +using boost::math::nonfinite_num_put; + +#include +using std::cout; +using std::endl; +using std::cerr; + +#include +using std::setw; +using std::left; +using std::right; +using std::internal; + +#include +using std::string; + +#include +using std::istringstream; + +#include +using std::ofstream; + +#include +using std::numeric_limits; + +#include +using std::locale; + + +/* +Use with serialization archives. + +It is important that the same locale is used +when an archive is saved and when it is loaded. +Otherwise, loading the archive may fail. + +By default, archives are saved and loaded with a classic C locale with a +`boost::archive::codecvt_null` facet added. +Normally you do not have to worry about that. +The constructors for the archive classes, as a side-effect, +imbue the stream with such a locale. + +However, if you want to use the facets `nonfinite_num_put` and `nonfinite_num_get` +with archives,`then you have to manage the locale manually. + +That is done by calling the archive constructor with the flag `boost::archive::no_codecvt`. +Then the archive constructor will not imbue the stream with a new locale. + +The following code shows how to use `nonfinite_num_put` with a `text_oarchive`: + +*/ + +int main() +{ + + if((std::numeric_limits::has_infinity == false) || (std::numeric_limits::infinity() == 0)) + { + std::cout << "Infinity not supported on this platform." << std::endl; + return 0; + } + + if((std::numeric_limits::has_quiet_NaN == false) || (std::numeric_limits::quiet_NaN() == 0)) + { + std::cout << "NaN not supported on this platform." << std::endl; + return 0; + } + + locale default_locale(locale::classic(), new boost::archive::codecvt_null); + // codecvt_null so the archive constructor will not imbue the stream with a new locale. + + locale my_locale(default_locale, new nonfinite_num_put); + // Add nonfinite_num_put facet to locale. + + // Use a temporary folder /.temps (which contains "boost-no-inspect" so that it will not be inspected, and made 'hidden' too). + ofstream ofs("./.temps/test.txt"); + ofs.imbue(my_locale); + + boost::archive::text_oarchive oa(ofs, no_codecvt); + + double x = numeric_limits::infinity(); + oa & x; + +} // int main() + + +/* The same method works with nonfinite_num_get and text_iarchive. + +If you use the trap_infinity and trap_nan flags with a serialization archive, +then you must set the exception mask of the stream. +Serialization archives do not check the stream state. + + +*/ diff --git a/src/boost/libs/math/example/nonfinite_signaling_NaN.cpp b/src/boost/libs/math/example/nonfinite_signaling_NaN.cpp new file mode 100644 index 00000000..98ccdd1d --- /dev/null +++ b/src/boost/libs/math/example/nonfinite_signaling_NaN.cpp @@ -0,0 +1,189 @@ +// Distributed under 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) + +// Copyright (c) 2006 Johan Rade +// Copyright (c) 2011 Paul A. Bristow + +/*! +\file +\brief Tests of nonfinite signaling NaN loopback. + +\detail nonfinite signaling NaN +test outputs using nonfinite facets +(output and input) and reads back in, and checks if loopback OK. + +Not expected to work on all platforms (if any). But shows that on MSVC, +this legacy locale can ensure a consistent quiet NaN input from representations +"1.#QNAN", "1.#SNAN" and "1.#IND" + +*/ + +#ifdef _MSC_VER +# pragma warning(disable : 4702) +#endif + +#include +using boost::math::nonfinite_num_get; +using boost::math::nonfinite_num_put; + +#include +using std::cout; +using std::endl; + +#include +using std::locale; + +#include +using std::string; + +#include + using std::stringstream; + using std::istringstream; + +#include +using std::numeric_limits; + +int main() +{ + if((std::numeric_limits::has_infinity == false) || (std::numeric_limits::infinity() == 0)) + { + std::cout << "Infinity not supported on this platform." << std::endl; + return 0; + } + + if((std::numeric_limits::has_quiet_NaN == false) || (std::numeric_limits::quiet_NaN() == 0)) + { + std::cout << "NaN not supported on this platform." << std::endl; + return 0; + } + + locale default_locale; // Current global locale. + // Try to use the default locale first. + // On MSVC this doesn't work. + + { // Try Quiet NaN + stringstream ss; // Both input and output. + ss.imbue(default_locale); // Redundant, of course. + string infs; + if(numeric_limits::has_quiet_NaN) + { // Make sure quiet NaN is specialised for type double. + double qnan = numeric_limits::quiet_NaN(); + ss << qnan; // Output quiet_NaN. + infs = ss.str(); // + } + else + { // Need to provide a suitable string for quiet NaN. + infs = "1.#QNAN"; + ss << infs; + } + double r; + ss >> r; // Read back in. + + cout << "quiet_NaN output was " << infs << endl; // "1.#QNAN" + cout << "quiet_NaN input was " << r << endl; // "1" + } + +#if (!defined __BORLANDC__ && !defined __CODEGEARC__) + // These compilers trap when trying to create a signaling_NaN! + { // Try Signaling NaN + stringstream ss; // Both input and output. + ss.imbue(default_locale); // Redundant, of course. + string infs; + if(numeric_limits::has_signaling_NaN) + { // Make sure signaling NaN is specialised for type double. + double qnan = numeric_limits::signaling_NaN(); + ss << qnan; // Output signaling_NaN. + infs = ss.str(); // + } + else + { // Need to provide a suitable string for signaling NaN. + infs = "1.#SNAN"; + ss << infs; + } + double r; + ss >> r; // Read back in. + + cout << "signaling_NaN output was " << infs << endl; // "1.#QNAN" (or "1.#SNAN"?) + cout << "signaling_NaN input was " << r << endl; // "1" + } +#endif // Not Borland or CodeGear. + + // Create legacy_locale and store the nonfinite_num_get facet (with legacy flag) in it. + locale legacy_locale(default_locale, new nonfinite_num_get(boost::math::legacy)); + // Note that the legacy flag has no effect on the nonfinite_num_put output facet. + + cout << "Use legacy locale." << endl; + + { // Try infinity. + stringstream ss; // Both input and output. + ss.imbue(legacy_locale); + string infs; + if(numeric_limits::has_infinity) + { // Make sure infinity is specialised for type double. + double inf = numeric_limits::infinity(); + ss << inf; // Output infinity. + infs = ss.str(); // + } + else + { // Need to provide a suitable string for infinity. + infs = "1.#INF"; + ss << infs; + } + double r; + ss >> r; // Read back in. + + cout << "infinity output was " << infs << endl; // "1.#INF" + cout << "infinity input was " << r << endl; // "1.#INF" + } + + { // Try input of "1.#SNAN". + //double inf = numeric_limits::signaling_NaN(); // Assigns "1.#QNAN" on MSVC. + // So must use explicit string "1.#SNAN" instead. + stringstream ss; // Both input and output. + ss.imbue(legacy_locale); + string s = "1.#SNAN"; + + ss << s; // Write out. + double r; + + ss >> r; // Read back in. + + cout << "SNAN output was " << s << endl; // "1.#SNAN" + cout << "SNAN input was " << r << endl; // "1.#QNAN" + } + + { // Try input of "1.#IND" . + stringstream ss; // Both input and output. + ss.imbue(legacy_locale); + string s = "1.#IND"; + ss << s; // Write out. + double r; + ss >> r; // Read back in. + + cout << "IND output was " << s << endl; // "1.#IND" + cout << "IND input was " << r << endl; // "1.#QNAN" + } + +} // int main() + +/* + +Output: + nonfinite_signaling_NaN.vcxproj -> J:\Cpp\fp_facet\fp_facet\Debug\nonfinite_signaling_NaN.exe + + quiet_NaN output was 1.#QNAN + quiet_NaN input was 1 + signaling_NaN output was 1.#QNAN + signaling_NaN input was 1 + Use legacy locale. + infinity output was 1.#INF + infinity input was 1.#INF + SNAN output was 1.#SNAN + SNAN input was 1.#QNAN + IND output was 1.#IND + IND input was 1.#QNAN + + +*/ + diff --git a/src/boost/libs/math/example/normal_misc_examples.cpp b/src/boost/libs/math/example/normal_misc_examples.cpp new file mode 100644 index 00000000..3d0f3acf --- /dev/null +++ b/src/boost/libs/math/example/normal_misc_examples.cpp @@ -0,0 +1,509 @@ +// normal_misc_examples.cpp + +// Copyright Paul A. Bristow 2007, 2010. + +// 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) + +// Example of using normal distribution. + +// Note that this file contains Quickbook mark-up as well as code +// and comments, don't change any of the special comment mark-ups! + +//[normal_basic1 +/*` +First we need some includes to access the normal distribution +(and some std output of course). +*/ + +#include // for normal_distribution + using boost::math::normal; // typedef provides default type is double. + +#include + using std::cout; using std::endl; using std::left; using std::showpoint; using std::noshowpoint; +#include + using std::setw; using std::setprecision; +#include + using std::numeric_limits; + +int main() +{ + cout << "Example: Normal distribution, Miscellaneous Applications."; + + try + { + { // Traditional tables and values. +/*`Let's start by printing some traditional tables. +*/ + double step = 1.; // in z + double range = 4; // min and max z = -range to +range. + int precision = 17; // traditional tables are only computed to much lower precision. + // but std::numeric_limits::max_digits10; on new Standard Libraries gives + // 17, the maximum number of digits that can possibly be significant. + // std::numeric_limits::digits10; == 15 is number of guaranteed digits, + // the other two digits being 'noisy'. + + // Construct a standard normal distribution s + normal s; // (default mean = zero, and standard deviation = unity) + cout << "Standard normal distribution, mean = "<< s.mean() + << ", standard deviation = " << s.standard_deviation() << endl; + +/*` First the probability distribution function (pdf). +*/ + cout << "Probability distribution function values" << endl; + cout << " z " " pdf " << endl; + cout.precision(5); + for (double z = -range; z < range + step; z += step) + { + cout << left << setprecision(3) << setw(6) << z << " " + << setprecision(precision) << setw(12) << pdf(s, z) << endl; + } + cout.precision(6); // default + /*`And the area under the normal curve from -[infin] up to z, + the cumulative distribution function (cdf). +*/ + // For a standard normal distribution + cout << "Standard normal mean = "<< s.mean() + << ", standard deviation = " << s.standard_deviation() << endl; + cout << "Integral (area under the curve) from - infinity up to z " << endl; + cout << " z " " cdf " << endl; + for (double z = -range; z < range + step; z += step) + { + cout << left << setprecision(3) << setw(6) << z << " " + << setprecision(precision) << setw(12) << cdf(s, z) << endl; + } + cout.precision(6); // default + +/*`And all this you can do with a nanoscopic amount of work compared to +the team of *human computers* toiling with Milton Abramovitz and Irene Stegen +at the US National Bureau of Standards (now [@http://www.nist.gov NIST]). +Starting in 1938, their "Handbook of Mathematical Functions with Formulas, Graphs and Mathematical Tables", +was eventually published in 1964, and has been reprinted numerous times since. +(A major replacement is planned at [@http://dlmf.nist.gov Digital Library of Mathematical Functions]). + +Pretty-printing a traditional 2-dimensional table is left as an exercise for the student, +but why bother now that the Math Toolkit lets you write +*/ + double z = 2.; + cout << "Area for z = " << z << " is " << cdf(s, z) << endl; // to get the area for z. +/*` +Correspondingly, we can obtain the traditional 'critical' values for significance levels. +For the 95% confidence level, the significance level usually called alpha, +is 0.05 = 1 - 0.95 (for a one-sided test), so we can write +*/ + cout << "95% of area has a z below " << quantile(s, 0.95) << endl; + // 95% of area has a z below 1.64485 +/*`and a two-sided test (a comparison between two levels, rather than a one-sided test) + +*/ + cout << "95% of area has a z between " << quantile(s, 0.975) + << " and " << -quantile(s, 0.975) << endl; + // 95% of area has a z between 1.95996 and -1.95996 +/*` + +First, define a table of significance levels: these are the probabilities +that the true occurrence frequency lies outside the calculated interval. + +It is convenient to have an alpha level for the probability that z lies outside just one standard deviation. +This will not be some nice neat number like 0.05, but we can easily calculate it, +*/ + double alpha1 = cdf(s, -1) * 2; // 0.3173105078629142 + cout << setprecision(17) << "Significance level for z == 1 is " << alpha1 << endl; +/*` + and place in our array of favorite alpha values. +*/ + double alpha[] = {0.3173105078629142, // z for 1 standard deviation. + 0.20, 0.1, 0.05, 0.01, 0.001, 0.0001, 0.00001 }; +/*` + +Confidence value as % is (1 - alpha) * 100 (so alpha 0.05 == 95% confidence) +that the true occurrence frequency lies *inside* the calculated interval. + +*/ + cout << "level of significance (alpha)" << setprecision(4) << endl; + cout << "2-sided 1 -sided z(alpha) " << endl; + for (unsigned i = 0; i < sizeof(alpha)/sizeof(alpha[0]); ++i) + { + cout << setw(15) << alpha[i] << setw(15) << alpha[i] /2 << setw(10) << quantile(complement(s, alpha[i]/2)) << endl; + // Use quantile(complement(s, alpha[i]/2)) to avoid potential loss of accuracy from quantile(s, 1 - alpha[i]/2) + } + cout << endl; + +/*`Notice the distinction between one-sided (also called one-tailed) +where we are using a > *or* < test (and not both) +and considering the area of the tail (integral) from z up to +[infin], +and a two-sided test where we are using two > *and* < tests, and thus considering two tails, +from -[infin] up to z low and z high up to +[infin]. + +So the 2-sided values alpha[i] are calculated using alpha[i]/2. + +If we consider a simple example of alpha = 0.05, then for a two-sided test, +the lower tail area from -[infin] up to -1.96 is 0.025 (alpha/2) +and the upper tail area from +z up to +1.96 is also 0.025 (alpha/2), +and the area between -1.96 up to 12.96 is alpha = 0.95. +and the sum of the two tails is 0.025 + 0.025 = 0.05, + +*/ +//] [/[normal_basic1] + +//[normal_basic2 + +/*`Armed with the cumulative distribution function, we can easily calculate the +easy to remember proportion of values that lie within 1, 2 and 3 standard deviations from the mean. + +*/ + cout.precision(3); + cout << showpoint << "cdf(s, s.standard_deviation()) = " + << cdf(s, s.standard_deviation()) << endl; // from -infinity to 1 sd + cout << "cdf(complement(s, s.standard_deviation())) = " + << cdf(complement(s, s.standard_deviation())) << endl; + cout << "Fraction 1 standard deviation within either side of mean is " + << 1 - cdf(complement(s, s.standard_deviation())) * 2 << endl; + cout << "Fraction 2 standard deviations within either side of mean is " + << 1 - cdf(complement(s, 2 * s.standard_deviation())) * 2 << endl; + cout << "Fraction 3 standard deviations within either side of mean is " + << 1 - cdf(complement(s, 3 * s.standard_deviation())) * 2 << endl; + +/*` +To a useful precision, the 1, 2 & 3 percentages are 68, 95 and 99.7, +and these are worth memorising as useful 'rules of thumb', as, for example, in +[@http://en.wikipedia.org/wiki/Standard_deviation standard deviation]: + +[pre +Fraction 1 standard deviation within either side of mean is 0.683 +Fraction 2 standard deviations within either side of mean is 0.954 +Fraction 3 standard deviations within either side of mean is 0.997 +] + +We could of course get some really accurate values for these +[@http://en.wikipedia.org/wiki/Confidence_interval confidence intervals] +by using cout.precision(15); + +[pre +Fraction 1 standard deviation within either side of mean is 0.682689492137086 +Fraction 2 standard deviations within either side of mean is 0.954499736103642 +Fraction 3 standard deviations within either side of mean is 0.997300203936740 +] + +But before you get too excited about this impressive precision, +don't forget that the *confidence intervals of the standard deviation* are surprisingly wide, +especially if you have estimated the standard deviation from only a few measurements. +*/ +//] [/[normal_basic2] + + +//[normal_bulbs_example1 +/*` +Examples from K. Krishnamoorthy, Handbook of Statistical Distributions with Applications, +ISBN 1 58488 635 8, page 125... implemented using the Math Toolkit library. + +A few very simple examples are shown here: +*/ +// K. Krishnamoorthy, Handbook of Statistical Distributions with Applications, + // ISBN 1 58488 635 8, page 125, example 10.3.5 +/*`Mean lifespan of 100 W bulbs is 1100 h with standard deviation of 100 h. +Assuming, perhaps with little evidence and much faith, that the distribution is normal, +we construct a normal distribution called /bulbs/ with these values: +*/ + double mean_life = 1100.; + double life_standard_deviation = 100.; + normal bulbs(mean_life, life_standard_deviation); + double expected_life = 1000.; + +/*`The we can use the Cumulative distribution function to predict fractions +(or percentages, if * 100) that will last various lifetimes. +*/ + cout << "Fraction of bulbs that will last at best (<=) " // P(X <= 1000) + << expected_life << " is "<< cdf(bulbs, expected_life) << endl; + cout << "Fraction of bulbs that will last at least (>) " // P(X > 1000) + << expected_life << " is "<< cdf(complement(bulbs, expected_life)) << endl; + double min_life = 900; + double max_life = 1200; + cout << "Fraction of bulbs that will last between " + << min_life << " and " << max_life << " is " + << cdf(bulbs, max_life) // P(X <= 1200) + - cdf(bulbs, min_life) << endl; // P(X <= 900) +/*` +[note Real-life failures are often very ab-normal, +with a significant number that 'dead-on-arrival' or suffer failure very early in their life: +the lifetime of the survivors of 'early mortality' may be well described by the normal distribution.] +*/ +//] [/normal_bulbs_example1 Quickbook end] + } + { + // K. Krishnamoorthy, Handbook of Statistical Distributions with Applications, + // ISBN 1 58488 635 8, page 125, Example 10.3.6 + +//[normal_bulbs_example3 +/*`Weekly demand for 5 lb sacks of onions at a store is normally distributed with mean 140 sacks and standard deviation 10. +*/ + double mean = 140.; // sacks per week. + double standard_deviation = 10; + normal sacks(mean, standard_deviation); + + double stock = 160.; // per week. + cout << "Percentage of weeks overstocked " + << cdf(sacks, stock) * 100. << endl; // P(X <=160) + // Percentage of weeks overstocked 97.7 + +/*`So there will be lots of mouldy onions! +So we should be able to say what stock level will meet demand 95% of the weeks. +*/ + double stock_95 = quantile(sacks, 0.95); + cout << "Store should stock " << int(stock_95) << " sacks to meet 95% of demands." << endl; +/*`And it is easy to estimate how to meet 80% of demand, and waste even less. +*/ + double stock_80 = quantile(sacks, 0.80); + cout << "Store should stock " << int(stock_80) << " sacks to meet 8 out of 10 demands." << endl; +//] [/normal_bulbs_example3 Quickbook end] + } + { // K. Krishnamoorthy, Handbook of Statistical Distributions with Applications, + // ISBN 1 58488 635 8, page 125, Example 10.3.7 + +//[normal_bulbs_example4 + +/*`A machine is set to pack 3 kg of ground beef per pack. +Over a long period of time it is found that the average packed was 3 kg +with a standard deviation of 0.1 kg. +Assuming the packing is normally distributed, +we can find the fraction (or %) of packages that weigh more than 3.1 kg. +*/ + +double mean = 3.; // kg +double standard_deviation = 0.1; // kg +normal packs(mean, standard_deviation); + +double max_weight = 3.1; // kg +cout << "Percentage of packs > " << max_weight << " is " +<< cdf(complement(packs, max_weight)) << endl; // P(X > 3.1) + +double under_weight = 2.9; +cout <<"fraction of packs <= " << under_weight << " with a mean of " << mean + << " is " << cdf(complement(packs, under_weight)) << endl; +// fraction of packs <= 2.9 with a mean of 3 is 0.841345 +// This is 0.84 - more than the target 0.95 +// Want 95% to be over this weight, so what should we set the mean weight to be? +// KK StatCalc says: +double over_mean = 3.0664; +normal xpacks(over_mean, standard_deviation); +cout << "fraction of packs >= " << under_weight +<< " with a mean of " << xpacks.mean() + << " is " << cdf(complement(xpacks, under_weight)) << endl; +// fraction of packs >= 2.9 with a mean of 3.06449 is 0.950005 +double under_fraction = 0.05; // so 95% are above the minimum weight mean - sd = 2.9 +double low_limit = standard_deviation; +double offset = mean - low_limit - quantile(packs, under_fraction); +double nominal_mean = mean + offset; + +normal nominal_packs(nominal_mean, standard_deviation); +cout << "Setting the packer to " << nominal_mean << " will mean that " + << "fraction of packs >= " << under_weight + << " is " << cdf(complement(nominal_packs, under_weight)) << endl; + +/*` +Setting the packer to 3.06449 will mean that fraction of packs >= 2.9 is 0.95. + +Setting the packer to 3.13263 will mean that fraction of packs >= 2.9 is 0.99, +but will more than double the mean loss from 0.0644 to 0.133. + +Alternatively, we could invest in a better (more precise) packer with a lower standard deviation. + +To estimate how much better (how much smaller standard deviation) it would have to be, +we need to get the 5% quantile to be located at the under_weight limit, 2.9 +*/ +double p = 0.05; // wanted p th quantile. +cout << "Quantile of " << p << " = " << quantile(packs, p) + << ", mean = " << packs.mean() << ", sd = " << packs.standard_deviation() << endl; // +/*` +Quantile of 0.05 = 2.83551, mean = 3, sd = 0.1 + +With the current packer (mean = 3, sd = 0.1), the 5% quantile is at 2.8551 kg, +a little below our target of 2.9 kg. +So we know that the standard deviation is going to have to be smaller. + +Let's start by guessing that it (now 0.1) needs to be halved, to a standard deviation of 0.05 +*/ +normal pack05(mean, 0.05); +cout << "Quantile of " << p << " = " << quantile(pack05, p) + << ", mean = " << pack05.mean() << ", sd = " << pack05.standard_deviation() << endl; + +cout <<"Fraction of packs >= " << under_weight << " with a mean of " << mean + << " and standard deviation of " << pack05.standard_deviation() + << " is " << cdf(complement(pack05, under_weight)) << endl; +// +/*` +Fraction of packs >= 2.9 with a mean of 3 and standard deviation of 0.05 is 0.9772 + +So 0.05 was quite a good guess, but we are a little over the 2.9 target, +so the standard deviation could be a tiny bit more. So we could do some +more guessing to get closer, say by increasing to 0.06 +*/ + +normal pack06(mean, 0.06); +cout << "Quantile of " << p << " = " << quantile(pack06, p) + << ", mean = " << pack06.mean() << ", sd = " << pack06.standard_deviation() << endl; + +cout <<"Fraction of packs >= " << under_weight << " with a mean of " << mean + << " and standard deviation of " << pack06.standard_deviation() + << " is " << cdf(complement(pack06, under_weight)) << endl; +/*` +Fraction of packs >= 2.9 with a mean of 3 and standard deviation of 0.06 is 0.9522 + +Now we are getting really close, but to do the job properly, +we could use root finding method, for example the tools provided, and used elsewhere, +in the Math Toolkit, see __root_finding_without_derivatives. + +But in this normal distribution case, we could be even smarter and make a direct calculation. +*/ + +normal s; // For standard normal distribution, +double sd = 0.1; +double x = 2.9; // Our required limit. +// then probability p = N((x - mean) / sd) +// So if we want to find the standard deviation that would be required to meet this limit, +// so that the p th quantile is located at x, +// in this case the 0.95 (95%) quantile at 2.9 kg pack weight, when the mean is 3 kg. + +double prob = pdf(s, (x - mean) / sd); +double qp = quantile(s, 0.95); +cout << "prob = " << prob << ", quantile(p) " << qp << endl; // p = 0.241971, quantile(p) 1.64485 +// Rearranging, we can directly calculate the required standard deviation: +double sd95 = std::abs((x - mean)) / qp; + +cout << "If we want the "<< p << " th quantile to be located at " + << x << ", would need a standard deviation of " << sd95 << endl; + +normal pack95(mean, sd95); // Distribution of the 'ideal better' packer. +cout <<"Fraction of packs >= " << under_weight << " with a mean of " << mean + << " and standard deviation of " << pack95.standard_deviation() + << " is " << cdf(complement(pack95, under_weight)) << endl; + +// Fraction of packs >= 2.9 with a mean of 3 and standard deviation of 0.0608 is 0.95 + +/*`Notice that these two deceptively simple questions +(do we over-fill or measure better) are actually very common. +The weight of beef might be replaced by a measurement of more or less anything. +But the calculations rely on the accuracy of the standard deviation - something +that is almost always less good than we might wish, +especially if based on a few measurements. +*/ + +//] [/normal_bulbs_example4 Quickbook end] + } + + { // K. Krishnamoorthy, Handbook of Statistical Distributions with Applications, + // ISBN 1 58488 635 8, page 125, example 10.3.8 +//[normal_bulbs_example5 +/*`A bolt is usable if between 3.9 and 4.1 long. +From a large batch of bolts, a sample of 50 show a +mean length of 3.95 with standard deviation 0.1. +Assuming a normal distribution, what proportion is usable? +The true sample mean is unknown, +but we can use the sample mean and standard deviation to find approximate solutions. +*/ + + normal bolts(3.95, 0.1); + double top = 4.1; + double bottom = 3.9; + +cout << "Fraction long enough [ P(X <= " << top << ") ] is " << cdf(bolts, top) << endl; +cout << "Fraction too short [ P(X <= " << bottom << ") ] is " << cdf(bolts, bottom) << endl; +cout << "Fraction OK -between " << bottom << " and " << top + << "[ P(X <= " << top << ") - P(X<= " << bottom << " ) ] is " + << cdf(bolts, top) - cdf(bolts, bottom) << endl; + +cout << "Fraction too long [ P(X > " << top << ") ] is " + << cdf(complement(bolts, top)) << endl; + +cout << "95% of bolts are shorter than " << quantile(bolts, 0.95) << endl; + +//] [/normal_bulbs_example5 Quickbook end] + } + } + catch(const std::exception& e) + { // Always useful to include try & catch blocks because default policies + // are to throw exceptions on arguments that cause errors like underflow, overflow. + // Lacking try & catch blocks, the program will abort without a message below, + // which may give some helpful clues as to the cause of the exception. + std::cout << + "\n""Message from thrown exception was:\n " << e.what() << std::endl; + } + return 0; +} // int main() + + +/* + +Output is: + +Autorun "i:\boost-06-05-03-1300\libs\math\test\Math_test\debug\normal_misc_examples.exe" +Example: Normal distribution, Miscellaneous Applications.Standard normal distribution, mean = 0, standard deviation = 1 +Probability distribution function values + z pdf +-4 0.00013383022576488537 +-3 0.0044318484119380075 +-2 0.053990966513188063 +-1 0.24197072451914337 +0 0.3989422804014327 +1 0.24197072451914337 +2 0.053990966513188063 +3 0.0044318484119380075 +4 0.00013383022576488537 +Standard normal mean = 0, standard deviation = 1 +Integral (area under the curve) from - infinity up to z + z cdf +-4 3.1671241833119979e-005 +-3 0.0013498980316300959 +-2 0.022750131948179219 +-1 0.1586552539314571 +0 0.5 +1 0.84134474606854293 +2 0.97724986805182079 +3 0.9986501019683699 +4 0.99996832875816688 +Area for z = 2 is 0.97725 +95% of area has a z below 1.64485 +95% of area has a z between 1.95996 and -1.95996 +Significance level for z == 1 is 0.3173105078629142 +level of significance (alpha) +2-sided 1 -sided z(alpha) +0.3173 0.1587 1 +0.2 0.1 1.282 +0.1 0.05 1.645 +0.05 0.025 1.96 +0.01 0.005 2.576 +0.001 0.0005 3.291 +0.0001 5e-005 3.891 +1e-005 5e-006 4.417 +cdf(s, s.standard_deviation()) = 0.841 +cdf(complement(s, s.standard_deviation())) = 0.159 +Fraction 1 standard deviation within either side of mean is 0.683 +Fraction 2 standard deviations within either side of mean is 0.954 +Fraction 3 standard deviations within either side of mean is 0.997 +Fraction of bulbs that will last at best (<=) 1.00e+003 is 0.159 +Fraction of bulbs that will last at least (>) 1.00e+003 is 0.841 +Fraction of bulbs that will last between 900. and 1.20e+003 is 0.819 +Percentage of weeks overstocked 97.7 +Store should stock 156 sacks to meet 95% of demands. +Store should stock 148 sacks to meet 8 out of 10 demands. +Percentage of packs > 3.10 is 0.159 +fraction of packs <= 2.90 with a mean of 3.00 is 0.841 +fraction of packs >= 2.90 with a mean of 3.07 is 0.952 +Setting the packer to 3.06 will mean that fraction of packs >= 2.90 is 0.950 +Quantile of 0.0500 = 2.84, mean = 3.00, sd = 0.100 +Quantile of 0.0500 = 2.92, mean = 3.00, sd = 0.0500 +Fraction of packs >= 2.90 with a mean of 3.00 and standard deviation of 0.0500 is 0.977 +Quantile of 0.0500 = 2.90, mean = 3.00, sd = 0.0600 +Fraction of packs >= 2.90 with a mean of 3.00 and standard deviation of 0.0600 is 0.952 +prob = 0.242, quantile(p) 1.64 +If we want the 0.0500 th quantile to be located at 2.90, would need a standard deviation of 0.0608 +Fraction of packs >= 2.90 with a mean of 3.00 and standard deviation of 0.0608 is 0.950 +Fraction long enough [ P(X <= 4.10) ] is 0.933 +Fraction too short [ P(X <= 3.90) ] is 0.309 +Fraction OK -between 3.90 and 4.10[ P(X <= 4.10) - P(X<= 3.90 ) ] is 0.625 +Fraction too long [ P(X > 4.10) ] is 0.0668 +95% of bolts are shorter than 4.11 + +*/ diff --git a/src/boost/libs/math/example/normal_tables.cpp b/src/boost/libs/math/example/normal_tables.cpp new file mode 100644 index 00000000..e130f5fd --- /dev/null +++ b/src/boost/libs/math/example/normal_tables.cpp @@ -0,0 +1,566 @@ + +// normal_misc_examples.cpp + +// Copyright Paul A. Bristow 2007, 2010, 2014, 2016. + +// 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) + +// Example of using normal distribution. + +// Note that this file contains Quickbook mark-up as well as code +// and comments, don't change any of the special comment mark-ups! + +/*` +First we need some includes to access the normal distribution +(and some std output of course). +*/ + +#include // MUST be first include!!! +// See Implementation of Float128 type, Overloading template functions with float128_t. + +#include // for normal_distribution. + using boost::math::normal; // typedef provides default type of double. + +#include + //using std::cout; using std::endl; + //using std::left; using std::showpoint; using std::noshowpoint; +#include + //using std::setw; using std::setprecision; +#include + //using std::numeric_limits; + + /*! +Function max_digits10 +Returns maximum number of possibly significant decimal digits for a floating-point type FPT, +even for older compilers/standard libraries that +lack support for std::std::numeric_limits::max_digits10, +when the Kahan formula 2 + binary_digits * 0.3010 is used instead. +Also provides the correct result for Visual Studio 2010 where the max_digits10 provided for float is wrong. +*/ +namespace boost +{ +namespace math +{ +template +int max_digits10() +{ +// Since max_digits10 is not defined (or wrong) on older systems, define a local max_digits10. + + // Usage: int m = max_digits10(); + const int m = +#if (defined BOOST_NO_CXX11_NUMERIC_LIMITS) || (_MSC_VER == 1600) // is wrongly 8 not 9 for VS2010. + 2 + std::numeric_limits::digits * 3010/10000; +#else + std::numeric_limits::max_digits10; +#endif + return m; +} +} // namespace math +} // namespace boost + +template +void normal_table() +{ + using namespace boost::math; + + FPT step = static_cast(1.); // step in z. + FPT range = static_cast(10.); // min and max z = -range to +range. + + // Traditional tables are only computed to much lower precision. + // but @c std::std::numeric_limits::max_digits10; + // on new Standard Libraries gives 17, + // the maximum number of digits from 64-bit double that can possibly be significant. + // @c std::std::numeric_limits::digits10; == 15 + // is number of @b guaranteed digits, the other two digits being 'noisy'. + // Here we use a custom version of max_digits10 which deals with those platforms + // where @c std::numeric_limits is not specialized, + // or @c std::numeric_limits<>::max_digits10 not implemented, or wrong. + int precision = boost::math::max_digits10(); + +// std::cout << typeid(FPT).name() << std::endl; +// demo_normal.cpp:85: undefined reference to `typeinfo for __float128' +// [@http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43622 GCC 43622] +// typeinfo for __float128 was missing GCC 4.9 Mar 2014, but OK for GCC 6.1.1. + + // Construct a standard normal distribution s, with + // (default mean = zero, and standard deviation = unity) + normal s; + std::cout << "\nStandard normal distribution, mean = "<< s.mean() + << ", standard deviation = " << s.standard_deviation() << std::endl; + + std::cout << "maxdigits_10 is " << precision + << ", digits10 is " << std::numeric_limits::digits10 << std::endl; + + std::cout << "Probability distribution function values" << std::endl; + + std::cout << " z " " PDF " << std::endl; + for (FPT z = -range; z < range + step; z += step) + { + std::cout << std::left << std::setprecision(3) << std::setw(6) << z << " " + << std::setprecision(precision) << std::setw(12) << pdf(s, z) << std::endl; + } + std::cout.precision(6); // Restore to default precision. + +/*`And the area under the normal curve from -[infin] up to z, + the cumulative distribution function (CDF). +*/ + // For a standard normal distribution: + std::cout << "Standard normal mean = "<< s.mean() + << ", standard deviation = " << s.standard_deviation() << std::endl; + std::cout << "Integral (area under the curve) from - infinity up to z." << std::endl; + std::cout << " z " " CDF " << std::endl; + for (FPT z = -range; z < range + step; z += step) + { + std::cout << std::left << std::setprecision(3) << std::setw(6) << z << " " + << std::setprecision(precision) << std::setw(12) << cdf(s, z) << std::endl; + } + std::cout.precision(6); // Reset to default precision. +} // template void normal_table() + +int main() +{ + std::cout << "\nExample: Normal distribution tables." << std::endl; + + using namespace boost::math; + + try + {// Tip - always use try'n'catch blocks to ensure that messages from thrown exceptions are shown. + +//[normal_table_1 +#ifdef BOOST_FLOAT32_C + normal_table(); // Usually type float +#endif + normal_table(); // Usually type double. Assume that float64_t is always available. +#ifdef BOOST_FLOAT80_C + normal_table(); // Type long double on some X86 platforms. +#endif +#ifdef BOOST_FLOAT128_C + normal_table(); // Type _Quad on some Intel and __float128 on some GCC platforms. +#endif + normal_table(); +//] [/normal_table_1 ] + } + catch(std::exception ex) + { + std::cout << "exception thrown " << ex.what() << std::endl; + } + + return 0; +} // int main() + + +/* + +GCC 4.8.1 with quadmath + +Example: Normal distribution tables. + +Standard normal distribution, mean = 0, standard deviation = 1 +maxdigits_10 is 9, digits10 is 6 +Probability distribution function values + z PDF +-10 7.69459863e-023 +-9 1.02797736e-018 +-8 5.05227108e-015 +-7 9.13472041e-012 +-6 6.07588285e-009 +-5 1.48671951e-006 +-4 0.000133830226 +-3 0.00443184841 +-2 0.0539909665 +-1 0.241970725 +0 0.39894228 +1 0.241970725 +2 0.0539909665 +3 0.00443184841 +4 0.000133830226 +5 1.48671951e-006 +6 6.07588285e-009 +7 9.13472041e-012 +8 5.05227108e-015 +9 1.02797736e-018 +10 7.69459863e-023 +Standard normal mean = 0, standard deviation = 1 +Integral (area under the curve) from - infinity up to z. + z CDF +-10 7.61985302e-024 +-9 1.12858841e-019 +-8 6.22096057e-016 +-7 1.27981254e-012 +-6 9.86587645e-010 +-5 2.86651572e-007 +-4 3.16712418e-005 +-3 0.00134989803 +-2 0.0227501319 +-1 0.158655254 +0 0.5 +1 0.841344746 +2 0.977249868 +3 0.998650102 +4 0.999968329 +5 0.999999713 +6 0.999999999 +7 1 +8 1 +9 1 +10 1 + +Standard normal distribution, mean = 0, standard deviation = 1 +maxdigits_10 is 17, digits10 is 15 +Probability distribution function values + z PDF +-10 7.6945986267064199e-023 +-9 1.0279773571668917e-018 +-8 5.0522710835368927e-015 +-7 9.1347204083645953e-012 +-6 6.0758828498232861e-009 +-5 1.4867195147342979e-006 +-4 0.00013383022576488537 +-3 0.0044318484119380075 +-2 0.053990966513188063 +-1 0.24197072451914337 +0 0.3989422804014327 +1 0.24197072451914337 +2 0.053990966513188063 +3 0.0044318484119380075 +4 0.00013383022576488537 +5 1.4867195147342979e-006 +6 6.0758828498232861e-009 +7 9.1347204083645953e-012 +8 5.0522710835368927e-015 +9 1.0279773571668917e-018 +10 7.6945986267064199e-023 +Standard normal mean = 0, standard deviation = 1 +Integral (area under the curve) from - infinity up to z. + z CDF +-10 7.6198530241605945e-024 +-9 1.1285884059538422e-019 +-8 6.2209605742718204e-016 +-7 1.279812543885835e-012 +-6 9.865876450377014e-010 +-5 2.8665157187919455e-007 +-4 3.1671241833119972e-005 +-3 0.0013498980316300957 +-2 0.022750131948179216 +-1 0.15865525393145705 +0 0.5 +1 0.84134474606854293 +2 0.97724986805182079 +3 0.9986501019683699 +4 0.99996832875816688 +5 0.99999971334842808 +6 0.9999999990134123 +7 0.99999999999872013 +8 0.99999999999999933 +9 1 +10 1 + +Standard normal distribution, mean = 0, standard deviation = 1 +maxdigits_10 is 21, digits10 is 18 +Probability distribution function values + z PDF +-10 7.69459862670641993759e-023 +-9 1.0279773571668916523e-018 +-8 5.05227108353689273243e-015 +-7 9.13472040836459525705e-012 +-6 6.07588284982328608733e-009 +-5 1.48671951473429788965e-006 +-4 0.00013383022576488536764 +-3 0.00443184841193800752729 +-2 0.0539909665131880628364 +-1 0.241970724519143365328 +0 0.398942280401432702863 +1 0.241970724519143365328 +2 0.0539909665131880628364 +3 0.00443184841193800752729 +4 0.00013383022576488536764 +5 1.48671951473429788965e-006 +6 6.07588284982328608733e-009 +7 9.13472040836459525705e-012 +8 5.05227108353689273243e-015 +9 1.0279773571668916523e-018 +10 7.69459862670641993759e-023 +Standard normal mean = 0, standard deviation = 1 +Integral (area under the curve) from - infinity up to z. + z CDF +-10 7.61985302416059451083e-024 +-9 1.12858840595384222719e-019 +-8 6.22096057427182035917e-016 +-7 1.279812543885834962e-012 +-6 9.86587645037701399241e-010 +-5 2.86651571879194547129e-007 +-4 3.16712418331199717608e-005 +-3 0.00134989803163009566139 +-2 0.0227501319481792155242 +-1 0.158655253931457046468 +0 0.5 +1 0.841344746068542925777 +2 0.977249868051820791415 +3 0.998650101968369896532 +4 0.999968328758166880021 +5 0.999999713348428076465 +6 0.999999999013412299576 +7 0.999999999998720134897 +8 0.999999999999999333866 +9 1 +10 1 + +Standard normal distribution, mean = 0, standard deviation = 1 +maxdigits_10 is 36, digits10 is 34 +Probability distribution function values + z PDF +-10 7.69459862670641993759264402330435296e-023 +-9 1.02797735716689165230378750485667109e-018 +-8 5.0522710835368927324337437844893081e-015 +-7 9.13472040836459525705208369548147081e-012 +-6 6.07588284982328608733411870229841611e-009 +-5 1.48671951473429788965346931561839483e-006 +-4 0.00013383022576488536764006964663309418 +-3 0.00443184841193800752728870762098267733 +-2 0.0539909665131880628363703067407186609 +-1 0.241970724519143365327522587904240936 +0 0.398942280401432702863218082711682655 +1 0.241970724519143365327522587904240936 +2 0.0539909665131880628363703067407186609 +3 0.00443184841193800752728870762098267733 +4 0.00013383022576488536764006964663309418 +5 1.48671951473429788965346931561839483e-006 +6 6.07588284982328608733411870229841611e-009 +7 9.13472040836459525705208369548147081e-012 +8 5.0522710835368927324337437844893081e-015 +9 1.02797735716689165230378750485667109e-018 +10 7.69459862670641993759264402330435296e-023 +Standard normal mean = 0, standard deviation = 1 +Integral (area under the curve) from - infinity up to z. + z CDF +-10 7.61985302416059451083278826816793623e-024 +-9 1.1285884059538422271881384555435713e-019 +-8 6.22096057427182035917417257601387863e-016 +-7 1.27981254388583496200054074948511201e-012 +-6 9.86587645037701399241244820583623953e-010 +-5 2.86651571879194547128505464808623238e-007 +-4 3.16712418331199717608064048146587766e-005 +-3 0.001349898031630095661392854111682027 +-2 0.0227501319481792155241528519127314212 +-1 0.158655253931457046467912164189328905 +0 0.5 +1 0.841344746068542925776512220181757584 +2 0.977249868051820791414741051994496956 +3 0.998650101968369896532351503992686048 +4 0.999968328758166880021462930017150939 +5 0.999999713348428076464813329948810861 +6 0.999999999013412299575520592043176293 +7 0.999999999998720134897212119540199637 +8 0.999999999999999333866185224906075746 +9 1 +10 1 + +Standard normal distribution, mean = 0, standard deviation = 1 +maxdigits_10 is 36, digits10 is 34 +Probability distribution function values + z PDF +-10 7.69459862670641993759264402330435296e-023 +-9 1.02797735716689165230378750485667109e-018 +-8 5.0522710835368927324337437844893081e-015 +-7 9.13472040836459525705208369548147081e-012 +-6 6.07588284982328608733411870229841611e-009 +-5 1.48671951473429788965346931561839483e-006 +-4 0.00013383022576488536764006964663309418 +-3 0.00443184841193800752728870762098267733 +-2 0.0539909665131880628363703067407186609 +-1 0.241970724519143365327522587904240936 +0 0.398942280401432702863218082711682655 +1 0.241970724519143365327522587904240936 +2 0.0539909665131880628363703067407186609 +3 0.00443184841193800752728870762098267733 +4 0.00013383022576488536764006964663309418 +5 1.48671951473429788965346931561839483e-006 +6 6.07588284982328608733411870229841611e-009 +7 9.13472040836459525705208369548147081e-012 +8 5.0522710835368927324337437844893081e-015 +9 1.02797735716689165230378750485667109e-018 +10 7.69459862670641993759264402330435296e-023 +Standard normal mean = 0, standard deviation = 1 +Integral (area under the curve) from - infinity up to z. + z CDF +-10 7.61985302416059451083278826816793623e-024 +-9 1.1285884059538422271881384555435713e-019 +-8 6.22096057427182035917417257601387863e-016 +-7 1.27981254388583496200054074948511201e-012 +-6 9.86587645037701399241244820583623953e-010 +-5 2.86651571879194547128505464808623238e-007 +-4 3.16712418331199717608064048146587766e-005 +-3 0.001349898031630095661392854111682027 +-2 0.0227501319481792155241528519127314212 +-1 0.158655253931457046467912164189328905 +0 0.5 +1 0.841344746068542925776512220181757584 +2 0.977249868051820791414741051994496956 +3 0.998650101968369896532351503992686048 +4 0.999968328758166880021462930017150939 +5 0.999999713348428076464813329948810861 +6 0.999999999013412299575520592043176293 +7 0.999999999998720134897212119540199637 +8 0.999999999999999333866185224906075746 +9 1 +10 1 + +MSVC 2013 64-bit +1> +1> Example: Normal distribution tables. +1> +1> Standard normal distribution, mean = 0, standard deviation = 1 +1> maxdigits_10 is 9, digits10 is 6 +1> Probability distribution function values +1> z PDF +1> -10 7.69459863e-023 +1> -9 1.02797736e-018 +1> -8 5.05227108e-015 +1> -7 9.13472041e-012 +1> -6 6.07588285e-009 +1> -5 1.48671951e-006 +1> -4 0.000133830226 +1> -3 0.00443184841 +1> -2 0.0539909665 +1> -1 0.241970725 +1> 0 0.39894228 +1> 1 0.241970725 +1> 2 0.0539909665 +1> 3 0.00443184841 +1> 4 0.000133830226 +1> 5 1.48671951e-006 +1> 6 6.07588285e-009 +1> 7 9.13472041e-012 +1> 8 5.05227108e-015 +1> 9 1.02797736e-018 +1> 10 7.69459863e-023 +1> Standard normal mean = 0, standard deviation = 1 +1> Integral (area under the curve) from - infinity up to z. +1> z CDF +1> -10 7.61985302e-024 +1> -9 1.12858841e-019 +1> -8 6.22096057e-016 +1> -7 1.27981254e-012 +1> -6 9.86587645e-010 +1> -5 2.86651572e-007 +1> -4 3.16712418e-005 +1> -3 0.00134989803 +1> -2 0.0227501319 +1> -1 0.158655254 +1> 0 0.5 +1> 1 0.841344746 +1> 2 0.977249868 +1> 3 0.998650102 +1> 4 0.999968329 +1> 5 0.999999713 +1> 6 0.999999999 +1> 7 1 +1> 8 1 +1> 9 1 +1> 10 1 +1> +1> Standard normal distribution, mean = 0, standard deviation = 1 +1> maxdigits_10 is 17, digits10 is 15 +1> Probability distribution function values +1> z PDF +1> -10 7.6945986267064199e-023 +1> -9 1.0279773571668917e-018 +1> -8 5.0522710835368927e-015 +1> -7 9.1347204083645953e-012 +1> -6 6.0758828498232861e-009 +1> -5 1.4867195147342979e-006 +1> -4 0.00013383022576488537 +1> -3 0.0044318484119380075 +1> -2 0.053990966513188063 +1> -1 0.24197072451914337 +1> 0 0.3989422804014327 +1> 1 0.24197072451914337 +1> 2 0.053990966513188063 +1> 3 0.0044318484119380075 +1> 4 0.00013383022576488537 +1> 5 1.4867195147342979e-006 +1> 6 6.0758828498232861e-009 +1> 7 9.1347204083645953e-012 +1> 8 5.0522710835368927e-015 +1> 9 1.0279773571668917e-018 +1> 10 7.6945986267064199e-023 +1> Standard normal mean = 0, standard deviation = 1 +1> Integral (area under the curve) from - infinity up to z. +1> z CDF +1> -10 7.6198530241605813e-024 +1> -9 1.1285884059538408e-019 +1> -8 6.2209605742718292e-016 +1> -7 1.2798125438858352e-012 +1> -6 9.8658764503770161e-010 +1> -5 2.8665157187919439e-007 +1> -4 3.1671241833119979e-005 +1> -3 0.0013498980316300957 +1> -2 0.022750131948179219 +1> -1 0.15865525393145707 +1> 0 0.5 +1> 1 0.84134474606854293 +1> 2 0.97724986805182079 +1> 3 0.9986501019683699 +1> 4 0.99996832875816688 +1> 5 0.99999971334842808 +1> 6 0.9999999990134123 +1> 7 0.99999999999872013 +1> 8 0.99999999999999933 +1> 9 1 +1> 10 1 +1> +1> Standard normal distribution, mean = 0, standard deviation = 1 +1> maxdigits_10 is 17, digits10 is 15 +1> Probability distribution function values +1> z PDF +1> -10 7.6945986267064199e-023 +1> -9 1.0279773571668917e-018 +1> -8 5.0522710835368927e-015 +1> -7 9.1347204083645953e-012 +1> -6 6.0758828498232861e-009 +1> -5 1.4867195147342979e-006 +1> -4 0.00013383022576488537 +1> -3 0.0044318484119380075 +1> -2 0.053990966513188063 +1> -1 0.24197072451914337 +1> 0 0.3989422804014327 +1> 1 0.24197072451914337 +1> 2 0.053990966513188063 +1> 3 0.0044318484119380075 +1> 4 0.00013383022576488537 +1> 5 1.4867195147342979e-006 +1> 6 6.0758828498232861e-009 +1> 7 9.1347204083645953e-012 +1> 8 5.0522710835368927e-015 +1> 9 1.0279773571668917e-018 +1> 10 7.6945986267064199e-023 +1> Standard normal mean = 0, standard deviation = 1 +1> Integral (area under the curve) from - infinity up to z. +1> z CDF +1> -10 7.6198530241605813e-024 +1> -9 1.1285884059538408e-019 +1> -8 6.2209605742718292e-016 +1> -7 1.2798125438858352e-012 +1> -6 9.8658764503770161e-010 +1> -5 2.8665157187919439e-007 +1> -4 3.1671241833119979e-005 +1> -3 0.0013498980316300957 +1> -2 0.022750131948179219 +1> -1 0.15865525393145707 +1> 0 0.5 +1> 1 0.84134474606854293 +1> 2 0.97724986805182079 +1> 3 0.9986501019683699 +1> 4 0.99996832875816688 +1> 5 0.99999971334842808 +1> 6 0.9999999990134123 +1> 7 0.99999999999872013 +1> 8 0.99999999999999933 +1> 9 1 +1> 10 1 + + +*/ diff --git a/src/boost/libs/math/example/numerical_derivative_example.cpp b/src/boost/libs/math/example/numerical_derivative_example.cpp new file mode 100644 index 00000000..ff45b458 --- /dev/null +++ b/src/boost/libs/math/example/numerical_derivative_example.cpp @@ -0,0 +1,209 @@ +// Copyright Christopher Kormanyos 2013. +// Distributed under 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). + +#ifdef _MSC_VER +# pragma warning (disable : 4996) // assignment operator could not be generated. +#endif + +# include +# include +# include +# include + +#include +#include +#include // for float_distance + +//[numeric_derivative_example +/*`The following example shows how multiprecision calculations can be used to +obtain full precision in a numerical derivative calculation that suffers from precision loss. + +Consider some well-known central difference rules for numerically +computing the 1st derivative of a function [f'(x)] with [/x] real. + +Need a reference here? Introduction to Partial Differential Equations, Peter J. Olver + December 16, 2012 + +Here, the implementation uses a C++ template that can be instantiated with various +floating-point types such as `float`, `double`, `long double`, or even +a user-defined floating-point type like __multiprecision. + +We will now use the derivative template with the built-in type `double` in +order to numerically compute the derivative of a function, and then repeat +with a 5 decimal digit higher precision user-defined floating-point type. + +Consider the function shown below. +!! +(3) +We will now take the derivative of this function with respect to x evaluated +at x = 3= 2. In other words, + +(4) + +The expected result is + + 0:74535 59924 99929 89880 . (5) +The program below uses the derivative template in order to perform +the numerical calculation of this derivative. The program also compares the +numerically-obtained result with the expected result and reports the absolute +relative error scaled to a deviation that can easily be related to the number of +bits of lost precision. + +*/ + +/*` [note Rquires the C++11 feature of +[@http://en.wikipedia.org/wiki/Anonymous_function#C.2B.2B anonymous functions] +for the derivative function calls like `[]( const double & x_) -> double`. +*/ + + + +template +value_type derivative (const value_type x, const value_type dx, function_type function) +{ + /*! \brief Compute the derivative of function using a 3-point central difference rule of O(dx^6). + \tparam value_type, floating-point type, for example: `double` or `cpp_dec_float_50` + \tparam function_type + + \param x Value at which to evaluate derivative. + \param dx Incremental step-size. + \param function Function whose derivative is to computed. + + \return derivative at x. + */ + + BOOST_STATIC_ASSERT_MSG(false == std::numeric_limits::is_integer, "value_type must be a floating-point type!"); + + const value_type dx2(dx * 2U); + const value_type dx3(dx * 3U); + // Difference terms. + const value_type m1 ((function (x + dx) - function(x - dx)) / 2U); + const value_type m2 ((function (x + dx2) - function(x - dx2)) / 4U); + const value_type m3 ((function (x + dx3) - function(x - dx3)) / 6U); + const value_type fifteen_m1 (m1 * 15U); + const value_type six_m2 (m2 * 6U); + const value_type ten_dx (dx * 10U); + return ((fifteen_m1 - six_m2) + m3) / ten_dx; // Derivative. +} // + +#include + using boost::multiprecision::number; + using boost::multiprecision::cpp_dec_float; + +// Re-compute using 5 extra decimal digits precision (22) than double (17). +#define MP_DIGITS10 unsigned (std::numeric_limits::max_digits10 + 5) + +typedef cpp_dec_float mp_backend; +typedef number mp_type; + + +int main() +{ + { + const double d = + derivative + ( 1.5, // x = 3.2 + std::ldexp (1., -9), // step size 2^-9 = see below for choice. + [](const double & x)->double // Function f(x). + { + return std::sqrt((x * x) - 1.) - std::acos(1. / x); + } + ); + + // The 'exactly right' result is [sqrt]5 / 3 = 0.74535599249992989880. + const double rel_error = (d - 0.74535599249992989880) / 0.74535599249992989880; + const double bit_error = std::abs(rel_error) / std::numeric_limits::epsilon(); + std::cout.precision (std::numeric_limits::digits10); // Show all guaranteed decimal digits. + std::cout << std::showpoint ; // Ensure that any trailing zeros are shown too. + + std::cout << " derivative : " << d << std::endl; + std::cout << " expected : " << 0.74535599249992989880 << std::endl; + // Can compute an 'exact' value using multiprecision type. + std::cout << " expected : " << sqrt(static_cast(5))/3U << std::endl; + std::cout << " bit_error : " << static_cast(bit_error) << std::endl; + + std::cout.precision(6); + std::cout << "float_distance = " << boost::math::float_distance(0.74535599249992989880, d) << std::endl; + + } + + { // Compute using multiprecision type with an extra 5 decimal digits of precision. + const mp_type mp = + derivative(mp_type(mp_type(3) / 2U), // x = 3/2 + mp_type(mp_type(1) / 10000000U), // Step size 10^7. + [](const mp_type & x)->mp_type + { + return sqrt((x * x) - 1.) - acos (1. / x); // Function + } + ); + + const double d = mp.convert_to(); // Convert to closest double. + const double rel_error = (d - 0.74535599249992989880) / 0.74535599249992989880; + const double bit_error = std::abs (rel_error) / std::numeric_limits::epsilon(); + std::cout.precision (std::numeric_limits ::digits10); // All guaranteed decimal digits. + std::cout << std::showpoint ; // Ensure that any trailing zeros are shown too. + std::cout << " derivative : " << d << std::endl; + // Can compute an 'exact' value using multiprecision type. + std::cout << " expected : " << sqrt(static_cast(5))/3U << std::endl; + std::cout << " expected : " << 0.74535599249992989880 + << std::endl; + std::cout << " bit_error : " << static_cast(bit_error) << std::endl; + + std::cout.precision(6); + std::cout << "float_distance = " << boost::math::float_distance(0.74535599249992989880, d) << std::endl; + + + } + + +} // int main() + +/*` +The result of this program on a system with an eight-byte, 64-bit IEEE-754 +conforming floating-point representation for `double` is: + + derivative : 0.745355992499951 + + derivative : 0.745355992499943 + expected : 0.74535599249993 + bit_error : 78 + + derivative : 0.745355992499930 + expected : 0.745355992499930 + bit_error : 0 + +The resulting bit error is 0. This means that the result of the derivative +calculation is bit-identical with the double representation of the expected result, +and this is the best result possible for the built-in type. + +The derivative in this example has a known closed form. There are, however, +countless situations in numerical analysis (and not only for numerical deriva- +tives) for which the calculation at hand does not have a known closed-form +solution or for which the closed-form solution is highly inconvenient to use. In +such cases, this technique may be useful. + +This example has shown how multiprecision can be used to add extra digits +to an ill-conditioned calculation that suffers from precision loss. When the result +of the multiprecision calculation is converted to a built-in type such as double, +the entire precision of the result in double is preserved. + + */ + +/* + + Description: Autorun "J:\Cpp\big_number\Debug\numerical_derivative_example.exe" + derivative : 0.745355992499943 + expected : 0.745355992499930 + expected : 0.745355992499930 + bit_error : 78 + float_distance = 117.000 + derivative : 0.745355992499930 + expected : 0.745355992499930 + expected : 0.745355992499930 + bit_error : 0 + float_distance = 0.000000 + + */ + diff --git a/src/boost/libs/math/example/ooura_fourier_integrals_cosine_example.cpp b/src/boost/libs/math/example/ooura_fourier_integrals_cosine_example.cpp new file mode 100644 index 00000000..2269202d --- /dev/null +++ b/src/boost/libs/math/example/ooura_fourier_integrals_cosine_example.cpp @@ -0,0 +1,83 @@ +// Copyright Paul A. Bristow, 2019 +// Copyright Nick Thompson, 2019 + +// 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) + +//#define BOOST_MATH_INSTRUMENT_OOURA // or -DBOOST_MATH_INSTRUMENT_OOURA etc for diagnostic output. + +#include // For ooura_fourier_cos +#include // For pi (including for multiprecision types, if used.) + +#include +#include +#include +#include + +int main() +{ + try + { + std::cout.precision(std::numeric_limits::max_digits10); // Show all potentially significant digits. + + using boost::math::quadrature::ooura_fourier_cos; + using boost::math::constants::half_pi; + using boost::math::constants::e; + + //[ooura_fourier_integrals_cosine_example_1 + auto integrator = ooura_fourier_cos(); + // Use the default tolerance root_epsilon and eight levels for type double. + + auto f = [](double x) + { // More complex example function. + return 1 / (x * x + 1); + }; + + double omega = 1; + + auto [result, relative_error] = integrator.integrate(f, omega); + std::cout << "Integral = " << result << ", relative error estimate " << relative_error << std::endl; + + //] [/ooura_fourier_integrals_cosine_example_1] + + //[ooura_fourier_integrals_cosine_example_2 + + constexpr double expected = half_pi() / e(); + std::cout << "pi/(2e) = " << expected << ", difference " << result - expected << std::endl; + //] [/ooura_fourier_integrals_cosine_example_2] + } + catch (std::exception const & ex) + { + // Lacking try&catch blocks, the program will abort after any throw, whereas the + // message below from the thrown exception will give some helpful clues as to the cause of the problem. + std::cout << "\n""Message from thrown exception was:\n " << ex.what() << std::endl; + } + +} // int main() + +/* + +//[ooura_fourier_integrals_example_cosine_output_1 +`` +Integral = 0.57786367489546109, relative error estimate 6.4177395404415149e-09 +pi/(2e) = 0.57786367489546087, difference 2.2204460492503131e-16 +`` +//] [/ooura_fourier_integrals_example_cosine_output_1] + + +//[ooura_fourier_integrals_example_cosine_diagnostic_output_1 +`` +ooura_fourier_cos with relative error goal 1.4901161193847656e-08 & 8 levels. +epsilon for type = 2.2204460492503131e-16 +h = 1.000000000000000, I_h = 0.588268622591776 = 0x1.2d318b7e96dbe00p-1, absolute error estimate = nan +h = 0.500000000000000, I_h = 0.577871642184837 = 0x1.27decab8f07b200p-1, absolute error estimate = 1.039698040693926e-02 +h = 0.250000000000000, I_h = 0.577863671186883 = 0x1.27ddbf42969be00p-1, absolute error estimate = 7.970997954576120e-06 +h = 0.125000000000000, I_h = 0.577863674895461 = 0x1.27ddbf6271dc000p-1, absolute error estimate = 3.708578555361441e-09 +Integral = 5.778636748954611e-01, relative error estimate 6.417739540441515e-09 +pi/(2e) = 5.778636748954609e-01, difference 2.220446049250313e-16 +`` +//] [/ooura_fourier_integrals_example_cosine_diagnostic_output_1] + +*/ diff --git a/src/boost/libs/math/example/ooura_fourier_integrals_example.cpp b/src/boost/libs/math/example/ooura_fourier_integrals_example.cpp new file mode 100644 index 00000000..22a9d015 --- /dev/null +++ b/src/boost/libs/math/example/ooura_fourier_integrals_example.cpp @@ -0,0 +1,83 @@ +// Copyright Paul A. Bristow, 2019 +// Copyright Nick Thompson, 2019 + +// 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) + +#ifdef BOOST_NO_CXX11_LAMBDAS +# error "This example requires a C++11 compiler that supports lambdas. Try C++11 or later." +#endif + +//#define BOOST_MATH_INSTRUMENT_OOURA // or -DBOOST_MATH_INSTRUMENT_OOURA etc for diagnostics. + +#include +#include // For pi (including for multiprecision types, if used.) + +#include +#include +#include +#include + +int main() +{ + try + { + std::cout.precision(std::numeric_limits::max_digits10); // Show all potentially significant digits. + + using boost::math::quadrature::ooura_fourier_sin; + using boost::math::constants::half_pi; + +//[ooura_fourier_integrals_example_1 + ooura_fourier_sinintegrator = ooura_fourier_sin(); + // Use the default tolerance root_epsilon and eight levels for type double. + + auto f = [](double x) + { // Simple reciprocal function for sinc. + return 1 / x; + }; + + double omega = 1; + std::pair result = integrator.integrate(f, omega); + std::cout << "Integral = " << result.first << ", relative error estimate " << result.second << std::endl; + +//] [/ooura_fourier_integrals_example_1] + +//[ooura_fourier_integrals_example_2 + + constexpr double expected = half_pi(); + std::cout << "pi/2 = " << expected << ", difference " << result.first - expected << std::endl; +//] [/ooura_fourier_integrals_example_2] + } + catch (std::exception const & ex) + { + // Lacking try&catch blocks, the program will abort after any throw, whereas the + // message below from the thrown exception will give some helpful clues as to the cause of the problem. + std::cout << "\n""Message from thrown exception was:\n " << ex.what() << std::endl; + } +} // int main() + +/* + +//[ooura_fourier_integrals_example_output_1 + +integral = 1.5707963267948966, relative error estimate 1.2655356398390254e-11 +pi/2 = 1.5707963267948966, difference 0 + +//] [/ooura_fourier_integrals_example_output_1] + + +//[ooura_fourier_integrals_example_diagnostic_output_1 + +ooura_fourier_sin with relative error goal 1.4901161193847656e-08 & 8 levels. +h = 1.000000000000000, I_h = 1.571890732004545 = 0x1.92676e56d853500p+0, absolute error estimate = nan +h = 0.500000000000000, I_h = 1.570793292491940 = 0x1.921f825c076f600p+0, absolute error estimate = 1.097439512605325e-03 +h = 0.250000000000000, I_h = 1.570796326814776 = 0x1.921fb54458acf00p+0, absolute error estimate = 3.034322835882008e-06 +h = 0.125000000000000, I_h = 1.570796326794897 = 0x1.921fb54442d1800p+0, absolute error estimate = 1.987898734512328e-11 +Integral = 1.570796326794897e+00, relative error estimate 1.265535639839025e-11 +pi/2 = 1.570796326794897e+00, difference 0.000000000000000e+00 + +//] [/ooura_fourier_integrals_example_diagnostic_output_1] + +*/ diff --git a/src/boost/libs/math/example/ooura_fourier_integrals_multiprecision_example.cpp b/src/boost/libs/math/example/ooura_fourier_integrals_multiprecision_example.cpp new file mode 100644 index 00000000..f2ac1319 --- /dev/null +++ b/src/boost/libs/math/example/ooura_fourier_integrals_multiprecision_example.cpp @@ -0,0 +1,98 @@ +// Copyright Paul A. Bristow, 2019 +// Copyright Nick Thompson, 2019 + +// 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) + +#if !defined(__cpp_structured_bindings) || (__cpp_structured_bindings < 201606L) +# error "This example requires a C++17 compiler that supports 'structured bindings'. Try /std:c++17 or -std=c++17 or later." +#endif + +//#define BOOST_MATH_INSTRUMENT_OOURA // or -DBOOST_MATH_INSTRUMENT_OOURA etc for diagnostic output. + +#include +#include // for cpp_bin_float_quad, cpp_bin_float_50... +#include // For pi (including for multiprecision types, if used.) + +#include +#include +#include +#include +#include + +int main() +{ + try + { + typedef boost::multiprecision::cpp_bin_float_quad Real; + + std::cout.precision(std::numeric_limits::max_digits10); // Show all potentially significant digits. + + using boost::math::quadrature::ooura_fourier_cos; + using boost::math::constants::half_pi; + using boost::math::constants::e; + + //[ooura_fourier_integrals_multiprecision_example_1 + + // Use the default parameters for tolerance root_epsilon and eight levels for a type of 8 bytes. + //auto integrator = ooura_fourier_cos(); + // Decide on a (tight) tolerance. + const Real tol = 2 * std::numeric_limits::epsilon(); + auto integrator = ooura_fourier_cos(tol, 8); // Loops or gets worse for more than 8. + + auto f = [](Real x) + { // More complex example function. + return 1 / (x * x + 1); + }; + + double omega = 1; + auto [result, relative_error] = integrator.integrate(f, omega); + + //] [/ooura_fourier_integrals_multiprecision_example_1] + + //[ooura_fourier_integrals_multiprecision_example_2 + std::cout << "Integral = " << result << ", relative error estimate " << relative_error << std::endl; + + const Real expected = half_pi() / e(); // Expect integral = 1/(2e) + std::cout << "pi/(2e) = " << expected << ", difference " << result - expected << std::endl; + //] [/ooura_fourier_integrals_multiprecision_example_2] + } + catch (std::exception const & ex) + { + // Lacking try&catch blocks, the program will abort after any throw, whereas the + // message below from the thrown exception will give some helpful clues as to the cause of the problem. + std::cout << "\n""Message from thrown exception was:\n " << ex.what() << std::endl; + } +} // int main() + +/* + +//[ooura_fourier_integrals_example_multiprecision_output_1 +`` +Integral = 0.5778636748954608589550465916563501587, relative error estimate 4.609814684522163895264277312610830278e-17 +pi/(2e) = 0.5778636748954608659545328919193707407, difference -6.999486300263020581921171645255733758e-18 +`` +//] [/ooura_fourier_integrals_example_multiprecision_output_1] + + +//[ooura_fourier_integrals_example_multiprecision_diagnostic_output_1 +`` +ooura_fourier_cos with relative error goal 3.851859888774471706111955885169854637e-34 & 15 levels. +epsilon for type = 1.925929944387235853055977942584927319e-34 +h = 1.000000000000000000000000000000000, I_h = 0.588268622591776615359568690603776 = 0.5882686225917766153595686906037760, absolute error estimate = nan +h = 0.500000000000000000000000000000000, I_h = 0.577871642184837461311756940493259 = 0.5778716421848374613117569404932595, absolute error estimate = 1.039698040693915404781175011051656e-02 +h = 0.250000000000000000000000000000000, I_h = 0.577863671186882539559996800783122 = 0.5778636711868825395599968007831220, absolute error estimate = 7.970997954921751760139710137450075e-06 +h = 0.125000000000000000000000000000000, I_h = 0.577863674895460885593491133506723 = 0.5778636748954608855934911335067232, absolute error estimate = 3.708578346033494332723601147051768e-09 +h = 0.062500000000000000000000000000000, I_h = 0.577863674895460858955046591656350 = 0.5778636748954608589550465916563502, absolute error estimate = 2.663844454185037302771663314961535e-17 +h = 0.031250000000000000000000000000000, I_h = 0.577863674895460858955046591656348 = 0.5778636748954608589550465916563484, absolute error estimate = 1.733336949948512267750380148326435e-33 +h = 0.015625000000000000000000000000000, I_h = 0.577863674895460858955046591656348 = 0.5778636748954608589550465916563479, absolute error estimate = 4.814824860968089632639944856462318e-34 +h = 0.007812500000000000000000000000000, I_h = 0.577863674895460858955046591656347 = 0.5778636748954608589550465916563473, absolute error estimate = 6.740754805355325485695922799047246e-34 +h = 0.003906250000000000000000000000000, I_h = 0.577863674895460858955046591656347 = 0.5778636748954608589550465916563475, absolute error estimate = 1.925929944387235853055977942584927e-34 +Integral = 5.778636748954608589550465916563475e-01, relative error estimate 3.332844800697411177051445985473052e-34 +pi/(2e) = 5.778636748954608589550465916563481e-01, difference -6.740754805355325485695922799047246e-34 +`` +//] [/ooura_fourier_integrals_example_multiprecision_diagnostic_output_1] + +*/ diff --git a/src/boost/libs/math/example/owens_t_example.cpp b/src/boost/libs/math/example/owens_t_example.cpp new file mode 100644 index 00000000..6c6d2041 --- /dev/null +++ b/src/boost/libs/math/example/owens_t_example.cpp @@ -0,0 +1,113 @@ +// Copyright Benjamin Sobotta 2012 + +// 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) + +#ifdef _MSC_VER +# pragma warning(disable : 4127) // conditional expression is constant. +#endif + +#include +#include + +int main() +{ + double h = 0.0,a; + std::cout << std::setprecision(20); + + static const double a_vec[] = { + 0.5000000000000000E+00, + 0.1000000000000000E+01, + 0.2000000000000000E+01, + 0.3000000000000000E+01, + 0.5000000000000000E+00, + 0.1000000000000000E+01, + 0.2000000000000000E+01, + 0.3000000000000000E+01, + 0.5000000000000000E+00, + 0.1000000000000000E+01, + 0.2000000000000000E+01, + 0.3000000000000000E+01, + 0.5000000000000000E+00, + 0.1000000000000000E+01, + 0.2000000000000000E+01, + 0.3000000000000000E+01, + 0.5000000000000000E+00, + 0.1000000000000000E+01, + 0.2000000000000000E+01, + 0.3000000000000000E+01, + 0.1000000000000000E+02, + 0.1000000000000000E+03 }; + + static const double h_vec[] = { + 0.1000000000000000E+01, + 0.1000000000000000E+01, + 0.1000000000000000E+01, + 0.1000000000000000E+01, + 0.5000000000000000E+00, + 0.5000000000000000E+00, + 0.5000000000000000E+00, + 0.5000000000000000E+00, + 0.2500000000000000E+00, + 0.2500000000000000E+00, + 0.2500000000000000E+00, + 0.2500000000000000E+00, + 0.1250000000000000E+00, + 0.1250000000000000E+00, + 0.1250000000000000E+00, + 0.1250000000000000E+00, + 0.7812500000000000E-02, + 0.7812500000000000E-02, + 0.7812500000000000E-02, + 0.7812500000000000E-02, + 0.7812500000000000E-02, + 0.7812500000000000E-02 }; + + static const double t_vec[] = { + 0.4306469112078537E-01, + 0.6674188216570097E-01, + 0.7846818699308410E-01, + 0.7929950474887259E-01, + 0.6448860284750376E-01, + 0.1066710629614485E+00, + 0.1415806036539784E+00, + 0.1510840430760184E+00, + 0.7134663382271778E-01, + 0.1201285306350883E+00, + 0.1666128410939293E+00, + 0.1847501847929859E+00, + 0.7317273327500385E-01, + 0.1237630544953746E+00, + 0.1737438887583106E+00, + 0.1951190307092811E+00, + 0.7378938035365546E-01, + 0.1249951430754052E+00, + 0.1761984774738108E+00, + 0.1987772386442824E+00, + 0.2340886964802671E+00, + 0.2479460829231492E+00 }; + + for(unsigned i = 0; i != 22; ++i) + { + h = h_vec[i]; + a = a_vec[i]; + const double t = boost::math::owens_t(h, a); + std::cout << "h=" << h << "\ta=" << a << "\tcomp=" + << t << "\ttab=" << t_vec[i] + << "\tdiff=" << std::fabs(t_vec[i]-t) << std::endl;; + } + + return 0; +} + + +// EOF + + + + + + + + diff --git a/src/boost/libs/math/example/policy_eg_1.cpp b/src/boost/libs/math/example/policy_eg_1.cpp new file mode 100644 index 00000000..7f8d9fbb --- /dev/null +++ b/src/boost/libs/math/example/policy_eg_1.cpp @@ -0,0 +1,70 @@ +// Copyright John Maddock 2007. +// Copyright Paul A> Bristow 2010 +// 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 +using std::cout; using std::endl; +#include // for ::errno + +//[policy_eg_1 + +#include +using boost::math::tgamma; + +// Define the policy to use: +using namespace boost::math::policies; // may be convenient, or + +using boost::math::policies::policy; +// Types of error whose action can be altered by policies:. +using boost::math::policies::evaluation_error; +using boost::math::policies::domain_error; +using boost::math::policies::overflow_error; +using boost::math::policies::domain_error; +using boost::math::policies::pole_error; +// Actions on error (in enum error_policy_type): +using boost::math::policies::errno_on_error; +using boost::math::policies::ignore_error; +using boost::math::policies::throw_on_error; +using boost::math::policies::user_error; + +typedef policy< + domain_error, + pole_error, + overflow_error, + evaluation_error +> c_policy; +// +// Now use the policy when calling tgamma: + +// http://msdn.microsoft.com/en-us/library/t3ayayh1.aspx +// Microsoft errno declared in STDLIB.H as "extern int errno;" + +int main() +{ + errno = 0; // Reset. + cout << "Result of tgamma(30000) is: " + << tgamma(30000, c_policy()) << endl; // Too big parameter + cout << "errno = " << errno << endl; // errno 34 Numerical result out of range. + cout << "Result of tgamma(-10) is: " + << boost::math::tgamma(-10, c_policy()) << endl; // Negative parameter. + cout << "errno = " << errno << endl; // error 33 Numerical argument out of domain. +} // int main() + +//] + +/* Output + +policy_eg_1.cpp + Generating code + Finished generating code + policy_eg_1.vcxproj -> J:\Cpp\MathToolkit\test\Math_test\Release\policy_eg_1.exe + Result of tgamma(30000) is: 1.#INF + errno = 34 + Result of tgamma(-10) is: 1.#QNAN + errno = 33 + +*/ + + diff --git a/src/boost/libs/math/example/policy_eg_10.cpp b/src/boost/libs/math/example/policy_eg_10.cpp new file mode 100644 index 00000000..87f84c09 --- /dev/null +++ b/src/boost/libs/math/example/policy_eg_10.cpp @@ -0,0 +1,183 @@ +// Copyright John Maddock 2007. +// Copyright Paul A. Bristow 2010 +// 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) + +// Note that this file contains quickbook mark-up as well as code +// and comments, don't change any of the special comment mark-ups! + +//[policy_eg_10 + +/*` + +To understand how the rounding policies for +the discrete distributions can be used, we'll +use the 50-sample binomial distribution with a +success fraction of 0.5 once again, and calculate +all the possible quantiles at 0.05 and 0.95. + +Begin by including the needed headers (and some using statements for conciseness): + +*/ +#include +using std::cout; using std::endl; +using std::left; using std::fixed; using std::right; using std::scientific; +#include +using std::setw; +using std::setprecision; + +#include +/*` + +Next we'll bring the needed declarations into scope, and +define distribution types for all the available rounding policies: + +*/ +// Avoid +// using namespace std; // and +// using namespace boost::math; +// to avoid potential ambiguity of names, like binomial. +// using namespace boost::math::policies; is small risk, but +// the necessary items are brought into scope thus: + +using boost::math::binomial_distribution; +using boost::math::policies::policy; +using boost::math::policies::discrete_quantile; + +using boost::math::policies::integer_round_outwards; +using boost::math::policies::integer_round_down; +using boost::math::policies::integer_round_up; +using boost::math::policies::integer_round_nearest; +using boost::math::policies::integer_round_inwards; +using boost::math::policies::real; + +using boost::math::binomial_distribution; // Not std::binomial_distribution. + +typedef binomial_distribution< + double, + policy > > + binom_round_outwards; + +typedef binomial_distribution< + double, + policy > > + binom_round_inwards; + +typedef binomial_distribution< + double, + policy > > + binom_round_down; + +typedef binomial_distribution< + double, + policy > > + binom_round_up; + +typedef binomial_distribution< + double, + policy > > + binom_round_nearest; + +typedef binomial_distribution< + double, + policy > > + binom_real_quantile; + +/*` +Now let's set to work calling those quantiles: +*/ + +int main() +{ + cout << + "Testing rounding policies for a 50 sample binomial distribution,\n" + "with a success fraction of 0.5.\n\n" + "Lower quantiles are calculated at p = 0.05\n\n" + "Upper quantiles at p = 0.95.\n\n"; + + cout << setw(25) << right + << "Policy"<< setw(18) << right + << "Lower Quantile" << setw(18) << right + << "Upper Quantile" << endl; + + // Test integer_round_outwards: + cout << setw(25) << right + << "integer_round_outwards" + << setw(18) << right + << quantile(binom_round_outwards(50, 0.5), 0.05) + << setw(18) << right + << quantile(binom_round_outwards(50, 0.5), 0.95) + << endl; + + // Test integer_round_inwards: + cout << setw(25) << right + << "integer_round_inwards" + << setw(18) << right + << quantile(binom_round_inwards(50, 0.5), 0.05) + << setw(18) << right + << quantile(binom_round_inwards(50, 0.5), 0.95) + << endl; + + // Test integer_round_down: + cout << setw(25) << right + << "integer_round_down" + << setw(18) << right + << quantile(binom_round_down(50, 0.5), 0.05) + << setw(18) << right + << quantile(binom_round_down(50, 0.5), 0.95) + << endl; + + // Test integer_round_up: + cout << setw(25) << right + << "integer_round_up" + << setw(18) << right + << quantile(binom_round_up(50, 0.5), 0.05) + << setw(18) << right + << quantile(binom_round_up(50, 0.5), 0.95) + << endl; + + // Test integer_round_nearest: + cout << setw(25) << right + << "integer_round_nearest" + << setw(18) << right + << quantile(binom_round_nearest(50, 0.5), 0.05) + << setw(18) << right + << quantile(binom_round_nearest(50, 0.5), 0.95) + << endl; + + // Test real: + cout << setw(25) << right + << "real" + << setw(18) << right + << quantile(binom_real_quantile(50, 0.5), 0.05) + << setw(18) << right + << quantile(binom_real_quantile(50, 0.5), 0.95) + << endl; +} // int main() + +/*` + +Which produces the program output: + +[pre + policy_eg_10.vcxproj -> J:\Cpp\MathToolkit\test\Math_test\Release\policy_eg_10.exe + Testing rounding policies for a 50 sample binomial distribution, + with a success fraction of 0.5. + + Lower quantiles are calculated at p = 0.05 + + Upper quantiles at p = 0.95. + + Policy Lower Quantile Upper Quantile + integer_round_outwards 18 31 + integer_round_inwards 19 30 + integer_round_down 18 30 + integer_round_up 19 31 + integer_round_nearest 19 30 + real 18.701 30.299 +] + +*/ + +//] //[policy_eg_10] ends quickbook import. diff --git a/src/boost/libs/math/example/policy_eg_2.cpp b/src/boost/libs/math/example/policy_eg_2.cpp new file mode 100644 index 00000000..3ab8312e --- /dev/null +++ b/src/boost/libs/math/example/policy_eg_2.cpp @@ -0,0 +1,65 @@ +// Copyright John Maddock 2007. +// Copyright Paul A. Bristow 2010 +// 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 +using std::cout; using std::endl; +#include // for ::errno + +//[policy_eg_2 + +#include +using boost::math::tgamma; + +int main() +{ + // using namespace boost::math::policies; // or + using boost::math::policies::errno_on_error; + using boost::math::policies::make_policy; + using boost::math::policies::pole_error; + using boost::math::policies::domain_error; + using boost::math::policies::overflow_error; + using boost::math::policies::evaluation_error; + + errno = 0; + std::cout << "Result of tgamma(30000) is: " + << boost::math::tgamma( + 30000, + make_policy( + domain_error(), + pole_error(), + overflow_error(), + evaluation_error() + ) + ) << std::endl; + // Check errno was set: + std::cout << "errno = " << errno << std::endl; + // and again with evaluation at a pole: + std::cout << "Result of tgamma(-10) is: " + << boost::math::tgamma( + -10, + make_policy( + domain_error(), + pole_error(), + overflow_error(), + evaluation_error() + ) + ) << std::endl; + // Check errno was set: + std::cout << "errno = " << errno << std::endl; +} + +//] //[/policy_eg_2] + +/* + +Output: + + Result of tgamma(30000) is: 1.#INF + errno = 34 + Result of tgamma(-10) is: 1.#QNAN + errno = 33 +*/ + diff --git a/src/boost/libs/math/example/policy_eg_3.cpp b/src/boost/libs/math/example/policy_eg_3.cpp new file mode 100644 index 00000000..adf8c9e4 --- /dev/null +++ b/src/boost/libs/math/example/policy_eg_3.cpp @@ -0,0 +1,55 @@ +// Copyright John Maddock 2007. +// Copyright Paul A. Bristow 2007, 2010. + +// 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) + +#ifdef _MSC_VER +# pragma warning (disable : 4305) // 'initializing' : truncation from 'long double' to 'const eval_type' +# pragma warning (disable : 4244) // conversion from 'long double' to 'const eval_type' +#endif + +#include +using std::cout; using std::endl; + +//[policy_eg_3 + +#include +using boost::math::binomial_distribution; + +// Begin by defining a policy type, that gives the behaviour we want: + +//using namespace boost::math::policies; or explicitly +using boost::math::policies::policy; + +using boost::math::policies::promote_float; +using boost::math::policies::discrete_quantile; +using boost::math::policies::integer_round_nearest; + +typedef policy< + promote_float, // Do not promote to double. + discrete_quantile // Round result to nearest integer. +> mypolicy; +// +// Then define a new distribution that uses it: +typedef boost::math::binomial_distribution mybinom; + +// And now use it to get the quantile: + +int main() +{ + cout << "quantile(mybinom(200, 0.25), 0.05) is: " << + quantile(mybinom(200, 0.25), 0.05) << endl; +} + +//] + +/* + +Output: + + quantile(mybinom(200, 0.25), 0.05) is: 40 + +*/ + diff --git a/src/boost/libs/math/example/policy_eg_4.cpp b/src/boost/libs/math/example/policy_eg_4.cpp new file mode 100644 index 00000000..5cd28161 --- /dev/null +++ b/src/boost/libs/math/example/policy_eg_4.cpp @@ -0,0 +1,107 @@ +// Copyright John Maddock 2007. +// Copyright Paul A. Bristow 2010 + +// 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) + +// Note that this file contains quickbook mark-up as well as code +// and comments, don't change any of the special comment mark-ups! + +#include +using std::cout; using std::endl; +#include // for ::errno + +//[policy_eg_4 + +/*` +Suppose we want `C::foo()` to behave in a C-compatible way and set +`::errno` on error rather than throwing any exceptions. + +We'll begin by including the needed header for our function: +*/ + +#include +//using boost::math::tgamma; // Not needed because using C::tgamma. + +/*` +Open up the "C" namespace that we'll use for our functions, and +define the policy type we want: in this case a C-style one that sets +::errno and returns a standard value, rather than throwing exceptions. + +Any policies we don't specify here will inherit the defaults. +*/ + +namespace C +{ // To hold our C-style policy. + //using namespace boost::math::policies; or explicitly: + using boost::math::policies::policy; + + using boost::math::policies::domain_error; + using boost::math::policies::pole_error; + using boost::math::policies::overflow_error; + using boost::math::policies::evaluation_error; + using boost::math::policies::errno_on_error; + + typedef policy< + domain_error, + pole_error, + overflow_error, + evaluation_error + > c_policy; + +/*` +All we need do now is invoke the BOOST_MATH_DECLARE_SPECIAL_FUNCTIONS +macro passing our policy type c_policy as the single argument: +*/ + +BOOST_MATH_DECLARE_SPECIAL_FUNCTIONS(c_policy) + +} // close namespace C + +/*` +We now have a set of forwarding functions defined in namespace C +that all look something like this: + +`` +template +inline typename boost::math::tools::promote_args::type + tgamma(RT z) +{ + return boost::math::tgamma(z, c_policy()); +} +`` + +So that when we call `C::tgamma(z)`, we really end up calling +`boost::math::tgamma(z, C::c_policy())`: +*/ + +int main() +{ + errno = 0; + cout << "Result of tgamma(30000) is: " + << C::tgamma(30000) << endl; // Note using C::tgamma + cout << "errno = " << errno << endl; // errno = 34 + cout << "Result of tgamma(-10) is: " + << C::tgamma(-10) << endl; + cout << "errno = " << errno << endl; // errno = 33, overwriting previous value of 34. +} + +/*` + +Which outputs: + +[pre +Result of C::tgamma(30000) is: 1.#INF +errno = 34 +Result of C::tgamma(-10) is: 1.#QNAN +errno = 33 +] + +This mechanism is particularly useful when we want to define a project-wide policy, +and don't want to modify the Boost source, +or to set project wide build macros (possibly fragile and easy to forget). + +*/ +//] //[/policy_eg_4] + diff --git a/src/boost/libs/math/example/policy_eg_5.cpp b/src/boost/libs/math/example/policy_eg_5.cpp new file mode 100644 index 00000000..d022c9c8 --- /dev/null +++ b/src/boost/libs/math/example/policy_eg_5.cpp @@ -0,0 +1,66 @@ +// Copyright John Maddock 2007. +// Copyright Paul A. Bristow 2010 +// 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) + +// Note that this file contains quickbook mark-up as well as code +// and comments, don't change any of the special comment mark-ups! + +#include +using std::cout; using std::endl; +#include // for ::errno + +//[policy_eg_5 + +#include +// using boost::math::tgamma; // Would create an ambiguity between +// 'double boost::math::tgamma(T)' and +// 'double 'anonymous-namespace'::tgamma(RT)'. + +namespace mymath +{ // unnamed + +using namespace boost::math::policies; + +typedef policy< + domain_error, + pole_error, + overflow_error, + evaluation_error +> c_policy; + +BOOST_MATH_DECLARE_SPECIAL_FUNCTIONS(c_policy) + +/*` +So that when we call `mymath::tgamma(z)`, we really end up calling + `boost::math::tgamma(z, anonymous-namespace::c_policy())`. +*/ + +} // close unnamed namespace + +int main() +{ + errno = 0; + cout << "Result of tgamma(30000) is: " + << mymath::tgamma(30000) << endl; + // tgamma in unnamed namespace in this translation unit (file) only. + cout << "errno = " << errno << endl; + cout << "Result of tgamma(-10) is: " + << mymath::tgamma(-10) << endl; + cout << "errno = " << errno << endl; + // Default tgamma policy would throw an exception, and abort. +} + +//] //[/policy_eg_5] + +/* +Output: + + Result of tgamma(30000) is: 1.#INF + errno = 34 + Result of tgamma(-10) is: 1.#QNAN + errno = 33 + + +*/ diff --git a/src/boost/libs/math/example/policy_eg_6.cpp b/src/boost/libs/math/example/policy_eg_6.cpp new file mode 100644 index 00000000..57f92fcc --- /dev/null +++ b/src/boost/libs/math/example/policy_eg_6.cpp @@ -0,0 +1,121 @@ +// Copyright John Maddock 2007. +// Copyright Paul A. Bristow 2010 +// 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) + +// Note that this file contains quickbook mark-up as well as code +// and comments, don't change any of the special comment mark-ups! + +#include +using std::cout; using std::endl; +#include // for ::errno + +//[policy_eg_6 + +/*` +Suppose we want a set of distributions to behave as follows: + +* Return infinity on overflow, rather than throwing an exception. +* Don't perform any promotion from double to long double internally. +* Return the closest integer result from the quantiles of discrete +distributions. + +We'll begin by including the needed header for all the distributions: +*/ + +#include + +/*` + +Open up an appropriate namespace, calling it `my_distributions`, +for our distributions, and define the policy type we want. +Any policies we don't specify here will inherit the defaults: + +*/ + +namespace my_distributions +{ + using namespace boost::math::policies; + // using boost::math::policies::errno_on_error; // etc. + + typedef policy< + // return infinity and set errno rather than throw: + overflow_error, + // Don't promote double -> long double internally: + promote_double, + // Return the closest integer result for discrete quantiles: + discrete_quantile + > my_policy; + +/*` + +All we need do now is invoke the BOOST_MATH_DECLARE_DISTRIBUTIONS +macro passing the floating point type `double` and policy types `my_policy` as arguments: + +*/ + +BOOST_MATH_DECLARE_DISTRIBUTIONS(double, my_policy) + +} // close namespace my_namespace + +/*` + +We now have a set of typedefs defined in namespace my_distributions +that all look something like this: + +`` +typedef boost::math::normal_distribution normal; +typedef boost::math::cauchy_distribution cauchy; +typedef boost::math::gamma_distribution gamma; +// etc +`` + +So that when we use my_distributions::normal we really end up using +`boost::math::normal_distribution`: + +*/ + +int main() +{ + // Construct distribution with something we know will overflow + // (using double rather than if promoted to long double): + my_distributions::normal norm(10, 2); + + errno = 0; + cout << "Result of quantile(norm, 0) is: " + << quantile(norm, 0) << endl; // -infinity. + cout << "errno = " << errno << endl; + errno = 0; + cout << "Result of quantile(norm, 1) is: " + << quantile(norm, 1) << endl; // +infinity. + cout << "errno = " << errno << endl; + + // Now try a discrete distribution. + my_distributions::binomial binom(20, 0.25); + cout << "Result of quantile(binom, 0.05) is: " + << quantile(binom, 0.05) << endl; // To check we get integer results. + cout << "Result of quantile(complement(binom, 0.05)) is: " + << quantile(complement(binom, 0.05)) << endl; +} + +/*` + +Which outputs: + +[pre +Result of quantile(norm, 0) is: -1.#INF +errno = 34 +Result of quantile(norm, 1) is: 1.#INF +errno = 34 +Result of quantile(binom, 0.05) is: 1 +Result of quantile(complement(binom, 0.05)) is: 8 +] + +This mechanism is particularly useful when we want to define a +project-wide policy, and don't want to modify the Boost source +or set project wide build macros (possibly fragile and easy to forget). + +*/ +//] //[/policy_eg_6] + diff --git a/src/boost/libs/math/example/policy_eg_7.cpp b/src/boost/libs/math/example/policy_eg_7.cpp new file mode 100644 index 00000000..70a49504 --- /dev/null +++ b/src/boost/libs/math/example/policy_eg_7.cpp @@ -0,0 +1,73 @@ +// Copyright John Maddock 2007. +// Copyright Paul A. Bristow 2010 +// 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) + +// Note that this file contains quickbook mark-up as well as code +// and comments, don't change any of the special comment mark-ups! + +#include +using std::cout; using std::endl; +#include // for ::errno + +//[policy_eg_7 + +#include // All distributions. +// using boost::math::normal; // Would create an ambguity between +// boost::math::normal_distribution boost::math::normal and +// 'anonymous-namespace'::normal'. + +namespace +{ // anonymous or unnnamed (rather than named as in policy_eg_6.cpp). + + using namespace boost::math::policies; + // using boost::math::policies::errno_on_error; // etc. + typedef policy< + // return infinity and set errno rather than throw: + overflow_error, + // Don't promote double -> long double internally: + promote_double, + // Return the closest integer result for discrete quantiles: + discrete_quantile + > my_policy; + + BOOST_MATH_DECLARE_DISTRIBUTIONS(double, my_policy) + +} // close namespace my_namespace + +int main() +{ + // Construct distribution with something we know will overflow. + normal norm(10, 2); // using 'anonymous-namespace'::normal + errno = 0; + cout << "Result of quantile(norm, 0) is: " + << quantile(norm, 0) << endl; + cout << "errno = " << errno << endl; + errno = 0; + cout << "Result of quantile(norm, 1) is: " + << quantile(norm, 1) << endl; + cout << "errno = " << errno << endl; + // + // Now try a discrete distribution: + binomial binom(20, 0.25); + cout << "Result of quantile(binom, 0.05) is: " + << quantile(binom, 0.05) << endl; + cout << "Result of quantile(complement(binom, 0.05)) is: " + << quantile(complement(binom, 0.05)) << endl; +} + +//] //[/policy_eg_7] + +/* + +Output: + + Result of quantile(norm, 0) is: -1.#INF + errno = 34 + Result of quantile(norm, 1) is: 1.#INF + errno = 34 + Result of quantile(binom, 0.05) is: 1 + Result of quantile(complement(binom, 0.05)) is: 8 + +*/ diff --git a/src/boost/libs/math/example/policy_eg_8.cpp b/src/boost/libs/math/example/policy_eg_8.cpp new file mode 100644 index 00000000..775f042e --- /dev/null +++ b/src/boost/libs/math/example/policy_eg_8.cpp @@ -0,0 +1,133 @@ +// Copyright John Maddock 2007. +// Copyright Paul a. Bristow 2010 +// 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) + +// Note that this file contains quickbook mark-up as well as code +// and comments, don't change any of the special comment mark-ups! + +#ifdef _MSC_VER +# pragma warning (disable : 4100) // unreferenced formal parameters +#endif + +#include +using std::cout; using std::endl; using std::cerr; + +//[policy_eg_8 + +/*` +Suppose we want our own user-defined error handlers rather than the +any of the default ones supplied by the library to be used. +If we set the policy for a specific type of error to `user_error` +then the library will call a user-supplied error handler. +These are forward declared, but not defined in +boost/math/policies/error_handling.hpp like this: + + namespace boost{ namespace math{ namespace policies{ + + template + T user_domain_error(const char* function, const char* message, const T& val); + template + T user_pole_error(const char* function, const char* message, const T& val); + template + T user_overflow_error(const char* function, const char* message, const T& val); + template + T user_underflow_error(const char* function, const char* message, const T& val); + template + T user_denorm_error(const char* function, const char* message, const T& val); + template + T user_evaluation_error(const char* function, const char* message, const T& val); + template + T user_rounding_error(const char* function, const char* message, const T& val, const TargetType& t); + template + T user_indeterminate_result_error(const char* function, const char* message, const T& val); + + }}} // namespaces + +So out first job is to include the header we want to use, and then +provide definitions for our user-defined error handlers that we want to use. +We only provide our special domain and pole error handlers; +other errors like overflow and underflow use the default. +*/ + +#include + +namespace boost{ namespace math +{ + namespace policies + { + template + T user_domain_error(const char* function, const char* message, const T& val) + { // Ignoring function, message and val for this example, perhaps unhelpfully. + cerr << "Domain Error!" << endl; + return std::numeric_limits::quiet_NaN(); + } + + template + T user_pole_error(const char* function, const char* message, const T& val) + { // Ignoring function, message and val for this example, perhaps unhelpfully. + cerr << "Pole Error!" << endl; + return std::numeric_limits::quiet_NaN(); + } + } // namespace policies +}} // namespace boost{ namespace math + + +/*` +Now we'll need to define a suitable policy that will call these handlers, +and define some forwarding functions that make use of the policy: +*/ + +namespace mymath{ + +using namespace boost::math::policies; + +typedef policy< + domain_error, + pole_error +> user_error_policy; + +BOOST_MATH_DECLARE_SPECIAL_FUNCTIONS(user_error_policy) + +} // close unnamed namespace + +/*` +We now have a set of forwarding functions defined in namespace mymath +that all look something like this: + +`` +template +inline typename boost::math::tools::promote_args::type + tgamma(RT z) +{ + return boost::math::tgamma(z, user_error_policy()); +} +`` + +So that when we call `mymath::tgamma(z)` we really end up calling +`boost::math::tgamma(z, user_error_policy())`, and any +errors will get directed to our own error handlers. +*/ + +int main() +{ + cout << "Result of erf_inv(-10) is: " + << mymath::erf_inv(-10) << endl; + cout << "Result of tgamma(-10) is: " + << mymath::tgamma(-10) << endl; +} + +/*` + +Which outputs: + +[pre + Domain Error! + Pole Error! + Result of erf_inv(-10) is: 1.#QNAN + Result of tgamma(-10) is: 1.#QNAN +] +*/ + +//] // //[/policy_eg_8] diff --git a/src/boost/libs/math/example/policy_eg_9.cpp b/src/boost/libs/math/example/policy_eg_9.cpp new file mode 100644 index 00000000..c1895220 --- /dev/null +++ b/src/boost/libs/math/example/policy_eg_9.cpp @@ -0,0 +1,313 @@ +// Copyright John Maddock 2007. +// Copyright Paul A. Bristow 2010 +// 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) + +// Note that this file contains quickbook mark-up as well as code +// and comments, don't change any of the special comment mark-ups! + +#include +#include +using std::cout; using std::endl; using std::cerr; + +//[policy_eg_9 + +/*` +The previous example was all well and good, but the custom error handlers +didn't really do much of any use. In this example we'll implement all +the custom handlers and show how the information provided to them can be +used to generate nice formatted error messages. + +Each error handler has the general form: + + template + T user_``['error_type]``( + const char* function, + const char* message, + const T& val); + +and accepts three arguments: + +[variablelist +[[const char* function] + [The name of the function that raised the error, this string + contains one or more %1% format specifiers that should be + replaced by the name of real type T, like float or double.]] +[[const char* message] + [A message associated with the error, normally this + contains a %1% format specifier that should be replaced with + the value of ['value]: however note that overflow and underflow messages + do not contain this %1% specifier (since the value of ['value] is + immaterial in these cases).]] +[[const T& value] + [The value that caused the error: either an argument to the function + if this is a domain or pole error, the tentative result + if this is a denorm or evaluation error, or zero or infinity for + underflow or overflow errors.]] +] + +As before we'll include the headers we need first: + +*/ + +#include + +/*` +Next we'll implement our own error handlers for each type of error, +starting with domain errors: +*/ + +namespace boost{ namespace math{ +namespace policies +{ + +template +T user_domain_error(const char* function, const char* message, const T& val) +{ + /*` + We'll begin with a bit of defensive programming in case function or message are empty: + */ + if(function == 0) + function = "Unknown function with arguments of type %1%"; + if(message == 0) + message = "Cause unknown with bad argument %1%"; + /*` + Next we'll format the name of the function with the name of type T, perhaps double: + */ + std::string msg("Error in function "); + msg += (boost::format(function) % typeid(T).name()).str(); + /*` + Then likewise format the error message with the value of parameter /val/, + making sure we output all the potentially significant digits of /val/: + */ + msg += ": \n"; + int prec = 2 + (std::numeric_limits::digits * 30103UL) / 100000UL; + // int prec = std::numeric_limits::max_digits10; // For C++0X Standard Library + msg += (boost::format(message) % boost::io::group(std::setprecision(prec), val)).str(); + /*` + Now we just have to do something with the message, we could throw an + exception, but for the purposes of this example we'll just dump the message + to std::cerr: + */ + std::cerr << msg << std::endl; + /*` + Finally the only sensible value we can return from a domain error is a NaN: + */ + return std::numeric_limits::quiet_NaN(); +} + +/*` +Pole errors are essentially a special case of domain errors, +so in this example we'll just return the result of a domain error: +*/ + +template +T user_pole_error(const char* function, const char* message, const T& val) +{ + return user_domain_error(function, message, val); +} + +/*` +Overflow errors are very similar to domain errors, except that there's +no %1% format specifier in the /message/ parameter: +*/ +template +T user_overflow_error(const char* function, const char* message, const T& val) +{ + if(function == 0) + function = "Unknown function with arguments of type %1%"; + if(message == 0) + message = "Result of function is too large to represent"; + + std::string msg("Error in function "); + msg += (boost::format(function) % typeid(T).name()).str(); + + msg += ": \n"; + msg += message; + + std::cerr << msg << std::endl; + + // Value passed to the function is an infinity, just return it: + return val; +} + +/*` +Underflow errors are much the same as overflow: +*/ + +template +T user_underflow_error(const char* function, const char* message, const T& val) +{ + if(function == 0) + function = "Unknown function with arguments of type %1%"; + if(message == 0) + message = "Result of function is too small to represent"; + + std::string msg("Error in function "); + msg += (boost::format(function) % typeid(T).name()).str(); + + msg += ": \n"; + msg += message; + + std::cerr << msg << std::endl; + + // Value passed to the function is zero, just return it: + return val; +} + +/*` +Denormalised results are much the same as underflow: +*/ + +template +T user_denorm_error(const char* function, const char* message, const T& val) +{ + if(function == 0) + function = "Unknown function with arguments of type %1%"; + if(message == 0) + message = "Result of function is denormalised"; + + std::string msg("Error in function "); + msg += (boost::format(function) % typeid(T).name()).str(); + + msg += ": \n"; + msg += message; + + std::cerr << msg << std::endl; + + // Value passed to the function is denormalised, just return it: + return val; +} + +/*` +Which leaves us with evaluation errors: these occur when an internal +error occurs that prevents the function being fully evaluated. +The parameter /val/ contains the closest approximation to the result +found so far: +*/ + +template +T user_evaluation_error(const char* function, const char* message, const T& val) +{ + if(function == 0) + function = "Unknown function with arguments of type %1%"; + if(message == 0) + message = "An internal evaluation error occurred with " + "the best value calculated so far of %1%"; + + std::string msg("Error in function "); + msg += (boost::format(function) % typeid(T).name()).str(); + + msg += ": \n"; + int prec = 2 + (std::numeric_limits::digits * 30103UL) / 100000UL; + // int prec = std::numeric_limits::max_digits10; // For C++0X Standard Library + msg += (boost::format(message) % boost::io::group(std::setprecision(prec), val)).str(); + + std::cerr << msg << std::endl; + + // What do we return here? This is generally a fatal error, that should never occur, + // so we just return a NaN for the purposes of the example: + return std::numeric_limits::quiet_NaN(); +} + +} // policies +}} // boost::math + + +/*` +Now we'll need to define a suitable policy that will call these handlers, +and define some forwarding functions that make use of the policy: +*/ + +namespace mymath +{ // unnamed. + +using namespace boost::math::policies; + +typedef policy< + domain_error, + pole_error, + overflow_error, + underflow_error, + denorm_error, + evaluation_error +> user_error_policy; + +BOOST_MATH_DECLARE_SPECIAL_FUNCTIONS(user_error_policy) + +} // unnamed namespace + +/*` +We now have a set of forwarding functions, defined in namespace mymath, +that all look something like this: + +`` +template +inline typename boost::math::tools::promote_args::type + tgamma(RT z) +{ + return boost::math::tgamma(z, user_error_policy()); +} +`` + +So that when we call `mymath::tgamma(z)` we really end up calling +`boost::math::tgamma(z, user_error_policy())`, and any +errors will get directed to our own error handlers: +*/ + +int main() +{ + // Raise a domain error: + cout << "Result of erf_inv(-10) is: " + << mymath::erf_inv(-10) << std::endl << endl; + // Raise a pole error: + cout << "Result of tgamma(-10) is: " + << mymath::tgamma(-10) << std::endl << endl; + // Raise an overflow error: + cout << "Result of tgamma(3000) is: " + << mymath::tgamma(3000) << std::endl << endl; + // Raise an underflow error: + cout << "Result of tgamma(-190.5) is: " + << mymath::tgamma(-190.5) << std::endl << endl; + // Unfortunately we can't predicably raise a denormalised + // result, nor can we raise an evaluation error in this example + // since these should never really occur! +} // int main() + +/*` + +Which outputs: + +[pre +Error in function boost::math::erf_inv(double, double): +Argument outside range \[-1, 1\] in inverse erf function (got p=-10). +Result of erf_inv(-10) is: 1.#QNAN + +Error in function boost::math::tgamma(long double): +Evaluation of tgamma at a negative integer -10. +Result of tgamma(-10) is: 1.#QNAN + +Error in function boost::math::tgamma(long double): +Result of tgamma is too large to represent. +Error in function boost::math::tgamma(double): +Result of function is too large to represent +Result of tgamma(3000) is: 1.#INF + +Error in function boost::math::tgamma(long double): +Result of tgamma is too large to represent. +Error in function boost::math::tgamma(long double): +Result of tgamma is too small to represent. +Result of tgamma(-190.5) is: 0 +] + +Notice how some of the calls result in an error handler being called more +than once, or for more than one handler to be called: this is an artefact +of the fact that many functions are implemented in terms of one or more +sub-routines each of which may have it's own error handling. For example +`tgamma(-190.5)` is implemented in terms of `tgamma(190.5)` - which overflows - +the reflection formula for `tgamma` then notices that it is dividing by +infinity and so underflows. +*/ + +//] //[/policy_eg_9] diff --git a/src/boost/libs/math/example/policy_ref_snip1.cpp b/src/boost/libs/math/example/policy_ref_snip1.cpp new file mode 100644 index 00000000..21771939 --- /dev/null +++ b/src/boost/libs/math/example/policy_ref_snip1.cpp @@ -0,0 +1,75 @@ +// Copyright John Maddock 2007. +// Copyright Paul A. Bristow 2010. +// 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) + +// Note that this file contains quickbook mark-up as well as code +// and comments, don't change any of the special comment mark-ups! + +//[policy_ref_snip1 + +#include +using boost::math::tgamma; + +//using namespace boost::math::policies; may also be convenient. +using boost::math::policies::policy; +using boost::math::policies::evaluation_error; +using boost::math::policies::domain_error; +using boost::math::policies::overflow_error; +using boost::math::policies::domain_error; +using boost::math::policies::pole_error; +using boost::math::policies::errno_on_error; + +// Define a policy: +typedef policy< + domain_error, + pole_error, + overflow_error, + evaluation_error +> my_policy; + +double my_value = 0.; // + +// Call the function applying my_policy: +double t1 = tgamma(my_value, my_policy()); + +// Alternatively (and equivalently) we could use helpful function +// make_policy and define everything at the call site: +double t2 = tgamma(my_value, + make_policy( + domain_error(), + pole_error(), + overflow_error(), + evaluation_error() ) + ); +//] + +#include +using std::cout; using std::endl; + +int main() +{ + cout << "my_value = " << my_value << endl; + try + { // First with default policy - throw an exception. + cout << "tgamma(my_value) = " << tgamma(my_value) << endl; + } + catch(const std::exception& e) + { + cout <<"\n""Message from thrown exception was:\n " << e.what() << endl; + } + + cout << "tgamma(my_value, my_policy() = " << t1 << endl; + cout << "tgamma(my_value, make_policy(domain_error(), pole_error(), overflow_error(), evaluation_error() ) = " << t2 << endl; +} + +/* +Output: + my_value = 0 + + Message from thrown exception was: + Error in function boost::math::tgamma(long double): Evaluation of tgamma at a negative integer 0. + tgamma(my_value, my_policy() = 1.#QNAN + tgamma(my_value, make_policy(domain_error(), pole_error(), overflow_error(), evaluation_error() ) = 1.#QNAN +*/ diff --git a/src/boost/libs/math/example/policy_ref_snip10.cpp b/src/boost/libs/math/example/policy_ref_snip10.cpp new file mode 100644 index 00000000..a4806dc6 --- /dev/null +++ b/src/boost/libs/math/example/policy_ref_snip10.cpp @@ -0,0 +1,40 @@ +// Copyright John Maddock 2007. +// Copyright Paul A. Bristow 2010 +// 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) + +// Note that this file contains quickbook mark-up as well as code +// and comments, don't change any of the special comment mark-ups! + +// Setting precision in a single function call using make_policy. + +#include +using std::cout; using std::endl; + +//[policy_ref_snip10 + +#include +using boost::math::tgamma; + +using namespace boost::math::policies; + +double t = tgamma(12, policy >()); // Concise make_policy. + +//] //[/policy_ref_snip10] + + + +int main() +{ + cout << "tgamma(12, policy >()) = "<< t << endl; +} + +/* + +Output: + + tgamma(12, policy >()) = 3.99168e+007 + +*/ + diff --git a/src/boost/libs/math/example/policy_ref_snip11.cpp b/src/boost/libs/math/example/policy_ref_snip11.cpp new file mode 100644 index 00000000..9e82750a --- /dev/null +++ b/src/boost/libs/math/example/policy_ref_snip11.cpp @@ -0,0 +1,45 @@ +// Copyright John Maddock 2007. +// Copyright Paul A. Bristow 2010 +// 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) + +// Note that this file contains quickbook mark-up as well as code +// and comments, don't change any of the special comment mark-ups! + +#include +using std::cout; using std::endl; + +// Setting (approximate) precision 25 bits in a single function call using make_policy. + +//[policy_ref_snip11 + +#include +using boost::math::normal_distribution; + +using namespace boost::math::policies; + +const int bits = 25; // approximate precision. + +double q = quantile( + normal_distribution > >(), + 0.05); // 5% quantile. + +//] //[/policy_ref_snip11] + +int main() +{ + std::streamsize p = 2 + (bits * 30103UL) / 100000UL; + // Approximate number of significant decimal digits for 25 bits. + cout.precision(p); + cout << bits << " binary bits is approoximately equivalent to " << p << " decimal digits " << endl; + cout << "quantile(normal_distribution > >(), 0.05 = " + << q << endl; // -1.64485 +} + +/* +Output: + 25 binary bits is approoximately equivalent to 9 decimal digits + quantile(normal_distribution > >(), 0.05 = -1.64485363 + */ + diff --git a/src/boost/libs/math/example/policy_ref_snip12.cpp b/src/boost/libs/math/example/policy_ref_snip12.cpp new file mode 100644 index 00000000..e406ce56 --- /dev/null +++ b/src/boost/libs/math/example/policy_ref_snip12.cpp @@ -0,0 +1,55 @@ +// Copyright John Maddock 2007. +// Copyright Paul A. Bristow 2010 +// 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) + +// Note that this file contains quickbook mark-up as well as code +// and comments, don't change any of the special comment mark-ups! + +// Define tgamma function with a no overflow policy +// into a specific namespace-scope. + +#include +using std::cout; using std::endl; + +//[policy_ref_snip12 + +#include +//using boost::math::tgamma; +// Need not declare using boost::math::tgamma here, +// because will define tgamma in myspace using macro below. + +namespace myspace +{ + using namespace boost::math::policies; + + // Define a policy that does not throw on overflow: + typedef policy > my_policy; + + // Define the special functions in this scope to use the policy: + BOOST_MATH_DECLARE_SPECIAL_FUNCTIONS(my_policy) +} + +// Now we can use myspace::tgamma etc. +// They will automatically use "my_policy": +// +double t = myspace::tgamma(30.0); // Will *not* throw on overflow, +// despite the large value of factorial 30 = 265252859812191058636308480000000 +// unlike default policy boost::math::tgamma; + +//] + +int main() +{ + cout << "myspace::tgamma(30.0) = " << t << endl; +} + +/* + +Output: + +myspace::tgamma(30.0) = 8.84176e+030 + +*/ + diff --git a/src/boost/libs/math/example/policy_ref_snip13.cpp b/src/boost/libs/math/example/policy_ref_snip13.cpp new file mode 100644 index 00000000..ce4b0948 --- /dev/null +++ b/src/boost/libs/math/example/policy_ref_snip13.cpp @@ -0,0 +1,81 @@ +// Copyright John Maddock 2007. +// Copyright Paul A. Bristow 2010 +// 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) + +// Note that this file contains quickbook mark-up as well as code +// and comments, don't change any of the special comment mark-ups! + +#include +#ifdef _MSC_VER +# pragma warning (disable : 4189) // 'd' : local variable is initialized but not referenced +#endif +#ifdef BOOST_GCC +# pragma GCC diagnostic ignored "-Wunused-variable" +#endif + +#include +using std::cout; using std::endl; + +#include +using std::domain_error; + +//[policy_ref_snip13 + +#include + +namespace myspace +{ // using namespace boost::math::policies; // May be convenient in myspace. + + // Define a policy called my_policy to use. + using boost::math::policies::policy; + +// In this case we want all the distribution accessor functions to compile, +// even if they are mathematically undefined, so +// make the policy assert_undefined. + using boost::math::policies::assert_undefined; + +typedef policy > my_policy; + +// Finally apply this policy to type double. +BOOST_MATH_DECLARE_DISTRIBUTIONS(double, my_policy) +} // namespace myspace + +// Now we can use myspace::cauchy etc, which will use policy +// myspace::mypolicy: +// +// This compiles but throws a domain error exception at runtime. +// Caution! If you omit the try'n'catch blocks, +// it will just silently terminate, giving no clues as to why! +// So try'n'catch blocks are very strongly recommended. + +void test_cauchy() +{ + try + { + double d = mean(myspace::cauchy()); // Cauchy does not have a mean! + (void) d; + } + catch(const std::domain_error& e) + { + cout << e.what() << endl; + } +} + +//] //[/policy_ref_snip13] + +int main() +{ + test_cauchy(); +} + +/* + +Output: + +policy_snip_13.vcxproj -> J:\Cpp\MathToolkit\test\Math_test\Release\policy_snip_13.exe + Error in function boost::math::mean(cauchy&): The Cauchy distribution does not have a mean: the only possible return value is 1.#QNAN. + + */ + diff --git a/src/boost/libs/math/example/policy_ref_snip2.cpp b/src/boost/libs/math/example/policy_ref_snip2.cpp new file mode 100644 index 00000000..304250d4 --- /dev/null +++ b/src/boost/libs/math/example/policy_ref_snip2.cpp @@ -0,0 +1,47 @@ +// Copyright John Maddock 2007. +// Copyright Paul A. Bristow 2010 +// 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) + +// Note that this file contains quickbook mark-up as well as code +// and comments, don't change any of the special comment mark-ups! + +#include +using std::cout; using std::endl; + +//[policy_ref_snip2 + +#include +using boost::math::normal_distribution; + +using namespace boost::math::policies; + +// Define a specific policy: +typedef policy< + overflow_error + > my_policy; + +// Define the distribution, using my_policy: +typedef normal_distribution my_norm; + +// Construct a my_norm distribution, using default mean and standard deviation, +// and get a 0.05 or 5% quantile: +double q = quantile(my_norm(), 0.05); // = -1.64485 + +//] //[/policy_ref_snip2] + +int main() +{ + my_norm n; // Construct a my_norm distribution, + // using default mean zero and standard deviation unity. + double q = quantile(n, 0.05); // and get a quantile. + cout << "quantile(my_norm(), 0.05) = " << q << endl; +} + +/* + +Output: + + quantile(my_norm(), 0.05) = -1.64485 +*/ diff --git a/src/boost/libs/math/example/policy_ref_snip3.cpp b/src/boost/libs/math/example/policy_ref_snip3.cpp new file mode 100644 index 00000000..b3820ad3 --- /dev/null +++ b/src/boost/libs/math/example/policy_ref_snip3.cpp @@ -0,0 +1,40 @@ +// Copyright John Maddock 2007. +// Copyright Paul A. Bristow 2010 +// 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) + +// Note that this file contains quickbook mark-up as well as code +// and comments, don't change any of the special comment mark-ups! + +double some_value = 2.; + +//[policy_ref_snip3 + +#include + +using namespace boost::math::policies; +using boost::math::tgamma; + +// Define a new policy *not* internally promoting RealType to double: +typedef policy< + promote_double + > my_policy; + +// Call the function, applying the new policy: +double t1 = tgamma(some_value, my_policy()); + +// Alternatively we could use helper function make_policy, +// and concisely define everything at the call site: +double t2 = tgamma(some_value, make_policy(promote_double())); + +//] //[\policy_ref_snip3] + +#include +using std::cout; using std::endl; + +int main() +{ + cout << "tgamma(some_value, my_policy()) = " << t1 + << ", tgamma(some_value, make_policy(promote_double()) = " << t2 << endl; +} diff --git a/src/boost/libs/math/example/policy_ref_snip4.cpp b/src/boost/libs/math/example/policy_ref_snip4.cpp new file mode 100644 index 00000000..7df35be1 --- /dev/null +++ b/src/boost/libs/math/example/policy_ref_snip4.cpp @@ -0,0 +1,41 @@ +// Copyright John Maddock 2007. +// Copyright Paul A. Bristow 2010. +// 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) + +// Note that this file contains quickbook mark-up as well as code +// and comments, don't change any of the special comment mark-ups! + +#ifdef _MSC_VER +# pragma warning (disable : 4305) // 'initializing' : truncation from 'long double' to 'const eval_type' +# pragma warning (disable : 4244) // 'conversion' : truncation from 'long double' to 'const eval_type' +#endif + +//[policy_ref_snip4 + +#include +using boost::math::normal_distribution; + +using namespace boost::math::policies; + +// Define a policy: +typedef policy< + promote_float + > my_policy; + +// Define the new normal distribution using my_policy: +typedef normal_distribution my_norm; + +// Get a quantile: +float q = quantile(my_norm(), 0.05f); + +//] [policy_ref_snip4] + +#include +using std::cout; using std::endl; + +int main() +{ + cout << " quantile(my_norm(), 0.05f) = " << q << endl; // -1.64485 +} diff --git a/src/boost/libs/math/example/policy_ref_snip5.cpp b/src/boost/libs/math/example/policy_ref_snip5.cpp new file mode 100644 index 00000000..06f270af --- /dev/null +++ b/src/boost/libs/math/example/policy_ref_snip5.cpp @@ -0,0 +1,45 @@ +// Copyright John Maddock 2007. +// Copyright Paul A. Bristow 2010. +// 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) + +// Note that this file contains quickbook mark-up as well as code +// and comments, don't change any of the special comment mark-ups! + +//[policy_ref_snip5 + +#include +using boost::math::negative_binomial_distribution; + +using namespace boost::math::policies; + +typedef negative_binomial_distribution< + double, + policy > + > dist_type; + +// Lower 5% quantile: +double x = quantile(dist_type(20, 0.3), 0.05); +// Upper 95% quantile: +double y = quantile(complement(dist_type(20, 0.3), 0.05)); + +//] //[/policy_ref_snip5] + +#include +using std::cout; using std::endl; + +int main() +{ + cout << "quantile(dist_type(20, 0.3), 0.05) = " << x + << "\nquantile(complement(dist_type(20, 0.3), 0.05) = " << y << endl; +} + +/* + +Output: + quantile(dist_type(20, 0.3), 0.05) = 27.3898 + quantile(complement(dist_type(20, 0.3), 0.05) = 68.1584 + + */ + diff --git a/src/boost/libs/math/example/policy_ref_snip6.cpp b/src/boost/libs/math/example/policy_ref_snip6.cpp new file mode 100644 index 00000000..9dc20729 --- /dev/null +++ b/src/boost/libs/math/example/policy_ref_snip6.cpp @@ -0,0 +1,38 @@ +// Copyright John Maddock 2007. +// Copyright Paul A. Bristow 2010. +// 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) + +// Note that this file contains quickbook mark-up as well as code +// and comments, don't change any of the special comment mark-ups! + +//[policy_ref_snip6 + +#include +using boost::math::negative_binomial; + +// Use the default rounding policy integer_round_outwards. +// Lower quantile rounded down: +double x = quantile(negative_binomial(20, 0.3), 0.05); // rounded up 27 from 27.3898 +// Upper quantile rounded up: +double y = quantile(complement(negative_binomial(20, 0.3), 0.05)); // rounded down to 69 from 68.1584 + +//] //[/policy_ref_snip6] + +#include +using std::cout; using std::endl; + +int main() +{ + cout << "quantile(negative_binomial(20, 0.3), 0.05) = "<< x < > " << endl + << "quantile(dist_type(20, 0.3), 0.05) = " << x << endl + << "quantile(complement(dist_type(20, 0.3), 0.05)) = " << y << endl; +} + +/* + +Output: + using policy > + quantile(dist_type(20, 0.3), 0.05) = 28 + quantile(complement(dist_type(20, 0.3), 0.05)) = 68 + + +*/ + diff --git a/src/boost/libs/math/example/policy_ref_snip8.cpp b/src/boost/libs/math/example/policy_ref_snip8.cpp new file mode 100644 index 00000000..abc48b9a --- /dev/null +++ b/src/boost/libs/math/example/policy_ref_snip8.cpp @@ -0,0 +1,47 @@ +// Copyright John Maddock 2007. +// Copyright Paul A. Bristow 2010. +// 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) + +// Note that this file contains quickbook mark-up as well as code +// and comments, don't change any of the special comment mark-ups! + +//[policy_ref_snip8 + +#include +using boost::math::negative_binomial_distribution; + +using namespace boost::math::policies; + +typedef negative_binomial_distribution< + double, + policy > + > dist_type; + +// Lower quantile rounded (down) to nearest: +double x = quantile(dist_type(20, 0.3), 0.05); // 27 +// Upper quantile rounded (down) to nearest: +double y = quantile(complement(dist_type(20, 0.3), 0.05)); // 68 + +//] //[/policy_ref_snip8] + +#include +using std::cout; using std::endl; + +int main() +{ + cout << "using policy " << endl + << "quantile(dist_type(20, 0.3), 0.05) = " << x << endl + << "quantile(complement(dist_type(20, 0.3), 0.05)) " << y << endl; +} + +/* + +Output: + + using policy + quantile(dist_type(20, 0.3), 0.05) = 27 + quantile(complement(dist_type(20, 0.3), 0.05)) 68 + +*/ diff --git a/src/boost/libs/math/example/policy_ref_snip9.cpp b/src/boost/libs/math/example/policy_ref_snip9.cpp new file mode 100644 index 00000000..ed38d460 --- /dev/null +++ b/src/boost/libs/math/example/policy_ref_snip9.cpp @@ -0,0 +1,36 @@ +// Copyright John Maddock 2007. +// Copyright Paul A. Bristow 2010 + +// 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) + +// Note that this file contains quickbook mark-up as well as code +// and comments, don't change any of the special comment mark-ups! + +#include +using std::cout; using std::endl; + +//[policy_ref_snip9 + +#include +using boost::math::tgamma; +using boost::math::policies::policy; +using boost::math::policies::digits10; + +typedef policy > my_pol_5; // Define a new, non-default, policy +// to calculate tgamma to accuracy of approximately 5 decimal digits. +//] + +int main() +{ + cout.precision(5); // To only show 5 (hopefully) accurate decimal digits. + double t = tgamma(12, my_pol_5()); // Apply the 5 decimal digits accuracy policy to use of tgamma. + cout << "tgamma(12, my_pol_5() = " << t << endl; +} + +/* + +Output: + tgamma(12, my_pol_5() = 3.9917e+007 +*/ diff --git a/src/boost/libs/math/example/polynomial_arithmetic.cpp b/src/boost/libs/math/example/polynomial_arithmetic.cpp new file mode 100644 index 00000000..78efd06d --- /dev/null +++ b/src/boost/libs/math/example/polynomial_arithmetic.cpp @@ -0,0 +1,237 @@ +// 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) + +// Copyright Jeremy W. Murphy 2015. + +// This file is written to be included from a Quickbook .qbk document. +// It can be compiled by the C++ compiler, and run. Any output can +// also be added here as comment or included or pasted in elsewhere. +// Caution: this file contains Quickbook markup as well as code +// and comments: don't change any of the special comment markups! + +//[polynomial_arithmetic_0 +/*`First include the essential polynomial header (and others) to make the example: +*/ +#include +//] [polynomial_arithmetic_0 + +#include +#include +#include + +#include +#include +#include +#include +#include + +//[polynomial_arithmetic_1 +/*`and some using statements are convenient: +*/ + +using std::string; +using std::exception; +using std::cout; +using std::abs; +using std::pair; + +using namespace boost::math; +using namespace boost::math::tools; // for polynomial +using boost::lexical_cast; + +//] [/polynomial_arithmetic_1] + +template +string sign_str(T const &x) +{ + return x < 0 ? "-" : "+"; +} + +template +string inner_coefficient(T const &x) +{ + string result(" " + sign_str(x) + " "); + if (abs(x) != T(1)) + result += lexical_cast(abs(x)); + return result; +} + +/*! Output in formula format. +For example: from a polynomial in Boost container storage [ 10, -6, -4, 3 ] +show as human-friendly formula notation: 3x^3 - 4x^2 - 6x + 10. +*/ +template +string formula_format(polynomial const &a) +{ + string result; + if (a.size() == 0) + result += lexical_cast(T(0)); + else + { + // First one is a special case as it may need unary negate. + unsigned i = a.size() - 1; + if (a[i] < 0) + result += "-"; + if (abs(a[i]) != T(1)) + result += lexical_cast(abs(a[i])); + + if (i > 0) + { + result += "x"; + if (i > 1) + { + result += "^" + lexical_cast(i); + i--; + for (; i != 1; i--) + if (a[i]) + result += inner_coefficient(a[i]) + "x^" + lexical_cast(i); + + if (a[i]) + result += inner_coefficient(a[i]) + "x"; + } + i--; + + if (a[i]) + result += " " + sign_str(a[i]) + " " + lexical_cast(abs(a[i])); + } + } + return result; +} // string formula_format(polynomial const &a) + + +int main() +{ + cout << "Example: Polynomial arithmetic.\n\n"; + + try + { +//[polynomial_arithmetic_2 +/*`Store the coefficients in a convenient way to access them, +then create some polynomials using construction from an iterator range, +and finally output in a 'pretty' formula format. + +[tip Although we might conventionally write a polynomial from left to right +in descending order of degree, Boost.Math stores in [*ascending order of degree].] + + Read/write for humans: 3x^3 - 4x^2 - 6x + 10 + Boost polynomial storage: [ 10, -6, -4, 3 ] +*/ + boost::array const d3a = {{10, -6, -4, 3}}; + polynomial const a(d3a.begin(), d3a.end()); + + // With C++11 and later, you can also use initializer_list construction. + polynomial const b{{-2.0, 1.0}}; + + // formula_format() converts from Boost storage to human notation. + cout << "a = " << formula_format(a) + << "\nb = " << formula_format(b) << "\n\n"; + +//] [/polynomial_arithmetic_2] + +//[polynomial_arithmetic_3 + // Now we can do arithmetic with the usual infix operators: + - * / and %. + polynomial s = a + b; + cout << "a + b = " << formula_format(s) << "\n"; + polynomial d = a - b; + cout << "a - b = " << formula_format(d) << "\n"; + polynomial p = a * b; + cout << "a * b = " << formula_format(p) << "\n"; + polynomial q = a / b; + cout << "a / b = " << formula_format(q) << "\n"; + polynomial r = a % b; + cout << "a % b = " << formula_format(r) << "\n"; +//] [/polynomial_arithmetic_3] + +//[polynomial_arithmetic_4 +/*` +Division is a special case where you can calculate two for the price of one. + +Actually, quotient and remainder are always calculated together due to the nature +of the algorithm: the infix operators return one result and throw the other +away. + +If you are doing a lot of division and want both the quotient and remainder, then +you don't want to do twice the work necessary. + +In that case you can call the underlying function, [^quotient_remainder], +to get both results together as a pair. +*/ + pair< polynomial, polynomial > result; + result = quotient_remainder(a, b); +// Reassure ourselves that the result is the same. + BOOST_ASSERT(result.first == q); + BOOST_ASSERT(result.second == r); +//] [/polynomial_arithmetic_4] +//[polynomial_arithmetic_5 + /* +We can use the right and left shift operators to add and remove a factor of x. +This has the same semantics as left and right shift for integers where it is a +factor of 2. x is the smallest prime factor of a polynomial as is 2 for integers. +*/ + cout << "Right and left shift operators.\n"; + cout << "\n" << formula_format(p) << "\n"; + cout << "... right shift by 1 ...\n"; + p >>= 1; + cout << formula_format(p) << "\n"; + cout << "... left shift by 2 ...\n"; + p <<= 2; + cout << formula_format(p) << "\n"; + +/* +We can also give a meaning to odd and even for a polynomial that is consistent +with these operations: a polynomial is odd if it has a non-zero constant value, +even otherwise. That is: + x^2 + 1 odd + x^2 even + */ + cout << std::boolalpha; + cout << "\nPrint whether a polynomial is odd.\n"; + cout << formula_format(s) << " odd? " << odd(s) << "\n"; + // We cheekily use the internal details to subtract the constant, making it even. + s -= s.data().front(); + cout << formula_format(s) << " odd? " << odd(s) << "\n"; + // And of course you can check if it is even: + cout << formula_format(s) << " even? " << even(s) << "\n"; + + + //] [/polynomial_arithmetic_5] + //[polynomial_arithmetic_6] + /* For performance and convenience, we can test whether a polynomial is zero + * by implicitly converting to bool with the same semantics as int. */ + polynomial zero; // Default construction is 0. + cout << "zero: " << (zero ? "not zero" : "zero") << "\n"; + cout << "r: " << (r ? "not zero" : "zero") << "\n"; + /* We can also set a polynomial to zero without needing a another zero + * polynomial to assign to it. */ + r.set_zero(); + cout << "r: " << (r ? "not zero" : "zero") << "\n"; + //] [/polynomial_arithmetic_6] +} +catch (exception const &e) +{ + cout << "\nMessage from thrown exception was:\n " << e.what() << "\n"; +} +} // int main() + +/* +//[polynomial_output_1 + +a = 3x^3 - 4x^2 - 6x + 10 +b = x - 2 + +//] [/polynomial_output_1] + + +//[polynomial_output_2 + +a + b = 3x^3 - 4x^2 - 5x + 8 +a - b = 3x^3 - 4x^2 - 7x + 12 +a * b = 3x^4 - 10x^3 + 2x^2 + 22x - 20 +a / b = 3x^2 + 2x - 2 +a % b = 6 + +//] [/polynomial_output_2] + +*/ diff --git a/src/boost/libs/math/example/root_elliptic_finding.cpp b/src/boost/libs/math/example/root_elliptic_finding.cpp new file mode 100644 index 00000000..a1c81124 --- /dev/null +++ b/src/boost/libs/math/example/root_elliptic_finding.cpp @@ -0,0 +1,878 @@ +// Copyright Paul A. Bristow 2015 + +// 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) + +// Comparison of finding roots using TOMS748, Newton-Raphson, Halley & Schroder algorithms. +// root_n_finding_algorithms.cpp Generalised for nth root version. + +// http://en.wikipedia.org/wiki/Cube_root + +// Note that this file contains Quickbook mark-up as well as code +// and comments, don't change any of the special comment mark-ups! +// This program also writes files in Quickbook tables mark-up format. + +#include +#include +#include +#include +#include +#include +#include + +//using boost::math::policies::policy; +//using boost::math::tools::eps_tolerance; // Binary functor for specified number of bits. +//using boost::math::tools::bracket_and_solve_root; +//using boost::math::tools::toms748_solve; +//using boost::math::tools::halley_iterate; +//using boost::math::tools::newton_raphson_iterate; +//using boost::math::tools::schroder_iterate; + +#include // For float_distance. + +#include // is binary. +using boost::multiprecision::cpp_bin_float_100; +using boost::multiprecision::cpp_bin_float_50; + +#include +#include +#include + +// STL +#include +#include +#include +#include +#include +#include // std::ofstream +#include +#include // for type name using typid(thingy).name(); + +#ifdef __FILE__ + std::string sourcefilename = __FILE__; +#else + std::string sourcefilename(""); +#endif + + std::string chop_last(std::string s) + { + std::string::size_type pos = s.find_last_of("\\/"); + if(pos != std::string::npos) + s.erase(pos); + else if(s.empty()) + abort(); + else + s.erase(); + return s; + } + + std::string make_root() + { + std::string result; + if(sourcefilename.find_first_of(":") != std::string::npos) + { + result = chop_last(sourcefilename); // lose filename part + result = chop_last(result); // lose /example/ + result = chop_last(result); // lose /math/ + result = chop_last(result); // lose /libs/ + } + else + { + result = chop_last(sourcefilename); // lose filename part + if(result.empty()) + result = "."; + result += "/../../.."; + } + return result; + } + + std::string short_file_name(std::string s) + { + std::string::size_type pos = s.find_last_of("\\/"); + if(pos != std::string::npos) + s.erase(0, pos + 1); + return s; + } + + std::string boost_root = make_root(); + + +std::string fp_hardware; // Any hardware features like SEE or AVX + +const std::string roots_name = "libs/math/doc/roots/"; + +const std::string full_roots_name(boost_root + "/libs/math/doc/roots/"); + +const std::size_t nooftypes = 4; +const std::size_t noofalgos = 4; + +double digits_accuracy = 1.0; // 1 == maximum possible accuracy. + +std::stringstream ss; + +std::ofstream fout; + +std::vector algo_names = +{ + "TOMS748", "Newton", "Halley", "Schr'''ö'''der" +}; + +std::vector names = +{ + "float", "double", "long double", "cpp_bin_float50" +}; + +uintmax_t iters; // Global as value of iterations is not returned. + +struct root_info +{ // for a floating-point type, float, double ... + std::size_t max_digits10; // for type. + std::string full_typename; // for type from type_id.name(). + std::string short_typename; // for type "float", "double", "cpp_bin_float_50" .... + std::size_t bin_digits; // binary in floating-point type numeric_limits::digits; + int get_digits; // fraction of maximum possible accuracy required. + // = digits * digits_accuracy + // Vector of values (4) for each algorithm, TOMS748, Newton, Halley & Schroder. + //std::vector< boost::int_least64_t> times; converted to int. + std::vector times; // arbirary units (ticks). + //boost::int_least64_t min_time = std::numeric_limits::max(); // Used to normalize times (as int). + std::vector normed_times; + int min_time = (std::numeric_limits::max)(); // Used to normalize times. + std::vector iterations; + std::vector distances; + std::vector full_results; +}; // struct root_info + +std::vector root_infos; // One element for each floating-point type used. + +inline std::string build_test_name(const char* type_name, const char* test_name) +{ + std::string result(BOOST_COMPILER); + result += "|"; + result += BOOST_STDLIB; + result += "|"; + result += BOOST_PLATFORM; + result += "|"; + result += type_name; + result += "|"; + result += test_name; +#if defined(_DEBUG) || !defined(NDEBUG) + result += "|"; + result += " debug"; +#else + result += "|"; + result += " release"; +#endif + result += "|"; + return result; +} // std::string build_test_name + +// Algorithms ////////////////////////////////////////////// + +// No derivatives - using TOMS748 internally. +//[elliptic_noderv_func +template +struct elliptic_root_functor_noderiv +{ // Nth root of x using only function - no derivatives. + elliptic_root_functor_noderiv(T const& arc, T const& radius) : m_arc(arc), m_radius(radius) + { // Constructor just stores value a to find root of. + } + T operator()(T const& x) + { + using std::sqrt; + // return the difference between required arc-length, and the calculated arc-length for an + // ellipse with radii m_radius and x: + T a = (std::max)(m_radius, x); + T b = (std::min)(m_radius, x); + T k = sqrt(1 - b * b / (a * a)); + return 4 * a * boost::math::ellint_2(k) - m_arc; + } +private: + T m_arc; // length of arc. + T m_radius; // one of the two radii of the ellipse +}; // template struct elliptic_root_functor_noderiv +//] +//[elliptic_root_noderiv +template +T elliptic_root_noderiv(T radius, T arc) +{ // return the other radius of an ellipse, given one radii and the arc-length + using namespace std; // Help ADL of std functions. + using namespace boost::math::tools; // For bracket_and_solve_root. + + T guess = sqrt(arc * arc / 16 - radius * radius); + T factor = 1.2; // How big steps to take when searching. + + const boost::uintmax_t maxit = 50; // Limit to maximum iterations. + boost::uintmax_t it = maxit; // Initally our chosen max iterations, but updated with actual. + bool is_rising = true; // arc-length increases if one radii increases, so function is rising + // Define a termination condition, stop when nearly all digits are correct, but allow for + // the fact that we are returning a range, and must have some inaccuracy in the elliptic integral: + eps_tolerance tol(std::numeric_limits::digits - 2); + // Call bracket_and_solve_root to find the solution, note that this is a rising function: + std::pair r = bracket_and_solve_root(elliptic_root_functor_noderiv(arc, radius), guess, factor, is_rising, tol, it); + //<- + iters = it; + //-> + // Result is midway between the endpoints of the range: + return r.first + (r.second - r.first) / 2; +} // template T elliptic_root_noderiv(T x) +//] +// Using 1st derivative only Newton-Raphson +//[elliptic_1deriv_func +template +struct elliptic_root_functor_1deriv +{ // Functor also returning 1st derviative. + BOOST_STATIC_ASSERT_MSG(boost::is_integral::value == false, "Only floating-point type types can be used!"); + + elliptic_root_functor_1deriv(T const& arc, T const& radius) : m_arc(arc), m_radius(radius) + { // Constructor just stores value a to find root of. + } + std::pair operator()(T const& x) + { + using std::sqrt; + // Return the difference between required arc-length, and the calculated arc-length for an + // ellipse with radii m_radius and x, plus it's derivative. + // See http://www.wolframalpha.com/input/?i=d%2Fda+[4+*+a+*+EllipticE%281+-+b^2%2Fa^2%29] + // We require two elliptic integral calls, but from these we can calculate both + // the function and it's derivative: + T a = (std::max)(m_radius, x); + T b = (std::min)(m_radius, x); + T a2 = a * a; + T b2 = b * b; + T k = sqrt(1 - b2 / a2); + T Ek = boost::math::ellint_2(k); + T Kk = boost::math::ellint_1(k); + T fx = 4 * a * Ek - m_arc; + T dfx = 4 * (a2 * Ek - b2 * Kk) / (a2 - b2); + return std::make_pair(fx, dfx); + } +private: + T m_arc; // length of arc. + T m_radius; // one of the two radii of the ellipse +}; // struct elliptic_root__functor_1deriv +//] +//[elliptic_1deriv +template +T elliptic_root_1deriv(T radius, T arc) +{ + using namespace std; // Help ADL of std functions. + using namespace boost::math::tools; // For newton_raphson_iterate. + + BOOST_STATIC_ASSERT_MSG(boost::is_integral::value == false, "Only floating-point type types can be used!"); + + T guess = sqrt(arc * arc / 16 - radius * radius); + T min = 0; // Minimum possible value is zero. + T max = arc; // Maximum possible value is the arc length. + + // Accuracy doubles at each step, so stop when just over half of the digits are + // correct, and rely on that step to polish off the remainder: + int get_digits = static_cast(std::numeric_limits::digits * 0.6); + const boost::uintmax_t maxit = 20; + boost::uintmax_t it = maxit; + T result = newton_raphson_iterate(elliptic_root_functor_1deriv(arc, radius), guess, min, max, get_digits, it); + //<- + iters = it; + //-> + return result; +} // T elliptic_root_1_deriv Newton-Raphson +//] + +// Using 1st and 2nd derivatives with Halley algorithm. +//[elliptic_2deriv_func +template +struct elliptic_root_functor_2deriv +{ // Functor returning both 1st and 2nd derivatives. + BOOST_STATIC_ASSERT_MSG(boost::is_integral::value == false, "Only floating-point type types can be used!"); + + elliptic_root_functor_2deriv(T const& arc, T const& radius) : m_arc(arc), m_radius(radius) {} + std::tuple operator()(T const& x) + { + using std::sqrt; + // Return the difference between required arc-length, and the calculated arc-length for an + // ellipse with radii m_radius and x, plus it's derivative. + // See http://www.wolframalpha.com/input/?i=d^2%2Fda^2+[4+*+a+*+EllipticE%281+-+b^2%2Fa^2%29] + // for the second derivative. + T a = (std::max)(m_radius, x); + T b = (std::min)(m_radius, x); + T a2 = a * a; + T b2 = b * b; + T k = sqrt(1 - b2 / a2); + T Ek = boost::math::ellint_2(k); + T Kk = boost::math::ellint_1(k); + T fx = 4 * a * Ek - m_arc; + T dfx = 4 * (a2 * Ek - b2 * Kk) / (a2 - b2); + T dfx2 = 4 * b2 * ((a2 + b2) * Kk - 2 * a2 * Ek) / (a * (a2 - b2) * (a2 - b2)); + return std::make_tuple(fx, dfx, dfx2); + } +private: + T m_arc; // length of arc. + T m_radius; // one of the two radii of the ellipse +}; +//] +//[elliptic_2deriv +template +T elliptic_root_2deriv(T radius, T arc) +{ + using namespace std; // Help ADL of std functions. + using namespace boost::math::tools; // For halley_iterate. + + BOOST_STATIC_ASSERT_MSG(boost::is_integral::value == false, "Only floating-point type types can be used!"); + + T guess = sqrt(arc * arc / 16 - radius * radius); + T min = 0; // Minimum possible value is zero. + T max = arc; // radius can't be larger than the arc length. + + // Accuracy triples at each step, so stop when just over one-third of the digits + // are correct, and the last iteration will polish off the remaining digits: + int get_digits = static_cast(std::numeric_limits::digits * 0.4); + const boost::uintmax_t maxit = 20; + boost::uintmax_t it = maxit; + T result = halley_iterate(elliptic_root_functor_2deriv(arc, radius), guess, min, max, get_digits, it); + //<- + iters = it; + //-> + return result; +} // nth_2deriv Halley +//] +// Using 1st and 2nd derivatives using Schroder algorithm. + +template +T elliptic_root_2deriv_s(T arc, T radius) +{ // return nth root of x using 1st and 2nd derivatives and Schroder. + + using namespace std; // Help ADL of std functions. + using namespace boost::math::tools; // For schroder_iterate. + + BOOST_STATIC_ASSERT_MSG(boost::is_integral::value == false, "Only floating-point type types can be used!"); + + T guess = sqrt(arc * arc / 16 - radius * radius); + T min = 0; // Minimum possible value is zero. + T max = arc; // radius can't be larger than the arc length. + + int digits = std::numeric_limits::digits; // Maximum possible binary digits accuracy for type T. + int get_digits = static_cast(digits * digits_accuracy); + const boost::uintmax_t maxit = 20; + boost::uintmax_t it = maxit; + T result = schroder_iterate(elliptic_root_functor_2deriv(arc, radius), guess, min, max, get_digits, it); + iters = it; + + return result; +} // T elliptic_root_2deriv_s Schroder + +//////////////////////////////////////////////////////// end of algorithms - perhaps in a separate .hpp? + +//! Print 4 floating-point types info: max_digits10, digits and required accuracy digits as a Quickbook table. +int table_type_info(double digits_accuracy) +{ + std::string qbk_name = full_roots_name; // Prefix by boost_root file. + + qbk_name += "type_info_table"; + std::stringstream ss; + ss.precision(3); + ss << "_" << digits_accuracy * 100; + qbk_name += ss.str(); + +#ifdef _MSC_VER + qbk_name += "_msvc.qbk"; +#else // assume GCC + qbk_name += "_gcc.qbk"; +#endif + + // Example: type_info_table_100_msvc.qbk + fout.open(qbk_name, std::ios_base::out); + + if (fout.is_open()) + { + std::cout << "Output type table to " << qbk_name << std::endl; + } + else + { // Failed to open. + std::cout << " Open file " << qbk_name << " for output failed!" << std::endl; + std::cout << "errno " << errno << std::endl; + return errno; + } + + fout << + "[/" + << qbk_name + << "\n" + "Copyright 2015 Paul A. Bristow.""\n" + "Copyright 2015 John Maddock.""\n" + "Distributed under the Boost Software License, Version 1.0.""\n" + "(See accompanying file LICENSE_1_0.txt or copy at""\n" + "http://www.boost.org/LICENSE_1_0.txt).""\n" + "]""\n" + << std::endl; + + fout << "[h6 Fraction of maximum possible bits of accuracy required is " << digits_accuracy << ".]\n" << std::endl; + + std::string table_id("type_info"); + table_id += ss.str(); // Fraction digits accuracy. + +#ifdef _MSC_VER + table_id += "_msvc"; +#else // assume GCC + table_id += "_gcc"; +#endif + + fout << "[table:" << table_id << " Digits for float, double, long double and cpp_bin_float_50\n" + << "[[type name] [max_digits10] [binary digits] [required digits]]\n";// header. + + // For all fout types: + + fout << "[[" << "float" << "]" + << "[" << std::numeric_limits::max_digits10 << "]" // max_digits10 + << "[" << std::numeric_limits::digits << "]"// < "Binary digits + << "[" << static_cast(std::numeric_limits::digits * digits_accuracy) << "]]\n"; // Accuracy digits. + + fout << "[[" << "float" << "]" + << "[" << std::numeric_limits::max_digits10 << "]" // max_digits10 + << "[" << std::numeric_limits::digits << "]"// < "Binary digits + << "[" << static_cast(std::numeric_limits::digits * digits_accuracy) << "]]\n"; // Accuracy digits. + + fout << "[[" << "long double" << "]" + << "[" << std::numeric_limits::max_digits10 << "]" // max_digits10 + << "[" << std::numeric_limits::digits << "]"// < "Binary digits + << "[" << static_cast(std::numeric_limits::digits * digits_accuracy) << "]]\n"; // Accuracy digits. + + fout << "[[" << "cpp_bin_float_50" << "]" + << "[" << std::numeric_limits::max_digits10 << "]" // max_digits10 + << "[" << std::numeric_limits::digits << "]"// < "Binary digits + << "[" << static_cast(std::numeric_limits::digits * digits_accuracy) << "]]\n"; // Accuracy digits. + + fout << "] [/table table_id_msvc] \n" << std::endl; // End of table. + + fout.close(); + return 0; +} // type_table + +//! Evaluate root N timing for each algorithm, and for one floating-point type T. +template +int test_root(cpp_bin_float_100 big_radius, cpp_bin_float_100 big_arc, cpp_bin_float_100 answer, const char* type_name, std::size_t type_no) +{ + std::size_t max_digits = 2 + std::numeric_limits::digits * 3010 / 10000; + // For new versions use max_digits10 + // std::cout.precision(std::numeric_limits::max_digits10); + std::cout.precision(max_digits); + std::cout << std::showpoint << std::endl; // Show trailing zeros too. + + root_infos.push_back(root_info()); + + root_infos[type_no].max_digits10 = max_digits; + root_infos[type_no].full_typename = typeid(T).name(); // Full typename. + root_infos[type_no].short_typename = type_name; // Short typename. + root_infos[type_no].bin_digits = std::numeric_limits::digits; + root_infos[type_no].get_digits = static_cast(std::numeric_limits::digits * digits_accuracy); + + T radius = static_cast(big_radius); + T arc = static_cast(big_arc); + + T result; // root + T sum = 0; + T ans = static_cast(answer); + + using boost::timer::nanosecond_type; + using boost::timer::cpu_times; + using boost::timer::cpu_timer; + + long eval_count = boost::is_floating_point::value ? 1000000 : 10000; // To give a sufficiently stable timing for the fast built-in types, + // This takes an inconveniently long time for multiprecision cpp_bin_float_50 etc types. + + cpu_times now; // Holds wall, user and system times. + + { // Evaluate times etc for each algorithm. + //algorithm_names.push_back("TOMS748"); // + cpu_timer ti; // Can start, pause, resume and stop, and read elapsed. + ti.start(); + for(long i = eval_count; i >= 0; --i) + { + result = elliptic_root_noderiv(radius, arc); // + sum += result; + } + now = ti.elapsed(); + int time = static_cast(now.user / eval_count); + root_infos[type_no].times.push_back(time); // CPU time taken. + if (time < root_infos[type_no].min_time) + { + root_infos[type_no].min_time = time; + } + ti.stop(); + long int distance = static_cast(boost::math::float_distance(result, ans)); + root_infos[type_no].distances.push_back(distance); + root_infos[type_no].iterations.push_back(iters); // + root_infos[type_no].full_results.push_back(result); + } + { + // algorithm_names.push_back("Newton"); // algorithm + cpu_timer ti; // Can start, pause, resume and stop, and read elapsed. + ti.start(); + for(long i = eval_count; i >= 0; --i) + { + result = elliptic_root_1deriv(radius, arc); // + sum += result; + } + now = ti.elapsed(); + int time = static_cast(now.user / eval_count); + root_infos[type_no].times.push_back(time); // CPU time taken. + if (time < root_infos[type_no].min_time) + { + root_infos[type_no].min_time = time; + } + + ti.stop(); + long int distance = static_cast(boost::math::float_distance(result, ans)); + root_infos[type_no].distances.push_back(distance); + root_infos[type_no].iterations.push_back(iters); // + root_infos[type_no].full_results.push_back(result); + } + { + //algorithm_names.push_back("Halley"); // algorithm + cpu_timer ti; // Can start, pause, resume and stop, and read elapsed. + ti.start(); + for(long i = eval_count; i >= 0; --i) + { + result = elliptic_root_2deriv(radius, arc); // + sum += result; + } + now = ti.elapsed(); + int time = static_cast(now.user / eval_count); + root_infos[type_no].times.push_back(time); // CPU time taken. + ti.stop(); + if (time < root_infos[type_no].min_time) + { + root_infos[type_no].min_time = time; + } + long int distance = static_cast(boost::math::float_distance(result, ans)); + root_infos[type_no].distances.push_back(distance); + root_infos[type_no].iterations.push_back(iters); // + root_infos[type_no].full_results.push_back(result); + } + { + // algorithm_names.push_back("Schr'''ö'''der"); // algorithm + cpu_timer ti; // Can start, pause, resume and stop, and read elapsed. + ti.start(); + for(long i = eval_count; i >= 0; --i) + { + result = elliptic_root_2deriv_s(arc, radius); // + sum += result; + } + now = ti.elapsed(); + int time = static_cast(now.user / eval_count); + root_infos[type_no].times.push_back(time); // CPU time taken. + if (time < root_infos[type_no].min_time) + { + root_infos[type_no].min_time = time; + } + ti.stop(); + long int distance = static_cast(boost::math::float_distance(result, ans)); + root_infos[type_no].distances.push_back(distance); + root_infos[type_no].iterations.push_back(iters); // + root_infos[type_no].full_results.push_back(result); + } + for (size_t i = 0; i != root_infos[type_no].times.size(); i++) // For each time. + { // Normalize times. + root_infos[type_no].normed_times.push_back(static_cast(root_infos[type_no].times[i]) / root_infos[type_no].min_time); + } + + std::cout << "Accumulated result was: " << sum << std::endl; + + return 4; // eval_count of how many algorithms used. +} // test_root + +/*! Fill array of times, interations, etc for Nth root for all 4 types, + and write a table of results in Quickbook format. + */ +void table_root_info(cpp_bin_float_100 radius, cpp_bin_float_100 arc) +{ + using std::abs; + + std::cout << nooftypes << " floating-point types tested:" << std::endl; +#if defined(_DEBUG) || !defined(NDEBUG) + std::cout << "Compiled in debug mode." << std::endl; +#else + std::cout << "Compiled in optimise mode." << std::endl; +#endif + std::cout << "FP hardware " << fp_hardware << std::endl; + // Compute the 'right' answer for root N at 100 decimal digits. + cpp_bin_float_100 full_answer = elliptic_root_noderiv(radius, arc); + + root_infos.clear(); // Erase any previous data. + // Fill the elements of the array for each floating-point type. + + test_root(radius, arc, full_answer, "float", 0); + test_root(radius, arc, full_answer, "double", 1); + test_root(radius, arc, full_answer, "long double", 2); + test_root(radius, arc, full_answer, "cpp_bin_float_50", 3); + + // Use info from 4 floating point types to + + // Prepare Quickbook table for a single root + // with columns of times, iterations, distances repeated for various floating-point types, + // and 4 rows for each algorithm. + + std::stringstream table_info; + table_info.precision(3); + table_info << "[table:elliptic root with radius " << radius << " and arc length " << arc << ") for float, double, long double and cpp_bin_float_50 types"; + if (fp_hardware != "") + { + table_info << ", using " << fp_hardware; + } + table_info << std::endl; + + fout << table_info.str() + << "[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]\n" + << "[[Algo ]"; + for (size_t tp = 0; tp != nooftypes; tp++) + { // For all types: + fout << "[Its]" << "[Times]" << "[Norm]" << "[Dis]" << "[ ]"; + } + fout << "]" << std::endl; + + // Row for all algorithms. + for (std::size_t algo = 0; algo != noofalgos; algo++) + { + fout << "[[" << std::left << std::setw(9) << algo_names[algo] << "]"; + for (size_t tp = 0; tp != nooftypes; tp++) + { // For all types: + fout + << "[" << std::right << std::showpoint + << std::setw(3) << std::setprecision(2) << root_infos[tp].iterations[algo] << "][" + << std::setw(5) << std::setprecision(5) << root_infos[tp].times[algo] << "]["; + fout << std::setw(3) << std::setprecision(3); + double normed_time = root_infos[tp].normed_times[algo]; + if (abs(normed_time - 1.00) <= 0.05) + { // At or near the best time, so show as blue. + fout << "[role blue " << normed_time << "]"; + } + else if (abs(normed_time) > 4.) + { // markedly poor so show as red. + fout << "[role red " << normed_time << "]"; + } + else + { // Not the best, so normal black. + fout << normed_time; + } + fout << "][" + << std::setw(3) << std::setprecision(2) << root_infos[tp].distances[algo] << "][ ]"; + } // tp + fout << "]" << std::endl; + } // for algo + fout << "] [/end of table root]\n"; +} // void table_root_info + +/*! Output program header, table of type info, and tables for 4 algorithms and 4 floating-point types, + for Nth root required digits_accuracy. + */ + +int roots_tables(cpp_bin_float_100 radius, cpp_bin_float_100 arc, double digits_accuracy) +{ + ::digits_accuracy = digits_accuracy; + // Save globally so that it is available to root-finding algorithms. Ugly :-( + +#if defined(_DEBUG) || !defined(NDEBUG) + std::string debug_or_optimize("Compiled in debug mode."); +#else + std::string debug_or_optimize("Compiled in optimise mode."); +#endif + + // Create filename for roots_table + std::string qbk_name = full_roots_name; + qbk_name += "elliptic_table"; + + std::stringstream ss; + ss.precision(3); + // ss << "_" << N // now put all the tables in one .qbk file? + ss << "_" << digits_accuracy * 100 + << std::flush; + // Assume only save optimize mode runs, so don't add any _DEBUG info. + qbk_name += ss.str(); + +#ifdef _MSC_VER + qbk_name += "_msvc"; +#else // assume GCC + qbk_name += "_gcc"; +#endif + if (fp_hardware != "") + { + qbk_name += fp_hardware; + } + qbk_name += ".qbk"; + + fout.open(qbk_name, std::ios_base::out); + + if (fout.is_open()) + { + std::cout << "Output root table to " << qbk_name << std::endl; + } + else + { // Failed to open. + std::cout << " Open file " << qbk_name << " for output failed!" << std::endl; + std::cout << "errno " << errno << std::endl; + return errno; + } + + fout << + "[/" + << qbk_name + << "\n" + "Copyright 2015 Paul A. Bristow.""\n" + "Copyright 2015 John Maddock.""\n" + "Distributed under the Boost Software License, Version 1.0.""\n" + "(See accompanying file LICENSE_1_0.txt or copy at""\n" + "http://www.boost.org/LICENSE_1_0.txt).""\n" + "]""\n" + << std::endl; + + // Print out the program/compiler/stdlib/platform names as a Quickbook comment: + fout << "\n[h6 Program [@../../example/" << short_file_name(sourcefilename) << " " << short_file_name(sourcefilename) << "],\n " + << BOOST_COMPILER << ", " + << BOOST_STDLIB << ", " + << BOOST_PLATFORM << "\n" + << debug_or_optimize + << ((fp_hardware != "") ? ", " + fp_hardware : "") + << "]" // [h6 close]. + << std::endl; + + //fout << "Fraction of full accuracy " << digits_accuracy << std::endl; + + table_root_info(radius, arc); + + fout.close(); + + // table_type_info(digits_accuracy); + + return 0; +} // roots_tables + + +int main() +{ + using namespace boost::multiprecision; + using namespace boost::math; + + + try + { + std::cout << "Tests run with " << BOOST_COMPILER << ", " + << BOOST_STDLIB << ", " << BOOST_PLATFORM << ", "; + +// How to: Configure Visual C++ Projects to Target 64-Bit Platforms +// https://msdn.microsoft.com/en-us/library/9yb4317s.aspx + +#ifdef _M_X64 // Defined for compilations that target x64 processors. + std::cout << "X64 " << std::endl; + fp_hardware += "_X64"; +#else +# ifdef _M_IX86 + std::cout << "X32 " << std::endl; + fp_hardware += "_X86"; +# endif +#endif + +#ifdef _M_AMD64 + std::cout << "AMD64 " << std::endl; + // fp_hardware += "_AMD64"; +#endif + +// https://msdn.microsoft.com/en-us/library/7t5yh4fd.aspx +// /arch (x86) options /arch:[IA32|SSE|SSE2|AVX|AVX2] +// default is to use SSE and SSE2 instructions by default. +// https://msdn.microsoft.com/en-us/library/jj620901.aspx +// /arch (x64) options /arch:AVX and /arch:AVX2 + +// MSVC doesn't bother to set these SSE macros! +// http://stackoverflow.com/questions/18563978/sse-sse2-is-enabled-control-in-visual-studio +// https://msdn.microsoft.com/en-us/library/b0084kay.aspx predefined macros. + +// But some of these macros are *not* defined by MSVC, +// unlike AVX (but *are* defined by GCC and Clang). +// So the macro code above does define them. +#if (defined(_M_AMD64) || defined (_M_X64)) +# define _M_X64 +# define __SSE2__ +#else +# ifdef _M_IX86_FP // Expands to an integer literal value indicating which /arch compiler option was used: + std::cout << "Floating-point _M_IX86_FP = " << _M_IX86_FP << std::endl; +# if (_M_IX86_FP == 2) // 2 if /arch:SSE2, /arch:AVX or /arch:AVX2 +# define __SSE2__ // x32 +# elif (_M_IX86_FP == 1) // 1 if /arch:SSE was used. +# define __SSE__ // x32 +# elif (_M_IX86_FP == 0) // 0 if /arch:IA32 was used. +# define _X32 // No special FP instructions. +# endif +# endif +#endif +// Set the fp_hardware that is used in the .qbk filename. +#ifdef __AVX2__ + std::cout << "Floating-point AVX2 " << std::endl; + fp_hardware += "_AVX2"; +# else +# ifdef __AVX__ + std::cout << "Floating-point AVX " << std::endl; + fp_hardware += "_AVX"; +# else +# ifdef __SSE2__ + std::cout << "Floating-point SSE2 " << std::endl; + fp_hardware += "_SSE2"; +# else +# ifdef __SSE__ + std::cout << "Floating-point SSE " << std::endl; + fp_hardware += "_SSE"; +# endif +# endif +# endif +# endif + +#ifdef _M_IX86 + std::cout << "Floating-point X86 _M_IX86 = " << _M_IX86 << std::endl; + // https://msdn.microsoft.com/en-us/library/aa273918%28v=vs.60%29.aspx#_predir_table_1..3 + // 600 = Pentium Pro +#endif + +#ifdef _MSC_FULL_VER + std::cout << "Floating-point _MSC_FULL_VER " << _MSC_FULL_VER << std::endl; +#endif + +#ifdef __MSVC_RUNTIME_CHECKS + std::cout << "Runtime __MSVC_RUNTIME_CHECKS " << std::endl; +#endif + + BOOST_MATH_CONTROL_FP; + + cpp_bin_float_100 radius("28."); + cpp_bin_float_100 arc("300."); + // Compute full answer to more than precision of tests. + //T value = 28.; // integer (exactly representable as floating-point) + // whose cube root is *not* exactly representable. + // Wolfram Alpha command N[28 ^ (1 / 3), 100] computes cube root to 100 decimal digits. + // 3.036588971875662519420809578505669635581453977248111123242141654169177268411884961770250390838097895 + + std::cout.precision(100); + std::cout << "radius 1" << radius << std::endl; + std::cout << "arc length" << arc << std::endl; + // std::cout << ",\n""answer = " << full_answer << std::endl; + std::cout.precision(6); + // cbrt cpp_bin_float_100 full_answer("3.036588971875662519420809578505669635581453977248111123242141654169177268411884961770250390838097895"); + + // Output the table of types, maxdigits10 and digits and required digits for some accuracies. + + // Output tables for some roots at full accuracy. + roots_tables(radius, arc, 1.); + + // Output tables for some roots at less accuracy. + //roots_tables(full_value, 0.75); + + return boost::exit_success; + } + catch (std::exception const& ex) + { + std::cout << "exception thrown: " << ex.what() << std::endl; + return boost::exit_failure; + } +} // int main() + +/* + +*/ diff --git a/src/boost/libs/math/example/root_finding_algorithms.cpp b/src/boost/libs/math/example/root_finding_algorithms.cpp new file mode 100644 index 00000000..89a8a014 --- /dev/null +++ b/src/boost/libs/math/example/root_finding_algorithms.cpp @@ -0,0 +1,907 @@ +// Copyright Paul A. Bristow 2015 + +// 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) + +// Comparison of finding roots using TOMS748, Newton-Raphson, Schroder & Halley algorithms. + +// Note that this file contains Quickbook mark-up as well as code +// and comments, don't change any of the special comment mark-ups! + +// root_finding_algorithms.cpp + +#include +#include +#include +#include +#include + +#include "table_type.hpp" +// Copy of i:\modular-boost\libs\math\test\table_type.hpp +// #include "handle_test_result.hpp" +// Copy of i:\modular - boost\libs\math\test\handle_test_result.hpp + +#include +//using boost::math::policies::policy; +//using boost::math::tools::newton_raphson_iterate; +//using boost::math::tools::halley_iterate; // +//using boost::math::tools::eps_tolerance; // Binary functor for specified number of bits. +//using boost::math::tools::bracket_and_solve_root; +//using boost::math::tools::toms748_solve; +//using boost::math::tools::schroder_iterate; + +#include // For float_distance. +#include // for tuple and make_tuple. +#include // For boost::math::cbrt. + +#include // is binary. +//#include // is decimal. +using boost::multiprecision::cpp_bin_float_100; +using boost::multiprecision::cpp_bin_float_50; + +#include +#include +#include +#include + +// STL +#include +#include +#include +#include +#include +#include // std::ofstream +#include +#include // for type name using typid(thingy).name(); + +#ifndef BOOST_ROOT +# define BOOST_ROOT i:/modular-boost/ +#endif +// Need to find this + +#ifdef __FILE__ +std::string sourcefilename = __FILE__; +#endif + +std::string chop_last(std::string s) +{ + std::string::size_type pos = s.find_last_of("\\/"); + if(pos != std::string::npos) + s.erase(pos); + else if(s.empty()) + abort(); + else + s.erase(); + return s; +} + +std::string make_root() +{ + std::string result; + if(sourcefilename.find_first_of(":") != std::string::npos) + { + result = chop_last(sourcefilename); // lose filename part + result = chop_last(result); // lose /example/ + result = chop_last(result); // lose /math/ + result = chop_last(result); // lose /libs/ + } + else + { + result = chop_last(sourcefilename); // lose filename part + if(result.empty()) + result = "."; + result += "/../../.."; + } + return result; +} + +std::string short_file_name(std::string s) +{ + std::string::size_type pos = s.find_last_of("\\/"); + if(pos != std::string::npos) + s.erase(0, pos + 1); + return s; +} + +std::string boost_root = make_root(); + +#ifdef _MSC_VER + std::string filename = boost_root.append("/libs/math/doc/roots/root_comparison_tables_msvc.qbk"); +#else // assume GCC + std::string filename = boost_root.append("/libs/math/doc/roots/root_comparison_tables_gcc.qbk"); +#endif + +std::ofstream fout (filename.c_str(), std::ios_base::out); + +//std::array float_type_names = +//{ +// "float", "double", "long double", "cpp_bin_128", "cpp_dec_50", "cpp_dec_100" +//}; + +std::vector algo_names = +{ + "cbrt", "TOMS748", "Newton", "Halley", "Schr'''ö'''der" +}; + +std::vector max_digits10s; +std::vector typenames; // Full computer generated type name. +std::vector names; // short name. + +uintmax_t iters; // Global as iterations is not returned by rooting function. + +const int count = 1000000; // Number of iterations to average. + +struct root_info +{ // for a floating-point type, float, double ... + std::size_t max_digits10; // for type. + std::string full_typename; // for type from type_id.name(). + std::string short_typename; // for type "float", "double", "cpp_bin_float_50" .... + + std::size_t bin_digits; // binary in floating-point type numeric_limits::digits; + int get_digits; // fraction of maximum possible accuracy required. + // = digits * digits_accuracy + // Vector of values for each algorithm, std::cbrt, boost::math::cbrt, TOMS748, Newton, Halley. + //std::vector< boost::int_least64_t> times; converted to int. + std::vector times; + //boost::int_least64_t min_time = std::numeric_limits::max(); // Used to normalize times (as int). + std::vector normed_times; + boost::int_least64_t min_time = (std::numeric_limits::max)(); // Used to normalize times. + std::vector iterations; + std::vector distances; + std::vector full_results; +}; // struct root_info + +std::vector root_infos; // One element for each type used. + +int type_no = -1; // float = 0, double = 1, ... indexing root_infos. + +inline std::string build_test_name(const char* type_name, const char* test_name) +{ + std::string result(BOOST_COMPILER); + result += "|"; + result += BOOST_STDLIB; + result += "|"; + result += BOOST_PLATFORM; + result += "|"; + result += type_name; + result += "|"; + result += test_name; +#if defined(_DEBUG ) || !defined(NDEBUG) + result += "|"; + result += " debug"; +#else + result += "|"; + result += " release"; +#endif + result += "|"; + return result; +} + +// No derivatives - using TOMS748 internally. +template +struct cbrt_functor_noderiv +{ // cube root of x using only function - no derivatives. + cbrt_functor_noderiv(T const& to_find_root_of) : a(to_find_root_of) + { // Constructor just stores value a to find root of. + } + T operator()(T const& x) + { + T fx = x*x*x - a; // Difference (estimate x^3 - a). + return fx; + } +private: + T a; // to be 'cube_rooted'. +}; // template struct cbrt_functor_noderiv + +template +T cbrt_noderiv(T x) +{ // return cube root of x using bracket_and_solve (using NO derivatives). + using namespace std; // Help ADL of std functions. + using namespace boost::math::tools; // For bracket_and_solve_root. + + // Maybe guess should be double, or use enable_if to avoid warning about conversion double to float here? + T guess; + if (boost::is_fundamental::value) + { + int exponent; + frexp(x, &exponent); // Get exponent of z (ignore mantissa). + guess = ldexp((T)1., exponent / 3); // Rough guess is to divide the exponent by three. + } + else + { // (boost::is_class) + double dx = static_cast(x); + guess = boost::math::cbrt(dx); // Get guess using double. + } + + T factor = 2; // How big steps to take when searching. + + const boost::uintmax_t maxit = 50; // Limit to maximum iterations. + boost::uintmax_t it = maxit; // Initally our chosen max iterations, but updated with actual. + bool is_rising = true; // So if result if guess^3 is too low, then try increasing guess. + // Some fraction of digits is used to control how accurate to try to make the result. + int get_digits = static_cast(std::numeric_limits::digits - 2); + + eps_tolerance tol(get_digits); // Set the tolerance. + std::pair r = + bracket_and_solve_root(cbrt_functor_noderiv(x), guess, factor, is_rising, tol, it); + iters = it; + T result = r.first + (r.second - r.first) / 2; // Midway between brackets. + return result; +} // template T cbrt_noderiv(T x) + + +// Using 1st derivative only Newton-Raphson + +template +struct cbrt_functor_deriv +{ // Functor also returning 1st derviative. + cbrt_functor_deriv(T const& to_find_root_of) : a(to_find_root_of) + { // Constructor stores value a to find root of, + // for example: calling cbrt_functor_deriv(x) to use to get cube root of x. + } + std::pair operator()(T const& x) + { // Return both f(x) and f'(x). + T fx = x*x*x - a; // Difference (estimate x^3 - value). + T dx = 3 * x*x; // 1st derivative = 3x^2. + return std::make_pair(fx, dx); // 'return' both fx and dx. + } +private: + T a; // to be 'cube_rooted'. +}; + +template +T cbrt_deriv(T x) +{ // return cube root of x using 1st derivative and Newton_Raphson. + using namespace boost::math::tools; + int exponent; + T guess; + if(boost::is_fundamental::value) + { + frexp(x, &exponent); // Get exponent of z (ignore mantissa). + guess = ldexp(static_cast(1), exponent / 3); // Rough guess is to divide the exponent by three. + } + else + guess = boost::math::cbrt(static_cast(x)); + T min = guess / 2; // Minimum possible value is half our guess. + T max = 2 * guess; // Maximum possible value is twice our guess. + int get_digits = static_cast(std::numeric_limits::digits * 0.6); + const boost::uintmax_t maxit = 20; + boost::uintmax_t it = maxit; + T result = newton_raphson_iterate(cbrt_functor_deriv(x), guess, min, max, get_digits, it); + iters = it; + return result; +} + +// Using 1st and 2nd derivatives with Halley algorithm. + +template +struct cbrt_functor_2deriv +{ // Functor returning both 1st and 2nd derivatives. + cbrt_functor_2deriv(T const& to_find_root_of) : a(to_find_root_of) + { // Constructor stores value a to find root of, for example: + // calling cbrt_functor_2deriv(x) to get cube root of x, + } + std::tuple operator()(T const& x) + { // Return both f(x) and f'(x) and f''(x). + T fx = x*x*x - a; // Difference (estimate x^3 - value). + T dx = 3 * x*x; // 1st derivative = 3x^2. + T d2x = 6 * x; // 2nd derivative = 6x. + return std::make_tuple(fx, dx, d2x); // 'return' fx, dx and d2x. + } +private: + T a; // to be 'cube_rooted'. +}; + +template +T cbrt_2deriv(T x) +{ // return cube root of x using 1st and 2nd derivatives and Halley. + //using namespace std; // Help ADL of std functions. + using namespace boost::math::tools; + int exponent; + T guess; + if(boost::is_fundamental::value) + { + frexp(x, &exponent); // Get exponent of z (ignore mantissa). + guess = ldexp(static_cast(1), exponent / 3); // Rough guess is to divide the exponent by three. + } + else + guess = boost::math::cbrt(static_cast(x)); + T min = guess / 2; // Minimum possible value is half our guess. + T max = 2 * guess; // Maximum possible value is twice our guess. + // digits used to control how accurate to try to make the result. + int get_digits = static_cast(std::numeric_limits::digits * 0.4); + boost::uintmax_t maxit = 20; + boost::uintmax_t it = maxit; + T result = halley_iterate(cbrt_functor_2deriv(x), guess, min, max, get_digits, it); + iters = it; + return result; +} + +// Using 1st and 2nd derivatives using Schroder algorithm. + +template +T cbrt_2deriv_s(T x) +{ // return cube root of x using 1st and 2nd derivatives and Schroder algorithm. + //using namespace std; // Help ADL of std functions. + using namespace boost::math::tools; + int exponent; + T guess; + if(boost::is_fundamental::value) + { + frexp(x, &exponent); // Get exponent of z (ignore mantissa). + guess = ldexp(static_cast(1), exponent / 3); // Rough guess is to divide the exponent by three. + } + else + guess = boost::math::cbrt(static_cast(x)); + T min = guess / 2; // Minimum possible value is half our guess. + T max = 2 * guess; // Maximum possible value is twice our guess. + // digits used to control how accurate to try to make the result. + int get_digits = static_cast(std::numeric_limits::digits * 0.4); + const boost::uintmax_t maxit = 20; + boost::uintmax_t it = maxit; + T result = schroder_iterate(cbrt_functor_2deriv(x), guess, min, max, get_digits, it); + iters = it; + return result; +} // template T cbrt_2deriv_s(T x) + + + +template +int test_root(cpp_bin_float_100 big_value, cpp_bin_float_100 answer, const char* type_name) +{ + //T value = 28.; // integer (exactly representable as floating-point) + // whose cube root is *not* exactly representable. + // Wolfram Alpha command N[28 ^ (1 / 3), 100] computes cube root to 100 decimal digits. + // 3.036588971875662519420809578505669635581453977248111123242141654169177268411884961770250390838097895 + + std::size_t max_digits = 2 + std::numeric_limits::digits * 3010 / 10000; + // For new versions use max_digits10 + // std::cout.precision(std::numeric_limits::max_digits10); + std::cout.precision(max_digits); + std::cout << std::showpoint << std::endl; // Trailing zeros too. + + root_infos.push_back(root_info()); + type_no++; // Another type. + + root_infos[type_no].max_digits10 = max_digits; + root_infos[type_no].full_typename = typeid(T).name(); // Full typename. + root_infos[type_no].short_typename = type_name; // Short typename. + + root_infos[type_no].bin_digits = std::numeric_limits::digits; + + root_infos[type_no].get_digits = std::numeric_limits::digits; + + T to_root = static_cast(big_value); + T result; // root + T ans = static_cast(answer); + int algo = 0; // Count of algorithms used. + + using boost::timer::nanosecond_type; + using boost::timer::cpu_times; + using boost::timer::cpu_timer; + + cpu_times now; // Holds wall, user and system times. + T sum = 0; + + // std::cbrt is much the fastest, but not useful for this comparison because it only handles fundamental types. + // Using enable_if allows us to avoid a compile fail with multiprecision types, but still distorts the results too much. + + //{ + // algorithm_names.push_back("std::cbrt"); + // cpu_timer ti; // Can start, pause, resume and stop, and read elapsed. + // ti.start(); + // for (long i = 0; i < count; ++i) + // { + // stdcbrt(big_value); + // } + // now = ti.elapsed(); + // int time = static_cast(now.user / count); + // root_infos[type_no].times.push_back(time); // CPU time taken per root. + // if (time < root_infos[type_no].min_time) + // { + // root_infos[type_no].min_time = time; + // } + // ti.stop(); + // long int distance = static_cast(boost::math::float_distance(result, ans)); + // root_infos[type_no].distances.push_back(distance); + // root_infos[type_no].iterations.push_back(0); // Not known. + // root_infos[type_no].full_results.push_back(result); + // algo++; + //} + //{ + // //algorithm_names.push_back("boost::math::cbrt"); // . + // cpu_timer ti; // Can start, pause, resume and stop, and read elapsed. + // ti.start(); + // for (long i = 0; i < count; ++i) + // { + // result = boost::math::cbrt(to_root); // + // } + // now = ti.elapsed(); + // int time = static_cast(now.user / count); + // root_infos[type_no].times.push_back(time); // CPU time taken. + // ti.stop(); + // if (time < root_infos[type_no].min_time) + // { + // root_infos[type_no].min_time = time; + // } + // long int distance = static_cast(boost::math::float_distance(result, ans)); + // root_infos[type_no].distances.push_back(distance); + // root_infos[type_no].iterations.push_back(0); // Iterations not knowable. + // root_infos[type_no].full_results.push_back(result); + //} + + + + { + //algorithm_names.push_back("boost::math::cbrt"); // . + result = 0; + cpu_timer ti; // Can start, pause, resume and stop, and read elapsed. + ti.start(); + for (long i = 0; i < count; ++i) + { + result = boost::math::cbrt(to_root); // + sum += result; + } + now = ti.elapsed(); + + long time = static_cast(now.user/1000); // convert nanoseconds to microseconds (assuming this is resolution). + root_infos[type_no].times.push_back(time); // CPU time taken. + ti.stop(); + if (time < root_infos[type_no].min_time) + { + root_infos[type_no].min_time = time; + } + long int distance = static_cast(boost::math::float_distance(result, ans)); + root_infos[type_no].distances.push_back(distance); + root_infos[type_no].iterations.push_back(0); // Iterations not knowable. + root_infos[type_no].full_results.push_back(result); + } + { + //algorithm_names.push_back("TOMS748"); // + cpu_timer ti; // Can start, pause, resume and stop, and read elapsed. + ti.start(); + for (long i = 0; i < count; ++i) + { + result = cbrt_noderiv(to_root); // + sum += result; + } + now = ti.elapsed(); +// int time = static_cast(now.user / count); + long time = static_cast(now.user/1000); + root_infos[type_no].times.push_back(time); // CPU time taken. + if (time < root_infos[type_no].min_time) + { + root_infos[type_no].min_time = time; + } + ti.stop(); + long int distance = static_cast(boost::math::float_distance(result, ans)); + root_infos[type_no].distances.push_back(distance); + root_infos[type_no].iterations.push_back(iters); // + root_infos[type_no].full_results.push_back(result); + } + { + // algorithm_names.push_back("Newton"); // algorithm + cpu_timer ti; // Can start, pause, resume and stop, and read elapsed. + ti.start(); + for (long i = 0; i < count; ++i) + { + result = cbrt_deriv(to_root); // + sum += result; + } + now = ti.elapsed(); +// int time = static_cast(now.user / count); + long time = static_cast(now.user/1000); + root_infos[type_no].times.push_back(time); // CPU time taken. + if (time < root_infos[type_no].min_time) + { + root_infos[type_no].min_time = time; + } + + ti.stop(); + long int distance = static_cast(boost::math::float_distance(result, ans)); + root_infos[type_no].distances.push_back(distance); + root_infos[type_no].iterations.push_back(iters); // + root_infos[type_no].full_results.push_back(result); + } + { + //algorithm_names.push_back("Halley"); // algorithm + cpu_timer ti; // Can start, pause, resume and stop, and read elapsed. + ti.start(); + for (long i = 0; i < count; ++i) + { + result = cbrt_2deriv(to_root); // + sum += result; + } + now = ti.elapsed(); +// int time = static_cast(now.user / count); + long time = static_cast(now.user/1000); + root_infos[type_no].times.push_back(time); // CPU time taken. + ti.stop(); + if (time < root_infos[type_no].min_time) + { + root_infos[type_no].min_time = time; + } + long int distance = static_cast(boost::math::float_distance(result, ans)); + root_infos[type_no].distances.push_back(distance); + root_infos[type_no].iterations.push_back(iters); // + root_infos[type_no].full_results.push_back(result); + } + + { + // algorithm_names.push_back("Shroeder"); // algorithm + cpu_timer ti; // Can start, pause, resume and stop, and read elapsed. + ti.start(); + for (long i = 0; i < count; ++i) + { + result = cbrt_2deriv_s(to_root); // + sum += result; + } + now = ti.elapsed(); +// int time = static_cast(now.user / count); + long time = static_cast(now.user/1000); + root_infos[type_no].times.push_back(time); // CPU time taken. + if (time < root_infos[type_no].min_time) + { + root_infos[type_no].min_time = time; + } + ti.stop(); + long int distance = static_cast(boost::math::float_distance(result, ans)); + root_infos[type_no].distances.push_back(distance); + root_infos[type_no].iterations.push_back(iters); // + root_infos[type_no].full_results.push_back(result); + } + for (size_t i = 0; i != root_infos[type_no].times.size(); i++) + { // Normalize times. + double normed_time = static_cast(root_infos[type_no].times[i]); + normed_time /= root_infos[type_no].min_time; + root_infos[type_no].normed_times.push_back(normed_time); + } + algo++; + std::cout << "Accumulated sum was " << sum << std::endl; + return algo; // Count of how many algorithms used. +} // test_root + +void table_root_info(cpp_bin_float_100 full_value, cpp_bin_float_100 full_answer) +{ + // Fill the elements. + test_root(full_value, full_answer, "float"); + test_root(full_value, full_answer, "double"); + test_root(full_value, full_answer, "long double"); + test_root(full_value, full_answer, "cpp_bin_float_50"); + //test_root(full_value, full_answer, "cpp_bin_float_100"); + + std::cout << root_infos.size() << " floating-point types tested:" << std::endl; +#ifndef NDEBUG + std::cout << "Compiled in debug mode." << std::endl; +#else + std::cout << "Compiled in optimise mode." << std::endl; +#endif + + + for (size_t tp = 0; tp != root_infos.size(); tp++) + { // For all types: + + std::cout << std::endl; + + std::cout << "Floating-point type = " << root_infos[tp].short_typename << std::endl; + std::cout << "Floating-point type = " << root_infos[tp].full_typename << std::endl; + std::cout << "Max_digits10 = " << root_infos[tp].max_digits10 << std::endl; + std::cout << "Binary digits = " << root_infos[tp].bin_digits << std::endl; + std::cout << "Accuracy digits = " << root_infos[tp].get_digits - 2 << ", " << static_cast(root_infos[tp].get_digits * 0.6) << ", " << static_cast(root_infos[tp].get_digits * 0.4) << std::endl; + std::cout << "min_time = " << root_infos[tp].min_time << std::endl; + + std::cout << std::setprecision(root_infos[tp].max_digits10 ) << "Roots = "; + std::copy(root_infos[tp].full_results.begin(), root_infos[tp].full_results.end(), std::ostream_iterator(std::cout, " ")); + std::cout << std::endl; + + // Header row. + std::cout << "Algorithm " << "Iterations " << "Times " << "Norm_times " << "Distance" << std::endl; + + // Row for all algorithms. + for (unsigned algo = 0; algo != algo_names.size(); algo++) + { + std::cout + << std::left << std::setw(20) << algo_names[algo] << " " + << std::setw(8) << std::setprecision(2) << root_infos[tp].iterations[algo] << " " + << std::setw(8) << std::setprecision(5) << root_infos[tp].times[algo] << " " + << std::setw(8) << std::setprecision(3) << root_infos[tp].normed_times[algo] << " " + << std::setw(8) << std::setprecision(2) << root_infos[tp].distances[algo] + << std::endl; + } // for algo + } // for tp + + // Print info as Quickbook table. +#if 0 + fout << "[table:cbrt_5 Info for float, double, long double and cpp_bin_float_50\n" + << "[[type name] [max_digits10] [binary digits] [required digits]]\n";// header. + + for (size_t tp = 0; tp != root_infos.size(); tp++) + { // For all types: + fout << "[" + << "[" << root_infos[tp].short_typename << "]" + << "[" << root_infos[tp].max_digits10 << "]" // max_digits10 + << "[" << root_infos[tp].bin_digits << "]"// < "Binary digits + << "[" << root_infos[tp].get_digits << "]]\n"; // Accuracy digits. + } // tp + fout << "] [/table cbrt_5] \n" << std::endl; +#endif + // Prepare Quickbook table of floating-point types. + fout << "[table:cbrt_4 Cube root(28) for float, double, long double and cpp_bin_float_50\n" + << "[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]\n" + << "[[Algorithm]"; + for (size_t tp = 0; tp != root_infos.size(); tp++) + { // For all types: + fout << "[Its]" << "[Times]" << "[Norm]" << "[Dis]" << "[ ]"; + } + fout << "]" << std::endl; + + // Row for all algorithms. + for (size_t algo = 0; algo != algo_names.size(); algo++) + { + fout << "[[" << std::left << std::setw(9) << algo_names[algo] << "]"; + for (size_t tp = 0; tp != root_infos.size(); tp++) + { // For all types: + + fout + << "[" << std::right << std::showpoint + << std::setw(3) << std::setprecision(2) << root_infos[tp].iterations[algo] << "][" + << std::setw(5) << std::setprecision(5) << root_infos[tp].times[algo] << "]["; + if(fabs(root_infos[tp].normed_times[algo]) <= 1.05) + fout << "[role blue " << std::setw(3) << std::setprecision(2) << root_infos[tp].normed_times[algo] << "]"; + else if(fabs(root_infos[tp].normed_times[algo]) > 4) + fout << "[role red " << std::setw(3) << std::setprecision(2) << root_infos[tp].normed_times[algo] << "]"; + else + fout << std::setw(3) << std::setprecision(2) << root_infos[tp].normed_times[algo]; + fout + << "][" + << std::setw(3) << std::setprecision(2) << root_infos[tp].distances[algo] << "][ ]"; + } // tp + fout <<"]" << std::endl; + } // for algo + fout << "] [/end of table cbrt_4]\n"; +} // void table_root_info + +int main() +{ + using namespace boost::multiprecision; + using namespace boost::math; + + try + { + std::cout << "Tests run with " << BOOST_COMPILER << ", " + << BOOST_STDLIB << ", " << BOOST_PLATFORM << ", "; + + if (fout.is_open()) + { + std::cout << "\nOutput to " << filename << std::endl; + } + else + { // Failed to open. + std::cout << " Open file " << filename << " for output failed!" << std::endl; + std::cout << "error" << errno << std::endl; + return boost::exit_failure; + } + + fout << + "[/""\n" + "Copyright 2015 Paul A. Bristow.""\n" + "Copyright 2015 John Maddock.""\n" + "Distributed under the Boost Software License, Version 1.0.""\n" + "(See accompanying file LICENSE_1_0.txt or copy at""\n" + "http://www.boost.org/LICENSE_1_0.txt).""\n" + "]""\n" + << std::endl; + std::string debug_or_optimize; +#ifdef _DEBUG +#if (_DEBUG == 0) + debug_or_optimize = "Compiled in debug mode."; +#else + debug_or_optimize = "Compiled in optimise mode."; +#endif +#endif + + // Print out the program/compiler/stdlib/platform names as a Quickbook comment: + fout << "\n[h5 Program " << short_file_name(sourcefilename) << ", " + << BOOST_COMPILER << ", " + << BOOST_STDLIB << ", " + << BOOST_PLATFORM << (sizeof(void*) == 8 ? ", x64" : ", x86") + << debug_or_optimize << "[br]" + << count << " evaluations of each of " << algo_names.size() << " root_finding algorithms." + << "]" + << std::endl; + + std::cout << count << " evaluations of root_finding." << std::endl; + + BOOST_MATH_CONTROL_FP; + + cpp_bin_float_100 full_value("28"); + + cpp_bin_float_100 full_answer ("3.036588971875662519420809578505669635581453977248111123242141654169177268411884961770250390838097895"); + + std::copy(max_digits10s.begin(), max_digits10s.end(), std::ostream_iterator(std::cout, " ")); + std::cout << std::endl; + + table_root_info(full_value, full_answer); + + + return boost::exit_success; + } + catch (std::exception const& ex) + { + std::cout << "exception thrown: " << ex.what() << std::endl; + return boost::exit_failure; + } +} // int main() + +/* +debug + +1> float, maxdigits10 = 9 +1> 6 algorithms used. +1> Digits required = 24.0000000 +1> find root of 28.0000000, expected answer = 3.03658897 +1> Times 156 312 18750 4375 3437 3906 +1> Iterations: 0 0 8 6 4 5 +1> Distance: 0 0 -1 0 0 0 +1> Roots: 3.03658891 3.03658891 3.03658915 3.03658891 3.03658891 3.03658891 + +release + +1> float, maxdigits10 = 9 +1> 6 algorithms used. +1> Digits required = 24.0000000 +1> find root of 28.0000000, expected answer = 3.03658897 +1> Times 0 312 6875 937 937 937 +1> Iterations: 0 0 8 6 4 5 +1> Distance: 0 0 -1 0 0 0 +1> Roots: 3.03658891 3.03658891 3.03658915 3.03658891 3.03658891 3.03658891 + + +1> +1> 5 algorithms used: +1> 10 algorithms used: +1> boost::math::cbrt TOMS748 Newton Halley Shroeder boost::math::cbrt TOMS748 Newton Halley Shroeder +1> 2 types compared. +1> Precision of full type = 102 decimal digits +1> Find root of 28.000000000000000, +1> Expected answer = 3.0365889718756625 +1> typeid(T).name()float, maxdigits10 = 9 +1> find root of 28.0000000, expected answer = 3.03658897 +1> +1> Iterations: 0 8 6 4 5 +1> Times 468 8437 4375 3593 4062 +1> Min Time 468 +1> Normalized Times 1.00 18.0 9.35 7.68 8.68 +1> Distance: 0 -1 0 0 0 +1> Roots: 3.03658891 3.03658915 3.03658891 3.03658891 3.03658891 +1> ================================================================== +1> typeid(T).name()double, maxdigits10 = 17 +1> find root of 28.000000000000000, expected answer = 3.0365889718756625 +1> +1> Iterations: 0 11 7 5 6 +1> Times 312 15000 4531 3906 4375 +1> Min Time 312 +1> Normalized Times 1.00 48.1 14.5 12.5 14.0 +1> Distance: 1 2 0 0 0 +1> Roots: 3.0365889718756622 3.0365889718756618 3.0365889718756627 3.0365889718756627 3.0365889718756627 +1> ================================================================== + + +Release + +1> 5 algorithms used: +1> 10 algorithms used: +1> boost::math::cbrt TOMS748 Newton Halley Shroeder boost::math::cbrt TOMS748 Newton Halley Shroeder +1> 2 types compared. +1> Precision of full type = 102 decimal digits +1> Find root of 28.000000000000000, +1> Expected answer = 3.0365889718756625 +1> typeid(T).name()float, maxdigits10 = 9 +1> find root of 28.0000000, expected answer = 3.03658897 +1> +1> Iterations: 0 8 6 4 5 +1> Times 312 781 937 937 937 +1> Min Time 312 +1> Normalized Times 1.00 2.50 3.00 3.00 3.00 +1> Distance: 0 -1 0 0 0 +1> Roots: 3.03658891 3.03658915 3.03658891 3.03658891 3.03658891 +1> ================================================================== +1> typeid(T).name()double, maxdigits10 = 17 +1> find root of 28.000000000000000, expected answer = 3.0365889718756625 +1> +1> Iterations: 0 11 7 5 6 +1> Times 312 1093 937 937 937 +1> Min Time 312 +1> Normalized Times 1.00 3.50 3.00 3.00 3.00 +1> Distance: 1 2 0 0 0 +1> Roots: 3.0365889718756622 3.0365889718756618 3.0365889718756627 3.0365889718756627 3.0365889718756627 +1> ================================================================== + + + +1> 5 algorithms used: +1> 15 algorithms used: +1> boost::math::cbrt TOMS748 Newton Halley Shroeder boost::math::cbrt TOMS748 Newton Halley Shroeder boost::math::cbrt TOMS748 Newton Halley Shroeder +1> 3 types compared. +1> Precision of full type = 102 decimal digits +1> Find root of 28.00000000000000000000000000000000000000000000000000, +1> Expected answer = 3.036588971875662519420809578505669635581453977248111 +1> typeid(T).name()float, maxdigits10 = 9 +1> find root of 28.0000000, expected answer = 3.03658897 +1> +1> Iterations: 0 8 6 4 5 +1> Times 156 781 937 1093 937 +1> Min Time 156 +1> Normalized Times 1.00 5.01 6.01 7.01 6.01 +1> Distance: 0 -1 0 0 0 +1> Roots: 3.03658891 3.03658915 3.03658891 3.03658891 3.03658891 +1> ================================================================== +1> typeid(T).name()double, maxdigits10 = 17 +1> find root of 28.000000000000000, expected answer = 3.0365889718756625 +1> +1> Iterations: 0 11 7 5 6 +1> Times 312 1093 937 937 937 +1> Min Time 312 +1> Normalized Times 1.00 3.50 3.00 3.00 3.00 +1> Distance: 1 2 0 0 0 +1> Roots: 3.0365889718756622 3.0365889718756618 3.0365889718756627 3.0365889718756627 3.0365889718756627 +1> ================================================================== +1> typeid(T).name()class boost::multiprecision::number,0>, maxdigits10 = 52 +1> find root of 28.00000000000000000000000000000000000000000000000000, expected answer = 3.036588971875662519420809578505669635581453977248111 +1> +1> Iterations: 0 13 9 6 7 +1> Times 8750 177343 30312 52968 58125 +1> Min Time 8750 +1> Normalized Times 1.00 20.3 3.46 6.05 6.64 +1> Distance: 0 0 -1 0 0 +1> Roots: 3.036588971875662519420809578505669635581453977248106 3.036588971875662519420809578505669635581453977248106 3.036588971875662519420809578505669635581453977248117 3.036588971875662519420809578505669635581453977248106 3.036588971875662519420809578505669635581453977248106 +1> ================================================================== + +Reduce accuracy required to 0.5 + +1> 5 algorithms used: +1> 15 algorithms used: +1> boost::math::cbrt TOMS748 Newton Halley Shroeder +1> 3 floating_point types compared. +1> Precision of full type = 102 decimal digits +1> Find root of 28.00000000000000000000000000000000000000000000000000, +1> Expected answer = 3.036588971875662519420809578505669635581453977248111 +1> typeid(T).name() = float, maxdigits10 = 9 +1> Digits accuracy fraction required = 0.500000000 +1> find root of 28.0000000, expected answer = 3.03658897 +1> +1> Iterations: 0 8 5 3 4 +1> Times 156 5937 1406 1250 1250 +1> Min Time 156 +1> Normalized Times 1.0 38. 9.0 8.0 8.0 +1> Distance: 0 -1 0 0 0 +1> Roots: 3.03658891 3.03658915 3.03658891 3.03658891 3.03658891 +1> ================================================================== +1> typeid(T).name() = double, maxdigits10 = 17 +1> Digits accuracy fraction required = 0.50000000000000000 +1> find root of 28.000000000000000, expected answer = 3.0365889718756625 +1> +1> Iterations: 0 8 6 4 5 +1> Times 156 6250 1406 1406 1250 +1> Min Time 156 +1> Normalized Times 1.0 40. 9.0 9.0 8.0 +1> Distance: 1 3695766 0 0 0 +1> Roots: 3.0365889718756622 3.0365889702344129 3.0365889718756627 3.0365889718756627 3.0365889718756627 +1> ================================================================== +1> typeid(T).name() = class boost::multiprecision::number,0>, maxdigits10 = 52 +1> Digits accuracy fraction required = 0.5000000000000000000000000000000000000000000000000000 +1> find root of 28.00000000000000000000000000000000000000000000000000, expected answer = 3.036588971875662519420809578505669635581453977248111 +1> +1> Iterations: 0 11 8 5 6 +1> Times 11562 239843 34843 47500 47812 +1> Min Time 11562 +1> Normalized Times 1.0 21. 3.0 4.1 4.1 +1> Distance: 0 0 -1 0 0 +1> Roots: 3.036588971875662519420809578505669635581453977248106 3.036588971875662519420809578505669635581453977248106 3.036588971875662519420809578505669635581453977248117 3.036588971875662519420809578505669635581453977248106 3.036588971875662519420809578505669635581453977248106 +1> ================================================================== + + + +*/ diff --git a/src/boost/libs/math/example/root_finding_example.cpp b/src/boost/libs/math/example/root_finding_example.cpp new file mode 100644 index 00000000..9cbfd237 --- /dev/null +++ b/src/boost/libs/math/example/root_finding_example.cpp @@ -0,0 +1,547 @@ +// root_finding_example.cpp + +// Copyright Paul A. Bristow 2010, 2015 + +// 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) + +// Example of finding roots using Newton-Raphson, Halley. + +// Note that this file contains Quickbook mark-up as well as code +// and comments, don't change any of the special comment mark-ups! + +//#define BOOST_MATH_INSTRUMENT + +/* +This example demonstrates how to use the various tools for root finding +taking the simple cube root function (`cbrt`) as an example. + +It shows how use of derivatives can improve the speed. +(But is only a demonstration and does not try to make the ultimate improvements of 'real-life' +implementation of `boost::math::cbrt`, mainly by using a better computed initial 'guess' +at ``). + +Then we show how a higher root (fifth) can be computed, +and in `root_finding_n_example.cpp` a generic method +for the ['n]th root that constructs the derivatives at compile-time, + +These methods should be applicable to other functions that can be differentiated easily. + +First some `#includes` that will be needed. + +[tip For clarity, `using` statements are provided to list what functions are being used in this example: +you can of course partly or fully qualify the names in other ways. +(For your application, you may wish to extract some parts into header files, +but you should never use `using` statements globally in header files).] +*/ + +//[root_finding_include_1 + +#include +//using boost::math::policies::policy; +//using boost::math::tools::newton_raphson_iterate; +//using boost::math::tools::halley_iterate; // +//using boost::math::tools::eps_tolerance; // Binary functor for specified number of bits. +//using boost::math::tools::bracket_and_solve_root; +//using boost::math::tools::toms748_solve; + +#include // For float_distance. +#include // for std::tuple and std::make_tuple. +#include // For boost::math::cbrt. + +//] [/root_finding_include_1] + +// using boost::math::tuple; +// using boost::math::make_tuple; +// using boost::math::tie; +// which provide convenient aliases for various implementations, +// including std::tr1, depending on what is available. + +#include +//using std::cout; using std::endl; +#include +//using std::setw; using std::setprecision; +#include +//using std::numeric_limits; + +/* + +Let's suppose we want to find the root of a number ['a], and to start, compute the cube root. + +So the equation we want to solve is: + +__spaces ['f](x) = x[cubed] - a + +We will first solve this without using any information +about the slope or curvature of the cube root function. + +We then show how adding what we can know about this function, first just the slope, +the 1st derivation /f'(x)/, will speed homing in on the solution. + +Lastly we show how adding the curvature /f''(x)/ too will speed convergence even more. + +*/ + +//[root_finding_noderiv_1 + +template +struct cbrt_functor_noderiv +{ + // cube root of x using only function - no derivatives. + cbrt_functor_noderiv(T const& to_find_root_of) : a(to_find_root_of) + { /* Constructor just stores value a to find root of. */ } + T operator()(T const& x) + { + T fx = x*x*x - a; // Difference (estimate x^3 - a). + return fx; + } +private: + T a; // to be 'cube_rooted'. +}; +//] [/root_finding_noderiv_1 + +/* +Implementing the cube root function itself is fairly trivial now: +the hardest part is finding a good approximation to begin with. +In this case we'll just divide the exponent by three. +(There are better but more complex guess algorithms used in 'real-life'.) + +Cube root function is 'Really Well Behaved' in that it is monotonic +and has only one root (we leave negative values 'as an exercise for the student'). +*/ + +//[root_finding_noderiv_2 + +template +T cbrt_noderiv(T x) +{ + // return cube root of x using bracket_and_solve (no derivatives). + using namespace std; // Help ADL of std functions. + using namespace boost::math::tools; // For bracket_and_solve_root. + + int exponent; + frexp(x, &exponent); // Get exponent of z (ignore mantissa). + T guess = ldexp(1., exponent/3); // Rough guess is to divide the exponent by three. + T factor = 2; // How big steps to take when searching. + + const boost::uintmax_t maxit = 20; // Limit to maximum iterations. + boost::uintmax_t it = maxit; // Initally our chosen max iterations, but updated with actual. + bool is_rising = true; // So if result if guess^3 is too low, then try increasing guess. + int digits = std::numeric_limits::digits; // Maximum possible binary digits accuracy for type T. + // Some fraction of digits is used to control how accurate to try to make the result. + int get_digits = digits - 3; // We have to have a non-zero interval at each step, so + // maximum accuracy is digits - 1. But we also have to + // allow for inaccuracy in f(x), otherwise the last few + // iterations just thrash around. + eps_tolerance tol(get_digits); // Set the tolerance. + std::pair r = bracket_and_solve_root(cbrt_functor_noderiv(x), guess, factor, is_rising, tol, it); + return r.first + (r.second - r.first)/2; // Midway between brackets is our result, if necessary we could + // return the result as an interval here. +} + +/*` + +[note The final parameter specifying a maximum number of iterations is optional. +However, it defaults to `boost::uintmax_t maxit = (std::numeric_limits::max)();` +which is `18446744073709551615` and is more than anyone would wish to wait for! + +So it may be wise to chose some reasonable estimate of how many iterations may be needed, +In this case the function is so well behaved that we can chose a low value of 20. + +Internally when Boost.Math uses these functions, it sets the maximum iterations to +`policies::get_max_root_iterations();`.] + +Should we have wished we can show how many iterations were used in `bracket_and_solve_root` +(this information is lost outside `cbrt_noderiv`), for example with: + + if (it >= maxit) + { + std::cout << "Unable to locate solution in " << maxit << " iterations:" + " Current best guess is between " << r.first << " and " << r.second << std::endl; + } + else + { + std::cout << "Converged after " << it << " (from maximum of " << maxit << " iterations)." << std::endl; + } + +for output like + + Converged after 11 (from maximum of 20 iterations). +*/ +//] [/root_finding_noderiv_2] + + +// Cube root with 1st derivative (slope) + +/* +We now solve the same problem, but using more information about the function, +to show how this can speed up finding the best estimate of the root. + +For the root function, the 1st differential (the slope of the tangent to a curve at any point) is known. + +If you need some reminders then +[@http://en.wikipedia.org/wiki/Derivative#Derivatives_of_elementary_functions Derivatives of elementary functions] +may help. + +Using the rule that the derivative of ['x[super n]] for positive n (actually all nonzero n) is ['n x[super n-1]], +allows us to get the 1st differential as ['3x[super 2]]. + +To see how this extra information is used to find a root, view +[@http://en.wikipedia.org/wiki/Newton%27s_method Newton-Raphson iterations] +and the [@http://en.wikipedia.org/wiki/Newton%27s_method#mediaviewer/File:NewtonIteration_Ani.gif animation]. + +We need to define a different functor `cbrt_functor_deriv` that returns +both the evaluation of the function to solve, along with its first derivative: + +To \'return\' two values, we use a `std::pair` of floating-point values +(though we could equally have used a std::tuple): +*/ + +//[root_finding_1_deriv_1 + +template +struct cbrt_functor_deriv +{ // Functor also returning 1st derivative. + cbrt_functor_deriv(T const& to_find_root_of) : a(to_find_root_of) + { // Constructor stores value a to find root of, + // for example: calling cbrt_functor_deriv(a) to use to get cube root of a. + } + std::pair operator()(T const& x) + { + // Return both f(x) and f'(x). + T fx = x*x*x - a; // Difference (estimate x^3 - value). + T dx = 3 * x*x; // 1st derivative = 3x^2. + return std::make_pair(fx, dx); // 'return' both fx and dx. + } +private: + T a; // Store value to be 'cube_rooted'. +}; + +/*`Our cube root function is now:*/ + +template +T cbrt_deriv(T x) +{ + // return cube root of x using 1st derivative and Newton_Raphson. + using namespace boost::math::tools; + int exponent; + frexp(x, &exponent); // Get exponent of z (ignore mantissa). + T guess = ldexp(1., exponent/3); // Rough guess is to divide the exponent by three. + T min = ldexp(0.5, exponent/3); // Minimum possible value is half our guess. + T max = ldexp(2., exponent/3); // Maximum possible value is twice our guess. + const int digits = std::numeric_limits::digits; // Maximum possible binary digits accuracy for type T. + int get_digits = static_cast(digits * 0.6); // Accuracy doubles with each step, so stop when we have + // just over half the digits correct. + const boost::uintmax_t maxit = 20; + boost::uintmax_t it = maxit; + T result = newton_raphson_iterate(cbrt_functor_deriv(x), guess, min, max, get_digits, it); + return result; +} + +//] [/root_finding_1_deriv_1] + + +/* +[h3:cbrt_2_derivatives Cube root with 1st & 2nd derivative (slope & curvature)] + +Finally we define yet another functor `cbrt_functor_2deriv` that returns +both the evaluation of the function to solve, +along with its first *and second* derivatives: + +__spaces[''f](x) = 6x + +To \'return\' three values, we use a `tuple` of three floating-point values: +*/ + +//[root_finding_2deriv_1 + +template +struct cbrt_functor_2deriv +{ + // Functor returning both 1st and 2nd derivatives. + cbrt_functor_2deriv(T const& to_find_root_of) : a(to_find_root_of) + { // Constructor stores value a to find root of, for example: + // calling cbrt_functor_2deriv(x) to get cube root of x, + } + std::tuple operator()(T const& x) + { + // Return both f(x) and f'(x) and f''(x). + T fx = x*x*x - a; // Difference (estimate x^3 - value). + T dx = 3 * x*x; // 1st derivative = 3x^2. + T d2x = 6 * x; // 2nd derivative = 6x. + return std::make_tuple(fx, dx, d2x); // 'return' fx, dx and d2x. + } +private: + T a; // to be 'cube_rooted'. +}; + +/*`Our cube root function is now:*/ + +template +T cbrt_2deriv(T x) +{ + // return cube root of x using 1st and 2nd derivatives and Halley. + //using namespace std; // Help ADL of std functions. + using namespace boost::math::tools; + int exponent; + frexp(x, &exponent); // Get exponent of z (ignore mantissa). + T guess = ldexp(1., exponent/3); // Rough guess is to divide the exponent by three. + T min = ldexp(0.5, exponent/3); // Minimum possible value is half our guess. + T max = ldexp(2., exponent/3); // Maximum possible value is twice our guess. + const int digits = std::numeric_limits::digits; // Maximum possible binary digits accuracy for type T. + // digits used to control how accurate to try to make the result. + int get_digits = static_cast(digits * 0.4); // Accuracy triples with each step, so stop when just + // over one third of the digits are correct. + boost::uintmax_t maxit = 20; + T result = halley_iterate(cbrt_functor_2deriv(x), guess, min, max, get_digits, maxit); + return result; +} + +//] [/root_finding_2deriv_1] + +//[root_finding_2deriv_lambda + +template +T cbrt_2deriv_lambda(T x) +{ + // return cube root of x using 1st and 2nd derivatives and Halley. + //using namespace std; // Help ADL of std functions. + using namespace boost::math::tools; + int exponent; + frexp(x, &exponent); // Get exponent of z (ignore mantissa). + T guess = ldexp(1., exponent / 3); // Rough guess is to divide the exponent by three. + T min = ldexp(0.5, exponent / 3); // Minimum possible value is half our guess. + T max = ldexp(2., exponent / 3); // Maximum possible value is twice our guess. + const int digits = std::numeric_limits::digits; // Maximum possible binary digits accuracy for type T. + // digits used to control how accurate to try to make the result. + int get_digits = static_cast(digits * 0.4); // Accuracy triples with each step, so stop when just + // over one third of the digits are correct. + boost::uintmax_t maxit = 20; + T result = halley_iterate( + // lambda function: + [x](const T& g){ return std::make_tuple(g * g * g - x, 3 * g * g, 6 * g); }, + guess, min, max, get_digits, maxit); + return result; +} + +//] [/root_finding_2deriv_lambda] +/* + +[h3 Fifth-root function] +Let's now suppose we want to find the [*fifth root] of a number ['a]. + +The equation we want to solve is : + +__spaces['f](x) = x[super 5] - a + +If your differentiation is a little rusty +(or you are faced with an equation whose complexity is daunting), +then you can get help, for example from the invaluable +[@http://www.wolframalpha.com/ WolframAlpha site.] + +For example, entering the commmand: `differentiate x ^ 5` + +or the Wolfram Language command: ` D[x ^ 5, x]` + +gives the output: `d/dx(x ^ 5) = 5 x ^ 4` + +and to get the second differential, enter: `second differentiate x ^ 5` + +or the Wolfram Language command: `D[x ^ 5, { x, 2 }]` + +to get the output: `d ^ 2 / dx ^ 2(x ^ 5) = 20 x ^ 3` + +To get a reference value, we can enter: [^fifth root 3126] + +or: `N[3126 ^ (1 / 5), 50]` + +to get a result with a precision of 50 decimal digits: + +5.0003199590478625588206333405631053401128722314376 + +(We could also get a reference value using Boost.Multiprecision - see below). + +The 1st and 2nd derivatives of x[super 5] are: + +__spaces['f]\'(x) = 5x[super 4] + +__spaces['f]\'\'(x) = 20x[super 3] + +*/ + +//[root_finding_fifth_1 +//] [/root_finding_fifth_1] + + +//[root_finding_fifth_functor_2deriv + +/*`Using these expressions for the derivatives, the functor is: +*/ + +template +struct fifth_functor_2deriv +{ + // Functor returning both 1st and 2nd derivatives. + fifth_functor_2deriv(T const& to_find_root_of) : a(to_find_root_of) + { /* Constructor stores value a to find root of, for example: */ } + + std::tuple operator()(T const& x) + { + // Return both f(x) and f'(x) and f''(x). + T fx = boost::math::pow<5>(x) - a; // Difference (estimate x^3 - value). + T dx = 5 * boost::math::pow<4>(x); // 1st derivative = 5x^4. + T d2x = 20 * boost::math::pow<3>(x); // 2nd derivative = 20 x^3 + return std::make_tuple(fx, dx, d2x); // 'return' fx, dx and d2x. + } +private: + T a; // to be 'fifth_rooted'. +}; // struct fifth_functor_2deriv + +//] [/root_finding_fifth_functor_2deriv] + +//[root_finding_fifth_2deriv + +/*`Our fifth-root function is now: +*/ + +template +T fifth_2deriv(T x) +{ + // return fifth root of x using 1st and 2nd derivatives and Halley. + using namespace std; // Help ADL of std functions. + using namespace boost::math::tools; // for halley_iterate. + + int exponent; + frexp(x, &exponent); // Get exponent of z (ignore mantissa). + T guess = ldexp(1., exponent / 5); // Rough guess is to divide the exponent by five. + T min = ldexp(0.5, exponent / 5); // Minimum possible value is half our guess. + T max = ldexp(2., exponent / 5); // Maximum possible value is twice our guess. + // Stop when slightly more than one of the digits are correct: + const int digits = static_cast(std::numeric_limits::digits * 0.4); + const boost::uintmax_t maxit = 50; + boost::uintmax_t it = maxit; + T result = halley_iterate(fifth_functor_2deriv(x), guess, min, max, digits, it); + return result; +} + +//] [/root_finding_fifth_2deriv] + + +int main() +{ + std::cout << "Root finding Examples." << std::endl; + std::cout.precision(std::numeric_limits::max_digits10); + // Show all possibly significant decimal digits for double. + // std::cout.precision(std::numeric_limits::digits10); + // Show all guaranteed significant decimal digits for double. + + +//[root_finding_main_1 + try + { + double threecubed = 27.; // Value that has an *exactly representable* integer cube root. + double threecubedp1 = 28.; // Value whose cube root is *not* exactly representable. + + std::cout << "cbrt(28) " << boost::math::cbrt(28.) << std::endl; // boost::math:: version of cbrt. + std::cout << "std::cbrt(28) " << std::cbrt(28.) << std::endl; // std:: version of cbrt. + std::cout <<" cast double " << static_cast(3.0365889718756625194208095785056696355814539772481111) << std::endl; + + // Cube root using bracketing: + double r = cbrt_noderiv(threecubed); + std::cout << "cbrt_noderiv(" << threecubed << ") = " << r << std::endl; + r = cbrt_noderiv(threecubedp1); + std::cout << "cbrt_noderiv(" << threecubedp1 << ") = " << r << std::endl; +//] [/root_finding_main_1] + //[root_finding_main_2 + + // Cube root using 1st differential Newton-Raphson: + r = cbrt_deriv(threecubed); + std::cout << "cbrt_deriv(" << threecubed << ") = " << r << std::endl; + r = cbrt_deriv(threecubedp1); + std::cout << "cbrt_deriv(" << threecubedp1 << ") = " << r << std::endl; + + // Cube root using Halley with 1st and 2nd differentials. + r = cbrt_2deriv(threecubed); + std::cout << "cbrt_2deriv(" << threecubed << ") = " << r << std::endl; + r = cbrt_2deriv(threecubedp1); + std::cout << "cbrt_2deriv(" << threecubedp1 << ") = " << r << std::endl; + + // Cube root using lambda's: + r = cbrt_2deriv_lambda(threecubed); + std::cout << "cbrt_2deriv(" << threecubed << ") = " << r << std::endl; + r = cbrt_2deriv_lambda(threecubedp1); + std::cout << "cbrt_2deriv(" << threecubedp1 << ") = " << r << std::endl; + + // Fifth root. + + double fivepowfive = 3125; // Example of a value that has an exact integer fifth root. + // Exact value of fifth root is exactly 5. + std::cout << "Fifth root of " << fivepowfive << " is " << 5 << std::endl; + + double fivepowfivep1 = fivepowfive + 1; // Example of a value whose fifth root is *not* exactly representable. + // Value of fifth root is 5.0003199590478625588206333405631053401128722314376 (50 decimal digits precision) + // and to std::numeric_limits::max_digits10 double precision (usually 17) is + + double root5v2 = static_cast(5.0003199590478625588206333405631053401128722314376); + std::cout << "Fifth root of " << fivepowfivep1 << " is " << root5v2 << std::endl; + + // Using Halley with 1st and 2nd differentials. + r = fifth_2deriv(fivepowfive); + std::cout << "fifth_2deriv(" << fivepowfive << ") = " << r << std::endl; + r = fifth_2deriv(fivepowfivep1); + std::cout << "fifth_2deriv(" << fivepowfivep1 << ") = " << r << std::endl; +//] [/root_finding_main_?] + } + catch(const std::exception& e) + { // Always useful to include try & catch blocks because default policies + // are to throw exceptions on arguments that cause errors like underflow, overflow. + // Lacking try & catch blocks, the program will abort without a message below, + // which may give some helpful clues as to the cause of the exception. + std::cout << + "\n""Message from thrown exception was:\n " << e.what() << std::endl; + } + return 0; +} // int main() + +//[root_finding_example_output +/*` +Normal output is: + +[pre + root_finding_example.cpp + Generating code + Finished generating code + root_finding_example.vcxproj -> J:\Cpp\MathToolkit\test\Math_test\Release\root_finding_example.exe + Cube Root finding (cbrt) Example. + Iterations 10 + cbrt_1(27) = 3 + Iterations 10 + Unable to locate solution in chosen iterations: Current best guess is between 3.0365889718756613 and 3.0365889718756627 + cbrt_1(28) = 3.0365889718756618 + cbrt_1(27) = 3 + cbrt_2(28) = 3.0365889718756627 + Iterations 4 + cbrt_3(27) = 3 + Iterations 5 + cbrt_3(28) = 3.0365889718756627 + +] [/pre] + +to get some (much!) diagnostic output we can add + +#define BOOST_MATH_INSTRUMENT + +[pre + +] +*/ +//] [/root_finding_example_output] + +/* + +cbrt(28) 3.0365889718756622 +std::cbrt(28) 3.0365889718756627 + +*/ diff --git a/src/boost/libs/math/example/root_finding_fifth.cpp b/src/boost/libs/math/example/root_finding_fifth.cpp new file mode 100644 index 00000000..a5f69938 --- /dev/null +++ b/src/boost/libs/math/example/root_finding_fifth.cpp @@ -0,0 +1,485 @@ +// root_finding_fith.cpp + +// Copyright Paul A. Bristow 2014. + +// 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) + +// Example of finding fifth root using Newton-Raphson, Halley, Schroder, TOMS748 . + +// Note that this file contains Quickbook mark-up as well as code +// and comments, don't change any of the special comment mark-ups! + +// To get (copious!) diagnostic output, add make this define here or elsewhere. +//#define BOOST_MATH_INSTRUMENT + + +//[root_fifth_headers +/* +This example demonstrates how to use the Boost.Math tools for root finding, +taking the fifth root function (fifth_root) as an example. +It shows how use of derivatives can improve the speed. + +First some includes that will be needed. +Using statements are provided to list what functions are being used in this example: +you can of course qualify the names in other ways. +*/ + +#include +using boost::math::policies::policy; +using boost::math::tools::newton_raphson_iterate; +using boost::math::tools::halley_iterate; +using boost::math::tools::eps_tolerance; // Binary functor for specified number of bits. +using boost::math::tools::bracket_and_solve_root; +using boost::math::tools::toms748_solve; + +#include + +#include +#include // pair, make_pair + +//] [/root_finding_headers] + +#include +using std::cout; using std::endl; +#include +using std::setw; using std::setprecision; +#include +using std::numeric_limits; + +/* +//[root_finding_fifth_1 +Let's suppose we want to find the fifth root of a number. + +The equation we want to solve is: + +__spaces ['f](x) = x[fifth] + +We will first solve this without using any information +about the slope or curvature of the fifth function. + +If your differentiation is a little rusty +(or you are faced with an equation whose complexity is daunting, +then you can get help, for example from the invaluable + +http://www.wolframalpha.com/ site + +entering the commmand + + differentiate x^5 + +or the Wolfram Language command + + D[x^5, x] + +gives the output + + d/dx(x^5) = 5 x^4 + +and to get the second differential, enter + + second differentiate x^5 + +or the Wolfram Language + + D[x^5, {x, 2}] + +to get the output + + d^2/dx^2(x^5) = 20 x^3 + +or + + 20 x^3 + +To get a reference value we can enter + + fifth root 3126 + +or + + N[3126^(1/5), 50] + +to get a result with a precision of 50 decimal digits + + 5.0003199590478625588206333405631053401128722314376 + +(We could also get a reference value using Boost.Multiprecision). + +We then show how adding what we can know, for this function, about the slope, +the 1st derivation /f'(x)/, will speed homing in on the solution, +and then finally how adding the curvature /f''(x)/ as well will improve even more. + +The 1st and 2nd derivatives of x[fifth] are: + +__spaces ['f]\'(x) = 2x[sup2] + +__spaces ['f]\'\'(x) = 6x + +*/ + +//] [/root_finding_fifth_1] + +//[root_finding_fifth_functor_noderiv + +template +struct fifth_functor_noderiv +{ // fifth root of x using only function - no derivatives. + fifth_functor_noderiv(T const& to_find_root_of) : value(to_find_root_of) + { // Constructor stores value to find root of. + // For example: calling fifth_functor(x) to get fifth root of x. + } + T operator()(T const& x) + { //! \returns f(x) - value. + T fx = x*x*x*x*x - value; // Difference (estimate x^5 - value). + return fx; + } +private: + T value; // to be 'fifth_rooted'. +}; + +//] [/root_finding_fifth_functor_noderiv] + +//cout << ", std::numeric_limits<" << typeid(T).name() << ">::digits = " << digits +// << ", accuracy " << get_digits << " bits."<< endl; + + +/*`Implementing the fifth root function itself is fairly trivial now: +the hardest part is finding a good approximation to begin with. +In this case we'll just divide the exponent by five. +(There are better but more complex guess algorithms used in 'real-life'.) + +fifth root function is 'Really Well Behaved' in that it is monotonic +and has only one root +(we leave negative values 'as an exercise for the student'). +*/ + +//[root_finding_fifth_noderiv + +template +T fifth_noderiv(T x) +{ //! \returns fifth root of x using bracket_and_solve (no derivatives). + using namespace std; // Help ADL of std functions. + using namespace boost::math::tools; // For bracket_and_solve_root. + + int exponent; + frexp(x, &exponent); // Get exponent of z (ignore mantissa). + T guess = ldexp(1., exponent / 5); // Rough guess is to divide the exponent by five. + T factor = 2; // To multiply and divide guess to bracket. + // digits used to control how accurate to try to make the result. + // int digits = 3 * std::numeric_limits::digits / 4; // 3/4 maximum possible binary digits accuracy for type T. + int digits = std::numeric_limits::digits; // Maximum possible binary digits accuracy for type T. + + //boost::uintmax_t maxit = (std::numeric_limits::max)(); + // (std::numeric_limits::max)() = 18446744073709551615 + // which is more than anyone might wish to wait for!!! + // so better to choose some reasonable estimate of how many iterations may be needed. + + const boost::uintmax_t maxit = 50; // Chosen max iterations, + // but updated on exit with actual iteration count. + + // We could also have used a maximum iterations provided by any policy: + // boost::uintmax_t max_it = policies::get_max_root_iterations(); + + boost::uintmax_t it = maxit; // Initally our chosen max iterations, + + bool is_rising = true; // So if result if guess^5 is too low, try increasing guess. + eps_tolerance tol(digits); + std::pair r = + bracket_and_solve_root(fifth_functor_noderiv(x), guess, factor, is_rising, tol, it); + // because the iteration count is updating, + // you can't call with a literal maximum iterations value thus: + //bracket_and_solve_root(fifth_functor_noderiv(x), guess, factor, is_rising, tol, 20); + + // Can show how many iterations (this information is lost outside fifth_noderiv). + cout << "Iterations " << it << endl; + if (it >= maxit) + { // Failed to converge (or is jumping between bracket values). + cout << "Unable to locate solution in chosen iterations:" + " Current best guess is between " << r.first << " and " << r.second << endl; + } + T distance = float_distance(r.first, r.second); + if (distance > 0) + { // + std::cout << distance << " bits separate the bracketing values." << std::endl; + for (int i = 0; i < distance; i++) + { // Show all the values within the bracketing values. + std::cout << float_advance(r.first, i) << std::endl; + } + } + else + { // distance == 0 and r.second == r.first + std::cout << "Converged to a single value " << r.first << std::endl; + } + + return r.first + (r.second - r.first) / 2; // return midway between bracketed interval. +} // T fifth_noderiv(T x) + +//] [/root_finding_fifth_noderiv] + + + +// maxit = 10 +// Unable to locate solution in chosen iterations: Current best guess is between 3.0365889718756613 and 3.0365889718756627 + + +/*` +We now solve the same problem, but using more information about the function, +to show how this can speed up finding the best estimate of the root. + +For this function, the 1st differential (the slope of the tangent to a curve at any point) is known. + +[@http://en.wikipedia.org/wiki/Derivative#Derivatives_of_elementary_functions Derivatives] +gives some reminders. + +Using the rule that the derivative of x^n for positive n (actually all nonzero n) is nx^n-1, +allows use to get the 1st differential as 3x^2. + +To see how this extra information is used to find the root, view this demo: +[@http://en.wikipedia.org/wiki/Newton%27s_methodNewton Newton-Raphson iterations]. + +We need to define a different functor that returns +both the evaluation of the function to solve, along with its first derivative: + +To \'return\' two values, we use a pair of floating-point values: +*/ + +//[root_finding_fifth_functor_1stderiv + +template +struct fifth_functor_1stderiv +{ // Functor returning function and 1st derivative. + + fifth_functor_1stderiv(T const& target) : value(target) + { // Constructor stores the value to be 'fifth_rooted'. + } + + std::pair operator()(T const& z) // z is best estimate so far. + { // Return both f(x) and first derivative f'(x). + T fx = z*z*z*z*z - value; // Difference estimate fx = x^5 - value. + T d1x = 5 * z*z*z*z; // 1st derivative d1x = 5x^4. + return std::make_pair(fx, d1x); // 'return' both fx and d1x. + } +private: + T value; // to be 'fifth_rooted'. +}; // fifth_functor_1stderiv + +//] [/root_finding_fifth_functor_1stderiv] + + +/*`Our fifth root function using fifth_functor_1stderiv is now:*/ + +//[root_finding_fifth_1deriv + +template +T fifth_1deriv(T x) +{ //! \return fifth root of x using 1st derivative and Newton_Raphson. + using namespace std; // For frexp, ldexp, numeric_limits. + using namespace boost::math::tools; // For newton_raphson_iterate. + + int exponent; + frexp(x, &exponent); // Get exponent of x (ignore mantissa). + T guess = ldexp(1., exponent / 5); // Rough guess is to divide the exponent by three. + // Set an initial bracket interval. + T min = ldexp(0.5, exponent / 5); // Minimum possible value is half our guess. + T max = ldexp(2., exponent / 5);// Maximum possible value is twice our guess. + + // digits used to control how accurate to try to make the result. + int digits = std::numeric_limits::digits; // Maximum possible binary digits accuracy for type T. + + const boost::uintmax_t maxit = 20; // Optionally limit the number of iterations. + boost::uintmax_t it = maxit; // limit the number of iterations. + //cout << "Max Iterations " << maxit << endl; // + T result = newton_raphson_iterate(fifth_functor_1stderiv(x), guess, min, max, digits, it); + // Can check and show how many iterations (updated by newton_raphson_iterate). + cout << it << " iterations (from max of " << maxit << ")" << endl; + return result; +} // fifth_1deriv + +//] [/root_finding_fifth_1deriv] + +// int get_digits = (digits * 2) /3; // Two thirds of maximum possible accuracy. + +//boost::uintmax_t maxit = (std::numeric_limits::max)(); +// the default (std::numeric_limits::max)() = 18446744073709551615 +// which is more than we might wish to wait for!!! so we can reduce it + +/*` +Finally need to define yet another functor that returns +both the evaluation of the function to solve, +along with its first and second derivatives: + +f''(x) = 3 * 3x + +To \'return\' three values, we use a tuple of three floating-point values: +*/ + +//[root_finding_fifth_functor_2deriv + +template +struct fifth_functor_2deriv +{ // Functor returning both 1st and 2nd derivatives. + fifth_functor_2deriv(T const& to_find_root_of) : value(to_find_root_of) + { // Constructor stores value to find root of, for example: + } + + // using boost::math::tuple; // to return three values. + std::tuple operator()(T const& x) + { // Return both f(x) and f'(x) and f''(x). + T fx = x*x*x*x*x - value; // Difference (estimate x^3 - value). + T dx = 5 * x*x*x*x; // 1st derivative = 5x^4. + T d2x = 20 * x*x*x; // 2nd derivative = 20 x^3 + return std::make_tuple(fx, dx, d2x); // 'return' fx, dx and d2x. + } +private: + T value; // to be 'fifth_rooted'. +}; // struct fifth_functor_2deriv + +//] [/root_finding_fifth_functor_2deriv] + + +/*`Our fifth function is now:*/ + +//[root_finding_fifth_2deriv + +template +T fifth_2deriv(T x) +{ // return fifth root of x using 1st and 2nd derivatives and Halley. + using namespace std; // Help ADL of std functions. + using namespace boost::math; // halley_iterate + + int exponent; + frexp(x, &exponent); // Get exponent of z (ignore mantissa). + T guess = ldexp(1., exponent / 5); // Rough guess is to divide the exponent by three. + T min = ldexp(0.5, exponent / 5); // Minimum possible value is half our guess. + T max = ldexp(2., exponent / 5); // Maximum possible value is twice our guess. + + int digits = std::numeric_limits::digits / 2; // Half maximum possible binary digits accuracy for type T. + const boost::uintmax_t maxit = 50; + boost::uintmax_t it = maxit; + T result = halley_iterate(fifth_functor_2deriv(x), guess, min, max, digits, it); + // Can show how many iterations (updated by halley_iterate). + cout << it << " iterations (from max of " << maxit << ")" << endl; + + return result; +} // fifth_2deriv(x) + +//] [/root_finding_fifth_2deriv] + +int main() +{ + + //[root_finding_example_1 + cout << "fifth Root finding (fifth) Example." << endl; + // Show all possibly significant decimal digits. + cout.precision(std::numeric_limits::max_digits10); + // or use cout.precision(max_digits10 = 2 + std::numeric_limits::digits * 3010/10000); + try + { // Always use try'n'catch blocks with Boost.Math to get any error messages. + + double v27 = 3125; // Example of a value that has an exact integer fifth root. + // exact value of fifth root is exactly 5. + + std::cout << "Fifth root of " << v27 << " is " << 5 << std::endl; + + double v28 = v27+1; // Example of a value whose fifth root is *not* exactly representable. + // Value of fifth root is 5.0003199590478625588206333405631053401128722314376 (50 decimal digits precision) + // and to std::numeric_limits::max_digits10 double precision (usually 17) is + + double root5v2 = static_cast(5.0003199590478625588206333405631053401128722314376); + + std::cout << "Fifth root of " << v28 << " is " << root5v2 << std::endl; + + // Using bracketing: + double r = fifth_noderiv(v27); + cout << "fifth_noderiv(" << v27 << ") = " << r << endl; + + r = fifth_noderiv(v28); + cout << "fifth_noderiv(" << v28 << ") = " << r << endl; + + // Using 1st differential Newton-Raphson: + r = fifth_1deriv(v27); + cout << "fifth_1deriv(" << v27 << ") = " << r << endl; + r = fifth_1deriv(v28); + cout << "fifth_1deriv(" << v28 << ") = " << r << endl; + + // Using Halley with 1st and 2nd differentials. + r = fifth_2deriv(v27); + cout << "fifth_2deriv(" << v27 << ") = " << r << endl; + r = fifth_2deriv(v28); + cout << "fifth_2deriv(" << v28 << ") = " << r << endl; + } + catch (const std::exception& e) + { // Always useful to include try & catch blocks because default policies + // are to throw exceptions on arguments that cause errors like underflow, overflow. + // Lacking try & catch blocks, the program will abort without a message below, + // which may give some helpful clues as to the cause of the exception. + std::cout << + "\n""Message from thrown exception was:\n " << e.what() << std::endl; + } + //] [/root_finding_example_1 + return 0; +} // int main() + +//[root_finding_example_output +/*` +Normal output is: + +[pre +1> Description: Autorun "J:\Cpp\MathToolkit\test\Math_test\Release\root_finding_fifth.exe" +1> fifth Root finding (fifth) Example. +1> Fifth root of 3125 is 5 +1> Fifth root of 3126 is 5.0003199590478626 +1> Iterations 10 +1> Converged to a single value 5 +1> fifth_noderiv(3125) = 5 +1> Iterations 11 +1> 2 bits separate the bracketing values. +1> 5.0003199590478609 +1> 5.0003199590478618 +1> fifth_noderiv(3126) = 5.0003199590478618 +1> 6 iterations (from max of 20) +1> fifth_1deriv(3125) = 5 +1> 7 iterations (from max of 20) +1> fifth_1deriv(3126) = 5.0003199590478626 +1> 4 iterations (from max of 50) +1> fifth_2deriv(3125) = 5 +1> 4 iterations (from max of 50) +1> fifth_2deriv(3126) = 5.0003199590478626 +[/pre] + +to get some (much!) diagnostic output we can add + +#define BOOST_MATH_INSTRUMENT + +[pre +1> fifth Root finding (fifth) Example. +1> I:\modular-boost\boost/math/tools/toms748_solve.hpp:537 a = 4 b = 8 fa = -2101 fb = 29643 count = 18 +1> I:\modular-boost\boost/math/tools/toms748_solve.hpp:340 a = 4.264742943548387 b = 8 +1> I:\modular-boost\boost/math/tools/toms748_solve.hpp:352 a = 4.264742943548387 b = 5.1409225585147951 +1> I:\modular-boost\boost/math/tools/toms748_solve.hpp:259 a = 4.264742943548387 b = 5.1409225585147951 d = 8 e = 4 fa = -1714.2037505671719 fb = 465.91652114644285 fd = 29643 fe = -2101 +1> I:\modular-boost\boost/math/tools/toms748_solve.hpp:267 q11 = -3.735257056451613 q21 = -0.045655399937094755 q31 = 0.68893005658139972 d21 = -2.9047328414222999 d31 = -0.18724955838500826 +1> I:\modular-boost\boost/math/tools/toms748_solve.hpp:275 q22 = -0.15074699539567221 q32 = 0.007740525571111408 d32 = -0.13385363287680208 q33 = 0.074868009790687237 c = 5.0362815354915851 +1> I:\modular-boost\boost/math/tools/toms748_solve.hpp:388 a = 4.264742943548387 b = 5.0362815354915851 +1> I:\modular-boost\boost/math/tools/toms748_solve.hpp:259 a = 4.264742943548387 b = 5.0362815354915851 d = 5.1409225585147951 e = 8 fa = -1714.2037505671719 fb = 115.03721886368339 fd = 465.91652114644285 fe = 29643 +1> I:\modular-boost\boost/math/tools/toms748_solve.hpp:267 q11 = -0.045655399937094755 q21 = -0.034306988726112195 q31 = 0.7230181097615842 d21 = -0.1389480117493222 d31 = -0.048520482181613811 +1> I:\modular-boost\boost/math/tools/toms748_solve.hpp:275 q22 = -0.00036345624935100459 q32 = 0.011175908093791367 d32 = -0.0030375853617102483 q33 = 0.00014618657296010219 c = 4.999083147976723 +1> I:\modular-boost\boost/math/tools/toms748_solve.hpp:408 a = 4.999083147976723 b = 5.0362815354915851 +1> I:\modular-boost\boost/math/tools/toms748_solve.hpp:433 a = 4.999083147976723 b = 5.0008904277935091 +1> I:\modular-boost\boost/math/tools/toms748_solve.hpp:434 tol = -0.00036152225583956088 +1> I:\modular-boost\boost/math/tools/toms748_solve.hpp:259 a = 4.999083147976723 b = 5.0008904277935091 d = 5.0362815354915851 e = 4.264742943548387 fa = -2.8641119933622576 fb = 2.7835781082976609 fd = 115.03721886368339 fe = -1714.2037505671719 +1> I:\modular-boost\boost/math/tools/toms748_solve.hpp:267 q11 = -0.048520482181613811 q21 = -0.00087760104664616457 q31 = 0.00091652546535745522 d21 = -0.036268708744722128 d31 = -0.00089075435142862297 +1> I:\modular-boost\boost/math/tools/toms748_solve.hpp:275 q22 = -1.9862562616034592e-005 q32 = 3.1952597740788757e-007 d32 = -1.2833778805050512e-005 q33 = 1.1763429980834706e-008 c = 5.0000000047314881 +1> I:\modular-boost\boost/math/tools/toms748_solve.hpp:388 a = 4.999083147976723 b = 5.0000000047314881 +1> I:\modular-boost\boost/math/tools/toms748_solve.hpp:259 a = 4.999083147976723 b = 5.0000000047314881 d = 5.0008904277935091 e = 5.0362815354915851 fa = -2.8641119933622576 fb = 1.4785900475544622e-005 fd = 2.7835781082976609 fe = 115.03721886368339 +1> I:\modular-boost\boost/math/tools/toms748_solve.hpp:267 q11 = -0.00087760104664616457 q21 = -4.7298032238887272e-009 q31 = 0.00091685202154135855 d21 = -0.00089042779182425238 d31 = -4.7332236912279757e-009 +1> I:\modular-boost\boost/math/tools/toms748_solve.hpp:275 q22 = -1.6486403607318402e-012 q32 = 1.7346209428817704e-012 d32 = -1.6858463963666777e-012 q33 = 9.0382569995250912e-016 c = 5 +1> I:\modular-boost\boost/math/tools/toms748_solve.hpp:592 max_iter = 10 count = 7 +1> Iterations 20 +1> 0 bits separate brackets. +1> fifth_noderiv(3125) = 5 +] +*/ +//] [/root_finding_example_output] diff --git a/src/boost/libs/math/example/root_finding_multiprecision_example.cpp b/src/boost/libs/math/example/root_finding_multiprecision_example.cpp new file mode 100644 index 00000000..d658f193 --- /dev/null +++ b/src/boost/libs/math/example/root_finding_multiprecision_example.cpp @@ -0,0 +1,232 @@ +// Copyright Paul A. Bristow 2015. + +// 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) + +// Note that this file contains Quickbook mark-up as well as code +// and comments, don't change any of the special comment mark-ups! + +// Example of root finding using Boost.Multiprecision. + +#include +//using boost::math::policies::policy; +//using boost::math::tools::newton_raphson_iterate; +//using boost::math::tools::halley_iterate; +//using boost::math::tools::eps_tolerance; // Binary functor for specified number of bits. +//using boost::math::tools::bracket_and_solve_root; +//using boost::math::tools::toms748_solve; + +#include // For float_distance. +#include +#include + +//[root_finding_multiprecision_include_1 +#include // For cpp_bin_float_50. +#include // For cpp_dec_float_50. +#ifndef _MSC_VER // float128 is not yet supported by Microsoft compiler at 2013. +# include // Requires libquadmath. +#endif +//] [/root_finding_multiprecision_include_1] + +#include +// using std::cout; using std::endl; +#include +// using std::setw; using std::setprecision; +#include +// using std::numeric_limits; +#include +#include // pair, make_pair + +// #define BUILTIN_POW_GUESS // define to use std::pow function to obtain a guess. + +template +T cbrt_2deriv(T x) +{ // return cube root of x using 1st and 2nd derivatives and Halley. + using namespace std; // Help ADL of std functions. + using namespace boost::math::tools; // For halley_iterate. + + // If T is not a binary floating-point type, for example, cpp_dec_float_50 + // then frexp may not be defined, + // so it may be necessary to compute the guess using a built-in type, + // probably quickest using double, but perhaps with float or long double. + // Note that the range of exponent may be restricted by a built-in-type for guess. + + typedef long double guess_type; + +#ifdef BUILTIN_POW_GUESS + guess_type pow_guess = std::pow(static_cast(x), static_cast(1) / 3); + T guess = pow_guess; + T min = pow_guess /2; + T max = pow_guess * 2; +#else + int exponent; + frexp(static_cast(x), &exponent); // Get exponent of z (ignore mantissa). + T guess = ldexp(static_cast(1.), exponent / 3); // Rough guess is to divide the exponent by three. + T min = ldexp(static_cast(1.) / 2, exponent / 3); // Minimum possible value is half our guess. + T max = ldexp(static_cast(2.), exponent / 3); // Maximum possible value is twice our guess. +#endif + + int digits = std::numeric_limits::digits / 2; // Half maximum possible binary digits accuracy for type T. + const boost::uintmax_t maxit = 20; + boost::uintmax_t it = maxit; + T result = halley_iterate(cbrt_functor_2deriv(x), guess, min, max, digits, it); + // Can show how many iterations (updated by halley_iterate). + // std::cout << "Iterations " << it << " (from max of "<< maxit << ")." << std::endl; + return result; +} // cbrt_2deriv(x) + + +template +struct cbrt_functor_2deriv +{ // Functor returning both 1st and 2nd derivatives. + cbrt_functor_2deriv(T const& to_find_root_of) : a(to_find_root_of) + { // Constructor stores value to find root of, for example: + } + + // using boost::math::tuple; // to return three values. + std::tuple operator()(T const& x) + { + // Return both f(x) and f'(x) and f''(x). + T fx = x*x*x - a; // Difference (estimate x^3 - value). + // std::cout << "x = " << x << "\nfx = " << fx << std::endl; + T dx = 3 * x*x; // 1st derivative = 3x^2. + T d2x = 6 * x; // 2nd derivative = 6x. + return std::make_tuple(fx, dx, d2x); // 'return' fx, dx and d2x. + } +private: + T a; // to be 'cube_rooted'. +}; // struct cbrt_functor_2deriv + +template +struct nth_functor_2deriv +{ // Functor returning both 1st and 2nd derivatives. + + nth_functor_2deriv(T const& to_find_root_of) : value(to_find_root_of) + { /* Constructor stores value to find root of, for example: */ } + + // using std::tuple; // to return three values. + std::tuple operator()(T const& x) + { + // Return both f(x) and f'(x) and f''(x). + using boost::math::pow; + T fx = pow(x) - value; // Difference (estimate x^3 - value). + T dx = n * pow(x); // 1st derivative = 5x^4. + T d2x = n * (n - 1) * pow(x); // 2nd derivative = 20 x^3 + return std::make_tuple(fx, dx, d2x); // 'return' fx, dx and d2x. + } +private: + T value; // to be 'nth_rooted'. +}; // struct nth_functor_2deriv + + +template +T nth_2deriv(T x) +{ + // return nth root of x using 1st and 2nd derivatives and Halley. + using namespace std; // Help ADL of std functions. + using namespace boost::math; // For halley_iterate. + + int exponent; + frexp(x, &exponent); // Get exponent of z (ignore mantissa). + T guess = ldexp(static_cast(1.), exponent / n); // Rough guess is to divide the exponent by three. + T min = ldexp(static_cast(0.5), exponent / n); // Minimum possible value is half our guess. + T max = ldexp(static_cast(2.), exponent / n); // Maximum possible value is twice our guess. + + int digits = std::numeric_limits::digits / 2; // Half maximum possible binary digits accuracy for type T. + const boost::uintmax_t maxit = 50; + boost::uintmax_t it = maxit; + T result = halley_iterate(nth_functor_2deriv(x), guess, min, max, digits, it); + // Can show how many iterations (updated by halley_iterate). + std::cout << it << " iterations (from max of " << maxit << ")" << std::endl; + + return result; +} // nth_2deriv(x) + +//[root_finding_multiprecision_show_1 + +template +T show_cube_root(T value) +{ // Demonstrate by printing the root using all definitely significant digits. + std::cout.precision(std::numeric_limits::digits10); + T r = cbrt_2deriv(value); + std::cout << "value = " << value << ", cube root =" << r << std::endl; + return r; +} + +//] [/root_finding_multiprecision_show_1] + +int main() +{ + std::cout << "Multiprecision Root finding Example." << std::endl; + // Show all possibly significant decimal digits. + std::cout.precision(std::numeric_limits::digits10); + // or use cout.precision(max_digits10 = 2 + std::numeric_limits::digits * 3010/10000); + //[root_finding_multiprecision_example_1 + using boost::multiprecision::cpp_dec_float_50; // decimal. + using boost::multiprecision::cpp_bin_float_50; // binary. +#ifndef _MSC_VER // Not supported by Microsoft compiler. + using boost::multiprecision::float128; +#endif + //] [/root_finding_multiprecision_example_1 + + try + { // Always use try'n'catch blocks with Boost.Math to get any error messages. + // Increase the precision to 50 decimal digits using Boost.Multiprecision +//[root_finding_multiprecision_example_2 + + std::cout.precision(std::numeric_limits::digits10); + + cpp_dec_float_50 two = 2; // + cpp_dec_float_50 r = cbrt_2deriv(two); + std::cout << "cbrt(" << two << ") = " << r << std::endl; + + r = cbrt_2deriv(2.); // Passing a double, so ADL will compute a double precision result. + std::cout << "cbrt(" << two << ") = " << r << std::endl; + // cbrt(2) = 1.2599210498948731906665443602832965552806854248047 'wrong' from digits 17 onwards! + r = cbrt_2deriv(static_cast(2.)); // Passing a cpp_dec_float_50, + // so will compute a cpp_dec_float_50 precision result. + std::cout << "cbrt(" << two << ") = " << r << std::endl; + r = cbrt_2deriv(2.); // Explictly a cpp_dec_float_50, so will compute a cpp_dec_float_50 precision result. + std::cout << "cbrt(" << two << ") = " << r << std::endl; + // cpp_dec_float_50 1.2599210498948731647672106072782283505702514647015 +//] [/root_finding_multiprecision_example_2 + // N[2^(1/3), 50] 1.2599210498948731647672106072782283505702514647015 + + //show_cube_root(2); // Integer parameter - Errors! + //show_cube_root(2.F); // Float parameter - Warnings! +//[root_finding_multiprecision_example_3 + show_cube_root(2.); + show_cube_root(2.L); + show_cube_root(two); + +//] [/root_finding_multiprecision_example_3 + + } + catch (const std::exception& e) + { // Always useful to include try&catch blocks because default policies + // are to throw exceptions on arguments that cause errors like underflow & overflow. + // Lacking try&catch blocks, the program will abort without a message below, + // which may give some helpful clues as to the cause of the exception. + std::cout << + "\n""Message from thrown exception was:\n " << e.what() << std::endl; + } + return 0; +} // int main() + + +/* + +Description: Autorun "J:\Cpp\MathToolkit\test\Math_test\Release\root_finding_multiprecision.exe" +Multiprecision Root finding Example. +cbrt(2) = 1.2599210498948731647672106072782283505702514647015 +cbrt(2) = 1.2599210498948731906665443602832965552806854248047 +cbrt(2) = 1.2599210498948731647672106072782283505702514647015 +cbrt(2) = 1.2599210498948731647672106072782283505702514647015 +value = 2, cube root =1.25992104989487 +value = 2, cube root =1.25992104989487 +value = 2, cube root =1.2599210498948731647672106072782283505702514647015 + + +*/ diff --git a/src/boost/libs/math/example/root_finding_n_example.cpp b/src/boost/libs/math/example/root_finding_n_example.cpp new file mode 100644 index 00000000..096ed954 --- /dev/null +++ b/src/boost/libs/math/example/root_finding_n_example.cpp @@ -0,0 +1,213 @@ +// Copyright Paul A. Bristow 2014, 2015. + +// 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) + +// Note that this file contains Quickbook mark-up as well as code +// and comments, don't change any of the special comment mark-ups! + +// Example of finding nth root using 1st and 2nd derivatives of x^n. + +#include +//using boost::math::policies::policy; +//using boost::math::tools::newton_raphson_iterate; +//using boost::math::tools::halley_iterate; +//using boost::math::tools::eps_tolerance; // Binary functor for specified number of bits. +//using boost::math::tools::bracket_and_solve_root; +//using boost::math::tools::toms748_solve; + +#include +#include +#include +#include + +#include // For cpp_dec_float_50. +#include // using boost::multiprecision::cpp_bin_float_50; +#ifndef _MSC_VER // float128 is not yet supported by Microsoft compiler at 2013. +# include +#endif + +#include +// using std::cout; using std::endl; +#include +// using std::setw; using std::setprecision; +#include +using std::numeric_limits; +#include +#include // pair, make_pair + + +//[root_finding_nth_functor_2deriv +template +struct nth_functor_2deriv +{ // Functor returning both 1st and 2nd derivatives. + BOOST_STATIC_ASSERT_MSG(boost::is_integral::value == false, "Only floating-point type types can be used!"); + BOOST_STATIC_ASSERT_MSG((N > 0) == true, "root N must be > 0!"); + + nth_functor_2deriv(T const& to_find_root_of) : a(to_find_root_of) + { /* Constructor stores value a to find root of, for example: */ } + + // using boost::math::tuple; // to return three values. + std::tuple operator()(T const& x) + { + // Return f(x), f'(x) and f''(x). + using boost::math::pow; + T fx = pow(x) - a; // Difference (estimate x^n - a). + T dx = N * pow(x); // 1st derivative f'(x). + T d2x = N * (N - 1) * pow(x); // 2nd derivative f''(x). + + return std::make_tuple(fx, dx, d2x); // 'return' fx, dx and d2x. + } +private: + T a; // to be 'nth_rooted'. +}; + +//] [/root_finding_nth_functor_2deriv] + +/* +To show the progress, one might use this before the return statement above? +#ifdef BOOST_MATH_ROOT_DIAGNOSTIC +std::cout << " x = " << x << ", fx = " << fx << ", dx = " << dx << ", dx2 = " << d2x << std::endl; +#endif +*/ + +// If T is a floating-point type, might be quicker to compute the guess using a built-in type, +// probably quickest using double, but perhaps with float or long double, T. + +// If T is a type for which frexp and ldexp are not defined, +// then it is necessary to compute the guess using a built-in type, +// probably quickest (but limited range) using double, +// but perhaps with float or long double, or a multiprecision T for the full range of T. +// typedef double guess_type; is used to specify the this. + +//[root_finding_nth_function_2deriv + +template +T nth_2deriv(T x) +{ // return nth root of x using 1st and 2nd derivatives and Halley. + + using namespace std; // Help ADL of std functions. + using namespace boost::math::tools; // For halley_iterate. + + BOOST_STATIC_ASSERT_MSG(boost::is_integral::value == false, "Only floating-point type types can be used!"); + BOOST_STATIC_ASSERT_MSG((N > 0) == true, "root N must be > 0!"); + BOOST_STATIC_ASSERT_MSG((N > 1000) == false, "root N is too big!"); + + typedef double guess_type; // double may restrict (exponent) range for a multiprecision T? + + int exponent; + frexp(static_cast(x), &exponent); // Get exponent of z (ignore mantissa). + T guess = ldexp(static_cast(1.), exponent / N); // Rough guess is to divide the exponent by n. + T min = ldexp(static_cast(1.) / 2, exponent / N); // Minimum possible value is half our guess. + T max = ldexp(static_cast(2.), exponent / N); // Maximum possible value is twice our guess. + + int digits = std::numeric_limits::digits * 0.4; // Accuracy triples with each step, so stop when + // slightly more than one third of the digits are correct. + const boost::uintmax_t maxit = 20; + boost::uintmax_t it = maxit; + T result = halley_iterate(nth_functor_2deriv(x), guess, min, max, digits, it); + return result; +} + +//] [/root_finding_nth_function_2deriv] + + +template +T show_nth_root(T value) +{ // Demonstrate by printing the nth root using all possibly significant digits. + //std::cout.precision(std::numeric_limits::max_digits10); + // or use cout.precision(max_digits10 = 2 + std::numeric_limits::digits * 3010/10000); + // Or guaranteed significant digits: + std::cout.precision(std::numeric_limits::digits10); + + T r = nth_2deriv(value); + std::cout << "Type " << typeid(T).name() << " value = " << value << ", " << N << "th root = " << r << std::endl; + return r; +} // print_nth_root + + +int main() +{ + std::cout << "nth Root finding Example." << std::endl; + using boost::multiprecision::cpp_dec_float_50; // decimal. + using boost::multiprecision::cpp_bin_float_50; // binary. +#ifndef _MSC_VER // Not supported by Microsoft compiler. + using boost::multiprecision::float128; // Requires libquadmath +#endif + try + { // Always use try'n'catch blocks with Boost.Math to get any error messages. + +//[root_finding_n_example_1 + double r1 = nth_2deriv<5, double>(2); // Integral value converted to double. + + // double r2 = nth_2deriv<5>(2); // Only floating-point type types can be used! + +//] [/root_finding_n_example_1 + + //show_nth_root<5, float>(2); // Integral value converted to float. + //show_nth_root<5, float>(2.F); // 'initializing' : conversion from 'double' to 'float', possible loss of data + +//[root_finding_n_example_2 + + + show_nth_root<5, double>(2.); + show_nth_root<5, long double>(2.); +#ifndef _MSC_VER // float128 is not supported by Microsoft compiler 2013. + show_nth_root<5, float128>(2); +#endif + show_nth_root<5, cpp_dec_float_50>(2); // dec + show_nth_root<5, cpp_bin_float_50>(2); // bin +//] [/root_finding_n_example_2 + + // show_nth_root<1000000>(2.); // Type double value = 2, 555th root = 1.00124969405651 + // Type double value = 2, 1000th root = 1.00069338746258 + // Type double value = 2, 1000000th root = 1.00000069314783 + } + catch (const std::exception& e) + { // Always useful to include try & catch blocks because default policies + // are to throw exceptions on arguments that cause errors like underflow, overflow. + // Lacking try & catch blocks, the program will abort without a message below, + // which may give some helpful clues as to the cause of the exception. + std::cout << + "\n""Message from thrown exception was:\n " << e.what() << std::endl; + } + return 0; +} // int main() + + +/* +//[root_finding_example_output_1 + Using MSVC 2013 + +nth Root finding Example. +Type double value = 2, 5th root = 1.14869835499704 +Type long double value = 2, 5th root = 1.14869835499704 +Type class boost::multiprecision::number,1> value = 2, + 5th root = 1.1486983549970350067986269467779275894438508890978 +Type class boost::multiprecision::number,0> value = 2, + 5th root = 1.1486983549970350067986269467779275894438508890978 + +//] [/root_finding_example_output_1] + +//[root_finding_example_output_2 + + Using GCC 4.91 (includes float_128 type) + + nth Root finding Example. +Type d value = 2, 5th root = 1.14869835499704 +Type e value = 2, 5th root = 1.14869835499703501 +Type N5boost14multiprecision6numberINS0_8backends16float128_backendELNS0_26expression_template_optionE0EEE value = 2, 5th root = 1.148698354997035006798626946777928 +Type N5boost14multiprecision6numberINS0_8backends13cpp_dec_floatILj50EivEELNS0_26expression_template_optionE1EEE value = 2, 5th root = 1.1486983549970350067986269467779275894438508890978 +Type N5boost14multiprecision6numberINS0_8backends13cpp_bin_floatILj50ELNS2_15digit_base_typeE10EviLi0ELi0EEELNS0_26expression_template_optionE0EEE value = 2, 5th root = 1.1486983549970350067986269467779275894438508890978 + +RUN SUCCESSFUL (total time: 63ms) + +//] [/root_finding_example_output_2] +*/ + +/* +Throw out of range using GCC release mode :-( + + */ diff --git a/src/boost/libs/math/example/root_finding_start_locations.cpp b/src/boost/libs/math/example/root_finding_start_locations.cpp new file mode 100644 index 00000000..2cb0bcf0 --- /dev/null +++ b/src/boost/libs/math/example/root_finding_start_locations.cpp @@ -0,0 +1,449 @@ +// Copyright John Maddock 2015 + +// 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) + +// Comparison of finding roots using TOMS748, Newton-Raphson, Halley & Schroder algorithms. +// Note that this file contains Quickbook mark-up as well as code +// and comments, don't change any of the special comment mark-ups! +// This program also writes files in Quickbook tables mark-up format. + +#include +#include +#include +#include +#include +#include +template +struct cbrt_functor_noderiv +{ + // cube root of x using only function - no derivatives. + cbrt_functor_noderiv(T const& to_find_root_of) : a(to_find_root_of) + { /* Constructor just stores value a to find root of. */ + } + T operator()(T const& x) + { + T fx = x*x*x - a; // Difference (estimate x^3 - a). + return fx; + } +private: + T a; // to be 'cube_rooted'. +}; +//] [/root_finding_noderiv_1 + +template +boost::uintmax_t cbrt_noderiv(T x, T guess) +{ + // return cube root of x using bracket_and_solve (no derivatives). + using namespace std; // Help ADL of std functions. + using namespace boost::math::tools; // For bracket_and_solve_root. + + T factor = 2; // How big steps to take when searching. + + const boost::uintmax_t maxit = 20; // Limit to maximum iterations. + boost::uintmax_t it = maxit; // Initally our chosen max iterations, but updated with actual. + bool is_rising = true; // So if result if guess^3 is too low, then try increasing guess. + int digits = std::numeric_limits::digits; // Maximum possible binary digits accuracy for type T. + // Some fraction of digits is used to control how accurate to try to make the result. + int get_digits = digits - 3; // We have to have a non-zero interval at each step, so + // maximum accuracy is digits - 1. But we also have to + // allow for inaccuracy in f(x), otherwise the last few + // iterations just thrash around. + eps_tolerance tol(get_digits); // Set the tolerance. + bracket_and_solve_root(cbrt_functor_noderiv(x), guess, factor, is_rising, tol, it); + return it; +} + +template +struct cbrt_functor_deriv +{ // Functor also returning 1st derivative. + cbrt_functor_deriv(T const& to_find_root_of) : a(to_find_root_of) + { // Constructor stores value a to find root of, + // for example: calling cbrt_functor_deriv(a) to use to get cube root of a. + } + std::pair operator()(T const& x) + { + // Return both f(x) and f'(x). + T fx = x*x*x - a; // Difference (estimate x^3 - value). + T dx = 3 * x*x; // 1st derivative = 3x^2. + return std::make_pair(fx, dx); // 'return' both fx and dx. + } +private: + T a; // Store value to be 'cube_rooted'. +}; + +template +boost::uintmax_t cbrt_deriv(T x, T guess) +{ + // return cube root of x using 1st derivative and Newton_Raphson. + using namespace boost::math::tools; + T min = guess / 100; // We don't really know what this should be! + T max = guess * 100; // We don't really know what this should be! + const int digits = std::numeric_limits::digits; // Maximum possible binary digits accuracy for type T. + int get_digits = static_cast(digits * 0.6); // Accuracy doubles with each step, so stop when we have + // just over half the digits correct. + const boost::uintmax_t maxit = 20; + boost::uintmax_t it = maxit; + newton_raphson_iterate(cbrt_functor_deriv(x), guess, min, max, get_digits, it); + return it; +} + +template +struct cbrt_functor_2deriv +{ + // Functor returning both 1st and 2nd derivatives. + cbrt_functor_2deriv(T const& to_find_root_of) : a(to_find_root_of) + { // Constructor stores value a to find root of, for example: + // calling cbrt_functor_2deriv(x) to get cube root of x, + } + std::tuple operator()(T const& x) + { + // Return both f(x) and f'(x) and f''(x). + T fx = x*x*x - a; // Difference (estimate x^3 - value). + T dx = 3 * x*x; // 1st derivative = 3x^2. + T d2x = 6 * x; // 2nd derivative = 6x. + return std::make_tuple(fx, dx, d2x); // 'return' fx, dx and d2x. + } +private: + T a; // to be 'cube_rooted'. +}; + +template +boost::uintmax_t cbrt_2deriv(T x, T guess) +{ + // return cube root of x using 1st and 2nd derivatives and Halley. + //using namespace std; // Help ADL of std functions. + using namespace boost::math::tools; + T min = guess / 100; // We don't really know what this should be! + T max = guess * 100; // We don't really know what this should be! + const int digits = std::numeric_limits::digits; // Maximum possible binary digits accuracy for type T. + // digits used to control how accurate to try to make the result. + int get_digits = static_cast(digits * 0.4); // Accuracy triples with each step, so stop when just + // over one third of the digits are correct. + boost::uintmax_t maxit = 20; + halley_iterate(cbrt_functor_2deriv(x), guess, min, max, get_digits, maxit); + return maxit; +} + +template +boost::uintmax_t cbrt_2deriv_s(T x, T guess) +{ + // return cube root of x using 1st and 2nd derivatives and Halley. + //using namespace std; // Help ADL of std functions. + using namespace boost::math::tools; + T min = guess / 100; // We don't really know what this should be! + T max = guess * 100; // We don't really know what this should be! + const int digits = std::numeric_limits::digits; // Maximum possible binary digits accuracy for type T. + // digits used to control how accurate to try to make the result. + int get_digits = static_cast(digits * 0.4); // Accuracy triples with each step, so stop when just + // over one third of the digits are correct. + boost::uintmax_t maxit = 20; + schroder_iterate(cbrt_functor_2deriv(x), guess, min, max, get_digits, maxit); + return maxit; +} + +template +struct elliptic_root_functor_noderiv +{ + elliptic_root_functor_noderiv(T const& arc, T const& radius) : m_arc(arc), m_radius(radius) + { // Constructor just stores value a to find root of. + } + T operator()(T const& x) + { + // return the difference between required arc-length, and the calculated arc-length for an + // ellipse with radii m_radius and x: + T a = (std::max)(m_radius, x); + T b = (std::min)(m_radius, x); + T k = sqrt(1 - b * b / (a * a)); + return 4 * a * boost::math::ellint_2(k) - m_arc; + } +private: + T m_arc; // length of arc. + T m_radius; // one of the two radii of the ellipse +}; // template struct elliptic_root_functor_noderiv + +template +boost::uintmax_t elliptic_root_noderiv(T radius, T arc, T guess) +{ // return the other radius of an ellipse, given one radii and the arc-length + using namespace std; // Help ADL of std functions. + using namespace boost::math::tools; // For bracket_and_solve_root. + + T factor = 2; // How big steps to take when searching. + + const boost::uintmax_t maxit = 50; // Limit to maximum iterations. + boost::uintmax_t it = maxit; // Initally our chosen max iterations, but updated with actual. + bool is_rising = true; // arc-length increases if one radii increases, so function is rising + // Define a termination condition, stop when nearly all digits are correct, but allow for + // the fact that we are returning a range, and must have some inaccuracy in the elliptic integral: + eps_tolerance tol(std::numeric_limits::digits - 2); + // Call bracket_and_solve_root to find the solution, note that this is a rising function: + bracket_and_solve_root(elliptic_root_functor_noderiv(arc, radius), guess, factor, is_rising, tol, it); + return it; +} + +template +struct elliptic_root_functor_1deriv +{ // Functor also returning 1st derviative. + BOOST_STATIC_ASSERT_MSG(boost::is_integral::value == false, "Only floating-point type types can be used!"); + + elliptic_root_functor_1deriv(T const& arc, T const& radius) : m_arc(arc), m_radius(radius) + { // Constructor just stores value a to find root of. + } + std::pair operator()(T const& x) + { + // Return the difference between required arc-length, and the calculated arc-length for an + // ellipse with radii m_radius and x, plus it's derivative. + // See http://www.wolframalpha.com/input/?i=d%2Fda+[4+*+a+*+EllipticE%281+-+b^2%2Fa^2%29] + // We require two elliptic integral calls, but from these we can calculate both + // the function and it's derivative: + T a = (std::max)(m_radius, x); + T b = (std::min)(m_radius, x); + T a2 = a * a; + T b2 = b * b; + T k = sqrt(1 - b2 / a2); + T Ek = boost::math::ellint_2(k); + T Kk = boost::math::ellint_1(k); + T fx = 4 * a * Ek - m_arc; + T dfx = 4 * (a2 * Ek - b2 * Kk) / (a2 - b2); + return std::make_pair(fx, dfx); + } +private: + T m_arc; // length of arc. + T m_radius; // one of the two radii of the ellipse +}; // struct elliptic_root__functor_1deriv + +template +boost::uintmax_t elliptic_root_1deriv(T radius, T arc, T guess) +{ + using namespace std; // Help ADL of std functions. + using namespace boost::math::tools; // For newton_raphson_iterate. + + BOOST_STATIC_ASSERT_MSG(boost::is_integral::value == false, "Only floating-point type types can be used!"); + + T min = 0; // Minimum possible value is zero. + T max = arc; // Maximum possible value is the arc length. + + // Accuracy doubles at each step, so stop when just over half of the digits are + // correct, and rely on that step to polish off the remainder: + int get_digits = static_cast(std::numeric_limits::digits * 0.6); + const boost::uintmax_t maxit = 20; + boost::uintmax_t it = maxit; + newton_raphson_iterate(elliptic_root_functor_1deriv(arc, radius), guess, min, max, get_digits, it); + return it; +} + +template +struct elliptic_root_functor_2deriv +{ // Functor returning both 1st and 2nd derivatives. + BOOST_STATIC_ASSERT_MSG(boost::is_integral::value == false, "Only floating-point type types can be used!"); + + elliptic_root_functor_2deriv(T const& arc, T const& radius) : m_arc(arc), m_radius(radius) {} + std::tuple operator()(T const& x) + { + // Return the difference between required arc-length, and the calculated arc-length for an + // ellipse with radii m_radius and x, plus it's derivative. + // See http://www.wolframalpha.com/input/?i=d^2%2Fda^2+[4+*+a+*+EllipticE%281+-+b^2%2Fa^2%29] + // for the second derivative. + T a = (std::max)(m_radius, x); + T b = (std::min)(m_radius, x); + T a2 = a * a; + T b2 = b * b; + T k = sqrt(1 - b2 / a2); + T Ek = boost::math::ellint_2(k); + T Kk = boost::math::ellint_1(k); + T fx = 4 * a * Ek - m_arc; + T dfx = 4 * (a2 * Ek - b2 * Kk) / (a2 - b2); + T dfx2 = 4 * b2 * ((a2 + b2) * Kk - 2 * a2 * Ek) / (a * (a2 - b2) * (a2 - b2)); + return std::make_tuple(fx, dfx, dfx2); + } +private: + T m_arc; // length of arc. + T m_radius; // one of the two radii of the ellipse +}; + +template +boost::uintmax_t elliptic_root_2deriv(T radius, T arc, T guess) +{ + using namespace std; // Help ADL of std functions. + using namespace boost::math::tools; // For halley_iterate. + + BOOST_STATIC_ASSERT_MSG(boost::is_integral::value == false, "Only floating-point type types can be used!"); + + T min = 0; // Minimum possible value is zero. + T max = arc; // radius can't be larger than the arc length. + + // Accuracy triples at each step, so stop when just over one-third of the digits + // are correct, and the last iteration will polish off the remaining digits: + int get_digits = static_cast(std::numeric_limits::digits * 0.4); + const boost::uintmax_t maxit = 20; + boost::uintmax_t it = maxit; + halley_iterate(elliptic_root_functor_2deriv(arc, radius), guess, min, max, get_digits, it); + return it; +} // nth_2deriv Halley +//] +// Using 1st and 2nd derivatives using Schroder algorithm. + +template +boost::uintmax_t elliptic_root_2deriv_s(T radius, T arc, T guess) +{ // return nth root of x using 1st and 2nd derivatives and Schroder. + + using namespace std; // Help ADL of std functions. + using namespace boost::math::tools; // For schroder_iterate. + + BOOST_STATIC_ASSERT_MSG(boost::is_integral::value == false, "Only floating-point type types can be used!"); + + T min = 0; // Minimum possible value is zero. + T max = arc; // radius can't be larger than the arc length. + + int digits = std::numeric_limits::digits; // Maximum possible binary digits accuracy for type T. + int get_digits = static_cast(digits * 0.4); + const boost::uintmax_t maxit = 20; + boost::uintmax_t it = maxit; + schroder_iterate(elliptic_root_functor_2deriv(arc, radius), guess, min, max, get_digits, it); + return it; +} // T elliptic_root_2deriv_s Schroder + + +int main() +{ + try + { + double to_root = 500; + double answer = 7.93700525984; + + std::cout << "[table\n" + << "[[Initial Guess=][-500% ([approx]1.323)][-100% ([approx]3.97)][-50% ([approx]3.96)][-20% ([approx]6.35)][-10% ([approx]7.14)][-5% ([approx]7.54)]" + "[5% ([approx]8.33)][10% ([approx]8.73)][20% ([approx]9.52)][50% ([approx]11.91)][100% ([approx]15.87)][500 ([approx]47.6)]]\n"; + std::cout << "[[bracket_and_solve_root][" + << cbrt_noderiv(to_root, answer / 6) + << "][" << cbrt_noderiv(to_root, answer / 2) + << "][" << cbrt_noderiv(to_root, answer - answer * 0.5) + << "][" << cbrt_noderiv(to_root, answer - answer * 0.2) + << "][" << cbrt_noderiv(to_root, answer - answer * 0.1) + << "][" << cbrt_noderiv(to_root, answer - answer * 0.05) + << "][" << cbrt_noderiv(to_root, answer + answer * 0.05) + << "][" << cbrt_noderiv(to_root, answer + answer * 0.1) + << "][" << cbrt_noderiv(to_root, answer + answer * 0.2) + << "][" << cbrt_noderiv(to_root, answer + answer * 0.5) + << "][" << cbrt_noderiv(to_root, answer + answer) + << "][" << cbrt_noderiv(to_root, answer + answer * 5) << "]]\n"; + + std::cout << "[[newton_iterate][" + << cbrt_deriv(to_root, answer / 6) + << "][" << cbrt_deriv(to_root, answer / 2) + << "][" << cbrt_deriv(to_root, answer - answer * 0.5) + << "][" << cbrt_deriv(to_root, answer - answer * 0.2) + << "][" << cbrt_deriv(to_root, answer - answer * 0.1) + << "][" << cbrt_deriv(to_root, answer - answer * 0.05) + << "][" << cbrt_deriv(to_root, answer + answer * 0.05) + << "][" << cbrt_deriv(to_root, answer + answer * 0.1) + << "][" << cbrt_deriv(to_root, answer + answer * 0.2) + << "][" << cbrt_deriv(to_root, answer + answer * 0.5) + << "][" << cbrt_deriv(to_root, answer + answer) + << "][" << cbrt_deriv(to_root, answer + answer * 5) << "]]\n"; + + std::cout << "[[halley_iterate][" + << cbrt_2deriv(to_root, answer / 6) + << "][" << cbrt_2deriv(to_root, answer / 2) + << "][" << cbrt_2deriv(to_root, answer - answer * 0.5) + << "][" << cbrt_2deriv(to_root, answer - answer * 0.2) + << "][" << cbrt_2deriv(to_root, answer - answer * 0.1) + << "][" << cbrt_2deriv(to_root, answer - answer * 0.05) + << "][" << cbrt_2deriv(to_root, answer + answer * 0.05) + << "][" << cbrt_2deriv(to_root, answer + answer * 0.1) + << "][" << cbrt_2deriv(to_root, answer + answer * 0.2) + << "][" << cbrt_2deriv(to_root, answer + answer * 0.5) + << "][" << cbrt_2deriv(to_root, answer + answer) + << "][" << cbrt_2deriv(to_root, answer + answer * 5) << "]]\n"; + + std::cout << "[[schr'''ö'''der_iterate][" + << cbrt_2deriv_s(to_root, answer / 6) + << "][" << cbrt_2deriv_s(to_root, answer / 2) + << "][" << cbrt_2deriv_s(to_root, answer - answer * 0.5) + << "][" << cbrt_2deriv_s(to_root, answer - answer * 0.2) + << "][" << cbrt_2deriv_s(to_root, answer - answer * 0.1) + << "][" << cbrt_2deriv_s(to_root, answer - answer * 0.05) + << "][" << cbrt_2deriv_s(to_root, answer + answer * 0.05) + << "][" << cbrt_2deriv_s(to_root, answer + answer * 0.1) + << "][" << cbrt_2deriv_s(to_root, answer + answer * 0.2) + << "][" << cbrt_2deriv_s(to_root, answer + answer * 0.5) + << "][" << cbrt_2deriv_s(to_root, answer + answer) + << "][" << cbrt_2deriv_s(to_root, answer + answer * 5) << "]]\n]\n\n"; + + + double radius_a = 10; + double arc_length = 500; + double radius_b = 123.6216507967705; + + std::cout << std::setprecision(4) << "[table\n" + << "[[Initial Guess=][-500% ([approx]" << radius_b / 6 << ")][-100% ([approx]" << radius_b / 2 << ")][-50% ([approx]" + << radius_b - radius_b * 0.5 << ")][-20% ([approx]" << radius_b - radius_b * 0.2 << ")][-10% ([approx]" << radius_b - radius_b * 0.1 << ")][-5% ([approx]" << radius_b - radius_b * 0.05 << ")]" + "[5% ([approx]" << radius_b + radius_b * 0.05 << ")][10% ([approx]" << radius_b + radius_b * 0.1 << ")][20% ([approx]" << radius_b + radius_b * 0.2 << ")][50% ([approx]" << radius_b + radius_b * 0.5 + << ")][100% ([approx]" << radius_b + radius_b << ")][500 ([approx]" << radius_b + radius_b * 5 << ")]]\n"; + std::cout << "[[bracket_and_solve_root][" + << elliptic_root_noderiv(radius_a, arc_length, radius_b / 6) + << "][" << elliptic_root_noderiv(radius_a, arc_length, radius_b / 2) + << "][" << elliptic_root_noderiv(radius_a, arc_length, radius_b - radius_b * 0.5) + << "][" << elliptic_root_noderiv(radius_a, arc_length, radius_b - radius_b * 0.2) + << "][" << elliptic_root_noderiv(radius_a, arc_length, radius_b - radius_b * 0.1) + << "][" << elliptic_root_noderiv(radius_a, arc_length, radius_b - radius_b * 0.05) + << "][" << elliptic_root_noderiv(radius_a, arc_length, radius_b + radius_b * 0.05) + << "][" << elliptic_root_noderiv(radius_a, arc_length, radius_b + radius_b * 0.1) + << "][" << elliptic_root_noderiv(radius_a, arc_length, radius_b + radius_b * 0.2) + << "][" << elliptic_root_noderiv(radius_a, arc_length, radius_b + radius_b * 0.5) + << "][" << elliptic_root_noderiv(radius_a, arc_length, radius_b + radius_b) + << "][" << elliptic_root_noderiv(radius_a, arc_length, radius_b + radius_b * 5) << "]]\n"; + + std::cout << "[[newton_iterate][" + << elliptic_root_1deriv(radius_a, arc_length, radius_b / 6) + << "][" << elliptic_root_1deriv(radius_a, arc_length, radius_b / 2) + << "][" << elliptic_root_1deriv(radius_a, arc_length, radius_b - radius_b * 0.5) + << "][" << elliptic_root_1deriv(radius_a, arc_length, radius_b - radius_b * 0.2) + << "][" << elliptic_root_1deriv(radius_a, arc_length, radius_b - radius_b * 0.1) + << "][" << elliptic_root_1deriv(radius_a, arc_length, radius_b - radius_b * 0.05) + << "][" << elliptic_root_1deriv(radius_a, arc_length, radius_b + radius_b * 0.05) + << "][" << elliptic_root_1deriv(radius_a, arc_length, radius_b + radius_b * 0.1) + << "][" << elliptic_root_1deriv(radius_a, arc_length, radius_b + radius_b * 0.2) + << "][" << elliptic_root_1deriv(radius_a, arc_length, radius_b + radius_b * 0.5) + << "][" << elliptic_root_1deriv(radius_a, arc_length, radius_b + radius_b) + << "][" << elliptic_root_1deriv(radius_a, arc_length, radius_b + radius_b * 5) << "]]\n"; + + std::cout << "[[halley_iterate][" + << elliptic_root_2deriv(radius_a, arc_length, radius_b / 6) + << "][" << elliptic_root_2deriv(radius_a, arc_length, radius_b / 2) + << "][" << elliptic_root_2deriv(radius_a, arc_length, radius_b - radius_b * 0.5) + << "][" << elliptic_root_2deriv(radius_a, arc_length, radius_b - radius_b * 0.2) + << "][" << elliptic_root_2deriv(radius_a, arc_length, radius_b - radius_b * 0.1) + << "][" << elliptic_root_2deriv(radius_a, arc_length, radius_b - radius_b * 0.05) + << "][" << elliptic_root_2deriv(radius_a, arc_length, radius_b + radius_b * 0.05) + << "][" << elliptic_root_2deriv(radius_a, arc_length, radius_b + radius_b * 0.1) + << "][" << elliptic_root_2deriv(radius_a, arc_length, radius_b + radius_b * 0.2) + << "][" << elliptic_root_2deriv(radius_a, arc_length, radius_b + radius_b * 0.5) + << "][" << elliptic_root_2deriv(radius_a, arc_length, radius_b + radius_b) + << "][" << elliptic_root_2deriv(radius_a, arc_length, radius_b + radius_b * 5) << "]]\n"; + + std::cout << "[[schr'''ö'''der_iterate][" + << elliptic_root_2deriv_s(radius_a, arc_length, radius_b / 6) + << "][" << elliptic_root_2deriv_s(radius_a, arc_length, radius_b / 2) + << "][" << elliptic_root_2deriv_s(radius_a, arc_length, radius_b - radius_b * 0.5) + << "][" << elliptic_root_2deriv_s(radius_a, arc_length, radius_b - radius_b * 0.2) + << "][" << elliptic_root_2deriv_s(radius_a, arc_length, radius_b - radius_b * 0.1) + << "][" << elliptic_root_2deriv_s(radius_a, arc_length, radius_b - radius_b * 0.05) + << "][" << elliptic_root_2deriv_s(radius_a, arc_length, radius_b + radius_b * 0.05) + << "][" << elliptic_root_2deriv_s(radius_a, arc_length, radius_b + radius_b * 0.1) + << "][" << elliptic_root_2deriv_s(radius_a, arc_length, radius_b + radius_b * 0.2) + << "][" << elliptic_root_2deriv_s(radius_a, arc_length, radius_b + radius_b * 0.5) + << "][" << elliptic_root_2deriv_s(radius_a, arc_length, radius_b + radius_b) + << "][" << elliptic_root_2deriv_s(radius_a, arc_length, radius_b + radius_b * 5) << "]]\n]\n\n"; + + return boost::exit_success; + } + catch(std::exception ex) + { + std::cout << "exception thrown: " << ex.what() << std::endl; + return boost::exit_failure; + } +} // int main() + diff --git a/src/boost/libs/math/example/root_n_finding_algorithms.cpp b/src/boost/libs/math/example/root_n_finding_algorithms.cpp new file mode 100644 index 00000000..032722e7 --- /dev/null +++ b/src/boost/libs/math/example/root_n_finding_algorithms.cpp @@ -0,0 +1,870 @@ +// Copyright Paul A. Bristow 2015 + +// 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) + +// Comparison of finding roots using TOMS748, Newton-Raphson, Halley & Schroder algorithms. +// root_n_finding_algorithms.cpp Generalised for nth root version. + +// http://en.wikipedia.org/wiki/Cube_root + +// Note that this file contains Quickbook mark-up as well as code +// and comments, don't change any of the special comment mark-ups! +// This program also writes files in Quickbook tables mark-up format. + +#include +#include +#include +#include +#include +#include + +//using boost::math::policies::policy; +//using boost::math::tools::eps_tolerance; // Binary functor for specified number of bits. +//using boost::math::tools::bracket_and_solve_root; +//using boost::math::tools::toms748_solve; +//using boost::math::tools::halley_iterate; +//using boost::math::tools::newton_raphson_iterate; +//using boost::math::tools::schroder_iterate; + +#include // For float_distance. +#include // For pow. +#include // for tuple and make_tuple. + +#include // is binary. +using boost::multiprecision::cpp_bin_float_100; +using boost::multiprecision::cpp_bin_float_50; + +#include +#include +#include + +// STL +#include +#include +#include +#include +#include +#include // std::ofstream +#include +#include // for type name using typid(thingy).name(); + +#ifdef __FILE__ + std::string sourcefilename = __FILE__; +#else + std::string sourcefilename(""); +#endif + + std::string chop_last(std::string s) + { + std::string::size_type pos = s.find_last_of("\\/"); + if(pos != std::string::npos) + s.erase(pos); + else if(s.empty()) + abort(); + else + s.erase(); + return s; + } + + std::string make_root() + { + std::string result; + if(sourcefilename.find_first_of(":") != std::string::npos) + { + result = chop_last(sourcefilename); // lose filename part + result = chop_last(result); // lose /example/ + result = chop_last(result); // lose /math/ + result = chop_last(result); // lose /libs/ + } + else + { + result = chop_last(sourcefilename); // lose filename part + if(result.empty()) + result = "."; + result += "/../../.."; + } + return result; + } + + std::string short_file_name(std::string s) + { + std::string::size_type pos = s.find_last_of("\\/"); + if(pos != std::string::npos) + s.erase(0, pos + 1); + return s; + } + + std::string boost_root = make_root(); + + +std::string fp_hardware; // Any hardware features like SEE or AVX + +const std::string roots_name = "libs/math/doc/roots/"; + +const std::string full_roots_name(boost_root + "/libs/math/doc/roots/"); + +const std::size_t nooftypes = 4; +const std::size_t noofalgos = 4; + +double digits_accuracy = 1.0; // 1 == maximum possible accuracy. + +std::stringstream ss; + +std::ofstream fout; + +std::vector algo_names = +{ + "TOMS748", "Newton", "Halley", "Schr'''ö'''der" +}; + +std::vector names = +{ + "float", "double", "long double", "cpp_bin_float50" +}; + +uintmax_t iters; // Global as value of iterations is not returned. + +struct root_info +{ // for a floating-point type, float, double ... + std::size_t max_digits10; // for type. + std::string full_typename; // for type from type_id.name(). + std::string short_typename; // for type "float", "double", "cpp_bin_float_50" .... + std::size_t bin_digits; // binary in floating-point type numeric_limits::digits; + int get_digits; // fraction of maximum possible accuracy required. + // = digits * digits_accuracy + // Vector of values (4) for each algorithm, TOMS748, Newton, Halley & Schroder. + //std::vector< boost::int_least64_t> times; converted to int. + std::vector times; // arbirary units (ticks). + //boost::int_least64_t min_time = std::numeric_limits::max(); // Used to normalize times (as int). + std::vector normed_times; + int min_time = (std::numeric_limits::max)(); // Used to normalize times. + std::vector iterations; + std::vector distances; + std::vector full_results; +}; // struct root_info + +std::vector root_infos; // One element for each floating-point type used. + +inline std::string build_test_name(const char* type_name, const char* test_name) +{ + std::string result(BOOST_COMPILER); + result += "|"; + result += BOOST_STDLIB; + result += "|"; + result += BOOST_PLATFORM; + result += "|"; + result += type_name; + result += "|"; + result += test_name; +#if defined(_DEBUG) || !defined(NDEBUG) + result += "|"; + result += " debug"; +#else + result += "|"; + result += " release"; +#endif + result += "|"; + return result; +} // std::string build_test_name + +// Algorithms ////////////////////////////////////////////// + +// No derivatives - using TOMS748 internally. + +template +struct nth_root_functor_noderiv +{ // Nth root of x using only function - no derivatives. + nth_root_functor_noderiv(T const& to_find_root_of) : a(to_find_root_of) + { // Constructor just stores value a to find root of. + } + T operator()(T const& x) + { + using boost::math::pow; + T fx = pow(x) -a; // Difference (estimate x^n - a). + return fx; + } +private: + T a; // to be 'cube_rooted'. +}; // template struct nth_root_functor_noderiv + +template +T nth_root_noderiv(T x) +{ // return Nth root of x using bracket_and_solve (using NO derivatives). + using namespace std; // Help ADL of std functions. + using namespace boost::math::tools; // For bracket_and_solve_root. + + typedef double guess_type; + + int exponent; + frexp(static_cast(x), &exponent); // Get exponent of z (ignore mantissa). + T guess = static_cast(ldexp(static_cast(1.), exponent / N)); // Rough guess is to divide the exponent by n. + //T min = static_cast(ldexp(static_cast(1.) / 2, exponent / N)); // Minimum possible value is half our guess. + //T max = static_cast(ldexp(static_cast(2.), exponent / N)); // Maximum possible value is twice our guess. + + T factor = 2; // How big steps to take when searching. + + const boost::uintmax_t maxit = 50; // Limit to maximum iterations. + boost::uintmax_t it = maxit; // Initally our chosen max iterations, but updated with actual. + bool is_rising = true; // So if result if guess^3 is too low, then try increasing guess. + // Some fraction of digits is used to control how accurate to try to make the result. + int get_digits = std::numeric_limits::digits - 2; + eps_tolerance tol(get_digits); // Set the tolerance. + std::pair r; + r = bracket_and_solve_root(nth_root_functor_noderiv(x), guess, factor, is_rising, tol, it); + iters = it; + T result = r.first + (r.second - r.first) / 2; // Midway between brackets. + return result; +} // template T nth_root_noderiv(T x) + +// Using 1st derivative only Newton-Raphson + +template +struct nth_root_functor_1deriv +{ // Functor also returning 1st derviative. + BOOST_STATIC_ASSERT_MSG(boost::is_integral::value == false, "Only floating-point type types can be used!"); + BOOST_STATIC_ASSERT_MSG((N > 0) == true, "root N must be > 0!"); + + nth_root_functor_1deriv(T const& to_find_root_of) : a(to_find_root_of) + { // Constructor stores value a to find root of, for example: + } + std::pair operator()(T const& x) + { // Return both f(x) and f'(x). + using boost::math::pow; // // Compile-time integral power. + T p = pow(x); + return std::make_pair(p * x - a, N * p); // 'return' both fx and dx. + } + +private: + T a; // to be 'nth_rooted'. +}; // struct nthroot__functor_1deriv + +template +T nth_root_1deriv(T x) +{ // return nth root of x using 1st derivative and Newton_Raphson. + using namespace std; // Help ADL of std functions. + using namespace boost::math::tools; // For newton_raphson_iterate. + + BOOST_STATIC_ASSERT_MSG(boost::is_integral::value == false, "Only floating-point type types can be used!"); + BOOST_STATIC_ASSERT_MSG((N > 0) == true, "root N must be > 0!"); + BOOST_STATIC_ASSERT_MSG((N > 1000) == false, "root N is too big!"); + + typedef double guess_type; + + int exponent; + frexp(static_cast(x), &exponent); // Get exponent of z (ignore mantissa). + T guess = static_cast(ldexp(static_cast(1.), exponent / N)); // Rough guess is to divide the exponent by n. + T min = static_cast(ldexp(static_cast(1.) / 2, exponent / N)); // Minimum possible value is half our guess. + T max = static_cast(ldexp(static_cast(2.), exponent / N)); // Maximum possible value is twice our guess. + + int digits = std::numeric_limits::digits; // Maximum possible binary digits accuracy for type T. + int get_digits = static_cast(digits * 0.6); + const boost::uintmax_t maxit = 20; + boost::uintmax_t it = maxit; + T result = newton_raphson_iterate(nth_root_functor_1deriv(x), guess, min, max, get_digits, it); + iters = it; + return result; +} // T nth_root_1_deriv Newton-Raphson + +// Using 1st and 2nd derivatives with Halley algorithm. + +template +struct nth_root_functor_2deriv +{ // Functor returning both 1st and 2nd derivatives. + BOOST_STATIC_ASSERT_MSG(boost::is_integral::value == false, "Only floating-point type types can be used!"); + BOOST_STATIC_ASSERT_MSG((N > 0) == true, "root N must be > 0!"); + + nth_root_functor_2deriv(T const& to_find_root_of) : a(to_find_root_of) + { // Constructor stores value a to find root of, for example: + } + + // using boost::math::tuple; // to return three values. + std::tuple operator()(T const& x) + { // Return f(x), f'(x) and f''(x). + using boost::math::pow; // Compile-time integral power. + T p = pow(x); + + return std::make_tuple(p * x * x - a, p * x * N, p * N * (N - 1)); // 'return' fx, dx and d2x. + } +private: + T a; // to be 'nth_rooted'. +}; + +template +T nth_root_2deriv(T x) +{ // return nth root of x using 1st and 2nd derivatives and Halley. + + using namespace std; // Help ADL of std functions. + using namespace boost::math::tools; // For halley_iterate. + + BOOST_STATIC_ASSERT_MSG(boost::is_integral::value == false, "Only floating-point type types can be used!"); + BOOST_STATIC_ASSERT_MSG((N > 0) == true, "root N must be > 0!"); + BOOST_STATIC_ASSERT_MSG((N > 1000) == false, "root N is too big!"); + + typedef double guess_type; + + int exponent; + frexp(static_cast(x), &exponent); // Get exponent of z (ignore mantissa). + T guess = static_cast(ldexp(static_cast(1.), exponent / N)); // Rough guess is to divide the exponent by n. + T min = static_cast(ldexp(static_cast(1.) / 2, exponent / N)); // Minimum possible value is half our guess. + T max = static_cast(ldexp(static_cast(2.), exponent / N)); // Maximum possible value is twice our guess. + + int digits = std::numeric_limits::digits; // Maximum possible binary digits accuracy for type T. + int get_digits = static_cast(digits * 0.4); + const boost::uintmax_t maxit = 20; + boost::uintmax_t it = maxit; + T result = halley_iterate(nth_root_functor_2deriv(x), guess, min, max, get_digits, it); + iters = it; + + return result; +} // nth_2deriv Halley + +template +T nth_root_2deriv_s(T x) +{ // return nth root of x using 1st and 2nd derivatives and Schroder. + + using namespace std; // Help ADL of std functions. + using namespace boost::math::tools; // For schroder_iterate. + + BOOST_STATIC_ASSERT_MSG(boost::is_integral::value == false, "Only floating-point type types can be used!"); + BOOST_STATIC_ASSERT_MSG((N > 0) == true, "root N must be > 0!"); + BOOST_STATIC_ASSERT_MSG((N > 1000) == false, "root N is too big!"); + + typedef double guess_type; + + int exponent; + frexp(static_cast(x), &exponent); // Get exponent of z (ignore mantissa). + T guess = static_cast(ldexp(static_cast(1.), exponent / N)); // Rough guess is to divide the exponent by n. + T min = static_cast(ldexp(static_cast(1.) / 2, exponent / N)); // Minimum possible value is half our guess. + T max = static_cast(ldexp(static_cast(2.), exponent / N)); // Maximum possible value is twice our guess. + + int get_digits = static_cast(std::numeric_limits::digits * 0.4); + const boost::uintmax_t maxit = 20; + boost::uintmax_t it = maxit; + T result = schroder_iterate(nth_root_functor_2deriv(x), guess, min, max, get_digits, it); + iters = it; + + return result; +} // T nth_root_2deriv_s Schroder + +//////////////////////////////////////////////////////// end of algorithms - perhaps in a separate .hpp? + +//! Print 4 floating-point types info: max_digits10, digits and required accuracy digits as a Quickbook table. +int table_type_info(double digits_accuracy) +{ + std::string qbk_name = full_roots_name; // Prefix by boost_root file. + + qbk_name += "type_info_table"; + std::stringstream ss; + ss.precision(3); + ss << "_" << digits_accuracy * 100; + qbk_name += ss.str(); + +#ifdef _MSC_VER + qbk_name += "_msvc.qbk"; +#else // assume GCC + qbk_name += "_gcc.qbk"; +#endif + + // Example: type_info_table_100_msvc.qbk + fout.open(qbk_name, std::ios_base::out); + + if (fout.is_open()) + { + std::cout << "Output type table to " << qbk_name << std::endl; + } + else + { // Failed to open. + std::cout << " Open file " << qbk_name << " for output failed!" << std::endl; + std::cout << "errno " << errno << std::endl; + return errno; + } + + fout << + "[/" + << qbk_name + << "\n" + "Copyright 2015 Paul A. Bristow.""\n" + "Copyright 2015 John Maddock.""\n" + "Distributed under the Boost Software License, Version 1.0.""\n" + "(See accompanying file LICENSE_1_0.txt or copy at""\n" + "http://www.boost.org/LICENSE_1_0.txt).""\n" + "]""\n" + << std::endl; + + fout << "[h6 Fraction of maximum possible bits of accuracy required is " << digits_accuracy << ".]\n" << std::endl; + + std::string table_id("type_info"); + table_id += ss.str(); // Fraction digits accuracy. + +#ifdef _MSC_VER + table_id += "_msvc"; +#else // assume GCC + table_id += "_gcc"; +#endif + + fout << "[table:" << table_id << " Digits for float, double, long double and cpp_bin_float_50\n" + << "[[type name] [max_digits10] [binary digits] [required digits]]\n";// header. + + // For all fout types: + + fout << "[[" << "float" << "]" + << "[" << std::numeric_limits::max_digits10 << "]" // max_digits10 + << "[" << std::numeric_limits::digits << "]"// < "Binary digits + << "[" << static_cast(std::numeric_limits::digits * digits_accuracy) << "]]\n"; // Accuracy digits. + + fout << "[[" << "float" << "]" + << "[" << std::numeric_limits::max_digits10 << "]" // max_digits10 + << "[" << std::numeric_limits::digits << "]"// < "Binary digits + << "[" << static_cast(std::numeric_limits::digits * digits_accuracy) << "]]\n"; // Accuracy digits. + + fout << "[[" << "long double" << "]" + << "[" << std::numeric_limits::max_digits10 << "]" // max_digits10 + << "[" << std::numeric_limits::digits << "]"// < "Binary digits + << "[" << static_cast(std::numeric_limits::digits * digits_accuracy) << "]]\n"; // Accuracy digits. + + fout << "[[" << "cpp_bin_float_50" << "]" + << "[" << std::numeric_limits::max_digits10 << "]" // max_digits10 + << "[" << std::numeric_limits::digits << "]"// < "Binary digits + << "[" << static_cast(std::numeric_limits::digits * digits_accuracy) << "]]\n"; // Accuracy digits. + + fout << "] [/table table_id_msvc] \n" << std::endl; // End of table. + + fout.close(); + return 0; +} // type_table + +//! Evaluate root N timing for each algorithm, and for one floating-point type T. +template +int test_root(cpp_bin_float_100 big_value, cpp_bin_float_100 answer, const char* type_name, std::size_t type_no) +{ + std::size_t max_digits = 2 + std::numeric_limits::digits * 3010 / 10000; + // For new versions use max_digits10 + // std::cout.precision(std::numeric_limits::max_digits10); + std::cout.precision(max_digits); + std::cout << std::showpoint << std::endl; // Show trailing zeros too. + + root_infos.push_back(root_info()); + + root_infos[type_no].max_digits10 = max_digits; + root_infos[type_no].full_typename = typeid(T).name(); // Full typename. + root_infos[type_no].short_typename = type_name; // Short typename. + root_infos[type_no].bin_digits = std::numeric_limits::digits; + root_infos[type_no].get_digits = static_cast(std::numeric_limits::digits * digits_accuracy); + + T to_root = static_cast(big_value); + + T result; // root + T sum = 0; + T ans = static_cast(answer); + + using boost::timer::nanosecond_type; + using boost::timer::cpu_times; + using boost::timer::cpu_timer; + + int eval_count = boost::is_floating_point::value ? 10000000 : 100000; // To give a sufficiently stable timing for the fast built-in types, + //int eval_count = 1000000; // To give a sufficiently stable timing for the fast built-in types, + // This takes an inconveniently long time for multiprecision cpp_bin_float_50 etc types. + + cpu_times now; // Holds wall, user and system times. + + { // Evaluate times etc for each algorithm. + //algorithm_names.push_back("TOMS748"); // + cpu_timer ti; // Can start, pause, resume and stop, and read elapsed. + ti.start(); + for (long i = 0; i < eval_count; ++i) + { + result = nth_root_noderiv(to_root); // + sum += result; + } + now = ti.elapsed(); + int time = static_cast(now.user / eval_count); + root_infos[type_no].times.push_back(time); // CPU time taken. + if (time < root_infos[type_no].min_time) + { + root_infos[type_no].min_time = time; + } + ti.stop(); + long int distance = static_cast(boost::math::float_distance(result, ans)); + root_infos[type_no].distances.push_back(distance); + root_infos[type_no].iterations.push_back(iters); // + root_infos[type_no].full_results.push_back(result); + } + { + // algorithm_names.push_back("Newton"); // algorithm + cpu_timer ti; // Can start, pause, resume and stop, and read elapsed. + ti.start(); + for (long i = 0; i < eval_count; ++i) + { + result = nth_root_1deriv(to_root); // + sum += result; + } + now = ti.elapsed(); + int time = static_cast(now.user / eval_count); + root_infos[type_no].times.push_back(time); // CPU time taken. + if (time < root_infos[type_no].min_time) + { + root_infos[type_no].min_time = time; + } + + ti.stop(); + long int distance = static_cast(boost::math::float_distance(result, ans)); + root_infos[type_no].distances.push_back(distance); + root_infos[type_no].iterations.push_back(iters); // + root_infos[type_no].full_results.push_back(result); + } + { + //algorithm_names.push_back("Halley"); // algorithm + cpu_timer ti; // Can start, pause, resume and stop, and read elapsed. + ti.start(); + for (long i = 0; i < eval_count; ++i) + { + result = nth_root_2deriv(to_root); // + sum += result; + } + now = ti.elapsed(); + int time = static_cast(now.user / eval_count); + root_infos[type_no].times.push_back(time); // CPU time taken. + ti.stop(); + if (time < root_infos[type_no].min_time) + { + root_infos[type_no].min_time = time; + } + long int distance = static_cast(boost::math::float_distance(result, ans)); + root_infos[type_no].distances.push_back(distance); + root_infos[type_no].iterations.push_back(iters); // + root_infos[type_no].full_results.push_back(result); + } + { + // algorithm_names.push_back("Schroder"); // algorithm + cpu_timer ti; // Can start, pause, resume and stop, and read elapsed. + ti.start(); + for (long i = 0; i < eval_count; ++i) + { + result = nth_root_2deriv_s(to_root); // + sum += result; + } + now = ti.elapsed(); + int time = static_cast(now.user / eval_count); + root_infos[type_no].times.push_back(time); // CPU time taken. + if (time < root_infos[type_no].min_time) + { + root_infos[type_no].min_time = time; + } + ti.stop(); + long int distance = static_cast(boost::math::float_distance(result, ans)); + root_infos[type_no].distances.push_back(distance); + root_infos[type_no].iterations.push_back(iters); // + root_infos[type_no].full_results.push_back(result); + } + for (size_t i = 0; i != root_infos[type_no].times.size(); i++) // For each time. + { // Normalize times. + root_infos[type_no].normed_times.push_back(static_cast(root_infos[type_no].times[i]) / root_infos[type_no].min_time); + } + + std::cout << "Accumulated result was: " << sum << std::endl; + + return 4; // eval_count of how many algorithms used. +} // test_root + +/*! Fill array of times, interations, etc for Nth root for all 4 types, + and write a table of results in Quickbook format. + */ +template +void table_root_info(cpp_bin_float_100 full_value) +{ + using std::abs; + std::cout << nooftypes << " floating-point types tested:" << std::endl; +#if defined(_DEBUG) || !defined(NDEBUG) + std::cout << "Compiled in debug mode." << std::endl; +#else + std::cout << "Compiled in optimise mode." << std::endl; +#endif + std::cout << "FP hardware " << fp_hardware << std::endl; + // Compute the 'right' answer for root N at 100 decimal digits. + cpp_bin_float_100 full_answer = nth_root_noderiv(full_value); + + root_infos.clear(); // Erase any previous data. + // Fill the elements of the array for each floating-point type. + + test_root(full_value, full_answer, "float", 0); + test_root(full_value, full_answer, "double", 1); + test_root(full_value, full_answer, "long double", 2); + test_root(full_value, full_answer, "cpp_bin_float_50", 3); + + // Use info from 4 floating point types to + + // Prepare Quickbook table for a single root + // with columns of times, iterations, distances repeated for various floating-point types, + // and 4 rows for each algorithm. + + std::stringstream table_info; + table_info.precision(3); + table_info << "[table:root_" << N << " " << N << "th root(" << static_cast(full_value) << ") for float, double, long double and cpp_bin_float_50 types"; + if (fp_hardware != "") + { + table_info << ", using " << fp_hardware; + } + table_info << std::endl; + + fout << table_info.str() + << "[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]\n" + << "[[Algo ]"; + for (size_t tp = 0; tp != nooftypes; tp++) + { // For all types: + fout << "[Its]" << "[Times]" << "[Norm]" << "[Dis]" << "[ ]"; + } + fout << "]" << std::endl; + + // Row for all algorithms. + for (std::size_t algo = 0; algo != noofalgos; algo++) + { + fout << "[[" << std::left << std::setw(9) << algo_names[algo] << "]"; + for (size_t tp = 0; tp != nooftypes; tp++) + { // For all types: + fout + << "[" << std::right << std::showpoint + << std::setw(3) << std::setprecision(2) << root_infos[tp].iterations[algo] << "][" + << std::setw(5) << std::setprecision(5) << root_infos[tp].times[algo] << "]["; + fout << std::setw(3) << std::setprecision(3); + double normed_time = root_infos[tp].normed_times[algo]; + if (abs(normed_time - 1.00) <= 0.05) + { // At or near the best time, so show as blue. + fout << "[role blue " << normed_time << "]"; + } + else if (abs(normed_time) > 4.) + { // markedly poor so show as red. + fout << "[role red " << normed_time << "]"; + } + else + { // Not the best, so normal black. + fout << normed_time; + } + fout << "][" + << std::setw(3) << std::setprecision(2) << root_infos[tp].distances[algo] << "][ ]"; + } // tp + fout << "]" << std::endl; + } // for algo + fout << "] [/end of table root]\n"; +} // void table_root_info + +/*! Output program header, table of type info, and tables for 4 algorithms and 4 floating-point types, + for Nth root required digits_accuracy. + */ + +int roots_tables(cpp_bin_float_100 full_value, double digits_accuracy) +{ + ::digits_accuracy = digits_accuracy; + // Save globally so that it is available to root-finding algorithms. Ugly :-( + +#if defined(_DEBUG) || !defined(NDEBUG) + std::string debug_or_optimize("Compiled in debug mode."); +#else + std::string debug_or_optimize("Compiled in optimise mode."); +#endif + + // Create filename for roots_table + std::string qbk_name = full_roots_name; + qbk_name += "roots_table"; + + std::stringstream ss; + ss.precision(3); + // ss << "_" << N // now put all the tables in one .qbk file? + ss << "_" << digits_accuracy * 100 + << std::flush; + // Assume only save optimize mode runs, so don't add any _DEBUG info. + qbk_name += ss.str(); + +#ifdef _MSC_VER + qbk_name += "_msvc"; +#else // assume GCC + qbk_name += "_gcc"; +#endif + if (fp_hardware != "") + { + qbk_name += fp_hardware; + } + qbk_name += ".qbk"; + + fout.open(qbk_name, std::ios_base::out); + + if (fout.is_open()) + { + std::cout << "Output root table to " << qbk_name << std::endl; + } + else + { // Failed to open. + std::cout << " Open file " << qbk_name << " for output failed!" << std::endl; + std::cout << "errno " << errno << std::endl; + return errno; + } + + fout << + "[/" + << qbk_name + << "\n" + "Copyright 2015 Paul A. Bristow.""\n" + "Copyright 2015 John Maddock.""\n" + "Distributed under the Boost Software License, Version 1.0.""\n" + "(See accompanying file LICENSE_1_0.txt or copy at""\n" + "http://www.boost.org/LICENSE_1_0.txt).""\n" + "]""\n" + << std::endl; + + // Print out the program/compiler/stdlib/platform names as a Quickbook comment: + fout << "\n[h6 Program " << sourcefilename << ",\n " + << BOOST_COMPILER << ", " + << BOOST_STDLIB << ", " + << BOOST_PLATFORM << "\n" + << debug_or_optimize + << ((fp_hardware != "") ? ", " + fp_hardware : "") + << "]" // [h6 close]. + << std::endl; + + fout << "Fraction of full accuracy " << digits_accuracy << std::endl; + + table_root_info<5>(full_value); + table_root_info<7>(full_value); + table_root_info<11>(full_value); + + fout.close(); + + // table_type_info(digits_accuracy); + + return 0; +} // roots_tables + + +int main() +{ + using namespace boost::multiprecision; + using namespace boost::math; + + + try + { + std::cout << "Tests run with " << BOOST_COMPILER << ", " + << BOOST_STDLIB << ", " << BOOST_PLATFORM << ", "; + +// How to: Configure Visual C++ Projects to Target 64-Bit Platforms +// https://msdn.microsoft.com/en-us/library/9yb4317s.aspx + +#ifdef _M_X64 // Defined for compilations that target x64 processors. + std::cout << "X64 " << std::endl; + fp_hardware += "_X64"; +#else +# ifdef _M_IX86 + std::cout << "X32 " << std::endl; + fp_hardware += "_X86"; +# endif +#endif + +#ifdef _M_AMD64 + std::cout << "AMD64 " << std::endl; + // fp_hardware += "_AMD64"; +#endif + +// https://msdn.microsoft.com/en-us/library/7t5yh4fd.aspx +// /arch (x86) options /arch:[IA32|SSE|SSE2|AVX|AVX2] +// default is to use SSE and SSE2 instructions by default. +// https://msdn.microsoft.com/en-us/library/jj620901.aspx +// /arch (x64) options /arch:AVX and /arch:AVX2 + +// MSVC doesn't bother to set these SSE macros! +// http://stackoverflow.com/questions/18563978/sse-sse2-is-enabled-control-in-visual-studio +// https://msdn.microsoft.com/en-us/library/b0084kay.aspx predefined macros. + +// But some of these macros are *not* defined by MSVC, +// unlike AVX (but *are* defined by GCC and Clang). +// So the macro code above does define them. +#if (defined(_M_AMD64) || defined (_M_X64)) +#ifndef _M_X64 +# define _M_X64 +#endif +#ifndef __SSE2__ +# define __SSE2__ +#endif +#else +# ifdef _M_IX86_FP // Expands to an integer literal value indicating which /arch compiler option was used: + std::cout << "Floating-point _M_IX86_FP = " << _M_IX86_FP << std::endl; +# if (_M_IX86_FP == 2) // 2 if /arch:SSE2, /arch:AVX or /arch:AVX2 +# define __SSE2__ // x32 +# elif (_M_IX86_FP == 1) // 1 if /arch:SSE was used. +# define __SSE__ // x32 +# elif (_M_IX86_FP == 0) // 0 if /arch:IA32 was used. +# define _X32 // No special FP instructions. +# endif +# endif +#endif +// Set the fp_hardware that is used in the .qbk filename. +#ifdef __AVX2__ + std::cout << "Floating-point AVX2 " << std::endl; + fp_hardware += "_AVX2"; +# else +# ifdef __AVX__ + std::cout << "Floating-point AVX " << std::endl; + fp_hardware += "_AVX"; +# else +# ifdef __SSE2__ + std::cout << "Floating-point SSE2 " << std::endl; + fp_hardware += "_SSE2"; +# else +# ifdef __SSE__ + std::cout << "Floating-point SSE " << std::endl; + fp_hardware += "_SSE"; +# endif +# endif +# endif +# endif + +#ifdef _M_IX86 + std::cout << "Floating-point X86 _M_IX86 = " << _M_IX86 << std::endl; + // https://msdn.microsoft.com/en-us/library/aa273918%28v=vs.60%29.aspx#_predir_table_1..3 + // 600 = Pentium Pro +#endif + +#ifdef _MSC_FULL_VER + std::cout << "Floating-point _MSC_FULL_VER " << _MSC_FULL_VER << std::endl; +#endif + +#ifdef __MSVC_RUNTIME_CHECKS + std::cout << "Runtime __MSVC_RUNTIME_CHECKS " << std::endl; +#endif + + BOOST_MATH_CONTROL_FP; + + cpp_bin_float_100 full_value("28."); + // Compute full answer to more than precision of tests. + //T value = 28.; // integer (exactly representable as floating-point) + // whose cube root is *not* exactly representable. + // Wolfram Alpha command N[28 ^ (1 / 3), 100] computes cube root to 100 decimal digits. + // 3.036588971875662519420809578505669635581453977248111123242141654169177268411884961770250390838097895 + + std::cout.precision(100); + std::cout << "value " << full_value << std::endl; + // std::cout << ",\n""answer = " << full_answer << std::endl; + std::cout.precision(6); + // cbrt cpp_bin_float_100 full_answer("3.036588971875662519420809578505669635581453977248111123242141654169177268411884961770250390838097895"); + + // Output the table of types, maxdigits10 and digits and required digits for some accuracies. + + // Output tables for some roots at full accuracy. + roots_tables(full_value, 1.); + + // Output tables for some roots at less accuracy. + //roots_tables(full_value, 0.75); + + return boost::exit_success; + } + catch (std::exception const& ex) + { + std::cout << "exception thrown: " << ex.what() << std::endl; + return boost::exit_failure; + } +} // int main() + +/* + +*/ diff --git a/src/boost/libs/math/example/series.cpp b/src/boost/libs/math/example/series.cpp new file mode 100644 index 00000000..8bfce824 --- /dev/null +++ b/src/boost/libs/math/example/series.cpp @@ -0,0 +1,107 @@ +// (C) Copyright John Maddock 2018. +// 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 + +//[series_log1p +template +struct log1p_series +{ + // we must define a result_type typedef: + typedef T result_type; + + log1p_series(T x) + : k(0), m_mult(-x), m_prod(-1) {} + + T operator()() + { + // This is the function operator invoked by the summation + // algorithm, the first call to this operator should return + // the first term of the series, the second call the second + // term and so on. + m_prod *= m_mult; + return m_prod / ++k; + } + +private: + int k; + const T m_mult; + T m_prod; +}; +//] + +//[series_log1p_func +template +T log1p(T x) +{ + // We really should add some error checking on x here! + BOOST_ASSERT(std::fabs(x) < 1); + + // Construct the series functor: + log1p_series s(x); + // Set a limit on how many iterations we permit: + boost::uintmax_t max_iter = 1000; + // Add it up, with enough precision for full machine precision: + return boost::math::tools::sum_series(s, std::numeric_limits::epsilon(), max_iter); +} +//] + +//[series_clog1p_func +template +struct log1p_series > +{ + // we must define a result_type typedef: + typedef std::complex result_type; + + log1p_series(std::complex x) + : k(0), m_mult(-x), m_prod(-1) {} + + std::complex operator()() + { + // This is the function operator invoked by the summation + // algorithm, the first call to this operator should return + // the first term of the series, the second call the second + // term and so on. + m_prod *= m_mult; + return m_prod / T(++k); + } + +private: + int k; + const std::complex m_mult; + std::complex m_prod; +}; + + +template +std::complex log1p(std::complex x) +{ + // We really should add some error checking on x here! + BOOST_ASSERT(abs(x) < 1); + + // Construct the series functor: + log1p_series > s(x); + // Set a limit on how many iterations we permit: + boost::uintmax_t max_iter = 1000; + // Add it up, with enough precision for full machine precision: + return boost::math::tools::sum_series(s, std::complex(std::numeric_limits::epsilon()), max_iter); +} +//] + +int main() +{ + using namespace boost::math::tools; + + std::cout << log1p(0.25) << std::endl; + + std::cout << log1p(std::complex(0.25, 0.25)) << std::endl; + + return 0; +} diff --git a/src/boost/libs/math/example/sines.hpp b/src/boost/libs/math/example/sines.hpp new file mode 100644 index 00000000..d4cbbbbf --- /dev/null +++ b/src/boost/libs/math/example/sines.hpp @@ -0,0 +1,47 @@ +// 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) + +// Copyright A N Other, 2019. + +// Table of 32 values with 50 decimal digits precision, +// generated by program fft_sines_table.cpp. + +#include // std::array + +static const std::array sines = +{{ + 1, + 0.70710678118654752440084436210484903928483593768847, + 0.38268343236508977172845998403039886676134456248563, + 0.19509032201612826784828486847702224092769161775195, + 0.098017140329560601994195563888641845861136673167501, + 0.049067674327418014254954976942682658314745363025753, + 0.024541228522912288031734529459282925065466119239452, + 0.012271538285719926079408261951003212140372319591769, + 0.0061358846491544753596402345903725809170578863173913, + 0.003067956762965976270145365490919842518944610213452, + 0.0015339801862847656123036971502640790799548645752374, + 0.00076699031874270452693856835794857664314091945206328, + 0.00038349518757139558907246168118138126339502603496474, + 0.00019174759731070330743990956198900093346887403385916, + 9.5873799095977345870517210976476351187065612851145e-05, + 4.7936899603066884549003990494658872746866687685767e-05, + 2.3968449808418218729186577165021820094761474895673e-05, + 1.1984224905069706421521561596988984804731977538387e-05, + 5.9921124526424278428797118088908617299871778780951e-06, + 2.9960562263346607504548128083570598118251878683408e-06, + 1.4980281131690112288542788461553611206917585861527e-06, + 7.4901405658471572113049856673065563715595930217207e-07, + 3.7450702829238412390316917908463317739740476297248e-07, + 1.8725351414619534486882457659356361712045272098286e-07, + 9.3626757073098082799067286680885620193236507169473e-08, + 4.681337853654909269511551813854009695950362701667e-08, + 2.3406689268274552759505493419034844037886207223779e-08, + 1.1703344634137277181246213503238103798093456639976e-08, + 5.8516723170686386908097901008341396943900085051756e-09, + 2.9258361585343193579282304690689559020175857150074e-09, + 1.4629180792671596805295321618659637103742615227834e-09, + 7.3145903963357984046044319684941757518633453150407e-10 +}}; // array sines diff --git a/src/boost/libs/math/example/skew_normal_example.cpp b/src/boost/libs/math/example/skew_normal_example.cpp new file mode 100644 index 00000000..5858aff3 --- /dev/null +++ b/src/boost/libs/math/example/skew_normal_example.cpp @@ -0,0 +1,275 @@ +// Copyright Benjamin Sobotta 2012 + +// 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) + + +#ifdef _MSC_VER +# pragma warning (disable : 4512) // assignment operator could not be generated +# pragma warning (disable : 4127) // conditional expression is constant. +#endif + +#include +using boost::math::skew_normal_distribution; +using boost::math::skew_normal; +#include +#include +#include + +void check(const double loc, const double sc, const double sh, + const double * const cumulants, const std::pair qu, + const double x, const double tpdf, const double tcdf) +{ + using namespace boost::math; + + skew_normal D(loc, sc, sh); + + const double sk = cumulants[2] / (std::pow(cumulants[1], 1.5)); + const double kt = cumulants[3] / (cumulants[1] * cumulants[1]); + + // checks against tabulated values + std::cout << "mean: table=" << cumulants[0] << "\tcompute=" << mean(D) << "\tdiff=" << fabs(cumulants[0]-mean(D)) << std::endl; + std::cout << "var: table=" << cumulants[1] << "\tcompute=" << variance(D) << "\tdiff=" << fabs(cumulants[1]-variance(D)) << std::endl; + std::cout << "skew: table=" << sk << "\tcompute=" << skewness(D) << "\tdiff=" << fabs(sk-skewness(D)) << std::endl; + std::cout << "kur.: table=" << kt << "\tcompute=" << kurtosis_excess(D) << "\tdiff=" << fabs(kt-kurtosis_excess(D)) << std::endl; + std::cout << "mode: table=" << "N/A" << "\tcompute=" << mode(D) << "\tdiff=" << "N/A" << std::endl; + + const double q = quantile(D, qu.first); + const double cq = quantile(complement(D, qu.first)); + + std::cout << "quantile(" << qu.first << "): table=" << qu.second << "\tcompute=" << q << "\tdiff=" << fabs(qu.second-q) << std::endl; + + // consistency + std::cout << "cdf(quantile)=" << cdf(D, q) << "\tp=" << qu.first << "\tdiff=" << fabs(qu.first-cdf(D, q)) << std::endl; + std::cout << "ccdf(cquantile)=" << cdf(complement(D,cq)) << "\tp=" << qu.first << "\tdiff=" << fabs(qu.first-cdf(complement(D,cq))) << std::endl; + + // PDF & CDF + std::cout << "pdf(" << x << "): table=" << tpdf << "\tcompute=" << pdf(D,x) << "\tdiff=" << fabs(tpdf-pdf(D,x)) << std::endl; + std::cout << "cdf(" << x << "): table=" << tcdf << "\tcompute=" << cdf(D,x) << "\tdiff=" << fabs(tcdf-cdf(D,x)) << std::endl; + std::cout << "================================\n"; +} + +int main() +{ + using namespace boost::math; + + double sc = 0.0,loc,sh,x,dsn,qsn,psn,p; + std::cout << std::setprecision(20); + + double cumulants[4]; + + + /* R: + > install.packages("sn") + Warning in install.packages("sn") : + 'lib = "/usr/lib64/R/library"' is not writable + Would you like to create a personal library + '~/R/x86_64-unknown-linux-gnu-library/2.12' + to install packages into? (y/n) y + --- Please select a CRAN mirror for use in this session --- + Loading Tcl/Tk interface ... done + also installing the dependency mnormt + + trying URL 'http://mirrors.dotsrc.org/cran/src/contrib/mnormt_1.4-5.tar.gz' + Content type 'application/x-gzip' length 34049 bytes (33 Kb) + opened URL + ================================================== + downloaded 33 Kb + + trying URL 'http://mirrors.dotsrc.org/cran/src/contrib/sn_0.4-17.tar.gz' + Content type 'application/x-gzip' length 65451 bytes (63 Kb) + opened URL + ================================================== + downloaded 63 Kb + + + > library(sn) + > options(digits=22) + + + > sn.cumulants(1.1, 2.2, -3.3) + [1] -0.5799089925398568 2.0179057767837230 -2.0347951542374196 + [4] 2.2553488991015072 + > qsn(0.3, 1.1, 2.2, -3.3) + [1] -1.180104068086876 + > psn(0.4, 1.1, 2.2, -3.3) + [1] 0.733918618927874 + > dsn(0.4, 1.1, 2.2, -3.3) + [1] 0.2941401101565995 + + */ + + //1 st + loc = 1.1; sc = 2.2; sh = -3.3; + std::cout << "location: " << loc << "\tscale: " << sc << "\tshape: " << sh << std::endl; + cumulants[0] = -0.5799089925398568; + cumulants[1] = 2.0179057767837230; + cumulants[2] = -2.0347951542374196; + cumulants[3] = 2.2553488991015072; + x = 0.4; + p = 0.3; + qsn = -1.180104068086876; + psn = 0.733918618927874; + dsn = 0.2941401101565995; + + check(loc, sc, sh, cumulants, std::make_pair(p,qsn), x, dsn, psn); + + /* R: + + > sn.cumulants(1.1, .02, .03) + [1] 1.1004785154529559e+00 3.9977102296128255e-04 4.7027439329779991e-11 + [4] 1.4847542790693825e-14 + > qsn(0.01, 1.1, .02, .03) + [1] 1.053964962950150 + > psn(1.3, 1.1, .02, .03) + [1] 1 + > dsn(1.3, 1.1, .02, .03) + [1] 4.754580380601393e-21 + + */ + + // 2nd + loc = 1.1; sc = .02; sh = .03; + std::cout << "location: " << loc << "\tscale: " << sc << "\tshape: " << sh << std::endl; + cumulants[0] = 1.1004785154529559e+00; + cumulants[1] = 3.9977102296128255e-04; + cumulants[2] = 4.7027439329779991e-11; + cumulants[3] = 1.4847542790693825e-14; + x = 1.3; + p = 0.01; + qsn = 1.053964962950150; + psn = 1; + dsn = 4.754580380601393e-21; + + check(loc, sc, sh, cumulants, std::make_pair(p,qsn), x, dsn, psn); + + /* R: + + > sn.cumulants(10.1, 5, -.03) + [1] 9.980371136761052e+00 2.498568893508016e+01 -7.348037395278123e-04 + [4] 5.799821402614775e-05 + > qsn(.8, 10.1, 5, -.03) + [1] 14.18727407491953 + > psn(-1.3, 10.1, 5, -.03) + [1] 0.01201290665838824 + > dsn(-1.3, 10.1, 5, -.03) + [1] 0.006254346348897927 + + + */ + + // 3rd + loc = 10.1; sc = 5; sh = -.03; + std::cout << "location: " << loc << "\tscale: " << sc << "\tshape: " << sh << std::endl; + cumulants[0] = 9.980371136761052e+00; + cumulants[1] = 2.498568893508016e+01; + cumulants[2] = -7.348037395278123e-04; + cumulants[3] = 5.799821402614775e-05; + x = -1.3; + p = 0.8; + qsn = 14.18727407491953; + psn = 0.01201290665838824; + dsn = 0.006254346348897927; + + check(loc, sc, sh, cumulants, std::make_pair(p,qsn), x, dsn, psn); + + + /* R: + + > sn.cumulants(-10.1, 5, 30) + [1] -6.112791696741384 9.102169946425548 27.206345266148194 71.572537838642916 + > qsn(.8, -10.1, 5, 30) + [1] -3.692242172277 + > psn(-1.3, -10.1, 5, 30) + [1] 0.921592193425035 + > dsn(-1.3, -10.1, 5, 30) + [1] 0.0339105445232089 + + */ + + // 4th + loc = -10.1; sc = 5; sh = 30; + std::cout << "location: " << loc << "\tscale: " << sc << "\tshape: " << sh << std::endl; + cumulants[0] = -6.112791696741384; + cumulants[1] = 9.102169946425548; + cumulants[2] = 27.206345266148194; + cumulants[3] = 71.572537838642916; + x = -1.3; + p = 0.8; + qsn = -3.692242172277; + psn = 0.921592193425035; + dsn = 0.0339105445232089; + + check(loc, sc, sh, cumulants, std::make_pair(p,qsn), x, dsn, psn); + + + /* R: + + > sn.cumulants(0,1,5) + [1] 0.7823901817554269 0.3878656034927102 0.2055576317962637 0.1061119471655128 + > qsn(0.5,0,1,5) + [1] 0.674471117502844 + > psn(-0.5, 0,1,5) + [1] 0.0002731513884140924 + > dsn(-0.5, 0,1,5) + [1] 0.00437241570403263 + + */ + + // 5th + loc = 0; sc = 1; sh = 5; + std::cout << "location: " << loc << "\tscale: " << sc << "\tshape: " << sh << std::endl; + cumulants[0] = 0.7823901817554269; + cumulants[1] = 0.3878656034927102; + cumulants[2] = 0.2055576317962637; + cumulants[3] = 0.1061119471655128; + x = -0.5; + p = 0.5; + qsn = 0.674471117502844; + psn = 0.0002731513884140924; + dsn = 0.00437241570403263; + + check(loc, sc, sh, cumulants, std::make_pair(p,qsn), x, dsn, psn); + + /* R: + + > sn.cumulants(0,1,1e5) + [1] 0.7978845607629713 0.3633802276960805 0.2180136141122883 0.1147706820312645 + > qsn(0.5,0,1,1e5) + [1] 0.6744897501960818 + > psn(-0.5, 0,1,1e5) + [1] 0 + > dsn(-0.5, 0,1,1e5) + [1] 0 + + */ + + // 6th + loc = 0; sc = 1; sh = 1e5; + std::cout << "location: " << loc << "\tscale: " << sc << "\tshape: " << sh << std::endl; + cumulants[0] = 0.7978845607629713; + cumulants[1] = 0.3633802276960805; + cumulants[2] = 0.2180136141122883; + cumulants[3] = 0.1147706820312645; + x = -0.5; + p = 0.5; + qsn = 0.6744897501960818; + psn = 0.; + dsn = 0.; + + check(loc, sc, sh, cumulants, std::make_pair(p,qsn), x, dsn, psn); + + return 0; +} + + +// EOF + + + + + + + + diff --git a/src/boost/libs/math/example/special_data.cpp b/src/boost/libs/math/example/special_data.cpp new file mode 100644 index 00000000..2e101b40 --- /dev/null +++ b/src/boost/libs/math/example/special_data.cpp @@ -0,0 +1,84 @@ +// Copyright John Maddock 2006. +// 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) + +//[special_data_example + +#include +#include +#include +#include + +using namespace boost::math::tools; +using namespace boost::math; +using namespace std; +using namespace boost::multiprecision; + +template +T my_special(T a, T b) +{ + // Implementation of my_special here... + return a + b; +} + +int cpp_main(int argc, char*argv []) +{ + // + // We'll use so many digits of precision that any + // calculation errors will still leave us with + // 40-50 good digits. We'll only run this program + // once so it doesn't matter too much how long this takes! + // + typedef number > bignum; + + parameter_info arg1, arg2; + test_data data; + + bool cont; + std::string line; + + if(argc < 1) + return 1; + + do{ + // + // User interface which prompts for + // range of input parameters: + // + if(0 == get_user_parameter_info(arg1, "a")) + return 1; + if(0 == get_user_parameter_info(arg2, "b")) + return 1; + + // + // Get a pointer to the function and call + // test_data::insert to actually generate + // the values. + // + bignum (*fp)(bignum, bignum) = &my_special; + data.insert(fp, arg2, arg1); + + std::cout << "Any more data [y/n]?"; + std::getline(std::cin, line); + boost::algorithm::trim(line); + cont = (line == "y"); + }while(cont); + // + // Just need to write the results to a file: + // + std::cout << "Enter name of test data file [default=my_special.ipp]"; + std::getline(std::cin, line); + boost::algorithm::trim(line); + if(line == "") + line = "my_special.ipp"; + std::ofstream ofs(line.c_str()); + line.erase(line.find('.')); + ofs << std::scientific << std::setprecision(50); + write_code(ofs, data, line.c_str()); + + return 0; +} + +//] diff --git a/src/boost/libs/math/example/students_t_example1.cpp b/src/boost/libs/math/example/students_t_example1.cpp new file mode 100644 index 00000000..c86b89d5 --- /dev/null +++ b/src/boost/libs/math/example/students_t_example1.cpp @@ -0,0 +1,101 @@ +// students_t_example1.cpp + +// Copyright Paul A. Bristow 2006, 2007. + +// 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) + +// Example 1 of using Student's t + +// http://en.wikipedia.org/wiki/Student's_t-test says: +// The t statistic was invented by William Sealy Gosset +// for cheaply monitoring the quality of beer brews. +// "Student" was his pen name. +// WS Gosset was statistician for Guinness brewery in Dublin, Ireland, +// hired due to Claude Guinness's innovative policy of recruiting the +// best graduates from Oxford and Cambridge for applying biochemistry +// and statistics to Guinness's industrial processes. +// Gosset published the t test in Biometrika in 1908, +// but was forced to use a pen name by his employer who regarded the fact +// that they were using statistics as a trade secret. +// In fact, Gosset's identity was unknown not only to fellow statisticians +// but to his employer - the company insisted on the pseudonym +// so that it could turn a blind eye to the breach of its rules. + +// Data for this example from: +// P.K.Hou, O. W. Lau & M.C. Wong, Analyst (1983) vol. 108, p 64. +// from Statistics for Analytical Chemistry, 3rd ed. (1994), pp 54-55 +// J. C. Miller and J. N. Miller, Ellis Horwood ISBN 0 13 0309907 + +// Determination of mercury by cold-vapour atomic absorption, +// the following values were obtained fusing a trusted +// Standard Reference Material containing 38.9% mercury, +// which we assume is correct or 'true'. +double standard = 38.9; + +const int values = 3; +double value[values] = {38.9, 37.4, 37.1}; + +// Is there any evidence for systematic error? + +// The Students't distribution function is described at +// http://en.wikipedia.org/wiki/Student%27s_t_distribution +#include + using boost::math::students_t; // Probability of students_t(df, t). + +#include + using std::cout; using std::endl; +#include + using std::setprecision; +#include + using std::sqrt; + +int main() +{ + cout << "Example 1 using Student's t function. " << endl; + + // Example/test using tabulated value + // (deliberately coded as naively as possible). + + // Null hypothesis is that there is no difference (greater or less) + // between measured and standard. + + double degrees_of_freedom = values-1; // 3-1 = 2 + cout << "Measurement 1 = " << value[0] << ", measurement 2 = " << value[1] << ", measurement 3 = " << value[2] << endl; + double mean = (value[0] + value[1] + value[2]) / static_cast(values); + cout << "Standard = " << standard << ", mean = " << mean << ", (mean - standard) = " << mean - standard << endl; + double sd = sqrt(((value[0] - mean) * (value[0] - mean) + (value[1] - mean) * (value[1] - mean) + (value[2] - mean) * (value[2] - mean))/ static_cast(values-1)); + cout << "Standard deviation = " << sd << endl; + if (sd == 0.) + { + cout << "Measured mean is identical to SRM value," << endl; + cout << "so probability of no difference between measured and standard (the 'null hypothesis') is unity." << endl; + return 0; + } + + double t = (mean - standard) * std::sqrt(static_cast(values)) / sd; + cout << "Student's t = " << t << endl; + cout.precision(2); // Useful accuracy is only a few decimal digits. + cout << "Probability of Student's t is " << cdf(students_t(degrees_of_freedom), std::abs(t)) << endl; + // 0.91, is 1 tailed. + // So there is insufficient evidence of a difference to meet a 95% (1 in 20) criterion. + + return 0; +} // int main() + +/* + +Output is: + +Example 1 using Student's t function. +Measurement 1 = 38.9, measurement 2 = 37.4, measurement 3 = 37.1 +Standard = 38.9, mean = 37.8, (mean - standard) = -1.1 +Standard deviation = 0.964365 +Student's t = -1.97566 +Probability of Student's t is 0.91 + +*/ + + diff --git a/src/boost/libs/math/example/students_t_example2.cpp b/src/boost/libs/math/example/students_t_example2.cpp new file mode 100644 index 00000000..bbd42316 --- /dev/null +++ b/src/boost/libs/math/example/students_t_example2.cpp @@ -0,0 +1,126 @@ +// students_t_example2.cpp + +// Copyright Paul A. Bristow 2006. +// 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) + +// Example 2 of using Student's t + +// A general guide to Student's t is at +// http://en.wikipedia.org/wiki/Student's_t-test +// (and many other elementary and advanced statistics texts). +// It says: +// The t statistic was invented by William Sealy Gosset +// for cheaply monitoring the quality of beer brews. +// "Student" was his pen name. +// Gosset was statistician for Guinness brewery in Dublin, Ireland, +// hired due to Claude Guinness's innovative policy of recruiting the +// best graduates from Oxford and Cambridge for applying biochemistry +// and statistics to Guinness's industrial processes. +// Gosset published the t test in Biometrika in 1908, +// but was forced to use a pen name by his employer who regarded the fact +// that they were using statistics as a trade secret. +// In fact, Gosset's identity was unknown not only to fellow statisticians +// but to his employer - the company insisted on the pseudonym +// so that it could turn a blind eye to the breach of its rules. + +// The Students't distribution function is described at +// http://en.wikipedia.org/wiki/Student%27s_t_distribution + +#include + using boost::math::students_t; // Probability of students_t(df, t). + +#include + using std::cout; + using std::endl; +#include + using std::setprecision; + using std::setw; +#include + using std::sqrt; + +// This example of a one-sided test is from: +// +// from Statistics for Analytical Chemistry, 3rd ed. (1994), pp 59-60 +// J. C. Miller and J. N. Miller, Ellis Horwood ISBN 0 13 0309907. + +// An acid-base titrimetric method has a significant indicator error and +// thus tends to give results with a positive systematic error (+bias). +// To test this an exactly 0.1 M solution of acid is used to titrate +// 25.00 ml of exactly 0.1 M solution of alkali, +// with the following results (ml): + +double reference = 25.00; // 'True' result. +const int values = 6; // titrations. +double data [values] = {25.06, 25.18, 24.87, 25.51, 25.34, 25.41}; + +int main() +{ + cout << "Example2 using Student's t function. "; +#if defined(__FILE__) && defined(__TIMESTAMP__) && defined(_MSC_FULL_VER) + cout << " " << __FILE__ << ' ' << __TIMESTAMP__ << ' '<< _MSC_FULL_VER; +#endif + cout << endl; + + double sum = 0.; + for (int value = 0; value < values; value++) + { // Echo data and calculate mean. + sum += data[value]; + cout << setw(4) << value << ' ' << setw(14) << data[value] << endl; + } + double mean = sum /static_cast(values); + cout << "Mean = " << mean << endl; // 25.2283 + + double sd = 0.; + for (int value = 0; value < values; value++) + { // Calculate standard deviation. + sd +=(data[value] - mean) * (data[value] - mean); + } + int degrees_of_freedom = values - 1; // Use the n-1 formula. + sd /= degrees_of_freedom; // == variance. + sd= sqrt(sd); + cout << "Standard deviation = " << sd<< endl; // = 0.238279 + + double t = (mean - reference) * sqrt(static_cast(values))/ sd; // + cout << "Student's t = " << t << ", with " << degrees_of_freedom << " degrees of freedom." << endl; // = 2.34725 + + cout << "Probability of positive bias is " << cdf(students_t(degrees_of_freedom), t) << "."<< endl; // = 0.967108. + // A 1-sided test because only testing for a positive bias. + // If > 0.95 then greater than 1 in 20 conventional (arbitrary) requirement. + + return 0; +} // int main() + +/* + +Output is: + +------ Build started: Project: students_t_example2, Configuration: Debug Win32 ------ +Compiling... +students_t_example2.cpp +Linking... +Autorun "i:\boost-06-05-03-1300\libs\math\test\Math_test\debug\students_t_example2.exe" +Example2 using Student's t function. ..\..\..\..\..\..\boost-sandbox\libs\math_functions\example\students_t_example2.cpp Sat Aug 12 16:55:59 2006 140050727 + 0 25.06 + 1 25.18 + 2 24.87 + 3 25.51 + 4 25.34 + 5 25.41 +Mean = 25.2283 +Standard deviation = 0.238279 +Student's t = 2.34725, with 5 degrees of freedom. +Probability of positive bias is 0.967108. +Build Time 0:03 +Build log was saved at "file://i:\boost-06-05-03-1300\libs\math\test\Math_test\students_t_example2\Debug\BuildLog.htm" +students_t_example2 - 0 error(s), 0 warning(s) +========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ========== + +*/ + + + + + diff --git a/src/boost/libs/math/example/students_t_example3.cpp b/src/boost/libs/math/example/students_t_example3.cpp new file mode 100644 index 00000000..289daec0 --- /dev/null +++ b/src/boost/libs/math/example/students_t_example3.cpp @@ -0,0 +1,120 @@ +// students_t_example3.cpp +// Copyright Paul A. Bristow 2006, 2007. + +// 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) + +// Example 3 of using Student's t. + +// A general guide to Student's t is at +// http://en.wikipedia.org/wiki/Student's_t-test +// (and many other elementary and advanced statistics texts). +// It says: +// The t statistic was invented by William Sealy Gosset +// for cheaply monitoring the quality of beer brews. +// "Student" was his pen name. +// Gosset was statistician for Guinness brewery in Dublin, Ireland, +// hired due to Claude Guinness's innovative policy of recruiting the +// best graduates from Oxford and Cambridge for applying biochemistry +// and statistics to Guinness's industrial processes. +// Gosset published the t test in Biometrika in 1908, +// but was forced to use a pen name by his employer who regarded the fact +// that they were using statistics as a trade secret. +// In fact, Gosset's identity was unknown not only to fellow statisticians +// but to his employer - the company insisted on the pseudonym +// so that it could turn a blind eye to the breach of its rules. + +// The Students't distribution function is described at +// http://en.wikipedia.org/wiki/Student%27s_t_distribution + +#include + using boost::math::students_t; // Probability of students_t(df, t). + +#include + using std::cout; using std::endl; +#include + using std::setprecision; using std::setw; +#include + using std::sqrt; + +// This example of a two-sided test is from: +// B. M. Smith & M. B. Griffiths, Analyst, 1982, 107, 253, +// from Statistics for Analytical Chemistry, 3rd ed. (1994), pp 58-59 +// J. C. Miller and J. N. Miller, Ellis Horwood ISBN 0 13 0309907 + +// Concentrations of lead (ug/l) determined by two different methods +// for each of four test portions, +// the concentration of each portion is significantly different, +// the values may NOT be pooled. +// (Called a 'paired test' by Miller and Miller +// because each portion analysed has a different concentration.) + +// Portion Wet oxidation Direct Extraction +// 1 71 76 +// 2 61 68 +// 3 50 48 +// 4 60 57 + +const int portions = 4; +const int methods = 2; +float data [portions][methods] = {{71, 76}, {61,68}, {50, 48}, {60, 57}}; +float diffs[portions]; + +int main() +{ + cout << "Example3 using Student's t function. " << endl; + float mean_diff = 0.f; + cout << "\n""Portion wet_oxidation Direct_extraction difference" << endl; + for (int portion = 0; portion < portions; portion++) + { // Echo data and differences. + diffs[portion] = data[portion][0] - data[portion][1]; + mean_diff += diffs[portion]; + cout << setw(4) << portion << ' ' << setw(14) << data[portion][0] << ' ' << setw(18)<< data[portion][1] << ' ' << setw(9) << diffs[portion] << endl; + } + mean_diff /= portions; + cout << "Mean difference = " << mean_diff << endl; // -1.75 + + float sd_diffs = 0.f; + for (int portion = 0; portion < portions; portion++) + { // Calculate standard deviation of differences. + sd_diffs +=(diffs[portion] - mean_diff) * (diffs[portion] - mean_diff); + } + int degrees_of_freedom = portions-1; // Use the n-1 formula. + sd_diffs /= degrees_of_freedom; + sd_diffs = sqrt(sd_diffs); + cout << "Standard deviation of differences = " << sd_diffs << endl; // 4.99166 + // Standard deviation of differences = 4.99166 + double t = mean_diff * sqrt(static_cast(portions))/ sd_diffs; // -0.70117 + cout << "Student's t = " << t << ", if " << degrees_of_freedom << " degrees of freedom." << endl; + // Student's t = -0.70117, if 3 degrees of freedom. + cout << "Probability of the means being different is " + << 2.F * cdf(students_t(degrees_of_freedom), t) << "."<< endl; // 0.266846 * 2 = 0.533692 + // Double the probability because using a 'two-sided test' because + // mean for 'Wet oxidation' could be either + // greater OR LESS THAN for 'Direct extraction'. + + return 0; +} // int main() + +/* + +Output is: + +Example3 using Student's t function. +Portion wet_oxidation Direct_extraction difference + 0 71 76 -5 + 1 61 68 -7 + 2 50 48 2 + 3 60 57 3 +Mean difference = -1.75 +Standard deviation of differences = 4.99166 +Student's t = -0.70117, if 3 degrees of freedom. +Probability of the means being different is 0.533692. + +*/ + + + + diff --git a/src/boost/libs/math/example/students_t_single_sample.cpp b/src/boost/libs/math/example/students_t_single_sample.cpp new file mode 100644 index 00000000..4fed0de1 --- /dev/null +++ b/src/boost/libs/math/example/students_t_single_sample.cpp @@ -0,0 +1,424 @@ +// Copyright John Maddock 2006 +// Copyright Paul A. Bristow 2007, 2010 + +// 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) + +#ifdef _MSC_VER +# pragma warning(disable: 4512) // assignment operator could not be generated. +# pragma warning(disable: 4510) // default constructor could not be generated. +# pragma warning(disable: 4610) // can never be instantiated - user defined constructor required. +#endif + +#include + +// avoid "using namespace std;" and "using namespace boost::math;" +// to avoid potential ambiguity with names in std random. +#include +using std::cout; using std::endl; +using std::left; using std::fixed; using std::right; using std::scientific; +#include +using std::setw; +using std::setprecision; + +void confidence_limits_on_mean(double Sm, double Sd, unsigned Sn) +{ + // + // Sm = Sample Mean. + // Sd = Sample Standard Deviation. + // Sn = Sample Size. + // + // Calculate confidence intervals for the mean. + // For example if we set the confidence limit to + // 0.95, we know that if we repeat the sampling + // 100 times, then we expect that the true mean + // will be between out limits on 95 occations. + // Note: this is not the same as saying a 95% + // confidence interval means that there is a 95% + // probability that the interval contains the true mean. + // The interval computed from a given sample either + // contains the true mean or it does not. + // See http://www.itl.nist.gov/div898/handbook/eda/section3/eda352.htm + + using boost::math::students_t; + + // Print out general info: + cout << + "__________________________________\n" + "2-Sided Confidence Limits For Mean\n" + "__________________________________\n\n"; + cout << setprecision(7); + cout << setw(40) << left << "Number of Observations" << "= " << Sn << "\n"; + cout << setw(40) << left << "Mean" << "= " << Sm << "\n"; + cout << setw(40) << left << "Standard Deviation" << "= " << Sd << "\n"; + // + // Define a table of significance/risk levels: + // + double alpha[] = { 0.5, 0.25, 0.1, 0.05, 0.01, 0.001, 0.0001, 0.00001 }; + // + // Start by declaring the distribution we'll need: + // + students_t dist(Sn - 1); + // + // Print table header: + // + cout << "\n\n" + "_______________________________________________________________\n" + "Confidence T Interval Lower Upper\n" + " Value (%) Value Width Limit Limit\n" + "_______________________________________________________________\n"; + // + // Now print out the data for the table rows. + // + for(unsigned i = 0; i < sizeof(alpha)/sizeof(alpha[0]); ++i) + { + // Confidence value: + cout << fixed << setprecision(3) << setw(10) << right << 100 * (1-alpha[i]); + // calculate T: + double T = quantile(complement(dist, alpha[i] / 2)); + // Print T: + cout << fixed << setprecision(3) << setw(10) << right << T; + // Calculate width of interval (one sided): + double w = T * Sd / sqrt(double(Sn)); + // Print width: + if(w < 0.01) + cout << scientific << setprecision(3) << setw(17) << right << w; + else + cout << fixed << setprecision(3) << setw(17) << right << w; + // Print Limits: + cout << fixed << setprecision(5) << setw(15) << right << Sm - w; + cout << fixed << setprecision(5) << setw(15) << right << Sm + w << endl; + } + cout << endl; +} // void confidence_limits_on_mean + +void single_sample_t_test(double M, double Sm, double Sd, unsigned Sn, double alpha) +{ + // + // M = true mean. + // Sm = Sample Mean. + // Sd = Sample Standard Deviation. + // Sn = Sample Size. + // alpha = Significance Level. + // + // A Students t test applied to a single set of data. + // We are testing the null hypothesis that the true + // mean of the sample is M, and that any variation is down + // to chance. We can also test the alternative hypothesis + // that any difference is not down to chance. + // See http://www.itl.nist.gov/div898/handbook/eda/section3/eda352.htm + + using boost::math::students_t; + + // Print header: + cout << + "__________________________________\n" + "Student t test for a single sample\n" + "__________________________________\n\n"; + cout << setprecision(5); + cout << setw(55) << left << "Number of Observations" << "= " << Sn << "\n"; + cout << setw(55) << left << "Sample Mean" << "= " << Sm << "\n"; + cout << setw(55) << left << "Sample Standard Deviation" << "= " << Sd << "\n"; + cout << setw(55) << left << "Expected True Mean" << "= " << M << "\n\n"; + // + // Now we can calculate and output some stats: + // + // Difference in means: + double diff = Sm - M; + cout << setw(55) << left << "Sample Mean - Expected Test Mean" << "= " << diff << "\n"; + // Degrees of freedom: + unsigned v = Sn - 1; + cout << setw(55) << left << "Degrees of Freedom" << "= " << v << "\n"; + // t-statistic: + double t_stat = diff * sqrt(double(Sn)) / Sd; + cout << setw(55) << left << "T Statistic" << "= " << t_stat << "\n"; + // + // Finally define our distribution, and get the probability: + // + students_t dist(v); + double q = cdf(complement(dist, fabs(t_stat))); + cout << setw(55) << left << "Probability that difference is due to chance" << "= " + << setprecision(3) << scientific << 2 * q << "\n\n"; + // + // Finally print out results of alternative hypothesis: + // + cout << setw(55) << left << + "Results for Alternative Hypothesis and alpha" << "= " + << setprecision(4) << fixed << alpha << "\n\n"; + cout << "Alternative Hypothesis Conclusion\n"; + cout << "Mean != " << setprecision(3) << fixed << M << " "; + if(q < alpha / 2) + cout << "NOT REJECTED\n"; + else + cout << "REJECTED\n"; + cout << "Mean < " << setprecision(3) << fixed << M << " "; + if(cdf(complement(dist, t_stat)) > alpha) + cout << "NOT REJECTED\n"; + else + cout << "REJECTED\n"; + cout << "Mean > " << setprecision(3) << fixed << M << " "; + if(cdf(dist, t_stat) > alpha) + cout << "NOT REJECTED\n"; + else + cout << "REJECTED\n"; + cout << endl << endl; +} // void single_sample_t_test( + +void single_sample_find_df(double M, double Sm, double Sd) +{ + // + // M = true mean. + // Sm = Sample Mean. + // Sd = Sample Standard Deviation. + // + + using boost::math::students_t; + + // Print out general info: + cout << + "_____________________________________________________________\n" + "Estimated sample sizes required for various confidence levels\n" + "_____________________________________________________________\n\n"; + cout << setprecision(5); + cout << setw(40) << left << "True Mean" << "= " << M << "\n"; + cout << setw(40) << left << "Sample Mean" << "= " << Sm << "\n"; + cout << setw(40) << left << "Sample Standard Deviation" << "= " << Sd << "\n"; + // + // Define a table of significance intervals: + // + double alpha[] = { 0.5, 0.25, 0.1, 0.05, 0.01, 0.001, 0.0001, 0.00001 }; + // + // Print table header: + // + cout << "\n\n" + "_______________________________________________________________\n" + "Confidence Estimated Estimated\n" + " Value (%) Sample Size Sample Size\n" + " (one sided test) (two sided test)\n" + "_______________________________________________________________\n"; + // + // Now print out the data for the table rows. + // + for(unsigned i = 1; i < sizeof(alpha)/sizeof(alpha[0]); ++i) + { + // Confidence value: + cout << fixed << setprecision(3) << setw(10) << right << 100 * (1-alpha[i]); + // calculate df for single sided test: + double df = students_t::find_degrees_of_freedom( + fabs(M - Sm), alpha[i], alpha[i], Sd); + // convert to sample size, always one more than the degrees of freedom: + double size = ceil(df) + 1; + // Print size: + cout << fixed << setprecision(0) << setw(16) << right << size; + // calculate df for two sided test: + df = students_t::find_degrees_of_freedom( + fabs(M - Sm), alpha[i]/2, alpha[i], Sd); + // convert to sample size: + size = ceil(df) + 1; + // Print size: + cout << fixed << setprecision(0) << setw(16) << right << size << endl; + } + cout << endl; +} // void single_sample_find_df + +int main() +{ + // + // Run tests for Heat Flow Meter data + // see http://www.itl.nist.gov/div898/handbook/eda/section4/eda428.htm + // The data was collected while calibrating a heat flow meter + // against a known value. + // + confidence_limits_on_mean(9.261460, 0.2278881e-01, 195); + single_sample_t_test(5, 9.261460, 0.2278881e-01, 195, 0.05); + single_sample_find_df(5, 9.261460, 0.2278881e-01); + + // + // Data for this example from: + // P.K.Hou, O. W. Lau & M.C. Wong, Analyst (1983) vol. 108, p 64. + // from Statistics for Analytical Chemistry, 3rd ed. (1994), pp 54-55 + // J. C. Miller and J. N. Miller, Ellis Horwood ISBN 0 13 0309907 + // + // Determination of mercury by cold-vapour atomic absorption, + // the following values were obtained fusing a trusted + // Standard Reference Material containing 38.9% mercury, + // which we assume is correct or 'true'. + // + confidence_limits_on_mean(37.8, 0.964365, 3); + // 95% test: + single_sample_t_test(38.9, 37.8, 0.964365, 3, 0.05); + // 90% test: + single_sample_t_test(38.9, 37.8, 0.964365, 3, 0.1); + // parameter estimate: + single_sample_find_df(38.9, 37.8, 0.964365); + + return 0; +} // int main() + +/* + +Output: + +------ Rebuild All started: Project: students_t_single_sample, Configuration: Release Win32 ------ + students_t_single_sample.cpp + Generating code + Finished generating code + students_t_single_sample.vcxproj -> J:\Cpp\MathToolkit\test\Math_test\Release\students_t_single_sample.exe +__________________________________ +2-Sided Confidence Limits For Mean +__________________________________ + +Number of Observations = 195 +Mean = 9.26146 +Standard Deviation = 0.02278881 + + +_______________________________________________________________ +Confidence T Interval Lower Upper + Value (%) Value Width Limit Limit +_______________________________________________________________ + 50.000 0.676 1.103e-003 9.26036 9.26256 + 75.000 1.154 1.883e-003 9.25958 9.26334 + 90.000 1.653 2.697e-003 9.25876 9.26416 + 95.000 1.972 3.219e-003 9.25824 9.26468 + 99.000 2.601 4.245e-003 9.25721 9.26571 + 99.900 3.341 5.453e-003 9.25601 9.26691 + 99.990 3.973 6.484e-003 9.25498 9.26794 + 99.999 4.537 7.404e-003 9.25406 9.26886 + +__________________________________ +Student t test for a single sample +__________________________________ + +Number of Observations = 195 +Sample Mean = 9.26146 +Sample Standard Deviation = 0.02279 +Expected True Mean = 5.00000 + +Sample Mean - Expected Test Mean = 4.26146 +Degrees of Freedom = 194 +T Statistic = 2611.28380 +Probability that difference is due to chance = 0.000e+000 + +Results for Alternative Hypothesis and alpha = 0.0500 + +Alternative Hypothesis Conclusion +Mean != 5.000 NOT REJECTED +Mean < 5.000 REJECTED +Mean > 5.000 NOT REJECTED + + +_____________________________________________________________ +Estimated sample sizes required for various confidence levels +_____________________________________________________________ + +True Mean = 5.00000 +Sample Mean = 9.26146 +Sample Standard Deviation = 0.02279 + + +_______________________________________________________________ +Confidence Estimated Estimated + Value (%) Sample Size Sample Size + (one sided test) (two sided test) +_______________________________________________________________ + 75.000 2 2 + 90.000 2 2 + 95.000 2 2 + 99.000 2 2 + 99.900 3 3 + 99.990 3 3 + 99.999 4 4 + +__________________________________ +2-Sided Confidence Limits For Mean +__________________________________ + +Number of Observations = 3 +Mean = 37.8000000 +Standard Deviation = 0.9643650 + + +_______________________________________________________________ +Confidence T Interval Lower Upper + Value (%) Value Width Limit Limit +_______________________________________________________________ + 50.000 0.816 0.455 37.34539 38.25461 + 75.000 1.604 0.893 36.90717 38.69283 + 90.000 2.920 1.626 36.17422 39.42578 + 95.000 4.303 2.396 35.40438 40.19562 + 99.000 9.925 5.526 32.27408 43.32592 + 99.900 31.599 17.594 20.20639 55.39361 + 99.990 99.992 55.673 -17.87346 93.47346 + 99.999 316.225 176.067 -138.26683 213.86683 + +__________________________________ +Student t test for a single sample +__________________________________ + +Number of Observations = 3 +Sample Mean = 37.80000 +Sample Standard Deviation = 0.96437 +Expected True Mean = 38.90000 + +Sample Mean - Expected Test Mean = -1.10000 +Degrees of Freedom = 2 +T Statistic = -1.97566 +Probability that difference is due to chance = 1.869e-001 + +Results for Alternative Hypothesis and alpha = 0.0500 + +Alternative Hypothesis Conclusion +Mean != 38.900 REJECTED +Mean < 38.900 NOT REJECTED +Mean > 38.900 NOT REJECTED + + +__________________________________ +Student t test for a single sample +__________________________________ + +Number of Observations = 3 +Sample Mean = 37.80000 +Sample Standard Deviation = 0.96437 +Expected True Mean = 38.90000 + +Sample Mean - Expected Test Mean = -1.10000 +Degrees of Freedom = 2 +T Statistic = -1.97566 +Probability that difference is due to chance = 1.869e-001 + +Results for Alternative Hypothesis and alpha = 0.1000 + +Alternative Hypothesis Conclusion +Mean != 38.900 REJECTED +Mean < 38.900 NOT REJECTED +Mean > 38.900 REJECTED + + +_____________________________________________________________ +Estimated sample sizes required for various confidence levels +_____________________________________________________________ + +True Mean = 38.90000 +Sample Mean = 37.80000 +Sample Standard Deviation = 0.96437 + + +_______________________________________________________________ +Confidence Estimated Estimated + Value (%) Sample Size Sample Size + (one sided test) (two sided test) +_______________________________________________________________ + 75.000 3 4 + 90.000 7 9 + 95.000 11 13 + 99.000 20 22 + 99.900 35 37 + 99.990 50 53 + 99.999 66 68 + +*/ + diff --git a/src/boost/libs/math/example/students_t_two_samples.cpp b/src/boost/libs/math/example/students_t_two_samples.cpp new file mode 100644 index 00000000..66a9e703 --- /dev/null +++ b/src/boost/libs/math/example/students_t_two_samples.cpp @@ -0,0 +1,245 @@ +// Copyright John Maddock 2006. +// Copyright Paul A. Bristow 2007, 2010 + +// 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) + +#ifdef _MSC_VER +# pragma warning(disable: 4512) // assignment operator could not be generated. +# pragma warning(disable: 4510) // default constructor could not be generated. +# pragma warning(disable: 4610) // can never be instantiated - user defined constructor required. +#endif + +#include +using std::cout; using std::endl; +using std::left; using std::fixed; using std::right; using std::scientific; +#include +using std::setw; +using std::setprecision; + +#include + using boost::math::students_t; + + +void two_samples_t_test_equal_sd( + double Sm1, // Sm1 = Sample Mean 1. + double Sd1, // Sd1 = Sample Standard Deviation 1. + unsigned Sn1, // Sn1 = Sample Size 1. + double Sm2, // Sm2 = Sample Mean 2. + double Sd2, // Sd2 = Sample Standard Deviation 2. + unsigned Sn2, // Sn2 = Sample Size 2. + double alpha) // alpha = Significance Level. +{ + // A Students t test applied to two sets of data. + // We are testing the null hypothesis that the two + // samples have the same mean and that any difference + // if due to chance. + // See http://www.itl.nist.gov/div898/handbook/eda/section3/eda353.htm + // + using namespace std; + // using namespace boost::math; + + using boost::math::students_t; + + // Print header: + cout << + "_______________________________________________\n" + "Student t test for two samples (equal variances)\n" + "_______________________________________________\n\n"; + cout << setprecision(5); + cout << setw(55) << left << "Number of Observations (Sample 1)" << "= " << Sn1 << "\n"; + cout << setw(55) << left << "Sample 1 Mean" << "= " << Sm1 << "\n"; + cout << setw(55) << left << "Sample 1 Standard Deviation" << "= " << Sd1 << "\n"; + cout << setw(55) << left << "Number of Observations (Sample 2)" << "= " << Sn2 << "\n"; + cout << setw(55) << left << "Sample 2 Mean" << "= " << Sm2 << "\n"; + cout << setw(55) << left << "Sample 2 Standard Deviation" << "= " << Sd2 << "\n"; + // + // Now we can calculate and output some stats: + // + // Degrees of freedom: + double v = Sn1 + Sn2 - 2; + cout << setw(55) << left << "Degrees of Freedom" << "= " << v << "\n"; + // Pooled variance and hence standard deviation: + double sp = sqrt(((Sn1-1) * Sd1 * Sd1 + (Sn2-1) * Sd2 * Sd2) / v); + cout << setw(55) << left << "Pooled Standard Deviation" << "= " << sp << "\n"; + // t-statistic: + double t_stat = (Sm1 - Sm2) / (sp * sqrt(1.0 / Sn1 + 1.0 / Sn2)); + cout << setw(55) << left << "T Statistic" << "= " << t_stat << "\n"; + // + // Define our distribution, and get the probability: + // + students_t dist(v); + double q = cdf(complement(dist, fabs(t_stat))); + cout << setw(55) << left << "Probability that difference is due to chance" << "= " + << setprecision(3) << scientific << 2 * q << "\n\n"; + // + // Finally print out results of alternative hypothesis: + // + cout << setw(55) << left << + "Results for Alternative Hypothesis and alpha" << "= " + << setprecision(4) << fixed << alpha << "\n\n"; + cout << "Alternative Hypothesis Conclusion\n"; + cout << "Sample 1 Mean != Sample 2 Mean " ; + if(q < alpha / 2) + cout << "NOT REJECTED\n"; + else + cout << "REJECTED\n"; + cout << "Sample 1 Mean < Sample 2 Mean "; + if(cdf(dist, t_stat) < alpha) + cout << "NOT REJECTED\n"; + else + cout << "REJECTED\n"; + cout << "Sample 1 Mean > Sample 2 Mean "; + if(cdf(complement(dist, t_stat)) < alpha) + cout << "NOT REJECTED\n"; + else + cout << "REJECTED\n"; + cout << endl << endl; +} + +void two_samples_t_test_unequal_sd( + double Sm1, // Sm1 = Sample Mean 1. + double Sd1, // Sd1 = Sample Standard Deviation 1. + unsigned Sn1, // Sn1 = Sample Size 1. + double Sm2, // Sm2 = Sample Mean 2. + double Sd2, // Sd2 = Sample Standard Deviation 2. + unsigned Sn2, // Sn2 = Sample Size 2. + double alpha) // alpha = Significance Level. +{ + // A Students t test applied to two sets of data. + // We are testing the null hypothesis that the two + // samples have the same mean and + // that any difference is due to chance. + // See http://www.itl.nist.gov/div898/handbook/eda/section3/eda353.htm + // + using namespace std; + using boost::math::students_t; + + // Print header: + cout << + "_________________________________________________\n" + "Student t test for two samples (unequal variances)\n" + "_________________________________________________\n\n"; + cout << setprecision(5); + cout << setw(55) << left << "Number of Observations (Sample 1)" << "= " << Sn1 << "\n"; + cout << setw(55) << left << "Sample 1 Mean" << "= " << Sm1 << "\n"; + cout << setw(55) << left << "Sample 1 Standard Deviation" << "= " << Sd1 << "\n"; + cout << setw(55) << left << "Number of Observations (Sample 2)" << "= " << Sn2 << "\n"; + cout << setw(55) << left << "Sample 2 Mean" << "= " << Sm2 << "\n"; + cout << setw(55) << left << "Sample 2 Standard Deviation" << "= " << Sd2 << "\n"; + // + // Now we can calculate and output some stats: + // + // Degrees of freedom: + double v = Sd1 * Sd1 / Sn1 + Sd2 * Sd2 / Sn2; + v *= v; + double t1 = Sd1 * Sd1 / Sn1; + t1 *= t1; + t1 /= (Sn1 - 1); + double t2 = Sd2 * Sd2 / Sn2; + t2 *= t2; + t2 /= (Sn2 - 1); + v /= (t1 + t2); + cout << setw(55) << left << "Degrees of Freedom" << "= " << v << "\n"; + // t-statistic: + double t_stat = (Sm1 - Sm2) / sqrt(Sd1 * Sd1 / Sn1 + Sd2 * Sd2 / Sn2); + cout << setw(55) << left << "T Statistic" << "= " << t_stat << "\n"; + // + // Define our distribution, and get the probability: + // + students_t dist(v); + double q = cdf(complement(dist, fabs(t_stat))); + cout << setw(55) << left << "Probability that difference is due to chance" << "= " + << setprecision(3) << scientific << 2 * q << "\n\n"; + // + // Finally print out results of alternative hypothesis: + // + cout << setw(55) << left << + "Results for Alternative Hypothesis and alpha" << "= " + << setprecision(4) << fixed << alpha << "\n\n"; + cout << "Alternative Hypothesis Conclusion\n"; + cout << "Sample 1 Mean != Sample 2 Mean " ; + if(q < alpha / 2) + cout << "NOT REJECTED\n"; + else + cout << "REJECTED\n"; + cout << "Sample 1 Mean < Sample 2 Mean "; + if(cdf(dist, t_stat) < alpha) + cout << "NOT REJECTED\n"; + else + cout << "REJECTED\n"; + cout << "Sample 1 Mean > Sample 2 Mean "; + if(cdf(complement(dist, t_stat)) < alpha) + cout << "NOT REJECTED\n"; + else + cout << "REJECTED\n"; + cout << endl << endl; +} + +int main() +{ + // + // Run tests for Car Mileage sample data + // http://www.itl.nist.gov/div898/handbook/eda/section3/eda3531.htm + // from the NIST website http://www.itl.nist.gov. The data compares + // miles per gallon of US cars with miles per gallon of Japanese cars. + // + two_samples_t_test_equal_sd(20.14458, 6.414700, 249, 30.48101, 6.107710, 79, 0.05); + two_samples_t_test_unequal_sd(20.14458, 6.414700, 249, 30.48101, 6.107710, 79, 0.05); + + return 0; +} // int main() + +/* +Output is: + + _______________________________________________ + Student t test for two samples (equal variances) + _______________________________________________ + + Number of Observations (Sample 1) = 249 + Sample 1 Mean = 20.145 + Sample 1 Standard Deviation = 6.4147 + Number of Observations (Sample 2) = 79 + Sample 2 Mean = 30.481 + Sample 2 Standard Deviation = 6.1077 + Degrees of Freedom = 326 + Pooled Standard Deviation = 6.3426 + T Statistic = -12.621 + Probability that difference is due to chance = 5.273e-030 + + Results for Alternative Hypothesis and alpha = 0.0500 + + Alternative Hypothesis Conclusion + Sample 1 Mean != Sample 2 Mean NOT REJECTED + Sample 1 Mean < Sample 2 Mean NOT REJECTED + Sample 1 Mean > Sample 2 Mean REJECTED + + + _________________________________________________ + Student t test for two samples (unequal variances) + _________________________________________________ + + Number of Observations (Sample 1) = 249 + Sample 1 Mean = 20.14458 + Sample 1 Standard Deviation = 6.41470 + Number of Observations (Sample 2) = 79 + Sample 2 Mean = 30.48101 + Sample 2 Standard Deviation = 6.10771 + Degrees of Freedom = 136.87499 + T Statistic = -12.94627 + Probability that difference is due to chance = 1.571e-025 + + Results for Alternative Hypothesis and alpha = 0.0500 + + Alternative Hypothesis Conclusion + Sample 1 Mean != Sample 2 Mean NOT REJECTED + Sample 1 Mean < Sample 2 Mean NOT REJECTED + Sample 1 Mean > Sample 2 Mean REJECTED + + + +*/ + diff --git a/src/boost/libs/math/example/table_type.hpp b/src/boost/libs/math/example/table_type.hpp new file mode 100644 index 00000000..b8f16cfd --- /dev/null +++ b/src/boost/libs/math/example/table_type.hpp @@ -0,0 +1,29 @@ +// Copyright John Maddock 2012. + +// 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) + +#ifndef BOOST_MATH_TEST_TABLE_TYPE_HPP +#define BOOST_MATH_TEST_TABLE_TYPE_HPP + +template +struct table_type +{ + typedef T type; +}; + +namespace boost{ namespace math{ namespace concepts{ + + class real_concept; + +}}} + +template <> +struct table_type +{ + typedef long double type; +}; + +#endif diff --git a/src/boost/libs/math/example/test_cpp_float_close_fraction.cpp b/src/boost/libs/math/example/test_cpp_float_close_fraction.cpp new file mode 100644 index 00000000..b4699fad --- /dev/null +++ b/src/boost/libs/math/example/test_cpp_float_close_fraction.cpp @@ -0,0 +1,119 @@ +// 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) + +// Copyright Paul A. Bristow 2013 +// Copyright Christopher Kormanyos 2013. +// Copyright John Maddock 2013. + +#ifdef _MSC_VER +# pragma warning (disable : 4512) +# pragma warning (disable : 4996) +#endif + +#define BOOST_TEST_MAIN +#define BOOST_LIB_DIAGNOSTIC "on"// Show library file details. + +#include +#include // Extra test tool for FP comparison. + +#include +#include + +//[expression_template_1 + +#include + +/*`To define a 50 decimal digit type using `cpp_dec_float`, +you must pass two template parameters to `boost::multiprecision::number`. + +It may be more legible to use a two-staged type definition such as this: + +`` +typedef boost::multiprecision::cpp_dec_float<50> mp_backend; +typedef boost::multiprecision::number cpp_dec_float_50_noet; +`` + +Here, we first define `mp_backend` as `cpp_dec_float` with 50 digits. +The second step passes this backend to `boost::multiprecision::number` +with `boost::multiprecision::et_off`, an enumerated type. + + typedef boost::multiprecision::number, boost::multiprecision::et_off> + cpp_dec_float_50_noet; + +You can reduce typing with a `using` directive `using namespace boost::multiprecision;` +if desired, as shown below. +*/ + +using namespace boost::multiprecision; + + +/*`Now `cpp_dec_float_50_noet` or `cpp_dec_float_50_et` +can be used as a direct replacement for built-in types like `double` etc. +*/ + +BOOST_AUTO_TEST_CASE(cpp_float_test_check_close_noet) +{ // No expression templates/ + typedef number, et_off> cpp_dec_float_50_noet; + + std::cout.precision(std::numeric_limits::digits10); // All significant digits. + std::cout << std::showpoint << std::endl; // Show trailing zeros. + + cpp_dec_float_50_noet a ("1.0"); + cpp_dec_float_50_noet b ("1.0"); + b += std::numeric_limits::epsilon(); // Increment least significant decimal digit. + + cpp_dec_float_50_noet eps = std::numeric_limits::epsilon(); + + std::cout <<"a = " << a << ",\nb = " << b << ",\neps = " << eps << std::endl; + + BOOST_CHECK_CLOSE(a, b, eps * 100); // Expected to pass (because tolerance is as percent). + BOOST_CHECK_CLOSE_FRACTION(a, b, eps); // Expected to pass (because tolerance is as fraction). + + + +} // BOOST_AUTO_TEST_CASE(cpp_float_test_check_close) + +BOOST_AUTO_TEST_CASE(cpp_float_test_check_close_et) +{ // Using expression templates. + typedef number, et_on> cpp_dec_float_50_et; + + std::cout.precision(std::numeric_limits::digits10); // All significant digits. + std::cout << std::showpoint << std::endl; // Show trailing zeros. + + cpp_dec_float_50_et a("1.0"); + cpp_dec_float_50_et b("1.0"); + b += std::numeric_limits::epsilon(); // Increment least significant decimal digit. + + cpp_dec_float_50_et eps = std::numeric_limits::epsilon(); + + std::cout << "a = " << a << ",\nb = " << b << ",\neps = " << eps << std::endl; + + BOOST_CHECK_CLOSE(a, b, eps * 100); // Expected to pass (because tolerance is as percent). + BOOST_CHECK_CLOSE_FRACTION(a, b, eps); // Expected to pass (because tolerance is as fraction). + + /*`Using `cpp_dec_float_50` with the default expression template use switched on, + the compiler error message for `BOOST_CHECK_CLOSE_FRACTION(a, b, eps); would be: + */ + // failure floating_point_comparison.hpp(59): error C2440: 'static_cast' : + // cannot convert from 'int' to 'boost::multiprecision::detail::expression' +//] [/expression_template_1] + +} // BOOST_AUTO_TEST_CASE(cpp_float_test_check_close) + +/* + +Output: + + Description: Autorun "J:\Cpp\big_number\Debug\test_cpp_float_close_fraction.exe" + Running 1 test case... + + a = 1.0000000000000000000000000000000000000000000000000, + b = 1.0000000000000000000000000000000000000000000000001, + eps = 1.0000000000000000000000000000000000000000000000000e-49 + + *** No errors detected + + +*/ + diff --git a/src/boost/libs/math/example/test_nonfinite_loopback.cpp b/src/boost/libs/math/example/test_nonfinite_loopback.cpp new file mode 100644 index 00000000..c7b8e420 --- /dev/null +++ b/src/boost/libs/math/example/test_nonfinite_loopback.cpp @@ -0,0 +1,97 @@ +// Distributed under 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) + +// Copyright (c) 2006 Johan Rade +// Copyright (c) 2011 Paul A. Bristow + +/*! +\file +\brief Basic tests of native nonfinite loopback. + +\detail Basic loopback test outputs using the platforms built-in facets +and reads back in, and checks if loopback OK. + +Using MSVC this doesn't work OK: +input produces just "1" instead of "1.#QNAN", 1.#SNAN" or 1.#IND"! + +*/ + +#include +using std::cout; +using std::endl; +#include +using std::locale; +#include +using std::string; +#include + using std::stringstream; +#include +using std::numeric_limits; + +int main() +{ + locale default_locale; // Current global locale. + // Try to use the default locale first. + // On MSVC this doesn't work. + + { // Try infinity. + stringstream ss; // Both input and output. + ss.imbue(default_locale); // Redundant, of course. + string infs; + if(numeric_limits::has_infinity) + { // Make sure infinity is specialised for type double. + double inf = numeric_limits::infinity(); + ss << inf; // Output infinity. + infs = ss.str(); // + } + else + { // Need to provide a suitable string for infinity. + infs = "1.#INF"; // Might suit MSVC? + ss << infs; + } + double r; + ss >> r; // Read back in. + + cout << "infinity output was " << infs << endl; // "1.#INF" + cout << "infinity input was " << r << endl; // "1" + } + + { // Try Quiet NaN + stringstream ss; // Both input and output. + ss.imbue(default_locale); // Redundant, of course. + string infs; + if(numeric_limits::has_quiet_NaN) + { // Make sure quiet NaN is specialised for type double. + double qnan = numeric_limits::quiet_NaN(); + ss << qnan; // Output quiet_NaN. + infs = ss.str(); // + } + else + { // Need to provide a suitable string for quiet_NAN. + infs = "1.#QNAN"; + ss << infs; + } + double r; + ss >> r; // Read back in. + + cout << "quiet_NaN output was " << infs << endl; // "1.#QNAN" + cout << "quiet_NaN input was " << r << endl; // "1#" + } + + +} // int main() + +/* + +Output (MSVC Version 10.0): + + + infinity output was 1.#INF + infinity input was 1 + quiet_NaN output was 1.#QNAN + quiet_NaN input was 1 + + +*/ + diff --git a/src/boost/libs/math/example/trapezoidal_example.cpp b/src/boost/libs/math/example/trapezoidal_example.cpp new file mode 100644 index 00000000..bbea6415 --- /dev/null +++ b/src/boost/libs/math/example/trapezoidal_example.cpp @@ -0,0 +1,29 @@ +/* + * Copyright Nick Thompson, 2017 + * 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) + * + * This example shows to to numerically integrate a periodic function using the adaptive_trapezoidal routine provided by boost. + */ + +#include +#include +#include +#include + +int main() +{ + using boost::math::constants::two_pi; + using boost::math::constants::third; + using boost::math::quadrature::trapezoidal; + // This function has an analytic form for its integral over a period: 2pi/3. + auto f = [](double x) { return 1/(5 - 4*cos(x)); }; + + double Q = trapezoidal(f, (double) 0, two_pi()); + + std::cout << std::setprecision(std::numeric_limits::digits10); + std::cout << "The adaptive trapezoidal rule gives the integral of our function as " << Q << "\n"; + std::cout << "The exact result is " << two_pi()*third() << "\n"; + +} diff --git a/src/boost/libs/math/include_private/boost/math/constants/generate.hpp b/src/boost/libs/math/include_private/boost/math/constants/generate.hpp new file mode 100644 index 00000000..2c29be71 --- /dev/null +++ b/src/boost/libs/math/include_private/boost/math/constants/generate.hpp @@ -0,0 +1,76 @@ +// Copyright John Maddock 2010. +// 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) + +#ifndef BOOST_MATH_CONSTANTS_GENERATE_INCLUDED +#define BOOST_MATH_CONSTANTS_GENERATE_INCLUDED + +#include +#include +#include +#include +#include + +#ifdef USE_MPFR +#include +#elif defined(USE_MPREAL) +#include +#elif defined(USE_CPP_FLOAT) +#include +#else +#include +#endif + +namespace boost{ namespace math{ namespace constants{ + +#ifdef USE_MPFR +typedef mpfr_class generator_type; +#elif defined(USE_MPREAL) +typedef mpfr::mpreal generator_type; +#elif defined(USE_CPP_FLOAT) +typedef boost::multiprecision::number > generator_type; +#else +typedef ntl::RR generator_type; +#endif + +inline void print_constant(const char* name, generator_type(*f)(const mpl::int_<0>&)) +{ +#ifdef USE_MPFR + mpfr_class::set_dprec(((200 + 1) * 1000L) / 301L); +#elif defined(USE_MPREAL) + mpfr::mpreal::set_default_prec(((200 + 1) * 1000L) / 301L); +#elif defined(USE_CPP_FLOAT) + // Nothing to do, precision is already set. +#else + ntl::RR::SetPrecision(((200 + 1) * 1000L) / 301L); + ntl::RR::SetOutputPrecision(102); +#endif + generator_type value = f(boost::mpl::int_<0>()); + std::stringstream os; + os << std::setprecision(110) << std::scientific; + os << value; + std::string s = os.str(); + static const regex e("([+-]?\\d+(?:\\.\\d{0,36})?)(\\d*)(?:e([+-]?\\d+))?"); + smatch what; + if(regex_match(s, what, e)) + { + std::cout << + "BOOST_DEFINE_MATH_CONSTANT(" << name << ", " + << what[1] << "e" << (what[3].length() ? what[3].str() : std::string("0")) << ", " + << "\"" << what[1] << what[2] << "e" << (what[3].length() ? what[3].str() : std::string("0")) + << "\");" << std::endl; + } + else + { + std::cout << "Format of numeric constant was not recognised!!" << std::endl; + } +} + +#define BOOST_CONSTANTS_GENERATE(name) \ + boost::math::constants::print_constant(#name, \ + & boost::math::constants::detail::BOOST_JOIN(constant_, name)::get) + +}}} // namespaces + +#endif // BOOST_MATH_CONSTANTS_GENERATE_INCLUDED diff --git a/src/boost/libs/math/include_private/boost/math/tools/iteration_logger.hpp b/src/boost/libs/math/include_private/boost/math/tools/iteration_logger.hpp new file mode 100644 index 00000000..c272a17d --- /dev/null +++ b/src/boost/libs/math/include_private/boost/math/tools/iteration_logger.hpp @@ -0,0 +1,77 @@ +// Copyright John Maddock 2014. +// 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) + +#ifndef BOOST_MATH_TOOLS_ITERATION_LOGGER +#define BOOST_MATH_TOOLS_ITERATION_LOGGER + +#include +#include +#include +#include +#include +#include +#include + +namespace boost{ namespace math{ namespace detail{ + +struct logger +{ + std::map, unsigned long long> data; + + ~logger() + { + for(std::map, unsigned long long>::const_iterator i = data.begin(); i != data.end(); ++i) + { + std::cout << "Logging iteration data:\n file: " << i->first.first + << "\n function: " << i->first.second + << "\n count: " << i->second << std::endl; + // + // Read in existing data: + // + std::map file_data; + std::string filename = i->first.first + ".logfile"; + std::ifstream is(filename.c_str()); + while(is.good()) + { + std::string f; + unsigned long long c; + is >> std::ws; + std::getline(is, f); + is >> c; + if(f.size()) + file_data[f] = c; + } + is.close(); + if(file_data.find(i->first.second) != file_data.end()) + file_data[i->first.second] += i->second; + else + file_data[i->first.second] = i->second; + // + // Write it out again: + // + std::ofstream os(filename.c_str()); + for(std::map::const_iterator j = file_data.begin(); j != file_data.end(); ++j) + os << j->first << "\n " << j->second << std::endl; + os.close(); + } + } +}; + +inline void log_iterations(const char* file, const char* function, unsigned long long count) +{ + static logger l; + std::pair key(file, function); + if(l.data.find(key) == l.data.end()) + l.data[key] = 0; + l.data[key] += count; +} + +#define BOOST_MATH_LOG_COUNT(count) boost::math::detail::log_iterations(__FILE__, BOOST_CURRENT_FUNCTION, count); + + +}}} // namespaces + +#endif // BOOST_MATH_TOOLS_ITERATION_LOGGER + diff --git a/src/boost/libs/math/include_private/boost/math/tools/remez.hpp b/src/boost/libs/math/include_private/boost/math/tools/remez.hpp new file mode 100644 index 00000000..44a3412f --- /dev/null +++ b/src/boost/libs/math/include_private/boost/math/tools/remez.hpp @@ -0,0 +1,667 @@ +// (C) Copyright John Maddock 2006. +// 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) + +#ifndef BOOST_MATH_TOOLS_REMEZ_HPP +#define BOOST_MATH_TOOLS_REMEZ_HPP + +#ifdef _MSC_VER +#pragma once +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost{ namespace math{ namespace tools{ + +namespace detail{ + +// +// The error function: the difference between F(x) and +// the current approximation. This is the function +// for which we must find the extema. +// +template +struct remez_error_function +{ + typedef boost::function1 function_type; +public: + remez_error_function( + function_type f_, + const polynomial& n, + const polynomial& d, + bool rel_err) + : f(f_), numerator(n), denominator(d), rel_error(rel_err) {} + + T operator()(const T& z)const + { + T y = f(z); + T abs = y - (numerator.evaluate(z) / denominator.evaluate(z)); + T err; + if(rel_error) + { + if(y != 0) + err = abs / fabs(y); + else if(0 == abs) + { + // we must be at a root, or it's not recoverable: + BOOST_ASSERT(0 == abs); + err = 0; + } + else + { + // We have a divide by zero! + // Lets assume that f(x) is zero as a result of + // internal cancellation error that occurs as a result + // of shifting a root at point z to the origin so that + // the approximation can be "pinned" to pass through + // the origin: in that case it really + // won't matter what our approximation calculates here + // as long as it's a small number, return the absolute error: + err = abs; + } + } + else + err = abs; + return err; + } +private: + function_type f; + polynomial numerator; + polynomial denominator; + bool rel_error; +}; +// +// This function adapts the error function so that it's minima +// are the extema of the error function. We can find the minima +// with standard techniques. +// +template +struct remez_max_error_function +{ + remez_max_error_function(const remez_error_function& f) + : func(f) {} + + T operator()(const T& x) + { + BOOST_MATH_STD_USING + return -fabs(func(x)); + } +private: + remez_error_function func; +}; + +} // detail + +template +class remez_minimax +{ +public: + typedef boost::function1 function_type; + typedef boost::numeric::ublas::vector vector_type; + typedef boost::numeric::ublas::matrix matrix_type; + + remez_minimax(function_type f, unsigned oN, unsigned oD, T a, T b, bool pin = true, bool rel_err = false, int sk = 0, int bits = 0); + remez_minimax(function_type f, unsigned oN, unsigned oD, T a, T b, bool pin, bool rel_err, int sk, int bits, const vector_type& points); + + void reset(unsigned oN, unsigned oD, T a, T b, bool pin = true, bool rel_err = false, int sk = 0, int bits = 0); + void reset(unsigned oN, unsigned oD, T a, T b, bool pin, bool rel_err, int sk, int bits, const vector_type& points); + + void set_brake(int b) + { + BOOST_ASSERT(b < 100); + BOOST_ASSERT(b >= 0); + m_brake = b; + } + + T iterate(); + + polynomial denominator()const; + polynomial numerator()const; + + vector_type const& chebyshev_points()const + { + return control_points; + } + + vector_type const& zero_points()const + { + return zeros; + } + + T error_term()const + { + return solution[solution.size() - 1]; + } + T max_error()const + { + return m_max_error; + } + T max_change()const + { + return m_max_change; + } + void rotate() + { + --orderN; + ++orderD; + } + void rescale(T a, T b) + { + T scale = (b - a) / (max - min); + for(unsigned i = 0; i < control_points.size(); ++i) + { + control_points[i] = (control_points[i] - min) * scale + a; + } + min = a; + max = b; + } +private: + + void init_chebyshev(); + + function_type func; // The function to approximate. + vector_type control_points; // Current control points to be used for the next iteration. + vector_type solution; // Solution from the last iteration contains all unknowns including the error term. + vector_type zeros; // Location of points of zero error from last iteration, plus the two end points. + vector_type maxima; // Location of maxima of the error function, actually contains the control points used for the last iteration. + T m_max_error; // Maximum error found in last approximation. + T m_max_change; // Maximum change in location of control points after last iteration. + unsigned orderN; // Order of the numerator polynomial. + unsigned orderD; // Order of the denominator polynomial. + T min, max; // End points of the range to optimise over. + bool rel_error; // If true optimise for relative not absolute error. + bool pinned; // If true the approximation is "pinned" to go through the origin. + unsigned unknowns; // Total number of unknowns. + int m_precision; // Number of bits precision to which the zeros and maxima are found. + T m_max_change_history[2]; // Past history of changes to control points. + int m_brake; // amount to break by in percentage points. + int m_skew; // amount to skew starting points by in percentage points: -100-100 +}; + +#ifndef BRAKE +#define BRAKE 0 +#endif +#ifndef SKEW +#define SKEW 0 +#endif + +template +void remez_minimax::init_chebyshev() +{ + BOOST_MATH_STD_USING + // + // Fill in the zeros: + // + unsigned terms = pinned ? orderD + orderN : orderD + orderN + 1; + + for(unsigned i = 0; i < terms; ++i) + { + T cheb = cos((2 * terms - 1 - 2 * i) * constants::pi() / (2 * terms)); + cheb += 1; + cheb /= 2; + if(m_skew != 0) + { + T p = static_cast(200 + m_skew) / 200; + cheb = pow(cheb, p); + } + cheb *= (max - min); + cheb += min; + zeros[i+1] = cheb; + } + zeros[0] = min; + zeros[unknowns] = max; + // perform a regular interpolation fit: + matrix_type A(terms, terms); + vector_type b(terms); + // fill in the y values: + for(unsigned i = 0; i < b.size(); ++i) + { + b[i] = func(zeros[i+1]); + } + // fill in powers of x evaluated at each of the control points: + unsigned offsetN = pinned ? 0 : 1; + unsigned offsetD = offsetN + orderN; + unsigned maxorder = (std::max)(orderN, orderD); + for(unsigned i = 0; i < b.size(); ++i) + { + T x0 = zeros[i+1]; + T x = x0; + if(!pinned) + A(i, 0) = 1; + for(unsigned j = 0; j < maxorder; ++j) + { + if(j < orderN) + A(i, j + offsetN) = x; + if(j < orderD) + { + A(i, j + offsetD) = -x * b[i]; + } + x *= x0; + } + } + // + // Now go ahead and solve the expression to get our solution: + // + vector_type l_solution = boost::math::tools::solve(A, b); + // need to add a "fake" error term: + l_solution.resize(unknowns); + l_solution[unknowns-1] = 0; + solution = l_solution; + // + // Now find all the extrema of the error function: + // + detail::remez_error_function Err(func, this->numerator(), this->denominator(), rel_error); + detail::remez_max_error_function Ex(Err); + m_max_error = 0; + //int max_err_location = 0; + for(unsigned i = 0; i < unknowns; ++i) + { + std::pair r = brent_find_minima(Ex, zeros[i], zeros[i+1], m_precision); + maxima[i] = r.first; + T rel_err = fabs(r.second); + if(rel_err > m_max_error) + { + m_max_error = fabs(r.second); + //max_err_location = i; + } + } + control_points = maxima; +} + +template +void remez_minimax::reset( + unsigned oN, + unsigned oD, + T a, + T b, + bool pin, + bool rel_err, + int sk, + int bits) +{ + control_points = vector_type(oN + oD + (pin ? 1 : 2)); + solution = control_points; + zeros = vector_type(oN + oD + (pin ? 2 : 3)); + maxima = control_points; + orderN = oN; + orderD = oD; + rel_error = rel_err; + pinned = pin; + m_skew = sk; + min = a; + max = b; + m_max_error = 0; + unknowns = orderN + orderD + (pinned ? 1 : 2); + // guess our initial control points: + control_points[0] = min; + control_points[unknowns - 1] = max; + T interval = (max - min) / (unknowns - 1); + T spot = min + interval; + for(unsigned i = 1; i < control_points.size(); ++i) + { + control_points[i] = spot; + spot += interval; + } + solution[unknowns - 1] = 0; + m_max_error = 0; + if(bits == 0) + { + // don't bother about more than float precision: + m_precision = (std::min)(24, (boost::math::policies::digits >() / 2) - 2); + } + else + { + // can't be more accurate than half the bits of T: + m_precision = (std::min)(bits, (boost::math::policies::digits >() / 2) - 2); + } + m_max_change_history[0] = m_max_change_history[1] = 1; + init_chebyshev(); + // do one iteration whatever: + //iterate(); +} + +template +inline remez_minimax::remez_minimax( + typename remez_minimax::function_type f, + unsigned oN, + unsigned oD, + T a, + T b, + bool pin, + bool rel_err, + int sk, + int bits) + : func(f) +{ + m_brake = 0; + reset(oN, oD, a, b, pin, rel_err, sk, bits); +} + +template +void remez_minimax::reset( + unsigned oN, + unsigned oD, + T a, + T b, + bool pin, + bool rel_err, + int sk, + int bits, + const vector_type& points) +{ + control_points = vector_type(oN + oD + (pin ? 1 : 2)); + solution = control_points; + zeros = vector_type(oN + oD + (pin ? 2 : 3)); + maxima = control_points; + orderN = oN; + orderD = oD; + rel_error = rel_err; + pinned = pin; + m_skew = sk; + min = a; + max = b; + m_max_error = 0; + unknowns = orderN + orderD + (pinned ? 1 : 2); + control_points = points; + solution[unknowns - 1] = 0; + m_max_error = 0; + if(bits == 0) + { + // don't bother about more than float precision: + m_precision = (std::min)(24, (boost::math::policies::digits >() / 2) - 2); + } + else + { + // can't be more accurate than half the bits of T: + m_precision = (std::min)(bits, (boost::math::policies::digits >() / 2) - 2); + } + m_max_change_history[0] = m_max_change_history[1] = 1; + // do one iteration whatever: + //iterate(); +} + +template +inline remez_minimax::remez_minimax( + typename remez_minimax::function_type f, + unsigned oN, + unsigned oD, + T a, + T b, + bool pin, + bool rel_err, + int sk, + int bits, + const vector_type& points) + : func(f) +{ + m_brake = 0; + reset(oN, oD, a, b, pin, rel_err, sk, bits, points); +} + +template +T remez_minimax::iterate() +{ + BOOST_MATH_STD_USING + matrix_type A(unknowns, unknowns); + vector_type b(unknowns); + + // fill in evaluation of f(x) at each of the control points: + for(unsigned i = 0; i < b.size(); ++i) + { + // take care that none of our control points are at the origin: + if(pinned && (control_points[i] == 0)) + { + if(i) + control_points[i] = control_points[i-1] / 3; + else + control_points[i] = control_points[i+1] / 3; + } + b[i] = func(control_points[i]); + } + + T err_err; + unsigned convergence_count = 0; + do{ + // fill in powers of x evaluated at each of the control points: + int sign = 1; + unsigned offsetN = pinned ? 0 : 1; + unsigned offsetD = offsetN + orderN; + unsigned maxorder = (std::max)(orderN, orderD); + T Elast = solution[unknowns - 1]; + + for(unsigned i = 0; i < b.size(); ++i) + { + T x0 = control_points[i]; + T x = x0; + if(!pinned) + A(i, 0) = 1; + for(unsigned j = 0; j < maxorder; ++j) + { + if(j < orderN) + A(i, j + offsetN) = x; + if(j < orderD) + { + T mult = rel_error ? T(b[i] - sign * fabs(b[i]) * Elast): T(b[i] - sign * Elast); + A(i, j + offsetD) = -x * mult; + } + x *= x0; + } + // The last variable to be solved for is the error term, + // sign changes with each control point: + T E = rel_error ? T(sign * fabs(b[i])) : T(sign); + A(i, unknowns - 1) = E; + sign = -sign; + } + + #ifdef BOOST_MATH_INSTRUMENT + for(unsigned i = 0; i < b.size(); ++i) + std::cout << b[i] << " "; + std::cout << "\n\n"; + for(unsigned i = 0; i < b.size(); ++i) + { + for(unsigned j = 0; j < b.size(); ++ j) + std::cout << A(i, j) << " "; + std::cout << "\n"; + } + std::cout << std::endl; + #endif + // + // Now go ahead and solve the expression to get our solution: + // + solution = boost::math::tools::solve(A, b); + + err_err = (Elast != 0) ? T(fabs((fabs(solution[unknowns-1]) - fabs(Elast)) / fabs(Elast))) : T(1); + }while(orderD && (convergence_count++ < 80) && (err_err > 0.001)); + + // + // Perform a sanity check to verify that the solution to the equations + // is not so much in error as to be useless. The matrix inversion can + // be very close to singular, so this can be a real problem. + // + vector_type sanity = prod(A, solution); + for(unsigned i = 0; i < b.size(); ++i) + { + T err = fabs((b[i] - sanity[i]) / fabs(b[i])); + if(err > sqrt(epsilon())) + { + std::cerr << "Sanity check failed: more than half the digits in the found solution are in error." << std::endl; + } + } + + // + // Next comes another sanity check, we want to verify that all the control + // points do actually alternate in sign, in practice we may have + // additional roots in the error function that cause this to fail. + // Failure here is always fatal: even though this code attempts to correct + // the problem it usually only postpones the inevitable. + // + polynomial num, denom; + num = this->numerator(); + denom = this->denominator(); + T e1 = b[0] - num.evaluate(control_points[0]) / denom.evaluate(control_points[0]); +#ifdef BOOST_MATH_INSTRUMENT + std::cout << e1; +#endif + for(unsigned i = 1; i < b.size(); ++i) + { + T e2 = b[i] - num.evaluate(control_points[i]) / denom.evaluate(control_points[i]); +#ifdef BOOST_MATH_INSTRUMENT + std::cout << " " << e2; +#endif + if(e2 * e1 > 0) + { + std::cerr << std::flush << "Basic sanity check failed: Error term does not alternate in sign, non-recoverable error may follow..." << std::endl; + T perturbation = 0.05; + do{ + T point = control_points[i] * (1 - perturbation) + control_points[i-1] * perturbation; + e2 = func(point) - num.evaluate(point) / denom.evaluate(point); + if(e2 * e1 < 0) + { + control_points[i] = point; + break; + } + perturbation += 0.05; + }while(perturbation < 0.8); + + if((e2 * e1 > 0) && (i + 1 < b.size())) + { + perturbation = 0.05; + do{ + T point = control_points[i] * (1 - perturbation) + control_points[i+1] * perturbation; + e2 = func(point) - num.evaluate(point) / denom.evaluate(point); + if(e2 * e1 < 0) + { + control_points[i] = point; + break; + } + perturbation += 0.05; + }while(perturbation < 0.8); + } + + } + e1 = e2; + } + +#ifdef BOOST_MATH_INSTRUMENT + for(unsigned i = 0; i < solution.size(); ++i) + std::cout << solution[i] << " "; + std::cout << std::endl << this->numerator() << std::endl; + std::cout << this->denominator() << std::endl; + std::cout << std::endl; +#endif + + // + // The next step is to find all the intervals in which our maxima + // lie: + // + detail::remez_error_function Err(func, this->numerator(), this->denominator(), rel_error); + zeros[0] = min; + zeros[unknowns] = max; + for(unsigned i = 1; i < control_points.size(); ++i) + { + eps_tolerance tol(m_precision); + boost::uintmax_t max_iter = 1000; + std::pair p = toms748_solve( + Err, + control_points[i-1], + control_points[i], + tol, + max_iter); + zeros[i] = (p.first + p.second) / 2; + //zeros[i] = bisect(Err, control_points[i-1], control_points[i], m_precision); + } + // + // Now find all the extrema of the error function: + // + detail::remez_max_error_function Ex(Err); + m_max_error = 0; + //int max_err_location = 0; + for(unsigned i = 0; i < unknowns; ++i) + { + std::pair r = brent_find_minima(Ex, zeros[i], zeros[i+1], m_precision); + maxima[i] = r.first; + T rel_err = fabs(r.second); + if(rel_err > m_max_error) + { + m_max_error = fabs(r.second); + //max_err_location = i; + } + } + // + // Almost done now! we just need to set our control points + // to the extrema, and calculate how much each point has changed + // (this will be our termination condition): + // + swap(control_points, maxima); + m_max_change = 0; + //int max_change_location = 0; + for(unsigned i = 0; i < unknowns; ++i) + { + control_points[i] = (control_points[i] * (100 - m_brake) + maxima[i] * m_brake) / 100; + T change = fabs((control_points[i] - maxima[i]) / control_points[i]); +#if 0 + if(change > m_max_change_history[1]) + { + // divergence!!! try capping the change: + std::cerr << "Possible divergent step, change will be capped!!" << std::endl; + change = m_max_change_history[1]; + if(control_points[i] < maxima[i]) + control_points[i] = maxima[i] - change * maxima[i]; + else + control_points[i] = maxima[i] + change * maxima[i]; + } +#endif + if(change > m_max_change) + { + m_max_change = change; + //max_change_location = i; + } + } + // + // store max change information: + // + m_max_change_history[0] = m_max_change_history[1]; + m_max_change_history[1] = fabs(m_max_change); + + return m_max_change; +} + +template +polynomial remez_minimax::numerator()const +{ + boost::scoped_array a(new T[orderN + 1]); + if(pinned) + a[0] = 0; + unsigned terms = pinned ? orderN : orderN + 1; + for(unsigned i = 0; i < terms; ++i) + a[pinned ? i+1 : i] = solution[i]; + return boost::math::tools::polynomial(&a[0], orderN); +} + +template +polynomial remez_minimax::denominator()const +{ + unsigned terms = orderD + 1; + unsigned offsetD = pinned ? orderN : (orderN + 1); + boost::scoped_array a(new T[terms]); + a[0] = 1; + for(unsigned i = 0; i < orderD; ++i) + a[i+1] = solution[i + offsetD]; + return boost::math::tools::polynomial(&a[0], orderD); +} + + +}}} // namespaces + +#endif // BOOST_MATH_TOOLS_REMEZ_HPP + + + diff --git a/src/boost/libs/math/include_private/boost/math/tools/solve.hpp b/src/boost/libs/math/include_private/boost/math/tools/solve.hpp new file mode 100644 index 00000000..78acde26 --- /dev/null +++ b/src/boost/libs/math/include_private/boost/math/tools/solve.hpp @@ -0,0 +1,79 @@ +// (C) Copyright John Maddock 2006. +// 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) + +#ifndef BOOST_MATH_TOOLS_SOLVE_HPP +#define BOOST_MATH_TOOLS_SOLVE_HPP + +#ifdef _MSC_VER +#pragma once +#endif + +#include +#include + +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4996 4267 4244) +#endif + +#include +#include +#include + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +namespace boost{ namespace math{ namespace tools{ + +// +// Find x such that Ax = b +// +// Caution: this uses undocumented, and untested ublas code, +// however short of writing our own LU-decompostion code +// it's the only game in town. +// +template +boost::numeric::ublas::vector solve( + const boost::numeric::ublas::matrix& A_, + const boost::numeric::ublas::vector& b_) +{ + //BOOST_ASSERT(A_.size() == b_.size()); + + boost::numeric::ublas::matrix A(A_); + boost::numeric::ublas::vector b(b_); + boost::numeric::ublas::permutation_matrix<> piv(b.size()); + lu_factorize(A, piv); + lu_substitute(A, piv, b); + // + // iterate to reduce error: + // + boost::numeric::ublas::vector delta(b.size()); + for(unsigned k = 0; k < 1; ++k) + { + noalias(delta) = prod(A_, b); + delta -= b_; + lu_substitute(A, piv, delta); + b -= delta; + + T max_error = 0; + + for(unsigned i = 0; i < delta.size(); ++i) + { + T err = fabs(delta[i] / b[i]); + if(err > max_error) + max_error = err; + } + //std::cout << "Max change in LU error correction: " << max_error << std::endl; + } + + return b; +} + +}}} // namespaces + +#endif // BOOST_MATH_TOOLS_SOLVE_HPP + + diff --git a/src/boost/libs/math/include_private/boost/math/tools/test.hpp b/src/boost/libs/math/include_private/boost/math/tools/test.hpp new file mode 100644 index 00000000..14b7e2b4 --- /dev/null +++ b/src/boost/libs/math/include_private/boost/math/tools/test.hpp @@ -0,0 +1,311 @@ +// (C) Copyright John Maddock 2006. +// 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) + +#ifndef BOOST_MATH_TOOLS_TEST_HPP +#define BOOST_MATH_TOOLS_TEST_HPP + +#ifdef _MSC_VER +#pragma once +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost{ namespace math{ namespace tools{ + +template +struct test_result +{ +private: + boost::math::tools::stats stat; // Statistics for the test. + unsigned worst_case; // Index of the worst case test. +public: + test_result() { worst_case = 0; } + void set_worst(int i){ worst_case = i; } + void add(const T& point){ stat.add(point); } + // accessors: + unsigned worst()const{ return worst_case; } + T min BOOST_PREVENT_MACRO_SUBSTITUTION()const{ return (stat.min)(); } + T max BOOST_PREVENT_MACRO_SUBSTITUTION()const{ return (stat.max)(); } + T total()const{ return stat.total(); } + T mean()const{ return stat.mean(); } + boost::uintmax_t count()const{ return stat.count(); } + T variance()const{ return stat.variance(); } + T variance1()const{ return stat.variance1(); } + T rms()const{ return stat.rms(); } + + test_result& operator+=(const test_result& t) + { + if((t.stat.max)() > (stat.max)()) + worst_case = t.worst_case; + stat += t.stat; + return *this; + } +}; + +template +struct calculate_result_type +{ + typedef typename T::value_type row_type; + typedef typename row_type::value_type value_type; +}; + +template +T relative_error(T a, T b) +{ + return boost::math::relative_difference(a, b); +} + + +template +void set_output_precision(T, std::ostream& os) +{ +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4127) +#endif + if(std::numeric_limits::digits10) + { + os << std::setprecision(std::numeric_limits::digits10 + 2); + } +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif +} + +template +void print_row(const Seq& row, std::ostream& os = std::cout) +{ + try { + set_output_precision(row[0], os); + for (unsigned i = 0; i < row.size(); ++i) + { + if (i) + os << ", "; + os << row[i]; + } + os << std::endl; + } + catch (const std::exception&) {} +} + +// +// Function test accepts an matrix of input values (probably a 2D boost::array) +// and calls two functors for each row in the array - one calculates a value +// to test, and one extracts the expected value from the array (or possibly +// calculates it at high precision). The two functors are usually simple lambda +// expressions. +// +template +test_result::value_type> test(const A& a, F1 test_func, F2 expect_func) +{ + typedef typename A::value_type row_type; + typedef typename row_type::value_type value_type; + + test_result result; + + for(unsigned i = 0; i < a.size(); ++i) + { + const row_type& row = a[i]; + value_type point; +#ifndef BOOST_NO_EXCEPTIONS + try + { +#endif + point = test_func(row); +#ifndef BOOST_NO_EXCEPTIONS + } + catch(const std::underflow_error&) + { + point = 0; + } + catch(const std::overflow_error&) + { + point = std::numeric_limits::has_infinity ? + std::numeric_limits::infinity() + : tools::max_value(); + } + catch(const std::exception& e) + { + std::cerr << e.what() << std::endl; + print_row(row, std::cerr); + BOOST_ERROR("Unexpected exception."); + // so we don't get further errors: + point = expect_func(row); + } +#endif + value_type expected = expect_func(row); + value_type err = relative_error(point, expected); +#ifdef BOOST_INSTRUMENT + if(err != 0) + { + std::cout << row[0] << " " << err; + if(std::numeric_limits::is_specialized) + { + std::cout << " (" << err / std::numeric_limits::epsilon() << "eps)"; + } + std::cout << std::endl; + } +#endif + if(!(boost::math::isfinite)(point) && (boost::math::isfinite)(expected)) + { + std::cerr << "CAUTION: Found non-finite result, when a finite value was expected at entry " << i << "\n"; + std::cerr << "Found: " << point << " Expected " << expected << " Error: " << err << std::endl; + print_row(row, std::cerr); + BOOST_ERROR("Unexpected non-finite result"); + } + if(err > 0.5) + { + std::cerr << "CAUTION: Gross error found at entry " << i << ".\n"; + std::cerr << "Found: " << point << " Expected " << expected << " Error: " << err << std::endl; + print_row(row, std::cerr); + BOOST_ERROR("Gross error"); + } + result.add(err); + if((result.max)() == err) + result.set_worst(i); + } + return result; +} + +template +test_result test_hetero(const A& a, F1 test_func, F2 expect_func) +{ + typedef typename A::value_type row_type; + typedef Real value_type; + + test_result result; + + for(unsigned i = 0; i < a.size(); ++i) + { + const row_type& row = a[i]; + value_type point; +#ifndef BOOST_NO_EXCEPTIONS + try + { +#endif + point = test_func(row); +#ifndef BOOST_NO_EXCEPTIONS + } + catch(const std::underflow_error&) + { + point = 0; + } + catch(const std::overflow_error&) + { + point = std::numeric_limits::has_infinity ? + std::numeric_limits::infinity() + : tools::max_value(); + } + catch(const std::exception& e) + { + std::cerr << "Unexpected exception at entry: " << i << "\n"; + std::cerr << e.what() << std::endl; + print_row(row, std::cerr); + BOOST_ERROR("Unexpected exception."); + // so we don't get further errors: + point = expect_func(row); + } +#endif + value_type expected = expect_func(row); + value_type err = relative_error(point, expected); +#ifdef BOOST_INSTRUMENT + if(err != 0) + { + std::cout << row[0] << " " << err; + if(std::numeric_limits::is_specialized) + { + std::cout << " (" << err / std::numeric_limits::epsilon() << "eps)"; + } + std::cout << std::endl; + } +#endif + if(!(boost::math::isfinite)(point) && (boost::math::isfinite)(expected)) + { + std::cerr << "CAUTION: Found non-finite result, when a finite value was expected at entry " << i << "\n"; + std::cerr << "Found: " << point << " Expected " << expected << " Error: " << err << std::endl; + print_row(row, std::cerr); + BOOST_ERROR("Unexpected non-finite result"); + } + if(err > 0.5) + { + std::cerr << "CAUTION: Gross error found at entry " << i << ".\n"; + std::cerr << "Found: " << point << " Expected " << expected << " Error: " << err << std::endl; + print_row(row, std::cerr); + BOOST_ERROR("Gross error"); + } + result.add(err); + if((result.max)() == err) + result.set_worst(i); + } + return result; +} + +template +void test_check_throw(Val v, Exception e) +{ + BOOST_CHECK(errno); + errno = 0; +} + +template +void test_check_throw(Val val, std::domain_error const* e) +{ + BOOST_CHECK(errno == EDOM); + errno = 0; + if(std::numeric_limits::has_quiet_NaN) + { + BOOST_CHECK((boost::math::isnan)(val)); + } +} + +template +void test_check_throw(Val v, std::overflow_error const* e) +{ + BOOST_CHECK(errno == ERANGE); + errno = 0; + BOOST_CHECK((v >= boost::math::tools::max_value()) || (v <= -boost::math::tools::max_value())); +} + +template +void test_check_throw(Val v, boost::math::rounding_error const* e) +{ + BOOST_CHECK(errno == ERANGE); + errno = 0; + if(std::numeric_limits::is_specialized && std::numeric_limits::is_integer) + { + BOOST_CHECK((v == (std::numeric_limits::max)()) || (v == (std::numeric_limits::min)())); + } + else + { + BOOST_CHECK((v == boost::math::tools::max_value()) || (v == -boost::math::tools::max_value())); + } +} + +} // namespace tools +} // namespace math +} // namespace boost + + + // + // exception-free testing support, ideally we'd only define this in our tests, + // but to keep things simple we really need it somewhere that's always included: + // +#ifdef BOOST_NO_EXCEPTIONS +# define BOOST_MATH_CHECK_THROW(x, ExceptionType) boost::math::tools::test_check_throw(x, static_cast(0)); +#else +# define BOOST_MATH_CHECK_THROW(x, y) BOOST_CHECK_THROW(x, y) +#endif + +#endif + + diff --git a/src/boost/libs/math/include_private/boost/math/tools/test_data.hpp b/src/boost/libs/math/include_private/boost/math/tools/test_data.hpp new file mode 100644 index 00000000..c2b37583 --- /dev/null +++ b/src/boost/libs/math/include_private/boost/math/tools/test_data.hpp @@ -0,0 +1,967 @@ +// (C) Copyright John Maddock 2006. +// 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) + +#ifndef BOOST_MATH_TOOLS_TEST_DATA_HPP +#define BOOST_MATH_TOOLS_TEST_DATA_HPP + +#ifdef _MSC_VER +#pragma once +#endif + +#include +#include +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable: 4127 4701 4512) +# pragma warning(disable: 4130) // '==' : logical operation on address of string constant. +#endif +#include +#include +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif +#include +#include +#include +#ifndef BOOST_NO_CXX11_HDR_RANDOM +#include +namespace random_ns = std; +#else +#include +namespace random_ns = boost::random; +#endif +#include +#include + +#include +#include +#include + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable: 4130) // '==' : logical operation on address of string constant. +// Used as a warning with BOOST_ASSERT +#endif + +namespace boost{ namespace math{ namespace tools{ + +enum parameter_type +{ + random_in_range = 0, + periodic_in_range = 1, + power_series = 2, + single_value = 3, + plus_minus_value = 4, + dummy_param = 0x80 +}; + +parameter_type operator | (parameter_type a, parameter_type b) +{ + return static_cast((int)a|(int)b); +} +parameter_type& operator |= (parameter_type& a, parameter_type b) +{ + a = static_cast(a|b); + return a; +} + +// +// If type == random_in_range then +// z1 and r2 are the endpoints of the half open range and n1 is the number of points. +// +// If type == periodic_in_range then +// z1 and r2 are the endpoints of the half open range and n1 is the number of points. +// +// If type == power_series then +// n1 and n2 are the endpoints of the exponents (closed range) and z1 is the basis. +// +// If type == single_value then z1 contains the single value to add. +// +// If type == plus_minus_value then test at +-z1 +// +// If type & dummy_param then this data is ignored and not stored in the output, it +// is passed to the generator function however which can do with it as it sees fit. +// +template +struct parameter_info +{ + parameter_type type; + T z1, z2; + int n1, n2; +}; + +template +inline parameter_info make_random_param(T start_range, T end_range, int n_points) +{ + parameter_info result = { random_in_range, start_range, end_range, n_points, 0 }; + return result; +} + +template +inline parameter_info make_periodic_param(T start_range, T end_range, int n_points) +{ + parameter_info result = { periodic_in_range, start_range, end_range, n_points, 0 }; + return result; +} + +template +inline parameter_info make_power_param(T basis, int start_exponent, int end_exponent) +{ + parameter_info result = { power_series, basis, 0, start_exponent, end_exponent }; + return result; +} + +template +inline parameter_info make_single_param(T val) +{ + parameter_info result = { single_value, val }; + return result; +} + +template +inline parameter_info make_plus_minus_param(T val) +{ + parameter_info result = { plus_minus_value, val }; + return result; +} + +namespace detail{ + +template +inline void unpack_and_append_tuple(Seq&, + const Item&, + const boost::integral_constant&, + const boost::false_type&) +{ + // termimation condition nothing to do here +} + +template +inline void unpack_and_append_tuple(Seq& s, + const Item& data, + const boost::integral_constant&, + const boost::true_type&) +{ + // extract the N'th element, append, and recurse: + typedef typename Seq::value_type value_type; + value_type val = boost::math::get(data); + s.push_back(val); + + typedef boost::integral_constant next_value; + typedef boost::integral_constant::value > N+1)> terminate; + + unpack_and_append_tuple(s, data, next_value(), terminate()); +} + +template +inline void unpack_and_append(Seq& s, const Item& data, const boost::true_type&) +{ + s.push_back(data); +} + +template +inline void unpack_and_append(Seq& s, const Item& data, const boost::false_type&) +{ + // Item had better be a tuple-like type or we've had it!!!! + typedef boost::integral_constant next_value; + typedef boost::integral_constant::value > 0)> terminate; + + unpack_and_append_tuple(s, data, next_value(), terminate()); +} + +template +inline void unpack_and_append(Seq& s, const Item& data) +{ + typedef typename Seq::value_type value_type; + unpack_and_append(s, data, ::boost::is_convertible()); +} + +} // detail + +template +class test_data +{ +public: + typedef std::vector row_type; + typedef row_type value_type; +private: + typedef std::set container_type; +public: + typedef typename container_type::reference reference; + typedef typename container_type::const_reference const_reference; + typedef typename container_type::iterator iterator; + typedef typename container_type::const_iterator const_iterator; + typedef typename container_type::difference_type difference_type; + typedef typename container_type::size_type size_type; + + // creation: + test_data(){} + template + test_data(F func, const parameter_info& arg1) + { + insert(func, arg1); + } + + // insertion: + template + test_data& insert(F func, const parameter_info& arg1) + { + // generate data for single argument functor F + + typedef typename std::set::const_iterator it_type; + + std::set points; + create_test_points(points, arg1); + it_type a = points.begin(); + it_type b = points.end(); + row_type row; + while(a != b) + { + if((arg1.type & dummy_param) == 0) + row.push_back(*a); +#ifndef BOOST_NO_EXCEPTIONS + try{ +#endif + // domain_error exceptions from func are swallowed + // and this data point is ignored: + boost::math::tools::detail::unpack_and_append(row, func(*a)); + m_data.insert(row); +#ifndef BOOST_NO_EXCEPTIONS + } + catch(const std::domain_error&){} +#endif + row.clear(); + ++a; + } + return *this; + } + + template + test_data& insert(F func, const parameter_info& arg1, const parameter_info& arg2) + { + // generate data for 2-argument functor F + + typedef typename std::set::const_iterator it_type; + + std::set points1, points2; + create_test_points(points1, arg1); + create_test_points(points2, arg2); + it_type a = points1.begin(); + it_type b = points1.end(); + row_type row; + while(a != b) + { + it_type c = points2.begin(); + it_type d = points2.end(); + while(c != d) + { + if((arg1.type & dummy_param) == 0) + row.push_back(*a); + if((arg2.type & dummy_param) == 0) + row.push_back(*c); +#ifndef BOOST_NO_EXCEPTIONS + try{ +#endif + // domain_error exceptions from func are swallowed + // and this data point is ignored: + detail::unpack_and_append(row, func(*a, *c)); + m_data.insert(row); +#ifndef BOOST_NO_EXCEPTIONS + } + catch(const std::domain_error&){} +#endif + row.clear(); + ++c; + } + ++a; + } + return *this; + } + + template + test_data& insert(F func, const parameter_info& arg1, const parameter_info& arg2, const parameter_info& arg3) + { + // generate data for 3-argument functor F + + typedef typename std::set::const_iterator it_type; + + std::set points1, points2, points3; + create_test_points(points1, arg1); + create_test_points(points2, arg2); + create_test_points(points3, arg3); + it_type a = points1.begin(); + it_type b = points1.end(); + row_type row; + while(a != b) + { + it_type c = points2.begin(); + it_type d = points2.end(); + while(c != d) + { + it_type e = points3.begin(); + it_type f = points3.end(); + while(e != f) + { + if((arg1.type & dummy_param) == 0) + row.push_back(*a); + if((arg2.type & dummy_param) == 0) + row.push_back(*c); + if((arg3.type & dummy_param) == 0) + row.push_back(*e); +#ifndef BOOST_NO_EXCEPTIONS + try{ +#endif + // domain_error exceptions from func are swallowed + // and this data point is ignored: + detail::unpack_and_append(row, func(*a, *c, *e)); + m_data.insert(row); +#ifndef BOOST_NO_EXCEPTIONS + } + catch(const std::domain_error&){} +#endif + row.clear(); + ++e; + } + ++c; + } + ++a; + } + return *this; + } + + template + test_data& insert(F func, const parameter_info& arg1, const parameter_info& arg2, const parameter_info& arg3, const parameter_info& arg4) + { + // generate data for 4-argument functor F + + typedef typename std::set::const_iterator it_type; + + std::set points1, points2, points3, points4; + create_test_points(points1, arg1); + create_test_points(points2, arg2); + create_test_points(points3, arg3); + create_test_points(points4, arg4); + it_type a = points1.begin(); + it_type b = points1.end(); + row_type row; + while(a != b) + { + it_type c = points2.begin(); + it_type d = points2.end(); + while(c != d) + { + it_type e = points3.begin(); + it_type f = points3.end(); + while(e != f) + { + it_type g = points4.begin(); + it_type h = points4.end(); + while (g != h) + { + if ((arg1.type & dummy_param) == 0) + row.push_back(*a); + if ((arg2.type & dummy_param) == 0) + row.push_back(*c); + if ((arg3.type & dummy_param) == 0) + row.push_back(*e); + if ((arg4.type & dummy_param) == 0) + row.push_back(*g); +#ifndef BOOST_NO_EXCEPTIONS + try { +#endif + // domain_error exceptions from func are swallowed + // and this data point is ignored: + detail::unpack_and_append(row, func(*a, *c, *e, *g)); + m_data.insert(row); +#ifndef BOOST_NO_EXCEPTIONS + } + catch (const std::domain_error&) {} +#endif + row.clear(); + ++g; + } + ++e; + } + ++c; + } + ++a; + } + return *this; + } + + template + test_data& insert(F func, const parameter_info& arg1, const parameter_info& arg2, const parameter_info& arg3, const parameter_info& arg4, const parameter_info& arg5) + { + // generate data for 5-argument functor F + + typedef typename std::set::const_iterator it_type; + + std::set points1, points2, points3, points4, points5; + create_test_points(points1, arg1); + create_test_points(points2, arg2); + create_test_points(points3, arg3); + create_test_points(points4, arg4); + create_test_points(points5, arg5); + it_type a = points1.begin(); + it_type b = points1.end(); + row_type row; + while(a != b) + { + it_type c = points2.begin(); + it_type d = points2.end(); + while(c != d) + { + it_type e = points3.begin(); + it_type f = points3.end(); + while(e != f) + { + it_type g = points4.begin(); + it_type h = points4.end(); + while (g != h) + { + it_type i = points5.begin(); + it_type j = points5.end(); + while (i != j) + { + if ((arg1.type & dummy_param) == 0) + row.push_back(*a); + if ((arg2.type & dummy_param) == 0) + row.push_back(*c); + if ((arg3.type & dummy_param) == 0) + row.push_back(*e); + if ((arg4.type & dummy_param) == 0) + row.push_back(*g); + if ((arg5.type & dummy_param) == 0) + row.push_back(*i); +#ifndef BOOST_NO_EXCEPTIONS + try { +#endif + // domain_error exceptions from func are swallowed + // and this data point is ignored: + detail::unpack_and_append(row, func(*a, *c, *e, *g, *i)); + m_data.insert(row); +#ifndef BOOST_NO_EXCEPTIONS + } + catch (const std::domain_error&) {} +#endif + row.clear(); + ++i; + } + ++g; + } + ++e; + } + ++c; + } + ++a; + } + return *this; + } + + void clear(){ m_data.clear(); } + + // access: + iterator begin() { return m_data.begin(); } + iterator end() { return m_data.end(); } + const_iterator begin()const { return m_data.begin(); } + const_iterator end()const { return m_data.end(); } + bool operator==(const test_data& d)const{ return m_data == d.m_data; } + bool operator!=(const test_data& d)const{ return m_data != d.m_data; } + void swap(test_data& other){ m_data.swap(other.m_data); } + size_type size()const{ return m_data.size(); } + size_type max_size()const{ return m_data.max_size(); } + bool empty()const{ return m_data.empty(); } + + bool operator < (const test_data& dat)const{ return m_data < dat.m_data; } + bool operator <= (const test_data& dat)const{ return m_data <= dat.m_data; } + bool operator > (const test_data& dat)const{ return m_data > dat.m_data; } + bool operator >= (const test_data& dat)const{ return m_data >= dat.m_data; } + +private: + void create_test_points(std::set& points, const parameter_info& arg1); + std::set m_data; + + static float extern_val; + static float truncate_to_float(float const * pf); + static float truncate_to_float(float c){ return truncate_to_float(&c); } +}; + +// +// This code exists to bemuse the compiler's optimizer and force a +// truncation to float-precision only: +// +template +inline float test_data::truncate_to_float(float const * pf) +{ + BOOST_MATH_STD_USING + int expon; + float f = floor(ldexp(frexp(*pf, &expon), 22)); + f = ldexp(f, expon - 22); + return f; + + //extern_val = *pf; + //return *pf; +} + +template +float test_data::extern_val = 0; + +template +void test_data::create_test_points(std::set& points, const parameter_info& arg1) +{ + BOOST_MATH_STD_USING + // + // Generate a set of test points as requested, try and generate points + // at only float precision: otherwise when testing float versions of functions + // there will be a rounding error in our input values which throws off the results + // (Garbage in garbage out etc). + // + switch(arg1.type & 0x7F) + { + case random_in_range: + { + BOOST_ASSERT(arg1.z1 < arg1.z2); + BOOST_ASSERT(arg1.n1 > 0); + typedef float random_type; + + random_ns::mt19937 rnd; + random_ns::uniform_real_distribution ur_a(real_cast(arg1.z1), real_cast(arg1.z2)); + + for(int i = 0; i < arg1.n1; ++i) + { + random_type r = ur_a(rnd); + points.insert(truncate_to_float(r)); + } + } + break; + case periodic_in_range: + { + BOOST_ASSERT(arg1.z1 < arg1.z2); + BOOST_ASSERT(arg1.n1 > 0); + float interval = real_cast((arg1.z2 - arg1.z1) / arg1.n1); + T val = arg1.z1; + while(val < arg1.z2) + { + points.insert(truncate_to_float(real_cast(val))); + val += interval; + } + } + break; + case power_series: + { + BOOST_ASSERT(arg1.n1 < arg1.n2); + + typedef float random_type; + typedef typename boost::mpl::if_< + ::boost::is_floating_point, + T, long double>::type power_type; + + random_ns::mt19937 rnd; + random_ns::uniform_real_distribution ur_a(1.0, 2.0); + + for(int power = arg1.n1; power <= arg1.n2; ++power) + { + random_type r = ur_a(rnd); + power_type p = ldexp(static_cast(r), power); + points.insert(truncate_to_float(real_cast(arg1.z1 + p))); + } + } + break; + case single_value: + { + points.insert(truncate_to_float(real_cast(arg1.z1))); + break; + } + case plus_minus_value: + { + points.insert(truncate_to_float(real_cast(arg1.z1))); + points.insert(truncate_to_float(-real_cast(arg1.z1))); + break; + } + default: + BOOST_ASSERT(0 == "Invalid parameter_info object"); + // Assert will fail if get here. + // Triggers warning 4130) // '==' : logical operation on address of string constant. + } +} + +// +// Prompt a user for information on a parameter range: +// +template +bool get_user_parameter_info(parameter_info& info, const char* param_name) +{ +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable: 4127) +#endif + std::string line; + do{ + std::cout << "What kind of distribution do you require for parameter " << param_name << "?\n" + "Choices are:\n" + " r Random values in a half open range\n" + " p Evenly spaced periodic values in a half open range\n" + " e Exponential power series at a particular point: a + 2^b for some range of b\n" + "[Default=r]"; + + std::getline(std::cin, line); + boost::algorithm::trim(line); + + if(line == "r") + { + info.type = random_in_range; + break; + } + else if(line == "p") + { + info.type = periodic_in_range; + break; + } + else if(line == "e") + { + info.type = power_series; + break; + } + else if(line == "") + { + info.type = random_in_range; + break; + } + // + // Ooops, not a valid input.... + // + std::cout << "Sorry don't recognise \"" << line << "\" as a valid input\n" + "do you want to try again [y/n]?"; + std::getline(std::cin, line); + boost::algorithm::trim(line); + if(line == "n") + return false; + else if(line == "y") + continue; + std::cout << "Sorry don't recognise that either, giving up...\n\n"; + return false; + }while(true); + + switch(info.type & ~dummy_param) + { + case random_in_range: + case periodic_in_range: + // get start and end points of range: + do{ + std::cout << "Data will be in the half open range a <= x < b,\n" + "enter value for the start point fo the range [default=0]:"; + std::getline(std::cin, line); + boost::algorithm::trim(line); + if(line == "") + { + info.z1 = 0; + break; + } +#ifndef BOOST_NO_EXCEPTIONS + try{ +#endif + info.z1 = boost::lexical_cast(line); + break; +#ifndef BOOST_NO_EXCEPTIONS + } + catch(const boost::bad_lexical_cast&) + { + std::cout << "Sorry, that was not valid input, try again [y/n]?"; + std::getline(std::cin, line); + boost::algorithm::trim(line); + if(line == "y") + continue; + if(line == "n") + return false; + std::cout << "Sorry don't recognise that either, giving up...\n\n"; + return false; + } +#endif + }while(true); + do{ + std::cout << "Enter value for the end point fo the range [default=1]:"; + std::getline(std::cin, line); + boost::algorithm::trim(line); + if(line == "") + { + info.z2 = 1; + } + else + { +#ifndef BOOST_NO_EXCEPTIONS + try + { +#endif + info.z2 = boost::lexical_cast(line); +#ifndef BOOST_NO_EXCEPTIONS + } + catch(const boost::bad_lexical_cast&) + { + std::cout << "Sorry, that was not valid input, try again [y/n]?"; + std::getline(std::cin, line); + boost::algorithm::trim(line); + if(line == "y") + continue; + if(line == "n") + return false; + std::cout << "Sorry don't recognise that either, giving up...\n\n"; + return false; + } +#endif + } + if(info.z1 >= info.z2) + { + std::cout << "The end point of the range was <= the start point\n" + "try a different value for the endpoint [y/n]?"; + std::getline(std::cin, line); + boost::algorithm::trim(line); + if(line == "y") + continue; + if(line == "n") + return false; + std::cout << "Sorry don't recognise that either, giving up...\n\n"; + return false; + } + break; + }while(true); + do{ + // get the number of points: + std::cout << "How many data points do you want?"; + std::getline(std::cin, line); + boost::algorithm::trim(line); +#ifndef BOOST_NO_EXCEPTIONS + try{ +#endif + info.n1 = boost::lexical_cast(line); + info.n2 = 0; + if(info.n1 <= 0) + { + std::cout << "The number of points should be > 0\n" + "try again [y/n]?"; + std::getline(std::cin, line); + boost::algorithm::trim(line); + if(line == "y") + continue; + if(line == "n") + return false; + std::cout << "Sorry don't recognise that either, giving up...\n\n"; + return false; + } + break; +#ifndef BOOST_NO_EXCEPTIONS + } + catch(const boost::bad_lexical_cast&) + { + std::cout << "Sorry, that was not valid input, try again [y/n]?"; + std::getline(std::cin, line); + boost::algorithm::trim(line); + if(line == "y") + continue; + if(line == "n") + return false; + std::cout << "Sorry don't recognise that either, giving up...\n\n"; + return false; + } +#endif + }while(true); + break; + case power_series: + // get start and end points of range: + info.z2 = 0; + do{ + std::cout << "Data will be in the form a + r*2^b\n" + "for random value r,\n" + "enter value for the point a [default=0]:"; + std::getline(std::cin, line); + boost::algorithm::trim(line); + if(line == "") + { + info.z1 = 0; + break; + } +#ifndef BOOST_NO_EXCEPTIONS + try{ +#endif + info.z1 = boost::lexical_cast(line); + break; +#ifndef BOOST_NO_EXCEPTIONS + } + catch(const boost::bad_lexical_cast&) + { + std::cout << "Sorry, that was not valid input, try again [y/n]?"; + std::getline(std::cin, line); + boost::algorithm::trim(line); + if(line == "y") + continue; + if(line == "n") + return false; + std::cout << "Sorry don't recognise that either, giving up...\n\n"; + return false; + } +#endif + }while(true); + + do{ + std::cout << "Data will be in the form a + r*2^b\n" + "for random value r,\n" + "enter value for the starting exponent b:"; + std::getline(std::cin, line); + boost::algorithm::trim(line); +#ifndef BOOST_NO_EXCEPTIONS + try{ +#endif + info.n1 = boost::lexical_cast(line); + break; +#ifndef BOOST_NO_EXCEPTIONS + } + catch(const boost::bad_lexical_cast&) + { + std::cout << "Sorry, that was not valid input, try again [y/n]?"; + std::getline(std::cin, line); + boost::algorithm::trim(line); + if(line == "y") + continue; + if(line == "n") + return false; + std::cout << "Sorry don't recognise that either, giving up...\n\n"; + return false; + } +#endif + }while(true); + + do{ + std::cout << "Data will be in the form a + r*2^b\n" + "for random value r,\n" + "enter value for the ending exponent b:"; + std::getline(std::cin, line); + boost::algorithm::trim(line); +#ifndef BOOST_NO_EXCEPTIONS + try{ +#endif + info.n2 = boost::lexical_cast(line); + break; +#ifndef BOOST_NO_EXCEPTIONS + } + catch(const boost::bad_lexical_cast&) + { + std::cout << "Sorry, that was not valid input, try again [y/n]?"; + std::getline(std::cin, line); + boost::algorithm::trim(line); + if(line == "y") + continue; + if(line == "n") + return false; + std::cout << "Sorry don't recognise that either, giving up...\n\n"; + return false; + } +#endif + }while(true); + + break; + default: + BOOST_ASSERT(0); // should never get here!! + } + + return true; +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif +} + +template +inline std::basic_ostream& write_csv(std::basic_ostream& os, + const test_data& data) +{ + const charT defarg[] = { ',', ' ', '\0' }; + return write_csv(os, data, defarg); +} + +template +std::basic_ostream& write_csv(std::basic_ostream& os, + const test_data& data, + const charT* separator) +{ + typedef typename test_data::const_iterator it_type; + typedef typename test_data::value_type value_type; + typedef typename value_type::const_iterator value_type_iterator; + it_type a, b; + a = data.begin(); + b = data.end(); + while(a != b) + { + value_type_iterator x, y; + bool sep = false; + x = a->begin(); + y = a->end(); + while(x != y) + { + if(sep) + os << separator; + os << *x; + sep = true; + ++x; + } + os << std::endl; + ++a; + } + return os; +} + +template +std::ostream& write_code(std::ostream& os, + const test_data& data, + const char* name) +{ + typedef typename test_data::const_iterator it_type; + typedef typename test_data::value_type value_type; + typedef typename value_type::const_iterator value_type_iterator; + + BOOST_ASSERT(os.good()); + + it_type a, b; + a = data.begin(); + b = data.end(); + if(a == b) + return os; + + os << "#ifndef SC_\n# define SC_(x) static_cast(BOOST_JOIN(x, L))\n#endif\n" + " static const boost::arraysize() << ">, " << data.size() << "> " << name << " = {{\n"; + + while(a != b) + { + if(a != data.begin()) + os << ", \n"; + + value_type_iterator x, y; + x = a->begin(); + y = a->end(); + os << " { "; + while(x != y) + { + if(x != a->begin()) + os << ", "; + os << "SC_(" << *x << ")"; + ++x; + } + os << " }"; + ++a; + } + os << "\n }};\n//#undef SC_\n\n"; + return os; +} + +} // namespace tools +} // namespace math +} // namespace boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + + +#endif // BOOST_MATH_TOOLS_TEST_DATA_HPP + + diff --git a/src/boost/libs/math/index.html b/src/boost/libs/math/index.html new file mode 100644 index 00000000..bc441655 --- /dev/null +++ b/src/boost/libs/math/index.html @@ -0,0 +1,14 @@ + + + + + +Automatic redirection failed, please go to +doc/html/index.html. +

Copyright Daryle Walker, Hubert Holin and John Maddock 2006

+

Distributed under the Boost Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at www.boost.org/LICENSE_1_0.txt).

+ + + + diff --git a/src/boost/libs/math/meta/libraries.json b/src/boost/libs/math/meta/libraries.json new file mode 100644 index 00000000..a00c9ef5 --- /dev/null +++ b/src/boost/libs/math/meta/libraries.json @@ -0,0 +1,81 @@ +[ + { + "key": "math", + "name": "Math", + "authors": [ + "various" + ], + "description": "Boost.Math includes several contributions in the domain of mathematics: The Greatest Common Divisor and Least Common Multiple library provides run-time and compile-time evaluation of the greatest common divisor (GCD) or least common multiple (LCM) of two integers. The Special Functions library currently provides eight templated special functions, in namespace boost. The Complex Number Inverse Trigonometric Functions are the inverses of trigonometric functions currently present in the C++ standard. Quaternions are a relative of complex numbers often used to parameterise rotations in three dimentional space. Octonions, like quaternions, are a relative of complex numbers.", + "category": [ + "Math" + ], + "maintainers": [ + "Hubert Holin ", + "John Maddock " + ] + }, + { + "key": "math/common_factor", + "name": "Math Common Factor", + "authors": [ + "Daryle Walker" + ], + "description": "Greatest common divisor and least common multiple.", + "documentation": "doc/html/gcd_lcm.html", + "category": [ + "Math" + ] + }, + { + "key": "math/octonion", + "name": "Math Octonion", + "authors": [ + "Hubert Holin" + ], + "description": "Octonions.", + "documentation": "doc/html/octonions.html", + "category": [ + "Math" + ] + }, + { + "key": "math/quaternion", + "name": "Math Quaternion", + "authors": [ + "Hubert Holin" + ], + "description": "Quaternions.", + "documentation": "doc/html/quaternions.html", + "category": [ + "Math" + ] + }, + { + "key": "math/special_functions", + "name": "Math/Special Functions", + "authors": [ + "John Maddock", + "Paul Bristow", + "Hubert Holin", + "Xiaogang Zhang" + ], + "description": "A wide selection of mathematical special functions.", + "documentation": "doc/html/special.html", + "category": [ + "Math" + ] + }, + { + "key": "math/statistical_distributions", + "name": "Math/Statistical Distributions", + "authors": [ + "John Maddock", + "Paul Bristow" + ], + "description": "A wide selection of univariate statistical distributions and functions that operate on them.", + "documentation": "doc/html/dist.html", + "category": [ + "Math" + ] + } +] diff --git a/src/boost/libs/math/minimax/Jamfile.v2 b/src/boost/libs/math/minimax/Jamfile.v2 new file mode 100644 index 00000000..81790f9a --- /dev/null +++ b/src/boost/libs/math/minimax/Jamfile.v2 @@ -0,0 +1,46 @@ +# Copyright John Maddock 2010 +# Copyright Paul A. Bristow 2018 +# Distributed under 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. +# \math_toolkit\libs\math\minimax\jamfile.v2 +# Runs minimax using multiprecision, (rather than gmp and mpfr) + +# bring in the rules for testing. +import modules ; +import path ; + +project + : requirements + gcc:-Wno-missing-braces + darwin:-Wno-missing-braces + acc:+W2068,2461,2236,4070,4069 + intel-win:-nologo + intel-win:-nologo + msvc:all + msvc:on + msvc:/wd4996 + msvc:/wd4512 + msvc:/wd4610 + msvc:/wd4510 + msvc:/wd4127 + msvc:/wd4701 # needed for lexical cast - temporary. + static + borland:static + ../../.. + BOOST_ALL_NO_LIB=1 + BOOST_UBLAS_UNSUPPORTED_COMPILER=0 + . + ../include_private + #$(ntl-path)/include + ; + +#lib mpfr : gmp : mpfr ; + +#lib gmp : : gmp ; + +# exe minimax : f.cpp main.cpp gmp mpfr ; +exe minimax : f.cpp main.cpp ; + +install bin : minimax ; + diff --git a/src/boost/libs/math/minimax/f.cpp b/src/boost/libs/math/minimax/f.cpp new file mode 100644 index 00000000..6ea40580 --- /dev/null +++ b/src/boost/libs/math/minimax/f.cpp @@ -0,0 +1,404 @@ +// (C) Copyright John Maddock 2006. +// 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) + +#define L22 +//#include "../tools/ntl_rr_lanczos.hpp" +//#include "../tools/ntl_rr_digamma.hpp" +#include "multiprecision.hpp" +#include +#include +#include +#include +#include + +#include + + +mp_type f(const mp_type& x, int variant) +{ + static const mp_type tiny = boost::math::tools::min_value() * 64; + switch(variant) + { + case 0: + { + mp_type x_ = sqrt(x == 0 ? 1e-80 : x); + return boost::math::erf(x_) / x_; + } + case 1: + { + mp_type x_ = 1 / x; + return boost::math::erfc(x_) * x_ / exp(-x_ * x_); + } + case 2: + { + return boost::math::erfc(x) * x / exp(-x * x); + } + case 3: + { + mp_type y(x); + if(y == 0) + y += tiny; + return boost::math::lgamma(y+2) / y - 0.5; + } + case 4: + // + // lgamma in the range [2,3], use: + // + // lgamma(x) = (x-2) * (x + 1) * (c + R(x - 2)) + // + // Works well at 80-bit long double precision, but doesn't + // stretch to 128-bit precision. + // + if(x == 0) + { + return boost::lexical_cast("0.42278433509846713939348790991759756895784066406008") / 3; + } + return boost::math::lgamma(x+2) / (x * (x+3)); + case 5: + { + // + // lgamma in the range [1,2], use: + // + // lgamma(x) = (x - 1) * (x - 2) * (c + R(x - 1)) + // + // works well over [1, 1.5] but not near 2 :-( + // + mp_type r1 = boost::lexical_cast("0.57721566490153286060651209008240243104215933593992"); + mp_type r2 = boost::lexical_cast("0.42278433509846713939348790991759756895784066406008"); + if(x == 0) + { + return r1; + } + if(x == 1) + { + return r2; + } + return boost::math::lgamma(x+1) / (x * (x - 1)); + } + case 6: + { + // + // lgamma in the range [1.5,2], use: + // + // lgamma(x) = (2 - x) * (1 - x) * (c + R(2 - x)) + // + // works well over [1.5, 2] but not near 1 :-( + // + mp_type r1 = boost::lexical_cast("0.57721566490153286060651209008240243104215933593992"); + mp_type r2 = boost::lexical_cast("0.42278433509846713939348790991759756895784066406008"); + if(x == 0) + { + return r2; + } + if(x == 1) + { + return r1; + } + return boost::math::lgamma(2-x) / (x * (x - 1)); + } + case 7: + { + // + // erf_inv in range [0, 0.5] + // + mp_type y = x; + if(y == 0) + y = boost::math::tools::epsilon() / 64; + return boost::math::erf_inv(y) / (y * (y+10)); + } + case 8: + { + // + // erfc_inv in range [0.25, 0.5] + // Use an y-offset of 0.25, and range [0, 0.25] + // abs error, auto y-offset. + // + mp_type y = x; + if(y == 0) + y = boost::lexical_cast("1e-5000"); + return sqrt(-2 * log(y)) / boost::math::erfc_inv(y); + } + case 9: + { + mp_type x2 = x; + if(x2 == 0) + x2 = boost::lexical_cast("1e-5000"); + mp_type y = exp(-x2*x2); // sqrt(-log(x2)) - 5; + return boost::math::erfc_inv(y) / x2; + } + case 10: + { + // + // Digamma over the interval [1,2], set x-offset to 1 + // and optimise for absolute error over [0,1]. + // + int current_precision = get_working_precision(); + if(current_precision < 1000) + set_working_precision(1000); + // + // This value for the root of digamma is calculated using our + // differentiated lanczos approximation. It agrees with Cody + // to ~ 25 digits and to Morris to 35 digits. See: + // TOMS ALGORITHM 708 (Didonato and Morris). + // and Math. Comp. 27, 123-127 (1973) by Cody, Strecok and Thacher. + // + //mp_type root = boost::lexical_cast("1.4616321449683623412626595423257213234331845807102825466429633351908372838889871"); + // + // Actually better to calculate the root on the fly, it appears to be more + // accurate: convergence is easier with the 1000-bit value, the approximation + // produced agrees with functions.mathworld.com values to 35 digits even quite + // near the root. + // + static boost::math::tools::eps_tolerance tol(1000); + static boost::uintmax_t max_iter = 1000; + mp_type (*pdg)(mp_type) = &boost::math::digamma; + static const mp_type root = boost::math::tools::bracket_and_solve_root(pdg, mp_type(1.4), mp_type(1.5), true, tol, max_iter).first; + + mp_type x2 = x; + double lim = 1e-65; + if(fabs(x2 - root) < lim) + { + // + // This is a problem area: + // x2-root suffers cancellation error, so does digamma. + // That gets compounded again when Remez calculates the error + // function. This cludge seems to stop the worst of the problems: + // + static const mp_type a = boost::math::digamma(root - lim) / -lim; + static const mp_type b = boost::math::digamma(root + lim) / lim; + mp_type fract = (x2 - root + lim) / (2*lim); + mp_type r = (1-fract) * a + fract * b; + std::cout << "In root area: " << r; + return r; + } + mp_type result = boost::math::digamma(x2) / (x2 - root); + if(current_precision < 1000) + set_working_precision(current_precision); + return result; + } + case 11: + // expm1: + if(x == 0) + { + static mp_type lim = 1e-80; + static mp_type a = boost::math::expm1(-lim); + static mp_type b = boost::math::expm1(lim); + static mp_type l = (b-a) / (2 * lim); + return l; + } + return boost::math::expm1(x) / x; + case 12: + // demo, and test case: + return exp(x); + case 13: + // K(k): + { + return boost::math::ellint_1(x); + } + case 14: + // K(k) + { + return boost::math::ellint_1(1-x) / log(x); + } + case 15: + // E(k) + { + // x = 1-k^2 + mp_type z = 1 - x * log(x); + return boost::math::ellint_2(sqrt(1-x)) / z; + } + case 16: + // Bessel I0(x) over [0,16]: + { + return boost::math::cyl_bessel_i(0, sqrt(x)); + } + case 17: + // Bessel I0(x) over [16,INF] + { + mp_type z = 1 / (mp_type(1)/16 - x); + return boost::math::cyl_bessel_i(0, z) * sqrt(z) / exp(z); + } + case 18: + // Zeta over [0, 1] + { + return boost::math::zeta(1 - x) * x - x; + } + case 19: + // Zeta over [1, n] + { + return boost::math::zeta(x) - 1 / (x - 1); + } + case 20: + // Zeta over [a, b] : a >> 1 + { + return log(boost::math::zeta(x) - 1); + } + case 21: + // expint[1] over [0,1]: + { + mp_type tiny = boost::lexical_cast("1e-5000"); + mp_type z = (x <= tiny) ? tiny : x; + return boost::math::expint(1, z) - z + log(z); + } + case 22: + // expint[1] over [1,N], + // Note that x varies from [0,1]: + { + mp_type z = 1 / x; + return boost::math::expint(1, z) * exp(z) * z; + } + case 23: + // expin Ei over [0,R] + { + static const mp_type root = + boost::lexical_cast("0.372507410781366634461991866580119133535689497771654051555657435242200120636201854384926049951548942392"); + mp_type z = x < (std::numeric_limits::min)() ? (std::numeric_limits::min)() : x; + return (boost::math::expint(z) - log(z / root)) / (z - root); + } + case 24: + // Expint Ei for large x: + { + static const mp_type root = + boost::lexical_cast("0.372507410781366634461991866580119133535689497771654051555657435242200120636201854384926049951548942392"); + mp_type z = x < (std::numeric_limits::min)() ? (std::numeric_limits::max)() : mp_type(1 / x); + return (boost::math::expint(z) - z) * z * exp(-z); + //return (boost::math::expint(z) - log(z)) * z * exp(-z); + } + case 25: + // Expint Ei for large x: + { + return (boost::math::expint(x) - x) * x * exp(-x); + } + case 26: + { + // + // erf_inv in range [0, 0.5] + // + mp_type y = x; + if(y == 0) + y = boost::math::tools::epsilon() / 64; + y = sqrt(y); + return boost::math::erf_inv(y) / (y); + } + case 28: + { + // log1p over [-0.5,0.5] + mp_type y = x; + if(fabs(y) < 1e-100) + y = (y == 0) ? 1e-100 : boost::math::sign(y) * 1e-100; + return (boost::math::log1p(y) - y + y * y / 2) / (y); + } + case 29: + { + // cbrt over [0.5, 1] + return boost::math::cbrt(x); + } + case 30: + { + // trigamma over [x,y] + mp_type y = x; + y = sqrt(y); + return boost::math::trigamma(x) * (x * x); + } + case 31: + { + // trigamma over [x, INF] + if(x == 0) return 1; + mp_type y = (x == 0) ? (std::numeric_limits::max)() / 2 : mp_type(1/x); + return boost::math::trigamma(y) * y; + } + case 32: + { + // I0 over [N, INF] + // Don't need to go past x = 1/1000 = 1e-3 for double, or + // 1/15000 = 0.0006 for long double, start at 1/7.75=0.13 + mp_type arg = 1 / x; + return sqrt(arg) * exp(-arg) * boost::math::cyl_bessel_i(0, arg); + } + case 33: + { + // I0 over [0, N] + mp_type xx = sqrt(x) * 2; + return (boost::math::cyl_bessel_i(0, xx) - 1) / x; + } + case 34: + { + // I1 over [0, N] + mp_type xx = sqrt(x) * 2; + return (boost::math::cyl_bessel_i(1, xx) * 2 / xx - 1 - x / 2) / (x * x); + } + case 35: + { + // I1 over [N, INF] + mp_type xx = 1 / x; + return boost::math::cyl_bessel_i(1, xx) * sqrt(xx) * exp(-xx); + } + case 36: + { + // K0 over [0, 1] + mp_type xx = sqrt(x); + return boost::math::cyl_bessel_k(0, xx) + log(xx) * boost::math::cyl_bessel_i(0, xx); + } + case 37: + { + // K0 over [1, INF] + mp_type xx = 1 / x; + return boost::math::cyl_bessel_k(0, xx) * exp(xx) * sqrt(xx); + } + case 38: + { + // K1 over [0, 1] + mp_type xx = sqrt(x); + return (boost::math::cyl_bessel_k(1, xx) - log(xx) * boost::math::cyl_bessel_i(1, xx) - 1 / xx) / xx; + } + case 39: + { + // K1 over [1, INF] + mp_type xx = 1 / x; + return boost::math::cyl_bessel_k(1, xx) * sqrt(xx) * exp(xx); + } + // Lambert W0 + case 40: + return boost::math::lambert_w0(x); + case 41: + { + if (x == 0) + return 1; + return boost::math::lambert_w0(x) / x; + } + case 42: + { + static const mp_type e1 = exp(mp_type(-1)); + return x / -boost::math::lambert_w0(-e1 + x); + } + case 43: + { + mp_type xx = 1 / x; + return 1 / boost::math::lambert_w0(xx); + } + case 44: + { + mp_type ex = exp(x); + return boost::math::lambert_w0(ex) - x; + } + } + return 0; +} + +void show_extra( + const boost::math::tools::polynomial& n, + const boost::math::tools::polynomial& d, + const mp_type& x_offset, + const mp_type& y_offset, + int variant) +{ + switch(variant) + { + default: + // do nothing here... + ; + } +} + diff --git a/src/boost/libs/math/minimax/main.cpp b/src/boost/libs/math/minimax/main.cpp new file mode 100644 index 00000000..6ff01876 --- /dev/null +++ b/src/boost/libs/math/minimax/main.cpp @@ -0,0 +1,650 @@ +// (C) Copyright John Maddock 2006. +// 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) + +#define BOOST_TEST_MODULE foobar +#define BOOST_UBLAS_TYPE_CHECK_EPSILON (type_traits::type_sqrt (boost::math::tools::epsilon ())) +#define BOOST_UBLAS_TYPE_CHECK_MIN (type_traits::type_sqrt ( boost::math::tools::min_value())) +#define BOOST_UBLAS_NDEBUG + +#include "multiprecision.hpp" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // for test_main +#include + + +extern mp_type f(const mp_type& x, int variant); +extern void show_extra( + const boost::math::tools::polynomial& n, + const boost::math::tools::polynomial& d, + const mp_type& x_offset, + const mp_type& y_offset, + int variant); + +using namespace boost::spirit::classic; + +mp_type a(0), b(1); // range to optimise over +bool rel_error(true); +bool pin(false); +int orderN(3); +int orderD(1); +int target_precision = boost::math::tools::digits(); +int working_precision = target_precision * 2; +bool started(false); +int variant(0); +int skew(0); +int brake(50); +mp_type x_offset(0), y_offset(0), x_scale(1); +bool auto_offset_y; + +boost::shared_ptr > p_remez; + +mp_type the_function(const mp_type& val) +{ + return f(x_scale * (val + x_offset), variant) + y_offset; +} + +void step_some(unsigned count) +{ + try{ + set_working_precision(working_precision); + if(!started) + { + // + // If we have an automatic y-offset calculate it now: + // + if(auto_offset_y) + { + mp_type fa, fb, fm; + fa = f(x_scale * (a + x_offset), variant); + fb = f(x_scale * (b + x_offset), variant); + fm = f(x_scale * ((a+b)/2 + x_offset), variant); + y_offset = -(fa + fb + fm) / 3; + set_output_precision(5); + std::cout << "Setting auto-y-offset to " << y_offset << std::endl; + } + // + // Truncate offsets to float precision: + // + x_offset = round_to_precision(x_offset, 20); + y_offset = round_to_precision(y_offset, 20); + // + // Construct new Remez state machine: + // + p_remez.reset(new boost::math::tools::remez_minimax( + &the_function, + orderN, orderD, + a, b, + pin, + rel_error, + skew, + working_precision)); + std::cout << "Max error in interpolated form: " << std::setprecision(3) << std::scientific << boost::math::tools::real_cast(p_remez->max_error()) << std::endl; + // + // Signal that we've started: + // + started = true; + } + unsigned i; + for(i = 0; i < count; ++i) + { + std::cout << "Stepping..." << std::endl; + p_remez->set_brake(brake); + mp_type r = p_remez->iterate(); + set_output_precision(3); + std::cout + << "Maximum Deviation Found: " << std::setprecision(3) << std::scientific << boost::math::tools::real_cast(p_remez->max_error()) << std::endl + << "Expected Error Term: " << std::setprecision(3) << std::scientific << boost::math::tools::real_cast(p_remez->error_term()) << std::endl + << "Maximum Relative Change in Control Points: " << std::setprecision(3) << std::scientific << boost::math::tools::real_cast(r) << std::endl; + } + } + catch(const std::exception& e) + { + std::cout << "Step failed with exception: " << e.what() << std::endl; + } +} + +void step(const char*, const char*) +{ + step_some(1); +} + +void show(const char*, const char*) +{ + set_working_precision(working_precision); + if(started) + { + boost::math::tools::polynomial n = p_remez->numerator(); + boost::math::tools::polynomial d = p_remez->denominator(); + std::vector cn = n.chebyshev(); + std::vector cd = d.chebyshev(); + int prec = 2 + (target_precision * 3010LL)/10000; + std::cout << std::scientific << std::setprecision(prec); + set_output_precision(prec); + boost::numeric::ublas::vector v = p_remez->zero_points(); + + std::cout << " Zeros = {\n"; + unsigned i; + for(i = 0; i < v.size(); ++i) + { + std::cout << " " << v[i] << std::endl; + } + std::cout << " }\n"; + + v = p_remez->chebyshev_points(); + std::cout << " Chebeshev Control Points = {\n"; + for(i = 0; i < v.size(); ++i) + { + std::cout << " " << v[i] << std::endl; + } + std::cout << " }\n"; + + std::cout << "X offset: " << x_offset << std::endl; + std::cout << "X scale: " << x_scale << std::endl; + std::cout << "Y offset: " << y_offset << std::endl; + + std::cout << "P = {"; + for(i = 0; i < n.size(); ++i) + { + std::cout << " " << n[i] << "L," << std::endl; + } + std::cout << " }\n"; + + std::cout << "Q = {"; + for(i = 0; i < d.size(); ++i) + { + std::cout << " " << d[i] << "L," << std::endl; + } + std::cout << " }\n"; + + std::cout << "CP = {"; + for(i = 0; i < cn.size(); ++i) + { + std::cout << " " << cn[i] << "L," << std::endl; + } + std::cout << " }\n"; + + std::cout << "CQ = {"; + for(i = 0; i < cd.size(); ++i) + { + std::cout << " " << cd[i] << "L," << std::endl; + } + std::cout << " }\n"; + + show_extra(n, d, x_offset, y_offset, variant); + } + else + { + std::cerr << "Nothing to display" << std::endl; + } +} + +void do_graph(unsigned points) +{ + set_working_precision(working_precision); + mp_type step = (b - a) / (points - 1); + mp_type x = a; + while(points > 1) + { + set_output_precision(10); + std::cout << std::setprecision(10) << std::setw(30) << std::left + << boost::lexical_cast(x) << the_function(x) << std::endl; + --points; + x += step; + } + std::cout << std::setprecision(10) << std::setw(30) << std::left + << boost::lexical_cast(b) << the_function(b) << std::endl; +} + +void graph(const char*, const char*) +{ + do_graph(3); +} + +template +mp_type convert_to_rr(const T& val) +{ + return val; +} +template +mp_type convert_to_rr(const boost::multiprecision::number& val) +{ + return boost::lexical_cast(val.str()); +} + +template +void do_test(T, const char* name) +{ + set_working_precision(working_precision); + if(started) + { + // + // We want to test the approximation at fixed precision: + // either float, double or long double. Begin by getting the + // polynomials: + // + boost::math::tools::polynomial n, d; + boost::math::tools::polynomial nr, dr; + nr = p_remez->numerator(); + dr = p_remez->denominator(); + n = nr; + d = dr; + + std::vector cn1, cd1; + cn1 = nr.chebyshev(); + cd1 = dr.chebyshev(); + std::vector cn, cd; + for(unsigned i = 0; i < cn1.size(); ++i) + { + cn.push_back(boost::math::tools::real_cast(cn1[i])); + } + for(unsigned i = 0; i < cd1.size(); ++i) + { + cd.push_back(boost::math::tools::real_cast(cd1[i])); + } + // + // We'll test at the Chebeshev control points which is where + // (in theory) the largest deviation should occur. For good + // measure we'll test at the zeros as well: + // + boost::numeric::ublas::vector + zeros(p_remez->zero_points()), + cheb(p_remez->chebyshev_points()); + + mp_type max_error(0), cheb_max_error(0); + + // + // Do the tests at the zeros: + // + std::cout << "Starting tests at " << name << " precision...\n"; + std::cout << "Absissa Error (Poly) Error (Cheb)\n"; + for(unsigned i = 0; i < zeros.size(); ++i) + { + mp_type true_result = the_function(zeros[i]); + T absissa = boost::math::tools::real_cast(zeros[i]); + mp_type test_result = convert_to_rr(n.evaluate(absissa) / d.evaluate(absissa)); + mp_type cheb_result = convert_to_rr(boost::math::tools::evaluate_chebyshev(cn, absissa) / boost::math::tools::evaluate_chebyshev(cd, absissa)); + mp_type err, cheb_err; + if(rel_error) + { + err = boost::math::tools::relative_error(test_result, true_result); + cheb_err = boost::math::tools::relative_error(cheb_result, true_result); + } + else + { + err = fabs(test_result - true_result); + cheb_err = fabs(cheb_result - true_result); + } + if(err > max_error) + max_error = err; + if(cheb_err > cheb_max_error) + cheb_max_error = cheb_err; + std::cout << std::setprecision(6) << std::setw(15) << std::left << absissa + << std::setw(15) << std::left << boost::math::tools::real_cast(err) << boost::math::tools::real_cast(cheb_err) << std::endl; + } + // + // Do the tests at the Chebeshev control points: + // + for(unsigned i = 0; i < cheb.size(); ++i) + { + mp_type true_result = the_function(cheb[i]); + T absissa = boost::math::tools::real_cast(cheb[i]); + mp_type test_result = convert_to_rr(n.evaluate(absissa) / d.evaluate(absissa)); + mp_type cheb_result = convert_to_rr(boost::math::tools::evaluate_chebyshev(cn, absissa) / boost::math::tools::evaluate_chebyshev(cd, absissa)); + mp_type err, cheb_err; + if(rel_error) + { + err = boost::math::tools::relative_error(test_result, true_result); + cheb_err = boost::math::tools::relative_error(cheb_result, true_result); + } + else + { + err = fabs(test_result - true_result); + cheb_err = fabs(cheb_result - true_result); + } + if(err > max_error) + max_error = err; + std::cout << std::setprecision(6) << std::setw(15) << std::left << absissa + << std::setw(15) << std::left << boost::math::tools::real_cast(err) << + boost::math::tools::real_cast(cheb_err) << std::endl; + } + std::string msg = "Max Error found at "; + msg += name; + msg += " precision = "; + msg.append(62 - 17 - msg.size(), ' '); + std::cout << msg << std::setprecision(6) << "Poly: " << std::setw(20) << std::left + << boost::math::tools::real_cast(max_error) << "Cheb: " << boost::math::tools::real_cast(cheb_max_error) << std::endl; + } + else + { + std::cout << "Nothing to test: try converging an approximation first!!!" << std::endl; + } +} + +void test_float(const char*, const char*) +{ + do_test(float(0), "float"); +} + +void test_double(const char*, const char*) +{ + do_test(double(0), "double"); +} + +void test_long(const char*, const char*) +{ + do_test((long double)(0), "long double"); +} + +void test_float80(const char*, const char*) +{ + do_test((boost::multiprecision::cpp_bin_float_double_extended)(0), "float80"); +} + +void test_float128(const char*, const char*) +{ + do_test((boost::multiprecision::cpp_bin_float_quad)(0), "float128"); +} + +void test_all(const char*, const char*) +{ + do_test(float(0), "float"); + do_test(double(0), "double"); + do_test((long double)(0), "long double"); +} + +template +void do_test_n(T, const char* name, unsigned count) +{ + set_working_precision(working_precision); + if(started) + { + // + // We want to test the approximation at fixed precision: + // either float, double or long double. Begin by getting the + // polynomials: + // + boost::math::tools::polynomial n, d; + boost::math::tools::polynomial nr, dr; + nr = p_remez->numerator(); + dr = p_remez->denominator(); + n = nr; + d = dr; + + std::vector cn1, cd1; + cn1 = nr.chebyshev(); + cd1 = dr.chebyshev(); + std::vector cn, cd; + for(unsigned i = 0; i < cn1.size(); ++i) + { + cn.push_back(boost::math::tools::real_cast(cn1[i])); + } + for(unsigned i = 0; i < cd1.size(); ++i) + { + cd.push_back(boost::math::tools::real_cast(cd1[i])); + } + + mp_type max_error(0), max_cheb_error(0); + mp_type step = (b - a) / count; + + // + // Do the tests at the zeros: + // + std::cout << "Starting tests at " << name << " precision...\n"; + std::cout << "Absissa Error (poly) Error (Cheb)\n"; + for(mp_type x = a; x <= b; x += step) + { + mp_type true_result = the_function(x); + //std::cout << true_result << std::endl; + T absissa = boost::math::tools::real_cast(x); + mp_type test_result = convert_to_rr(n.evaluate(absissa) / d.evaluate(absissa)); + //std::cout << test_result << std::endl; + mp_type cheb_result = convert_to_rr(boost::math::tools::evaluate_chebyshev(cn, absissa) / boost::math::tools::evaluate_chebyshev(cd, absissa)); + //std::cout << cheb_result << std::endl; + mp_type err, cheb_err; + if(rel_error) + { + err = boost::math::tools::relative_error(test_result, true_result); + cheb_err = boost::math::tools::relative_error(cheb_result, true_result); + } + else + { + err = fabs(test_result - true_result); + cheb_err = fabs(cheb_result - true_result); + } + if(err > max_error) + max_error = err; + if(cheb_err > max_cheb_error) + max_cheb_error = cheb_err; + std::cout << std::setprecision(6) << std::setw(15) << std::left << boost::math::tools::real_cast(absissa) + << (test_result < true_result ? "-" : "") << std::setw(20) << std::left + << boost::math::tools::real_cast(err) + << boost::math::tools::real_cast(cheb_err) << std::endl; + } + std::string msg = "Max Error found at "; + msg += name; + msg += " precision = "; + //msg.append(62 - 17 - msg.size(), ' '); + std::cout << msg << "Poly: " << std::setprecision(6) + //<< std::setw(15) << std::left + << boost::math::tools::real_cast(max_error) + << " Cheb: " << boost::math::tools::real_cast(max_cheb_error) << std::endl; + } + else + { + std::cout << "Nothing to test: try converging an approximation first!!!" << std::endl; + } +} + +void test_n(unsigned n) +{ + do_test_n(mp_type(), "mp_type", n); +} + +void test_float_n(unsigned n) +{ + do_test_n(float(0), "float", n); +} + +void test_double_n(unsigned n) +{ + do_test_n(double(0), "double", n); +} + +void test_long_n(unsigned n) +{ + do_test_n((long double)(0), "long double", n); +} + +void test_float80_n(unsigned n) +{ + do_test_n((boost::multiprecision::cpp_bin_float_double_extended)(0), "float80", n); +} + +void test_float128_n(unsigned n) +{ + do_test_n((boost::multiprecision::cpp_bin_float_quad)(0), "float128", n); +} + +void rotate(const char*, const char*) +{ + if(p_remez) + { + p_remez->rotate(); + } + else + { + std::cerr << "Nothing to rotate" << std::endl; + } +} + +void rescale(const char*, const char*) +{ + if(p_remez) + { + p_remez->rescale(a, b); + } + else + { + std::cerr << "Nothing to rescale" << std::endl; + } +} + +void graph_poly(const char*, const char*) +{ + int i = 50; + set_working_precision(working_precision); + if(started) + { + // + // We want to test the approximation at fixed precision: + // either float, double or long double. Begin by getting the + // polynomials: + // + boost::math::tools::polynomial n, d; + n = p_remez->numerator(); + d = p_remez->denominator(); + + mp_type max_error(0); + mp_type step = (b - a) / i; + + std::cout << "Evaluating Numerator...\n"; + mp_type val; + for(val = a; val <= b; val += step) + std::cout << n.evaluate(val) << std::endl; + std::cout << "Evaluating Denominator...\n"; + for(val = a; val <= b; val += step) + std::cout << d.evaluate(val) << std::endl; + } + else + { + std::cout << "Nothing to test: try converging an approximation first!!!" << std::endl; + } +} + +BOOST_AUTO_TEST_CASE( test_main ) +{ + std::string line; + real_parser const rr_p; + while(std::getline(std::cin, line)) + { + if(parse(line.c_str(), str_p("quit"), space_p).full) + return; + if(false == parse(line.c_str(), + ( + + str_p("range")[assign_a(started, false)] && real_p[assign_a(a)] && real_p[assign_a(b)] + || + str_p("relative")[assign_a(started, false)][assign_a(rel_error, true)] + || + str_p("absolute")[assign_a(started, false)][assign_a(rel_error, false)] + || + str_p("pin")[assign_a(started, false)] && str_p("true")[assign_a(pin, true)] + || + str_p("pin")[assign_a(started, false)] && str_p("false")[assign_a(pin, false)] + || + str_p("pin")[assign_a(started, false)] && str_p("1")[assign_a(pin, true)] + || + str_p("pin")[assign_a(started, false)] && str_p("0")[assign_a(pin, false)] + || + str_p("pin")[assign_a(started, false)][assign_a(pin, true)] + || + str_p("order")[assign_a(started, false)] && uint_p[assign_a(orderN)] && uint_p[assign_a(orderD)] + || + str_p("order")[assign_a(started, false)] && uint_p[assign_a(orderN)] + || + str_p("target-precision") && uint_p[assign_a(target_precision)] + || + str_p("working-precision")[assign_a(started, false)] && uint_p[assign_a(working_precision)] + || + str_p("variant")[assign_a(started, false)] && int_p[assign_a(variant)] + || + str_p("skew")[assign_a(started, false)] && int_p[assign_a(skew)] + || + str_p("brake") && int_p[assign_a(brake)] + || + str_p("step") && int_p[&step_some] + || + str_p("step")[&step] + || + str_p("poly")[&graph_poly] + || + str_p("info")[&show] + || + str_p("graph") && uint_p[&do_graph] + || + str_p("graph")[&graph] + || + str_p("x-offset") && real_p[assign_a(x_offset)] + || + str_p("x-scale") && real_p[assign_a(x_scale)] + || + str_p("y-offset") && str_p("auto")[assign_a(auto_offset_y, true)] + || + str_p("y-offset") && real_p[assign_a(y_offset)][assign_a(auto_offset_y, false)] + || + str_p("test") && str_p("float80") && uint_p[&test_float80_n] + || + str_p("test") && str_p("float80")[&test_float80] + || + str_p("test") && str_p("float128") && uint_p[&test_float128_n] + || + str_p("test") && str_p("float128")[&test_float128] + || + str_p("test") && str_p("float") && uint_p[&test_float_n] + || + str_p("test") && str_p("float")[&test_float] + || + str_p("test") && str_p("double") && uint_p[&test_double_n] + || + str_p("test") && str_p("double")[&test_double] + || + str_p("test") && str_p("long") && uint_p[&test_long_n] + || + str_p("test") && str_p("long")[&test_long] + || + str_p("test") && str_p("all")[&test_all] + || + str_p("test") && uint_p[&test_n] + || + str_p("rotate")[&rotate] + || + str_p("rescale") && real_p[assign_a(a)] && real_p[assign_a(b)] && epsilon_p[&rescale] + + ), space_p).full) + { + std::cout << "Unable to parse directive: \"" << line << "\"" << std::endl; + } + else + { + std::cout << "Variant = " << variant << std::endl; + std::cout << "range = [" << a << "," << b << "]" << std::endl; + std::cout << "Relative Error = " << rel_error << std::endl; + std::cout << "Pin to Origin = " << pin << std::endl; + std::cout << "Order (Num/Denom) = " << orderN << "/" << orderD << std::endl; + std::cout << "Target Precision = " << target_precision << std::endl; + std::cout << "Working Precision = " << working_precision << std::endl; + std::cout << "Skew = " << skew << std::endl; + std::cout << "Brake = " << brake << std::endl; + std::cout << "X Offset = " << x_offset << std::endl; + std::cout << "X scale = " << x_scale << std::endl; + std::cout << "Y Offset = "; + if(auto_offset_y) + std::cout << "Auto ("; + std::cout << y_offset; + if(auto_offset_y) + std::cout << ")"; + std::cout << std::endl; + } + } +} diff --git a/src/boost/libs/math/minimax/multiprecision.hpp b/src/boost/libs/math/minimax/multiprecision.hpp new file mode 100644 index 00000000..2f44ac07 --- /dev/null +++ b/src/boost/libs/math/minimax/multiprecision.hpp @@ -0,0 +1,224 @@ +// (C) Copyright John Maddock 2015. +// 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) + +#ifndef BOOST_REMEZ_MULTIPRECISION_HPP +#define BOOST_REMEZ_MULTIPRECISION_HPP + +#include + +#ifdef USE_NTL +#include +namespace std { + using boost::math::ntl::pow; +} // workaround for spirit parser. + +typedef boost::math::ntl::RR mp_type; + +inline void set_working_precision(int n) +{ + NTL::RR::SetPrecision(working_precision); +} + +inline int get_working_precision() +{ + return mp_type::precision(working_precision); +} + +inline void set_output_precision(int n) +{ + NTL::RR::SetOutputPrecision(n); +} + +inline mp_type round_to_precision(mp_type m, int bits) +{ + return NTL::RoundToPrecision(m.value(), bits); +} + + +namespace boost { + namespace math { + namespace tools { + + template <> + inline boost::multiprecision::cpp_bin_float_double_extended real_cast(mp_type val) + { + unsigned p = NTL::RR::OutputPrecision(); + NTL::RR::SetOutputPrecision(20); + boost::multiprecision::cpp_bin_float_double_extended r = boost::lexical_cast(val); + NTL::RR::SetOutputPrecision(p); + return r; + } + template <> + inline boost::multiprecision::cpp_bin_float_quad real_cast(mp_type val) + { + unsigned p = NTL::RR::OutputPrecision(); + NTL::RR::SetOutputPrecision(35); + boost::multiprecision::cpp_bin_float_quad r = boost::lexical_cast(val); + NTL::RR::SetOutputPrecision(p); + return r; + } + + } + } +} + +#elif defined(USE_CPP_BIN_FLOAT_100) + +#include + +typedef boost::multiprecision::cpp_bin_float_100 mp_type; + +inline void set_working_precision(int n) +{ +} + +inline void set_output_precision(int n) +{ + std::cout << std::setprecision(n); + std::cerr << std::setprecision(n); +} + +inline mp_type round_to_precision(mp_type m, int bits) +{ + int i; + mp_type f = frexp(m, &i); + f = ldexp(f, bits); + i -= bits; + f = floor(f); + return ldexp(f, i); +} + +inline int get_working_precision() +{ + return std::numeric_limits::digits; +} + +namespace boost { + namespace math { + namespace tools { + + template <> + inline boost::multiprecision::cpp_bin_float_double_extended real_cast(mp_type val) + { + return boost::multiprecision::cpp_bin_float_double_extended(val); + } + template <> + inline boost::multiprecision::cpp_bin_float_quad real_cast(mp_type val) + { + return boost::multiprecision::cpp_bin_float_quad(val); + } + + } + } +} + + +#elif defined(USE_MPFR_100) + +#include + +typedef boost::multiprecision::mpfr_float_100 mp_type; + +inline void set_working_precision(int n) +{ +} + +inline void set_output_precision(int n) +{ + std::cout << std::setprecision(n); + std::cerr << std::setprecision(n); +} + +inline mp_type round_to_precision(mp_type m, int bits) +{ + mpfr_prec_round(m.backend().data(), bits, MPFR_RNDN); + return m; +} + +inline int get_working_precision() +{ + return std::numeric_limits::digits; +} + +namespace boost { + namespace math { + namespace tools { + + template <> + inline boost::multiprecision::cpp_bin_float_double_extended real_cast(mp_type val) + { + return boost::multiprecision::cpp_bin_float_double_extended(val); + } + template <> + inline boost::multiprecision::cpp_bin_float_quad real_cast(mp_type val) + { + return boost::multiprecision::cpp_bin_float_quad(val); + } + + } + } +} + + +#else + +#include + +typedef boost::multiprecision::mpfr_float mp_type; + +inline void set_working_precision(int n) +{ + boost::multiprecision::mpfr_float::default_precision(boost::multiprecision::detail::digits2_2_10(n)); +} + +inline void set_output_precision(int n) +{ + std::cout << std::setprecision(n); + std::cerr << std::setprecision(n); +} + +inline mp_type round_to_precision(mp_type m, int bits) +{ + mpfr_prec_round(m.backend().data(), bits, MPFR_RNDN); + return m; +} + +inline int get_working_precision() +{ + return mp_type::default_precision(); +} + +namespace boost { + namespace math { + namespace tools { + + template <> + inline boost::multiprecision::cpp_bin_float_double_extended real_cast(mp_type val) + { + return boost::multiprecision::cpp_bin_float_double_extended(val); + } + template <> + inline boost::multiprecision::cpp_bin_float_quad real_cast(mp_type val) + { + return boost::multiprecision::cpp_bin_float_quad(val); + } + + } + } +} + + + +#endif + + + + +#endif // BOOST_REMEZ_MULTIPRECISION_HPP + + + + + diff --git a/src/boost/libs/math/reporting/accuracy/Jamfile.v2 b/src/boost/libs/math/reporting/accuracy/Jamfile.v2 new file mode 100644 index 00000000..7227a2fe --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/Jamfile.v2 @@ -0,0 +1,161 @@ +# Copyright Daryle Walker, Hubert Holin, John Maddock 2006 - 2007 +# copyright Paul A. Bristow 2006 - 2010 +# Distributed under 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. +# \math_toolkit\libs\math\test\jamfile.v2 +# Runs all math toolkit tests, functions & distributions, +# and build math examples. + +# bring in the rules for testing +import testing ; +import modules ; +import path ; +import pch ; +import ../../../config/checks/config : requires ; +using quickbook ; +using auto-index ; + +project + : requirements + ../../include_private + ; + +if $(is_unix) +{ + local osname = [ SHELL uname ] ; + + switch $(osname) + { + case "Sun*" : OTHERFLAGS = "-lpthread -lrt" ; + case "*BSD*" : OTHERFLAGS = "-lpthread" ; + } +} + +# +# Configuration first: +# +lib gsl ; +lib gslcblas ; +lib Rmath ; +obj has_cxx17_cmath : has_cxx17_cmath.cpp ; +explicit has_cxx17_cmath ; +obj has_c99_cmath : has_c99_cmath.cpp ; +explicit has_c99_cmath ; +exe has_gsl : has_gsl.cpp gsl gslcblas ; +explicit has_gsl ; +exe has_rmath : has_rmath.cpp Rmath ; +explicit has_rmath ; + +CEPHES_SOURCE = acosh.c airy.c asin.c asinh.c atan.c atanh.c bdtr.c beta.c +btdtr.c cbrt.c chbevl.c chdtr.c clog.c cmplx.c const.c +cosh.c dawsn.c drand.c ei.c ellie.c ellik.c ellpe.c ellpj.c ellpk.c +exp.c exp10.c exp2.c expn.c expx2.c fabs.c fac.c fdtr.c +fresnl.c gamma.c gdtr.c hyp2f1.c hyperg.c i0.c i1.c igami.c incbet.c +incbi.c igam.c isnan.c iv.c j0.c j1.c jn.c jv.c k0.c k1.c kn.c kolmogorov.c +log.c log2.c log10.c lrand.c nbdtr.c ndtr.c ndtri.c pdtr.c planck.c +polevl.c polmisc.c polylog.c polyn.c pow.c powi.c psi.c rgamma.c round.c +shichi.c sici.c sin.c sindg.c sinh.c spence.c stdtr.c struve.c +tan.c tandg.c tanh.c unity.c yn.c zeta.c zetac.c +sqrt.c floor.c setprec.c mtherr.c ; + +path-constant here : . ; +make $(here)/third_party/cephes_double/acosh.c : : @check_exists ; +actions check_exists +{ + stat $(<) +} +explicit $(here)/third_party/cephes_double/acosh.c ; + +lib cephes_double : $(here)/third_party/cephes_double/$(CEPHES_SOURCE) + : + release + static + [ check-target-builds $(here)/third_party/cephes_double/acosh.c : : no ] + ; + +explicit cephes_double ; + +rule all-tests { + local result ; + for local source in [ glob test*.cpp ] + { + result += [ run $(source) /boost/regex//boost_regex /boost/system /boost/filesystem /boost/test//boost_unit_test_framework + : : : + [ check-target-builds has_gsl : ALWAYS_TEST_DOUBLE : ] + linux:-lpthread + linux:-lrt + gcc:$(OTHERFLAGS) ] + ; + result += [ run $(source) /boost/regex//boost_regex /boost/system /boost/filesystem /boost/test//boost_unit_test_framework + : : : [ check-target-builds has_cxx17_cmath : TEST_CXX17_CMATH : no ] + linux:-lpthread + linux:-lrt + gcc:$(OTHERFLAGS) + : $(source:B)_cxx17_cmath ] + ; + result += [ run $(source) /boost/regex//boost_regex /boost/system /boost/filesystem /boost/test//boost_unit_test_framework + : : : [ check-target-builds has_c99_cmath : TEST_C99 : no ] + linux:-lpthread + linux:-lrt + gcc:$(OTHERFLAGS) + : $(source:B)_c99 ] + ; + result += [ run $(source) /boost/regex//boost_regex /boost/system /boost/filesystem /boost/test//boost_unit_test_framework gsl gslcblas + : : : [ check-target-builds has_gsl : TEST_GSL : no ] + linux:-lpthread + linux:-lrt + gcc:$(OTHERFLAGS) + : $(source:B)_gsl ] + ; + result += [ run $(source) /boost/regex//boost_regex /boost/system /boost/filesystem /boost/test//boost_unit_test_framework Rmath + : : : [ check-target-builds has_rmath : TEST_RMATH : no ] + linux:-lpthread + linux:-lrt + gcc:$(OTHERFLAGS) + : $(source:B)_rmath ] + ; + result += [ run $(source) /boost/regex//boost_regex /boost/system /boost/filesystem /boost/test//boost_unit_test_framework cephes_double + : : : [ check-target-builds $(here)/third_party/cephes_double/acosh.c : TEST_CEPHES cephes_double : no ] + linux:-lpthread + linux:-lrt + gcc:$(OTHERFLAGS) + : $(source:B)_cephes ] + ; + } + return $(result) ; +} + +test-suite report_gen : [ all-tests ] ; + +path-constant images_location : html ; +path-constant here : . ; + +xml report : doc/report.qbk : report_gen ; +boostbook standalone + : + report + : + # Path for links to Boost: + boost.root=../../../../.. + + # Some general style settings: + table.footnote.number.format=1 + footnote.number.format=1 + html.stylesheet=http://www.boost.org/doc/libs/1_58_0/doc/src/boostbook.css + + # HTML options first: + # Use graphics not text for navigation: + navig.graphics=1 + # How far down we chunk nested sections, basically all of them: + chunk.section.depth=0 + # Don't put the first section on the same page as the TOC: + chunk.first.sections=0 + # How far down sections get TOC's + toc.section.depth=2 + # Max depth in each TOC: + toc.max.depth=4 + # How far down we go with TOC's + generate.section.toc.level=10 + ; + diff --git a/src/boost/libs/math/reporting/accuracy/bindings.hpp b/src/boost/libs/math/reporting/accuracy/bindings.hpp new file mode 100644 index 00000000..f2d49a03 --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/bindings.hpp @@ -0,0 +1,765 @@ +// Copyright John Maddock 2015. +// 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) + +#ifndef BOOST_MATH_BINDINGS +#define BOOST_MATH_BINDINGS + +#define ERROR_REPORTING_MODE +#include + +#if TEST_CXX17_CMATH + +#include + +#define TEST_LIBRARY_NAME "" + +#define LOG1P_FUNCTION_TO_TEST std::log1p +#define EXPM1_FUNCTION_TO_TEST std::expm1 + +#define CBRT_FUNCTION_TO_TEST std::cbrt +#define ERF_FUNCTION_TO_TEST std::erf +#define ERFC_FUNCTION_TO_TEST std::erfc + +#define LGAMMA_FUNCTION_TO_TEST std::lgamma +#define TGAMMA_FUNCTION_TO_TEST std::tgamma + +#define BESSEL_I_FUNCTION_TO_TEST std::cyl_bessel_i +#define BESSEL_IN_FUNCTION_TO_TEST std::cyl_bessel_i +#define BESSEL_J_FUNCTION_TO_TEST std::cyl_bessel_j +#define BESSEL_JN_FUNCTION_TO_TEST std::cyl_bessel_j +#define BESSEL_JS_FUNCTION_TO_TEST std::sph_bessel +#define BESSEL_K_FUNCTION_TO_TEST std::cyl_bessel_k +#define BESSEL_KN_FUNCTION_TO_TEST std::cyl_bessel_k +#define BESSEL_Y_FUNCTION_TO_TEST std::cyl_neumann +#define BESSEL_YN_FUNCTION_TO_TEST std::cyl_neumann +#define BESSEL_YS_FUNCTION_TO_TEST std::sph_neumann + +#define BETA_FUNCTION_TO_TEST std::beta + +#define ELLINT_1_FUNCTION_TO_TEST std::ellint_1 +#define ELLINT_1C_FUNCTION_TO_TEST std::comp_ellint_1 +#define ELLINT_2_FUNCTION_TO_TEST std::ellint_2 +#define ELLINT_2C_FUNCTION_TO_TEST std::comp_ellint_2 +#define ELLINT_3_FUNCTION_TO_TEST std::ellint_3 +#define ELLINT_3C_FUNCTION_TO_TEST std::comp_ellint_3 + +#define EI_FUNCTION_TO_TEST std::expint + +#define LAGUERRE_FUNCTION_TO_TEST std::laguerre +#define ASSOC_LAGUERRE_FUNCTION_TO_TEST std::assoc_laguerre + +inline long double legendre_p_binder(int i, long double d) +{ + if(i < 0) + throw std::domain_error("order parameters less than 0 not supported in TR1"); + return std::legendre(i, d); +} +inline long double assoc_legendre_p_binder(int i, int j, long double d) +{ + if((i < 0) || (j < 0)) + throw std::domain_error("order parameters less than 0 not supported in TR1"); + return std::assoc_legendre(i, j, d); +} + +#define LEGENDRE_P_FUNCTION_TO_TEST legendre_p_binder +#define LEGENDRE_PA_FUNCTION_TO_TEST assoc_legendre_p_binder +#define ZETA_FUNCTION_TO_TEST std::riemann_zeta + +#define TYPE_TO_TEST long double + +#elif defined(TEST_C99) + +#include + +#define TEST_LIBRARY_NAME "" + +#ifdef _MSC_VER + +#define LOG1P_FUNCTION_TO_TEST ::log1p +#define EXPM1_FUNCTION_TO_TEST ::expm1 + +#define CBRT_FUNCTION_TO_TEST ::cbrt +#define ERF_FUNCTION_TO_TEST ::erf +#define ERFC_FUNCTION_TO_TEST ::erfc + +#define LGAMMA_FUNCTION_TO_TEST ::lgamma +#define TGAMMA_FUNCTION_TO_TEST ::tgamma +#define BESSEL_JN_FUNCTION_TO_TEST ::jn +#define BESSEL_YN_FUNCTION_TO_TEST ::yn + +#define TYPE_TO_TEST double + +#else + +#define LOG1P_FUNCTION_TO_TEST ::log1pl +#define EXPM1_FUNCTION_TO_TEST ::expm1l + +#define CBRT_FUNCTION_TO_TEST ::cbrtl +#define ERF_FUNCTION_TO_TEST ::erfl +#define ERFC_FUNCTION_TO_TEST ::erfcl + +#define LGAMMA_FUNCTION_TO_TEST ::lgammal +#define TGAMMA_FUNCTION_TO_TEST ::tgammal +//#define BESSEL_JN_FUNCTION_TO_TEST ::jnl +//#define BESSEL_JN_FUNCTION_TO_TEST ::ynl + +#define TYPE_TO_TEST long double +#endif + +#elif defined(TEST_GSL) + +#include + +#include +#include +#include + +#define TEST_LIBRARY_NAME "GSL " GSL_VERSION + +void gsl_handler(const char * reason, const char * file, int line, int gsl_errno) +{ + if(gsl_errno == GSL_ERANGE) return; // handle zero or infinity in our test code. + throw std::domain_error(reason); +} + +struct gsl_error_handler_setter +{ + gsl_error_handler_t * old_handler; + gsl_error_handler_setter() + { + old_handler = gsl_set_error_handler(gsl_handler); + } + ~gsl_error_handler_setter() + { + gsl_set_error_handler(old_handler); + } +}; + +static const gsl_error_handler_setter handler; + +inline double gsl_bessel_ys(unsigned i, double d) +{ + return gsl_sf_bessel_yl(i, d); +} + +inline double gsl_bessel_js(unsigned i, double d) +{ + return gsl_sf_bessel_jl(i, d); +} + +//#define CBRT_FUNCTION_TO_TEST boost::cbrt +#define ERF_FUNCTION_TO_TEST gsl_sf_erf +#define ERFC_FUNCTION_TO_TEST gsl_sf_erfc +//#define ERF_INV_FUNCTION_TO_TEST boost::math::erf_inv +//#define ERFC_INV_FUNCTION_TO_TEST boost::math::erfc_inv + +#define LGAMMA_FUNCTION_TO_TEST gsl_sf_lngamma +#define TGAMMA_FUNCTION_TO_TEST gsl_sf_gamma +//#define TGAMMA1PM1_FUNCTION_TO_TEST boost::math::tgamma1pm1 + +#define BESSEL_I_FUNCTION_TO_TEST gsl_sf_bessel_Inu +#define BESSEL_IN_FUNCTION_TO_TEST gsl_sf_bessel_In +//#define BESSEL_IP_FUNCTION_TO_TEST boost::math::cyl_bessel_i_prime +//#define BESSEL_IPN_FUNCTION_TO_TEST boost::math::cyl_bessel_i_prime +#define BESSEL_J_FUNCTION_TO_TEST gsl_sf_bessel_Jnu +#define BESSEL_JN_FUNCTION_TO_TEST gsl_sf_bessel_Jn +#define BESSEL_JS_FUNCTION_TO_TEST gsl_bessel_js +//#define BESSEL_JP_FUNCTION_TO_TEST boost::math::cyl_bessel_j_prime +//#define BESSEL_JPN_FUNCTION_TO_TEST boost::math::cyl_bessel_j_prime +//#define BESSEL_JPS_FUNCTION_TO_TEST boost::math::sph_bessel_prime +#define BESSEL_K_FUNCTION_TO_TEST gsl_sf_bessel_Knu +#define BESSEL_KN_FUNCTION_TO_TEST gsl_sf_bessel_Kn +//#define BESSEL_KP_FUNCTION_TO_TEST boost::math::cyl_bessel_k_prime +//#define BESSEL_KPN_FUNCTION_TO_TEST boost::math::cyl_bessel_k_prime +#define BESSEL_Y_FUNCTION_TO_TEST gsl_sf_bessel_Ynu +#define BESSEL_YN_FUNCTION_TO_TEST gsl_sf_bessel_Yn +#define BESSEL_YS_FUNCTION_TO_TEST gsl_bessel_ys +//#define BESSEL_YP_FUNCTION_TO_TEST boost::math::cyl_neumann_prime +//#define BESSEL_YNP_FUNCTION_TO_TEST boost::math::cyl_neumann_prime +//#define BESSEL_YSP_FUNCTION_TO_TEST boost::math::sph_neumann_prime + +#define BETA_FUNCTION_TO_TEST gsl_sf_beta +//#define BINOMIAL_FUNCTION_TO_TEST boost::math::binomial_coefficient + +inline double RC(double a, double b) +{ + return gsl_sf_ellint_RC(a, b, GSL_PREC_DOUBLE); +} +inline double RD(double a, double b, double c) +{ + return gsl_sf_ellint_RD(a, b, c, GSL_PREC_DOUBLE); +} +inline double RF(double a, double b, double c) +{ + return gsl_sf_ellint_RF(a, b, c, GSL_PREC_DOUBLE); +} +inline double RJ(double a, double b, double c, double d) +{ + return gsl_sf_ellint_RJ(a, b, c, d, GSL_PREC_DOUBLE); +} + + +#define ELLINT_RC_FUNCTION_TO_TEST RC +#define ELLINT_RD_FUNCTION_TO_TEST RD +#define ELLINT_RF_FUNCTION_TO_TEST RF +//#define ELLINT_RG_FUNCTION_TO_TEST boost::math::ellint_rg +#define ELLINT_RJ_FUNCTION_TO_TEST RJ + +#define DIGAMMA_FUNCTION_TO_TEST gsl_sf_psi + +inline double ellintK(double a) { return gsl_sf_ellint_Kcomp(a, GSL_PREC_DOUBLE); } +inline double ellintE(double a) { return gsl_sf_ellint_Ecomp(a, GSL_PREC_DOUBLE); } +inline double ellintP(double a, double b) { return gsl_sf_ellint_Pcomp(a, -b, GSL_PREC_DOUBLE); } + +inline double ellintF(double a, double b) { return gsl_sf_ellint_F(b, a, GSL_PREC_DOUBLE); } +inline double ellintE2(double a, double b) { return gsl_sf_ellint_E(b, a, GSL_PREC_DOUBLE); } +inline double ellintP3(double a, double b, double c) { return gsl_sf_ellint_P(c, a, -b, GSL_PREC_DOUBLE); } +inline double ellintD2(double a, double b) { return gsl_sf_ellint_D(b, a, GSL_PREC_DOUBLE); } + +#define ELLINT_1_FUNCTION_TO_TEST ellintF +#define ELLINT_1C_FUNCTION_TO_TEST ellintK +#define ELLINT_2_FUNCTION_TO_TEST ellintE2 +#define ELLINT_2C_FUNCTION_TO_TEST ellintE +#define ELLINT_3_FUNCTION_TO_TEST ellintP3 +#define ELLINT_3C_FUNCTION_TO_TEST ellintP +#define ELLINT_D2_FUNCTION_TO_TEST ellintD2 +//#define ELLINT_D1_FUNCTION_TO_TEST boost::math::ellint_d + +#define EI_FUNCTION_TO_TEST gsl_sf_expint_Ei +#define EN_FUNCTION_TO_TEST gsl_sf_expint_En + +//#define HERMITE_FUNCTION_TO_TEST boost::math::hermite +//#define HEUMAN_LAMBDA_FUNCTION_TO_TEST boost::math::heuman_lambda + +//#define BETA_INC_FUNCTION_TO_TEST boost::math::beta +//#define BETAC_INC_FUNCTION_TO_TEST boost::math::betac +#define IBETA_FUNCTION_TO_TEST gsl_sf_beta_inc +//#define IBETAC_FUNCTION_TO_TEST boost::math::ibetac +//#define IBETA_INV_FUNCTION_TO_TEST boost::math::ibeta_inv +//#define IBETAC_INV_FUNCTION_TO_TEST boost::math::ibetac_inv +//#define IBETA_INVA_FUNCTION_TO_TEST boost::math::ibeta_inva +//#define IBETAC_INVA_FUNCTION_TO_TEST boost::math::ibetac_inva +//#define IBETA_INVB_FUNCTION_TO_TEST boost::math::ibeta_invb +//#define IBETAC_INVB_FUNCTION_TO_TEST boost::math::ibetac_invb + +#define IGAMMA_FUNCTION_TO_TEST gsl_sf_gamma_inc +//#define IGAMMAL_FUNCTION_TO_TEST boost::math::tgamma_lower +#define GAMMAP_FUNCTION_TO_TEST gsl_sf_gamma_inc_P +#define GAMMAQ_FUNCTION_TO_TEST gsl_sf_gamma_inc_Q +//#define GAMMAP_INV_FUNCTION_TO_TEST boost::math::gamma_p_inv +//#define GAMMAQ_INV_FUNCTION_TO_TEST boost::math::gamma_q_inv +//#define GAMMAP_INVA_FUNCTION_TO_TEST boost::math::gamma_p_inva +//#define GAMMAQ_INVA_FUNCTION_TO_TEST boost::math::gamma_q_inva + +inline double sn(double k, double u) +{ + double s, c, d; + gsl_sf_elljac_e(u, k * k, &s, &c, &d); + return s; +} +inline double cn(double k, double u) +{ + double s, c, d; + gsl_sf_elljac_e(u, k * k, &s, &c, &d); + return c; +} +inline double dn(double k, double u) +{ + double s, c, d; + gsl_sf_elljac_e(u, k * k, &s, &c, &d); + return d; +} + +#define SN_FUNCTION_TO_TEST sn +#define CN_FUNCTION_TO_TEST cn +#define DN_FUNCTION_TO_TEST dn +//#define JACOBI_ZETA_FUNCTION_TO_TEST boost::math::jacobi_zeta + +inline double laguerre(unsigned n, unsigned m, double x){ return gsl_sf_laguerre_n(n, m, x); } +inline double laguerre_0(unsigned n, double x){ return gsl_sf_laguerre_n(n, 0, x); } + +#define LAGUERRE_FUNCTION_TO_TEST laguerre_0 +#define ASSOC_LAGUERRE_FUNCTION_TO_TEST laguerre + +inline double legendre_q(unsigned n, double x) { return gsl_sf_legendre_Ql(n, x); } + +#define LEGENDRE_P_FUNCTION_TO_TEST gsl_sf_legendre_Pl +#define LEGENDRE_Q_FUNCTION_TO_TEST legendre_q +#define LEGENDRE_PA_FUNCTION_TO_TEST gsl_sf_legendre_Plm + +#define POLYGAMMA_FUNCTION_TO_TEST gsl_sf_psi_n +//#define TGAMMA_RATIO_FUNCTION_TO_TEST boost::math::tgamma_ratio +//#define TGAMMA_DELTA_RATIO_FUNCTION_TO_TEST boost::math::tgamma_delta_ratio +//#define SIN_PI_RATIO_FUNCTION_TO_TEST boost::math::sin_pi +//#define COS_PI_RATIO_FUNCTION_TO_TEST boost::math::cos_pi +#define TRIGAMMA_RATIO_FUNCTION_TO_TEST gsl_sf_psi_1 +#define ZETA_FUNCTION_TO_TEST gsl_sf_zeta + +#define TYPE_TO_TEST double + +#elif defined(TEST_RMATH) + +#define MATHLIB_STANDALONE +#include + +#undef trunc + +#define TEST_LIBRARY_NAME "Rmath " R_VERSION_STRING + +#define LOG1P_FUNCTION_TO_TEST log1p +#define EXPM1_FUNCTION_TO_TEST expm1 + +//#define CBRT_FUNCTION_TO_TEST boost::math::cbrt +//#define ERF_FUNCTION_TO_TEST boost::math::erf +//#define ERFC_FUNCTION_TO_TEST boost::math::erfc +//#define ERF_INV_FUNCTION_TO_TEST boost::math::erf_inv +//#define ERFC_INV_FUNCTION_TO_TEST boost::math::erfc_inv + +#define LGAMMA_FUNCTION_TO_TEST lgammafn +#define TGAMMA_FUNCTION_TO_TEST gammafn +//#define TGAMMA1PM1_FUNCTION_TO_TEST boost::math::tgamma1pm1 + +inline double I(double n, double x) +{ + if (x < 0) + throw std::domain_error("Unsupported domain"); + return bessel_i(x, n, 1); +} +inline double K(double n, double x) { return bessel_k(x, n, 1); } +inline double J(double n, double x) +{ + if (x < 0) + throw std::domain_error("Unsupported domain"); + return bessel_j(x, n); +} +inline double Y(double n, double x) { return bessel_y(x, n); } + +#define BESSEL_I_FUNCTION_TO_TEST I +#define BESSEL_IN_FUNCTION_TO_TEST I +//#define BESSEL_IP_FUNCTION_TO_TEST boost::math::cyl_bessel_i_prime +//#define BESSEL_IPN_FUNCTION_TO_TEST boost::math::cyl_bessel_i_prime +#define BESSEL_J_FUNCTION_TO_TEST J +#define BESSEL_JN_FUNCTION_TO_TEST J +//#define BESSEL_JS_FUNCTION_TO_TEST boost::math::sph_bessel +//#define BESSEL_JP_FUNCTION_TO_TEST boost::math::cyl_bessel_j_prime +//#define BESSEL_JPN_FUNCTION_TO_TEST boost::math::cyl_bessel_j_prime +//#define BESSEL_JPS_FUNCTION_TO_TEST boost::math::sph_bessel_prime +#define BESSEL_K_FUNCTION_TO_TEST K +#define BESSEL_KN_FUNCTION_TO_TEST K +//#define BESSEL_KP_FUNCTION_TO_TEST boost::math::cyl_bessel_k_prime +//#define BESSEL_KPN_FUNCTION_TO_TEST boost::math::cyl_bessel_k_prime +#define BESSEL_Y_FUNCTION_TO_TEST Y +#define BESSEL_YN_FUNCTION_TO_TEST Y +//#define BESSEL_YS_FUNCTION_TO_TEST boost::math::sph_neumann +//#define BESSEL_YP_FUNCTION_TO_TEST boost::math::cyl_neumann_prime +//#define BESSEL_YNP_FUNCTION_TO_TEST boost::math::cyl_neumann_prime +//#define BESSEL_YSP_FUNCTION_TO_TEST boost::math::sph_neumann_prime + +#define BETA_FUNCTION_TO_TEST beta +//#define BINOMIAL_FUNCTION_TO_TEST boost::math::binomial_coefficient + +//#define ELLINT_RC_FUNCTION_TO_TEST boost::math::ellint_rc +//#define ELLINT_RD_FUNCTION_TO_TEST boost::math::ellint_rd +//#define ELLINT_RF_FUNCTION_TO_TEST boost::math::ellint_rf +//#define ELLINT_RG_FUNCTION_TO_TEST boost::math::ellint_rg +//#define ELLINT_RJ_FUNCTION_TO_TEST boost::math::ellint_rj + +#define DIGAMMA_FUNCTION_TO_TEST digamma + +//#define ELLINT_1_FUNCTION_TO_TEST boost::math::ellint_1 +//#define ELLINT_1C_FUNCTION_TO_TEST boost::math::ellint_1 +//#define ELLINT_2_FUNCTION_TO_TEST boost::math::ellint_2 +//#define ELLINT_2C_FUNCTION_TO_TEST boost::math::ellint_2 +//#define ELLINT_3_FUNCTION_TO_TEST boost::math::ellint_3 +//#define ELLINT_3C_FUNCTION_TO_TEST boost::math::ellint_3 +//#define ELLINT_D2_FUNCTION_TO_TEST boost::math::ellint_d +//#define ELLINT_D1_FUNCTION_TO_TEST boost::math::ellint_d + +//#define EI_FUNCTION_TO_TEST boost::math::expint +//#define EN_FUNCTION_TO_TEST boost::math::expint + +//#define HERMITE_FUNCTION_TO_TEST boost::math::hermite +//#define HEUMAN_LAMBDA_FUNCTION_TO_TEST boost::math::heuman_lambda + +inline double ibeta(double a, double b, double x) { return pbeta(x, a, b, 1, 0); } +inline double ibetac(double a, double b, double x) { return pbeta(x, a, b, 0, 0); } +inline double ibeta_inv(double a, double b, double x) { return qbeta(x, a, b, 1, 0); } +inline double ibetac_inv(double a, double b, double x) { return qbeta(x, a, b, 0, 0); } + +//#define BETA_INC_FUNCTION_TO_TEST boost::math::beta +//#define BETAC_INC_FUNCTION_TO_TEST boost::math::betac +#define IBETA_FUNCTION_TO_TEST ibeta +#define IBETAC_FUNCTION_TO_TEST ibetac +#define IBETA_INV_FUNCTION_TO_TEST ibeta_inv +#define IBETAC_INV_FUNCTION_TO_TEST ibetac_inv +//#define IBETA_INVA_FUNCTION_TO_TEST boost::math::ibeta_inva +//#define IBETAC_INVA_FUNCTION_TO_TEST boost::math::ibetac_inva +//#define IBETA_INVB_FUNCTION_TO_TEST boost::math::ibeta_invb +//#define IBETAC_INVB_FUNCTION_TO_TEST boost::math::ibetac_invb + +inline double gamma_p(double a, double x) { return pgamma(x, a, 1.0, 1, 0); } +inline double gamma_q(double a, double x) { return pgamma(x, a, 1.0, 0, 0); } +inline double gamma_p_inv(double a, double x) { return qgamma(x, a, 1.0, 1, 0); } +inline double gamma_q_inv(double a, double x) { return qgamma(x, a, 1.0, 0, 0); } + +//#define IGAMMA_FUNCTION_TO_TEST boost::math::tgamma +//#define IGAMMAL_FUNCTION_TO_TEST boost::math::tgamma_lower +#define GAMMAP_FUNCTION_TO_TEST gamma_p +#define GAMMAQ_FUNCTION_TO_TEST gamma_q +#define GAMMAP_INV_FUNCTION_TO_TEST gamma_p_inv +#define GAMMAQ_INV_FUNCTION_TO_TEST gamma_q_inv +//#define GAMMAP_INVA_FUNCTION_TO_TEST boost::math::gamma_p_inva +//#define GAMMAQ_INVA_FUNCTION_TO_TEST boost::math::gamma_q_inva + +//#define SN_FUNCTION_TO_TEST boost::math::jacobi_sn +//#define CN_FUNCTION_TO_TEST boost::math::jacobi_cn +//#define DN_FUNCTION_TO_TEST boost::math::jacobi_dn +//#define JACOBI_ZETA_FUNCTION_TO_TEST boost::math::jacobi_zeta + +//#define LAGUERRE_FUNCTION_TO_TEST boost::math::laguerre +//#define ASSOC_LAGUERRE_FUNCTION_TO_TEST boost::math::laguerre + +//#define LEGENDRE_P_FUNCTION_TO_TEST boost::math::legendre_p +//#define LEGENDRE_Q_FUNCTION_TO_TEST boost::math::legendre_q +//#define LEGENDRE_PA_FUNCTION_TO_TEST boost::math::legendre_p + +inline double polygamma(int n, double x) +{ + if (x < 0) + throw std::domain_error("Outside supported domain"); + return psigamma(x, n); +} + +#define POLYGAMMA_FUNCTION_TO_TEST polygamma +//#define TGAMMA_RATIO_FUNCTION_TO_TEST boost::math::tgamma_ratio +//#define TGAMMA_DELTA_RATIO_FUNCTION_TO_TEST boost::math::tgamma_delta_ratio +//#define SIN_PI_RATIO_FUNCTION_TO_TEST sinpi +//#define COS_PI_RATIO_FUNCTION_TO_TEST cospi +#define TRIGAMMA_RATIO_FUNCTION_TO_TEST trigamma +//#define ZETA_FUNCTION_TO_TEST boost::math::zeta + +//#define SQRT1PM1_FUNCTION_TO_TEST boost::math::sqrt1pm1 +//#define POWM1_FUNCTION_TO_TEST boost::math::powm1 +//#define OWENS_T_FUNCTION_TO_TEST boost::math::owens_t +//#define SPHERICAL_HARMONIC_R_FUNCTION_TO_TEST boost::math::spherical_harmonic_r +//#define SPHERICAL_HARMONIC_I_FUNCTION_TO_TEST boost::math::spherical_harmonic_i + +template T do_nc_beta_cdf(T a, T b, T nc, T x){ return pnbeta(x, a, b, nc, 1, 0); } +template T do_nc_beta_ccdf(T a, T b, T nc, T x){ return pnbeta(x, a, b, nc, 0, 0); } +template T do_nc_chi_squared_cdf(T df, T nc, T x){ return pnchisq(x, df, nc, 1, 0); } +template T do_nc_chi_squared_ccdf(T df, T nc, T x){ return pnchisq(x, df, nc, 0, 0); } +template T do_nc_t_cdf(T df, T nc, T x){ return pnt(x, df, nc, 1, 0); } +template T do_nc_t_ccdf(T df, T nc, T x){ return pnt(x, df, nc, 0, 0); } + +#define NC_BETA_CDF_FUNCTION_TO_TEST do_nc_beta_cdf +#define NC_BETA_CCDF_FUNCTION_TO_TEST do_nc_beta_ccdf +#define NC_CHI_SQUARED_CDF_FUNCTION_TO_TEST do_nc_chi_squared_cdf +#define NC_CHI_SQUARED_CCDF_FUNCTION_TO_TEST do_nc_chi_squared_ccdf +#define NC_T_CDF_FUNCTION_TO_TEST do_nc_t_cdf +#define NC_T_CCDF_FUNCTION_TO_TEST do_nc_t_ccdf + +#define TYPE_TO_TEST double + +#elif defined(TEST_CEPHES) + +#define TEST_LIBRARY_NAME "Cephes" +#define TYPE_TO_TEST double + +extern "C" { + + double log1p(double) throw(); + double expm1(double) throw(); + double cbrt(double) throw(); + double erf(double) throw(); + double erfc(double) throw(); + double gamma(double) throw(); + double lgam(double) throw(); + + double iv(double, double) throw(); + double jv(double, double) throw(); + double jn(int, double) throw(); + double kn(int, double) throw(); + double yn(int, double) throw(); + + double beta(double, double)throw(); + double psi(double); + + double ellik(double, double); + double ellpk(double); + double ellie(double, double); + double ellpe(double); + + double ei(double); + // Can't get any sensible values from Cephes expn??? + //double expn(double, double); + + double incbet(double, double, double); + double incbi(double, double, double); + + double igam(double, double); + double igamc(double, double); + double igami(double, double); + + double ellpj(double u, double m, double *sn, double *cn, double *dn, double *phi); + + double zetac(double); + +} + +inline double ellint_1(double k, double phi) { return ellik(phi, k * k); } +inline double ellint_2(double k, double phi) { return ellie(phi, k * k); } +inline double ellint_1(double k) { return ellpk(k * k); } +inline double ellint_2(double k) { return ellpe(k * k); } + +inline double sn(double k, double u) +{ + double sn, cn, dn, phi; + ellpj(u, k * k, &sn, &cn, &dn, &phi); + return sn; +} +inline double cn(double k, double u) +{ + double sn, cn, dn, phi; + ellpj(u, k * k, &sn, &cn, &dn, &phi); + return cn; +} + +inline double dn(double k, double u) +{ + double sn, cn, dn, phi; + ellpj(u, k * k, &sn, &cn, &dn, &phi); + return dn; +} + +#define LOG1P_FUNCTION_TO_TEST log1p +#define EXPM1_FUNCTION_TO_TEST expm1 + +#define CBRT_FUNCTION_TO_TEST cbrt +#define ERF_FUNCTION_TO_TEST erf +#define ERFC_FUNCTION_TO_TEST erfc +//#define ERF_INV_FUNCTION_TO_TEST boost::math::erf_inv +//#define ERFC_INV_FUNCTION_TO_TEST boost::math::erfc_inv + +#define LGAMMA_FUNCTION_TO_TEST lgam +#define TGAMMA_FUNCTION_TO_TEST gamma +//#define TGAMMA1PM1_FUNCTION_TO_TEST boost::math::tgamma1pm1 + +#define BESSEL_I_FUNCTION_TO_TEST iv +#define BESSEL_IN_FUNCTION_TO_TEST iv +//#define BESSEL_IP_FUNCTION_TO_TEST boost::math::cyl_bessel_i_prime +//#define BESSEL_IPN_FUNCTION_TO_TEST boost::math::cyl_bessel_i_prime +#define BESSEL_J_FUNCTION_TO_TEST jv +#define BESSEL_JN_FUNCTION_TO_TEST jn +//#define BESSEL_JS_FUNCTION_TO_TEST boost::math::sph_bessel +//#define BESSEL_JP_FUNCTION_TO_TEST boost::math::cyl_bessel_j_prime +//#define BESSEL_JPN_FUNCTION_TO_TEST boost::math::cyl_bessel_j_prime +//#define BESSEL_JPS_FUNCTION_TO_TEST boost::math::sph_bessel_prime +//#define BESSEL_K_FUNCTION_TO_TEST boost::math::cyl_bessel_k +#define BESSEL_KN_FUNCTION_TO_TEST kn +//#define BESSEL_KP_FUNCTION_TO_TEST boost::math::cyl_bessel_k_prime +//#define BESSEL_KPN_FUNCTION_TO_TEST boost::math::cyl_bessel_k_prime +//#define BESSEL_Y_FUNCTION_TO_TEST boost::math::cyl_neumann +#define BESSEL_YN_FUNCTION_TO_TEST yn +//#define BESSEL_YS_FUNCTION_TO_TEST boost::math::sph_neumann +//#define BESSEL_YP_FUNCTION_TO_TEST boost::math::cyl_neumann_prime +//#define BESSEL_YNP_FUNCTION_TO_TEST boost::math::cyl_neumann_prime +//#define BESSEL_YSP_FUNCTION_TO_TEST boost::math::sph_neumann_prime + +#define BETA_FUNCTION_TO_TEST beta +//#define BINOMIAL_FUNCTION_TO_TEST boost::math::binomial_coefficient + +//#define ELLINT_RC_FUNCTION_TO_TEST boost::math::ellint_rc +//#define ELLINT_RD_FUNCTION_TO_TEST boost::math::ellint_rd +//#define ELLINT_RF_FUNCTION_TO_TEST boost::math::ellint_rf +//#define ELLINT_RG_FUNCTION_TO_TEST boost::math::ellint_rg +//#define ELLINT_RJ_FUNCTION_TO_TEST boost::math::ellint_rj + +#define DIGAMMA_FUNCTION_TO_TEST psi + +#define ELLINT_1_FUNCTION_TO_TEST ellint_1 +// Can't seem to get sensible answers from Cephes complete elliptic integrals??? +//#define ELLINT_1C_FUNCTION_TO_TEST ellint_1 +#define ELLINT_2_FUNCTION_TO_TEST ellint_2 +//#define ELLINT_2C_FUNCTION_TO_TEST ellint_2 +//#define ELLINT_3_FUNCTION_TO_TEST boost::math::ellint_3 +//#define ELLINT_3C_FUNCTION_TO_TEST boost::math::ellint_3 +//#define ELLINT_D2_FUNCTION_TO_TEST boost::math::ellint_d +//#define ELLINT_D1_FUNCTION_TO_TEST boost::math::ellint_d + +#define EI_FUNCTION_TO_TEST ei +//#define EN_FUNCTION_TO_TEST expn + +//#define HERMITE_FUNCTION_TO_TEST boost::math::hermite +//#define HEUMAN_LAMBDA_FUNCTION_TO_TEST boost::math::heuman_lambda + +//#define BETA_INC_FUNCTION_TO_TEST incbet +//#define BETAC_INC_FUNCTION_TO_TEST boost::math::betac +#define IBETA_FUNCTION_TO_TEST incbet +//#define IBETAC_FUNCTION_TO_TEST boost::math::ibetac +#define IBETA_INV_FUNCTION_TO_TEST incbi +//#define IBETAC_INV_FUNCTION_TO_TEST boost::math::ibetac_inv +//#define IBETA_INVA_FUNCTION_TO_TEST boost::math::ibeta_inva +//#define IBETAC_INVA_FUNCTION_TO_TEST boost::math::ibetac_inva +//#define IBETA_INVB_FUNCTION_TO_TEST boost::math::ibeta_invb +//#define IBETAC_INVB_FUNCTION_TO_TEST boost::math::ibetac_invb + +//#define IGAMMA_FUNCTION_TO_TEST boost::math::tgamma +//#define IGAMMAL_FUNCTION_TO_TEST boost::math::tgamma_lower +#define GAMMAP_FUNCTION_TO_TEST igam +#define GAMMAQ_FUNCTION_TO_TEST igamc +//#define GAMMAP_INV_FUNCTION_TO_TEST boost::math::gamma_p_inv +#define GAMMAQ_INV_FUNCTION_TO_TEST igami +//#define GAMMAP_INVA_FUNCTION_TO_TEST boost::math::gamma_p_inva +//#define GAMMAQ_INVA_FUNCTION_TO_TEST boost::math::gamma_q_inva + +#define SN_FUNCTION_TO_TEST sn +#define CN_FUNCTION_TO_TEST cn +#define DN_FUNCTION_TO_TEST dn + +#define ZETA_FUNCTION_TO_TEST zetac + +#else + +#include +#include +#include + +#define TEST_LIBRARY_NAME "boost" + +#define LOG1P_FUNCTION_TO_TEST boost::math::log1p +#define EXPM1_FUNCTION_TO_TEST boost::math::expm1 + +#define CBRT_FUNCTION_TO_TEST boost::math::cbrt +#define ERF_FUNCTION_TO_TEST boost::math::erf +#define ERFC_FUNCTION_TO_TEST boost::math::erfc +#define ERF_INV_FUNCTION_TO_TEST boost::math::erf_inv +#define ERFC_INV_FUNCTION_TO_TEST boost::math::erfc_inv + +#define LGAMMA_FUNCTION_TO_TEST boost::math::lgamma +#define TGAMMA_FUNCTION_TO_TEST boost::math::tgamma +#define TGAMMA1PM1_FUNCTION_TO_TEST boost::math::tgamma1pm1 + +#define BESSEL_I_FUNCTION_TO_TEST boost::math::cyl_bessel_i +#define BESSEL_IN_FUNCTION_TO_TEST boost::math::cyl_bessel_i +#define BESSEL_IP_FUNCTION_TO_TEST boost::math::cyl_bessel_i_prime +#define BESSEL_IPN_FUNCTION_TO_TEST boost::math::cyl_bessel_i_prime +#define BESSEL_J_FUNCTION_TO_TEST boost::math::cyl_bessel_j +#define BESSEL_JN_FUNCTION_TO_TEST boost::math::cyl_bessel_j +#define BESSEL_JS_FUNCTION_TO_TEST boost::math::sph_bessel +#define BESSEL_JP_FUNCTION_TO_TEST boost::math::cyl_bessel_j_prime +#define BESSEL_JPN_FUNCTION_TO_TEST boost::math::cyl_bessel_j_prime +#define BESSEL_JPS_FUNCTION_TO_TEST boost::math::sph_bessel_prime +#define BESSEL_K_FUNCTION_TO_TEST boost::math::cyl_bessel_k +#define BESSEL_KN_FUNCTION_TO_TEST boost::math::cyl_bessel_k +#define BESSEL_KP_FUNCTION_TO_TEST boost::math::cyl_bessel_k_prime +#define BESSEL_KPN_FUNCTION_TO_TEST boost::math::cyl_bessel_k_prime +#define BESSEL_Y_FUNCTION_TO_TEST boost::math::cyl_neumann +#define BESSEL_YN_FUNCTION_TO_TEST boost::math::cyl_neumann +#define BESSEL_YS_FUNCTION_TO_TEST boost::math::sph_neumann +#define BESSEL_YP_FUNCTION_TO_TEST boost::math::cyl_neumann_prime +#define BESSEL_YNP_FUNCTION_TO_TEST boost::math::cyl_neumann_prime +#define BESSEL_YSP_FUNCTION_TO_TEST boost::math::sph_neumann_prime + +#define BETA_FUNCTION_TO_TEST boost::math::beta +#define BINOMIAL_FUNCTION_TO_TEST boost::math::binomial_coefficient + +#define ELLINT_RC_FUNCTION_TO_TEST boost::math::ellint_rc +#define ELLINT_RD_FUNCTION_TO_TEST boost::math::ellint_rd +#define ELLINT_RF_FUNCTION_TO_TEST boost::math::ellint_rf +#define ELLINT_RG_FUNCTION_TO_TEST boost::math::ellint_rg +#define ELLINT_RJ_FUNCTION_TO_TEST boost::math::ellint_rj + +#define DIGAMMA_FUNCTION_TO_TEST boost::math::digamma + +#define ELLINT_1_FUNCTION_TO_TEST boost::math::ellint_1 +#define ELLINT_1C_FUNCTION_TO_TEST boost::math::ellint_1 +#define ELLINT_2_FUNCTION_TO_TEST boost::math::ellint_2 +#define ELLINT_2C_FUNCTION_TO_TEST boost::math::ellint_2 +#define ELLINT_3_FUNCTION_TO_TEST boost::math::ellint_3 +#define ELLINT_3C_FUNCTION_TO_TEST boost::math::ellint_3 +#define ELLINT_D2_FUNCTION_TO_TEST boost::math::ellint_d +#define ELLINT_D1_FUNCTION_TO_TEST boost::math::ellint_d + +#define EI_FUNCTION_TO_TEST boost::math::expint +#define EN_FUNCTION_TO_TEST boost::math::expint + +#define HERMITE_FUNCTION_TO_TEST boost::math::hermite +#define HEUMAN_LAMBDA_FUNCTION_TO_TEST boost::math::heuman_lambda + +#define BETA_INC_FUNCTION_TO_TEST boost::math::beta +#define BETAC_INC_FUNCTION_TO_TEST boost::math::betac +#define IBETA_FUNCTION_TO_TEST boost::math::ibeta +#define IBETAC_FUNCTION_TO_TEST boost::math::ibetac +#define IBETA_INV_FUNCTION_TO_TEST boost::math::ibeta_inv +#define IBETAC_INV_FUNCTION_TO_TEST boost::math::ibetac_inv +#define IBETA_INVA_FUNCTION_TO_TEST boost::math::ibeta_inva +#define IBETAC_INVA_FUNCTION_TO_TEST boost::math::ibetac_inva +#define IBETA_INVB_FUNCTION_TO_TEST boost::math::ibeta_invb +#define IBETAC_INVB_FUNCTION_TO_TEST boost::math::ibetac_invb + +#define IGAMMA_FUNCTION_TO_TEST boost::math::tgamma +#define IGAMMAL_FUNCTION_TO_TEST boost::math::tgamma_lower +#define GAMMAP_FUNCTION_TO_TEST boost::math::gamma_p +#define GAMMAQ_FUNCTION_TO_TEST boost::math::gamma_q +#define GAMMAP_INV_FUNCTION_TO_TEST boost::math::gamma_p_inv +#define GAMMAQ_INV_FUNCTION_TO_TEST boost::math::gamma_q_inv +#define GAMMAP_INVA_FUNCTION_TO_TEST boost::math::gamma_p_inva +#define GAMMAQ_INVA_FUNCTION_TO_TEST boost::math::gamma_q_inva + +#define SN_FUNCTION_TO_TEST boost::math::jacobi_sn +#define CN_FUNCTION_TO_TEST boost::math::jacobi_cn +#define DN_FUNCTION_TO_TEST boost::math::jacobi_dn +#define JACOBI_ZETA_FUNCTION_TO_TEST boost::math::jacobi_zeta + +#define LAGUERRE_FUNCTION_TO_TEST boost::math::laguerre +#define ASSOC_LAGUERRE_FUNCTION_TO_TEST boost::math::laguerre + +#define LEGENDRE_P_FUNCTION_TO_TEST boost::math::legendre_p +#define LEGENDRE_Q_FUNCTION_TO_TEST boost::math::legendre_q +#define LEGENDRE_PA_FUNCTION_TO_TEST boost::math::legendre_p + +#define POLYGAMMA_FUNCTION_TO_TEST boost::math::polygamma +#define TGAMMA_RATIO_FUNCTION_TO_TEST boost::math::tgamma_ratio +#define TGAMMA_DELTA_RATIO_FUNCTION_TO_TEST boost::math::tgamma_delta_ratio +#define SIN_PI_RATIO_FUNCTION_TO_TEST boost::math::sin_pi +#define COS_PI_RATIO_FUNCTION_TO_TEST boost::math::cos_pi +#define TRIGAMMA_RATIO_FUNCTION_TO_TEST boost::math::trigamma +#define ZETA_FUNCTION_TO_TEST boost::math::zeta + +#define SQRT1PM1_FUNCTION_TO_TEST boost::math::sqrt1pm1 +#define POWM1_FUNCTION_TO_TEST boost::math::powm1 +#define OWENS_T_FUNCTION_TO_TEST boost::math::owens_t +#define SPHERICAL_HARMONIC_R_FUNCTION_TO_TEST boost::math::spherical_harmonic_r +#define SPHERICAL_HARMONIC_I_FUNCTION_TO_TEST boost::math::spherical_harmonic_i + +template T do_nc_beta_cdf(T a, T b, T nc, T x){ return cdf(boost::math::non_central_beta_distribution(a, b, nc), x); } +template T do_nc_beta_ccdf(T a, T b, T nc, T x){ return cdf(complement(boost::math::non_central_beta_distribution(a, b, nc), x)); } +template T do_nc_chi_squared_cdf(T df, T nc, T x){ return cdf(boost::math::non_central_chi_squared_distribution(df, nc), x); } +template T do_nc_chi_squared_ccdf(T df, T nc, T x){ return cdf(complement(boost::math::non_central_chi_squared_distribution(df, nc), x)); } +template T do_nc_t_cdf(T df, T nc, T x){ return cdf(boost::math::non_central_t_distribution(df, nc), x); } +template T do_nc_t_ccdf(T df, T nc, T x){ return cdf(complement(boost::math::non_central_t_distribution(df, nc), x)); } + +#define NC_BETA_CDF_FUNCTION_TO_TEST do_nc_beta_cdf +#define NC_BETA_CCDF_FUNCTION_TO_TEST do_nc_beta_ccdf +#define NC_CHI_SQUARED_CDF_FUNCTION_TO_TEST do_nc_chi_squared_cdf +#define NC_CHI_SQUARED_CCDF_FUNCTION_TO_TEST do_nc_chi_squared_ccdf +#define NC_T_CDF_FUNCTION_TO_TEST do_nc_t_cdf +#define NC_T_CCDF_FUNCTION_TO_TEST do_nc_t_ccdf + + +#endif + +#if defined(TYPE_TO_TEST) && !defined(NAME_OF_TYPE_TO_TEST) +#define NAME_OF_TYPE_TO_TEST BOOST_STRINGIZE(TYPE_TO_TEST) +#endif + +// +// This include has to come at the end after all the setup is done: +// +#include "handle_test_result.hpp" + + +#endif + diff --git a/src/boost/libs/math/reporting/accuracy/handle_test_result.hpp b/src/boost/libs/math/reporting/accuracy/handle_test_result.hpp new file mode 100644 index 00000000..3410bb15 --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/handle_test_result.hpp @@ -0,0 +1,515 @@ +// (C) Copyright John Maddock 2006-7. +// 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) + +#ifndef BOOST_MATH_HANDLE_TEST_RESULT +#define BOOST_MATH_HANDLE_TEST_RESULT + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +inline std::string sanitize_string(const std::string& s) +{ + static const boost::regex e("[^a-zA-Z0-9]+"); + return boost::regex_replace(s, e, "_"); +} + +static std::string content; +boost::filesystem::path path_to_content; + +struct content_loader +{ + boost::interprocess::named_mutex mu; + boost::interprocess::scoped_lock lock; + content_loader() : mu(boost::interprocess::open_or_create, "handle_test_result"), lock(mu) + { + boost::filesystem::path p(__FILE__); + p = p.parent_path(); + p /= "doc"; + p /= "accuracy_tables.qbk"; + path_to_content = p; + if(boost::filesystem::exists(p)) + { + boost::filesystem::ifstream is(p); + if(is.good()) + { + do + { + char c = static_cast(is.get()); + if(c != EOF) + content.append(1, c); + } while(is.good()); + } + } + } + ~content_loader() + { + boost::filesystem::ofstream os(path_to_content); + os << content; + } + void instantiate()const + { + } +}; + +static const content_loader loader; + +void load_table(std::vector >& table, std::string::const_iterator begin, std::string::const_iterator end) +{ + static const boost::regex item_e( + "\\[" + "([^\\[\\]]*(?0)?)*" + "\\]" + ); + + boost::regex_token_iterator i(begin, end, item_e), j; + + while(i != j) + { + // Add a row: + table.push_back(std::vector()); + boost::regex_token_iterator k(i->first + 1, i->second - 1, item_e); + while(k != j) + { + // Add a cell: + table.back().push_back(std::string(k->first + 1, k->second - 1)); + ++k; + } + ++i; + } +} + +std::string save_table(std::vector >& table) +{ + std::string result; + + for(std::vector >::const_iterator i = table.begin(), j = table.end(); i != j; ++i) + { + result += "["; + for(std::vector::const_iterator k = i->begin(), l = i->end(); k != l; ++k) + { + result += "["; + result += *k; + result += "]"; + } + result += "]\n"; + } + return result; +} + +void add_to_all_sections(const std::string& id, std::string list_name = "all_sections") +{ + std::string::size_type pos = content.find("[template " + list_name + "[]"), end_pos; + if(pos == std::string::npos) + { + // + // Just append to the end: + // + content.append("\n[template ").append(list_name).append("[]\n[").append(id).append("]\n]\n"); + } + else + { + // + // Read in the all list of sections, add our new one (in alphabetical order), + // and then rewrite the whole thing: + // + static const boost::regex item_e( + "\\[" + "([^\\[\\]]*(?0)?)*" + "\\]|\\]" + ); + boost::regex_token_iterator i(content.begin() + pos + 12 + list_name.size(), content.end(), item_e), j; + std::set sections; + while(i != j) + { + if(i->length() == 1) + { + end_pos = i->first - content.begin(); + break; + } + sections.insert(std::string(i->first + 1, i->second - 1)); + ++i; + } + sections.insert(id); + std::string new_list = "\n"; + for(std::set::const_iterator sec = sections.begin(); sec != sections.end(); ++sec) + { + new_list += "[" + *sec + "]\n"; + } + content.replace(pos + 12 + list_name.size(), end_pos - pos - 12 - list_name.size(), new_list); + } +} + +void add_cell(const std::string& cell_name, const std::string& table_name, const std::string& row_name, const std::string& type_name) +{ + // + // Load the table, add our data, and re-write: + // + std::string table_id = "table_" + sanitize_string(table_name); + std::string column_heading = BOOST_COMPILER; + column_heading += "[br]"; + column_heading += BOOST_PLATFORM; + column_heading += "[br]"; + column_heading += type_name; + boost::regex table_e("\\[table:" + table_id + + "\\s[^\\[]+" + "((\\[" + "([^\\[\\]]*(?2)?)*" + "\\]\\s*)*\\s*)" + "\\]" + ); + + boost::smatch table_location; + if(regex_search(content, table_location, table_e)) + { + std::vector > table_data; + load_table(table_data, table_location[1].first, table_location[1].second); + // + // Figure out which column we're on: + // + unsigned column_id = 1001u; + for(unsigned i = 0; i < table_data[0].size(); ++i) + { + if(table_data[0][i] == column_heading) + { + column_id = i; + break; + } + } + if(column_id > 1000) + { + // + // Need a new column, must be adding a new compiler to the table! + // + table_data[0].push_back(column_heading); + for(unsigned i = 1; i < table_data.size(); ++i) + table_data[i].push_back(std::string()); + column_id = table_data[0].size() - 1; + } + // + // Figure out the row: + // + unsigned row_id = 1001; + for(unsigned i = 1; i < table_data.size(); ++i) + { + if(table_data[i][0] == row_name) + { + row_id = i; + break; + } + } + if(row_id > 1000) + { + // + // Need a new row, add it now: + // + table_data.push_back(std::vector()); + table_data.back().push_back(row_name); + for(unsigned i = 1; i < table_data[0].size(); ++i) + table_data.back().push_back(std::string()); + row_id = table_data.size() - 1; + } + // + // Update the entry: + // + std::string& s = table_data[row_id][column_id]; + if(s.empty()) + { + std::cout << "Adding " << cell_name << " to empty cell."; + s = "[" + cell_name + "]"; + } + else + { + if(cell_name.find("_boost_") != std::string::npos) + { + std::cout << "Adding " << cell_name << " to start of cell."; + s.insert(0, "[" + cell_name + "][br][br]"); + } + else + { + std::cout << "Adding " << cell_name << " to end of cell."; + if((s.find("_boost_") != std::string::npos) && (s.find("[br]") == std::string::npos)) + s += "[br]"; // extra break if we're adding directly after the boost results. + s += "[br][" + cell_name + "]"; + } + } + // + // Convert back to a string and insert into content: + std::string c = save_table(table_data); + content.replace(table_location.position(1), table_location.length(1), c); + } + else + { + // + // Create a new table and try again: + // + std::string new_table = "\n[template " + table_id; + new_table += "[]\n[table:" + table_id; + new_table += " Error rates for "; + new_table += table_name; + new_table += "\n[[]["; + new_table += column_heading; + new_table += "]]\n"; + new_table += "[["; + new_table += row_name; + new_table += "][["; + new_table += cell_name; + new_table += "]]]\n]\n]\n"; + + std::string::size_type pos = content.find("[/tables:]"); + if(pos != std::string::npos) + content.insert(pos + 10, new_table); + else + content += "\n\n[/tables:]\n" + new_table; + // + // Add a section for this table as well: + // + std::string section_id = "section_" + sanitize_string(table_name); + if(content.find(section_id + "[]") == std::string::npos) + { + std::string new_section = "\n[template " + section_id + "[]\n[section:" + section_id + " " + table_name + "]\n[" + table_id + "]\n[endsect]\n]\n"; + pos = content.find("[/sections:]"); + if(pos != std::string::npos) + content.insert(pos + 12, new_section); + else + content += "\n\n[/sections:]\n" + new_section; + add_to_all_sections(section_id); + } + // + // Add to list of all tables (not in sections): + // + add_to_all_sections(table_id, "all_tables"); + } +} + +void set_result(const std::string& cell_name, const std::string& cell_content, const std::string& table_name, const std::string& row_name, const std::string& type_name) +{ + loader.instantiate(); + const boost::regex e("\\[template\\s+" + cell_name + + "\\[\\]([^\\n]*)\\]$"); + + boost::smatch what; + if(regex_search(content, what, e)) + { + content.replace(what.position(1), what.length(1), cell_content); + } + else + { + // Need to add new content: + std::string::size_type pos = content.find("[/Cell Content:]"); + std::string t = "\n[template " + cell_name + "[] " + cell_content + "]"; + if(pos != std::string::npos) + content.insert(pos + 16, t); + else + { + content.insert(0, t); + content.insert(0, "[/Cell Content:]"); + } + } + // + // Check to verify that our content is actually used somewhere, + // if not we need to create a place for it: + // + if(content.find("[" + cell_name + "]") == std::string::npos) + add_cell(cell_name, table_name, row_name, type_name); +} + +void set_error_content(const std::string& id, const std::string& error_s) +{ + boost::regex content_e("\\[template\\s+" + id + + "\\[\\]\\s+" + "(" + "[^\\]\\[]*" + "(?:" + "\\[" + "([^\\[\\]]*(?2)?)*" + "\\]" + "[^\\]\\[]*" + ")*" + + ")" + "\\]"); + boost::smatch what; + if(regex_search(content, what, content_e)) + { + // replace existing content: + content.replace(what.position(1), what.length(1), error_s); + } + else + { + // add new content: + std::string::size_type pos = content.find("[/error_content:]"); + if(pos != std::string::npos) + { + content.insert(pos + 17, "\n[template " + id + "[]\n" + error_s + "\n]\n"); + } + else + content.append("\n[/error_content:]\n[template " + id + "[]\n" + error_s + "\n]\n"); + } + // + // Add to all_errors if not already there: + // + if(content.find("[" + id + "]") == std::string::npos) + { + // Find all_errors template: + std::string::size_type pos = content.find("[template all_errors[]\n"); + if(pos != std::string::npos) + { + content.insert(pos + 23, "[" + id + "]\n"); + } + else + { + content.append("\n[template all_errors[]\n[").append(id).append("]\n]\n"); + } + } +} + +void remove_error_content(const std::string& error_id) +{ + // remove use template first: + std::string::size_type pos = content.find("[" + error_id + "]"); + if(pos != std::string::npos) + { + content.erase(pos, 2 + error_id.size()); + } + // then the template define itself: + boost::regex content_e("\\[template\\s+" + error_id + + "\\[\\]\\s+" + "(" + "[^\\]\\[]*" + "(?:" + "\\[" + "([^\\[\\]]*(?2)?)*" + "\\]" + "[^\\]\\[]*" + ")*" + ")" + "\\]"); + boost::smatch what; + if(regex_search(content, what, content_e)) + { + content.erase(what.position(), what.length()); + } +} + +template +void handle_test_result(const boost::math::tools::test_result& result, + const Seq& worst, int row, + const char* type_name, + const char* test_name, + const char* group_name) +{ + T eps = boost::math::tools::epsilon(); + T max_error_found = (result.max)() / eps; + T mean_error_found = result.rms() / eps; + + std::string cell_name = sanitize_string(BOOST_COMPILER) + "_" + sanitize_string(BOOST_PLATFORM) + "_" + sanitize_string(type_name) + + "_" + sanitize_string(test_name) + "_" + sanitize_string(TEST_LIBRARY_NAME) + "_" + sanitize_string(group_name); + + std::stringstream ss; + ss << std::setprecision(3); + if(std::string(TEST_LIBRARY_NAME) != "boost") + ss << "(['" << TEST_LIBRARY_NAME << ":] "; + else + ss << "[role blue "; + + if((result.max)() > std::sqrt(eps)) + ss << "[role red "; + + + ss << "Max = "; + if((boost::math::isfinite)(max_error_found)) + ss << max_error_found; + else + ss << "+INF"; + ss << "[epsilon] (Mean = "; + if((boost::math::isfinite)(mean_error_found)) + ss << mean_error_found; + else + ss << "+INF"; + ss << "[epsilon])"; + + // + // Now check for error output from gross errors or unexpected exceptions: + // + std::stringbuf* pbuf = dynamic_cast(std::cerr.rdbuf()); + bool have_errors = false; + std::string error_id = "errors_" + cell_name; + if(pbuf) + { + std::string err_s = pbuf->str(); + if(err_s.size()) + { + if(err_s.size() > 4096) + { + std::string::size_type pos = err_s.find("\n", 4096); + if(pos != std::string::npos) + { + err_s.erase(pos); + err_s += "\n*** FURTHER CONTENT HAS BEEN TRUNCATED FOR BREVITY ***\n"; + } + } + std::string::size_type pos = err_s.find("\n"); + while(pos != std::string::npos) + { + err_s.replace(pos, 1, "[br]"); + pos = err_s.find("\n"); + } + err_s = "[h4 Error Output For " + std::string(test_name) + std::string(" with compiler ") + std::string(BOOST_COMPILER) + + std::string(" and library ") + std::string(TEST_LIBRARY_NAME) + " and test data " + + std::string(group_name) + "]\n\n[#" + error_id + "]\n" + err_s + std::string("\n\n\n"); + ss << " [link " << error_id << " And other failures.]"; + pbuf->str(""); + set_error_content(error_id, err_s); + have_errors = true; + } + } + if(!have_errors) + remove_error_content(error_id); + + + if(std::string(TEST_LIBRARY_NAME) != "boost") + ss << ")"; + else + ss << "]"; + + if((result.max)() > std::sqrt(eps)) + ss << "]"; + + std::string cell_content = ss.str(); + + set_result(cell_name, cell_content, test_name, group_name, type_name); +} + +struct error_stream_replacer +{ + std::streambuf* old_buf; + std::stringstream ss; + error_stream_replacer() + { + old_buf = std::cerr.rdbuf(); + std::cerr.rdbuf(ss.rdbuf()); + } + ~error_stream_replacer() + { + std::cerr.rdbuf(old_buf); + } +}; + +#endif // BOOST_MATH_HANDLE_TEST_RESULT + diff --git a/src/boost/libs/math/reporting/accuracy/has_c99_cmath.cpp b/src/boost/libs/math/reporting/accuracy/has_c99_cmath.cpp new file mode 100644 index 00000000..87658592 --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/has_c99_cmath.cpp @@ -0,0 +1,17 @@ +// Copyright John Maddock 2015. +// 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 + +int main() +{ + long double d = 1; + + d = ::erf(d); + d = ::erfc(d); + d = ::tgamma(d); + d = ::lgamma(d); + return d != 0 ? 0 : 1; +} diff --git a/src/boost/libs/math/reporting/accuracy/has_cxx17_cmath.cpp b/src/boost/libs/math/reporting/accuracy/has_cxx17_cmath.cpp new file mode 100644 index 00000000..a73540b5 --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/has_cxx17_cmath.cpp @@ -0,0 +1,18 @@ +// Copyright John Maddock 2015. +// 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 + +int main() +{ + long double d = 1; + + d = std::erf(d); + d = std::erfc(d); + d = std::tgamma(d); + d = std::lgamma(d); + d = std::comp_ellint_1(d); + return d != 0 ? 0 : 1; +} diff --git a/src/boost/libs/math/reporting/accuracy/has_gsl.cpp b/src/boost/libs/math/reporting/accuracy/has_gsl.cpp new file mode 100644 index 00000000..f6679439 --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/has_gsl.cpp @@ -0,0 +1,12 @@ +// Copyright John Maddock 2015. +// 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 + +int main() +{ + double d = gsl_sf_bessel_Jn(2, 1.0); + return d != 0 ? 0 : 1; +} diff --git a/src/boost/libs/math/reporting/accuracy/has_libstdcxx_tr1.cpp b/src/boost/libs/math/reporting/accuracy/has_libstdcxx_tr1.cpp new file mode 100644 index 00000000..e2cb9448 --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/has_libstdcxx_tr1.cpp @@ -0,0 +1,17 @@ +// Copyright John Maddock 2015. +// 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 + +int main() +{ + long double d = 1; + + d = std::tr1::erf(d); + d = std::tr1::erfc(d); + d = std::tr1::tgamma(d); + d = std::tr1::lgamma(d); + return d != 0 ? 0 : 1; +} diff --git a/src/boost/libs/math/reporting/accuracy/has_rmath.cpp b/src/boost/libs/math/reporting/accuracy/has_rmath.cpp new file mode 100644 index 00000000..df6cb315 --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/has_rmath.cpp @@ -0,0 +1,13 @@ +// Copyright John Maddock 2015. +// 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) + +#define MATHLIB_STANDALONE +#include + +int main() +{ + double d = psigamma(2.0, 4); + return d != 0 ? 0 : 1; +} diff --git a/src/boost/libs/math/reporting/accuracy/html/index.html b/src/boost/libs/math/reporting/accuracy/html/index.html new file mode 100644 index 00000000..f859e717 --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/html/index.html @@ -0,0 +1,27805 @@ + + + +Special Function Error Rates Report + + + + + + + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+
+
+
+
+
+

+Special Function Error Rates Report

+
+

+ Distributed under 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) +

+
+
+
+
+
+

Table of Contents

+
+
beta
+
beta + (incomplete)
+
betac
+
binomial_coefficient
+
boost::math::powm1
+
cbrt
+
cos_pi
+
cyl_bessel_i
+
cyl_bessel_i + (integer orders)
+
cyl_bessel_i_prime
+
cyl_bessel_i_prime + (integer orders)
+
cyl_bessel_j
+
cyl_bessel_j + (integer orders)
+
cyl_bessel_j_prime
+
cyl_bessel_j_prime + (integer orders)
+
cyl_bessel_k
+
cyl_bessel_k + (integer orders)
+
cyl_bessel_k_prime
+
cyl_bessel_k_prime + (integer orders)
+
cyl_neumann
+
cyl_neumann + (integer orders)
+
cyl_neumann_prime
+
cyl_neumann_prime + (integer orders)
+
digamma
+
ellint_1
+
ellint_1 + (complete)
+
ellint_2
+
ellint_2 + (complete)
+
ellint_3
+
ellint_3 + (complete)
+
ellint_d
+
ellint_d + (complete)
+
ellint_rc
+
ellint_rd
+
ellint_rf
+
ellint_rg
+
ellint_rj
+
erf
+
erf_inv
+
erfc
+
erfc_inv
+
expint + (Ei)
+
expint + (En)
+
expm1
+
gamma_p
+
gamma_p_inv
+
gamma_p_inva
+
gamma_q
+
gamma_q_inv
+
gamma_q_inva
+
hermite
+
heuman_lambda
+
ibeta
+
ibeta_inv
+
ibeta_inva
+
ibeta_invb
+
ibetac
+
ibetac_inv
+
ibetac_inva
+
ibetac_invb
+
jacobi_cn
+
jacobi_dn
+
jacobi_sn
+
jacobi_zeta
+
laguerre(n, + m, x)
+
laguerre(n, + x)
+
legendre_p
+
legendre_p + (associated)
+
legendre_q
+
lgamma
+
log1p
+
non + central beta CDF
+
non + central beta CDF complement
+
non + central chi squared CDF
+
non + central chi squared CDF complement
+
non + central t CDF
+
non + central t CDF complement
+
owens_t
+
polygamma
+
powm1
+
sin_pi
+
sph_bessel
+
sph_bessel_prime
+
sph_neumann
+
sph_neumann_prime
+
spherical_harmonic_i
+
spherical_harmonic_r
+
sqrt1pm1
+
tgamma
+
tgamma1pm1
+
tgamma_delta_ratio
+
tgamma + (incomplete)
+
tgamma_lower
+
tgamma_ratio
+
trigamma
+
zeta
+
Error Logs
+
Tables
+
+
+
+

+beta +

+
+

Table 1. Error rates for beta

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Beta Function: Small Values +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = +INFε (Mean = +INFε) And + other failures.)
(Rmath 3.2.3: + Max = 1.14ε (Mean = 0.574ε)) +

+
+

+ Max = 2.86ε (Mean = 1.22ε)

+ (<cmath>: Max = 364ε (Mean = 76.2ε)) +

+
+

+ Max = 2.86ε (Mean = 1.22ε) +

+
+

+ Max = 2.23ε (Mean = 1.14ε) +

+
+

+ Beta Function: Medium Values +

+
+

+ Max = 0.978ε (Mean = 0.0595ε)

+ (GSL 2.1: Max = 1.18e+03ε (Mean = 238ε))
+ (Rmath 3.2.3: Max = 1.09e+03ε (Mean = 265ε)) +

+
+

+ Max = 61.4ε (Mean = 19.4ε)

+ (<cmath>: Max = 1.07e+03ε (Mean = 264ε)) +

+
+

+ Max = 107ε (Mean = 24.5ε) +

+
+

+ Max = 96.5ε (Mean = 22.4ε) +

+
+

+ Beta Function: Divergent Values +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 12.1ε (Mean = 1.99ε))
(Rmath 3.2.3: + Max = 176ε (Mean = 28ε)) +

+
+

+ Max = 8.99ε (Mean = 2.44ε)

+ (<cmath>: Max = 128ε (Mean = 23.8ε)) +

+
+

+ Max = 18.8ε (Mean = 2.71ε) +

+
+

+ Max = 11.4ε (Mean = 2.19ε) +

+
+
+
+
+
+ +
+

Table 2. Error rates for beta (incomplete)

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Incomplete Beta Function: Small Values +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 11.1ε (Mean = 2.32ε) +

+
+

+ Max = 18.7ε (Mean = 3.19ε) +

+
+

+ Max = 9.94ε (Mean = 2.17ε) +

+
+

+ Incomplete Beta Function: Medium Values +

+
+

+ Max = 0.568ε (Mean = 0.0254ε) +

+
+

+ Max = 69.2ε (Mean = 13.4ε) +

+
+

+ Max = 174ε (Mean = 25ε) +

+
+

+ Max = 90ε (Mean = 12.7ε) +

+
+

+ Incomplete Beta Function: Large and Diverse Values +

+
+

+ Max = 0.999ε (Mean = 0.0325ε) +

+
+

+ Max = 6.84e+04ε (Mean = 2.76e+03ε) +

+
+

+ Max = 6.86e+04ε (Mean = 2.79e+03ε) +

+
+

+ Max = 633ε (Mean = 29.7ε) +

+
+

+ Incomplete Beta Function: Small Integer Values +

+
+

+ Max = 0.786ε (Mean = 0.0323ε) +

+
+

+ Max = 11.6ε (Mean = 3.6ε) +

+
+

+ Max = 51.8ε (Mean = 11ε) +

+
+

+ Max = 26ε (Mean = 6.28ε) +

+
+
+
+
+
+

+betac +

+
+

Table 3. Error rates for betac

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Incomplete Beta Function: Small Values +

+
+

+ Max = 0.676ε (Mean = 0.0302ε) +

+
+

+ Max = 9.92ε (Mean = 2.3ε) +

+
+

+ Max = 11.2ε (Mean = 2.94ε) +

+
+

+ Max = 8.94ε (Mean = 2.06ε) +

+
+

+ Incomplete Beta Function: Medium Values +

+
+

+ Max = 0.949ε (Mean = 0.098ε) +

+
+

+ Max = 63.5ε (Mean = 13.5ε) +

+
+

+ Max = 97.6ε (Mean = 24.3ε) +

+
+

+ Max = 90.6ε (Mean = 14.8ε) +

+
+

+ Incomplete Beta Function: Large and Diverse Values +

+
+

+ Max = 1.12ε (Mean = 0.0458ε) +

+
+

+ Max = 1.05e+05ε (Mean = 5.45e+03ε) +

+
+

+ Max = 1.04e+05ε (Mean = 5.46e+03ε) +

+
+

+ Max = 3.72e+03ε (Mean = 113ε) +

+
+

+ Incomplete Beta Function: Small Integer Values +

+
+

+ Max = 0.586ε (Mean = 0.0314ε) +

+
+

+ Max = 11.1ε (Mean = 3.65ε) +

+
+

+ Max = 103ε (Mean = 17.4ε) +

+
+

+ Max = 26.2ε (Mean = 6.36ε) +

+
+
+
+
+
+ +
+

Table 4. Error rates for binomial_coefficient

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Binomials: small arguments +

+
+

+ Max = 1ε (Mean = 0.369ε) +

+
+

+ Max = 1.5ε (Mean = 0.339ε) +

+
+

+ Max = 1.5ε (Mean = 0.339ε) +

+
+

+ Max = 1ε (Mean = 0.369ε) +

+
+

+ Binomials: large arguments +

+
+

+ Max = 0.939ε (Mean = 0.314ε) +

+
+

+ Max = 26.6ε (Mean = 6.13ε) +

+
+

+ Max = 53.2ε (Mean = 10.8ε) +

+
+

+ Max = 37.2ε (Mean = 7.4ε) +

+
+
+
+
+
+ +
+

Table 5. Error rates for boost::math::powm1

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ GNU C++ version 7.1.0
linux
double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ powm1 +

+
+

+ (<math.h>: Max = 2.04ε (Mean = 0.493ε))
+
Max = 2.04ε (Mean = 0.493ε)
+
(<cmath>: Max = 2.04ε (Mean = 0.493ε)) +

+
+

+ (Rmath 3.2.3: Max = 1.06ε (Mean = 0.425ε))
+
(GSL 2.1: Max = 1.06ε (Mean = 0.425ε))
+
Max = 1.06ε (Mean = 0.425ε) +

+
+

+ Max = 1.88ε (Mean = 0.49ε)

+ (<math.h>: Max = 1.88ε (Mean = 0.49ε)) +

+
+

+ (<math.h>: Max = 1.84ε (Mean = 0.486ε))
+
Max = 1.84ε (Mean = 0.486ε) +

+
+
+
+
+
+

+cbrt +

+
+

Table 6. Error rates for cbrt

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ cbrt Function +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 1.34ε (Mean = 0.471ε)

+ (<cmath>: Max = 1.34ε (Mean = 0.471ε))
+ (<math.h>: Max = 1.34ε (Mean = 0.471ε)) +

+
+

+ Max = 1.34ε (Mean = 0.471ε)

+ (<math.h>: Max = 1.34ε (Mean = 0.471ε)) +

+
+

+ Max = 1.7ε (Mean = 0.565ε)

+ (<math.h>: Max = 1.7ε (Mean = 0.565ε)) +

+
+
+
+
+
+

+cos_pi +

+
+

Table 7. Error rates for cos_pi

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ sin_pi and cos_pi +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 0.991ε (Mean = 0.302ε) +

+
+

+ Max = 0.991ε (Mean = 0.302ε) +

+
+

+ Max = 0.996ε (Mean = 0.284ε) +

+
+

+ sin_pi and cos_pi near integers and half integers +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 0.976ε (Mean = 0.28ε) +

+
+

+ Max = 0.976ε (Mean = 0.28ε) +

+
+

+ Max = 0.996ε (Mean = 0.298ε) +

+
+
+
+
+
+ +
+

Table 8. Error rates for cyl_bessel_i

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Bessel I0: Mathworld Data +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 270ε (Mean = 91.6ε) And + other failures.)
(Rmath 3.2.3: + Max = 1.52ε (Mean = 0.622ε) And + other failures.) +

+
+

+ Max = 1.95ε (Mean = 0.738ε)

+ (<cmath>: Max = 8.49ε (Mean = 3.46ε) And + other failures.) +

+
+

+ Max = 1.95ε (Mean = 0.661ε) +

+
+

+ Max = 0.762ε (Mean = 0.329ε) +

+
+

+ Bessel I1: Mathworld Data +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 128ε (Mean = 41ε) And + other failures.)
(Rmath 3.2.3: + Max = 1.53ε (Mean = 0.483ε) And + other failures.) +

+
+

+ Max = 0.64ε (Mean = 0.202ε)

+ (<cmath>: Max = 5ε (Mean = 2.15ε) And + other failures.) +

+
+

+ Max = 0.64ε (Mean = 0.202ε) +

+
+

+ Max = 0.767ε (Mean = 0.398ε) +

+
+

+ Bessel In: Mathworld Data +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 2.31ε (Mean = 0.838ε) And + other failures.)
(Rmath 3.2.3: + Max = 1.73ε (Mean = 0.601ε) And + other failures.) +

+
+

+ Max = 1.8ε (Mean = 1.33ε)

+ (<cmath>: Max = 430ε (Mean = 163ε) And + other failures.) +

+
+

+ Max = 463ε (Mean = 140ε) +

+
+

+ Max = 3.46ε (Mean = 1.32ε) +

+
+

+ Bessel Iv: Mathworld Data +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 5.95ε (Mean = 2.08ε) And + other failures.)
(Rmath 3.2.3: + Max = 3.53ε (Mean = 1.39ε)) +

+
+

+ Max = 4.12ε (Mean = 1.85ε)

+ (<cmath>: Max = 616ε (Mean = 221ε) And + other failures.) +

+
+

+ Max = 4.12ε (Mean = 1.95ε) +

+
+

+ Max = 2.97ε (Mean = 1.24ε) +

+
+

+ Bessel In: Random Data +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 261ε (Mean = 53.2ε) And + other failures.)
(Rmath 3.2.3: + Max = 7.37ε (Mean = 2.4ε)) +

+
+

+ Max = 4.62ε (Mean = 1.06ε)

+ (<cmath>: Max = 645ε (Mean = 132ε)) +

+
+

+ Max = 176ε (Mean = 39.1ε) +

+
+

+ Max = 9.67ε (Mean = 1.88ε) +

+
+

+ Bessel Iv: Random Data +

+
+

+ Max = 0.661ε (Mean = 0.0441ε)

+ (GSL 2.1: Max = 6.18e+03ε (Mean = 1.55e+03ε) And + other failures.)
(Rmath 3.2.3: + Max = 4.28e+08ε (Mean = 2.85e+07ε)) +

+
+

+ Max = 8.35ε (Mean = 1.62ε)

+ (<cmath>: Max = 1.05e+03ε (Mean = 224ε) + And + other failures.) +

+
+

+ Max = 283ε (Mean = 88.4ε) +

+
+

+ Max = 7.46ε (Mean = 1.71ε) +

+
+

+ Bessel Iv: Mathworld Data (large values) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 37ε (Mean = 18ε) And + other failures.)
(Rmath 3.2.3: + Max = 3.77e+168ε (Mean = 2.39e+168ε) And + other failures.) +

+
+

+ Max = 14.7ε (Mean = 6.66ε)

+ (<cmath>: Max = 118ε (Mean = 57.2ε) And + other failures.) +

+
+

+ Max = 14.7ε (Mean = 6.59ε) +

+
+

+ Max = 3.67ε (Mean = 1.64ε) +

+
+
+
+
+
+ +
+

Table 9. Error rates for cyl_bessel_i (integer orders)

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Bessel I0: Mathworld Data (Integer Version) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 0.79ε (Mean = 0.482ε))
(Rmath + 3.2.3: Max = 1.52ε (Mean = 0.622ε) And + other failures.) +

+
+

+ Max = 1.95ε (Mean = 0.738ε)

+ (<cmath>: Max = 8.49ε (Mean = 3.46ε) And + other failures.) +

+
+

+ Max = 1.95ε (Mean = 0.661ε) +

+
+

+ Max = 0.762ε (Mean = 0.329ε) +

+
+

+ Bessel I1: Mathworld Data (Integer Version) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 0.82ε (Mean = 0.456ε))
(Rmath + 3.2.3: Max = 1.53ε (Mean = 0.483ε) And + other failures.) +

+
+

+ Max = 0.64ε (Mean = 0.202ε)

+ (<cmath>: Max = 5ε (Mean = 2.15ε) And + other failures.) +

+
+

+ Max = 0.64ε (Mean = 0.202ε) +

+
+

+ Max = 0.767ε (Mean = 0.398ε) +

+
+

+ Bessel In: Mathworld Data (Integer Version) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 5.15ε (Mean = 2.13ε) And + other failures.)
(Rmath 3.2.3: + Max = 1.73ε (Mean = 0.601ε) And + other failures.) +

+
+

+ Max = 1.8ε (Mean = 1.33ε)

+ (<cmath>: Max = 430ε (Mean = 163ε) And + other failures.) +

+
+

+ Max = 463ε (Mean = 140ε) +

+
+

+ Max = 3.46ε (Mean = 1.32ε) +

+
+
+
+
+
+ +
+

Table 10. Error rates for cyl_bessel_i_prime

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Bessel I'0: Mathworld Data +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 0.82ε (Mean = 0.259ε) +

+
+

+ Max = 0.82ε (Mean = 0.259ε) +

+
+

+ Max = 0.82ε (Mean = 0.354ε) +

+
+

+ Bessel I'1: Mathworld Data +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 1.97ε (Mean = 0.757ε) +

+
+

+ Max = 1.97ε (Mean = 0.757ε) +

+
+

+ Max = 1.36ε (Mean = 0.782ε) +

+
+

+ Bessel I'n: Mathworld Data +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 2.31ε (Mean = 1.41ε) +

+
+

+ Max = 701ε (Mean = 212ε) +

+
+

+ Max = 3.61ε (Mean = 1.22ε) +

+
+

+ Bessel I'v: Mathworld Data +

+
+

+ Max = 1.62ε (Mean = 0.512ε) +

+
+

+ Max = 2.89e+03ε (Mean = 914ε) +

+
+

+ Max = 2.89e+03ε (Mean = 914ε) +

+
+

+ Max = 3.76e+03ε (Mean = 1.19e+03ε) +

+
+

+ Bessel I'n: Random Data +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 3.95ε (Mean = 1.06ε) +

+
+

+ Max = 195ε (Mean = 37.1ε) +

+
+

+ Max = 9.85ε (Mean = 1.82ε) +

+
+

+ Bessel I'v: Random Data +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 14.1ε (Mean = 2.93ε) +

+
+

+ Max = 336ε (Mean = 68.5ε) +

+
+

+ Max = 14ε (Mean = 2.5ε) +

+
+

+ Bessel I'v: Mathworld Data (large values) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 42.6ε (Mean = 20.2ε) +

+
+

+ Max = 42.6ε (Mean = 20.2ε) +

+
+

+ Max = 59.5ε (Mean = 26.6ε) +

+
+
+
+
+
+ +
+

Table 11. Error rates for cyl_bessel_i_prime (integer orders)

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Bessel I'0: Mathworld Data (Integer Version) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 0.82ε (Mean = 0.259ε) +

+
+

+ Max = 0.82ε (Mean = 0.259ε) +

+
+

+ Max = 0.82ε (Mean = 0.354ε) +

+
+

+ Bessel I'1: Mathworld Data (Integer Version) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 1.97ε (Mean = 0.757ε) +

+
+

+ Max = 1.97ε (Mean = 0.757ε) +

+
+

+ Max = 1.36ε (Mean = 0.782ε) +

+
+

+ Bessel I'n: Mathworld Data (Integer Version) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 2.31ε (Mean = 1.41ε) +

+
+

+ Max = 701ε (Mean = 212ε) +

+
+

+ Max = 3.61ε (Mean = 1.22ε) +

+
+
+
+
+
+ +
+

Table 12. Error rates for cyl_bessel_j

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ GNU C++ version 7.1.0
linux
double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Bessel J0: Mathworld Data +

+
+

+ Max = 6.55ε (Mean = 2.86ε)

+ (<cmath>: Max = 5.04ε (Mean = 1.78ε) And + other failures.) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 0.629ε (Mean = 0.223ε) And + other failures.)
(Rmath 3.2.3: + Max = 0.629ε (Mean = 0.223ε) And + other failures.) +

+
+

+ Max = 6.55ε (Mean = 2.86ε) +

+
+

+ Max = 2.52ε (Mean = 1.2ε) +

+
+

+ Bessel J0: Mathworld Data (Tricky cases) +

+
+

+ Max = 1.64e+08ε (Mean = 6.69e+07ε)
+
(<cmath>: Max = 4.79e+08ε (Mean = + 1.96e+08ε)) +

+
+

+ Max = 8e+04ε (Mean = 3.27e+04ε)
+
(GSL 2.1: Max = 6.5e+07ε (Mean = 2.66e+07ε))
+ (Rmath 3.2.3: Max = 1.04e+07ε (Mean = 4.29e+06ε)) +

+
+

+ Max = 1.64e+08ε (Mean = 6.69e+07ε) +

+
+

+ Max = 1e+07ε (Mean = 4.09e+06ε) +

+
+

+ Bessel J1: Mathworld Data +

+
+

+ Max = 3.59ε (Mean = 1.33ε)

+ (<cmath>: Max = 6.1ε (Mean = 2.95ε) And + other failures.) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 6.62ε (Mean = 2.35ε) And + other failures.)
(Rmath 3.2.3: + Max = 0.946ε (Mean = 0.39ε) And + other failures.) +

+
+

+ Max = 1.44ε (Mean = 0.637ε) +

+
+

+ Max = 1.73ε (Mean = 0.976ε) +

+
+

+ Bessel J1: Mathworld Data (tricky cases) +

+
+

+ Max = 2.18e+05ε (Mean = 9.76e+04ε)
+
(<cmath>: Max = 2.15e+06ε (Mean = + 1.58e+06ε)) +

+
+

+ Max = 106ε (Mean = 47.5ε)

+ (GSL 2.1: Max = 8.75e+05ε (Mean = 5.32e+05ε))
+ (Rmath 3.2.3: Max = 2.93e+06ε (Mean = 1.7e+06ε)) +

+
+

+ Max = 2.18e+05ε (Mean = 9.76e+04ε) +

+
+

+ Max = 3.23e+04ε (Mean = 1.45e+04ε) +

+
+

+ Bessel JN: Mathworld Data +

+
+

+ Max = 6.85ε (Mean = 3.35ε)

+ (<cmath>: Max = 2.13e+19ε (Mean + = 5.16e+18ε) And + other failures.) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 6.9e+05ε (Mean = 2.15e+05ε) And + other failures.)
(Rmath 3.2.3: + Max = +INFε (Mean = +INFε) And + other failures.) +

+
+

+ Max = 463ε (Mean = 112ε) +

+
+

+ Max = 14.7ε (Mean = 5.4ε) +

+
+

+ Bessel J: Mathworld Data +

+
+

+ Max = 14.7ε (Mean = 4.11ε)

+ (<cmath>: Max = 3.49e+05ε (Mean = 8.09e+04ε) + And + other failures.) +

+
+

+ Max = 10ε (Mean = 2.24ε)

(GSL + 2.1: Max = 2.39e+05ε (Mean = 5.37e+04ε) And + other failures.)
(Rmath 3.2.3: + Max = +INFε (Mean = +INFε) And + other failures.) +

+
+

+ Max = 14.7ε (Mean = 4.22ε) +

+
+

+ Max = 14.9ε (Mean = 3.89ε) +

+
+

+ Bessel J: Mathworld Data (large values) +

+
+

+ Max = 607ε (Mean = 305ε)

(<cmath>: + Max = 34.9ε (Mean = 17.4ε) And + other failures.) +

+
+

+ Max = 0.536ε (Mean = 0.268ε)

+ (GSL 2.1: Max = 4.91e+03ε (Mean = 2.46e+03ε) And + other failures.)
(Rmath 3.2.3: + Max = 5.9ε (Mean = 3.76ε)) +

+
+

+ Max = 607ε (Mean = 305ε) +

+
+

+ Max = 9.31ε (Mean = 5.52ε) +

+
+

+ Bessel JN: Random Data +

+
+

+ Max = 50.8ε (Mean = 3.69ε)

+ (<cmath>: Max = 1.12e+03ε (Mean = 88.7ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 75.7ε (Mean = 5.36ε))
(Rmath 3.2.3: + Max = 3.93ε (Mean = 1.22ε)) +

+
+

+ Max = 99.6ε (Mean = 22ε) +

+
+

+ Max = 17.5ε (Mean = 1.46ε) +

+
+

+ Bessel J: Random Data +

+
+

+ Max = 11.4ε (Mean = 1.68ε)

+ (<cmath>: Max = 501ε (Mean = 52.3ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 15.5ε (Mean = 3.33ε) And + other failures.)
(Rmath 3.2.3: + Max = 6.74ε (Mean = 1.3ε)) +

+
+

+ Max = 260ε (Mean = 34ε) +

+
+

+ Max = 9.24ε (Mean = 1.17ε) +

+
+

+ Bessel J: Random Data (Tricky large values) +

+
+

+ Max = 785ε (Mean = 94.2ε)

+ (<cmath>: Max = 5.01e+17ε (Mean + = 6.23e+16ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 2.48e+05ε (Mean = 5.11e+04ε))
(Rmath + 3.2.3: Max = 71.6ε (Mean = 11.7ε)) +

+
+

+ Max = 785ε (Mean = 97.4ε) +

+
+

+ Max = 59.2ε (Mean = 8.67ε) +

+
+
+
+
+
+ +
+

Table 13. Error rates for cyl_bessel_j (integer orders)

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ GNU C++ version 7.1.0
linux
double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Bessel J0: Mathworld Data (Integer Version) +

+
+

+ Max = 6.55ε (Mean = 2.86ε)

+ (<cmath>: Max = 5.04ε (Mean = 1.78ε) And + other failures.) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 1.12ε (Mean = 0.488ε))
(Rmath + 3.2.3: Max = 0.629ε (Mean = 0.223ε) And + other failures.) +

+
+

+ Max = 6.55ε (Mean = 2.86ε) +

+
+

+ Max = 2.52ε (Mean = 1.2ε)

+ (<math.h>: Max = 1.89ε (Mean = 0.988ε)) +

+
+

+ Bessel J0: Mathworld Data (Tricky cases) (Integer Version) +

+
+

+ Max = 1.64e+08ε (Mean = 6.69e+07ε)
+
(<cmath>: Max = 4.79e+08ε (Mean = + 1.96e+08ε)) +

+
+

+ Max = 8e+04ε (Mean = 3.27e+04ε)
+
(GSL 2.1: Max = 1e+07ε (Mean = 4.11e+06ε))
+ (Rmath 3.2.3: Max = 1.04e+07ε (Mean = 4.29e+06ε)) +

+
+

+ Max = 1.64e+08ε (Mean = 6.69e+07ε) +

+
+

+ Max = 1e+07ε (Mean = 4.09e+06ε)
+
(<math.h>: Max + = 2.54e+08ε (Mean = 1.04e+08ε)) +

+
+

+ Bessel J1: Mathworld Data (Integer Version) +

+
+

+ Max = 3.59ε (Mean = 1.33ε)

+ (<cmath>: Max = 6.1ε (Mean = 2.95ε) And + other failures.) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 1.89ε (Mean = 0.721ε))
(Rmath + 3.2.3: Max = 0.946ε (Mean = 0.39ε) And + other failures.) +

+
+

+ Max = 1.44ε (Mean = 0.637ε) +

+
+

+ Max = 1.73ε (Mean = 0.976ε)

+ (<math.h>: Max = 11.4ε (Mean = 4.15ε)) +

+
+

+ Bessel J1: Mathworld Data (tricky cases) (Integer Version) +

+
+

+ Max = 2.18e+05ε (Mean = 9.76e+04ε)
+
(<cmath>: Max = 2.15e+06ε (Mean = + 1.58e+06ε)) +

+
+

+ Max = 106ε (Mean = 47.5ε)

+ (GSL 2.1: Max = 1.26e+06ε (Mean = 6.28e+05ε))
+ (Rmath 3.2.3: Max = 2.93e+06ε (Mean = 1.7e+06ε)) +

+
+

+ Max = 2.18e+05ε (Mean = 9.76e+04ε) +

+
+

+ Max = 3.23e+04ε (Mean = 1.45e+04ε)
+
(<math.h>: Max = 1.44e+07ε (Mean + = 6.5e+06ε)) +

+
+

+ Bessel JN: Mathworld Data (Integer Version) +

+
+

+ Max = 6.85ε (Mean = 3.35ε)

+ (<cmath>: Max = 2.13e+19ε (Mean + = 5.16e+18ε) And + other failures.) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 6.9e+05ε (Mean = 2.53e+05ε) And + other failures.)
(Rmath 3.2.3: + Max = +INFε (Mean = +INFε) And + other failures.) +

+
+

+ Max = 463ε (Mean = 112ε) +

+
+

+ Max = 14.7ε (Mean = 5.4ε)

+ (<math.h>: Max = +INFε (Mean + = +INFε) And + other failures.) +

+
+
+
+
+
+ +
+

Table 14. Error rates for cyl_bessel_j_prime

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Bessel J0': Mathworld Data +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 18.9ε (Mean = 6.82ε) +

+
+

+ Max = 18.9ε (Mean = 6.72ε) +

+
+

+ Max = 6.62ε (Mean = 2.55ε) +

+
+

+ Bessel J0': Mathworld Data (Tricky cases) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 7.44ε (Mean = 3.34ε) +

+
+

+ Max = 7.44ε (Mean = 3.31ε) +

+
+

+ Max = 3.67ε (Mean = 1.74ε) +

+
+

+ Bessel J1': Mathworld Data +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 7.9ε (Mean = 3.37ε) +

+
+

+ Max = 7.9ε (Mean = 3.37ε) +

+
+

+ Max = 0.999ε (Mean = 0.627ε) +

+
+

+ Bessel J1': Mathworld Data (tricky cases) +

+
+

+ Max = 287ε (Mean = 129ε) +

+
+

+ Max = 5.88e+05ε (Mean = 2.63e+05ε) +

+
+

+ Max = 5.88e+05ε (Mean = 2.63e+05ε) +

+
+

+ Max = 288ε (Mean = 129ε) +

+
+

+ Bessel JN': Mathworld Data +

+
+

+ Max = 0.527ε (Mean = 0.128ε) +

+
+

+ Max = 1.29e+03ε (Mean = 312ε) +

+
+

+ Max = 1.29e+03ε (Mean = 355ε) +

+
+

+ Max = 14ε (Mean = 6.13ε) +

+
+

+ Bessel J': Mathworld Data +

+
+

+ Max = 21.5ε (Mean = 4.7ε) +

+
+

+ Max = 42.5ε (Mean = 9.31ε) +

+
+

+ Max = 42.5ε (Mean = 9.32ε) +

+
+

+ Max = 23.7ε (Mean = 8ε) +

+
+

+ Bessel J': Mathworld Data (large values) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 989ε (Mean = 495ε) +

+
+

+ Max = 989ε (Mean = 495ε) +

+
+

+ Max = 2.9ε (Mean = 1.61ε) +

+
+

+ Bessel JN': Random Data +

+
+

+ Max = 0.593ε (Mean = 0.0396ε) +

+
+

+ Max = 11.3ε (Mean = 1.85ε) +

+
+

+ Max = 79.4ε (Mean = 16.2ε) +

+
+

+ Max = 6.34ε (Mean = 0.999ε) +

+
+

+ Bessel J': Random Data +

+
+

+ Max = 0.885ε (Mean = 0.033ε) +

+
+

+ Max = 139ε (Mean = 6.47ε) +

+
+

+ Max = 279ε (Mean = 27.2ε) +

+
+

+ Max = 176ε (Mean = 9.75ε) +

+
+

+ Bessel J': Random Data (Tricky large values) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 474ε (Mean = 62.2ε) +

+
+

+ Max = 474ε (Mean = 64.5ε) +

+
+

+ Max = 379ε (Mean = 45.4ε) +

+
+
+
+
+
+ +
+

Table 15. Error rates for cyl_bessel_j_prime (integer orders)

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Bessel J0': Mathworld Data (Integer Version) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 18.9ε (Mean = 6.82ε) +

+
+

+ Max = 18.9ε (Mean = 6.72ε) +

+
+

+ Max = 6.62ε (Mean = 2.55ε) +

+
+

+ Bessel J0': Mathworld Data (Tricky cases) (Integer Version) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 7.44ε (Mean = 3.34ε) +

+
+

+ Max = 7.44ε (Mean = 3.31ε) +

+
+

+ Max = 3.67ε (Mean = 1.74ε) +

+
+

+ Bessel J1': Mathworld Data (Integer Version) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 7.9ε (Mean = 3.37ε) +

+
+

+ Max = 7.9ε (Mean = 3.37ε) +

+
+

+ Max = 0.999ε (Mean = 0.627ε) +

+
+

+ Bessel J1': Mathworld Data (tricky cases) (Integer Version) +

+
+

+ Max = 287ε (Mean = 129ε) +

+
+

+ Max = 5.88e+05ε (Mean = 2.63e+05ε) +

+
+

+ Max = 5.88e+05ε (Mean = 2.63e+05ε) +

+
+

+ Max = 288ε (Mean = 129ε) +

+
+

+ Bessel JN': Mathworld Data (Integer Version) +

+
+

+ Max = 0.527ε (Mean = 0.128ε) +

+
+

+ Max = 1.29e+03ε (Mean = 312ε) +

+
+

+ Max = 1.29e+03ε (Mean = 355ε) +

+
+

+ Max = 14ε (Mean = 6.13ε) +

+
+
+
+
+
+ +
+

Table 16. Error rates for cyl_bessel_k

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ GNU C++ version 7.1.0
linux
double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Bessel K0: Mathworld Data +

+
+

+ Max = 0.833ε (Mean = 0.436ε)

+ (<cmath>: Max = 9.33ε (Mean = 3.25ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 6.04ε (Mean = 2.16ε))
(Rmath 3.2.3: + Max = 0.833ε (Mean = 0.601ε)) +

+
+

+ Max = 0.833ε (Mean = 0.436ε) +

+
+

+ Max = 0.833ε (Mean = 0.552ε) +

+
+

+ Bessel K1: Mathworld Data +

+
+

+ Max = 0.786ε (Mean = 0.329ε)

+ (<cmath>: Max = 8.94ε (Mean = 3.19ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 6.26ε (Mean = 2.21ε))
(Rmath 3.2.3: + Max = 0.894ε (Mean = 0.516ε)) +

+
+

+ Max = 0.786ε (Mean = 0.329ε) +

+
+

+ Max = 0.786ε (Mean = 0.39ε) +

+
+

+ Bessel Kn: Mathworld Data +

+
+

+ Max = 2.6ε (Mean = 1.21ε)

+ (<cmath>: Max = 12.9ε (Mean = 4.91ε) And + other failures.) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 3.36ε (Mean = 1.43ε) And + other failures.)
(Rmath 3.2.3: + Max = 8.48ε (Mean = 2.98ε)) +

+
+

+ Max = 2.6ε (Mean = 1.21ε) +

+
+

+ Max = 3.63ε (Mean = 1.46ε) +

+
+

+ Bessel Kv: Mathworld Data +

+
+

+ Max = 3.58ε (Mean = 2.39ε)

+ (<cmath>: Max = 13ε (Mean = 4.81ε) And + other failures.) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 5.47ε (Mean = 2.04ε) And + other failures.)
(Rmath 3.2.3: + Max = 3.15ε (Mean = 1.35ε)) +

+
+

+ Max = 5.21ε (Mean = 2.53ε) +

+
+

+ Max = 4.78ε (Mean = 2.19ε) +

+
+

+ Bessel Kv: Mathworld Data (large values) +

+
+

+ Max = 42.3ε (Mean = 21ε)

(<cmath>: + Max = 42.3ε (Mean = 19.8ε) And + other failures.) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 308ε (Mean = 142ε) And + other failures.)
(Rmath 3.2.3: + Max = 84.6ε (Mean = 37.8ε)) +

+
+

+ Max = 42.3ε (Mean = 21ε) +

+
+

+ Max = 59.8ε (Mean = 26.9ε) +

+
+

+ Bessel Kn: Random Data +

+
+

+ Max = 4.55ε (Mean = 1.12ε)

+ (<cmath>: Max = 13.9ε (Mean = 2.91ε)) +

+
+

+ Max = 0.764ε (Mean = 0.0348ε)

+ (GSL 2.1: Max = 8.71ε (Mean = 1.76ε) And + other failures.)
(Rmath 3.2.3: + Max = 7.47ε (Mean = 1.34ε)) +

+
+

+ Max = 4.55ε (Mean = 1.12ε) +

+
+

+ Max = 9.34ε (Mean = 1.7ε) +

+
+

+ Bessel Kv: Random Data +

+
+

+ Max = 7.88ε (Mean = 1.48ε)

+ (<cmath>: Max = 13.6ε (Mean = 2.68ε) And + other failures.) +

+
+

+ Max = 0.507ε (Mean = 0.0313ε)

+ (GSL 2.1: Max = 9.71ε (Mean = 1.47ε) And + other failures.)
(Rmath 3.2.3: + Max = 7.37ε (Mean = 1.49ε)) +

+
+

+ Max = 7.88ε (Mean = 1.47ε) +

+
+

+ Max = 8.33ε (Mean = 1.62ε) +

+
+
+
+
+
+ +
+

Table 17. Error rates for cyl_bessel_k (integer orders)

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ GNU C++ version 7.1.0
linux
double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Bessel K0: Mathworld Data (Integer Version) +

+
+

+ Max = 0.833ε (Mean = 0.436ε)

+ (<cmath>: Max = 9.33ε (Mean = 3.25ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 1.2ε (Mean = 0.733ε))
(Rmath 3.2.3: + Max = 0.833ε (Mean = 0.601ε)) +

+
+

+ Max = 0.833ε (Mean = 0.436ε) +

+
+

+ Max = 0.833ε (Mean = 0.552ε) +

+
+

+ Bessel K1: Mathworld Data (Integer Version) +

+
+

+ Max = 0.786ε (Mean = 0.329ε)

+ (<cmath>: Max = 8.94ε (Mean = 3.19ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 0.626ε (Mean = 0.333ε))
(Rmath + 3.2.3: Max = 0.894ε (Mean = 0.516ε)) +

+
+

+ Max = 0.786ε (Mean = 0.329ε) +

+
+

+ Max = 0.786ε (Mean = 0.39ε) +

+
+

+ Bessel Kn: Mathworld Data (Integer Version) +

+
+

+ Max = 2.6ε (Mean = 1.21ε)

+ (<cmath>: Max = 12.9ε (Mean = 4.91ε) And + other failures.) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 168ε (Mean = 59.5ε))
(Rmath 3.2.3: + Max = 8.48ε (Mean = 2.98ε)) +

+
+

+ Max = 2.6ε (Mean = 1.21ε) +

+
+

+ Max = 3.63ε (Mean = 1.46ε) +

+
+
+
+
+
+ +
+

Table 18. Error rates for cyl_bessel_k_prime

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Bessel K'0: Mathworld Data +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 0.786ε (Mean = 0.329ε) +

+
+

+ Max = 0.786ε (Mean = 0.329ε) +

+
+

+ Max = 0.786ε (Mean = 0.39ε) +

+
+

+ Bessel K'1: Mathworld Data +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 0.736ε (Mean = 0.389ε) +

+
+

+ Max = 0.736ε (Mean = 0.389ε) +

+
+

+ Max = 0.761ε (Mean = 0.444ε) +

+
+

+ Bessel K'n: Mathworld Data +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 2.16ε (Mean = 1.08ε) +

+
+

+ Max = 2.16ε (Mean = 1.08ε) +

+
+

+ Max = 4.17ε (Mean = 1.75ε) +

+
+

+ Bessel K'v: Mathworld Data +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 3.94ε (Mean = 2.44ε) +

+
+

+ Max = 3.94ε (Mean = 2.34ε) +

+
+

+ Max = 3.94ε (Mean = 1.47ε) +

+
+

+ Bessel K'v: Mathworld Data (large values) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 59.2ε (Mean = 42.9ε) +

+
+

+ Max = 58.7ε (Mean = 42.6ε) +

+
+

+ Max = 18.6ε (Mean = 11.8ε) +

+
+

+ Bessel K'n: Random Data +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 4.45ε (Mean = 1.19ε) +

+
+

+ Max = 4.45ε (Mean = 1.19ε) +

+
+

+ Max = 9.67ε (Mean = 1.73ε) +

+
+

+ Bessel K'v: Random Data +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 7.95ε (Mean = 1.53ε) +

+
+

+ Max = 7.95ε (Mean = 1.52ε) +

+
+

+ Max = 8.32ε (Mean = 1.65ε) +

+
+
+
+
+
+ +
+

Table 19. Error rates for cyl_bessel_k_prime (integer orders)

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Bessel K'0: Mathworld Data (Integer Version) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 0.786ε (Mean = 0.329ε) +

+
+

+ Max = 0.786ε (Mean = 0.329ε) +

+
+

+ Max = 0.786ε (Mean = 0.39ε) +

+
+

+ Bessel K'1: Mathworld Data (Integer Version) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 0.736ε (Mean = 0.389ε) +

+
+

+ Max = 0.736ε (Mean = 0.389ε) +

+
+

+ Max = 0.761ε (Mean = 0.444ε) +

+
+

+ Bessel K'n: Mathworld Data (Integer Version) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 2.16ε (Mean = 1.08ε) +

+
+

+ Max = 2.16ε (Mean = 1.08ε) +

+
+

+ Max = 4.17ε (Mean = 1.75ε) +

+
+
+
+
+
+ +
+

Table 20. Error rates for cyl_neumann

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ GNU C++ version 7.1.0
linux
double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Y0: Mathworld Data +

+
+

+ Max = 5.53ε (Mean = 2.4ε)

+ (<cmath>: Max = 2.05e+05ε (Mean = 6.87e+04ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 60.9ε (Mean = 20.4ε))
(Rmath 3.2.3: + Max = 167ε (Mean = 56.5ε)) +

+
+

+ Max = 5.53ε (Mean = 2.4ε) +

+
+

+ Max = 4.61ε (Mean = 2.29ε) +

+
+

+ Y1: Mathworld Data +

+
+

+ Max = 6.33ε (Mean = 2.25ε)

+ (<cmath>: Max = 9.71e+03ε (Mean = 4.08e+03ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 23.4ε (Mean = 8.1ε))
(Rmath 3.2.3: + Max = 193ε (Mean = 64.4ε)) +

+
+

+ Max = 6.33ε (Mean = 2.29ε) +

+
+

+ Max = 4.75ε (Mean = 1.72ε) +

+
+

+ Yn: Mathworld Data +

+
+

+ Max = 55.2ε (Mean = 17.8ε)

+ (<cmath>: Max = 2.2e+20ε (Mean + = 6.97e+19ε) And + other failures.) +

+
+

+ Max = 0.993ε (Mean = 0.314ε)

+ (GSL 2.1: Max = 2.41e+05ε (Mean = 7.62e+04ε) And + other failures.)
(Rmath 3.2.3: + Max = 1.24e+04ε (Mean = 4e+03ε)) +

+
+

+ Max = 55.2ε (Mean = 17.8ε) +

+
+

+ Max = 35ε (Mean = 11.9ε) +

+
+

+ Yv: Mathworld Data +

+
+

+ Max = 10.7ε (Mean = 4.93ε)

+ (<cmath>: Max = 3.49e+15ε (Mean + = 1.05e+15ε) And + other failures.) +

+
+

+ Max = 10ε (Mean = 3.02ε)

(GSL + 2.1: Max = 1.07e+05ε (Mean = 3.22e+04ε) And + other failures.)
(Rmath 3.2.3: + Max = 243ε (Mean = 73.9ε)) +

+
+

+ Max = 10.7ε (Mean = 5.1ε) +

+
+

+ Max = 7.89ε (Mean = 3.27ε) +

+
+

+ Yv: Mathworld Data (large values) +

+
+

+ Max = 1.7ε (Mean = 1.33ε)

+ (<cmath>: Max = 43.2ε (Mean = 16.3ε) And + other failures.) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 60.8ε (Mean = 23ε) And + other failures.)
(Rmath 3.2.3: + Max = 0.682ε (Mean = 0.335ε)) +

+
+

+ Max = 1.7ε (Mean = 1.33ε) +

+
+

+ Max = 0.682ε (Mean = 0.423ε) +

+
+

+ Y0 and Y1: Random Data +

+
+

+ Max = 10.8ε (Mean = 3.04ε)

+ (<cmath>: Max = 2.59e+03ε (Mean = 500ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 34.4ε (Mean = 8.9ε))
(Rmath 3.2.3: + Max = 83ε (Mean = 14.2ε)) +

+
+

+ Max = 10.8ε (Mean = 3.04ε) +

+
+

+ Max = 4.17ε (Mean = 1.24ε) +

+
+

+ Yn: Random Data +

+
+

+ Max = 338ε (Mean = 27.5ε)

+ (<cmath>: Max = 4.01e+03ε (Mean = 348ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 500ε (Mean = 47.8ε))
(Rmath 3.2.3: + Max = 691ε (Mean = 67.9ε)) +

+
+

+ Max = 338ε (Mean = 27.5ε) +

+
+

+ Max = 117ε (Mean = 10.2ε) +

+
+

+ Yv: Random Data +

+
+

+ Max = 2.08e+03ε (Mean = 149ε)

+ (<cmath>: Max = +INFε (Mean + = +INFε) And + other failures.) +

+
+

+ Max = 1.53ε (Mean = 0.102ε)

+ (GSL 2.1: Max = 1.41e+06ε (Mean = 7.67e+04ε))
+ (Rmath 3.2.3: Max = 1.79e+05ε (Mean = 9.64e+03ε)) +

+
+

+ Max = 2.08e+03ε (Mean = 149ε) +

+
+

+ Max = 1.23e+03ε (Mean = 69.9ε) +

+
+
+
+
+
+ +
+

Table 21. Error rates for cyl_neumann (integer orders)

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ GNU C++ version 7.1.0
linux
double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Y0: Mathworld Data (Integer Version) +

+
+

+ Max = 5.53ε (Mean = 2.4ε)

+ (<cmath>: Max = 2.05e+05ε (Mean = 6.87e+04ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 6.46ε (Mean = 2.38ε))
(Rmath 3.2.3: + Max = 167ε (Mean = 56.5ε)) +

+
+

+ Max = 5.53ε (Mean = 2.4ε) +

+
+

+ Max = 4.61ε (Mean = 2.29ε)

+ (<math.h>: Max = 5.37e+03ε (Mean = 1.81e+03ε)) +

+
+

+ Y1: Mathworld Data (Integer Version) +

+
+

+ Max = 6.33ε (Mean = 2.25ε)

+ (<cmath>: Max = 9.71e+03ε (Mean = 4.08e+03ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 1.51ε (Mean = 0.839ε))
(Rmath + 3.2.3: Max = 193ε (Mean = 64.4ε)) +

+
+

+ Max = 6.33ε (Mean = 2.29ε) +

+
+

+ Max = 4.75ε (Mean = 1.72ε)

+ (<math.h>: Max = 1.86e+04ε (Mean = 6.2e+03ε)) +

+
+

+ Yn: Mathworld Data (Integer Version) +

+
+

+ Max = 55.2ε (Mean = 17.8ε)

+ (<cmath>: Max = 2.2e+20ε (Mean + = 6.97e+19ε) And + other failures.) +

+
+

+ Max = 0.993ε (Mean = 0.314ε)

+ (GSL 2.1: Max = 2.41e+05ε (Mean = 7.62e+04ε))
+ (Rmath 3.2.3: Max = 1.24e+04ε (Mean = 4e+03ε)) +

+
+

+ Max = 55.2ε (Mean = 17.8ε) +

+
+

+ Max = 35ε (Mean = 11.9ε)

(<math.h>: + Max = 2.49e+05ε (Mean = 8.14e+04ε)) +

+
+
+
+
+
+ +
+

Table 22. Error rates for cyl_neumann_prime

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Y'0: Mathworld Data +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 6.33ε (Mean = 3.12ε) +

+
+

+ Max = 6.33ε (Mean = 3.14ε) +

+
+

+ Max = 4.75ε (Mean = 1.75ε) +

+
+

+ Y'1: Mathworld Data +

+
+

+ Max = 0.58ε (Mean = 0.193ε) +

+
+

+ Max = 37.1ε (Mean = 12.8ε) +

+
+

+ Max = 34ε (Mean = 11.8ε) +

+
+

+ Max = 3.08ε (Mean = 1.2ε) +

+
+

+ Y'n: Mathworld Data +

+
+

+ Max = 2.05ε (Mean = 0.677ε) +

+
+

+ Max = 56ε (Mean = 18.2ε) +

+
+

+ Max = 56ε (Mean = 21.3ε) +

+
+

+ Max = 563ε (Mean = 178ε) +

+
+

+ Y'v: Mathworld Data +

+
+

+ Max = 21.5ε (Mean = 6.49ε) +

+
+

+ Max = 42.5ε (Mean = 13.4ε) +

+
+

+ Max = 42.5ε (Mean = 13.6ε) +

+
+

+ Max = 23.7ε (Mean = 10.1ε) +

+
+

+ Y'v: Mathworld Data (large values) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 1.57ε (Mean = 1.24ε) +

+
+

+ Max = 1.57ε (Mean = 1.24ε) +

+
+

+ Max = 0.627ε (Mean = 0.237ε) +

+
+

+ Y'0 and Y'1: Random Data +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 23.8ε (Mean = 3.69ε) +

+
+

+ Max = 23.8ε (Mean = 3.69ε) +

+
+

+ Max = 5.95ε (Mean = 1.36ε) +

+
+

+ Y'n: Random Data +

+
+

+ Max = 1.53ε (Mean = 0.0885ε) +

+
+

+ Max = 2.35e+03ε (Mean = 136ε) +

+
+

+ Max = 2.35e+03ε (Mean = 136ε) +

+
+

+ Max = 621ε (Mean = 36ε) +

+
+

+ Y'v: Random Data +

+
+

+ Max = 56.8ε (Mean = 2.59ε) +

+
+

+ Max = 1.16e+05ε (Mean = 5.28e+03ε) +

+
+

+ Max = 1.16e+05ε (Mean = 5.28e+03ε) +

+
+

+ Max = 3.23e+04ε (Mean = 1.13e+03ε) +

+
+
+
+
+
+ +
+

Table 23. Error rates for cyl_neumann_prime (integer orders)

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Y'0: Mathworld Data (Integer Version) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 6.33ε (Mean = 3.12ε) +

+
+

+ Max = 6.33ε (Mean = 3.14ε) +

+
+

+ Max = 4.75ε (Mean = 1.75ε) +

+
+

+ Y'1: Mathworld Data (Integer Version) +

+
+

+ Max = 0.58ε (Mean = 0.193ε) +

+
+

+ Max = 37.1ε (Mean = 12.8ε) +

+
+

+ Max = 34ε (Mean = 11.8ε) +

+
+

+ Max = 3.08ε (Mean = 1.2ε) +

+
+

+ Y'n: Mathworld Data (Integer Version) +

+
+

+ Max = 2.05ε (Mean = 0.677ε) +

+
+

+ Max = 56ε (Mean = 18.2ε) +

+
+

+ Max = 56ε (Mean = 21.3ε) +

+
+

+ Max = 563ε (Mean = 178ε) +

+
+
+
+
+
+ +
+

Table 24. Error rates for digamma

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Digamma Function: Large Values +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 1.84ε (Mean = 0.71ε))
(Rmath 3.2.3: + Max = 1.18ε (Mean = 0.331ε)) +

+
+

+ Max = 1.39ε (Mean = 0.413ε) +

+
+

+ Max = 1.39ε (Mean = 0.413ε) +

+
+

+ Max = 0.98ε (Mean = 0.369ε) +

+
+

+ Digamma Function: Near the Positive Root +

+
+

+ Max = 0.891ε (Mean = 0.0995ε)

+ (GSL 2.1: Max = 135ε (Mean = 11.9ε))
(Rmath + 3.2.3: Max = 2.02e+03ε (Mean = 256ε)) +

+
+

+ Max = 1.37ε (Mean = 0.477ε) +

+
+

+ Max = 1.31ε (Mean = 0.471ε) +

+
+

+ Max = 0.997ε (Mean = 0.527ε) +

+
+

+ Digamma Function: Near Zero +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 0.953ε (Mean = 0.348ε))
(Rmath + 3.2.3: Max = 1.17ε (Mean = 0.564ε)) +

+
+

+ Max = 0.984ε (Mean = 0.361ε) +

+
+

+ Max = 0.984ε (Mean = 0.361ε) +

+
+

+ Max = 0.953ε (Mean = 0.337ε) +

+
+

+ Digamma Function: Negative Values +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 4.56e+04ε (Mean = 3.91e+03ε))
(Rmath + 3.2.3: Max = 4.6e+04ε (Mean = 3.94e+03ε)) +

+
+

+ Max = 180ε (Mean = 13ε) +

+
+

+ Max = 180ε (Mean = 13ε) +

+
+

+ Max = 214ε (Mean = 16.1ε) +

+
+

+ Digamma Function: Values near 0 +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 0.866ε (Mean = 0.387ε))
(Rmath + 3.2.3: Max = 3.58e+05ε (Mean = 1.6e+05ε)) +

+
+

+ Max = 1ε (Mean = 0.592ε) +

+
+

+ Max = 1ε (Mean = 0.592ε) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Digamma Function: Integer arguments +

+
+

+ Max = 0.992ε (Mean = 0.215ε)

+ (GSL 2.1: Max = 1.18ε (Mean = 0.607ε))
(Rmath + 3.2.3: Max = 4.33ε (Mean = 0.982ε)) +

+
+

+ Max = 0.888ε (Mean = 0.403ε) +

+
+

+ Max = 0.888ε (Mean = 0.403ε) +

+
+

+ Max = 0.992ε (Mean = 0.452ε) +

+
+

+ Digamma Function: Half integer arguments +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 1.09ε (Mean = 0.531ε))
(Rmath + 3.2.3: Max = 46.2ε (Mean = 7.24ε)) +

+
+

+ Max = 0.906ε (Mean = 0.409ε) +

+
+

+ Max = 0.906ε (Mean = 0.409ε) +

+
+

+ Max = 0.78ε (Mean = 0.314ε) +

+
+
+
+
+
+ +
+

Table 25. Error rates for ellint_1

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ GNU C++ version 7.1.0
linux
double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Elliptic Integral F: Mathworld Data +

+
+

+ Max = 0.94ε (Mean = 0.509ε)

+ (<cmath>: Max = +INFε (Mean + = +INFε) And + other failures.) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 0.919ε (Mean = 0.544ε)) +

+
+

+ Max = 0.94ε (Mean = 0.509ε) +

+
+

+ Max = 0.919ε (Mean = 0.542ε) +

+
+

+ Elliptic Integral F: Random Data +

+
+

+ Max = 1.57ε (Mean = 0.56ε)

+ (<cmath>: Max = 2.56ε (Mean = 0.816ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 2.99ε (Mean = 0.797ε)) +

+
+

+ Max = 1.57ε (Mean = 0.561ε) +

+
+

+ Max = 2.26ε (Mean = 0.631ε) +

+
+
+
+
+
+ +
+

Table 26. Error rates for ellint_1 (complete)

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ GNU C++ version 7.1.0
linux
double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Elliptic Integral K: Mathworld Data +

+
+

+ Max = 0.887ε (Mean = 0.296ε)

+ (<cmath>: Max = 1.19ε (Mean = 0.765ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 0.623ε (Mean = 0.393ε)) +

+
+

+ Max = 0.887ε (Mean = 0.296ε) +

+
+

+ Max = 0.915ε (Mean = 0.547ε) +

+
+

+ Elliptic Integral K: Random Data +

+
+

+ Max = 1.27ε (Mean = 0.473ε)

+ (<cmath>: Max = 2.19ε (Mean = 0.694ε)) +

+
+

+ Max = 0.851ε (Mean = 0.0851ε)

+ (GSL 2.1: Max = 2.32ε (Mean = 0.688ε)) +

+
+

+ Max = 1.27ε (Mean = 0.473ε) +

+
+

+ Max = 0.958ε (Mean = 0.408ε) +

+
+
+
+
+
+ +
+

Table 27. Error rates for ellint_2

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Elliptic Integral E: Mathworld Data +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 0.63ε (Mean = 0.325ε)) +

+
+

+ Max = 0.656ε (Mean = 0.317ε)

+ (<cmath>: Max = +INFε (Mean + = +INFε) And + other failures.) +

+
+

+ Max = 0.656ε (Mean = 0.317ε) +

+
+

+ Max = 1.31ε (Mean = 0.727ε) +

+
+

+ Elliptic Integral E: Random Data +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 4.4ε (Mean = 1.16ε)) +

+
+

+ Max = 2.05ε (Mean = 0.632ε)

+ (<cmath>: Max = 3.08e+04ε (Mean = 3.84e+03ε)) +

+
+

+ Max = 2.05ε (Mean = 0.632ε) +

+
+

+ Max = 2.23ε (Mean = 0.639ε) +

+
+

+ Elliptic Integral E: Small Angles +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 0.5ε (Mean = 0.118ε)) +

+
+

+ Max = 1ε (Mean = 0.283ε)

(<cmath>: + Max = 2ε (Mean = 0.333ε)) +

+
+

+ Max = 1ε (Mean = 0.283ε) +

+
+

+ Max = 1ε (Mean = 0.421ε) +

+
+
+
+
+
+ +
+

Table 28. Error rates for ellint_2 (complete)

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Elliptic Integral E: Mathworld Data +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 3.09ε (Mean = 1.04ε) And + other failures.) +

+
+

+ Max = 0.836ε (Mean = 0.469ε)

+ (<cmath>: Max = 170ε (Mean = 55.1ε)) +

+
+

+ Max = 0.836ε (Mean = 0.469ε) +

+
+

+ Max = 1.3ε (Mean = 0.615ε) +

+
+

+ Elliptic Integral E: Random Data +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 4.34ε (Mean = 1.18ε)) +

+
+

+ Max = 1.97ε (Mean = 0.629ε)

+ (<cmath>: Max = 2.49e+04ε (Mean = 3.39e+03ε)) +

+
+

+ Max = 1.97ε (Mean = 0.629ε) +

+
+

+ Max = 1.71ε (Mean = 0.553ε) +

+
+
+
+
+
+ +
+

Table 29. Error rates for ellint_3

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ GNU C++ version 7.1.0
linux
double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Elliptic Integral PI: Mathworld Data +

+
+

+ Max = 475ε (Mean = 86.3ε)

+ (<cmath>: Max = +INFε (Mean + = +INFε) And + other failures.) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 1.48e+05ε (Mean = 2.54e+04ε) And + other failures.) +

+
+

+ Max = 475ε (Mean = 86.3ε) +

+
+

+ Max = 565ε (Mean = 102ε) +

+
+

+ Elliptic Integral PI: Random Data +

+
+

+ Max = 4.54ε (Mean = 0.895ε)

+ (<cmath>: Max = 3.37e+20ε (Mean + = 3.47e+19ε) And + other failures.) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 633ε (Mean = 50.1ε)) +

+
+

+ Max = 4.49ε (Mean = 0.885ε) +

+
+

+ Max = 8.33ε (Mean = 0.971ε) +

+
+

+ Elliptic Integral PI: Large Random Data +

+
+

+ Max = 3.7ε (Mean = 0.893ε)

+ (<cmath>: Max = 2.52e+18ε (Mean + = 4.83e+17ε) And + other failures.) +

+
+

+ Max = 0.557ε (Mean = 0.0389ε)

+ (GSL 2.1: Max = 40.1ε (Mean = 7.77ε)) +

+
+

+ Max = 3.7ε (Mean = 0.892ε) +

+
+

+ Max = 2.86ε (Mean = 0.944ε) +

+
+
+
+
+
+ +
+

Table 30. Error rates for ellint_3 (complete)

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ GNU C++ version 7.1.0
linux
double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Complete Elliptic Integral PI: Mathworld Data +

+
+

+ Max = 1.4ε (Mean = 0.575ε)

+ (<cmath>: Max = 6.31e+20ε (Mean + = 1.53e+20ε) And + other failures.) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 6.33e+04ε (Mean = 1.54e+04ε) And + other failures.) +

+
+

+ Max = 1.4ε (Mean = 0.575ε) +

+
+

+ Max = 0.971ε (Mean = 0.464ε) +

+
+

+ Complete Elliptic Integral PI: Random Data +

+
+

+ Max = 2.45ε (Mean = 0.696ε)

+ (<cmath>: Max = 8.78e+20ε (Mean + = 1.02e+20ε) And + other failures.) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 24ε (Mean = 2.99ε)) +

+
+

+ Max = 2.4ε (Mean = 0.677ε) +

+
+

+ Max = 2.46ε (Mean = 0.657ε) +

+
+
+
+
+
+ +
+

Table 31. Error rates for ellint_d

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Elliptic Integral E: Mathworld Data +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 0.862ε (Mean = 0.568ε)) +

+
+

+ Max = 1.3ε (Mean = 0.813ε) +

+
+

+ Max = 1.3ε (Mean = 0.813ε) +

+
+

+ Max = 0.862ε (Mean = 0.457ε) +

+
+

+ Elliptic Integral D: Random Data +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 3.01ε (Mean = 0.928ε)) +

+
+

+ Max = 2.51ε (Mean = 0.883ε) +

+
+

+ Max = 2.51ε (Mean = 0.883ε) +

+
+

+ Max = 2.87ε (Mean = 0.805ε) +

+
+
+
+
+
+ +
+

Table 32. Error rates for ellint_d (complete)

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Elliptic Integral E: Mathworld Data +

+
+

+ Max = 0.637ε (Mean = 0.368ε) +

+
+

+ Max = 1.27ε (Mean = 0.735ε) +

+
+

+ Max = 1.27ε (Mean = 0.735ε) +

+
+

+ Max = 0.637ε (Mean = 0.368ε) +

+
+

+ Elliptic Integral D: Random Data +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 1.27ε (Mean = 0.334ε) +

+
+

+ Max = 1.27ε (Mean = 0.334ε) +

+
+

+ Max = 1.27ε (Mean = 0.355ε) +

+
+
+
+
+
+ +
+

Table 33. Error rates for ellint_rc

+
++++++ + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ RC: Random data +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 2.4ε (Mean = 0.624ε)) +

+
+

+ Max = 0.995ε (Mean = 0.433ε) +

+
+

+ Max = 0.962ε (Mean = 0.407ε) +

+
+
+
+
+
+ +
+

Table 34. Error rates for ellint_rd

+
++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ RD: Random data +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 2.59ε (Mean = 0.878ε)) +

+
+

+ Max = 2.73ε (Mean = 0.831ε) +

+
+

+ Max = 2.16ε (Mean = 0.803ε) +

+
+

+ RD: y = z +

+
+

+ Max = 0.896ε (Mean = 0.022ε)

+ (GSL 2.1: Max = 2.88ε (Mean = 0.839ε)) +

+
+

+ Max = 2.65ε (Mean = 0.82ε) +

+
+

+ Max = 16.5ε (Mean = 0.843ε) +

+
+

+ RD: x = y +

+
+

+ Max = 0.824ε (Mean = 0.0272ε)

+ (GSL 2.1: Max = 3.74ε (Mean = 0.84ε)) +

+
+

+ Max = 2.85ε (Mean = 0.865ε) +

+
+

+ Max = 3.51ε (Mean = 0.816ε) +

+
+

+ RD: x = 0, y = z +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 2ε (Mean = 0.656ε)) +

+
+

+ Max = 1.19ε (Mean = 0.522ε) +

+
+

+ Max = 1.16ε (Mean = 0.497ε) +

+
+

+ RD: x = y = z +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 1.03ε (Mean = 0.418ε)) +

+
+

+ Max = 0.998ε (Mean = 0.387ε) +

+
+

+ Max = 1.03ε (Mean = 0.418ε) +

+
+

+ RD: x = 0 +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 2.85ε (Mean = 0.781ε)) +

+
+

+ Max = 2.79ε (Mean = 0.883ε) +

+
+

+ Max = 2.64ε (Mean = 0.894ε) +

+
+
+
+
+
+ +
+

Table 35. Error rates for ellint_rf

+
++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ RF: Random data +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 2.73ε (Mean = 0.804ε)) +

+
+

+ Max = 2.54ε (Mean = 0.674ε) +

+
+

+ Max = 2.02ε (Mean = 0.677ε) +

+
+

+ RF: x = y = z +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 0.999ε (Mean = 0.34ε)) +

+
+

+ Max = 0.991ε (Mean = 0.345ε) +

+
+

+ Max = 0.999ε (Mean = 0.34ε) +

+
+

+ RF: x = y or y = z or x = z +

+
+

+ Max = 0.536ε (Mean = 0.00658ε)

+ (GSL 2.1: Max = 2.89ε (Mean = 0.749ε)) +

+
+

+ Max = 1.95ε (Mean = 0.418ε) +

+
+

+ Max = 1.21ε (Mean = 0.394ε) +

+
+

+ RF: x = 0, y = z +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 1.29ε (Mean = 0.527ε)) +

+
+

+ Max = 0.894ε (Mean = 0.338ε) +

+
+

+ Max = 0.999ε (Mean = 0.407ε) +

+
+

+ RF: z = 0 +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 2.54ε (Mean = 0.781ε)) +

+
+

+ Max = 1.7ε (Mean = 0.539ε) +

+
+

+ Max = 1.89ε (Mean = 0.587ε) +

+
+
+
+
+
+ +
+

Table 36. Error rates for ellint_rg

+
++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ RG: Random Data +

+
+

+ Max = 0.983ε (Mean = 0.0172ε)

+ (GSL 2.1: Max = 0.983ε (Mean = 0.0172ε)) +

+
+

+ Max = 3.95ε (Mean = 0.951ε) +

+
+

+ Max = 3.65ε (Mean = 0.929ε) +

+
+

+ RG: two values 0 +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 0ε (Mean = 0ε)) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ RG: All values the same or zero +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 0ε (Mean = 0ε)) +

+
+

+ Max = 0.992ε (Mean = 0.288ε) +

+
+

+ Max = 1.06ε (Mean = 0.348ε) +

+
+

+ RG: two values the same +

+
+

+ Max = 0.594ε (Mean = 0.0103ε)

+ (GSL 2.1: Max = 0.594ε (Mean = 0.0103ε)) +

+
+

+ Max = 1.51ε (Mean = 0.404ε) +

+
+

+ Max = 1.96ε (Mean = 0.374ε) +

+
+

+ RG: one value zero +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 0ε (Mean = 0ε)) +

+
+

+ Max = 2.14ε (Mean = 0.722ε) +

+
+

+ Max = 1.96ε (Mean = 0.674ε) +

+
+
+
+
+
+ +
+

Table 37. Error rates for ellint_rj

+
++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ RJ: Random data +

+
+

+ Max = 0.52ε (Mean = 0.0184ε)

+ (GSL 2.1: Max = 3.57ε (Mean = 0.704ε) And + other failures.) +

+
+

+ Max = 186ε (Mean = 6.67ε) +

+
+

+ Max = 215ε (Mean = 7.66ε) +

+
+

+ RJ: 4 Equal Values +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 1.03ε (Mean = 0.418ε)) +

+
+

+ Max = 0.998ε (Mean = 0.387ε) +

+
+

+ Max = 1.03ε (Mean = 0.418ε) +

+
+

+ RJ: 3 Equal Values +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 3.96ε (Mean = 1.06ε)) +

+
+

+ Max = 20.8ε (Mean = 0.986ε) +

+
+

+ Max = 39.9ε (Mean = 1.17ε) +

+
+

+ RJ: 2 Equal Values +

+
+

+ Max = 0.6ε (Mean = 0.0228ε)

+ (GSL 2.1: Max = 2.57ε (Mean = 0.754ε)) +

+
+

+ Max = 220ε (Mean = 6.64ε) +

+
+

+ Max = 214ε (Mean = 5.28ε) +

+
+

+ RJ: Equal z and p +

+
+

+ Max = 0.742ε (Mean = 0.0166ε)

+ (GSL 2.1: Max = 2.62ε (Mean = 0.699ε)) +

+
+

+ Max = 17.2ε (Mean = 1.16ε) +

+
+

+ Max = 16.1ε (Mean = 1.14ε) +

+
+
+
+
+
+

+erf +

+
+

Table 38. Error rates for erf

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ GNU C++ version 7.1.0
linux
double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Erf Function: Small Values +

+
+

+ Max = 0.925ε (Mean = 0.193ε)

+ (<cmath>: Max = 0.944ε (Mean = 0.191ε))
+ (<math.h>: Max = 0.944ε (Mean = 0.191ε)) +

+
+

+ Max = 0.841ε (Mean = 0.0687ε)

+ (GSL 2.1: Max = 2.06ε (Mean = 0.319ε)) +

+
+

+ Max = 0.925ε (Mean = 0.193ε)

+ (<math.h>: Max = 0.944ε (Mean = 0.194ε)) +

+
+

+ Max = 0.996ε (Mean = 0.182ε)

+ (<math.h>: Max = 1.57ε (Mean = 0.317ε)) +

+
+

+ Erf Function: Medium Values +

+
+

+ Max = 1.5ε (Mean = 0.193ε)

+ (<cmath>: Max = 0.921ε (Mean = 0.0723ε))
+ (<math.h>: Max = 0.921ε (Mean = 0.0723ε)) +

+
+

+ Max = 1ε (Mean = 0.119ε)

(GSL + 2.1: Max = 2.31ε (Mean = 0.368ε)) +

+
+

+ Max = 1.5ε (Mean = 0.197ε)

+ (<math.h>: Max = 0.921ε (Mean = 0.071ε)) +

+
+

+ Max = 1ε (Mean = 0.171ε)

(<math.h>: + Max = 1.19ε (Mean = 0.244ε)) +

+
+

+ Erf Function: Large Values +

+
+

+ Max = 0ε (Mean = 0ε)

(<cmath>: + Max = 0ε (Mean = 0ε))
(<math.h>: Max + = 0ε (Mean = 0ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 0ε (Mean = 0ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(<math.h>: + Max = 0ε (Mean = 0ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(<math.h>: + Max = 0ε (Mean = 0ε)) +

+
+
+
+
+
+ +
+

Table 39. Error rates for erf_inv

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Inverse Erf Function +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 0.996ε (Mean = 0.389ε) +

+
+

+ Max = 1.08ε (Mean = 0.395ε) +

+
+

+ Max = 1.09ε (Mean = 0.502ε) +

+
+
+
+
+
+

+erfc +

+
+

Table 40. Error rates for erfc

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ GNU C++ version 7.1.0
linux
double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Erf Function: Small Values +

+
+

+ Max = 0ε (Mean = 0ε)

(<cmath>: + Max = 0ε (Mean = 0ε))
(<math.h>: Max + = 0ε (Mean = 0ε)) +

+
+

+ Max = 0.658ε (Mean = 0.0537ε)

+ (GSL 2.1: Max = 1.01ε (Mean = 0.485ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(<math.h>: + Max = 0ε (Mean = 0ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(<math.h>: + Max = 0ε (Mean = 0ε)) +

+
+

+ Erf Function: Medium Values +

+
+

+ Max = 1.76ε (Mean = 0.365ε)

+ (<cmath>: Max = 1.35ε (Mean = 0.307ε))
+ (<math.h>: Max = 1.35ε (Mean = 0.307ε)) +

+
+

+ Max = 0.983ε (Mean = 0.213ε)

+ (GSL 2.1: Max = 2.64ε (Mean = 0.662ε)) +

+
+

+ Max = 1.76ε (Mean = 0.38ε)

+ (<math.h>: Max = 2.81ε (Mean = 0.739ε)) +

+
+

+ Max = 1.65ε (Mean = 0.373ε)

+ (<math.h>: Max = 2.36ε (Mean = 0.539ε)) +

+
+

+ Erf Function: Large Values +

+
+

+ Max = 1.57ε (Mean = 0.542ε)

+ (<cmath>: Max = 1.26ε (Mean = 0.441ε))
+ (<math.h>: Max = 1.26ε (Mean = 0.441ε)) +

+
+

+ Max = 0.868ε (Mean = 0.147ε)

+ (GSL 2.1: Max = 3.9ε (Mean = 0.472ε)) +

+
+

+ Max = 1.57ε (Mean = 0.564ε)

+ (<math.h>: Max = 4.91ε (Mean = 1.54ε)) +

+
+

+ Max = 1.14ε (Mean = 0.248ε)

+ (<math.h>: Max = 1.84ε (Mean = 0.331ε)) +

+
+
+
+
+
+ +
+

Table 41. Error rates for erfc_inv

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Inverse Erfc Function +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 0.996ε (Mean = 0.397ε) +

+
+

+ Max = 1.08ε (Mean = 0.403ε) +

+
+

+ Max = 1ε (Mean = 0.491ε) +

+
+

+ Inverse Erfc Function: extreme values +

+
+ +

+ Max = 1.62ε (Mean = 0.383ε) +

+
+

+ Max = 1.62ε (Mean = 0.383ε) +

+
+
+
+
+
+
+ +
+

Table 42. Error rates for expint (Ei)

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ GNU C++ version 7.1.0
linux
double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Exponential Integral Ei +

+
+

+ Max = 5.05ε (Mean = 0.821ε)

+ (<cmath>: Max = 14.1ε (Mean = 2.43ε) And + other failures.) +

+
+

+ Max = 0.994ε (Mean = 0.142ε)

+ (GSL 2.1: Max = 8.96ε (Mean = 0.703ε)) +

+
+

+ Max = 5.05ε (Mean = 0.835ε) +

+
+

+ Max = 1.43ε (Mean = 0.54ε) +

+
+

+ Exponential Integral Ei: double exponent range +

+
+

+ Max = 1.72ε (Mean = 0.593ε)

+ (<cmath>: Max = 3.11ε (Mean = 1.13ε)) +

+
+

+ Max = 0.998ε (Mean = 0.156ε)

+ (GSL 2.1: Max = 1.5ε (Mean = 0.612ε)) +

+
+

+ Max = 1.72ε (Mean = 0.607ε) +

+
+

+ Max = 1.7ε (Mean = 0.66ε) +

+
+

+ Exponential Integral Ei: long exponent range +

+
+

+ Max = 1.98ε (Mean = 0.595ε)

+ (<cmath>: Max = 1.93ε (Mean = 0.855ε)) +

+
+ +

+ Max = 1.98ε (Mean = 0.575ε) +

+
+
+
+
+
+
+ +
+

Table 43. Error rates for expint (En)

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Exponential Integral En +

+
+

+ Max = 0.589ε (Mean = 0.0331ε)

+ (GSL 2.1: Max = 58.5ε (Mean = 17.1ε)) +

+
+

+ Max = 9.97ε (Mean = 2.13ε) +

+
+

+ Max = 9.97ε (Mean = 2.13ε) +

+
+

+ Max = 7.16ε (Mean = 1.85ε) +

+
+

+ Exponential Integral En: small z values +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 115ε (Mean = 23.6ε)) +

+
+

+ Max = 1.99ε (Mean = 0.559ε) +

+
+

+ Max = 1.99ε (Mean = 0.559ε) +

+
+

+ Max = 2.62ε (Mean = 0.531ε) +

+
+

+ Exponential Integral E1 +

+
+

+ Max = 0.556ε (Mean = 0.0625ε)

+ (GSL 2.1: Max = 0.988ε (Mean = 0.469ε)) +

+
+

+ Max = 0.965ε (Mean = 0.414ε) +

+
+

+ Max = 0.965ε (Mean = 0.408ε) +

+
+

+ Max = 0.988ε (Mean = 0.486ε) +

+
+
+
+
+
+

+expm1 +

+
+

Table 44. Error rates for expm1

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ GNU C++ version 7.1.0
linux
double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Random test data +

+
+

+ Max = 0.992ε (Mean = 0.402ε)

+ (<cmath>: Max = 0.992ε (Mean = 0.402ε))
+ (<math.h>: Max = 0.992ε (Mean = 0.402ε)) +

+
+

+ Max = 0.793ε (Mean = 0.126ε)

+ (Rmath 3.2.3: Max = 0.793ε (Mean = 0.126ε)) +

+
+

+ Max = 1.31ε (Mean = 0.428ε)

+ (<math.h>: Max = 0.996ε (Mean = 0.426ε)) +

+
+

+ Max = 1.31ε (Mean = 0.496ε)

+ (<math.h>: Max = 1.31ε (Mean = 0.496ε)) +

+
+
+
+
+
+ +
+

Table 45. Error rates for gamma_p

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ tgamma(a, z) medium values +

+
+

+ Max = 0.955ε (Mean = 0.05ε)

+ (GSL 2.1: Max = 342ε (Mean = 45.8ε))
(Rmath + 3.2.3: Max = 389ε (Mean = 44ε)) +

+
+

+ Max = 41.6ε (Mean = 8.09ε) +

+
+

+ Max = 239ε (Mean = 30.2ε) +

+
+

+ Max = 35.1ε (Mean = 6.98ε) +

+
+

+ tgamma(a, z) small values +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 4.82ε (Mean = 0.758ε))
(Rmath + 3.2.3: Max = 1.01ε (Mean = 0.306ε)) +

+
+

+ Max = 2ε (Mean = 0.464ε) +

+
+

+ Max = 2ε (Mean = 0.461ε) +

+
+

+ Max = 1.54ε (Mean = 0.439ε) +

+
+

+ tgamma(a, z) large values +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 1.02e+03ε (Mean = 105ε))
(Rmath + 3.2.3: Max = 1.11e+03ε (Mean = 67.5ε)) +

+
+

+ Max = 3.08e+04ε (Mean = 1.86e+03ε) +

+
+

+ Max = 3.02e+04ε (Mean = 1.91e+03ε) +

+
+

+ Max = 243ε (Mean = 20.2ε) +

+
+

+ tgamma(a, z) integer and half integer values +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 128ε (Mean = 22.6ε))
(Rmath 3.2.3: + Max = 66.2ε (Mean = 12.2ε)) +

+
+

+ Max = 11.8ε (Mean = 2.66ε) +

+
+

+ Max = 71.6ε (Mean = 9.47ε) +

+
+

+ Max = 13ε (Mean = 2.97ε) +

+
+
+
+
+
+ +
+

Table 46. Error rates for gamma_p_inv

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ incomplete gamma inverse(a, z) medium values +

+
+

+ Max = 0.993ε (Mean = 0.15ε)

+ (Rmath 3.2.3: Max = 4.88ε (Mean = 0.868ε)) +

+
+

+ Max = 1.8ε (Mean = 0.406ε) +

+
+

+ Max = 1.89ε (Mean = 0.466ε) +

+
+

+ Max = 1.71ε (Mean = 0.34ε) +

+
+

+ incomplete gamma inverse(a, z) large values +

+
+

+ Max = 0ε (Mean = 0ε)

(Rmath + 3.2.3: Max = 0.816ε (Mean = 0.0874ε)) +

+
+

+ Max = 0.509ε (Mean = 0.0447ε) +

+
+

+ Max = 0.509ε (Mean = 0.0447ε) +

+
+

+ Max = 0.924ε (Mean = 0.108ε) +

+
+

+ incomplete gamma inverse(a, z) small values +

+
+

+ Max = 441ε (Mean = 53.9ε)

+ (Rmath 3.2.3: Max = 547ε (Mean = 61.6ε)) +

+
+

+ Max = 9.17e+03ε (Mean = 1.45e+03ε) +

+
+

+ Max = 1.09e+04ε (Mean = 1.3e+03ε) +

+
+

+ Max = 1.1e+03ε (Mean = 131ε) +

+
+
+
+
+
+ +
+

Table 47. Error rates for gamma_p_inva

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Incomplete gamma inverses. +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 7.87ε (Mean = 1.15ε) +

+
+

+ Max = 4.08ε (Mean = 1.12ε) +

+
+

+ Max = 4.92ε (Mean = 1.03ε) +

+
+
+
+
+
+ +
+

Table 48. Error rates for gamma_q

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ tgamma(a, z) medium values +

+
+

+ Max = 0.927ε (Mean = 0.035ε)

+ (GSL 2.1: Max = 201ε (Mean = 13.5ε))
(Rmath + 3.2.3: Max = 131ε (Mean = 12.7ε)) +

+
+

+ Max = 32.3ε (Mean = 6.61ε) +

+
+

+ Max = 199ε (Mean = 26.6ε) +

+
+

+ Max = 23.7ε (Mean = 4ε) +

+
+

+ tgamma(a, z) small values +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 1.38e+10ε (Mean = 1.05e+09ε))
+ (Rmath 3.2.3: Max = 65.6ε (Mean = 11ε)) +

+
+

+ Max = 2.45ε (Mean = 0.885ε) +

+
+

+ Max = 2.45ε (Mean = 0.819ε) +

+
+

+ Max = 2.26ε (Mean = 0.74ε) +

+
+

+ tgamma(a, z) large values +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 2.71e+04ε (Mean = 2.16e+03ε))
(Rmath + 3.2.3: Max = 1.02e+03ε (Mean = 62.7ε)) +

+
+

+ Max = 6.82e+03ε (Mean = 414ε) +

+
+

+ Max = 1.15e+04ε (Mean = 733ε) +

+
+

+ Max = 469ε (Mean = 31.5ε) +

+
+

+ tgamma(a, z) integer and half integer values +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 118ε (Mean = 12.5ε))
(Rmath 3.2.3: + Max = 138ε (Mean = 16.9ε)) +

+
+

+ Max = 11.1ε (Mean = 2.07ε) +

+
+

+ Max = 54.7ε (Mean = 6.16ε) +

+
+

+ Max = 8.72ε (Mean = 1.48ε) +

+
+
+
+
+
+ +
+

Table 49. Error rates for gamma_q_inv

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ incomplete gamma inverse(a, z) medium values +

+
+

+ Max = 0.912ε (Mean = 0.154ε)

+ (Rmath 3.2.3: Max = 4.66ε (Mean = 0.792ε)) +

+
+

+ Max = 6.2ε (Mean = 0.627ε) +

+
+

+ Max = 6.2ε (Mean = 0.683ε) +

+
+

+ Max = 2.88ε (Mean = 0.469ε) +

+
+

+ incomplete gamma inverse(a, z) large values +

+
+

+ Max = 0.894ε (Mean = 0.0915ε)

+ (Rmath 3.2.3: Max = 0.894ε (Mean = 0.106ε)) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 0.814ε (Mean = 0.0856ε) +

+
+

+ incomplete gamma inverse(a, z) small values +

+
+

+ Max = 292ε (Mean = 36.4ε)

+ (Rmath 3.2.3: Max = 415ε (Mean = 48.7ε)) +

+
+

+ Max = 8.28e+03ε (Mean = 1.09e+03ε) +

+
+

+ Max = 8.98e+03ε (Mean = 877ε) +

+
+

+ Max = 451ε (Mean = 64.7ε) +

+
+
+
+
+
+ +
+

Table 50. Error rates for gamma_q_inva

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Incomplete gamma inverses. +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 8.42ε (Mean = 1.3ε) +

+
+

+ Max = 7.86ε (Mean = 1.24ε) +

+
+

+ Max = 5.05ε (Mean = 1.08ε) +

+
+
+
+
+
+ +
+

Table 51. Error rates for hermite

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Hermite Polynomials +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 6.24ε (Mean = 2.07ε) +

+
+

+ Max = 6.24ε (Mean = 2.07ε) +

+
+

+ Max = 4.46ε (Mean = 1.41ε) +

+
+
+
+
+
+ +
+

Table 52. Error rates for heuman_lambda

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Elliptic Integral Jacobi Zeta: Mathworld Data +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 1.89ε (Mean = 0.887ε) +

+
+

+ Max = 1.89ε (Mean = 0.887ε) +

+
+

+ Max = 1.08ε (Mean = 0.734ε) +

+
+

+ Elliptic Integral Heuman Lambda: Random Data +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 3.82ε (Mean = 0.609ε) +

+
+

+ Max = 3.82ε (Mean = 0.608ε) +

+
+

+ Max = 2.12ε (Mean = 0.588ε) +

+
+
+
+
+
+

+ibeta +

+
+

Table 53. Error rates for ibeta

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Incomplete Beta Function: Small Values +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 682ε (Mean = 32.6ε))
(Rmath 3.2.3: + Max = 22.9ε (Mean = 3.35ε)) +

+
+

+ Max = 8.97ε (Mean = 2.09ε) +

+
+

+ Max = 21.3ε (Mean = 2.75ε) +

+
+

+ Max = 8.4ε (Mean = 1.93ε) +

+
+

+ Incomplete Beta Function: Medium Values +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 690ε (Mean = 151ε))
(Rmath 3.2.3: + Max = 232ε (Mean = 27.9ε)) +

+
+

+ Max = 50ε (Mean = 12.1ε) +

+
+

+ Max = 124ε (Mean = 18.4ε) +

+
+

+ Max = 106ε (Mean = 16.3ε) +

+
+

+ Incomplete Beta Function: Large and Diverse Values +

+
+

+ Max = 1.26ε (Mean = 0.063ε)

+ (GSL 2.1: Max = 3.9e+05ε (Mean = 1.82e+04ε) And + other failures.)
(Rmath 3.2.3: + Max = 574ε (Mean = 49.4ε)) +

+
+

+ Max = 1.96e+04ε (Mean = 997ε) +

+
+

+ Max = 4.98e+04ε (Mean = 2.07e+03ε) +

+
+

+ Max = 1.32e+03ε (Mean = 68.5ε) +

+
+

+ Incomplete Beta Function: Small Integer Values +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 254ε (Mean = 50.9ε))
(Rmath 3.2.3: + Max = 62.2ε (Mean = 8.95ε)) +

+
+

+ Max = 4.45ε (Mean = 0.814ε) +

+
+

+ Max = 44.5ε (Mean = 10.1ε) +

+
+

+ Max = 3.85ε (Mean = 0.791ε) +

+
+
+
+
+
+ +
+

Table 54. Error rates for ibeta_inv

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Inverse incomplete beta +

+
+

+ Max = 11ε (Mean = 0.345ε)

+ (Rmath 3.2.3: Max = 1.14e+121ε (Mean + = 3.28e+119ε) And + other failures.) +

+
+

+ Max = 3.8e+04ε (Mean = 2.66e+03ε) +

+
+

+ Max = 4.07e+04ε (Mean = 2.86e+03ε) +

+
+

+ Max = 8.59e+03ε (Mean = 277ε) +

+
+
+
+
+
+ +
+

Table 55. Error rates for ibeta_inva

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Inverse incomplete beta +

+
+

+ Max = 0.602ε (Mean = 0.0239ε) +

+
+

+ Max = 377ε (Mean = 24.4ε) +

+
+

+ Max = 438ε (Mean = 31.3ε) +

+
+

+ Max = 242ε (Mean = 22.9ε) +

+
+
+
+
+
+ +
+

Table 56. Error rates for ibeta_invb

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Inverse incomplete beta +

+
+

+ Max = 0.765ε (Mean = 0.0422ε) +

+
+

+ Max = 407ε (Mean = 27.2ε) +

+
+

+ Max = 407ε (Mean = 24.4ε) +

+
+

+ Max = 409ε (Mean = 19.3ε) +

+
+
+
+
+
+

+ibetac +

+
+

Table 57. Error rates for ibetac

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Incomplete Beta Function: Small Values +

+
+

+ Max = 0ε (Mean = 0ε)

(Rmath + 3.2.3: Max = 22.4ε (Mean = 3.67ε)) +

+
+

+ Max = 10.6ε (Mean = 2.22ε) +

+
+

+ Max = 13.8ε (Mean = 2.68ε) +

+
+

+ Max = 6.94ε (Mean = 1.71ε) +

+
+

+ Incomplete Beta Function: Medium Values +

+
+

+ Max = 0ε (Mean = 0ε)

(Rmath + 3.2.3: Max = 204ε (Mean = 25.8ε)) +

+
+

+ Max = 73.9ε (Mean = 11.2ε) +

+
+

+ Max = 132ε (Mean = 19.8ε) +

+
+

+ Max = 56.7ε (Mean = 14.3ε) +

+
+

+ Incomplete Beta Function: Large and Diverse Values +

+
+

+ Max = 0.981ε (Mean = 0.0573ε)

+ (Rmath 3.2.3: Max = 889ε (Mean = 68.4ε)) +

+
+

+ Max = 3.45e+04ε (Mean = 1.32e+03ε) +

+
+

+ Max = 6.31e+04ε (Mean = 2.04e+03ε) +

+
+

+ Max = 1.88e+03ε (Mean = 82.7ε) +

+
+

+ Incomplete Beta Function: Small Integer Values +

+
+

+ Max = 0ε (Mean = 0ε)

(Rmath + 3.2.3: Max = 84.6ε (Mean = 18ε)) +

+
+

+ Max = 5.34ε (Mean = 1.11ε) +

+
+

+ Max = 107ε (Mean = 17.1ε) +

+
+

+ Max = 6.37ε (Mean = 1.03ε) +

+
+
+
+
+
+ +
+

Table 58. Error rates for ibetac_inv

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Inverse incomplete beta +

+
+

+ Max = 0.977ε (Mean = 0.0976ε)

+ (Rmath 3.2.3: Max = 3.01e+132ε (Mean + = 8.65e+130ε) And + other failures.) +

+
+

+ Max = 4.88e+04ε (Mean = 3.16e+03ε) +

+
+

+ Max = 5.05e+04ε (Mean = 3.33e+03ε) +

+
+

+ Max = 2.93e+03ε (Mean = 198ε) +

+
+
+
+
+
+ +
+

Table 59. Error rates for ibetac_inva

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Inverse incomplete beta +

+
+

+ Max = 0.683ε (Mean = 0.0314ε) +

+
+

+ Max = 382ε (Mean = 22.2ε) +

+
+

+ Max = 315ε (Mean = 23.7ε) +

+
+

+ Max = 408ε (Mean = 26.7ε) +

+
+
+
+
+
+ +
+

Table 60. Error rates for ibetac_invb

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Inverse incomplete beta +

+
+

+ Max = 0.724ε (Mean = 0.0303ε) +

+
+

+ Max = 317ε (Mean = 19.8ε) +

+
+

+ Max = 369ε (Mean = 22.6ε) +

+
+

+ Max = 271ε (Mean = 16.4ε) +

+
+
+
+
+
+ +
+

Table 61. Error rates for jacobi_cn

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Jacobi Elliptic: Mathworld Data +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 17.3ε (Mean = 4.29ε) And + other failures.) +

+
+

+ Max = 71.6ε (Mean = 19.3ε) +

+
+

+ Max = 71.6ε (Mean = 19.4ε) +

+
+

+ Max = 45.8ε (Mean = 11.4ε) +

+
+

+ Jacobi Elliptic: Random Data +

+
+

+ Max = 0.816ε (Mean = 0.0563ε)

+ (GSL 2.1: Max = 2.43ε (Mean = 0.803ε)) +

+
+

+ Max = 1.68ε (Mean = 0.443ε) +

+
+

+ Max = 1.68ε (Mean = 0.454ε) +

+
+

+ Max = 1.83ε (Mean = 0.455ε) +

+
+

+ Jacobi Elliptic: Random Small Values +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 55.2ε (Mean = 1.64ε) And + other failures.) +

+
+

+ Max = 10.4ε (Mean = 0.594ε) +

+
+

+ Max = 10.4ε (Mean = 0.602ε) +

+
+

+ Max = 26.2ε (Mean = 1.17ε) +

+
+

+ Jacobi Elliptic: Modulus near 1 +

+
+

+ Max = 0.919ε (Mean = 0.127ε)

+ (GSL 2.1: Max = 0ε (Mean = 0ε) And + other failures.) +

+
+

+ Max = 675ε (Mean = 87.1ε) +

+
+

+ Max = 675ε (Mean = 86.8ε) +

+
+

+ Max = 513ε (Mean = 126ε) +

+
+

+ Jacobi Elliptic: Large Phi +

+
+

+ Max = 14.2ε (Mean = 0.927ε)

+ (GSL 2.1: Max = 5.92e+03ε (Mean = 477ε)) +

+
+

+ Max = 2.97e+04ε (Mean = 1.9e+03ε) +

+
+

+ Max = 2.97e+04ε (Mean = 1.9e+03ε) +

+
+

+ Max = 3.27e+04ε (Mean = 1.93e+03ε) +

+
+
+
+
+
+ +
+

Table 62. Error rates for jacobi_dn

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Jacobi Elliptic: Mathworld Data +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 2.82ε (Mean = 1.18ε) And + other failures.) +

+
+

+ Max = 49ε (Mean = 14ε) +

+
+

+ Max = 49ε (Mean = 14ε) +

+
+

+ Max = 34.3ε (Mean = 8.71ε) +

+
+

+ Jacobi Elliptic: Random Data +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 3ε (Mean = 0.61ε)) +

+
+

+ Max = 1.53ε (Mean = 0.473ε) +

+
+

+ Max = 1.53ε (Mean = 0.481ε) +

+
+

+ Max = 1.52ε (Mean = 0.466ε) +

+
+

+ Jacobi Elliptic: Random Small Values +

+
+

+ Max = 0.5ε (Mean = 0.0122ε)

+ (GSL 2.1: Max = 1.5ε (Mean = 0.391ε) And + other failures.) +

+
+

+ Max = 22.4ε (Mean = 0.777ε) +

+
+

+ Max = 22.4ε (Mean = 0.763ε) +

+
+

+ Max = 16.1ε (Mean = 0.685ε) +

+
+

+ Jacobi Elliptic: Modulus near 1 +

+
+

+ Max = 2.28ε (Mean = 0.194ε)

+ (GSL 2.1: Max = 0ε (Mean = 0ε) And + other failures.) +

+
+

+ Max = 3.75e+03ε (Mean = 293ε) +

+
+

+ Max = 3.75e+03ε (Mean = 293ε) +

+
+

+ Max = 6.24e+03ε (Mean = 482ε) +

+
+

+ Jacobi Elliptic: Large Phi +

+
+

+ Max = 14.1ε (Mean = 0.897ε)

+ (GSL 2.1: Max = 121ε (Mean = 22ε)) +

+
+

+ Max = 2.82e+04ε (Mean = 1.79e+03ε) +

+
+

+ Max = 2.82e+04ε (Mean = 1.79e+03ε) +

+
+

+ Max = 1.67e+04ε (Mean = 1e+03ε) +

+
+
+
+
+
+ +
+

Table 63. Error rates for jacobi_sn

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Jacobi Elliptic: Mathworld Data +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 588ε (Mean = 146ε) And + other failures.) +

+
+

+ Max = 341ε (Mean = 80.7ε) +

+
+

+ Max = 341ε (Mean = 80.7ε) +

+
+

+ Max = 481ε (Mean = 113ε) +

+
+

+ Jacobi Elliptic: Random Data +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 4.02ε (Mean = 1.07ε)) +

+
+

+ Max = 2.01ε (Mean = 0.584ε) +

+
+

+ Max = 2.01ε (Mean = 0.593ε) +

+
+

+ Max = 1.92ε (Mean = 0.567ε) +

+
+

+ Jacobi Elliptic: Random Small Values +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 11.7ε (Mean = 1.65ε) And + other failures.) +

+
+

+ Max = 1.99ε (Mean = 0.347ε) +

+
+

+ Max = 1.99ε (Mean = 0.347ε) +

+
+

+ Max = 2.11ε (Mean = 0.385ε) +

+
+

+ Jacobi Elliptic: Modulus near 1 +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 0ε (Mean = 0ε) And + other failures.) +

+
+

+ Max = 109ε (Mean = 7.35ε) +

+
+

+ Max = 109ε (Mean = 7.38ε) +

+
+

+ Max = 23.2ε (Mean = 1.85ε) +

+
+

+ Jacobi Elliptic: Large Phi +

+
+

+ Max = 12ε (Mean = 0.771ε)

+ (GSL 2.1: Max = 4.54e+04ε (Mean = 2.63e+03ε)) +

+
+

+ Max = 2.45e+04ε (Mean = 1.51e+03ε) +

+
+

+ Max = 2.45e+04ε (Mean = 1.51e+03ε) +

+
+

+ Max = 4.36e+04ε (Mean = 2.54e+03ε) +

+
+
+
+
+
+ +
+

Table 64. Error rates for jacobi_zeta

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Elliptic Integral Jacobi Zeta: Mathworld Data +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 1.66ε (Mean = 0.48ε) +

+
+

+ Max = 1.66ε (Mean = 0.48ε) +

+
+

+ Max = 1.52ε (Mean = 0.357ε) +

+
+

+ Elliptic Integral Jacobi Zeta: Random Data +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 2.99ε (Mean = 0.824ε) +

+
+

+ Max = 3.96ε (Mean = 1.06ε) +

+
+

+ Max = 3.89ε (Mean = 0.824ε) +

+
+

+ Elliptic Integral Jacobi Zeta: Large Phi Values +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 2.92ε (Mean = 0.951ε) +

+
+

+ Max = 3.05ε (Mean = 1.13ε) +

+
+

+ Max = 2.52ε (Mean = 0.977ε) +

+
+
+
+
+
+ +
+

Table 65. Error rates for laguerre(n, m, x)

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Associated Laguerre Polynomials +

+
+

+ Max = 0.84ε (Mean = 0.0358ε)

+ (GSL 2.1: Max = 434ε (Mean = 10.7ε)) +

+
+

+ Max = 167ε (Mean = 6.38ε)

+ (<cmath>: Max = 206ε (Mean = 6.86ε)) +

+
+

+ Max = 167ε (Mean = 6.38ε) +

+
+

+ Max = 434ε (Mean = 11.1ε) +

+
+
+
+
+
+ +
+

Table 66. Error rates for laguerre(n, x)

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Laguerre Polynomials +

+
+

+ Max = 6.82ε (Mean = 0.408ε)

+ (GSL 2.1: Max = 3.1e+03ε (Mean = 185ε)) +

+
+

+ Max = 1.39e+04ε (Mean = 828ε)

+ (<cmath>: Max = 4.2e+03ε (Mean = 251ε)) +

+
+

+ Max = 1.39e+04ε (Mean = 828ε) +

+
+

+ Max = 3.1e+03ε (Mean = 185ε) +

+
+
+
+
+
+ +
+

Table 67. Error rates for legendre_p

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Legendre Polynomials: Small Values +

+
+

+ Max = 0.732ε (Mean = 0.0619ε)

+ (GSL 2.1: Max = 211ε (Mean = 20.4ε)) +

+
+

+ Max = 69.2ε (Mean = 9.58ε)

+ (<cmath>: Max = 124ε (Mean = 13.2ε)) +

+
+

+ Max = 69.2ε (Mean = 9.58ε) +

+
+

+ Max = 211ε (Mean = 20.4ε) +

+
+

+ Legendre Polynomials: Large Values +

+
+

+ Max = 0.632ε (Mean = 0.0693ε)

+ (GSL 2.1: Max = 300ε (Mean = 33.2ε)) +

+
+

+ Max = 699ε (Mean = 59.6ε)

+ (<cmath>: Max = 343ε (Mean = 32.1ε)) +

+
+

+ Max = 699ε (Mean = 59.6ε) +

+
+

+ Max = 300ε (Mean = 33.2ε) +

+
+
+
+
+
+ +
+

Table 68. Error rates for legendre_p (associated)

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Associated Legendre Polynomials: Small Values +

+
+

+ Max = 0.999ε (Mean = 0.05ε)

+ (GSL 2.1: Max = 121ε (Mean = 6.75ε) And + other failures.) +

+
+

+ Max = 175ε (Mean = 9.88ε)

+ (<cmath>: Max = 175ε (Mean = 9.36ε) And + other failures.) +

+
+

+ Max = 77.7ε (Mean = 5.59ε) +

+
+

+ Max = 121ε (Mean = 7.14ε) +

+
+
+
+
+
+ +
+

Table 69. Error rates for legendre_q

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Legendre Polynomials: Small Values +

+
+

+ Max = 0.612ε (Mean = 0.0517ε)

+ (GSL 2.1: Max = 46.4ε (Mean = 7.46ε)) +

+
+

+ Max = 50.9ε (Mean = 9ε) +

+
+

+ Max = 50.9ε (Mean = 8.98ε) +

+
+

+ Max = 46.4ε (Mean = 7.32ε) +

+
+

+ Legendre Polynomials: Large Values +

+
+

+ Max = 2.49ε (Mean = 0.202ε)

+ (GSL 2.1: Max = 4.6e+03ε (Mean = 366ε)) +

+
+

+ Max = 5.98e+03ε (Mean = 478ε) +

+
+

+ Max = 5.98e+03ε (Mean = 478ε) +

+
+

+ Max = 4.6e+03ε (Mean = 366ε) +

+
+
+
+
+
+

+lgamma +

+
+

Table 70. Error rates for lgamma

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ factorials +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 33.6ε (Mean = 2.78ε))
(Rmath 3.2.3: + Max = 1.55ε (Mean = 0.592ε)) +

+
+

+ Max = 0.991ε (Mean = 0.308ε)

+ (<cmath>: Max = 1.67ε (Mean = 0.487ε))
+ (<math.h>: Max = 1.67ε (Mean = 0.487ε)) +

+
+

+ Max = 0.991ε (Mean = 0.383ε)

+ (<math.h>: Max = 1.36ε (Mean = 0.476ε)) +

+
+

+ Max = 0.914ε (Mean = 0.175ε)

+ (<math.h>: Max = 0.958ε (Mean = 0.38ε)) +

+
+

+ near 0 +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 5.21ε (Mean = 1.57ε))
(Rmath 3.2.3: + Max = 0ε (Mean = 0ε)) +

+
+

+ Max = 1.42ε (Mean = 0.566ε)

+ (<cmath>: Max = 0.964ε (Mean = 0.543ε))
+ (<math.h>: Max = 0.964ε (Mean = 0.543ε)) +

+
+

+ Max = 1.42ε (Mean = 0.566ε)

+ (<math.h>: Max = 0.964ε (Mean = 0.543ε)) +

+
+

+ Max = 0.964ε (Mean = 0.462ε)

+ (<math.h>: Max = 0.962ε (Mean = 0.372ε)) +

+
+

+ near 1 +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 442ε (Mean = 88.8ε))
(Rmath 3.2.3: + Max = 7.99e+04ε (Mean = 1.68e+04ε)) +

+
+

+ Max = 0.948ε (Mean = 0.36ε)

+ (<cmath>: Max = 0.615ε (Mean = 0.096ε))
+ (<math.h>: Max = 0.615ε (Mean = 0.096ε)) +

+
+

+ Max = 0.948ε (Mean = 0.36ε)

+ (<math.h>: Max = 1.71ε (Mean = 0.581ε)) +

+
+

+ Max = 0.867ε (Mean = 0.468ε)

+ (<math.h>: Max = 0.906ε (Mean = 0.565ε)) +

+
+

+ near 2 +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 1.17e+03ε (Mean = 274ε))
(Rmath + 3.2.3: Max = 2.63e+05ε (Mean = 5.84e+04ε)) +

+
+

+ Max = 0.878ε (Mean = 0.242ε)

+ (<cmath>: Max = 0.741ε (Mean = 0.263ε))
+ (<math.h>: Max = 0.741ε (Mean = 0.263ε)) +

+
+

+ Max = 0.878ε (Mean = 0.242ε)

+ (<math.h>: Max = 0.598ε (Mean = 0.235ε)) +

+
+

+ Max = 0.591ε (Mean = 0.159ε)

+ (<math.h>: Max = 0.741ε (Mean = 0.473ε)) +

+
+

+ near -10 +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 24.9ε (Mean = 4.6ε))
(Rmath 3.2.3: + Max = 4.22ε (Mean = 1.26ε)) +

+
+

+ Max = 3.81ε (Mean = 1.01ε)

+ (<cmath>: Max = 0.997ε (Mean = 0.412ε))
+ (<math.h>: Max = 0.997ε (Mean = 0.412ε)) +

+
+

+ Max = 3.81ε (Mean = 1.01ε)

+ (<math.h>: Max = 3.04ε (Mean = 1.01ε)) +

+
+

+ Max = 4.22ε (Mean = 1.33ε)

+ (<math.h>: Max = 0.997ε (Mean = 0.444ε)) +

+
+

+ near -55 +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 7.02ε (Mean = 1.47ε))
(Rmath 3.2.3: + Max = 250ε (Mean = 60.9ε)) +

+
+

+ Max = 0.821ε (Mean = 0.513ε)

+ (<cmath>: Max = 1.58ε (Mean = 0.672ε))
+ (<math.h>: Max = 1.58ε (Mean = 0.672ε)) +

+
+

+ Max = 1.59ε (Mean = 0.587ε)

+ (<math.h>: Max = 0.821ε (Mean = 0.674ε)) +

+
+

+ Max = 0.821ε (Mean = 0.419ε)

+ (<math.h>: Max = 249ε (Mean = 43.1ε)) +

+
+
+
+
+
+

+log1p +

+
+

Table 71. Error rates for log1p

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ GNU C++ version 7.1.0
linux
double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Random test data +

+
+

+ Max = 0.818ε (Mean = 0.227ε)

+ (<cmath>: Max = 0.818ε (Mean = 0.227ε))
+ (<math.h>: Max = 0.818ε (Mean = 0.227ε)) +

+
+

+ Max = 0.846ε (Mean = 0.153ε)

+ (Rmath 3.2.3: Max = 0.846ε (Mean = 0.153ε)) +

+
+

+ Max = 2.3ε (Mean = 0.66ε)

+ (<math.h>: Max = 0.818ε (Mean = 0.249ε)) +

+
+

+ Max = 0.509ε (Mean = 0.057ε)

+ (<math.h>: Max = 0.509ε (Mean = 0.057ε)) +

+
+
+
+
+
+ +
+

Table 72. Error rates for non central beta CDF

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Non Central Beta, medium parameters +

+
+

+ Max = 0.998ε (Mean = 0.0649ε)

+ (Rmath 3.2.3: Max = 1.46e+26ε (Mean + = 3.5e+24ε) And + other failures.) +

+
+

+ Max = 824ε (Mean = 27.4ε) +

+
+

+ Max = 832ε (Mean = 38.1ε) +

+
+

+ Max = 242ε (Mean = 31ε) +

+
+

+ Non Central Beta, large parameters +

+
+

+ Max = 1.18ε (Mean = 0.175ε)

+ (Rmath 3.2.3: Max = 1.01e+36ε (Mean + = 1.19e+35ε) And + other failures.) +

+
+

+ Max = 2.5e+04ε (Mean = 3.78e+03ε) +

+
+

+ Max = 2.57e+04ε (Mean = 4.45e+03ε) +

+
+

+ Max = 3.66e+03ε (Mean = 500ε) +

+
+
+
+
+
+ +
+

Table 73. Error rates for non central beta CDF complement

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Non Central Beta, medium parameters +

+
+

+ Max = 0.998ε (Mean = 0.0936ε)

+ (Rmath 3.2.3: Max = 7.5e+97ε (Mean + = 1.37e+96ε) And + other failures.) +

+
+

+ Max = 396ε (Mean = 50.7ε) +

+
+

+ Max = 554ε (Mean = 57.2ε) +

+
+

+ Max = 624ε (Mean = 62.7ε) +

+
+

+ Non Central Beta, large parameters +

+
+

+ Max = 0.986ε (Mean = 0.188ε)

+ (Rmath 3.2.3: Max = +INFε (Mean + = +INFε) And + other failures.) +

+
+

+ Max = 6.83e+03ε (Mean = 993ε) +

+
+

+ Max = 3.56e+03ε (Mean = 707ε) +

+
+

+ Max = 1.25e+04ε (Mean = 1.49e+03ε) +

+
+
+
+
+
+ +
+

Table 74. Error rates for non central chi squared CDF

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Non Central Chi Squared, medium parameters +

+
+

+ Max = 0.99ε (Mean = 0.0544ε)

+ (Rmath 3.2.3: Max = 727ε (Mean = 121ε)) +

+
+

+ Max = 46.5ε (Mean = 10.3ε) +

+
+

+ Max = 115ε (Mean = 13.9ε) +

+
+

+ Max = 48.9ε (Mean = 10ε) +

+
+

+ Non Central Chi Squared, large parameters +

+
+

+ Max = 1.07ε (Mean = 0.102ε)

+ (Rmath 3.2.3: Max = 3.27e+08ε (Mean + = 2.23e+07ε)) +

+
+

+ Max = 3.07e+03ε (Mean = 336ε) +

+
+

+ Max = 6.17e+03ε (Mean = 677ε) +

+
+

+ Max = 9.79e+03ε (Mean = 723ε) +

+
+
+
+
+
+ +
+

Table 75. Error rates for non central chi squared CDF complement

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Non Central Chi Squared, medium parameters +

+
+

+ Max = 0.96ε (Mean = 0.0635ε)

+ (Rmath 3.2.3: Max = +INFε (Mean + = +INFε) And + other failures.) +

+
+

+ Max = 107ε (Mean = 17.2ε) +

+
+

+ Max = 171ε (Mean = 22.8ε) +

+
+

+ Max = 98.6ε (Mean = 15.8ε) +

+
+

+ Non Central Chi Squared, large parameters +

+
+

+ Max = 2.11ε (Mean = 0.278ε)

+ (Rmath 3.2.3: Max = +INFε (Mean + = +INFε) And + other failures.) +

+
+

+ Max = 5.02e+03ε (Mean = 630ε) +

+
+

+ Max = 5.1e+03ε (Mean = 577ε) +

+
+

+ Max = 5.43e+03ε (Mean = 705ε) +

+
+
+
+
+
+ +
+

Table 76. Error rates for non central t CDF

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Non Central T +

+
+

+ Max = 0.796ε (Mean = 0.0691ε)

+ (Rmath 3.2.3: Max = 5.28e+15ε (Mean + = 8.49e+14ε) And + other failures.) +

+
+

+ Max = 139ε (Mean = 31ε) +

+
+

+ Max = 145ε (Mean = 30.9ε) +

+
+

+ Max = 135ε (Mean = 32.1ε) +

+
+

+ Non Central T (small non-centrality) +

+
+

+ Max = 0ε (Mean = 0ε)

(Rmath + 3.2.3: Max = 2.09e+03ε (Mean = 244ε)) +

+
+

+ Max = 3.86ε (Mean = 1.4ε) +

+
+

+ Max = 9.15ε (Mean = 2.13ε) +

+
+

+ Max = 6.17ε (Mean = 1.45ε) +

+
+

+ Non Central T (large parameters) +

+
+

+ Max = 257ε (Mean = 72.1ε)

+ (Rmath 3.2.3: Max = 2.46ε (Mean = 0.657ε)) +

+
+

+ Max = 5.26e+05ε (Mean = 1.48e+05ε) +

+
+

+ Max = 5.24e+05ε (Mean = 1.47e+05ε) +

+
+

+ Max = 286ε (Mean = 62.8ε) +

+
+
+
+
+
+ +
+

Table 77. Error rates for non central t CDF complement

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Non Central T +

+
+

+ Max = 0.707ε (Mean = 0.0497ε)

+ (Rmath 3.2.3: Max = 6.19e+15ε (Mean + = 6.72e+14ε) And + other failures.) +

+
+

+ Max = 201ε (Mean = 31.7ε) +

+
+

+ Max = 340ε (Mean = 43.2ε) +

+
+

+ Max = 154ε (Mean = 32.1ε) +

+
+

+ Non Central T (small non-centrality) +

+
+

+ Max = 0ε (Mean = 0ε)

(Rmath + 3.2.3: Max = 1.87e+03ε (Mean = 263ε)) +

+
+

+ Max = 10.5ε (Mean = 2.13ε) +

+
+

+ Max = 10.5ε (Mean = 2.39ε) +

+
+

+ Max = 4.6ε (Mean = 1.63ε) +

+
+

+ Non Central T (large parameters) +

+
+

+ Max = 478ε (Mean = 96.3ε)

+ (Rmath 3.2.3: Max = 2.24ε (Mean = 0.945ε)) +

+
+

+ Max = 9.79e+05ε (Mean = 1.97e+05ε) +

+
+

+ Max = 9.79e+05ε (Mean = 1.97e+05ε) +

+
+

+ Max = 227ε (Mean = 50.4ε) +

+
+
+
+
+
+ +
+

Table 78. Error rates for owens_t

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Owens T (medium small values) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 3.34ε (Mean = 0.944ε) +

+
+

+ Max = 3.34ε (Mean = 0.911ε) +

+
+

+ Max = 4.37ε (Mean = 0.98ε) +

+
+

+ Owens T (large and diverse values) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 49ε (Mean = 2.16ε) +

+
+

+ Max = 24.5ε (Mean = 1.39ε) +

+
+

+ Max = 3.78ε (Mean = 0.621ε) +

+
+
+
+
+
+ +
+

Table 79. Error rates for polygamma

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Mathematica Data +

+
+

+ Max = 0.824ε (Mean = 0.0574ε)

+ (GSL 2.1: Max = 62.9ε (Mean = 12.8ε))
(Rmath + 3.2.3: Max = 108ε (Mean = 15.2ε)) +

+
+

+ Max = 7.38ε (Mean = 1.84ε) +

+
+

+ Max = 34.3ε (Mean = 7.65ε) +

+
+

+ Max = 9.32ε (Mean = 1.95ε) +

+
+

+ Mathematica Data - large arguments +

+
+

+ Max = 0.998ε (Mean = 0.0592ε)

+ (GSL 2.1: Max = 244ε (Mean = 32.8ε) And + other failures.)
(Rmath 3.2.3: + Max = 1.71e+56ε (Mean = 1.01e+55ε) And + other failures.) +

+
+

+ Max = 2.23ε (Mean = 0.323ε) +

+
+

+ Max = 11.1ε (Mean = 0.848ε) +

+
+

+ Max = 150ε (Mean = 13.9ε) +

+
+

+ Mathematica Data - negative arguments +

+
+

+ Max = 0.516ε (Mean = 0.022ε)

+ (GSL 2.1: Max = 36.6ε (Mean = 3.04ε) And + other failures.)
(Rmath 3.2.3: + Max = 0ε (Mean = 0ε) And + other failures.) +

+
+

+ Max = 269ε (Mean = 87.7ε) +

+
+

+ Max = 269ε (Mean = 88.4ε) +

+
+

+ Max = 497ε (Mean = 129ε) +

+
+

+ Mathematica Data - large negative arguments +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 1.79ε (Mean = 0.197ε) And + other failures.)
(Rmath 3.2.3: + Max = 0ε (Mean = 0ε) And + other failures.) +

+
+

+ Max = 155ε (Mean = 96.4ε) +

+
+

+ Max = 155ε (Mean = 96.4ε) +

+
+

+ Max = 162ε (Mean = 101ε) +

+
+

+ Mathematica Data - small arguments +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 15.2ε (Mean = 5.03ε))
(Rmath 3.2.3: + Max = 106ε (Mean = 20ε)) +

+
+

+ Max = 3.33ε (Mean = 0.75ε) +

+
+

+ Max = 3.33ε (Mean = 0.75ε) +

+
+

+ Max = 3ε (Mean = 0.496ε) +

+
+

+ Mathematica Data - Large orders and other bug cases +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 151ε (Mean = 39.3ε) And + other failures.)
(Rmath 3.2.3: + Max = +INFε (Mean = +INFε) And + other failures.) +

+
+

+ Max = 54.5ε (Mean = 13.3ε) +

+
+

+ Max = 145ε (Mean = 55.9ε) +

+
+

+ Max = 200ε (Mean = 57.2ε) +

+
+
+
+
+
+

+powm1 +

+
+

Table 80. Error rates for powm1

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ powm1 +

+
+

+ Max = 1.06ε (Mean = 0.425ε) +

+
+

+ Max = 2.04ε (Mean = 0.493ε) +

+
+

+ Max = 1.88ε (Mean = 0.49ε) +

+
+

+ Max = 1.84ε (Mean = 0.486ε) +

+
+
+
+
+
+

+sin_pi +

+
+

Table 81. Error rates for sin_pi

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ sin_pi and cos_pi +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 0.996ε (Mean = 0.335ε) +

+
+

+ Max = 0.996ε (Mean = 0.336ε) +

+
+

+ Max = 0.99ε (Mean = 0.328ε) +

+
+

+ sin_pi and cos_pi near integers and half integers +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 0.976ε (Mean = 0.293ε) +

+
+

+ Max = 0.976ε (Mean = 0.293ε) +

+
+

+ Max = 0.996ε (Mean = 0.343ε) +

+
+
+
+
+
+ +
+

Table 82. Error rates for sph_bessel

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ GNU C++ version 7.1.0
linux
double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Bessel j: Random Data +

+
+

+ Max = 243ε (Mean = 13.3ε)

+ (<cmath>: Max = 1.91e+06ε (Mean = 1.09e+05ε)) +

+
+

+ Max = 0.978ε (Mean = 0.0445ε)

+ (GSL 2.1: Max = 1.79e+03ε (Mean = 107ε)) +

+
+

+ Max = 243ε (Mean = 33.7ε) +

+
+

+ Max = 245ε (Mean = 16.3ε) +

+
+
+
+
+
+ +
+

Table 83. Error rates for sph_bessel_prime

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Bessel j': Random Data +

+
+

+ Max = 0.753ε (Mean = 0.0343ε) +

+
+

+ Max = 167ε (Mean = 12ε) +

+
+

+ Max = 167ε (Mean = 33.2ε) +

+
+

+ Max = 307ε (Mean = 25.2ε) +

+
+
+
+
+
+ +
+

Table 84. Error rates for sph_neumann

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ GNU C++ version 7.1.0
linux
double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ y: Random Data +

+
+

+ Max = 234ε (Mean = 19.5ε)

+ (<cmath>: Max = 1.6e+06ε (Mean = 1.4e+05ε)) +

+
+

+ Max = 0.995ε (Mean = 0.0665ε)

+ (GSL 2.1: Max = 8.5e+04ε (Mean = 5.33e+03ε)) +

+
+

+ Max = 234ε (Mean = 19.8ε) +

+
+

+ Max = 281ε (Mean = 31.1ε) +

+
+
+
+
+
+ +
+

Table 85. Error rates for sph_neumann_prime

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ y': Random Data +

+
+

+ Max = 0.988ε (Mean = 0.0869ε) +

+
+

+ Max = 158ε (Mean = 18.8ε) +

+
+

+ Max = 158ε (Mean = 20.2ε) +

+
+

+ Max = 296ε (Mean = 25.6ε) +

+
+
+
+
+
+ +
+

Table 86. Error rates for spherical_harmonic_i

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Spherical Harmonics +

+
+

+ Max = 1.36ε (Mean = 0.0765ε) +

+
+

+ Max = 2.89e+03ε (Mean = 108ε) +

+
+

+ Max = 1.03e+04ε (Mean = 327ε) +

+
+

+ Max = 2.27e+04ε (Mean = 725ε) +

+
+
+
+
+
+ +
+

Table 87. Error rates for spherical_harmonic_r

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Spherical Harmonics +

+
+

+ Max = 1.58ε (Mean = 0.0707ε) +

+
+

+ Max = 2.89e+03ε (Mean = 108ε) +

+
+

+ Max = 1.03e+04ε (Mean = 327ε) +

+
+

+ Max = 2.27e+04ε (Mean = 725ε) +

+
+
+
+
+
+ +
+

Table 88. Error rates for sqrt1pm1

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ sqrt1pm1 +

+
+

+ Max = 1.3ε (Mean = 0.404ε) +

+
+

+ Max = 1.33ε (Mean = 0.404ε) +

+
+

+ Max = 1.54ε (Mean = 0.563ε) +

+
+

+ Max = 1.35ε (Mean = 0.497ε) +

+
+
+
+
+
+

+tgamma +

+
+

Table 89. Error rates for tgamma

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ factorials +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 3.95ε (Mean = 0.783ε))
(Rmath + 3.2.3: Max = 314ε (Mean = 93.4ε)) +

+
+

+ Max = 2.67ε (Mean = 0.617ε)

+ (<cmath>: Max = 1.66ε (Mean = 0.584ε))
+ (<math.h>: Max = 1.66ε (Mean = 0.584ε)) +

+
+

+ Max = 172ε (Mean = 41ε)

(<math.h>: + Max = 0ε (Mean = 0ε)) +

+
+

+ Max = 1.85ε (Mean = 0.566ε)

+ (<math.h>: Max = 3.17ε (Mean = 0.928ε)) +

+
+

+ near 0 +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 4.51ε (Mean = 1.92ε))
(Rmath 3.2.3: + Max = 1ε (Mean = 0.335ε)) +

+
+

+ Max = 2ε (Mean = 0.608ε)

(<cmath>: + Max = 1ε (Mean = 0.376ε))
(<math.h>: + Max = 1ε (Mean = 0.376ε)) +

+
+

+ Max = 2ε (Mean = 0.647ε)

(<math.h>: + Max = 0.5ε (Mean = 0.0791ε)) +

+
+

+ Max = 1.5ε (Mean = 0.635ε)

+ (<math.h>: Max = 1ε (Mean = 0.405ε)) +

+
+

+ near 1 +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 4.41ε (Mean = 1.81ε))
(Rmath 3.2.3: + Max = 1ε (Mean = 0.32ε)) +

+
+

+ Max = 2.51ε (Mean = 1.02ε)

+ (<cmath>: Max = 0.918ε (Mean = 0.203ε))
+ (<math.h>: Max = 0.918ε (Mean = 0.203ε)) +

+
+

+ Max = 3.01ε (Mean = 1.06ε)

+ (<math.h>: Max = 1ε (Mean = 0.175ε)) +

+
+

+ Max = 1.1ε (Mean = 0.59ε)

+ (<math.h>: Max = 1ε (Mean = 0.4ε)) +

+
+

+ near 2 +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 7.95ε (Mean = 3.12ε))
(Rmath 3.2.3: + Max = 1ε (Mean = 0.191ε)) +

+
+

+ Max = 4.1ε (Mean = 1.55ε)

+ (<cmath>: Max = 0.558ε (Mean = 0.298ε))
+ (<math.h>: Max = 0.558ε (Mean = 0.298ε)) +

+
+

+ Max = 5.01ε (Mean = 1.89ε)

+ (<math.h>: Max = 0ε (Mean = 0ε)) +

+
+

+ Max = 2ε (Mean = 0.733ε)

(<math.h>: + Max = 0ε (Mean = 0ε)) +

+
+

+ near -10 +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 2.6ε (Mean = 1.05ε))
(Rmath 3.2.3: + Max = 34.9ε (Mean = 9.2ε)) +

+
+

+ Max = 1.75ε (Mean = 0.895ε)

+ (<cmath>: Max = 2.26ε (Mean = 1.08ε))
+ (<math.h>: Max = 2.26ε (Mean = 1.08ε)) +

+
+

+ Max = 1.75ε (Mean = 0.819ε)

+ (<math.h>: Max = 0ε (Mean = 0ε)) +

+
+

+ Max = 1.86ε (Mean = 0.881ε)

+ (<math.h>: Max = 0.866ε (Mean = 0.445ε)) +

+
+

+ near -55 +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 1.8ε (Mean = 0.782ε))
(Rmath 3.2.3: + Max = 3.89e+04ε (Mean = 9.52e+03ε)) +

+
+

+ Max = 2.69ε (Mean = 1.09ε)

+ (<cmath>: Max = 1.79ε (Mean = 0.75ε))
+ (<math.h>: Max = 1.79ε (Mean = 0.75ε)) +

+
+

+ Max = 98.5ε (Mean = 53.4ε)

+ (<math.h>: Max = 0ε (Mean = 0ε)) +

+
+

+ Max = 2.7ε (Mean = 1.35ε)

+ (<math.h>: Max = 3.87e+04ε (Mean = 6.71e+03ε)) +

+
+
+
+
+
+ +
+

Table 90. Error rates for tgamma1pm1

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ tgamma1pm1(dz) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 1.12ε (Mean = 0.49ε) +

+
+

+ Max = 6.61ε (Mean = 0.84ε) +

+
+

+ Max = 3.31ε (Mean = 0.517ε) +

+
+
+
+
+
+ +
+

Table 91. Error rates for tgamma_delta_ratio

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ tgamma + small delta ratios +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 5.83ε (Mean = 1.3ε) +

+
+

+ Max = 15.4ε (Mean = 2.09ε) +

+
+

+ Max = 7.56ε (Mean = 1.31ε) +

+
+

+ tgamma + small delta ratios (negative delta) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 7.94ε (Mean = 1.4ε) +

+
+

+ Max = 18.3ε (Mean = 2.03ε) +

+
+

+ Max = 7.43ε (Mean = 1.42ε) +

+
+

+ tgamma + small integer ratios +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 1.96ε (Mean = 0.677ε) +

+
+

+ Max = 1.96ε (Mean = 0.677ε) +

+
+

+ Max = 2.74ε (Mean = 0.736ε) +

+
+

+ tgamma + small integer ratios (negative delta) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 1.62ε (Mean = 0.451ε) +

+
+

+ Max = 1.62ε (Mean = 0.451ε) +

+
+

+ Max = 2.15ε (Mean = 0.685ε) +

+
+

+ integer tgamma ratios +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 0.997ε (Mean = 0.4ε) +

+
+

+ Max = 0.997ε (Mean = 0.4ε) +

+
+

+ Max = 0.968ε (Mean = 0.386ε) +

+
+

+ integer tgamma ratios (negative delta) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 0.853ε (Mean = 0.176ε) +

+
+

+ Max = 0.853ε (Mean = 0.176ε) +

+
+

+ Max = 0.974ε (Mean = 0.175ε) +

+
+
+
+
+
+ +
+

Table 92. Error rates for tgamma (incomplete)

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ tgamma(a, z) medium values +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 200ε (Mean = 13.3ε)) +

+
+

+ Max = 8.47ε (Mean = 1.9ε) +

+
+

+ Max = 412ε (Mean = 95.5ε) +

+
+

+ Max = 8.14ε (Mean = 1.76ε) +

+
+

+ tgamma(a, z) small values +

+
+

+ Max = 0.753ε (Mean = 0.0474ε)

+ (GSL 2.1: Max = 1.38e+10ε (Mean + = 1.05e+09ε)) +

+
+

+ Max = 2.31ε (Mean = 0.775ε) +

+
+

+ Max = 2.13ε (Mean = 0.717ε) +

+
+

+ Max = 2.53ε (Mean = 0.66ε) +

+
+

+ tgamma(a, z) integer and half integer values +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 117ε (Mean = 12.5ε)) +

+
+

+ Max = 5.52ε (Mean = 1.48ε) +

+
+

+ Max = 79.6ε (Mean = 20.9ε) +

+
+

+ Max = 5.16ε (Mean = 1.33ε) +

+
+
+
+
+
+ +
+

Table 93. Error rates for tgamma_lower

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ tgamma(a, z) medium values +

+
+

+ Max = 0.833ε (Mean = 0.0315ε)

+ (GSL 2.1: Max = 0.833ε (Mean = 0.0315ε)) +

+
+

+ Max = 6.79ε (Mean = 1.46ε) +

+
+

+ Max = 363ε (Mean = 63.8ε) +

+
+

+ Max = 5.62ε (Mean = 1.49ε) +

+
+

+ tgamma(a, z) small values +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 0ε (Mean = 0ε)) +

+
+

+ Max = 1.97ε (Mean = 0.555ε) +

+
+

+ Max = 1.97ε (Mean = 0.558ε) +

+
+

+ Max = 1.57ε (Mean = 0.525ε) +

+
+

+ tgamma(a, z) integer and half integer values +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 0ε (Mean = 0ε)) +

+
+

+ Max = 4.83ε (Mean = 1.15ε) +

+
+

+ Max = 84.7ε (Mean = 17.5ε) +

+
+

+ Max = 2.69ε (Mean = 0.849ε) +

+
+
+
+
+
+ +
+

Table 94. Error rates for tgamma_ratio

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ tgamma ratios +

+
+

+ Max = 0.694ε (Mean = 0.0347ε) +

+
+

+ Max = 2.99ε (Mean = 1.15ε) +

+
+

+ Max = 174ε (Mean = 61.2ε) +

+
+

+ Max = 3.28ε (Mean = 1.12ε) +

+
+
+
+
+
+ +
+

Table 95. Error rates for trigamma

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Mathematica Data +

+
+

+ Max = 0.998ε (Mean = 0.105ε)

+ (GSL 2.1: Max = 1.34e+04ε (Mean = 1.49e+03ε))
+ (Rmath 3.2.3: Max = 1.34e+04ε (Mean = 1.51e+03ε)) +

+
+

+ Max = 1.28ε (Mean = 0.449ε) +

+
+

+ Max = 1.28ε (Mean = 0.449ε) +

+
+

+ Max = 1ε (Mean = 0.382ε) +

+
+
+
+
+
+

+zeta +

+
+

Table 96. Error rates for zeta

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ GNU C++ version 7.1.0
linux
double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Zeta: Random values greater than 1 +

+
+

+ Max = 0.846ε (Mean = 0.0833ε)

+ (<cmath>: Max = 5.45ε (Mean = 1ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 8.69ε (Mean = 1.03ε)) +

+
+

+ Max = 0.846ε (Mean = 0.0833ε) +

+
+

+ Max = 0.836ε (Mean = 0.093ε) +

+
+

+ Zeta: Random values less than 1 +

+
+

+ Max = 7.03ε (Mean = 2.93ε)

+ (<cmath>: Max = 538ε (Mean = 59.3ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 137ε (Mean = 13.8ε)) +

+
+

+ Max = 70.1ε (Mean = 17.1ε) +

+
+

+ Max = 6.84ε (Mean = 3.12ε) +

+
+

+ Zeta: Values close to and greater than 1 +

+
+

+ Max = 0.995ε (Mean = 0.5ε)

+ (<cmath>: Max = 1.9e+06ε (Mean = 5.11e+05ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 7.73ε (Mean = 4.07ε)) +

+
+

+ Max = 0.995ε (Mean = 0.5ε) +

+
+

+ Max = 0.994ε (Mean = 0.421ε) +

+
+

+ Zeta: Values close to and less than 1 +

+
+

+ Max = 0.998ε (Mean = 0.508ε)

+ (<cmath>: Max = 8.53e+06ε (Mean = 1.87e+06ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 0.991ε (Mean = 0.28ε)) +

+
+

+ Max = 0.998ε (Mean = 0.508ε) +

+
+

+ Max = 0.991ε (Mean = 0.375ε) +

+
+

+ Zeta: Integer arguments +

+
+

+ Max = 9ε (Mean = 3.06ε)

(<cmath>: + Max = 70.3ε (Mean = 17.4ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 3.75ε (Mean = 1.1ε)) +

+
+

+ Max = 28ε (Mean = 5.62ε) +

+
+

+ Max = 9ε (Mean = 3ε) +

+
+
+
+
+
+ +
+ + Error + Output For cyl_bessel_j (integer orders) with compiler Microsoft Visual C++ + version 14.1 and library <math.h> and test data Bessel JN: Mathworld + Data (Integer Version) +
+

+ CAUTION: + Found non-finite result, when a finite value was expected at entry 16
+ Found: -nan(ind) Expected 0 Error: 1.79769e+308
10, 1e-100, 0
CAUTION: + Gross error found at entry 16.
Found: -nan(ind) Expected 0 Error: 1.79769e+308
+ 10, 1e-100, 0
+

+
+ + Error + Output For legendre_p (associated) with compiler GNU C++ version 7.1.0 and + library GSL 2.1 and test data Associated Legendre Polynomials: Small Values +
+

+ domain + error
3.75573, -3, 0.264719, 0.0186823
domain error
3.75573, + -3, 0.670017, 0.0085227
domain error
3.75573, -3, 0.915014, 0.00136786
+ domain error
3.75573, -3, 0.93539, 0.000921218
domain error
+ 3.75573, -2, -0.804919, -0.035427
domain error
3.75573, -2, -0.623236, + -0.0476446
domain error
3.75573, -2, 0.629447, 0.0475072
+ domain error
3.75573, -2, 0.929777, 0.0157498
domain error
+ 3.75573, -2, 0.985763, 0.0034837
domain error
3.75573, -1, 0.093763, + -0.118979
domain error
4.28576, -4, 0.0944412, 0.00255792
+ domain error
4.28576, -4, 0.670017, 0.000790849
domain error
+ 4.28576, -3, -0.746026, -0.00458957
domain error
4.28576, -2, -0.623236, + 0.0219016
domain error
4.28576, -2, 0.629447, 0.0223081
domain + error
4.28576, -2, 0.93539, 0.0133504
domain error
4.28576, + -1, 0.915014, 0.132001
domain error
4.28576, -1, 0.985763, 0.0787743
+ domain error
4.43859, -4, 0.093763, 0.00255858
domain error
+ 4.43859, -4, 0.811584, 0.000303404
domain error
4.43859, -4, 0.826752, + 0.000260835
domain error
4.43859, -4, 0.929777, 4.78235e-05
+ domain error
4.43859, -3, -0.804919, -0.00350364
domain error
+ 4.43859, -3, -0.729046, -0.00487043
domain error
4.43859, -3, -0.623236, + -0.00620995
domain error
4.43859, -3, 0.93539, 0.000861698
+ domain error
4.43859, -2, -0.557932, 0.0169167
domain error
+ 4.43859, -2, -0.443004, 0.0062586
domain error
4.43859, -2, 0.915014, + 0.016481
domain error
4.43859, -1, 0.629447, -0.0138523
domain + error
5.39088, -5, 0.0944412, 0.000254649
domain error
5.39088, + -5, 0.264719, 0.000217164
domain error
5.39088, -5, 0.670017, 5.87083e-05
+ domain error
5.39088, -5, 0.915014, 2.78273e-06
domain error
+ 5.39088, -3, 0.929777, 0.000880849
domain error
5.39088, -2, 0.629447, + 0.00448021
domain error
5.39088, -2, 0.826752, 0.01718
domain + error
5.39088, -2, 0.937736, 0.011583
domain error
5.39088, + -1, -0.804919, 0.0276144
domain error
5.39088, -1, -0.746026, -0.0119425
+ domain error
5.39088, -1, -0.443004, -0.0525987
domain error
+ 5.39088, -1, 0.811584, 0.032475
domain error
5.39088, -1, 0.985763, + 0.0759289
domain error
5.97861, -5, -0.729046, 3.91223e-05
+ domain error
5.97861, -5, -0.383666, 0.000174899
domain error
+ 5.97861, -5, 0.93539, 1.43993e-06
domain error
5.97861, -4, -0.623236, + -0.000607048
domain error
5.97861, -4, 0.264719, 0.00059614
+ domain error
5.97861, -3, 0.629447, 0.00313497
domain error
+ 5.97861, -3, 0.670017, 0.00323895
domain error
5.97861, -2, 0.915014, + 0.0140705
domain error
5.97861, -2, 0.992923, 0.00171356
+ domain error
5.97861, -1, -0.746026, -0.0119425
domain error
+ 5.97861, -1, 0.937736, 0.106972
domain error
7.01297, -6, -0.443004, + -4.99177e-06
domain error
7.01297, -6, 0.629447, 3.00689e-06
+ domain error
7.01297, -6, 0.811584, 7.00407e-07
domain error
+ 7.01297, -6, 0.985763, 4.83431e-10
domain error
7.01297, -3, 0.670017, + 0.000233323
domain error
7.01297, -2, -0.804919, -0.0027739
+ domain error
7.01297, -1, -0.383666, 0.0397866
domain error
+ 7.01297, -1, 0.929777, 0.0544549
domain error
7.54701, -7, 0.929777, + 1.42008e-09
domain error
7.54701, -6, 0.992923, 6.04622e-11
+ domain error
7.54701, -5, -0.804919, 1.18502e-05
domain error
+ 7.54701, -5, -0.623236, 2.57049e-05
domain error
7.54701, -5, -0.557932, + 2.60266e-05
domain error
7.54701, -5, 0.826752, 9.64276e-06
+ domain error
7.54701, -4, -0.746026, -0.0001618
domain error
+ 7.54701, -3, 0.0944412, 0.000622493
domain error
7.54701, -3, 0.985763, + 9.14782e-05
domain error
7.54701, -1, 0.811584, -0.0376184
+ domain error
11.8439, -10, -0.557932, -2.32652e-11
domain error
+ 11.8439, -10, 0.811584, 1.01194e-12
domain error
11.8439, -8, -0.746026, + -1.34891e-09
domain error
11.8439, -8, -0.729046, -1.5428e-09
+ domain error
11.8439, -8, 0.985763, 5.90035e-14
domain error
+ 11.8439, -4, 0.629447, -1.44723e-05
domain error
11.8439, -4, 0.929777, + 1.98812e-05
domain error
11.8439, -3, 0.670017, -4.58296e-05
+ domain error
11.8439, -2, 0.826752, -0.00244759
domain error
+ 11.8439, -2, 0.992923, 0.00151458
domain error
11.8439, -1, -0.383666, + 0.00419108
domain error
11.85, -11, 0.093763, 1.16526e-11
+ domain error
11.85, -11, 0.929777, 2.05797e-16
domain error
+ 11.85, -11, 0.93539, 1.32249e-16
domain error
*** FURTHER CONTENT + HAS BEEN TRUNCATED FOR BREVITY ***
+

+
+ + Error + Output For legendre_p (associated) with compiler GNU C++ version 7.1.0 and + library <cmath> and test data Associated Legendre Polynomials: Small + Values +
+

+ order + parameters less than 0 not supported in TR1
3.75573, -3, 0.264719, 0.0186823
+ order parameters less than 0 not supported in TR1
3.75573, -3, 0.670017, + 0.0085227
order parameters less than 0 not supported in TR1
3.75573, + -3, 0.915014, 0.00136786
order parameters less than 0 not supported in + TR1
3.75573, -3, 0.93539, 0.000921218
order parameters less than + 0 not supported in TR1
3.75573, -2, -0.804919, -0.035427
order + parameters less than 0 not supported in TR1
3.75573, -2, -0.623236, -0.0476446
+ order parameters less than 0 not supported in TR1
3.75573, -2, 0.629447, + 0.0475072
order parameters less than 0 not supported in TR1
3.75573, + -2, 0.929777, 0.0157498
order parameters less than 0 not supported in + TR1
3.75573, -2, 0.985763, 0.0034837
order parameters less than + 0 not supported in TR1
3.75573, -1, 0.093763, -0.118979
order parameters + less than 0 not supported in TR1
4.28576, -4, 0.0944412, 0.00255792
+ order parameters less than 0 not supported in TR1
4.28576, -4, 0.670017, + 0.000790849
order parameters less than 0 not supported in TR1
4.28576, + -3, -0.746026, -0.00458957
order parameters less than 0 not supported + in TR1
4.28576, -2, -0.623236, 0.0219016
order parameters less + than 0 not supported in TR1
4.28576, -2, 0.629447, 0.0223081
order + parameters less than 0 not supported in TR1
4.28576, -2, 0.93539, 0.0133504
+ order parameters less than 0 not supported in TR1
4.28576, -1, 0.915014, + 0.132001
order parameters less than 0 not supported in TR1
4.28576, + -1, 0.985763, 0.0787743
order parameters less than 0 not supported in + TR1
4.43859, -4, 0.093763, 0.00255858
order parameters less than + 0 not supported in TR1
4.43859, -4, 0.811584, 0.000303404
order + parameters less than 0 not supported in TR1
4.43859, -4, 0.826752, 0.000260835
+ order parameters less than 0 not supported in TR1
4.43859, -4, 0.929777, + 4.78235e-05
order parameters less than 0 not supported in TR1
4.43859, + -3, -0.804919, -0.00350364
order parameters less than 0 not supported + in TR1
4.43859, -3, -0.729046, -0.00487043
order parameters less + than 0 not supported in TR1
4.43859, -3, -0.623236, -0.00620995
+ order parameters less than 0 not supported in TR1
4.43859, -3, 0.93539, + 0.000861698
order parameters less than 0 not supported in TR1
4.43859, + -2, -0.557932, 0.0169167
order parameters less than 0 not supported in + TR1
4.43859, -2, -0.443004, 0.0062586
order parameters less than + 0 not supported in TR1
4.43859, -2, 0.915014, 0.016481
order parameters + less than 0 not supported in TR1
4.43859, -1, 0.629447, -0.0138523
+ order parameters less than 0 not supported in TR1
5.39088, -5, 0.0944412, + 0.000254649
order parameters less than 0 not supported in TR1
5.39088, + -5, 0.264719, 0.000217164
order parameters less than 0 not supported + in TR1
5.39088, -5, 0.670017, 5.87083e-05
order parameters less + than 0 not supported in TR1
5.39088, -5, 0.915014, 2.78273e-06
+ order parameters less than 0 not supported in TR1
5.39088, -3, 0.929777, + 0.000880849
order parameters less than 0 not supported in TR1
5.39088, + -2, 0.629447, 0.00448021
order parameters less than 0 not supported in + TR1
5.39088, -2, 0.826752, 0.01718
order parameters less than 0 + not supported in TR1
5.39088, -2, 0.937736, 0.011583
order parameters + less than 0 not supported in TR1
5.39088, -1, -0.804919, 0.0276144
+ order parameters less than 0 not supported in TR1
5.39088, -1, -0.746026, + -0.0119425
order parameters less than 0 not supported in TR1
5.39088, + -1, -0.443004, -0.0525987
order parameters less than 0 not supported + in TR1
5.39088, -1, 0.811584, 0.032475
order parameters less than + 0 not supported in TR1
5.39088, -1, 0.985763, 0.0759289
order parameters + less than 0 not supported in TR1
5.97861, -5, -0.729046, 3.91223e-05
+ order parameters less than 0 not supported in TR1
5.97861, -5, -0.383666, + 0.000174899
order parameters less than 0 not supported in TR1
5.97861, + -5, 0.93539, 1.43993e-06
order parameters less than 0 not supported in + TR1
5.97861, -4, -0.623236, -0.000607048
order parameters less + than 0 not supported in TR1
5.97861, -4, 0.264719, 0.00059614
order + parameters less than 0 not supported in TR1
5.97861, -3, 0.629447, 0.00313497
+ *** FURTHER CONTENT HAS BEEN TRUNCATED FOR BREVITY ***
+

+
+ + Error + Output For cyl_bessel_i with compiler GNU C++ version 7.1.0 and library Rmath + 3.2.3 and test data Bessel Iv: Mathworld Data (large values) +
+

+ CAUTION: + Gross error found at entry 0.
Found: 0 Expected 1.86459e-155 Error: 8.37988e+152
+ -1, 3.72917e-155, 1.86459e-155
CAUTION: Gross error found at entry 1.
+ Found: 0 Expected 1.86459e-155 Error: 8.37988e+152
1, 3.72917e-155, 1.86459e-155
+ CAUTION: Gross error found at entry 3.
Found: 0 Expected 8.02269e-175 + Error: 3.60559e+133
1.125, 3.72917e-155, 8.02269e-175
+

+
+ + Error + Output For cyl_bessel_i (integer orders) with compiler GNU C++ version 7.1.0 + and library Rmath 3.2.3 and test data Bessel In: Mathworld Data (Integer Version) +
+

+ Unsupported + domain
-5, -1, -0.000271463
Unsupported domain
10, -5, 0.00458004
+ Unsupported domain
-100, -200, 4.35275e+74
+

+
+ + Error + Output For cyl_bessel_i (integer orders) with compiler GNU C++ version 7.1.0 + and library Rmath 3.2.3 and test data Bessel I1: Mathworld Data (Integer Version) +
+

+ Unsupported + domain
1, -2, -1.59064
Unsupported domain
1, -8, -399.873
+ Unsupported domain
1, -10, -2670.99
+

+
+ + Error + Output For cyl_bessel_i (integer orders) with compiler GNU C++ version 7.1.0 + and library Rmath 3.2.3 and test data Bessel I0: Mathworld Data (Integer Version) +
+

+ Unsupported + domain
0, -2, 2.27959
Unsupported domain
0, -7, 168.594
+ Unsupported domain
0, -1, 1.26607
+

+
+ + Error + Output For cyl_bessel_i with compiler GNU C++ version 7.1.0 and library Rmath + 3.2.3 and test data Bessel In: Mathworld Data +
+

+ Unsupported + domain
-5, -1, -0.000271463
Unsupported domain
10, -5, 0.00458004
+ Unsupported domain
-100, -200, 4.35275e+74
+

+
+ + Error + Output For cyl_bessel_i with compiler GNU C++ version 7.1.0 and library Rmath + 3.2.3 and test data Bessel I1: Mathworld Data +
+

+ Unsupported + domain
1, -2, -1.59064
Unsupported domain
1, -8, -399.873
+ Unsupported domain
1, -10, -2670.99
+

+
+ + Error + Output For cyl_bessel_i with compiler GNU C++ version 7.1.0 and library Rmath + 3.2.3 and test data Bessel I0: Mathworld Data +
+

+ Unsupported + domain
0, -2, 2.27959
Unsupported domain
0, -7, 168.594
+ Unsupported domain
0, -1, 1.26607
+

+
+ + Error + Output For cyl_bessel_j with compiler GNU C++ version 7.1.0 and library Rmath + 3.2.3 and test data Bessel J: Mathworld Data +
+

+ CAUTION: + Gross error found at entry 6.
Found: 0 Expected -0.000747424 Error: 3.3591e+304
+ 5.5, 1e+06, -0.000747424
CAUTION: Gross error found at entry 7.
+ Found: 0 Expected -0.0007766 Error: 3.49022e+304
5.125, 1e+06, -0.0007766
+ CAUTION: Gross error found at entry 8.
Found: 0 Expected -0.000466323 + Error: 2.09576e+304
5.875, 1e+06, -0.000466323
+

+
+ + Error + Output For cyl_bessel_j (integer orders) with compiler GNU C++ version 7.1.0 + and library Rmath 3.2.3 and test data Bessel JN: Mathworld Data (Integer Version) +
+

+ Unsupported + domain
5, -10, 0.234062
CAUTION: Gross error found at entry 6.
+ Found: 0 Expected 0.000725964 Error: 3.26265e+304
-5, 1e+06, 0.000725964
+ CAUTION: Gross error found at entry 7.
Found: 0 Expected -0.000725964 + Error: 3.26265e+304
5, 1e+06, -0.000725964
Unsupported domain
+ -5, -1, 0.000249758
Unsupported domain
10, -10, 0.207486
+ Unsupported domain
10, -5, 0.0014678
CAUTION: Gross error found + at entry 12.
Found: 0 Expected -0.000331079 Error: 1.48795e+304
+ -10, 1e+06, -0.000331079
CAUTION: Gross error found at entry 13.
+ Found: 0 Expected -0.000331079 Error: 1.48795e+304
10, 1e+06, -0.000331079
+

+
+ + Error + Output For cyl_bessel_j (integer orders) with compiler GNU C++ version 7.1.0 + and library Rmath 3.2.3 and test data Bessel J1: Mathworld Data (Integer Version) +
+

+ Unsupported + domain
1, -2, -0.576725
Unsupported domain
1, -8, -0.234636
+ Unsupported domain
1, -10, -0.0434727
+

+
+ + Error + Output For cyl_bessel_j (integer orders) with compiler GNU C++ version 7.1.0 + and library Rmath 3.2.3 and test data Bessel J0: Mathworld Data (Integer Version) +
+

+ Unsupported + domain
0, -2, 0.223891
Unsupported domain
0, -8, 0.171651
+ Unsupported domain
0, -10, -0.245936
+

+
+ + Error + Output For cyl_bessel_j with compiler GNU C++ version 7.1.0 and library Rmath + 3.2.3 and test data Bessel JN: Mathworld Data +
+

+ Unsupported + domain
5, -10, 0.234062
CAUTION: Gross error found at entry 6.
+ Found: 0 Expected 0.000725964 Error: 3.26265e+304
-5, 1e+06, 0.000725964
+ CAUTION: Gross error found at entry 7.
Found: 0 Expected -0.000725964 + Error: 3.26265e+304
5, 1e+06, -0.000725964
Unsupported domain
+ -5, -1, 0.000249758
Unsupported domain
10, -10, 0.207486
+ Unsupported domain
10, -5, 0.0014678
CAUTION: Gross error found + at entry 12.
Found: 0 Expected -0.000331079 Error: 1.48795e+304
+ -10, 1e+06, -0.000331079
CAUTION: Gross error found at entry 13.
+ Found: 0 Expected -0.000331079 Error: 1.48795e+304
10, 1e+06, -0.000331079
+

+
+ + Error + Output For cyl_bessel_j with compiler GNU C++ version 7.1.0 and library Rmath + 3.2.3 and test data Bessel J1: Mathworld Data +
+

+ Unsupported + domain
1, -2, -0.576725
Unsupported domain
1, -8, -0.234636
+ Unsupported domain
1, -10, -0.0434727
+

+
+ + Error + Output For cyl_bessel_j with compiler GNU C++ version 7.1.0 and library Rmath + 3.2.3 and test data Bessel J0: Mathworld Data +
+

+ Unsupported + domain
0, -2, 0.223891
Unsupported domain
0, -8, 0.171651
+ Unsupported domain
0, -10, -0.245936
+

+
+ + Error + Output For ibetac_inv with compiler GNU C++ version 7.1.0 and library Rmath + 3.2.3 and test data Inverse incomplete beta +
+

+ CAUTION: + Gross error found at entry 7.
Found: 3.8247e-302 Expected 0 Error: 1.71891e+06
+ 1.38853e-05, 0.0497627, 0.632396, 0, 0
CAUTION: Gross error found at + entry 71.
Found: 1.38362e-204 Expected 0 Error: 6.21832e+103
3.77931e-05, + 0.0150073, 0.835025, 0, 0
CAUTION: Gross error found at entry 90.
+ Found: 1.09275e-303 Expected 0 Error: 49109.6
4.29383e-05, 0.0428761, + 0.814742, 0, 0
CAUTION: Gross error found at entry 102.
Found: + 3.8625e-304 Expected 0 Error: 17358
4.80089e-05, 0.0296236, 0.913384, + 0, 0
CAUTION: Gross error found at entry 115.
Found: 1.51774e-303 + Expected 0 Error: 68209.8
0.000130387, 0.0404969, 0.814742, 0, 0
+ CAUTION: Gross error found at entry 123.
Found: 1.28036e-303 Expected + 0 Error: 57541.4
0.000149328, 0.0201182, 0.905801, 5.70765e-267, 0
+ CAUTION: Gross error found at entry 133.
Found: 1.96732e-302 Expected + 0 Error: 884160
0.000173563, 0.0301908, 0.913384, 4.21662e-213, 0
+ CAUTION: Gross error found at entry 159.
Found: 1.48697e-191 Expected + 0 Error: 6.68279e+116
0.000260723, 0.0252933, 0.632396, 0, 0
CAUTION: + Gross error found at entry 256.
Found: 9.24166e-245 Expected 0 Error: + 4.15342e+63
0.00246975, 0.016063, 0.913384, 1, 0
+

+
+ + Error + Output For ibeta_inv with compiler GNU C++ version 7.1.0 and library Rmath + 3.2.3 and test data Inverse incomplete beta +
+

+ CAUTION: + Gross error found at entry 1.
Found: 1.90197e-247 Expected 0 Error: 8.54789e+60
+ 1.12733e-05, 0.022662, 0.135563, 0, 0
CAUTION: Gross error found at entry + 30.
Found: 1.36217e-301 Expected 0 Error: 6.12191e+06
2.10769e-05, + 0.0448972, 0.221112, 0, 0
CAUTION: Gross error found at entry 152.
+ Found: 2.92621e-285 Expected 0 Error: 1.31511e+23
0.000240381, 0.017982, + 0.221112, 0, 0
CAUTION: Gross error found at entry 184.
Found: + 5.63355e-203 Expected 0 Error: 2.53185e+105
0.000348822, 0.0275467, 0.135563, + 0, 1.88165e-166
CAUTION: Gross error found at entry 205.
Found: + 5.52731e-303 Expected 0 Error: 248409
0.000441212, 0.0313573, 0.127074, + 0, 9.07221e-121
+

+
+ + Error + Output For non central beta CDF complement with compiler GNU C++ version 7.1.0 + and library Rmath 3.2.3 and test data Non Central Beta, large parameters +
+

+ CAUTION: + Gross error found at entry 10.
Found: 9.76918e-10 Expected 1.61248e-15 + Error: 605846
290.682, 72.6705, 20005.4, 0.997663, 1, 1.61248e-15
+ CAUTION: Gross error found at entry 11.
Found: 9.94184e-10 Expected 3.0108e-42 + Error: 3.30205e+32
290.682, 145.341, 53489.1, 0.998663, 1, 3.0108e-42
+ CAUTION: Gross error found at entry 16.
Found: 8.45406e-10 Expected 4.46652e-22 + Error: 1.89276e+12
290.682, 1162.73, 2308.07, 0.656921, 1, 4.46652e-22
+ CAUTION: Gross error found at entry 17.
Found: 9.41971e-10 Expected 1.7241e-50 + Error: 5.46356e+40
290.682, 1453.41, 8064.48, 0.832237, 1, 1.7241e-50
+ CAUTION: Gross error found at entry 18.
Found: 9.30663e-10 Expected 2.09803e-305 + Error: 4.43589e+295
975.766, 731.824, 232.285, 0.919742, 1, 2.09803e-305
+ CAUTION: Gross error found at entry 27.
Found: 9.76918e-10 Expected 9.3474e-18 + Error: 1.04512e+08
1879.05, 187.905, 20005.4, 0.992215, 1, 9.3474e-18
+ CAUTION: Gross error found at entry 28.
Found: 9.94184e-10 Expected 1.8122e-90 + Error: 5.48607e+80
1879.05, 469.762, 53489.1, 0.994618, 1, 1.8122e-90
+ CAUTION: Gross error found at entry 32.
Found: 9.27224e-10 Expected 3.18255e-15 + Error: 291345
1879.05, 3758.1, 1879.05, 0.480508, 1, 3.18255e-15
+ CAUTION: Gross error found at entry 33.
Found: 8.45406e-10 Expected 1.10218e-77 + Error: 7.67029e+67
1879.05, 5637.15, 2308.07, 0.458181, 1, 1.10218e-77
+ CAUTION: Gross error found at entry 34.
Found: 9.30663e-10 Expected 0 + Error: 4.18262e+298
2308.07, 1154.03, 232.285, 0.919371, 1, 0
CAUTION: + Gross error found at entry 35.
Found: 8.93617e-10 Expected 0 Error: 4.01612e+298
+ 2308.07, 1731.05, 290.682, 0.917262, 1, 0
CAUTION: Gross error found + at entry 43.
Found: 9.94184e-10 Expected 3.57283e-70 Error: 2.78262e+60
+ 8064.48, 806.448, 53489.1, 0.988678, 1, 3.57283e-70
CAUTION: Gross error + found at entry 48.
Found: 8.45406e-10 Expected 8.78057e-74 Error: 9.62814e+63
+ 8064.48, 16129, 2308.07, 0.421531, 1, 8.78057e-74
CAUTION: Gross error + found at entry 49.
Found: 9.30663e-10 Expected 0 Error: 4.18262e+298
+ 15674.4, 3918.59, 232.285, 0.933726, 1, 0
CAUTION: Gross error found + at entry 50.
Found: 8.93617e-10 Expected 0 Error: 4.01612e+298
+ 15674.4, 7837.19, 290.682, 0.917179, 1, 0
CAUTION: Gross error found + at entry 51.
Found: 8.9318e-10 Expected 0 Error: 4.01416e+298
15674.4, + 11755.8, 975.766, 0.915784, 1, 0
CAUTION: Gross error found at entry + 63.
Found: 9.41971e-10 Expected 2.31296e-171 Error: 4.07258e+161
+ 20005.4, 40010.8, 8064.48, 0.432094, 1, 2.31296e-171
CAUTION: Gross error + found at entry 64.
Found: 9.30663e-10 Expected 0 Error: 4.18262e+298
+ 53489.1, 5348.92, 232.285, 0.954635, 1, 0
CAUTION: Gross error found + at entry 65.
Found: 8.93617e-10 Expected 0 Error: 4.01612e+298
+ 53489.1, 13372.3, 290.682, 0.933478, 1, 0
CAUTION: Gross error found + at entry 66.
Found: 8.9318e-10 Expected 0 Error: 4.01416e+298
53489.1, + 26744.6, 975.766, 0.91717, 1, 0
+

+
+ + Error + Output For non central beta CDF with compiler GNU C++ version 7.1.0 and library + Rmath 3.2.3 and test data Non Central Beta, large parameters +
+

+ CAUTION: + Gross error found at entry 0.
Found: 9.1136e-209 Expected 5.82279e-200 + Error: 6.38913e+08
232.285, 209.056, 232.285, 0.062486, 5.82279e-200, + 1
CAUTION: Gross error found at entry 1.
Found: 4.08108e-115 Expected + 2.37643e-112 Error: 581.304
232.285, 229.962, 290.682, 0.155342, 2.37643e-112, + 1
CAUTION: Gross error found at entry 2.
Found: 1.07549e-93 Expected + 9.53431e-89 Error: 88650
232.285, 232.052, 975.766, 0.378086, 9.53431e-89, + 1
CAUTION: Gross error found at entry 3.
Found: 2.58402e-54 Expected + 8.27353e-53 Error: 31.0181
232.285, 232.285, 1879.05, 0.625865, 8.27353e-53, + 1
CAUTION: Gross error found at entry 4.
Found: 1.93718e-19 Expected + 6.64275e-16 Error: 3428.08
232.285, 232.308, 2308.07, 0.770774, 6.64275e-16, + 1
CAUTION: Gross error found at entry 21.
Found: 8.12962e-240 Expected + 1.82294e-219 Error: 2.24234e+20
975.766, 974.79, 1879.05, 0.331337, 1.82294e-219, + 1
CAUTION: Gross error found at entry 22.
Found: 3.47274e-69 Expected + 1.42183e-67 Error: 39.9426
975.766, 975.766, 2308.07, 0.514323, 1.42183e-67, + 1
CAUTION: Gross error found at entry 23.
Found: 5.86885e-50 Expected + 1.27896e-47 Error: 216.923
975.766, 975.863, 8064.48, 0.753209, 1.27896e-47, + 1
CAUTION: Gross error found at entry 39.
Found: 4.82785e-230 Expected + 1.25446e-213 Error: 2.59838e+16
2308.07, 2308.07, 8064.48, 0.54983, 1.25446e-213, + 1
CAUTION: Gross error found at entry 40.
Found: 1.22971e-87 Expected + 1.82618e-85 Error: 147.505
2308.07, 2308.3, 15674.4, 0.733174, 1.82618e-85, + 1
CAUTION: Gross error found at entry 56.
Found: 2.97337e-127 Expected + 2.56068e-124 Error: 860.205
15674.4, 15675.9, 20005.4, 0.55883, 2.56068e-124, + 1
+

+
+ + Error + Output For non central beta CDF complement with compiler GNU C++ version 7.1.0 + and library Rmath 3.2.3 and test data Non Central Beta, medium parameters +
+

+ CAUTION: + Gross error found at entry 296.
Found: 9.44166e-10 Expected 6.22975e-10 + Error: 0.515577
22.9367, 114.683, 19.5081, 0.480981, 1, 6.22975e-10
+ CAUTION: Gross error found at entry 369.
Found: 2.52234e-10 Expected + 1.40246e-10 Error: 0.79851
27.5277, 20.6457, 0.956697, 0.915111, 1, 1.40246e-10
+ CAUTION: Gross error found at entry 429.
Found: 1.18105e-09 Expected + 7.45745e-10 Error: 0.58372
28.8063, 21.6047, 60.3826, 0.946143, 1, 7.45745e-10
+ CAUTION: Gross error found at entry 430.
Found: 2.44435e-09 Expected + 1.60695e-09 Error: 0.521115
28.8063, 21.6047, 148.129, 0.965121, 1, 1.60695e-09
+ CAUTION: Gross error found at entry 477.
Found: 7.57435e-10 Expected + 7.14133e-11 Error: 9.60635
28.8063, 144.032, 42.3849, 0.504845, 1, 7.14133e-11
+ CAUTION: Gross error found at entry 489.
Found: 4.8561e-10 Expected 5.62991e-11 + Error: 7.62553
31.9438, 23.9579, 44.2068, 0.93835, 1, 5.62991e-11
+ CAUTION: Gross error found at entry 490.
Found: 8.35187e-10 Expected + 1.87483e-10 Error: 3.45473
31.9438, 23.9579, 135.747, 0.961117, 1, 1.87483e-10
+ CAUTION: Gross error found at entry 491.
Found: 1.00174e-09 Expected + 2.38491e-10 Error: 3.20032
31.9438, 23.9579, 191.501, 0.968273, 1, 2.38491e-10
+ CAUTION: Gross error found at entry 537.
Found: 7.29746e-10 Expected + 1.31223e-12 Error: 555.111
31.9438, 159.719, 34.2373, 0.489796, 1, 1.31223e-12
+ CAUTION: Gross error found at entry 538.
Found: 2.49663e-09 Expected + 1.54239e-09 Error: 0.618681
31.9438, 159.719, 126.472, 0.581861, 1, 1.54239e-09
+ CAUTION: Gross error found at entry 549.
Found: 4.16125e-10 Expected + 4.8536e-13 Error: 856.353
38.0822, 28.5617, 34.773, 0.931853, 1, 4.8536e-13
+ CAUTION: Gross error found at entry 550.
Found: 9.69907e-10 Expected + 2.87054e-12 Error: 336.883
38.0822, 28.5617, 127.953, 0.956104, 1, 2.87054e-12
+ CAUTION: Gross error found at entry 551.
Found: 5.90132e-10 Expected + 4.08361e-12 Error: 143.512
38.0822, 28.5617, 183.147, 0.963764, 1, 4.08361e-12
+ CAUTION: Gross error found at entry 597.
Found: 4.67033e-10 Expected + 9.82939e-16 Error: 475139
38.0822, 190.411, 27.0954, 0.475419, 1, 9.82939e-16
+ CAUTION: Gross error found at entry 598.
Found: 9.33207e-10 Expected + 4.03465e-12 Error: 230.298
38.0822, 190.411, 100.733, 0.544491, 1, 4.03465e-12
+ CAUTION: Gross error found at entry 599.
Found: 7.4092e-10 Expected 9.53942e-11 + Error: 6.76693
38.0822, 190.411, 169.826, 0.594614, 1, 9.53942e-11
+ CAUTION: Gross error found at entry 609.
Found: 5.71813e-10 Expected + 1.17207e-14 Error: 48785.7
42.7789, 32.0842, 28.3773, 0.927814, 1, 1.17207e-14
+ CAUTION: Gross error found at entry 610.
Found: 5.16834e-10 Expected + 9.62679e-14 Error: 5367.71
42.7789, 32.0842, 109.376, 0.950307, 1, 9.62679e-14
+ CAUTION: Gross error found at entry 611.
Found: 6.08012e-10 Expected + 1.7454e-13 Error: 3482.51
42.7789, 32.0842, 175.686, 0.960431, 1, 1.7454e-13
+ CAUTION: Gross error found at entry 657.
Found: 5.59489e-10 Expected + 2.86344e-18 Error: 1.95391e+08
42.7789, 213.895, 21.9724, 0.467166, 1, + 2.86344e-18
CAUTION: Gross error found at entry 658.
Found: 5.14798e-10 + Expected 2.50972e-14 Error: 20511.2
42.7789, 213.895, 84.4175, 0.522676, + 1, 2.50972e-14
CAUTION: Gross error found at entry 659.
Found: + 8.49991e-10 Expected 2.38005e-12 Error: 356.131
42.7789, 213.895, 160.056, + 0.576191, 1, 2.38005e-12
CAUTION: Gross error found at entry 671.
+ Found: 3.03281e-10 Expected 2.22036e-15 Error: 136590
44.5963, 33.4472, + 22.4929, 0.924976, 1, 2.22036e-15
CAUTION: Gross error found at entry + 672.
Found: 8.40636e-10 Expected 2.22384e-14 Error: 37800.1
44.5963, + 33.4472, 94.9517, 0.946545, 1, 2.22384e-14
CAUTION: Gross error found + at entry 673.
Found: 8.15021e-10 Expected 4.75974e-14 Error: 17122.2
+ 44.5963, 33.4472, 162.945, 0.95793, 1, 4.75974e-14
CAUTION: Gross error + found at entry 716.
Found: 1.11988e-10 Expected 2.84965e-22 Error: 3.92989e+11
+ 44.5963, 222.981, 0.956697, 0.445432, 1, 2.84965e-22
CAUTION: Gross error + found at entry 717.
Found: 7.99524e-10 Expected 3.04552e-15 Error: 262523
+ 44.5963, 222.981, 78.4454, 0.515267, 1, 3.04552e-15
CAUTION: Gross error + found at entry 718.
Found: 8.0958e-10 Expected 5.89458e-13 Error: 1372.43
+ 44.5963, 222.981, 158.441, 0.57107, 1, 5.89458e-13
*** FURTHER CONTENT + HAS BEEN TRUNCATED FOR BREVITY ***
+

+
+ + Error + Output For non central beta CDF with compiler GNU C++ version 7.1.0 and library + Rmath 3.2.3 and test data Non Central Beta, medium parameters +
+

+ CAUTION: + Gross error found at entry 14.
Found: 4.64669e-35 Expected 7.14875e-33 + Error: 152.846
1.45431, 1.30887, 158.441, 0.0983847, 7.14875e-33, 1
+ CAUTION: Gross error found at entry 15.
Found: 4.66674e-46 Expected 3.13332e-40 + Error: 671416
1.45431, 1.30887, 196.222, 0.09869, 3.13332e-40, 1
+ CAUTION: Gross error found at entry 18.
Found: 5.84342e-28 Expected 3.61559e-27 + Error: 5.18745
1.45431, 1.43976, 159.586, 0.245596, 3.61559e-27, 1
+ CAUTION: Gross error found at entry 19.
Found: 1.72833e-34 Expected 1.76943e-33 + Error: 9.2378
1.45431, 1.43976, 198.576, 0.246444, 1.76943e-33, 1
+ CAUTION: Gross error found at entry 22.
Found: 1.76915e-19 Expected 3.69506e-18 + Error: 19.8861
1.45431, 1.45285, 159.621, 0.491116, 3.69506e-18, 1
+ CAUTION: Gross error found at entry 23.
Found: 2.52007e-25 Expected 2.00482e-22 + Error: 794.544
1.45431, 1.45285, 199.292, 0.492849, 2.00482e-22, 1
+ CAUTION: Gross error found at entry 73.
Found: 2.04477e-34 Expected 2.45287e-33 + Error: 10.9958
7.62448, 6.86203, 148.129, 0.0921776, 2.45287e-33, 1
+ CAUTION: Gross error found at entry 74.
Found: 2.36587e-46 Expected 7.32638e-42 + Error: 30966
7.62448, 6.86203, 193.539, 0.093784, 7.32638e-42, 1
+ CAUTION: Gross error found at entry 76.
Found: 3.29122e-26 Expected 7.418e-25 + Error: 21.5387
7.62448, 7.54824, 148.626, 0.228717, 7.418e-25, 1
+ CAUTION: Gross error found at entry 77.
Found: 1.70126e-32 Expected 1.07666e-31 + Error: 5.32864
7.62448, 7.54824, 193.774, 0.23303, 1.07666e-31, 1
+ CAUTION: Gross error found at entry 79.
Found: 1.3478e-15 Expected 4.21836e-15 + Error: 2.12982
7.62448, 7.61686, 151.548, 0.457773, 4.21836e-15, 1
+ CAUTION: Gross error found at entry 80.
Found: 8.78487e-21 Expected 3.41238e-19 + Error: 37.8438
7.62448, 7.61686, 194.119, 0.465826, 3.41238e-19, 1
+ CAUTION: Gross error found at entry 132.
Found: 3.85783e-23 Expected + 1.54142e-22 Error: 2.99555
19.9593, 17.9634, 44.2068, 0.0698905, 1.54142e-22, + 1
CAUTION: Gross error found at entry 133.
Found: 8.6122e-39 Expected + 3.94361e-38 Error: 3.5791
19.9593, 17.9634, 135.747, 0.0829178, 3.94361e-38, + 1
CAUTION: Gross error found at entry 134.
Found: 3.61781e-52 Expected + 3.98669e-48 Error: 11018.6
19.9593, 17.9634, 191.501, 0.0864897, 3.98669e-48, + 1
CAUTION: Gross error found at entry 135.
Found: 2.07122e-15 Expected + 7.08614e-15 Error: 2.42124
19.9593, 19.7597, 55.6996, 0.176444, 7.08614e-15, + 1
CAUTION: Gross error found at entry 136.
Found: 2.28223e-27 Expected + 2.16759e-25 Error: 93.977
19.9593, 19.7597, 136.272, 0.20393, 2.16759e-25, + 1
CAUTION: Gross error found at entry 137.
Found: 6.4251e-34 Expected + 4.0064e-33 Error: 5.23554
19.9593, 19.7597, 191.898, 0.213398, 4.0064e-33, + 1
CAUTION: Gross error found at entry 139.
Found: 2.1734e-14 Expected + 4.65637e-14 Error: 1.14243
19.9593, 19.9394, 145.168, 0.410858, 4.65637e-14, + 1
CAUTION: Gross error found at entry 140.
Found: 2.18388e-19 Expected + 5.1677e-18 Error: 22.663
19.9593, 19.9394, 192.978, 0.426523, 5.1677e-18, + 1
CAUTION: Gross error found at entry 192.
Found: 3.29537e-23 Expected + 8.29996e-23 Error: 1.51867
22.4174, 20.1757, 34.773, 0.0661999, 8.29996e-23, + 1
CAUTION: Gross error found at entry 193.
Found: 7.86091e-39 Expected + 2.77686e-38 Error: 2.5325
22.4174, 20.1757, 127.953, 0.0809614, 2.77686e-38, + 1
CAUTION: Gross error found at entry 194.
Found: 3.0161e-51 Expected + 4.5396e-48 Error: 1504.12
22.4174, 20.1757, 183.147, 0.0848857, 4.5396e-48, + 1
CAUTION: Gross error found at entry 195.
Found: 3.08022e-14 Expected + 1.42713e-13 Error: 3.6332
22.4174, 22.1932, 37.6764, 0.162145, 1.42713e-13, + 1
CAUTION: Gross error found at entry 196.
Found: 8.89935e-28 Expected + 2.56187e-25 Error: 286.871
22.4174, 22.1932, 131.096, 0.199361, 2.56187e-25, + 1
CAUTION: Gross error found at entry 197.
Found: 9.34392e-34 Expected + 6.14831e-33 Error: 5.58001
22.4174, 22.1932, 186.799, 0.209601, 6.14831e-33, + 1
CAUTION: Gross error found at entry 199.
Found: 2.79341e-13 Expected + 4.79277e-13 Error: 0.71574
22.4174, 22.395, 131.148, 0.398015, 4.79277e-13, + 1
CAUTION: Gross error found at entry 200.
Found: 3.13989e-19 Expected + 7.01608e-18 Error: 21.345
22.4174, 22.395, 191.433, 0.419933, 7.01608e-18, + 1
*** FURTHER CONTENT HAS BEEN TRUNCATED FOR BREVITY ***
+

+
+ + Error + Output For non central chi squared CDF complement with compiler GNU C++ version + 7.1.0 and library Rmath 3.2.3 and test data Non Central Chi Squared, large + parameters +
+

+ CAUTION: + Gross error found at entry 12.
Found: 0 Expected 1.17655e-12 Error: 5.28771e+295
+ 101.815, 5236.73, 6406.25, 1, 1.17655e-12
CAUTION: Gross error found + at entry 13.
Found: 0 Expected 1.79374e-44 Error: 8.06149e+263
+ 101.815, 9735.22, 12788.2, 1, 1.79374e-44
CAUTION: Gross error found + at entry 35.
Found: 2.58682e-14 Expected 1.84404e-61 Error: 1.4028e+47
+ 107.623, 122.456, 920.317, 1, 1.84404e-61
CAUTION: Gross error found + at entry 36.
Found: 0 Expected 2.30757e-102 Error: 1.03707e+206
+ 107.623, 156.292, 1319.58, 1, 2.30757e-102
CAUTION: Gross error found + at entry 52.
Found: 0 Expected 6.40952e-24 Error: 2.88059e+284
+ 114.68, 417.884, 1065.13, 1, 6.40952e-24
CAUTION: Gross error found at + entry 53.
Found: 0 Expected 1.02366e-98 Error: 4.60058e+209
114.68, + 669.781, 2353.38, 1, 1.02366e-98
CAUTION: Gross error found at entry + 69.
Found: 0 Expected 6.55726e-39 Error: 2.94699e+269
118.032, + 3168.71, 4930.11, 1, 6.55726e-39
CAUTION: Gross error found at entry + 85.
Found: 0 Expected 7.30688e-22 Error: 3.28388e+286
163.004, + 9735.22, 11877.9, 1, 7.30688e-22
CAUTION: Gross error found at entry + 86.
Found: 0 Expected 1.17171e-111 Error: 5.26596e+196
163.004, + 25344.1, 33159.2, 1, 1.17171e-111
CAUTION: Gross error found at entry + 108.
Found: 1.12355e-13 Expected 2.67349e-61 Error: 4.20255e+47
+ 256.292, 122.456, 1136.25, 1, 2.67349e-61
CAUTION: Gross error found + at entry 109.
Found: 1.16462e-13 Expected 8.30595e-116 Error: 1.40216e+102
+ 256.292, 156.292, 1650.34, 1, 8.30595e-116
CAUTION: Gross error found + at entry 124.
Found: 1.05804e-13 Expected 1.01672e-15 Error: 103.064
+ 517.884, 417.884, 1403.65, 1, 1.01672e-15
CAUTION: Gross error found + at entry 125.
Found: 2.00728e-13 Expected 3.50192e-56 Error: 5.73194e+42
+ 517.884, 669.781, 2375.33, 1, 3.50192e-56
CAUTION: Gross error found + at entry 141.
Found: 0 Expected 1.36924e-20 Error: 6.15368e+287
+ 769.781, 3168.71, 5120.04, 1, 1.36924e-20
CAUTION: Gross error found + at entry 142.
Found: 0 Expected 3.19215e-72 Error: 1.43463e+236
+ 769.781, 5236.73, 9009.76, 1, 3.19215e-72
CAUTION: Gross error found + at entry 157.
Found: 0 Expected 7.26231e-08 Error: 3.26385e+300
+ 1223.88, 9735.22, 12055, 1, 7.26231e-08
CAUTION: Gross error found at + entry 158.
Found: 0 Expected 4.5906e-56 Error: 2.06312e+252
1223.88, + 25344.1, 31881.6, 1, 4.5906e-56
CAUTION: Gross error found at entry 194.
+ Found: 0 Expected 5.34714e-12 Error: 2.40313e+296
9835.22, 122.456, 10953.4, + 1, 5.34714e-12
CAUTION: Gross error found at entry 195.
Found: + 0 Expected 4.84412e-40 Error: 2.17706e+268
9835.22, 156.292, 11989.8, + 1, 4.84412e-40
CAUTION: Gross error found at entry 196.
Found: + 0 Expected 5.50199e-83 Error: 2.47272e+225
9835.22, 417.884, 13329, 1, + 5.50199e-83
CAUTION: Gross error found at entry 197.
Found: 0 Expected + 1.28192e-205 Error: 5.76124e+102
9835.22, 669.781, 15757.5, 1, 1.28192e-205
+ CAUTION: Gross error found at entry 211.
Found: 0 Expected 3.83272e-28 + Error: 1.72251e+280
25444.1, 1123.88, 29224.8, 1, 3.83272e-28
CAUTION: + Gross error found at entry 212.
Found: 0 Expected 1.69815e-101 Error: + 7.63188e+206
25444.1, 3168.71, 34335.4, 1, 1.69815e-101
CAUTION: + Gross error found at entry 213.
Found: 0 Expected 1.09245e-217 Error: + 4.90974e+90
25444.1, 5236.73, 39885.1, 1, 1.09245e-217
+

+
+ + Error + Output For non central chi squared CDF complement with compiler GNU C++ version + 7.1.0 and library Rmath 3.2.3 and test data Non Central Chi Squared, medium + parameters +
+

+ CAUTION: + Gross error found at entry 36.
Found: 1.11022e-14 Expected 1.30043e-26 + Error: 8.53738e+11
1.95191, 109.376, 445.313, 1, 1.30043e-26
CAUTION: + Gross error found at entry 37.
Found: 0 Expected 1.45478e-39 Error: 6.53812e+268
+ 1.95191, 109.444, 556.98, 1, 1.45478e-39
CAUTION: Gross error found at + entry 54.
Found: 2.91989e-14 Expected 4.25949e-21 Error: 6.85501e+06
+ 1.95191, 159.586, 484.613, 1, 4.25949e-21
CAUTION: Gross error found + at entry 55.
Found: 0 Expected 1.33424e-37 Error: 5.99639e+270
+ 1.95191, 159.621, 646.292, 1, 1.33424e-37
CAUTION: Gross error found + at entry 56.
Found: 1.25455e-14 Expected 1.95903e-56 Error: 6.40393e+41
+ 1.95191, 160.056, 810.04, 1, 1.95903e-56
CAUTION: Gross error found at + entry 73.
Found: 0 Expected 4.34735e-25 Error: 1.9538e+283
1.95191, + 193.539, 586.473, 1, 4.34735e-25
CAUTION: Gross error found at entry + 74.
Found: 0 Expected 4.66119e-45 Error: 2.09485e+263
1.95191, + 193.774, 782.902, 1, 4.66119e-45
CAUTION: Gross error found at entry + 75.
Found: 4.77396e-15 Expected 8.92248e-68 Error: 5.35048e+52
+ 1.95191, 194.119, 980.352, 1, 8.92248e-68
CAUTION: Gross error found + at entry 111.
Found: 0 Expected 3.1064e-15 Error: 1.39609e+293
+ 20.4105, 84.4175, 314.484, 1, 3.1064e-15
CAUTION: Gross error found at + entry 112.
Found: 0 Expected 7.50903e-29 Error: 3.37473e+279
20.4105, + 94.9517, 461.449, 1, 7.50903e-29
CAUTION: Gross error found at entry + 113.
Found: 3.77476e-15 Expected 1.74225e-43 Error: 2.1666e+28
+ 20.4105, 97.0751, 587.428, 1, 1.74225e-43
CAUTION: Gross error found + at entry 130.
Found: 8.88178e-16 Expected 4.13277e-23 Error: 2.14911e+07
+ 20.4105, 151.548, 515.876, 1, 4.13277e-23
CAUTION: Gross error found + at entry 131.
Found: 1.75415e-14 Expected 1.92146e-41 Error: 9.12928e+26
+ 20.4105, 152.75, 692.642, 1, 1.92146e-41
CAUTION: Gross error found at + entry 132.
Found: 1.38778e-14 Expected 7.09864e-64 Error: 1.95499e+49
+ 20.4105, 158.441, 894.26, 1, 7.09864e-64
CAUTION: Gross error found at + entry 149.
Found: 2.22045e-16 Expected 8.74501e-28 Error: 2.5391e+11
+ 20.4105, 191.433, 635.532, 1, 8.74501e-28
CAUTION: Gross error found + at entry 150.
Found: 0 Expected 6.94227e-50 Error: 3.12002e+258
+ 20.4105, 191.501, 847.648, 1, 6.94227e-50
CAUTION: Gross error found + at entry 151.
Found: 3.40838e-14 Expected 5.3889e-75 Error: 6.32482e+60
+ 20.4105, 191.898, 1061.55, 1, 5.3889e-75
CAUTION: Gross error found at + entry 206.
Found: 5.88418e-15 Expected 2.69136e-22 Error: 2.18632e+07
+ 22.8625, 141.209, 492.215, 1, 2.69136e-22
CAUTION: Gross error found + at entry 207.
Found: 3.60822e-14 Expected 1.64941e-40 Error: 2.18759e+26
+ 22.8625, 145.168, 672.121, 1, 1.64941e-40
CAUTION: Gross error found + at entry 208.
Found: 3.73035e-14 Expected 1.6094e-61 Error: 2.31784e+47
+ 22.8625, 148.129, 854.96, 1, 1.6094e-61
CAUTION: Gross error found at + entry 225.
Found: 0 Expected 3.73672e-27 Error: 1.67937e+281
22.8625, + 182.675, 616.613, 1, 3.73672e-27
CAUTION: Gross error found at entry + 226.
Found: 0 Expected 8.85688e-49 Error: 3.98049e+259
22.8625, + 183.147, 824.038, 1, 8.85688e-49
CAUTION: Gross error found at entry + 227.
Found: 0 Expected 2.29176e-74 Error: 1.02997e+234
22.8625, + 186.799, 1048.31, 1, 2.29176e-74
CAUTION: Gross error found at entry + 282.
Found: 0 Expected 2.18831e-21 Error: 9.8348e+286
23.3804, + 132.721, 468.305, 1, 2.18831e-21
CAUTION: Gross error found at entry + 283.
Found: 0 Expected 1.3071e-38 Error: 5.87439e+269
23.3804, + 135.747, 636.51, 1, 1.3071e-38
CAUTION: Gross error found at entry 284.
+ Found: 1.84297e-14 Expected 8.27843e-58 Error: 2.22623e+43
23.3804, 136.272, + 798.262, 1, 8.27843e-58
CAUTION: Gross error found at entry 301.
+ Found: 0 Expected 9.85282e-26 Error: 4.42808e+282
23.3804, 169.826, 579.619, + 1, 9.85282e-26
CAUTION: Gross error found at entry 302.
Found: + 0 Expected 4.8094e-47 Error: 2.16145e+261
23.3804, 174.486, 791.465, + 1, 4.8094e-47
CAUTION: Gross error found at entry 303.
Found: 1.11022e-16 + Expected 6.70476e-71 Error: 1.65587e+54
23.3804, 175.686, 995.333, 1, + 6.70476e-71
CAUTION: Gross error found at entry 358.
Found: 0 Expected + 3.9702e-21 Error: 1.7843e+287
26.2704, 126.472, 458.227, 1, 3.9702e-21
+ CAUTION: Gross error found at entry 359.
*** FURTHER CONTENT HAS BEEN + TRUNCATED FOR BREVITY ***
+

+
+ + Error + Output For non central t CDF complement with compiler GNU C++ version 7.1.0 + and library Rmath 3.2.3 and test data Non Central T +
+

+ CAUTION: + Gross error found at entry 56.
Found: 0.000186411 Expected 7.85192e-05 + Error: 1.37408
61.6335, 46.2251, 68.8608, 0.999921, 7.85192e-05
+ CAUTION: Gross error found at entry 75.
Found: 0.00011439 Expected 5.05344e-05 + Error: 1.26361
80.8418, 60.6313, 86.1278, 0.999949, 5.05344e-05
+ CAUTION: Gross error found at entry 93.
Found: 0.000655162 Expected 0.000423927 + Error: 0.545458
100.733, 50.3663, 65.7619, 0.999576, 0.000423927
+ CAUTION: Gross error found at entry 112.
Found: 0.000518249 Expected + 0.00034473 Error: 0.503348
127.953, 63.9764, 81.0824, 0.999655, 0.00034473
+

+
+ + Error + Output For non central t CDF with compiler GNU C++ version 7.1.0 and library + Rmath 3.2.3 and test data Non Central T +
+

+ CAUTION: + Gross error found at entry 74.
Found: 0.000830062 Expected 0.000522858 + Error: 0.587549
79.7478, -39.8739, -53.8066, 0.000522858, 0.999477
+ CAUTION: Gross error found at entry 94.
Found: 7.69292e-05 Expected 3.54024e-05 + Error: 1.17299
101.191, -75.8936, -104.104, 3.54024e-05, 0.999965
+ CAUTION: Gross error found at entry 113.
Found: 5.07713e-05 Expected + 2.4439e-05 Error: 1.07747
128.792, -96.5942, -128.112, 2.4439e-05, 0.999976
+ CAUTION: Gross error found at entry 132.
Found: 4.08612e-05 Expected + 2.01542e-05 Error: 1.02743
146.56, -109.92, -143.392, 2.01542e-05, 0.99998
+ CAUTION: Gross error found at entry 151.
Found: 3.55146e-05 Expected + 1.7803e-05 Error: 0.994869
159.586, -119.689, -154.522, 1.7803e-05, 0.999982
+ CAUTION: Gross error found at entry 170.
Found: 3.03671e-05 Expected + 1.55023e-05 Error: 0.958873
175.686, -131.765, -168.211, 1.55023e-05, + 0.999984
CAUTION: Gross error found at entry 189.
Found: 2.61339e-05 + Expected 1.3581e-05 Error: 0.924298
192.978, -144.733, -182.834, 1.3581e-05, + 0.999986
+

+
+ + Error + Output For polygamma with compiler GNU C++ version 7.1.0 and library Rmath + 3.2.3 and test data Mathematica Data - Large orders and other bug cases +
+

+ CAUTION: + Found non-finite result, when a finite value was expected at entry 0
+ Found: -nan Expected 2.07309e+257 Error: 1.79769e+308
171, 2, 2.07309e+257
+ CAUTION: Gross error found at entry 0.
Found: -nan Expected 2.07309e+257 + Error: 1.79769e+308
171, 2, 2.07309e+257
CAUTION: Found non-finite + result, when a finite value was expected at entry 1
Found: -nan Expected + 7.42912e+188 Error: 1.79769e+308
171, 5, 7.42912e+188
CAUTION: + Gross error found at entry 1.
Found: -nan Expected 7.42912e+188 Error: + 1.79769e+308
171, 5, 7.42912e+188
CAUTION: Found non-finite result, + when a finite value was expected at entry 2
Found: -nan Expected -4.81295e+247 + Error: 1.79769e+308
166, 2, -4.81295e+247
CAUTION: Gross error + found at entry 2.
Found: -nan Expected -4.81295e+247 Error: 1.79769e+308
+ 166, 2, -4.81295e+247
CAUTION: Found non-finite result, when a finite + value was expected at entry 3
Found: -nan Expected -1.88439e+218 Error: + 1.79769e+308
166, 3, -1.88439e+218
CAUTION: Gross error found at + entry 3.
Found: -nan Expected -1.88439e+218 Error: 1.79769e+308
+ 166, 3, -1.88439e+218
CAUTION: Found non-finite result, when a finite + value was expected at entry 4
Found: -nan Expected 7.53144e+74 Error: + 1.79769e+308
171, 23, 7.53144e+74
CAUTION: Gross error found at + entry 4.
Found: -nan Expected 7.53144e+74 Error: 1.79769e+308
171, + 23, 7.53144e+74
CAUTION: Found non-finite result, when a finite value + was expected at entry 5
Found: -nan Expected -6.52661e-66 Error: 1.79769e+308
+ 168, 150, -6.52661e-66
CAUTION: Gross error found at entry 5.
Found: + -nan Expected -6.52661e-66 Error: 1.79769e+308
168, 150, -6.52661e-66
+ CAUTION: Found non-finite result, when a finite value was expected at entry + 6
Found: -nan Expected 9.2734e-88 Error: 1.79769e+308
169, 202, + 9.2734e-88
CAUTION: Gross error found at entry 6.
Found: -nan Expected + 9.2734e-88 Error: 1.79769e+308
169, 202, 9.2734e-88
Outside supported + domain
20, -9.5, -0.00103076
Outside supported domain
21, + -9.5, 4.28582e+26
Outside supported domain
22, -9.5, -0.00419144
+ Outside supported domain
23, -9.5, 8.6745e+29
Outside supported + domain
24, -9.5, -0.0204825
Outside supported domain
25, + -9.5, 2.08188e+33
Outside supported domain
26, -9.5, -0.118403
+ Outside supported domain
27, -9.5, 5.84592e+36
Outside supported + domain
28, -9.5, -0.798969
Outside supported domain
29, -9.5, + 1.89875e+40
Outside supported domain
30, -9.5, -6.22245
+

+
+ + Error + Output For polygamma with compiler GNU C++ version 7.1.0 and library Rmath + 3.2.3 and test data Mathematica Data - large negative arguments +
+

+ Outside + supported domain
124, -1.5, 7.63705e+240
Outside supported domain
+ 124, -2.5, 7.63705e+240
Outside supported domain
124, -3.5, 7.63705e+240
+ Outside supported domain
124, -4.5, 7.63705e+240
Outside supported + domain
124, -5.5, 7.63705e+240
Outside supported domain
124, + -6.5, 7.63705e+240
Outside supported domain
124, -7.5, 7.63705e+240
+ Outside supported domain
124, -8.5, 7.63705e+240
Outside supported + domain
124, -9.5, 7.63705e+240
Outside supported domain
124, + -10.5, 7.63705e+240
Outside supported domain
124, -11.5, 7.63705e+240
+ Outside supported domain
124, -12.5, 7.63705e+240
Outside supported + domain
124, -13.5, 7.63705e+240
Outside supported domain
+ 124, -14.5, 7.63705e+240
Outside supported domain
124, -15.5, 7.63705e+240
+ Outside supported domain
124, -16.5, 7.63705e+240
Outside supported + domain
124, -17.5, 7.63705e+240
Outside supported domain
+ 124, -18.5, 7.63705e+240
Outside supported domain
124, -19.5, 7.63705e+240
+ Outside supported domain
124, -20.5, 7.63705e+240
Outside supported + domain
124, -1.5, -7.63705e+240
Outside supported domain
+ 124, -2.5, -7.63705e+240
Outside supported domain
124, -3.5, -7.63705e+240
+ Outside supported domain
124, -4.5, -7.63705e+240
Outside supported + domain
124, -5.5, -7.63705e+240
Outside supported domain
+ 124, -6.5, -7.63705e+240
Outside supported domain
124, -7.5, -7.63705e+240
+ Outside supported domain
124, -8.5, -7.63705e+240
Outside supported + domain
124, -9.5, -7.63705e+240
Outside supported domain
+ 124, -10.5, -7.63705e+240
Outside supported domain
124, -11.5, + -7.63705e+240
Outside supported domain
124, -12.5, -7.63705e+240
+ Outside supported domain
124, -13.5, -7.63705e+240
Outside supported + domain
124, -14.5, -7.63705e+240
Outside supported domain
+ 124, -15.5, -7.63705e+240
Outside supported domain
124, -16.5, + -7.63705e+240
Outside supported domain
124, -17.5, -7.63705e+240
+ Outside supported domain
124, -18.5, -7.63705e+240
Outside supported + domain
124, -19.5, -7.63705e+240
Outside supported domain
+ 124, -20.5, -7.63705e+240
Outside supported domain
1, -0.5, 8.9348
+ Outside supported domain
2, -0.5, -0.828797
Outside supported domain
+ 3, -0.5, 193.409
Outside supported domain
4, -0.5, -3.47425
+ Outside supported domain
5, -0.5, 15371.1
Outside supported domain
+ 6, -0.5, -43.4579
Outside supported domain
7, -0.5, 2.58068e+06
+ Outside supported domain
8, -0.5, -1059.96
Outside supported domain
+ 9, -0.5, 7.43185e+08
Outside supported domain
10, -0.5, -42108.9
+ Outside supported domain
11, -0.5, 3.26999e+11
Outside supported + domain
12, -0.5, -2.46448e+06
Outside supported domain
13, + -0.5, 2.04047e+14
Outside supported domain
14, -0.5, -1.9918e+08
+ Outside supported domain
15, -0.5, 1.71399e+17
Outside supported + domain
16, -0.5, -2.12394e+10
Outside supported domain
17, + -0.5, 1.86483e+20
Outside supported domain
18, -0.5, -2.88824e+12
+ Outside supported domain
19, -0.5, 2.55108e+23
Outside supported + domain
20, -0.5, -4.87773e+14
Outside supported domain
21, + -0.5, 4.28582e+26
Outside supported domain
1, -0.5, 8.9348
+ Outside supported domain
2, -0.5, -0.828843
Outside supported domain
+ 3, -0.5, 193.409
Outside supported domain
4, -0.5, -3.47791
+ Outside supported domain
5, -0.5, 15371.1
Outside supported domain
+ 6, -0.5, -44.0732
Outside supported domain
7, -0.5, 2.58068e+06
+ Outside supported domain
8, -0.5, -1237.15
Outside supported domain
+ 9, -0.5, 7.43185e+08
Outside supported domain
10, -0.5, -120071
+ Outside supported domain
11, -0.5, 3.26999e+11
Outside supported + domain
12, -0.5, -5.11131e+07
Outside supported domain
13, + -0.5, 2.04047e+14
Outside supported domain
14, -0.5, -4.1064e+10
+ Outside supported domain
15, -0.5, 1.71399e+17
Outside supported + domain
16, -0.5, -4.44822e+13
Outside supported domain
17, + -0.5, 1.86483e+20
Outside supported domain
18, -0.5, -6.08254e+16
+ Outside supported domain
19, -0.5, 2.55108e+23
Outside supported + domain
20, -0.5, -1.02182e+20
Outside supported domain
21, + -0.5, 4.28582e+26
Outside supported domain
1, -0.5, 8.9348
+ Outside supported domain
2, -0.5, -0.828751
Outside supported domain
+ 3, -0.5, 193.409
Outside supported domain
4, -0.5, -3.47059
+ Outside supported domain
*** FURTHER CONTENT HAS BEEN TRUNCATED FOR BREVITY + ***
+

+
+ + Error + Output For polygamma with compiler GNU C++ version 7.1.0 and library Rmath + 3.2.3 and test data Mathematica Data - negative arguments +
+

+ Outside + supported domain
1, -12.75, 19.6638
Outside supported domain
+ 1, -12.25, 19.6608
Outside supported domain
1, -11.75, 19.6576
+ Outside supported domain
1, -11.25, 19.6542
Outside supported domain
+ 1, -10.75, 19.6504
Outside supported domain
1, -10.25, 19.6463
+ Outside supported domain
1, -9.75, 19.6417
Outside supported domain
+ 1, -9.25, 19.6367
Outside supported domain
1, -8.75, 19.6312
+ Outside supported domain
1, -8.25, 19.625
Outside supported domain
+ 1, -7.75, 19.6181
Outside supported domain
1, -7.25, 19.6104
+ Outside supported domain
1, -6.75, 19.6015
Outside supported domain
+ 1, -6.25, 19.5913
Outside supported domain
1, -5.75, 19.5795
+ Outside supported domain
1, -5.25, 19.5657
Outside supported domain
+ 1, -4.75, 19.5493
Outside supported domain
1, -4.25, 19.5294
+ Outside supported domain
1, -3.75, 19.505
Outside supported domain
+ 1, -3.25, 19.4741
Outside supported domain
1, -2.75, 19.4339
+ Outside supported domain
1, -2.25, 19.3794
Outside supported domain
+ 1, -1.75, 19.3016
Outside supported domain
1, -1.25, 19.1819
+ Outside supported domain
1, -0.75, 18.9751
Outside supported domain
+ 1, -0.25, 18.5419
Outside supported domain
2, -12.75, -124.031
+ Outside supported domain
2, -12.25, 124.019
Outside supported domain
+ 2, -11.75, -124.032
Outside supported domain
2, -11.25, 124.018
+ Outside supported domain
2, -10.75, -124.033
Outside supported + domain
2, -10.25, 124.016
Outside supported domain
2, -9.75, + -124.035
Outside supported domain
2, -9.25, 124.015
Outside + supported domain
2, -8.75, -124.037
Outside supported domain
+ 2, -8.25, 124.012
Outside supported domain
2, -7.75, -124.04
+ Outside supported domain
2, -7.25, 124.009
Outside supported domain
+ 2, -6.75, -124.044
Outside supported domain
2, -6.25, 124.003
+ Outside supported domain
2, -5.75, -124.051
Outside supported domain
+ 2, -5.25, 123.995
Outside supported domain
2, -4.75, -124.061
+ Outside supported domain
2, -4.25, 123.981
Outside supported domain
+ 2, -3.75, -124.08
Outside supported domain
2, -3.25, 123.955
+ Outside supported domain
2, -2.75, -124.118
Outside supported domain
+ 2, -2.25, 123.897
Outside supported domain
2, -1.75, -124.214
+ Outside supported domain
2, -1.25, 123.721
Outside supported domain
+ 2, -0.75, -124.587
Outside supported domain
2, -0.25, 122.697
+ Outside supported domain
3, -12.75, 1558.54
Outside supported domain
+ 3, -12.25, 1558.54
Outside supported domain
3, -11.75, 1558.54
+ Outside supported domain
3, -11.25, 1558.54
Outside supported domain
+ 3, -10.75, 1558.54
Outside supported domain
3, -10.25, 1558.54
+ Outside supported domain
3, -9.75, 1558.54
Outside supported domain
+ 3, -9.25, 1558.54
Outside supported domain
3, -8.75, 1558.54
+ Outside supported domain
3, -8.25, 1558.54
Outside supported domain
+ 3, -7.75, 1558.54
Outside supported domain
3, -7.25, 1558.54
+ Outside supported domain
3, -6.75, 1558.54
Outside supported domain
+ 3, -6.25, 1558.54
Outside supported domain
3, -5.75, 1558.54
+ Outside supported domain
3, -5.25, 1558.54
Outside supported domain
+ 3, -4.75, 1558.53
Outside supported domain
3, -4.25, 1558.53
+ Outside supported domain
3, -3.75, 1558.52
Outside supported domain
+ 3, -3.25, 1558.51
Outside supported domain
3, -2.75, 1558.49
+ Outside supported domain
3, -2.25, 1558.46
Outside supported domain
+ 3, -1.75, 1558.38
Outside supported domain
3, -1.25, 1558.22
+ Outside supported domain
3, -0.75, 1557.75
Outside supported domain
+ 3, -0.25, 1555.76
Outside supported domain
4, -12.75, -24481.6
+ Outside supported domain
4, -12.25, 24481.6
Outside supported domain
+ 4, -11.75, -24481.6
Outside supported domain
4, -11.25, 24481.6
+ Outside supported domain
4, -10.75, -24481.6
Outside supported + domain
4, -10.25, 24481.6
Outside supported domain
4, -9.75, + -24481.6
Outside supported domain
4, -9.25, 24481.6
Outside + supported domain
4, -8.75, -24481.6
Outside supported domain
+ 4, -8.25, 24481.6
Outside supported domain
4, -7.75, -24481.6
+ Outside supported domain
4, -7.25, 24481.6
Outside supported domain
+ 4, -6.75, -24481.6
Outside supported domain
4, -6.25, 24481.6
+ Outside supported domain
4, -5.75, -24481.6
Outside supported domain
+ 4, -5.25, 24481.6
Outside supported domain
*** FURTHER CONTENT + HAS BEEN TRUNCATED FOR BREVITY ***
+

+
+ + Error + Output For polygamma with compiler GNU C++ version 7.1.0 and library Rmath + 3.2.3 and test data Mathematica Data - large arguments +
+

+ CAUTION: + Gross error found at entry 211.
Found: -0 Expected -8.44974e-268 Error: + 3.79751e+40
30, 8.58993e+09, -8.44974e-268
CAUTION: Gross error + found at entry 212.
Found: -0 Expected -7.86943e-277 Error: 3.5367e+31
+ 30, 1.71799e+10, -7.86943e-277
CAUTION: Gross error found at entry 213.
+ Found: -0 Expected -7.32898e-286 Error: 3.29381e+22
30, 3.43597e+10, + -7.32898e-286
CAUTION: Gross error found at entry 214.
Found: -0 + Expected -6.82564e-295 Error: 3.0676e+13
30, 6.87195e+10, -6.82564e-295
+ CAUTION: Gross error found at entry 215.
Found: -0 Expected -6.35687e-304 + Error: 28568.3
30, 1.37439e+11, -6.35687e-304
+

+
+ + Error + Output For cyl_bessel_i with compiler GNU C++ version 7.1.0 and library GSL + 2.1 and test data Bessel Iv: Mathworld Data (large values) +
+

+ domain + error
-1, 3.72917e-155, 1.86459e-155
domain error
-1.125, + 3.72917e-155, -1.34964e+173
+

+
+ + Error + Output For cyl_bessel_i with compiler GNU C++ version 7.1.0 and library GSL + 2.1 and test data Bessel Iv: Random Data +
+

+ domain + error
-80.4919, 24.7501, 4.18698e+28
domain error
-80.4919, + 63.7722, 2.03248e+06
domain error
-74.6026, 24.7501, 7.20977e+23
+ domain error
-74.6026, 63.7722, 8.7549e+08
domain error
-72.9046, + 24.7501, 1.04535e+22
domain error
-72.9046, 63.7722, 4.7162e+09
+ domain error
-62.3236, 24.7501, 3.65147e+14
domain error
+ -62.3236, 63.7722, 8.56683e+13
domain error
-55.7932, 24.7501, + -7.70364e+09
domain error
-55.7932, 63.7722, 1.95969e+16
+ domain error
-44.3004, 9.50706, 2.93478e+22
domain error
+ -44.3004, 24.7501, 640.568
domain error
-44.3004, 63.7722, 8.05557e+19
+ domain error
-38.3666, 5.11399, 2.89105e+27
domain error
+ -38.3666, 9.50706, 8.80632e+16
domain error
-38.3666, 24.7501, + 0.389004
domain error
-38.3666, 63.7722, 3.06303e+21
underflow
+ 81.1584, 0.00177219, 0
underflow
81.1584, 0.00221773, 0
underflow
+ 81.1584, 0.0074445, 6.08857e-319
underflow
82.6752, 0.00177219, + 0
underflow
82.6752, 0.00221773, 0
underflow
82.6752, + 0.0074445, 0
underflow
91.5014, 0.00177219, 0
underflow
+ 91.5014, 0.00221773, 0
underflow
91.5014, 0.0074445, 0
underflow
+ 91.5014, 0.014336, 0
underflow
91.5014, 0.0176092, 0
underflow
+ 92.9777, 0.00177219, 0
underflow
92.9777, 0.00221773, 0
underflow
+ 92.9777, 0.0074445, 0
underflow
92.9777, 0.014336, 0
underflow
+ 92.9777, 0.0176092, 0
underflow
93.539, 0.00177219, 0
underflow
+ 93.539, 0.00221773, 0
underflow
93.539, 0.0074445, 0
underflow
+ 93.539, 0.014336, 0
underflow
93.539, 0.0176092, 0
underflow
+ 93.7736, 0.00177219, 0
underflow
93.7736, 0.00221773, 0
underflow
+ 93.7736, 0.0074445, 0
underflow
93.7736, 0.014336, 0
underflow
+ 93.7736, 0.0176092, 0
underflow
98.5763, 0.00177219, 0
underflow
+ 98.5763, 0.00221773, 0
underflow
98.5763, 0.0074445, 0
underflow
+ 98.5763, 0.014336, 0
underflow
98.5763, 0.0176092, 0
underflow
+ 99.2923, 0.00177219, 0
underflow
99.2923, 0.00221773, 0
underflow
+ 99.2923, 0.0074445, 0
underflow
99.2923, 0.014336, 0
underflow
+ 99.2923, 0.0176092, 0
+

+
+ + Error + Output For cyl_bessel_i with compiler GNU C++ version 7.1.0 and library GSL + 2.1 and test data Bessel In: Random Data +
+

+ underflow
+ 70, 0.00177219, 1.75887e-314
underflow
73, 0.00177219, 0
+ underflow
73, 0.00221773, 4.24896e-322
underflow
76, 0.00177219, + 0
underflow
76, 0.00221773, 0
underflow
79, 0.00177219, + 0
underflow
79, 0.00221773, 0
underflow
79, 0.0074445, + 1.38676e-309
underflow
82, 0.00177219, 0
underflow
+ 82, 0.00221773, 0
underflow
82, 0.0074445, 1.33398e-322
underflow
+ 85, 0.00177219, 0
underflow
85, 0.00221773, 0
underflow
+ 85, 0.0074445, 0
underflow
85, 0.014336, 1.81568e-311
underflow
+ 88, 0.00177219, 0
underflow
88, 0.00221773, 0
underflow
+ 88, 0.0074445, 0
underflow
88, 0.014336, 9.88131e-324
underflow
+ 88, 0.0176092, 7.34647e-316
+

+
+ + Error + Output For cyl_bessel_i with compiler GNU C++ version 7.1.0 and library GSL + 2.1 and test data Bessel Iv: Mathworld Data +
+

+ domain + error
-4.99902, 2.125, 0.0267921
domain error
-5.5, 10, 597.578
+ domain error
-5.5, 100, 9.22363e+41
domain error
-10.0003, + 0.000976562, 1.41474e+35
domain error
-10.0003, 50, 1.07153e+20
+ domain error
-141.4, 100, 2066.28
+

+
+ + Error + Output For cyl_bessel_i (integer orders) with compiler GNU C++ version 7.1.0 + and library GSL 2.1 and test data Bessel In: Mathworld Data (Integer Version) +
+

+ underflow
+ 10, 1e-100, 0
+

+
+ + Error + Output For cyl_bessel_i with compiler GNU C++ version 7.1.0 and library GSL + 2.1 and test data Bessel In: Mathworld Data +
+

+ domain + error
-2, 0, 0
domain error
-5, 100, 9.47009e+41
domain + error
-5, -1, -0.000271463
domain error
10, -5, 0.00458004
+ domain error
-100, -200, 4.35275e+74
underflow
10, 1e-100, + 0
+

+
+ + Error + Output For cyl_bessel_i with compiler GNU C++ version 7.1.0 and library GSL + 2.1 and test data Bessel I1: Mathworld Data +
+

+ domain + error
1, -2, -1.59064
domain error
1, -8, -399.873
+ domain error
1, -10, -2670.99
+

+
+ + Error + Output For cyl_bessel_i with compiler GNU C++ version 7.1.0 and library GSL + 2.1 and test data Bessel I0: Mathworld Data +
+

+ domain + error
0, -2, 2.27959
domain error
0, -7, 168.594
domain + error
0, -1, 1.26607
+

+
+ + Error + Output For cyl_bessel_i with compiler GNU C++ version 7.1.0 and library <cmath> + and test data Bessel Iv: Mathworld Data (large values) +
+

+ Bad + argument in __cyl_bessel_i.
-1, 3.72917e-155, 1.86459e-155
Bad + argument in __cyl_bessel_i.
-1.125, 3.72917e-155, -1.34964e+173
+

+
+ + Error + Output For cyl_bessel_i with compiler GNU C++ version 7.1.0 and library <cmath> + and test data Bessel Iv: Random Data +
+

+ Bad + argument in __cyl_bessel_i.
-80.4919, 24.7501, 4.18698e+28
Bad + argument in __cyl_bessel_i.
-80.4919, 63.7722, 2.03248e+06
Bad + argument in __cyl_bessel_i.
-74.6026, 24.7501, 7.20977e+23
Bad + argument in __cyl_bessel_i.
-74.6026, 63.7722, 8.7549e+08
Bad argument + in __cyl_bessel_i.
-72.9046, 24.7501, 1.04535e+22
Bad argument + in __cyl_bessel_i.
-72.9046, 63.7722, 4.7162e+09
Bad argument in + __cyl_bessel_i.
-62.3236, 24.7501, 3.65147e+14
Bad argument in + __cyl_bessel_i.
-62.3236, 63.7722, 8.56683e+13
Bad argument in + __cyl_bessel_i.
-55.7932, 24.7501, -7.70364e+09
Bad argument in + __cyl_bessel_i.
-55.7932, 63.7722, 1.95969e+16
Bad argument in + __cyl_bessel_i.
-44.3004, 9.50706, 2.93478e+22
Bad argument in + __cyl_bessel_i.
-44.3004, 24.7501, 640.568
Bad argument in __cyl_bessel_i.
+ -44.3004, 63.7722, 8.05557e+19
Bad argument in __cyl_bessel_i.
+ -38.3666, 5.11399, 2.89105e+27
Bad argument in __cyl_bessel_i.
+ -38.3666, 9.50706, 8.80632e+16
Bad argument in __cyl_bessel_i.
+ -38.3666, 24.7501, 0.389004
Bad argument in __cyl_bessel_i.
-38.3666, + 63.7722, 3.06303e+21
+

+
+ + Error + Output For cyl_bessel_i with compiler GNU C++ version 7.1.0 and library <cmath> + and test data Bessel Iv: Mathworld Data +
+

+ Bad + argument in __cyl_bessel_i.
-4.99902, 2.125, 0.0267921
Bad argument + in __cyl_bessel_i.
-5.5, 10, 597.578
Bad argument in __cyl_bessel_i.
+ -5.5, 100, 9.22363e+41
Bad argument in __cyl_bessel_i.
-10.0003, + 0.000976562, 1.41474e+35
Bad argument in __cyl_bessel_i.
-10.0003, + 50, 1.07153e+20
Bad argument in __cyl_bessel_i.
-141.4, 100, 2066.28
+

+
+ + Error + Output For cyl_bessel_i (integer orders) with compiler GNU C++ version 7.1.0 + and library <cmath> and test data Bessel In: Mathworld Data (Integer + Version) +
+

+ Bad + argument in __cyl_bessel_i.
-2, 0, 0
Bad argument in __cyl_bessel_i.
+ -5, 100, 9.47009e+41
Bad argument in __cyl_bessel_i.
-5, -1, -0.000271463
+ Bad argument in __cyl_bessel_i.
10, -5, 0.00458004
Bad argument + in __cyl_bessel_i.
-100, -200, 4.35275e+74
+

+
+ + Error + Output For cyl_bessel_i (integer orders) with compiler GNU C++ version 7.1.0 + and library <cmath> and test data Bessel I1: Mathworld Data (Integer + Version) +
+

+ Bad + argument in __cyl_bessel_i.
1, -2, -1.59064
Bad argument in __cyl_bessel_i.
+ 1, -8, -399.873
Bad argument in __cyl_bessel_i.
1, -10, -2670.99
+

+
+ + Error + Output For cyl_bessel_i (integer orders) with compiler GNU C++ version 7.1.0 + and library <cmath> and test data Bessel I0: Mathworld Data (Integer + Version) +
+

+ Bad + argument in __cyl_bessel_i.
0, -2, 2.27959
Bad argument in __cyl_bessel_i.
+ 0, -7, 168.594
Bad argument in __cyl_bessel_i.
0, -1, 1.26607
+

+
+ + Error + Output For cyl_bessel_i with compiler GNU C++ version 7.1.0 and library <cmath> + and test data Bessel In: Mathworld Data +
+

+ Bad + argument in __cyl_bessel_i.
-2, 0, 0
Bad argument in __cyl_bessel_i.
+ -5, 100, 9.47009e+41
Bad argument in __cyl_bessel_i.
-5, -1, -0.000271463
+ Bad argument in __cyl_bessel_i.
10, -5, 0.00458004
Bad argument + in __cyl_bessel_i.
-100, -200, 4.35275e+74
+

+
+ + Error + Output For cyl_bessel_i with compiler GNU C++ version 7.1.0 and library <cmath> + and test data Bessel I1: Mathworld Data +
+

+ Bad + argument in __cyl_bessel_i.
1, -2, -1.59064
Bad argument in __cyl_bessel_i.
+ 1, -8, -399.873
Bad argument in __cyl_bessel_i.
1, -10, -2670.99
+

+
+ + Error + Output For cyl_bessel_i with compiler GNU C++ version 7.1.0 and library <cmath> + and test data Bessel I0: Mathworld Data +
+

+ Bad + argument in __cyl_bessel_i.
0, -2, 2.27959
Bad argument in __cyl_bessel_i.
+ 0, -7, 168.594
Bad argument in __cyl_bessel_i.
0, -1, 1.26607
+

+
+ + Error + Output For cyl_bessel_j with compiler GNU C++ version 7.1.0 and library GSL + 2.1 and test data Bessel J: Random Data +
+

+ underflow
+ 63.8868, 5.5381e-05, 0
underflow
63.8868, 6.9304e-05, 0
underflow
+ 63.8868, 0.000232641, 0
underflow
63.8868, 0.000448, 8.39912e-323
+ underflow
63.8868, 0.000550287, 4.32897e-317
+

+
+ + Error + Output For cyl_bessel_j with compiler GNU C++ version 7.1.0 and library GSL + 2.1 and test data Bessel J: Mathworld Data (large values) +
+

+ domain + error
-0.5, 1.2459e-206, 7.14823e+102
domain error
-256, + 8, 0
domain error
-2.5, 4, -0.0145679
+

+
+ + Error + Output For cyl_bessel_j with compiler GNU C++ version 7.1.0 and library GSL + 2.1 and test data Bessel J: Mathworld Data +
+

+ domain + error
-5.5, 3.1416, -2.5582
domain error
-5.5, 10000, 0.00244984
+ domain error
-5.5, 10000, 0.00244984
domain error
-5.5, 1e+06, + 0.000279243
domain error
-0.5, 101, 0.0708185
domain error
+ -10.0003, 0.000976562, 1.41474e+35
domain error
-10.0003, 15, -0.0902239
+ domain error
-10.0003, 100, -0.0547614
domain error
-10.0003, + 20000, -0.00556869
domain error
-8.5, 12.5664, -0.257087
+

+
+ + Error + Output For cyl_bessel_j (integer orders) with compiler GNU C++ version 7.1.0 + and library GSL 2.1 and test data Bessel JN: Mathworld Data (Integer Version) +
+

+ underflow
+ 10, 1e-100, 0
+

+
+ + Error + Output For cyl_bessel_j with compiler GNU C++ version 7.1.0 and library GSL + 2.1 and test data Bessel JN: Mathworld Data +
+

+ domain + error
-1, 1.25, -0.510623
domain error
-2, 0, 0
domain + error
5, -10, 0.234062
domain error
-5, 1e+06, 0.000725964
+ domain error
-5, -1, 0.000249758
domain error
10, -10, 0.207486
+ domain error
10, -5, 0.0014678
domain error
-10, 1e+06, -0.000331079
+ underflow
10, 1e-100, 0
+

+
+ + Error + Output For cyl_bessel_j with compiler GNU C++ version 7.1.0 and library GSL + 2.1 and test data Bessel J1: Mathworld Data +
+

+ domain + error
1, -2, -0.576725
domain error
1, -8, -0.234636
+ domain error
1, -10, -0.0434727
+

+
+ + Error + Output For cyl_bessel_j with compiler GNU C++ version 7.1.0 and library GSL + 2.1 and test data Bessel J0: Mathworld Data +
+

+ domain + error
0, -2, 0.223891
domain error
0, -8, 0.171651
+ domain error
0, -10, -0.245936
+

+
+ + Error + Output For cyl_bessel_j with compiler GNU C++ version 7.1.0 and library <cmath> + and test data Bessel J: Mathworld Data (large values) +
+

+ Bad + argument in __cyl_bessel_j.
-0.5, 1.2459e-206, 7.14823e+102
Bad + argument in __cyl_bessel_j.
-256, 8, 1.46866e-353
Bad argument + in __cyl_bessel_j.
-2.5, 4, -0.0145679
+

+
+ + Error + Output For cyl_bessel_j with compiler GNU C++ version 7.1.0 and library <cmath> + and test data Bessel J: Mathworld Data +
+

+ Bad + argument in __cyl_bessel_j.
-5.5, 3.1416, -2.5582
Bad argument + in __cyl_bessel_j.
-5.5, 10000, 0.00244984
Bad argument in __cyl_bessel_j.
+ -5.5, 10000, 0.00244984
Bad argument in __cyl_bessel_j.
-5.5, 1e+06, + 0.000279243
Bad argument in __cyl_bessel_j.
-0.5, 101, 0.0708185
+ Bad argument in __cyl_bessel_j.
-10.0003, 0.000976562, 1.41474e+35
+ Bad argument in __cyl_bessel_j.
-10.0003, 15, -0.0902239
Bad argument + in __cyl_bessel_j.
-10.0003, 100, -0.0547614
Bad argument in __cyl_bessel_j.
+ -10.0003, 20000, -0.00556869
Bad argument in __cyl_bessel_j.
-8.5, + 12.5664, -0.257087
+

+
+ + Error + Output For cyl_bessel_j (integer orders) with compiler GNU C++ version 7.1.0 + and library <cmath> and test data Bessel JN: Mathworld Data (Integer + Version) +
+

+ Bad + argument in __cyl_bessel_j.
-1, 1.25, -0.510623
Bad argument in + __cyl_bessel_j.
-2, 0, 0
Bad argument in __cyl_bessel_j.
+ 5, -10, 0.234062
Bad argument in __cyl_bessel_j.
-5, 1e+06, 0.000725964
+ Bad argument in __cyl_bessel_j.
-5, -1, 0.000249758
Bad argument + in __cyl_bessel_j.
10, -10, 0.207486
Bad argument in __cyl_bessel_j.
+ 10, -5, 0.0014678
Bad argument in __cyl_bessel_j.
-10, 1e+06, -0.000331079
+ CAUTION: Gross error found at entry 15.
Found: 0.0042409 Expected 0.00128318 + Error: 2.305
1000, 100000, 0.00128318
+

+
+ + Error + Output For cyl_bessel_j (integer orders) with compiler GNU C++ version 7.1.0 + and library <cmath> and test data Bessel J1: Mathworld Data (Integer + Version) +
+

+ Bad + argument in __cyl_bessel_j.
1, -2, -0.576725
Bad argument in __cyl_bessel_j.
+ 1, -8, -0.234636
Bad argument in __cyl_bessel_j.
1, -10, -0.0434727
+

+
+ + Error + Output For cyl_bessel_j (integer orders) with compiler GNU C++ version 7.1.0 + and library <cmath> and test data Bessel J0: Mathworld Data (Integer + Version) +
+

+ Bad + argument in __cyl_bessel_j.
0, -2, 0.223891
Bad argument in __cyl_bessel_j.
+ 0, -8, 0.171651
Bad argument in __cyl_bessel_j.
0, -10, -0.245936
+

+
+ + Error + Output For cyl_bessel_j with compiler GNU C++ version 7.1.0 and library <cmath> + and test data Bessel JN: Mathworld Data +
+

+ Bad + argument in __cyl_bessel_j.
-1, 1.25, -0.510623
Bad argument in + __cyl_bessel_j.
-2, 0, 0
Bad argument in __cyl_bessel_j.
+ 5, -10, 0.234062
Bad argument in __cyl_bessel_j.
-5, 1e+06, 0.000725964
+ Bad argument in __cyl_bessel_j.
-5, -1, 0.000249758
Bad argument + in __cyl_bessel_j.
10, -10, 0.207486
Bad argument in __cyl_bessel_j.
+ 10, -5, 0.0014678
Bad argument in __cyl_bessel_j.
-10, 1e+06, -0.000331079
+ CAUTION: Gross error found at entry 15.
Found: 0.0042409 Expected 0.00128318 + Error: 2.305
1000, 100000, 0.00128318
+

+
+ + Error + Output For cyl_bessel_j with compiler GNU C++ version 7.1.0 and library <cmath> + and test data Bessel J1: Mathworld Data +
+

+ Bad + argument in __cyl_bessel_j.
1, -2, -0.576725
Bad argument in __cyl_bessel_j.
+ 1, -8, -0.234636
Bad argument in __cyl_bessel_j.
1, -10, -0.0434727
+

+
+ + Error + Output For cyl_bessel_j with compiler GNU C++ version 7.1.0 and library <cmath> + and test data Bessel J0: Mathworld Data +
+

+ Bad + argument in __cyl_bessel_j.
0, -2, 0.223891
Bad argument in __cyl_bessel_j.
+ 0, -8, 0.171651
Bad argument in __cyl_bessel_j.
0, -10, -0.245936
+

+
+ + Error + Output For cyl_bessel_k with compiler GNU C++ version 7.1.0 and library GSL + 2.1 and test data Bessel Kv: Random Data +
+

+ domain + error
-80.4919, 24.7501, 6.57902e+28
domain error
-80.4919, + 63.7722, 2.39552e-09
domain error
-80.4919, 125.28, 3.06904e-45
+ domain error
-80.4919, 255.547, 2.30343e-107
domain error
+ -80.4919, 503.011, 1.20315e-217
domain error
-80.4919, 1007.46, + 0
domain error
-80.4919, 1185.4, 0
domain error
-80.4919, + 3534.52, 0
domain error
-80.4919, 8071.55, 0
domain error
+ -80.4919, 16229.2, 0
domain error
-80.4919, 32066.2, 0
domain + error
-80.4919, 36367.9, 0
domain error
-74.6026, 24.7501, + 1.19405e+24
domain error
-74.6026, 63.7722, 5.81897e-12
domain + error
-74.6026, 125.28, 9.89214e-47
domain error
-74.6026, + 255.547, 3.9726e-108
domain error
-74.6026, 503.011, 4.87462e-218
+ domain error
-74.6026, 1007.46, 0
domain error
-74.6026, + 1185.4, 0
domain error
-74.6026, 3534.52, 0
domain error
+ -74.6026, 8071.55, 0
domain error
-74.6026, 16229.2, 0
domain + error
-74.6026, 32066.2, 0
domain error
-74.6026, 36367.9, + 0
domain error
-72.9046, 24.7501, 5.5618e+22
domain error
+ -72.9046, 63.7722, 1.09452e-12
domain error
-72.9046, 125.28, 3.8393e-47
+ domain error
-72.9046, 255.547, 2.45173e-108
domain error
+ -72.9046, 503.011, 3.80454e-218
domain error
-72.9046, 1007.46, + 0
domain error
-72.9046, 1185.4, 0
domain error
-72.9046, + 3534.52, 0
domain error
-72.9046, 8071.55, 0
domain error
+ -72.9046, 16229.2, 0
domain error
-72.9046, 32066.2, 0
domain + error
-72.9046, 36367.9, 0
domain error
-62.3236, 24.7501, + 6.74518e+14
domain error
-62.3236, 63.7722, 6.54531e-17
domain + error
-62.3236, 125.28, 1.65653e-49
domain error
-62.3236, + 255.547, 1.54767e-109
domain error
-62.3236, 503.011, 9.22721e-219
+ domain error
-62.3236, 1007.46, 0
domain error
-62.3236, + 1185.4, 0
domain error
-62.3236, 3534.52, 0
domain error
+ -62.3236, 8071.55, 0
domain error
-62.3236, 16229.2, 0
domain + error
-62.3236, 32066.2, 0
domain error
-62.3236, 36367.9, + 0
domain error
-55.7932, 24.7501, 2.00028e+10
domain error
+ -55.7932, 63.7722, 3.01107e-19
domain error
-55.7932, 125.28, 8.54693e-51
+ domain error
-55.7932, 255.547, 3.47666e-110
domain error
+ -55.7932, 503.011, 4.29705e-219
domain error
-55.7932, 1007.46, + 0
domain error
-55.7932, 1185.4, 0
domain error
-55.7932, + 3534.52, 0
domain error
-55.7932, 8071.55, 0
domain error
+ -55.7932, 16229.2, 0
domain error
-55.7932, 32066.2, 0
domain + error
-55.7932, 36367.9, 0
domain error
-44.3004, 9.50706, + 5.6936e+22
domain error
-44.3004, 24.7501, 1242.73
domain + error
-44.3004, 63.7722, 7.99341e-23
domain error
-44.3004, + 125.28, 9.88149e-53
domain error
-44.3004, 255.547, 3.73007e-111
+ domain error
-44.3004, 503.011, 1.37367e-219
domain error
+ -44.3004, 1007.46, 0
domain error
-44.3004, 1185.4, 0
domain + error
-44.3004, 3534.52, 0
domain error
-44.3004, 8071.55, + 0
domain error
-44.3004, 16229.2, 0
domain error
-44.3004, + 32066.2, 0
domain error
-44.3004, 36367.9, 0
domain error
+ -38.3666, 5.11399, 4.97154e+27
domain error
-38.3666, 9.50706, + 1.51436e+17
domain error
-38.3666, 24.7501, 0.639495
domain + error
-38.3666, 63.7722, 2.19334e-24
domain error
-38.3666, + 125.28, 1.45351e-53
domain error
-38.3666, 255.547, 1.43713e-111
+ domain error
-38.3666, 503.011, 8.44445e-220
domain error
+ -38.3666, 1007.46, 0
domain error
-38.3666, 1185.4, 0
domain + error
-38.3666, 3534.52, 0
domain error
-38.3666, 8071.55, + 0
domain error
-38.3666, 16229.2, 0
domain error
-38.3666, + 32066.2, 0
domain error
-38.3666, 36367.9, 0
underflow
+ 9.3763, 1007.46, 0
underflow
9.3763, 1185.4, 0
underflow
+ 9.3763, 3534.52, 0
underflow
9.3763, 8071.55, 0
underflow
+ 9.3763, 16229.2, 0
underflow
9.3763, 32066.2, 0
underflow
+ 9.3763, 36367.9, 0
underflow
9.44412, 1007.46, 0
underflow
+ 9.44412, 1185.4, 0
underflow
9.44412, 3534.52, 0
underflow
+ 9.44412, 8071.55, 0
underflow
9.44412, 16229.2, 0
underflow
+ 9.44412, 32066.2, 0
underflow
9.44412, 36367.9, 0
underflow
+ 26.4719, 1007.46, 0
underflow
26.4719, 1185.4, 0
underflow
+ 26.4719, 3534.52, 0
underflow
26.4719, 8071.55, 0
underflow
+ 26.4719, 16229.2, 0
underflow
26.4719, 32066.2, 0
underflow
+ 26.4719, 36367.9, 0
underflow
62.9447, 1007.46, 0
underflow
+ 62.9447, 1185.4, 0
underflow
62.9447, 3534.52, 0
underflow
+ 62.9447, 8071.55, 0
underflow
62.9447, 16229.2, 0
underflow
+ *** FURTHER CONTENT HAS BEEN TRUNCATED FOR BREVITY ***
+

+
+ + Error + Output For cyl_bessel_k with compiler GNU C++ version 7.1.0 and library GSL + 2.1 and test data Bessel Kn: Random Data +
+

+ underflow
+ 0, 1007.46, 0
underflow
0, 1185.4, 0
underflow
0, 3534.52, + 0
underflow
0, 8071.55, 0
underflow
0, 16229.2, 0
+ underflow
0, 32066.2, 0
underflow
0, 36367.9, 0
underflow
+ 1, 1007.46, 0
underflow
1, 1185.4, 0
underflow
1, 3534.52, + 0
underflow
1, 8071.55, 0
underflow
1, 16229.2, 0
+ underflow
1, 32066.2, 0
underflow
1, 36367.9, 0
underflow
+ 4, 1007.46, 0
underflow
4, 1185.4, 0
underflow
4, 3534.52, + 0
underflow
4, 8071.55, 0
underflow
4, 16229.2, 0
+ underflow
4, 32066.2, 0
underflow
4, 36367.9, 0
underflow
+ 7, 1007.46, 0
underflow
7, 1185.4, 0
underflow
7, 3534.52, + 0
underflow
7, 8071.55, 0
underflow
7, 16229.2, 0
+ underflow
7, 32066.2, 0
underflow
7, 36367.9, 0
underflow
+ 10, 1007.46, 0
underflow
10, 1185.4, 0
underflow
10, + 3534.52, 0
underflow
10, 8071.55, 0
underflow
10, 16229.2, + 0
underflow
10, 32066.2, 0
underflow
10, 36367.9, 0
+ underflow
13, 1007.46, 0
underflow
13, 1185.4, 0
underflow
+ 13, 3534.52, 0
underflow
13, 8071.55, 0
underflow
13, + 16229.2, 0
underflow
13, 32066.2, 0
underflow
13, 36367.9, + 0
underflow
16, 1007.46, 0
underflow
16, 1185.4, 0
+ underflow
16, 3534.52, 0
underflow
16, 8071.55, 0
underflow
+ 16, 16229.2, 0
underflow
16, 32066.2, 0
underflow
16, + 36367.9, 0
underflow
19, 1007.46, 0
underflow
19, 1185.4, + 0
underflow
19, 3534.52, 0
underflow
19, 8071.55, 0
+ underflow
19, 16229.2, 0
underflow
19, 32066.2, 0
underflow
+ 19, 36367.9, 0
underflow
22, 1007.46, 0
underflow
22, + 1185.4, 0
underflow
22, 3534.52, 0
underflow
22, 8071.55, + 0
underflow
22, 16229.2, 0
underflow
22, 32066.2, 0
+ underflow
22, 36367.9, 0
underflow
25, 1007.46, 0
underflow
+ 25, 1185.4, 0
underflow
25, 3534.52, 0
underflow
25, + 8071.55, 0
underflow
25, 16229.2, 0
underflow
25, 32066.2, + 0
underflow
25, 36367.9, 0
underflow
28, 1007.46, 0
+ underflow
28, 1185.4, 0
underflow
28, 3534.52, 0
underflow
+ 28, 8071.55, 0
underflow
28, 16229.2, 0
underflow
28, + 32066.2, 0
underflow
28, 36367.9, 0
underflow
31, 1007.46, + 0
underflow
31, 1185.4, 0
underflow
31, 3534.52, 0
+ underflow
31, 8071.55, 0
underflow
31, 16229.2, 0
underflow
+ 31, 32066.2, 0
underflow
31, 36367.9, 0
underflow
34, + 1007.46, 0
underflow
34, 1185.4, 0
underflow
34, 3534.52, + 0
underflow
34, 8071.55, 0
underflow
34, 16229.2, 0
+ underflow
34, 32066.2, 0
underflow
34, 36367.9, 0
underflow
+ 37, 1007.46, 0
underflow
37, 1185.4, 0
underflow
37, + 3534.52, 0
underflow
37, 8071.55, 0
underflow
37, 16229.2, + 0
underflow
37, 32066.2, 0
underflow
37, 36367.9, 0
+ underflow
40, 1007.46, 0
underflow
40, 1185.4, 0
underflow
+ 40, 3534.52, 0
underflow
40, 8071.55, 0
underflow
40, + 16229.2, 0
underflow
40, 32066.2, 0
underflow
40, 36367.9, + 0
underflow
43, 1007.46, 0
underflow
43, 1185.4, 0
+ underflow
43, 3534.52, 0
underflow
43, 8071.55, 0
underflow
+ 43, 16229.2, 0
underflow
43, 32066.2, 0
underflow
43, + 36367.9, 0
underflow
46, 1007.46, 0
underflow
46, 1185.4, + 0
underflow
46, 3534.52, 0
underflow
46, 8071.55, 0
+ underflow
46, 16229.2, 0
underflow
46, 32066.2, 0
underflow
+ 46, 36367.9, 0
underflow
49, 1007.46, 0
underflow
49, + 1185.4, 0
underflow
49, 3534.52, 0
underflow
49, 8071.55, + 0
underflow
49, 16229.2, 0
underflow
49, 32066.2, 0
+ underflow
49, 36367.9, 0
underflow
52, 1007.46, 0
underflow
+ 52, 1185.4, 0
underflow
52, 3534.52, 0
underflow
52, + 8071.55, 0
underflow
52, 16229.2, 0
underflow
52, 32066.2, + 0
underflow
52, 36367.9, 0
underflow
55, 1007.46, 0
+ underflow
55, 1185.4, 0
underflow
55, 3534.52, 0
underflow
+ 55, 8071.55, 0
underflow
55, 16229.2, 0
underflow
55, + 32066.2, 0
underflow
55, 36367.9, 0
underflow
58, 1007.46, + 0
underflow
58, 1185.4, 0
underflow
58, 3534.52, 0
+ underflow
58, 8071.55, 0
underflow
58, 16229.2, 0
underflow
+ 58, 32066.2, 0
underflow
58, 36367.9, 0
underflow
61, + 1007.46, 0
underflow
61, 1185.4, 0
underflow
61, 3534.52, + 0
underflow
61, 8071.55, 0
underflow
61, 16229.2, 0
+ underflow
61, 32066.2, 0
underflow
61, 36367.9, 0
underflow
+ 64, 1007.46, 0
underflow
64, 1185.4, 0
underflow
64, + 3534.52, 0
underflow
64, 8071.55, 0
underflow
64, 16229.2, + 0
underflow
64, 32066.2, 0
underflow
64, 36367.9, 0
+ underflow
67, 1007.46, 0
underflow
67, 1185.4, 0
underflow
+ 67, 3534.52, 0
underflow
67, 8071.55, 0
underflow
67, + 16229.2, 0
*** FURTHER CONTENT HAS BEEN TRUNCATED FOR BREVITY ***
+

+
+ + Error + Output For cyl_bessel_k with compiler GNU C++ version 7.1.0 and library GSL + 2.1 and test data Bessel Kv: Mathworld Data (large values) +
+

+ domain + error
-1, 3.72917e-155, 2.68156e+154
domain error
-1.125, + 3.72917e-155, 5.53984e+173
+

+
+ + Error + Output For cyl_bessel_k with compiler GNU C++ version 7.1.0 and library GSL + 2.1 and test data Bessel Kv: Mathworld Data +
+

+ domain + error
-5.5, 10, 7.33045e-05
domain error
-5.5, 100, 5.41275e-45
+ domain error
-141.399, 50, 1.30185e+42
+

+
+ + Error + Output For cyl_bessel_k with compiler GNU C++ version 7.1.0 and library GSL + 2.1 and test data Bessel Kn: Mathworld Data +
+

+ domain + error
-5, 100, 5.27326e-45
domain error
-10, 1, 1.80713e+08
+ domain error
-1000, 700, 6.51562e-31
+

+
+ + Error + Output For cyl_bessel_k with compiler GNU C++ version 7.1.0 and library <cmath> + and test data Bessel Kv: Random Data +
+

+ Bad + argument in __cyl_bessel_k.
-80.4919, 24.7501, 6.57902e+28
Bad + argument in __cyl_bessel_k.
-80.4919, 63.7722, 2.39552e-09
Bad + argument in __cyl_bessel_k.
-80.4919, 125.28, 3.06904e-45
Bad argument + in __cyl_bessel_k.
-80.4919, 255.547, 2.30343e-107
Bad argument + in __cyl_bessel_k.
-80.4919, 503.011, 1.20315e-217
Bad argument + in __cyl_bessel_k.
-80.4919, 1007.46, 2.86537e-438
Bad argument + in __cyl_bessel_k.
-80.4919, 1185.4, 8.63263e-516
Bad argument + in __cyl_bessel_k.
-80.4919, 3534.52, 5.01367e-1537
Bad argument + in __cyl_bessel_k.
-80.4919, 8071.55, 7.76555e-3508
Bad argument + in __cyl_bessel_k.
-80.4919, 16229.2, 0
Bad argument in __cyl_bessel_k.
+ -80.4919, 32066.2, 0
Bad argument in __cyl_bessel_k.
-80.4919, + 36367.9, 0
Bad argument in __cyl_bessel_k.
-74.6026, 24.7501, 1.19405e+24
+ Bad argument in __cyl_bessel_k.
-74.6026, 63.7722, 5.81897e-12
+ Bad argument in __cyl_bessel_k.
-74.6026, 125.28, 9.89214e-47
Bad + argument in __cyl_bessel_k.
-74.6026, 255.547, 3.9726e-108
Bad + argument in __cyl_bessel_k.
-74.6026, 503.011, 4.87462e-218
Bad + argument in __cyl_bessel_k.
-74.6026, 1007.46, 1.82221e-438
Bad + argument in __cyl_bessel_k.
-74.6026, 1185.4, 5.87506e-516
Bad + argument in __cyl_bessel_k.
-74.6026, 3534.52, 4.40608e-1537
Bad + argument in __cyl_bessel_k.
-74.6026, 8071.55, 7.3384e-3508
Bad + argument in __cyl_bessel_k.
-74.6026, 16229.2, 0
Bad argument in + __cyl_bessel_k.
-74.6026, 32066.2, 0
Bad argument in __cyl_bessel_k.
+ -74.6026, 36367.9, 0
Bad argument in __cyl_bessel_k.
-72.9046, + 24.7501, 5.5618e+22
Bad argument in __cyl_bessel_k.
-72.9046, 63.7722, + 1.09452e-12
Bad argument in __cyl_bessel_k.
-72.9046, 125.28, 3.8393e-47
+ Bad argument in __cyl_bessel_k.
-72.9046, 255.547, 2.45173e-108
+ Bad argument in __cyl_bessel_k.
-72.9046, 503.011, 3.80454e-218
+ Bad argument in __cyl_bessel_k.
-72.9046, 1007.46, 1.60949e-438
+ Bad argument in __cyl_bessel_k.
-72.9046, 1185.4, 5.28662e-516
+ Bad argument in __cyl_bessel_k.
-72.9046, 3534.52, 4.25273e-1537
+ Bad argument in __cyl_bessel_k.
-72.9046, 8071.55, 7.22542e-3508
+ Bad argument in __cyl_bessel_k.
-72.9046, 16229.2, 0
Bad argument + in __cyl_bessel_k.
-72.9046, 32066.2, 0
Bad argument in __cyl_bessel_k.
+ -72.9046, 36367.9, 0
Bad argument in __cyl_bessel_k.
-62.3236, + 24.7501, 6.74518e+14
Bad argument in __cyl_bessel_k.
-62.3236, + 63.7722, 6.54531e-17
Bad argument in __cyl_bessel_k.
-62.3236, + 125.28, 1.65653e-49
Bad argument in __cyl_bessel_k.
-62.3236, 255.547, + 1.54767e-109
Bad argument in __cyl_bessel_k.
-62.3236, 503.011, + 9.22721e-219
Bad argument in __cyl_bessel_k.
-62.3236, 1007.46, + 7.91894e-439
Bad argument in __cyl_bessel_k.
-62.3236, 1185.4, + 2.89281e-516
Bad argument in __cyl_bessel_k.
-62.3236, 3534.52, + 3.4736e-1537
Bad argument in __cyl_bessel_k.
-62.3236, 8071.55, + 6.6126e-3508
Bad argument in __cyl_bessel_k.
-62.3236, 16229.2, + 0
Bad argument in __cyl_bessel_k.
-62.3236, 32066.2, 0
Bad + argument in __cyl_bessel_k.
-62.3236, 36367.9, 0
Bad argument in + __cyl_bessel_k.
-55.7932, 24.7501, 2.00028e+10
Bad argument in + __cyl_bessel_k.
-55.7932, 63.7722, 3.01107e-19
Bad argument in + __cyl_bessel_k.
-55.7932, 125.28, 8.54693e-51
Bad argument in __cyl_bessel_k.
+ -55.7932, 255.547, 3.47666e-110
Bad argument in __cyl_bessel_k.
+ -55.7932, 503.011, 4.29705e-219
Bad argument in __cyl_bessel_k.
+ -55.7932, 1007.46, 5.40242e-439
Bad argument in __cyl_bessel_k.
+ -55.7932, 1185.4, 2.08996e-516
Bad argument in __cyl_bessel_k.
+ -55.7932, 3534.52, 3.11458e-1537
Bad argument in __cyl_bessel_k.
+ -55.7932, 8071.55, 6.30409e-3508
Bad argument in __cyl_bessel_k.
+ -55.7932, 16229.2, 0
Bad argument in __cyl_bessel_k.
-55.7932, + 32066.2, 0
Bad argument in __cyl_bessel_k.
-55.7932, 36367.9, 0
+ Bad argument in __cyl_bessel_k.
-44.3004, 9.50706, 5.6936e+22
Bad + argument in __cyl_bessel_k.
-44.3004, 24.7501, 1242.73
Bad argument + in __cyl_bessel_k.
-44.3004, 63.7722, 7.99341e-23
Bad argument + in __cyl_bessel_k.
-44.3004, 125.28, 9.88149e-53
Bad argument in + __cyl_bessel_k.
-44.3004, 255.547, 3.73007e-111
Bad argument in + __cyl_bessel_k.
-44.3004, 503.011, 1.37367e-219
Bad argument in + __cyl_bessel_k.
-44.3004, 1007.46, 3.05398e-439
Bad argument in + __cyl_bessel_k.
*** FURTHER CONTENT HAS BEEN TRUNCATED FOR BREVITY ***
+

+
+ + Error + Output For cyl_bessel_k with compiler GNU C++ version 7.1.0 and library <cmath> + and test data Bessel Kv: Mathworld Data (large values) +
+

+ Bad + argument in __cyl_bessel_k.
-1, 3.72917e-155, 2.68156e+154
Bad + argument in __cyl_bessel_k.
-1.125, 3.72917e-155, 5.53984e+173
+

+
+ + Error + Output For cyl_bessel_k with compiler GNU C++ version 7.1.0 and library <cmath> + and test data Bessel Kv: Mathworld Data +
+

+ Bad + argument in __cyl_bessel_k.
-5.5, 10, 7.33045e-05
Bad argument + in __cyl_bessel_k.
-5.5, 100, 5.41275e-45
Bad argument in __cyl_bessel_k.
+ -141.399, 50, 1.30185e+42
+

+
+ + Error + Output For cyl_bessel_k (integer orders) with compiler GNU C++ version 7.1.0 + and library <cmath> and test data Bessel Kn: Mathworld Data (Integer + Version) +
+

+ Bad + argument in __cyl_bessel_k.
-5, 100, 5.27326e-45
Bad argument in + __cyl_bessel_k.
-10, 1, 1.80713e+08
Bad argument in __cyl_bessel_k.
+ -1000, 700, 6.51562e-31
+

+
+ + Error + Output For cyl_bessel_k with compiler GNU C++ version 7.1.0 and library <cmath> + and test data Bessel Kn: Mathworld Data +
+

+ Bad + argument in __cyl_bessel_k.
-5, 100, 5.27326e-45
Bad argument in + __cyl_bessel_k.
-10, 1, 1.80713e+08
Bad argument in __cyl_bessel_k.
+ -1000, 700, 6.51562e-31
+

+
+ + Error + Output For cyl_neumann with compiler GNU C++ version 7.1.0 and library GSL + 2.1 and test data Yv: Mathworld Data (large values) +
+

+ domain + error
-0.5, 1.2459e-206, 8.90598e-104
+

+
+ + Error + Output For cyl_neumann with compiler GNU C++ version 7.1.0 and library GSL + 2.1 and test data Yv: Mathworld Data +
+

+ domain + error
-5.5, 3.125, -0.0274994
domain error
-5.5, 10000, -0.00759344
+ domain error
-10.0003, 0.000976562, -1.50382e+38
domain error
+ -10.0003, 100, 0.0583042
domain error
-141.75, 100, -3.8101e+09
+ domain error
-8.5, 12.5664, 0.0436808
+

+
+ + Error + Output For cyl_neumann with compiler GNU C++ version 7.1.0 and library GSL + 2.1 and test data Yn: Mathworld Data +
+

+ domain + error
-5, 1e+06, 0.000331052
domain error
-10, 1e+06, 0.000725952
+ domain error
-1000, 700, -1.88753e+77
domain error
-25, 8, + 3.45114e+08
+

+
+ + Error + Output For cyl_neumann with compiler GNU C++ version 7.1.0 and library <cmath> + and test data Yv: Random Data +
+

+ CAUTION: + Gross error found at entry 394.
Found: -3.29903 Expected 0.0192842 Error: + 1.18973e+4932
125.28, 1007.46, 0.0192842
CAUTION: Gross error found + at entry 395.
Found: 1.13543 Expected 0.0230358 Error: 48.2897
+ 125.28, 1185.4, 0.0230358
CAUTION: Gross error found at entry 396.
+ Found: 0.00119445 Expected 0.00460223 Error: 2.85302
125.28, 3534.52, + 0.00460223
CAUTION: Gross error found at entry 403.
Found: 1068 + Expected -0.00270959 Error: 1.18973e+4932
255.547, 1007.46, -0.00270959
+ CAUTION: Gross error found at entry 404.
Found: -395.006 Expected 0.00738845 + Error: 1.18973e+4932
255.547, 1185.4, 0.00738845
CAUTION: Gross + error found at entry 405.
Found: 1.08701 Expected -0.000407036 Error: + 1.18973e+4932
255.547, 3534.52, -0.000407036
CAUTION: Gross error + found at entry 406.
Found: 0.0232211 Expected 0.00886946 Error: 1.61809
+ 255.547, 8071.55, 0.00886946
CAUTION: Gross error found at entry 411.
+ Found: 65895.7 Expected -0.0158467 Error: 1.18973e+4932
503.011, 1007.46, + -0.0158467
CAUTION: Gross error found at entry 412.
Found: -123316 + Expected 0.00594357 Error: 1.18973e+4932
503.011, 1185.4, 0.00594357
+ CAUTION: Gross error found at entry 413.
Found: -706.209 Expected 0.010151 + Error: 1.18973e+4932
503.011, 3534.52, 0.010151
CAUTION: Gross + error found at entry 414.
Found: -21.2081 Expected 0.00888375 Error: + 1.18973e+4932
503.011, 8071.55, 0.00888375
CAUTION: Gross error + found at entry 415.
Found: 0.0272835 Expected 0.00552287 Error: 3.94008
+ 503.011, 16229.2, 0.00552287
CAUTION: Gross error found at entry 416.
+ Found: 0.0103324 Expected 0.00445559 Error: 1.31898
503.011, 32066.2, + 0.00445559
CAUTION: Gross error found at entry 417.
Found: 0.00540788 + Expected -0.00384344 Error: 1.18973e+4932
503.011, 36367.9, -0.00384344
+ CAUTION: Gross error found at entry 418.
Found: 5.43091e+07 Expected + -0.0772843 Error: 1.18973e+4932
1007.46, 1007.46, -0.0772843
CAUTION: + Gross error found at entry 419.
Found: -2.84383e+07 Expected 0.0304312 + Error: 1.18973e+4932
1007.46, 1185.4, 0.0304312
CAUTION: Gross + error found at entry 420.
Found: -61440.2 Expected -0.00474217 Error: + 1.29562e+07
1007.46, 3534.52, -0.00474217
CAUTION: Gross error + found at entry 421.
Found: -4126.89 Expected -0.0074205 Error: 556146
+ 1007.46, 8071.55, -0.0074205
CAUTION: Gross error found at entry 422.
+ Found: -69.2831 Expected -0.00179572 Error: 38581.4
1007.46, 16229.2, + -0.00179572
CAUTION: Gross error found at entry 423.
Found: 2.32048 + Expected 0.000750053 Error: 3092.76
1007.46, 32066.2, 0.000750053
+ CAUTION: Gross error found at entry 424.
Found: 3.90724 Expected 0.00305125 + Error: 1279.54
1007.46, 36367.9, 0.00305125
CAUTION: Gross error + found at entry 425.
Found: -1.83374e+08 Expected -7.25176e+28 Error: + 3.95463e+20
1185.4, 1007.46, -7.25176e+28
CAUTION: Gross error + found at entry 426.
Found: 1.09822e+08 Expected -0.0732059 Error: 1.18973e+4932
+ 1185.4, 1185.4, -0.0732059
CAUTION: Gross error found at entry 427.
+ Found: 315632 Expected 0.000479585 Error: 6.58136e+08
1185.4, 3534.52, + 0.000479585
CAUTION: Gross error found at entry 428.
Found: 16815.6 + Expected 0.00174909 Error: 9.61391e+06
1185.4, 8071.55, 0.00174909
+ CAUTION: Gross error found at entry 429.
Found: 133.356 Expected 0.00416288 + Error: 32033.6
1185.4, 16229.2, 0.00416288
CAUTION: Gross error + found at entry 430.
Found: -1.38401 Expected -0.000320056 Error: 4323.27
+ 1185.4, 32066.2, -0.000320056
CAUTION: Gross error found at entry 431.
+ Found: -17.7085 Expected -0.00417656 Error: 4238.96
1185.4, 36367.9, + -0.00417656
+

+
+ + Error + Output For cyl_neumann with compiler GNU C++ version 7.1.0 and library <cmath> + and test data Yv: Mathworld Data (large values) +
+

+ Bad + argument in __cyl_neumann_n.
-0.5, 1.2459e-206, 8.90598e-104
+

+
+ + Error + Output For cyl_neumann with compiler GNU C++ version 7.1.0 and library <cmath> + and test data Yv: Mathworld Data +
+

+ Bad + argument in __cyl_neumann_n.
-5.5, 3.125, -0.0274994
Bad argument + in __cyl_neumann_n.
-5.5, 10000, -0.00759344
Bad argument in __cyl_neumann_n.
+ -10.0003, 0.000976562, -1.50382e+38
Bad argument in __cyl_neumann_n.
+ -10.0003, 100, 0.0583042
Bad argument in __cyl_neumann_n.
-141.75, + 100, -3.8101e+09
Bad argument in __cyl_neumann_n.
-8.5, 12.5664, + 0.0436808
+

+
+ + Error + Output For cyl_neumann (integer orders) with compiler GNU C++ version 7.1.0 + and library <cmath> and test data Yn: Mathworld Data (Integer Version) +
+

+ Bad + argument in __cyl_neumann_n.
-5, 1e+06, 0.000331052
Bad argument + in __cyl_neumann_n.
-10, 1e+06, 0.000725952
CAUTION: Gross error + found at entry 7.
Found: 0.0540745 Expected 0.00217255 Error: 23.8899
+ 1000, 100000, 0.00217255
Bad argument in __cyl_neumann_n.
-1000, + 700, -1.88753e+77
Bad argument in __cyl_neumann_n.
-25, 8, 3.45114e+08
+

+
+ + Error + Output For cyl_neumann with compiler GNU C++ version 7.1.0 and library <cmath> + and test data Yn: Mathworld Data +
+

+ Bad + argument in __cyl_neumann_n.
-5, 1e+06, 0.000331052
Bad argument + in __cyl_neumann_n.
-10, 1e+06, 0.000725952
CAUTION: Gross error + found at entry 7.
Found: 0.0540745 Expected 0.00217255 Error: 23.8899
+ 1000, 100000, 0.00217255
Bad argument in __cyl_neumann_n.
-1000, + 700, -1.88753e+77
Bad argument in __cyl_neumann_n.
-25, 8, 3.45114e+08
+

+
+ + Error + Output For beta with compiler GNU C++ version 7.1.0 and library GSL 2.1 and + test data Beta Function: Small Values +
+

+ CAUTION: + Found non-finite result, when a finite value was expected at entry 22
+ Found: inf Expected 5.69832e+154 Error: 1.79769e+308
2.98334e-154, 1.86459e-155, + 5.69832e+154
CAUTION: Gross error found at entry 22.
Found: inf + Expected 5.69832e+154 Error: 1.79769e+308
2.98334e-154, 1.86459e-155, + 5.69832e+154
+

+
+ + Error + Output For ellint_rj with compiler GNU C++ version 7.1.0 and library GSL 2.1 + and test data RJ: Random data +
+

+ domain + error
1.77787e-31, 1.40657e+18, 10.046, -4.8298e-10, -2.51795e-10
+ domain error
3.37448e-31, 4.65772e+22, 0.469831, -4.33756e-09, -2.95865e-11
+ domain error
5.25297e-31, 5.85483e+25, 2.02482e-15, -1.87347e-28, 3.36445e+07
+ domain error
6.22216e-31, 3.43401e+23, 0.673005, -2.7626e-13, -7.58898e-12
+ domain error
6.26875e-31, 2.62568e-13, 1.06394e+24, -1.36451e+14, -6.70372e-25
+ domain error
6.84599e-31, 3.57666e-29, 1.82191e+11, -3.63292e+08, -8.35235e-13
+ domain error
8.90482e-31, 1.97093e-28, 1.14939e-31, -1.26424e-12, -6.39454e+26
+ domain error
1.07374e-30, 1.70005e-12, 1.88773e-25, -1.16558e-29, 4.31668e+32
+ domain error
1.17141e-30, 24.2523, 3.67522e+21, -4.79065e-22, 2.2702e-05
+ domain error
1.64143e-30, 2.01978e-22, 2.58942e+12, -8.52649e-12, -2.82629e+06
+ domain error
1.85141e-30, 0.0386712, 2.37846e-13, -1.57357e+15, -1.38574e-13
+ domain error
2.70034e-30, 4.43896e-24, 7.54576e+16, -1.1436e-14, -1.10082e+07
+ domain error
4.01162e-30, 2.73343e+23, 1.32333e+13, -1.86032e-07, -4.16626e-25
+ domain error
4.13665e-30, 1.08034e-30, 3.13547e-16, -5.58099e-08, -5.14643e+16
+ domain error
4.3728e-30, 7.79812e+12, 8.58894e+21, -4.58312e-24, 5.28901e-09
+ domain error
5.6397e-30, 1.64768e+23, 9.64423e-15, -1.82207e+20, -1.62886e-30
+ domain error
9.89841e-30, 9.69731e+10, 1.03263e+21, -0.00343967, -9.62714e-22
+ domain error
1.3797e-29, 6.03357e+08, 5.62497e-15, -5.87235e+16, -5.80287e-20
+ domain error
1.96963e-29, 3.22384e-25, 2.92187e+23, -3.80643e+27, -8.2513e-38
+ domain error
2.00927e-29, 5.6976e-05, 1.16219e+25, -1.64129e-22, 0.00318397
+ domain error
7.29506e-29, 5904.94, 9.93922e+10, -19.528, -1.60795e-09
+ domain error
1.19698e-28, 1.66816e-22, 28472, -1.21137e-19, -5.84699e+17
+ domain error
1.64095e-28, 2.13421e-21, 7.8914e-15, -1.77584e-07, -1.70156e+15
+ domain error
2.03475e-28, 4.40987e+15, 28739.1, -9624.5, -1.29418e-12
+ domain error
2.73113e-28, 1.08457e+19, 4.00674e+08, -5.70043e-11, 1.092e-17
+ domain error
5.52633e-28, 1.45707e-17, 1.29411e-27, -1.67255e-15, -5.84881e+24
+ domain error
5.61278e-28, 9.22881e-12, 8.64222e-13, -5.6282e+23, -4.57782e-18
+ domain error
6.08465e-28, 1.32249e+26, 1.25536e-30, -1.89097e-14, -223.246
+ domain error
9.50943e-28, 2.49682e-18, 0.000904584, -3.1419e-12, -2.44954e+14
+ domain error
1.20779e-27, 35383.2, 1.35533e-15, -4.67834e-24, 3.20581e+15
+ domain error
2.29822e-27, 3.35258e-16, 2.60689e+08, -9.99161e-20, -5.4924e+11
+ domain error
3.0926e-27, 3.11839e-13, 3.37883e-23, -1.94349e+26, -3.55191e-19
+ domain error
3.12803e-27, 1.15118e+16, 1.52495e+10, -4.2399e+13, -3.07515e-21
+ domain error
4.49747e-27, 716.685, 1.69018e-23, -1.32558e-14, -9.2291e+13
+ domain error
4.84575e-27, 3.44028e-27, 3.42665e+09, -812.399, -2.12767e-06
+ domain error
5.81424e-27, 3.70845e-15, 3.69338e+11, -4.15794e+06, -2.95944e-11
+ domain error
6.08654e-27, 1.23742e+08, 1.09124e-26, -2.19946e+16, -4.90896e-19
+ domain error
7.71967e-27, 9.46115e-26, 1.24324e+25, -522800, -5.83203e-17
+ domain error
9.20037e-27, 207550, 2.45782e-17, -6.06901e+29, -2.88945e-31
+ domain error
1.75502e-26, 5.81507e+16, 8.83063e+21, -1.11214e-21, 1.57697e-11
+ domain error
2.29965e-26, 2.9716e-21, 1.81059e-25, -5.23972e-08, -6.23302e+18
+ domain error
2.32628e-26, 0.0655133, 1.62901e-21, -7.15441e-17, -9.88586e+17
+ domain error
3.49194e-26, 2.53343e+14, 756.217, -1.3359e+10, -1.275e-16
+ domain error
1.009e-25, 0.0694304, 1.20267e-14, -1.55746e-22, 2.10701e+17
+ domain error
3.54771e-25, 1.67999e-27, 2.3917e+24, -9.98754e+25, -1.11704e-36
+ domain error
6.31714e-25, 3.4594e-28, 6.37951e-24, -1.25529e-24, -9.56292e+35
+ domain error
6.74086e-25, 2.47169e+12, 1.32962e+23, -6.78845e+06, -3.32861e-24
+ domain error
1.8099e-24, 4.5215e-06, 8.66937e-11, -3.70795e-08, -1.41893e+11
+ domain error
2.29798e-24, 9.30454e-30, 6.56584e-17, -9890.38, -373149
+ domain error
2.88161e-24, 8.82377e-05, 1.57747e+21, -4.25068e-24, 2260.61
+ domain error
3.25991e-24, 1.92923e+29, 3.09752e-05, -1.00986e+11, -1.25485e-24
+ domain error
6.36705e-24, 2.8074e+22, 1.75569e-13, -1.53152e+24, -4.89823e-34
+ domain error
7.90772e-24, 2.11611e-30, 1.42682e-07, -0.00296297, -5.38814e+07
+ domain error
1.05302e-23, 4.83473e+26, 4.43149e-30, -1.56818e+13, -3.6836e-25
+ *** FURTHER CONTENT HAS BEEN TRUNCATED FOR BREVITY ***
+

+
+ + Error + Output For ellint_1 with compiler GNU C++ version 7.1.0 and library <cmath> + and test data Elliptic Integral F: Mathworld Data +
+

+ CAUTION: + Gross error found at entry 9.
Found: -7.02862e+09 Expected 1.04181e+20 + Error: 1.18973e+4932
1e+20, 0.390625, 1.04181e+20
CAUTION: Gross + error found at entry 10.
Found: -9.3866e+09 Expected 1.39133e+50 Error: + 1.18973e+4932
1e+50, 0.875, 1.39133e+50
+

+
+ + Error + Output For ellint_2 (complete) with compiler GNU C++ version 7.1.0 and library + GSL 2.1 and test data Elliptic Integral E: Mathworld Data +
+

+ domain + error
-1, 1
+

+
+ + Error + Output For ellint_2 with compiler GNU C++ version 7.1.0 and library <cmath> + and test data Elliptic Integral E: Mathworld Data +
+

+ CAUTION: + Gross error found at entry 7.
Found: -6.3027e+09 Expected 9.34215e+09 + Error: 1.18973e+4932
1e+10, -0.5, 9.34215e+09
CAUTION: Gross error + found at entry 8.
Found: -6.48129e+09 Expected 7.08861e+19 Error: 1.18973e+4932
+ 7.3787e+19, 0.390625, 7.08861e+19
CAUTION: Gross error found at entry + 9.
Found: -5.13973e+09 Expected 7.1259e+49 Error: 1.18973e+4932
+ 9.35361e+49, 0.878906, 7.1259e+49
+

+
+ + Error + Output For ellint_3 (complete) with compiler GNU C++ version 7.1.0 and library + GSL 2.1 and test data Complete Elliptic Integral PI: Mathworld Data +
+

+ domain + error
-4.14952e+180, 0.5, 7.71119e-91
+

+
+ + Error + Output For ellint_3 with compiler GNU C++ version 7.1.0 and library GSL 2.1 + and test data Elliptic Integral PI: Mathworld Data +
+

+ domain + error
1.125, 10, 0.25, 0.662468
domain error
1.125, 3, 0.25, + -0.142697
domain error
1.00391, 21.5, 0.125, -0.535406
domain + error
1, 2, 0.5, -2.87535
domain error
1, -2, 0.5, 2.87535
+ domain error
1, 2, 6.22302e-61, -2.18504
domain error
1, + -2, 6.22302e-61, 2.18504
domain error
20, 3.14257, 0.5, 0.000975941
+ domain error
20, -3.14257, 0.5, -0.000975941
domain error
+ 1.01562, 1.6958, 0.5, -27.1647
domain error
1.01562, -1.6958, 0.5, + 27.1647
+

+
+ + Error + Output For ellint_3 (complete) with compiler GNU C++ version 7.1.0 and library + <cmath> and test data Complete Elliptic Integral PI: Random Data +
+

+ Argument + too small in __ellint_rj
-87.1743, 0.126987, 0.167413
Argument + too small in __ellint_rj
-87.1743, 0.135477, 0.167431
Argument + too small in __ellint_rj
-87.1743, 0.221034, 0.167683
Argument + too small in __ellint_rj
-87.1743, 0.308167, 0.168078
Argument + too small in __ellint_rj
-87.1743, 0.632359, 0.17122
Argument too + small in __ellint_rj
-87.1743, 0.814724, 0.175341
Argument too + small in __ellint_rj
-87.1743, 0.835009, 0.176056
Argument too + small in __ellint_rj
-87.1743, 0.905792, 0.179501
Argument too + small in __ellint_rj
-87.1743, 0.913376, 0.180014
Argument too + small in __ellint_rj
-87.1743, 0.968868, 0.186162
Argument too + small in __ellint_rj
-86.3168, 0.126987, 0.168233
Argument too + small in __ellint_rj
-86.3168, 0.135477, 0.168252
Argument too + small in __ellint_rj
-86.3168, 0.221034, 0.168506
Argument too + small in __ellint_rj
-86.3168, 0.308167, 0.168905
Argument too + small in __ellint_rj
-86.3168, 0.632359, 0.172077
Argument too + small in __ellint_rj
-86.3168, 0.814724, 0.176237
Argument too + small in __ellint_rj
-86.3168, 0.835009, 0.176958
Argument too + small in __ellint_rj
-86.3168, 0.905792, 0.180437
Argument too + small in __ellint_rj
-86.3168, 0.913376, 0.180955
Argument too + small in __ellint_rj
-86.3168, 0.968868, 0.187163
Argument too + small in __ellint_rj
-77.6756, 0.126987, 0.177238
Argument too + small in __ellint_rj
-77.6756, 0.135477, 0.177258
Argument too + small in __ellint_rj
-77.6756, 0.221034, 0.17754
Argument too small + in __ellint_rj
-77.6756, 0.308167, 0.17798
Argument too small in + __ellint_rj
-77.6756, 0.632359, 0.181485
Argument too small in + __ellint_rj
-77.6756, 0.814724, 0.186089
Argument too small in + __ellint_rj
-77.6756, 0.835009, 0.186888
Argument too small in + __ellint_rj
-77.6756, 0.905792, 0.190742
Argument too small in + __ellint_rj
-77.6756, 0.913376, 0.191315
Argument too small in + __ellint_rj
-77.6756, 0.968868, 0.1982
Argument too small in __ellint_rj
+ -68.8751, 0.126987, 0.188077
Argument too small in __ellint_rj
+ -68.8751, 0.135477, 0.188099
Argument too small in __ellint_rj
+ -68.8751, 0.221034, 0.188414
Argument too small in __ellint_rj
+ -68.8751, 0.308167, 0.188907
Argument too small in __ellint_rj
+ -68.8751, 0.632359, 0.192834
Argument too small in __ellint_rj
+ -68.8751, 0.814724, 0.198
Argument too small in __ellint_rj
-68.8751, + 0.835009, 0.198896
Argument too small in __ellint_rj
-68.8751, + 0.905792, 0.203226
Argument too small in __ellint_rj
-68.8751, + 0.913376, 0.203871
Argument too small in __ellint_rj
-68.8751, + 0.968868, 0.211615
Argument too small in __ellint_rj
-36.1317, + 0.126987, 0.258074
Argument too small in __ellint_rj
-36.1317, + 0.135477, 0.258115
Argument too small in __ellint_rj
-36.1317, + 0.221034, 0.258686
Argument too small in __ellint_rj
-36.1317, + 0.308167, 0.259579
Argument too small in __ellint_rj
-36.1317, + 0.632359, 0.266738
Argument too small in __ellint_rj
-36.1317, + 0.814724, 0.276242
Argument too small in __ellint_rj
-36.1317, + 0.835009, 0.2779
Argument too small in __ellint_rj
-36.1317, 0.905792, + 0.285938
Argument too small in __ellint_rj
-36.1317, 0.913376, + 0.287139
Argument too small in __ellint_rj
-36.1317, 0.968868, + 0.301608
Argument too small in __ellint_rj
-17.7129, 0.126987, + 0.363673
Argument too small in __ellint_rj
-17.7129, 0.135477, + 0.36375
Argument too small in __ellint_rj
-17.7129, 0.221034, 0.364822
+ Argument too small in __ellint_rj
-17.7129, 0.308167, 0.366503
+ Argument too small in __ellint_rj
-17.7129, 0.632359, 0.380066
+ Argument too small in __ellint_rj
-17.7129, 0.814724, 0.398311
+ Argument too small in __ellint_rj
-17.7129, 0.835009, 0.401518
+ Argument too small in __ellint_rj
-17.7129, 0.905792, 0.417145
+ Argument too small in __ellint_rj
-17.7129, 0.913376, 0.41949
Argument + too small in __ellint_rj
-17.7129, 0.968868, 0.447893
Argument + too small in __ellint_rj
-15.6641, 0.126987, 0.385409
Argument + too small in __ellint_rj
-15.6641, 0.135477, 0.385495
Argument + too small in __ellint_rj
-15.6641, 0.221034, 0.386686
Argument + too small in __ellint_rj
-15.6641, 0.308167, 0.388553
Argument + too small in __ellint_rj
-15.6641, 0.632359, 0.403643
Argument + too small in __ellint_rj
*** FURTHER CONTENT HAS BEEN TRUNCATED FOR BREVITY + ***
+

+
+ + Error + Output For ellint_3 (complete) with compiler GNU C++ version 7.1.0 and library + <cmath> and test data Complete Elliptic Integral PI: Mathworld Data +
+

+ CAUTION: + Gross error found at entry 3.
Found: 1.28255 Expected 2.22144 Error: + 0.732051
0.5, 0, 2.22144
Argument too small in __ellint_rj
+ -4, 0.3, 0.712709
Argument too small in __ellint_rj
-100000, -0.5, + 0.00496945
Argument too small in __ellint_rj
-1e+10, -0.75, 1.5708e-05
+ CAUTION: Gross error found at entry 8.
Found: 1.45615 Expected 101.045 + Error: 68.3919
0.999023, -0.875, 101.045
Argument too small in + __ellint_rj
-4.14952e+180, 0.5, 7.71119e-91
+

+
+ + Error + Output For ellint_3 with compiler GNU C++ version 7.1.0 and library <cmath> + and test data Elliptic Integral PI: Large Random Data +
+

+ Argument + too small in __ellint_rj
-88.2952, -8.04919, 0.814724, -0.874724
+ Argument too small in __ellint_rj
-88.2952, -7.46026, 0.135477, -0.827189
+ Argument too small in __ellint_rj
-88.2952, -7.29046, 0.905792, -0.877476
+ Argument too small in __ellint_rj
-88.2952, -6.23236, 0.835009, -0.652152
+ Argument too small in __ellint_rj
-88.2952, -5.57932, 0.126987, -0.512276
+ Argument too small in __ellint_rj
-88.2952, -4.43004, 0.968868, -0.543324
+ Argument too small in __ellint_rj
-88.2952, -3.83666, 0.913376, -0.513389
+ Argument too small in __ellint_rj
-88.2952, 0.93763, 0.221034, 0.158243
+ Argument too small in __ellint_rj
-88.2952, 0.944412, 0.632359, 0.160101
+ Argument too small in __ellint_rj
-88.2952, 2.64719, 0.308167, 0.188127
+ Argument too small in __ellint_rj
-88.2952, 6.29447, 0.0975404, 0.676465
+ Argument too small in __ellint_rj
-88.2952, 6.70017, 0.547221, 0.817785
+ Argument too small in __ellint_rj
-88.2952, 8.11584, 0.278498, 0.837452
+ Argument too small in __ellint_rj
-88.2952, 8.26752, 0.188382, 0.837571
+ Argument too small in __ellint_rj
-88.2952, 9.15014, 0.546881, 0.885365
+ Argument too small in __ellint_rj
-88.2952, 9.29777, 0.992881, 1.06701
+ Argument too small in __ellint_rj
-88.2952, 9.3539, 0.957507, 1.03573
+ Argument too small in __ellint_rj
-88.2952, 9.37736, 0.996461, 1.13933
+ Argument too small in __ellint_rj
-88.2952, 9.85763, 0.964889, 1.24906
+ Argument too small in __ellint_rj
-88.2952, 9.92923, 0.967695, 1.25621
+ Argument too small in __ellint_rj
-86.8166, -8.04919, 0.157613, -0.841405
+ Argument too small in __ellint_rj
-86.8166, -7.46026, 0.725839, -0.859877
+ Argument too small in __ellint_rj
-86.8166, -7.29046, 0.970593, -0.914439
+ Argument too small in __ellint_rj
-86.8166, -6.23236, 0.98111, -0.710627
+ Argument too small in __ellint_rj
-86.8166, -5.57932, 0.957167, -0.58106
+ Argument too small in __ellint_rj
-86.8166, -4.43004, 0.109862, -0.499839
+ Argument too small in __ellint_rj
-86.8166, -3.83666, 0.485376, -0.494286
+ Argument too small in __ellint_rj
-86.8166, 0.93763, 0.798106, 0.162644
+ Argument too small in __ellint_rj
-86.8166, 0.944412, 0.80028, 0.16282
+ Argument too small in __ellint_rj
-86.8166, 2.64719, 0.297029, 0.18978
+ Argument too small in __ellint_rj
-86.8166, 6.29447, 0.141886, 0.682392
+ Argument too small in __ellint_rj
-86.8166, 6.70017, 0.00478348, 0.812885
+ Argument too small in __ellint_rj
-86.8166, 8.11584, 0.421761, 0.849249
+ Argument too small in __ellint_rj
-86.8166, 8.26752, 0.112465, 0.843648
+ Argument too small in __ellint_rj
-86.8166, 9.15014, 0.915736, 0.953733
+ Argument too small in __ellint_rj
-86.8166, 9.29777, 0.639763, 0.936743
+ Argument too small in __ellint_rj
-86.8166, 9.3539, 0.792207, 0.987359
+ Argument too small in __ellint_rj
-86.8166, 9.37736, 0.878431, 1.02525
+ Argument too small in __ellint_rj
-86.8166, 9.85763, 0.959492, 1.25508
+ Argument too small in __ellint_rj
-86.8166, 9.92923, 0.503663, 1.16735
+ Argument too small in __ellint_rj
-84.7616, -8.04919, 0.655741, -0.873305
+ Argument too small in __ellint_rj
-84.7616, -7.46026, 0.797929, -0.879044
+ Argument too small in __ellint_rj
-84.7616, -7.29046, 0.0357117, -0.840785
+ Argument too small in __ellint_rj
-84.7616, -6.23236, 0.361294, -0.635502
+ Argument too small in __ellint_rj
-84.7616, -5.57932, 0.849129, -0.558231
+ Argument too small in __ellint_rj
-84.7616, -4.43004, 0.211924, -0.506533
+ Argument too small in __ellint_rj
-84.7616, -3.83666, 0.933993, -0.527681
+ Argument too small in __ellint_rj
-84.7616, 0.93763, 0.68136, 0.163458
+ Argument too small in __ellint_rj
-84.7616, 0.944412, 0.678735, 0.163582
+ Argument too small in __ellint_rj
-84.7616, 2.64719, 0.398739, 0.193458
+ Argument too small in __ellint_rj
-84.7616, 6.29447, 0.75774, 0.716086
+ Argument too small in __ellint_rj
-84.7616, 6.70017, 0.740647, 0.847849
+ Argument too small in __ellint_rj
-84.7616, 8.11584, 0.743132, 0.883827
+ Argument too small in __ellint_rj
-84.7616, 8.26752, 0.474759, 0.864181
+ Argument too small in __ellint_rj
-84.7616, 9.15014, 0.392227, 0.895646
+ Argument too small in __ellint_rj
-84.7616, 9.29777, 0.422088, 0.933423
+ Argument too small in __ellint_rj
*** FURTHER CONTENT HAS BEEN TRUNCATED + FOR BREVITY ***
+

+
+ + Error + Output For ellint_3 with compiler GNU C++ version 7.1.0 and library <cmath> + and test data Elliptic Integral PI: Random Data +
+

+ CAUTION: + Gross error found at entry 150.
Found: 1.09748 Expected 1.76311 Error: + 0.606506
0.546881, 1.27977, 0.349984, 1.76311
CAUTION: Gross error + found at entry 151.
Found: 1.39529 Expected 2.4686 Error: 0.769232
+ 0.546881, 1.31163, 0.907365, 2.4686
CAUTION: Gross error found at entry + 152.
Found: 1.17627 Expected 2.03097 Error: 0.726615
0.546881, + 1.42281, 0.196595, 2.03097
CAUTION: Gross error found at entry 153.
+ Found: 1.47192 Expected 2.76894 Error: 0.881179
0.546881, 1.43473, 0.848468, + 2.76894
CAUTION: Gross error found at entry 154.
Found: 1.23674 + Expected 2.22733 Error: 0.800966
0.546881, 1.50405, 0.251084, 2.22733
+ CAUTION: Gross error found at entry 155.
Found: 1.87704 Expected 3.98415 + Error: 1.12257
0.546881, 1.51564, 0.955018, 3.98415
CAUTION: Gross + error found at entry 156.
Found: 1.35817 Expected 2.53989 Error: 0.870091
+ 0.546881, 1.52005, 0.616045, 2.53989
CAUTION: Gross error found at entry + 157.
Found: 1.48427 Expected 2.87082 Error: 0.934166
0.546881, + 1.52189, 0.778898, 2.87082
CAUTION: Gross error found at entry 158.
+ Found: 1.32687 Expected 2.48679 Error: 0.874176
0.546881, 1.55961, 0.473289, + 2.48679
CAUTION: Gross error found at entry 159.
Found: 2.37485 + Expected 5.58805 Error: 1.35301
0.546881, 1.56524, 0.98746, 5.58805
+ CAUTION: Gross error found at entry 170.
Found: 1.08889 Expected 1.74565 + Error: 0.603142
0.547221, 1.27977, 0.285839, 1.74565
CAUTION: Gross + error found at entry 171.
Found: 1.21346 Expected 2.03956 Error: 0.680778
+ 0.547221, 1.31163, 0.67982, 2.03956
CAUTION: Gross error found at entry + 172.
Found: 1.36407 Expected 2.48392 Error: 0.820965
0.547221, + 1.42281, 0.7572, 2.48392
CAUTION: Gross error found at entry 173.
+ Found: 1.21442 Expected 2.12881 Error: 0.752947
0.547221, 1.43473, 0.39232, + 2.12881
CAUTION: Gross error found at entry 174.
Found: 1.4409 + Expected 2.74399 Error: 0.904352
0.547221, 1.50405, 0.753729, 2.74399
+ CAUTION: Gross error found at entry 175.
Found: 1.32796 Expected 2.46156 + Error: 0.853642
0.547221, 1.51564, 0.561557, 2.46156
CAUTION: Gross + error found at entry 176.
Found: 1.27163 Expected 2.32413 Error: 0.82767
+ 0.547221, 1.52005, 0.380446, 2.32413
CAUTION: Gross error found at entry + 177.
Found: 1.24298 Expected 2.25511 Error: 0.814274
0.547221, + 1.52189, 0.208068, 2.25511
CAUTION: Gross error found at entry 178.
+ Found: 1.36528 Expected 2.58635 Error: 0.894379
0.547221, 1.55961, 0.567822, + 2.58635
CAUTION: Gross error found at entry 179.
Found: 1.35151 + Expected 2.55463 Error: 0.890206
0.547221, 1.56524, 0.527371, 2.55463
+ CAUTION: Gross error found at entry 189.
Found: 1.01047 Expected 1.52344 + Error: 0.507658
0.632359, 0.993308, 0.964966, 1.52344
CAUTION: + Gross error found at entry 190.
Found: 1.05231 Expected 1.84135 Error: + 0.749817
0.632359, 1.27977, 0.129906, 1.84135
CAUTION: Gross error + found at entry 191.
Found: 1.07393 Expected 1.92224 Error: 0.789918
+ 0.632359, 1.31163, 0.154438, 1.92224
CAUTION: Gross error found at entry + 192.
Found: 1.22616 Expected 2.43657 Error: 0.987156
0.632359, + 1.42281, 0.568824, 2.43657
CAUTION: Gross error found at entry 193.
+ Found: 1.18462 Expected 2.33142 Error: 0.968083
0.632359, 1.43473, 0.394908, + 2.33142
CAUTION: Gross error found at entry 194.
Found: 1.25094 + Expected 2.59169 Error: 1.0718
0.632359, 1.50405, 0.469391, 2.59169
+ CAUTION: Gross error found at entry 195.
Found: 1.23693 Expected 2.56158 + Error: 1.07091
0.632359, 1.51564, 0.387296, 2.56158
CAUTION: Gross + error found at entry 196.
Found: 1.19839 Expected 2.45293 Error: 1.04685
+ 0.632359, 1.52005, 0.0119021, 2.45293
CAUTION: Gross error found at entry + 197.
Found: 1.39415 Expected 3.05228 Error: 1.18935
0.632359, 1.52189, + 0.726955, 3.05228
CAUTION: Gross error found at entry 198.
Found: + 1.25489 Expected 2.6569 Error: 1.11723
0.632359, 1.55961, 0.337123, 2.6569
+ CAUTION: Gross error found at entry 199.
Found: 1.27021 Expected 2.70857 + Error: 1.13237
0.632359, 1.56524, 0.38857, 2.70857
CAUTION: Gross + error found at entry 209.
Found: 0.83304 Expected 1.35947 Error: 0.631944
+ 0.814724, 0.993308, 0.119547, 1.35947
CAUTION: Gross error found at entry + 210.
Found: 1.07764 Expected 2.50291 Error: 1.32258
*** FURTHER + CONTENT HAS BEEN TRUNCATED FOR BREVITY ***
+

+
+ + Error + Output For ellint_3 with compiler GNU C++ version 7.1.0 and library <cmath> + and test data Elliptic Integral PI: Mathworld Data +
+

+ CAUTION: + Gross error found at entry 0.
Found: -0.809353 Expected -1.55741 Error: + 0.924263
1, -1, 0, -1.55741
CAUTION: Gross error found at entry + 11.
Found: 1.07555 Expected 13.2822 Error: 11.3492
0.999023, 1.5, + 0, 13.2822
CAUTION: Gross error found at entry 13.
Found: -5.86896e+09 + Expected 1.53659e+10 Error: 1.18973e+4932
0.5, 1e+10, 0.5, 1.53659e+10
+ Argument too small in __ellint_rj
-100000, 10, 0.75, 0.0347926
+ Argument too small in __ellint_rj
-1e+10, 10, 0.875, 0.000109956
+ Argument too small in __ellint_rj
-1e+10, 1e+20, 0.875, 1.00001e+15
+ Argument too small in __ellint_rj
-1e+10, 1.57031, 0.875, 1.57081e-05
+ CAUTION: Gross error found at entry 18.
Found: -6.25413e+09 Expected + 6.43274e+21 Error: 1.18973e+4932
0.999023, 1e+20, 0.875, 6.43274e+21
+ CAUTION: Gross error found at entry 19.
Found: 0.102424 Expected 0.196321 + Error: 0.916748
50, 0.125, 0.25, 0.196321
CAUTION: Gross error + found at entry 20.
Found: 0.798807 Expected 1.773 Error: 1.21956
+ 1.125, 1, 0.25, 1.773
CAUTION: Gross error found at entry 21.
Found: + 7.07138 Expected 0.662468 Error: 9.6743
1.125, 10, 0.25, 0.662468
+ CAUTION: Gross error found at entry 22.
Found: 2.04288 Expected -0.142697 + Error: 1.18973e+4932
1.125, 3, 0.25, -0.142697
CAUTION: Gross error + found at entry 23.
Found: 1.07762 Expected 22.2699 Error: 19.6659
+ 1.00391, 1.5, 0.125, 22.2699
CAUTION: Gross error found at entry 24.
+ Found: 15.1275 Expected -0.535406 Error: 1.18973e+4932
1.00391, 21.5, + 0.125, -0.535406
CAUTION: Gross error found at entry 41.
Found: + 1.57454 Expected 3.0338 Error: 0.926787
0.5, 2, 0, 3.0338
CAUTION: + Gross error found at entry 42.
Found: 3.0338 Expected 1.57454 Error: + 0.926787
-0.5, 2, 0, 1.57454
CAUTION: Gross error found at entry + 43.
Found: -1.57454 Expected -3.0338 Error: 0.926787
0.5, -2, 0, + -3.0338
CAUTION: Gross error found at entry 44.
Found: -3.0338 + Expected -1.57454 Error: 0.926787
-0.5, -2, 0, -1.57454
CAUTION: + Found non-finite result, when a finite value was expected at entry 51
+ Found: inf Expected -2.87535 Error: 1.18973e+4932
1, 2, 0.5, -2.87535
+ CAUTION: Gross error found at entry 51.
Found: inf Expected -2.87535 + Error: 1.18973e+4932
1, 2, 0.5, -2.87535
CAUTION: Found non-finite + result, when a finite value was expected at entry 52
Found: -inf Expected + 2.87535 Error: 1.18973e+4932
1, -2, 0.5, 2.87535
CAUTION: Gross + error found at entry 52.
Found: -inf Expected 2.87535 Error: 1.18973e+4932
+ 1, -2, 0.5, 2.87535
CAUTION: Found non-finite result, when a finite value + was expected at entry 53
Found: inf Expected -2.18504 Error: 1.18973e+4932
+ 1, 2, 6.22302e-61, -2.18504
CAUTION: Gross error found at entry 53.
+ Found: inf Expected -2.18504 Error: 1.18973e+4932
1, 2, 6.22302e-61, + -2.18504
CAUTION: Found non-finite result, when a finite value was expected + at entry 54
Found: -inf Expected 2.18504 Error: 1.18973e+4932
1, + -2, 6.22302e-61, 2.18504
CAUTION: Gross error found at entry 54.
+ Found: -inf Expected 2.18504 Error: 1.18973e+4932
1, -2, 6.22302e-61, + 2.18504
CAUTION: Gross error found at entry 57.
Found: 0.703907 + Expected 0.000975941 Error: 720.259
20, 3.14257, 0.5, 0.000975941
+ CAUTION: Gross error found at entry 58.
Found: -0.703907 Expected -0.000975941 + Error: 720.259
20, -3.14257, 0.5, -0.000975941
CAUTION: Gross error + found at entry 59.
Found: 1.24445 Expected -27.1647 Error: 1.18973e+4932
+ 1.01562, 1.6958, 0.5, -27.1647
CAUTION: Gross error found at entry 60.
+ Found: -1.24445 Expected 27.1647 Error: 1.18973e+4932
1.01562, -1.6958, + 0.5, 27.1647
+

+
+ + Error + Output For expint (Ei) with compiler GNU C++ version 7.1.0 and library <cmath> + and test data Exponential Integral Ei +
+

+ Continued + fraction failed in __expint_En_cont_frac.
-1.30539, -0.134326
+

+
+ + Error + Output For ibeta with compiler GNU C++ version 7.1.0 and library GSL 2.1 and + test data Incomplete Beta Function: Large and Diverse Values +
+

+ underflow
+ 1.04761e-05, 39078.2, 0.913384, 95444.4, 0, 1, 0
underflow
1.2158e-05, + 24110.5, 0.135563, 82239.7, 0, 1, 0
underflow
1.30342e-05, 26168.3, + 0.127074, 76710.7, 0, 1, 0
underflow
1.51962e-05, 16177.5, 0.814742, + 65795.4, 0, 1, 0
underflow
1.64873e-05, 470997, 0.127074, 60639.1, + 0, 1, 0
underflow
1.66259e-05, 147819, 0.632396, 60134.5, 0, 1, + 0
underflow
1.78638e-05, 439.387, 0.835025, 55972.4, 0, 1, 0
+ underflow
2.00434e-05, 482.007, 0.905801, 49885.1, 0, 1, 0
underflow
+ 2.05189e-05, 236088, 0.835025, 48722.7, 0, 1, 0
underflow
2.14336e-05, + 3719.28, 0.814742, 46647, 0, 1, 0
underflow
2.24486e-05, 445071, + 0.221112, 44532.6, 0, 1, 0
underflow
2.34849e-05, 25542.8, 0.968871, + 42569.8, 0, 1, 0
underflow
2.39993e-05, 462.946, 0.814742, 41661.1, + 0, 1, 0
underflow
2.52178e-05, 1832.27, 0.913384, 39646.4, 0, 1, + 0
underflow
2.87756e-05, 25491.8, 0.905801, 34740.9, 0, 1, 0
+ underflow
2.89316e-05, 494.984, 0.968871, 34557.6, 0, 1, 0
underflow
+ 3.11413e-05, 348144, 0.308236, 32098.3, 0, 1, 0
underflow
3.12319e-05, + 33713, 0.221112, 32007.5, 0, 1, 0
underflow
3.19889e-05, 3931.19, + 0.308236, 31251.9, 0, 1, 0
underflow
3.27129e-05, 3109.49, 0.968871, + 30560.4, 0, 1, 0
underflow
3.27529e-05, 25796.3, 0.835025, 30520.9, + 0, 1, 0
underflow
3.34106e-05, 3378.01, 0.221112, 29922, 0, 1, + 0
underflow
3.40793e-05, 288783, 0.814742, 29330.2, 0, 1, 0
+ underflow
3.46418e-05, 411.559, 0.913384, 28860.3, 0, 1, 0
underflow
+ 3.61632e-05, 311937, 0.905801, 27639.2, 0, 1, 0
underflow
3.75686e-05, + 386440, 0.913384, 26604.5, 0, 1, 0
underflow
3.99261e-05, 495352, + 0.968871, 25032.6, 0, 1, 0
underflow
4.01492e-05, 3246.23, 0.905801, + 24898.5, 0, 1, 0
underflow
4.0288e-05, 2569.28, 0.835025, 24812.9, + 0, 1, 0
underflow
4.11667e-05, 24253.8, 0.308236, 24280.8, 0, 1, + 0
underflow
4.17714e-05, 274447, 0.135563, 23926.7, 0, 1, 0
+ underflow
4.66877e-05, 3780.93, 0.632396, 21410.1, 0, 1, 0
underflow
+ 4.73604e-05, 48598.7, 0.632396, 21103.3, 0, 1, 0
underflow
0.00013245, + 251.768, 0.968871, 7543.9, 0, 1, 0
underflow
0.000168283, 195801, + 0.905801, 5929.61, 0, 1, 0
underflow
0.000177906, 276489, 0.814742, + 5607.86, 0, 1, 0
underflow
0.000183097, 316055, 0.127074, 5448.36, + 0, 1, 0
underflow
0.000190369, 159132, 0.835025, 5240.42, 0, 1, + 0
underflow
0.000191066, 419861, 0.913384, 5220.29, 0, 1, 0
+ underflow
0.000192195, 177798, 0.308236, 5190.39, 0, 1, 0
underflow
+ 0.000220499, 107380, 0.135563, 4523.03, 0, 1, 0
underflow
0.00022254, + 1432.25, 0.814742, 4485.74, 0, 1, 0
underflow
0.000240291, 49604.4, + 0.632396, 4150.25, 0, 1, 0
underflow
0.000251444, 15605.8, 0.135563, + 3966.81, 0, 1, 0
underflow
0.000274279, 289206, 0.968871, 3632.79, + 0, 1, 0
underflow
0.000274343, 2954.47, 0.308236, 3636.51, 0, 1, + 0
underflow
0.000278714, 4023.16, 0.632396, 3579.05, 0, 1, 0
+ underflow
0.000288369, 460073, 0.221112, 3454.19, 0, 1, 0
underflow
+ 0.000294717, 4642.26, 0.221112, 3384.08, 0, 1, 0
underflow
0.000303403, + 2574.36, 0.835025, 3287.52, 0, 1, 0
underflow
0.000304309, 4480.75, + 0.905801, 3277.17, 0, 1, 0
underflow
0.00031313, 47957, 0.308236, + 3182.22, 0, 1, 0
underflow
0.000320063, 25544.6, 0.905801, 3113.68, + 0, 1, 0
underflow
0.000334818, 29065.5, 0.968871, 2975.86, 0, 1, + 0
underflow
0.00034899, 41187.6, 0.913384, 2854.23, 0, 1, 0
+ underflow
0.000350247, 426.308, 0.905801, 2848.5, 0, 1, 0
underflow
+ 0.000357727, 31752.2, 0.127074, 2784.5, 0, 1, 0
underflow
0.000412091, + 367.714, 0.913384, 2420.17, 0, 1, 0
underflow
0.000417933, 4668.47, + 0.968871, 2383.72, 0, 1, 0
underflow
0.000424632, 17994.9, 0.221112, + 2344.63, 0, 1, 0
underflow
0.000427051, 2443.44, 0.913384, 2333.28, + 0, 1, 0
underflow
0.000437724, 454399, 0.632396, 2270.98, 0, 1, + 0
underflow
0.000450377, 10660.8, 0.835025, 2210.53, 0, 1, 0
+ underflow
0.000475601, 19603, 0.814742, 2092.17, 0, 1, 0
underflow
+ 0.00116972, 4487.22, 0.221112, 845.964, 0, 1, 0
underflow
0.00124188, + 211066, 0.632396, 792.493, 0, 1, 0
underflow
0.00128578, 4738.41, + 0.308236, 768.75, 0, 1, 0
underflow
0.00133388, 46277.8, 0.913384, + 738.46, 0, 1, 0
underflow
0.00138692, 2158.76, 0.814742, 712.816, + 0, 1, 0
underflow
0.00153268, 13060.2, 0.968871, 642.474, 0, 1, + 0
underflow
0.00159946, 1780.43, 0.968871, 617.202, 0, 1, 0
+ *** FURTHER CONTENT HAS BEEN TRUNCATED FOR BREVITY ***
+

+
+ + Error + Output For jacobi_dn with compiler GNU C++ version 7.1.0 and library GSL 2.1 + and test data Jacobi Elliptic: Modulus near 1 +
+

+ |m| + > 1.0
-4.0246, 1, -0.999361, 0.0357365, 0.0357231
|m| > 1.0
+ -4.0246, 1, -0.999361, 0.0357497, 0.0357097
|m| > 1.0
-4.0246, + 1, -0.99936, 0.0357762, 0.0356829
|m| > 1.0
-4.0246, 1, -0.999359, + 0.0357895, 0.0356695
|m| > 1.0
-4.0246, 1.00001, -0.999354, + 0.0359354, 0.0355222
|m| > 1.0
-4.0246, 1.00003, -0.999347, + 0.0361343, 0.0353212
|m| > 1.0
-4.0246, 1.00004, -0.999343, + 0.036247, 0.0352073
|m| > 1.0
-4.0246, 1.0001, -0.999311, 0.0371157, + 0.0343296
|m| > 1.0
-4.0246, 1.00016, -0.99928, 0.0379513, 0.0334851
+ |m| > 1.0
-4.0246, 1.00027, -0.999221, 0.0394571, 0.0319634
+ |m| > 1.0
-4.0246, 1.00076, -0.99893, 0.0462407, 0.0251046
|m| + > 1.0
-4.0246, 1.00125, -0.998589, 0.0531109, 0.0181532
|m| + > 1.0
-4.0246, 1.00232, -0.99768, 0.0680761, 0.0029944
|m| > + 1.0
-4.0246, 1.00604, -0.992752, 0.120179, -0.049966
|m| > 1.0
+ -4.0246, 1.01557, -0.967356, 0.25342, -0.186698
|m| > 1.0
-4.0246, + 1.03059, -0.890373, 0.455232, -0.397492
|m| > 1.0
-4.0246, 1.06239, + -0.607191, 0.794556, -0.76412
|m| > 1.0
-3.73013, 1, -0.998849, + 0.0479567, 0.0479467
|m| > 1.0
-3.73013, 1, -0.998849, 0.0479665, + 0.0479367
|m| > 1.0
-3.73013, 1, -0.998848, 0.0479862, 0.0479167
+ |m| > 1.0
-3.73013, 1, -0.998848, 0.047996, 0.0479067
|m| > + 1.0
-3.73013, 1.00001, -0.998842, 0.0481042, 0.0477966
|m| > + 1.0
-3.73013, 1.00003, -0.998835, 0.0482517, 0.0476465
|m| > + 1.0
-3.73013, 1.00004, -0.998831, 0.0483354, 0.0475615
|m| > + 1.0
-3.73013, 1.0001, -0.9988, 0.0489797, 0.0469059
|m| > 1.0
+ -3.73013, 1.00016, -0.998769, 0.0495995, 0.0462752
|m| > 1.0
+ -3.73013, 1.00027, -0.998713, 0.0507164, 0.0451386
|m| > 1.0
+ -3.73013, 1.00076, -0.998445, 0.0557477, 0.0400164
|m| > 1.0
+ -3.73013, 1.00125, -0.998147, 0.0608429, 0.0348257
|m| > 1.0
+ -3.73013, 1.00232, -0.997409, 0.0719406, 0.0235071
|m| > 1.0
+ -3.73013, 1.00604, -0.993866, 0.110593, -0.016048
|m| > 1.0
+ -3.73013, 1.01557, -0.977708, 0.209971, -0.118704
|m| > 1.0
+ -3.73013, 1.03059, -0.931162, 0.364606, -0.281224
|m| > 1.0
+ -3.73013, 1.06239, -0.753495, 0.657453, -0.599326
|m| > 1.0
+ -3.64523, 1, -0.998637, 0.0521997, 0.0521906
|m| > 1.0
-3.64523, + 1, -0.998636, 0.0522087, 0.0521814
|m| > 1.0
-3.64523, 1, -0.998635, + 0.0522268, 0.052163
|m| > 1.0
-3.64523, 1, -0.998635, 0.0522358, + 0.0521538
|m| > 1.0
-3.64523, 1.00001, -0.99863, 0.052335, 0.0520526
+ |m| > 1.0
-3.64523, 1.00003, -0.998622, 0.0524703, 0.0519145
+ |m| > 1.0
-3.64523, 1.00004, -0.998618, 0.052547, 0.0518363
+ |m| > 1.0
-3.64523, 1.0001, -0.998587, 0.0531379, 0.0512335
+ |m| > 1.0
-3.64523, 1.00016, -0.998557, 0.0537063, 0.0506536
+ |m| > 1.0
-3.64523, 1.00027, -0.998501, 0.0547305, 0.0496084
+ |m| > 1.0
-3.64523, 1.00076, -0.998238, 0.0593443, 0.0448986
+ |m| > 1.0
-3.64523, 1.00125, -0.997949, 0.0640165, 0.0401258
+ |m| > 1.0
-3.64523, 1.00232, -0.997244, 0.0741927, 0.0297191
+ |m| > 1.0
-3.64523, 1.00604, -0.993972, 0.109636, -0.00664888
+ |m| > 1.0
-3.64523, 1.01557, -0.979623, 0.200844, -0.101111
+ |m| > 1.0
-3.64523, 1.03059, -0.939163, 0.343472, -0.251382
+ |m| > 1.0
-3.64523, 1.06239, -0.784719, 0.619852, -0.552253
+ |m| > 1.0
-3.11618, 1, -0.996078, 0.0884811, 0.0884757
|m| > + 1.0
-3.11618, 1, -0.996077, 0.0884863, 0.0884702
|m| > 1.0
+ -3.11618, 1, -0.996076, 0.0884967, 0.0884593
|m| > 1.0
-3.11618, + 1, -0.996076, 0.0885019, 0.0884538
|m| > 1.0
-3.11618, 1.00001, + -0.996071, 0.0885593, 0.0883936
|m| > 1.0
-3.11618, 1.00003, + -0.996064, 0.0886376, 0.0883114
|m| > 1.0
-3.11618, 1.00004, + -0.99606, 0.0886819, 0.0882648
|m| > 1.0
-3.11618, 1.0001, -0.99603, + 0.0890236, 0.0879059
|m| > 1.0
-3.11618, 1.00016, -0.996, 0.0893523, + 0.0875607
|m| > 1.0
-3.11618, 1.00027, -0.995947, 0.0899445, + 0.0869386
|m| > 1.0
-3.11618, 1.00076, -0.995702, 0.092612, + 0.0841353
|m| > 1.0
-3.11618, 1.00125, -0.995447, 0.0953126, + 0.0812953
|m| > 1.0
-3.11618, 1.00232, -0.994867, 0.101193, + 0.0751049
|m| > 1.0
-3.11618, 1.00604, -0.992571, 0.121667, + 0.0534858
|m| > 1.0
-3.11618, 1.01557, -0.984666, 0.174451, + -0.00273723
|m| > 1.0
-3.11618, 1.03059, -0.966077, 0.258253, + -0.0934336
|m| > 1.0
-3.11618, 1.06239, -0.901067, 0.433681, + -0.289151
|m| > 1.0
-2.78966, 1, -0.992478, 0.122424, 0.12242
+ |m| > 1.0
-2.78966, 1, -0.992477, 0.122428, 0.122416
*** FURTHER + CONTENT HAS BEEN TRUNCATED FOR BREVITY ***
+

+
+ + Error + Output For jacobi_cn with compiler GNU C++ version 7.1.0 and library GSL 2.1 + and test data Jacobi Elliptic: Modulus near 1 +
+

+ |m| + > 1.0
-4.0246, 1, -0.999361, 0.0357365, 0.0357231
|m| > 1.0
+ -4.0246, 1, -0.999361, 0.0357497, 0.0357097
|m| > 1.0
-4.0246, + 1, -0.99936, 0.0357762, 0.0356829
|m| > 1.0
-4.0246, 1, -0.999359, + 0.0357895, 0.0356695
|m| > 1.0
-4.0246, 1.00001, -0.999354, + 0.0359354, 0.0355222
|m| > 1.0
-4.0246, 1.00003, -0.999347, + 0.0361343, 0.0353212
|m| > 1.0
-4.0246, 1.00004, -0.999343, + 0.036247, 0.0352073
|m| > 1.0
-4.0246, 1.0001, -0.999311, 0.0371157, + 0.0343296
|m| > 1.0
-4.0246, 1.00016, -0.99928, 0.0379513, 0.0334851
+ |m| > 1.0
-4.0246, 1.00027, -0.999221, 0.0394571, 0.0319634
+ |m| > 1.0
-4.0246, 1.00076, -0.99893, 0.0462407, 0.0251046
|m| + > 1.0
-4.0246, 1.00125, -0.998589, 0.0531109, 0.0181532
|m| + > 1.0
-4.0246, 1.00232, -0.99768, 0.0680761, 0.0029944
|m| > + 1.0
-4.0246, 1.00604, -0.992752, 0.120179, -0.049966
|m| > 1.0
+ -4.0246, 1.01557, -0.967356, 0.25342, -0.186698
|m| > 1.0
-4.0246, + 1.03059, -0.890373, 0.455232, -0.397492
|m| > 1.0
-4.0246, 1.06239, + -0.607191, 0.794556, -0.76412
|m| > 1.0
-3.73013, 1, -0.998849, + 0.0479567, 0.0479467
|m| > 1.0
-3.73013, 1, -0.998849, 0.0479665, + 0.0479367
|m| > 1.0
-3.73013, 1, -0.998848, 0.0479862, 0.0479167
+ |m| > 1.0
-3.73013, 1, -0.998848, 0.047996, 0.0479067
|m| > + 1.0
-3.73013, 1.00001, -0.998842, 0.0481042, 0.0477966
|m| > + 1.0
-3.73013, 1.00003, -0.998835, 0.0482517, 0.0476465
|m| > + 1.0
-3.73013, 1.00004, -0.998831, 0.0483354, 0.0475615
|m| > + 1.0
-3.73013, 1.0001, -0.9988, 0.0489797, 0.0469059
|m| > 1.0
+ -3.73013, 1.00016, -0.998769, 0.0495995, 0.0462752
|m| > 1.0
+ -3.73013, 1.00027, -0.998713, 0.0507164, 0.0451386
|m| > 1.0
+ -3.73013, 1.00076, -0.998445, 0.0557477, 0.0400164
|m| > 1.0
+ -3.73013, 1.00125, -0.998147, 0.0608429, 0.0348257
|m| > 1.0
+ -3.73013, 1.00232, -0.997409, 0.0719406, 0.0235071
|m| > 1.0
+ -3.73013, 1.00604, -0.993866, 0.110593, -0.016048
|m| > 1.0
+ -3.73013, 1.01557, -0.977708, 0.209971, -0.118704
|m| > 1.0
+ -3.73013, 1.03059, -0.931162, 0.364606, -0.281224
|m| > 1.0
+ -3.73013, 1.06239, -0.753495, 0.657453, -0.599326
|m| > 1.0
+ -3.64523, 1, -0.998637, 0.0521997, 0.0521906
|m| > 1.0
-3.64523, + 1, -0.998636, 0.0522087, 0.0521814
|m| > 1.0
-3.64523, 1, -0.998635, + 0.0522268, 0.052163
|m| > 1.0
-3.64523, 1, -0.998635, 0.0522358, + 0.0521538
|m| > 1.0
-3.64523, 1.00001, -0.99863, 0.052335, 0.0520526
+ |m| > 1.0
-3.64523, 1.00003, -0.998622, 0.0524703, 0.0519145
+ |m| > 1.0
-3.64523, 1.00004, -0.998618, 0.052547, 0.0518363
+ |m| > 1.0
-3.64523, 1.0001, -0.998587, 0.0531379, 0.0512335
+ |m| > 1.0
-3.64523, 1.00016, -0.998557, 0.0537063, 0.0506536
+ |m| > 1.0
-3.64523, 1.00027, -0.998501, 0.0547305, 0.0496084
+ |m| > 1.0
-3.64523, 1.00076, -0.998238, 0.0593443, 0.0448986
+ |m| > 1.0
-3.64523, 1.00125, -0.997949, 0.0640165, 0.0401258
+ |m| > 1.0
-3.64523, 1.00232, -0.997244, 0.0741927, 0.0297191
+ |m| > 1.0
-3.64523, 1.00604, -0.993972, 0.109636, -0.00664888
+ |m| > 1.0
-3.64523, 1.01557, -0.979623, 0.200844, -0.101111
+ |m| > 1.0
-3.64523, 1.03059, -0.939163, 0.343472, -0.251382
+ |m| > 1.0
-3.64523, 1.06239, -0.784719, 0.619852, -0.552253
+ |m| > 1.0
-3.11618, 1, -0.996078, 0.0884811, 0.0884757
|m| > + 1.0
-3.11618, 1, -0.996077, 0.0884863, 0.0884702
|m| > 1.0
+ -3.11618, 1, -0.996076, 0.0884967, 0.0884593
|m| > 1.0
-3.11618, + 1, -0.996076, 0.0885019, 0.0884538
|m| > 1.0
-3.11618, 1.00001, + -0.996071, 0.0885593, 0.0883936
|m| > 1.0
-3.11618, 1.00003, + -0.996064, 0.0886376, 0.0883114
|m| > 1.0
-3.11618, 1.00004, + -0.99606, 0.0886819, 0.0882648
|m| > 1.0
-3.11618, 1.0001, -0.99603, + 0.0890236, 0.0879059
|m| > 1.0
-3.11618, 1.00016, -0.996, 0.0893523, + 0.0875607
|m| > 1.0
-3.11618, 1.00027, -0.995947, 0.0899445, + 0.0869386
|m| > 1.0
-3.11618, 1.00076, -0.995702, 0.092612, + 0.0841353
|m| > 1.0
-3.11618, 1.00125, -0.995447, 0.0953126, + 0.0812953
|m| > 1.0
-3.11618, 1.00232, -0.994867, 0.101193, + 0.0751049
|m| > 1.0
-3.11618, 1.00604, -0.992571, 0.121667, + 0.0534858
|m| > 1.0
-3.11618, 1.01557, -0.984666, 0.174451, + -0.00273723
|m| > 1.0
-3.11618, 1.03059, -0.966077, 0.258253, + -0.0934336
|m| > 1.0
-3.11618, 1.06239, -0.901067, 0.433681, + -0.289151
|m| > 1.0
-2.78966, 1, -0.992478, 0.122424, 0.12242
+ |m| > 1.0
-2.78966, 1, -0.992477, 0.122428, 0.122416
*** FURTHER + CONTENT HAS BEEN TRUNCATED FOR BREVITY ***
+

+
+ + Error + Output For jacobi_sn with compiler GNU C++ version 7.1.0 and library GSL 2.1 + and test data Jacobi Elliptic: Modulus near 1 +
+

+ |m| + > 1.0
-4.0246, 1, -0.999361, 0.0357365, 0.0357231
|m| > 1.0
+ -4.0246, 1, -0.999361, 0.0357497, 0.0357097
|m| > 1.0
-4.0246, + 1, -0.99936, 0.0357762, 0.0356829
|m| > 1.0
-4.0246, 1, -0.999359, + 0.0357895, 0.0356695
|m| > 1.0
-4.0246, 1.00001, -0.999354, + 0.0359354, 0.0355222
|m| > 1.0
-4.0246, 1.00003, -0.999347, + 0.0361343, 0.0353212
|m| > 1.0
-4.0246, 1.00004, -0.999343, + 0.036247, 0.0352073
|m| > 1.0
-4.0246, 1.0001, -0.999311, 0.0371157, + 0.0343296
|m| > 1.0
-4.0246, 1.00016, -0.99928, 0.0379513, 0.0334851
+ |m| > 1.0
-4.0246, 1.00027, -0.999221, 0.0394571, 0.0319634
+ |m| > 1.0
-4.0246, 1.00076, -0.99893, 0.0462407, 0.0251046
|m| + > 1.0
-4.0246, 1.00125, -0.998589, 0.0531109, 0.0181532
|m| + > 1.0
-4.0246, 1.00232, -0.99768, 0.0680761, 0.0029944
|m| > + 1.0
-4.0246, 1.00604, -0.992752, 0.120179, -0.049966
|m| > 1.0
+ -4.0246, 1.01557, -0.967356, 0.25342, -0.186698
|m| > 1.0
-4.0246, + 1.03059, -0.890373, 0.455232, -0.397492
|m| > 1.0
-4.0246, 1.06239, + -0.607191, 0.794556, -0.76412
|m| > 1.0
-3.73013, 1, -0.998849, + 0.0479567, 0.0479467
|m| > 1.0
-3.73013, 1, -0.998849, 0.0479665, + 0.0479367
|m| > 1.0
-3.73013, 1, -0.998848, 0.0479862, 0.0479167
+ |m| > 1.0
-3.73013, 1, -0.998848, 0.047996, 0.0479067
|m| > + 1.0
-3.73013, 1.00001, -0.998842, 0.0481042, 0.0477966
|m| > + 1.0
-3.73013, 1.00003, -0.998835, 0.0482517, 0.0476465
|m| > + 1.0
-3.73013, 1.00004, -0.998831, 0.0483354, 0.0475615
|m| > + 1.0
-3.73013, 1.0001, -0.9988, 0.0489797, 0.0469059
|m| > 1.0
+ -3.73013, 1.00016, -0.998769, 0.0495995, 0.0462752
|m| > 1.0
+ -3.73013, 1.00027, -0.998713, 0.0507164, 0.0451386
|m| > 1.0
+ -3.73013, 1.00076, -0.998445, 0.0557477, 0.0400164
|m| > 1.0
+ -3.73013, 1.00125, -0.998147, 0.0608429, 0.0348257
|m| > 1.0
+ -3.73013, 1.00232, -0.997409, 0.0719406, 0.0235071
|m| > 1.0
+ -3.73013, 1.00604, -0.993866, 0.110593, -0.016048
|m| > 1.0
+ -3.73013, 1.01557, -0.977708, 0.209971, -0.118704
|m| > 1.0
+ -3.73013, 1.03059, -0.931162, 0.364606, -0.281224
|m| > 1.0
+ -3.73013, 1.06239, -0.753495, 0.657453, -0.599326
|m| > 1.0
+ -3.64523, 1, -0.998637, 0.0521997, 0.0521906
|m| > 1.0
-3.64523, + 1, -0.998636, 0.0522087, 0.0521814
|m| > 1.0
-3.64523, 1, -0.998635, + 0.0522268, 0.052163
|m| > 1.0
-3.64523, 1, -0.998635, 0.0522358, + 0.0521538
|m| > 1.0
-3.64523, 1.00001, -0.99863, 0.052335, 0.0520526
+ |m| > 1.0
-3.64523, 1.00003, -0.998622, 0.0524703, 0.0519145
+ |m| > 1.0
-3.64523, 1.00004, -0.998618, 0.052547, 0.0518363
+ |m| > 1.0
-3.64523, 1.0001, -0.998587, 0.0531379, 0.0512335
+ |m| > 1.0
-3.64523, 1.00016, -0.998557, 0.0537063, 0.0506536
+ |m| > 1.0
-3.64523, 1.00027, -0.998501, 0.0547305, 0.0496084
+ |m| > 1.0
-3.64523, 1.00076, -0.998238, 0.0593443, 0.0448986
+ |m| > 1.0
-3.64523, 1.00125, -0.997949, 0.0640165, 0.0401258
+ |m| > 1.0
-3.64523, 1.00232, -0.997244, 0.0741927, 0.0297191
+ |m| > 1.0
-3.64523, 1.00604, -0.993972, 0.109636, -0.00664888
+ |m| > 1.0
-3.64523, 1.01557, -0.979623, 0.200844, -0.101111
+ |m| > 1.0
-3.64523, 1.03059, -0.939163, 0.343472, -0.251382
+ |m| > 1.0
-3.64523, 1.06239, -0.784719, 0.619852, -0.552253
+ |m| > 1.0
-3.11618, 1, -0.996078, 0.0884811, 0.0884757
|m| > + 1.0
-3.11618, 1, -0.996077, 0.0884863, 0.0884702
|m| > 1.0
+ -3.11618, 1, -0.996076, 0.0884967, 0.0884593
|m| > 1.0
-3.11618, + 1, -0.996076, 0.0885019, 0.0884538
|m| > 1.0
-3.11618, 1.00001, + -0.996071, 0.0885593, 0.0883936
|m| > 1.0
-3.11618, 1.00003, + -0.996064, 0.0886376, 0.0883114
|m| > 1.0
-3.11618, 1.00004, + -0.99606, 0.0886819, 0.0882648
|m| > 1.0
-3.11618, 1.0001, -0.99603, + 0.0890236, 0.0879059
|m| > 1.0
-3.11618, 1.00016, -0.996, 0.0893523, + 0.0875607
|m| > 1.0
-3.11618, 1.00027, -0.995947, 0.0899445, + 0.0869386
|m| > 1.0
-3.11618, 1.00076, -0.995702, 0.092612, + 0.0841353
|m| > 1.0
-3.11618, 1.00125, -0.995447, 0.0953126, + 0.0812953
|m| > 1.0
-3.11618, 1.00232, -0.994867, 0.101193, + 0.0751049
|m| > 1.0
-3.11618, 1.00604, -0.992571, 0.121667, + 0.0534858
|m| > 1.0
-3.11618, 1.01557, -0.984666, 0.174451, + -0.00273723
|m| > 1.0
-3.11618, 1.03059, -0.966077, 0.258253, + -0.0934336
|m| > 1.0
-3.11618, 1.06239, -0.901067, 0.433681, + -0.289151
|m| > 1.0
-2.78966, 1, -0.992478, 0.122424, 0.12242
+ |m| > 1.0
-2.78966, 1, -0.992477, 0.122428, 0.122416
*** FURTHER + CONTENT HAS BEEN TRUNCATED FOR BREVITY ***
+

+
+ + Error + Output For jacobi_dn with compiler GNU C++ version 7.1.0 and library GSL 2.1 + and test data Jacobi Elliptic: Random Small Values +
+

+ |m| + > 1.0
1.65048e-12, 1.65574, 1.65048e-12, 1, 1
|m| > 1.0
+ 2.06542e-12, 1.65574, 2.06542e-12, 1, 1
|m| > 1.0
6.93323e-12, + 1.65574, 6.93323e-12, 1, 1
|m| > 1.0
1.33514e-11, 1.65574, 1.33514e-11, + 1, 1
|m| > 1.0
1.63998e-11, 1.65574, 1.63998e-11, 1, 1
+ |m| > 1.0
5.73016e-11, 1.65574, 5.73016e-11, 1, 1
|m| > 1.0
+ 1.11373e-10, 1.65574, 1.11373e-10, 1, 1
|m| > 1.0
1.42147e-10, + 1.65574, 1.42147e-10, 1, 1
|m| > 1.0
3.80063e-10, 1.65574, 3.80063e-10, + 1, 1
|m| > 1.0
6.09163e-10, 1.65574, 6.09163e-10, 1, 1
+ |m| > 1.0
1.02216e-09, 1.65574, 1.02216e-09, 1, 1
|m| > 1.0
+ 2.88192e-09, 1.65574, 2.88192e-09, 1, 1
|m| > 1.0
4.76278e-09, + 1.65574, 4.76278e-09, 1, 1
|m| > 1.0
8.85413e-09, 1.65574, 8.85413e-09, + 1, 1
|m| > 1.0
2.30503e-08, 1.65574, 2.30503e-08, 1, 1
+ |m| > 1.0
5.93925e-08, 1.65574, 5.93925e-08, 1, 1
|m| > 1.0
+ 1.16676e-07, 1.65574, 1.16676e-07, 1, 1
|m| > 1.0
2.37997e-07, + 1.65574, 2.37997e-07, 1, 1
|m| > 1.0
4.68466e-07, 1.65574, 4.68466e-07, + 1, 1
|m| > 1.0
9.3827e-07, 1.65574, 9.3827e-07, 1, 1
|m| + > 1.0
1.10399e-06, 1.65574, 1.10399e-06, 1, 1
|m| > 1.0
+ 3.29178e-06, 1.65574, 3.29178e-06, 1, 1
|m| > 1.0
7.51721e-06, + 1.65574, 7.51721e-06, 1, 1
|m| > 1.0
1.51147e-05, 1.65574, 1.51147e-05, + 1, 1
|m| > 1.0
2.9864e-05, 1.65574, 2.9864e-05, 1, 1
|m| + > 1.0
3.38703e-05, 1.65574, 3.38703e-05, 1, 1
|m| > 1.0
+ 9.06601e-05, 1.65574, 9.06601e-05, 1, 1
|m| > 1.0
0.000219495, + 1.65574, 0.000219495, 1, 1
|m| > 1.0
0.000439522, 1.65574, 0.000439521, + 1, 1
|m| > 1.0
0.000633315, 1.65574, 0.000633315, 1, 0.999999
+ |m| > 1.0
0.00111512, 1.65574, 0.00111512, 0.999999, 0.999998
+ |m| > 1.0
0.00196247, 1.65574, 0.00196246, 0.999998, 0.999995
+ |m| > 1.0
0.00555375, 1.65574, 0.00555365, 0.999985, 0.999958
+ |m| > 1.0
0.00869113, 1.65574, 0.00869072, 0.999962, 0.999896
+ |m| > 1.0
0.0299334, 1.65574, 0.0299166, 0.999552, 0.998772
+ |m| > 1.0
0.0512426, 1.65574, 0.0511588, 0.998691, 0.996406
+ |m| > 1.0
0.112013, 1.65574, 0.111143, 0.993804, 0.982922
|m| + > 1.0
0.234804, 1.65574, 0.227, 0.973895, 0.926679
|m| > + 1.0
0.489873, 1.65574, 0.425971, 0.904737, 0.708912
|m| > 1.0
+ 0.751831, 1.65574, 0.553446, 0.832885, 0.400346
|m| > 1.0
1.65574, + 1.65574, 0.408154, 0.912913, -0.737088
+

+
+ + Error + Output For jacobi_cn with compiler GNU C++ version 7.1.0 and library GSL 2.1 + and test data Jacobi Elliptic: Random Small Values +
+

+ |m| + > 1.0
1.65048e-12, 1.65574, 1.65048e-12, 1, 1
|m| > 1.0
+ 2.06542e-12, 1.65574, 2.06542e-12, 1, 1
|m| > 1.0
6.93323e-12, + 1.65574, 6.93323e-12, 1, 1
|m| > 1.0
1.33514e-11, 1.65574, 1.33514e-11, + 1, 1
|m| > 1.0
1.63998e-11, 1.65574, 1.63998e-11, 1, 1
+ |m| > 1.0
5.73016e-11, 1.65574, 5.73016e-11, 1, 1
|m| > 1.0
+ 1.11373e-10, 1.65574, 1.11373e-10, 1, 1
|m| > 1.0
1.42147e-10, + 1.65574, 1.42147e-10, 1, 1
|m| > 1.0
3.80063e-10, 1.65574, 3.80063e-10, + 1, 1
|m| > 1.0
6.09163e-10, 1.65574, 6.09163e-10, 1, 1
+ |m| > 1.0
1.02216e-09, 1.65574, 1.02216e-09, 1, 1
|m| > 1.0
+ 2.88192e-09, 1.65574, 2.88192e-09, 1, 1
|m| > 1.0
4.76278e-09, + 1.65574, 4.76278e-09, 1, 1
|m| > 1.0
8.85413e-09, 1.65574, 8.85413e-09, + 1, 1
|m| > 1.0
2.30503e-08, 1.65574, 2.30503e-08, 1, 1
+ |m| > 1.0
5.93925e-08, 1.65574, 5.93925e-08, 1, 1
|m| > 1.0
+ 1.16676e-07, 1.65574, 1.16676e-07, 1, 1
|m| > 1.0
2.37997e-07, + 1.65574, 2.37997e-07, 1, 1
|m| > 1.0
4.68466e-07, 1.65574, 4.68466e-07, + 1, 1
|m| > 1.0
9.3827e-07, 1.65574, 9.3827e-07, 1, 1
|m| + > 1.0
1.10399e-06, 1.65574, 1.10399e-06, 1, 1
|m| > 1.0
+ 3.29178e-06, 1.65574, 3.29178e-06, 1, 1
|m| > 1.0
7.51721e-06, + 1.65574, 7.51721e-06, 1, 1
|m| > 1.0
1.51147e-05, 1.65574, 1.51147e-05, + 1, 1
|m| > 1.0
2.9864e-05, 1.65574, 2.9864e-05, 1, 1
|m| + > 1.0
3.38703e-05, 1.65574, 3.38703e-05, 1, 1
|m| > 1.0
+ 9.06601e-05, 1.65574, 9.06601e-05, 1, 1
|m| > 1.0
0.000219495, + 1.65574, 0.000219495, 1, 1
|m| > 1.0
0.000439522, 1.65574, 0.000439521, + 1, 1
|m| > 1.0
0.000633315, 1.65574, 0.000633315, 1, 0.999999
+ |m| > 1.0
0.00111512, 1.65574, 0.00111512, 0.999999, 0.999998
+ |m| > 1.0
0.00196247, 1.65574, 0.00196246, 0.999998, 0.999995
+ |m| > 1.0
0.00555375, 1.65574, 0.00555365, 0.999985, 0.999958
+ |m| > 1.0
0.00869113, 1.65574, 0.00869072, 0.999962, 0.999896
+ |m| > 1.0
0.0299334, 1.65574, 0.0299166, 0.999552, 0.998772
+ |m| > 1.0
0.0512426, 1.65574, 0.0511588, 0.998691, 0.996406
+ |m| > 1.0
0.112013, 1.65574, 0.111143, 0.993804, 0.982922
|m| + > 1.0
0.234804, 1.65574, 0.227, 0.973895, 0.926679
|m| > + 1.0
0.489873, 1.65574, 0.425971, 0.904737, 0.708912
|m| > 1.0
+ 0.751831, 1.65574, 0.553446, 0.832885, 0.400346
|m| > 1.0
1.65574, + 1.65574, 0.408154, 0.912913, -0.737088
+

+
+ + Error + Output For jacobi_sn with compiler GNU C++ version 7.1.0 and library GSL 2.1 + and test data Jacobi Elliptic: Random Small Values +
+

+ |m| + > 1.0
1.65048e-12, 1.65574, 1.65048e-12, 1, 1
|m| > 1.0
+ 2.06542e-12, 1.65574, 2.06542e-12, 1, 1
|m| > 1.0
6.93323e-12, + 1.65574, 6.93323e-12, 1, 1
|m| > 1.0
1.33514e-11, 1.65574, 1.33514e-11, + 1, 1
|m| > 1.0
1.63998e-11, 1.65574, 1.63998e-11, 1, 1
+ |m| > 1.0
5.73016e-11, 1.65574, 5.73016e-11, 1, 1
|m| > 1.0
+ 1.11373e-10, 1.65574, 1.11373e-10, 1, 1
|m| > 1.0
1.42147e-10, + 1.65574, 1.42147e-10, 1, 1
|m| > 1.0
3.80063e-10, 1.65574, 3.80063e-10, + 1, 1
|m| > 1.0
6.09163e-10, 1.65574, 6.09163e-10, 1, 1
+ |m| > 1.0
1.02216e-09, 1.65574, 1.02216e-09, 1, 1
|m| > 1.0
+ 2.88192e-09, 1.65574, 2.88192e-09, 1, 1
|m| > 1.0
4.76278e-09, + 1.65574, 4.76278e-09, 1, 1
|m| > 1.0
8.85413e-09, 1.65574, 8.85413e-09, + 1, 1
|m| > 1.0
2.30503e-08, 1.65574, 2.30503e-08, 1, 1
+ |m| > 1.0
5.93925e-08, 1.65574, 5.93925e-08, 1, 1
|m| > 1.0
+ 1.16676e-07, 1.65574, 1.16676e-07, 1, 1
|m| > 1.0
2.37997e-07, + 1.65574, 2.37997e-07, 1, 1
|m| > 1.0
4.68466e-07, 1.65574, 4.68466e-07, + 1, 1
|m| > 1.0
9.3827e-07, 1.65574, 9.3827e-07, 1, 1
|m| + > 1.0
1.10399e-06, 1.65574, 1.10399e-06, 1, 1
|m| > 1.0
+ 3.29178e-06, 1.65574, 3.29178e-06, 1, 1
|m| > 1.0
7.51721e-06, + 1.65574, 7.51721e-06, 1, 1
|m| > 1.0
1.51147e-05, 1.65574, 1.51147e-05, + 1, 1
|m| > 1.0
2.9864e-05, 1.65574, 2.9864e-05, 1, 1
|m| + > 1.0
3.38703e-05, 1.65574, 3.38703e-05, 1, 1
|m| > 1.0
+ 9.06601e-05, 1.65574, 9.06601e-05, 1, 1
|m| > 1.0
0.000219495, + 1.65574, 0.000219495, 1, 1
|m| > 1.0
0.000439522, 1.65574, 0.000439521, + 1, 1
|m| > 1.0
0.000633315, 1.65574, 0.000633315, 1, 0.999999
+ |m| > 1.0
0.00111512, 1.65574, 0.00111512, 0.999999, 0.999998
+ |m| > 1.0
0.00196247, 1.65574, 0.00196246, 0.999998, 0.999995
+ |m| > 1.0
0.00555375, 1.65574, 0.00555365, 0.999985, 0.999958
+ |m| > 1.0
0.00869113, 1.65574, 0.00869072, 0.999962, 0.999896
+ |m| > 1.0
0.0299334, 1.65574, 0.0299166, 0.999552, 0.998772
+ |m| > 1.0
0.0512426, 1.65574, 0.0511588, 0.998691, 0.996406
+ |m| > 1.0
0.112013, 1.65574, 0.111143, 0.993804, 0.982922
|m| + > 1.0
0.234804, 1.65574, 0.227, 0.973895, 0.926679
|m| > + 1.0
0.489873, 1.65574, 0.425971, 0.904737, 0.708912
|m| > 1.0
+ 0.751831, 1.65574, 0.553446, 0.832885, 0.400346
|m| > 1.0
1.65574, + 1.65574, 0.408154, 0.912913, -0.737088
+

+
+ + Error + Output For jacobi_dn with compiler GNU C++ version 7.1.0 and library GSL 2.1 + and test data Jacobi Elliptic: Mathworld Data +
+

+ |m| + > 1.0
2.98023e-08, 1.5, 2.98023e-08, 1, 1
|m| > 1.0
+ -2.98023e-08, 1.5, -2.98023e-08, 1, 1
|m| > 1.0
0.25, 1.5, 0.24183, + 0.970319, 0.931888
|m| > 1.0
-0.25, 1.5, -0.24183, 0.970319, + 0.931888
|m| > 1.0
1.25, 1.5, 0.665876, 0.746063, -0.0486921
+ |m| > 1.0
-1.25, 1.5, -0.665876, 0.746063, -0.0486921
|m| > + 1.0
25, 1.5, 0.618665, 0.785655, 0.372585
|m| > 1.0
-25, + 1.5, -0.618665, 0.785655, 0.372585
+

+
+ + Error + Output For jacobi_cn with compiler GNU C++ version 7.1.0 and library GSL 2.1 + and test data Jacobi Elliptic: Mathworld Data +
+

+ |m| + > 1.0
2.98023e-08, 1.5, 2.98023e-08, 1, 1
|m| > 1.0
+ -2.98023e-08, 1.5, -2.98023e-08, 1, 1
|m| > 1.0
0.25, 1.5, 0.24183, + 0.970319, 0.931888
|m| > 1.0
-0.25, 1.5, -0.24183, 0.970319, + 0.931888
|m| > 1.0
1.25, 1.5, 0.665876, 0.746063, -0.0486921
+ |m| > 1.0
-1.25, 1.5, -0.665876, 0.746063, -0.0486921
|m| > + 1.0
25, 1.5, 0.618665, 0.785655, 0.372585
|m| > 1.0
-25, + 1.5, -0.618665, 0.785655, 0.372585
+

+
+ + Error + Output For jacobi_sn with compiler GNU C++ version 7.1.0 and library GSL 2.1 + and test data Jacobi Elliptic: Mathworld Data +
+

+ |m| + > 1.0
2.98023e-08, 1.5, 2.98023e-08, 1, 1
|m| > 1.0
+ -2.98023e-08, 1.5, -2.98023e-08, 1, 1
|m| > 1.0
0.25, 1.5, 0.24183, + 0.970319, 0.931888
|m| > 1.0
-0.25, 1.5, -0.24183, 0.970319, + 0.931888
|m| > 1.0
1.25, 1.5, 0.665876, 0.746063, -0.0486921
+ |m| > 1.0
-1.25, 1.5, -0.665876, 0.746063, -0.0486921
|m| > + 1.0
25, 1.5, 0.618665, 0.785655, 0.372585
|m| > 1.0
-25, + 1.5, -0.618665, 0.785655, 0.372585
+

+
+ + Error + Output For polygamma with compiler GNU C++ version 7.1.0 and library GSL 2.1 + and test data Mathematica Data - Large orders and other bug cases +
+

+ underflow
+ 168, 150, -6.52661e-66
underflow
169, 202, 9.2734e-88
domain + error
20, -9.5, -0.00103076
domain error
21, -9.5, 4.28582e+26
+ domain error
22, -9.5, -0.00419144
domain error
23, -9.5, + 8.6745e+29
domain error
24, -9.5, -0.0204825
domain error
+ 25, -9.5, 2.08188e+33
domain error
26, -9.5, -0.118403
domain + error
27, -9.5, 5.84592e+36
domain error
28, -9.5, -0.798969
+ domain error
29, -9.5, 1.89875e+40
domain error
30, -9.5, + -6.22245
underflow
10, 1.32923e+36, -0
underflow
15, + 1.32923e+36, 0
+

+
+ + Error + Output For polygamma with compiler GNU C++ version 7.1.0 and library GSL 2.1 + and test data Mathematica Data - large negative arguments +
+

+ domain + error
124, -1.5, 7.63705e+240
domain error
124, -2.5, 7.63705e+240
+ domain error
124, -3.5, 7.63705e+240
domain error
124, -4.5, + 7.63705e+240
domain error
124, -5.5, 7.63705e+240
domain + error
124, -6.5, 7.63705e+240
domain error
124, -7.5, 7.63705e+240
+ domain error
124, -8.5, 7.63705e+240
domain error
124, -9.5, + 7.63705e+240
domain error
124, -10.5, 7.63705e+240
domain + error
124, -11.5, 7.63705e+240
domain error
124, -12.5, 7.63705e+240
+ domain error
124, -13.5, 7.63705e+240
domain error
124, -14.5, + 7.63705e+240
domain error
124, -15.5, 7.63705e+240
domain + error
124, -16.5, 7.63705e+240
domain error
124, -17.5, 7.63705e+240
+ domain error
124, -18.5, 7.63705e+240
domain error
124, -19.5, + 7.63705e+240
domain error
124, -20.5, 7.63705e+240
domain + error
124, -1.5, -7.63705e+240
domain error
124, -2.5, -7.63705e+240
+ domain error
124, -3.5, -7.63705e+240
domain error
124, -4.5, + -7.63705e+240
domain error
124, -5.5, -7.63705e+240
domain + error
124, -6.5, -7.63705e+240
domain error
124, -7.5, -7.63705e+240
+ domain error
124, -8.5, -7.63705e+240
domain error
124, -9.5, + -7.63705e+240
domain error
124, -10.5, -7.63705e+240
domain + error
124, -11.5, -7.63705e+240
domain error
124, -12.5, + -7.63705e+240
domain error
124, -13.5, -7.63705e+240
domain + error
124, -14.5, -7.63705e+240
domain error
124, -15.5, + -7.63705e+240
domain error
124, -16.5, -7.63705e+240
domain + error
124, -17.5, -7.63705e+240
domain error
124, -18.5, + -7.63705e+240
domain error
124, -19.5, -7.63705e+240
domain + error
124, -20.5, -7.63705e+240
domain error
2, -0.5, -0.828797
+ domain error
3, -0.5, 193.409
domain error
4, -0.5, -3.47425
+ domain error
5, -0.5, 15371.1
domain error
6, -0.5, -43.4579
+ domain error
7, -0.5, 2.58068e+06
domain error
8, -0.5, -1059.96
+ domain error
9, -0.5, 7.43185e+08
domain error
10, -0.5, + -42108.9
domain error
11, -0.5, 3.26999e+11
domain error
+ 12, -0.5, -2.46448e+06
domain error
13, -0.5, 2.04047e+14
+ domain error
14, -0.5, -1.9918e+08
domain error
15, -0.5, + 1.71399e+17
domain error
16, -0.5, -2.12394e+10
domain error
+ 17, -0.5, 1.86483e+20
domain error
18, -0.5, -2.88824e+12
+ domain error
19, -0.5, 2.55108e+23
domain error
20, -0.5, + -4.87773e+14
domain error
21, -0.5, 4.28582e+26
domain error
+ 2, -0.5, -0.828843
domain error
3, -0.5, 193.409
domain error
+ 4, -0.5, -3.47791
domain error
5, -0.5, 15371.1
domain error
+ 6, -0.5, -44.0732
domain error
7, -0.5, 2.58068e+06
domain + error
8, -0.5, -1237.15
domain error
9, -0.5, 7.43185e+08
+ domain error
10, -0.5, -120071
domain error
11, -0.5, 3.26999e+11
+ domain error
12, -0.5, -5.11131e+07
domain error
13, -0.5, + 2.04047e+14
domain error
14, -0.5, -4.1064e+10
domain error
+ 15, -0.5, 1.71399e+17
domain error
16, -0.5, -4.44822e+13
+ domain error
17, -0.5, 1.86483e+20
domain error
18, -0.5, + -6.08254e+16
domain error
19, -0.5, 2.55108e+23
domain error
+ 20, -0.5, -1.02182e+20
domain error
21, -0.5, 4.28582e+26
+ domain error
2, -0.5, -0.828751
domain error
3, -0.5, 193.409
+ domain error
4, -0.5, -3.47059
domain error
5, -0.5, 15371.1
+ domain error
6, -0.5, -42.8426
domain error
7, -0.5, 2.58068e+06
+ domain error
8, -0.5, -882.773
domain error
9, -0.5, 7.43185e+08
+ domain error
10, -0.5, 35853.7
domain error
11, -0.5, 3.26999e+11
+ domain error
12, -0.5, 4.61841e+07
domain error
13, -0.5, + 2.04047e+14
domain error
14, -0.5, 4.06656e+10
domain error
+ 15, -0.5, 1.71399e+17
domain error
16, -0.5, 4.44397e+13
+ domain error
17, -0.5, 1.86483e+20
domain error
18, -0.5, + 6.08197e+16
domain error
19, -0.5, 2.55108e+23
domain error
+ 20, -0.5, 1.02181e+20
domain error
21, -0.5, 4.28582e+26
+

+
+ + Error + Output For polygamma with compiler GNU C++ version 7.1.0 and library GSL 2.1 + and test data Mathematica Data - negative arguments +
+

+ domain + error
2, -12.75, -124.031
domain error
2, -12.25, 124.019
+ domain error
2, -11.75, -124.032
domain error
2, -11.25, + 124.018
domain error
2, -10.75, -124.033
domain error
+ 2, -10.25, 124.016
domain error
2, -9.75, -124.035
domain + error
2, -9.25, 124.015
domain error
2, -8.75, -124.037
+ domain error
2, -8.25, 124.012
domain error
2, -7.75, -124.04
+ domain error
2, -7.25, 124.009
domain error
2, -6.75, -124.044
+ domain error
2, -6.25, 124.003
domain error
2, -5.75, -124.051
+ domain error
2, -5.25, 123.995
domain error
2, -4.75, -124.061
+ domain error
2, -4.25, 123.981
domain error
2, -3.75, -124.08
+ domain error
2, -3.25, 123.955
domain error
2, -2.75, -124.118
+ domain error
2, -2.25, 123.897
domain error
2, -1.75, -124.214
+ domain error
2, -1.25, 123.721
domain error
2, -0.75, -124.587
+ domain error
2, -0.25, 122.697
domain error
3, -12.75, 1558.54
+ domain error
3, -12.25, 1558.54
domain error
3, -11.75, 1558.54
+ domain error
3, -11.25, 1558.54
domain error
3, -10.75, 1558.54
+ domain error
3, -10.25, 1558.54
domain error
3, -9.75, 1558.54
+ domain error
3, -9.25, 1558.54
domain error
3, -8.75, 1558.54
+ domain error
3, -8.25, 1558.54
domain error
3, -7.75, 1558.54
+ domain error
3, -7.25, 1558.54
domain error
3, -6.75, 1558.54
+ domain error
3, -6.25, 1558.54
domain error
3, -5.75, 1558.54
+ domain error
3, -5.25, 1558.54
domain error
3, -4.75, 1558.53
+ domain error
3, -4.25, 1558.53
domain error
3, -3.75, 1558.52
+ domain error
3, -3.25, 1558.51
domain error
3, -2.75, 1558.49
+ domain error
3, -2.25, 1558.46
domain error
3, -1.75, 1558.38
+ domain error
3, -1.25, 1558.22
domain error
3, -0.75, 1557.75
+ domain error
3, -0.25, 1555.76
domain error
4, -12.75, -24481.6
+ domain error
4, -12.25, 24481.6
domain error
4, -11.75, -24481.6
+ domain error
4, -11.25, 24481.6
domain error
4, -10.75, -24481.6
+ domain error
4, -10.25, 24481.6
domain error
4, -9.75, -24481.6
+ domain error
4, -9.25, 24481.6
domain error
4, -8.75, -24481.6
+ domain error
4, -8.25, 24481.6
domain error
4, -7.75, -24481.6
+ domain error
4, -7.25, 24481.6
domain error
4, -6.75, -24481.6
+ domain error
4, -6.25, 24481.6
domain error
4, -5.75, -24481.6
+ domain error
4, -5.25, 24481.6
domain error
4, -4.75, -24481.6
+ domain error
4, -4.25, 24481.6
domain error
4, -3.75, -24481.6
+ domain error
4, -3.25, 24481.5
domain error
4, -2.75, -24481.6
+ domain error
4, -2.25, 24481.5
domain error
4, -1.75, -24481.8
+ domain error
4, -1.25, 24481.1
domain error
4, -0.75, -24483.2
+ domain error
4, -0.25, 24473.2
domain error
5, -12.75, 492231
+ domain error
5, -12.25, 492231
domain error
5, -11.75, 492231
+ domain error
5, -11.25, 492231
domain error
5, -10.75, 492231
+ domain error
5, -10.25, 492231
domain error
5, -9.75, 492231
+ domain error
5, -9.25, 492231
domain error
5, -8.75, 492231
+ domain error
5, -8.25, 492231
domain error
5, -7.75, 492231
+ domain error
5, -7.25, 492231
domain error
5, -6.75, 492231
+ domain error
5, -6.25, 492231
domain error
5, -5.75, 492231
+ domain error
5, -5.25, 492231
domain error
5, -4.75, 492231
+ domain error
5, -4.25, 492231
domain error
5, -3.75, 492231
+ domain error
5, -3.25, 492231
domain error
5, -2.75, 492231
+ domain error
5, -2.25, 492231
domain error
5, -1.75, 492231
+ domain error
5, -1.25, 492230
domain error
5, -0.75, 492227
+ domain error
5, -0.25, 492199
domain error
6, -12.75, -1.17912e+07
+ domain error
6, -12.25, 1.17912e+07
domain error
6, -11.75, + -1.17912e+07
domain error
6, -11.25, 1.17912e+07
domain error
+ 6, -10.75, -1.17912e+07
domain error
6, -10.25, 1.17912e+07
+ domain error
6, -9.75, -1.17912e+07
domain error
6, -9.25, + 1.17912e+07
domain error
6, -8.75, -1.17912e+07
domain error
+ 6, -8.25, 1.17912e+07
domain error
6, -7.75, -1.17912e+07
+ domain error
6, -7.25, 1.17912e+07
domain error
6, -6.75, + -1.17912e+07
domain error
6, -6.25, 1.17912e+07
domain error
+ 6, -5.75, -1.17912e+07
domain error
6, -5.25, 1.17912e+07
+ domain error
6, -4.75, -1.17912e+07
domain error
6, -4.25, + 1.17912e+07
domain error
6, -3.75, -1.17912e+07
domain error
+ 6, -3.25, 1.17912e+07
domain error
6, -2.75, -1.17912e+07
+ domain error
6, -2.25, 1.17912e+07
domain error
6, -1.75, + -1.17912e+07
domain error
6, -1.25, 1.17912e+07
*** FURTHER + CONTENT HAS BEEN TRUNCATED FOR BREVITY ***
+

+
+ + Error + Output For polygamma with compiler GNU C++ version 7.1.0 and library GSL 2.1 + and test data Mathematica Data - large arguments +
+

+ underflow
+ 30, 8.58993e+09, -8.44974e-268
underflow
30, 1.71799e+10, -7.86943e-277
+ underflow
30, 3.43597e+10, -7.32898e-286
underflow
30, 6.87195e+10, + -6.82564e-295
underflow
30, 1.37439e+11, -6.35687e-304
underflow
+ 30, 2.74878e+11, -5.9203e-313
underflow
30, 5.49756e+11, -5.53354e-322
+ underflow
30, 1.09951e+12, -0
underflow
30, 2.19902e+12, + -0
underflow
30, 4.39805e+12, -0
underflow
30, 8.79609e+12, + -0
underflow
30, 1.75922e+13, -0
underflow
30, 3.51844e+13, + -0
underflow
30, 7.03687e+13, -0
underflow
30, 1.40737e+14, + -0
underflow
30, 2.81475e+14, -0
underflow
30, 5.6295e+14, + -0
underflow
30, 1.1259e+15, -0
underflow
30, 2.2518e+15, + -0
underflow
30, 4.5036e+15, -0
underflow
30, 9.0072e+15, + -0
underflow
30, 1.80144e+16, -0
underflow
30, 3.60288e+16, + -0
underflow
30, 7.20576e+16, -0
underflow
30, 1.44115e+17, + -0
underflow
30, 2.8823e+17, -0
underflow
30, 5.76461e+17, + -0
underflow
30, 1.15292e+18, -0
underflow
30, 2.30584e+18, + -0
underflow
30, 4.61169e+18, -0
underflow
30, 9.22337e+18, + -0
underflow
30, 1.84467e+19, -0
underflow
30, 3.68935e+19, + -0
underflow
30, 7.3787e+19, -0
underflow
30, 1.47574e+20, + -0
underflow
30, 2.95148e+20, -0
underflow
30, 5.90296e+20, + -0
underflow
30, 1.18059e+21, -0
underflow
30, 2.36118e+21, + -0
underflow
30, 4.72237e+21, -0
underflow
30, 9.44473e+21, + -0
underflow
30, 1.88895e+22, -0
underflow
30, 3.77789e+22, + -0
underflow
30, 7.55579e+22, -0
underflow
30, 1.51116e+23, + -0
underflow
30, 3.02231e+23, -0
underflow
30, 6.04463e+23, + -0
underflow
30, 1.20893e+24, -0
underflow
30, 2.41785e+24, + -0
underflow
30, 4.8357e+24, -0
underflow
30, 9.67141e+24, + -0
underflow
30, 1.93428e+25, -0
underflow
30, 3.86856e+25, + -0
underflow
30, 7.73713e+25, -0
underflow
30, 1.54743e+26, + -0
underflow
30, 3.09485e+26, -0
underflow
30, 6.1897e+26, + -0
underflow
30, 1.23794e+27, -0
underflow
30, 2.47588e+27, + -0
underflow
30, 4.95176e+27, -0
underflow
30, 9.90352e+27, + -0
underflow
30, 1.9807e+28, -0
underflow
30, 3.96141e+28, + -0
underflow
30, 7.92282e+28, -0
underflow
30, 1.58456e+29, + -0
underflow
30, 3.16913e+29, -0
underflow
30, 6.33825e+29, + -0
underflow
30, 1.26765e+30, -0
+

+
+
+

+Tables +

+
+

Table 97. Error rates for beta

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Beta Function: Small Values +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = +INFε (Mean = +INFε) And + other failures.)
(Rmath 3.2.3: + Max = 1.14ε (Mean = 0.574ε)) +

+
+

+ Max = 2.86ε (Mean = 1.22ε)

+ (<cmath>: Max = 364ε (Mean = 76.2ε)) +

+
+

+ Max = 2.86ε (Mean = 1.22ε) +

+
+

+ Max = 2.23ε (Mean = 1.14ε) +

+
+

+ Beta Function: Medium Values +

+
+

+ Max = 0.978ε (Mean = 0.0595ε)

+ (GSL 2.1: Max = 1.18e+03ε (Mean = 238ε))
+ (Rmath 3.2.3: Max = 1.09e+03ε (Mean = 265ε)) +

+
+

+ Max = 61.4ε (Mean = 19.4ε)

+ (<cmath>: Max = 1.07e+03ε (Mean = 264ε)) +

+
+

+ Max = 107ε (Mean = 24.5ε) +

+
+

+ Max = 96.5ε (Mean = 22.4ε) +

+
+

+ Beta Function: Divergent Values +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 12.1ε (Mean = 1.99ε))
(Rmath 3.2.3: + Max = 176ε (Mean = 28ε)) +

+
+

+ Max = 8.99ε (Mean = 2.44ε)

+ (<cmath>: Max = 128ε (Mean = 23.8ε)) +

+
+

+ Max = 18.8ε (Mean = 2.71ε) +

+
+

+ Max = 11.4ε (Mean = 2.19ε) +

+
+
+
+

Table 98. Error rates for beta (incomplete)

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Incomplete Beta Function: Small Values +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 11.1ε (Mean = 2.32ε) +

+
+

+ Max = 18.7ε (Mean = 3.19ε) +

+
+

+ Max = 9.94ε (Mean = 2.17ε) +

+
+

+ Incomplete Beta Function: Medium Values +

+
+

+ Max = 0.568ε (Mean = 0.0254ε) +

+
+

+ Max = 69.2ε (Mean = 13.4ε) +

+
+

+ Max = 174ε (Mean = 25ε) +

+
+

+ Max = 90ε (Mean = 12.7ε) +

+
+

+ Incomplete Beta Function: Large and Diverse Values +

+
+

+ Max = 0.999ε (Mean = 0.0325ε) +

+
+

+ Max = 6.84e+04ε (Mean = 2.76e+03ε) +

+
+

+ Max = 6.86e+04ε (Mean = 2.79e+03ε) +

+
+

+ Max = 633ε (Mean = 29.7ε) +

+
+

+ Incomplete Beta Function: Small Integer Values +

+
+

+ Max = 0.786ε (Mean = 0.0323ε) +

+
+

+ Max = 11.6ε (Mean = 3.6ε) +

+
+

+ Max = 51.8ε (Mean = 11ε) +

+
+

+ Max = 26ε (Mean = 6.28ε) +

+
+
+
+

Table 99. Error rates for betac

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Incomplete Beta Function: Small Values +

+
+

+ Max = 0.676ε (Mean = 0.0302ε) +

+
+

+ Max = 9.92ε (Mean = 2.3ε) +

+
+

+ Max = 11.2ε (Mean = 2.94ε) +

+
+

+ Max = 8.94ε (Mean = 2.06ε) +

+
+

+ Incomplete Beta Function: Medium Values +

+
+

+ Max = 0.949ε (Mean = 0.098ε) +

+
+

+ Max = 63.5ε (Mean = 13.5ε) +

+
+

+ Max = 97.6ε (Mean = 24.3ε) +

+
+

+ Max = 90.6ε (Mean = 14.8ε) +

+
+

+ Incomplete Beta Function: Large and Diverse Values +

+
+

+ Max = 1.12ε (Mean = 0.0458ε) +

+
+

+ Max = 1.05e+05ε (Mean = 5.45e+03ε) +

+
+

+ Max = 1.04e+05ε (Mean = 5.46e+03ε) +

+
+

+ Max = 3.72e+03ε (Mean = 113ε) +

+
+

+ Incomplete Beta Function: Small Integer Values +

+
+

+ Max = 0.586ε (Mean = 0.0314ε) +

+
+

+ Max = 11.1ε (Mean = 3.65ε) +

+
+

+ Max = 103ε (Mean = 17.4ε) +

+
+

+ Max = 26.2ε (Mean = 6.36ε) +

+
+
+
+

Table 100. Error rates for binomial_coefficient

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Binomials: small arguments +

+
+

+ Max = 1ε (Mean = 0.369ε) +

+
+

+ Max = 1.5ε (Mean = 0.339ε) +

+
+

+ Max = 1.5ε (Mean = 0.339ε) +

+
+

+ Max = 1ε (Mean = 0.369ε) +

+
+

+ Binomials: large arguments +

+
+

+ Max = 0.939ε (Mean = 0.314ε) +

+
+

+ Max = 26.6ε (Mean = 6.13ε) +

+
+

+ Max = 53.2ε (Mean = 10.8ε) +

+
+

+ Max = 37.2ε (Mean = 7.4ε) +

+
+
+
+

Table 101. Error rates for boost::math::powm1

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ GNU C++ version 7.1.0
linux
double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ powm1 +

+
+

+ (<math.h>: Max = 2.04ε (Mean = 0.493ε))
+
Max = 2.04ε (Mean = 0.493ε)
+
(<cmath>: Max = 2.04ε (Mean = 0.493ε)) +

+
+

+ (Rmath 3.2.3: Max = 1.06ε (Mean = 0.425ε))
+
(GSL 2.1: Max = 1.06ε (Mean = 0.425ε))
+
Max = 1.06ε (Mean = 0.425ε) +

+
+

+ Max = 1.88ε (Mean = 0.49ε)

+ (<math.h>: Max = 1.88ε (Mean = 0.49ε)) +

+
+

+ (<math.h>: Max = 1.84ε (Mean = 0.486ε))
+
Max = 1.84ε (Mean = 0.486ε) +

+
+
+
+

Table 102. Error rates for cbrt

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ cbrt Function +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 1.34ε (Mean = 0.471ε)

+ (<cmath>: Max = 1.34ε (Mean = 0.471ε))
+ (<math.h>: Max = 1.34ε (Mean = 0.471ε)) +

+
+

+ Max = 1.34ε (Mean = 0.471ε)

+ (<math.h>: Max = 1.34ε (Mean = 0.471ε)) +

+
+

+ Max = 1.7ε (Mean = 0.565ε)

+ (<math.h>: Max = 1.7ε (Mean = 0.565ε)) +

+
+
+
+

Table 103. Error rates for cos_pi

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ sin_pi and cos_pi +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 0.991ε (Mean = 0.302ε) +

+
+

+ Max = 0.991ε (Mean = 0.302ε) +

+
+

+ Max = 0.996ε (Mean = 0.284ε) +

+
+

+ sin_pi and cos_pi near integers and half integers +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 0.976ε (Mean = 0.28ε) +

+
+

+ Max = 0.976ε (Mean = 0.28ε) +

+
+

+ Max = 0.996ε (Mean = 0.298ε) +

+
+
+
+

Table 104. Error rates for cyl_bessel_i

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Bessel I0: Mathworld Data +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 270ε (Mean = 91.6ε) And + other failures.)
(Rmath 3.2.3: + Max = 1.52ε (Mean = 0.622ε) And + other failures.) +

+
+

+ Max = 1.95ε (Mean = 0.738ε)

+ (<cmath>: Max = 8.49ε (Mean = 3.46ε) And + other failures.) +

+
+

+ Max = 1.95ε (Mean = 0.661ε) +

+
+

+ Max = 0.762ε (Mean = 0.329ε) +

+
+

+ Bessel I1: Mathworld Data +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 128ε (Mean = 41ε) And + other failures.)
(Rmath 3.2.3: + Max = 1.53ε (Mean = 0.483ε) And + other failures.) +

+
+

+ Max = 0.64ε (Mean = 0.202ε)

+ (<cmath>: Max = 5ε (Mean = 2.15ε) And + other failures.) +

+
+

+ Max = 0.64ε (Mean = 0.202ε) +

+
+

+ Max = 0.767ε (Mean = 0.398ε) +

+
+

+ Bessel In: Mathworld Data +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 2.31ε (Mean = 0.838ε) And + other failures.)
(Rmath 3.2.3: + Max = 1.73ε (Mean = 0.601ε) And + other failures.) +

+
+

+ Max = 1.8ε (Mean = 1.33ε)

+ (<cmath>: Max = 430ε (Mean = 163ε) And + other failures.) +

+
+

+ Max = 463ε (Mean = 140ε) +

+
+

+ Max = 3.46ε (Mean = 1.32ε) +

+
+

+ Bessel Iv: Mathworld Data +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 5.95ε (Mean = 2.08ε) And + other failures.)
(Rmath 3.2.3: + Max = 3.53ε (Mean = 1.39ε)) +

+
+

+ Max = 4.12ε (Mean = 1.85ε)

+ (<cmath>: Max = 616ε (Mean = 221ε) And + other failures.) +

+
+

+ Max = 4.12ε (Mean = 1.95ε) +

+
+

+ Max = 2.97ε (Mean = 1.24ε) +

+
+

+ Bessel In: Random Data +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 261ε (Mean = 53.2ε) And + other failures.)
(Rmath 3.2.3: + Max = 7.37ε (Mean = 2.4ε)) +

+
+

+ Max = 4.62ε (Mean = 1.06ε)

+ (<cmath>: Max = 645ε (Mean = 132ε)) +

+
+

+ Max = 176ε (Mean = 39.1ε) +

+
+

+ Max = 9.67ε (Mean = 1.88ε) +

+
+

+ Bessel Iv: Random Data +

+
+

+ Max = 0.661ε (Mean = 0.0441ε)

+ (GSL 2.1: Max = 6.18e+03ε (Mean = 1.55e+03ε) And + other failures.)
(Rmath 3.2.3: + Max = 4.28e+08ε (Mean = 2.85e+07ε)) +

+
+

+ Max = 8.35ε (Mean = 1.62ε)

+ (<cmath>: Max = 1.05e+03ε (Mean = 224ε) + And + other failures.) +

+
+

+ Max = 283ε (Mean = 88.4ε) +

+
+

+ Max = 7.46ε (Mean = 1.71ε) +

+
+

+ Bessel Iv: Mathworld Data (large values) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 37ε (Mean = 18ε) And + other failures.)
(Rmath 3.2.3: + Max = 3.77e+168ε (Mean = 2.39e+168ε) And + other failures.) +

+
+

+ Max = 14.7ε (Mean = 6.66ε)

+ (<cmath>: Max = 118ε (Mean = 57.2ε) And + other failures.) +

+
+

+ Max = 14.7ε (Mean = 6.59ε) +

+
+

+ Max = 3.67ε (Mean = 1.64ε) +

+
+
+
+

Table 105. Error rates for cyl_bessel_i (integer orders)

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Bessel I0: Mathworld Data (Integer Version) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 0.79ε (Mean = 0.482ε))
(Rmath + 3.2.3: Max = 1.52ε (Mean = 0.622ε) And + other failures.) +

+
+

+ Max = 1.95ε (Mean = 0.738ε)

+ (<cmath>: Max = 8.49ε (Mean = 3.46ε) And + other failures.) +

+
+

+ Max = 1.95ε (Mean = 0.661ε) +

+
+

+ Max = 0.762ε (Mean = 0.329ε) +

+
+

+ Bessel I1: Mathworld Data (Integer Version) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 0.82ε (Mean = 0.456ε))
(Rmath + 3.2.3: Max = 1.53ε (Mean = 0.483ε) And + other failures.) +

+
+

+ Max = 0.64ε (Mean = 0.202ε)

+ (<cmath>: Max = 5ε (Mean = 2.15ε) And + other failures.) +

+
+

+ Max = 0.64ε (Mean = 0.202ε) +

+
+

+ Max = 0.767ε (Mean = 0.398ε) +

+
+

+ Bessel In: Mathworld Data (Integer Version) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 5.15ε (Mean = 2.13ε) And + other failures.)
(Rmath 3.2.3: + Max = 1.73ε (Mean = 0.601ε) And + other failures.) +

+
+

+ Max = 1.8ε (Mean = 1.33ε)

+ (<cmath>: Max = 430ε (Mean = 163ε) And + other failures.) +

+
+

+ Max = 463ε (Mean = 140ε) +

+
+

+ Max = 3.46ε (Mean = 1.32ε) +

+
+
+
+

Table 106. Error rates for cyl_bessel_i_prime

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Bessel I'0: Mathworld Data +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 0.82ε (Mean = 0.259ε) +

+
+

+ Max = 0.82ε (Mean = 0.259ε) +

+
+

+ Max = 0.82ε (Mean = 0.354ε) +

+
+

+ Bessel I'1: Mathworld Data +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 1.97ε (Mean = 0.757ε) +

+
+

+ Max = 1.97ε (Mean = 0.757ε) +

+
+

+ Max = 1.36ε (Mean = 0.782ε) +

+
+

+ Bessel I'n: Mathworld Data +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 2.31ε (Mean = 1.41ε) +

+
+

+ Max = 701ε (Mean = 212ε) +

+
+

+ Max = 3.61ε (Mean = 1.22ε) +

+
+

+ Bessel I'v: Mathworld Data +

+
+

+ Max = 1.62ε (Mean = 0.512ε) +

+
+

+ Max = 2.89e+03ε (Mean = 914ε) +

+
+

+ Max = 2.89e+03ε (Mean = 914ε) +

+
+

+ Max = 3.76e+03ε (Mean = 1.19e+03ε) +

+
+

+ Bessel I'n: Random Data +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 3.95ε (Mean = 1.06ε) +

+
+

+ Max = 195ε (Mean = 37.1ε) +

+
+

+ Max = 9.85ε (Mean = 1.82ε) +

+
+

+ Bessel I'v: Random Data +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 14.1ε (Mean = 2.93ε) +

+
+

+ Max = 336ε (Mean = 68.5ε) +

+
+

+ Max = 14ε (Mean = 2.5ε) +

+
+

+ Bessel I'v: Mathworld Data (large values) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 42.6ε (Mean = 20.2ε) +

+
+

+ Max = 42.6ε (Mean = 20.2ε) +

+
+

+ Max = 59.5ε (Mean = 26.6ε) +

+
+
+
+

Table 107. Error rates for cyl_bessel_i_prime (integer orders)

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Bessel I'0: Mathworld Data (Integer Version) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 0.82ε (Mean = 0.259ε) +

+
+

+ Max = 0.82ε (Mean = 0.259ε) +

+
+

+ Max = 0.82ε (Mean = 0.354ε) +

+
+

+ Bessel I'1: Mathworld Data (Integer Version) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 1.97ε (Mean = 0.757ε) +

+
+

+ Max = 1.97ε (Mean = 0.757ε) +

+
+

+ Max = 1.36ε (Mean = 0.782ε) +

+
+

+ Bessel I'n: Mathworld Data (Integer Version) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 2.31ε (Mean = 1.41ε) +

+
+

+ Max = 701ε (Mean = 212ε) +

+
+

+ Max = 3.61ε (Mean = 1.22ε) +

+
+
+
+

Table 108. Error rates for cyl_bessel_j

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ GNU C++ version 7.1.0
linux
double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Bessel J0: Mathworld Data +

+
+

+ Max = 6.55ε (Mean = 2.86ε)

+ (<cmath>: Max = 5.04ε (Mean = 1.78ε) And + other failures.) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 0.629ε (Mean = 0.223ε) And + other failures.)
(Rmath 3.2.3: + Max = 0.629ε (Mean = 0.223ε) And + other failures.) +

+
+

+ Max = 6.55ε (Mean = 2.86ε) +

+
+

+ Max = 2.52ε (Mean = 1.2ε) +

+
+

+ Bessel J0: Mathworld Data (Tricky cases) +

+
+

+ Max = 1.64e+08ε (Mean = 6.69e+07ε)
+
(<cmath>: Max = 4.79e+08ε (Mean = + 1.96e+08ε)) +

+
+

+ Max = 8e+04ε (Mean = 3.27e+04ε)
+
(GSL 2.1: Max = 6.5e+07ε (Mean = 2.66e+07ε))
+ (Rmath 3.2.3: Max = 1.04e+07ε (Mean = 4.29e+06ε)) +

+
+

+ Max = 1.64e+08ε (Mean = 6.69e+07ε) +

+
+

+ Max = 1e+07ε (Mean = 4.09e+06ε) +

+
+

+ Bessel J1: Mathworld Data +

+
+

+ Max = 3.59ε (Mean = 1.33ε)

+ (<cmath>: Max = 6.1ε (Mean = 2.95ε) And + other failures.) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 6.62ε (Mean = 2.35ε) And + other failures.)
(Rmath 3.2.3: + Max = 0.946ε (Mean = 0.39ε) And + other failures.) +

+
+

+ Max = 1.44ε (Mean = 0.637ε) +

+
+

+ Max = 1.73ε (Mean = 0.976ε) +

+
+

+ Bessel J1: Mathworld Data (tricky cases) +

+
+

+ Max = 2.18e+05ε (Mean = 9.76e+04ε)
+
(<cmath>: Max = 2.15e+06ε (Mean = + 1.58e+06ε)) +

+
+

+ Max = 106ε (Mean = 47.5ε)

+ (GSL 2.1: Max = 8.75e+05ε (Mean = 5.32e+05ε))
+ (Rmath 3.2.3: Max = 2.93e+06ε (Mean = 1.7e+06ε)) +

+
+

+ Max = 2.18e+05ε (Mean = 9.76e+04ε) +

+
+

+ Max = 3.23e+04ε (Mean = 1.45e+04ε) +

+
+

+ Bessel JN: Mathworld Data +

+
+

+ Max = 6.85ε (Mean = 3.35ε)

+ (<cmath>: Max = 2.13e+19ε (Mean + = 5.16e+18ε) And + other failures.) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 6.9e+05ε (Mean = 2.15e+05ε) And + other failures.)
(Rmath 3.2.3: + Max = +INFε (Mean = +INFε) And + other failures.) +

+
+

+ Max = 463ε (Mean = 112ε) +

+
+

+ Max = 14.7ε (Mean = 5.4ε) +

+
+

+ Bessel J: Mathworld Data +

+
+

+ Max = 14.7ε (Mean = 4.11ε)

+ (<cmath>: Max = 3.49e+05ε (Mean = 8.09e+04ε) + And + other failures.) +

+
+

+ Max = 10ε (Mean = 2.24ε)

(GSL + 2.1: Max = 2.39e+05ε (Mean = 5.37e+04ε) And + other failures.)
(Rmath 3.2.3: + Max = +INFε (Mean = +INFε) And + other failures.) +

+
+

+ Max = 14.7ε (Mean = 4.22ε) +

+
+

+ Max = 14.9ε (Mean = 3.89ε) +

+
+

+ Bessel J: Mathworld Data (large values) +

+
+

+ Max = 607ε (Mean = 305ε)

(<cmath>: + Max = 34.9ε (Mean = 17.4ε) And + other failures.) +

+
+

+ Max = 0.536ε (Mean = 0.268ε)

+ (GSL 2.1: Max = 4.91e+03ε (Mean = 2.46e+03ε) And + other failures.)
(Rmath 3.2.3: + Max = 5.9ε (Mean = 3.76ε)) +

+
+

+ Max = 607ε (Mean = 305ε) +

+
+

+ Max = 9.31ε (Mean = 5.52ε) +

+
+

+ Bessel JN: Random Data +

+
+

+ Max = 50.8ε (Mean = 3.69ε)

+ (<cmath>: Max = 1.12e+03ε (Mean = 88.7ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 75.7ε (Mean = 5.36ε))
(Rmath 3.2.3: + Max = 3.93ε (Mean = 1.22ε)) +

+
+

+ Max = 99.6ε (Mean = 22ε) +

+
+

+ Max = 17.5ε (Mean = 1.46ε) +

+
+

+ Bessel J: Random Data +

+
+

+ Max = 11.4ε (Mean = 1.68ε)

+ (<cmath>: Max = 501ε (Mean = 52.3ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 15.5ε (Mean = 3.33ε) And + other failures.)
(Rmath 3.2.3: + Max = 6.74ε (Mean = 1.3ε)) +

+
+

+ Max = 260ε (Mean = 34ε) +

+
+

+ Max = 9.24ε (Mean = 1.17ε) +

+
+

+ Bessel J: Random Data (Tricky large values) +

+
+

+ Max = 785ε (Mean = 94.2ε)

+ (<cmath>: Max = 5.01e+17ε (Mean + = 6.23e+16ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 2.48e+05ε (Mean = 5.11e+04ε))
(Rmath + 3.2.3: Max = 71.6ε (Mean = 11.7ε)) +

+
+

+ Max = 785ε (Mean = 97.4ε) +

+
+

+ Max = 59.2ε (Mean = 8.67ε) +

+
+
+
+

Table 109. Error rates for cyl_bessel_j (integer orders)

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ GNU C++ version 7.1.0
linux
double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Bessel J0: Mathworld Data (Integer Version) +

+
+

+ Max = 6.55ε (Mean = 2.86ε)

+ (<cmath>: Max = 5.04ε (Mean = 1.78ε) And + other failures.) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 1.12ε (Mean = 0.488ε))
(Rmath + 3.2.3: Max = 0.629ε (Mean = 0.223ε) And + other failures.) +

+
+

+ Max = 6.55ε (Mean = 2.86ε) +

+
+

+ Max = 2.52ε (Mean = 1.2ε)

+ (<math.h>: Max = 1.89ε (Mean = 0.988ε)) +

+
+

+ Bessel J0: Mathworld Data (Tricky cases) (Integer Version) +

+
+

+ Max = 1.64e+08ε (Mean = 6.69e+07ε)
+
(<cmath>: Max = 4.79e+08ε (Mean = + 1.96e+08ε)) +

+
+

+ Max = 8e+04ε (Mean = 3.27e+04ε)
+
(GSL 2.1: Max = 1e+07ε (Mean = 4.11e+06ε))
+ (Rmath 3.2.3: Max = 1.04e+07ε (Mean = 4.29e+06ε)) +

+
+

+ Max = 1.64e+08ε (Mean = 6.69e+07ε) +

+
+

+ Max = 1e+07ε (Mean = 4.09e+06ε)
+
(<math.h>: Max + = 2.54e+08ε (Mean = 1.04e+08ε)) +

+
+

+ Bessel J1: Mathworld Data (Integer Version) +

+
+

+ Max = 3.59ε (Mean = 1.33ε)

+ (<cmath>: Max = 6.1ε (Mean = 2.95ε) And + other failures.) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 1.89ε (Mean = 0.721ε))
(Rmath + 3.2.3: Max = 0.946ε (Mean = 0.39ε) And + other failures.) +

+
+

+ Max = 1.44ε (Mean = 0.637ε) +

+
+

+ Max = 1.73ε (Mean = 0.976ε)

+ (<math.h>: Max = 11.4ε (Mean = 4.15ε)) +

+
+

+ Bessel J1: Mathworld Data (tricky cases) (Integer Version) +

+
+

+ Max = 2.18e+05ε (Mean = 9.76e+04ε)
+
(<cmath>: Max = 2.15e+06ε (Mean = + 1.58e+06ε)) +

+
+

+ Max = 106ε (Mean = 47.5ε)

+ (GSL 2.1: Max = 1.26e+06ε (Mean = 6.28e+05ε))
+ (Rmath 3.2.3: Max = 2.93e+06ε (Mean = 1.7e+06ε)) +

+
+

+ Max = 2.18e+05ε (Mean = 9.76e+04ε) +

+
+

+ Max = 3.23e+04ε (Mean = 1.45e+04ε)
+
(<math.h>: Max = 1.44e+07ε (Mean + = 6.5e+06ε)) +

+
+

+ Bessel JN: Mathworld Data (Integer Version) +

+
+

+ Max = 6.85ε (Mean = 3.35ε)

+ (<cmath>: Max = 2.13e+19ε (Mean + = 5.16e+18ε) And + other failures.) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 6.9e+05ε (Mean = 2.53e+05ε) And + other failures.)
(Rmath 3.2.3: + Max = +INFε (Mean = +INFε) And + other failures.) +

+
+

+ Max = 463ε (Mean = 112ε) +

+
+

+ Max = 14.7ε (Mean = 5.4ε)

+ (<math.h>: Max = +INFε (Mean + = +INFε) And + other failures.) +

+
+
+
+

Table 110. Error rates for cyl_bessel_j_prime

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Bessel J0': Mathworld Data +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 18.9ε (Mean = 6.82ε) +

+
+

+ Max = 18.9ε (Mean = 6.72ε) +

+
+

+ Max = 6.62ε (Mean = 2.55ε) +

+
+

+ Bessel J0': Mathworld Data (Tricky cases) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 7.44ε (Mean = 3.34ε) +

+
+

+ Max = 7.44ε (Mean = 3.31ε) +

+
+

+ Max = 3.67ε (Mean = 1.74ε) +

+
+

+ Bessel J1': Mathworld Data +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 7.9ε (Mean = 3.37ε) +

+
+

+ Max = 7.9ε (Mean = 3.37ε) +

+
+

+ Max = 0.999ε (Mean = 0.627ε) +

+
+

+ Bessel J1': Mathworld Data (tricky cases) +

+
+

+ Max = 287ε (Mean = 129ε) +

+
+

+ Max = 5.88e+05ε (Mean = 2.63e+05ε) +

+
+

+ Max = 5.88e+05ε (Mean = 2.63e+05ε) +

+
+

+ Max = 288ε (Mean = 129ε) +

+
+

+ Bessel JN': Mathworld Data +

+
+

+ Max = 0.527ε (Mean = 0.128ε) +

+
+

+ Max = 1.29e+03ε (Mean = 312ε) +

+
+

+ Max = 1.29e+03ε (Mean = 355ε) +

+
+

+ Max = 14ε (Mean = 6.13ε) +

+
+

+ Bessel J': Mathworld Data +

+
+

+ Max = 21.5ε (Mean = 4.7ε) +

+
+

+ Max = 42.5ε (Mean = 9.31ε) +

+
+

+ Max = 42.5ε (Mean = 9.32ε) +

+
+

+ Max = 23.7ε (Mean = 8ε) +

+
+

+ Bessel J': Mathworld Data (large values) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 989ε (Mean = 495ε) +

+
+

+ Max = 989ε (Mean = 495ε) +

+
+

+ Max = 2.9ε (Mean = 1.61ε) +

+
+

+ Bessel JN': Random Data +

+
+

+ Max = 0.593ε (Mean = 0.0396ε) +

+
+

+ Max = 11.3ε (Mean = 1.85ε) +

+
+

+ Max = 79.4ε (Mean = 16.2ε) +

+
+

+ Max = 6.34ε (Mean = 0.999ε) +

+
+

+ Bessel J': Random Data +

+
+

+ Max = 0.885ε (Mean = 0.033ε) +

+
+

+ Max = 139ε (Mean = 6.47ε) +

+
+

+ Max = 279ε (Mean = 27.2ε) +

+
+

+ Max = 176ε (Mean = 9.75ε) +

+
+

+ Bessel J': Random Data (Tricky large values) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 474ε (Mean = 62.2ε) +

+
+

+ Max = 474ε (Mean = 64.5ε) +

+
+

+ Max = 379ε (Mean = 45.4ε) +

+
+
+
+

Table 111. Error rates for cyl_bessel_j_prime (integer orders)

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Bessel J0': Mathworld Data (Integer Version) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 18.9ε (Mean = 6.82ε) +

+
+

+ Max = 18.9ε (Mean = 6.72ε) +

+
+

+ Max = 6.62ε (Mean = 2.55ε) +

+
+

+ Bessel J0': Mathworld Data (Tricky cases) (Integer Version) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 7.44ε (Mean = 3.34ε) +

+
+

+ Max = 7.44ε (Mean = 3.31ε) +

+
+

+ Max = 3.67ε (Mean = 1.74ε) +

+
+

+ Bessel J1': Mathworld Data (Integer Version) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 7.9ε (Mean = 3.37ε) +

+
+

+ Max = 7.9ε (Mean = 3.37ε) +

+
+

+ Max = 0.999ε (Mean = 0.627ε) +

+
+

+ Bessel J1': Mathworld Data (tricky cases) (Integer Version) +

+
+

+ Max = 287ε (Mean = 129ε) +

+
+

+ Max = 5.88e+05ε (Mean = 2.63e+05ε) +

+
+

+ Max = 5.88e+05ε (Mean = 2.63e+05ε) +

+
+

+ Max = 288ε (Mean = 129ε) +

+
+

+ Bessel JN': Mathworld Data (Integer Version) +

+
+

+ Max = 0.527ε (Mean = 0.128ε) +

+
+

+ Max = 1.29e+03ε (Mean = 312ε) +

+
+

+ Max = 1.29e+03ε (Mean = 355ε) +

+
+

+ Max = 14ε (Mean = 6.13ε) +

+
+
+
+

Table 112. Error rates for cyl_bessel_k

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ GNU C++ version 7.1.0
linux
double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Bessel K0: Mathworld Data +

+
+

+ Max = 0.833ε (Mean = 0.436ε)

+ (<cmath>: Max = 9.33ε (Mean = 3.25ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 6.04ε (Mean = 2.16ε))
(Rmath 3.2.3: + Max = 0.833ε (Mean = 0.601ε)) +

+
+

+ Max = 0.833ε (Mean = 0.436ε) +

+
+

+ Max = 0.833ε (Mean = 0.552ε) +

+
+

+ Bessel K1: Mathworld Data +

+
+

+ Max = 0.786ε (Mean = 0.329ε)

+ (<cmath>: Max = 8.94ε (Mean = 3.19ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 6.26ε (Mean = 2.21ε))
(Rmath 3.2.3: + Max = 0.894ε (Mean = 0.516ε)) +

+
+

+ Max = 0.786ε (Mean = 0.329ε) +

+
+

+ Max = 0.786ε (Mean = 0.39ε) +

+
+

+ Bessel Kn: Mathworld Data +

+
+

+ Max = 2.6ε (Mean = 1.21ε)

+ (<cmath>: Max = 12.9ε (Mean = 4.91ε) And + other failures.) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 3.36ε (Mean = 1.43ε) And + other failures.)
(Rmath 3.2.3: + Max = 8.48ε (Mean = 2.98ε)) +

+
+

+ Max = 2.6ε (Mean = 1.21ε) +

+
+

+ Max = 3.63ε (Mean = 1.46ε) +

+
+

+ Bessel Kv: Mathworld Data +

+
+

+ Max = 3.58ε (Mean = 2.39ε)

+ (<cmath>: Max = 13ε (Mean = 4.81ε) And + other failures.) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 5.47ε (Mean = 2.04ε) And + other failures.)
(Rmath 3.2.3: + Max = 3.15ε (Mean = 1.35ε)) +

+
+

+ Max = 5.21ε (Mean = 2.53ε) +

+
+

+ Max = 4.78ε (Mean = 2.19ε) +

+
+

+ Bessel Kv: Mathworld Data (large values) +

+
+

+ Max = 42.3ε (Mean = 21ε)

(<cmath>: + Max = 42.3ε (Mean = 19.8ε) And + other failures.) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 308ε (Mean = 142ε) And + other failures.)
(Rmath 3.2.3: + Max = 84.6ε (Mean = 37.8ε)) +

+
+

+ Max = 42.3ε (Mean = 21ε) +

+
+

+ Max = 59.8ε (Mean = 26.9ε) +

+
+

+ Bessel Kn: Random Data +

+
+

+ Max = 4.55ε (Mean = 1.12ε)

+ (<cmath>: Max = 13.9ε (Mean = 2.91ε)) +

+
+

+ Max = 0.764ε (Mean = 0.0348ε)

+ (GSL 2.1: Max = 8.71ε (Mean = 1.76ε) And + other failures.)
(Rmath 3.2.3: + Max = 7.47ε (Mean = 1.34ε)) +

+
+

+ Max = 4.55ε (Mean = 1.12ε) +

+
+

+ Max = 9.34ε (Mean = 1.7ε) +

+
+

+ Bessel Kv: Random Data +

+
+

+ Max = 7.88ε (Mean = 1.48ε)

+ (<cmath>: Max = 13.6ε (Mean = 2.68ε) And + other failures.) +

+
+

+ Max = 0.507ε (Mean = 0.0313ε)

+ (GSL 2.1: Max = 9.71ε (Mean = 1.47ε) And + other failures.)
(Rmath 3.2.3: + Max = 7.37ε (Mean = 1.49ε)) +

+
+

+ Max = 7.88ε (Mean = 1.47ε) +

+
+

+ Max = 8.33ε (Mean = 1.62ε) +

+
+
+
+

Table 113. Error rates for cyl_bessel_k (integer orders)

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ GNU C++ version 7.1.0
linux
double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Bessel K0: Mathworld Data (Integer Version) +

+
+

+ Max = 0.833ε (Mean = 0.436ε)

+ (<cmath>: Max = 9.33ε (Mean = 3.25ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 1.2ε (Mean = 0.733ε))
(Rmath 3.2.3: + Max = 0.833ε (Mean = 0.601ε)) +

+
+

+ Max = 0.833ε (Mean = 0.436ε) +

+
+

+ Max = 0.833ε (Mean = 0.552ε) +

+
+

+ Bessel K1: Mathworld Data (Integer Version) +

+
+

+ Max = 0.786ε (Mean = 0.329ε)

+ (<cmath>: Max = 8.94ε (Mean = 3.19ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 0.626ε (Mean = 0.333ε))
(Rmath + 3.2.3: Max = 0.894ε (Mean = 0.516ε)) +

+
+

+ Max = 0.786ε (Mean = 0.329ε) +

+
+

+ Max = 0.786ε (Mean = 0.39ε) +

+
+

+ Bessel Kn: Mathworld Data (Integer Version) +

+
+

+ Max = 2.6ε (Mean = 1.21ε)

+ (<cmath>: Max = 12.9ε (Mean = 4.91ε) And + other failures.) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 168ε (Mean = 59.5ε))
(Rmath 3.2.3: + Max = 8.48ε (Mean = 2.98ε)) +

+
+

+ Max = 2.6ε (Mean = 1.21ε) +

+
+

+ Max = 3.63ε (Mean = 1.46ε) +

+
+
+
+

Table 114. Error rates for cyl_bessel_k_prime

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Bessel K'0: Mathworld Data +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 0.786ε (Mean = 0.329ε) +

+
+

+ Max = 0.786ε (Mean = 0.329ε) +

+
+

+ Max = 0.786ε (Mean = 0.39ε) +

+
+

+ Bessel K'1: Mathworld Data +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 0.736ε (Mean = 0.389ε) +

+
+

+ Max = 0.736ε (Mean = 0.389ε) +

+
+

+ Max = 0.761ε (Mean = 0.444ε) +

+
+

+ Bessel K'n: Mathworld Data +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 2.16ε (Mean = 1.08ε) +

+
+

+ Max = 2.16ε (Mean = 1.08ε) +

+
+

+ Max = 4.17ε (Mean = 1.75ε) +

+
+

+ Bessel K'v: Mathworld Data +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 3.94ε (Mean = 2.44ε) +

+
+

+ Max = 3.94ε (Mean = 2.34ε) +

+
+

+ Max = 3.94ε (Mean = 1.47ε) +

+
+

+ Bessel K'v: Mathworld Data (large values) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 59.2ε (Mean = 42.9ε) +

+
+

+ Max = 58.7ε (Mean = 42.6ε) +

+
+

+ Max = 18.6ε (Mean = 11.8ε) +

+
+

+ Bessel K'n: Random Data +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 4.45ε (Mean = 1.19ε) +

+
+

+ Max = 4.45ε (Mean = 1.19ε) +

+
+

+ Max = 9.67ε (Mean = 1.73ε) +

+
+

+ Bessel K'v: Random Data +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 7.95ε (Mean = 1.53ε) +

+
+

+ Max = 7.95ε (Mean = 1.52ε) +

+
+

+ Max = 8.32ε (Mean = 1.65ε) +

+
+
+
+

Table 115. Error rates for cyl_bessel_k_prime (integer orders)

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Bessel K'0: Mathworld Data (Integer Version) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 0.786ε (Mean = 0.329ε) +

+
+

+ Max = 0.786ε (Mean = 0.329ε) +

+
+

+ Max = 0.786ε (Mean = 0.39ε) +

+
+

+ Bessel K'1: Mathworld Data (Integer Version) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 0.736ε (Mean = 0.389ε) +

+
+

+ Max = 0.736ε (Mean = 0.389ε) +

+
+

+ Max = 0.761ε (Mean = 0.444ε) +

+
+

+ Bessel K'n: Mathworld Data (Integer Version) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 2.16ε (Mean = 1.08ε) +

+
+

+ Max = 2.16ε (Mean = 1.08ε) +

+
+

+ Max = 4.17ε (Mean = 1.75ε) +

+
+
+
+

Table 116. Error rates for cyl_neumann

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ GNU C++ version 7.1.0
linux
double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Y0: Mathworld Data +

+
+

+ Max = 5.53ε (Mean = 2.4ε)

+ (<cmath>: Max = 2.05e+05ε (Mean = 6.87e+04ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 60.9ε (Mean = 20.4ε))
(Rmath 3.2.3: + Max = 167ε (Mean = 56.5ε)) +

+
+

+ Max = 5.53ε (Mean = 2.4ε) +

+
+

+ Max = 4.61ε (Mean = 2.29ε) +

+
+

+ Y1: Mathworld Data +

+
+

+ Max = 6.33ε (Mean = 2.25ε)

+ (<cmath>: Max = 9.71e+03ε (Mean = 4.08e+03ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 23.4ε (Mean = 8.1ε))
(Rmath 3.2.3: + Max = 193ε (Mean = 64.4ε)) +

+
+

+ Max = 6.33ε (Mean = 2.29ε) +

+
+

+ Max = 4.75ε (Mean = 1.72ε) +

+
+

+ Yn: Mathworld Data +

+
+

+ Max = 55.2ε (Mean = 17.8ε)

+ (<cmath>: Max = 2.2e+20ε (Mean + = 6.97e+19ε) And + other failures.) +

+
+

+ Max = 0.993ε (Mean = 0.314ε)

+ (GSL 2.1: Max = 2.41e+05ε (Mean = 7.62e+04ε) And + other failures.)
(Rmath 3.2.3: + Max = 1.24e+04ε (Mean = 4e+03ε)) +

+
+

+ Max = 55.2ε (Mean = 17.8ε) +

+
+

+ Max = 35ε (Mean = 11.9ε) +

+
+

+ Yv: Mathworld Data +

+
+

+ Max = 10.7ε (Mean = 4.93ε)

+ (<cmath>: Max = 3.49e+15ε (Mean + = 1.05e+15ε) And + other failures.) +

+
+

+ Max = 10ε (Mean = 3.02ε)

(GSL + 2.1: Max = 1.07e+05ε (Mean = 3.22e+04ε) And + other failures.)
(Rmath 3.2.3: + Max = 243ε (Mean = 73.9ε)) +

+
+

+ Max = 10.7ε (Mean = 5.1ε) +

+
+

+ Max = 7.89ε (Mean = 3.27ε) +

+
+

+ Yv: Mathworld Data (large values) +

+
+

+ Max = 1.7ε (Mean = 1.33ε)

+ (<cmath>: Max = 43.2ε (Mean = 16.3ε) And + other failures.) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 60.8ε (Mean = 23ε) And + other failures.)
(Rmath 3.2.3: + Max = 0.682ε (Mean = 0.335ε)) +

+
+

+ Max = 1.7ε (Mean = 1.33ε) +

+
+

+ Max = 0.682ε (Mean = 0.423ε) +

+
+

+ Y0 and Y1: Random Data +

+
+

+ Max = 10.8ε (Mean = 3.04ε)

+ (<cmath>: Max = 2.59e+03ε (Mean = 500ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 34.4ε (Mean = 8.9ε))
(Rmath 3.2.3: + Max = 83ε (Mean = 14.2ε)) +

+
+

+ Max = 10.8ε (Mean = 3.04ε) +

+
+

+ Max = 4.17ε (Mean = 1.24ε) +

+
+

+ Yn: Random Data +

+
+

+ Max = 338ε (Mean = 27.5ε)

+ (<cmath>: Max = 4.01e+03ε (Mean = 348ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 500ε (Mean = 47.8ε))
(Rmath 3.2.3: + Max = 691ε (Mean = 67.9ε)) +

+
+

+ Max = 338ε (Mean = 27.5ε) +

+
+

+ Max = 117ε (Mean = 10.2ε) +

+
+

+ Yv: Random Data +

+
+

+ Max = 2.08e+03ε (Mean = 149ε)

+ (<cmath>: Max = +INFε (Mean + = +INFε) And + other failures.) +

+
+

+ Max = 1.53ε (Mean = 0.102ε)

+ (GSL 2.1: Max = 1.41e+06ε (Mean = 7.67e+04ε))
+ (Rmath 3.2.3: Max = 1.79e+05ε (Mean = 9.64e+03ε)) +

+
+

+ Max = 2.08e+03ε (Mean = 149ε) +

+
+

+ Max = 1.23e+03ε (Mean = 69.9ε) +

+
+
+
+

Table 117. Error rates for cyl_neumann (integer orders)

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ GNU C++ version 7.1.0
linux
double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Y0: Mathworld Data (Integer Version) +

+
+

+ Max = 5.53ε (Mean = 2.4ε)

+ (<cmath>: Max = 2.05e+05ε (Mean = 6.87e+04ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 6.46ε (Mean = 2.38ε))
(Rmath 3.2.3: + Max = 167ε (Mean = 56.5ε)) +

+
+

+ Max = 5.53ε (Mean = 2.4ε) +

+
+

+ Max = 4.61ε (Mean = 2.29ε)

+ (<math.h>: Max = 5.37e+03ε (Mean = 1.81e+03ε)) +

+
+

+ Y1: Mathworld Data (Integer Version) +

+
+

+ Max = 6.33ε (Mean = 2.25ε)

+ (<cmath>: Max = 9.71e+03ε (Mean = 4.08e+03ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 1.51ε (Mean = 0.839ε))
(Rmath + 3.2.3: Max = 193ε (Mean = 64.4ε)) +

+
+

+ Max = 6.33ε (Mean = 2.29ε) +

+
+

+ Max = 4.75ε (Mean = 1.72ε)

+ (<math.h>: Max = 1.86e+04ε (Mean = 6.2e+03ε)) +

+
+

+ Yn: Mathworld Data (Integer Version) +

+
+

+ Max = 55.2ε (Mean = 17.8ε)

+ (<cmath>: Max = 2.2e+20ε (Mean + = 6.97e+19ε) And + other failures.) +

+
+

+ Max = 0.993ε (Mean = 0.314ε)

+ (GSL 2.1: Max = 2.41e+05ε (Mean = 7.62e+04ε))
+ (Rmath 3.2.3: Max = 1.24e+04ε (Mean = 4e+03ε)) +

+
+

+ Max = 55.2ε (Mean = 17.8ε) +

+
+

+ Max = 35ε (Mean = 11.9ε)

(<math.h>: + Max = 2.49e+05ε (Mean = 8.14e+04ε)) +

+
+
+
+

Table 118. Error rates for cyl_neumann_prime

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Y'0: Mathworld Data +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 6.33ε (Mean = 3.12ε) +

+
+

+ Max = 6.33ε (Mean = 3.14ε) +

+
+

+ Max = 4.75ε (Mean = 1.75ε) +

+
+

+ Y'1: Mathworld Data +

+
+

+ Max = 0.58ε (Mean = 0.193ε) +

+
+

+ Max = 37.1ε (Mean = 12.8ε) +

+
+

+ Max = 34ε (Mean = 11.8ε) +

+
+

+ Max = 3.08ε (Mean = 1.2ε) +

+
+

+ Y'n: Mathworld Data +

+
+

+ Max = 2.05ε (Mean = 0.677ε) +

+
+

+ Max = 56ε (Mean = 18.2ε) +

+
+

+ Max = 56ε (Mean = 21.3ε) +

+
+

+ Max = 563ε (Mean = 178ε) +

+
+

+ Y'v: Mathworld Data +

+
+

+ Max = 21.5ε (Mean = 6.49ε) +

+
+

+ Max = 42.5ε (Mean = 13.4ε) +

+
+

+ Max = 42.5ε (Mean = 13.6ε) +

+
+

+ Max = 23.7ε (Mean = 10.1ε) +

+
+

+ Y'v: Mathworld Data (large values) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 1.57ε (Mean = 1.24ε) +

+
+

+ Max = 1.57ε (Mean = 1.24ε) +

+
+

+ Max = 0.627ε (Mean = 0.237ε) +

+
+

+ Y'0 and Y'1: Random Data +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 23.8ε (Mean = 3.69ε) +

+
+

+ Max = 23.8ε (Mean = 3.69ε) +

+
+

+ Max = 5.95ε (Mean = 1.36ε) +

+
+

+ Y'n: Random Data +

+
+

+ Max = 1.53ε (Mean = 0.0885ε) +

+
+

+ Max = 2.35e+03ε (Mean = 136ε) +

+
+

+ Max = 2.35e+03ε (Mean = 136ε) +

+
+

+ Max = 621ε (Mean = 36ε) +

+
+

+ Y'v: Random Data +

+
+

+ Max = 56.8ε (Mean = 2.59ε) +

+
+

+ Max = 1.16e+05ε (Mean = 5.28e+03ε) +

+
+

+ Max = 1.16e+05ε (Mean = 5.28e+03ε) +

+
+

+ Max = 3.23e+04ε (Mean = 1.13e+03ε) +

+
+
+
+

Table 119. Error rates for cyl_neumann_prime (integer orders)

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Y'0: Mathworld Data (Integer Version) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 6.33ε (Mean = 3.12ε) +

+
+

+ Max = 6.33ε (Mean = 3.14ε) +

+
+

+ Max = 4.75ε (Mean = 1.75ε) +

+
+

+ Y'1: Mathworld Data (Integer Version) +

+
+

+ Max = 0.58ε (Mean = 0.193ε) +

+
+

+ Max = 37.1ε (Mean = 12.8ε) +

+
+

+ Max = 34ε (Mean = 11.8ε) +

+
+

+ Max = 3.08ε (Mean = 1.2ε) +

+
+

+ Y'n: Mathworld Data (Integer Version) +

+
+

+ Max = 2.05ε (Mean = 0.677ε) +

+
+

+ Max = 56ε (Mean = 18.2ε) +

+
+

+ Max = 56ε (Mean = 21.3ε) +

+
+

+ Max = 563ε (Mean = 178ε) +

+
+
+
+

Table 120. Error rates for digamma

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Digamma Function: Large Values +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 1.84ε (Mean = 0.71ε))
(Rmath 3.2.3: + Max = 1.18ε (Mean = 0.331ε)) +

+
+

+ Max = 1.39ε (Mean = 0.413ε) +

+
+

+ Max = 1.39ε (Mean = 0.413ε) +

+
+

+ Max = 0.98ε (Mean = 0.369ε) +

+
+

+ Digamma Function: Near the Positive Root +

+
+

+ Max = 0.891ε (Mean = 0.0995ε)

+ (GSL 2.1: Max = 135ε (Mean = 11.9ε))
(Rmath + 3.2.3: Max = 2.02e+03ε (Mean = 256ε)) +

+
+

+ Max = 1.37ε (Mean = 0.477ε) +

+
+

+ Max = 1.31ε (Mean = 0.471ε) +

+
+

+ Max = 0.997ε (Mean = 0.527ε) +

+
+

+ Digamma Function: Near Zero +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 0.953ε (Mean = 0.348ε))
(Rmath + 3.2.3: Max = 1.17ε (Mean = 0.564ε)) +

+
+

+ Max = 0.984ε (Mean = 0.361ε) +

+
+

+ Max = 0.984ε (Mean = 0.361ε) +

+
+

+ Max = 0.953ε (Mean = 0.337ε) +

+
+

+ Digamma Function: Negative Values +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 4.56e+04ε (Mean = 3.91e+03ε))
(Rmath + 3.2.3: Max = 4.6e+04ε (Mean = 3.94e+03ε)) +

+
+

+ Max = 180ε (Mean = 13ε) +

+
+

+ Max = 180ε (Mean = 13ε) +

+
+

+ Max = 214ε (Mean = 16.1ε) +

+
+

+ Digamma Function: Values near 0 +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 0.866ε (Mean = 0.387ε))
(Rmath + 3.2.3: Max = 3.58e+05ε (Mean = 1.6e+05ε)) +

+
+

+ Max = 1ε (Mean = 0.592ε) +

+
+

+ Max = 1ε (Mean = 0.592ε) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Digamma Function: Integer arguments +

+
+

+ Max = 0.992ε (Mean = 0.215ε)

+ (GSL 2.1: Max = 1.18ε (Mean = 0.607ε))
(Rmath + 3.2.3: Max = 4.33ε (Mean = 0.982ε)) +

+
+

+ Max = 0.888ε (Mean = 0.403ε) +

+
+

+ Max = 0.888ε (Mean = 0.403ε) +

+
+

+ Max = 0.992ε (Mean = 0.452ε) +

+
+

+ Digamma Function: Half integer arguments +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 1.09ε (Mean = 0.531ε))
(Rmath + 3.2.3: Max = 46.2ε (Mean = 7.24ε)) +

+
+

+ Max = 0.906ε (Mean = 0.409ε) +

+
+

+ Max = 0.906ε (Mean = 0.409ε) +

+
+

+ Max = 0.78ε (Mean = 0.314ε) +

+
+
+
+

Table 121. Error rates for ellint_1

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ GNU C++ version 7.1.0
linux
double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Elliptic Integral F: Mathworld Data +

+
+

+ Max = 0.94ε (Mean = 0.509ε)

+ (<cmath>: Max = +INFε (Mean + = +INFε) And + other failures.) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 0.919ε (Mean = 0.544ε)) +

+
+

+ Max = 0.94ε (Mean = 0.509ε) +

+
+

+ Max = 0.919ε (Mean = 0.542ε) +

+
+

+ Elliptic Integral F: Random Data +

+
+

+ Max = 1.57ε (Mean = 0.56ε)

+ (<cmath>: Max = 2.56ε (Mean = 0.816ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 2.99ε (Mean = 0.797ε)) +

+
+

+ Max = 1.57ε (Mean = 0.561ε) +

+
+

+ Max = 2.26ε (Mean = 0.631ε) +

+
+
+
+

Table 122. Error rates for ellint_1 (complete)

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ GNU C++ version 7.1.0
linux
double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Elliptic Integral K: Mathworld Data +

+
+

+ Max = 0.887ε (Mean = 0.296ε)

+ (<cmath>: Max = 1.19ε (Mean = 0.765ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 0.623ε (Mean = 0.393ε)) +

+
+

+ Max = 0.887ε (Mean = 0.296ε) +

+
+

+ Max = 0.915ε (Mean = 0.547ε) +

+
+

+ Elliptic Integral K: Random Data +

+
+

+ Max = 1.27ε (Mean = 0.473ε)

+ (<cmath>: Max = 2.19ε (Mean = 0.694ε)) +

+
+

+ Max = 0.851ε (Mean = 0.0851ε)

+ (GSL 2.1: Max = 2.32ε (Mean = 0.688ε)) +

+
+

+ Max = 1.27ε (Mean = 0.473ε) +

+
+

+ Max = 0.958ε (Mean = 0.408ε) +

+
+
+
+

Table 123. Error rates for ellint_2

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Elliptic Integral E: Mathworld Data +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 0.63ε (Mean = 0.325ε)) +

+
+

+ Max = 0.656ε (Mean = 0.317ε)

+ (<cmath>: Max = +INFε (Mean + = +INFε) And + other failures.) +

+
+

+ Max = 0.656ε (Mean = 0.317ε) +

+
+

+ Max = 1.31ε (Mean = 0.727ε) +

+
+

+ Elliptic Integral E: Random Data +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 4.4ε (Mean = 1.16ε)) +

+
+

+ Max = 2.05ε (Mean = 0.632ε)

+ (<cmath>: Max = 3.08e+04ε (Mean = 3.84e+03ε)) +

+
+

+ Max = 2.05ε (Mean = 0.632ε) +

+
+

+ Max = 2.23ε (Mean = 0.639ε) +

+
+

+ Elliptic Integral E: Small Angles +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 0.5ε (Mean = 0.118ε)) +

+
+

+ Max = 1ε (Mean = 0.283ε)

(<cmath>: + Max = 2ε (Mean = 0.333ε)) +

+
+

+ Max = 1ε (Mean = 0.283ε) +

+
+

+ Max = 1ε (Mean = 0.421ε) +

+
+
+
+

Table 124. Error rates for ellint_2 (complete)

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Elliptic Integral E: Mathworld Data +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 3.09ε (Mean = 1.04ε) And + other failures.) +

+
+

+ Max = 0.836ε (Mean = 0.469ε)

+ (<cmath>: Max = 170ε (Mean = 55.1ε)) +

+
+

+ Max = 0.836ε (Mean = 0.469ε) +

+
+

+ Max = 1.3ε (Mean = 0.615ε) +

+
+

+ Elliptic Integral E: Random Data +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 4.34ε (Mean = 1.18ε)) +

+
+

+ Max = 1.97ε (Mean = 0.629ε)

+ (<cmath>: Max = 2.49e+04ε (Mean = 3.39e+03ε)) +

+
+

+ Max = 1.97ε (Mean = 0.629ε) +

+
+

+ Max = 1.71ε (Mean = 0.553ε) +

+
+
+
+

Table 125. Error rates for ellint_3

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ GNU C++ version 7.1.0
linux
double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Elliptic Integral PI: Mathworld Data +

+
+

+ Max = 475ε (Mean = 86.3ε)

+ (<cmath>: Max = +INFε (Mean + = +INFε) And + other failures.) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 1.48e+05ε (Mean = 2.54e+04ε) And + other failures.) +

+
+

+ Max = 475ε (Mean = 86.3ε) +

+
+

+ Max = 565ε (Mean = 102ε) +

+
+

+ Elliptic Integral PI: Random Data +

+
+

+ Max = 4.54ε (Mean = 0.895ε)

+ (<cmath>: Max = 3.37e+20ε (Mean + = 3.47e+19ε) And + other failures.) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 633ε (Mean = 50.1ε)) +

+
+

+ Max = 4.49ε (Mean = 0.885ε) +

+
+

+ Max = 8.33ε (Mean = 0.971ε) +

+
+

+ Elliptic Integral PI: Large Random Data +

+
+

+ Max = 3.7ε (Mean = 0.893ε)

+ (<cmath>: Max = 2.52e+18ε (Mean + = 4.83e+17ε) And + other failures.) +

+
+

+ Max = 0.557ε (Mean = 0.0389ε)

+ (GSL 2.1: Max = 40.1ε (Mean = 7.77ε)) +

+
+

+ Max = 3.7ε (Mean = 0.892ε) +

+
+

+ Max = 2.86ε (Mean = 0.944ε) +

+
+
+
+

Table 126. Error rates for ellint_3 (complete)

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ GNU C++ version 7.1.0
linux
double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Complete Elliptic Integral PI: Mathworld Data +

+
+

+ Max = 1.4ε (Mean = 0.575ε)

+ (<cmath>: Max = 6.31e+20ε (Mean + = 1.53e+20ε) And + other failures.) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 6.33e+04ε (Mean = 1.54e+04ε) And + other failures.) +

+
+

+ Max = 1.4ε (Mean = 0.575ε) +

+
+

+ Max = 0.971ε (Mean = 0.464ε) +

+
+

+ Complete Elliptic Integral PI: Random Data +

+
+

+ Max = 2.45ε (Mean = 0.696ε)

+ (<cmath>: Max = 8.78e+20ε (Mean + = 1.02e+20ε) And + other failures.) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 24ε (Mean = 2.99ε)) +

+
+

+ Max = 2.4ε (Mean = 0.677ε) +

+
+

+ Max = 2.46ε (Mean = 0.657ε) +

+
+
+
+

Table 127. Error rates for ellint_d

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Elliptic Integral E: Mathworld Data +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 0.862ε (Mean = 0.568ε)) +

+
+

+ Max = 1.3ε (Mean = 0.813ε) +

+
+

+ Max = 1.3ε (Mean = 0.813ε) +

+
+

+ Max = 0.862ε (Mean = 0.457ε) +

+
+

+ Elliptic Integral D: Random Data +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 3.01ε (Mean = 0.928ε)) +

+
+

+ Max = 2.51ε (Mean = 0.883ε) +

+
+

+ Max = 2.51ε (Mean = 0.883ε) +

+
+

+ Max = 2.87ε (Mean = 0.805ε) +

+
+
+
+

Table 128. Error rates for ellint_d (complete)

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Elliptic Integral E: Mathworld Data +

+
+

+ Max = 0.637ε (Mean = 0.368ε) +

+
+

+ Max = 1.27ε (Mean = 0.735ε) +

+
+

+ Max = 1.27ε (Mean = 0.735ε) +

+
+

+ Max = 0.637ε (Mean = 0.368ε) +

+
+

+ Elliptic Integral D: Random Data +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 1.27ε (Mean = 0.334ε) +

+
+

+ Max = 1.27ε (Mean = 0.334ε) +

+
+

+ Max = 1.27ε (Mean = 0.355ε) +

+
+
+
+

Table 129. Error rates for ellint_rc

+
++++++ + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ RC: Random data +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 2.4ε (Mean = 0.624ε)) +

+
+

+ Max = 0.995ε (Mean = 0.433ε) +

+
+

+ Max = 0.962ε (Mean = 0.407ε) +

+
+
+
+

Table 130. Error rates for ellint_rd

+
++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ RD: Random data +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 2.59ε (Mean = 0.878ε)) +

+
+

+ Max = 2.73ε (Mean = 0.831ε) +

+
+

+ Max = 2.16ε (Mean = 0.803ε) +

+
+

+ RD: y = z +

+
+

+ Max = 0.896ε (Mean = 0.022ε)

+ (GSL 2.1: Max = 2.88ε (Mean = 0.839ε)) +

+
+

+ Max = 2.65ε (Mean = 0.82ε) +

+
+

+ Max = 16.5ε (Mean = 0.843ε) +

+
+

+ RD: x = y +

+
+

+ Max = 0.824ε (Mean = 0.0272ε)

+ (GSL 2.1: Max = 3.74ε (Mean = 0.84ε)) +

+
+

+ Max = 2.85ε (Mean = 0.865ε) +

+
+

+ Max = 3.51ε (Mean = 0.816ε) +

+
+

+ RD: x = 0, y = z +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 2ε (Mean = 0.656ε)) +

+
+

+ Max = 1.19ε (Mean = 0.522ε) +

+
+

+ Max = 1.16ε (Mean = 0.497ε) +

+
+

+ RD: x = y = z +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 1.03ε (Mean = 0.418ε)) +

+
+

+ Max = 0.998ε (Mean = 0.387ε) +

+
+

+ Max = 1.03ε (Mean = 0.418ε) +

+
+

+ RD: x = 0 +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 2.85ε (Mean = 0.781ε)) +

+
+

+ Max = 2.79ε (Mean = 0.883ε) +

+
+

+ Max = 2.64ε (Mean = 0.894ε) +

+
+
+
+

Table 131. Error rates for ellint_rf

+
++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ RF: Random data +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 2.73ε (Mean = 0.804ε)) +

+
+

+ Max = 2.54ε (Mean = 0.674ε) +

+
+

+ Max = 2.02ε (Mean = 0.677ε) +

+
+

+ RF: x = y = z +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 0.999ε (Mean = 0.34ε)) +

+
+

+ Max = 0.991ε (Mean = 0.345ε) +

+
+

+ Max = 0.999ε (Mean = 0.34ε) +

+
+

+ RF: x = y or y = z or x = z +

+
+

+ Max = 0.536ε (Mean = 0.00658ε)

+ (GSL 2.1: Max = 2.89ε (Mean = 0.749ε)) +

+
+

+ Max = 1.95ε (Mean = 0.418ε) +

+
+

+ Max = 1.21ε (Mean = 0.394ε) +

+
+

+ RF: x = 0, y = z +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 1.29ε (Mean = 0.527ε)) +

+
+

+ Max = 0.894ε (Mean = 0.338ε) +

+
+

+ Max = 0.999ε (Mean = 0.407ε) +

+
+

+ RF: z = 0 +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 2.54ε (Mean = 0.781ε)) +

+
+

+ Max = 1.7ε (Mean = 0.539ε) +

+
+

+ Max = 1.89ε (Mean = 0.587ε) +

+
+
+
+

Table 132. Error rates for ellint_rg

+
++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ RG: Random Data +

+
+

+ Max = 0.983ε (Mean = 0.0172ε)

+ (GSL 2.1: Max = 0.983ε (Mean = 0.0172ε)) +

+
+

+ Max = 3.95ε (Mean = 0.951ε) +

+
+

+ Max = 3.65ε (Mean = 0.929ε) +

+
+

+ RG: two values 0 +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 0ε (Mean = 0ε)) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ RG: All values the same or zero +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 0ε (Mean = 0ε)) +

+
+

+ Max = 0.992ε (Mean = 0.288ε) +

+
+

+ Max = 1.06ε (Mean = 0.348ε) +

+
+

+ RG: two values the same +

+
+

+ Max = 0.594ε (Mean = 0.0103ε)

+ (GSL 2.1: Max = 0.594ε (Mean = 0.0103ε)) +

+
+

+ Max = 1.51ε (Mean = 0.404ε) +

+
+

+ Max = 1.96ε (Mean = 0.374ε) +

+
+

+ RG: one value zero +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 0ε (Mean = 0ε)) +

+
+

+ Max = 2.14ε (Mean = 0.722ε) +

+
+

+ Max = 1.96ε (Mean = 0.674ε) +

+
+
+
+

Table 133. Error rates for ellint_rj

+
++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ RJ: Random data +

+
+

+ Max = 0.52ε (Mean = 0.0184ε)

+ (GSL 2.1: Max = 3.57ε (Mean = 0.704ε) And + other failures.) +

+
+

+ Max = 186ε (Mean = 6.67ε) +

+
+

+ Max = 215ε (Mean = 7.66ε) +

+
+

+ RJ: 4 Equal Values +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 1.03ε (Mean = 0.418ε)) +

+
+

+ Max = 0.998ε (Mean = 0.387ε) +

+
+

+ Max = 1.03ε (Mean = 0.418ε) +

+
+

+ RJ: 3 Equal Values +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 3.96ε (Mean = 1.06ε)) +

+
+

+ Max = 20.8ε (Mean = 0.986ε) +

+
+

+ Max = 39.9ε (Mean = 1.17ε) +

+
+

+ RJ: 2 Equal Values +

+
+

+ Max = 0.6ε (Mean = 0.0228ε)

+ (GSL 2.1: Max = 2.57ε (Mean = 0.754ε)) +

+
+

+ Max = 220ε (Mean = 6.64ε) +

+
+

+ Max = 214ε (Mean = 5.28ε) +

+
+

+ RJ: Equal z and p +

+
+

+ Max = 0.742ε (Mean = 0.0166ε)

+ (GSL 2.1: Max = 2.62ε (Mean = 0.699ε)) +

+
+

+ Max = 17.2ε (Mean = 1.16ε) +

+
+

+ Max = 16.1ε (Mean = 1.14ε) +

+
+
+
+

Table 134. Error rates for erf

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ GNU C++ version 7.1.0
linux
double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Erf Function: Small Values +

+
+

+ Max = 0.925ε (Mean = 0.193ε)

+ (<cmath>: Max = 0.944ε (Mean = 0.191ε))
+ (<math.h>: Max = 0.944ε (Mean = 0.191ε)) +

+
+

+ Max = 0.841ε (Mean = 0.0687ε)

+ (GSL 2.1: Max = 2.06ε (Mean = 0.319ε)) +

+
+

+ Max = 0.925ε (Mean = 0.193ε)

+ (<math.h>: Max = 0.944ε (Mean = 0.194ε)) +

+
+

+ Max = 0.996ε (Mean = 0.182ε)

+ (<math.h>: Max = 1.57ε (Mean = 0.317ε)) +

+
+

+ Erf Function: Medium Values +

+
+

+ Max = 1.5ε (Mean = 0.193ε)

+ (<cmath>: Max = 0.921ε (Mean = 0.0723ε))
+ (<math.h>: Max = 0.921ε (Mean = 0.0723ε)) +

+
+

+ Max = 1ε (Mean = 0.119ε)

(GSL + 2.1: Max = 2.31ε (Mean = 0.368ε)) +

+
+

+ Max = 1.5ε (Mean = 0.197ε)

+ (<math.h>: Max = 0.921ε (Mean = 0.071ε)) +

+
+

+ Max = 1ε (Mean = 0.171ε)

(<math.h>: + Max = 1.19ε (Mean = 0.244ε)) +

+
+

+ Erf Function: Large Values +

+
+

+ Max = 0ε (Mean = 0ε)

(<cmath>: + Max = 0ε (Mean = 0ε))
(<math.h>: Max + = 0ε (Mean = 0ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 0ε (Mean = 0ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(<math.h>: + Max = 0ε (Mean = 0ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(<math.h>: + Max = 0ε (Mean = 0ε)) +

+
+
+
+

Table 135. Error rates for erf_inv

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Inverse Erf Function +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 0.996ε (Mean = 0.389ε) +

+
+

+ Max = 1.08ε (Mean = 0.395ε) +

+
+

+ Max = 1.09ε (Mean = 0.502ε) +

+
+
+
+

Table 136. Error rates for erfc

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ GNU C++ version 7.1.0
linux
double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Erf Function: Small Values +

+
+

+ Max = 0ε (Mean = 0ε)

(<cmath>: + Max = 0ε (Mean = 0ε))
(<math.h>: Max + = 0ε (Mean = 0ε)) +

+
+

+ Max = 0.658ε (Mean = 0.0537ε)

+ (GSL 2.1: Max = 1.01ε (Mean = 0.485ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(<math.h>: + Max = 0ε (Mean = 0ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(<math.h>: + Max = 0ε (Mean = 0ε)) +

+
+

+ Erf Function: Medium Values +

+
+

+ Max = 1.76ε (Mean = 0.365ε)

+ (<cmath>: Max = 1.35ε (Mean = 0.307ε))
+ (<math.h>: Max = 1.35ε (Mean = 0.307ε)) +

+
+

+ Max = 0.983ε (Mean = 0.213ε)

+ (GSL 2.1: Max = 2.64ε (Mean = 0.662ε)) +

+
+

+ Max = 1.76ε (Mean = 0.38ε)

+ (<math.h>: Max = 2.81ε (Mean = 0.739ε)) +

+
+

+ Max = 1.65ε (Mean = 0.373ε)

+ (<math.h>: Max = 2.36ε (Mean = 0.539ε)) +

+
+

+ Erf Function: Large Values +

+
+

+ Max = 1.57ε (Mean = 0.542ε)

+ (<cmath>: Max = 1.26ε (Mean = 0.441ε))
+ (<math.h>: Max = 1.26ε (Mean = 0.441ε)) +

+
+

+ Max = 0.868ε (Mean = 0.147ε)

+ (GSL 2.1: Max = 3.9ε (Mean = 0.472ε)) +

+
+

+ Max = 1.57ε (Mean = 0.564ε)

+ (<math.h>: Max = 4.91ε (Mean = 1.54ε)) +

+
+

+ Max = 1.14ε (Mean = 0.248ε)

+ (<math.h>: Max = 1.84ε (Mean = 0.331ε)) +

+
+
+
+

Table 137. Error rates for erfc_inv

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Inverse Erfc Function +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 0.996ε (Mean = 0.397ε) +

+
+

+ Max = 1.08ε (Mean = 0.403ε) +

+
+

+ Max = 1ε (Mean = 0.491ε) +

+
+

+ Inverse Erfc Function: extreme values +

+
+ +

+ Max = 1.62ε (Mean = 0.383ε) +

+
+

+ Max = 1.62ε (Mean = 0.383ε) +

+
+
+
+
+

Table 138. Error rates for expint (Ei)

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ GNU C++ version 7.1.0
linux
double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Exponential Integral Ei +

+
+

+ Max = 5.05ε (Mean = 0.821ε)

+ (<cmath>: Max = 14.1ε (Mean = 2.43ε) And + other failures.) +

+
+

+ Max = 0.994ε (Mean = 0.142ε)

+ (GSL 2.1: Max = 8.96ε (Mean = 0.703ε)) +

+
+

+ Max = 5.05ε (Mean = 0.835ε) +

+
+

+ Max = 1.43ε (Mean = 0.54ε) +

+
+

+ Exponential Integral Ei: double exponent range +

+
+

+ Max = 1.72ε (Mean = 0.593ε)

+ (<cmath>: Max = 3.11ε (Mean = 1.13ε)) +

+
+

+ Max = 0.998ε (Mean = 0.156ε)

+ (GSL 2.1: Max = 1.5ε (Mean = 0.612ε)) +

+
+

+ Max = 1.72ε (Mean = 0.607ε) +

+
+

+ Max = 1.7ε (Mean = 0.66ε) +

+
+

+ Exponential Integral Ei: long exponent range +

+
+

+ Max = 1.98ε (Mean = 0.595ε)

+ (<cmath>: Max = 1.93ε (Mean = 0.855ε)) +

+
+ +

+ Max = 1.98ε (Mean = 0.575ε) +

+
+
+
+
+

Table 139. Error rates for expint (En)

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Exponential Integral En +

+
+

+ Max = 0.589ε (Mean = 0.0331ε)

+ (GSL 2.1: Max = 58.5ε (Mean = 17.1ε)) +

+
+

+ Max = 9.97ε (Mean = 2.13ε) +

+
+

+ Max = 9.97ε (Mean = 2.13ε) +

+
+

+ Max = 7.16ε (Mean = 1.85ε) +

+
+

+ Exponential Integral En: small z values +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 115ε (Mean = 23.6ε)) +

+
+

+ Max = 1.99ε (Mean = 0.559ε) +

+
+

+ Max = 1.99ε (Mean = 0.559ε) +

+
+

+ Max = 2.62ε (Mean = 0.531ε) +

+
+

+ Exponential Integral E1 +

+
+

+ Max = 0.556ε (Mean = 0.0625ε)

+ (GSL 2.1: Max = 0.988ε (Mean = 0.469ε)) +

+
+

+ Max = 0.965ε (Mean = 0.414ε) +

+
+

+ Max = 0.965ε (Mean = 0.408ε) +

+
+

+ Max = 0.988ε (Mean = 0.486ε) +

+
+
+
+

Table 140. Error rates for expm1

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ GNU C++ version 7.1.0
linux
double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Random test data +

+
+

+ Max = 0.992ε (Mean = 0.402ε)

+ (<cmath>: Max = 0.992ε (Mean = 0.402ε))
+ (<math.h>: Max = 0.992ε (Mean = 0.402ε)) +

+
+

+ Max = 0.793ε (Mean = 0.126ε)

+ (Rmath 3.2.3: Max = 0.793ε (Mean = 0.126ε)) +

+
+

+ Max = 1.31ε (Mean = 0.428ε)

+ (<math.h>: Max = 0.996ε (Mean = 0.426ε)) +

+
+

+ Max = 1.31ε (Mean = 0.496ε)

+ (<math.h>: Max = 1.31ε (Mean = 0.496ε)) +

+
+
+
+

Table 141. Error rates for gamma_p

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ tgamma(a, z) medium values +

+
+

+ Max = 0.955ε (Mean = 0.05ε)

+ (GSL 2.1: Max = 342ε (Mean = 45.8ε))
(Rmath + 3.2.3: Max = 389ε (Mean = 44ε)) +

+
+

+ Max = 41.6ε (Mean = 8.09ε) +

+
+

+ Max = 239ε (Mean = 30.2ε) +

+
+

+ Max = 35.1ε (Mean = 6.98ε) +

+
+

+ tgamma(a, z) small values +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 4.82ε (Mean = 0.758ε))
(Rmath + 3.2.3: Max = 1.01ε (Mean = 0.306ε)) +

+
+

+ Max = 2ε (Mean = 0.464ε) +

+
+

+ Max = 2ε (Mean = 0.461ε) +

+
+

+ Max = 1.54ε (Mean = 0.439ε) +

+
+

+ tgamma(a, z) large values +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 1.02e+03ε (Mean = 105ε))
(Rmath + 3.2.3: Max = 1.11e+03ε (Mean = 67.5ε)) +

+
+

+ Max = 3.08e+04ε (Mean = 1.86e+03ε) +

+
+

+ Max = 3.02e+04ε (Mean = 1.91e+03ε) +

+
+

+ Max = 243ε (Mean = 20.2ε) +

+
+

+ tgamma(a, z) integer and half integer values +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 128ε (Mean = 22.6ε))
(Rmath 3.2.3: + Max = 66.2ε (Mean = 12.2ε)) +

+
+

+ Max = 11.8ε (Mean = 2.66ε) +

+
+

+ Max = 71.6ε (Mean = 9.47ε) +

+
+

+ Max = 13ε (Mean = 2.97ε) +

+
+
+
+

Table 142. Error rates for gamma_p_inv

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ incomplete gamma inverse(a, z) medium values +

+
+

+ Max = 0.993ε (Mean = 0.15ε)

+ (Rmath 3.2.3: Max = 4.88ε (Mean = 0.868ε)) +

+
+

+ Max = 1.8ε (Mean = 0.406ε) +

+
+

+ Max = 1.89ε (Mean = 0.466ε) +

+
+

+ Max = 1.71ε (Mean = 0.34ε) +

+
+

+ incomplete gamma inverse(a, z) large values +

+
+

+ Max = 0ε (Mean = 0ε)

(Rmath + 3.2.3: Max = 0.816ε (Mean = 0.0874ε)) +

+
+

+ Max = 0.509ε (Mean = 0.0447ε) +

+
+

+ Max = 0.509ε (Mean = 0.0447ε) +

+
+

+ Max = 0.924ε (Mean = 0.108ε) +

+
+

+ incomplete gamma inverse(a, z) small values +

+
+

+ Max = 441ε (Mean = 53.9ε)

+ (Rmath 3.2.3: Max = 547ε (Mean = 61.6ε)) +

+
+

+ Max = 9.17e+03ε (Mean = 1.45e+03ε) +

+
+

+ Max = 1.09e+04ε (Mean = 1.3e+03ε) +

+
+

+ Max = 1.1e+03ε (Mean = 131ε) +

+
+
+
+

Table 143. Error rates for gamma_p_inva

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Incomplete gamma inverses. +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 7.87ε (Mean = 1.15ε) +

+
+

+ Max = 4.08ε (Mean = 1.12ε) +

+
+

+ Max = 4.92ε (Mean = 1.03ε) +

+
+
+
+

Table 144. Error rates for gamma_q

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ tgamma(a, z) medium values +

+
+

+ Max = 0.927ε (Mean = 0.035ε)

+ (GSL 2.1: Max = 201ε (Mean = 13.5ε))
(Rmath + 3.2.3: Max = 131ε (Mean = 12.7ε)) +

+
+

+ Max = 32.3ε (Mean = 6.61ε) +

+
+

+ Max = 199ε (Mean = 26.6ε) +

+
+

+ Max = 23.7ε (Mean = 4ε) +

+
+

+ tgamma(a, z) small values +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 1.38e+10ε (Mean = 1.05e+09ε))
+ (Rmath 3.2.3: Max = 65.6ε (Mean = 11ε)) +

+
+

+ Max = 2.45ε (Mean = 0.885ε) +

+
+

+ Max = 2.45ε (Mean = 0.819ε) +

+
+

+ Max = 2.26ε (Mean = 0.74ε) +

+
+

+ tgamma(a, z) large values +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 2.71e+04ε (Mean = 2.16e+03ε))
(Rmath + 3.2.3: Max = 1.02e+03ε (Mean = 62.7ε)) +

+
+

+ Max = 6.82e+03ε (Mean = 414ε) +

+
+

+ Max = 1.15e+04ε (Mean = 733ε) +

+
+

+ Max = 469ε (Mean = 31.5ε) +

+
+

+ tgamma(a, z) integer and half integer values +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 118ε (Mean = 12.5ε))
(Rmath 3.2.3: + Max = 138ε (Mean = 16.9ε)) +

+
+

+ Max = 11.1ε (Mean = 2.07ε) +

+
+

+ Max = 54.7ε (Mean = 6.16ε) +

+
+

+ Max = 8.72ε (Mean = 1.48ε) +

+
+
+
+

Table 145. Error rates for gamma_q_inv

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ incomplete gamma inverse(a, z) medium values +

+
+

+ Max = 0.912ε (Mean = 0.154ε)

+ (Rmath 3.2.3: Max = 4.66ε (Mean = 0.792ε)) +

+
+

+ Max = 6.2ε (Mean = 0.627ε) +

+
+

+ Max = 6.2ε (Mean = 0.683ε) +

+
+

+ Max = 2.88ε (Mean = 0.469ε) +

+
+

+ incomplete gamma inverse(a, z) large values +

+
+

+ Max = 0.894ε (Mean = 0.0915ε)

+ (Rmath 3.2.3: Max = 0.894ε (Mean = 0.106ε)) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 0.814ε (Mean = 0.0856ε) +

+
+

+ incomplete gamma inverse(a, z) small values +

+
+

+ Max = 292ε (Mean = 36.4ε)

+ (Rmath 3.2.3: Max = 415ε (Mean = 48.7ε)) +

+
+

+ Max = 8.28e+03ε (Mean = 1.09e+03ε) +

+
+

+ Max = 8.98e+03ε (Mean = 877ε) +

+
+

+ Max = 451ε (Mean = 64.7ε) +

+
+
+
+

Table 146. Error rates for gamma_q_inva

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Incomplete gamma inverses. +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 8.42ε (Mean = 1.3ε) +

+
+

+ Max = 7.86ε (Mean = 1.24ε) +

+
+

+ Max = 5.05ε (Mean = 1.08ε) +

+
+
+
+

Table 147. Error rates for hermite

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Hermite Polynomials +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 6.24ε (Mean = 2.07ε) +

+
+

+ Max = 6.24ε (Mean = 2.07ε) +

+
+

+ Max = 4.46ε (Mean = 1.41ε) +

+
+
+
+

Table 148. Error rates for heuman_lambda

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Elliptic Integral Jacobi Zeta: Mathworld Data +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 1.89ε (Mean = 0.887ε) +

+
+

+ Max = 1.89ε (Mean = 0.887ε) +

+
+

+ Max = 1.08ε (Mean = 0.734ε) +

+
+

+ Elliptic Integral Heuman Lambda: Random Data +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 3.82ε (Mean = 0.609ε) +

+
+

+ Max = 3.82ε (Mean = 0.608ε) +

+
+

+ Max = 2.12ε (Mean = 0.588ε) +

+
+
+
+

Table 149. Error rates for ibeta

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Incomplete Beta Function: Small Values +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 682ε (Mean = 32.6ε))
(Rmath 3.2.3: + Max = 22.9ε (Mean = 3.35ε)) +

+
+

+ Max = 8.97ε (Mean = 2.09ε) +

+
+

+ Max = 21.3ε (Mean = 2.75ε) +

+
+

+ Max = 8.4ε (Mean = 1.93ε) +

+
+

+ Incomplete Beta Function: Medium Values +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 690ε (Mean = 151ε))
(Rmath 3.2.3: + Max = 232ε (Mean = 27.9ε)) +

+
+

+ Max = 50ε (Mean = 12.1ε) +

+
+

+ Max = 124ε (Mean = 18.4ε) +

+
+

+ Max = 106ε (Mean = 16.3ε) +

+
+

+ Incomplete Beta Function: Large and Diverse Values +

+
+

+ Max = 1.26ε (Mean = 0.063ε)

+ (GSL 2.1: Max = 3.9e+05ε (Mean = 1.82e+04ε) And + other failures.)
(Rmath 3.2.3: + Max = 574ε (Mean = 49.4ε)) +

+
+

+ Max = 1.96e+04ε (Mean = 997ε) +

+
+

+ Max = 4.98e+04ε (Mean = 2.07e+03ε) +

+
+

+ Max = 1.32e+03ε (Mean = 68.5ε) +

+
+

+ Incomplete Beta Function: Small Integer Values +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 254ε (Mean = 50.9ε))
(Rmath 3.2.3: + Max = 62.2ε (Mean = 8.95ε)) +

+
+

+ Max = 4.45ε (Mean = 0.814ε) +

+
+

+ Max = 44.5ε (Mean = 10.1ε) +

+
+

+ Max = 3.85ε (Mean = 0.791ε) +

+
+
+
+

Table 150. Error rates for ibeta_inv

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Inverse incomplete beta +

+
+

+ Max = 11ε (Mean = 0.345ε)

+ (Rmath 3.2.3: Max = 1.14e+121ε (Mean + = 3.28e+119ε) And + other failures.) +

+
+

+ Max = 3.8e+04ε (Mean = 2.66e+03ε) +

+
+

+ Max = 4.07e+04ε (Mean = 2.86e+03ε) +

+
+

+ Max = 8.59e+03ε (Mean = 277ε) +

+
+
+
+

Table 151. Error rates for ibeta_inva

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Inverse incomplete beta +

+
+

+ Max = 0.602ε (Mean = 0.0239ε) +

+
+

+ Max = 377ε (Mean = 24.4ε) +

+
+

+ Max = 438ε (Mean = 31.3ε) +

+
+

+ Max = 242ε (Mean = 22.9ε) +

+
+
+
+

Table 152. Error rates for ibeta_invb

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Inverse incomplete beta +

+
+

+ Max = 0.765ε (Mean = 0.0422ε) +

+
+

+ Max = 407ε (Mean = 27.2ε) +

+
+

+ Max = 407ε (Mean = 24.4ε) +

+
+

+ Max = 409ε (Mean = 19.3ε) +

+
+
+
+

Table 153. Error rates for ibetac

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Incomplete Beta Function: Small Values +

+
+

+ Max = 0ε (Mean = 0ε)

(Rmath + 3.2.3: Max = 22.4ε (Mean = 3.67ε)) +

+
+

+ Max = 10.6ε (Mean = 2.22ε) +

+
+

+ Max = 13.8ε (Mean = 2.68ε) +

+
+

+ Max = 6.94ε (Mean = 1.71ε) +

+
+

+ Incomplete Beta Function: Medium Values +

+
+

+ Max = 0ε (Mean = 0ε)

(Rmath + 3.2.3: Max = 204ε (Mean = 25.8ε)) +

+
+

+ Max = 73.9ε (Mean = 11.2ε) +

+
+

+ Max = 132ε (Mean = 19.8ε) +

+
+

+ Max = 56.7ε (Mean = 14.3ε) +

+
+

+ Incomplete Beta Function: Large and Diverse Values +

+
+

+ Max = 0.981ε (Mean = 0.0573ε)

+ (Rmath 3.2.3: Max = 889ε (Mean = 68.4ε)) +

+
+

+ Max = 3.45e+04ε (Mean = 1.32e+03ε) +

+
+

+ Max = 6.31e+04ε (Mean = 2.04e+03ε) +

+
+

+ Max = 1.88e+03ε (Mean = 82.7ε) +

+
+

+ Incomplete Beta Function: Small Integer Values +

+
+

+ Max = 0ε (Mean = 0ε)

(Rmath + 3.2.3: Max = 84.6ε (Mean = 18ε)) +

+
+

+ Max = 5.34ε (Mean = 1.11ε) +

+
+

+ Max = 107ε (Mean = 17.1ε) +

+
+

+ Max = 6.37ε (Mean = 1.03ε) +

+
+
+
+

Table 154. Error rates for ibetac_inv

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Inverse incomplete beta +

+
+

+ Max = 0.977ε (Mean = 0.0976ε)

+ (Rmath 3.2.3: Max = 3.01e+132ε (Mean + = 8.65e+130ε) And + other failures.) +

+
+

+ Max = 4.88e+04ε (Mean = 3.16e+03ε) +

+
+

+ Max = 5.05e+04ε (Mean = 3.33e+03ε) +

+
+

+ Max = 2.93e+03ε (Mean = 198ε) +

+
+
+
+

Table 155. Error rates for ibetac_inva

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Inverse incomplete beta +

+
+

+ Max = 0.683ε (Mean = 0.0314ε) +

+
+

+ Max = 382ε (Mean = 22.2ε) +

+
+

+ Max = 315ε (Mean = 23.7ε) +

+
+

+ Max = 408ε (Mean = 26.7ε) +

+
+
+
+

Table 156. Error rates for ibetac_invb

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Inverse incomplete beta +

+
+

+ Max = 0.724ε (Mean = 0.0303ε) +

+
+

+ Max = 317ε (Mean = 19.8ε) +

+
+

+ Max = 369ε (Mean = 22.6ε) +

+
+

+ Max = 271ε (Mean = 16.4ε) +

+
+
+
+

Table 157. Error rates for jacobi_cn

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Jacobi Elliptic: Mathworld Data +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 17.3ε (Mean = 4.29ε) And + other failures.) +

+
+

+ Max = 71.6ε (Mean = 19.3ε) +

+
+

+ Max = 71.6ε (Mean = 19.4ε) +

+
+

+ Max = 45.8ε (Mean = 11.4ε) +

+
+

+ Jacobi Elliptic: Random Data +

+
+

+ Max = 0.816ε (Mean = 0.0563ε)

+ (GSL 2.1: Max = 2.43ε (Mean = 0.803ε)) +

+
+

+ Max = 1.68ε (Mean = 0.443ε) +

+
+

+ Max = 1.68ε (Mean = 0.454ε) +

+
+

+ Max = 1.83ε (Mean = 0.455ε) +

+
+

+ Jacobi Elliptic: Random Small Values +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 55.2ε (Mean = 1.64ε) And + other failures.) +

+
+

+ Max = 10.4ε (Mean = 0.594ε) +

+
+

+ Max = 10.4ε (Mean = 0.602ε) +

+
+

+ Max = 26.2ε (Mean = 1.17ε) +

+
+

+ Jacobi Elliptic: Modulus near 1 +

+
+

+ Max = 0.919ε (Mean = 0.127ε)

+ (GSL 2.1: Max = 0ε (Mean = 0ε) And + other failures.) +

+
+

+ Max = 675ε (Mean = 87.1ε) +

+
+

+ Max = 675ε (Mean = 86.8ε) +

+
+

+ Max = 513ε (Mean = 126ε) +

+
+

+ Jacobi Elliptic: Large Phi +

+
+

+ Max = 14.2ε (Mean = 0.927ε)

+ (GSL 2.1: Max = 5.92e+03ε (Mean = 477ε)) +

+
+

+ Max = 2.97e+04ε (Mean = 1.9e+03ε) +

+
+

+ Max = 2.97e+04ε (Mean = 1.9e+03ε) +

+
+

+ Max = 3.27e+04ε (Mean = 1.93e+03ε) +

+
+
+
+

Table 158. Error rates for jacobi_dn

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Jacobi Elliptic: Mathworld Data +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 2.82ε (Mean = 1.18ε) And + other failures.) +

+
+

+ Max = 49ε (Mean = 14ε) +

+
+

+ Max = 49ε (Mean = 14ε) +

+
+

+ Max = 34.3ε (Mean = 8.71ε) +

+
+

+ Jacobi Elliptic: Random Data +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 3ε (Mean = 0.61ε)) +

+
+

+ Max = 1.53ε (Mean = 0.473ε) +

+
+

+ Max = 1.53ε (Mean = 0.481ε) +

+
+

+ Max = 1.52ε (Mean = 0.466ε) +

+
+

+ Jacobi Elliptic: Random Small Values +

+
+

+ Max = 0.5ε (Mean = 0.0122ε)

+ (GSL 2.1: Max = 1.5ε (Mean = 0.391ε) And + other failures.) +

+
+

+ Max = 22.4ε (Mean = 0.777ε) +

+
+

+ Max = 22.4ε (Mean = 0.763ε) +

+
+

+ Max = 16.1ε (Mean = 0.685ε) +

+
+

+ Jacobi Elliptic: Modulus near 1 +

+
+

+ Max = 2.28ε (Mean = 0.194ε)

+ (GSL 2.1: Max = 0ε (Mean = 0ε) And + other failures.) +

+
+

+ Max = 3.75e+03ε (Mean = 293ε) +

+
+

+ Max = 3.75e+03ε (Mean = 293ε) +

+
+

+ Max = 6.24e+03ε (Mean = 482ε) +

+
+

+ Jacobi Elliptic: Large Phi +

+
+

+ Max = 14.1ε (Mean = 0.897ε)

+ (GSL 2.1: Max = 121ε (Mean = 22ε)) +

+
+

+ Max = 2.82e+04ε (Mean = 1.79e+03ε) +

+
+

+ Max = 2.82e+04ε (Mean = 1.79e+03ε) +

+
+

+ Max = 1.67e+04ε (Mean = 1e+03ε) +

+
+
+
+

Table 159. Error rates for jacobi_sn

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Jacobi Elliptic: Mathworld Data +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 588ε (Mean = 146ε) And + other failures.) +

+
+

+ Max = 341ε (Mean = 80.7ε) +

+
+

+ Max = 341ε (Mean = 80.7ε) +

+
+

+ Max = 481ε (Mean = 113ε) +

+
+

+ Jacobi Elliptic: Random Data +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 4.02ε (Mean = 1.07ε)) +

+
+

+ Max = 2.01ε (Mean = 0.584ε) +

+
+

+ Max = 2.01ε (Mean = 0.593ε) +

+
+

+ Max = 1.92ε (Mean = 0.567ε) +

+
+

+ Jacobi Elliptic: Random Small Values +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 11.7ε (Mean = 1.65ε) And + other failures.) +

+
+

+ Max = 1.99ε (Mean = 0.347ε) +

+
+

+ Max = 1.99ε (Mean = 0.347ε) +

+
+

+ Max = 2.11ε (Mean = 0.385ε) +

+
+

+ Jacobi Elliptic: Modulus near 1 +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 0ε (Mean = 0ε) And + other failures.) +

+
+

+ Max = 109ε (Mean = 7.35ε) +

+
+

+ Max = 109ε (Mean = 7.38ε) +

+
+

+ Max = 23.2ε (Mean = 1.85ε) +

+
+

+ Jacobi Elliptic: Large Phi +

+
+

+ Max = 12ε (Mean = 0.771ε)

+ (GSL 2.1: Max = 4.54e+04ε (Mean = 2.63e+03ε)) +

+
+

+ Max = 2.45e+04ε (Mean = 1.51e+03ε) +

+
+

+ Max = 2.45e+04ε (Mean = 1.51e+03ε) +

+
+

+ Max = 4.36e+04ε (Mean = 2.54e+03ε) +

+
+
+
+

Table 160. Error rates for jacobi_zeta

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Elliptic Integral Jacobi Zeta: Mathworld Data +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 1.66ε (Mean = 0.48ε) +

+
+

+ Max = 1.66ε (Mean = 0.48ε) +

+
+

+ Max = 1.52ε (Mean = 0.357ε) +

+
+

+ Elliptic Integral Jacobi Zeta: Random Data +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 2.99ε (Mean = 0.824ε) +

+
+

+ Max = 3.96ε (Mean = 1.06ε) +

+
+

+ Max = 3.89ε (Mean = 0.824ε) +

+
+

+ Elliptic Integral Jacobi Zeta: Large Phi Values +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 2.92ε (Mean = 0.951ε) +

+
+

+ Max = 3.05ε (Mean = 1.13ε) +

+
+

+ Max = 2.52ε (Mean = 0.977ε) +

+
+
+
+

Table 161. Error rates for laguerre(n, m, x)

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Associated Laguerre Polynomials +

+
+

+ Max = 0.84ε (Mean = 0.0358ε)

+ (GSL 2.1: Max = 434ε (Mean = 10.7ε)) +

+
+

+ Max = 167ε (Mean = 6.38ε)

+ (<cmath>: Max = 206ε (Mean = 6.86ε)) +

+
+

+ Max = 167ε (Mean = 6.38ε) +

+
+

+ Max = 434ε (Mean = 11.1ε) +

+
+
+
+

Table 162. Error rates for laguerre(n, x)

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Laguerre Polynomials +

+
+

+ Max = 6.82ε (Mean = 0.408ε)

+ (GSL 2.1: Max = 3.1e+03ε (Mean = 185ε)) +

+
+

+ Max = 1.39e+04ε (Mean = 828ε)

+ (<cmath>: Max = 4.2e+03ε (Mean = 251ε)) +

+
+

+ Max = 1.39e+04ε (Mean = 828ε) +

+
+

+ Max = 3.1e+03ε (Mean = 185ε) +

+
+
+
+

Table 163. Error rates for legendre_p

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Legendre Polynomials: Small Values +

+
+

+ Max = 0.732ε (Mean = 0.0619ε)

+ (GSL 2.1: Max = 211ε (Mean = 20.4ε)) +

+
+

+ Max = 69.2ε (Mean = 9.58ε)

+ (<cmath>: Max = 124ε (Mean = 13.2ε)) +

+
+

+ Max = 69.2ε (Mean = 9.58ε) +

+
+

+ Max = 211ε (Mean = 20.4ε) +

+
+

+ Legendre Polynomials: Large Values +

+
+

+ Max = 0.632ε (Mean = 0.0693ε)

+ (GSL 2.1: Max = 300ε (Mean = 33.2ε)) +

+
+

+ Max = 699ε (Mean = 59.6ε)

+ (<cmath>: Max = 343ε (Mean = 32.1ε)) +

+
+

+ Max = 699ε (Mean = 59.6ε) +

+
+

+ Max = 300ε (Mean = 33.2ε) +

+
+
+
+

Table 164. Error rates for legendre_p (associated)

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Associated Legendre Polynomials: Small Values +

+
+

+ Max = 0.999ε (Mean = 0.05ε)

+ (GSL 2.1: Max = 121ε (Mean = 6.75ε) And + other failures.) +

+
+

+ Max = 175ε (Mean = 9.88ε)

+ (<cmath>: Max = 175ε (Mean = 9.36ε) And + other failures.) +

+
+

+ Max = 77.7ε (Mean = 5.59ε) +

+
+

+ Max = 121ε (Mean = 7.14ε) +

+
+
+
+

Table 165. Error rates for legendre_q

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Legendre Polynomials: Small Values +

+
+

+ Max = 0.612ε (Mean = 0.0517ε)

+ (GSL 2.1: Max = 46.4ε (Mean = 7.46ε)) +

+
+

+ Max = 50.9ε (Mean = 9ε) +

+
+

+ Max = 50.9ε (Mean = 8.98ε) +

+
+

+ Max = 46.4ε (Mean = 7.32ε) +

+
+

+ Legendre Polynomials: Large Values +

+
+

+ Max = 2.49ε (Mean = 0.202ε)

+ (GSL 2.1: Max = 4.6e+03ε (Mean = 366ε)) +

+
+

+ Max = 5.98e+03ε (Mean = 478ε) +

+
+

+ Max = 5.98e+03ε (Mean = 478ε) +

+
+

+ Max = 4.6e+03ε (Mean = 366ε) +

+
+
+
+

Table 166. Error rates for lgamma

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ factorials +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 33.6ε (Mean = 2.78ε))
(Rmath 3.2.3: + Max = 1.55ε (Mean = 0.592ε)) +

+
+

+ Max = 0.991ε (Mean = 0.308ε)

+ (<cmath>: Max = 1.67ε (Mean = 0.487ε))
+ (<math.h>: Max = 1.67ε (Mean = 0.487ε)) +

+
+

+ Max = 0.991ε (Mean = 0.383ε)

+ (<math.h>: Max = 1.36ε (Mean = 0.476ε)) +

+
+

+ Max = 0.914ε (Mean = 0.175ε)

+ (<math.h>: Max = 0.958ε (Mean = 0.38ε)) +

+
+

+ near 0 +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 5.21ε (Mean = 1.57ε))
(Rmath 3.2.3: + Max = 0ε (Mean = 0ε)) +

+
+

+ Max = 1.42ε (Mean = 0.566ε)

+ (<cmath>: Max = 0.964ε (Mean = 0.543ε))
+ (<math.h>: Max = 0.964ε (Mean = 0.543ε)) +

+
+

+ Max = 1.42ε (Mean = 0.566ε)

+ (<math.h>: Max = 0.964ε (Mean = 0.543ε)) +

+
+

+ Max = 0.964ε (Mean = 0.462ε)

+ (<math.h>: Max = 0.962ε (Mean = 0.372ε)) +

+
+

+ near 1 +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 442ε (Mean = 88.8ε))
(Rmath 3.2.3: + Max = 7.99e+04ε (Mean = 1.68e+04ε)) +

+
+

+ Max = 0.948ε (Mean = 0.36ε)

+ (<cmath>: Max = 0.615ε (Mean = 0.096ε))
+ (<math.h>: Max = 0.615ε (Mean = 0.096ε)) +

+
+

+ Max = 0.948ε (Mean = 0.36ε)

+ (<math.h>: Max = 1.71ε (Mean = 0.581ε)) +

+
+

+ Max = 0.867ε (Mean = 0.468ε)

+ (<math.h>: Max = 0.906ε (Mean = 0.565ε)) +

+
+

+ near 2 +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 1.17e+03ε (Mean = 274ε))
(Rmath + 3.2.3: Max = 2.63e+05ε (Mean = 5.84e+04ε)) +

+
+

+ Max = 0.878ε (Mean = 0.242ε)

+ (<cmath>: Max = 0.741ε (Mean = 0.263ε))
+ (<math.h>: Max = 0.741ε (Mean = 0.263ε)) +

+
+

+ Max = 0.878ε (Mean = 0.242ε)

+ (<math.h>: Max = 0.598ε (Mean = 0.235ε)) +

+
+

+ Max = 0.591ε (Mean = 0.159ε)

+ (<math.h>: Max = 0.741ε (Mean = 0.473ε)) +

+
+

+ near -10 +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 24.9ε (Mean = 4.6ε))
(Rmath 3.2.3: + Max = 4.22ε (Mean = 1.26ε)) +

+
+

+ Max = 3.81ε (Mean = 1.01ε)

+ (<cmath>: Max = 0.997ε (Mean = 0.412ε))
+ (<math.h>: Max = 0.997ε (Mean = 0.412ε)) +

+
+

+ Max = 3.81ε (Mean = 1.01ε)

+ (<math.h>: Max = 3.04ε (Mean = 1.01ε)) +

+
+

+ Max = 4.22ε (Mean = 1.33ε)

+ (<math.h>: Max = 0.997ε (Mean = 0.444ε)) +

+
+

+ near -55 +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 7.02ε (Mean = 1.47ε))
(Rmath 3.2.3: + Max = 250ε (Mean = 60.9ε)) +

+
+

+ Max = 0.821ε (Mean = 0.513ε)

+ (<cmath>: Max = 1.58ε (Mean = 0.672ε))
+ (<math.h>: Max = 1.58ε (Mean = 0.672ε)) +

+
+

+ Max = 1.59ε (Mean = 0.587ε)

+ (<math.h>: Max = 0.821ε (Mean = 0.674ε)) +

+
+

+ Max = 0.821ε (Mean = 0.419ε)

+ (<math.h>: Max = 249ε (Mean = 43.1ε)) +

+
+
+
+

Table 167. Error rates for log1p

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ GNU C++ version 7.1.0
linux
double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Random test data +

+
+

+ Max = 0.818ε (Mean = 0.227ε)

+ (<cmath>: Max = 0.818ε (Mean = 0.227ε))
+ (<math.h>: Max = 0.818ε (Mean = 0.227ε)) +

+
+

+ Max = 0.846ε (Mean = 0.153ε)

+ (Rmath 3.2.3: Max = 0.846ε (Mean = 0.153ε)) +

+
+

+ Max = 2.3ε (Mean = 0.66ε)

+ (<math.h>: Max = 0.818ε (Mean = 0.249ε)) +

+
+

+ Max = 0.509ε (Mean = 0.057ε)

+ (<math.h>: Max = 0.509ε (Mean = 0.057ε)) +

+
+
+
+

Table 168. Error rates for non central beta CDF

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Non Central Beta, medium parameters +

+
+

+ Max = 0.998ε (Mean = 0.0649ε)

+ (Rmath 3.2.3: Max = 1.46e+26ε (Mean + = 3.5e+24ε) And + other failures.) +

+
+

+ Max = 824ε (Mean = 27.4ε) +

+
+

+ Max = 832ε (Mean = 38.1ε) +

+
+

+ Max = 242ε (Mean = 31ε) +

+
+

+ Non Central Beta, large parameters +

+
+

+ Max = 1.18ε (Mean = 0.175ε)

+ (Rmath 3.2.3: Max = 1.01e+36ε (Mean + = 1.19e+35ε) And + other failures.) +

+
+

+ Max = 2.5e+04ε (Mean = 3.78e+03ε) +

+
+

+ Max = 2.57e+04ε (Mean = 4.45e+03ε) +

+
+

+ Max = 3.66e+03ε (Mean = 500ε) +

+
+
+
+

Table 169. Error rates for non central beta CDF complement

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Non Central Beta, medium parameters +

+
+

+ Max = 0.998ε (Mean = 0.0936ε)

+ (Rmath 3.2.3: Max = 7.5e+97ε (Mean + = 1.37e+96ε) And + other failures.) +

+
+

+ Max = 396ε (Mean = 50.7ε) +

+
+

+ Max = 554ε (Mean = 57.2ε) +

+
+

+ Max = 624ε (Mean = 62.7ε) +

+
+

+ Non Central Beta, large parameters +

+
+

+ Max = 0.986ε (Mean = 0.188ε)

+ (Rmath 3.2.3: Max = +INFε (Mean + = +INFε) And + other failures.) +

+
+

+ Max = 6.83e+03ε (Mean = 993ε) +

+
+

+ Max = 3.56e+03ε (Mean = 707ε) +

+
+

+ Max = 1.25e+04ε (Mean = 1.49e+03ε) +

+
+
+
+

Table 170. Error rates for non central chi squared CDF

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Non Central Chi Squared, medium parameters +

+
+

+ Max = 0.99ε (Mean = 0.0544ε)

+ (Rmath 3.2.3: Max = 727ε (Mean = 121ε)) +

+
+

+ Max = 46.5ε (Mean = 10.3ε) +

+
+

+ Max = 115ε (Mean = 13.9ε) +

+
+

+ Max = 48.9ε (Mean = 10ε) +

+
+

+ Non Central Chi Squared, large parameters +

+
+

+ Max = 1.07ε (Mean = 0.102ε)

+ (Rmath 3.2.3: Max = 3.27e+08ε (Mean + = 2.23e+07ε)) +

+
+

+ Max = 3.07e+03ε (Mean = 336ε) +

+
+

+ Max = 6.17e+03ε (Mean = 677ε) +

+
+

+ Max = 9.79e+03ε (Mean = 723ε) +

+
+
+
+

Table 171. Error rates for non central chi squared CDF complement

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Non Central Chi Squared, medium parameters +

+
+

+ Max = 0.96ε (Mean = 0.0635ε)

+ (Rmath 3.2.3: Max = +INFε (Mean + = +INFε) And + other failures.) +

+
+

+ Max = 107ε (Mean = 17.2ε) +

+
+

+ Max = 171ε (Mean = 22.8ε) +

+
+

+ Max = 98.6ε (Mean = 15.8ε) +

+
+

+ Non Central Chi Squared, large parameters +

+
+

+ Max = 2.11ε (Mean = 0.278ε)

+ (Rmath 3.2.3: Max = +INFε (Mean + = +INFε) And + other failures.) +

+
+

+ Max = 5.02e+03ε (Mean = 630ε) +

+
+

+ Max = 5.1e+03ε (Mean = 577ε) +

+
+

+ Max = 5.43e+03ε (Mean = 705ε) +

+
+
+
+

Table 172. Error rates for non central t CDF

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Non Central T +

+
+

+ Max = 0.796ε (Mean = 0.0691ε)

+ (Rmath 3.2.3: Max = 5.28e+15ε (Mean + = 8.49e+14ε) And + other failures.) +

+
+

+ Max = 139ε (Mean = 31ε) +

+
+

+ Max = 145ε (Mean = 30.9ε) +

+
+

+ Max = 135ε (Mean = 32.1ε) +

+
+

+ Non Central T (small non-centrality) +

+
+

+ Max = 0ε (Mean = 0ε)

(Rmath + 3.2.3: Max = 2.09e+03ε (Mean = 244ε)) +

+
+

+ Max = 3.86ε (Mean = 1.4ε) +

+
+

+ Max = 9.15ε (Mean = 2.13ε) +

+
+

+ Max = 6.17ε (Mean = 1.45ε) +

+
+

+ Non Central T (large parameters) +

+
+

+ Max = 257ε (Mean = 72.1ε)

+ (Rmath 3.2.3: Max = 2.46ε (Mean = 0.657ε)) +

+
+

+ Max = 5.26e+05ε (Mean = 1.48e+05ε) +

+
+

+ Max = 5.24e+05ε (Mean = 1.47e+05ε) +

+
+

+ Max = 286ε (Mean = 62.8ε) +

+
+
+
+

Table 173. Error rates for non central t CDF complement

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Non Central T +

+
+

+ Max = 0.707ε (Mean = 0.0497ε)

+ (Rmath 3.2.3: Max = 6.19e+15ε (Mean + = 6.72e+14ε) And + other failures.) +

+
+

+ Max = 201ε (Mean = 31.7ε) +

+
+

+ Max = 340ε (Mean = 43.2ε) +

+
+

+ Max = 154ε (Mean = 32.1ε) +

+
+

+ Non Central T (small non-centrality) +

+
+

+ Max = 0ε (Mean = 0ε)

(Rmath + 3.2.3: Max = 1.87e+03ε (Mean = 263ε)) +

+
+

+ Max = 10.5ε (Mean = 2.13ε) +

+
+

+ Max = 10.5ε (Mean = 2.39ε) +

+
+

+ Max = 4.6ε (Mean = 1.63ε) +

+
+

+ Non Central T (large parameters) +

+
+

+ Max = 478ε (Mean = 96.3ε)

+ (Rmath 3.2.3: Max = 2.24ε (Mean = 0.945ε)) +

+
+

+ Max = 9.79e+05ε (Mean = 1.97e+05ε) +

+
+

+ Max = 9.79e+05ε (Mean = 1.97e+05ε) +

+
+

+ Max = 227ε (Mean = 50.4ε) +

+
+
+
+

Table 174. Error rates for owens_t

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Owens T (medium small values) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 3.34ε (Mean = 0.944ε) +

+
+

+ Max = 3.34ε (Mean = 0.911ε) +

+
+

+ Max = 4.37ε (Mean = 0.98ε) +

+
+

+ Owens T (large and diverse values) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 49ε (Mean = 2.16ε) +

+
+

+ Max = 24.5ε (Mean = 1.39ε) +

+
+

+ Max = 3.78ε (Mean = 0.621ε) +

+
+
+
+

Table 175. Error rates for polygamma

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Mathematica Data +

+
+

+ Max = 0.824ε (Mean = 0.0574ε)

+ (GSL 2.1: Max = 62.9ε (Mean = 12.8ε))
(Rmath + 3.2.3: Max = 108ε (Mean = 15.2ε)) +

+
+

+ Max = 7.38ε (Mean = 1.84ε) +

+
+

+ Max = 34.3ε (Mean = 7.65ε) +

+
+

+ Max = 9.32ε (Mean = 1.95ε) +

+
+

+ Mathematica Data - large arguments +

+
+

+ Max = 0.998ε (Mean = 0.0592ε)

+ (GSL 2.1: Max = 244ε (Mean = 32.8ε) And + other failures.)
(Rmath 3.2.3: + Max = 1.71e+56ε (Mean = 1.01e+55ε) And + other failures.) +

+
+

+ Max = 2.23ε (Mean = 0.323ε) +

+
+

+ Max = 11.1ε (Mean = 0.848ε) +

+
+

+ Max = 150ε (Mean = 13.9ε) +

+
+

+ Mathematica Data - negative arguments +

+
+

+ Max = 0.516ε (Mean = 0.022ε)

+ (GSL 2.1: Max = 36.6ε (Mean = 3.04ε) And + other failures.)
(Rmath 3.2.3: + Max = 0ε (Mean = 0ε) And + other failures.) +

+
+

+ Max = 269ε (Mean = 87.7ε) +

+
+

+ Max = 269ε (Mean = 88.4ε) +

+
+

+ Max = 497ε (Mean = 129ε) +

+
+

+ Mathematica Data - large negative arguments +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 1.79ε (Mean = 0.197ε) And + other failures.)
(Rmath 3.2.3: + Max = 0ε (Mean = 0ε) And + other failures.) +

+
+

+ Max = 155ε (Mean = 96.4ε) +

+
+

+ Max = 155ε (Mean = 96.4ε) +

+
+

+ Max = 162ε (Mean = 101ε) +

+
+

+ Mathematica Data - small arguments +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 15.2ε (Mean = 5.03ε))
(Rmath 3.2.3: + Max = 106ε (Mean = 20ε)) +

+
+

+ Max = 3.33ε (Mean = 0.75ε) +

+
+

+ Max = 3.33ε (Mean = 0.75ε) +

+
+

+ Max = 3ε (Mean = 0.496ε) +

+
+

+ Mathematica Data - Large orders and other bug cases +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 151ε (Mean = 39.3ε) And + other failures.)
(Rmath 3.2.3: + Max = +INFε (Mean = +INFε) And + other failures.) +

+
+

+ Max = 54.5ε (Mean = 13.3ε) +

+
+

+ Max = 145ε (Mean = 55.9ε) +

+
+

+ Max = 200ε (Mean = 57.2ε) +

+
+
+
+

Table 176. Error rates for powm1

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ powm1 +

+
+

+ Max = 1.06ε (Mean = 0.425ε) +

+
+

+ Max = 2.04ε (Mean = 0.493ε) +

+
+

+ Max = 1.88ε (Mean = 0.49ε) +

+
+

+ Max = 1.84ε (Mean = 0.486ε) +

+
+
+
+

Table 177. Error rates for sin_pi

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ sin_pi and cos_pi +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 0.996ε (Mean = 0.335ε) +

+
+

+ Max = 0.996ε (Mean = 0.336ε) +

+
+

+ Max = 0.99ε (Mean = 0.328ε) +

+
+

+ sin_pi and cos_pi near integers and half integers +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 0.976ε (Mean = 0.293ε) +

+
+

+ Max = 0.976ε (Mean = 0.293ε) +

+
+

+ Max = 0.996ε (Mean = 0.343ε) +

+
+
+
+

Table 178. Error rates for sph_bessel

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ GNU C++ version 7.1.0
linux
double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Bessel j: Random Data +

+
+

+ Max = 243ε (Mean = 13.3ε)

+ (<cmath>: Max = 1.91e+06ε (Mean = 1.09e+05ε)) +

+
+

+ Max = 0.978ε (Mean = 0.0445ε)

+ (GSL 2.1: Max = 1.79e+03ε (Mean = 107ε)) +

+
+

+ Max = 243ε (Mean = 33.7ε) +

+
+

+ Max = 245ε (Mean = 16.3ε) +

+
+
+
+

Table 179. Error rates for sph_bessel_prime

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Bessel j': Random Data +

+
+

+ Max = 0.753ε (Mean = 0.0343ε) +

+
+

+ Max = 167ε (Mean = 12ε) +

+
+

+ Max = 167ε (Mean = 33.2ε) +

+
+

+ Max = 307ε (Mean = 25.2ε) +

+
+
+
+

Table 180. Error rates for sph_neumann

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ GNU C++ version 7.1.0
linux
double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ y: Random Data +

+
+

+ Max = 234ε (Mean = 19.5ε)

+ (<cmath>: Max = 1.6e+06ε (Mean = 1.4e+05ε)) +

+
+

+ Max = 0.995ε (Mean = 0.0665ε)

+ (GSL 2.1: Max = 8.5e+04ε (Mean = 5.33e+03ε)) +

+
+

+ Max = 234ε (Mean = 19.8ε) +

+
+

+ Max = 281ε (Mean = 31.1ε) +

+
+
+
+

Table 181. Error rates for sph_neumann_prime

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ y': Random Data +

+
+

+ Max = 0.988ε (Mean = 0.0869ε) +

+
+

+ Max = 158ε (Mean = 18.8ε) +

+
+

+ Max = 158ε (Mean = 20.2ε) +

+
+

+ Max = 296ε (Mean = 25.6ε) +

+
+
+
+

Table 182. Error rates for spherical_harmonic_i

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Spherical Harmonics +

+
+

+ Max = 1.36ε (Mean = 0.0765ε) +

+
+

+ Max = 2.89e+03ε (Mean = 108ε) +

+
+

+ Max = 1.03e+04ε (Mean = 327ε) +

+
+

+ Max = 2.27e+04ε (Mean = 725ε) +

+
+
+
+

Table 183. Error rates for spherical_harmonic_r

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Spherical Harmonics +

+
+

+ Max = 1.58ε (Mean = 0.0707ε) +

+
+

+ Max = 2.89e+03ε (Mean = 108ε) +

+
+

+ Max = 1.03e+04ε (Mean = 327ε) +

+
+

+ Max = 2.27e+04ε (Mean = 725ε) +

+
+
+
+

Table 184. Error rates for sqrt1pm1

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ sqrt1pm1 +

+
+

+ Max = 1.3ε (Mean = 0.404ε) +

+
+

+ Max = 1.33ε (Mean = 0.404ε) +

+
+

+ Max = 1.54ε (Mean = 0.563ε) +

+
+

+ Max = 1.35ε (Mean = 0.497ε) +

+
+
+
+

Table 185. Error rates for tgamma

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ factorials +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 3.95ε (Mean = 0.783ε))
(Rmath + 3.2.3: Max = 314ε (Mean = 93.4ε)) +

+
+

+ Max = 2.67ε (Mean = 0.617ε)

+ (<cmath>: Max = 1.66ε (Mean = 0.584ε))
+ (<math.h>: Max = 1.66ε (Mean = 0.584ε)) +

+
+

+ Max = 172ε (Mean = 41ε)

(<math.h>: + Max = 0ε (Mean = 0ε)) +

+
+

+ Max = 1.85ε (Mean = 0.566ε)

+ (<math.h>: Max = 3.17ε (Mean = 0.928ε)) +

+
+

+ near 0 +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 4.51ε (Mean = 1.92ε))
(Rmath 3.2.3: + Max = 1ε (Mean = 0.335ε)) +

+
+

+ Max = 2ε (Mean = 0.608ε)

(<cmath>: + Max = 1ε (Mean = 0.376ε))
(<math.h>: + Max = 1ε (Mean = 0.376ε)) +

+
+

+ Max = 2ε (Mean = 0.647ε)

(<math.h>: + Max = 0.5ε (Mean = 0.0791ε)) +

+
+

+ Max = 1.5ε (Mean = 0.635ε)

+ (<math.h>: Max = 1ε (Mean = 0.405ε)) +

+
+

+ near 1 +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 4.41ε (Mean = 1.81ε))
(Rmath 3.2.3: + Max = 1ε (Mean = 0.32ε)) +

+
+

+ Max = 2.51ε (Mean = 1.02ε)

+ (<cmath>: Max = 0.918ε (Mean = 0.203ε))
+ (<math.h>: Max = 0.918ε (Mean = 0.203ε)) +

+
+

+ Max = 3.01ε (Mean = 1.06ε)

+ (<math.h>: Max = 1ε (Mean = 0.175ε)) +

+
+

+ Max = 1.1ε (Mean = 0.59ε)

+ (<math.h>: Max = 1ε (Mean = 0.4ε)) +

+
+

+ near 2 +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 7.95ε (Mean = 3.12ε))
(Rmath 3.2.3: + Max = 1ε (Mean = 0.191ε)) +

+
+

+ Max = 4.1ε (Mean = 1.55ε)

+ (<cmath>: Max = 0.558ε (Mean = 0.298ε))
+ (<math.h>: Max = 0.558ε (Mean = 0.298ε)) +

+
+

+ Max = 5.01ε (Mean = 1.89ε)

+ (<math.h>: Max = 0ε (Mean = 0ε)) +

+
+

+ Max = 2ε (Mean = 0.733ε)

(<math.h>: + Max = 0ε (Mean = 0ε)) +

+
+

+ near -10 +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 2.6ε (Mean = 1.05ε))
(Rmath 3.2.3: + Max = 34.9ε (Mean = 9.2ε)) +

+
+

+ Max = 1.75ε (Mean = 0.895ε)

+ (<cmath>: Max = 2.26ε (Mean = 1.08ε))
+ (<math.h>: Max = 2.26ε (Mean = 1.08ε)) +

+
+

+ Max = 1.75ε (Mean = 0.819ε)

+ (<math.h>: Max = 0ε (Mean = 0ε)) +

+
+

+ Max = 1.86ε (Mean = 0.881ε)

+ (<math.h>: Max = 0.866ε (Mean = 0.445ε)) +

+
+

+ near -55 +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 1.8ε (Mean = 0.782ε))
(Rmath 3.2.3: + Max = 3.89e+04ε (Mean = 9.52e+03ε)) +

+
+

+ Max = 2.69ε (Mean = 1.09ε)

+ (<cmath>: Max = 1.79ε (Mean = 0.75ε))
+ (<math.h>: Max = 1.79ε (Mean = 0.75ε)) +

+
+

+ Max = 98.5ε (Mean = 53.4ε)

+ (<math.h>: Max = 0ε (Mean = 0ε)) +

+
+

+ Max = 2.7ε (Mean = 1.35ε)

+ (<math.h>: Max = 3.87e+04ε (Mean = 6.71e+03ε)) +

+
+
+
+

Table 186. Error rates for tgamma1pm1

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ tgamma1pm1(dz) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 1.12ε (Mean = 0.49ε) +

+
+

+ Max = 6.61ε (Mean = 0.84ε) +

+
+

+ Max = 3.31ε (Mean = 0.517ε) +

+
+
+
+

Table 187. Error rates for tgamma_delta_ratio

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ tgamma + small delta ratios +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 5.83ε (Mean = 1.3ε) +

+
+

+ Max = 15.4ε (Mean = 2.09ε) +

+
+

+ Max = 7.56ε (Mean = 1.31ε) +

+
+

+ tgamma + small delta ratios (negative delta) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 7.94ε (Mean = 1.4ε) +

+
+

+ Max = 18.3ε (Mean = 2.03ε) +

+
+

+ Max = 7.43ε (Mean = 1.42ε) +

+
+

+ tgamma + small integer ratios +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 1.96ε (Mean = 0.677ε) +

+
+

+ Max = 1.96ε (Mean = 0.677ε) +

+
+

+ Max = 2.74ε (Mean = 0.736ε) +

+
+

+ tgamma + small integer ratios (negative delta) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 1.62ε (Mean = 0.451ε) +

+
+

+ Max = 1.62ε (Mean = 0.451ε) +

+
+

+ Max = 2.15ε (Mean = 0.685ε) +

+
+

+ integer tgamma ratios +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 0.997ε (Mean = 0.4ε) +

+
+

+ Max = 0.997ε (Mean = 0.4ε) +

+
+

+ Max = 0.968ε (Mean = 0.386ε) +

+
+

+ integer tgamma ratios (negative delta) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 0.853ε (Mean = 0.176ε) +

+
+

+ Max = 0.853ε (Mean = 0.176ε) +

+
+

+ Max = 0.974ε (Mean = 0.175ε) +

+
+
+
+

Table 188. Error rates for tgamma (incomplete)

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ tgamma(a, z) medium values +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 200ε (Mean = 13.3ε)) +

+
+

+ Max = 8.47ε (Mean = 1.9ε) +

+
+

+ Max = 412ε (Mean = 95.5ε) +

+
+

+ Max = 8.14ε (Mean = 1.76ε) +

+
+

+ tgamma(a, z) small values +

+
+

+ Max = 0.753ε (Mean = 0.0474ε)

+ (GSL 2.1: Max = 1.38e+10ε (Mean + = 1.05e+09ε)) +

+
+

+ Max = 2.31ε (Mean = 0.775ε) +

+
+

+ Max = 2.13ε (Mean = 0.717ε) +

+
+

+ Max = 2.53ε (Mean = 0.66ε) +

+
+

+ tgamma(a, z) integer and half integer values +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 117ε (Mean = 12.5ε)) +

+
+

+ Max = 5.52ε (Mean = 1.48ε) +

+
+

+ Max = 79.6ε (Mean = 20.9ε) +

+
+

+ Max = 5.16ε (Mean = 1.33ε) +

+
+
+
+

Table 189. Error rates for tgamma_lower

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ tgamma(a, z) medium values +

+
+

+ Max = 0.833ε (Mean = 0.0315ε)

+ (GSL 2.1: Max = 0.833ε (Mean = 0.0315ε)) +

+
+

+ Max = 6.79ε (Mean = 1.46ε) +

+
+

+ Max = 363ε (Mean = 63.8ε) +

+
+

+ Max = 5.62ε (Mean = 1.49ε) +

+
+

+ tgamma(a, z) small values +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 0ε (Mean = 0ε)) +

+
+

+ Max = 1.97ε (Mean = 0.555ε) +

+
+

+ Max = 1.97ε (Mean = 0.558ε) +

+
+

+ Max = 1.57ε (Mean = 0.525ε) +

+
+

+ tgamma(a, z) integer and half integer values +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 0ε (Mean = 0ε)) +

+
+

+ Max = 4.83ε (Mean = 1.15ε) +

+
+

+ Max = 84.7ε (Mean = 17.5ε) +

+
+

+ Max = 2.69ε (Mean = 0.849ε) +

+
+
+
+

Table 190. Error rates for tgamma_ratio

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ tgamma ratios +

+
+

+ Max = 0.694ε (Mean = 0.0347ε) +

+
+

+ Max = 2.99ε (Mean = 1.15ε) +

+
+

+ Max = 174ε (Mean = 61.2ε) +

+
+

+ Max = 3.28ε (Mean = 1.12ε) +

+
+
+
+

Table 191. Error rates for trigamma

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
double +

+
+

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Mathematica Data +

+
+

+ Max = 0.998ε (Mean = 0.105ε)

+ (GSL 2.1: Max = 1.34e+04ε (Mean = 1.49e+03ε))
+ (Rmath 3.2.3: Max = 1.34e+04ε (Mean = 1.51e+03ε)) +

+
+

+ Max = 1.28ε (Mean = 0.449ε) +

+
+

+ Max = 1.28ε (Mean = 0.449ε) +

+
+

+ Max = 1ε (Mean = 0.382ε) +

+
+
+
+

Table 192. Error rates for zeta

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ GNU C++ version 7.1.0
linux
long double +

+
+

+ GNU C++ version 7.1.0
linux
double +

+
+

+ Sun compiler version 0x5150
Sun Solaris
long double +

+
+

+ Microsoft Visual C++ version 14.1
Win32
double +

+
+

+ Zeta: Random values greater than 1 +

+
+

+ Max = 0.846ε (Mean = 0.0833ε)

+ (<cmath>: Max = 5.45ε (Mean = 1ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 8.69ε (Mean = 1.03ε)) +

+
+

+ Max = 0.846ε (Mean = 0.0833ε) +

+
+

+ Max = 0.836ε (Mean = 0.093ε) +

+
+

+ Zeta: Random values less than 1 +

+
+

+ Max = 7.03ε (Mean = 2.93ε)

+ (<cmath>: Max = 538ε (Mean = 59.3ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 137ε (Mean = 13.8ε)) +

+
+

+ Max = 70.1ε (Mean = 17.1ε) +

+
+

+ Max = 6.84ε (Mean = 3.12ε) +

+
+

+ Zeta: Values close to and greater than 1 +

+
+

+ Max = 0.995ε (Mean = 0.5ε)

+ (<cmath>: Max = 1.9e+06ε (Mean = 5.11e+05ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 7.73ε (Mean = 4.07ε)) +

+
+

+ Max = 0.995ε (Mean = 0.5ε) +

+
+

+ Max = 0.994ε (Mean = 0.421ε) +

+
+

+ Zeta: Values close to and less than 1 +

+
+

+ Max = 0.998ε (Mean = 0.508ε)

+ (<cmath>: Max = 8.53e+06ε (Mean = 1.87e+06ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 0.991ε (Mean = 0.28ε)) +

+
+

+ Max = 0.998ε (Mean = 0.508ε) +

+
+

+ Max = 0.991ε (Mean = 0.375ε) +

+
+

+ Zeta: Integer arguments +

+
+

+ Max = 9ε (Mean = 3.06ε)

(<cmath>: + Max = 70.3ε (Mean = 17.4ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(GSL + 2.1: Max = 3.75ε (Mean = 1.1ε)) +

+
+

+ Max = 28ε (Mean = 5.62ε) +

+
+

+ Max = 9ε (Mean = 3ε) +

+
+
+
+
+
+ + + +

Last revised: March 09, 2018 at 13:43:44 GMT

+
+
+ + diff --git a/src/boost/libs/math/reporting/accuracy/test_bessel_i.cpp b/src/boost/libs/math/reporting/accuracy/test_bessel_i.cpp new file mode 100644 index 00000000..877dc977 --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/test_bessel_i.cpp @@ -0,0 +1,63 @@ +// Copyright John Maddock 2006-15. +// Copyright Paul A. Bristow 2007 +// 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 "bindings.hpp" +#include "../../test/test_bessel_i.hpp" +#include + +BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(test_main, 10000); + +BOOST_AUTO_TEST_CASE(test_main) +{ + BOOST_MATH_CONTROL_FP; + + error_stream_replacer rep; + +#ifdef TYPE_TO_TEST + + test_bessel(static_cast(0), NAME_OF_TYPE_TO_TEST); + +#else + bool test_float = false; + bool test_double = false; + bool test_long_double = false; + + if(std::numeric_limits::digits == std::numeric_limits::digits) + { + // + // Don't bother with long double, it's the same as double: + // + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + test_double = true; + } + else + { + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + if(BOOST_MATH_PROMOTE_DOUBLE_POLICY == false) + test_double = true; + test_long_double = true; + } + +#ifdef ALWAYS_TEST_DOUBLE + test_double = true; +#endif + + if(test_float) + test_bessel(0.0f, "float"); + if(test_double) + test_bessel(0.0, "double"); + if(test_long_double) + test_bessel(0.0L, "long double"); +#ifdef BOOST_MATH_USE_FLOAT128 + //test_bessel(0.0Q, "__float128"); +#endif + + +#endif +} + diff --git a/src/boost/libs/math/reporting/accuracy/test_bessel_i_prime.cpp b/src/boost/libs/math/reporting/accuracy/test_bessel_i_prime.cpp new file mode 100644 index 00000000..70a454d4 --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/test_bessel_i_prime.cpp @@ -0,0 +1,64 @@ +// Copyright John Maddock 2006-15. +// Copyright Paul A. Bristow 2007 +// 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) + +#define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error +#include "bindings.hpp" +#include "../../test/test_bessel_i_prime.hpp" +#include + +BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(test_main, 10000); + +BOOST_AUTO_TEST_CASE(test_main) +{ + BOOST_MATH_CONTROL_FP; + + error_stream_replacer rep; + +#ifdef TYPE_TO_TEST + + test_bessel(static_cast(0), NAME_OF_TYPE_TO_TEST); + +#else + bool test_float = false; + bool test_double = false; + bool test_long_double = false; + + if(std::numeric_limits::digits == std::numeric_limits::digits) + { + // + // Don't bother with long double, it's the same as double: + // + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + test_double = true; + } + else + { + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + if(BOOST_MATH_PROMOTE_DOUBLE_POLICY == false) + test_double = true; + test_long_double = true; + } + +#ifdef ALWAYS_TEST_DOUBLE + test_double = true; +#endif + + if(test_float) + test_bessel(0.0f, "float"); + if(test_double) + test_bessel(0.0, "double"); + if(test_long_double) + test_bessel(0.0L, "long double"); +#ifdef BOOST_MATH_USE_FLOAT128 + //test_bessel(0.0Q, "__float128"); +#endif + + +#endif +} + diff --git a/src/boost/libs/math/reporting/accuracy/test_bessel_j.cpp b/src/boost/libs/math/reporting/accuracy/test_bessel_j.cpp new file mode 100644 index 00000000..dd4cef2b --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/test_bessel_j.cpp @@ -0,0 +1,63 @@ +// Copyright John Maddock 2006-15. +// Copyright Paul A. Bristow 2007 +// 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 "bindings.hpp" +#include "../../test/test_bessel_j.hpp" +#include + +BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(test_main, 10000); + +BOOST_AUTO_TEST_CASE(test_main) +{ + BOOST_MATH_CONTROL_FP; + + error_stream_replacer rep; + +#ifdef TYPE_TO_TEST + + test_bessel(static_cast(0), NAME_OF_TYPE_TO_TEST); + +#else + bool test_float = false; + bool test_double = false; + bool test_long_double = false; + + if(std::numeric_limits::digits == std::numeric_limits::digits) + { + // + // Don't bother with long double, it's the same as double: + // + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + test_double = true; + } + else + { + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + if(BOOST_MATH_PROMOTE_DOUBLE_POLICY == false) + test_double = true; + test_long_double = true; + } + +#ifdef ALWAYS_TEST_DOUBLE + test_double = true; +#endif + + if(test_float) + test_bessel(0.0f, "float"); + if(test_double) + test_bessel(0.0, "double"); + if(test_long_double) + test_bessel(0.0L, "long double"); +#ifdef BOOST_MATH_USE_FLOAT128 + //test_bessel(0.0Q, "__float128"); +#endif + + +#endif +} + diff --git a/src/boost/libs/math/reporting/accuracy/test_bessel_j_prime.cpp b/src/boost/libs/math/reporting/accuracy/test_bessel_j_prime.cpp new file mode 100644 index 00000000..b39020cb --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/test_bessel_j_prime.cpp @@ -0,0 +1,64 @@ +// Copyright John Maddock 2006-15. +// Copyright Paul A. Bristow 2007 +// 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) + +#define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error +#include "bindings.hpp" +#include "../../test/test_bessel_j_prime.hpp" +#include + +BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(test_main, 10000); + +BOOST_AUTO_TEST_CASE(test_main) +{ + BOOST_MATH_CONTROL_FP; + + error_stream_replacer rep; + +#ifdef TYPE_TO_TEST + + test_bessel_prime(static_cast(0), NAME_OF_TYPE_TO_TEST); + +#else + bool test_float = false; + bool test_double = false; + bool test_long_double = false; + + if(std::numeric_limits::digits == std::numeric_limits::digits) + { + // + // Don't bother with long double, it's the same as double: + // + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + test_double = true; + } + else + { + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + if(BOOST_MATH_PROMOTE_DOUBLE_POLICY == false) + test_double = true; + test_long_double = true; + } + +#ifdef ALWAYS_TEST_DOUBLE + test_double = true; +#endif + + if(test_float) + test_bessel_prime(0.0f, "float"); + if(test_double) + test_bessel_prime(0.0, "double"); + if(test_long_double) + test_bessel_prime(0.0L, "long double"); +#ifdef BOOST_MATH_USE_FLOAT128 + //test_bessel_prime(0.0Q, "__float128"); +#endif + + +#endif +} + diff --git a/src/boost/libs/math/reporting/accuracy/test_bessel_k.cpp b/src/boost/libs/math/reporting/accuracy/test_bessel_k.cpp new file mode 100644 index 00000000..010555d6 --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/test_bessel_k.cpp @@ -0,0 +1,63 @@ +// Copyright John Maddock 2006-15. +// Copyright Paul A. Bristow 2007 +// 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 "bindings.hpp" +#include "../../test/test_bessel_k.hpp" +#include + +BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(test_main, 10000); + +BOOST_AUTO_TEST_CASE(test_main) +{ + BOOST_MATH_CONTROL_FP; + + error_stream_replacer rep; + +#ifdef TYPE_TO_TEST + + test_bessel(static_cast(0), NAME_OF_TYPE_TO_TEST); + +#else + bool test_float = false; + bool test_double = false; + bool test_long_double = false; + + if(std::numeric_limits::digits == std::numeric_limits::digits) + { + // + // Don't bother with long double, it's the same as double: + // + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + test_double = true; + } + else + { + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + if(BOOST_MATH_PROMOTE_DOUBLE_POLICY == false) + test_double = true; + test_long_double = true; + } + +#ifdef ALWAYS_TEST_DOUBLE + test_double = true; +#endif + + if(test_float) + test_bessel(0.0f, "float"); + if(test_double) + test_bessel(0.0, "double"); + if(test_long_double) + test_bessel(0.0L, "long double"); +#ifdef BOOST_MATH_USE_FLOAT128 + //test_bessel(0.0Q, "__float128"); +#endif + + +#endif +} + diff --git a/src/boost/libs/math/reporting/accuracy/test_bessel_k_prime.cpp b/src/boost/libs/math/reporting/accuracy/test_bessel_k_prime.cpp new file mode 100644 index 00000000..7678b56a --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/test_bessel_k_prime.cpp @@ -0,0 +1,64 @@ +// Copyright John Maddock 2006-15. +// Copyright Paul A. Bristow 2007 +// 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) + +#define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error +#include "bindings.hpp" +#include "../../test/test_bessel_k_prime.hpp" +#include + +BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(test_main, 10000); + +BOOST_AUTO_TEST_CASE(test_main) +{ + BOOST_MATH_CONTROL_FP; + + error_stream_replacer rep; + +#ifdef TYPE_TO_TEST + + test_bessel(static_cast(0), NAME_OF_TYPE_TO_TEST); + +#else + bool test_float = false; + bool test_double = false; + bool test_long_double = false; + + if(std::numeric_limits::digits == std::numeric_limits::digits) + { + // + // Don't bother with long double, it's the same as double: + // + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + test_double = true; + } + else + { + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + if(BOOST_MATH_PROMOTE_DOUBLE_POLICY == false) + test_double = true; + test_long_double = true; + } + +#ifdef ALWAYS_TEST_DOUBLE + test_double = true; +#endif + + if(test_float) + test_bessel(0.0f, "float"); + if(test_double) + test_bessel(0.0, "double"); + if(test_long_double) + test_bessel(0.0L, "long double"); +#ifdef BOOST_MATH_USE_FLOAT128 + //test_bessel(0.0Q, "__float128"); +#endif + + +#endif +} + diff --git a/src/boost/libs/math/reporting/accuracy/test_bessel_y.cpp b/src/boost/libs/math/reporting/accuracy/test_bessel_y.cpp new file mode 100644 index 00000000..684a1bb5 --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/test_bessel_y.cpp @@ -0,0 +1,63 @@ +// Copyright John Maddock 2006-15. +// Copyright Paul A. Bristow 2007 +// 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 "bindings.hpp" +#include "../../test/test_bessel_y.hpp" +#include + +BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(test_main, 10000); + +BOOST_AUTO_TEST_CASE(test_main) +{ + BOOST_MATH_CONTROL_FP; + + error_stream_replacer rep; + +#ifdef TYPE_TO_TEST + + test_bessel(static_cast(0), NAME_OF_TYPE_TO_TEST); + +#else + bool test_float = false; + bool test_double = false; + bool test_long_double = false; + + if(std::numeric_limits::digits == std::numeric_limits::digits) + { + // + // Don't bother with long double, it's the same as double: + // + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + test_double = true; + } + else + { + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + if(BOOST_MATH_PROMOTE_DOUBLE_POLICY == false) + test_double = true; + test_long_double = true; + } + +#ifdef ALWAYS_TEST_DOUBLE + test_double = true; +#endif + + if(test_float) + test_bessel(0.0f, "float"); + if(test_double) + test_bessel(0.0, "double"); + if(test_long_double) + test_bessel(0.0L, "long double"); +#ifdef BOOST_MATH_USE_FLOAT128 + //test_bessel(0.0Q, "__float128"); +#endif + + +#endif +} + diff --git a/src/boost/libs/math/reporting/accuracy/test_bessel_y_prime.cpp b/src/boost/libs/math/reporting/accuracy/test_bessel_y_prime.cpp new file mode 100644 index 00000000..eff8b8bf --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/test_bessel_y_prime.cpp @@ -0,0 +1,64 @@ +// Copyright John Maddock 2006-15. +// Copyright Paul A. Bristow 2007 +// 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) + +#define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error +#include "bindings.hpp" +#include "../../test/test_bessel_y_prime.hpp" +#include + +BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(test_main, 10000); + +BOOST_AUTO_TEST_CASE(test_main) +{ + BOOST_MATH_CONTROL_FP; + + error_stream_replacer rep; + +#ifdef TYPE_TO_TEST + + test_bessel_prime(static_cast(0), NAME_OF_TYPE_TO_TEST); + +#else + bool test_float = false; + bool test_double = false; + bool test_long_double = false; + + if(std::numeric_limits::digits == std::numeric_limits::digits) + { + // + // Don't bother with long double, it's the same as double: + // + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + test_double = true; + } + else + { + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + if(BOOST_MATH_PROMOTE_DOUBLE_POLICY == false) + test_double = true; + test_long_double = true; + } + +#ifdef ALWAYS_TEST_DOUBLE + test_double = true; +#endif + + if(test_float) + test_bessel_prime(0.0f, "float"); + if(test_double) + test_bessel_prime(0.0, "double"); + if(test_long_double) + test_bessel_prime(0.0L, "long double"); +#ifdef BOOST_MATH_USE_FLOAT128 + //test_bessel_prime(0.0Q, "__float128"); +#endif + + +#endif +} + diff --git a/src/boost/libs/math/reporting/accuracy/test_beta.cpp b/src/boost/libs/math/reporting/accuracy/test_beta.cpp new file mode 100644 index 00000000..7c9dbb1a --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/test_beta.cpp @@ -0,0 +1,63 @@ +// Copyright John Maddock 2006-15. +// Copyright Paul A. Bristow 2007 +// 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 "bindings.hpp" +#include "../../test/test_beta.hpp" +#include + +BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(test_main, 10000); + +BOOST_AUTO_TEST_CASE(test_main) +{ + BOOST_MATH_CONTROL_FP; + + error_stream_replacer rep; + +#ifdef TYPE_TO_TEST + + test_beta(static_cast(0), NAME_OF_TYPE_TO_TEST); + +#else + bool test_float = false; + bool test_double = false; + bool test_long_double = false; + + if(std::numeric_limits::digits == std::numeric_limits::digits) + { + // + // Don't bother with long double, it's the same as double: + // + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + test_double = true; + } + else + { + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + if(BOOST_MATH_PROMOTE_DOUBLE_POLICY == false) + test_double = true; + test_long_double = true; + } + +#ifdef ALWAYS_TEST_DOUBLE + test_double = true; +#endif + + if(test_float) + test_beta(0.0f, "float"); + if(test_double) + test_beta(0.0, "double"); + if(test_long_double) + test_beta(0.0L, "long double"); +#ifdef BOOST_MATH_USE_FLOAT128 + //test_beta(0.0Q, "__float128"); +#endif + + +#endif +} + diff --git a/src/boost/libs/math/reporting/accuracy/test_binomial_coeff.cpp b/src/boost/libs/math/reporting/accuracy/test_binomial_coeff.cpp new file mode 100644 index 00000000..cd79e9c8 --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/test_binomial_coeff.cpp @@ -0,0 +1,63 @@ +// Copyright John Maddock 2006-15. +// Copyright Paul A. Bristow 2007 +// 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 "bindings.hpp" +#include "../../test/test_binomial_coeff.hpp" +#include + +BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(test_main, 10000); + +BOOST_AUTO_TEST_CASE(test_main) +{ + BOOST_MATH_CONTROL_FP; + + error_stream_replacer rep; + +#ifdef TYPE_TO_TEST + + test_binomial(static_cast(0), NAME_OF_TYPE_TO_TEST); + +#else + bool test_float = false; + bool test_double = false; + bool test_long_double = false; + + if(std::numeric_limits::digits == std::numeric_limits::digits) + { + // + // Don't bother with long double, it's the same as double: + // + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + test_double = true; + } + else + { + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + if(BOOST_MATH_PROMOTE_DOUBLE_POLICY == false) + test_double = true; + test_long_double = true; + } + +#ifdef ALWAYS_TEST_DOUBLE + test_double = true; +#endif + + if(test_float) + test_binomial(0.0f, "float"); + if(test_double) + test_binomial(0.0, "double"); + if(test_long_double) + test_binomial(0.0L, "long double"); +#ifdef BOOST_MATH_USE_FLOAT128 + //test_binomial(0.0Q, "__float128"); +#endif + + +#endif +} + diff --git a/src/boost/libs/math/reporting/accuracy/test_carlson.cpp b/src/boost/libs/math/reporting/accuracy/test_carlson.cpp new file mode 100644 index 00000000..3a23a6fc --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/test_carlson.cpp @@ -0,0 +1,67 @@ +// Copyright John Maddock 2006-15. +// Copyright Paul A. Bristow 2007 +// 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 "bindings.hpp" +#include "../../test/test_carlson.hpp" +#include +#include +#include +#include +#include + +BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(test_main, 10000); + +BOOST_AUTO_TEST_CASE(test_main) +{ + BOOST_MATH_CONTROL_FP; + + error_stream_replacer rep; + +#ifdef TYPE_TO_TEST + + test_spots(static_cast(0), NAME_OF_TYPE_TO_TEST); + +#else + bool test_float = false; + bool test_double = false; + bool test_long_double = false; + + if(std::numeric_limits::digits == std::numeric_limits::digits) + { + // + // Don't bother with long double, it's the same as double: + // + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + test_double = true; + } + else + { + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + if(BOOST_MATH_PROMOTE_DOUBLE_POLICY == false) + test_double = true; + test_long_double = true; + } + +#ifdef ALWAYS_TEST_DOUBLE + test_double = true; +#endif + + if(test_float) + test_spots(0.0f, "float"); + if(test_double) + test_spots(0.0, "double"); + if(test_long_double) + test_spots(0.0L, "long double"); +#ifdef BOOST_MATH_USE_FLOAT128 + //test_spots(0.0Q, "__float128"); +#endif + + +#endif +} + diff --git a/src/boost/libs/math/reporting/accuracy/test_cbrt.cpp b/src/boost/libs/math/reporting/accuracy/test_cbrt.cpp new file mode 100644 index 00000000..35108c3e --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/test_cbrt.cpp @@ -0,0 +1,66 @@ +// Copyright John Maddock 2015. +// 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) + +#ifdef _MSC_VER +# pragma warning (disable : 4224) +#endif + +#include +#include "bindings.hpp" +#include "../../test/test_cbrt.hpp" + +BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(test_main, 10000); + +BOOST_AUTO_TEST_CASE(test_main) +{ + BOOST_MATH_CONTROL_FP; + + error_stream_replacer rep; + +#ifdef TYPE_TO_TEST + + test_cbrt(static_cast(0), NAME_OF_TYPE_TO_TEST); + +#else + bool test_float = false; + bool test_double = false; + bool test_long_double = false; + + if(std::numeric_limits::digits == std::numeric_limits::digits) + { + // + // Don't bother with long double, it's the same as double: + // + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + test_double = true; + } + else + { + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + if(BOOST_MATH_PROMOTE_DOUBLE_POLICY == false) + test_double = true; + test_long_double = true; + } + +#ifdef ALWAYS_TEST_DOUBLE + test_double = true; +#endif + + if(test_float) + test_cbrt(0.0f, "float"); + if(test_double) + test_cbrt(0.0, "double"); + if(test_long_double) + test_cbrt(0.0L, "long double"); +#ifdef BOOST_MATH_USE_FLOAT128 + //test_cbrt(0.0Q, "__float128"); +#endif + + +#endif +} + diff --git a/src/boost/libs/math/reporting/accuracy/test_digamma.cpp b/src/boost/libs/math/reporting/accuracy/test_digamma.cpp new file mode 100644 index 00000000..a211bc66 --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/test_digamma.cpp @@ -0,0 +1,63 @@ +// Copyright John Maddock 2006-15. +// Copyright Paul A. Bristow 2007 +// 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 "bindings.hpp" +#include "../../test/test_digamma.hpp" +#include + +BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(test_main, 10000); + +BOOST_AUTO_TEST_CASE(test_main) +{ + BOOST_MATH_CONTROL_FP; + + error_stream_replacer rep; + +#ifdef TYPE_TO_TEST + + test_digamma(static_cast(0), NAME_OF_TYPE_TO_TEST); + +#else + bool test_float = false; + bool test_double = false; + bool test_long_double = false; + + if(std::numeric_limits::digits == std::numeric_limits::digits) + { + // + // Don't bother with long double, it's the same as double: + // + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + test_double = true; + } + else + { + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + if(BOOST_MATH_PROMOTE_DOUBLE_POLICY == false) + test_double = true; + test_long_double = true; + } + +#ifdef ALWAYS_TEST_DOUBLE + test_double = true; +#endif + + if(test_float) + test_digamma(0.0f, "float"); + if(test_double) + test_digamma(0.0, "double"); + if(test_long_double) + test_digamma(0.0L, "long double"); +#ifdef BOOST_MATH_USE_FLOAT128 + //test_digamma(0.0Q, "__float128"); +#endif + + +#endif +} + diff --git a/src/boost/libs/math/reporting/accuracy/test_ellint_1.cpp b/src/boost/libs/math/reporting/accuracy/test_ellint_1.cpp new file mode 100644 index 00000000..ab19f272 --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/test_ellint_1.cpp @@ -0,0 +1,63 @@ +// Copyright John Maddock 2006-15. +// Copyright Paul A. Bristow 2007 +// 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 "bindings.hpp" +#include "../../test/test_ellint_1.hpp" +#include + +BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(test_main, 10000); + +BOOST_AUTO_TEST_CASE(test_main) +{ + BOOST_MATH_CONTROL_FP; + + error_stream_replacer rep; + +#ifdef TYPE_TO_TEST + + test_spots(static_cast(0), NAME_OF_TYPE_TO_TEST); + +#else + bool test_float = false; + bool test_double = false; + bool test_long_double = false; + + if(std::numeric_limits::digits == std::numeric_limits::digits) + { + // + // Don't bother with long double, it's the same as double: + // + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + test_double = true; + } + else + { + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + if(BOOST_MATH_PROMOTE_DOUBLE_POLICY == false) + test_double = true; + test_long_double = true; + } + +#ifdef ALWAYS_TEST_DOUBLE + test_double = true; +#endif + + if(test_float) + test_spots(0.0f, "float"); + if(test_double) + test_spots(0.0, "double"); + if(test_long_double) + test_spots(0.0L, "long double"); +#ifdef BOOST_MATH_USE_FLOAT128 + //test_spots(0.0Q, "__float128"); +#endif + + +#endif +} + diff --git a/src/boost/libs/math/reporting/accuracy/test_ellint_2.cpp b/src/boost/libs/math/reporting/accuracy/test_ellint_2.cpp new file mode 100644 index 00000000..27b3f217 --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/test_ellint_2.cpp @@ -0,0 +1,63 @@ +// Copyright John Maddock 2006-15. +// Copyright Paul A. Bristow 2007 +// 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 "bindings.hpp" +#include "../../test/test_ellint_2.hpp" +#include + +BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(test_main, 10000); + +BOOST_AUTO_TEST_CASE(test_main) +{ + BOOST_MATH_CONTROL_FP; + + error_stream_replacer rep; + +#ifdef TYPE_TO_TEST + + test_spots(static_cast(0), NAME_OF_TYPE_TO_TEST); + +#else + bool test_float = false; + bool test_double = false; + bool test_long_double = false; + + if(std::numeric_limits::digits == std::numeric_limits::digits) + { + // + // Don't bother with long double, it's the same as double: + // + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + test_double = true; + } + else + { + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + if(BOOST_MATH_PROMOTE_DOUBLE_POLICY == false) + test_double = true; + test_long_double = true; + } + +#ifdef ALWAYS_TEST_DOUBLE + test_double = true; +#endif + + if(test_float) + test_spots(0.0f, "float"); + if(test_double) + test_spots(0.0, "double"); + if(test_long_double) + test_spots(0.0L, "long double"); +#ifdef BOOST_MATH_USE_FLOAT128 + //test_spots(0.0Q, "__float128"); +#endif + + +#endif +} + diff --git a/src/boost/libs/math/reporting/accuracy/test_ellint_3.cpp b/src/boost/libs/math/reporting/accuracy/test_ellint_3.cpp new file mode 100644 index 00000000..cfc5e98f --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/test_ellint_3.cpp @@ -0,0 +1,63 @@ +// Copyright John Maddock 2006-15. +// Copyright Paul A. Bristow 2007 +// 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 "bindings.hpp" +#include "../../test/test_ellint_3.hpp" +#include + +BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(test_main, 10000); + +BOOST_AUTO_TEST_CASE(test_main) +{ + BOOST_MATH_CONTROL_FP; + + error_stream_replacer rep; + +#ifdef TYPE_TO_TEST + + test_spots(static_cast(0), NAME_OF_TYPE_TO_TEST); + +#else + bool test_float = false; + bool test_double = false; + bool test_long_double = false; + + if(std::numeric_limits::digits == std::numeric_limits::digits) + { + // + // Don't bother with long double, it's the same as double: + // + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + test_double = true; + } + else + { + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + if(BOOST_MATH_PROMOTE_DOUBLE_POLICY == false) + test_double = true; + test_long_double = true; + } + +#ifdef ALWAYS_TEST_DOUBLE + test_double = true; +#endif + + if(test_float) + test_spots(0.0f, "float"); + if(test_double) + test_spots(0.0, "double"); + if(test_long_double) + test_spots(0.0L, "long double"); +#ifdef BOOST_MATH_USE_FLOAT128 + //test_spots(0.0Q, "__float128"); +#endif + + +#endif +} + diff --git a/src/boost/libs/math/reporting/accuracy/test_ellint_d.cpp b/src/boost/libs/math/reporting/accuracy/test_ellint_d.cpp new file mode 100644 index 00000000..d06d0390 --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/test_ellint_d.cpp @@ -0,0 +1,63 @@ +// Copyright John Maddock 2006-15. +// Copyright Paul A. Bristow 2007 +// 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 "bindings.hpp" +#include "../../test/test_ellint_d.hpp" +#include + +BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(test_main, 10000); + +BOOST_AUTO_TEST_CASE(test_main) +{ + BOOST_MATH_CONTROL_FP; + + error_stream_replacer rep; + +#ifdef TYPE_TO_TEST + + test_spots(static_cast(0), NAME_OF_TYPE_TO_TEST); + +#else + bool test_float = false; + bool test_double = false; + bool test_long_double = false; + + if(std::numeric_limits::digits == std::numeric_limits::digits) + { + // + // Don't bother with long double, it's the same as double: + // + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + test_double = true; + } + else + { + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + if(BOOST_MATH_PROMOTE_DOUBLE_POLICY == false) + test_double = true; + test_long_double = true; + } + +#ifdef ALWAYS_TEST_DOUBLE + test_double = true; +#endif + + if(test_float) + test_spots(0.0f, "float"); + if(test_double) + test_spots(0.0, "double"); + if(test_long_double) + test_spots(0.0L, "long double"); +#ifdef BOOST_MATH_USE_FLOAT128 + //test_spots(0.0Q, "__float128"); +#endif + + +#endif +} + diff --git a/src/boost/libs/math/reporting/accuracy/test_erf.cpp b/src/boost/libs/math/reporting/accuracy/test_erf.cpp new file mode 100644 index 00000000..6edd6119 --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/test_erf.cpp @@ -0,0 +1,63 @@ +// Copyright John Maddock 2006-15. +// Copyright Paul A. Bristow 2007 +// 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 "bindings.hpp" +#include "../../test/test_erf.hpp" + +BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(test_main, 10000); + +BOOST_AUTO_TEST_CASE(test_main) +{ + BOOST_MATH_CONTROL_FP; + + error_stream_replacer rep; + +#ifdef TYPE_TO_TEST + + test_erf(static_cast(0), NAME_OF_TYPE_TO_TEST); + +#else + bool test_float = false; + bool test_double = false; + bool test_long_double = false; + + if(std::numeric_limits::digits == std::numeric_limits::digits) + { + // + // Don't bother with long double, it's the same as double: + // + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + test_double = true; + } + else + { + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + if(BOOST_MATH_PROMOTE_DOUBLE_POLICY == false) + test_double = true; + test_long_double = true; + } + +#ifdef ALWAYS_TEST_DOUBLE + test_double = true; +#endif + + if(test_float) + test_erf(0.0f, "float"); + if(test_double) + test_erf(0.0, "double"); + if(test_long_double) + test_erf(0.0L, "long double"); +#ifdef BOOST_MATH_USE_FLOAT128 + //test_erf(0.0Q, "__float128"); +#endif + + +#endif +} + diff --git a/src/boost/libs/math/reporting/accuracy/test_expint.cpp b/src/boost/libs/math/reporting/accuracy/test_expint.cpp new file mode 100644 index 00000000..adc3c406 --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/test_expint.cpp @@ -0,0 +1,63 @@ +// Copyright John Maddock 2006-15. +// Copyright Paul A. Bristow 2007 +// 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 "bindings.hpp" +#include "../../test/test_expint.hpp" +#include + +BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(test_main, 10000); + +BOOST_AUTO_TEST_CASE(test_main) +{ + BOOST_MATH_CONTROL_FP; + + error_stream_replacer rep; + +#ifdef TYPE_TO_TEST + + test_expint(static_cast(0), NAME_OF_TYPE_TO_TEST); + +#else + bool test_float = false; + bool test_double = false; + bool test_long_double = false; + + if(std::numeric_limits::digits == std::numeric_limits::digits) + { + // + // Don't bother with long double, it's the same as double: + // + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + test_double = true; + } + else + { + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + if(BOOST_MATH_PROMOTE_DOUBLE_POLICY == false) + test_double = true; + test_long_double = true; + } + +#ifdef ALWAYS_TEST_DOUBLE + test_double = true; +#endif + + if(test_float) + test_expint(0.0f, "float"); + if(test_double) + test_expint(0.0, "double"); + if(test_long_double) + test_expint(0.0L, "long double"); +#ifdef BOOST_MATH_USE_FLOAT128 + //test_expint(0.0Q, "__float128"); +#endif + + +#endif +} + diff --git a/src/boost/libs/math/reporting/accuracy/test_gamma.cpp b/src/boost/libs/math/reporting/accuracy/test_gamma.cpp new file mode 100644 index 00000000..f7dbb3cb --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/test_gamma.cpp @@ -0,0 +1,66 @@ +// Copyright John Maddock 2015. +// 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) + +#ifdef _MSC_VER +# pragma warning (disable : 4224) +#endif + +#include +#include "bindings.hpp" +#include "../../test/test_gamma.hpp" + +BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(test_main, 10000); + +BOOST_AUTO_TEST_CASE(test_main) +{ + BOOST_MATH_CONTROL_FP; + + error_stream_replacer rep; + +#ifdef TYPE_TO_TEST + + test_gamma(static_cast(0), NAME_OF_TYPE_TO_TEST); + +#else + bool test_float = false; + bool test_double = false; + bool test_long_double = false; + + if(std::numeric_limits::digits == std::numeric_limits::digits) + { + // + // Don't bother with long double, it's the same as double: + // + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + test_double = true; + } + else + { + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + if(BOOST_MATH_PROMOTE_DOUBLE_POLICY == false) + test_double = true; + test_long_double = true; + } + +#ifdef ALWAYS_TEST_DOUBLE + test_double = true; +#endif + + if(test_float) + test_gamma(0.0f, "float"); + if(test_double) + test_gamma(0.0, "double"); + if(test_long_double) + test_gamma(0.0L, "long double"); +#ifdef BOOST_MATH_USE_FLOAT128 + //test_cbrt(0.0Q, "__float128"); +#endif + + +#endif +} + diff --git a/src/boost/libs/math/reporting/accuracy/test_hermite.cpp b/src/boost/libs/math/reporting/accuracy/test_hermite.cpp new file mode 100644 index 00000000..9c7c6d20 --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/test_hermite.cpp @@ -0,0 +1,63 @@ +// Copyright John Maddock 2006-15. +// Copyright Paul A. Bristow 2007 +// 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 "bindings.hpp" +#include "../../test/test_hermite.hpp" +#include + +BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(test_main, 10000); + +BOOST_AUTO_TEST_CASE(test_main) +{ + BOOST_MATH_CONTROL_FP; + + error_stream_replacer rep; + +#ifdef TYPE_TO_TEST + + test_hermite(static_cast(0), NAME_OF_TYPE_TO_TEST); + +#else + bool test_float = false; + bool test_double = false; + bool test_long_double = false; + + if(std::numeric_limits::digits == std::numeric_limits::digits) + { + // + // Don't bother with long double, it's the same as double: + // + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + test_double = true; + } + else + { + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + if(BOOST_MATH_PROMOTE_DOUBLE_POLICY == false) + test_double = true; + test_long_double = true; + } + +#ifdef ALWAYS_TEST_DOUBLE + test_double = true; +#endif + + if(test_float) + test_hermite(0.0f, "float"); + if(test_double) + test_hermite(0.0, "double"); + if(test_long_double) + test_hermite(0.0L, "long double"); +#ifdef BOOST_MATH_USE_FLOAT128 + //test_hermite(0.0Q, "__float128"); +#endif + + +#endif +} + diff --git a/src/boost/libs/math/reporting/accuracy/test_heuman_lambda.cpp b/src/boost/libs/math/reporting/accuracy/test_heuman_lambda.cpp new file mode 100644 index 00000000..64a61a7b --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/test_heuman_lambda.cpp @@ -0,0 +1,63 @@ +// Copyright John Maddock 2006-15. +// Copyright Paul A. Bristow 2007 +// 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 "bindings.hpp" +#include "../../test/test_heuman_lambda.hpp" +#include + +BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(test_main, 10000); + +BOOST_AUTO_TEST_CASE(test_main) +{ + BOOST_MATH_CONTROL_FP; + + error_stream_replacer rep; + +#ifdef TYPE_TO_TEST + + test_spots(static_cast(0), NAME_OF_TYPE_TO_TEST); + +#else + bool test_float = false; + bool test_double = false; + bool test_long_double = false; + + if(std::numeric_limits::digits == std::numeric_limits::digits) + { + // + // Don't bother with long double, it's the same as double: + // + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + test_double = true; + } + else + { + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + if(BOOST_MATH_PROMOTE_DOUBLE_POLICY == false) + test_double = true; + test_long_double = true; + } + +#ifdef ALWAYS_TEST_DOUBLE + test_double = true; +#endif + + if(test_float) + test_spots(0.0f, "float"); + if(test_double) + test_spots(0.0, "double"); + if(test_long_double) + test_spots(0.0L, "long double"); +#ifdef BOOST_MATH_USE_FLOAT128 + //test_spots(0.0Q, "__float128"); +#endif + + +#endif +} + diff --git a/src/boost/libs/math/reporting/accuracy/test_ibeta.cpp b/src/boost/libs/math/reporting/accuracy/test_ibeta.cpp new file mode 100644 index 00000000..285049d4 --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/test_ibeta.cpp @@ -0,0 +1,63 @@ +// Copyright John Maddock 2006-15. +// Copyright Paul A. Bristow 2007 +// 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 "bindings.hpp" +#include "../../test/test_ibeta.hpp" +#include + +BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(test_main, 10000); + +BOOST_AUTO_TEST_CASE(test_main) +{ + BOOST_MATH_CONTROL_FP; + + error_stream_replacer rep; + +#ifdef TYPE_TO_TEST + + test_beta(static_cast(0), NAME_OF_TYPE_TO_TEST); + +#else + bool test_float = false; + bool test_double = false; + bool test_long_double = false; + + if(std::numeric_limits::digits == std::numeric_limits::digits) + { + // + // Don't bother with long double, it's the same as double: + // + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + test_double = true; + } + else + { + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + if(BOOST_MATH_PROMOTE_DOUBLE_POLICY == false) + test_double = true; + test_long_double = true; + } + +#ifdef ALWAYS_TEST_DOUBLE + test_double = true; +#endif + + if(test_float) + test_beta(0.0f, "float"); + if(test_double) + test_beta(0.0, "double"); + if(test_long_double) + test_beta(0.0L, "long double"); +#ifdef BOOST_MATH_USE_FLOAT128 + //test_beta(0.0Q, "__float128"); +#endif + + +#endif +} + diff --git a/src/boost/libs/math/reporting/accuracy/test_ibeta_inv.cpp b/src/boost/libs/math/reporting/accuracy/test_ibeta_inv.cpp new file mode 100644 index 00000000..6abe55be --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/test_ibeta_inv.cpp @@ -0,0 +1,63 @@ +// Copyright John Maddock 2006-15. +// Copyright Paul A. Bristow 2007 +// 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 "bindings.hpp" +#include "../../test/test_ibeta_inv.hpp" +#include + +BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(test_main, 10000); + +BOOST_AUTO_TEST_CASE(test_main) +{ + BOOST_MATH_CONTROL_FP; + + error_stream_replacer rep; + +#ifdef TYPE_TO_TEST + + test_beta(static_cast(0), NAME_OF_TYPE_TO_TEST); + +#else + bool test_float = false; + bool test_double = false; + bool test_long_double = false; + + if(std::numeric_limits::digits == std::numeric_limits::digits) + { + // + // Don't bother with long double, it's the same as double: + // + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + test_double = true; + } + else + { + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + if(BOOST_MATH_PROMOTE_DOUBLE_POLICY == false) + test_double = true; + test_long_double = true; + } + +#ifdef ALWAYS_TEST_DOUBLE + test_double = true; +#endif + + if(test_float) + test_beta(0.0f, "float"); + if(test_double) + test_beta(0.0, "double"); + if(test_long_double) + test_beta(0.0L, "long double"); +#ifdef BOOST_MATH_USE_FLOAT128 + //test_beta(0.0Q, "__float128"); +#endif + + +#endif +} + diff --git a/src/boost/libs/math/reporting/accuracy/test_ibeta_inva.cpp b/src/boost/libs/math/reporting/accuracy/test_ibeta_inva.cpp new file mode 100644 index 00000000..ff2f290b --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/test_ibeta_inva.cpp @@ -0,0 +1,63 @@ +// Copyright John Maddock 2006-15. +// Copyright Paul A. Bristow 2007 +// 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 "bindings.hpp" +#include "../../test/test_ibeta_inv_ab.hpp" +#include + +BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(test_main, 10000); + +BOOST_AUTO_TEST_CASE(test_main) +{ + BOOST_MATH_CONTROL_FP; + + error_stream_replacer rep; + +#ifdef TYPE_TO_TEST + + test_beta(static_cast(0), NAME_OF_TYPE_TO_TEST); + +#else + bool test_float = false; + bool test_double = false; + bool test_long_double = false; + + if(std::numeric_limits::digits == std::numeric_limits::digits) + { + // + // Don't bother with long double, it's the same as double: + // + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + test_double = true; + } + else + { + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + if(BOOST_MATH_PROMOTE_DOUBLE_POLICY == false) + test_double = true; + test_long_double = true; + } + +#ifdef ALWAYS_TEST_DOUBLE + test_double = true; +#endif + + if(test_float) + test_beta(0.0f, "float"); + if(test_double) + test_beta(0.0, "double"); + if(test_long_double) + test_beta(0.0L, "long double"); +#ifdef BOOST_MATH_USE_FLOAT128 + //test_beta(0.0Q, "__float128"); +#endif + + +#endif +} + diff --git a/src/boost/libs/math/reporting/accuracy/test_igamma.cpp b/src/boost/libs/math/reporting/accuracy/test_igamma.cpp new file mode 100644 index 00000000..c4a4efcc --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/test_igamma.cpp @@ -0,0 +1,61 @@ +// Copyright John Maddock 2006-15. +// Copyright Paul A. Bristow 2007 +// 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 "bindings.hpp" +#include "../../test/test_igamma.hpp" +#include + +BOOST_AUTO_TEST_CASE(test_main) +{ + BOOST_MATH_CONTROL_FP; + + error_stream_replacer rep; + +#ifdef TYPE_TO_TEST + + test_gamma(static_cast(0), NAME_OF_TYPE_TO_TEST); + +#else + bool test_float = false; + bool test_double = false; + bool test_long_double = false; + + if(std::numeric_limits::digits == std::numeric_limits::digits) + { + // + // Don't bother with long double, it's the same as double: + // + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + test_double = true; + } + else + { + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + if(BOOST_MATH_PROMOTE_DOUBLE_POLICY == false) + test_double = true; + test_long_double = true; + } + +#ifdef ALWAYS_TEST_DOUBLE + test_double = true; +#endif + + if(test_float) + test_gamma(0.0f, "float"); + if(test_double) + test_gamma(0.0, "double"); + if(test_long_double) + test_gamma(0.0L, "long double"); +#ifdef BOOST_MATH_USE_FLOAT128 + //test_gamma(0.0Q, "__float128"); +#endif + + +#endif +} + diff --git a/src/boost/libs/math/reporting/accuracy/test_igamma_inv.cpp b/src/boost/libs/math/reporting/accuracy/test_igamma_inv.cpp new file mode 100644 index 00000000..aa96cd34 --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/test_igamma_inv.cpp @@ -0,0 +1,61 @@ +// Copyright John Maddock 2006-15. +// Copyright Paul A. Bristow 2007 +// 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 "bindings.hpp" +#include "../../test/test_igamma_inv.hpp" +#include + +BOOST_AUTO_TEST_CASE(test_main) +{ + BOOST_MATH_CONTROL_FP; + + error_stream_replacer rep; + +#ifdef TYPE_TO_TEST + + test_gamma(static_cast(0), NAME_OF_TYPE_TO_TEST); + +#else + bool test_float = false; + bool test_double = false; + bool test_long_double = false; + + if(std::numeric_limits::digits == std::numeric_limits::digits) + { + // + // Don't bother with long double, it's the same as double: + // + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + test_double = true; + } + else + { + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + if(BOOST_MATH_PROMOTE_DOUBLE_POLICY == false) + test_double = true; + test_long_double = true; + } + +#ifdef ALWAYS_TEST_DOUBLE + test_double = true; +#endif + + if(test_float) + test_gamma(0.0f, "float"); + if(test_double) + test_gamma(0.0, "double"); + if(test_long_double) + test_gamma(0.0L, "long double"); +#ifdef BOOST_MATH_USE_FLOAT128 + //test_gamma(0.0Q, "__float128"); +#endif + + +#endif +} + diff --git a/src/boost/libs/math/reporting/accuracy/test_igamma_inva.cpp b/src/boost/libs/math/reporting/accuracy/test_igamma_inva.cpp new file mode 100644 index 00000000..125b2141 --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/test_igamma_inva.cpp @@ -0,0 +1,63 @@ +// Copyright John Maddock 2006-15. +// Copyright Paul A. Bristow 2007 +// 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 "bindings.hpp" +#include "../../test/test_igamma_inva.hpp" +#include + +BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(test_main, 10000); + +BOOST_AUTO_TEST_CASE(test_main) +{ + BOOST_MATH_CONTROL_FP; + + error_stream_replacer rep; + +#ifdef TYPE_TO_TEST + + test_gamma(static_cast(0), NAME_OF_TYPE_TO_TEST); + +#else + bool test_float = false; + bool test_double = false; + bool test_long_double = false; + + if(std::numeric_limits::digits == std::numeric_limits::digits) + { + // + // Don't bother with long double, it's the same as double: + // + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + test_double = true; + } + else + { + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + if(BOOST_MATH_PROMOTE_DOUBLE_POLICY == false) + test_double = true; + test_long_double = true; + } + +#ifdef ALWAYS_TEST_DOUBLE + test_double = true; +#endif + + if(test_float) + test_gamma(0.0f, "float"); + if(test_double) + test_gamma(0.0, "double"); + if(test_long_double) + test_gamma(0.0L, "long double"); +#ifdef BOOST_MATH_USE_FLOAT128 + //test_gamma(0.0Q, "__float128"); +#endif + + +#endif +} + diff --git a/src/boost/libs/math/reporting/accuracy/test_jacobi.cpp b/src/boost/libs/math/reporting/accuracy/test_jacobi.cpp new file mode 100644 index 00000000..4c9650ae --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/test_jacobi.cpp @@ -0,0 +1,63 @@ +// Copyright John Maddock 2006-15. +// Copyright Paul A. Bristow 2007 +// 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 "bindings.hpp" +#include "../../test/test_jacobi.hpp" +#include + +BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(test_main, 10000); + +BOOST_AUTO_TEST_CASE(test_main) +{ + BOOST_MATH_CONTROL_FP; + + error_stream_replacer rep; + +#ifdef TYPE_TO_TEST + + test_spots(static_cast(0), NAME_OF_TYPE_TO_TEST); + +#else + bool test_float = false; + bool test_double = false; + bool test_long_double = false; + + if(std::numeric_limits::digits == std::numeric_limits::digits) + { + // + // Don't bother with long double, it's the same as double: + // + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + test_double = true; + } + else + { + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + if(BOOST_MATH_PROMOTE_DOUBLE_POLICY == false) + test_double = true; + test_long_double = true; + } + +#ifdef ALWAYS_TEST_DOUBLE + test_double = true; +#endif + + if(test_float) + test_spots(0.0f, "float"); + if(test_double) + test_spots(0.0, "double"); + if(test_long_double) + test_spots(0.0L, "long double"); +#ifdef BOOST_MATH_USE_FLOAT128 + //test_spots(0.0Q, "__float128"); +#endif + + +#endif +} + diff --git a/src/boost/libs/math/reporting/accuracy/test_jacobi_zeta.cpp b/src/boost/libs/math/reporting/accuracy/test_jacobi_zeta.cpp new file mode 100644 index 00000000..7e31f1e5 --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/test_jacobi_zeta.cpp @@ -0,0 +1,63 @@ +// Copyright John Maddock 2006-15. +// Copyright Paul A. Bristow 2007 +// 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 "bindings.hpp" +#include "../../test/test_jacobi_zeta.hpp" +#include + +BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(test_main, 10000); + +BOOST_AUTO_TEST_CASE(test_main) +{ + BOOST_MATH_CONTROL_FP; + + error_stream_replacer rep; + +#ifdef TYPE_TO_TEST + + test_spots(static_cast(0), NAME_OF_TYPE_TO_TEST); + +#else + bool test_float = false; + bool test_double = false; + bool test_long_double = false; + + if(std::numeric_limits::digits == std::numeric_limits::digits) + { + // + // Don't bother with long double, it's the same as double: + // + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + test_double = true; + } + else + { + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + if(BOOST_MATH_PROMOTE_DOUBLE_POLICY == false) + test_double = true; + test_long_double = true; + } + +#ifdef ALWAYS_TEST_DOUBLE + test_double = true; +#endif + + if(test_float) + test_spots(0.0f, "float"); + if(test_double) + test_spots(0.0, "double"); + if(test_long_double) + test_spots(0.0L, "long double"); +#ifdef BOOST_MATH_USE_FLOAT128 + //test_spots(0.0Q, "__float128"); +#endif + + +#endif +} + diff --git a/src/boost/libs/math/reporting/accuracy/test_laguerre.cpp b/src/boost/libs/math/reporting/accuracy/test_laguerre.cpp new file mode 100644 index 00000000..b59891bb --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/test_laguerre.cpp @@ -0,0 +1,63 @@ +// Copyright John Maddock 2006-15. +// Copyright Paul A. Bristow 2007 +// 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 "bindings.hpp" +#include "../../test/test_laguerre.hpp" +#include + +BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(test_main, 10000); + +BOOST_AUTO_TEST_CASE(test_main) +{ + BOOST_MATH_CONTROL_FP; + + error_stream_replacer rep; + +#ifdef TYPE_TO_TEST + + test_laguerre(static_cast(0), NAME_OF_TYPE_TO_TEST); + +#else + bool test_float = false; + bool test_double = false; + bool test_long_double = false; + + if(std::numeric_limits::digits == std::numeric_limits::digits) + { + // + // Don't bother with long double, it's the same as double: + // + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + test_double = true; + } + else + { + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + if(BOOST_MATH_PROMOTE_DOUBLE_POLICY == false) + test_double = true; + test_long_double = true; + } + +#ifdef ALWAYS_TEST_DOUBLE + test_double = true; +#endif + + if(test_float) + test_laguerre(0.0f, "float"); + if(test_double) + test_laguerre(0.0, "double"); + if(test_long_double) + test_laguerre(0.0L, "long double"); +#ifdef BOOST_MATH_USE_FLOAT128 + //test_laguerre(0.0Q, "__float128"); +#endif + + +#endif +} + diff --git a/src/boost/libs/math/reporting/accuracy/test_legendre.cpp b/src/boost/libs/math/reporting/accuracy/test_legendre.cpp new file mode 100644 index 00000000..4b080fb0 --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/test_legendre.cpp @@ -0,0 +1,63 @@ +// Copyright John Maddock 2006-15. +// Copyright Paul A. Bristow 2007 +// 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 "bindings.hpp" +#include "../../test/test_legendre.hpp" +#include + +BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(test_main, 10000); + +BOOST_AUTO_TEST_CASE(test_main) +{ + BOOST_MATH_CONTROL_FP; + + error_stream_replacer rep; + +#ifdef TYPE_TO_TEST + + test_legendre_p(static_cast(0), NAME_OF_TYPE_TO_TEST); + +#else + bool test_float = false; + bool test_double = false; + bool test_long_double = false; + + if(std::numeric_limits::digits == std::numeric_limits::digits) + { + // + // Don't bother with long double, it's the same as double: + // + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + test_double = true; + } + else + { + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + if(BOOST_MATH_PROMOTE_DOUBLE_POLICY == false) + test_double = true; + test_long_double = true; + } + +#ifdef ALWAYS_TEST_DOUBLE + test_double = true; +#endif + + if(test_float) + test_legendre_p(0.0f, "float"); + if(test_double) + test_legendre_p(0.0, "double"); + if(test_long_double) + test_legendre_p(0.0L, "long double"); +#ifdef BOOST_MATH_USE_FLOAT128 + //test_legendre_p(0.0Q, "__float128"); +#endif + + +#endif +} + diff --git a/src/boost/libs/math/reporting/accuracy/test_log1p_expm1.cpp b/src/boost/libs/math/reporting/accuracy/test_log1p_expm1.cpp new file mode 100644 index 00000000..24016e38 --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/test_log1p_expm1.cpp @@ -0,0 +1,67 @@ +// Copyright John Maddock 2006-15. +// Copyright Paul A. Bristow 2007 +// 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) + +#define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error +#include "bindings.hpp" +#include "../../test/log1p_expm1_test.hpp" +#include +#include +#define BOOST_TEST_MAIN +#include + +BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(test_main, 10000); + +BOOST_AUTO_TEST_CASE(test_main) +{ + BOOST_MATH_CONTROL_FP; + + error_stream_replacer rep; + +#ifdef TYPE_TO_TEST + + test(static_cast(0), NAME_OF_TYPE_TO_TEST); + +#else + bool test_float = false; + bool test_double = false; + bool test_long_double = false; + + if(std::numeric_limits::digits == std::numeric_limits::digits) + { + // + // Don't bother with long double, it's the same as double: + // + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + test_double = true; + } + else + { + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + if(BOOST_MATH_PROMOTE_DOUBLE_POLICY == false) + test_double = true; + test_long_double = true; + } + +#ifdef ALWAYS_TEST_DOUBLE + test_double = true; +#endif + + if(test_float) + test(0.0f, "float"); + if(test_double) + test(0.0, "double"); + if(test_long_double) + test(0.0L, "long double"); +#ifdef BOOST_MATH_USE_FLOAT128 + //test(0.0Q, "__float128"); +#endif + + +#endif +} + diff --git a/src/boost/libs/math/reporting/accuracy/test_nc_beta.cpp b/src/boost/libs/math/reporting/accuracy/test_nc_beta.cpp new file mode 100644 index 00000000..6a23b923 --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/test_nc_beta.cpp @@ -0,0 +1,65 @@ +// Copyright John Maddock 2006-15. +// Copyright Paul A. Bristow 2007 +// 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) + +#define BOOST_TEST_MAIN +#define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error +#include "bindings.hpp" +#include "../../test/test_nc_beta.hpp" +#include + +BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(test_main, 10000); + +BOOST_AUTO_TEST_CASE(test_main) +{ + BOOST_MATH_CONTROL_FP; + + error_stream_replacer rep; + +#ifdef TYPE_TO_TEST + + test_accuracy(static_cast(0), NAME_OF_TYPE_TO_TEST); + +#else + bool test_float = false; + bool test_double = false; + bool test_long_double = false; + + if(std::numeric_limits::digits == std::numeric_limits::digits) + { + // + // Don't bother with long double, it's the same as double: + // + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + test_double = true; + } + else + { + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + if(BOOST_MATH_PROMOTE_DOUBLE_POLICY == false) + test_double = true; + test_long_double = true; + } + +#ifdef ALWAYS_TEST_DOUBLE + test_double = true; +#endif + + if(test_float) + test_accuracy(0.0f, "float"); + if(test_double) + test_accuracy(0.0, "double"); + if(test_long_double) + test_accuracy(0.0L, "long double"); +#ifdef BOOST_MATH_USE_FLOAT128 + //test_accuracy(0.0Q, "__float128"); +#endif + + +#endif +} + diff --git a/src/boost/libs/math/reporting/accuracy/test_nc_chi_squared.cpp b/src/boost/libs/math/reporting/accuracy/test_nc_chi_squared.cpp new file mode 100644 index 00000000..03e22644 --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/test_nc_chi_squared.cpp @@ -0,0 +1,65 @@ +// Copyright John Maddock 2006-15. +// Copyright Paul A. Bristow 2007 +// 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) + +#define BOOST_TEST_MAIN +#define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error +#include "bindings.hpp" +#include "../../test/test_nc_chi_squared.hpp" +#include + +BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(test_main, 10000); + +BOOST_AUTO_TEST_CASE(test_main) +{ + BOOST_MATH_CONTROL_FP; + + error_stream_replacer rep; + +#ifdef TYPE_TO_TEST + + test_accuracy(static_cast(0), NAME_OF_TYPE_TO_TEST); + +#else + bool test_float = false; + bool test_double = false; + bool test_long_double = false; + + if(std::numeric_limits::digits == std::numeric_limits::digits) + { + // + // Don't bother with long double, it's the same as double: + // + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + test_double = true; + } + else + { + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + if(BOOST_MATH_PROMOTE_DOUBLE_POLICY == false) + test_double = true; + test_long_double = true; + } + +#ifdef ALWAYS_TEST_DOUBLE + test_double = true; +#endif + + if(test_float) + test_accuracy(0.0f, "float"); + if(test_double) + test_accuracy(0.0, "double"); + if(test_long_double) + test_accuracy(0.0L, "long double"); +#ifdef BOOST_MATH_USE_FLOAT128 + //test_accuracy(0.0Q, "__float128"); +#endif + + +#endif +} + diff --git a/src/boost/libs/math/reporting/accuracy/test_nc_t.cpp b/src/boost/libs/math/reporting/accuracy/test_nc_t.cpp new file mode 100644 index 00000000..cf6be89a --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/test_nc_t.cpp @@ -0,0 +1,65 @@ +// Copyright John Maddock 2006-15. +// Copyright Paul A. Bristow 2007 +// 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) + +#define BOOST_TEST_MAIN +#define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error +#include "bindings.hpp" +#include "../../test/test_nc_t.hpp" +#include + +BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(test_main, 10000); + +BOOST_AUTO_TEST_CASE(test_main) +{ + BOOST_MATH_CONTROL_FP; + + error_stream_replacer rep; + +#ifdef TYPE_TO_TEST + + test_accuracy(static_cast(0), NAME_OF_TYPE_TO_TEST); + +#else + bool test_float = false; + bool test_double = false; + bool test_long_double = false; + + if(std::numeric_limits::digits == std::numeric_limits::digits) + { + // + // Don't bother with long double, it's the same as double: + // + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + test_double = true; + } + else + { + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + if(BOOST_MATH_PROMOTE_DOUBLE_POLICY == false) + test_double = true; + test_long_double = true; + } + +#ifdef ALWAYS_TEST_DOUBLE + test_double = true; +#endif + + if(test_float) + test_accuracy(0.0f, "float"); + if(test_double) + test_accuracy(0.0, "double"); + if(test_long_double) + test_accuracy(0.0L, "long double"); +#ifdef BOOST_MATH_USE_FLOAT128 + //test_accuracy(0.0Q, "__float128"); +#endif + + +#endif +} + diff --git a/src/boost/libs/math/reporting/accuracy/test_owens_t.cpp b/src/boost/libs/math/reporting/accuracy/test_owens_t.cpp new file mode 100644 index 00000000..4aa790ca --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/test_owens_t.cpp @@ -0,0 +1,65 @@ +// Copyright John Maddock 2006-15. +// Copyright Paul A. Bristow 2007 +// 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) + +#define BOOST_TEST_MAIN +#include "bindings.hpp" +#include "../../test/test_owens_t.hpp" +#include // for owens_t function. +#include + +BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(test_main, 10000); + +BOOST_AUTO_TEST_CASE(test_main) +{ + BOOST_MATH_CONTROL_FP; + + error_stream_replacer rep; + +#ifdef TYPE_TO_TEST + + test_owens_t(static_cast(0), NAME_OF_TYPE_TO_TEST); + +#else + bool test_float = false; + bool test_double = false; + bool test_long_double = false; + + if(std::numeric_limits::digits == std::numeric_limits::digits) + { + // + // Don't bother with long double, it's the same as double: + // + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + test_double = true; + } + else + { + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + if(BOOST_MATH_PROMOTE_DOUBLE_POLICY == false) + test_double = true; + test_long_double = true; + } + +#ifdef ALWAYS_TEST_DOUBLE + test_double = true; +#endif + + if(test_float) + test_owens_t(0.0f, "float"); + if(test_double) + test_owens_t(0.0, "double"); + if(test_long_double) + test_owens_t(0.0L, "long double"); +#ifdef BOOST_MATH_USE_FLOAT128 + //test_owens_t(0.0Q, "__float128"); +#endif + + +#endif +} + diff --git a/src/boost/libs/math/reporting/accuracy/test_polygamma.cpp b/src/boost/libs/math/reporting/accuracy/test_polygamma.cpp new file mode 100644 index 00000000..e0447fe3 --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/test_polygamma.cpp @@ -0,0 +1,63 @@ +// Copyright John Maddock 2006-15. +// Copyright Paul A. Bristow 2007 +// 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 "bindings.hpp" +#include "../../test/test_polygamma.hpp" +#include + +BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(test_main, 10000); + +BOOST_AUTO_TEST_CASE(test_main) +{ + BOOST_MATH_CONTROL_FP; + + error_stream_replacer rep; + +#ifdef TYPE_TO_TEST + + test_polygamma(static_cast(0), NAME_OF_TYPE_TO_TEST); + +#else + bool test_float = false; + bool test_double = false; + bool test_long_double = false; + + if(std::numeric_limits::digits == std::numeric_limits::digits) + { + // + // Don't bother with long double, it's the same as double: + // + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + test_double = true; + } + else + { + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + if(BOOST_MATH_PROMOTE_DOUBLE_POLICY == false) + test_double = true; + test_long_double = true; + } + +#ifdef ALWAYS_TEST_DOUBLE + test_double = true; +#endif + + if(test_float) + test_polygamma(0.0f, "float"); + if(test_double) + test_polygamma(0.0, "double"); + if(test_long_double) + test_polygamma(0.0L, "long double"); +#ifdef BOOST_MATH_USE_FLOAT128 + //test_polygamma(0.0Q, "__float128"); +#endif + + +#endif +} + diff --git a/src/boost/libs/math/reporting/accuracy/test_powm1.cpp b/src/boost/libs/math/reporting/accuracy/test_powm1.cpp new file mode 100644 index 00000000..378a11d3 --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/test_powm1.cpp @@ -0,0 +1,66 @@ +// Copyright John Maddock 2006-15. +// Copyright Paul A. Bristow 2007 +// 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) + +#define BOOST_TEST_MAIN +#include "bindings.hpp" +#include "../../test/powm1_sqrtp1m1_test.hpp" +#include +#include +#include + +BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(test_main, 10000); + +BOOST_AUTO_TEST_CASE(test_main) +{ + BOOST_MATH_CONTROL_FP; + + error_stream_replacer rep; + +#ifdef TYPE_TO_TEST + + test_powm1_sqrtp1m1(static_cast(0), NAME_OF_TYPE_TO_TEST); + +#else + bool test_float = false; + bool test_double = false; + bool test_long_double = false; + + if(std::numeric_limits::digits == std::numeric_limits::digits) + { + // + // Don't bother with long double, it's the same as double: + // + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + test_double = true; + } + else + { + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + if(BOOST_MATH_PROMOTE_DOUBLE_POLICY == false) + test_double = true; + test_long_double = true; + } + +#ifdef ALWAYS_TEST_DOUBLE + test_double = true; +#endif + + if(test_float) + test_powm1_sqrtp1m1(0.0f, "float"); + if(test_double) + test_powm1_sqrtp1m1(0.0, "double"); + if(test_long_double) + test_powm1_sqrtp1m1(0.0L, "long double"); +#ifdef BOOST_MATH_USE_FLOAT128 + //test_powm1_sqrtp1m1(0.0Q, "__float128"); +#endif + + +#endif +} + diff --git a/src/boost/libs/math/reporting/accuracy/test_spherical_harmonic.cpp b/src/boost/libs/math/reporting/accuracy/test_spherical_harmonic.cpp new file mode 100644 index 00000000..fa1ebef4 --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/test_spherical_harmonic.cpp @@ -0,0 +1,65 @@ +// Copyright John Maddock 2006-15. +// Copyright Paul A. Bristow 2007 +// 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 "bindings.hpp" +#include "../../test/test_spherical_harmonic.hpp" +#include +#define BOOST_TEST_MAIN +#include + +BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(test_main, 10000); + +BOOST_AUTO_TEST_CASE(test_main) +{ + BOOST_MATH_CONTROL_FP; + + error_stream_replacer rep; + +#ifdef TYPE_TO_TEST + + test_spherical_harmonic(static_cast(0), NAME_OF_TYPE_TO_TEST); + +#else + bool test_float = false; + bool test_double = false; + bool test_long_double = false; + + if(std::numeric_limits::digits == std::numeric_limits::digits) + { + // + // Don't bother with long double, it's the same as double: + // + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + test_double = true; + } + else + { + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + if(BOOST_MATH_PROMOTE_DOUBLE_POLICY == false) + test_double = true; + test_long_double = true; + } + +#ifdef ALWAYS_TEST_DOUBLE + test_double = true; +#endif + + if(test_float) + test_spherical_harmonic(0.0f, "float"); + if(test_double) + test_spherical_harmonic(0.0, "double"); + if(test_long_double) + test_spherical_harmonic(0.0L, "long double"); +#ifdef BOOST_MATH_USE_FLOAT128 + //test_spherical_harmonic(0.0Q, "__float128"); +#endif + + +#endif +} + diff --git a/src/boost/libs/math/reporting/accuracy/test_tgamma_ratio.cpp b/src/boost/libs/math/reporting/accuracy/test_tgamma_ratio.cpp new file mode 100644 index 00000000..19673b37 --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/test_tgamma_ratio.cpp @@ -0,0 +1,63 @@ +// Copyright John Maddock 2006-15. +// Copyright Paul A. Bristow 2007 +// 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 "bindings.hpp" +#include "../../test/test_tgamma_ratio.hpp" +#include + +BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(test_main, 10000); + +BOOST_AUTO_TEST_CASE(test_main) +{ + BOOST_MATH_CONTROL_FP; + + error_stream_replacer rep; + +#ifdef TYPE_TO_TEST + + test_tgamma_ratio(static_cast(0), NAME_OF_TYPE_TO_TEST); + +#else + bool test_float = false; + bool test_double = false; + bool test_long_double = false; + + if(std::numeric_limits::digits == std::numeric_limits::digits) + { + // + // Don't bother with long double, it's the same as double: + // + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + test_double = true; + } + else + { + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + if(BOOST_MATH_PROMOTE_DOUBLE_POLICY == false) + test_double = true; + test_long_double = true; + } + +#ifdef ALWAYS_TEST_DOUBLE + test_double = true; +#endif + + if(test_float) + test_tgamma_ratio(0.0f, "float"); + if(test_double) + test_tgamma_ratio(0.0, "double"); + if(test_long_double) + test_tgamma_ratio(0.0L, "long double"); +#ifdef BOOST_MATH_USE_FLOAT128 + //test_tgamma_ratio(0.0Q, "__float128"); +#endif + + +#endif +} + diff --git a/src/boost/libs/math/reporting/accuracy/test_trig.cpp b/src/boost/libs/math/reporting/accuracy/test_trig.cpp new file mode 100644 index 00000000..f5095179 --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/test_trig.cpp @@ -0,0 +1,64 @@ +// Copyright John Maddock 2006-15. +// Copyright Paul A. Bristow 2007 +// 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 "bindings.hpp" +#include "../../test/test_trig.hpp" +#include +#include + +BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(test_main, 10000); + +BOOST_AUTO_TEST_CASE(test_main) +{ + BOOST_MATH_CONTROL_FP; + + error_stream_replacer rep; + +#ifdef TYPE_TO_TEST + + test_trig(static_cast(0), NAME_OF_TYPE_TO_TEST); + +#else + bool test_float = false; + bool test_double = false; + bool test_long_double = false; + + if(std::numeric_limits::digits == std::numeric_limits::digits) + { + // + // Don't bother with long double, it's the same as double: + // + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + test_double = true; + } + else + { + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + if(BOOST_MATH_PROMOTE_DOUBLE_POLICY == false) + test_double = true; + test_long_double = true; + } + +#ifdef ALWAYS_TEST_DOUBLE + test_double = true; +#endif + + if(test_float) + test_trig(0.0f, "float"); + if(test_double) + test_trig(0.0, "double"); + if(test_long_double) + test_trig(0.0L, "long double"); +#ifdef BOOST_MATH_USE_FLOAT128 + //test_trig(0.0Q, "__float128"); +#endif + + +#endif +} + diff --git a/src/boost/libs/math/reporting/accuracy/test_trigamma.cpp b/src/boost/libs/math/reporting/accuracy/test_trigamma.cpp new file mode 100644 index 00000000..33a2d063 --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/test_trigamma.cpp @@ -0,0 +1,63 @@ +// Copyright John Maddock 2006-15. +// Copyright Paul A. Bristow 2007 +// 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 "bindings.hpp" +#include "../../test/test_trigamma.hpp" +#include + +BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(test_main, 10000); + +BOOST_AUTO_TEST_CASE(test_main) +{ + BOOST_MATH_CONTROL_FP; + + error_stream_replacer rep; + +#ifdef TYPE_TO_TEST + + test_trigamma(static_cast(0), NAME_OF_TYPE_TO_TEST); + +#else + bool test_float = false; + bool test_double = false; + bool test_long_double = false; + + if(std::numeric_limits::digits == std::numeric_limits::digits) + { + // + // Don't bother with long double, it's the same as double: + // + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + test_double = true; + } + else + { + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + if(BOOST_MATH_PROMOTE_DOUBLE_POLICY == false) + test_double = true; + test_long_double = true; + } + +#ifdef ALWAYS_TEST_DOUBLE + test_double = true; +#endif + + if(test_float) + test_trigamma(0.0f, "float"); + if(test_double) + test_trigamma(0.0, "double"); + if(test_long_double) + test_trigamma(0.0L, "long double"); +#ifdef BOOST_MATH_USE_FLOAT128 + //test_trigamma(0.0Q, "__float128"); +#endif + + +#endif +} + diff --git a/src/boost/libs/math/reporting/accuracy/test_zeta.cpp b/src/boost/libs/math/reporting/accuracy/test_zeta.cpp new file mode 100644 index 00000000..619d4350 --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/test_zeta.cpp @@ -0,0 +1,63 @@ +// Copyright John Maddock 2006-15. +// Copyright Paul A. Bristow 2007 +// 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 "bindings.hpp" +#include "../../test/test_zeta.hpp" +#include + +BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(test_main, 10000); + +BOOST_AUTO_TEST_CASE(test_main) +{ + BOOST_MATH_CONTROL_FP; + + error_stream_replacer rep; + +#ifdef TYPE_TO_TEST + + test_zeta(static_cast(0), NAME_OF_TYPE_TO_TEST); + +#else + bool test_float = false; + bool test_double = false; + bool test_long_double = false; + + if(std::numeric_limits::digits == std::numeric_limits::digits) + { + // + // Don't bother with long double, it's the same as double: + // + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + test_double = true; + } + else + { + if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false) + test_float = true; + if(BOOST_MATH_PROMOTE_DOUBLE_POLICY == false) + test_double = true; + test_long_double = true; + } + +#ifdef ALWAYS_TEST_DOUBLE + test_double = true; +#endif + + if(test_float) + test_zeta(0.0f, "float"); + if(test_double) + test_zeta(0.0, "double"); + if(test_long_double) + test_zeta(0.0L, "long double"); +#ifdef BOOST_MATH_USE_FLOAT128 + //test_zeta(0.0Q, "__float128"); +#endif + + +#endif +} + diff --git a/src/boost/libs/math/reporting/accuracy/third_party/cephes_double/readme.txt b/src/boost/libs/math/reporting/accuracy/third_party/cephes_double/readme.txt new file mode 100644 index 00000000..f5f49d0b --- /dev/null +++ b/src/boost/libs/math/reporting/accuracy/third_party/cephes_double/readme.txt @@ -0,0 +1,7 @@ +Place the source for the Cephes double precision library here if you want bjam to +build and test it when reporting accuracy results. + +Copyright 2015 John Maddock and Paul A. Bristow. +Distributed under 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). diff --git a/src/boost/libs/math/reporting/performance/Jamfile.v2 b/src/boost/libs/math/reporting/performance/Jamfile.v2 new file mode 100644 index 00000000..42ff1019 --- /dev/null +++ b/src/boost/libs/math/reporting/performance/Jamfile.v2 @@ -0,0 +1,188 @@ +# Copyright Daryle Walker, Hubert Holin, John Maddock 2006 - 2007 +# copyright Paul A. Bristow 2006 - 2010 +# Distributed under 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. +# \math_toolkit\libs\math\test\jamfile.v2 +# Runs all math toolkit tests, functions & distributions, +# and build math examples. + +# bring in the rules for testing +import testing ; +import modules ; +import path ; +import pch ; +import ../../../config/checks/config : requires ; +using quickbook ; +using auto-index ; + +import ../../../predef/check/predef + : check require + : predef-check predef-require ; + +project + : requirements + ../../include_private + ; + +if $(is_unix) +{ + local osname = [ SHELL uname ] ; + + switch $(osname) + { + case "Sun*" : OTHERFLAGS = "-lpthread -lrt" ; + case "*BSD*" : OTHERFLAGS = "-lpthread" ; + } +} + +# +# Configuration first: +# +lib gsl ; +lib gslcblas ; +lib Rmath ; +obj has_libstdcxx_tr1 : has_libstdcxx_tr1.cpp ; +explicit has_libstdcxx_tr1 ; +obj has_c99_cmath : has_c99_cmath.cpp ; +explicit has_c99_cmath ; +exe has_gsl : has_gsl.cpp gsl gslcblas ; +explicit has_gsl ; +exe has_rmath : has_rmath.cpp Rmath ; +explicit has_rmath ; +obj is_intel_win : is_intel_win.cpp ; +explicit is_intel_win ; + +CEPHES_SOURCE = acosh.c airy.c asin.c asinh.c atan.c atanh.c bdtr.c beta.c +btdtr.c cbrt.c chbevl.c chdtr.c clog.c cmplx.c const.c +cosh.c dawsn.c drand.c ei.c ellie.c ellik.c ellpe.c ellpj.c ellpk.c +exp.c exp10.c exp2.c expn.c expx2.c fabs.c fac.c fdtr.c +fresnl.c gamma.c gdtr.c hyp2f1.c hyperg.c i0.c i1.c igami.c incbet.c +incbi.c igam.c isnan.c iv.c j0.c j1.c jn.c jv.c k0.c k1.c kn.c kolmogorov.c +log.c log2.c log10.c lrand.c nbdtr.c ndtr.c ndtri.c pdtr.c planck.c +polevl.c polmisc.c polylog.c polyn.c pow.c powi.c psi.c rgamma.c round.c +shichi.c sici.c sin.c sindg.c sinh.c spence.c stdtr.c struve.c +tan.c tandg.c tanh.c unity.c yn.c zeta.c zetac.c +sqrt.c floor.c setprec.c mtherr.c ; + +DCDFLIB_SOURCE = dcdflib.c ipmpar.c ; + +path-constant here : . ; +make $(here)/third_party/cephes_double/acosh.c : : @check_exists ; +make $(here)/third_party/dcdflib/dcdflib.c : : @check_exists ; +actions check_exists +{ + stat $(<) +} +explicit $(here)/third_party/cephes_double/acosh.c ; +explicit $(here)/third_party/dcdflib/dcdflib.c ; + +lib cephes_double : $(here)/third_party/cephes_double/$(CEPHES_SOURCE) + : + release + static + [ check-target-builds $(here)/third_party/cephes_double/acosh.c : : no ] + ; + +explicit cephes_double ; + +lib dcdflib : $(here)/third_party/dcdflib/$(DCDFLIB_SOURCE) + : + release + static + [ check-target-builds $(here)/third_party/dcdflib/dcdflib.c : : no ] + ; + +explicit dcdflib ; + +obj table_helper : table_helper.cpp ; + +rule all-tests { + local result ; + for local source in [ glob test*.cpp ] + { + result += [ run $(source) /boost/regex//boost_regex /boost/system /boost/chrono /boost/filesystem table_helper + : : : release ../../test + [ check-target-builds ../accuracy//has_c99_cmath : TEST_C99 ] + [ check-target-builds ../accuracy//has_libstdcxx_tr1 : TEST_LIBSTDCXX ] + [ check-target-builds ../accuracy//has_gsl : TEST_GSL gsl gslcblas ] + [ check-target-builds ../accuracy//has_rmath : TEST_RMATH Rmath ] + # [ check-target-builds is_intel_win : no : ] + [ check-target-builds $(here)/third_party/dcdflib/dcdflib.c : TEST_DCDFLIB dcdflib ] + linux:-lpthread linux:-lrt + #msvc:64 + ] ; + } + return $(result) ; +} + +# +# Special cases to test different compiler options, +# cbrt first as an example of a trivial function: +# +run test_cbrt.cpp /boost/regex//boost_regex /boost/system /boost/chrono /boost/filesystem table_helper + : : : debug COMPILER_COMPARISON_TABLES [ predef-require "BOOST_COMP_MSVC" ] 32 : test_cbrt_msvc_debug ; +run test_cbrt.cpp /boost/regex//boost_regex /boost/system /boost/chrono /boost/filesystem table_helper + : : : release COMPILER_COMPARISON_TABLES [ predef-require "BOOST_COMP_MSVC" ] -Ox 32 : test_cbrt_msvc_release_32 ; +run test_cbrt.cpp /boost/regex//boost_regex /boost/system /boost/chrono /boost/filesystem table_helper + : : : release COMPILER_COMPARISON_TABLES [ predef-require "BOOST_COMP_MSVC" ] -Ox 64 : test_cbrt_msvc_release_64 ; +run test_cbrt.cpp /boost/regex//boost_regex /boost/system /boost/chrono /boost/filesystem table_helper + : : : release COMPILER_COMPARISON_TABLES [ check-target-builds is_intel_win : : no ] intel:-Ox 64 : test_cbrt_intel_release ; +# +# Now jn as a little more complex: +# +run test_jn.cpp /boost/regex//boost_regex /boost/system /boost/chrono /boost/filesystem table_helper + : : : debug COMPILER_COMPARISON_TABLES ../../test [ predef-require "BOOST_COMP_MSVC" ] 32 : test_jn_msvc_debug ; +run test_jn.cpp /boost/regex//boost_regex /boost/system /boost/chrono /boost/filesystem table_helper + : : : release COMPILER_COMPARISON_TABLES ../../test [ predef-require "BOOST_COMP_MSVC" ] -Ox 32 : test_jn_msvc_release_32 ; +run test_jn.cpp /boost/regex//boost_regex /boost/system /boost/chrono /boost/filesystem table_helper + : : : release COMPILER_COMPARISON_TABLES ../../test [ predef-require "BOOST_COMP_MSVC" ] -Ox 64 : test_jn_msvc_release_64 ; +run test_jn.cpp /boost/regex//boost_regex /boost/system /boost/chrono /boost/filesystem table_helper + : : : release COMPILER_COMPARISON_TABLES ../../test [ check-target-builds is_intel_win : : no ] 64 : test_jn_intel_release ; +# +# Then something really expensive, like the inverse-incomplete-beta: +# +run test_ibeta_inv.cpp /boost/regex//boost_regex /boost/system /boost/chrono /boost/filesystem table_helper + : : : debug COMPILER_COMPARISON_TABLES ../../test [ predef-require "BOOST_COMP_MSVC" ] 32 : test_ibeta_inv_msvc_debug ; +run test_ibeta_inv.cpp /boost/regex//boost_regex /boost/system /boost/chrono /boost/filesystem table_helper + : : : release COMPILER_COMPARISON_TABLES ../../test [ predef-require "BOOST_COMP_MSVC" ] -Ox 32 : test_ibeta_inv_msvc_release_32 ; +run test_ibeta_inv.cpp /boost/regex//boost_regex /boost/system /boost/chrono /boost/filesystem table_helper + : : : release COMPILER_COMPARISON_TABLES ../../test [ predef-require "BOOST_COMP_MSVC" ] -Ox 64 : test_ibeta_inv_msvc_release_64 ; +run test_ibeta_inv.cpp /boost/regex//boost_regex /boost/system /boost/chrono /boost/filesystem table_helper + : : : release COMPILER_COMPARISON_TABLES ../../test [ check-target-builds is_intel_win : : no ] intel:-Ox 64 : test_ibeta_inv_intel_release ; + +test-suite report_gen : [ all-tests ] test_cbrt_msvc_debug test_cbrt_msvc_release_32 test_cbrt_msvc_release_64 test_cbrt_intel_release + test_jn_msvc_debug test_jn_msvc_release_32 test_jn_msvc_release_64 test_jn_intel_release test_ibeta_inv_msvc_debug + test_ibeta_inv_msvc_release_32 test_ibeta_inv_msvc_release_64 test_ibeta_inv_intel_release ; + +path-constant images_location : html ; +path-constant here : . ; + +xml report : doc/report.qbk : report_gen ; +boostbook standalone + : + report + : + # Path for links to Boost: + boost.root=../../../../.. + + # Some general style settings: + table.footnote.number.format=1 + footnote.number.format=1 + html.stylesheet=boostbook.css + + # HTML options first: + # Use graphics not text for navigation: + navig.graphics=1 + # How far down we chunk nested sections, basically all of them: + chunk.section.depth=0 + # Don't put the first section on the same page as the TOC: + chunk.first.sections=0 + # How far down sections get TOC's + toc.section.depth=2 + # Max depth in each TOC: + toc.max.depth=4 + # How far down we go with TOC's + generate.section.toc.level=10 + ; + diff --git a/src/boost/libs/math/reporting/performance/fibonacci.hpp b/src/boost/libs/math/reporting/performance/fibonacci.hpp new file mode 100644 index 00000000..f6be1f8d --- /dev/null +++ b/src/boost/libs/math/reporting/performance/fibonacci.hpp @@ -0,0 +1,1245 @@ +// Copyright (c) 2015 John Maddock +// 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) + +#pragma once + +#include +#include +#include + +template +std::vector const& fibonacci_numbers(const boost::mpl::int_<16>&) +{ + static const boost::uint16_t numbers[] = { + static_cast(21u), + static_cast(34u), + static_cast(55u), + static_cast(89u), + static_cast(144u), + static_cast(233u), + static_cast(377u), + static_cast(610u), + static_cast(987u), + static_cast(1597u), + static_cast(2584u), + static_cast(4181u), + static_cast(6765u), + static_cast(17711u), + static_cast(10946u), + static_cast(17711u), + static_cast(28657u), + static_cast(46368u) + }; + static const std::vector data(numbers, numbers + sizeof(numbers) / sizeof(numbers[0])); + + return data; +} + +template +std::vector const& fibonacci_numbers(const boost::mpl::int_<32>&) +{ + static const boost::uint32_t numbers[] = { + 21u, + 34u, + 55u, + 89u, + 144u, + 233u, + 377u, + 610u, + 987u, + 1597u, + 2584u, + 4181u, + 6765u, + 10946u, + 17711u, + 28657u, + 46368u, + 75025u, + 121393u, + 196418u, + 317811u, + 514229u, + 832040u, + 1346269u, + 2178309u, + 3524578u, + 5702887u, + 9227465u, + 14930352u, + 24157817u, + 39088169u, + 63245986u, + 102334155u, + 165580141u, + 267914296u, + 433494437u, + 701408733u, + 1134903170u, + 1836311903u, + 2971215073u + }; + static const std::vector data(numbers, numbers + sizeof(numbers) / sizeof(numbers[0])); + + return data; +} + +template +std::vector const& fibonacci_numbers(const boost::mpl::int_<64>&) +{ + static const boost::uint64_t numbers[] = { + 21uLL, + 34uLL, + 55uLL, + 89uLL, + 144uLL, + 233uLL, + 377uLL, + 610uLL, + 987uLL, + 1597uLL, + 2584uLL, + 4181uLL, + 6765uLL, + 10946uLL, + 17711uLL, + 28657uLL, + 46368uLL, + 75025uLL, + 121393uLL, + 196418uLL, + 317811uLL, + 514229uLL, + 832040uLL, + 1346269uLL, + 2178309uLL, + 3524578uLL, + 5702887uLL, + 9227465uLL, + 14930352uLL, + 24157817uLL, + 39088169uLL, + 63245986uLL, + 102334155uLL, + 165580141uLL, + 267914296uLL, + 433494437uLL, + 701408733uLL, + 1134903170uLL, + 1836311903uLL, + 2971215073uLL, + 4807526976uLL, + 7778742049uLL, + 12586269025uLL, + 20365011074uLL, + 32951280099uLL, + 53316291173uLL, + 86267571272uLL, + 139583862445uLL, + 225851433717uLL, + 365435296162uLL, + 591286729879uLL, + 956722026041uLL, + 1548008755920uLL, + 2504730781961uLL, + 4052739537881uLL, + 6557470319842uLL, + 10610209857723uLL, + 17167680177565uLL, + 27777890035288uLL, + 44945570212853uLL, + 72723460248141uLL, + 117669030460994uLL, + 190392490709135uLL, + 308061521170129uLL, + 498454011879264uLL, + 806515533049393uLL, + 1304969544928657uLL, + 2111485077978050uLL, + 3416454622906707uLL, + 5527939700884757uLL, + 8944394323791464uLL, + 14472334024676221uLL, + 23416728348467685uLL, + 37889062373143906uLL, + 61305790721611591uLL, + 99194853094755497uLL, + 160500643816367088uLL, + 259695496911122585uLL, + 420196140727489673uLL, + 679891637638612258uLL, + 1100087778366101931uLL, + 1779979416004714189uLL, + 2880067194370816120uLL, + 4660046610375530309uLL, + 7540113804746346429uLL, + 12200160415121876738uLL, + }; + static const std::vector data(numbers, numbers + sizeof(numbers) / sizeof(numbers[0])); + + return data; +} + +template +std::vector const& fibonacci_numbers(const boost::mpl::int_<0>&) +{ + static const T numbers[] = { + boost::lexical_cast("21"), + boost::lexical_cast("34"), + boost::lexical_cast("55"), + boost::lexical_cast("89"), + boost::lexical_cast("144"), + boost::lexical_cast("233"), + boost::lexical_cast("377"), + boost::lexical_cast("610"), + boost::lexical_cast("987"), + boost::lexical_cast("1597"), + boost::lexical_cast("2584"), + boost::lexical_cast("4181"), + boost::lexical_cast("6765"), + boost::lexical_cast("10946"), + boost::lexical_cast("17711"), + boost::lexical_cast("28657"), + boost::lexical_cast("46368"), + boost::lexical_cast("75025"), + boost::lexical_cast("121393"), + boost::lexical_cast("196418"), + boost::lexical_cast("317811"), + boost::lexical_cast("514229"), + boost::lexical_cast("832040"), + boost::lexical_cast("1346269"), + boost::lexical_cast("2178309"), + boost::lexical_cast("3524578"), + boost::lexical_cast("5702887"), + boost::lexical_cast("9227465"), + boost::lexical_cast("14930352"), + boost::lexical_cast("24157817"), + boost::lexical_cast("39088169"), + boost::lexical_cast("63245986"), + boost::lexical_cast("102334155"), + boost::lexical_cast("165580141"), + boost::lexical_cast("267914296"), + boost::lexical_cast("433494437"), + boost::lexical_cast("701408733"), + boost::lexical_cast("1134903170"), + boost::lexical_cast("1836311903"), + boost::lexical_cast("2971215073"), + // 64-bit: + boost::lexical_cast("4807526976"), + boost::lexical_cast("7778742049"), + boost::lexical_cast("12586269025"), + boost::lexical_cast("20365011074"), + boost::lexical_cast("32951280099"), + boost::lexical_cast("53316291173"), + boost::lexical_cast("86267571272"), + boost::lexical_cast("139583862445"), + boost::lexical_cast("225851433717"), + boost::lexical_cast("365435296162"), + boost::lexical_cast("591286729879"), + boost::lexical_cast("956722026041"), + boost::lexical_cast("1548008755920"), + boost::lexical_cast("2504730781961"), + boost::lexical_cast("4052739537881"), + boost::lexical_cast("6557470319842"), + boost::lexical_cast("10610209857723"), + boost::lexical_cast("17167680177565"), + boost::lexical_cast("27777890035288"), + boost::lexical_cast("44945570212853"), + boost::lexical_cast("72723460248141"), + boost::lexical_cast("117669030460994"), + boost::lexical_cast("190392490709135"), + boost::lexical_cast("308061521170129"), + boost::lexical_cast("498454011879264"), + boost::lexical_cast("806515533049393"), + boost::lexical_cast("1304969544928657"), + boost::lexical_cast("2111485077978050"), + boost::lexical_cast("3416454622906707"), + boost::lexical_cast("5527939700884757"), + boost::lexical_cast("8944394323791464"), + boost::lexical_cast("14472334024676221"), + boost::lexical_cast("23416728348467685"), + boost::lexical_cast("37889062373143906"), + boost::lexical_cast("61305790721611591"), + boost::lexical_cast("99194853094755497"), + boost::lexical_cast("160500643816367088"), + boost::lexical_cast("259695496911122585"), + boost::lexical_cast("420196140727489673"), + boost::lexical_cast("679891637638612258"), + boost::lexical_cast("1100087778366101931"), + boost::lexical_cast("1779979416004714189"), + boost::lexical_cast("2880067194370816120"), + boost::lexical_cast("4660046610375530309"), + boost::lexical_cast("7540113804746346429"), + boost::lexical_cast("12200160415121876738"), + // 128-bit: + boost::lexical_cast("19740274219868223167"), + boost::lexical_cast("31940434634990099905"), + boost::lexical_cast("51680708854858323072"), + boost::lexical_cast("83621143489848422977"), + boost::lexical_cast("135301852344706746049"), + boost::lexical_cast("218922995834555169026"), + boost::lexical_cast("354224848179261915075"), + boost::lexical_cast("573147844013817084101"), + boost::lexical_cast("927372692193078999176"), + boost::lexical_cast("1500520536206896083277"), + boost::lexical_cast("2427893228399975082453"), + boost::lexical_cast("3928413764606871165730"), + boost::lexical_cast("6356306993006846248183"), + boost::lexical_cast("10284720757613717413913"), + boost::lexical_cast("16641027750620563662096"), + boost::lexical_cast("26925748508234281076009"), + boost::lexical_cast("43566776258854844738105"), + boost::lexical_cast("70492524767089125814114"), + boost::lexical_cast("114059301025943970552219"), + boost::lexical_cast("184551825793033096366333"), + boost::lexical_cast("298611126818977066918552"), + boost::lexical_cast("483162952612010163284885"), + boost::lexical_cast("781774079430987230203437"), + boost::lexical_cast("1264937032042997393488322"), + boost::lexical_cast("2046711111473984623691759"), + boost::lexical_cast("3311648143516982017180081"), + boost::lexical_cast("5358359254990966640871840"), + boost::lexical_cast("8670007398507948658051921"), + boost::lexical_cast("14028366653498915298923761"), + boost::lexical_cast("22698374052006863956975682"), + boost::lexical_cast("36726740705505779255899443"), + boost::lexical_cast("59425114757512643212875125"), + boost::lexical_cast("96151855463018422468774568"), + boost::lexical_cast("155576970220531065681649693"), + boost::lexical_cast("251728825683549488150424261"), + boost::lexical_cast("407305795904080553832073954"), + boost::lexical_cast("659034621587630041982498215"), + boost::lexical_cast("1066340417491710595814572169"), + boost::lexical_cast("1725375039079340637797070384"), + boost::lexical_cast("2791715456571051233611642553"), + boost::lexical_cast("4517090495650391871408712937"), + boost::lexical_cast("7308805952221443105020355490"), + boost::lexical_cast("11825896447871834976429068427"), + boost::lexical_cast("19134702400093278081449423917"), + boost::lexical_cast("30960598847965113057878492344"), + boost::lexical_cast("50095301248058391139327916261"), + boost::lexical_cast("81055900096023504197206408605"), + boost::lexical_cast("131151201344081895336534324866"), + boost::lexical_cast("212207101440105399533740733471"), + boost::lexical_cast("343358302784187294870275058337"), + boost::lexical_cast("555565404224292694404015791808"), + boost::lexical_cast("898923707008479989274290850145"), + boost::lexical_cast("1454489111232772683678306641953"), + boost::lexical_cast("2353412818241252672952597492098"), + boost::lexical_cast("3807901929474025356630904134051"), + boost::lexical_cast("6161314747715278029583501626149"), + boost::lexical_cast("9969216677189303386214405760200"), + boost::lexical_cast("16130531424904581415797907386349"), + boost::lexical_cast("26099748102093884802012313146549"), + boost::lexical_cast("42230279526998466217810220532898"), + boost::lexical_cast("68330027629092351019822533679447"), + boost::lexical_cast("110560307156090817237632754212345"), + boost::lexical_cast("178890334785183168257455287891792"), + boost::lexical_cast("289450641941273985495088042104137"), + boost::lexical_cast("468340976726457153752543329995929"), + boost::lexical_cast("757791618667731139247631372100066"), + boost::lexical_cast("1226132595394188293000174702095995"), + boost::lexical_cast("1983924214061919432247806074196061"), + boost::lexical_cast("3210056809456107725247980776292056"), + boost::lexical_cast("5193981023518027157495786850488117"), + boost::lexical_cast("8404037832974134882743767626780173"), + boost::lexical_cast("13598018856492162040239554477268290"), + boost::lexical_cast("22002056689466296922983322104048463"), + boost::lexical_cast("35600075545958458963222876581316753"), + boost::lexical_cast("57602132235424755886206198685365216"), + boost::lexical_cast("93202207781383214849429075266681969"), + boost::lexical_cast("150804340016807970735635273952047185"), + boost::lexical_cast("244006547798191185585064349218729154"), + boost::lexical_cast("394810887814999156320699623170776339"), + boost::lexical_cast("638817435613190341905763972389505493"), + boost::lexical_cast("1033628323428189498226463595560281832"), + boost::lexical_cast("1672445759041379840132227567949787325"), + boost::lexical_cast("2706074082469569338358691163510069157"), + boost::lexical_cast("4378519841510949178490918731459856482"), + boost::lexical_cast("7084593923980518516849609894969925639"), + boost::lexical_cast("11463113765491467695340528626429782121"), + boost::lexical_cast("18547707689471986212190138521399707760"), + boost::lexical_cast("30010821454963453907530667147829489881"), + boost::lexical_cast("48558529144435440119720805669229197641"), + boost::lexical_cast("78569350599398894027251472817058687522"), + boost::lexical_cast("127127879743834334146972278486287885163"), + boost::lexical_cast("205697230343233228174223751303346572685"), + boost::lexical_cast("332825110087067562321196029789634457848"), + boost::lexical_cast("538522340430300790495419781092981030533"), + boost::lexical_cast("871347450517368352816615810882615488381"), + boost::lexical_cast("1409869790947669143312035591975596518914"), + boost::lexical_cast("2281217241465037496128651402858212007295"), + boost::lexical_cast("3691087032412706639440686994833808526209"), + boost::lexical_cast("5972304273877744135569338397692020533504"), + boost::lexical_cast("9663391306290450775010025392525829059713"), + boost::lexical_cast("15635695580168194910579363790217849593217"), + boost::lexical_cast("25299086886458645685589389182743678652930"), + boost::lexical_cast("40934782466626840596168752972961528246147"), + boost::lexical_cast("66233869353085486281758142155705206899077"), + boost::lexical_cast("107168651819712326877926895128666735145224"), + boost::lexical_cast("173402521172797813159685037284371942044301"), + boost::lexical_cast("280571172992510140037611932413038677189525"), + boost::lexical_cast("453973694165307953197296969697410619233826"), + boost::lexical_cast("734544867157818093234908902110449296423351"), + boost::lexical_cast("1188518561323126046432205871807859915657177"), + boost::lexical_cast("1923063428480944139667114773918309212080528"), + boost::lexical_cast("3111581989804070186099320645726169127737705"), + boost::lexical_cast("5034645418285014325766435419644478339818233"), + boost::lexical_cast("8146227408089084511865756065370647467555938"), + boost::lexical_cast("13180872826374098837632191485015125807374171"), + boost::lexical_cast("21327100234463183349497947550385773274930109"), + boost::lexical_cast("34507973060837282187130139035400899082304280"), + boost::lexical_cast("55835073295300465536628086585786672357234389"), + boost::lexical_cast("90343046356137747723758225621187571439538669"), + boost::lexical_cast("146178119651438213260386312206974243796773058"), + boost::lexical_cast("236521166007575960984144537828161815236311727"), + boost::lexical_cast("382699285659014174244530850035136059033084785"), + boost::lexical_cast("619220451666590135228675387863297874269396512"), + boost::lexical_cast("1001919737325604309473206237898433933302481297"), + boost::lexical_cast("1621140188992194444701881625761731807571877809"), + boost::lexical_cast("2623059926317798754175087863660165740874359106"), + boost::lexical_cast("4244200115309993198876969489421897548446236915"), + boost::lexical_cast("6867260041627791953052057353082063289320596021"), + boost::lexical_cast("11111460156937785151929026842503960837766832936"), + boost::lexical_cast("17978720198565577104981084195586024127087428957"), + boost::lexical_cast("29090180355503362256910111038089984964854261893"), + boost::lexical_cast("47068900554068939361891195233676009091941690850"), + boost::lexical_cast("76159080909572301618801306271765994056795952743"), + boost::lexical_cast("123227981463641240980692501505442003148737643593"), + boost::lexical_cast("199387062373213542599493807777207997205533596336"), + boost::lexical_cast("322615043836854783580186309282650000354271239929"), + boost::lexical_cast("522002106210068326179680117059857997559804836265"), + boost::lexical_cast("844617150046923109759866426342507997914076076194"), + boost::lexical_cast("1366619256256991435939546543402365995473880912459"), + boost::lexical_cast("2211236406303914545699412969744873993387956988653"), + boost::lexical_cast("3577855662560905981638959513147239988861837901112"), + boost::lexical_cast("5789092068864820527338372482892113982249794889765"), + boost::lexical_cast("9366947731425726508977331996039353971111632790877"), + boost::lexical_cast("15156039800290547036315704478931467953361427680642"), + boost::lexical_cast("24522987531716273545293036474970821924473060471519"), + boost::lexical_cast("39679027332006820581608740953902289877834488152161"), + boost::lexical_cast("64202014863723094126901777428873111802307548623680"), + boost::lexical_cast("103881042195729914708510518382775401680142036775841"), + boost::lexical_cast("168083057059453008835412295811648513482449585399521"), + boost::lexical_cast("271964099255182923543922814194423915162591622175362"), + boost::lexical_cast("440047156314635932379335110006072428645041207574883"), + boost::lexical_cast("712011255569818855923257924200496343807632829750245"), + boost::lexical_cast("1152058411884454788302593034206568772452674037325128"), + boost::lexical_cast("1864069667454273644225850958407065116260306867075373"), + boost::lexical_cast("3016128079338728432528443992613633888712980904400501"), + boost::lexical_cast("4880197746793002076754294951020699004973287771475874"), + boost::lexical_cast("7896325826131730509282738943634332893686268675876375"), + boost::lexical_cast("12776523572924732586037033894655031898659556447352249"), + boost::lexical_cast("20672849399056463095319772838289364792345825123228624"), + boost::lexical_cast("33449372971981195681356806732944396691005381570580873"), + boost::lexical_cast("54122222371037658776676579571233761483351206693809497"), + boost::lexical_cast("87571595343018854458033386304178158174356588264390370"), + boost::lexical_cast("141693817714056513234709965875411919657707794958199867"), + boost::lexical_cast("229265413057075367692743352179590077832064383222590237"), + boost::lexical_cast("370959230771131880927453318055001997489772178180790104"), + boost::lexical_cast("600224643828207248620196670234592075321836561403380341"), + boost::lexical_cast("971183874599339129547649988289594072811608739584170445"), + boost::lexical_cast("1571408518427546378167846658524186148133445300987550786"), + boost::lexical_cast("2542592393026885507715496646813780220945054040571721231"), + boost::lexical_cast("4114000911454431885883343305337966369078499341559272017"), + boost::lexical_cast("6656593304481317393598839952151746590023553382130993248"), + boost::lexical_cast("10770594215935749279482183257489712959102052723690265265"), + boost::lexical_cast("17427187520417066673081023209641459549125606105821258513"), + boost::lexical_cast("28197781736352815952563206467131172508227658829511523778"), + boost::lexical_cast("45624969256769882625644229676772632057353264935332782291"), + boost::lexical_cast("73822750993122698578207436143903804565580923764844306069"), + boost::lexical_cast("119447720249892581203851665820676436622934188700177088360"), + boost::lexical_cast("193270471243015279782059101964580241188515112465021394429"), + boost::lexical_cast("312718191492907860985910767785256677811449301165198482789"), + boost::lexical_cast("505988662735923140767969869749836918999964413630219877218"), + boost::lexical_cast("818706854228831001753880637535093596811413714795418360007"), + boost::lexical_cast("1324695516964754142521850507284930515811378128425638237225"), + boost::lexical_cast("2143402371193585144275731144820024112622791843221056597232"), + boost::lexical_cast("3468097888158339286797581652104954628434169971646694834457"), + boost::lexical_cast("5611500259351924431073312796924978741056961814867751431689"), + boost::lexical_cast("9079598147510263717870894449029933369491131786514446266146"), + boost::lexical_cast("14691098406862188148944207245954912110548093601382197697835"), + boost::lexical_cast("23770696554372451866815101694984845480039225387896643963981"), + boost::lexical_cast("38461794961234640015759308940939757590587318989278841661816"), + boost::lexical_cast("62232491515607091882574410635924603070626544377175485625797"), + boost::lexical_cast("100694286476841731898333719576864360661213863366454327287613"), + boost::lexical_cast("162926777992448823780908130212788963731840407743629812913410"), + boost::lexical_cast("263621064469290555679241849789653324393054271110084140201023"), + boost::lexical_cast("426547842461739379460149980002442288124894678853713953114433"), + boost::lexical_cast("690168906931029935139391829792095612517948949963798093315456"), + boost::lexical_cast("1116716749392769314599541809794537900642843628817512046429889"), + boost::lexical_cast("1806885656323799249738933639586633513160792578781310139745345"), + boost::lexical_cast("2923602405716568564338475449381171413803636207598822186175234"), + boost::lexical_cast("4730488062040367814077409088967804926964428786380132325920579"), + boost::lexical_cast("7654090467756936378415884538348976340768064993978954512095813"), + boost::lexical_cast("12384578529797304192493293627316781267732493780359086838016392"), + boost::lexical_cast("20038668997554240570909178165665757608500558774338041350112205"), + boost::lexical_cast("32423247527351544763402471792982538876233052554697128188128597"), + boost::lexical_cast("52461916524905785334311649958648296484733611329035169538240802"), + boost::lexical_cast("84885164052257330097714121751630835360966663883732297726369399"), + boost::lexical_cast("137347080577163115432025771710279131845700275212767467264610201"), + boost::lexical_cast("222232244629420445529739893461909967206666939096499764990979600"), + boost::lexical_cast("359579325206583560961765665172189099052367214309267232255589801"), + boost::lexical_cast("581811569836004006491505558634099066259034153405766997246569401"), + boost::lexical_cast("941390895042587567453271223806288165311401367715034229502159202"), + boost::lexical_cast("1523202464878591573944776782440387231570435521120801226748728603"), + boost::lexical_cast("2464593359921179141398048006246675396881836888835835456250887805"), + boost::lexical_cast("3987795824799770715342824788687062628452272409956636682999616408"), + boost::lexical_cast("6452389184720949856740872794933738025334109298792472139250504213"), + boost::lexical_cast("10440185009520720572083697583620800653786381708749108822250120621"), + boost::lexical_cast("16892574194241670428824570378554538679120491007541580961500624834"), + boost::lexical_cast("27332759203762391000908267962175339332906872716290689783750745455"), + boost::lexical_cast("44225333398004061429732838340729878012027363723832270745251370289"), + boost::lexical_cast("71558092601766452430641106302905217344934236440122960529002115744"), + boost::lexical_cast("115783425999770513860373944643635095356961600163955231274253486033"), + boost::lexical_cast("187341518601536966291015050946540312701895836604078191803255601777"), + boost::lexical_cast("303124944601307480151388995590175408058857436768033423077509087810"), + boost::lexical_cast("490466463202844446442404046536715720760753273372111614880764689587"), + boost::lexical_cast("793591407804151926593793042126891128819610710140145037958273777397"), + boost::lexical_cast("1284057871006996373036197088663606849580363983512256652839038466984"), + boost::lexical_cast("2077649278811148299629990130790497978399974693652401690797312244381"), + boost::lexical_cast("3361707149818144672666187219454104827980338677164658343636350711365"), + boost::lexical_cast("5439356428629292972296177350244602806380313370817060034433662955746"), + boost::lexical_cast("8801063578447437644962364569698707634360652047981718378070013667111"), + boost::lexical_cast("14240420007076730617258541919943310440740965418798778412503676622857"), + boost::lexical_cast("23041483585524168262220906489642018075101617466780496790573690289968"), + boost::lexical_cast("37281903592600898879479448409585328515842582885579275203077366912825"), + boost::lexical_cast("60323387178125067141700354899227346590944200352359771993651057202793"), + boost::lexical_cast("97605290770725966021179803308812675106786783237939047196728424115618"), + boost::lexical_cast("157928677948851033162880158208040021697730983590298819190379481318411"), + boost::lexical_cast("255533968719576999184059961516852696804517766828237866387107905434029"), + boost::lexical_cast("413462646668428032346940119724892718502248750418536685577487386752440"), + boost::lexical_cast("668996615388005031531000081241745415306766517246774551964595292186469"), + boost::lexical_cast("1082459262056433063877940200966638133809015267665311237542082678938909"), + boost::lexical_cast("1751455877444438095408940282208383549115781784912085789506677971125378"), + boost::lexical_cast("2833915139500871159286880483175021682924797052577397027048760650064287"), + boost::lexical_cast("4585371016945309254695820765383405232040578837489482816555438621189665"), + boost::lexical_cast("7419286156446180413982701248558426914965375890066879843604199271253952"), + boost::lexical_cast("12004657173391489668678522013941832147005954727556362660159637892443617"), + boost::lexical_cast("19423943329837670082661223262500259061971330617623242503763837163697569"), + boost::lexical_cast("31428600503229159751339745276442091208977285345179605163923475056141186"), + boost::lexical_cast("50852543833066829834000968538942350270948615962802847667687312219838755"), + boost::lexical_cast("82281144336295989585340713815384441479925901307982452831610787275979941"), + boost::lexical_cast("133133688169362819419341682354326791750874517270785300499298099495818696"), + boost::lexical_cast("215414832505658809004682396169711233230800418578767753330908886771798637"), + boost::lexical_cast("348548520675021628424024078524038024981674935849553053830206986267617333"), + boost::lexical_cast("563963353180680437428706474693749258212475354428320807161115873039415970"), + boost::lexical_cast("912511873855702065852730553217787283194150290277873860991322859307033303"), + boost::lexical_cast("1476475227036382503281437027911536541406625644706194668152438732346449273"), + boost::lexical_cast("2388987100892084569134167581129323824600775934984068529143761591653482576"), + boost::lexical_cast("3865462327928467072415604609040860366007401579690263197296200323999931849"), + boost::lexical_cast("6254449428820551641549772190170184190608177514674331726439961915653414425"), + boost::lexical_cast("10119911756749018713965376799211044556615579094364594923736162239653346274"), + boost::lexical_cast("16374361185569570355515148989381228747223756609038926650176124155306760699"), + boost::lexical_cast("26494272942318589069480525788592273303839335703403521573912286394960106973"), + boost::lexical_cast("42868634127888159424995674777973502051063092312442448224088410550266867672"), + boost::lexical_cast("69362907070206748494476200566565775354902428015845969798000696945226974645"), + boost::lexical_cast("112231541198094907919471875344539277405965520328288418022089107495493842317"), + boost::lexical_cast("181594448268301656413948075911105052760867948344134387820089804440720816962"), + boost::lexical_cast("293825989466396564333419951255644330166833468672422805842178911936214659279"), + boost::lexical_cast("475420437734698220747368027166749382927701417016557193662268716376935476241"), + boost::lexical_cast("769246427201094785080787978422393713094534885688979999504447628313150135520"), + boost::lexical_cast("1244666864935793005828156005589143096022236302705537193166716344690085611761"), + boost::lexical_cast("2013913292136887790908943984011536809116771188394517192671163973003235747281"), + boost::lexical_cast("3258580157072680796737099989600679905139007491100054385837880317693321359042"), + boost::lexical_cast("5272493449209568587646043973612216714255778679494571578509044290696557106323"), + boost::lexical_cast("8531073606282249384383143963212896619394786170594625964346924608389878465365"), + boost::lexical_cast("13803567055491817972029187936825113333650564850089197542855968899086435571688"), + boost::lexical_cast("22334640661774067356412331900038009953045351020683823507202893507476314037053"), + boost::lexical_cast("36138207717265885328441519836863123286695915870773021050058862406562749608741"), + boost::lexical_cast("58472848379039952684853851736901133239741266891456844557261755914039063645794"), + boost::lexical_cast("94611056096305838013295371573764256526437182762229865607320618320601813254535"), + boost::lexical_cast("153083904475345790698149223310665389766178449653686710164582374234640876900329"), + boost::lexical_cast("247694960571651628711444594884429646292615632415916575771902992555242690154864"), + boost::lexical_cast("400778865046997419409593818195095036058794082069603285936485366789883567055193"), + boost::lexical_cast("648473825618649048121038413079524682351409714485519861708388359345126257210057"), + boost::lexical_cast("1049252690665646467530632231274619718410203796555123147644873726135009824265250"), + boost::lexical_cast("1697726516284295515651670644354144400761613511040643009353262085480136081475307"), + boost::lexical_cast("2746979206949941983182302875628764119171817307595766156998135811615145905740557"), + boost::lexical_cast("4444705723234237498833973519982908519933430818636409166351397897095281987215864"), + boost::lexical_cast("7191684930184179482016276395611672639105248126232175323349533708710427892956421"), + boost::lexical_cast("11636390653418416980850249915594581159038678944868584489700931605805709880172285"), + boost::lexical_cast("18828075583602596462866526311206253798143927071100759813050465314516137773128706"), + boost::lexical_cast("30464466237021013443716776226800834957182606015969344302751396920321847653300991"), + boost::lexical_cast("49292541820623609906583302538007088755326533087070104115801862234837985426429697"), + boost::lexical_cast("79757008057644623350300078764807923712509139103039448418553259155159833079730688"), + boost::lexical_cast("129049549878268233256883381302815012467835672190109552534355121389997818506160385"), + boost::lexical_cast("208806557935912856607183460067622936180344811293149000952908380545157651585891073"), + boost::lexical_cast("337856107814181089864066841370437948648180483483258553487263501935155470092051458"), + boost::lexical_cast("546662665750093946471250301438060884828525294776407554440171882480313121677942531"), + boost::lexical_cast("884518773564275036335317142808498833476705778259666107927435384415468591769993989"), + boost::lexical_cast("1431181439314368982806567444246559718305231073036073662367607266895781713447936520"), + boost::lexical_cast("2315700212878644019141884587055058551781936851295739770295042651311250305217930509"), + boost::lexical_cast("3746881652193013001948452031301618270087167924331813432662649918207032018665867029"), + boost::lexical_cast("6062581865071657021090336618356676821869104775627553202957692569518282323883797538"), + boost::lexical_cast("9809463517264670023038788649658295091956272699959366635620342487725314342549664567"), + boost::lexical_cast("15872045382336327044129125268014971913825377475586919838578035057243596666433462105"), + boost::lexical_cast("25681508899600997067167913917673267005781650175546286474198377544968911008983126672"), + boost::lexical_cast("41553554281937324111297039185688238919607027651133206312776412602212507675416588777"), + boost::lexical_cast("67235063181538321178464953103361505925388677826679492786974790147181418684399715449"), + boost::lexical_cast("108788617463475645289761992289049744844995705477812699099751202749393926359816304226"), + boost::lexical_cast("176023680645013966468226945392411250770384383304492191886725992896575345044216019675"), + boost::lexical_cast("284812298108489611757988937681460995615380088782304890986477195645969271404032323901"), + boost::lexical_cast("460835978753503578226215883073872246385764472086797082873203188542544616448248343576"), + boost::lexical_cast("745648276861993189984204820755333242001144560869101973859680384188513887852280667477"), + boost::lexical_cast("1206484255615496768210420703829205488386909032955899056732883572731058504300529011053"), + boost::lexical_cast("1952132532477489958194625524584538730388053593825001030592563956919572392152809678530"), + boost::lexical_cast("3158616788092986726405046228413744218774962626780900087325447529650630896453338689583"), + boost::lexical_cast("5110749320570476684599671752998282949163016220605901117918011486570203288606148368113"), + boost::lexical_cast("8269366108663463411004717981412027167937978847386801205243459016220834185059487057696"), + boost::lexical_cast("13380115429233940095604389734410310117100995067992702323161470502791037473665635425809"), + boost::lexical_cast("21649481537897403506609107715822337285038973915379503528404929519011871658725122483505"), + boost::lexical_cast("35029596967131343602213497450232647402139968983372205851566400021802909132390757909314"), + boost::lexical_cast("56679078505028747108822605166054984687178942898751709379971329540814780791115880392819"), + boost::lexical_cast("91708675472160090711036102616287632089318911882123915231537729562617689923506638302133"), + boost::lexical_cast("148387753977188837819858707782342616776497854780875624611509059103432470714622518694952"), + boost::lexical_cast("240096429449348928530894810398630248865816766662999539843046788666050160638129156997085"), + boost::lexical_cast("388484183426537766350753518180972865642314621443875164454555847769482631352751675692037"), + boost::lexical_cast("628580612875886694881648328579603114508131388106874704297602636435532791990880832689122"), + boost::lexical_cast("1017064796302424461232401846760575980150446009550749868752158484205015423343632508381159"), + boost::lexical_cast("1645645409178311156114050175340179094658577397657624573049761120640548215334513341070281"), + boost::lexical_cast("2662710205480735617346452022100755074809023407208374441801919604845563638678145849451440"), + boost::lexical_cast("4308355614659046773460502197440934169467600804865999014851680725486111854012659190521721"), + boost::lexical_cast("6971065820139782390806954219541689244276624212074373456653600330331675492690805039973161"), + boost::lexical_cast("11279421434798829164267456416982623413744225016940372471505281055817787346703464230494882"), + boost::lexical_cast("18250487254938611555074410636524312658020849229014745928158881386149462839394269270468043"), + boost::lexical_cast("29529908689737440719341867053506936071765074245955118399664162441967250186097733500962925"), + boost::lexical_cast("47780395944676052274416277690031248729785923474969864327823043828116713025492002771430968"), + boost::lexical_cast("77310304634413492993758144743538184801550997720924982727487206270083963211589736272393893"), + boost::lexical_cast("125090700579089545268174422433569433531336921195894847055310250098200676237081739043824861"), + boost::lexical_cast("202401005213503038261932567177107618332887918916819829782797456368284639448671475316218754"), + boost::lexical_cast("327491705792592583530106989610677051864224840112714676838107706466485315685753214360043615"), + boost::lexical_cast("529892711006095621792039556787784670197112759029534506620905162834769955134424689676262369"), + boost::lexical_cast("857384416798688205322146546398461722061337599142249183459012869301255270820177904036305984"), + boost::lexical_cast("1387277127804783827114186103186246392258450358171783690079918032136025225954602593712568353"), + boost::lexical_cast("2244661544603472032436332649584708114319787957314032873538930901437280496774780497748874337"), + boost::lexical_cast("3631938672408255859550518752770954506578238315485816563618848933573305722729383091461442690"), + boost::lexical_cast("5876600217011727891986851402355662620898026272799849437157779835010586219504163589210317027"), + boost::lexical_cast("9508538889419983751537370155126617127476264588285666000776628768583891942233546680671759717"), + boost::lexical_cast("15385139106431711643524221557482279748374290861085515437934408603594478161737710269882076744"), + boost::lexical_cast("24893677995851695395061591712608896875850555449371181438711037372178370103971256950553836461"), + boost::lexical_cast("40278817102283407038585813270091176624224846310456696876645445975772848265708967220435913205"), + boost::lexical_cast("65172495098135102433647404982700073500075401759827878315356483347951218369680224170989749666"), + boost::lexical_cast("105451312200418509472233218252791250124300248070284575192001929323724066635389191391425662871"), + boost::lexical_cast("170623807298553611905880623235491323624375649830112453507358412671675285005069415562415412537"), + boost::lexical_cast("276075119498972121378113841488282573748675897900397028699360341995399351640458606953841075408"), + boost::lexical_cast("446698926797525733283994464723773897373051547730509482206718754667074636645528022516256487945"), + boost::lexical_cast("722774046296497854662108306212056471121727445630906510906079096662473988285986629470097563353"), + boost::lexical_cast("1169472973094023587946102770935830368494778993361415993112797851329548624931514651986354051298"), + boost::lexical_cast("1892247019390521442608211077147886839616506438992322504018876947992022613217501281456451614651"), + boost::lexical_cast("3061719992484545030554313848083717208111285432353738497131674799321571238149015933442805665949"), + boost::lexical_cast("4953967011875066473162524925231604047727791871346061001150551747313593851366517214899257280600"), + boost::lexical_cast("8015687004359611503716838773315321255839077303699799498282226546635165089515533148342062946549"), + boost::lexical_cast("12969654016234677976879363698546925303566869175045860499432778293948758940882050363241320227149"), + boost::lexical_cast("20985341020594289480596202471862246559405946478745659997715004840583924030397583511583383173698"), + boost::lexical_cast("33954995036828967457475566170409171862972815653791520497147783134532682971279633874824703400847"), + boost::lexical_cast("54940336057423256938071768642271418422378762132537180494862787975116607001677217386408086574545"), + boost::lexical_cast("88895331094252224395547334812680590285351577786328700992010571109649289972956851261232789975392"), + boost::lexical_cast("143835667151675481333619103454952008707730339918865881486873359084765896974634068647640876549937"), + boost::lexical_cast("232730998245927705729166438267632598993081917705194582478883930194415186947590919908873666525329"), + boost::lexical_cast("376566665397603187062785541722584607700812257624060463965757289279181083922224988556514543075266"), + boost::lexical_cast("609297663643530892791951979990217206693894175329255046444641219473596270869815908465388209600595"), + boost::lexical_cast("985864329041134079854737521712801814394706432953315510410398508752777354792040897021902752675861"), + boost::lexical_cast("1595161992684664972646689501703019021088600608282570556855039728226373625661856805487290962276456"), + boost::lexical_cast("2581026321725799052501427023415820835483307041235886067265438236979150980453897702509193714952317"), + boost::lexical_cast("4176188314410464025148116525118839856571907649518456624120477965205524606115754507996484677228773"), + boost::lexical_cast("6757214636136263077649543548534660692055214690754342691385916202184675586569652210505678392181090"), + boost::lexical_cast("10933402950546727102797660073653500548627122340272799315506394167390200192685406718502163069409863"), + boost::lexical_cast("17690617586682990180447203622188161240682337031027142006892310369574875779255058929007841461590953"), + boost::lexical_cast("28624020537229717283244863695841661789309459371299941322398704536965075971940465647510004531000816"), + boost::lexical_cast("46314638123912707463692067318029823029991796402327083329291014906539951751195524576517845992591769"), + boost::lexical_cast("74938658661142424746936931013871484819301255773627024651689719443505027723135990224027850523592585"), + boost::lexical_cast("121253296785055132210628998331901307849293052175954107980980734350044979474331514800545696516184354"), + boost::lexical_cast("196191955446197556957565929345772792668594307949581132632670453793550007197467505024573547039776939"), + boost::lexical_cast("317445252231252689168194927677674100517887360125535240613651188143594986671799019825119243555961293"), + boost::lexical_cast("513637207677450246125760857023446893186481668075116373246321641937144993869266524849692790595738232"), + boost::lexical_cast("831082459908702935293955784701120993704369028200651613859972830080739980541065544674812034151699525"), + boost::lexical_cast("1344719667586153181419716641724567886890850696275767987106294472017884974410332069524504824747437757"), + boost::lexical_cast("2175802127494856116713672426425688880595219724476419600966267302098624954951397614199316858899137282"), + boost::lexical_cast("3520521795081009298133389068150256767486070420752187588072561774116509929361729683723821683646575039"), + boost::lexical_cast("5696323922575865414847061494575945648081290145228607189038829076215134884313127297923138542545712321"), + boost::lexical_cast("9216845717656874712980450562726202415567360565980794777111390850331644813674856981646960226192287360"), + boost::lexical_cast("14913169640232740127827512057302148063648650711209401966150219926546779697987984279570098768737999681"), + boost::lexical_cast("24130015357889614840807962620028350479216011277190196743261610776878424511662841261217058994930287041"), + boost::lexical_cast("39043184998122354968635474677330498542864661988399598709411830703425204209650825540787157763668286722"), + boost::lexical_cast("63173200356011969809443437297358849022080673265589795452673441480303628721313666802004216758598573763"), + boost::lexical_cast("102216385354134324778078911974689347564945335253989394162085272183728832930964492342791374522266860485"), + boost::lexical_cast("165389585710146294587522349272048196587026008519579189614758713664032461652278159144795591280865434248"), + boost::lexical_cast("267605971064280619365601261246737544151971343773568583776843985847761294583242651487586965803132294733"), + boost::lexical_cast("432995556774426913953123610518785740738997352293147773391602699511793756235520810632382557083997728981"), + boost::lexical_cast("700601527838707533318724871765523284890968696066716357168446685359555050818763462119969522887130023714"), + boost::lexical_cast("1133597084613134447271848482284309025629966048359864130560049384871348807054284272752352079971127752695"), + boost::lexical_cast("1834198612451841980590573354049832310520934744426580487728496070230903857873047734872321602858257776409"), + boost::lexical_cast("2967795697064976427862421836334141336150900792786444618288545455102252664927332007624673682829385529104"), + boost::lexical_cast("4801994309516818408452995190383973646671835537213025106017041525333156522800379742496995285687643305513"), + boost::lexical_cast("7769790006581794836315417026718114982822736329999469724305586980435409187727711750121668968517028834617"), + boost::lexical_cast("12571784316098613244768412217102088629494571867212494830322628505768565710528091492618664254204672140130"), + boost::lexical_cast("20341574322680408081083829243820203612317308197211964554628215486203974898255803242740333222721700974747"), + boost::lexical_cast("32913358638779021325852241460922292241811880064424459384950843991972540608783894735358997476926373114877"), + boost::lexical_cast("53254932961459429406936070704742495854129188261636423939579059478176515507039697978099330699648074089624"), + boost::lexical_cast("86168291600238450732788312165664788095941068326060883324529903470149056115823592713458328176574447204501"), + boost::lexical_cast("139423224561697880139724382870407283950070256587697307264108962948325571622863290691557658876222521294125"), + boost::lexical_cast("225591516161936330872512695036072072046011324913758190588638866418474627738686883405015987052796968498626"), + boost::lexical_cast("365014740723634211012237077906479355996081581501455497852747829366800199361550174096573645929019489792751"), + boost::lexical_cast("590606256885570541884749772942551428042092906415213688441386695785274827100237057501589632981816458291377"), + boost::lexical_cast("955620997609204752896986850849030784038174487916669186294134525152075026461787231598163278910835948084128"), + boost::lexical_cast("1546227254494775294781736623791582212080267394331882874735521220937349853562024289099752911892652406375505"), + boost::lexical_cast("2501848252103980047678723474640612996118441882248552061029655746089424880023811520697916190803488354459633"), + boost::lexical_cast("4048075506598755342460460098432195208198709276580434935765176967026774733585835809797669102696140760835138"), + boost::lexical_cast("6549923758702735390139183573072808204317151158828986996794832713116199613609647330495585293499629115294771"), + boost::lexical_cast("10597999265301490732599643671505003412515860435409421932560009680142974347195483140293254396195769876129909"), + boost::lexical_cast("17147923024004226122738827244577811616833011594238408929354842393259173960805130470788839689695398991424680"), + boost::lexical_cast("27745922289305716855338470916082815029348872029647830861914852073402148308000613611082094085891168867554589"), + boost::lexical_cast("44893845313309942978077298160660626646181883623886239791269694466661322268805744081870933775586567858979269"), + boost::lexical_cast("72639767602615659833415769076743441675530755653534070653184546540063470576806357692953027861477736726533858"), + boost::lexical_cast("117533612915925602811493067237404068321712639277420310444454241006724792845612101774823961637064304585513127"), + boost::lexical_cast("190173380518541262644908836314147509997243394930954381097638787546788263422418459467776989498542041312046985"), + boost::lexical_cast("307706993434466865456401903551551578318956034208374691542093028553513056268030561242600951135606345897560112"), + boost::lexical_cast("497880373953008128101310739865699088316199429139329072639731816100301319690449020710377940634148387209607097"), + boost::lexical_cast("805587367387474993557712643417250666635155463347703764181824844653814375958479581952978891769754733107167209"), + boost::lexical_cast("1303467741340483121659023383282949754951354892487032836821556660754115695648928602663356832403903120316774306"), + boost::lexical_cast("2109055108727958115216736026700200421586510355834736601003381505407930071607408184616335724173657853423941515"), + boost::lexical_cast("3412522850068441236875759409983150176537865248321769437824938166162045767256336787279692556577560973740715821"), + boost::lexical_cast("5521577958796399352092495436683350598124375604156506038828319671569975838863744971896028280751218827164657336"), + boost::lexical_cast("8934100808864840588968254846666500774662240852478275476653257837732021606120081759175720837328779800905373157"), + boost::lexical_cast("14455678767661239941060750283349851372786616456634781515481577509301997444983826731071749118079998628070030493"), + boost::lexical_cast("23389779576526080530029005130016352147448857309113056992134835347034019051103908490247469955408778428975403650"), + boost::lexical_cast("37845458344187320471089755413366203520235473765747838507616412856336016496087735221319219073488777057045434143"), + boost::lexical_cast("61235237920713401001118760543382555667684331074860895499751248203370035547191643711566689028897555486020837793"), + boost::lexical_cast("99080696264900721472208515956748759187919804840608734007367661059706052043279378932885908102386332543066271936"), + boost::lexical_cast("160315934185614122473327276500131314855604135915469629507118909263076087590471022644452597131283888029087109729"), + boost::lexical_cast("259396630450514843945535792456880074043523940756078363514486570322782139633750401577338505233670220572153381665"), + boost::lexical_cast("419712564636128966418863068957011388899128076671547993021605479585858227224221424221791102364954108601240491394"), + boost::lexical_cast("679109195086643810364398861413891462942652017427626356536092049908640366857971825799129607598624329173393873059"), + boost::lexical_cast("1098821759722772776783261930370902851841780094099174349557697529494498594082193250020920709963578437774634364453"), + boost::lexical_cast("1777930954809416587147660791784794314784432111526800706093789579403138960940165075820050317562202766948028237512"), + boost::lexical_cast("2876752714532189363930922722155697166626212205625975055651487108897637555022358325840971027525781204722662601965"), + boost::lexical_cast("4654683669341605951078583513940491481410644317152775761745276688300776515962523401661021345087983971670690839477"), + boost::lexical_cast("7531436383873795315009506236096188648036856522778750817396763797198414070984881727501992372613765176393353441442"), + boost::lexical_cast("12186120053215401266088089750036680129447500839931526579142040485499190586947405129163013717701749148064044280919"), + boost::lexical_cast("19717556437089196581097595986132868777484357362710277396538804282697604657932286856665006090315514324457397722361"), + boost::lexical_cast("31903676490304597847185685736169548906931858202641803975680844768196795244879691985828019808017263472521442003280"), + boost::lexical_cast("51621232927393794428283281722302417684416215565352081372219649050894399902811978842493025898332777796978839725641"), + boost::lexical_cast("83524909417698392275468967458471966591348073767993885347900493819091195147691670828321045706350041269500281728921"), + boost::lexical_cast("135146142345092186703752249180774384275764289333345966720120142869985595050503649670814071604682819066479121454562"), + boost::lexical_cast("218671051762790578979221216639246350867112363101339852068020636689076790198195320499135117311032860335979403183483"), + boost::lexical_cast("353817194107882765682973465820020735142876652434685818788140779559062385248698970169949188915715679402458524638045"), + boost::lexical_cast("572488245870673344662194682459267086009989015536025670856161416248139175446894290669084306226748539738437927821528"), + boost::lexical_cast("926305439978556110345168148279287821152865667970711489644302195807201560695593260839033495142464219140896452459573"), + boost::lexical_cast("1498793685849229455007362830738554907162854683506737160500463612055340736142487551508117801369212758879334380281101"), + boost::lexical_cast("2425099125827785565352530979017842728315720351477448650144765807862542296838080812347151296511676978020230832740674"), + boost::lexical_cast("3923892811677015020359893809756397635478575034984185810645229419917883032980568363855269097880889736899565213021775"), + boost::lexical_cast("6348991937504800585712424788774240363794295386461634460789995227780425329818649176202420394392566714919796045762449"), + boost::lexical_cast("10272884749181815606072318598530637999272870421445820271435224647698308362799217540057689492273456451819361258784224"), + boost::lexical_cast("16621876686686616191784743387304878363067165807907454732225219875478733692617866716260109886666023166739157304546673"), + boost::lexical_cast("26894761435868431797857061985835516362340036229353275003660444523177042055417084256317799378939479618558518563330897"), + boost::lexical_cast("4351663812255504798964180537314039472540720203726072973588566439865577574803495097257790926560550278529767567877570"), + boost::lexical_cast("70411399558423479787498867358975911087747238266614004739546108921832817803452035228895708644544982403856194431208467"), + boost::lexical_cast("113928037680978527777140672732116305813154440303874734475431773320488593551486986201473617910150485189153870299086037"), + boost::lexical_cast("184339437239402007564639540091092216900901678570488739214977882242321411354939021430369326554695467593010064730294504"), + boost::lexical_cast("298267474920380535341780212823208522714056118874363473690409655562810004906426007631842944464845952782163935029380541"), + boost::lexical_cast("482606912159782542906419752914300739614957797444852212905387537805131416261365029062212271019541420375173999759675045"), + boost::lexical_cast("780874387080163078248199965737509262329013916319215686595797193367941421167791036694055215484387373157337934789055586"), + boost::lexical_cast("1263481299239945621154619718651810001943971713764067899501184731173072837429156065756267486503928793532511934548730631"), + boost::lexical_cast("2044355686320108699402819684389319264272985630083283586096981924541014258596947102450322701988316166689849869337786217"), + boost::lexical_cast("3307836985560054320557439403041129266216957343847351485598166655714087096026103168206590188492244960222361803886516848"), + boost::lexical_cast("5352192671880163019960259087430448530489942973930635071695148580255101354623050270656912890480561126912211673224303065"), + boost::lexical_cast("8660029657440217340517698490471577796706900317777986557293315235969188450649153438863503078972806087134573477110819913"), + boost::lexical_cast("14012222329320380360477957577902026327196843291708621628988463816224289805272203709520415969453367214046785150335122978"), + boost::lexical_cast("22672251986760597700995656068373604123903743609486608186281779052193478255921357148383919048426173301181358627445942891"), + boost::lexical_cast("36684474316080978061473613646275630451100586901195229815270242868417768061193560857904335017879540515228143777781065869"), + boost::lexical_cast("59356726302841575762469269714649234575004330510681838001552021920611246317114918006288254066305713816409502405227008760"), + boost::lexical_cast("96041200618922553823942883360924865026104917411877067816822264789029014378308478864192589084185254331637646183008074629"), + boost::lexical_cast("155397926921764129586412153075574099601109247922558905818374286709640260695423396870480843150490968148047148588235083389"), + boost::lexical_cast("251439127540686683410355036436498964627214165334435973635196551498669275073731875734673432234676222479684794771243158018"), + boost::lexical_cast("406837054462450812996767189512073064228323413256994879453570838208309535769155272605154275385167190627731943359478241407"), + boost::lexical_cast("658276182003137496407122225948572028855537578591430853088767389706978810842887148339827707619843413107416738130721399425"), + boost::lexical_cast("1065113236465588309403889415460645093083860991848425732542338227915288346612042420944981983005010603735148681490199640832"), + boost::lexical_cast("1723389418468725805811011641409217121939398570439856585631105617622267157454929569284809690624854016842565419620921040257"), + boost::lexical_cast("2788502654934314115214901056869862215023259562288282318173443845537555504066971990229791673629864620577714101111120681089"), + boost::lexical_cast("4511892073403039921025912698279079336962658132728138903804549463159822661521901559514601364254718637420279520732041721346"), + boost::lexical_cast("7300394728337354036240813755148941551985917695016421221977993308697378165588873549744393037884583257997993621843162402435"), + boost::lexical_cast("11812286801740393957266726453428020888948575827744560125782542771857200827110775109258994402139301895418273142575204123781"), + boost::lexical_cast("19112681530077747993507540208576962440934493522760981347760536080554578992699648659003387440023885153416266764418366526216"), + boost::lexical_cast("30924968331818141950774266662004983329883069350505541473543078852411779819810423768262381842163187048834539906993570649997"), + boost::lexical_cast("50037649861895889944281806870581945770817562873266522821303614932966358812510072427265769282187072202250806671411937176213"), + boost::lexical_cast("80962618193714031895056073532586929100700632223772064294846693785378138632320496195528151124350259251085346578405507826210"), + boost::lexical_cast("131000268055609921839337880403168874871518195097038587116150308718344497444830568622793920406537331453336153249817445002423"), + boost::lexical_cast("211962886249323953734393953935755803972218827320810651410997002503722636077151064818322071530887590704421499828222952828633"), + boost::lexical_cast("342963154304933875573731834338924678843737022417849238527147311222067133521981633441115991937424922157757653078040397831056"), + boost::lexical_cast("554926040554257829308125788274680482815955849738659889938144313725789769599132698259438063468312512862179152906263350659689"), + boost::lexical_cast("897889194859191704881857622613605161659692872156509128465291624947856903121114331700554055405737435019936805984303748490745"), + boost::lexical_cast("1452815235413449534189983410888285644475648721895169018403435938673646672720247029959992118874049947882115958890567099150434"), + boost::lexical_cast("2350704430272641239071841033501890806135341594051678146868727563621503575841361361660546174279787382902052764874870847641179"), + boost::lexical_cast("3803519665686090773261824444390176450610990315946847165272163502295150248561608391620538293153837330784168723765437946791613"), + boost::lexical_cast("6154224095958732012333665477892067256746331909998525312140891065916653824402969753281084467433624713686221488640308794432792"), + boost::lexical_cast("9957743761644822785595489922282243707357322225945372477413054568211804072964578144901622760587462044470390212405746741224405"), + boost::lexical_cast("16111967857603554797929155400174310964103654135943897789553945634128457897367547898182707228021086758156611701046055535657197"), + boost::lexical_cast("26069711619248377583524645322456554671460976361889270266967000202340261970332126043084329988608548802627001913451802276881602"), + boost::lexical_cast("42181679476851932381453800722630865635564630497833168056520945836468719867699673941267037216629635560783613614497857812538799"), + boost::lexical_cast("68251391096100309964978446045087420307025606859722438323487946038808981838031799984351367205238184363410615527949660089420401"), + boost::lexical_cast("110433070572952242346432246767718285942590237357555606380008891875277701705731473925618404421867819924194229142447517901959200"), + boost::lexical_cast("178684461669052552311410692812805706249615844217278044703496837914086683543763273909969771627106004287604844670397177991379601"), + boost::lexical_cast("289117532242004794657842939580523992192206081574833651083505729789364385249494747835588176048973824211799073812844695893338801"), + boost::lexical_cast("467801993911057346969253632393329698441821925792111695787002567703451068793258021745557947676079828499403918483241873884718402"), + boost::lexical_cast("756919526153062141627096571973853690634028007366945346870508297492815454042752769581146123725053652711202992296086569778057203"), + boost::lexical_cast("1224721520064119488596350204367183389075849933159057042657510865196266522836010791326704071401133481210606910779328443662775605"), + boost::lexical_cast("1981641046217181630223446776341037079709877940526002389528019162689081976878763560907850195126187133921809903075415013440832808"), + boost::lexical_cast("3206362566281301118819796980708220468785727873685059432185530027885348499714774352234554266527320615132416813854743457103608413"), + boost::lexical_cast("5188003612498482749043243757049257548495605814211061821713549190574430476593537913142404461653507749054226716930158470544441221"), + boost::lexical_cast("8394366178779783867863040737757478017281333687896121253899079218459778976308312265376958728180828364186643530784901927648049634"), + boost::lexical_cast("13582369791278266616906284494806735565776939502107183075612628409034209452901850178519363189834336113240870247715060398192490855"), + boost::lexical_cast("21976735970058050484769325232564213583058273190003304329511707627493988429210162443896321918015164477427513778499962325840540489"), + boost::lexical_cast("35559105761336317101675609727370949148835212692110487405124336036528197882112012622415685107849500590668384026215022724033031344"), + boost::lexical_cast("57535841731394367586444934959935162731893485882113791734636043664022186311322175066312007025864665068095897804714985049873571833"), + boost::lexical_cast("93094947492730684688120544687306111880728698574224279139760379700550384193434187688727692133714165658764281830930007773906603177"), + boost::lexical_cast("150630789224125052274565479647241274612622184456338070874396423364572570504756362755039699159578830726860179635644992823780175010"), + boost::lexical_cast("243725736716855736962686024334547386493350883030562350014156803065122954698190550443767391293292996385624461466575000597686778187"), + boost::lexical_cast("394356525940980789237251503981788661105973067486900420888553226429695525202946913198807090452871827112484641102219993421466953197"), + boost::lexical_cast("638082262657836526199937528316336047599323950517462770902710029494818479901137463642574481746164823498109102568794994019153731384"), + boost::lexical_cast("1032438788598817315437189032298124708705297018004363191791263255924514005104084376841381572199036650610593743671014987440620684581"), + boost::lexical_cast("1670521051256653841637126560614460756304620968521825962693973285419332485005221840483956053945201474108702846239809981459774415965"), + boost::lexical_cast("2702959839855471157074315592912585465009917986526189154485236541343846490109306217325337626144238124719296589910824968900395100546"), + boost::lexical_cast("4373480891112124998711442153527046221314538955048015117179209826763178975114528057809293680089439598827999436150634950360169516511"), + boost::lexical_cast("7076440730967596155785757746439631686324456941574204271664446368107025465223834275134631306233677723547296026061459919260564617057"), + boost::lexical_cast("11449921622079721154497199899966677907638995896622219388843656194870204440338362332943924986323117322375295462212094869620734133568"), + boost::lexical_cast("18526362353047317310282957646406309593963452838196423660508102562977229905562196608078556292556795045922591488273554788881298750625"), + boost::lexical_cast("29976283975127038464780157546372987501602448734818643049351758757847434345900558941022481278879912368297886950485649658502032884193"), + boost::lexical_cast("48502646328174355775063115192779297095565901573015066709859861320824664251462755549101037571436707414220478438759204447383331634818"), + boost::lexical_cast("78478930303301394239843272739152284597168350307833709759211620078672098597363314490123518850316619782518365389244854105885364519011"), + boost::lexical_cast("126981576631475750014906387931931581692734251880848776469071481399496762848826070039224556421753327196738843828004058553268696153829"), + boost::lexical_cast("205460506934777144254749660671083866289902602188682486228283101478168861446189384529348075272069946979257209217248912659154060672840"), + boost::lexical_cast("332442083566252894269656048603015447982636854069531262697354582877665624295015454568572631693823274175996053045252971212422756826669"), + boost::lexical_cast("537902590501030038524405709274099314272539456258213748925637684355834485741204839097920706965893221155253262262501883871576817499509"), + boost::lexical_cast("870344674067282932794061757877114762255176310327745011622992267233500110036220293666493338659716495331249315307754855083999574326178"), + boost::lexical_cast("1408247264568312971318467467151214076527715766585958760548629951589334595777425132764414045625609716486502577570256738955576391825687"), + boost::lexical_cast("2278591938635595904112529225028328838782892076913703772171622218822834705813645426430907384285326211817751892878011594039575966151865"), + boost::lexical_cast("3686839203203908875430996692179542915310607843499662532720252170412169301591070559195321429910935928304254470448268332995152357977552"), + boost::lexical_cast("5965431141839504779543525917207871754093499920413366304891874389235004007404715985626228814196262140122006363326279927034728324129417"), + boost::lexical_cast("9652270345043413654974522609387414669404107763913028837612126559647173308995786544821550244107198068426260833774548260029880682106969"), + boost::lexical_cast("15617701486882918434518048526595286423497607684326395142504000948882177316400502530447779058303460208548267197100828187064609006236386"), + boost::lexical_cast("25269971831926332089492571135982701092901715448239423980116127508529350625396289075269329302410658276974528030875376447094489688343355"), + boost::lexical_cast("40887673318809250524010619662577987516399323132565819122620128457411527941796791605717108360714118485522795227976204634159098694579741"), + boost::lexical_cast("66157645150735582613503190798560688609301038580805243102736255965940878567193080680986437663124776762497323258851581081253588382923096"), + boost::lexical_cast("107045318469544833137513810461138676125700361713371062225356384423352406508989872286703546023838895248020118486827785715412687077502837"), + boost::lexical_cast("173202963620280415751017001259699364735001400294176305328092640389293285076182952967689983686963672010517441745679366796666275460425933"), + boost::lexical_cast("280248282089825248888530811720838040860701762007547367553449024812645691585172825254393529710802567258537560232507152512078962537928770"), + boost::lexical_cast("453451245710105664639547812980537405595703162301723672881541665201938976661355778222083513397766239269055001978186519308745237998354703"), + boost::lexical_cast("733699527799930913528078624701375446456404924309271040434990690014584668246528603476477043108568806527592562210693671820824200536283473"), + boost::lexical_cast("1187150773510036578167626437681912852052108086610994713316532355216523644907884381698560556506335045796647564188880191129569438534638176"), + boost::lexical_cast("1920850301309967491695705062383288298508513010920265753751523045231108313154412985175037599614903852324240126399573862950393639070921649"), + boost::lexical_cast("3108001074820004069863331500065201150560621097531260467068055400447631958062297366873598156121238898120887690588454054079963077605559825"), + boost::lexical_cast("5028851376129971561559036562448489449069134108451526220819578445678740271216710352048635755736142750445127816988027917030356716676481474"), + boost::lexical_cast("8136852450949975631422368062513690599629755205982786687887633846126372229279007718922233911857381648566015507576481971110319794282041299"), + boost::lexical_cast("13165703827079947192981404624962180048698889314434312908707212291805112500495718070970869667593524399011143324564509888140676510958522773"), + boost::lexical_cast("21302556278029922824403772687475870648328644520417099596594846137931484729774725789893103579450906047577158832140991859250996305240564072"), + boost::lexical_cast("34468260105109870017385177312438050697027533834851412505302058429736597230270443860863973247044430446588302156705501747391672816199086845"), + boost::lexical_cast("55770816383139792841788949999913921345356178355268512101896904567668081960045169650757076826495336494165460988846493606642669121439650917"), + boost::lexical_cast("90239076488249662859174127312351972042383712190119924607198962997404679190315613511621050073539766940753763145551995354034341937638737762"), + boost::lexical_cast("146009892871389455700963077312265893387739890545388436709095867565072761150360783162378126900035103434919224134398488960677011059078388679"), + boost::lexical_cast("236248969359639118560137204624617865430123602735508361316294830562477440340676396673999176973574870375672987279950484314711352996717126441"), + boost::lexical_cast("382258862231028574261100281936883758817863493280896798025390698127550201491037179836377303873609973810592211414348973275388364055795515120"), + boost::lexical_cast("618507831590667692821237486561501624247987096016405159341685528690027641831713576510376480847184844186265198694299457590099717052512641561"), + boost::lexical_cast("1000766693821696267082337768498385383065850589297301957367076226817577843322750756346753784720794817996857410108648430865488081108308156681"), + boost::lexical_cast("1619274525412363959903575255059887007313837685313707116708761755507605485154464332857130265567979662183122608802947888455587798160820798242"), + boost::lexical_cast("2620041219234060226985913023558272390379688274611009074075837982325183328477215089203884050288774480179980018911596319321075879269128954923"), + boost::lexical_cast("4239315744646424186889488278618159397693525959924716190784599737832788813631679422061014315856754142363102627714544207776663677429949753165"), + boost::lexical_cast("6859356963880484413875401302176431788073214234535725264860437720157972142108894511264898366145528622543082646626140527097739556699078708088"), + boost::lexical_cast("11098672708526908600764889580794591185766740194460441455645037457990760955740573933325912682002282764906185274340684734874403234129028461253"), + boost::lexical_cast("17958029672407393014640290882971022973839954428996166720505475178148733097849468444590811048147811387449267920966825261972142790828107169341"), + boost::lexical_cast("29056702380934301615405180463765614159606694623456608176150512636139494053590042377916723730150094152355453195307509996846546024957135630594"), + boost::lexical_cast("47014732053341694630045471346736637133446649052452774896655987814288227151439510822507534778297905539804721116274335258818688815785242799935"), + boost::lexical_cast("76071434434275996245450651810502251293053343675909383072806500450427721205029553200424258508447999692160174311581845255665234840742378430529"), + boost::lexical_cast("123086166487617690875496123157238888426499992728362157969462488264715948356469064022931793286745905231964895427856180514483923656527621230464"), + boost::lexical_cast("199157600921893687120946774967741139719553336404271541042268988715143669561498617223356051795193904924125069739438025770149158497269999660993"), + boost::lexical_cast("322243767409511377996442898124980028146053329132633699011731476979859617917967681246287845081939810156089965167294206284633082153797620891457"), + boost::lexical_cast("521401368331405065117389673092721167865606665536905240054000465695003287479466298469643896877133715080215034906732232054782240651067620552450"), + boost::lexical_cast("843645135740916443113832571217701196011659994669538939065731942674862905397433979715931741959073525236305000074026438339415322804865241443907"), + boost::lexical_cast("1365046504072321508231222244310422363877266660206444179119732408369866192876900278185575638836207240316520034980758670394197563455932861996357"), + boost::lexical_cast("2208691639813237951345054815528123559888926654875983118185464351044729098274334257901507380795280765552825035054785108733612886260798103440264"), + boost::lexical_cast("3573738143885559459576277059838545923766193315082427297305196759414595291151234536087083019631488005869345070035543779127810449716730965436621"), + boost::lexical_cast("5782429783698797410921331875366669483655119969958410415490661110459324389425568793988590400426768771422170105090328887861423335977529068876885"), + boost::lexical_cast("9356167927584356870497608935205215407421313285040837712795857869873919680576803330075673420058256777291515175125872666989233785694260034313506"), + boost::lexical_cast("15138597711283154281418940810571884891076433254999248128286518980333244070002372124064263820485025548713685280216201554850657121671789103190391"), + boost::lexical_cast("24494765638867511151916549745777100298497746540040085841082376850207163750579175454139937240543282326005200455342074221839890907366049137503897"), + boost::lexical_cast("39633363350150665433335490556348985189574179795039333969368895830540407820581547578204201061028307874718885735558275776690548029037838240694288"), + boost::lexical_cast("64128128989018176585252040302126085488071926335079419810451272680747571571160723032344138301571590200724086190900349998530438936403887378198185"), + boost::lexical_cast("103761492339168842018587530858475070677646106130118753779820168511287979391742270610548339362599898075442971926458625775220986965441725618892473"), + boost::lexical_cast("167889621328187018603839571160601156165718032465198173590271441192035550962902993642892477664171488276167058117358975773751425901845612997090658"), + boost::lexical_cast("271651113667355860622427102019076226843364138595316927370091609703323530354645264253440817026771386351610030043817601548972412867287338615983131"), + boost::lexical_cast("439540734995542879226266673179677383009082171060515100960363050895359081317548257896333294690942874627777088161176577322723838769132951613073789"), + boost::lexical_cast("711191848662898739848693775198753609852446309655832028330454660598682611672193522149774111717714260979387118204994178871696251636420290229056920"), + boost::lexical_cast("1150732583658441619074960448378430992861528480716347129290817711494041692989741780046107406408657135607164206366170756194420090405553241842130709"), + boost::lexical_cast("1861924432321340358923654223577184602713974790372179157621272372092724304661935302195881518126371396586551324571164935066116342041973532071187629"), + boost::lexical_cast("3012657015979781977998614671955615595575503271088526286912090083586765997651677082241988924535028532193715530937335691260536432447526773913318338"), + boost::lexical_cast("4874581448301122336922268895532800198289478061460705444533362455679490302313612384437870442661399928780266855508500626326652774489500305984505967"), + boost::lexical_cast("7887238464280904314920883567488415793864981332549231731445452539266256299965289466679859367196428460973982386445836317587189206937027079897824305"), + boost::lexical_cast("12761819912582026651843152463021215992154459394009937175978814994945746602278901851117729809857828389754249241954336943913841981426527385882330272"), + boost::lexical_cast("20649058376862930966764036030509631786019440726559168907424267534212002902244191317797589177054256850728231628400173261501031188363554465780154577"), + boost::lexical_cast("33410878289444957618607188493530847778173900120569106083403082529157749504523093168915318986912085240482480870354510205414873169790081851662484849"), + boost::lexical_cast("54059936666307888585371224524040479564193340847128274990827350063369752406767284486712908163966342091210712498754683466915904358153636317442639426"), + boost::lexical_cast("87470814955752846203978413017571327342367240967697381074230432592527501911290377655628227150878427331693193369109193672330777527943718169105124275"), + boost::lexical_cast("141530751622060734789349637541611806906560581814825656065057782655897254318057662142341135314844769422903905867863877139246681886097354486547763701"), + boost::lexical_cast("229001566577813580993328050559183134248927822782523037139288215248424756229348039797969362465723196754597099236973070811577459414041072655652887976"), + boost::lexical_cast("370532318199874315782677688100794941155488404597348693204345997904322010547405701940310497780567966177501005104836947950824141300138427142200651677"), + boost::lexical_cast("599533884777687896776005738659978075404416227379871730343634213152746766776753741738279860246291162932098104341810018762401600714179499797853539653"), + boost::lexical_cast("970066202977562212558683426760773016559904631977220423547980211057068777324159443678590358026859129109599109446646966713225742014317926940054191330"), + boost::lexical_cast("1569600087755250109334689165420751091964320859357092153891614424209815544100913185416870218273150292041697213788456985475627342728497426737907730983"), + boost::lexical_cast("2539666290732812321893372592181524108524225491334312577439594635266884321425072629095460576300009421151296323235103952188853084742815353677961922313"), + boost::lexical_cast("4109266378488062431228061757602275200488546350691404731331209059476699865525985814512330794573159713192993537023560937664480427471312780415869653296"), + boost::lexical_cast("6648932669220874753121434349783799309012771842025717308770803694743584186951058443607791370873169134344289860258664889853333512214128134093831575609"), + boost::lexical_cast("10758199047708937184349496107386074509501318192717122040102012754220284052477044258120122165446328847537283397282225827517813939685440914509701228905"), + boost::lexical_cast("17407131716929811937470930457169873818514090034742839348872816448963868239428102701727913536319497981881573257540890717371147451899569048603532804514"), + boost::lexical_cast("28165330764638749121820426564555948328015408227459961388974829203184152291905146959848035701765826829418856654823116544888961391585009963113234033419"), + boost::lexical_cast("45572462481568561059291357021725822146529498262202800737847645652148020531333249661575949238085324811300429912364007262260108843484579011716766837933"), + boost::lexical_cast("73737793246207310181111783586281770474544906489662762126822474855332172823238396621423984939851151640719286567187123807149070235069588974830000871352"), + boost::lexical_cast("119310255727775871240403140608007592621074404751865562864670120507480193354571646282999934177936476452019716479551131069409179078554167986546767709285"), + boost::lexical_cast("193048048973983181421514924194289363095619311241528324991492595362812366177810042904423919117787628092739003046738254876558249313623756961376768580637"), + boost::lexical_cast("312358304701759052661918064802296955716693715993393887856162715870292559532381689187423853295724104544758719526289385945967428392177924947923536289922"), + boost::lexical_cast("505406353675742234083432988996586318812313027234922212847655311233104925710191732091847772413511732637497722573027640822525677705801681909300304870559"), + boost::lexical_cast("817764658377501286745351053798883274529006743228316100703818027103397485242573421279271625709235837182256442099317026768493106097979606857223841160481"), + boost::lexical_cast("1323171012053243520828784042795469593341319770463238313551473338336502410952765153371119398122747569819754164672344667591018783803781288766524146031040"), + boost::lexical_cast("2140935670430744807574135096594352867870326513691554414255291365439899896195338574650391023831983407002010606771661694359511889901760895623747987191521"), + boost::lexical_cast("3464106682483988328402919139389822461211646284154792727806764703776402307148103728021510421954730976821764771444006361950530673705542184390272133222561"), + boost::lexical_cast("5605042352914733135977054235984175329081972797846347142062056069216302203343442302671901445786714383823775378215668056310042563607303080014020120414082"), + boost::lexical_cast("9069149035398721464379973375373997790293619082001139869868820772992704510491546030693411867741445360645540149659674418260573237312845264404292253636643"), + boost::lexical_cast("14674191388313454600357027611358173119375591879847487011930876842209006713834988333365313313528159744469315527875342474570615800920148344418312374050725"), + boost::lexical_cast("23743340423712176064737000986732170909669210961848626881799697615201711224326534364058725181269605105114855677535016892831189038232993608822604627687368"), + boost::lexical_cast("38417531812025630665094028598090344029044802841696113893730574457410717938161522697424038494797764849584171205410359367401804839153141953240917001738093"), + boost::lexical_cast("62160872235737806729831029584822514938714013803544740775530272072612429162488057061482763676067369954699026882945376260232993877386135562063521629425461"), + boost::lexical_cast("100578404047763437394925058182912858967758816645240854669260846530023147100649579758906802170865134804283198088355735627634798716539277515304438631163554"), + boost::lexical_cast("162739276283501244124756087767735373906472830448785595444791118602635576263137636820389565846932504758982224971301111887867792593925413077367960260589015"), + boost::lexical_cast("263317680331264681519681145950648232874231647094026450114051965132658723363787216579296368017797639563265423059656847515502591310464690592672398891752569"), + boost::lexical_cast("426056956614765925644437233718383606780704477542812045558843083735294299626924853399685933864730144322247648030957959403370383904390103670040359152341584"), + boost::lexical_cast("689374636946030607164118379669031839654936124636838495672895048867953022990712069978982301882527783885513071090614806918872975214854794262712758044094153"), + boost::lexical_cast("1115431593560796532808555613387415446435640602179650541231738132603247322617636923378668235747257928207760719121572766322243359119244897932753117196435737"), + boost::lexical_cast("1804806230506827139972673993056447286090576726816489036904633181471200345608348993357650537629785712093273790212187573241116334334099692195465875240529890"), + boost::lexical_cast("2920237824067623672781229606443862732526217328996139578136371314074447668225985916736318773377043640301034509333760339563359693453344590128218992436965627"), + boost::lexical_cast("4725044054574450812753903599500310018616794055812628615041004495545648013834334910093969311006829352394308299545947912804476027787444282323684867677495517"), + boost::lexical_cast("7645281878642074485535133205944172751143011384808768193177375809620095682060320826830288084383872992695342808879708252367835721240788872451903860114461144"), + boost::lexical_cast("12370325933216525298289036805444482769759805440621396808218380305165743695894655736924257395390702345089651108425656165172311749028233154775588727791956661"), + boost::lexical_cast("20015607811858599783824170011388655520902816825430165001395756114785839377954976563754545479774575337784993917305364417540147470269022027227492587906417805"), + boost::lexical_cast("32385933745075125082113206816833138290662622266051561809614136419951583073849632300678802875165277682874645025731020582712459219297255182003081315698374466"), + boost::lexical_cast("52401541556933724865937376828221793811565439091481726811009892534737422451804608864433348354939853020659638943036385000252606689566277209230573903604792271"), + boost::lexical_cast("84787475302008849948050583645054932102228061357533288620624028954689005525654241165112151230105130703534283968767405582965065908863532391233655219303166737"), + boost::lexical_cast("137189016858942574813987960473276725913793500449015015431633921489426427977458850029545499585044983724193922911803790583217672598429809600464229122907959008"), + boost::lexical_cast("221976492160951424762038544118331658016021561806548304052257950444115433503113091194657650815150114427728206880571196166182738507293341991697884342211125745"), + boost::lexical_cast("359165509019893999576026504591608383929815062255563319483891871933541861480571941224203150400195098151922129792374986749400411105723151592162113465119084753"), + boost::lexical_cast("581142001180845424338065048709940041945836624062111623536149822377657294983685032418860801215345212579650336672946182915583149613016493583859997807330210498"), + boost::lexical_cast("940307510200739423914091553301548425875651686317674943020041694311199156464256973643063951615540310731572466465321169664983560718739645176022111272449295251"), + boost::lexical_cast("1521449511381584848252156602011488467821488310379786566556191516688856451447942006061924752830885523311222803138267352580566710331756138759882109079779505749"), + boost::lexical_cast("2461757021582324272166248155313036893697139996697461509576233211000055607912198979704988704446425834042795269603588522245550271050495783935904220352228801000"), + boost::lexical_cast("3983206532963909120418404757324525361518628307077248076132424727688912059360140985766913457277311357354018072741855874826116981382251922695786329432008306749"), + boost::lexical_cast("6444963554546233392584652912637562255215768303774709585708657938688967667272339965471902161723737191396813342345444397071667252432747706631690549784237107749"), + boost::lexical_cast("10428170087510142513003057669962087616734396610851957661841082666377879726632480951238815619001048548750831415087300271897784233814999629327476879216245414498"), + boost::lexical_cast("16873133642056375905587710582599649871950164914626667247549740605066847393904820916710717780724785740147644757432744668969451486247747335959167429000482522247"), + boost::lexical_cast("27301303729566518418590768252561737488684561525478624909390823271444727120537301867949533399725834288898476172520044940867235720062746965286644308216727936745"), + boost::lexical_cast("44174437371622894324178478835161387360634726440105292156940563876511574514442122784660251180450620029046120929952789609836687206310494301245811737217210458992"), + boost::lexical_cast("71475741101189412742769247087723124849319287965583917066331387147956301634979424652609784580176454317944597102472834550703922926373241266532456045433938395737"), + boost::lexical_cast("115650178472812307066947725922884512209954014405689209223271951024467876149421547437270035760627074346990718032425624160540610132683735567778267782651148854729"), + boost::lexical_cast("187125919574001719809716973010607637059273302371273126289603338172424177784400972089879820340803528664935315134898458711244533059056976834310723828085087250466"), + boost::lexical_cast("302776098046814026876664698933492149269227316776962335512875289196892053933822519527149856101430603011926033167324082871785143191740712402088991610736236105195"), + boost::lexical_cast("489902017620815746686381671944099786328500619148235461802478627369316231718223491617029676442234131676861348302222541583029676250797689236399715438821323355661"), + boost::lexical_cast("792678115667629773563046370877591935597727935925197797315353916566208285652046011144179532543664734688787381469546624454814819442538401638488707049557559460856"), + boost::lexical_cast("1282580133288445520249428042821691721926228555073433259117832543935524517370269502761209208985898866365648729771769166037844495693336090874888422488378882816517"), + boost::lexical_cast("2075258248956075293812474413699283657523956490998631056433186460501732803022315513905388741529563601054436111241315790492659315135874492513377129537936442277373"), + boost::lexical_cast("3357838382244520814061902456520975379450185046072064315551019004437257320392585016666597950515462467420084841013084956530503810829210583388265552026315325093890"), + boost::lexical_cast("5433096631200596107874376870220259036974141537070695371984205464938990123414900530571986692045026068474520952254400747023163125965085075901642681564251767371263"), + boost::lexical_cast("8790935013445116921936279326741234416424326583142759687535224469376247443807485547238584642560488535894605793267485703553666936794295659289908233590567092465153"), + boost::lexical_cast("14224031644645713029810656196961493453398468120213455059519429934315237567222386077810571334605514604369126745521886450576830062759380735191550915154818859836416"), + boost::lexical_cast("23014966658090829951746935523702727869822794703356214747054654403691485011029871625049155977166003140263732538789372154130496999553676394481459148745385952301569"), + boost::lexical_cast("37238998302736542981557591720664221323221262823569669806574084338006722578252257702859727311771517744632859284311258604707327062313057129673010063900204812137985"), + boost::lexical_cast("60253964960827372933304527244366949193044057526925884553628738741698207589282129327908883288937520884896591823100630758837824061866733524154469212645590764439554"), + boost::lexical_cast("97492963263563915914862118965031170516265320350495554360202823079704930167534387030768610600709038629529451107411889363545151124179790653827479276545795576577539"), + boost::lexical_cast("157746928224391288848166646209398119709309377877421438913831561821403137756816516358677493889646559514426042930512520122382975186046524177981948489191386341017093"), + boost::lexical_cast("255239891487955204763028765174429290225574698227916993274034384901108067924350903389446104490355598143955494037924409485928126310226314831809427765737181917594632"), + boost::lexical_cast("412986819712346493611195411383827409934884076105338432187865946722511205681167419748123598380002157658381536968436929608311101496272839009791376254928568258611725"), + boost::lexical_cast("668226711200301698374224176558256700160458774333255425461900331623619273605518323137569702870357755802337031006361339094239227806499153841600804020665750176206357"), + boost::lexical_cast("1081213530912648191985419587942084110095342850438593857649766278346130479286685742885693301250359913460718567974798268702550329302771992851392180275594318434818082"), + boost::lexical_cast("1749440242112949890359643764500340810255801624771849283111666609969749752892204066023263004120717669263055598981159607796789557109271146692992984296260068611024439"), + boost::lexical_cast("2830653773025598082345063352442424920351144475210443140761432888315880232178889808908956305371077582723774166955957876499339886412043139544385164571854387045842521"), + boost::lexical_cast("4580094015138547972704707116942765730606946099982292423873099498285629985071093874932219309491795251986829765937117484296129443521314286237378148868114455656866960"), + boost::lexical_cast("7410747788164146055049770469385190650958090575192735564634532386601510217249983683841175614862872834710603932893075360795469329933357425781763313439968842702709481"), + boost::lexical_cast("11990841803302694027754477586327956381565036675175027988507631884887140202321077558773394924354668086697433698830192845091598773454671712019141462308083298359576441"), + boost::lexical_cast("19401589591466840082804248055713147032523127250367763553142164271488650419571061242614570539217540921408037631723268205887068103388029137800904775748052141062285922"), + boost::lexical_cast("31392431394769534110558725642041103414088163925542791541649796156375790621892138801387965463572209008105471330553461050978666876842700849820046238056135439421862363"), + boost::lexical_cast("50794020986236374193362973697754250446611291175910555094791960427864441041463200044002536002789749929513508962276729256865734980230729987620951013804187580484148285"), + boost::lexical_cast("82186452381005908303921699339795353860699455101453346636441756584240231663355338845390501466361958937618980292830190307844401857073430837440997251860323019906010648"), + boost::lexical_cast("132980473367242282497284673037549604307310746277363901731233717012104672704818538889393037469151708867132489255106919564710136837304160825061948265664510600390158933"), + boost::lexical_cast("215166925748248190801206372377344958168010201378817248367675473596344904368173877734783538935513667804751469547937109872554538694377591662502945517524833620296169581"), + boost::lexical_cast("348147399115490473298491045414894562475320947656181150098909190608449577072992416624176576404665376671883958803044029437264675531681752487564893783189344220686328514"), + boost::lexical_cast("563314324863738664099697417792239520643331149034998398466584664204794481441166294358960115340179044476635428350981139309819214226059344150067839300714177840982498095"), + boost::lexical_cast("911461723979229137398188463207134083118652096691179548565493854813244058514158710983136691744844421148519387154025168747083889757741096637632733083903522061668826609"), + boost::lexical_cast("1474776048842967801497885880999373603761983245726177947032078519018038539955325005342096807085023465625154815505006308056903103983800440787700572384617699902651324704"), + boost::lexical_cast("2386237772822196938896074344206507686880635342417357495597572373831282598469483716325233498829867886773674202659031476803986993741541537425333305468521221964320151313"), + boost::lexical_cast("3861013821665164740393960225205881290642618588143535442629650892849321138424808721667330305914891352398829018164037784860890097725341978213033877853138921866971476017"), + boost::lexical_cast("6247251594487361679290034569412388977523253930560892938227223266680603736894292437992563804744759239172503220823069261664877091466883515638367183321660143831291627330"), + boost::lexical_cast("10108265416152526419683994794618270268165872518704428380856874159529924875319101159659894110659650591571332238987107046525767189192225493851401061174799065698263103347"), + boost::lexical_cast("16355517010639888098974029364030659245689126449265321319084097426210528612213393597652457915404409830743835459810176308190644280659109009489768244496459209529554730677"), + boost::lexical_cast("26463782426792414518658024158648929513854998967969749699940971585740453487532494757312352026064060422315167698797283354716411469851334503341169305671258275227817834024"), + boost::lexical_cast("42819299437432302617632053522679588759544125417235071019025069011950982099745888354964809941468470253059003158607459662907055750510443512830937550167717484757372564701"), + boost::lexical_cast("69283081864224717136290077681328518273399124385204820718966040597691435587278383112277161967532530675374170857404743017623467220361778016172106855838975759985190398725"), + boost::lexical_cast("112102381301657019753922131204008107032943249802439891737991109609642417687024271467241971909001000928433174016012202680530522970872221529003044406006693244742562963426"), + boost::lexical_cast("181385463165881736890212208885336625306342374187644712456957150207333853274302654579519133876533531603807344873416945698153990191233999545175151261845669004727753362151"), + boost::lexical_cast("293487844467538756644134340089344732339285623990084604194948259816976270961326926046761105785534532532240518889429148378684513162106221074178195667852362249470316325577"), + boost::lexical_cast("474873307633420493534346548974681357645627998177729316651905410024310124235629580626280239662068064136047863762846094076838503353340220619353346929698031254198069687728"), + boost::lexical_cast("768361152100959250178480889064026089984913622167813920846853669841286395196956506673041345447602596668288382652275242455523016515446441693531542597550393503668386013305"), + boost::lexical_cast("1243234459734379743712827438038707447630541620345543237498759079865596519432586087299321585109670660804336246415121336532361519868786662312884889527248424757866455701033"), + boost::lexical_cast("2011595611835338993891308327102733537615455242513357158345612749706882914629542593972362930557273257472624629067396578987884536384233104006416432124798818261534841714338"), + boost::lexical_cast("3254830071569718737604135765141440985245996862858900395844371829572479434062128681271684515666943918276960875482517915520246056253019766319301321652047243019401297415371"), + boost::lexical_cast("5266425683405057731495444092244174522861452105372257554189984579279362348691671275244047446224217175749585504549914494508130592637252870325717753776846061280936139129709"), + boost::lexical_cast("8521255754974776469099579857385615508107448968231157950034356408851841782753799956515731961891161094026546380032432410028376648890272636645019075428893304300337436545080"), + boost::lexical_cast("13787681438379834200595023949629790030968901073603415504224340988131204131445471231759779408115378269776131884582346904536507241527525506970736829205739365581273575674789"), + boost::lexical_cast("22308937193354610669694603807015405539076350041834573454258697396983045914199271188275511370006539363802678264614779314564883890417798143615755904634632669881611012219869"), + boost::lexical_cast("36096618631734444870289627756645195570045251115437988958483038385114250045644742420035290778121917633578810149197126219101391131945323650586492733840372035462884587894658"), + boost::lexical_cast("58405555825089055539984231563660601109121601157272562412741735782097295959844013608310802148128456997381488413811905533666275022363121794202248638475004705344495600114527"), + boost::lexical_cast("94502174456823500410273859320305796679166852272710551371224774167211546005488756028346092926250374630960298563009031752767666154308445444788741372315376740807380188009185"), + boost::lexical_cast("152907730281912555950258090883966397788288453429983113783966509949308841965332769636656895074378831628341786976820937286433941176671567238990990010790381446151875788123712"), + boost::lexical_cast("247409904738736056360531950204272194467455305702693665155191284116520387970821525665002988000629206259302085539829969039201607330980012683779731383105758186959255976132897"), + boost::lexical_cast("400317635020648612310790041088238592255743759132676778939157794065829229936154295301659883075008037887643872516650906325635548507651579922770721393896139633111131764256609"), + boost::lexical_cast("647727539759384668671321991292510786723199064835370444094349078182349617906975820966662871075637244146945958056480875364837155838631592606550452777001897820070387740389506"), + boost::lexical_cast("1048045174780033280982112032380749378978942823968047223033506872248178847843130116268322754150645282034589830573131781690472704346283172529321174170898037453181519504646115"), + boost::lexical_cast("1695772714539417949653434023673260165702141888803417667127855950430528465750105937234985625226282526181535788629612657055309860184914765135871626947899935273251907245035621"), + boost::lexical_cast("2743817889319451230635546056054009544681084712771464890161362822678707313593236053503308379376927808216125619202744438745782564531197937665192801118797972726433426749681736"), + boost::lexical_cast("4439590603858869180288980079727269710383226601574882557289218773109235779343341990738294004603210334397661407832357095801092424716112702801064428066697907999685333994717357"), + boost::lexical_cast("7183408493178320410924526135781279255064311314346347447450581595787943092936578044241602383980138142613787027035101534546874989247310640466257229185495880726118760744399093"), + boost::lexical_cast("11622999097037189591213506215508548965447537915921230004739800368897178872279920034979896388583348477011448434867458630347967413963423343267321657252193788725804094739116450"), + boost::lexical_cast("18806407590215510002138032351289828220511849230267577452190381964685121965216498079221498772563486619625235461902560164894842403210733983733578886437689669451922855483515543"), + boost::lexical_cast("30429406687252699593351538566798377185959387146188807456930182333582300837496418114201395161146835096636683896770018795242809817174157327000900543689883458177726950222631993"), + boost::lexical_cast("49235814277468209595489570918088205406471236376456384909120564298267422802712916193422893933710321716261919358672578960137652220384891310734479430127573127629649805706147536"), + boost::lexical_cast("79665220964720909188841109484886582592430623522645192366050746631849723640209334307624289094857156812898603255442597755380462037559048637735379973817456585807376755928779529"), + boost::lexical_cast("128901035242189118784330680402974787998901859899101577275171310930117146442922250501047183028567478529160522614115176715518114257943939948469859403945029713437026561634927065"), + boost::lexical_cast("208566256206910027973171789887861370591332483421746769641222057561966870083131584808671472123424635342059125869557774470898576295502988586205239377762486299244403317563706594"), + boost::lexical_cast("337467291449099146757502470290836158590234343320848346916393368492084016526053835309718655151992113871219648483672951186416690553446928534675098781707516012681429879198633659"), + boost::lexical_cast("546033547656009174730674260178697529181566826742595116557615426054050886609185420118390127275416749213278774353230725657315266848949917120880338159470002311925833196762340253"), + boost::lexical_cast("883500839105108321488176730469533687771801170063443463474008794546134903135239255428108782427408863084498422836903676843731957402396845655555436941177518324607263075960973912"), + boost::lexical_cast("1429534386761117496218850990648231216953367996806038580031624220600185789744424675546498909702825612297777197190134402501047224251346762776435775100647520636533096272723314165"), + boost::lexical_cast("2313035225866225817707027721117764904725169166869482043505633015146320692879663930974607692130234475382275620027038079344779181653743608431991212041825038961140359348684288077"), + boost::lexical_cast("3742569612627343313925878711765996121678537163675520623537257235746506482624088606521106601833060087680052817217172481845826405905090371208426987142472559597673455621407602242"), + boost::lexical_cast("6055604838493569131632906432883761026403706330545002667042890250892827175503752537495714293963294563062328437244210561190605587558833979640418199184297598558813814970091890319"), + boost::lexical_cast("9798174451120912445558785144649757148082243494220523290580147486639333658127841144016820895796354650742381254461383043036431993463924350848845186326770158156487270591499492561"), + boost::lexical_cast("15853779289614481577191691577533518174485949824765525957623037737532160833631593681512535189759649213804709691705593604227037581022758330489263385511067756715301085561591382880"), + boost::lexical_cast("25651953740735394022750476722183275322568193318986049248203185224171494491759434825529356085556003864547090946166976647263469574486682681338108571837837914871788356153090875441"), + boost::lexical_cast("41505733030349875599942168299716793497054143143751575205826222961703655325391028507041891275315653078351800637872570251490507155509441011827371957348905671587089441714682258321"), + boost::lexical_cast("67157686771085269622692645021900068819622336462737624454029408185875149817150463332571247360871656942898891584039546898753976729996123693165480529186743586458877797867773133762"), + boost::lexical_cast("108663419801435145222634813321616862316676479606489199659855631147578805142541491839613138636187310021250692221912117150244483885505564704992852486535649258045967239582455392083"), + boost::lexical_cast("175821106572520414845327458343516931136298816069226824113885039333453954959691955172184385997058966964149583805951664048998460615501688398158333015722392844504845037450228525845"), + boost::lexical_cast("284484526373955560067962271665133793452975295675716023773740670481032760102233447011797524633246276985400276027863781199242944501007253103151185502258042102550812277032683917928"), + boost::lexical_cast("460305632946475974913289730008650724589274111744942847887625709814486715061925402183981910630305243949549859833815445248241405116508941501309518517980434947055657314482912443773"), + boost::lexical_cast("744790159320431534981252001673784518042249407420658871661366380295519475164158849195779435263551520934950135861679226447484349617516194604460704020238477049606469591515596361701"), + boost::lexical_cast("1205095792266907509894541731682435242631523519165601719548992090110006190226084251379761345893856764884499995695494671695725754734025136105770222538218911996662126905998508805474"), + boost::lexical_cast("1949885951587339044875793733356219760673772926586260591210358470405525665390243100575540781157408285819450131557173898143210104351541330710230926558457389046268596497514105167175"), + boost::lexical_cast("3154981743854246554770335465038655003305296445751862310759350560515531855616327351955302127051265050703950127252668569838935859085566466816001149096676301042930723403512613972649"), + boost::lexical_cast("5104867695441585599646129198394874763979069372338122901969709030921057521006570452530842908208673336523400258809842467982145963437107797526232075655133690089199319901026719139824"), + boost::lexical_cast("8259849439295832154416464663433529767284365818089985212729059591436589376622897804486145035259938387227350386062511037821081822522674264342233224751809991132130043304539333112473"), + boost::lexical_cast("13364717134737417754062593861828404531263435190428108114698768622357646897629468257016987943468611723750750644872353505803227785959782061868465300406943681221329363205566052252297"), + boost::lexical_cast("21624566574033249908479058525261934298547801008518093327427828213794236274252366061503132978728550110978101030934864543624309608482456326210698525158753672353459406510105385364770"), + boost::lexical_cast("34989283708770667662541652387090338829811236198946201442126596836151883171881834318520120922197161834728851675807218049427537394442238388079163825565697353574788769715671437617067"), + boost::lexical_cast("56613850282803917571020710912352273128359037207464294769554425049946119446134200380023253900925711945706952706742082593051847002924694714289862350724451025928248176225776822981837"), + boost::lexical_cast("91603133991574585233562363299442611958170273406410496211681021886098002618016034698543374823122873780435804382549300642479384397366933102369026176290148379503036945941448260598904"), + boost::lexical_cast("148216984274378502804583074211794885086529310613874790981235446936044122064150235078566628724048585726142757089291383235531231400291627816658888527014599405431285122167225083580741"), + boost::lexical_cast("239820118265953088038145437511237497044699584020285287192916468822142124682166269777110003547171459506578561471840683878010615797658560919027914703304747784934322068108673344179645"), + boost::lexical_cast("388037102540331590842728511723032382131228894634160078174151915758186246746316504855676632271220045232721318561132067113541847197950188735686803230319347190365607190275898427760386"), + boost::lexical_cast("627857220806284678880873949234269879175928478654445365367068384580328371428482774632786635818391504739299880032972750991552462995608749654714717933624094975299929258384571771940031"), + boost::lexical_cast("1015894323346616269723602460957302261307157373288605443541220300338514618174799279488463268089611549972021198594104818105094310193558938390401521163943442165665536448660470199700417"), + boost::lexical_cast("1643751544152900948604476410191572140483085851943050808908288684918842989603282054121249903908003054711321078627077569096646773189167688045116239097567537140965465707045041971640448"), + boost::lexical_cast("2659645867499517218328078871148874401790243225231656252449508985257357607778081333609713171997614604683342277221182387201741083382726626435517760261510979306631002155705512171340865"), + boost::lexical_cast("4303397411652418166932555281340446542273329077174707061357797670176200597381363387730963075905617659394663355848259956298387856571894314480633999359078516447596467862750554142981313"), + boost::lexical_cast("6963043279151935385260634152489320944063572302406363313807306655433558205159444721340676247903232264078005633069442343500128939954620940916151759620589495754227470018456066314322178"), + boost::lexical_cast("11266440690804353552193189433829767486336901379581070375165104325609758802540808109071639323808849923472668988917702299798516796526515255396785758979668012201823937881206620457303491"), + boost::lexical_cast("18229483969956288937453823586319088430400473681987433688972410981043317007700252830412315571712082187550674621987144643298645736481136196312937518600257507956051407899662686771625669"), + boost::lexical_cast("29495924660760642489647013020148855916737375061568504064137515306653075810241060939483954895520932111023343610904846943097162533007651451709723277579925520157875345780869307228929160"), + boost::lexical_cast("47725408630716931427100836606467944347137848743555937753109926287696392817941313769896270467233014298574018232891991586395808269488787648022660796180183028113926753680531994000554829"), + boost::lexical_cast("77221333291477573916747849626616800263875223805124441817247441594349468628182374709380225362753946409597361843796838529492970802496439099732384073760108548271802099461401301229483989"), + boost::lexical_cast("124946741922194505343848686233084744611013072548680379570357367882045861446123688479276495829986960708171380076688830115888779071985226747755044869940291576385728853141933295230038818"), + boost::lexical_cast("202168075213672079260596535859701544874888296353804821387604809476395330074306063188656721192740907117768741920485668645381749874481665847487428943700400124657530952603334596459522807"), + boost::lexical_cast("327114817135866584604445222092786289485901368902485200957962177358441191520429751667933217022727867825940121997174498761270528946466892595242473813640691701043259805745267891689561625"), + boost::lexical_cast("529282892349538663865041757952487834360789665256290022345566986834836521594735814856589938215468774943708863917660167406652278820948558442729902757341091825700790758348602488149084432"), + boost::lexical_cast("856397709485405248469486980045274123846691034158775223303529164193277713115165566524523155238196642769648985914834666167922807767415451037972376570981783526744050564093870379838646057"), + boost::lexical_cast("1385680601834943912334528737997761958207480699415065245649096151028114234709901381381113093453665417713357849832494833574575086588364009480702279328322875352444841322442472867987730489"), + boost::lexical_cast("2242078311320349160804015718043036082054171733573840468952625315221391947825066947905636248691862060483006835747329499742497894355779460518674655899304658879188891886536343247826376546"), + boost::lexical_cast("3627758913155293073138544456040798040261652432988905714601721466249506182534968329286749342145527478196364685579824333317072980944143469999376935227627534231633733208978816115814107035"), + boost::lexical_cast("5869837224475642233942560174083834122315824166562746183554346781470898130360035277192385590837389538679371521327153833059570875299922930518051591126932193110822625095515159363640483581"), + boost::lexical_cast("9497596137630935307081104630124632162577476599551651898156068247720404312895003606479134932982917016875736206906978166376643856244066400517428526354559727342456358304493975479454590616"), + boost::lexical_cast("15367433362106577541023664804208466284893300766114398081710415029191302443255038883671520523820306555555107728234131999436214731543989331035480117481491920453278983400009134843095074197"), + boost::lexical_cast("24865029499737512848104769434333098447470777365666049979866483276911706756150042490150655456803223572430843935141110165812858587788055731552908643836051647795735341704503110322549664813"), + boost::lexical_cast("40232462861844090389128434238541564732364078131780448061576898306103009199405081373822175980623530127985951663375242165249073319332045062588388761317543568249014325104512245165644739010"), + boost::lexical_cast("65097492361581603237233203672874663179834855497446498041443381583014715955555123863972831437426753700416795598516352331061931907120100794141297405153595216044749666809015355488194403823"), + boost::lexical_cast("105329955223425693626361637911416227912198933629226946103020279889117725154960205237795007418050283828402747261891594496311005226452145856729686166471138784293763991913527600653839142833"), + boost::lexical_cast("170427447585007296863594841584290891092033789126673444144463661472132441110515329101767838855477037528819542860407946827372937133572246650870983571624734000338513658722542956142033546656"), + boost::lexical_cast("275757402808432990489956479495707119004232722755900390247483941361250166265475534339562846273527321357222290122299541323683942360024392507600669738095872784632277650636070556795872689489"), + boost::lexical_cast("446184850393440287353551321079998010096266511882573834391947602833382607375990863441330685129004358886041832982707488151056879493596639158471653309720606784970791309358613512937906236145"), + boost::lexical_cast("721942253201873277843507800575705129100499234638474224639431544194632773641466397780893531402531680243264123105007029474740821853621031666072323047816479569603068959994684069733778925634"), + boost::lexical_cast("1168127103595313565197059121655703139196765746521048059031379147028015381017457261222224216531536039129305956087714517625797701347217670824543976357537086354573860269353297582671685161779"), + boost::lexical_cast("1890069356797186843040566922231408268297264981159522283670810691222648154658923659003117747934067719372570079192721547100538523200838702490616299405353565924176929229347981652405464087413"), + boost::lexical_cast("3058196460392500408237626043887111407494030727680570342702189838250663535676380920225341964465603758501876035280436064726336224548056373315160275762890652278750789498701279235077149249192"), + boost::lexical_cast("4948265817189687251278192966118519675791295708840092626373000529473311690335304579228459712399671477874446114473157611826874747748895075805776575168244218202927718728049260887482613336605"), + boost::lexical_cast("8006462277582187659515819010005631083285326436520662969075190367723975226011685499453801676865275236376322149753593676553210972296951449120936850931134870481678508226750540122559762585797"), + boost::lexical_cast("12954728094771874910794011976124150759076622145360755595448190897197286916346990078682261389264946714250768264226751288380085720045846524926713426099379088684606226954799801010042375922402"), + boost::lexical_cast("20961190372354062570309830986129781842361948581881418564523381264921262142358675578136063066130221950627090413980344964933296692342797974047650277030513959166284735181550341132602138508199"), + boost::lexical_cast("33915918467125937481103842962253932601438570727242174159971572162118549058705665656818324455395168664877858678207096253313382412388644498974363703129893047850890962136350142142644514430601"), + boost::lexical_cast("54877108839480000051413673948383714443800519309123592724494953427039811201064341234954387521525390615504949092187441218246679104731442473022013980160407007017175697317900483275246652938800"), + boost::lexical_cast("88793027306605937532517516910637647045239090036365766884466525589158360259770006891772711976920559280382807770394537471560061517120086971996377683290300054868066659454250625417891167369401"), + boost::lexical_cast("143670136146085937583931190859021361489039609345489359608961479016198171460834348126727099498445949895887756862581978689806740621851529445018391663450707061885242356772151108693137820308201"), + boost::lexical_cast("232463163452691875116448707769659008534278699381855126493428004605356531720604355018499811475366509176270564632976516161366802138971616417014769346741007116753309016226401734111028987677602"), + boost::lexical_cast("376133299598777812700379898628680370023318308727344486102389483621554703181438703145226910973812459072158321495558494851173542760823145862033161010191714178638551372998552842804166807985803"), + boost::lexical_cast("608596463051469687816828606398339378557597008109199612595817488226911234902043058163726722449178968248428886128535011012540344899794762279047930356932721295391860389224954576915195795663405"), + boost::lexical_cast("984729762650247500517208505027019748580915316836544098698206971848465938083481761308953633422991427320587207624093505863713887660617908141081091367124435474030411762223507419719362603649208"), + boost::lexical_cast("1593326225701717188334037111425359127138512324945743711294024460075377172985524819472680355872170395569016093752628516876254232560412670420129021724057156769422272151448461996634558399312613"), + boost::lexical_cast("2578055988351964688851245616452378875719427641782287809992231431923843111069006580781633989295161822889603301376722022739968120221030578561210113091181592243452683913671969416353921002961821"), + boost::lexical_cast("4171382214053681877185282727877738002857939966728031521286255891999220284054531400254314345167332218458619395129350539616222352781443248981339134815238749012874956065120431412988479402274434"), + boost::lexical_cast("6749438202405646566036528344330116878577367608510319331278487323923063395123537981035948334462494041348222696506072562356190473002473827542549247906420341256327639978792400829342400405236255"), + boost::lexical_cast("10920820416459328443221811072207854881435307575238350852564743215922283679178069381290262679629826259806842091635423101972412825783917076523888382721659090269202596043912832242330879807510689"), + boost::lexical_cast("17670258618864975009258339416537971760012675183748670183843230539845347074301607362326211014092320301155064788141495664328603298786390904066437630628079431525530236022705233071673280212746944"), + boost::lexical_cast("28591079035324303452480150488745826641447982758987021036407973755767630753479676743616473693722146560961906879776918766301016124570307980590326013349738521794732832066618065314004160020257633"), + boost::lexical_cast("46261337654189278461738489905283798401460657942735691220251204295612977827781284105942684707814466862116971667918414430629619423356698884656763643977817953320263068089323298385677440233004577"), + boost::lexical_cast("74852416689513581914218640394029625042908640701722712256659178051380608581260960849559158401536613423078878547695333196930635547927006865247089657327556475114995900155941363699681600253262210"), + boost::lexical_cast("121113754343702860375957130299313423444369298644458403476910382346993586409042244955501843109351080285195850215613747627560254971283705749903853301305374428435258968245264662085359040486266787"), + boost::lexical_cast("195966171033216442290175770693343048487277939346181115733569560398374194990303205805061001510887693708274728763309080824490890519210712615150942958632930903550254868401206025785040640739528997"), + boost::lexical_cast("317079925376919302666132900992656471931647237990639519210479942745367781399345450760562844620238773993470578978922828452051145490494418365054796259938305331985513836646470687870399681225795784"), + boost::lexical_cast("513046096410135744956308671685999520418925177336820634944049503143741976389648656565623846131126467701745307742231909276542036009705130980205739218571236235535768705047676713655440321965324781"), + boost::lexical_cast("830126021787055047622441572678655992350572415327460154154529445889109757788994107326186690751365241695215886721154737728593181500199549345260535478509541567521282541694147401525840003191120565"), + boost::lexical_cast("1343172118197190792578750244364655512769497592664280789098578949032851734178642763891810536882491709396961194463386647005135217509904680325466274697080777803057051246741824115181280325156445346"), + boost::lexical_cast("2173298139984245840201191817043311505120070007991740943253108394921961491967636871217997227633856951092177081184541384733728399010104229670726810175590319370578333788435971516707120328347565911"), + boost::lexical_cast("3516470258181436632779942061407967017889567600656021732351687343954813226146279635109807764516348660489138275647928031738863616520008909996193084872671097173635385035177795631888400653504011257"), + boost::lexical_cast("5689768398165682472981133878451278523009637608647762675604795738876774718113916506327804992150205611581315356832469416472592015530113139666919895048261416544213718823613767148595520981851577168"), + boost::lexical_cast("9206238656347119105761075939859245540899205209303784407956483082831587944260196141437612756666554272070453632480397448211455632050122049663112979920932513717849103858791562780483921635355588425"), + boost::lexical_cast("14896007054512801578742209818310524063908842817951547083561278821708362662374112647765417748816759883651768989312866864684047647580235189330032874969193930262062822682405329929079442617207165593"), + boost::lexical_cast("24102245710859920684503285758169769604808048027255331491517761904539950606634308789203030505483314155722222621793264312895503279630357238993145854890126443979911926541196892709563364252562754018"), + boost::lexical_cast("38998252765372722263245495576480293668716890845206878575079040726248313269008421436968448254300074039373991611106131177579550927210592428323178729859320374241974749223602222638642806869769919611"), + boost::lexical_cast("63100498476232642947748781334650063273524938872462210066596802630788263875642730226171478759783388195096214232899395490475054206840949667316324584749446818221886675764799115348206171122332673629"), + boost::lexical_cast("102098751241605365210994276911130356942241829717669088641675843357036577144651151663139927014083462234470205844005526668054605134051542095639503314608767192463861424988401337986848977992102593240"), + boost::lexical_cast("165199249717838008158743058245780420215766768590131298708272645987824841020293881889311405773866850429566420076904922158529659340892491762955827899358214010685748100753200453335055149114435266869"), + boost::lexical_cast("267298000959443373369737335156910777158008598307800387349948489344861418164945033552451332787950312664036625920910448826584264474944033858595331213966981203149609525741601791321904127106537860109"), + boost::lexical_cast("432497250677281381528480393402691197373775366897931686058221135332686259185238915441762738561817163093603045997815370985113923815836525621551159113325195213835357626494802244656959276220973126978"), + boost::lexical_cast("699795251636724754898217728559601974531783965205732073408169624677547677350183948994214071349767475757639671918725819811698188290780559480146490327292176416984967152236404035978863403327510987087"), + boost::lexical_cast("1132292502314006136426698121962293171905559332103663759466390760010233936535422864435976809911584638851242717916541190796812112106617085101697649440617371630820324778731206280635822679548484114065"), + boost::lexical_cast("1832087753950730891324915850521895146437343297309395832874560384687781613885606813430190881261352114608882389835267010608510300397397644581844139767909548047805291930967610316614686082875995101152"), + boost::lexical_cast("2964380256264737027751613972484188318342902629413059592340951144698015550421029677866167691172936753460125107751808201405322412504014729683541789208526919678625616709698816597250508762424479215217"), + boost::lexical_cast("4796468010215467919076529823006083464780245926722455425215511529385797164306636491296358572434288868069007497587075212013832712901412374265385928976436467726430908640666426913865194845300474316369"), + boost::lexical_cast("7760848266480204946828143795490271783123148556135515017556462674083812714727666169162526263607225621529132605338883413419155125405427103948927718184963387405056525350365243511115703607724953531586"), + boost::lexical_cast("12557316276695672865904673618496355247903394482857970442771974203469609879034302660458884836041514489598140102925958625432987838306839478214313647161399855131487433991031670424980898453025427847955"), + boost::lexical_cast("20318164543175877812732817413986627031026543038993485460328436877553422593761968829621411099648740111127272708264842038852142963712266582163241365346363242536543959341396913936096602060750381379541"), + boost::lexical_cast("32875480819871550678637491032482982278929937521851455903100411081023032472796271490080295935690254600725412811190800664285130802019106060377555012507763097668031393332428584361077500513775809227496"), + boost::lexical_cast("53193645363047428491370308446469609309956480560844941363428847958576455066558240319701707035338994711852685519455642703137273765731372642540796377854126340204575352673825498297174102574526190607037"), + boost::lexical_cast("86069126182918979170007799478952591588886418082696397266529259039599487539354511809782002971029249312578098330646443367422404567750478702918351390361889437872606746006254082658251603088301999834533"), + boost::lexical_cast("139262771545966407661378107925422200898842898643541338629958106998175942605912752129483710006368244024430783850102086070559678333481851345459147768216015778077182098680079580955425705662828190441570"), + boost::lexical_cast("225331897728885386831385907404374792487729316726237735896487366037775430145267263939265712977397493337008882180748529437982082901232330048377499158577905215949788844686333663613677308751130190276103"), + boost::lexical_cast("364594669274851794492764015329796993386572215369779074526445473035951372751180016068749422983765737361439666030850615508541761234714181393836646926793920994026970943366413244569103014413958380717673"), + boost::lexical_cast("589926567003737181324149922734171785874301532096016810422932839073726802896447280008015135961163230698448548211599144946523844135946511442214146085371826209976759788052746908182780323165088570993776"), + boost::lexical_cast("954521236278588975816913938063968779260873747465795884949378312109678175647627296076764558944928968059888214242449760455065605370660692836050793012165747204003730731419160152751883337579046951711449"), + boost::lexical_cast("1544447803282326157141063860798140565135175279561812695372311151183404978544074576084779694906092198758336762454048905401589449506607204278264939097537573413980490519471907060934663660744135522705225"), + boost::lexical_cast("2498969039560915132957977798862109344396049027027608580321689463293083154191701872161544253851021166818224976696498665856655054877267897114315732109703320617984221250891067213686546998323182474416674"), + boost::lexical_cast("4043416842843241290099041659660249909531224306589421275694000614476488132735776448246323948757113365576561739150547571258244504383875101392580671207240894031964711770362974274621210659067317997121899"), + boost::lexical_cast("6542385882404156423057019458522359253927273333617029856015690077769571286927478320407868202608134532394786715847046237114899559261142998506896403316944214649948933021254041488307757657390500471538573"), + boost::lexical_cast("10585802725247397713156061118182609163458497640206451131709690692246059419663254768654192151365247897971348454997593808373144063645018099899477074524185108681913644791617015762928968316457818468660472"), + boost::lexical_cast("17128188607651554136213080576704968417385770973823480987725380770015630706590733089062060353973382430366135170844640045488043622906161098406373477841129323331862577812871057251236725973848318940199045"), + boost::lexical_cast("27713991332898951849369141694887577580844268614029932119435071462261690126253987857716252505338630328337483625842233853861187686551179198305850552365314432013776222604488073014165694290306137408859517"), + boost::lexical_cast("44842179940550505985582222271592545998230039587853413107160452232277320832844720946778312859312012758703618796686873899349231309457340296712224030206443755345638800417359130265402420264154456349058562"), + boost::lexical_cast("72556171273449457834951363966480123579074308201883345226595523694539010959098708804494565364650643087041102422529107753210418996008519495018074582571758187359415023021847203279568114554460593757918079"), + boost::lexical_cast("117398351213999963820533586238072669577304347789736758333755975926816331791943429751272878223962655845744721219215981652559650305465859791730298612778201942705053823439206333544970534818615050106976641"), + boost::lexical_cast("189954522487449421655484950204552793156378655991620103560351499621355342751042138555767443588613298932785823641745089405770069301474379286748373195349960130064468846461053536824538649373075643864894720"), + boost::lexical_cast("307352873701449385476018536442625462733683003781356861894107475548171674542985568307040321812575954778530544860961071058329719606940239078478671808128162072769522669900259870369509184191690693971871361"), + boost::lexical_cast("497307396188898807131503486647178255890061659772976965454458975169527017294027706862807765401189253711316368502706160464099788908414618365227045003478122202833991516361313407194047833564766337836766081"), + boost::lexical_cast("804660269890348192607522023089803718623744663554333827348566450717698691837013275169848087213765208489846913363667231522429508515354857443705716811606284275603514186261573277563557017756457031808637442"), + boost::lexical_cast("1301967666079246999739025509736981974513806323327310792803025425887225709131040982032655852614954462201163281866373391986529297423769475808932761815084406478437505702622886684757604851321223369645403523"), + boost::lexical_cast("2106627935969595192346547532826785693137550986881644620151591876604924400968054257202503939828719670691010195230040623508958805939124333252638478626690690754041019888884459962321161869077680401454040965"), + boost::lexical_cast("3408595602048842192085573042563767667651357310208955412954617302492150110099095239235159792443674132892173477096414015495488103362893809061571240441775097232478525591507346647078766720398903771099444488"), + boost::lexical_cast("5515223538018437384432120575390553360788908297090600033106209179097074511067149496437663732272393803583183672326454639004446909302018142314209719068465787986519545480391806609399928589476584172553485453"), + boost::lexical_cast("8923819140067279576517693617954321028440265607299555446060826481589224621166244735672823524716067936475357149422868654499935012664911951375780959510240885218998071071899153256478695309875487943652929941"), + boost::lexical_cast("14439042678085716960949814193344874389229173904390155479167035660686299132233394232110487256988461740058540821749323293504381921966930093689990678578706673205517616552290959865878623899352072116206415394"), + boost::lexical_cast("23362861818152996537467507811299195417669439511689710925227862142275523753399638967783310781704529676533897971172191948004316934631842045065771638088947558424515687624190113122357319209227560059859345335"), + boost::lexical_cast("37801904496238713498417322004644069806898613416079866404394897802961822885633033199893798038692991416592438792921515241508698856598772138755762316667654231630033304176481072988235943108579632176065760729"), + boost::lexical_cast("61164766314391710035884829815943265224568052927769577329622759945237346639032672167677108820397521093126336764093707189513015791230614183821533954756601790054548991800671186110593262317807192235925106064"), + boost::lexical_cast("98966670810630423534302151820587335031466666343849443734017657748199169524665705367570906859090512509718775557015222431021714647829386322577296271424256021684582295977152259098829205426386824411990866793"), + boost::lexical_cast("160131437125022133570186981636530600256034719271619021063640417693436516163698377535248015679488033602845112321108929620534730439060000506398830226180857811739131287777823445209422467744194016647915972857"), + boost::lexical_cast("259098107935652557104489133457117935287501385615468464797658075441635685688364082902818922538578546112563887878124152051556445086889386828976126497605113833423713583754975704308251673170580841059906839650"), + boost::lexical_cast("419229545060674690674676115093648535543536104887087485861298493135072201852062460438066938218066579715409000199233081672091175525949387335374956723785971645162844871532799149517674140914774857707822812507"), + boost::lexical_cast("678327652996327247779165248550766470831037490502555950658956568576707887540426543340885860756645125827972888077357233723647620612838774164351083221391085478586558455287774853825925814085355698767729652157"), + boost::lexical_cast("1097557198057001938453841363644415006374573595389643436520255061711780089392489003778952798974711705543381888276590315395738796138788161499726039945177057123749403326820574003343599955000130556475552464664"), + boost::lexical_cast("1775884851053329186233006612195181477205611085892199387179211630288487976932915547119838659731356831371354776353947549119386416751626935664077123166568142602335961782108348857169525769085486255243282116821"), + boost::lexical_cast("2873442049110331124686847975839596483580184681281842823699466692000268066325404550898791458706068536914736664630537864515125212890415097163803163111745199726085365108928922860513125724085616811718834581485"), + boost::lexical_cast("4649326900163660310919854588034777960785795767174042210878678322288756043258320098018630118437425368286091440984485413634511629642042032827880286278313342328421326891037271717682651493171103066962116698306"), + boost::lexical_cast("7522768949273991435606702563874374444365980448455885034578145014289024109583724648917421577143493905200828105615023278149636842532457129991683449390058542054506691999966194578195777217256719878680951279791"), + boost::lexical_cast("12172095849437651746526557151909152405151776215629927245456823336577780152842044746936051695580919273486919546599508691784148472174499162819563735668371884382928018891003466295878428710427822945643067978097"), + boost::lexical_cast("19694864798711643182133259715783526849517756664085812280034968350866804262425769395853473272724413178687747652214531969933785314706956292811247185058430426437434710890969660874074205927684542824324019257888"), + boost::lexical_cast("31866960648149294928659816867692679254669532879715739525491791687444584415267814142789524968305332452174667198814040661717933786881455455630810920726802310820362729781973127169952634638112365769967087235985"), + boost::lexical_cast("51561825446860938110793076583476206104187289543801551805526760038311388677693583538642998241029745630862414851028572631651719101588411748442058105785232737257797440672942788044026840565796908594291106493873"), + boost::lexical_cast("83428786095010233039452893451168885358856822423517291331018551725755973092961397681432523209335078083037082049842613293369652888469867204072869026512035048078160170454915915213979475203909274364258193729858"), + boost::lexical_cast("134990611541871171150245970034645091463044111967318843136545311764067361770654981220075521450364823713899496900871185925021371990058278952514927132297267785335957611127858703258006315769706182958549300223731"), + boost::lexical_cast("218419397636881404189698863485813976821900934390836134467563863489823334863616378901508044659699901796936578950713799218391024878528146156587796158809302833414117781582774618471985790973615457322807493953589"), + boost::lexical_cast("353410009178752575339944833520459068284945046358154977604109175253890696634271360121583566110064725510836075851584985143412396868586425109102723291106570618750075392710633321729992106743321640281356794177320"), + boost::lexical_cast("571829406815633979529643697006273045106845980748991112071673038743714031497887739023091610769764627307772654802298784361803421747114571265690519449915873452164193174293407940201977897716937097604164288130909"), + boost::lexical_cast("925239415994386554869588530526732113391791027107146089675782213997604728132159099144675176879829352818608730653883769505215818615700996374793242741022444070914268567004041261931970004460258737885521082308229"), + boost::lexical_cast("1497068822810020534399232227533005158498637007856137201747455252741318759630046838167766787649593980126381385456182553867019240362815567640483762190938317523078461741297449202133947902177195835489685370439138"), + boost::lexical_cast("2422308238804407089268820758059737271890428034963283291423237466738923487762205937312441964529423332944990116110066323372235058978516564015277004931960761593992730308301490464065917906637454573375206452747367"), + boost::lexical_cast("3919377061614427623668052985592742430389065042819420493170692719480242247392252775480208752179017313071371501566248877239254299341332131655760767122899079117071192049598939666199865808814650408864891823186505"), + boost::lexical_cast("6341685300418834712936873743652479702279493077782703784593930186219165735154458712792650716708440646016361617676315200611489358319848695671037772054859840711063922357900430130265783715452104982240098275933872"), + boost::lexical_cast("10261062362033262336604926729245222132668558120602124277764622905699407982546711488272859468887457959087733119242564077850743657661180827326798539177758919828135114407499369796465649524266755391104990099120377"), + boost::lexical_cast("16602747662452097049541800472897701834948051198384828062358553091918573717701170201065510185595898605104094736918879278462233015981029522997836311232618760539199036765399799926731433239718860373345088375054249"), + boost::lexical_cast("26863810024485359386146727202142923967616609318986952340123175997617981700247881689338369654483356564191827856161443356312976673642210350324634850410377680367334151172899169723197082763985615764450078474174626"), + boost::lexical_cast("43466557686937456435688527675040625802564660517371780402481729089536555417949051890403879840079255169295922593080322634775209689623239873322471161642996440906533187938298969649928516003704476137795166849228875"), + boost::lexical_cast("70330367711422815821835254877183549770181269836358732742604905087154537118196933579742249494562611733487750449241765991088186363265450223647106012053374121273867339111198139373125598767690091902245245323403501") + }; + static const std::vector data(numbers, numbers + sizeof(numbers) / sizeof(numbers[0])); + + return data; +} + +template +std::vector > const& fibonacci_numbers_permution_1() +{ + typedef boost::mpl::int_< + ((std::numeric_limits::digits <= 16) ? 16 : ((std::numeric_limits::digits <= 32) ? 32 : (std::numeric_limits::digits <= 64) ? 64 : 0)) + > tag_type; + + static std::vector > data; + static bool init = false; + if(!init) + { + init = true; + for(unsigned i = 0; i < fibonacci_numbers(tag_type()).size() - 1; ++i) + data.push_back(std::make_pair(fibonacci_numbers(tag_type())[i], fibonacci_numbers(tag_type())[i + 1])); + } + return data; +} + +template +std::vector > const& fibonacci_numbers_permution_2() +{ + typedef boost::mpl::int_< + ((std::numeric_limits::digits <= 16) ? 16 : ((std::numeric_limits::digits <= 32) ? 32 : (std::numeric_limits::digits <= 64) ? 64 : 0)) + > tag_type; + + static std::vector > data; + static bool init = false; + if(!init) + { + init = true; + for(unsigned i = 0; i < fibonacci_numbers(tag_type()).size(); ++i) + for(unsigned j = 0; j < fibonacci_numbers(tag_type()).size(); ++j) + data.push_back(std::make_pair(fibonacci_numbers(tag_type())[i], fibonacci_numbers(tag_type())[j])); + } + return data; +} + +template +std::vector > const & trivial_gcd_test_cases() +{ + static const std::pair a[] = { + std::pair(0, 0), + std::pair(0, 832040u), + std::pair(832040u, 0), + std::pair(1u << 15, 1u << 4), + std::pair(1u << 3, 1u << 14), + std::pair(832040u, 832040u), + std::pair(991u * 3 * 7, 991u), + std::pair(991u * 2, 991u), + }; + static const std::vector > data(a, a + sizeof(a) / sizeof(a[0])); + return data; +} + diff --git a/src/boost/libs/math/reporting/performance/html/boostbook.css b/src/boost/libs/math/reporting/performance/html/boostbook.css new file mode 100644 index 00000000..d42b3c02 --- /dev/null +++ b/src/boost/libs/math/reporting/performance/html/boostbook.css @@ -0,0 +1,700 @@ + +/*============================================================================= +Copyright (c) 2004 Joel de Guzman +http://spirit.sourceforge.net/ + +Copyright 2013 Niall Douglas additions for colors and alignment. +Copyright 2013 Paul A. Bristow additions for more colors and alignments. + +Distributed under the Boost Software License, Version 1.0. (See accompany- +ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +/*============================================================================= +Body defaults +=============================================================================*/ + + body + { + margin: 1em; + font-family: sans-serif; + } + +/*============================================================================= +Paragraphs +=============================================================================*/ + + p + { + text-align: left; + font-size: 10pt; + line-height: 1.15; + } + +/*============================================================================= +Program listings +=============================================================================*/ + + /* Code on paragraphs */ + p tt.computeroutput + { + font-size: 9pt; + } + + pre.synopsis + { + font-size: 9pt; + margin: 1pc 4% 0pc 4%; + padding: 0.5pc 0.5pc 0.5pc 0.5pc; + } + + .programlisting, + .screen + { + font-size: 9pt; + display: block; + margin: 1pc 4% 0pc 4%; + padding: 0.5pc 0.5pc 0.5pc 0.5pc; + } + + /* Program listings in tables don't get borders */ + td .programlisting, + td .screen + { + margin: 0pc 0pc 0pc 0pc; + padding: 0pc 0pc 0pc 0pc; + } + +/*============================================================================= +Headings +=============================================================================*/ + + h1, h2, h3, h4, h5, h6 + { + text-align: left; + margin: 1em 0em 0.5em 0em; + font-weight: bold; + } + + h1 { font-size: 140%; } + h2 { font-weight: bold; font-size: 140%; } + h3 { font-weight: bold; font-size: 130%; } + h4 { font-weight: bold; font-size: 120%; } + h5 { font-weight: normal; font-style: italic; font-size: 110%; } + h6 { font-weight: normal; font-style: italic; font-size: 100%; } + + /* Top page titles */ + title, + h1.title, + h2.title + h3.title, + h4.title, + h5.title, + h6.title, + .refentrytitle + { + font-weight: bold; + margin-bottom: 1pc; + } + + h1.title { font-size: 140% } + h2.title { font-size: 140% } + h3.title { font-size: 130% } + h4.title { font-size: 120% } + h5.title { font-size: 110% } + h6.title { font-size: 100% } + + .section h1 + { + margin: 0em 0em 0.5em 0em; + font-size: 140%; + } + + .section h2 { font-size: 140% } + .section h3 { font-size: 130% } + .section h4 { font-size: 120% } + .section h5 { font-size: 110% } + .section h6 { font-size: 100% } + + /* Code on titles */ + h1 tt.computeroutput { font-size: 140% } + h2 tt.computeroutput { font-size: 140% } + h3 tt.computeroutput { font-size: 130% } + h4 tt.computeroutput { font-size: 130% } + h5 tt.computeroutput { font-size: 130% } + h6 tt.computeroutput { font-size: 130% } + + +/*============================================================================= +Author +=============================================================================*/ + + h3.author + { + font-size: 100% + } + +/*============================================================================= +Lists +=============================================================================*/ + + li + { + font-size: 10pt; + line-height: 1.3; + } + + /* Unordered lists */ + ul + { + text-align: left; + } + + /* Ordered lists */ + ol + { + text-align: left; + } + +/*============================================================================= +Links +=============================================================================*/ + + a + { + text-decoration: none; /* no underline */ + } + + a:hover + { + text-decoration: underline; + } + +/*============================================================================= +Spirit style navigation +=============================================================================*/ + + .spirit-nav + { + text-align: right; + } + + .spirit-nav a + { + color: white; + padding-left: 0.5em; + } + + .spirit-nav img + { + border-width: 0px; + } + +/*============================================================================= +Copyright footer +=============================================================================*/ + .copyright-footer + { + text-align: right; + font-size: 70%; + } + + .copyright-footer p + { + text-align: right; + font-size: 80%; + } + +/*============================================================================= +Table of contents +=============================================================================*/ + + div.toc + { + margin: 1pc 4% 0pc 4%; + padding: 0.1pc 1pc 0.1pc 1pc; + font-size: 80%; + line-height: 1.15; + } + + .boost-toc + { + float: right; + padding: 0.5pc; + } + + /* Code on toc */ + .toc .computeroutput { font-size: 120% } + + /* No margin on nested menus */ + + .toc dl dl { margin: 0; } + +/*============================================================================= +Tables +=============================================================================*/ + + .table-title, + div.table p.title + { + margin-left: 4%; + padding-right: 0.5em; + padding-left: 0.5em; + } + + .informaltable table, + .table table + { + width: 92%; + margin-left: 4%; + margin-right: 4%; + } + + div.informaltable table, + div.table table + { + padding: 4px; + } + + /* Table Cells */ + div.informaltable table tr td, + div.table table tr td + { + padding: 0.5em; + text-align: left; + font-size: 9pt; + } + + div.informaltable table tr th, + div.table table tr th + { + padding: 0.5em 0.5em 0.5em 0.5em; + border: 1pt solid white; + font-size: 80%; + } + + table.simplelist + { + width: auto !important; + margin: 0em !important; + padding: 0em !important; + border: none !important; + } + table.simplelist td + { + margin: 0em !important; + padding: 0em !important; + text-align: left !important; + font-size: 9pt !important; + border: none !important; + } + +/*============================================================================= +Blurbs +=============================================================================*/ + + div.note, + div.tip, + div.important, + div.caution, + div.warning, + p.blurb + { + font-size: 9pt; /* A little bit smaller than the main text */ + line-height: 1.2; + display: block; + margin: 1pc 4% 0pc 4%; + padding: 0.5pc 0.5pc 0.5pc 0.5pc; + } + + p.blurb img + { + padding: 1pt; + } + +/*============================================================================= +Variable Lists +=============================================================================*/ + + div.variablelist + { + margin: 1em 0; + } + + /* Make the terms in definition lists bold */ + div.variablelist dl dt, + span.term + { + font-weight: bold; + font-size: 10pt; + } + + div.variablelist table tbody tr td + { + text-align: left; + vertical-align: top; + padding: 0em 2em 0em 0em; + font-size: 10pt; + margin: 0em 0em 0.5em 0em; + line-height: 1; + } + + div.variablelist dl dt + { + margin-bottom: 0.2em; + } + + div.variablelist dl dd + { + margin: 0em 0em 0.5em 2em; + font-size: 10pt; + } + + div.variablelist table tbody tr td p, + div.variablelist dl dd p + { + margin: 0em 0em 0.5em 0em; + line-height: 1; + } + +/*============================================================================= +Misc +=============================================================================*/ + + /* Title of books and articles in bibliographies */ + span.title + { + font-style: italic; + } + + span.underline + { + text-decoration: underline; + } + + span.strikethrough + { + text-decoration: line-through; + } + + /* Copyright, Legal Notice */ + div div.legalnotice p + { + text-align: left + } + +/*============================================================================= +Colors +=============================================================================*/ + + @media screen + { + body { + background-color: #FFFFFF; + color: #000000; + } + + /* Syntax Highlighting */ + .keyword { color: #0000AA; } + .identifier { color: #000000; } + .special { color: #707070; } + .preprocessor { color: #402080; } + .char { color: teal; } + .comment { color: #800000; } + .string { color: teal; } + .number { color: teal; } + .white_bkd { background-color: #FFFFFF; } + .dk_grey_bkd { background-color: #999999; } + + /* Links */ + a, a .keyword, a .identifier, a .special, a .preprocessor + a .char, a .comment, a .string, a .number + { + color: #005a9c; + } + + a:visited, a:visited .keyword, a:visited .identifier, + a:visited .special, a:visited .preprocessor a:visited .char, + a:visited .comment, a:visited .string, a:visited .number + { + color: #9c5a9c; + } + + h1 a, h2 a, h3 a, h4 a, h5 a, h6 a, + h1 a:hover, h2 a:hover, h3 a:hover, h4 a:hover, h5 a:hover, h6 a:hover, + h1 a:visited, h2 a:visited, h3 a:visited, h4 a:visited, h5 a:visited, h6 a:visited + { + text-decoration: none; /* no underline */ + color: #000000; + } + + /* Copyright, Legal Notice */ + .copyright + { + color: #666666; + font-size: small; + } + + div div.legalnotice p + { + color: #666666; + } + + /* Program listing */ + pre.synopsis + { + border: 1px solid #DCDCDC; + } + + .programlisting, + .screen + { + border: 1px solid #DCDCDC; + } + + td .programlisting, + td .screen + { + border: 0px solid #DCDCDC; + } + + /* Blurbs */ + div.note, + div.tip, + div.important, + div.caution, + div.warning, + p.blurb + { + border: 1px solid #DCDCDC; + } + + /* Table of contents */ + div.toc + { + border: 1px solid #DCDCDC; + } + + /* Tables */ + div.informaltable table tr td, + div.table table tr td + { + border: 1px solid #DCDCDC; + } + + div.informaltable table tr th, + div.table table tr th + { + background-color: #F0F0F0; + border: 1px solid #DCDCDC; + } + + .copyright-footer + { + color: #8F8F8F; + } + + /* Misc */ + span.highlight + { + color: #00A000; + } + } + + @media print + { + /* Links */ + a + { + color: black; + } + + a:visited + { + color: black; + } + + .spirit-nav + { + display: none; + } + + /* Program listing */ + pre.synopsis + { + border: 1px solid gray; + } + + .programlisting, + .screen + { + border: 1px solid gray; + } + + td .programlisting, + td .screen + { + border: 0px solid #DCDCDC; + } + + /* Table of contents */ + div.toc + { + border: 1px solid gray; + } + + .informaltable table, + .table table + { + border: 1px solid gray; + border-collapse: collapse; + } + + /* Tables */ + div.informaltable table tr td, + div.table table tr td + { + border: 1px solid gray; + } + + div.informaltable table tr th, + div.table table tr th + { + border: 1px solid gray; + } + + table.simplelist tr td + { + border: none !important; + } + + /* Misc */ + span.highlight + { + font-weight: bold; + } + } + +/*============================================================================= +Images +=============================================================================*/ + + span.inlinemediaobject img + { + vertical-align: middle; + } + +/*============================================================================== +Super and Subscript: style so that line spacing isn't effected, see +http://www.adobe.com/cfusion/communityengine/index.cfm?event=showdetails&productId=1&postId=5341 +==============================================================================*/ + +sup, +sub { +height: 0; +line-height: 1; +vertical-align: baseline; +position: relative; + +} + +/* For internet explorer: */ + +* html sup, +* html sub { +vertical-align: bottom; +} + +sup { +bottom: 1ex; +} + +sub { +top: .5ex; +} + +/*============================================================================== +Indexes: pretty much the same as the TOC. +==============================================================================*/ + + .index + { + font-size: 80%; + padding-top: 0px; + padding-bottom: 0px; + margin-top: 0px; + margin-bottom: 0px; + margin-left: 0px; + } + + .index ul + { + padding-left: 3em; + } + + .index p + { + padding: 2px; + margin: 2px; + } + + .index-entry-level-0 + { + font-weight: bold; + } + + .index em + { + font-weight: bold; + } + + +/*============================================================================== +Alignment and coloring use 'role' feature, available from Quickbook 1.6 up. +Added from Niall Douglas for role color and alignment. +http://article.gmane.org/gmane.comp.lib.boost.devel/243318 +*/ + +/* Add text alignment (see http://www.w3schools.com/cssref/pr_text_text-align.asp) */ +span.aligncenter +{ + display: inline-block; width: 100%; text-align: center; +} +span.alignright +{ + display: inline-block; width: 100%; text-align: right; +} +/* alignleft is the default. */ +span.alignleft +{ + display: inline-block; width: 100%; text-align: left; +} + +/* alignjustify stretches the word spacing so that each line has equal width +within a chosen fraction of page width (here arbitrarily 20%). +*Not* useful inside table items as the column width remains the total string width. +Nor very useful, except to temporarily restrict the width. +*/ +span.alignjustify +{ + display: inline-block; width: 20%; text-align: justify; +} + +/* Text colors. +Names at http://www.w3.org/TR/2002/WD-css3-color-20020219/ 4.3. X11 color keywords. +Quickbook Usage: [role red Some red text] + +*/ +span.red { inline-block; color: red; } +span.green { color: green; } +span.lime { color: #00FF00; } +span.blue { color: blue; } +span.navy { color: navy; } +span.yellow { color: yellow; } +span.magenta { color: magenta; } +span.indigo { color: #4B0082; } +span.cyan { color: cyan; } +span.purple { color: purple; } +span.gold { color: gold; } +span.silver { color: silver; } /* lighter gray */ +span.gray { color: #808080; } /* light gray */ diff --git a/src/boost/libs/math/reporting/performance/html/index.html b/src/boost/libs/math/reporting/performance/html/index.html new file mode 100644 index 00000000..0d3f2b48 --- /dev/null +++ b/src/boost/libs/math/reporting/performance/html/index.html @@ -0,0 +1,36552 @@ + + + +Special Function and Distribution Performance Report + + + + + + + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+
+
+
+
+
+

+Special Function and Distribution Performance Report

+
+

+ Distributed under 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) +

+
+
+
+
+
+

Table of Contents

+
+
Compiler + Comparison on Windows x64
+
Compiler + Comparison on linux
+
Compiler + Option Comparison on Windows x64
+
Distribution + performance comparison for different performance options with GNU C++ version + 5.3.0 on Windows x64
+
Distribution + performance comparison for different performance options with GNU C++ version + 5.3.0 on linux
+
Distribution + performance comparison for different performance options with Intel C++ C++0x + mode version 1600 on Windows x64
+
Distribution + performance comparison for different performance options with Microsoft Visual + C++ version 14.0 on Windows x64
+
Distribution + performance comparison with GNU C++ version 5.3.0 on Windows x64
+
Distribution + performance comparison with GNU C++ version 5.3.0 on linux
+
Distribution + performance comparison with Intel C++ C++0x mode version 1600 on Windows x64
+
Distribution + performance comparison with Microsoft Visual C++ version 14.0 on Windows x64
+
Library + Comparison with GNU C++ version 5.3.0 on Windows x64
+
Library + Comparison with GNU C++ version 5.3.0 on linux
+
Library + Comparison with Intel C++ C++0x mode version 1600 on Windows x64
+
Library + Comparison with Microsoft Visual C++ version 14.0 on Windows x64
+
Polynomial + Method Comparison with GNU C++ version 5.3.0 on Windows x64
+
Polynomial + Method Comparison with GNU C++ version 5.3.0 on linux
+
Polynomial + Method Comparison with Intel C++ C++0x mode version 1600 on Windows x64
+
Polynomial + Method Comparison with Microsoft Visual C++ version 14.0 on Windows x64
+
Rational + Method Comparison with GNU C++ version 5.3.0 on Windows x64
+
Rational + Method Comparison with GNU C++ version 5.3.0 on linux
+
Rational + Method Comparison with Intel C++ C++0x mode version 1600 on Windows x64
+
Rational + Method Comparison with Microsoft Visual C++ version 14.0 on Windows x64
+
gcd + method comparison with Clang version 3.8.0 (trunk 256686) on linux
+
gcd + method comparison with GNU C++ version 5.3.0 on linux
+
gcd + method comparison with Intel C++ C++0x mode version 1500 on linux
+
gcd + method comparison with Microsoft Visual C++ version 14.0 on Windows x64
+
gcd + method comparison with Microsoft Visual C++ version 14.1 on Windows x64
+
+
+
+ +
+

Table 1. Compiler Comparison on Windows x64

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ Function +

+
+

+ Microsoft Visual C++ version 14.0
boost 1.61 +

+
+

+ GNU C++ version 5.3.0
boost 1.61 +

+
+

+ GNU C++ version 5.3.0
boost 1.61
promote_double<false> +

+
+

+ Intel C++ C++0x mode version 1600
boost 1.61 +

+
+

+ assoc_laguerre +

+
+

+ 1.16
(208ns)
+

+
+

+ 1.21
(217ns)
+

+
+

+ 1.06
(190ns)
+

+
+

+ 1.00
(180ns)
+

+
+

+ assoc_legendre +

+
+

+ 1.57
(151ns)
+

+
+

+ 1.80
(173ns)
+

+
+

+ 1.16
(111ns)
+

+
+

+ 1.00
(96ns)
+

+
+

+ beta +

+
+

+ 1.74
(176ns)
+

+
+

+ 3.78
(382ns)
+

+
+

+ 2.17
(219ns)
+

+
+

+ 1.00
(101ns)
+

+
+

+ beta (incomplete) +

+
+

+ 1.44
(520ns)
+

+
+

+ 3.03
(1096ns)
+

+
+

+ 1.84
(666ns)
+

+
+

+ 1.00
(362ns)
+

+
+

+ cbrt +

+
+

+ 3.21
(45ns)
+

+
+

+ 3.43
(48ns)
+

+
+

+ 3.07
(43ns)
+

+
+

+ 1.00
(14ns)
+

+
+

+ cyl_bessel_i +

+
+

+ 1.11
(404ns)
+

+
+

+ 2.78
(1016ns)
+

+
+

+ 1.21
(442ns)
+

+
+

+ 1.00
(365ns)
+

+
+

+ cyl_bessel_i (integer order) +

+
+

+ 1.29
(261ns)
+

+
+

+ 3.16
(638ns)
+

+
+

+ 1.22
(247ns)
+

+
+

+ 1.00
(202ns)
+

+
+

+ cyl_bessel_j +

+
+

+ 1.19
(488ns)
+

+
+

+ 2.06
(841ns)
+

+
+

+ 1.25
(513ns)
+

+
+

+ 1.00
(409ns)
+

+
+

+ cyl_bessel_j (integer order) +

+
+

+ 1.36
(103ns)
+

+
+

+ 2.39
(182ns)
+

+
+

+ 1.47
(112ns)
+

+
+

+ 1.00
(76ns)
+

+
+

+ cyl_bessel_k +

+
+

+ 1.04
(747ns)
+

+
+

+ 9.43
(6743ns)
+

+
+

+ 1.03
(734ns)
+

+
+

+ 1.00
(715ns)
+

+
+

+ cyl_bessel_k (integer order) +

+
+

+ 1.26
(419ns)
+

+
+

+ 10.49
(3494ns)
+

+
+

+ 1.10
(367ns)
+

+
+

+ 1.00
(333ns)
+

+
+

+ cyl_neumann +

+
+

+ 16.76
(11212ns)
+

+
+

+ 2.01
(1346ns)
+

+
+

+ 1.00
(669ns)
+

+
+

+ 15.35
(10266ns)
+

+
+

+ cyl_neumann (integer order) +

+
+

+ 1.00
(225ns)
+

+
+

+ 1.79
(403ns)
+

+
+

+ 1.24
(279ns)
+

+
+

+ 1.02
(229ns)
+

+
+

+ digamma +

+
+

+ 1.20
(24ns)
+

+
+

+ 3.75
(75ns)
+

+
+

+ 2.15
(43ns)
+

+
+

+ 1.00
(20ns)
+

+
+

+ ellint_1 +

+
+

+ 1.87
(329ns)
+

+
+

+ 1.99
(350ns)
+

+
+

+ 1.32
(232ns)
+

+
+

+ 1.00
(176ns)
+

+
+

+ ellint_1 (complete) +

+
+

+ 2.18
(61ns)
+

+
+

+ 2.57
(72ns)
+

+
+

+ 1.57
(44ns)
+

+
+

+ 1.00
(28ns)
+

+
+

+ ellint_2 +

+
+

+ 1.78
(525ns)
+

+
+

+ 2.17
(640ns)
+

+
+

+ 1.52
(449ns)
+

+
+

+ 1.00
(295ns)
+

+
+

+ ellint_2 (complete) +

+
+

+ 2.14
(62ns)
+

+
+

+ 2.07
(60ns)
+

+
+

+ 1.24
(36ns)
+

+
+

+ 1.00
(29ns)
+

+
+

+ ellint_3 +

+
+

+ 1.94
(1155ns)
+

+
+

+ 2.91
(1733ns)
+

+
+

+ 1.65
(986ns)
+

+
+

+ 1.00
(596ns)
+

+
+

+ ellint_3 (complete) +

+
+

+ 2.05
(721ns)
+

+
+

+ 3.07
(1079ns)
+

+
+

+ 1.46
(514ns)
+

+
+

+ 1.00
(352ns)
+

+
+

+ ellint_rc +

+
+

+ 1.58
(49ns)
+

+
+

+ 2.68
(83ns)
+

+
+

+ 1.55
(48ns)
+

+
+

+ 1.00
(31ns)
+

+
+

+ ellint_rd +

+
+

+ 1.75
(332ns)
+

+
+

+ 1.83
(348ns)
+

+
+

+ 1.40
(266ns)
+

+
+

+ 1.00
(190ns)
+

+
+

+ ellint_rf +

+
+

+ 1.69
(71ns)
+

+
+

+ 2.40
(101ns)
+

+
+

+ 1.57
(66ns)
+

+
+

+ 1.00
(42ns)
+

+
+

+ ellint_rj +

+
+

+ 1.91
(344ns)
+

+
+

+ 2.96
(532ns)
+

+
+

+ 1.43
(257ns)
+

+
+

+ 1.00
(180ns)
+

+
+

+ erf +

+
+

+ 1.77
(23ns)
+

+
+

+ 2.92
(38ns)
+

+
+

+ 1.92
(25ns)
+

+
+

+ 1.00
(13ns)
+

+
+

+ erfc +

+
+

+ 1.29
(22ns)
+

+
+

+ 3.41
(58ns)
+

+
+

+ 2.06
(35ns)
+

+
+

+ 1.00
(17ns)
+

+
+

+ expint +

+
+

+ 1.39
(39ns)
+

+
+

+ 3.07
(86ns)
+

+
+

+ 2.14
(60ns)
+

+
+

+ 1.00
(28ns)
+

+
+

+ expint (En) +

+
+

+ 1.10
(117ns)
+

+
+

+ 2.19
(232ns)
+

+
+

+ 1.38
(146ns)
+

+
+

+ 1.00
(106ns)
+

+
+

+ expm1 +

+
+

+ 1.00
(10ns)
+

+
+

+ 3.10
(31ns)
+

+
+

+ 2.40
(24ns)
+

+
+

+ 1.10
(11ns)
+

+
+

+ gamma_p +

+
+

+ 1.29
(192ns)
+

+
+

+ 2.64
(393ns)
+

+
+

+ 1.71
(255ns)
+

+
+

+ 1.00
(149ns)
+

+
+

+ gamma_p_inv +

+
+

+ 1.36
(706ns)
+

+
+

+ 2.47
(1288ns)
+

+
+

+ 1.91
(997ns)
+

+
+

+ 1.00
(521ns)
+

+
+

+ gamma_q +

+
+

+ 1.16
(179ns)
+

+
+

+ 2.79
(429ns)
+

+
+

+ 1.61
(248ns)
+

+
+

+ 1.00
(154ns)
+

+
+

+ gamma_q_inv +

+
+

+ 1.37
(703ns)
+

+
+

+ 2.38
(1225ns)
+

+
+

+ 1.89
(971ns)
+

+
+

+ 1.00
(515ns)
+

+
+

+ ibeta +

+
+

+ 1.34
(520ns)
+

+
+

+ 3.13
(1218ns)
+

+
+

+ 1.83
(711ns)
+

+
+

+ 1.00
(389ns)
+

+
+

+ ibeta_inv +

+
+

+ 1.51
(2193ns)
+

+
+

+ 2.81
(4085ns)
+

+
+

+ 2.27
(3303ns)
+

+
+

+ 1.00
(1452ns)
+

+
+

+ ibetac +

+
+

+ 1.29
(518ns)
+

+
+

+ 2.94
(1179ns)
+

+
+

+ 1.73
(694ns)
+

+
+

+ 1.00
(401ns)
+

+
+

+ ibetac_inv +

+
+

+ 1.41
(2045ns)
+

+
+

+ 2.80
(4058ns)
+

+
+

+ 1.78
(2572ns)
+

+
+

+ 1.00
(1447ns)
+

+
+

+ jacobi_cn +

+
+

+ 1.36
(182ns)
+

+
+

+ 3.72
(499ns)
+

+
+

+ 2.28
(306ns)
+

+
+

+ 1.00
(134ns)
+

+
+

+ jacobi_dn +

+
+

+ 1.82
(262ns)
+

+
+

+ 3.68
(530ns)
+

+
+

+ 2.27
(327ns)
+

+
+

+ 1.00
(144ns)
+

+
+

+ jacobi_sn +

+
+

+ 1.31
(179ns)
+

+
+

+ 3.73
(511ns)
+

+
+

+ 2.43
(333ns)
+

+
+

+ 1.00
(137ns)
+

+
+

+ laguerre +

+
+

+ 1.00
(121ns)
+

+
+

+ 1.15
(139ns)
+

+
+

+ 1.04
(126ns)
+

+
+

+ 1.10
(133ns)
+

+
+

+ legendre +

+
+

+ 1.07
(364ns)
+

+
+

+ 1.16
(396ns)
+

+
+

+ 1.00
(340ns)
+

+
+

+ 1.13
(383ns)
+

+
+

+ legendre Q +

+
+

+ 1.00
(427ns)
+

+
+

+ 1.20
(512ns)
+

+
+

+ 1.01
(430ns)
+

+
+

+ 1.07
(455ns)
+

+
+

+ lgamma +

+
+

+ 1.00
(73ns)
+

+
+

+ 3.07
(224ns)
+

+
+

+ 1.82
(133ns)
+

+
+

+ 1.05
(77ns)
+

+
+

+ log1p +

+
+

+ 1.00
(14ns)
+

+
+

+ 2.00
(28ns)
+

+
+

+ 1.14
(16ns)
+

+
+

+ 1.00
(14ns)
+

+
+

+ polygamma +

+
+

+ 1.16
(3773ns)
+

+
+

+ 1.02
(3320ns)
+

+
+

+ 2.24
(7270ns)
+

+
+

+ 1.00
(3246ns)
+

+
+

+ sph_bessel +

+
+

+ 1.17
(1005ns)
+

+
+

+ 1.55
(1325ns)
+

+
+

+ 1.09
(931ns)
+

+
+

+ 1.00
(857ns)
+

+
+

+ sph_neumann +

+
+

+ 1.08
(1827ns)
+

+
+

+ 2.07
(3483ns)
+

+
+

+ 1.00
(1685ns)
+

+
+

+ 1.01
(1702ns)
+

+
+

+ tgamma +

+
+

+ 1.31
(77ns)
+

+
+

+ 4.03
(238ns)
+

+
+

+ 2.49
(147ns)
+

+
+

+ 1.00
(59ns)
+

+
+

+ tgamma (incomplete) +

+
+

+ 1.26
(276ns)
+

+
+

+ 2.52
(552ns)
+

+
+

+ 1.73
(379ns)
+

+
+

+ 1.00
(219ns)
+

+
+

+ trigamma +

+
+

+ 1.35
(23ns)
+

+
+

+ 2.88
(49ns)
+

+
+

+ 1.41
(24ns)
+

+
+

+ 1.00
(17ns)
+

+
+

+ zeta +

+
+

+ 1.34
(121ns)
+

+
+

+ 3.83
(345ns)
+

+
+

+ 2.52
(227ns)
+

+
+

+ 1.00
(90ns)
+

+
+
+
+
+
+ +
+

Table 2. Compiler Comparison on linux

+
+++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ Function +

+
+

+ GNU C++ version 5.3.0
boost 1.61 +

+
+

+ GNU C++ version 5.3.0
boost 1.61
promote_double<false> +

+
+

+ assoc_laguerre +

+
+

+ 1.36
(263ns)
+

+
+

+ 1.00
(194ns)
+

+
+

+ assoc_legendre +

+
+

+ 2.55
(258ns)
+

+
+

+ 1.00
(101ns)
+

+
+

+ beta +

+
+

+ 4.71
(734ns)
+

+
+

+ 1.00
(156ns)
+

+
+

+ beta (incomplete) +

+
+

+ 3.12
(1796ns)
+

+
+

+ 1.00
(575ns)
+

+
+

+ cbrt +

+
+

+ 2.53
(43ns)
+

+
+

+ 1.00
(17ns)
+

+
+

+ cyl_bessel_i +

+
+

+ 3.47
(1410ns)
+

+
+

+ 1.00
(406ns)
+

+
+

+ cyl_bessel_i (integer order) +

+
+

+ 3.38
(893ns)
+

+
+

+ 1.00
(264ns)
+

+
+

+ cyl_bessel_j +

+
+

+ 2.69
(1071ns)
+

+
+

+ 1.00
(398ns)
+

+
+

+ cyl_bessel_j (integer order) +

+
+

+ 2.59
(275ns)
+

+
+

+ 1.00
(106ns)
+

+
+

+ cyl_bessel_k +

+
+

+ 6.86
(4589ns)
+

+
+

+ 1.00
(669ns)
+

+
+

+ cyl_bessel_k (integer order) +

+
+

+ 10.17
(3673ns)
+

+
+

+ 1.00
(361ns)
+

+
+

+ cyl_neumann +

+
+

+ 2.48
(1478ns)
+

+
+

+ 1.00
(597ns)
+

+
+

+ cyl_neumann (integer order) +

+
+

+ 2.20
(484ns)
+

+
+

+ 1.00
(220ns)
+

+
+

+ digamma +

+
+

+ 1.92
(75ns)
+

+
+

+ 1.00
(39ns)
+

+
+

+ ellint_1 +

+
+

+ 1.94
(358ns)
+

+
+

+ 1.00
(185ns)
+

+
+

+ ellint_1 (complete) +

+
+

+ 1.86
(52ns)
+

+
+

+ 1.00
(28ns)
+

+
+

+ ellint_2 +

+
+

+ 2.32
(805ns)
+

+
+

+ 1.00
(347ns)
+

+
+

+ ellint_2 (complete) +

+
+

+ 1.71
(60ns)
+

+
+

+ 1.00
(35ns)
+

+
+

+ ellint_3 +

+
+

+ 2.75
(2154ns)
+

+
+

+ 1.00
(783ns)
+

+
+

+ ellint_3 (complete) +

+
+

+ 2.23
(1172ns)
+

+
+

+ 1.00
(525ns)
+

+
+

+ ellint_rc +

+
+

+ 1.57
(77ns)
+

+
+

+ 1.00
(49ns)
+

+
+

+ ellint_rd +

+
+

+ 2.23
(520ns)
+

+
+

+ 1.00
(233ns)
+

+
+

+ ellint_rf +

+
+

+ 1.51
(95ns)
+

+
+

+ 1.00
(63ns)
+

+
+

+ ellint_rj +

+
+

+ 2.33
(481ns)
+

+
+

+ 1.00
(206ns)
+

+
+

+ erf +

+
+

+ 2.60
(39ns)
+

+
+

+ 1.00
(15ns)
+

+
+

+ erfc +

+
+

+ 2.68
(59ns)
+

+
+

+ 1.00
(22ns)
+

+
+

+ expint +

+
+

+ 2.47
(94ns)
+

+
+

+ 1.00
(38ns)
+

+
+

+ expint (En) +

+
+

+ 1.86
(273ns)
+

+
+

+ 1.00
(147ns)
+

+
+

+ expm1 +

+
+

+ 1.00
(10ns)
+

+
+

+ 1.10
(11ns)
+

+
+

+ gamma_p +

+
+

+ 2.42
(492ns)
+

+
+

+ 1.00
(203ns)
+

+
+

+ gamma_p_inv +

+
+

+ 2.24
(1577ns)
+

+
+

+ 1.00
(704ns)
+

+
+

+ gamma_q +

+
+

+ 2.53
(508ns)
+

+
+

+ 1.00
(201ns)
+

+
+

+ gamma_q_inv +

+
+

+ 2.45
(1841ns)
+

+
+

+ 1.00
(751ns)
+

+
+

+ ibeta +

+
+

+ 2.71
(1715ns)
+

+
+

+ 1.00
(634ns)
+

+
+

+ ibeta_inv +

+
+

+ 2.58
(5742ns)
+

+
+

+ 1.00
(2224ns)
+

+
+

+ ibetac +

+
+

+ 2.66
(1736ns)
+

+
+

+ 1.00
(653ns)
+

+
+

+ ibetac_inv +

+
+

+ 2.44
(5451ns)
+

+
+

+ 1.00
(2237ns)
+

+
+

+ jacobi_cn +

+
+

+ 2.77
(476ns)
+

+
+

+ 1.00
(172ns)
+

+
+

+ jacobi_dn +

+
+

+ 2.80
(481ns)
+

+
+

+ 1.00
(172ns)
+

+
+

+ jacobi_sn +

+
+

+ 2.86
(492ns)
+

+
+

+ 1.00
(172ns)
+

+
+

+ laguerre +

+
+

+ 1.09
(139ns)
+

+
+

+ 1.00
(128ns)
+

+
+

+ legendre +

+
+

+ 1.16
(399ns)
+

+
+

+ 1.00
(345ns)
+

+
+

+ legendre Q +

+
+

+ 1.18
(496ns)
+

+
+

+ 1.00
(422ns)
+

+
+

+ lgamma +

+
+

+ 2.20
(257ns)
+

+
+

+ 1.00
(117ns)
+

+
+

+ log1p +

+
+

+ 1.00
(12ns)
+

+
+

+ 1.00
(12ns)
+

+
+

+ polygamma +

+
+

+ 3.93
(2885ns)
+

+
+

+ 1.00
(734ns)
+

+
+

+ sph_bessel +

+
+

+ 1.71
(1563ns)
+

+
+

+ 1.00
(915ns)
+

+
+

+ sph_neumann +

+
+

+ 2.15
(3745ns)
+

+
+

+ 1.00
(1744ns)
+

+
+

+ tgamma +

+
+

+ 3.69
(354ns)
+

+
+

+ 1.00
(96ns)
+

+
+

+ tgamma (incomplete) +

+
+

+ 2.35
(744ns)
+

+
+

+ 1.00
(316ns)
+

+
+

+ trigamma +

+
+

+ 1.64
(36ns)
+

+
+

+ 1.00
(22ns)
+

+
+

+ zeta +

+
+

+ 2.71
(509ns)
+

+
+

+ 1.00
(188ns)
+

+
+
+
+
+
+ +
+

Table 3. Compiler Option Comparison on Windows x64

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ Function +

+
+

+ cl /Od (x86 build) +

+
+

+ cl /arch:sse2 /Ox (x86 build) +

+
+

+ cl /Ox (x64 build) +

+
+

+ icl /Ox (x64 build) +

+
+

+ boost::math::cbrt +

+
+

+ 18.29
(256ns)
+

+
+

+ 4.29
(60ns)
+

+
+

+ 3.14
(44ns)
+

+
+

+ 1.00
(14ns)
+

+
+

+ boost::math::cyl_bessel_j (integer orders) +

+
+

+ 10.03
(742ns)
+

+
+

+ 1.77
(131ns)
+

+
+

+ 1.36
(101ns)
+

+
+

+ 1.00
(74ns)
+

+
+

+ boost::math::ibeta_inv +

+
+

+ 4.32
(6583ns)
+

+
+

+ 1.29
(1963ns)
+

+
+

+ 1.28
(1957ns)
+

+
+

+ 1.00
(1523ns)
+

+
+
+
+
+
+ +
+

Table 4. Distribution performance comparison for different performance options + with GNU C++ version 5.3.0 on Windows x64

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ Function +

+
+

+ boost 1.61 +

+
+

+ Boost
promote_double<false> +

+
+

+ Boost
promote_double<false>
digits10<10> +

+
+

+ Boost
float
promote_float<false> +

+
+

+ ArcSine (CDF) +

+
+

+ 1.06
(33ns)
+

+
+

+ 1.00
(31ns)
+

+
+

+ 1.06
(33ns)
+

+
+

+ 1.90
(59ns)
+

+
+

+ ArcSine (PDF) +

+
+

+ 1.12
(9ns)
+

+
+

+ 1.00
(8ns)
+

+
+

+ 1.00
(8ns)
+

+
+

+ 1.00
(8ns)
+

+
+

+ ArcSine (quantile) +

+
+

+ 1.00
(44ns)
+

+
+

+ 1.00
(44ns)
+

+
+

+ 1.02
(45ns)
+

+
+

+ 1.09
(48ns)
+

+
+

+ Beta (CDF) +

+
+

+ 2.58
(379ns)
+

+
+

+ 1.40
(206ns)
+

+
+

+ 1.33
(195ns)
+

+
+

+ 1.00
(147ns)
+

+
+

+ Beta (PDF) +

+
+

+ 2.18
(323ns)
+

+
+

+ 1.01
(150ns)
+

+
+

+ 1.05
(156ns)
+

+
+

+ 1.00
(148ns)
+

+
+

+ Beta (quantile) +

+
+

+ 2.04
(2180ns)
+

+
+

+ 1.29
(1382ns)
+

+
+

+ 1.05
(1123ns)
+

+
+

+ 1.00
(1071ns)
+

+
+

+ Binomial (CDF) +

+
+

+ 4.12
(1122ns)
+

+
+

+ 2.42
(658ns)
+

+
+

+ 1.78
(485ns)
+

+
+

+ 1.00
(272ns)
+

+
+

+ Binomial (PDF) +

+
+

+ 2.47
(353ns)
+

+
+

+ 1.17
(167ns)
+

+
+

+ 1.20
(172ns)
+

+
+

+ 1.00
(143ns)
+

+
+

+ Binomial (quantile) +

+
+

+ 4.00
(5174ns)
+

+
+

+ 2.26
(2921ns)
+

+
+

+ 1.78
(2301ns)
+

+
+

+ 1.00
(1294ns)
+

+
+

+ Cauchy (CDF) +

+
+

+ 1.00
(23ns)
+

+
+

+ 1.00
(23ns)
+

+
+

+ 1.09
(25ns)
+

+
+

+ 2.43
(56ns)
+

+
+

+ Cauchy (PDF) +

+
+

+ 1.17
(7ns)
+

+
+

+ 1.33
(8ns)
+

+
+

+ 1.33
(8ns)
+

+
+

+ 1.00
(6ns)
+

+
+

+ Cauchy (quantile) +

+
+

+ 1.00
(24ns)
+

+
+

+ 1.17
(28ns)
+

+
+

+ 1.00
(24ns)
+

+
+

+ 1.21
(29ns)
+

+
+

+ ChiSquared (CDF) +

+
+

+ 2.65
(506ns)
+

+
+

+ 1.49
(285ns)
+

+
+

+ 1.24
(236ns)
+

+
+

+ 1.00
(191ns)
+

+
+

+ ChiSquared (PDF) +

+
+

+ 1.86
(251ns)
+

+
+

+ 1.01
(137ns)
+

+
+

+ 1.00
(135ns)
+

+
+

+ 1.07
(144ns)
+

+
+

+ ChiSquared (quantile) +

+
+

+ 2.37
(1275ns)
+

+
+

+ 1.44
(774ns)
+

+
+

+ 1.10
(592ns)
+

+
+

+ 1.00
(539ns)
+

+
+

+ Exponential (CDF) +

+
+

+ 1.26
(43ns)
+

+
+

+ 1.00
(34ns)
+

+
+

+ 1.00
(34ns)
+

+
+

+ 1.00
(34ns)
+

+
+

+ Exponential (PDF) +

+
+

+ 1.07
(61ns)
+

+
+

+ 1.00
(57ns)
+

+
+

+ 1.05
(60ns)
+

+
+

+ 1.09
(62ns)
+

+
+

+ Exponential (quantile) +

+
+

+ 1.81
(47ns)
+

+
+

+ 1.00
(26ns)
+

+
+

+ 1.08
(28ns)
+

+
+

+ 1.15
(30ns)
+

+
+

+ ExtremeValue (CDF) +

+
+

+ 1.05
(114ns)
+

+
+

+ 1.00
(109ns)
+

+
+

+ 1.00
(109ns)
+

+
+

+ 1.04
(113ns)
+

+
+

+ ExtremeValue (PDF) +

+
+

+ 1.03
(155ns)
+

+
+

+ 1.02
(154ns)
+

+
+

+ 1.00
(151ns)
+

+
+

+ 1.03
(155ns)
+

+
+

+ ExtremeValue (quantile) +

+
+

+ 1.00
(72ns)
+

+
+

+ 1.00
(72ns)
+

+
+

+ 1.00
(72ns)
+

+
+

+ 1.08
(78ns)
+

+
+

+ F (CDF) +

+
+

+ 4.08
(988ns)
+

+
+

+ 2.36
(572ns)
+

+
+

+ 1.90
(459ns)
+

+
+

+ 1.00
(242ns)
+

+
+

+ F (PDF) +

+
+

+ 2.48
(392ns)
+

+
+

+ 1.18
(187ns)
+

+
+

+ 1.14
(180ns)
+

+
+

+ 1.00
(158ns)
+

+
+

+ F (quantile) +

+
+

+ 2.28
(2910ns)
+

+
+

+ 1.26
(1601ns)
+

+
+

+ 1.11
(1413ns)
+

+
+

+ 1.00
(1274ns)
+

+
+

+ Gamma (CDF) +

+
+

+ 1.98
(483ns)
+

+
+

+ 1.19
(291ns)
+

+
+

+ 1.11
(271ns)
+

+
+

+ 1.00
(244ns)
+

+
+

+ Gamma (PDF) +

+
+

+ 1.80
(316ns)
+

+
+

+ 1.16
(204ns)
+

+
+

+ 1.07
(188ns)
+

+
+

+ 1.00
(176ns)
+

+
+

+ Gamma (quantile) +

+
+

+ 2.07
(1425ns)
+

+
+

+ 1.40
(960ns)
+

+
+

+ 1.01
(693ns)
+

+
+

+ 1.00
(688ns)
+

+
+

+ Geometric (CDF) +

+
+

+ 1.35
(46ns)
+

+
+

+ 1.00
(34ns)
+

+
+

+ 1.00
(34ns)
+

+
+

+ 1.03
(35ns)
+

+
+

+ Geometric (PDF) +

+
+

+ 1.06
(52ns)
+

+
+

+ 1.06
(52ns)
+

+
+

+ 1.04
(51ns)
+

+
+

+ 1.00
(49ns)
+

+
+

+ Geometric (quantile) +

+
+

+ 1.62
(42ns)
+

+
+

+ 1.00
(26ns)
+

+
+

+ 1.04
(27ns)
+

+
+

+ 1.04
(27ns)
+

+
+

+ Hypergeometric (CDF) +

+
+

+ 1.95
(11511ns)
+

+
+

+ 1.01
(5944ns)
+

+
+

+ 1.00
(5910ns)
+

+
+

+ 1.05
(6213ns)
+

+
+

+ Hypergeometric (PDF) +

+
+

+ 1.92
(11018ns)
+

+
+

+ 1.00
(5748ns)
+

+
+

+ 1.00
(5726ns)
+

+
+

+ 1.05
(6016ns)
+

+
+

+ Hypergeometric (quantile) +

+
+

+ 1.00
(70322ns)
+

+
+

+ 1.38
(96730ns)
+

+
+

+ 1.36
(95955ns)
+

+
+

+ 1.79
(126152ns)
+

+
+

+ InverseChiSquared (CDF) +

+
+

+ 2.98
(485ns)
+

+
+

+ 1.94
(317ns)
+

+
+

+ 1.34
(218ns)
+

+
+

+ 1.00
(163ns)
+

+
+

+ InverseChiSquared (PDF) +

+
+

+ 2.02
(268ns)
+

+
+

+ 1.25
(166ns)
+

+
+

+ 1.11
(147ns)
+

+
+

+ 1.00
(133ns)
+

+
+

+ InverseChiSquared (quantile) +

+
+

+ 2.28
(1235ns)
+

+
+

+ 1.69
(917ns)
+

+
+

+ 1.11
(602ns)
+

+
+

+ 1.00
(542ns)
+

+
+

+ InverseGamma (CDF) +

+
+

+ 1.78
(484ns)
+

+
+

+ 1.25
(339ns)
+

+
+

+ 1.00
(272ns)
+

+
+

+ 1.05
(285ns)
+

+
+

+ InverseGamma (PDF) +

+
+

+ 1.89
(334ns)
+

+
+

+ 1.19
(211ns)
+

+
+

+ 1.20
(212ns)
+

+
+

+ 1.00
(177ns)
+

+
+

+ InverseGamma (quantile) +

+
+

+ 2.13
(1487ns)
+

+
+

+ 1.51
(1055ns)
+

+
+

+ 1.07
(747ns)
+

+
+

+ 1.00
(699ns)
+

+
+

+ InverseGaussian (CDF) +

+
+

+ 1.22
(106ns)
+

+
+

+ 1.29
(112ns)
+

+
+

+ 1.25
(109ns)
+

+
+

+ 1.00
(87ns)
+

+
+

+ InverseGaussian (PDF) +

+
+

+ 1.03
(33ns)
+

+
+

+ 1.00
(32ns)
+

+
+

+ 1.06
(34ns)
+

+
+

+ 1.06
(34ns)
+

+
+

+ InverseGaussian (quantile) +

+
+

+ 1.49
(2170ns)
+

+
+

+ 1.50
(2189ns)
+

+
+

+ 1.31
(1915ns)
+

+
+

+ 1.00
(1459ns)
+

+
+

+ Laplace (CDF) +

+
+

+ 1.08
(56ns)
+

+
+

+ 1.04
(54ns)
+

+
+

+ 1.00
(52ns)
+

+
+

+ 1.15
(60ns)
+

+
+

+ Laplace (PDF) +

+
+

+ 1.08
(56ns)
+

+
+

+ 1.06
(55ns)
+

+
+

+ 1.00
(52ns)
+

+
+

+ 1.12
(58ns)
+

+
+

+ Laplace (quantile) +

+
+

+ 1.11
(40ns)
+

+
+

+ 1.19
(43ns)
+

+
+

+ 1.00
(36ns)
+

+
+

+ 1.14
(41ns)
+

+
+

+ LogNormal (CDF) +

+
+

+ 1.32
(121ns)
+

+
+

+ 1.08
(99ns)
+

+
+

+ 1.00
(92ns)
+

+
+

+ 1.01
(93ns)
+

+
+

+ LogNormal (PDF) +

+
+

+ 1.00
(93ns)
+

+
+

+ 1.01
(94ns)
+

+
+

+ 1.02
(95ns)
+

+
+

+ 1.08
(100ns)
+

+
+

+ LogNormal (quantile) +

+
+

+ 1.24
(135ns)
+

+
+

+ 1.00
(109ns)
+

+
+

+ 1.03
(112ns)
+

+
+

+ 1.16
(126ns)
+

+
+

+ Logistic (CDF) +

+
+

+ 1.00
(48ns)
+

+
+

+ 1.08
(52ns)
+

+
+

+ 1.04
(50ns)
+

+
+

+ 1.08
(52ns)
+

+
+

+ Logistic (PDF) +

+
+

+ 1.00
(53ns)
+

+
+

+ 1.00
(53ns)
+

+
+

+ 1.08
(57ns)
+

+
+

+ 1.04
(55ns)
+

+
+

+ Logistic (quantile) +

+
+

+ 1.05
(43ns)
+

+
+

+ 1.07
(44ns)
+

+
+

+ 1.00
(41ns)
+

+
+

+ 1.05
(43ns)
+

+
+

+ NegativeBinomial (CDF) +

+
+

+ 4.75
(1713ns)
+

+
+

+ 2.77
(1001ns)
+

+
+

+ 2.08
(750ns)
+

+
+

+ 1.00
(361ns)
+

+
+

+ NegativeBinomial (PDF) +

+
+

+ 2.65
(437ns)
+

+
+

+ 1.12
(184ns)
+

+
+

+ 1.10
(181ns)
+

+
+

+ 1.00
(165ns)
+

+
+

+ NegativeBinomial (quantile) +

+
+

+ 2.48
(8682ns)
+

+
+

+ 1.45
(5084ns)
+

+
+

+ 1.13
(3965ns)
+

+
+

+ 1.00
(3507ns)
+

+
+

+ NonCentralBeta (CDF) +

+
+

+ 3.23
(2366ns)
+

+
+

+ 2.14
(1565ns)
+

+
+

+ 1.76
(1291ns)
+

+
+

+ 1.00
(733ns)
+

+
+

+ NonCentralBeta (PDF) +

+
+

+ 3.24
(1774ns)
+

+
+

+ 2.09
(1142ns)
+

+
+

+ 1.96
(1073ns)
+

+
+

+ 1.00
(547ns)
+

+
+

+ NonCentralBeta (quantile) +

+
+

+ 3.96
(50346ns)
+

+
+

+ 2.45
(31142ns)
+

+
+

+ 2.13
(27101ns)
+

+
+

+ 1.00
(12728ns)
+

+
+

+ NonCentralChiSquared (CDF) +

+
+

+ 3.92
(6813ns)
+

+
+

+ 2.58
(4481ns)
+

+
+

+ 1.99
(3457ns)
+

+
+

+ 1.00
(1736ns)
+

+
+

+ NonCentralChiSquared (PDF) +

+
+

+ 2.50
(1043ns)
+

+
+

+ 1.73
(722ns)
+

+
+

+ 1.55
(647ns)
+

+
+

+ 1.00
(417ns)
+

+
+

+ NonCentralChiSquared (quantile) +

+
+

+ 6.34
(49579ns)
+

+
+

+ 3.39
(26501ns)
+

+
+

+ 2.24
(17507ns)
+

+
+

+ 1.00
(7817ns)
+

+
+

+ NonCentralF (CDF) +

+
+

+ 3.39
(2083ns)
+

+
+

+ 2.09
(1286ns)
+

+
+

+ 1.75
(1079ns)
+

+
+

+ 1.00
(615ns)
+

+
+

+ NonCentralF (PDF) +

+
+

+ 3.07
(1689ns)
+

+
+

+ 1.87
(1031ns)
+

+
+

+ 1.61
(887ns)
+

+
+

+ 1.00
(550ns)
+

+
+

+ NonCentralF (quantile) +

+
+

+ 3.94
(33446ns)
+

+
+

+ 2.21
(18763ns)
+

+
+

+ 1.72
(14570ns)
+

+
+

+ 1.00
(8483ns)
+

+
+

+ NonCentralT (CDF) +

+
+

+ 3.82
(8822ns)
+

+
+

+ 2.44
(5639ns)
+

+
+

+ 2.01
(4634ns)
+

+
+

+ 1.00
(2311ns)
+

+
+

+ NonCentralT (PDF) +

+
+

+ 3.72
(6702ns)
+

+
+

+ 2.43
(4382ns)
+

+
+

+ 2.05
(3688ns)
+

+
+

+ 1.00
(1803ns)
+

+
+

+ NonCentralT (quantile) +

+
+

+ 4.76
(91176ns)
+

+
+

+ 2.79
(53475ns)
+

+
+

+ 2.03
(38889ns)
+

+
+

+ 1.00
(19158ns)
+

+
+

+ Normal (CDF) +

+
+

+ 1.52
(76ns)
+

+
+

+ 1.00
(50ns)
+

+
+

+ 1.06
(53ns)
+

+
+

+ 1.06
(53ns)
+

+
+

+ Normal (PDF) +

+
+

+ 1.10
(57ns)
+

+
+

+ 1.06
(55ns)
+

+
+

+ 1.00
(52ns)
+

+
+

+ 1.13
(59ns)
+

+
+

+ Normal (quantile) +

+
+

+ 1.78
(89ns)
+

+
+

+ 1.00
(50ns)
+

+
+

+ 1.04
(52ns)
+

+
+

+ 1.08
(54ns)
+

+
+

+ Pareto (CDF) +

+
+

+ 1.09
(59ns)
+

+
+

+ 1.11
(60ns)
+

+
+

+ 1.11
(60ns)
+

+
+

+ 1.00
(54ns)
+

+
+

+ Pareto (PDF) +

+
+

+ 1.00
(88ns)
+

+
+

+ 1.00
(88ns)
+

+
+

+ 1.03
(91ns)
+

+
+

+ 1.03
(91ns)
+

+
+

+ Pareto (quantile) +

+
+

+ 1.04
(78ns)
+

+
+

+ 1.00
(75ns)
+

+
+

+ 1.00
(75ns)
+

+
+

+ 1.05
(79ns)
+

+
+

+ Poisson (CDF) +

+
+

+ 2.09
(247ns)
+

+
+

+ 1.28
(151ns)
+

+
+

+ 1.15
(136ns)
+

+
+

+ 1.00
(118ns)
+

+
+

+ Poisson (PDF) +

+
+

+ 1.81
(170ns)
+

+
+

+ 1.12
(105ns)
+

+
+

+ 1.07
(101ns)
+

+
+

+ 1.00
(94ns)
+

+
+

+ Poisson (quantile) +

+
+

+ 1.98
(1094ns)
+

+
+

+ 1.19
(655ns)
+

+
+

+ 1.07
(592ns)
+

+
+

+ 1.00
(552ns)
+

+
+

+ Rayleigh (CDF) +

+
+

+ 1.22
(44ns)
+

+
+

+ 1.00
(36ns)
+

+
+

+ 1.06
(38ns)
+

+
+

+ 1.06
(38ns)
+

+
+

+ Rayleigh (PDF) +

+
+

+ 1.03
(62ns)
+

+
+

+ 1.00
(60ns)
+

+
+

+ 1.05
(63ns)
+

+
+

+ 1.03
(62ns)
+

+
+

+ Rayleigh (quantile) +

+
+

+ 1.66
(48ns)
+

+
+

+ 1.00
(29ns)
+

+
+

+ 1.00
(29ns)
+

+
+

+ 1.00
(29ns)
+

+
+

+ SkewNormal (CDF) +

+
+

+ 1.38
(438ns)
+

+
+

+ 1.30
(414ns)
+

+
+

+ 1.37
(435ns)
+

+
+

+ 1.00
(318ns)
+

+
+

+ SkewNormal (PDF) +

+
+

+ 1.24
(123ns)
+

+
+

+ 1.02
(101ns)
+

+
+

+ 1.03
(102ns)
+

+
+

+ 1.00
(99ns)
+

+
+

+ SkewNormal (quantile) +

+
+

+ 1.94
(3849ns)
+

+
+

+ 1.77
(3502ns)
+

+
+

+ 1.25
(2485ns)
+

+
+

+ 1.00
(1981ns)
+

+
+

+ StudentsT (CDF) +

+
+

+ 2.38
(877ns)
+

+
+

+ 1.27
(466ns)
+

+
+

+ 1.21
(444ns)
+

+
+

+ 1.00
(368ns)
+

+
+

+ StudentsT (PDF) +

+
+

+ 2.30
(387ns)
+

+
+

+ 1.08
(182ns)
+

+
+

+ 1.12
(188ns)
+

+
+

+ 1.00
(168ns)
+

+
+

+ StudentsT (quantile) +

+
+

+ 2.01
(1549ns)
+

+
+

+ 1.19
(915ns)
+

+
+

+ 1.14
(883ns)
+

+
+

+ 1.00
(772ns)
+

+
+

+ Weibull (CDF) +

+
+

+ 1.16
(92ns)
+

+
+

+ 1.00
(79ns)
+

+
+

+ 1.01
(80ns)
+

+
+

+ 1.03
(81ns)
+

+
+

+ Weibull (PDF) +

+
+

+ 1.02
(146ns)
+

+
+

+ 1.01
(144ns)
+

+
+

+ 1.00
(143ns)
+

+
+

+ 1.03
(147ns)
+

+
+

+ Weibull (quantile) +

+
+

+ 1.14
(128ns)
+

+
+

+ 1.00
(112ns)
+

+
+

+ 1.03
(115ns)
+

+
+

+ 1.04
(117ns)
+

+
+
+
+
+
+ +
+

Table 5. Distribution performance comparison for different performance options + with GNU C++ version 5.3.0 on linux

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ Function +

+
+

+ boost 1.61 +

+
+

+ Boost
promote_double<false> +

+
+

+ Boost
promote_double<false>
digits10<10> +

+
+

+ Boost
float
promote_float<false> +

+
+

+ ArcSine (CDF) +

+
+

+ 1.74
(33ns)
+

+
+

+ 1.79
(34ns)
+

+
+

+ 1.79
(34ns)
+

+
+

+ 1.00
(19ns)
+

+
+

+ ArcSine (PDF) +

+
+

+ 1.29
(9ns)
+

+
+

+ 1.29
(9ns)
+

+
+

+ 1.29
(9ns)
+

+
+

+ 1.00
(7ns)
+

+
+

+ ArcSine (quantile) +

+
+

+ 1.24
(21ns)
+

+
+

+ 1.29
(22ns)
+

+
+

+ 1.24
(21ns)
+

+
+

+ 1.00
(17ns)
+

+
+

+ Beta (CDF) +

+
+

+ 3.32
(452ns)
+

+
+

+ 1.38
(188ns)
+

+
+

+ 1.28
(174ns)
+

+
+

+ 1.00
(136ns)
+

+
+

+ Beta (PDF) +

+
+

+ 2.93
(355ns)
+

+
+

+ 1.17
(141ns)
+

+
+

+ 1.15
(139ns)
+

+
+

+ 1.00
(121ns)
+

+
+

+ Beta (quantile) +

+
+

+ 3.72
(2863ns)
+

+
+

+ 1.55
(1192ns)
+

+
+

+ 1.27
(976ns)
+

+
+

+ 1.00
(769ns)
+

+
+

+ Binomial (CDF) +

+
+

+ 4.12
(1133ns)
+

+
+

+ 2.39
(657ns)
+

+
+

+ 1.85
(509ns)
+

+
+

+ 1.00
(275ns)
+

+
+

+ Binomial (PDF) +

+
+

+ 2.58
(376ns)
+

+
+

+ 1.14
(167ns)
+

+
+

+ 1.13
(165ns)
+

+
+

+ 1.00
(146ns)
+

+
+

+ Binomial (quantile) +

+
+

+ 3.66
(5047ns)
+

+
+

+ 2.19
(3017ns)
+

+
+

+ 1.77
(2444ns)
+

+
+

+ 1.00
(1378ns)
+

+
+

+ Cauchy (CDF) +

+
+

+ 1.21
(29ns)
+

+
+

+ 1.17
(28ns)
+

+
+

+ 1.21
(29ns)
+

+
+

+ 1.00
(24ns)
+

+
+

+ Cauchy (PDF) +

+
+

+ 1.29
(9ns)
+

+
+

+ 1.14
(8ns)
+

+
+

+ 1.14
(8ns)
+

+
+

+ 1.00
(7ns)
+

+
+

+ Cauchy (quantile) +

+
+

+ 1.39
(43ns)
+

+
+

+ 1.39
(43ns)
+

+
+

+ 1.45
(45ns)
+

+
+

+ 1.00
(31ns)
+

+
+

+ ChiSquared (CDF) +

+
+

+ 4.01
(545ns)
+

+
+

+ 1.86
(253ns)
+

+
+

+ 1.53
(208ns)
+

+
+

+ 1.00
(136ns)
+

+
+

+ ChiSquared (PDF) +

+
+

+ 3.81
(362ns)
+

+
+

+ 1.47
(140ns)
+

+
+

+ 1.38
(131ns)
+

+
+

+ 1.00
(95ns)
+

+
+

+ ChiSquared (quantile) +

+
+

+ 3.88
(1416ns)
+

+
+

+ 2.00
(729ns)
+

+
+

+ 1.46
(533ns)
+

+
+

+ 1.00
(365ns)
+

+
+

+ Exponential (CDF) +

+
+

+ 1.33
(20ns)
+

+
+

+ 1.27
(19ns)
+

+
+

+ 1.27
(19ns)
+

+
+

+ 1.00
(15ns)
+

+
+

+ Exponential (PDF) +

+
+

+ 1.53
(26ns)
+

+
+

+ 1.53
(26ns)
+

+
+

+ 1.59
(27ns)
+

+
+

+ 1.00
(17ns)
+

+
+

+ Exponential (quantile) +

+
+

+ 1.09
(25ns)
+

+
+

+ 1.00
(23ns)
+

+
+

+ 1.00
(23ns)
+

+
+

+ 1.00
(23ns)
+

+
+

+ ExtremeValue (CDF) +

+
+

+ 1.23
(48ns)
+

+
+

+ 1.23
(48ns)
+

+
+

+ 1.26
(49ns)
+

+
+

+ 1.00
(39ns)
+

+
+

+ ExtremeValue (PDF) +

+
+

+ 1.42
(68ns)
+

+
+

+ 1.40
(67ns)
+

+
+

+ 1.42
(68ns)
+

+
+

+ 1.00
(48ns)
+

+
+

+ ExtremeValue (quantile) +

+
+

+ 1.66
(68ns)
+

+
+

+ 1.59
(65ns)
+

+
+

+ 1.59
(65ns)
+

+
+

+ 1.00
(41ns)
+

+
+

+ F (CDF) +

+
+

+ 4.28
(1028ns)
+

+
+

+ 2.42
(580ns)
+

+
+

+ 1.90
(456ns)
+

+
+

+ 1.00
(240ns)
+

+
+

+ F (PDF) +

+
+

+ 2.92
(409ns)
+

+
+

+ 1.22
(171ns)
+

+
+

+ 1.24
(174ns)
+

+
+

+ 1.00
(140ns)
+

+
+

+ F (quantile) +

+
+

+ 2.59
(2899ns)
+

+
+

+ 1.39
(1556ns)
+

+
+

+ 1.27
(1420ns)
+

+
+

+ 1.00
(1118ns)
+

+
+

+ Gamma (CDF) +

+
+

+ 3.60
(619ns)
+

+
+

+ 1.47
(253ns)
+

+
+

+ 1.33
(228ns)
+

+
+

+ 1.00
(172ns)
+

+
+

+ Gamma (PDF) +

+
+

+ 4.00
(480ns)
+

+
+

+ 1.41
(169ns)
+

+
+

+ 1.34
(161ns)
+

+
+

+ 1.00
(120ns)
+

+
+

+ Gamma (quantile) +

+
+

+ 4.14
(1971ns)
+

+
+

+ 1.81
(860ns)
+

+
+

+ 1.28
(611ns)
+

+
+

+ 1.00
(476ns)
+

+
+

+ Geometric (CDF) +

+
+

+ 1.08
(26ns)
+

+
+

+ 1.17
(28ns)
+

+
+

+ 1.00
(24ns)
+

+
+

+ 1.00
(24ns)
+

+
+

+ Geometric (PDF) +

+
+

+ 1.00
(33ns)
+

+
+

+ 1.06
(35ns)
+

+
+

+ 1.03
(34ns)
+

+
+

+ 1.21
(40ns)
+

+
+

+ Geometric (quantile) +

+
+

+ 1.00
(22ns)
+

+
+

+ 1.00
(22ns)
+

+
+

+ 1.00
(22ns)
+

+
+

+ 1.00
(22ns)
+

+
+

+ Hypergeometric (CDF) +

+
+

+ 1.87
(11779ns)
+

+
+

+ 1.02
(6423ns)
+

+
+

+ 1.03
(6458ns)
+

+
+

+ 1.00
(6294ns)
+

+
+

+ Hypergeometric (PDF) +

+
+

+ 1.88
(11384ns)
+

+
+

+ 1.00
(6054ns)
+

+
+

+ 1.01
(6107ns)
+

+
+

+ 1.08
(6534ns)
+

+
+

+ Hypergeometric (quantile) +

+
+

+ 1.09
(57820ns)
+

+
+

+ 1.69
(89233ns)
+

+
+

+ 1.70
(89729ns)
+

+
+

+ 1.00
(52921ns)
+

+
+

+ InverseChiSquared (CDF) +

+
+

+ 4.55
(546ns)
+

+
+

+ 2.04
(245ns)
+

+
+

+ 1.52
(183ns)
+

+
+

+ 1.00
(120ns)
+

+
+

+ InverseChiSquared (PDF) +

+
+

+ 3.42
(342ns)
+

+
+

+ 1.50
(150ns)
+

+
+

+ 1.42
(142ns)
+

+
+

+ 1.00
(100ns)
+

+
+

+ InverseChiSquared (quantile) +

+
+

+ 3.59
(1378ns)
+

+
+

+ 1.93
(740ns)
+

+
+

+ 1.45
(555ns)
+

+
+

+ 1.00
(384ns)
+

+
+

+ InverseGamma (CDF) +

+
+

+ 3.53
(610ns)
+

+
+

+ 1.41
(244ns)
+

+
+

+ 1.22
(211ns)
+

+
+

+ 1.00
(173ns)
+

+
+

+ InverseGamma (PDF) +

+
+

+ 3.94
(477ns)
+

+
+

+ 1.43
(173ns)
+

+
+

+ 1.33
(161ns)
+

+
+

+ 1.00
(121ns)
+

+
+

+ InverseGamma (quantile) +

+
+

+ 3.65
(1870ns)
+

+
+

+ 1.64
(838ns)
+

+
+

+ 1.12
(573ns)
+

+
+

+ 1.00
(512ns)
+

+
+

+ InverseGaussian (CDF) +

+
+

+ 2.08
(108ns)
+

+
+

+ 2.08
(108ns)
+

+
+

+ 2.04
(106ns)
+

+
+

+ 1.00
(52ns)
+

+
+

+ InverseGaussian (PDF) +

+
+

+ 1.46
(19ns)
+

+
+

+ 1.46
(19ns)
+

+
+

+ 1.38
(18ns)
+

+
+

+ 1.00
(13ns)
+

+
+

+ InverseGaussian (quantile) +

+
+

+ 2.46
(2105ns)
+

+
+

+ 2.43
(2074ns)
+

+
+

+ 2.22
(1894ns)
+

+
+

+ 1.00
(854ns)
+

+
+

+ Laplace (CDF) +

+
+

+ 1.29
(27ns)
+

+
+

+ 1.29
(27ns)
+

+
+

+ 1.29
(27ns)
+

+
+

+ 1.00
(21ns)
+

+
+

+ Laplace (PDF) +

+
+

+ 1.33
(28ns)
+

+
+

+ 1.33
(28ns)
+

+
+

+ 1.33
(28ns)
+

+
+

+ 1.00
(21ns)
+

+
+

+ Laplace (quantile) +

+
+

+ 1.39
(32ns)
+

+
+

+ 1.43
(33ns)
+

+
+

+ 1.39
(32ns)
+

+
+

+ 1.00
(23ns)
+

+
+

+ LogNormal (CDF) +

+
+

+ 2.02
(115ns)
+

+
+

+ 1.21
(69ns)
+

+
+

+ 1.21
(69ns)
+

+
+

+ 1.00
(57ns)
+

+
+

+ LogNormal (PDF) +

+
+

+ 1.43
(66ns)
+

+
+

+ 1.46
(67ns)
+

+
+

+ 1.43
(66ns)
+

+
+

+ 1.00
(46ns)
+

+
+

+ LogNormal (quantile) +

+
+

+ 1.39
(103ns)
+

+
+

+ 1.27
(94ns)
+

+
+

+ 1.30
(96ns)
+

+
+

+ 1.00
(74ns)
+

+
+

+ Logistic (CDF) +

+
+

+ 1.27
(28ns)
+

+
+

+ 1.32
(29ns)
+

+
+

+ 1.32
(29ns)
+

+
+

+ 1.00
(22ns)
+

+
+

+ Logistic (PDF) +

+
+

+ 1.29
(31ns)
+

+
+

+ 1.33
(32ns)
+

+
+

+ 1.33
(32ns)
+

+
+

+ 1.00
(24ns)
+

+
+

+ Logistic (quantile) +

+
+

+ 1.50
(36ns)
+

+
+

+ 1.54
(37ns)
+

+
+

+ 1.54
(37ns)
+

+
+

+ 1.00
(24ns)
+

+
+

+ NegativeBinomial (CDF) +

+
+

+ 4.48
(1733ns)
+

+
+

+ 2.66
(1028ns)
+

+
+

+ 1.98
(768ns)
+

+
+

+ 1.00
(387ns)
+

+
+

+ NegativeBinomial (PDF) +

+
+

+ 2.51
(384ns)
+

+
+

+ 1.14
(175ns)
+

+
+

+ 1.16
(178ns)
+

+
+

+ 1.00
(153ns)
+

+
+

+ NegativeBinomial (quantile) +

+
+

+ 2.79
(9167ns)
+

+
+

+ 1.60
(5278ns)
+

+
+

+ 1.20
(3953ns)
+

+
+

+ 1.00
(3291ns)
+

+
+

+ NonCentralBeta (CDF) +

+
+

+ 3.86
(2715ns)
+

+
+

+ 2.02
(1421ns)
+

+
+

+ 1.70
(1196ns)
+

+
+

+ 1.00
(703ns)
+

+
+

+ NonCentralBeta (PDF) +

+
+

+ 3.99
(2036ns)
+

+
+

+ 2.31
(1179ns)
+

+
+

+ 2.04
(1041ns)
+

+
+

+ 1.00
(510ns)
+

+
+

+ NonCentralBeta (quantile) +

+
+

+ 5.19
(63495ns)
+

+
+

+ 2.42
(29566ns)
+

+
+

+ 2.00
(24524ns)
+

+
+

+ 1.00
(12234ns)
+

+
+

+ NonCentralChiSquared (CDF) +

+
+

+ 4.22
(7258ns)
+

+
+

+ 2.63
(4515ns)
+

+
+

+ 2.03
(3492ns)
+

+
+

+ 1.00
(1719ns)
+

+
+

+ NonCentralChiSquared (PDF) +

+
+

+ 3.29
(1275ns)
+

+
+

+ 1.82
(705ns)
+

+
+

+ 1.67
(645ns)
+

+
+

+ 1.00
(387ns)
+

+
+

+ NonCentralChiSquared (quantile) +

+
+

+ 7.10
(51391ns)
+

+
+

+ 3.72
(26920ns)
+

+
+

+ 2.42
(17494ns)
+

+
+

+ 1.00
(7241ns)
+

+
+

+ NonCentralF (CDF) +

+
+

+ 3.95
(2583ns)
+

+
+

+ 2.09
(1364ns)
+

+
+

+ 1.73
(1131ns)
+

+
+

+ 1.00
(654ns)
+

+
+

+ NonCentralF (PDF) +

+
+

+ 3.91
(2102ns)
+

+
+

+ 2.05
(1099ns)
+

+
+

+ 1.83
(985ns)
+

+
+

+ 1.00
(537ns)
+

+
+

+ NonCentralF (quantile) +

+
+

+ 4.47
(39838ns)
+

+
+

+ 2.24
(19939ns)
+

+
+

+ 1.71
(15247ns)
+

+
+

+ 1.00
(8916ns)
+

+
+

+ NonCentralT (CDF) +

+
+

+ 4.50
(9817ns)
+

+
+

+ 2.77
(6036ns)
+

+
+

+ 2.49
(5428ns)
+

+
+

+ 1.00
(2180ns)
+

+
+

+ NonCentralT (PDF) +

+
+

+ 4.25
(7422ns)
+

+
+

+ 2.77
(4838ns)
+

+
+

+ 2.32
(4054ns)
+

+
+

+ 1.00
(1745ns)
+

+
+

+ NonCentralT (quantile) +

+
+

+ 5.46
(100206ns)
+

+
+

+ 3.24
(59572ns)
+

+
+

+ 2.26
(41463ns)
+

+
+

+ 1.00
(18366ns)
+

+
+

+ Normal (CDF) +

+
+

+ 2.39
(79ns)
+

+
+

+ 1.06
(35ns)
+

+
+

+ 1.06
(35ns)
+

+
+

+ 1.00
(33ns)
+

+
+

+ Normal (PDF) +

+
+

+ 1.43
(33ns)
+

+
+

+ 1.39
(32ns)
+

+
+

+ 1.43
(33ns)
+

+
+

+ 1.00
(23ns)
+

+
+

+ Normal (quantile) +

+
+

+ 1.56
(67ns)
+

+
+

+ 1.21
(52ns)
+

+
+

+ 1.21
(52ns)
+

+
+

+ 1.00
(43ns)
+

+
+

+ Pareto (CDF) +

+
+

+ 1.04
(52ns)
+

+
+

+ 1.06
(53ns)
+

+
+

+ 1.04
(52ns)
+

+
+

+ 1.00
(50ns)
+

+
+

+ Pareto (PDF) +

+
+

+ 1.01
(91ns)
+

+
+

+ 1.00
(90ns)
+

+
+

+ 1.02
(92ns)
+

+
+

+ 1.22
(110ns)
+

+
+

+ Pareto (quantile) +

+
+

+ 1.00
(55ns)
+

+
+

+ 1.20
(66ns)
+

+
+

+ 1.00
(55ns)
+

+
+

+ 1.22
(67ns)
+

+
+

+ Poisson (CDF) +

+
+

+ 3.39
(251ns)
+

+
+

+ 1.69
(125ns)
+

+
+

+ 1.43
(106ns)
+

+
+

+ 1.00
(74ns)
+

+
+

+ Poisson (PDF) +

+
+

+ 3.06
(196ns)
+

+
+

+ 1.47
(94ns)
+

+
+

+ 1.34
(86ns)
+

+
+

+ 1.00
(64ns)
+

+
+

+ Poisson (quantile) +

+
+

+ 2.97
(1120ns)
+

+
+

+ 1.49
(562ns)
+

+
+

+ 1.29
(487ns)
+

+
+

+ 1.00
(377ns)
+

+
+

+ Rayleigh (CDF) +

+
+

+ 1.21
(23ns)
+

+
+

+ 1.16
(22ns)
+

+
+

+ 1.16
(22ns)
+

+
+

+ 1.00
(19ns)
+

+
+

+ Rayleigh (PDF) +

+
+

+ 1.48
(31ns)
+

+
+

+ 1.29
(27ns)
+

+
+

+ 1.29
(27ns)
+

+
+

+ 1.00
(21ns)
+

+
+

+ Rayleigh (quantile) +

+
+

+ 1.04
(25ns)
+

+
+

+ 1.00
(24ns)
+

+
+

+ 1.04
(25ns)
+

+
+

+ 1.04
(25ns)
+

+
+

+ SkewNormal (CDF) +

+
+

+ 1.68
(471ns)
+

+
+

+ 1.54
(433ns)
+

+
+

+ 1.52
(428ns)
+

+
+

+ 1.00
(281ns)
+

+
+

+ SkewNormal (PDF) +

+
+

+ 1.91
(90ns)
+

+
+

+ 1.26
(59ns)
+

+
+

+ 1.28
(60ns)
+

+
+

+ 1.00
(47ns)
+

+
+

+ SkewNormal (quantile) +

+
+

+ 2.12
(3697ns)
+

+
+

+ 1.98
(3440ns)
+

+
+

+ 1.34
(2339ns)
+

+
+

+ 1.00
(1740ns)
+

+
+

+ StudentsT (CDF) +

+
+

+ 6.37
(1517ns)
+

+
+

+ 2.02
(481ns)
+

+
+

+ 1.95
(463ns)
+

+
+

+ 1.00
(238ns)
+

+
+

+ StudentsT (PDF) +

+
+

+ 5.55
(716ns)
+

+
+

+ 1.53
(198ns)
+

+
+

+ 1.57
(202ns)
+

+
+

+ 1.00
(129ns)
+

+
+

+ StudentsT (quantile) +

+
+

+ 4.85
(2557ns)
+

+
+

+ 1.60
(841ns)
+

+
+

+ 1.55
(817ns)
+

+
+

+ 1.00
(527ns)
+

+
+

+ Weibull (CDF) +

+
+

+ 1.07
(91ns)
+

+
+

+ 1.00
(85ns)
+

+
+

+ 1.00
(85ns)
+

+
+

+ 1.27
(108ns)
+

+
+

+ Weibull (PDF) +

+
+

+ 1.01
(155ns)
+

+
+

+ 1.00
(154ns)
+

+
+

+ 1.01
(155ns)
+

+
+

+ 1.23
(189ns)
+

+
+

+ Weibull (quantile) +

+
+

+ 1.00
(89ns)
+

+
+

+ 1.00
(89ns)
+

+
+

+ 1.00
(89ns)
+

+
+

+ 1.22
(109ns)
+

+
+
+
+
+
+ +
+

Table 6. Distribution performance comparison for different performance options + with Intel C++ C++0x mode version 1600 on Windows x64

+
++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ Function +

+
+

+ boost 1.61 +

+
+

+ Boost
promote_double<false>
digits10<10> +

+
+

+ Boost
float
promote_float<false> +

+
+

+ ArcSine (CDF) +

+
+

+ 1.33
(36ns)
+

+
+

+ 1.26
(34ns)
+

+
+

+ 1.00
(27ns)
+

+
+

+ ArcSine (PDF) +

+
+

+ 1.19
(19ns)
+

+
+

+ 1.00
(16ns)
+

+
+

+ 1.00
(16ns)
+

+
+

+ ArcSine (quantile) +

+
+

+ 1.00
(24ns)
+

+
+

+ 1.00
(24ns)
+

+
+

+ 1.13
(27ns)
+

+
+

+ Beta (CDF) +

+
+

+ 2.30
(170ns)
+

+
+

+ 1.80
(133ns)
+

+
+

+ 1.00
(74ns)
+

+
+

+ Beta (PDF) +

+
+

+ 2.38
(152ns)
+

+
+

+ 1.61
(103ns)
+

+
+

+ 1.00
(64ns)
+

+
+

+ Beta (quantile) +

+
+

+ 2.15
(871ns)
+

+
+

+ 1.49
(603ns)
+

+
+

+ 1.00
(405ns)
+

+
+

+ Binomial (CDF) +

+
+

+ 2.66
(644ns)
+

+
+

+ 1.95
(473ns)
+

+
+

+ 1.00
(242ns)
+

+
+

+ Binomial (PDF) +

+
+

+ 1.95
(187ns)
+

+
+

+ 1.35
(130ns)
+

+
+

+ 1.00
(96ns)
+

+
+

+ Binomial (quantile) +

+
+

+ 2.64
(3067ns)
+

+
+

+ 1.90
(2201ns)
+

+
+

+ 1.00
(1160ns)
+

+
+

+ Cauchy (CDF) +

+
+

+ 1.28
(23ns)
+

+
+

+ 1.28
(23ns)
+

+
+

+ 1.00
(18ns)
+

+
+

+ Cauchy (PDF) +

+
+

+ 1.00
(9ns)
+

+
+

+ 1.00
(9ns)
+

+
+

+ 1.00
(9ns)
+

+
+

+ Cauchy (quantile) +

+
+

+ 1.23
(27ns)
+

+
+

+ 1.18
(26ns)
+

+
+

+ 1.00
(22ns)
+

+
+

+ ChiSquared (CDF) +

+
+

+ 2.00
(226ns)
+

+
+

+ 1.71
(193ns)
+

+
+

+ 1.00
(113ns)
+

+
+

+ ChiSquared (PDF) +

+
+

+ 1.75
(103ns)
+

+
+

+ 1.37
(81ns)
+

+
+

+ 1.00
(59ns)
+

+
+

+ ChiSquared (quantile) +

+
+

+ 2.10
(610ns)
+

+
+

+ 1.54
(449ns)
+

+
+

+ 1.00
(291ns)
+

+
+

+ Exponential (CDF) +

+
+

+ 1.36
(19ns)
+

+
+

+ 1.00
(14ns)
+

+
+

+ 1.00
(14ns)
+

+
+

+ Exponential (PDF) +

+
+

+ 1.00
(17ns)
+

+
+

+ 1.00
(17ns)
+

+
+

+ 1.00
(17ns)
+

+
+

+ Exponential (quantile) +

+
+

+ 1.24
(21ns)
+

+
+

+ 1.24
(21ns)
+

+
+

+ 1.00
(17ns)
+

+
+

+ ExtremeValue (CDF) +

+
+

+ 1.00
(24ns)
+

+
+

+ 1.00
(24ns)
+

+
+

+ 1.04
(25ns)
+

+
+

+ ExtremeValue (PDF) +

+
+

+ 1.08
(27ns)
+

+
+

+ 1.08
(27ns)
+

+
+

+ 1.00
(25ns)
+

+
+

+ ExtremeValue (quantile) +

+
+

+ 1.32
(29ns)
+

+
+

+ 1.41
(31ns)
+

+
+

+ 1.00
(22ns)
+

+
+

+ F (CDF) +

+
+

+ 2.95
(566ns)
+

+
+

+ 2.10
(403ns)
+

+
+

+ 1.00
(192ns)
+

+
+

+ F (PDF) +

+
+

+ 2.33
(214ns)
+

+
+

+ 1.52
(140ns)
+

+
+

+ 1.00
(92ns)
+

+
+

+ F (quantile) +

+
+

+ 1.61
(1265ns)
+

+
+

+ 1.24
(972ns)
+

+
+

+ 1.00
(785ns)
+

+
+

+ Gamma (CDF) +

+
+

+ 1.68
(190ns)
+

+
+

+ 1.57
(177ns)
+

+
+

+ 1.00
(113ns)
+

+
+

+ Gamma (PDF) +

+
+

+ 1.81
(112ns)
+

+
+

+ 1.44
(89ns)
+

+
+

+ 1.00
(62ns)
+

+
+

+ Gamma (quantile) +

+
+

+ 2.02
(625ns)
+

+
+

+ 1.35
(417ns)
+

+
+

+ 1.00
(309ns)
+

+
+

+ Geometric (CDF) +

+
+

+ 1.41
(24ns)
+

+
+

+ 1.18
(20ns)
+

+
+

+ 1.00
(17ns)
+

+
+

+ Geometric (PDF) +

+
+

+ 1.25
(15ns)
+

+
+

+ 1.17
(14ns)
+

+
+

+ 1.00
(12ns)
+

+
+

+ Geometric (quantile) +

+
+

+ 1.22
(22ns)
+

+
+

+ 1.22
(22ns)
+

+
+

+ 1.00
(18ns)
+

+
+

+ Hypergeometric (CDF) +

+
+

+ 1.01
(5958ns)
+

+
+

+ 1.00
(5921ns)
+

+
+

+ 1.03
(6119ns)
+

+
+

+ Hypergeometric (PDF) +

+
+

+ 1.01
(5681ns)
+

+
+

+ 1.00
(5646ns)
+

+
+

+ 1.05
(5949ns)
+

+
+

+ Hypergeometric (quantile) +

+
+

+ 1.01
(35994ns)
+

+
+

+ 1.00
(35580ns)
+

+
+

+ 1.01
(35907ns)
+

+
+

+ InverseChiSquared (CDF) +

+
+

+ 2.30
(214ns)
+

+
+

+ 1.66
(154ns)
+

+
+

+ 1.00
(93ns)
+

+
+

+ InverseChiSquared (PDF) +

+
+

+ 2.03
(118ns)
+

+
+

+ 1.55
(90ns)
+

+
+

+ 1.00
(58ns)
+

+
+

+ InverseChiSquared (quantile) +

+
+

+ 2.36
(647ns)
+

+
+

+ 1.55
(424ns)
+

+
+

+ 1.00
(274ns)
+

+
+

+ InverseGamma (CDF) +

+
+

+ 1.63
(187ns)
+

+
+

+ 1.42
(163ns)
+

+
+

+ 1.00
(115ns)
+

+
+

+ InverseGamma (PDF) +

+
+

+ 1.87
(116ns)
+

+
+

+ 1.50
(93ns)
+

+
+

+ 1.00
(62ns)
+

+
+

+ InverseGamma (quantile) +

+
+

+ 1.93
(620ns)
+

+
+

+ 1.38
(443ns)
+

+
+

+ 1.00
(321ns)
+

+
+

+ InverseGaussian (CDF) +

+
+

+ 1.36
(53ns)
+

+
+

+ 1.38
(54ns)
+

+
+

+ 1.00
(39ns)
+

+
+

+ InverseGaussian (PDF) +

+
+

+ 1.18
(13ns)
+

+
+

+ 1.09
(12ns)
+

+
+

+ 1.00
(11ns)
+

+
+

+ InverseGaussian (quantile) +

+
+

+ 1.53
(902ns)
+

+
+

+ 1.44
(844ns)
+

+
+

+ 1.00
(588ns)
+

+
+

+ Laplace (CDF) +

+
+

+ 1.00
(15ns)
+

+
+

+ 1.00
(15ns)
+

+
+

+ 1.13
(17ns)
+

+
+

+ Laplace (PDF) +

+
+

+ 1.00
(16ns)
+

+
+

+ 1.00
(16ns)
+

+
+

+ 1.00
(16ns)
+

+
+

+ Laplace (quantile) +

+
+

+ 1.06
(17ns)
+

+
+

+ 1.06
(17ns)
+

+
+

+ 1.00
(16ns)
+

+
+

+ LogNormal (CDF) +

+
+

+ 1.20
(42ns)
+

+
+

+ 1.20
(42ns)
+

+
+

+ 1.00
(35ns)
+

+
+

+ LogNormal (PDF) +

+
+

+ 1.28
(32ns)
+

+
+

+ 1.28
(32ns)
+

+
+

+ 1.00
(25ns)
+

+
+

+ LogNormal (quantile) +

+
+

+ 1.15
(61ns)
+

+
+

+ 1.15
(61ns)
+

+
+

+ 1.00
(53ns)
+

+
+

+ Logistic (CDF) +

+
+

+ 1.06
(17ns)
+

+
+

+ 1.06
(17ns)
+

+
+

+ 1.00
(16ns)
+

+
+

+ Logistic (PDF) +

+
+

+ 1.11
(20ns)
+

+
+

+ 1.11
(20ns)
+

+
+

+ 1.00
(18ns)
+

+
+

+ Logistic (quantile) +

+
+

+ 1.25
(20ns)
+

+
+

+ 1.19
(19ns)
+

+
+

+ 1.00
(16ns)
+

+
+

+ NegativeBinomial (CDF) +

+
+

+ 3.21
(964ns)
+

+
+

+ 2.29
(686ns)
+

+
+

+ 1.00
(300ns)
+

+
+

+ NegativeBinomial (PDF) +

+
+

+ 1.97
(187ns)
+

+
+

+ 1.37
(130ns)
+

+
+

+ 1.00
(95ns)
+

+
+

+ NegativeBinomial (quantile) +

+
+

+ 1.80
(4806ns)
+

+
+

+ 1.32
(3526ns)
+

+
+

+ 1.00
(2665ns)
+

+
+

+ NonCentralBeta (CDF) +

+
+

+ 2.73
(1240ns)
+

+
+

+ 2.14
(975ns)
+

+
+

+ 1.00
(455ns)
+

+
+

+ NonCentralBeta (PDF) +

+
+

+ 2.73
(1053ns)
+

+
+

+ 2.17
(836ns)
+

+
+

+ 1.00
(386ns)
+

+
+

+ NonCentralBeta (quantile) +

+
+

+ 3.43
(24612ns)
+

+
+

+ 2.58
(18500ns)
+

+
+

+ 1.00
(7178ns)
+

+
+

+ NonCentralChiSquared (CDF) +

+
+

+ 2.79
(3877ns)
+

+
+

+ 2.20
(3057ns)
+

+
+

+ 1.00
(1389ns)
+

+
+

+ NonCentralChiSquared (PDF) +

+
+

+ 1.78
(555ns)
+

+
+

+ 1.59
(495ns)
+

+
+

+ 1.00
(312ns)
+

+
+

+ NonCentralChiSquared (quantile) +

+
+

+ 3.85
(22440ns)
+

+
+

+ 2.65
(15474ns)
+

+
+

+ 1.00
(5830ns)
+

+
+

+ NonCentralF (CDF) +

+
+

+ 2.75
(1278ns)
+

+
+

+ 2.01
(935ns)
+

+
+

+ 1.00
(465ns)
+

+
+

+ NonCentralF (PDF) +

+
+

+ 2.64
(1035ns)
+

+
+

+ 1.92
(753ns)
+

+
+

+ 1.00
(392ns)
+

+
+

+ NonCentralF (quantile) +

+
+

+ 3.08
(18251ns)
+

+
+

+ 2.14
(12664ns)
+

+
+

+ 1.00
(5924ns)
+

+
+

+ NonCentralT (CDF) +

+
+

+ 2.86
(5298ns)
+

+
+

+ 2.22
(4117ns)
+

+
+

+ 1.00
(1853ns)
+

+
+

+ NonCentralT (PDF) +

+
+

+ 2.84
(4062ns)
+

+
+

+ 2.26
(3229ns)
+

+
+

+ 1.00
(1429ns)
+

+
+

+ NonCentralT (quantile) +

+
+

+ 3.48
(48842ns)
+

+
+

+ 2.47
(34580ns)
+

+
+

+ 1.00
(14027ns)
+

+
+

+ Normal (CDF) +

+
+

+ 1.07
(31ns)
+

+
+

+ 1.07
(31ns)
+

+
+

+ 1.00
(29ns)
+

+
+

+ Normal (PDF) +

+
+

+ 1.00
(19ns)
+

+
+

+ 1.00
(19ns)
+

+
+

+ 1.00
(19ns)
+

+
+

+ Normal (quantile) +

+
+

+ 1.17
(42ns)
+

+
+

+ 1.11
(40ns)
+

+
+

+ 1.00
(36ns)
+

+
+

+ Pareto (CDF) +

+
+

+ 1.32
(33ns)
+

+
+

+ 1.32
(33ns)
+

+
+

+ 1.00
(25ns)
+

+
+

+ Pareto (PDF) +

+
+

+ 1.24
(62ns)
+

+
+

+ 1.26
(63ns)
+

+
+

+ 1.00
(50ns)
+

+
+

+ Pareto (quantile) +

+
+

+ 1.07
(29ns)
+

+
+

+ 1.07
(29ns)
+

+
+

+ 1.00
(27ns)
+

+
+

+ Poisson (CDF) +

+
+

+ 1.71
(96ns)
+

+
+

+ 1.41
(79ns)
+

+
+

+ 1.00
(56ns)
+

+
+

+ Poisson (PDF) +

+
+

+ 1.69
(61ns)
+

+
+

+ 1.44
(52ns)
+

+
+

+ 1.00
(36ns)
+

+
+

+ Poisson (quantile) +

+
+

+ 1.54
(446ns)
+

+
+

+ 1.33
(387ns)
+

+
+

+ 1.00
(290ns)
+

+
+

+ Rayleigh (CDF) +

+
+

+ 1.41
(24ns)
+

+
+

+ 1.06
(18ns)
+

+
+

+ 1.00
(17ns)
+

+
+

+ Rayleigh (PDF) +

+
+

+ 1.17
(21ns)
+

+
+

+ 1.17
(21ns)
+

+
+

+ 1.00
(18ns)
+

+
+

+ Rayleigh (quantile) +

+
+

+ 1.22
(22ns)
+

+
+

+ 1.22
(22ns)
+

+
+

+ 1.00
(18ns)
+

+
+

+ SkewNormal (CDF) +

+
+

+ 1.01
(187ns)
+

+
+

+ 1.00
(186ns)
+

+
+

+ 1.01
(187ns)
+

+
+

+ SkewNormal (PDF) +

+
+

+ 1.04
(49ns)
+

+
+

+ 1.06
(50ns)
+

+
+

+ 1.00
(47ns)
+

+
+

+ SkewNormal (quantile) +

+
+

+ 1.44
(1409ns)
+

+
+

+ 1.10
(1078ns)
+

+
+

+ 1.00
(979ns)
+

+
+

+ StudentsT (CDF) +

+
+

+ 1.72
(331ns)
+

+
+

+ 1.57
(302ns)
+

+
+

+ 1.00
(192ns)
+

+
+

+ StudentsT (PDF) +

+
+

+ 1.57
(132ns)
+

+
+

+ 1.55
(130ns)
+

+
+

+ 1.00
(84ns)
+

+
+

+ StudentsT (quantile) +

+
+

+ 1.40
(623ns)
+

+
+

+ 1.39
(619ns)
+

+
+

+ 1.00
(444ns)
+

+
+

+ Weibull (CDF) +

+
+

+ 1.39
(46ns)
+

+
+

+ 1.24
(41ns)
+

+
+

+ 1.00
(33ns)
+

+
+

+ Weibull (PDF) +

+
+

+ 1.50
(63ns)
+

+
+

+ 1.40
(59ns)
+

+
+

+ 1.00
(42ns)
+

+
+

+ Weibull (quantile) +

+
+

+ 1.29
(44ns)
+

+
+

+ 1.29
(44ns)
+

+
+

+ 1.00
(34ns)
+

+
+
+
+
+
+ +
+

Table 7. Distribution performance comparison for different performance options + with Microsoft Visual C++ version 14.0 on Windows x64

+
++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ Function +

+
+

+ boost 1.61 +

+
+

+ Boost
promote_double<false>
digits10<10> +

+
+

+ Boost
float
promote_float<false> +

+
+

+ ArcSine (CDF) +

+
+

+ 1.36
(45ns)
+

+
+

+ 1.45
(48ns)
+

+
+

+ 1.00
(33ns)
+

+
+

+ ArcSine (PDF) +

+
+

+ 1.00
(16ns)
+

+
+

+ 1.13
(18ns)
+

+
+

+ 1.06
(17ns)
+

+
+

+ ArcSine (quantile) +

+
+

+ 1.00
(21ns)
+

+
+

+ 1.05
(22ns)
+

+
+

+ 1.38
(29ns)
+

+
+

+ Beta (CDF) +

+
+

+ 1.87
(196ns)
+

+
+

+ 1.71
(180ns)
+

+
+

+ 1.00
(105ns)
+

+
+

+ Beta (PDF) +

+
+

+ 1.64
(143ns)
+

+
+

+ 1.70
(148ns)
+

+
+

+ 1.00
(87ns)
+

+
+

+ Beta (quantile) +

+
+

+ 1.80
(1127ns)
+

+
+

+ 1.43
(894ns)
+

+
+

+ 1.00
(627ns)
+

+
+

+ Binomial (CDF) +

+
+

+ 2.32
(682ns)
+

+
+

+ 1.95
(573ns)
+

+
+

+ 1.00
(294ns)
+

+
+

+ Binomial (PDF) +

+
+

+ 1.63
(184ns)
+

+
+

+ 1.73
(196ns)
+

+
+

+ 1.00
(113ns)
+

+
+

+ Binomial (quantile) +

+
+

+ 2.28
(3249ns)
+

+
+

+ 1.82
(2602ns)
+

+
+

+ 1.00
(1428ns)
+

+
+

+ Cauchy (CDF) +

+
+

+ 1.14
(32ns)
+

+
+

+ 1.14
(32ns)
+

+
+

+ 1.00
(28ns)
+

+
+

+ Cauchy (PDF) +

+
+

+ 1.10
(11ns)
+

+
+

+ 1.10
(11ns)
+

+
+

+ 1.00
(10ns)
+

+
+

+ Cauchy (quantile) +

+
+

+ 1.10
(23ns)
+

+
+

+ 1.05
(22ns)
+

+
+

+ 1.00
(21ns)
+

+
+

+ ChiSquared (CDF) +

+
+

+ 1.60
(268ns)
+

+
+

+ 1.38
(231ns)
+

+
+

+ 1.00
(168ns)
+

+
+

+ ChiSquared (PDF) +

+
+

+ 1.95
(129ns)
+

+
+

+ 1.89
(125ns)
+

+
+

+ 1.00
(66ns)
+

+
+

+ ChiSquared (quantile) +

+
+

+ 1.98
(741ns)
+

+
+

+ 1.47
(551ns)
+

+
+

+ 1.00
(375ns)
+

+
+

+ Exponential (CDF) +

+
+

+ 1.18
(20ns)
+

+
+

+ 1.06
(18ns)
+

+
+

+ 1.00
(17ns)
+

+
+

+ Exponential (PDF) +

+
+

+ 1.00
(16ns)
+

+
+

+ 1.06
(17ns)
+

+
+

+ 1.31
(21ns)
+

+
+

+ Exponential (quantile) +

+
+

+ 1.26
(29ns)
+

+
+

+ 1.00
(23ns)
+

+
+

+ 1.26
(29ns)
+

+
+

+ ExtremeValue (CDF) +

+
+

+ 1.29
(45ns)
+

+
+

+ 1.26
(44ns)
+

+
+

+ 1.00
(35ns)
+

+
+

+ ExtremeValue (PDF) +

+
+

+ 1.26
(44ns)
+

+
+

+ 1.37
(48ns)
+

+
+

+ 1.00
(35ns)
+

+
+

+ ExtremeValue (quantile) +

+
+

+ 1.24
(36ns)
+

+
+

+ 1.21
(35ns)
+

+
+

+ 1.00
(29ns)
+

+
+

+ F (CDF) +

+
+

+ 2.43
(643ns)
+

+
+

+ 1.95
(516ns)
+

+
+

+ 1.00
(265ns)
+

+
+

+ F (PDF) +

+
+

+ 1.74
(202ns)
+

+
+

+ 1.69
(196ns)
+

+
+

+ 1.00
(116ns)
+

+
+

+ F (quantile) +

+
+

+ 1.31
(1464ns)
+

+
+

+ 1.34
(1503ns)
+

+
+

+ 1.00
(1121ns)
+

+
+

+ Gamma (CDF) +

+
+

+ 2.00
(294ns)
+

+
+

+ 1.47
(216ns)
+

+
+

+ 1.00
(147ns)
+

+
+

+ Gamma (PDF) +

+
+

+ 1.71
(159ns)
+

+
+

+ 1.57
(146ns)
+

+
+

+ 1.00
(93ns)
+

+
+

+ Gamma (quantile) +

+
+

+ 1.67
(841ns)
+

+
+

+ 1.17
(586ns)
+

+
+

+ 1.00
(503ns)
+

+
+

+ Geometric (CDF) +

+
+

+ 1.24
(26ns)
+

+
+

+ 1.19
(25ns)
+

+
+

+ 1.00
(21ns)
+

+
+

+ Geometric (PDF) +

+
+

+ 1.61
(29ns)
+

+
+

+ 1.72
(31ns)
+

+
+

+ 1.00
(18ns)
+

+
+

+ Geometric (quantile) +

+
+

+ 1.14
(25ns)
+

+
+

+ 1.09
(24ns)
+

+
+

+ 1.00
(22ns)
+

+
+

+ Hypergeometric (CDF) +

+
+

+ 1.05
(6896ns)
+

+
+

+ 1.04
(6830ns)
+

+
+

+ 1.00
(6577ns)
+

+
+

+ Hypergeometric (PDF) +

+
+

+ 1.00
(6565ns)
+

+
+

+ 1.04
(6855ns)
+

+
+

+ 1.03
(6774ns)
+

+
+

+ Hypergeometric (quantile) +

+
+

+ 1.00
(34866ns)
+

+
+

+ 1.12
(38984ns)
+

+
+

+ 1.00
(35017ns)
+

+
+

+ InverseChiSquared (CDF) +

+
+

+ 2.26
(269ns)
+

+
+

+ 1.84
(219ns)
+

+
+

+ 1.00
(119ns)
+

+
+

+ InverseChiSquared (PDF) +

+
+

+ 1.90
(156ns)
+

+
+

+ 1.71
(140ns)
+

+
+

+ 1.00
(82ns)
+

+
+

+ InverseChiSquared (quantile) +

+
+

+ 1.55
(778ns)
+

+
+

+ 1.17
(587ns)
+

+
+

+ 1.00
(501ns)
+

+
+

+ InverseGamma (CDF) +

+
+

+ 1.85
(279ns)
+

+
+

+ 1.44
(217ns)
+

+
+

+ 1.00
(151ns)
+

+
+

+ InverseGamma (PDF) +

+
+

+ 2.52
(217ns)
+

+
+

+ 1.85
(159ns)
+

+
+

+ 1.00
(86ns)
+

+
+

+ InverseGamma (quantile) +

+
+

+ 2.34
(946ns)
+

+
+

+ 1.41
(571ns)
+

+
+

+ 1.00
(404ns)
+

+
+

+ InverseGaussian (CDF) +

+
+

+ 1.05
(63ns)
+

+
+

+ 1.03
(62ns)
+

+
+

+ 1.00
(60ns)
+

+
+

+ InverseGaussian (PDF) +

+
+

+ 1.00
(16ns)
+

+
+

+ 1.00
(16ns)
+

+
+

+ 1.06
(17ns)
+

+
+

+ InverseGaussian (quantile) +

+
+

+ 1.28
(1138ns)
+

+
+

+ 1.19
(1053ns)
+

+
+

+ 1.00
(888ns)
+

+
+

+ Laplace (CDF) +

+
+

+ 1.22
(22ns)
+

+
+

+ 1.22
(22ns)
+

+
+

+ 1.00
(18ns)
+

+
+

+ Laplace (PDF) +

+
+

+ 1.44
(23ns)
+

+
+

+ 1.50
(24ns)
+

+
+

+ 1.00
(16ns)
+

+
+

+ Laplace (quantile) +

+
+

+ 1.22
(22ns)
+

+
+

+ 1.22
(22ns)
+

+
+

+ 1.00
(18ns)
+

+
+

+ LogNormal (CDF) +

+
+

+ 1.26
(49ns)
+

+
+

+ 1.26
(49ns)
+

+
+

+ 1.00
(39ns)
+

+
+

+ LogNormal (PDF) +

+
+

+ 1.16
(43ns)
+

+
+

+ 1.14
(42ns)
+

+
+

+ 1.00
(37ns)
+

+
+

+ LogNormal (quantile) +

+
+

+ 1.30
(82ns)
+

+
+

+ 1.30
(82ns)
+

+
+

+ 1.00
(63ns)
+

+
+

+ Logistic (CDF) +

+
+

+ 1.50
(24ns)
+

+
+

+ 1.50
(24ns)
+

+
+

+ 1.00
(16ns)
+

+
+

+ Logistic (PDF) +

+
+

+ 1.26
(29ns)
+

+
+

+ 1.26
(29ns)
+

+
+

+ 1.00
(23ns)
+

+
+

+ Logistic (quantile) +

+
+

+ 1.11
(21ns)
+

+
+

+ 1.05
(20ns)
+

+
+

+ 1.00
(19ns)
+

+
+

+ NegativeBinomial (CDF) +

+
+

+ 2.62
(1081ns)
+

+
+

+ 2.02
(832ns)
+

+
+

+ 1.00
(412ns)
+

+
+

+ NegativeBinomial (PDF) +

+
+

+ 1.67
(200ns)
+

+
+

+ 1.71
(205ns)
+

+
+

+ 1.00
(120ns)
+

+
+

+ NegativeBinomial (quantile) +

+
+

+ 1.53
(5462ns)
+

+
+

+ 1.22
(4355ns)
+

+
+

+ 1.00
(3571ns)
+

+
+

+ NonCentralBeta (CDF) +

+
+

+ 2.67
(1449ns)
+

+
+

+ 2.23
(1212ns)
+

+
+

+ 1.00
(543ns)
+

+
+

+ NonCentralBeta (PDF) +

+
+

+ 2.64
(1186ns)
+

+
+

+ 2.24
(1009ns)
+

+
+

+ 1.00
(450ns)
+

+
+

+ NonCentralBeta (quantile) +

+
+

+ 3.39
(29111ns)
+

+
+

+ 2.81
(24149ns)
+

+
+

+ 1.00
(8580ns)
+

+
+

+ NonCentralChiSquared (CDF) +

+
+

+ 2.78
(4617ns)
+

+
+

+ 2.19
(3633ns)
+

+
+

+ 1.00
(1662ns)
+

+
+

+ NonCentralChiSquared (PDF) +

+
+

+ 1.73
(607ns)
+

+
+

+ 1.58
(552ns)
+

+
+

+ 1.00
(350ns)
+

+
+

+ NonCentralChiSquared (quantile) +

+
+

+ 3.89
(27110ns)
+

+
+

+ 2.60
(18124ns)
+

+
+

+ 1.00
(6974ns)
+

+
+

+ NonCentralF (CDF) +

+
+

+ 2.45
(1382ns)
+

+
+

+ 2.07
(1167ns)
+

+
+

+ 1.00
(564ns)
+

+
+

+ NonCentralF (PDF) +

+
+

+ 2.43
(1087ns)
+

+
+

+ 2.13
(952ns)
+

+
+

+ 1.00
(447ns)
+

+
+

+ NonCentralF (quantile) +

+
+

+ 2.76
(20066ns)
+

+
+

+ 2.18
(15826ns)
+

+
+

+ 1.00
(7268ns)
+

+
+

+ NonCentralT (CDF) +

+
+

+ 2.26
(6005ns)
+

+
+

+ 1.84
(4878ns)
+

+
+

+ 1.00
(2655ns)
+

+
+

+ NonCentralT (PDF) +

+
+

+ 2.53
(4582ns)
+

+
+

+ 2.11
(3828ns)
+

+
+

+ 1.00
(1813ns)
+

+
+

+ NonCentralT (quantile) +

+
+

+ 2.91
(56269ns)
+

+
+

+ 2.10
(40598ns)
+

+
+

+ 1.00
(19366ns)
+

+
+

+ Normal (CDF) +

+
+

+ 1.52
(38ns)
+

+
+

+ 1.44
(36ns)
+

+
+

+ 1.00
(25ns)
+

+
+

+ Normal (PDF) +

+
+

+ 1.16
(29ns)
+

+
+

+ 1.16
(29ns)
+

+
+

+ 1.00
(25ns)
+

+
+

+ Normal (quantile) +

+
+

+ 1.08
(40ns)
+

+
+

+ 1.14
(42ns)
+

+
+

+ 1.00
(37ns)
+

+
+

+ Pareto (CDF) +

+
+

+ 1.60
(48ns)
+

+
+

+ 1.67
(50ns)
+

+
+

+ 1.00
(30ns)
+

+
+

+ Pareto (PDF) +

+
+

+ 1.44
(111ns)
+

+
+

+ 1.40
(108ns)
+

+
+

+ 1.00
(77ns)
+

+
+

+ Pareto (quantile) +

+
+

+ 1.34
(43ns)
+

+
+

+ 1.38
(44ns)
+

+
+

+ 1.00
(32ns)
+

+
+

+ Poisson (CDF) +

+
+

+ 1.72
(122ns)
+

+
+

+ 1.51
(107ns)
+

+
+

+ 1.00
(71ns)
+

+
+

+ Poisson (PDF) +

+
+

+ 1.91
(82ns)
+

+
+

+ 1.88
(81ns)
+

+
+

+ 1.00
(43ns)
+

+
+

+ Poisson (quantile) +

+
+

+ 1.65
(599ns)
+

+
+

+ 1.47
(532ns)
+

+
+

+ 1.00
(362ns)
+

+
+

+ Rayleigh (CDF) +

+
+

+ 1.28
(23ns)
+

+
+

+ 1.17
(21ns)
+

+
+

+ 1.00
(18ns)
+

+
+

+ Rayleigh (PDF) +

+
+

+ 1.24
(21ns)
+

+
+

+ 1.24
(21ns)
+

+
+

+ 1.00
(17ns)
+

+
+

+ Rayleigh (quantile) +

+
+

+ 1.08
(27ns)
+

+
+

+ 1.08
(27ns)
+

+
+

+ 1.00
(25ns)
+

+
+

+ SkewNormal (CDF) +

+
+

+ 1.05
(232ns)
+

+
+

+ 1.04
(230ns)
+

+
+

+ 1.00
(221ns)
+

+
+

+ SkewNormal (PDF) +

+
+

+ 1.21
(81ns)
+

+
+

+ 1.21
(81ns)
+

+
+

+ 1.00
(67ns)
+

+
+

+ SkewNormal (quantile) +

+
+

+ 1.45
(2020ns)
+

+
+

+ 1.05
(1464ns)
+

+
+

+ 1.00
(1391ns)
+

+
+

+ StudentsT (CDF) +

+
+

+ 1.95
(464ns)
+

+
+

+ 1.95
(463ns)
+

+
+

+ 1.00
(238ns)
+

+
+

+ StudentsT (PDF) +

+
+

+ 1.95
(216ns)
+

+
+

+ 2.17
(241ns)
+

+
+

+ 1.00
(111ns)
+

+
+

+ StudentsT (quantile) +

+
+

+ 1.72
(839ns)
+

+
+

+ 1.78
(868ns)
+

+
+

+ 1.00
(487ns)
+

+
+

+ Weibull (CDF) +

+
+

+ 1.53
(75ns)
+

+
+

+ 1.47
(72ns)
+

+
+

+ 1.00
(49ns)
+

+
+

+ Weibull (PDF) +

+
+

+ 1.82
(120ns)
+

+
+

+ 1.79
(118ns)
+

+
+

+ 1.00
(66ns)
+

+
+

+ Weibull (quantile) +

+
+

+ 1.49
(73ns)
+

+
+

+ 1.53
(75ns)
+

+
+

+ 1.00
(49ns)
+

+
+
+
+
+
+ +
+

Table 8. Distribution performance comparison with GNU C++ version 5.3.0 on Windows + x64

+
++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ Function +

+
+

+ boost 1.61 +

+
+

+ Boost
promote_double<false> +

+
+

+ DCDFLIB +

+
+

+ ArcSine (CDF) +

+
+

+ 1.06
(33ns)
+

+
+

+ 1.00
(31ns)
+

+
+
+

+ ArcSine (PDF) +

+
+

+ 1.12
(9ns)
+

+
+

+ 1.00
(8ns)
+

+
+
+

+ ArcSine (quantile) +

+
+

+ 1.00
(44ns)
+

+
+

+ 1.00
(44ns)
+

+
+
+

+ Beta (CDF) +

+
+

+ 1.84
(379ns)
+

+
+

+ 1.00
(206ns)
+

+
+

+ 2.55
(526ns)
+

+
+

+ Beta (PDF) +

+
+

+ 2.15
(323ns)
+

+
+

+ 1.00
(150ns)
+

+
+
+

+ Beta (quantile) +

+
+

+ 1.58
(2180ns)
+

+
+

+ 1.00
(1382ns)
+

+
+

+ 8.32
(11501ns)
+

+
+

+ Binomial (CDF) +

+
+

+ 1.71
(1122ns)
+

+
+

+ 1.00
(658ns)
+

+
+

+ 1.25
(822ns)
+

+
+

+ Binomial (PDF) +

+
+

+ 2.11
(353ns)
+

+
+

+ 1.00
(167ns)
+

+
+
+

+ Binomial (quantile) +

+
+

+ 1.77
(5174ns)
+

+
+

+ 1.00
(2921ns)
+

+
+

+ 4.38
(12786ns)
+

+
+

+ Cauchy (CDF) +

+
+

+ 1.00
(23ns)
+

+
+

+ 1.00
(23ns)
+

+
+
+

+ Cauchy (PDF) +

+
+

+ 1.00
(7ns)
+

+
+

+ 1.14
(8ns)
+

+
+
+

+ Cauchy (quantile) +

+
+

+ 1.00
(24ns)
+

+
+

+ 1.17
(28ns)
+

+
+
+

+ ChiSquared (CDF) +

+
+

+ 2.04
(506ns)
+

+
+

+ 1.15
(285ns)
+

+
+

+ 1.00
(248ns)
+

+
+

+ ChiSquared (PDF) +

+
+

+ 1.83
(251ns)
+

+
+

+ 1.00
(137ns)
+

+
+
+

+ ChiSquared (quantile) +

+
+

+ 1.65
(1275ns)
+

+
+

+ 1.00
(774ns)
+

+
+

+ 7.13
(5518ns)
+

+
+

+ Exponential (CDF) +

+
+

+ 1.26
(43ns)
+

+
+

+ 1.00
(34ns)
+

+
+
+

+ Exponential (PDF) +

+
+

+ 1.07
(61ns)
+

+
+

+ 1.00
(57ns)
+

+
+
+

+ Exponential (quantile) +

+
+

+ 1.81
(47ns)
+

+
+

+ 1.00
(26ns)
+

+
+
+

+ ExtremeValue (CDF) +

+
+

+ 1.05
(114ns)
+

+
+

+ 1.00
(109ns)
+

+
+
+

+ ExtremeValue (PDF) +

+
+

+ 1.01
(155ns)
+

+
+

+ 1.00
(154ns)
+

+
+
+

+ ExtremeValue (quantile) +

+
+

+ 1.00
(72ns)
+

+
+

+ 1.00
(72ns)
+

+
+
+

+ F (CDF) +

+
+

+ 1.73
(988ns)
+

+
+

+ 1.00
(572ns)
+

+
+

+ 1.31
(747ns)
+

+
+

+ F (PDF) +

+
+

+ 2.10
(392ns)
+

+
+

+ 1.00
(187ns)
+

+
+
+

+ F (quantile) +

+
+

+ 1.82
(2910ns)
+

+
+

+ 1.00
(1601ns)
+

+
+

+ 6.08
(9729ns)
+

+
+

+ Gamma (CDF) +

+
+

+ 2.00
(483ns)
+

+
+

+ 1.20
(291ns)
+

+
+

+ 1.00
(242ns)
+

+
+

+ Gamma (PDF) +

+
+

+ 1.55
(316ns)
+

+
+

+ 1.00
(204ns)
+

+
+
+

+ Gamma (quantile) +

+
+

+ 1.95
(1425ns)
+

+
+

+ 1.31
(960ns)
+

+
+

+ 1.00
(731ns)
+

+
+

+ Geometric (CDF) +

+
+

+ 1.35
(46ns)
+

+
+

+ 1.00
(34ns)
+

+
+
+

+ Geometric (PDF) +

+
+

+ 1.00
(52ns)
+

+
+

+ 1.00
(52ns)
+

+
+
+

+ Geometric (quantile) +

+
+

+ 1.62
(42ns)
+

+
+

+ 1.00
(26ns)
+

+
+
+

+ Hypergeometric (CDF) +

+
+

+ 1.94
(11511ns)
+

+
+

+ 1.00
(5944ns)
+

+
+
+

+ Hypergeometric (PDF) +

+
+

+ 1.92
(11018ns)
+

+
+

+ 1.00
(5748ns)
+

+
+
+

+ Hypergeometric (quantile) +

+
+

+ 1.00
(70322ns)
+

+
+

+ 1.38
(96730ns)
+

+
+
+

+ InverseChiSquared (CDF) +

+
+

+ 1.53
(485ns)
+

+
+

+ 1.00
(317ns)
+

+
+
+

+ InverseChiSquared (PDF) +

+
+

+ 1.61
(268ns)
+

+
+

+ 1.00
(166ns)
+

+
+
+

+ InverseChiSquared (quantile) +

+
+

+ 1.35
(1235ns)
+

+
+

+ 1.00
(917ns)
+

+
+
+

+ InverseGamma (CDF) +

+
+

+ 1.43
(484ns)
+

+
+

+ 1.00
(339ns)
+

+
+
+

+ InverseGamma (PDF) +

+
+

+ 1.58
(334ns)
+

+
+

+ 1.00
(211ns)
+

+
+
+

+ InverseGamma (quantile) +

+
+

+ 1.41
(1487ns)
+

+
+

+ 1.00
(1055ns)
+

+
+
+

+ InverseGaussian (CDF) +

+
+

+ 1.00
(106ns)
+

+
+

+ 1.06
(112ns)
+

+
+
+

+ InverseGaussian (PDF) +

+
+

+ 1.03
(33ns)
+

+
+

+ 1.00
(32ns)
+

+
+
+

+ InverseGaussian (quantile) +

+
+

+ 1.00
(2170ns)
+

+
+

+ 1.01
(2189ns)
+

+
+
+

+ Laplace (CDF) +

+
+

+ 1.04
(56ns)
+

+
+

+ 1.00
(54ns)
+

+
+
+

+ Laplace (PDF) +

+
+

+ 1.02
(56ns)
+

+
+

+ 1.00
(55ns)
+

+
+
+

+ Laplace (quantile) +

+
+

+ 1.00
(40ns)
+

+
+

+ 1.07
(43ns)
+

+
+
+

+ LogNormal (CDF) +

+
+

+ 1.22
(121ns)
+

+
+

+ 1.00
(99ns)
+

+
+
+

+ LogNormal (PDF) +

+
+

+ 1.00
(93ns)
+

+
+

+ 1.01
(94ns)
+

+
+
+

+ LogNormal (quantile) +

+
+

+ 1.24
(135ns)
+

+
+

+ 1.00
(109ns)
+

+
+
+

+ Logistic (CDF) +

+
+

+ 1.00
(48ns)
+

+
+

+ 1.08
(52ns)
+

+
+
+

+ Logistic (PDF) +

+
+

+ 1.00
(53ns)
+

+
+

+ 1.00
(53ns)
+

+
+
+

+ Logistic (quantile) +

+
+

+ 1.00
(43ns)
+

+
+

+ 1.02
(44ns)
+

+
+
+

+ NegativeBinomial (CDF) +

+
+

+ 2.04
(1713ns)
+

+
+

+ 1.19
(1001ns)
+

+
+

+ 1.00
(840ns)
+

+
+

+ NegativeBinomial (PDF) +

+
+

+ 2.38
(437ns)
+

+
+

+ 1.00
(184ns)
+

+
+
+

+ NegativeBinomial (quantile) +

+
+

+ 1.71
(8682ns)
+

+
+

+ 1.00
(5084ns)
+

+
+

+ 3.36
(17091ns)
+

+
+

+ NonCentralBeta (CDF) +

+
+

+ 1.51
(2366ns)
+

+
+

+ 1.00
(1565ns)
+

+
+
+

+ NonCentralBeta (PDF) +

+
+

+ 1.55
(1774ns)
+

+
+

+ 1.00
(1142ns)
+

+
+
+

+ NonCentralBeta (quantile) +

+
+

+ 1.62
(50346ns)
+

+
+

+ 1.00
(31142ns)
+

+
+
+

+ NonCentralChiSquared (CDF) +

+
+

+ 9.45
(6813ns)
+

+
+

+ 6.21
(4481ns)
+

+
+

+ 1.00
(721ns)
+

+
+

+ NonCentralChiSquared (PDF) +

+
+

+ 1.44
(1043ns)
+

+
+

+ 1.00
(722ns)
+

+
+
+

+ NonCentralChiSquared (quantile) +

+
+

+ 3.26
(49579ns)
+

+
+

+ 1.74
(26501ns)
+

+
+

+ 1.00
(15221ns)
+

+
+

+ NonCentralF (CDF) +

+
+

+ 1.62
(2083ns)
+

+
+

+ 1.00
(1286ns)
+

+
+

+ 1.23
(1581ns)
+

+
+

+ NonCentralF (PDF) +

+
+

+ 1.64
(1689ns)
+

+
+

+ 1.00
(1031ns)
+

+
+
+

+ NonCentralF (quantile) +

+
+

+ 1.78
(33446ns)
+

+
+

+ 1.00
(18763ns)
+

+
+

+ 1.00
(18799ns)
+

+
+

+ NonCentralT (CDF) +

+
+

+ 2.36
(8822ns)
+

+
+

+ 1.51
(5639ns)
+

+
+

+ 1.00
(3743ns)
+

+
+

+ NonCentralT (PDF) +

+
+

+ 1.53
(6702ns)
+

+
+

+ 1.00
(4382ns)
+

+
+
+

+ NonCentralT (quantile) +

+
+

+ 1.71
(91176ns)
+

+
+

+ 1.00
(53475ns)
+

+
+

+ 1.05
(56248ns)
+

+
+

+ Normal (CDF) +

+
+

+ 1.52
(76ns)
+

+
+

+ 1.00
(50ns)
+

+
+

+ 4.62
(231ns)
+

+
+

+ Normal (PDF) +

+
+

+ 1.04
(57ns)
+

+
+

+ 1.00
(55ns)
+

+
+
+

+ Normal (quantile) +

+
+

+ 1.78
(89ns)
+

+
+

+ 1.00
(50ns)
+

+
+

+ 12.96
(648ns)
+

+
+

+ Pareto (CDF) +

+
+

+ 1.00
(59ns)
+

+
+

+ 1.02
(60ns)
+

+
+
+

+ Pareto (PDF) +

+
+

+ 1.00
(88ns)
+

+
+

+ 1.00
(88ns)
+

+
+
+

+ Pareto (quantile) +

+
+

+ 1.04
(78ns)
+

+
+

+ 1.00
(75ns)
+

+
+
+

+ Poisson (CDF) +

+
+

+ 1.64
(247ns)
+

+
+

+ 1.00
(151ns)
+

+
+

+ 1.66
(251ns)
+

+
+

+ Poisson (PDF) +

+
+

+ 1.62
(170ns)
+

+
+

+ 1.00
(105ns)
+

+
+
+

+ Poisson (quantile) +

+
+

+ 1.67
(1094ns)
+

+
+

+ 1.00
(655ns)
+

+
+

+ 4.63
(3032ns)
+

+
+

+ Rayleigh (CDF) +

+
+

+ 1.22
(44ns)
+

+
+

+ 1.00
(36ns)
+

+
+
+

+ Rayleigh (PDF) +

+
+

+ 1.03
(62ns)
+

+
+

+ 1.00
(60ns)
+

+
+
+

+ Rayleigh (quantile) +

+
+

+ 1.66
(48ns)
+

+
+

+ 1.00
(29ns)
+

+
+
+

+ SkewNormal (CDF) +

+
+

+ 1.06
(438ns)
+

+
+

+ 1.00
(414ns)
+

+
+
+

+ SkewNormal (PDF) +

+
+

+ 1.22
(123ns)
+

+
+

+ 1.00
(101ns)
+

+
+
+

+ SkewNormal (quantile) +

+
+

+ 1.10
(3849ns)
+

+
+

+ 1.00
(3502ns)
+

+
+
+

+ StudentsT (CDF) +

+
+

+ 1.88
(877ns)
+

+
+

+ 1.00
(466ns)
+

+
+

+ 1.16
(541ns)
+

+
+

+ StudentsT (PDF) +

+
+

+ 2.13
(387ns)
+

+
+

+ 1.00
(182ns)
+

+
+
+

+ StudentsT (quantile) +

+
+

+ 1.69
(1549ns)
+

+
+

+ 1.00
(915ns)
+

+
+

+ 4.26
(3894ns)
+

+
+

+ Weibull (CDF) +

+
+

+ 1.16
(92ns)
+

+
+

+ 1.00
(79ns)
+

+
+
+

+ Weibull (PDF) +

+
+

+ 1.01
(146ns)
+

+
+

+ 1.00
(144ns)
+

+
+
+

+ Weibull (quantile) +

+
+

+ 1.14
(128ns)
+

+
+

+ 1.00
(112ns)
+

+
+
+
+
+
+
+ +
+

Table 9. Distribution performance comparison with GNU C++ version 5.3.0 on linux

+
++++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ Function +

+
+

+ boost 1.61 +

+
+

+ Boost
promote_double<false> +

+
+

+ GSL +

+
+

+ Rmath 3.0.2 +

+
+

+ DCDFLIB +

+
+

+ ArcSine (CDF) +

+
+

+ 1.00
(33ns)
+

+
+

+ 1.03
(34ns)
+

+
+ + +
+

+ ArcSine (PDF) +

+
+

+ 1.00
(9ns)
+

+
+

+ 1.00
(9ns)
+

+
+ + +
+

+ ArcSine (quantile) +

+
+

+ 1.00
(21ns)
+

+
+

+ 1.05
(22ns)
+

+
+ + +
+

+ Beta (CDF) +

+
+

+ 2.40
(452ns)
+

+
+

+ 1.00
(188ns)
+

+
+

+ 2.66
(500ns)
+

+
+

+ 1.64
(308ns)
+

+
+

+ 2.39
(449ns)
+

+
+

+ Beta (PDF) +

+
+

+ 2.52
(355ns)
+

+
+

+ 1.00
(141ns)
+

+
+

+ - +

+
+

+ 1.71
(241ns)
+

+
+
+

+ Beta (quantile) +

+
+

+ 2.40
(2863ns)
+

+
+

+ 1.00
(1192ns)
+

+
+

+ 13.48
(16063ns)
+

+
+

+ 15.15
(18064ns)
+

+
+

+ 7.43
(8852ns)
+

+
+

+ Binomial (CDF) +

+
+

+ 1.72
(1133ns)
+

+
+

+ 1.00
(657ns)
+

+
+

+ 1.40
(920ns)
+

+
+

+ 1.17
(768ns)
+

+
+

+ 1.23
(807ns)
+

+
+

+ Binomial (PDF) +

+
+

+ 2.25
(376ns)
+

+
+

+ 1.00
(167ns)
+

+
+

+ - +

+
+

+ 1.07
(179ns)
+

+
+
+

+ Binomial (quantile) +

+
+

+ 2.47
(5047ns)
+

+
+

+ 1.48
(3017ns)
+

+
+

+ - +

+
+

+ 1.00
(2040ns)
+

+
+

+ 6.21
(12659ns)
+

+
+

+ Cauchy (CDF) +

+
+

+ 1.38
(29ns)
+

+
+

+ 1.33
(28ns)
+

+
+

+ 1.00
(21ns)
+

+
+

+ 1.81
(38ns)
+

+
+
+

+ Cauchy (PDF) +

+
+

+ 1.12
(9ns)
+

+
+

+ 1.00
(8ns)
+

+
+

+ - +

+
+

+ 1.50
(12ns)
+

+
+
+

+ Cauchy (quantile) +

+
+

+ 1.00
(43ns)
+

+
+

+ 1.00
(43ns)
+

+
+

+ 59.65
(2565ns)
+

+
+

+ 59.21
(2546ns)
+

+
+
+

+ ChiSquared (CDF) +

+
+

+ 2.28
(545ns)
+

+
+

+ 1.06
(253ns)
+

+
+

+ 16.73
(3999ns)
+

+
+

+ 1.23
(293ns)
+

+
+

+ 1.00
(239ns)
+

+
+

+ ChiSquared (PDF) +

+
+

+ 3.20
(362ns)
+

+
+

+ 1.24
(140ns)
+

+
+

+ - +

+
+

+ 1.00
(113ns)
+

+
+
+

+ ChiSquared (quantile) +

+
+

+ 1.94
(1416ns)
+

+
+

+ 1.00
(729ns)
+

+
+

+ 51.52
(37557ns)
+

+
+

+ 2.26
(1644ns)
+

+
+

+ 7.71
(5623ns)
+

+
+

+ Exponential (CDF) +

+
+

+ 1.05
(20ns)
+

+
+

+ 1.00
(19ns)
+

+
+

+ 1.21
(23ns)
+

+
+

+ 1.53
(29ns)
+

+
+
+

+ Exponential (PDF) +

+
+

+ 1.00
(26ns)
+

+
+

+ 1.00
(26ns)
+

+
+

+ - +

+
+

+ 1.27
(33ns)
+

+
+
+

+ Exponential (quantile) +

+
+

+ 1.56
(25ns)
+

+
+

+ 1.44
(23ns)
+

+
+

+ 1.00
(16ns)
+

+
+

+ 1.44
(23ns)
+

+
+
+

+ ExtremeValue (CDF) +

+
+

+ 1.00
(48ns)
+

+
+

+ 1.00
(48ns)
+

+
+ + +
+

+ ExtremeValue (PDF) +

+
+

+ 1.01
(68ns)
+

+
+

+ 1.00
(67ns)
+

+
+ + +
+

+ ExtremeValue (quantile) +

+
+

+ 1.05
(68ns)
+

+
+

+ 1.00
(65ns)
+

+
+ + +
+

+ F (CDF) +

+
+

+ 1.77
(1028ns)
+

+
+

+ 1.00
(580ns)
+

+
+

+ 1.59
(921ns)
+

+
+

+ 1.13
(653ns)
+

+
+

+ 1.10
(637ns)
+

+
+

+ F (PDF) +

+
+

+ 2.39
(409ns)
+

+
+

+ 1.00
(171ns)
+

+
+

+ - +

+
+

+ 1.12
(192ns)
+

+
+
+

+ F (quantile) +

+
+

+ 1.86
(2899ns)
+

+
+

+ 1.00
(1556ns)
+

+
+

+ 9.67
(15050ns)
+

+
+

+ 1.98
(3083ns)
+

+
+

+ 5.85
(9110ns)
+

+
+

+ Gamma (CDF) +

+
+

+ 2.48
(619ns)
+

+
+

+ 1.01
(253ns)
+

+
+

+ 6.12
(1529ns)
+

+
+

+ 1.40
(349ns)
+

+
+

+ 1.00
(250ns)
+

+
+

+ Gamma (PDF) +

+
+

+ 2.91
(480ns)
+

+
+

+ 1.02
(169ns)
+

+
+

+ - +

+
+

+ 1.00
(165ns)
+

+
+
+

+ Gamma (quantile) +

+
+

+ 2.29
(1971ns)
+

+
+

+ 1.00
(860ns)
+

+
+

+ 13.93
(11979ns)
+

+
+

+ 2.13
(1829ns)
+

+
+

+ 1.03
(886ns)
+

+
+

+ Geometric (CDF) +

+
+

+ 1.00
(26ns)
+

+
+

+ 1.08
(28ns)
+

+
+

+ 1.00
(26ns)
+

+
+

+ 2.08
(54ns)
+

+
+
+

+ Geometric (PDF) +

+
+

+ 1.00
(33ns)
+

+
+

+ 1.06
(35ns)
+

+
+

+ - +

+
+

+ 7.15
(236ns)
+

+
+
+

+ Geometric (quantile) +

+
+

+ 1.00
(22ns)
+

+
+

+ 1.00
(22ns)
+

+
+

+ - +

+
+

+ 2.18
(48ns)
+

+
+
+

+ Hypergeometric (CDF) +

+
+

+ 12.07
(11779ns)
+

+
+

+ 6.58
(6423ns)
+

+
+

+ 1.61
(1568ns)
+

+
+

+ 1.00
(976ns)
+

+
+
+

+ Hypergeometric (PDF) +

+
+

+ 25.41
(11384ns)
+

+
+

+ 13.51
(6054ns)
+

+
+

+ - +

+
+

+ 1.00
(448ns)
+

+
+
+

+ Hypergeometric (quantile) +

+
+

+ 1.00
(57820ns)
+

+
+

+ 1.54
(89233ns)
+

+
+

+ - +

+
+

+ 1.60
(92679ns)
+

+
+
+

+ InverseChiSquared (CDF) +

+
+

+ 2.23
(546ns)
+

+
+

+ 1.00
(245ns)
+

+
+ + +
+

+ InverseChiSquared (PDF) +

+
+

+ 2.28
(342ns)
+

+
+

+ 1.00
(150ns)
+

+
+ + +
+

+ InverseChiSquared (quantile) +

+
+

+ 1.86
(1378ns)
+

+
+

+ 1.00
(740ns)
+

+
+ + +
+

+ InverseGamma (CDF) +

+
+

+ 2.50
(610ns)
+

+
+

+ 1.00
(244ns)
+

+
+ + +
+

+ InverseGamma (PDF) +

+
+

+ 2.76
(477ns)
+

+
+

+ 1.00
(173ns)
+

+
+ + +
+

+ InverseGamma (quantile) +

+
+

+ 2.23
(1870ns)
+

+
+

+ 1.00
(838ns)
+

+
+ + +
+

+ InverseGaussian (CDF) +

+
+

+ 1.00
(108ns)
+

+
+

+ 1.00
(108ns)
+

+
+ + +
+

+ InverseGaussian (PDF) +

+
+

+ 1.00
(19ns)
+

+
+

+ 1.00
(19ns)
+

+
+ + +
+

+ InverseGaussian (quantile) +

+
+

+ 1.01
(2105ns)
+

+
+

+ 1.00
(2074ns)
+

+
+ + +
+

+ Laplace (CDF) +

+
+

+ 1.35
(27ns)
+

+
+

+ 1.35
(27ns)
+

+
+

+ 1.00
(20ns)
+

+
+ +
+

+ Laplace (PDF) +

+
+

+ 1.00
(28ns)
+

+
+

+ 1.00
(28ns)
+

+
+ + +
+

+ Laplace (quantile) +

+
+

+ 1.14
(32ns)
+

+
+

+ 1.18
(33ns)
+

+
+

+ 1.00
(28ns)
+

+
+ +
+

+ LogNormal (CDF) +

+
+

+ 1.67
(115ns)
+

+
+

+ 1.00
(69ns)
+

+
+

+ 1.13
(78ns)
+

+
+

+ 1.46
(101ns)
+

+
+
+

+ LogNormal (PDF) +

+
+

+ 1.00
(66ns)
+

+
+

+ 1.02
(67ns)
+

+
+

+ - +

+
+

+ 1.08
(71ns)
+

+
+
+

+ LogNormal (quantile) +

+
+

+ 1.45
(103ns)
+

+
+

+ 1.32
(94ns)
+

+
+

+ 1.00
(71ns)
+

+
+

+ 1.32
(94ns)
+

+
+
+

+ Logistic (CDF) +

+
+

+ 1.00
(28ns)
+

+
+

+ 1.04
(29ns)
+

+
+

+ 1.04
(29ns)
+

+
+

+ 1.25
(35ns)
+

+
+
+

+ Logistic (PDF) +

+
+

+ 1.00
(31ns)
+

+
+

+ 1.03
(32ns)
+

+
+

+ - +

+
+

+ 1.03
(32ns)
+

+
+
+

+ Logistic (quantile) +

+
+

+ 1.09
(36ns)
+

+
+

+ 1.12
(37ns)
+

+
+

+ 1.00
(33ns)
+

+
+

+ 1.27
(42ns)
+

+
+
+

+ NegativeBinomial (CDF) +

+
+

+ 2.08
(1733ns)
+

+
+

+ 1.23
(1028ns)
+

+
+

+ 1.58
(1317ns)
+

+
+

+ 1.10
(916ns)
+

+
+

+ 1.00
(833ns)
+

+
+

+ NegativeBinomial (PDF) +

+
+

+ 2.19
(384ns)
+

+
+

+ 1.00
(175ns)
+

+
+

+ - +

+
+

+ 1.12
(196ns)
+

+
+
+

+ NegativeBinomial (quantile) +

+
+

+ 1.74
(9167ns)
+

+
+

+ 1.00
(5278ns)
+

+
+

+ - +

+
+

+ 3.35
(17681ns)
+

+
+

+ 3.01
(15887ns)
+

+
+

+ NonCentralBeta (CDF) +

+
+

+ 2.25
(2715ns)
+

+
+

+ 1.18
(1421ns)
+

+
+

+ - +

+
+

+ 1.00
(1205ns)
+

+
+
+

+ NonCentralBeta (PDF) +

+
+

+ 2.13
(2036ns)
+

+
+

+ 1.23
(1179ns)
+

+
+

+ - +

+
+

+ 1.00
(956ns)
+

+
+
+

+ NonCentralBeta (quantile) +

+
+

+ 2.15
(63495ns)
+

+
+

+ 1.00
(29566ns)
+

+
+

+ - +

+
+

+ 2.89
(85371ns)
+

+
+
+

+ NonCentralChiSquared (CDF) +

+
+

+ 10.17
(7258ns)
+

+
+

+ 6.32
(4515ns)
+

+
+

+ - +

+
+

+ 15.17
(10828ns)
+

+
+

+ 1.00
(714ns)
+

+
+

+ NonCentralChiSquared (PDF) +

+
+

+ 2.81
(1275ns)
+

+
+

+ 1.55
(705ns)
+

+
+

+ - +

+
+

+ 1.00
(454ns)
+

+
+
+

+ NonCentralChiSquared (quantile) +

+
+

+ 3.29
(51391ns)
+

+
+

+ 1.72
(26920ns)
+

+
+

+ - +

+
+

+ 34.31
(536514ns)
+

+
+

+ 1.00
(15636ns)
+

+
+

+ NonCentralF (CDF) +

+
+

+ 1.96
(2583ns)
+

+
+

+ 1.04
(1364ns)
+

+
+

+ - +

+
+

+ 1.00
(1316ns)
+

+
+

+ 1.15
(1512ns)
+

+
+

+ NonCentralF (PDF) +

+
+

+ 2.39
(2102ns)
+

+
+

+ 1.25
(1099ns)
+

+
+

+ - +

+
+

+ 1.00
(878ns)
+

+
+
+

+ NonCentralF (quantile) +

+
+

+ 2.30
(39838ns)
+

+
+

+ 1.15
(19939ns)
+

+
+

+ - +

+
+

+ 4.06
(70302ns)
+

+
+

+ 1.00
(17331ns)
+

+
+

+ NonCentralT (CDF) +

+
+

+ 5.04
(9817ns)
+

+
+

+ 3.10
(6036ns)
+

+
+

+ - +

+
+

+ 1.00
(1949ns)
+

+
+

+ 1.84
(3591ns)
+

+
+

+ NonCentralT (PDF) +

+
+

+ 1.82
(7422ns)
+

+
+

+ 1.19
(4838ns)
+

+
+

+ - +

+
+

+ 1.00
(4078ns)
+

+
+
+

+ NonCentralT (quantile) +

+
+

+ 1.88
(100206ns)
+

+
+

+ 1.12
(59572ns)
+

+
+

+ - +

+
+

+ 1.70
(90848ns)
+

+
+

+ 1.00
(53399ns)
+

+
+

+ Normal (CDF) +

+
+

+ 2.55
(79ns)
+

+
+

+ 1.13
(35ns)
+

+
+

+ 1.00
(31ns)
+

+
+

+ 2.06
(64ns)
+

+
+

+ 6.61
(205ns)
+

+
+

+ Normal (PDF) +

+
+

+ 1.03
(33ns)
+

+
+

+ 1.00
(32ns)
+

+
+

+ - +

+
+

+ 1.25
(40ns)
+

+
+
+

+ Normal (quantile) +

+
+

+ 2.03
(67ns)
+

+
+

+ 1.58
(52ns)
+

+
+

+ 1.00
(33ns)
+

+
+

+ 1.36
(45ns)
+

+
+

+ 17.58
(580ns)
+

+
+

+ Pareto (CDF) +

+
+

+ 1.00
(52ns)
+

+
+

+ 1.02
(53ns)
+

+
+

+ 1.21
(63ns)
+

+
+ +
+

+ Pareto (PDF) +

+
+

+ 1.01
(91ns)
+

+
+

+ 1.00
(90ns)
+

+
+ + +
+

+ Pareto (quantile) +

+
+

+ 1.04
(55ns)
+

+
+

+ 1.25
(66ns)
+

+
+

+ 1.00
(53ns)
+

+
+ +
+

+ Poisson (CDF) +

+
+

+ 2.01
(251ns)
+

+
+

+ 1.00
(125ns)
+

+
+

+ 5.84
(730ns)
+

+
+

+ 2.22
(278ns)
+

+
+

+ 1.68
(210ns)
+

+
+

+ Poisson (PDF) +

+
+

+ 2.09
(196ns)
+

+
+

+ 1.00
(94ns)
+

+
+

+ - +

+
+

+ 1.01
(95ns)
+

+
+
+

+ Poisson (quantile) +

+
+

+ 1.99
(1120ns)
+

+
+

+ 1.00
(562ns)
+

+
+

+ - +

+
+

+ 1.21
(682ns)
+

+
+

+ 5.51
(3097ns)
+

+
+

+ Rayleigh (CDF) +

+
+

+ 1.10
(23ns)
+

+
+

+ 1.05
(22ns)
+

+
+

+ 1.00
(21ns)
+

+
+ +
+

+ Rayleigh (PDF) +

+
+

+ 1.15
(31ns)
+

+
+

+ 1.00
(27ns)
+

+
+ + +
+

+ Rayleigh (quantile) +

+
+

+ 1.25
(25ns)
+

+
+

+ 1.20
(24ns)
+

+
+

+ 1.00
(20ns)
+

+
+ +
+

+ SkewNormal (CDF) +

+
+

+ 1.09
(471ns)
+

+
+

+ 1.00
(433ns)
+

+
+ + +
+

+ SkewNormal (PDF) +

+
+

+ 1.53
(90ns)
+

+
+

+ 1.00
(59ns)
+

+
+ + +
+

+ SkewNormal (quantile) +

+
+

+ 1.07
(3697ns)
+

+
+

+ 1.00
(3440ns)
+

+
+ + +
+

+ StudentsT (CDF) +

+
+

+ 5.72
(1517ns)
+

+
+

+ 1.82
(481ns)
+

+
+

+ 1.00
(265ns)
+

+
+

+ 1.42
(375ns)
+

+
+

+ 1.68
(446ns)
+

+
+

+ StudentsT (PDF) +

+
+

+ 5.23
(716ns)
+

+
+

+ 1.45
(198ns)
+

+
+

+ - +

+
+

+ 1.00
(137ns)
+

+
+
+

+ StudentsT (quantile) +

+
+

+ 3.04
(2557ns)
+

+
+

+ 1.00
(841ns)
+

+
+

+ 1.37
(1148ns)
+

+
+

+ 1.16
(977ns)
+

+
+

+ 4.48
(3770ns)
+

+
+

+ Weibull (CDF) +

+
+

+ 1.07
(91ns)
+

+
+

+ 1.00
(85ns)
+

+
+

+ 1.00
(85ns)
+

+
+

+ 1.19
(101ns)
+

+
+
+

+ Weibull (PDF) +

+
+

+ 1.48
(155ns)
+

+
+

+ 1.47
(154ns)
+

+
+

+ - +

+
+

+ 1.00
(105ns)
+

+
+
+

+ Weibull (quantile) +

+
+

+ 1.00
(89ns)
+

+
+

+ 1.00
(89ns)
+

+
+

+ 1.16
(103ns)
+

+
+

+ 1.08
(96ns)
+

+
+
+
+
+
+
+ +
+

Table 10. Distribution performance comparison with Intel C++ C++0x mode version + 1600 on Windows x64

+
+++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ Function +

+
+

+ boost 1.61 +

+
+

+ DCDFLIB +

+
+

+ ArcSine (CDF) +

+
+

+ 1.00
(36ns)
+

+
+
+

+ ArcSine (PDF) +

+
+

+ 1.00
(19ns)
+

+
+
+

+ ArcSine (quantile) +

+
+

+ 1.00
(24ns)
+

+
+
+

+ Beta (CDF) +

+
+

+ 1.00
(170ns)
+

+
+

+ 1.61
(273ns)
+

+
+

+ Beta (PDF) +

+
+

+ 1.00
(152ns)
+

+
+
+

+ Beta (quantile) +

+
+

+ 1.00
(871ns)
+

+
+

+ 6.36
(5536ns)
+

+
+

+ Binomial (CDF) +

+
+

+ 1.05
(644ns)
+

+
+

+ 1.00
(613ns)
+

+
+

+ Binomial (PDF) +

+
+

+ 1.00
(187ns)
+

+
+
+

+ Binomial (quantile) +

+
+

+ 1.00
(3067ns)
+

+
+

+ 3.10
(9515ns)
+

+
+

+ Cauchy (CDF) +

+
+

+ 1.00
(23ns)
+

+
+
+

+ Cauchy (PDF) +

+
+

+ 1.00
(9ns)
+

+
+
+

+ Cauchy (quantile) +

+
+

+ 1.00
(27ns)
+

+
+
+

+ ChiSquared (CDF) +

+
+

+ 1.57
(226ns)
+

+
+

+ 1.00
(144ns)
+

+
+

+ ChiSquared (PDF) +

+
+

+ 1.00
(103ns)
+

+
+
+

+ ChiSquared (quantile) +

+
+

+ 1.00
(610ns)
+

+
+

+ 5.60
(3416ns)
+

+
+

+ Exponential (CDF) +

+
+

+ 1.00
(19ns)
+

+
+
+

+ Exponential (PDF) +

+
+

+ 1.00
(17ns)
+

+
+
+

+ Exponential (quantile) +

+
+

+ 1.00
(21ns)
+

+
+
+

+ ExtremeValue (CDF) +

+
+

+ 1.00
(24ns)
+

+
+
+

+ ExtremeValue (PDF) +

+
+

+ 1.00
(27ns)
+

+
+
+

+ ExtremeValue (quantile) +

+
+

+ 1.00
(29ns)
+

+
+
+

+ F (CDF) +

+
+

+ 1.03
(566ns)
+

+
+

+ 1.00
(547ns)
+

+
+

+ F (PDF) +

+
+

+ 1.00
(214ns)
+

+
+
+

+ F (quantile) +

+
+

+ 1.00
(1265ns)
+

+
+

+ 6.54
(8271ns)
+

+
+

+ Gamma (CDF) +

+
+

+ 1.14
(190ns)
+

+
+

+ 1.00
(166ns)
+

+
+

+ Gamma (PDF) +

+
+

+ 1.00
(112ns)
+

+
+
+

+ Gamma (quantile) +

+
+

+ 1.16
(625ns)
+

+
+

+ 1.00
(541ns)
+

+
+

+ Geometric (CDF) +

+
+

+ 1.00
(24ns)
+

+
+
+

+ Geometric (PDF) +

+
+

+ 1.00
(15ns)
+

+
+
+

+ Geometric (quantile) +

+
+

+ 1.00
(22ns)
+

+
+
+

+ Hypergeometric (CDF) +

+
+

+ 1.00
(5958ns)
+

+
+
+

+ Hypergeometric (PDF) +

+
+

+ 1.00
(5681ns)
+

+
+
+

+ Hypergeometric (quantile) +

+
+

+ 1.00
(35994ns)
+

+
+
+

+ InverseChiSquared (CDF) +

+
+

+ 1.00
(214ns)
+

+
+
+

+ InverseChiSquared (PDF) +

+
+

+ 1.00
(118ns)
+

+
+
+

+ InverseChiSquared (quantile) +

+
+

+ 1.00
(647ns)
+

+
+
+

+ InverseGamma (CDF) +

+
+

+ 1.00
(187ns)
+

+
+
+

+ InverseGamma (PDF) +

+
+

+ 1.00
(116ns)
+

+
+
+

+ InverseGamma (quantile) +

+
+

+ 1.00
(620ns)
+

+
+
+

+ InverseGaussian (CDF) +

+
+

+ 1.00
(53ns)
+

+
+
+

+ InverseGaussian (PDF) +

+
+

+ 1.00
(13ns)
+

+
+
+

+ InverseGaussian (quantile) +

+
+

+ 1.00
(902ns)
+

+
+
+

+ Laplace (CDF) +

+
+

+ 1.00
(15ns)
+

+
+
+

+ Laplace (PDF) +

+
+

+ 1.00
(16ns)
+

+
+
+

+ Laplace (quantile) +

+
+

+ 1.00
(17ns)
+

+
+
+

+ LogNormal (CDF) +

+
+

+ 1.00
(42ns)
+

+
+
+

+ LogNormal (PDF) +

+
+

+ 1.00
(32ns)
+

+
+
+

+ LogNormal (quantile) +

+
+

+ 1.00
(61ns)
+

+
+
+

+ Logistic (CDF) +

+
+

+ 1.00
(17ns)
+

+
+
+

+ Logistic (PDF) +

+
+

+ 1.00
(20ns)
+

+
+
+

+ Logistic (quantile) +

+
+

+ 1.00
(20ns)
+

+
+
+

+ NegativeBinomial (CDF) +

+
+

+ 1.19
(964ns)
+

+
+

+ 1.00
(807ns)
+

+
+

+ NegativeBinomial (PDF) +

+
+

+ 1.00
(187ns)
+

+
+
+

+ NegativeBinomial (quantile) +

+
+

+ 1.00
(4806ns)
+

+
+

+ 2.74
(13152ns)
+

+
+

+ NonCentralBeta (CDF) +

+
+

+ 1.00
(1240ns)
+

+
+
+

+ NonCentralBeta (PDF) +

+
+

+ 1.00
(1053ns)
+

+
+
+

+ NonCentralBeta (quantile) +

+
+

+ 1.00
(24612ns)
+

+
+
+

+ NonCentralChiSquared (CDF) +

+
+

+ 9.46
(3877ns)
+

+
+

+ 1.00
(410ns)
+

+
+

+ NonCentralChiSquared (PDF) +

+
+

+ 1.00
(555ns)
+

+
+
+

+ NonCentralChiSquared (quantile) +

+
+

+ 2.41
(22440ns)
+

+
+

+ 1.00
(9321ns)
+

+
+

+ NonCentralF (CDF) +

+
+

+ 1.17
(1278ns)
+

+
+

+ 1.00
(1093ns)
+

+
+

+ NonCentralF (PDF) +

+
+

+ 1.00
(1035ns)
+

+
+
+

+ NonCentralF (quantile) +

+
+

+ 1.53
(18251ns)
+

+
+

+ 1.00
(11948ns)
+

+
+

+ NonCentralT (CDF) +

+
+

+ 1.83
(5298ns)
+

+
+

+ 1.00
(2899ns)
+

+
+

+ NonCentralT (PDF) +

+
+

+ 1.00
(4062ns)
+

+
+
+

+ NonCentralT (quantile) +

+
+

+ 1.17
(48842ns)
+

+
+

+ 1.00
(41636ns)
+

+
+

+ Normal (CDF) +

+
+

+ 1.00
(31ns)
+

+
+

+ 3.55
(110ns)
+

+
+

+ Normal (PDF) +

+
+

+ 1.00
(19ns)
+

+
+
+

+ Normal (quantile) +

+
+

+ 1.00
(42ns)
+

+
+

+ 7.36
(309ns)
+

+
+

+ Pareto (CDF) +

+
+

+ 1.00
(33ns)
+

+
+
+

+ Pareto (PDF) +

+
+

+ 1.00
(62ns)
+

+
+
+

+ Pareto (quantile) +

+
+

+ 1.00
(29ns)
+

+
+
+

+ Poisson (CDF) +

+
+

+ 1.00
(96ns)
+

+
+

+ 1.41
(135ns)
+

+
+

+ Poisson (PDF) +

+
+

+ 1.00
(61ns)
+

+
+
+

+ Poisson (quantile) +

+
+

+ 1.00
(446ns)
+

+
+

+ 4.68
(2087ns)
+

+
+

+ Rayleigh (CDF) +

+
+

+ 1.00
(24ns)
+

+
+
+

+ Rayleigh (PDF) +

+
+

+ 1.00
(21ns)
+

+
+
+

+ Rayleigh (quantile) +

+
+

+ 1.00
(22ns)
+

+
+
+

+ SkewNormal (CDF) +

+
+

+ 1.00
(187ns)
+

+
+
+

+ SkewNormal (PDF) +

+
+

+ 1.00
(49ns)
+

+
+
+

+ SkewNormal (quantile) +

+
+

+ 1.00
(1409ns)
+

+
+
+

+ StudentsT (CDF) +

+
+

+ 1.22
(331ns)
+

+
+

+ 1.00
(272ns)
+

+
+

+ StudentsT (PDF) +

+
+

+ 1.00
(132ns)
+

+
+
+

+ StudentsT (quantile) +

+
+

+ 1.00
(623ns)
+

+
+

+ 3.66
(2280ns)
+

+
+

+ Weibull (CDF) +

+
+

+ 1.00
(46ns)
+

+
+
+

+ Weibull (PDF) +

+
+

+ 1.00
(63ns)
+

+
+
+

+ Weibull (quantile) +

+
+

+ 1.00
(44ns)
+

+
+
+
+
+
+
+ +
+

Table 11. Distribution performance comparison with Microsoft Visual C++ version + 14.0 on Windows x64

+
+++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ Function +

+
+

+ boost 1.61 +

+
+

+ DCDFLIB +

+
+

+ ArcSine (CDF) +

+
+

+ 1.00
(45ns)
+

+
+

+ - +

+
+

+ ArcSine (PDF) +

+
+

+ 1.00
(16ns)
+

+
+

+ - +

+
+

+ ArcSine (quantile) +

+
+

+ 1.00
(21ns)
+

+
+

+ - +

+
+

+ Beta (CDF) +

+
+

+ 1.00
(196ns)
+

+
+

+ 1.90
(372ns)
+

+
+

+ Beta (PDF) +

+
+

+ 1.00
(143ns)
+

+
+

+ - +

+
+

+ Beta (quantile) +

+
+

+ 1.00
(1127ns)
+

+
+

+ 6.95
(7832ns)
+

+
+

+ Binomial (CDF) +

+
+

+ 1.00
(682ns)
+

+
+

+ 1.11
(756ns)
+

+
+

+ Binomial (PDF) +

+
+

+ 1.00
(184ns)
+

+
+

+ - +

+
+

+ Binomial (quantile) +

+
+

+ 1.00
(3249ns)
+

+
+

+ 3.63
(11787ns)
+

+
+

+ Cauchy (CDF) +

+
+

+ 1.00
(32ns)
+

+
+

+ - +

+
+

+ Cauchy (PDF) +

+
+

+ 1.00
(11ns)
+

+
+

+ - +

+
+

+ Cauchy (quantile) +

+
+

+ 1.00
(23ns)
+

+
+

+ - +

+
+

+ ChiSquared (CDF) +

+
+

+ 1.35
(268ns)
+

+
+

+ 1.00
(198ns)
+

+
+

+ ChiSquared (PDF) +

+
+

+ 1.00
(129ns)
+

+
+

+ - +

+
+

+ ChiSquared (quantile) +

+
+

+ 1.00
(741ns)
+

+
+

+ 6.19
(4587ns)
+

+
+

+ Exponential (CDF) +

+
+

+ 1.00
(20ns)
+

+
+

+ - +

+
+

+ Exponential (PDF) +

+
+

+ 1.00
(16ns)
+

+
+

+ - +

+
+

+ Exponential (quantile) +

+
+

+ 1.00
(29ns)
+

+
+

+ - +

+
+

+ ExtremeValue (CDF) +

+
+

+ 1.00
(45ns)
+

+
+

+ - +

+
+

+ ExtremeValue (PDF) +

+
+

+ 1.00
(44ns)
+

+
+

+ - +

+
+

+ ExtremeValue (quantile) +

+
+

+ 1.00
(36ns)
+

+
+

+ - +

+
+

+ F (CDF) +

+
+

+ 1.08
(643ns)
+

+
+

+ 1.00
(596ns)
+

+
+

+ F (PDF) +

+
+

+ 1.00
(202ns)
+

+
+

+ - +

+
+

+ F (quantile) +

+
+

+ 1.00
(1464ns)
+

+
+

+ 5.89
(8630ns)
+

+
+

+ Gamma (CDF) +

+
+

+ 1.40
(294ns)
+

+
+

+ 1.00
(210ns)
+

+
+

+ Gamma (PDF) +

+
+

+ 1.00
(159ns)
+

+
+

+ - +

+
+

+ Gamma (quantile) +

+
+

+ 1.18
(841ns)
+

+
+

+ 1.00
(714ns)
+

+
+

+ Geometric (CDF) +

+
+

+ 1.00
(26ns)
+

+
+

+ - +

+
+

+ Geometric (PDF) +

+
+

+ 1.00
(29ns)
+

+
+

+ - +

+
+

+ Geometric (quantile) +

+
+

+ 1.00
(25ns)
+

+
+

+ - +

+
+

+ Hypergeometric (CDF) +

+
+

+ 1.00
(6896ns)
+

+
+

+ - +

+
+

+ Hypergeometric (PDF) +

+
+

+ 1.00
(6565ns)
+

+
+

+ - +

+
+

+ Hypergeometric (quantile) +

+
+

+ 1.00
(34866ns)
+

+
+

+ - +

+
+

+ InverseChiSquared (CDF) +

+
+

+ 1.00
(269ns)
+

+
+

+ - +

+
+

+ InverseChiSquared (PDF) +

+
+

+ 1.00
(156ns)
+

+
+

+ - +

+
+

+ InverseChiSquared (quantile) +

+
+

+ 1.00
(778ns)
+

+
+

+ - +

+
+

+ InverseGamma (CDF) +

+
+

+ 1.00
(279ns)
+

+
+

+ - +

+
+

+ InverseGamma (PDF) +

+
+

+ 1.00
(217ns)
+

+
+

+ - +

+
+

+ InverseGamma (quantile) +

+
+

+ 1.00
(946ns)
+

+
+

+ - +

+
+

+ InverseGaussian (CDF) +

+
+

+ 1.00
(63ns)
+

+
+

+ - +

+
+

+ InverseGaussian (PDF) +

+
+

+ 1.00
(16ns)
+

+
+

+ - +

+
+

+ InverseGaussian (quantile) +

+
+

+ 1.00
(1138ns)
+

+
+

+ - +

+
+

+ Laplace (CDF) +

+
+

+ 1.00
(22ns)
+

+
+

+ - +

+
+

+ Laplace (PDF) +

+
+

+ 1.00
(23ns)
+

+
+

+ - +

+
+

+ Laplace (quantile) +

+
+

+ 1.00
(22ns)
+

+
+

+ - +

+
+

+ LogNormal (CDF) +

+
+

+ 1.00
(49ns)
+

+
+

+ - +

+
+

+ LogNormal (PDF) +

+
+

+ 1.00
(43ns)
+

+
+

+ - +

+
+

+ LogNormal (quantile) +

+
+

+ 1.00
(82ns)
+

+
+

+ - +

+
+

+ Logistic (CDF) +

+
+

+ 1.00
(24ns)
+

+
+

+ - +

+
+

+ Logistic (PDF) +

+
+

+ 1.00
(29ns)
+

+
+

+ - +

+
+

+ Logistic (quantile) +

+
+

+ 1.00
(21ns)
+

+
+

+ - +

+
+

+ NegativeBinomial (CDF) +

+
+

+ 1.34
(1081ns)
+

+
+

+ 1.00
(806ns)
+

+
+

+ NegativeBinomial (PDF) +

+
+

+ 1.00
(200ns)
+

+
+

+ - +

+
+

+ NegativeBinomial (quantile) +

+
+

+ 1.00
(5462ns)
+

+
+

+ 2.84
(15511ns)
+

+
+

+ NonCentralBeta (CDF) +

+
+

+ 1.00
(1449ns)
+

+
+

+ - +

+
+

+ NonCentralBeta (PDF) +

+
+

+ 1.00
(1186ns)
+

+
+

+ - +

+
+

+ NonCentralBeta (quantile) +

+
+

+ 1.00
(29111ns)
+

+
+

+ - +

+
+

+ NonCentralChiSquared (CDF) +

+
+

+ 9.20
(4617ns)
+

+
+

+ 1.00
(502ns)
+

+
+

+ NonCentralChiSquared (PDF) +

+
+

+ 1.00
(607ns)
+

+
+

+ - +

+
+

+ NonCentralChiSquared (quantile) +

+
+

+ 2.34
(27110ns)
+

+
+

+ 1.00
(11572ns)
+

+
+

+ NonCentralF (CDF) +

+
+

+ 1.22
(1382ns)
+

+
+

+ 1.00
(1132ns)
+

+
+

+ NonCentralF (PDF) +

+
+

+ 1.00
(1087ns)
+

+
+

+ - +

+
+

+ NonCentralF (quantile) +

+
+

+ 1.21
(20066ns)
+

+
+

+ 1.00
(16553ns)
+

+
+

+ NonCentralT (CDF) +

+
+

+ 2.15
(6005ns)
+

+
+

+ 1.00
(2792ns)
+

+
+

+ NonCentralT (PDF) +

+
+

+ 1.00
(4582ns)
+

+
+

+ - +

+
+

+ NonCentralT (quantile) +

+
+

+ 1.23
(56269ns)
+

+
+

+ 1.00
(45879ns)
+

+
+

+ Normal (CDF) +

+
+

+ 1.00
(38ns)
+

+
+

+ 4.16
(158ns)
+

+
+

+ Normal (PDF) +

+
+

+ 1.00
(29ns)
+

+
+

+ - +

+
+

+ Normal (quantile) +

+
+

+ 1.00
(40ns)
+

+
+

+ 10.22
(409ns)
+

+
+

+ Pareto (CDF) +

+
+

+ 1.00
(48ns)
+

+
+

+ - +

+
+

+ Pareto (PDF) +

+
+

+ 1.00
(111ns)
+

+
+

+ - +

+
+

+ Pareto (quantile) +

+
+

+ 1.00
(43ns)
+

+
+

+ - +

+
+

+ Poisson (CDF) +

+
+

+ 1.00
(122ns)
+

+
+

+ 1.48
(181ns)
+

+
+

+ Poisson (PDF) +

+
+

+ 1.00
(82ns)
+

+
+

+ - +

+
+

+ Poisson (quantile) +

+
+

+ 1.00
(599ns)
+

+
+

+ 4.63
(2772ns)
+

+
+

+ Rayleigh (CDF) +

+
+

+ 1.00
(23ns)
+

+
+

+ - +

+
+

+ Rayleigh (PDF) +

+
+

+ 1.00
(21ns)
+

+
+

+ - +

+
+

+ Rayleigh (quantile) +

+
+

+ 1.00
(27ns)
+

+
+

+ - +

+
+

+ SkewNormal (CDF) +

+
+

+ 1.00
(232ns)
+

+
+

+ - +

+
+

+ SkewNormal (PDF) +

+
+

+ 1.00
(81ns)
+

+
+

+ - +

+
+

+ SkewNormal (quantile) +

+
+

+ 1.00
(2020ns)
+

+
+

+ - +

+
+

+ StudentsT (CDF) +

+
+

+ 1.15
(464ns)
+

+
+

+ 1.00
(404ns)
+

+
+

+ StudentsT (PDF) +

+
+

+ 1.00
(216ns)
+

+
+

+ - +

+
+

+ StudentsT (quantile) +

+
+

+ 1.00
(839ns)
+

+
+

+ 3.80
(3188ns)
+

+
+

+ Weibull (CDF) +

+
+

+ 1.00
(75ns)
+

+
+

+ - +

+
+

+ Weibull (PDF) +

+
+

+ 1.00
(120ns)
+

+
+

+ - +

+
+

+ Weibull (quantile) +

+
+

+ 1.00
(73ns)
+

+
+

+ - +

+
+
+
+
+
+ +
+

Table 12. Library Comparison with GNU C++ version 5.3.0 on Windows x64

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ Function +

+
+

+ boost 1.61 +

+
+

+ boost 1.61
promote_double<false> +

+
+

+ tr1/cmath +

+
+

+ math.h +

+
+

+ assoc_laguerre
(2240/2240 tests selected) +

+
+

+ 1.14
(217ns)
+

+
+

+ 1.00
(190ns)
+

+
+

+ 1.19
(226ns)
+

+
+
+

+ assoc_legendre
(205/400 tests selected) +

+
+

+ - +

+
+

+ - +

+
+

+ 1.00
(45ns)
+

+
+
+

+ beta
(2204/2204 tests selected) +

+
+

+ 2.15
(382ns)
+

+
+

+ 1.23
(219ns)
+

+
+

+ 1.00
(178ns)
+

+
+
+

+ cbrt
(85/85 tests selected) +

+
+

+ 1.12
(48ns)
+

+
+

+ 1.00
(43ns)
+

+
+

+ 1.33
(57ns)
+

+
+

+ 1.33
(57ns)
+

+
+

+ cyl_bessel_i (integer order)
(515/526 tests selected) +

+
+

+ 2.73
(638ns)
+

+
+

+ 1.06
(247ns)
+

+
+

+ 1.00
(234ns)
+

+
+

+ - +

+
+

+ cyl_bessel_i
(215/240 tests selected) +

+
+

+ 4.73
(1016ns)
+

+
+

+ 2.06
(442ns)
+

+
+

+ 1.00
(215ns)
+

+
+

+ - +

+
+

+ cyl_bessel_j (integer order)
(252/268 tests selected) +

+
+

+ 1.62
(182ns)
+

+
+

+ 1.00
(112ns)
+

+
+

+ 2.55
(286ns)
+

+
+

+ 1.75
(196ns)
+

+
+

+ cyl_bessel_j
(431/451 tests selected) +

+
+

+ 2.07
(841ns)
+

+
+

+ 1.26
(513ns)
+

+
+

+ 1.00
(406ns)
+

+
+

+ - +

+
+

+ cyl_bessel_k (integer order)
(505/508 tests selected) +

+
+

+ 9.52
(3494ns)
+

+
+

+ 1.00
(367ns)
+

+
+

+ 7.50
(2751ns)
+

+
+

+ - +

+
+

+ cyl_bessel_k
(187/279 tests selected) +

+
+

+ 9.19
(6743ns)
+

+
+

+ 1.00
(734ns)
+

+
+

+ 4.20
(3085ns)
+

+
+

+ - +

+
+

+ cyl_neumann (integer order)
(423/428 tests selected) +

+
+

+ 2.76
(403ns)
+

+
+

+ 1.91
(279ns)
+

+
+

+ 4.76
(695ns)
+

+
+

+ 1.00
(146ns)
+

+
+

+ cyl_neumann
(400/450 tests selected) +

+
+

+ 2.01
(1346ns)
+

+
+

+ 1.00
(669ns)
+

+
+

+ 1.15
(772ns)
+

+
+

+ - +

+
+

+ ellint_1 (complete)
(109/109 tests selected) +

+
+

+ 1.64
(72ns)
+

+
+

+ 1.00
(44ns)
+

+
+

+ 5.36
(236ns)
+

+
+

+ - +

+
+

+ ellint_1
(627/629 tests selected) +

+
+

+ 1.51
(350ns)
+

+
+

+ 1.00
(232ns)
+

+
+

+ 2.01
(467ns)
+

+
+

+ - +

+
+

+ ellint_2 (complete)
(110/110 tests selected) +

+
+

+ 1.67
(60ns)
+

+
+

+ 1.00
(36ns)
+

+
+

+ 14.81
(533ns)
+

+
+

+ - +

+
+

+ ellint_2
(527/530 tests selected) +

+
+

+ 1.43
(640ns)
+

+
+

+ 1.00
(449ns)
+

+
+

+ 1.57
(707ns)
+

+
+

+ - +

+
+

+ ellint_3 (complete)
(500/500 tests selected) +

+
+

+ 2.10
(1079ns)
+

+
+

+ 1.00
(514ns)
+

+
+

+ 1.63
(839ns)
+

+
+

+ - +

+
+

+ ellint_3
(831/845 tests selected) +

+
+

+ 1.76
(1733ns)
+

+
+

+ 1.00
(986ns)
+

+
+

+ 1.27
(1257ns)
+

+
+

+ - +

+
+

+ erf
(950/950 tests selected) +

+
+

+ 1.00
(25ns)
+

+
+

+ - +

+
+

+ 1.60
(40ns)
+

+
+

+ 1.60
(40ns)
+

+
+

+ erfc
(950/950 tests selected) +

+
+

+ 1.66
(58ns)
+

+
+

+ 1.00
(35ns)
+

+
+

+ 1.74
(61ns)
+

+
+

+ 1.69
(59ns)
+

+
+

+ expint
(436/436 tests selected) +

+
+

+ 1.43
(86ns)
+

+
+

+ 1.00
(60ns)
+

+
+

+ 3.67
(220ns)
+

+
+

+ - +

+
+

+ expm1
(80/80 tests selected) +

+
+

+ 1.48
(31ns)
+

+
+

+ 1.14
(24ns)
+

+
+

+ 1.05
(22ns)
+

+
+

+ 1.00
(21ns)
+

+
+

+ laguerre
(280/280 tests selected) +

+
+

+ 1.10
(139ns)
+

+
+

+ 1.00
(126ns)
+

+
+

+ 1.25
(158ns)
+

+
+

+ - +

+
+

+ legendre
(300/300 tests selected) +

+
+

+ 1.16
(396ns)
+

+
+

+ 1.00
(340ns)
+

+
+

+ 1.11
(376ns)
+

+
+

+ - +

+
+

+ lgamma
(400/400 tests selected) +

+
+

+ 3.80
(224ns)
+

+
+

+ 2.25
(133ns)
+

+
+

+ 1.02
(60ns)
+

+
+

+ 1.00
(59ns)
+

+
+

+ log1p
(80/80 tests selected) +

+
+

+ 1.75
(28ns)
+

+
+

+ 1.00
(16ns)
+

+
+

+ 1.69
(27ns)
+

+
+

+ 1.69
(27ns)
+

+
+

+ sph_bessel
(483/483 tests selected) +

+
+

+ 1.42
(1325ns)
+

+
+

+ 1.00
(931ns)
+

+
+

+ 2.02
(1884ns)
+

+
+

+ - +

+
+

+ sph_neumann
(284/284 tests selected) +

+
+

+ 2.07
(3483ns)
+

+
+

+ 1.00
(1685ns)
+

+
+

+ 1.64
(2764ns)
+

+
+

+ - +

+
+

+ tgamma
(400/400 tests selected) +

+
+

+ 3.31
(238ns)
+

+
+

+ 2.04
(147ns)
+

+
+

+ 1.00
(72ns)
+

+
+

+ 1.01
(73ns)
+

+
+

+ zeta
(448/448 tests selected) +

+
+

+ 1.52
(345ns)
+

+
+

+ 1.00
(227ns)
+

+
+

+ 781.92
(177495ns)
+

+
+

+ - +

+
+
+
+
+
+ +
+

Table 13. Library Comparison with GNU C++ version 5.3.0 on linux

+
+++++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ Function +

+
+

+ boost 1.61 +

+
+

+ boost 1.61
promote_double<false> +

+
+

+ tr1/cmath +

+
+

+ GSL 1.16 +

+
+

+ Rmath 3.0.2 +

+
+

+ math.h +

+
+

+ assoc_laguerre
(2240/2240 tests selected) +

+
+

+ 1.36
(263ns)
+

+
+

+ 1.00
(194ns)
+

+
+

+ 1.20
(232ns)
+

+
+

+ 1.12
(218ns)
+

+
+

+ - +

+
+

+ - +

+
+

+ assoc_legendre
(205/400 tests selected) +

+
+

+ 4.16
(258ns)
+

+
+

+ 1.63
(101ns)
+

+
+

+ 1.00
(62ns)
+

+
+

+ 2.53
(157ns)
+

+
+

+ - +

+
+

+ - +

+
+

+ beta (incomplete)
(2682/3210 tests selected) +

+
+

+ 3.12
(1796ns)
+

+
+

+ 1.00
(575ns)
+

+
+

+ - +

+
+

+ 1.36
(780ns)
+

+
+

+ - +

+
+

+ - +

+
+

+ beta
(2203/2204 tests selected) +

+
+

+ 4.74
(734ns)
+

+
+

+ 1.01
(156ns)
+

+
+

+ 1.00
(155ns)
+

+
+

+ 2.57
(398ns)
+

+
+

+ 1.65
(255ns)
+

+
+

+ - +

+
+

+ cbrt
(85/85 tests selected) +

+
+

+ 2.53
(43ns)
+

+
+

+ 1.00
(17ns)
+

+
+

+ 1.24
(21ns)
+

+
+

+ - +

+
+

+ - +

+
+

+ 1.24
(21ns)
+

+
+

+ cyl_bessel_i (integer order)
(494/526 tests selected) +

+
+

+ 3.66
(893ns)
+

+
+

+ 1.08
(264ns)
+

+
+

+ 1.00
(244ns)
+

+
+

+ 1.98
(482ns)
+

+
+

+ 4.69
(1145ns)
+

+
+
+

+ cyl_bessel_i
(177/240 tests selected) +

+
+

+ 6.78
(1410ns)
+

+
+

+ 1.95
(406ns)
+

+
+

+ 1.00
(208ns)
+

+
+

+ 4.47
(929ns)
+

+
+

+ 8.16
(1698ns)
+

+
+

+ - +

+
+

+ cyl_bessel_j (integer order)
(250/268 tests selected) +

+
+

+ 2.59
(275ns)
+

+
+

+ 1.00
(106ns)
+

+
+

+ 2.50
(265ns)
+

+
+

+ 2.52
(267ns)
+

+
+

+ 4.22
(447ns)
+

+
+

+ 1.94
(206ns)
+

+
+

+ cyl_bessel_j
(423/451 tests selected) +

+
+

+ 2.83
(1071ns)
+

+
+

+ 1.05
(398ns)
+

+
+

+ 1.00
(379ns)
+

+
+

+ 2.28
(865ns)
+

+
+

+ 1.20
(456ns)
+

+
+

+ - +

+
+

+ cyl_bessel_k (integer order)
(505/508 tests selected) +

+
+

+ 13.91
(3673ns)
+

+
+

+ 1.37
(361ns)
+

+
+

+ 10.34
(2729ns)
+

+
+

+ 1.00
(264ns)
+

+
+

+ 1.34
(355ns)
+

+
+

+ - +

+
+

+ cyl_bessel_k
(96/279 tests selected) +

+
+

+ 6.86
(4589ns)
+

+
+

+ 1.00
(669ns)
+

+
+

+ 1.20
(803ns)
+

+
+

+ 1.31
(877ns)
+

+
+

+ 1.27
(851ns)
+

+
+

+ - +

+
+

+ cyl_neumann (integer order)
(423/428 tests selected) +

+
+

+ 2.20
(484ns)
+

+
+

+ 1.00
(220ns)
+

+
+

+ 3.26
(718ns)
+

+
+

+ 2.42
(533ns)
+

+
+

+ 4.95
(1089ns)
+

+
+

+ 1.78
(392ns)
+

+
+

+ cyl_neumann
(400/450 tests selected) +

+
+

+ 2.48
(1478ns)
+

+
+

+ 1.00
(597ns)
+

+
+

+ 1.26
(754ns)
+

+
+

+ 2.42
(1444ns)
+

+
+

+ 1.07
(637ns)
+

+
+

+ - +

+
+

+ digamma
(1019/1019 tests selected) +

+
+

+ 1.92
(75ns)
+

+
+

+ 1.00
(39ns)
+

+
+

+ - +

+
+

+ 2.69
(105ns)
+

+
+

+ 4.31
(168ns)
+

+
+

+ - +

+
+

+ ellint_1 (complete)
(109/109 tests selected) +

+
+

+ 1.86
(52ns)
+

+
+

+ 1.00
(28ns)
+

+
+

+ 8.89
(249ns)
+

+
+

+ 10.54
(295ns)
+

+
+

+ - +

+
+
+

+ ellint_1
(627/629 tests selected) +

+
+

+ 1.94
(358ns)
+

+
+

+ 1.00
(185ns)
+

+
+

+ 2.31
(428ns)
+

+
+

+ 2.51
(464ns)
+

+
+

+ - +

+
+

+ - +

+
+

+ ellint_2 (complete)
(109/110 tests selected) +

+
+

+ 1.71
(60ns)
+

+
+

+ 1.00
(35ns)
+

+
+

+ 15.23
(533ns)
+

+
+

+ 17.31
(606ns)
+

+
+

+ - +

+
+

+ - +

+
+

+ ellint_2
(527/530 tests selected) +

+
+

+ 2.32
(805ns)
+

+
+

+ 1.00
(347ns)
+

+
+

+ 1.90
(658ns)
+

+
+

+ 2.17
(754ns)
+

+
+

+ - +

+
+

+ - +

+
+

+ ellint_3 (complete)
(500/500 tests selected) +

+
+

+ 2.23
(1172ns)
+

+
+

+ 1.00
(525ns)
+

+
+

+ 1.66
(873ns)
+

+
+

+ 1.98
(1037ns)
+

+
+ +
+

+ ellint_3
(831/845 tests selected) +

+
+

+ 2.75
(2154ns)
+

+
+

+ 1.00
(783ns)
+

+
+

+ 1.59
(1243ns)
+

+
+

+ 1.77
(1383ns)
+

+
+

+ - +

+
+

+ - +

+
+

+ ellint_rc
(201/201 tests selected) +

+
+

+ 1.57
(77ns)
+

+
+

+ 1.00
(49ns)
+

+
+

+ - +

+
+

+ 4.41
(216ns)
+

+
+

+ - +

+
+

+ - +

+
+

+ ellint_rd
(7588/7588 tests selected) +

+
+

+ 2.23
(520ns)
+

+
+

+ 1.00
(233ns)
+

+
+

+ - +

+
+

+ 1.64
(381ns)
+

+
+

+ - +

+
+

+ - +

+
+

+ ellint_rf
(7788/7788 tests selected) +

+
+

+ 1.51
(95ns)
+

+
+

+ 1.00
(63ns)
+

+
+

+ - +

+
+

+ 5.54
(349ns)
+

+
+

+ - +

+
+

+ - +

+
+

+ ellint_rj
(7642/8032 tests selected) +

+
+

+ 2.33
(481ns)
+

+
+

+ 1.00
(206ns)
+

+
+

+ - +

+
+

+ 11.31
(2329ns)
+

+
+

+ - +

+
+

+ - +

+
+

+ erf
(950/950 tests selected) +

+
+

+ 1.00
(15ns)
+

+
+

+ - +

+
+

+ 1.20
(18ns)
+

+
+

+ 10.27
(154ns)
+

+
+

+ - +

+
+

+ 1.20
(18ns)
+

+
+

+ erfc
(950/950 tests selected) +

+
+

+ 2.68
(59ns)
+

+
+

+ 1.00
(22ns)
+

+
+

+ 1.18
(26ns)
+

+
+

+ 3.50
(77ns)
+

+
+

+ - +

+
+

+ 1.14
(25ns)
+

+
+

+ expint (En)
(1059/1059 tests selected) +

+
+

+ 1.86
(273ns)
+

+
+

+ 1.00
(147ns)
+

+
+

+ - +

+
+

+ 4.87
(716ns)
+

+
+

+ - +

+
+

+ - +

+
+

+ expint
(436/436 tests selected) +

+
+

+ 2.47
(94ns)
+

+
+

+ 1.00
(38ns)
+

+
+

+ 5.34
(203ns)
+

+
+

+ 3.76
(143ns)
+

+
+

+ - +

+
+

+ - +

+
+

+ expm1
(80/80 tests selected) +

+
+

+ 1.00
(10ns)
+

+
+

+ 1.10
(11ns)
+

+
+

+ 1.00
(10ns)
+

+
+

+ - +

+
+

+ - +

+
+

+ 1.00
(10ns)
+

+
+

+ gamma_p
(1379/1379 tests selected) +

+
+

+ 2.42
(492ns)
+

+
+

+ 1.00
(203ns)
+

+
+

+ - +

+
+

+ 4.77
(968ns)
+

+
+

+ 1.61
(326ns)
+

+
+

+ - +

+
+

+ gamma_p_inv
(559/559 tests selected) +

+
+

+ 2.24
(1577ns)
+

+
+

+ 1.00
(704ns)
+

+
+

+ - +

+
+

+ - +

+
+

+ 2.22
(1560ns)
+

+
+

+ - +

+
+

+ gamma_q
(1371/1379 tests selected) +

+
+

+ 2.53
(508ns)
+

+
+

+ 1.00
(201ns)
+

+
+

+ - +

+
+

+ 5.70
(1146ns)
+

+
+

+ 1.78
(358ns)
+

+
+

+ - +

+
+

+ gamma_q_inv
(78/559 tests selected) +

+
+

+ 2.45
(1841ns)
+

+
+

+ 1.00
(751ns)
+

+
+

+ - +

+
+

+ - +

+
+

+ 1.09
(822ns)
+

+
+

+ - +

+
+

+ ibeta
(3210/3210 tests selected) +

+
+

+ 3.47
(1715ns)
+

+
+

+ 1.28
(634ns)
+

+
+

+ - +

+
+

+ - +

+
+

+ 1.00
(494ns)
+

+
+

+ - +

+
+

+ ibeta_inv
(952/1210 tests selected) +

+
+

+ 2.58
(5742ns)
+

+
+

+ 1.00
(2224ns)
+

+
+

+ - +

+
+

+ - +

+
+

+ 26.72
(59415ns)
+

+
+

+ - +

+
+

+ ibetac
(3210/3210 tests selected) +

+
+

+ 3.51
(1736ns)
+

+
+

+ 1.32
(653ns)
+

+
+

+ - +

+
+

+ - +

+
+

+ 1.00
(495ns)
+

+
+

+ - +

+
+

+ ibetac_inv
(945/1210 tests selected) +

+
+

+ 2.44
(5451ns)
+

+
+

+ 1.00
(2237ns)
+

+
+

+ - +

+
+

+ - +

+
+

+ 19.20
(42953ns)
+

+
+

+ - +

+
+

+ jacobi_cn
(2368/2757 tests selected) +

+
+

+ 5.01
(476ns)
+

+
+

+ 1.81
(172ns)
+

+
+

+ - +

+
+

+ 1.00
(95ns)
+

+
+

+ - +

+
+

+ - +

+
+

+ jacobi_dn
(2368/2757 tests selected) +

+
+

+ 5.12
(481ns)
+

+
+

+ 1.83
(172ns)
+

+
+

+ - +

+
+

+ 1.00
(94ns)
+

+
+

+ - +

+
+

+ - +

+
+

+ jacobi_sn
(2368/2757 tests selected) +

+
+

+ 5.23
(492ns)
+

+
+

+ 1.83
(172ns)
+

+
+

+ - +

+
+

+ 1.00
(94ns)
+

+
+

+ - +

+
+

+ - +

+
+

+ laguerre
(280/280 tests selected) +

+
+

+ 1.09
(139ns)
+

+
+

+ 1.00
(128ns)
+

+
+

+ 1.25
(160ns)
+

+
+

+ 1.18
(151ns)
+

+
+

+ - +

+
+

+ - +

+
+

+ legendre Q
(300/300 tests selected) +

+
+

+ 1.18
(496ns)
+

+
+

+ 1.00
(422ns)
+

+
+

+ - +

+
+

+ 1.09
(461ns)
+

+
+

+ - +

+
+

+ - +

+
+

+ legendre
(300/300 tests selected) +

+
+

+ 1.16
(399ns)
+

+
+

+ 1.00
(345ns)
+

+
+

+ 1.10
(380ns)
+

+
+

+ 2.10
(726ns)
+

+
+

+ - +

+
+

+ - +

+
+

+ lgamma
(400/400 tests selected) +

+
+

+ 5.35
(257ns)
+

+
+

+ 2.44
(117ns)
+

+
+

+ 1.00
(48ns)
+

+
+

+ 5.92
(284ns)
+

+
+

+ 1.96
(94ns)
+

+
+

+ 1.00
(48ns)
+

+
+

+ log1p
(80/80 tests selected) +

+
+

+ 1.09
(12ns)
+

+
+

+ 1.09
(12ns)
+

+
+

+ 1.00
(11ns)
+

+
+

+ - +

+
+

+ - +

+
+

+ 1.00
(11ns)
+

+
+

+ polygamma
(823/1535 tests selected) +

+
+

+ 8.69
(2885ns)
+

+
+

+ 2.21
(734ns)
+

+
+

+ - +

+
+

+ 7.47
(2480ns)
+

+
+

+ 1.00
(332ns)
+

+
+

+ - +

+
+

+ sph_bessel
(483/483 tests selected) +

+
+

+ 1.71
(1563ns)
+

+
+

+ 1.00
(915ns)
+

+
+

+ 2.11
(1935ns)
+

+
+

+ 2.68
(2452ns)
+

+
+

+ - +

+
+

+ - +

+
+

+ sph_neumann
(284/284 tests selected) +

+
+

+ 8.32
(3745ns)
+

+
+

+ 3.88
(1744ns)
+

+
+

+ 6.46
(2906ns)
+

+
+

+ 1.00
(450ns)
+

+
+

+ - +

+
+

+ - +

+
+

+ tgamma (incomplete)
(1266/1379 tests selected) +

+
+

+ 2.35
(744ns)
+

+
+

+ 1.00
(316ns)
+

+
+

+ - +

+
+

+ 2.93
(927ns)
+

+
+

+ - +

+
+

+ - +

+
+

+ tgamma
(400/400 tests selected) +

+
+

+ 4.54
(354ns)
+

+
+

+ 1.23
(96ns)
+

+
+

+ 2.05
(160ns)
+

+
+

+ 1.21
(94ns)
+

+
+

+ 1.00
(78ns)
+

+
+

+ 2.06
(161ns)
+

+
+

+ trigamma
(659/659 tests selected) +

+
+

+ 1.64
(36ns)
+

+
+

+ 1.00
(22ns)
+

+
+

+ - +

+
+

+ 39.41
(867ns)
+

+
+

+ 12.09
(266ns)
+

+
+

+ - +

+
+

+ zeta
(448/448 tests selected) +

+
+

+ 2.71
(509ns)
+

+
+

+ 1.00
(188ns)
+

+
+

+ 752.52
(141474ns)
+

+
+

+ 1.52
(285ns)
+

+
+

+ - +

+
+

+ - +

+
+
+
+
+
+ +
+

Table 14. Library Comparison with Intel C++ C++0x mode version 1600 on Windows + x64

+
+++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ Function +

+
+

+ boost 1.61 +

+
+

+ math.h +

+
+

+ cbrt
(85/85 tests selected) +

+
+

+ 1.56
(14ns)
+

+
+

+ 1.00
(9ns)
+

+
+

+ cyl_bessel_j (integer order)
(268/268 tests selected) +

+
+

+ 1.00
(76ns)
+

+
+

+ 1.25
(95ns)
+

+
+

+ cyl_neumann (integer order)
(428/428 tests selected) +

+
+

+ 1.00
(229ns)
+

+
+

+ 1.03
(235ns)
+

+
+

+ erf
(950/950 tests selected) +

+
+

+ 1.00
(13ns)
+

+
+

+ 2.23
(29ns)
+

+
+

+ erfc
(950/950 tests selected) +

+
+

+ 1.00
(17ns)
+

+
+

+ 6.65
(113ns)
+

+
+

+ expm1
(80/80 tests selected) +

+
+

+ 1.10
(11ns)
+

+
+

+ 1.00
(10ns)
+

+
+

+ lgamma
(400/400 tests selected) +

+
+

+ 1.35
(77ns)
+

+
+

+ 1.00
(57ns)
+

+
+

+ log1p
(80/80 tests selected) +

+
+

+ 1.08
(14ns)
+

+
+

+ 1.00
(13ns)
+

+
+

+ tgamma
(400/400 tests selected) +

+
+

+ 1.00
(59ns)
+

+
+

+ 1.07
(63ns)
+

+
+
+
+
+
+ +
+

Table 15. Library Comparison with Microsoft Visual C++ version 14.0 on Windows + x64

+
+++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ Function +

+
+

+ boost 1.61 +

+
+

+ math.h +

+
+

+ cbrt
(85/85 tests selected) +

+
+

+ 1.00
(45ns)
+

+
+

+ 1.44
(65ns)
+

+
+

+ cyl_bessel_j (integer order)
(267/268 tests selected) +

+
+

+ 1.00
(103ns)
+

+
+

+ 2.11
(217ns)
+

+
+

+ cyl_neumann (integer order)
(428/428 tests selected) +

+
+

+ 1.57
(225ns)
+

+
+

+ 1.00
(143ns)
+

+
+

+ erf
(950/950 tests selected) +

+
+

+ 1.10
(23ns)
+

+
+

+ 1.00
(21ns)
+

+
+

+ erfc
(950/950 tests selected) +

+
+

+ 1.00
(22ns)
+

+
+

+ 3.36
(74ns)
+

+
+

+ expm1
(80/80 tests selected) +

+
+

+ 1.00
(10ns)
+

+
+

+ 1.10
(11ns)
+

+
+

+ lgamma
(400/400 tests selected) +

+
+

+ 1.00
(73ns)
+

+
+

+ 1.74
(127ns)
+

+
+

+ log1p
(80/80 tests selected) +

+
+

+ 1.08
(14ns)
+

+
+

+ 1.00
(13ns)
+

+
+

+ tgamma
(400/400 tests selected) +

+
+

+ 1.00
(77ns)
+

+
+

+ 12.12
(933ns)
+

+
+
+
+
+
+ +
+

Table 16. Polynomial Method Comparison with GNU C++ version 5.3.0 on Windows x64

+
+++++++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ Function +

+
+

+ Method 0
(Double Coefficients) +

+
+

+ Method 0
(Integer Coefficients) +

+
+

+ Method 1
(Double Coefficients) +

+
+

+ Method 1
(Integer Coefficients) +

+
+

+ Method 2
(Double Coefficients) +

+
+

+ Method 2
(Integer Coefficients) +

+
+

+ Method 3
(Double Coefficients) +

+
+

+ Method 3
(Integer Coefficients) +

+
+

+ Order 2 +

+
+

+ - +

+
+

+ - +

+
+

+ 1.00
(9ns)
+

+
+

+ 1.00
(9ns)
+

+
+

+ 1.00
(9ns)
+

+
+

+ 1.00
(9ns)
+

+
+

+ 1.11
(10ns)
+

+
+

+ 1.11
(10ns)
+

+
+

+ Order 3 +

+
+

+ 1.50
(18ns)
+

+
+

+ 2.42
(29ns)
+

+
+

+ 1.00
(12ns)
+

+
+

+ 1.00
(12ns)
+

+
+

+ 1.00
(12ns)
+

+
+

+ 1.00
(12ns)
+

+
+

+ 1.00
(12ns)
+

+
+

+ 1.08
(13ns)
+

+
+

+ Order 4 +

+
+

+ 1.40
(21ns)
+

+
+

+ 2.40
(36ns)
+

+
+

+ 1.00
(15ns)
+

+
+

+ 1.07
(16ns)
+

+
+

+ 1.00
(15ns)
+

+
+

+ 1.00
(15ns)
+

+
+

+ 1.07
(16ns)
+

+
+

+ 1.13
(17ns)
+

+
+

+ Order 5 +

+
+

+ 1.37
(26ns)
+

+
+

+ 2.37
(45ns)
+

+
+

+ 1.00
(19ns)
+

+
+

+ 1.00
(19ns)
+

+
+

+ 1.11
(21ns)
+

+
+

+ 1.05
(20ns)
+

+
+

+ 1.05
(20ns)
+

+
+

+ 1.11
(21ns)
+

+
+

+ Order 6 +

+
+

+ 1.54
(37ns)
+

+
+

+ 2.25
(54ns)
+

+
+

+ 1.00
(24ns)
+

+
+

+ 1.00
(24ns)
+

+
+

+ 1.00
(24ns)
+

+
+

+ 1.29
(31ns)
+

+
+

+ 1.04
(25ns)
+

+
+

+ 1.00
(24ns)
+

+
+

+ Order 7 +

+
+

+ 1.55
(45ns)
+

+
+

+ 2.17
(63ns)
+

+
+

+ 1.03
(30ns)
+

+
+

+ 1.00
(29ns)
+

+
+

+ 1.10
(32ns)
+

+
+

+ 1.10
(32ns)
+

+
+

+ 1.00
(29ns)
+

+
+

+ 1.07
(31ns)
+

+
+

+ Order 8 +

+
+

+ 1.61
(53ns)
+

+
+

+ 2.18
(72ns)
+

+
+

+ 1.09
(36ns)
+

+
+

+ 1.09
(36ns)
+

+
+

+ 1.15
(38ns)
+

+
+

+ 1.03
(34ns)
+

+
+

+ 1.06
(35ns)
+

+
+

+ 1.00
(33ns)
+

+
+

+ Order 9 +

+
+

+ 1.76
(65ns)
+

+
+

+ 2.49
(92ns)
+

+
+

+ 1.19
(44ns)
+

+
+

+ 1.24
(46ns)
+

+
+

+ 1.00
(37ns)
+

+
+

+ 1.03
(38ns)
+

+
+

+ 1.00
(37ns)
+

+
+

+ 1.00
(37ns)
+

+
+

+ Order 10 +

+
+

+ 1.76
(72ns)
+

+
+

+ 2.61
(107ns)
+

+
+

+ 1.22
(50ns)
+

+
+

+ 1.24
(51ns)
+

+
+

+ 1.29
(53ns)
+

+
+

+ 1.15
(47ns)
+

+
+

+ 1.00
(41ns)
+

+
+

+ 1.02
(42ns)
+

+
+

+ Order 11 +

+
+

+ 1.83
(84ns)
+

+
+

+ 2.59
(119ns)
+

+
+

+ 1.28
(59ns)
+

+
+

+ 1.26
(58ns)
+

+
+

+ 1.09
(50ns)
+

+
+

+ 1.07
(49ns)
+

+
+

+ 1.00
(46ns)
+

+
+

+ 1.02
(47ns)
+

+
+

+ Order 12 +

+
+

+ 1.92
(100ns)
+

+
+

+ 2.73
(142ns)
+

+
+

+ 1.29
(67ns)
+

+
+

+ 1.31
(68ns)
+

+
+

+ 1.06
(55ns)
+

+
+

+ 1.08
(56ns)
+

+
+

+ 1.00
(52ns)
+

+
+

+ 1.02
(53ns)
+

+
+

+ Order 13 +

+
+

+ 2.24
(112ns)
+

+
+

+ 2.96
(148ns)
+

+
+

+ 1.44
(72ns)
+

+
+

+ 1.40
(70ns)
+

+
+

+ 1.04
(52ns)
+

+
+

+ 1.00
(50ns)
+

+
+

+ 1.00
(50ns)
+

+
+

+ 1.08
(54ns)
+

+
+

+ Order 14 +

+
+

+ 2.04
(114ns)
+

+
+

+ 2.88
(161ns)
+

+
+

+ 1.50
(84ns)
+

+
+

+ 1.54
(86ns)
+

+
+

+ 1.05
(59ns)
+

+
+

+ 1.04
(58ns)
+

+
+

+ 1.00
(56ns)
+

+
+

+ 1.00
(56ns)
+

+
+

+ Order 15 +

+
+

+ 1.80
(133ns)
+

+
+

+ 2.41
(178ns)
+

+
+

+ 1.39
(103ns)
+

+
+

+ 1.35
(100ns)
+

+
+

+ 1.00
(74ns)
+

+
+

+ 1.16
(86ns)
+

+
+

+ 1.00
(74ns)
+

+
+

+ 1.00
(74ns)
+

+
+

+ Order 16 +

+
+

+ 1.84
(149ns)
+

+
+

+ 2.49
(202ns)
+

+
+

+ 1.32
(107ns)
+

+
+

+ 1.37
(111ns)
+

+
+

+ 1.09
(88ns)
+

+
+

+ 1.10
(89ns)
+

+
+

+ 1.00
(81ns)
+

+
+

+ 1.00
(81ns)
+

+
+

+ Order 17 +

+
+

+ 1.99
(165ns)
+

+
+

+ 2.65
(220ns)
+

+
+

+ 1.49
(124ns)
+

+
+

+ 1.49
(124ns)
+

+
+

+ 1.13
(94ns)
+

+
+

+ 1.04
(86ns)
+

+
+

+ 1.00
(83ns)
+

+
+

+ 1.00
(83ns)
+

+
+

+ Order 18 +

+
+

+ 2.00
(180ns)
+

+
+

+ 2.71
(244ns)
+

+
+

+ 1.49
(134ns)
+

+
+

+ 1.48
(133ns)
+

+
+

+ 1.10
(99ns)
+

+
+

+ 1.08
(97ns)
+

+
+

+ 1.00
(90ns)
+

+
+

+ 1.01
(91ns)
+

+
+

+ Order 19 +

+
+

+ 2.03
(195ns)
+

+
+

+ 2.70
(259ns)
+

+
+

+ 1.53
(147ns)
+

+
+

+ 1.51
(145ns)
+

+
+

+ 1.04
(100ns)
+

+
+

+ 1.09
(105ns)
+

+
+

+ 1.01
(97ns)
+

+
+

+ 1.00
(96ns)
+

+
+

+ Order 20 +

+
+

+ 2.02
(200ns)
+

+
+

+ 2.85
(282ns)
+

+
+

+ 1.65
(163ns)
+

+
+

+ 1.56
(154ns)
+

+
+

+ 1.17
(116ns)
+

+
+

+ 1.09
(108ns)
+

+
+

+ 1.00
(99ns)
+

+
+

+ 1.02
(101ns)
+

+
+
+
+
+
+ +
+

Table 17. Polynomial Method Comparison with GNU C++ version 5.3.0 on linux

+
+++++++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ Function +

+
+

+ Method 0
(Double Coefficients) +

+
+

+ Method 0
(Integer Coefficients) +

+
+

+ Method 1
(Double Coefficients) +

+
+

+ Method 1
(Integer Coefficients) +

+
+

+ Method 2
(Double Coefficients) +

+
+

+ Method 2
(Integer Coefficients) +

+
+

+ Method 3
(Double Coefficients) +

+
+

+ Method 3
(Integer Coefficients) +

+
+

+ Order 2 +

+
+

+ - +

+
+

+ - +

+
+

+ 1.00
(9ns)
+

+
+

+ 1.00
(9ns)
+

+
+

+ 1.11
(10ns)
+

+
+

+ 1.00
(9ns)
+

+
+

+ 1.11
(10ns)
+

+
+

+ 1.11
(10ns)
+

+
+

+ Order 3 +

+
+

+ 1.58
(19ns)
+

+
+

+ 2.08
(25ns)
+

+
+

+ 1.08
(13ns)
+

+
+

+ 1.08
(13ns)
+

+
+

+ 1.00
(12ns)
+

+
+

+ 1.08
(13ns)
+

+
+

+ 1.00
(12ns)
+

+
+

+ 1.08
(13ns)
+

+
+

+ Order 4 +

+
+

+ 2.00
(30ns)
+

+
+

+ 2.40
(36ns)
+

+
+

+ 1.07
(16ns)
+

+
+

+ 1.07
(16ns)
+

+
+

+ 1.07
(16ns)
+

+
+

+ 1.07
(16ns)
+

+
+

+ 1.00
(15ns)
+

+
+

+ 1.20
(18ns)
+

+
+

+ Order 5 +

+
+

+ 1.74
(33ns)
+

+
+

+ 2.74
(52ns)
+

+
+

+ 1.00
(19ns)
+

+
+

+ 1.00
(19ns)
+

+
+

+ 1.11
(21ns)
+

+
+

+ 1.05
(20ns)
+

+
+

+ 1.05
(20ns)
+

+
+

+ 1.05
(20ns)
+

+
+

+ Order 6 +

+
+

+ 1.83
(44ns)
+

+
+

+ 2.29
(55ns)
+

+
+

+ 1.08
(26ns)
+

+
+

+ 1.00
(24ns)
+

+
+

+ 1.08
(26ns)
+

+
+

+ 1.08
(26ns)
+

+
+

+ 1.04
(25ns)
+

+
+

+ 1.00
(24ns)
+

+
+

+ Order 7 +

+
+

+ 1.71
(48ns)
+

+
+

+ 2.39
(67ns)
+

+
+

+ 1.04
(29ns)
+

+
+

+ 1.07
(30ns)
+

+
+

+ 1.04
(29ns)
+

+
+

+ 1.04
(29ns)
+

+
+

+ 1.00
(28ns)
+

+
+

+ 1.00
(28ns)
+

+
+

+ Order 8 +

+
+

+ 1.66
(53ns)
+

+
+

+ 2.41
(77ns)
+

+
+

+ 1.16
(37ns)
+

+
+

+ 1.12
(36ns)
+

+
+

+ 1.06
(34ns)
+

+
+

+ 1.09
(35ns)
+

+
+

+ 1.03
(33ns)
+

+
+

+ 1.00
(32ns)
+

+
+

+ Order 9 +

+
+

+ 1.78
(66ns)
+

+
+

+ 2.65
(98ns)
+

+
+

+ 1.16
(43ns)
+

+
+

+ 1.19
(44ns)
+

+
+

+ 1.03
(38ns)
+

+
+

+ 1.16
(43ns)
+

+
+

+ 1.00
(37ns)
+

+
+

+ 1.00
(37ns)
+

+
+

+ Order 10 +

+
+

+ 1.67
(72ns)
+

+
+

+ 2.49
(107ns)
+

+
+

+ 1.21
(52ns)
+

+
+

+ 1.19
(51ns)
+

+
+

+ 1.09
(47ns)
+

+
+

+ 1.12
(48ns)
+

+
+

+ 1.02
(44ns)
+

+
+

+ 1.00
(43ns)
+

+
+

+ Order 11 +

+
+

+ 2.21
(104ns)
+

+
+

+ 2.68
(126ns)
+

+
+

+ 1.30
(61ns)
+

+
+

+ 1.36
(64ns)
+

+
+

+ 1.09
(51ns)
+

+
+

+ 1.09
(51ns)
+

+
+

+ 1.02
(48ns)
+

+
+

+ 1.00
(47ns)
+

+
+

+ Order 12 +

+
+

+ 2.25
(119ns)
+

+
+

+ 2.58
(137ns)
+

+
+

+ 1.34
(71ns)
+

+
+

+ 1.57
(83ns)
+

+
+

+ 1.06
(56ns)
+

+
+

+ 1.06
(56ns)
+

+
+

+ 1.00
(53ns)
+

+
+

+ 1.00
(53ns)
+

+
+

+ Order 13 +

+
+

+ 2.38
(124ns)
+

+
+

+ 2.94
(153ns)
+

+
+

+ 1.42
(74ns)
+

+
+

+ 1.60
(83ns)
+

+
+

+ 1.02
(53ns)
+

+
+

+ 1.06
(55ns)
+

+
+

+ 1.00
(52ns)
+

+
+

+ 1.02
(53ns)
+

+
+

+ Order 14 +

+
+

+ 2.19
(129ns)
+

+
+

+ 2.83
(167ns)
+

+
+

+ 1.53
(90ns)
+

+
+

+ 1.46
(86ns)
+

+
+

+ 1.05
(62ns)
+

+
+

+ 1.03
(61ns)
+

+
+

+ 1.00
(59ns)
+

+
+

+ 1.03
(61ns)
+

+
+

+ Order 15 +

+
+

+ 1.97
(146ns)
+

+
+

+ 2.45
(181ns)
+

+
+

+ 1.46
(108ns)
+

+
+

+ 1.41
(104ns)
+

+
+

+ 1.07
(79ns)
+

+
+

+ 1.24
(92ns)
+

+
+

+ 1.00
(74ns)
+

+
+

+ 1.01
(75ns)
+

+
+

+ Order 16 +

+
+

+ 2.04
(163ns)
+

+
+

+ 2.60
(208ns)
+

+
+

+ 1.39
(111ns)
+

+
+

+ 1.38
(110ns)
+

+
+

+ 1.09
(87ns)
+

+
+

+ 1.06
(85ns)
+

+
+

+ 1.01
(81ns)
+

+
+

+ 1.00
(80ns)
+

+
+

+ Order 17 +

+
+

+ 2.01
(175ns)
+

+
+

+ 2.62
(228ns)
+

+
+

+ 1.41
(123ns)
+

+
+

+ 1.40
(122ns)
+

+
+

+ 1.02
(89ns)
+

+
+

+ 1.00
(87ns)
+

+
+

+ 1.00
(87ns)
+

+
+

+ 1.01
(88ns)
+

+
+

+ Order 18 +

+
+

+ 2.05
(189ns)
+

+
+

+ 2.79
(257ns)
+

+
+

+ 1.48
(136ns)
+

+
+

+ 1.47
(135ns)
+

+
+

+ 1.03
(95ns)
+

+
+

+ 1.04
(96ns)
+

+
+

+ 1.00
(92ns)
+

+
+

+ 1.00
(92ns)
+

+
+

+ Order 19 +

+
+

+ 2.05
(195ns)
+

+
+

+ 2.82
(268ns)
+

+
+

+ 1.55
(147ns)
+

+
+

+ 1.58
(150ns)
+

+
+

+ 1.05
(100ns)
+

+
+

+ 1.02
(97ns)
+

+
+

+ 1.00
(95ns)
+

+
+

+ 1.00
(95ns)
+

+
+

+ Order 20 +

+
+

+ 2.07
(211ns)
+

+
+

+ 2.91
(297ns)
+

+
+

+ 1.61
(164ns)
+

+
+

+ 1.69
(172ns)
+

+
+

+ 1.05
(107ns)
+

+
+

+ 1.04
(106ns)
+

+
+

+ 1.02
(104ns)
+

+
+

+ 1.00
(102ns)
+

+
+
+
+
+
+ +
+

Table 18. Polynomial Method Comparison with Intel C++ C++0x mode version 1600 + on Windows x64

+
+++++++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ Function +

+
+

+ Method 0
(Double Coefficients) +

+
+

+ Method 0
(Integer Coefficients) +

+
+

+ Method 1
(Double Coefficients) +

+
+

+ Method 1
(Integer Coefficients) +

+
+

+ Method 2
(Double Coefficients) +

+
+

+ Method 2
(Integer Coefficients) +

+
+

+ Method 3
(Double Coefficients) +

+
+

+ Method 3
(Integer Coefficients) +

+
+

+ Order 2 +

+
+

+ - +

+
+

+ - +

+
+

+ 1.00
(5ns)
+

+
+

+ 1.00
(5ns)
+

+
+

+ 1.00
(5ns)
+

+
+

+ 1.00
(5ns)
+

+
+

+ 1.00
(5ns)
+

+
+

+ 1.00
(5ns)
+

+
+

+ Order 3 +

+
+

+ 3.00
(24ns)
+

+
+

+ 3.88
(31ns)
+

+
+

+ 1.00
(8ns)
+

+
+

+ 1.00
(8ns)
+

+
+

+ 1.13
(9ns)
+

+
+

+ 1.13
(9ns)
+

+
+

+ 1.00
(8ns)
+

+
+

+ 1.00
(8ns)
+

+
+

+ Order 4 +

+
+

+ 2.45
(27ns)
+

+
+

+ 3.27
(36ns)
+

+
+

+ 1.00
(11ns)
+

+
+

+ 1.00
(11ns)
+

+
+

+ 1.09
(12ns)
+

+
+

+ 1.18
(13ns)
+

+
+

+ 1.00
(11ns)
+

+
+

+ 1.00
(11ns)
+

+
+

+ Order 5 +

+
+

+ 2.54
(33ns)
+

+
+

+ 3.54
(46ns)
+

+
+

+ 1.00
(13ns)
+

+
+

+ 1.00
(13ns)
+

+
+

+ 1.54
(20ns)
+

+
+

+ 1.62
(21ns)
+

+
+

+ 1.23
(16ns)
+

+
+

+ 1.23
(16ns)
+

+
+

+ Order 6 +

+
+

+ 2.67
(40ns)
+

+
+

+ 3.67
(55ns)
+

+
+

+ 1.00
(15ns)
+

+
+

+ 1.00
(15ns)
+

+
+

+ 1.67
(25ns)
+

+
+

+ 1.47
(22ns)
+

+
+

+ 1.33
(20ns)
+

+
+

+ 1.33
(20ns)
+

+
+

+ Order 7 +

+
+

+ 2.61
(47ns)
+

+
+

+ 3.78
(68ns)
+

+
+

+ 1.00
(18ns)
+

+
+

+ 1.00
(18ns)
+

+
+

+ 1.67
(30ns)
+

+
+

+ 1.56
(28ns)
+

+
+

+ 1.33
(24ns)
+

+
+

+ 1.33
(24ns)
+

+
+

+ Order 8 +

+
+

+ 2.71
(57ns)
+

+
+

+ 3.62
(76ns)
+

+
+

+ 1.00
(21ns)
+

+
+

+ 1.05
(22ns)
+

+
+

+ 1.52
(32ns)
+

+
+

+ 1.43
(30ns)
+

+
+

+ 1.33
(28ns)
+

+
+

+ 1.33
(28ns)
+

+
+

+ Order 9 +

+
+

+ 2.48
(67ns)
+

+
+

+ 3.48
(94ns)
+

+
+

+ 1.00
(27ns)
+

+
+

+ 1.07
(29ns)
+

+
+

+ 1.44
(39ns)
+

+
+

+ 1.44
(39ns)
+

+
+

+ 1.19
(32ns)
+

+
+

+ 1.19
(32ns)
+

+
+

+ Order 10 +

+
+

+ 2.41
(77ns)
+

+
+

+ 3.22
(103ns)
+

+
+

+ 1.00
(32ns)
+

+
+

+ 1.03
(33ns)
+

+
+

+ 1.31
(42ns)
+

+
+

+ 1.38
(44ns)
+

+
+

+ 1.16
(37ns)
+

+
+

+ 1.19
(38ns)
+

+
+

+ Order 11 +

+
+

+ 2.39
(86ns)
+

+
+

+ 3.22
(116ns)
+

+
+

+ 1.00
(36ns)
+

+
+

+ 1.03
(37ns)
+

+
+

+ 1.28
(46ns)
+

+
+

+ 1.19
(43ns)
+

+
+

+ 1.17
(42ns)
+

+
+

+ 1.17
(42ns)
+

+
+

+ Order 12 +

+
+

+ 2.37
(102ns)
+

+
+

+ 3.00
(129ns)
+

+
+

+ 1.02
(44ns)
+

+
+

+ 1.00
(43ns)
+

+
+

+ 1.16
(50ns)
+

+
+

+ 1.28
(55ns)
+

+
+

+ 1.07
(46ns)
+

+
+

+ 1.09
(47ns)
+

+
+

+ Order 13 +

+
+

+ 2.59
(114ns)
+

+
+

+ 3.20
(141ns)
+

+
+

+ 1.00
(44ns)
+

+
+

+ 1.00
(44ns)
+

+
+

+ 1.18
(52ns)
+

+
+

+ 1.14
(50ns)
+

+
+

+ 1.07
(47ns)
+

+
+

+ 1.07
(47ns)
+

+
+

+ Order 14 +

+
+

+ 2.85
(131ns)
+

+
+

+ 3.39
(156ns)
+

+
+

+ 1.00
(46ns)
+

+
+

+ 1.22
(56ns)
+

+
+

+ 1.15
(53ns)
+

+
+

+ 1.22
(56ns)
+

+
+

+ 1.04
(48ns)
+

+
+

+ 1.04
(48ns)
+

+
+

+ Order 15 +

+
+

+ 3.16
(139ns)
+

+
+

+ 3.91
(172ns)
+

+
+

+ 1.00
(44ns)
+

+
+

+ 1.07
(47ns)
+

+
+

+ 1.18
(52ns)
+

+
+

+ 1.23
(54ns)
+

+
+

+ 1.07
(47ns)
+

+
+

+ 1.07
(47ns)
+

+
+

+ Order 16 +

+
+

+ 3.43
(151ns)
+

+
+

+ 4.43
(195ns)
+

+
+

+ 1.05
(46ns)
+

+
+

+ 1.00
(44ns)
+

+
+

+ 1.16
(51ns)
+

+
+

+ 1.09
(48ns)
+

+
+

+ 1.09
(48ns)
+

+
+

+ 1.09
(48ns)
+

+
+

+ Order 17 +

+
+

+ 3.66
(161ns)
+

+
+

+ 4.89
(215ns)
+

+
+

+ 1.00
(44ns)
+

+
+

+ 1.00
(44ns)
+

+
+

+ 1.07
(47ns)
+

+
+

+ 1.07
(47ns)
+

+
+

+ 1.07
(47ns)
+

+
+

+ 1.07
(47ns)
+

+
+

+ Order 18 +

+
+

+ 3.91
(176ns)
+

+
+

+ 5.24
(236ns)
+

+
+

+ 1.02
(46ns)
+

+
+

+ 1.00
(45ns)
+

+
+

+ 1.07
(48ns)
+

+
+

+ 1.07
(48ns)
+

+
+

+ 1.07
(48ns)
+

+
+

+ 1.07
(48ns)
+

+
+

+ Order 19 +

+
+

+ 4.00
(184ns)
+

+
+

+ 5.43
(250ns)
+

+
+

+ 1.02
(47ns)
+

+
+

+ 1.00
(46ns)
+

+
+

+ 1.02
(47ns)
+

+
+

+ 1.02
(47ns)
+

+
+

+ 1.04
(48ns)
+

+
+

+ 1.02
(47ns)
+

+
+

+ Order 20 +

+
+

+ 4.40
(198ns)
+

+
+

+ 5.96
(268ns)
+

+
+

+ 1.00
(45ns)
+

+
+

+ 1.00
(45ns)
+

+
+

+ 1.07
(48ns)
+

+
+

+ 1.04
(47ns)
+

+
+

+ 1.04
(47ns)
+

+
+

+ 1.07
(48ns)
+

+
+
+
+
+
+ +
+

Table 19. Polynomial Method Comparison with Microsoft Visual C++ version 14.0 + on Windows x64

+
+++++++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ Function +

+
+

+ Method 0
(Double Coefficients) +

+
+

+ Method 0
(Integer Coefficients) +

+
+

+ Method 1
(Double Coefficients) +

+
+

+ Method 1
(Integer Coefficients) +

+
+

+ Method 2
(Double Coefficients) +

+
+

+ Method 2
(Integer Coefficients) +

+
+

+ Method 3
(Double Coefficients) +

+
+

+ Method 3
(Integer Coefficients) +

+
+

+ Order 2 +

+
+

+ - +

+
+

+ - +

+
+

+ 1.00
(9ns)
+

+
+

+ 1.00
(9ns)
+

+
+

+ 1.00
(9ns)
+

+
+

+ 1.00
(9ns)
+

+
+

+ 1.00
(9ns)
+

+
+

+ 1.00
(9ns)
+

+
+

+ Order 3 +

+
+

+ 2.08
(25ns)
+

+
+

+ 2.75
(33ns)
+

+
+

+ 1.08
(13ns)
+

+
+

+ 1.08
(13ns)
+

+
+

+ 1.08
(13ns)
+

+
+

+ 1.08
(13ns)
+

+
+

+ 1.08
(13ns)
+

+
+

+ 1.00
(12ns)
+

+
+

+ Order 4 +

+
+

+ 2.06
(35ns)
+

+
+

+ 2.71
(46ns)
+

+
+

+ 1.06
(18ns)
+

+
+

+ 1.00
(17ns)
+

+
+

+ 1.06
(18ns)
+

+
+

+ 1.06
(18ns)
+

+
+

+ 1.00
(17ns)
+

+
+

+ 1.00
(17ns)
+

+
+

+ Order 5 +

+
+

+ 1.32
(29ns)
+

+
+

+ 2.00
(44ns)
+

+
+

+ 1.00
(22ns)
+

+
+

+ 1.00
(22ns)
+

+
+

+ 1.05
(23ns)
+

+
+

+ 1.05
(23ns)
+

+
+

+ 1.05
(23ns)
+

+
+

+ 1.05
(23ns)
+

+
+

+ Order 6 +

+
+

+ 1.38
(36ns)
+

+
+

+ 2.04
(53ns)
+

+
+

+ 1.08
(28ns)
+

+
+

+ 1.00
(26ns)
+

+
+

+ 1.08
(28ns)
+

+
+

+ 1.08
(28ns)
+

+
+

+ 1.35
(35ns)
+

+
+

+ 1.38
(36ns)
+

+
+

+ Order 7 +

+
+

+ 1.43
(43ns)
+

+
+

+ 2.13
(64ns)
+

+
+

+ 1.03
(31ns)
+

+
+

+ 1.00
(30ns)
+

+
+

+ 1.10
(33ns)
+

+
+

+ 1.03
(31ns)
+

+
+

+ 1.10
(33ns)
+

+
+

+ 1.13
(34ns)
+

+
+

+ Order 8 +

+
+

+ 1.65
(61ns)
+

+
+

+ 2.22
(82ns)
+

+
+

+ 1.00
(37ns)
+

+
+

+ 1.08
(40ns)
+

+
+

+ 1.14
(42ns)
+

+
+

+ 1.05
(39ns)
+

+
+

+ 1.08
(40ns)
+

+
+

+ 1.11
(41ns)
+

+
+

+ Order 9 +

+
+

+ 1.39
(57ns)
+

+
+

+ 2.05
(84ns)
+

+
+

+ 1.17
(48ns)
+

+
+

+ 1.17
(48ns)
+

+
+

+ 1.00
(41ns)
+

+
+

+ 1.05
(43ns)
+

+
+

+ 1.15
(47ns)
+

+
+

+ 1.12
(46ns)
+

+
+

+ Order 10 +

+
+

+ 1.37
(63ns)
+

+
+

+ 2.20
(101ns)
+

+
+

+ 1.22
(56ns)
+

+
+

+ 1.24
(57ns)
+

+
+

+ 1.00
(46ns)
+

+
+

+ 1.00
(46ns)
+

+
+

+ 1.17
(54ns)
+

+
+

+ 1.17
(54ns)
+

+
+

+ Order 11 +

+
+

+ 1.59
(78ns)
+

+
+

+ 2.24
(110ns)
+

+
+

+ 1.37
(67ns)
+

+
+

+ 1.29
(63ns)
+

+
+

+ 1.22
(60ns)
+

+
+

+ 1.00
(49ns)
+

+
+

+ 1.22
(60ns)
+

+
+

+ 1.22
(60ns)
+

+
+

+ Order 12 +

+
+

+ 1.46
(83ns)
+

+
+

+ 2.16
(123ns)
+

+
+

+ 1.28
(73ns)
+

+
+

+ 1.26
(72ns)
+

+
+

+ 1.02
(58ns)
+

+
+

+ 1.00
(57ns)
+

+
+

+ 1.07
(61ns)
+

+
+

+ 1.05
(60ns)
+

+
+

+ Order 13 +

+
+

+ 1.61
(90ns)
+

+
+

+ 2.55
(143ns)
+

+
+

+ 1.32
(74ns)
+

+
+

+ 1.39
(78ns)
+

+
+

+ 1.04
(58ns)
+

+
+

+ 1.00
(56ns)
+

+
+

+ 1.11
(62ns)
+

+
+

+ 1.07
(60ns)
+

+
+

+ Order 14 +

+
+

+ 1.61
(106ns)
+

+
+

+ 2.23
(147ns)
+

+
+

+ 1.45
(96ns)
+

+
+

+ 1.45
(96ns)
+

+
+

+ 1.02
(67ns)
+

+
+

+ 1.02
(67ns)
+

+
+

+ 1.00
(66ns)
+

+
+

+ 1.09
(72ns)
+

+
+

+ Order 15 +

+
+

+ 1.49
(119ns)
+

+
+

+ 2.10
(168ns)
+

+
+

+ 1.35
(108ns)
+

+
+

+ 1.35
(108ns)
+

+
+

+ 1.00
(80ns)
+

+
+

+ 1.00
(80ns)
+

+
+

+ 1.00
(80ns)
+

+
+

+ 1.02
(82ns)
+

+
+

+ Order 16 +

+
+

+ 1.54
(129ns)
+

+
+

+ 1.99
(167ns)
+

+
+

+ 1.49
(125ns)
+

+
+

+ 1.45
(122ns)
+

+
+

+ 1.07
(90ns)
+

+
+

+ 1.00
(84ns)
+

+
+

+ 1.08
(91ns)
+

+
+

+ 1.02
(86ns)
+

+
+

+ Order 17 +

+
+

+ 1.51
(133ns)
+

+
+

+ 2.02
(178ns)
+

+
+

+ 1.57
(138ns)
+

+
+

+ 1.50
(132ns)
+

+
+

+ 1.02
(90ns)
+

+
+

+ 1.00
(88ns)
+

+
+

+ 1.07
(94ns)
+

+
+

+ 1.06
(93ns)
+

+
+

+ Order 18 +

+
+

+ 1.53
(148ns)
+

+
+

+ 2.16
(210ns)
+

+
+

+ 1.49
(145ns)
+

+
+

+ 1.57
(152ns)
+

+
+

+ 1.11
(108ns)
+

+
+

+ 1.09
(106ns)
+

+
+

+ 1.00
(97ns)
+

+
+

+ 1.08
(105ns)
+

+
+

+ Order 19 +

+
+

+ 1.90
(194ns)
+

+
+

+ 2.27
(232ns)
+

+
+

+ 1.62
(165ns)
+

+
+

+ 1.62
(165ns)
+

+
+

+ 1.08
(110ns)
+

+
+

+ 1.00
(102ns)
+

+
+

+ 1.17
(119ns)
+

+
+

+ 1.19
(121ns)
+

+
+

+ Order 20 +

+
+

+ 1.65
(206ns)
+

+
+

+ 2.08
(260ns)
+

+
+

+ 1.45
(181ns)
+

+
+

+ 1.44
(180ns)
+

+
+

+ 1.00
(125ns)
+

+
+

+ 1.00
(125ns)
+

+
+

+ 1.01
(126ns)
+

+
+

+ 1.03
(129ns)
+

+
+
+
+
+
+ +
+

Table 20. Rational Method Comparison with GNU C++ version 5.3.0 on Windows x64

+
+++++++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ Function +

+
+

+ Method 0
(Double Coefficients) +

+
+

+ Method 0
(Integer Coefficients) +

+
+

+ Method 1
(Double Coefficients) +

+
+

+ Method 1
(Integer Coefficients) +

+
+

+ Method 2
(Double Coefficients) +

+
+

+ Method 2
(Integer Coefficients) +

+
+

+ Method 3
(Double Coefficients) +

+
+

+ Method 3
(Integer Coefficients) +

+
+

+ Order 2 +

+
+

+ - +

+
+

+ - +

+
+

+ 2.00
(82ns)
+

+
+

+ 1.98
(81ns)
+

+
+

+ 1.07
(44ns)
+

+
+

+ 1.02
(42ns)
+

+
+

+ 1.02
(42ns)
+

+
+

+ 1.00
(41ns)
+

+
+

+ Order 3 +

+
+

+ 2.02
(83ns)
+

+
+

+ 2.00
(82ns)
+

+
+

+ 2.02
(83ns)
+

+
+

+ 1.98
(81ns)
+

+
+

+ 1.07
(44ns)
+

+
+

+ 1.02
(42ns)
+

+
+

+ 1.02
(42ns)
+

+
+

+ 1.00
(41ns)
+

+
+

+ Order 4 +

+
+

+ 1.98
(83ns)
+

+
+

+ 1.98
(83ns)
+

+
+

+ 1.93
(81ns)
+

+
+

+ 1.93
(81ns)
+

+
+

+ 1.00
(42ns)
+

+
+

+ 1.00
(42ns)
+

+
+

+ 1.00
(42ns)
+

+
+

+ 1.00
(42ns)
+

+
+

+ Order 5 +

+
+

+ 1.01
(83ns)
+

+
+

+ 1.10
(90ns)
+

+
+

+ 1.00
(82ns)
+

+
+

+ 1.02
(84ns)
+

+
+

+ 1.46
(120ns)
+

+
+

+ 1.46
(120ns)
+

+
+

+ 1.45
(119ns)
+

+
+

+ 1.45
(119ns)
+

+
+

+ Order 6 +

+
+

+ 1.03
(89ns)
+

+
+

+ 1.12
(96ns)
+

+
+

+ 1.00
(86ns)
+

+
+

+ 1.00
(86ns)
+

+
+

+ 1.38
(119ns)
+

+
+

+ 1.40
(120ns)
+

+
+

+ 1.40
(120ns)
+

+
+

+ 1.40
(120ns)
+

+
+

+ Order 7 +

+
+

+ 1.07
(98ns)
+

+
+

+ 1.25
(115ns)
+

+
+

+ 1.00
(92ns)
+

+
+

+ 1.04
(96ns)
+

+
+

+ 1.38
(127ns)
+

+
+

+ 1.38
(127ns)
+

+
+

+ 1.37
(126ns)
+

+
+

+ 1.36
(125ns)
+

+
+

+ Order 8 +

+
+

+ 1.08
(114ns)
+

+
+

+ 1.28
(136ns)
+

+
+

+ 1.00
(106ns)
+

+
+

+ 1.07
(113ns)
+

+
+

+ 1.20
(127ns)
+

+
+

+ 1.21
(128ns)
+

+
+

+ 1.22
(129ns)
+

+
+

+ 1.29
(137ns)
+

+
+

+ Order 9 +

+
+

+ 1.07
(131ns)
+

+
+

+ 1.27
(156ns)
+

+
+

+ 1.00
(123ns)
+

+
+

+ 1.03
(127ns)
+

+
+

+ 1.07
(132ns)
+

+
+

+ 1.08
(133ns)
+

+
+

+ 1.11
(137ns)
+

+
+

+ 1.07
(132ns)
+

+
+

+ Order 10 +

+
+

+ 1.08
(152ns)
+

+
+

+ 1.17
(165ns)
+

+
+

+ 1.01
(143ns)
+

+
+

+ 1.00
(141ns)
+

+
+

+ 1.01
(143ns)
+

+
+

+ 1.03
(145ns)
+

+
+

+ 1.02
(144ns)
+

+
+

+ 1.03
(145ns)
+

+
+

+ Order 11 +

+
+

+ 1.19
(168ns)
+

+
+

+ 1.29
(182ns)
+

+
+

+ 1.00
(141ns)
+

+
+

+ 1.03
(145ns)
+

+
+

+ 1.02
(144ns)
+

+
+

+ 1.01
(143ns)
+

+
+

+ 1.01
(143ns)
+

+
+

+ 1.01
(143ns)
+

+
+

+ Order 12 +

+
+

+ 1.43
(213ns)
+

+
+

+ 1.35
(201ns)
+

+
+

+ 1.07
(160ns)
+

+
+

+ 1.07
(159ns)
+

+
+

+ 1.03
(154ns)
+

+
+

+ 1.05
(156ns)
+

+
+

+ 1.00
(149ns)
+

+
+

+ 1.01
(150ns)
+

+
+

+ Order 13 +

+
+

+ 1.40
(222ns)
+

+
+

+ 1.34
(213ns)
+

+
+

+ 1.12
(178ns)
+

+
+

+ 1.13
(180ns)
+

+
+

+ 1.00
(159ns)
+

+
+

+ 1.01
(160ns)
+

+
+

+ 1.01
(160ns)
+

+
+

+ 1.01
(160ns)
+

+
+

+ Order 14 +

+
+

+ 1.24
(214ns)
+

+
+

+ 1.39
(239ns)
+

+
+

+ 1.17
(202ns)
+

+
+

+ 1.16
(199ns)
+

+
+

+ 1.02
(176ns)
+

+
+

+ 1.03
(177ns)
+

+
+

+ 1.00
(172ns)
+

+
+

+ 1.02
(176ns)
+

+
+

+ Order 15 +

+
+

+ 1.26
(226ns)
+

+
+

+ 1.55
(279ns)
+

+
+

+ 1.21
(218ns)
+

+
+

+ 1.26
(227ns)
+

+
+

+ 1.00
(180ns)
+

+
+

+ 1.01
(182ns)
+

+
+

+ 1.01
(182ns)
+

+
+

+ 1.01
(182ns)
+

+
+

+ Order 16 +

+
+

+ 1.26
(249ns)
+

+
+

+ 1.46
(287ns)
+

+
+

+ 1.24
(244ns)
+

+
+

+ 1.22
(240ns)
+

+
+

+ 1.01
(199ns)
+

+
+

+ 1.01
(199ns)
+

+
+

+ 1.00
(197ns)
+

+
+

+ 1.07
(210ns)
+

+
+

+ Order 17 +

+
+

+ 1.31
(264ns)
+

+
+

+ 1.56
(314ns)
+

+
+

+ 1.33
(268ns)
+

+
+

+ 1.32
(265ns)
+

+
+

+ 1.00
(201ns)
+

+
+

+ 1.02
(205ns)
+

+
+

+ 1.00
(202ns)
+

+
+

+ 1.01
(204ns)
+

+
+

+ Order 18 +

+
+

+ 1.24
(277ns)
+

+
+

+ 1.45
(323ns)
+

+
+

+ 1.28
(285ns)
+

+
+

+ 1.36
(303ns)
+

+
+

+ 1.01
(226ns)
+

+
+

+ 1.03
(229ns)
+

+
+

+ 1.02
(228ns)
+

+
+

+ 1.00
(223ns)
+

+
+

+ Order 19 +

+
+

+ 1.32
(294ns)
+

+
+

+ 1.51
(335ns)
+

+
+

+ 1.40
(310ns)
+

+
+

+ 1.41
(313ns)
+

+
+

+ 1.11
(246ns)
+

+
+

+ 1.02
(227ns)
+

+
+

+ 1.00
(223ns)
+

+
+

+ 1.00
(222ns)
+

+
+

+ Order 20 +

+
+

+ 1.26
(315ns)
+

+
+

+ 1.47
(368ns)
+

+
+

+ 1.35
(338ns)
+

+
+

+ 1.36
(339ns)
+

+
+

+ 1.07
(267ns)
+

+
+

+ 1.06
(266ns)
+

+
+

+ 1.00
(250ns)
+

+
+

+ 1.00
(251ns)
+

+
+
+
+
+
+ +
+

Table 21. Rational Method Comparison with GNU C++ version 5.3.0 on linux

+
+++++++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ Function +

+
+

+ Method 0
(Double Coefficients) +

+
+

+ Method 0
(Integer Coefficients) +

+
+

+ Method 1
(Double Coefficients) +

+
+

+ Method 1
(Integer Coefficients) +

+
+

+ Method 2
(Double Coefficients) +

+
+

+ Method 2
(Integer Coefficients) +

+
+

+ Method 3
(Double Coefficients) +

+
+

+ Method 3
(Integer Coefficients) +

+
+

+ Order 2 +

+
+

+ - +

+
+

+ - +

+
+

+ 1.95
(84ns)
+

+
+

+ 1.93
(83ns)
+

+
+

+ 1.05
(45ns)
+

+
+

+ 1.00
(43ns)
+

+
+

+ 1.05
(45ns)
+

+
+

+ 1.02
(44ns)
+

+
+

+ Order 3 +

+
+

+ 1.95
(84ns)
+

+
+

+ 1.98
(85ns)
+

+
+

+ 1.95
(84ns)
+

+
+

+ 1.98
(85ns)
+

+
+

+ 1.00
(43ns)
+

+
+

+ 1.02
(44ns)
+

+
+

+ 1.05
(45ns)
+

+
+

+ 1.02
(44ns)
+

+
+

+ Order 4 +

+
+

+ 1.93
(85ns)
+

+
+

+ 1.95
(86ns)
+

+
+

+ 1.91
(84ns)
+

+
+

+ 1.93
(85ns)
+

+
+

+ 1.00
(44ns)
+

+
+

+ 1.00
(44ns)
+

+
+

+ 1.02
(45ns)
+

+
+

+ 1.00
(44ns)
+

+
+

+ Order 5 +

+
+

+ 1.00
(85ns)
+

+
+

+ 1.08
(92ns)
+

+
+

+ 1.13
(96ns)
+

+
+

+ 1.00
(85ns)
+

+
+

+ 1.47
(125ns)
+

+
+

+ 1.49
(127ns)
+

+
+

+ 1.51
(128ns)
+

+
+

+ 1.47
(125ns)
+

+
+

+ Order 6 +

+
+

+ 1.00
(92ns)
+

+
+

+ 1.09
(100ns)
+

+
+

+ 1.03
(95ns)
+

+
+

+ 1.01
(93ns)
+

+
+

+ 1.38
(127ns)
+

+
+

+ 1.38
(127ns)
+

+
+

+ 1.35
(124ns)
+

+
+

+ 1.34
(123ns)
+

+
+

+ Order 7 +

+
+

+ 1.06
(101ns)
+

+
+

+ 1.26
(120ns)
+

+
+

+ 1.00
(95ns)
+

+
+

+ 1.00
(95ns)
+

+
+

+ 1.51
(143ns)
+

+
+

+ 1.42
(135ns)
+

+
+

+ 1.37
(130ns)
+

+
+

+ 1.37
(130ns)
+

+
+

+ Order 8 +

+
+

+ 1.20
(118ns)
+

+
+

+ 1.43
(140ns)
+

+
+

+ 1.02
(100ns)
+

+
+

+ 1.00
(98ns)
+

+
+

+ 1.35
(132ns)
+

+
+

+ 1.37
(134ns)
+

+
+

+ 1.37
(134ns)
+

+
+

+ 1.38
(135ns)
+

+
+

+ Order 9 +

+
+

+ 1.18
(136ns)
+

+
+

+ 1.36
(156ns)
+

+
+

+ 1.00
(115ns)
+

+
+

+ 1.03
(119ns)
+

+
+

+ 1.23
(141ns)
+

+
+

+ 1.26
(145ns)
+

+
+

+ 1.23
(141ns)
+

+
+

+ 1.22
(140ns)
+

+
+

+ Order 10 +

+
+

+ 1.24
(168ns)
+

+
+

+ 1.30
(175ns)
+

+
+

+ 1.00
(135ns)
+

+
+

+ 1.00
(135ns)
+

+
+

+ 1.18
(159ns)
+

+
+

+ 1.13
(152ns)
+

+
+

+ 1.15
(155ns)
+

+
+

+ 1.16
(157ns)
+

+
+

+ Order 11 +

+
+

+ 1.31
(191ns)
+

+
+

+ 1.25
(182ns)
+

+
+

+ 1.00
(146ns)
+

+
+

+ 1.02
(149ns)
+

+
+

+ 1.03
(151ns)
+

+
+

+ 1.05
(154ns)
+

+
+

+ 1.02
(149ns)
+

+
+

+ 1.05
(154ns)
+

+
+

+ Order 12 +

+
+

+ 1.23
(198ns)
+

+
+

+ 1.22
(197ns)
+

+
+

+ 1.02
(165ns)
+

+
+

+ 1.00
(161ns)
+

+
+

+ 1.03
(166ns)
+

+
+

+ 1.06
(170ns)
+

+
+

+ 1.01
(163ns)
+

+
+

+ 1.01
(163ns)
+

+
+

+ Order 13 +

+
+

+ 1.26
(211ns)
+

+
+

+ 1.32
(220ns)
+

+
+

+ 1.07
(179ns)
+

+
+

+ 1.07
(179ns)
+

+
+

+ 1.00
(167ns)
+

+
+

+ 1.01
(169ns)
+

+
+

+ 1.04
(174ns)
+

+
+

+ 1.03
(172ns)
+

+
+

+ Order 14 +

+
+

+ 1.25
(225ns)
+

+
+

+ 1.42
(255ns)
+

+
+

+ 1.16
(208ns)
+

+
+

+ 1.17
(211ns)
+

+
+

+ 1.03
(185ns)
+

+
+

+ 1.03
(185ns)
+

+
+

+ 1.00
(180ns)
+

+
+

+ 1.02
(184ns)
+

+
+

+ Order 15 +

+
+

+ 1.26
(241ns)
+

+
+

+ 1.44
(276ns)
+

+
+

+ 1.19
(229ns)
+

+
+

+ 1.24
(238ns)
+

+
+

+ 1.03
(197ns)
+

+
+

+ 1.01
(194ns)
+

+
+

+ 1.00
(192ns)
+

+
+

+ 1.00
(192ns)
+

+
+

+ Order 16 +

+
+

+ 1.23
(253ns)
+

+
+

+ 1.46
(300ns)
+

+
+

+ 1.18
(244ns)
+

+
+

+ 1.17
(241ns)
+

+
+

+ 1.01
(209ns)
+

+
+

+ 1.00
(206ns)
+

+
+

+ 1.04
(214ns)
+

+
+

+ 1.04
(214ns)
+

+
+

+ Order 17 +

+
+

+ 1.23
(268ns)
+

+
+

+ 1.43
(312ns)
+

+
+

+ 1.21
(263ns)
+

+
+

+ 1.20
(261ns)
+

+
+

+ 1.00
(218ns)
+

+
+

+ 1.04
(227ns)
+

+
+

+ 1.03
(225ns)
+

+
+

+ 1.00
(218ns)
+

+
+

+ Order 18 +

+
+

+ 1.29
(295ns)
+

+
+

+ 1.45
(332ns)
+

+
+

+ 1.19
(273ns)
+

+
+

+ 1.20
(275ns)
+

+
+

+ 1.03
(236ns)
+

+
+

+ 1.03
(237ns)
+

+
+

+ 1.00
(230ns)
+

+
+

+ 1.00
(229ns)
+

+
+

+ Order 19 +

+
+

+ 1.28
(309ns)
+

+
+

+ 1.46
(353ns)
+

+
+

+ 1.20
(291ns)
+

+
+

+ 1.22
(295ns)
+

+
+

+ 1.03
(249ns)
+

+
+

+ 1.03
(250ns)
+

+
+

+ 1.00
(242ns)
+

+
+

+ 1.04
(252ns)
+

+
+

+ Order 20 +

+
+

+ 1.24
(325ns)
+

+
+

+ 1.41
(369ns)
+

+
+

+ 1.16
(304ns)
+

+
+

+ 1.15
(300ns)
+

+
+

+ 1.01
(264ns)
+

+
+

+ 1.04
(273ns)
+

+
+

+ 1.00
(262ns)
+

+
+

+ 1.00
(263ns)
+

+
+
+
+
+
+ +
+

Table 22. Rational Method Comparison with Intel C++ C++0x mode version 1600 on + Windows x64

+
+++++++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ Function +

+
+

+ Method 0
(Double Coefficients) +

+
+

+ Method 0
(Integer Coefficients) +

+
+

+ Method 1
(Double Coefficients) +

+
+

+ Method 1
(Integer Coefficients) +

+
+

+ Method 2
(Double Coefficients) +

+
+

+ Method 2
(Integer Coefficients) +

+
+

+ Method 3
(Double Coefficients) +

+
+

+ Method 3
(Integer Coefficients) +

+
+

+ Order 2 +

+
+

+ - +

+
+

+ - +

+
+

+ 1.95
(78ns)
+

+
+

+ 1.95
(78ns)
+

+
+

+ 1.00
(40ns)
+

+
+

+ 1.00
(40ns)
+

+
+

+ 1.02
(41ns)
+

+
+

+ 1.00
(40ns)
+

+
+

+ Order 3 +

+
+

+ 3.90
(78ns)
+

+
+

+ 3.95
(79ns)
+

+
+

+ 3.90
(78ns)
+

+
+

+ 3.95
(79ns)
+

+
+

+ 1.00
(20ns)
+

+
+

+ 1.00
(20ns)
+

+
+

+ 1.00
(20ns)
+

+
+

+ 1.00
(20ns)
+

+
+

+ Order 4 +

+
+

+ 3.95
(79ns)
+

+
+

+ 4.00
(80ns)
+

+
+

+ 3.95
(79ns)
+

+
+

+ 3.95
(79ns)
+

+
+

+ 1.00
(20ns)
+

+
+

+ 1.00
(20ns)
+

+
+

+ 1.00
(20ns)
+

+
+

+ 1.00
(20ns)
+

+
+

+ Order 5 +

+
+

+ 1.01
(80ns)
+

+
+

+ 1.06
(84ns)
+

+
+

+ 1.00
(79ns)
+

+
+

+ 1.00
(79ns)
+

+
+

+ 1.48
(117ns)
+

+
+

+ 1.48
(117ns)
+

+
+

+ 1.47
(116ns)
+

+
+

+ 1.47
(116ns)
+

+
+

+ Order 6 +

+
+

+ 1.06
(86ns)
+

+
+

+ 1.19
(96ns)
+

+
+

+ 1.00
(81ns)
+

+
+

+ 1.00
(81ns)
+

+
+

+ 1.43
(116ns)
+

+
+

+ 1.43
(116ns)
+

+
+

+ 1.43
(116ns)
+

+
+

+ 1.43
(116ns)
+

+
+

+ Order 7 +

+
+

+ 1.11
(94ns)
+

+
+

+ 1.31
(111ns)
+

+
+

+ 1.00
(85ns)
+

+
+

+ 1.00
(85ns)
+

+
+

+ 1.38
(117ns)
+

+
+

+ 1.38
(117ns)
+

+
+

+ 1.38
(117ns)
+

+
+

+ 1.36
(116ns)
+

+
+

+ Order 8 +

+
+

+ 1.18
(105ns)
+

+
+

+ 1.40
(125ns)
+

+
+

+ 1.00
(89ns)
+

+
+

+ 1.00
(89ns)
+

+
+

+ 1.37
(122ns)
+

+
+

+ 1.36
(121ns)
+

+
+

+ 1.52
(135ns)
+

+
+

+ 1.53
(136ns)
+

+
+

+ Order 9 +

+
+

+ 1.28
(124ns)
+

+
+

+ 1.47
(143ns)
+

+
+

+ 1.09
(106ns)
+

+
+

+ 1.00
(97ns)
+

+
+

+ 1.31
(127ns)
+

+
+

+ 1.31
(127ns)
+

+
+

+ 1.45
(141ns)
+

+
+

+ 1.42
(138ns)
+

+
+

+ Order 10 +

+
+

+ 1.23
(135ns)
+

+
+

+ 1.45
(159ns)
+

+
+

+ 1.00
(110ns)
+

+
+

+ 1.01
(111ns)
+

+
+

+ 1.21
(133ns)
+

+
+

+ 1.20
(132ns)
+

+
+

+ 1.44
(158ns)
+

+
+

+ 1.75
(192ns)
+

+
+

+ Order 11 +

+
+

+ 1.27
(158ns)
+

+
+

+ 1.37
(170ns)
+

+
+

+ 1.00
(124ns)
+

+
+

+ 1.02
(126ns)
+

+
+

+ 1.12
(139ns)
+

+
+

+ 1.12
(139ns)
+

+
+

+ 1.29
(160ns)
+

+
+

+ 1.69
(210ns)
+

+
+

+ Order 12 +

+
+

+ 1.26
(175ns)
+

+
+

+ 1.35
(188ns)
+

+
+

+ 1.00
(139ns)
+

+
+

+ 1.00
(139ns)
+

+
+

+ 1.06
(148ns)
+

+
+

+ 1.06
(147ns)
+

+
+

+ 1.32
(183ns)
+

+
+

+ 1.60
(223ns)
+

+
+

+ Order 13 +

+
+

+ 1.69
(191ns)
+

+
+

+ 1.77
(200ns)
+

+
+

+ 1.00
(113ns)
+

+
+

+ 1.00
(113ns)
+

+
+

+ 1.01
(114ns)
+

+
+

+ 1.01
(114ns)
+

+
+

+ 1.74
(197ns)
+

+
+

+ 2.08
(235ns)
+

+
+

+ Order 14 +

+
+

+ 1.74
(203ns)
+

+
+

+ 1.86
(218ns)
+

+
+

+ 1.00
(117ns)
+

+
+

+ 1.00
(117ns)
+

+
+

+ 1.02
(119ns)
+

+
+

+ 1.09
(128ns)
+

+
+

+ 1.84
(215ns)
+

+
+

+ 2.23
(261ns)
+

+
+

+ Order 15 +

+
+

+ 1.81
(219ns)
+

+
+

+ 1.93
(233ns)
+

+
+

+ 1.00
(121ns)
+

+
+

+ 1.00
(121ns)
+

+
+

+ 1.02
(123ns)
+

+
+

+ 1.03
(125ns)
+

+
+

+ 1.83
(222ns)
+

+
+

+ 2.31
(280ns)
+

+
+

+ Order 16 +

+
+

+ 1.85
(231ns)
+

+
+

+ 2.01
(251ns)
+

+
+

+ 1.00
(125ns)
+

+
+

+ 1.00
(125ns)
+

+
+

+ 1.03
(129ns)
+

+
+

+ 1.02
(128ns)
+

+
+

+ 1.89
(236ns)
+

+
+

+ 2.49
(311ns)
+

+
+

+ Order 17 +

+
+

+ 1.85
(241ns)
+

+
+

+ 2.11
(274ns)
+

+
+

+ 1.00
(130ns)
+

+
+

+ 1.04
(135ns)
+

+
+

+ 1.00
(130ns)
+

+
+

+ 1.02
(133ns)
+

+
+

+ 1.87
(243ns)
+

+
+

+ 2.48
(323ns)
+

+
+

+ Order 18 +

+
+

+ 1.90
(254ns)
+

+
+

+ 2.25
(301ns)
+

+
+

+ 1.03
(138ns)
+

+
+

+ 1.01
(135ns)
+

+
+

+ 1.01
(136ns)
+

+
+

+ 1.00
(134ns)
+

+
+

+ 1.92
(257ns)
+

+
+

+ 2.59
(347ns)
+

+
+

+ Order 19 +

+
+

+ 2.04
(278ns)
+

+
+

+ 2.33
(317ns)
+

+
+

+ 1.07
(145ns)
+

+
+

+ 4.06
(552ns)
+

+
+

+ 1.00
(136ns)
+

+
+

+ 1.04
(142ns)
+

+
+

+ 1.93
(263ns)
+

+
+

+ 2.68
(364ns)
+

+
+

+ Order 20 +

+
+

+ 2.14
(295ns)
+

+
+

+ 2.43
(336ns)
+

+
+

+ 1.07
(147ns)
+

+
+

+ 4.12
(568ns)
+

+
+

+ 1.00
(138ns)
+

+
+

+ 3.06
(422ns)
+

+
+

+ 1.86
(256ns)
+

+
+

+ 2.85
(393ns)
+

+
+
+
+
+
+ +
+

Table 23. Rational Method Comparison with Microsoft Visual C++ version 14.0 on + Windows x64

+
+++++++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ Function +

+
+

+ Method 0
(Double Coefficients) +

+
+

+ Method 0
(Integer Coefficients) +

+
+

+ Method 1
(Double Coefficients) +

+
+

+ Method 1
(Integer Coefficients) +

+
+

+ Method 2
(Double Coefficients) +

+
+

+ Method 2
(Integer Coefficients) +

+
+

+ Method 3
(Double Coefficients) +

+
+

+ Method 3
(Integer Coefficients) +

+
+

+ Order 2 +

+
+

+ - +

+
+

+ - +

+
+

+ 2.12
(89ns)
+

+
+

+ 1.95
(82ns)
+

+
+

+ 1.00
(42ns)
+

+
+

+ 1.00
(42ns)
+

+
+

+ 1.00
(42ns)
+

+
+

+ 1.00
(42ns)
+

+
+

+ Order 3 +

+
+

+ 2.10
(88ns)
+

+
+

+ 2.10
(88ns)
+

+
+

+ 2.05
(86ns)
+

+
+

+ 2.10
(88ns)
+

+
+

+ 1.05
(44ns)
+

+
+

+ 1.00
(42ns)
+

+
+

+ 1.00
(42ns)
+

+
+

+ 1.00
(42ns)
+

+
+

+ Order 4 +

+
+

+ 2.12
(89ns)
+

+
+

+ 2.21
(93ns)
+

+
+

+ 1.98
(83ns)
+

+
+

+ 2.10
(88ns)
+

+
+

+ 1.02
(43ns)
+

+
+

+ 1.02
(43ns)
+

+
+

+ 1.02
(43ns)
+

+
+

+ 1.00
(42ns)
+

+
+

+ Order 5 +

+
+

+ 1.07
(90ns)
+

+
+

+ 1.15
(97ns)
+

+
+

+ 1.08
(91ns)
+

+
+

+ 1.00
(84ns)
+

+
+

+ 1.45
(122ns)
+

+
+

+ 1.46
(123ns)
+

+
+

+ 1.45
(122ns)
+

+
+

+ 1.45
(122ns)
+

+
+

+ Order 6 +

+
+

+ 1.16
(102ns)
+

+
+

+ 1.58
(139ns)
+

+
+

+ 1.00
(88ns)
+

+
+

+ 1.03
(91ns)
+

+
+

+ 1.44
(127ns)
+

+
+

+ 1.44
(127ns)
+

+
+

+ 1.41
(124ns)
+

+
+

+ 1.38
(121ns)
+

+
+

+ Order 7 +

+
+

+ 1.29
(121ns)
+

+
+

+ 1.44
(135ns)
+

+
+

+ 1.01
(95ns)
+

+
+

+ 1.00
(94ns)
+

+
+

+ 1.38
(130ns)
+

+
+

+ 1.36
(128ns)
+

+
+

+ 1.33
(125ns)
+

+
+

+ 1.36
(128ns)
+

+
+

+ Order 8 +

+
+

+ 1.33
(134ns)
+

+
+

+ 1.52
(154ns)
+

+
+

+ 1.00
(101ns)
+

+
+

+ 1.08
(109ns)
+

+
+

+ 1.38
(139ns)
+

+
+

+ 1.31
(132ns)
+

+
+

+ 1.39
(140ns)
+

+
+

+ 1.37
(138ns)
+

+
+

+ Order 9 +

+
+

+ 1.18
(141ns)
+

+
+

+ 1.45
(172ns)
+

+
+

+ 1.00
(119ns)
+

+
+

+ 1.08
(128ns)
+

+
+

+ 1.13
(135ns)
+

+
+

+ 1.26
(150ns)
+

+
+

+ 1.26
(150ns)
+

+
+

+ 1.27
(151ns)
+

+
+

+ Order 10 +

+
+

+ 1.29
(180ns)
+

+
+

+ 1.28
(178ns)
+

+
+

+ 1.05
(146ns)
+

+
+

+ 1.00
(139ns)
+

+
+

+ 1.06
(147ns)
+

+
+

+ 1.06
(147ns)
+

+
+

+ 1.18
(164ns)
+

+
+

+ 1.17
(163ns)
+

+
+

+ Order 11 +

+
+

+ 1.28
(187ns)
+

+
+

+ 1.28
(187ns)
+

+
+

+ 1.06
(155ns)
+

+
+

+ 1.05
(154ns)
+

+
+

+ 1.03
(151ns)
+

+
+

+ 1.00
(146ns)
+

+
+

+ 1.19
(174ns)
+

+
+

+ 1.47
(215ns)
+

+
+

+ Order 12 +

+
+

+ 1.22
(197ns)
+

+
+

+ 1.38
(223ns)
+

+
+

+ 1.04
(168ns)
+

+
+

+ 1.04
(169ns)
+

+
+

+ 1.00
(162ns)
+

+
+

+ 1.04
(169ns)
+

+
+

+ 1.22
(198ns)
+

+
+

+ 1.52
(246ns)
+

+
+

+ Order 13 +

+
+

+ 1.23
(209ns)
+

+
+

+ 1.29
(220ns)
+

+
+

+ 1.15
(196ns)
+

+
+

+ 1.10
(187ns)
+

+
+

+ 1.00
(170ns)
+

+
+

+ 1.15
(196ns)
+

+
+

+ 1.22
(208ns)
+

+
+

+ 1.61
(273ns)
+

+
+

+ Order 14 +

+
+

+ 1.28
(242ns)
+

+
+

+ 1.39
(262ns)
+

+
+

+ 1.15
(218ns)
+

+
+

+ 1.14
(216ns)
+

+
+

+ 1.00
(189ns)
+

+
+

+ 1.01
(191ns)
+

+
+

+ 1.49
(282ns)
+

+
+

+ 1.53
(290ns)
+

+
+

+ Order 15 +

+
+

+ 1.28
(260ns)
+

+
+

+ 1.34
(273ns)
+

+
+

+ 1.12
(227ns)
+

+
+

+ 1.15
(233ns)
+

+
+

+ 1.00
(203ns)
+

+
+

+ 1.00
(203ns)
+

+
+

+ 1.38
(280ns)
+

+
+

+ 1.47
(298ns)
+

+
+

+ Order 16 +

+
+

+ 1.35
(288ns)
+

+
+

+ 1.40
(300ns)
+

+
+

+ 1.22
(261ns)
+

+
+

+ 1.18
(252ns)
+

+
+

+ 1.00
(214ns)
+

+
+

+ 1.23
(264ns)
+

+
+

+ 1.43
(305ns)
+

+
+

+ 1.52
(325ns)
+

+
+

+ Order 17 +

+
+

+ 1.16
(259ns)
+

+
+

+ 1.47
(328ns)
+

+
+

+ 1.15
(256ns)
+

+
+

+ 1.35
(302ns)
+

+
+

+ 1.00
(223ns)
+

+
+

+ 1.22
(273ns)
+

+
+

+ 1.50
(334ns)
+

+
+

+ 1.52
(339ns)
+

+
+

+ Order 18 +

+
+

+ 1.10
(273ns)
+

+
+

+ 1.46
(363ns)
+

+
+

+ 1.10
(273ns)
+

+
+

+ 1.75
(434ns)
+

+
+

+ 1.00
(248ns)
+

+
+

+ 1.30
(322ns)
+

+
+

+ 1.41
(349ns)
+

+
+

+ 1.46
(363ns)
+

+
+

+ Order 19 +

+
+

+ 1.26
(330ns)
+

+
+

+ 1.35
(352ns)
+

+
+

+ 1.24
(324ns)
+

+
+

+ 1.33
(348ns)
+

+
+

+ 1.00
(261ns)
+

+
+

+ 1.22
(319ns)
+

+
+

+ 1.44
(377ns)
+

+
+

+ 1.46
(381ns)
+

+
+

+ Order 20 +

+
+

+ 1.24
(330ns)
+

+
+

+ 1.60
(427ns)
+

+
+

+ 1.22
(327ns)
+

+
+

+ 1.56
(416ns)
+

+
+

+ 1.00
(267ns)
+

+
+

+ 1.19
(317ns)
+

+
+

+ 1.57
(418ns)
+

+
+

+ 1.56
(416ns)
+

+
+
+
+
+
+ +
+

Table 24. gcd method comparison with Clang version 3.8.0 (trunk 256686) on linux

+
++++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ Function +

+
+

+ Stein_gcd boost 1.61 +

+
+

+ Euclid_gcd boost 1.61 +

+
+

+ Stein_gcd_textbook boost 1.61 +

+
+

+ gcd_euclid_textbook boost 1.61 +

+
+

+ mixed_binary_gcd boost 1.61 +

+
+

+ gcd<boost::multiprecision::uint1024_t> (Trivial cases) +

+
+

+ 2.90
(2168ns)
+

+
+

+ 1.06
(789ns)
+

+
+

+ 1.44
(1076ns)
+

+
+

+ 1.00
(747ns)
+

+
+

+ 1.02
(765ns)
+

+
+

+ gcd<boost::multiprecision::uint1024_t> (adjacent Fibonacci + numbers) +

+
+

+ 1.94
(31316360ns)
+

+
+

+ 3.87
(62642261ns)
+

+
+

+ 1.51
(24472987ns)
+

+
+

+ 3.83
(61916324ns)
+

+
+

+ 1.00
(16179799ns)
+

+
+

+ gcd<boost::multiprecision::uint1024_t> (permutations of Fibonacci + numbers) +

+
+

+ 11.97
(18043652628ns)
+

+
+

+ 1.00
(1507174851ns)
+

+
+

+ 9.58
(14431204875ns)
+

+
+

+ 1.02
(1531576481ns)
+

+
+

+ 1.64
(2465688542ns)
+

+
+

+ gcd<boost::multiprecision::uint1024_t> (random prime number + products) +

+
+

+ 4.83
(4723442ns)
+

+
+

+ 1.28
(1251922ns)
+

+
+

+ 3.98
(3887583ns)
+

+
+

+ 1.32
(1287721ns)
+

+
+

+ 1.00
(977931ns)
+

+
+

+ gcd<boost::multiprecision::uint1024_t> (uniform random numbers) +

+
+

+ 1.74
(124484347ns)
+

+
+

+ 1.35
(96356140ns)
+

+
+

+ 1.36
(97020965ns)
+

+
+

+ 1.28
(91336905ns)
+

+
+

+ 1.00
(71465869ns)
+

+
+

+ gcd<boost::multiprecision::uint256_t> (Trivial cases) +

+
+

+ 3.65
(1972ns)
+

+
+

+ 1.15
(622ns)
+

+
+

+ 1.59
(860ns)
+

+
+

+ 1.00
(540ns)
+

+
+

+ 1.04
(563ns)
+

+
+

+ gcd<boost::multiprecision::uint256_t> (adjacent Fibonacci numbers) +

+
+

+ 2.08
(17450117ns)
+

+
+

+ 1.97
(16495829ns)
+

+
+

+ 1.53
(12849563ns)
+

+
+

+ 1.94
(16231394ns)
+

+
+

+ 1.00
(8381691ns)
+

+
+

+ gcd<boost::multiprecision::uint256_t> (permutations of Fibonacci + numbers) +

+
+

+ 2.49
(9126691475ns)
+

+
+

+ 1.38
(5069244283ns)
+

+
+

+ 1.86
(6804097262ns)
+

+
+

+ 1.40
(5124612784ns)
+

+
+

+ 1.00
(3667503540ns)
+

+
+

+ gcd<boost::multiprecision::uint256_t> (random prime number + products) +

+
+

+ 4.95
(4874581ns)
+

+
+

+ 1.24
(1225945ns)
+

+
+

+ 3.86
(3806213ns)
+

+
+

+ 1.23
(1210277ns)
+

+
+

+ 1.00
(985502ns)
+

+
+

+ gcd<boost::multiprecision::uint256_t> (uniform random numbers) +

+
+

+ 1.85
(22005838ns)
+

+
+

+ 1.38
(16479606ns)
+

+
+

+ 1.41
(16807035ns)
+

+
+

+ 1.39
(16496596ns)
+

+
+

+ 1.00
(11900084ns)
+

+
+

+ gcd<boost::multiprecision::uint512_t> (Trivial cases) +

+
+

+ 3.36
(2013ns)
+

+
+

+ 1.07
(642ns)
+

+
+

+ 1.53
(916ns)
+

+
+

+ 1.00
(599ns)
+

+
+

+ 1.05
(626ns)
+

+
+

+ gcd<boost::multiprecision::uint512_t> (adjacent Fibonacci numbers) +

+
+

+ 2.04
(30307983ns)
+

+
+

+ 2.80
(41616297ns)
+

+
+

+ 1.47
(21863333ns)
+

+
+

+ 2.71
(40178640ns)
+

+
+

+ 1.00
(14839571ns)
+

+
+

+ gcd<boost::multiprecision::uint512_t> (permutations of Fibonacci + numbers) +

+
+

+ 3.83
(16865014424ns)
+

+
+

+ 1.32
(5812976738ns)
+

+
+

+ 2.82
(12405385177ns)
+

+
+

+ 1.25
(5504816915ns)
+

+
+

+ 1.00
(4400311295ns)
+

+
+

+ gcd<boost::multiprecision::uint512_t> (random prime number + products) +

+
+

+ 4.73
(5052367ns)
+

+
+

+ 1.28
(1366348ns)
+

+
+

+ 3.75
(4007526ns)
+

+
+

+ 1.26
(1344357ns)
+

+
+

+ 1.00
(1067390ns)
+

+
+

+ gcd<boost::multiprecision::uint512_t> (uniform random numbers) +

+
+

+ 1.81
(51516027ns)
+

+
+

+ 1.41
(40297849ns)
+

+
+

+ 1.29
(36761270ns)
+

+
+

+ 1.38
(39294531ns)
+

+
+

+ 1.00
(28540198ns)
+

+
+

+ gcd<unsigned long long> (Trivial cases) +

+
+

+ 1.16
(142ns)
+

+
+

+ 1.32
(161ns)
+

+
+

+ 1.47
(179ns)
+

+
+

+ 1.09
(133ns)
+

+
+

+ 1.00
(122ns)
+

+
+

+ gcd<unsigned long long> (adjacent Fibonacci numbers) +

+
+

+ 1.00
(11337ns)
+

+
+

+ 7.82
(88645ns)
+

+
+

+ 3.32
(37618ns)
+

+
+

+ 8.27
(93731ns)
+

+
+

+ 1.79
(20288ns)
+

+
+

+ gcd<unsigned long long> (permutations of Fibonacci numbers) +

+
+

+ 2.27
(3094725ns)
+

+
+

+ 1.15
(1564746ns)
+

+
+

+ 3.68
(5018874ns)
+

+
+

+ 1.10
(1504161ns)
+

+
+

+ 1.00
(1365661ns)
+

+
+

+ gcd<unsigned long long> (random prime number products) +

+
+

+ 1.44
(563322ns)
+

+
+

+ 1.15
(448479ns)
+

+
+

+ 2.40
(938942ns)
+

+
+

+ 1.12
(439560ns)
+

+
+

+ 1.00
(391207ns)
+

+
+

+ gcd<unsigned long long> (uniform random numbers) +

+
+

+ 1.00
(718895ns)
+

+
+

+ 1.10
(791723ns)
+

+
+

+ 1.70
(1224803ns)
+

+
+

+ 1.09
(781750ns)
+

+
+

+ 1.03
(737606ns)
+

+
+

+ gcd<unsigned long> (Trivial cases) +

+
+

+ 1.06
(128ns)
+

+
+

+ 1.38
(167ns)
+

+
+

+ 1.57
(190ns)
+

+
+

+ 1.07
(129ns)
+

+
+

+ 1.00
(121ns)
+

+
+

+ gcd<unsigned long> (adjacent Fibonacci numbers) +

+
+

+ 1.00
(11188ns)
+

+
+

+ 7.89
(88300ns)
+

+
+

+ 3.06
(34190ns)
+

+
+

+ 7.84
(87699ns)
+

+
+

+ 1.80
(20152ns)
+

+
+

+ gcd<unsigned long> (permutations of Fibonacci numbers) +

+
+

+ 2.33
(3012118ns)
+

+
+

+ 1.22
(1578276ns)
+

+
+

+ 3.70
(4788935ns)
+

+
+

+ 1.17
(1512843ns)
+

+
+

+ 1.00
(1293335ns)
+

+
+

+ gcd<unsigned long> (random prime number products) +

+
+

+ 1.44
(547427ns)
+

+
+

+ 1.18
(447239ns)
+

+
+

+ 2.30
(876396ns)
+

+
+

+ 1.16
(440962ns)
+

+
+

+ 1.00
(380492ns)
+

+
+

+ gcd<unsigned long> (uniform random numbers) +

+
+

+ 1.01
(706547ns)
+

+
+

+ 1.13
(788922ns)
+

+
+

+ 1.65
(1154470ns)
+

+
+

+ 1.11
(777950ns)
+

+
+

+ 1.00
(697913ns)
+

+
+

+ gcd<unsigned short> (Trivial cases) +

+
+

+ 1.67
(132ns)
+

+
+

+ 1.09
(86ns)
+

+
+

+ 2.48
(196ns)
+

+
+

+ 1.00
(79ns)
+

+
+

+ 1.20
(95ns)
+

+
+

+ gcd<unsigned short> (adjacent Fibonacci numbers) +

+
+

+ 1.00
(1059ns)
+

+
+

+ 3.86
(4088ns)
+

+
+

+ 2.15
(2277ns)
+

+
+

+ 3.43
(3632ns)
+

+
+

+ 1.20
(1276ns)
+

+
+

+ gcd<unsigned short> (permutations of Fibonacci numbers) +

+
+

+ 1.41
(22350ns)
+

+
+

+ 1.66
(26480ns)
+

+
+

+ 3.80
(60467ns)
+

+
+

+ 1.58
(25159ns)
+

+
+

+ 1.00
(15906ns)
+

+
+

+ gcd<unsigned short> (random prime number products) +

+
+

+ 1.57
(153466ns)
+

+
+

+ 1.12
(109188ns)
+

+
+

+ 2.63
(256492ns)
+

+
+

+ 1.00
(97526ns)
+

+
+

+ 1.07
(103893ns)
+

+
+

+ gcd<unsigned short> (uniform random numbers) +

+
+

+ 1.31
(190489ns)
+

+
+

+ 1.07
(156183ns)
+

+
+

+ 2.18
(317399ns)
+

+
+

+ 1.00
(145520ns)
+

+
+

+ 1.01
(147682ns)
+

+
+

+ gcd<unsigned> (Trivial cases) +

+
+

+ 1.53
(130ns)
+

+
+

+ 1.05
(89ns)
+

+
+

+ 2.08
(177ns)
+

+
+

+ 1.00
(85ns)
+

+
+

+ 1.07
(91ns)
+

+
+

+ gcd<unsigned> (adjacent Fibonacci numbers) +

+
+

+ 1.00
(2757ns)
+

+
+

+ 5.15
(14202ns)
+

+
+

+ 3.01
(8301ns)
+

+
+

+ 5.12
(14103ns)
+

+
+

+ 1.19
(3271ns)
+

+
+

+ gcd<unsigned> (permutations of Fibonacci numbers) +

+
+

+ 2.65
(341353ns)
+

+
+

+ 1.41
(181367ns)
+

+
+

+ 4.61
(594132ns)
+

+
+

+ 1.35
(173905ns)
+

+
+

+ 1.00
(128782ns)
+

+
+

+ gcd<unsigned> (random prime number products) +

+
+

+ 1.62
(291727ns)
+

+
+

+ 1.06
(190741ns)
+

+
+

+ 2.73
(490180ns)
+

+
+

+ 1.04
(187255ns)
+

+
+

+ 1.00
(179681ns)
+

+
+

+ gcd<unsigned> (uniform random numbers) +

+
+

+ 1.26
(352457ns)
+

+
+

+ 1.03
(288254ns)
+

+
+

+ 2.17
(607171ns)
+

+
+

+ 1.00
(280216ns)
+

+
+

+ 1.02
(286875ns)
+

+
+
+
+
+
+ +
+

Table 25. gcd method comparison with GNU C++ version 5.3.0 on linux

+
++++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ Function +

+
+

+ Stein_gcd boost 1.61 +

+
+

+ Euclid_gcd boost 1.61 +

+
+

+ Stein_gcd_textbook boost 1.61 +

+
+

+ gcd_euclid_textbook boost 1.61 +

+
+

+ mixed_binary_gcd boost 1.61 +

+
+

+ gcd<boost::multiprecision::uint1024_t> (Trivial cases) +

+
+

+ 3.13
(2802ns)
+

+
+

+ 1.00
(895ns)
+

+
+

+ 1.44
(1286ns)
+

+
+

+ 1.14
(1016ns)
+

+
+

+ 1.02
(914ns)
+

+
+

+ gcd<boost::multiprecision::uint1024_t> (adjacent Fibonacci + numbers) +

+
+

+ 2.31
(41775723ns)
+

+
+

+ 3.87
(69955770ns)
+

+
+

+ 1.54
(27777726ns)
+

+
+

+ 4.68
(84599574ns)
+

+
+

+ 1.00
(18077291ns)
+

+
+

+ gcd<boost::multiprecision::uint1024_t> (permutations of Fibonacci + numbers) +

+
+

+ 14.78
(23241632149ns)
+

+
+

+ 1.00
(1572425270ns)
+

+
+

+ 10.27
(16142366056ns)
+

+
+

+ 1.22
(1911988140ns)
+

+
+

+ 1.66
(2606038259ns)
+

+
+

+ gcd<boost::multiprecision::uint1024_t> (random prime number + products) +

+
+

+ 6.05
(6355783ns)
+

+
+

+ 1.28
(1346702ns)
+

+
+

+ 4.27
(4483024ns)
+

+
+

+ 1.75
(1832606ns)
+

+
+

+ 1.00
(1049715ns)
+

+
+

+ gcd<boost::multiprecision::uint1024_t> (uniform random numbers) +

+
+

+ 1.91
(147141332ns)
+

+
+

+ 1.40
(107633586ns)
+

+
+

+ 1.35
(103810056ns)
+

+
+

+ 1.65
(126771843ns)
+

+
+

+ 1.00
(76852875ns)
+

+
+

+ gcd<boost::multiprecision::uint256_t> (Trivial cases) +

+
+

+ 3.92
(2186ns)
+

+
+

+ 1.00
(558ns)
+

+
+

+ 1.54
(862ns)
+

+
+

+ 1.00
(558ns)
+

+
+

+ 1.03
(572ns)
+

+
+

+ gcd<boost::multiprecision::uint256_t> (adjacent Fibonacci numbers) +

+
+

+ 1.92
(17235572ns)
+

+
+

+ 1.89
(16956962ns)
+

+
+

+ 1.24
(11155401ns)
+

+
+

+ 2.17
(19466812ns)
+

+
+

+ 1.00
(8964083ns)
+

+
+

+ gcd<boost::multiprecision::uint256_t> (permutations of Fibonacci + numbers) +

+
+

+ 2.45
(9417422440ns)
+

+
+

+ 1.37
(5269990456ns)
+

+
+

+ 1.58
(6081011309ns)
+

+
+

+ 1.57
(6044479950ns)
+

+
+

+ 1.00
(3841778329ns)
+

+
+

+ gcd<boost::multiprecision::uint256_t> (random prime number + products) +

+
+

+ 4.87
(4919066ns)
+

+
+

+ 1.22
(1236082ns)
+

+
+

+ 3.29
(3328411ns)
+

+
+

+ 1.43
(1447819ns)
+

+
+

+ 1.00
(1011109ns)
+

+
+

+ gcd<boost::multiprecision::uint256_t> (uniform random numbers) +

+
+

+ 1.83
(22425804ns)
+

+
+

+ 1.40
(17164135ns)
+

+
+

+ 1.19
(14545436ns)
+

+
+

+ 1.63
(19976038ns)
+

+
+

+ 1.00
(12252895ns)
+

+
+

+ gcd<boost::multiprecision::uint512_t> (Trivial cases) +

+
+

+ 3.43
(2342ns)
+

+
+

+ 1.00
(683ns)
+

+
+

+ 1.33
(911ns)
+

+
+

+ 1.00
(686ns)
+

+
+

+ 1.00
(683ns)
+

+
+

+ gcd<boost::multiprecision::uint512_t> (adjacent Fibonacci numbers) +

+
+

+ 1.95
(32049761ns)
+

+
+

+ 2.76
(45352231ns)
+

+
+

+ 1.28
(20998111ns)
+

+
+

+ 3.06
(50350772ns)
+

+
+

+ 1.00
(16436491ns)
+

+
+

+ gcd<boost::multiprecision::uint512_t> (permutations of Fibonacci + numbers) +

+
+

+ 3.55
(17112372205ns)
+

+
+

+ 1.23
(5911837749ns)
+

+
+

+ 2.50
(12050581754ns)
+

+
+

+ 1.41
(6807285781ns)
+

+
+

+ 1.00
(4825798492ns)
+

+
+

+ gcd<boost::multiprecision::uint512_t> (random prime number + products) +

+
+

+ 4.50
(5057957ns)
+

+
+

+ 1.24
(1389638ns)
+

+
+

+ 3.14
(3534092ns)
+

+
+

+ 1.46
(1639899ns)
+

+
+

+ 1.00
(1125162ns)
+

+
+

+ gcd<boost::multiprecision::uint512_t> (uniform random numbers) +

+
+

+ 1.73
(54047618ns)
+

+
+

+ 1.41
(43900144ns)
+

+
+

+ 1.18
(36748862ns)
+

+
+

+ 1.59
(49619900ns)
+

+
+

+ 1.00
(31215862ns)
+

+
+

+ gcd<unsigned long long> (Trivial cases) +

+
+

+ 1.00
(126ns)
+

+
+

+ 1.39
(175ns)
+

+
+

+ 1.25
(157ns)
+

+
+

+ 1.13
(142ns)
+

+
+

+ 1.08
(136ns)
+

+
+

+ gcd<unsigned long long> (adjacent Fibonacci numbers) +

+
+

+ 1.00
(9128ns)
+

+
+

+ 9.71
(88614ns)
+

+
+

+ 1.42
(12990ns)
+

+
+

+ 9.53
(86978ns)
+

+
+

+ 2.05
(18728ns)
+

+
+

+ gcd<unsigned long long> (permutations of Fibonacci numbers) +

+
+

+ 2.35
(3279425ns)
+

+
+

+ 1.13
(1572402ns)
+

+
+

+ 1.97
(2742654ns)
+

+
+

+ 1.09
(1514923ns)
+

+
+

+ 1.00
(1393889ns)
+

+
+

+ gcd<unsigned long long> (random prime number products) +

+
+

+ 1.47
(602247ns)
+

+
+

+ 1.10
(447959ns)
+

+
+

+ 1.24
(506832ns)
+

+
+

+ 1.08
(442637ns)
+

+
+

+ 1.00
(408504ns)
+

+
+

+ gcd<unsigned long long> (uniform random numbers) +

+
+

+ 1.16
(782472ns)
+

+
+

+ 1.16
(781423ns)
+

+
+

+ 1.00
(672974ns)
+

+
+

+ 1.16
(779270ns)
+

+
+

+ 1.10
(742312ns)
+

+
+

+ gcd<unsigned long> (Trivial cases) +

+
+

+ 1.00
(112ns)
+

+
+

+ 1.42
(159ns)
+

+
+

+ 1.22
(137ns)
+

+
+

+ 1.21
(135ns)
+

+
+

+ 1.21
(135ns)
+

+
+

+ gcd<unsigned long> (adjacent Fibonacci numbers) +

+
+

+ 1.00
(10253ns)
+

+
+

+ 8.66
(88746ns)
+

+
+

+ 1.31
(13391ns)
+

+
+

+ 8.51
(87217ns)
+

+
+

+ 1.79
(18361ns)
+

+
+

+ gcd<unsigned long> (permutations of Fibonacci numbers) +

+
+

+ 2.35
(3271184ns)
+

+
+

+ 1.13
(1576470ns)
+

+
+

+ 1.99
(2761823ns)
+

+
+

+ 1.10
(1524202ns)
+

+
+

+ 1.00
(1391168ns)
+

+
+

+ gcd<unsigned long> (random prime number products) +

+
+

+ 1.45
(597876ns)
+

+
+

+ 1.08
(446057ns)
+

+
+

+ 1.22
(501704ns)
+

+
+

+ 1.08
(445617ns)
+

+
+

+ 1.00
(412184ns)
+

+
+

+ gcd<unsigned long> (uniform random numbers) +

+
+

+ 1.18
(794630ns)
+

+
+

+ 1.18
(793453ns)
+

+
+

+ 1.00
(675176ns)
+

+
+

+ 1.17
(791469ns)
+

+
+

+ 1.15
(775141ns)
+

+
+

+ gcd<unsigned short> (Trivial cases) +

+
+

+ 1.37
(127ns)
+

+
+

+ 1.01
(94ns)
+

+
+

+ 1.65
(153ns)
+

+
+

+ 1.00
(93ns)
+

+
+

+ 1.15
(107ns)
+

+
+

+ gcd<unsigned short> (adjacent Fibonacci numbers) +

+
+

+ 1.00
(647ns)
+

+
+

+ 4.94
(3195ns)
+

+
+

+ 1.85
(1197ns)
+

+
+

+ 4.80
(3103ns)
+

+
+

+ 1.26
(814ns)
+

+
+

+ gcd<unsigned short> (permutations of Fibonacci numbers) +

+
+

+ 2.18
(23922ns)
+

+
+

+ 2.18
(23937ns)
+

+
+

+ 3.25
(35622ns)
+

+
+

+ 2.02
(22184ns)
+

+
+

+ 1.00
(10975ns)
+

+
+

+ gcd<unsigned short> (random prime number products) +

+
+

+ 1.76
(164869ns)
+

+
+

+ 1.06
(99310ns)
+

+
+

+ 1.75
(163857ns)
+

+
+

+ 1.00
(93720ns)
+

+
+

+ 1.03
(96506ns)
+

+
+

+ gcd<unsigned short> (uniform random numbers) +

+
+

+ 1.49
(207037ns)
+

+
+

+ 1.03
(143353ns)
+

+
+

+ 1.49
(206536ns)
+

+
+

+ 1.00
(138705ns)
+

+
+

+ 1.05
(145798ns)
+

+
+

+ gcd<unsigned> (Trivial cases) +

+
+

+ 1.33
(118ns)
+

+
+

+ 1.04
(93ns)
+

+
+

+ 1.66
(148ns)
+

+
+

+ 1.00
(89ns)
+

+
+

+ 1.11
(99ns)
+

+
+

+ gcd<unsigned> (adjacent Fibonacci numbers) +

+
+

+ 1.00
(1828ns)
+

+
+

+ 8.08
(14770ns)
+

+
+

+ 2.43
(4441ns)
+

+
+

+ 7.29
(13321ns)
+

+
+

+ 1.48
(2706ns)
+

+
+

+ gcd<unsigned> (permutations of Fibonacci numbers) +

+
+

+ 2.12
(350485ns)
+

+
+

+ 1.16
(190884ns)
+

+
+

+ 2.17
(359150ns)
+

+
+

+ 1.03
(170124ns)
+

+
+

+ 1.00
(165174ns)
+

+
+

+ gcd<unsigned> (random prime number products) +

+
+

+ 1.73
(316056ns)
+

+
+

+ 1.09
(199210ns)
+

+
+

+ 1.61
(295756ns)
+

+
+

+ 1.00
(183139ns)
+

+
+

+ 1.24
(226528ns)
+

+
+

+ gcd<unsigned> (uniform random numbers) +

+
+

+ 1.37
(389398ns)
+

+
+

+ 1.03
(293115ns)
+

+
+

+ 1.32
(375314ns)
+

+
+

+ 1.00
(284048ns)
+

+
+

+ 1.24
(352400ns)
+

+
+
+
+
+
+ +
+

Table 26. gcd method comparison with Intel C++ C++0x mode version 1500 on linux

+
++++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ Function +

+
+

+ Stein_gcd boost 1.61 +

+
+

+ Euclid_gcd boost 1.61 +

+
+

+ Stein_gcd_textbook boost 1.61 +

+
+

+ gcd_euclid_textbook boost 1.61 +

+
+

+ mixed_binary_gcd boost 1.61 +

+
+

+ gcd<boost::multiprecision::uint1024_t> (Trivial cases) +

+
+

+ 4.77
(4641ns)
+

+
+

+ 1.01
(980ns)
+

+
+

+ 2.10
(2043ns)
+

+
+

+ 1.00
(973ns)
+

+
+

+ 2.02
(1970ns)
+

+
+

+ gcd<boost::multiprecision::uint1024_t> (adjacent Fibonacci + numbers) +

+
+

+ 2.08
(58154864ns)
+

+
+

+ 2.50
(69904918ns)
+

+
+

+ 1.33
(37216550ns)
+

+
+

+ 2.71
(75796697ns)
+

+
+

+ 1.00
(27972451ns)
+

+
+

+ gcd<boost::multiprecision::uint1024_t> (permutations of Fibonacci + numbers) +

+
+

+ 19.48
(33271105714ns)
+

+
+

+ 1.00
(1708193354ns)
+

+
+

+ 12.76
(21792913775ns)
+

+
+

+ 1.06
(1815382677ns)
+

+
+

+ 2.18
(3723938582ns)
+

+
+

+ gcd<boost::multiprecision::uint1024_t> (random prime number + products) +

+
+

+ 6.89
(9414373ns)
+

+
+

+ 1.00
(1367187ns)
+

+
+

+ 4.72
(6458117ns)
+

+
+

+ 1.16
(1583753ns)
+

+
+

+ 1.14
(1562793ns)
+

+
+

+ gcd<boost::multiprecision::uint1024_t> (uniform random numbers) +

+
+

+ 1.93
(202561994ns)
+

+
+

+ 1.06
(111048658ns)
+

+
+

+ 1.27
(132829158ns)
+

+
+

+ 1.08
(113036723ns)
+

+
+

+ 1.00
(104969288ns)
+

+
+

+ gcd<boost::multiprecision::uint256_t> (Trivial cases) +

+
+

+ 6.93
(3917ns)
+

+
+

+ 1.00
(565ns)
+

+
+

+ 2.62
(1479ns)
+

+
+

+ 1.01
(573ns)
+

+
+

+ 2.71
(1531ns)
+

+
+

+ gcd<boost::multiprecision::uint256_t> (adjacent Fibonacci numbers) +

+
+

+ 2.21
(30286211ns)
+

+
+

+ 1.23
(16874361ns)
+

+
+

+ 1.39
(19081717ns)
+

+
+

+ 1.29
(17676519ns)
+

+
+

+ 1.00
(13726965ns)
+

+
+

+ gcd<boost::multiprecision::uint256_t> (permutations of Fibonacci + numbers) +

+
+

+ 3.09
(16264475163ns)
+

+
+

+ 1.00
(5267565731ns)
+

+
+

+ 1.95
(10286841026ns)
+

+
+

+ 1.04
(5490091759ns)
+

+
+

+ 1.10
(5793652829ns)
+

+
+

+ gcd<boost::multiprecision::uint256_t> (random prime number + products) +

+
+

+ 7.24
(9135147ns)
+

+
+

+ 1.00
(1261015ns)
+

+
+

+ 4.68
(5898603ns)
+

+
+

+ 1.04
(1309201ns)
+

+
+

+ 1.19
(1498616ns)
+

+
+

+ gcd<boost::multiprecision::uint256_t> (uniform random numbers) +

+
+

+ 2.19
(37665692ns)
+

+
+

+ 1.00
(17208818ns)
+

+
+

+ 1.40
(24038634ns)
+

+
+

+ 1.04
(17885551ns)
+

+
+

+ 1.04
(17856525ns)
+

+
+

+ gcd<boost::multiprecision::uint512_t> (Trivial cases) +

+
+

+ 6.14
(4226ns)
+

+
+

+ 1.04
(714ns)
+

+
+

+ 2.40
(1650ns)
+

+
+

+ 1.00
(688ns)
+

+
+

+ 2.54
(1750ns)
+

+
+

+ gcd<boost::multiprecision::uint512_t> (adjacent Fibonacci numbers) +

+
+

+ 2.09
(50478428ns)
+

+
+

+ 1.85
(44510007ns)
+

+
+

+ 1.30
(31453596ns)
+

+
+

+ 1.95
(46966463ns)
+

+
+

+ 1.00
(24119978ns)
+

+
+

+ gcd<boost::multiprecision::uint512_t> (permutations of Fibonacci + numbers) +

+
+

+ 4.78
(28634298954ns)
+

+
+

+ 1.00
(5992545367ns)
+

+
+

+ 3.03
(18149620491ns)
+

+
+

+ 1.07
(6428199599ns)
+

+
+

+ 1.16
(6922805976ns)
+

+
+

+ gcd<boost::multiprecision::uint512_t> (random prime number + products) +

+
+

+ 6.82
(9443735ns)
+

+
+

+ 1.00
(1384889ns)
+

+
+

+ 4.40
(6089320ns)
+

+
+

+ 1.08
(1490160ns)
+

+
+

+ 1.20
(1659326ns)
+

+
+

+ gcd<boost::multiprecision::uint512_t> (uniform random numbers) +

+
+

+ 1.91
(81450557ns)
+

+
+

+ 1.00
(42646044ns)
+

+
+

+ 1.25
(53179175ns)
+

+
+

+ 1.10
(46719225ns)
+

+
+

+ 1.00
(42673142ns)
+

+
+

+ gcd<unsigned long long> (Trivial cases) +

+
+

+ 1.00
(116ns)
+

+
+

+ 1.41
(164ns)
+

+
+

+ 1.18
(137ns)
+

+
+

+ 1.14
(132ns)
+

+
+

+ 1.11
(129ns)
+

+
+

+ gcd<unsigned long long> (adjacent Fibonacci numbers) +

+
+

+ 1.00
(10264ns)
+

+
+

+ 8.74
(89752ns)
+

+
+

+ 1.79
(18416ns)
+

+
+

+ 8.56
(87836ns)
+

+
+

+ 1.92
(19682ns)
+

+
+

+ gcd<unsigned long long> (permutations of Fibonacci numbers) +

+
+

+ 2.38
(3155892ns)
+

+
+

+ 1.17
(1546387ns)
+

+
+

+ 2.31
(3064571ns)
+

+
+

+ 1.14
(1505421ns)
+

+
+

+ 1.00
(1324137ns)
+

+
+

+ gcd<unsigned long long> (random prime number products) +

+
+

+ 1.51
(570068ns)
+

+
+

+ 1.19
(446612ns)
+

+
+

+ 1.48
(558835ns)
+

+
+

+ 1.19
(446745ns)
+

+
+

+ 1.00
(376559ns)
+

+
+

+ gcd<unsigned long long> (uniform random numbers) +

+
+

+ 1.02
(729507ns)
+

+
+

+ 1.12
(796575ns)
+

+
+

+ 1.06
(754568ns)
+

+
+

+ 1.09
(780209ns)
+

+
+

+ 1.00
(714345ns)
+

+
+

+ gcd<unsigned long> (Trivial cases) +

+
+

+ 1.00
(111ns)
+

+
+

+ 1.50
(167ns)
+

+
+

+ 1.35
(150ns)
+

+
+

+ 1.22
(135ns)
+

+
+

+ 1.14
(126ns)
+

+
+

+ gcd<unsigned long> (adjacent Fibonacci numbers) +

+
+

+ 1.00
(10290ns)
+

+
+

+ 9.04
(92993ns)
+

+
+

+ 1.79
(18378ns)
+

+
+

+ 8.51
(87529ns)
+

+
+

+ 1.91
(19686ns)
+

+
+

+ gcd<unsigned long> (permutations of Fibonacci numbers) +

+
+

+ 2.39
(3151730ns)
+

+
+

+ 1.19
(1571898ns)
+

+
+

+ 2.39
(3157925ns)
+

+
+

+ 1.15
(1514291ns)
+

+
+

+ 1.00
(1321038ns)
+

+
+

+ gcd<unsigned long> (random prime number products) +

+
+

+ 1.52
(567900ns)
+

+
+

+ 1.20
(447416ns)
+

+
+

+ 1.53
(570241ns)
+

+
+

+ 1.17
(437075ns)
+

+
+

+ 1.00
(373656ns)
+

+
+

+ gcd<unsigned long> (uniform random numbers) +

+
+

+ 1.02
(725502ns)
+

+
+

+ 1.11
(786216ns)
+

+
+

+ 1.14
(809581ns)
+

+
+

+ 1.16
(823657ns)
+

+
+

+ 1.00
(709300ns)
+

+
+

+ gcd<unsigned short> (Trivial cases) +

+
+

+ 1.70
(119ns)
+

+
+

+ 1.10
(77ns)
+

+
+

+ 1.64
(115ns)
+

+
+

+ 1.00
(70ns)
+

+
+

+ 1.34
(94ns)
+

+
+

+ gcd<unsigned short> (adjacent Fibonacci numbers) +

+
+

+ 1.00
(505ns)
+

+
+

+ 6.66
(3361ns)
+

+
+

+ 1.82
(920ns)
+

+
+

+ 6.00
(3031ns)
+

+
+

+ 1.43
(723ns)
+

+
+

+ gcd<unsigned short> (permutations of Fibonacci numbers) +

+
+

+ 1.03
(9677ns)
+

+
+

+ 2.47
(23264ns)
+

+
+

+ 2.31
(21708ns)
+

+
+

+ 2.20
(20726ns)
+

+
+

+ 1.00
(9404ns)
+

+
+

+ gcd<unsigned short> (random prime number products) +

+
+

+ 1.66
(144754ns)
+

+
+

+ 1.04
(91131ns)
+

+
+

+ 1.75
(152844ns)
+

+
+

+ 1.00
(87426ns)
+

+
+

+ 1.09
(95489ns)
+

+
+

+ gcd<unsigned short> (uniform random numbers) +

+
+

+ 1.47
(193344ns)
+

+
+

+ 1.05
(138447ns)
+

+
+

+ 1.54
(203579ns)
+

+
+

+ 1.00
(131849ns)
+

+
+

+ 1.12
(147658ns)
+

+
+

+ gcd<unsigned> (Trivial cases) +

+
+

+ 1.53
(121ns)
+

+
+

+ 1.09
(86ns)
+

+
+

+ 1.80
(142ns)
+

+
+

+ 1.00
(79ns)
+

+
+

+ 1.23
(97ns)
+

+
+

+ gcd<unsigned> (adjacent Fibonacci numbers) +

+
+

+ 1.00
(2543ns)
+

+
+

+ 5.58
(14181ns)
+

+
+

+ 1.87
(4761ns)
+

+
+

+ 5.23
(13303ns)
+

+
+

+ 1.28
(3249ns)
+

+
+

+ gcd<unsigned> (permutations of Fibonacci numbers) +

+
+

+ 2.23
(322541ns)
+

+
+

+ 1.24
(178892ns)
+

+
+

+ 2.63
(380151ns)
+

+
+

+ 1.16
(167798ns)
+

+
+

+ 1.00
(144818ns)
+

+
+

+ gcd<unsigned> (random prime number products) +

+
+

+ 1.58
(287780ns)
+

+
+

+ 1.04
(190430ns)
+

+
+

+ 1.72
(313206ns)
+

+
+

+ 1.00
(182486ns)
+

+
+

+ 1.06
(194089ns)
+

+
+

+ gcd<unsigned> (uniform random numbers) +

+
+

+ 1.25
(357105ns)
+

+
+

+ 1.00
(285373ns)
+

+
+

+ 1.43
(406966ns)
+

+
+

+ 1.03
(294621ns)
+

+
+

+ 1.12
(319048ns)
+

+
+
+
+
+
+ +
+

Table 27. gcd method comparison with Microsoft Visual C++ version 14.0 on Windows + x64

+
++++++++++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ Function +

+
+

+ Stein_gcd boost 1.61 +

+
+

+ Euclid_gcd boost 1.61 +

+
+

+ Stein_gcd_textbook boost 1.61 +

+
+

+ gcd_euclid_textbook boost 1.61 +

+
+

+ mixed_binary_gcd boost 1.61 +

+
+

+ gcd boost 1.64 +

+
+

+ Euclid_gcd boost 1.64 +

+
+

+ Stein_gcd boost 1.64 +

+
+

+ mixed_binary_gcd boost 1.64 +

+
+

+ Stein_gcd_textbook boost 1.64 +

+
+

+ gcd_euclid_textbook boost 1.64 +

+
+

+ gcd<boost::multiprecision::uint1024_t> (Trivial cases) +

+
+

+ 3.05
(2653ns)
+

+
+

+ 1.00
(871ns)
+

+
+

+ 1.44
(1254ns)
+

+
+

+ 1.01
(882ns)
+

+
+

+ 1.92
(1669ns)
+

+
+

+ 2.53
(2207ns)
+

+
+

+ 2.62
(2281ns)
+

+
+

+ 11.46
(9978ns)
+

+
+

+ 10.70
(9316ns)
+

+
+

+ 3.48
(3035ns)
+

+
+

+ 2.72
(2367ns)
+

+
+

+ gcd<boost::multiprecision::uint1024_t> (adjacent Fibonacci + numbers) +

+
+

+ 2.42
(59670883ns)
+

+
+

+ 2.57
(63320661ns)
+

+
+

+ 1.19
(29370585ns)
+

+
+

+ 2.22
(54668476ns)
+

+
+

+ 1.65
(40663816ns)
+

+
+

+ 1.00
(24623955ns)
+

+
+

+ 4.35
(107118158ns)
+

+
+

+ 5.35
(131687985ns)
+

+
+

+ 3.15
(77463382ns)
+

+
+

+ 2.14
(52636654ns)
+

+
+

+ 5.25
(129158187ns)
+

+
+

+ gcd<boost::multiprecision::uint1024_t> (permutations of Fibonacci + numbers) +

+
+

+ 15.51
(33644126589ns)
+

+
+

+ 1.00
(2169788957ns)
+

+
+

+ 7.78
(16883236272ns)
+

+
+

+ 1.10
(2378290598ns)
+

+
+

+ 2.64
(5721817992ns)
+

+
+

+ 5.89
(12776783246ns)
+

+
+

+ 1.60
(3473198791ns)
+

+
+

+ 38.51
(83549633852ns)
+

+
+

+ 5.64
(12235187520ns)
+

+
+

+ 14.54
(31558153140ns)
+

+
+

+ 1.79
(3883541816ns)
+

+
+

+ gcd<boost::multiprecision::uint1024_t> (random prime number + products) +

+
+

+ 5.56
(7426321ns)
+

+
+

+ 1.06
(1420925ns)
+

+
+

+ 3.18
(4254380ns)
+

+
+

+ 1.00
(1336372ns)
+

+
+

+ 1.61
(2149489ns)
+

+
+

+ 1.72
(2295367ns)
+

+
+

+ 1.97
(2629042ns)
+

+
+

+ 16.99
(22706002ns)
+

+
+

+ 3.66
(4896256ns)
+

+
+

+ 6.66
(8899615ns)
+

+
+

+ 2.47
(3296882ns)
+

+
+

+ gcd<boost::multiprecision::uint1024_t> (uniform random numbers) +

+
+

+ 3.03
(275000359ns)
+

+
+

+ 1.20
(109316990ns)
+

+
+

+ 1.36
(123200308ns)
+

+
+

+ 1.00
(90757472ns)
+

+
+

+ 2.11
(191066461ns)
+

+
+

+ 1.36
(123876688ns)
+

+
+

+ 1.86
(168555428ns)
+

+
+

+ 4.94
(448341733ns)
+

+
+

+ 2.87
(260414480ns)
+

+
+

+ 2.10
(190249211ns)
+

+
+

+ 2.06
(187300242ns)
+

+
+

+ gcd<boost::multiprecision::uint256_t> (Trivial cases) +

+
+

+ 3.56
(2100ns)
+

+
+

+ 1.00
(590ns)
+

+
+

+ 1.52
(896ns)
+

+
+

+ 1.01
(594ns)
+

+
+

+ 2.47
(1460ns)
+

+
+

+ 1.52
(896ns)
+

+
+

+ 1.65
(974ns)
+

+
+

+ 8.24
(4859ns)
+

+
+

+ 7.14
(4211ns)
+

+
+

+ 2.36
(1390ns)
+

+
+

+ 1.36
(803ns)
+

+
+

+ gcd<boost::multiprecision::uint256_t> (adjacent Fibonacci numbers) +

+
+

+ 2.41
(25292952ns)
+

+
+

+ 1.35
(14156133ns)
+

+
+

+ 1.33
(14011069ns)
+

+
+

+ 1.29
(13517673ns)
+

+
+

+ 1.80
(18914822ns)
+

+
+

+ 1.00
(10509446ns)
+

+
+

+ 2.42
(25415287ns)
+

+
+

+ 4.34
(45569911ns)
+

+
+

+ 2.75
(28868909ns)
+

+
+

+ 1.69
(17787967ns)
+

+
+

+ 2.45
(25703761ns)
+

+
+

+ gcd<boost::multiprecision::uint256_t> (permutations of Fibonacci + numbers) +

+
+

+ 3.23
(13662865260ns)
+

+
+

+ 1.06
(4469548580ns)
+

+
+

+ 1.76
(7471801261ns)
+

+
+

+ 1.00
(4236351208ns)
+

+
+

+ 1.85
(7828273663ns)
+

+
+

+ 1.33
(5641641009ns)
+

+
+

+ 2.00
(8481980418ns)
+

+
+

+ 6.13
(25958089997ns)
+

+
+

+ 3.03
(12831671502ns)
+

+
+

+ 2.46
(10425285342ns)
+

+
+

+ 2.00
(8481275507ns)
+

+
+

+ gcd<boost::multiprecision::uint256_t> (random prime number + products) +

+
+

+ 5.65
(7151179ns)
+

+
+

+ 1.01
(1279095ns)
+

+
+

+ 3.25
(4106910ns)
+

+
+

+ 1.00
(1264825ns)
+

+
+

+ 1.70
(2152290ns)
+

+
+

+ 1.92
(2431940ns)
+

+
+

+ 1.85
(2345808ns)
+

+
+

+ 11.27
(14248457ns)
+

+
+

+ 2.76
(3489015ns)
+

+
+

+ 4.98
(6301435ns)
+

+
+

+ 1.89
(2392981ns)
+

+
+

+ gcd<boost::multiprecision::uint256_t> (uniform random numbers) +

+
+

+ 2.45
(32310613ns)
+

+
+

+ 1.06
(14059302ns)
+

+
+

+ 1.35
(17793742ns)
+

+
+

+ 1.00
(13204360ns)
+

+
+

+ 1.84
(24264232ns)
+

+
+

+ 1.15
(15190274ns)
+

+
+

+ 1.97
(26017484ns)
+

+
+

+ 4.46
(58842348ns)
+

+
+

+ 2.79
(36785666ns)
+

+
+

+ 1.69
(22326488ns)
+

+
+

+ 1.91
(25204278ns)
+

+
+

+ gcd<boost::multiprecision::uint512_t> (Trivial cases) +

+
+

+ 3.43
(2210ns)
+

+
+

+ 1.00
(644ns)
+

+
+

+ 1.55
(1000ns)
+

+
+

+ 1.03
(662ns)
+

+
+

+ 2.10
(1355ns)
+

+
+

+ 1.42
(913ns)
+

+
+

+ 1.54
(989ns)
+

+
+

+ 7.32
(4716ns)
+

+
+

+ 6.40
(4122ns)
+

+
+

+ 2.12
(1368ns)
+

+
+

+ 1.27
(817ns)
+

+
+

+ gcd<boost::multiprecision::uint512_t> (adjacent Fibonacci numbers) +

+
+

+ 2.09
(48927775ns)
+

+
+

+ 1.58
(37027792ns)
+

+
+

+ 1.11
(26031785ns)
+

+
+

+ 1.45
(33931511ns)
+

+
+

+ 1.43
(33404007ns)
+

+
+

+ 1.00
(23435290ns)
+

+
+

+ 3.12
(73104180ns)
+

+
+

+ 3.84
(90089949ns)
+

+
+

+ 2.43
(56923240ns)
+

+
+

+ 1.48
(34693435ns)
+

+
+

+ 2.80
(65620808ns)
+

+
+

+ gcd<boost::multiprecision::uint512_t> (permutations of Fibonacci + numbers) +

+
+

+ 5.53
(28125905824ns)
+

+
+

+ 1.08
(5505436279ns)
+

+
+

+ 2.89
(14713059756ns)
+

+
+

+ 1.00
(5084759818ns)
+

+
+

+ 1.85
(9420550833ns)
+

+
+

+ 2.41
(12252843971ns)
+

+
+

+ 2.02
(10272751458ns)
+

+
+

+ 9.61
(48856236248ns)
+

+
+

+ 2.98
(15149065981ns)
+

+
+

+ 3.66
(18594373353ns)
+

+
+

+ 1.81
(9217862382ns)
+

+
+

+ gcd<boost::multiprecision::uint512_t> (random prime number + products) +

+
+

+ 5.48
(7364662ns)
+

+
+

+ 1.01
(1351079ns)
+

+
+

+ 3.28
(4407547ns)
+

+
+

+ 1.00
(1344003ns)
+

+
+

+ 1.58
(2123434ns)
+

+
+

+ 1.89
(2543037ns)
+

+
+

+ 1.96
(2636943ns)
+

+
+

+ 11.40
(15325370ns)
+

+
+

+ 2.86
(3841352ns)
+

+
+

+ 4.91
(6593697ns)
+

+
+

+ 2.06
(2763216ns)
+

+
+

+ gcd<boost::multiprecision::uint512_t> (uniform random numbers) +

+
+

+ 2.66
(87178566ns)
+

+
+

+ 1.13
(37150982ns)
+

+
+

+ 1.39
(45679514ns)
+

+
+

+ 1.00
(32787132ns)
+

+
+

+ 1.88
(61528205ns)
+

+
+

+ 1.33
(43591274ns)
+

+
+

+ 2.10
(68925414ns)
+

+
+

+ 4.32
(141511277ns)
+

+
+

+ 3.05
(100081308ns)
+

+
+

+ 1.87
(61292346ns)
+

+
+

+ 2.02
(66235861ns)
+

+
+

+ gcd<unsigned long long> (Trivial cases) +

+
+

+ 1.00
(119ns)
+

+
+

+ 1.39
(166ns)
+

+
+

+ 1.41
(168ns)
+

+
+

+ 1.17
(139ns)
+

+
+

+ 1.13
(134ns)
+

+
+

+ 2.65
(315ns)
+

+
+

+ 1.75
(208ns)
+

+
+

+ 1.97
(235ns)
+

+
+

+ 2.41
(287ns)
+

+
+

+ 4.06
(483ns)
+

+
+

+ 1.76
(209ns)
+

+
+

+ gcd<unsigned long long> (adjacent Fibonacci numbers) +

+
+

+ 1.00
(8347ns)
+

+
+

+ 10.38
(86663ns)
+

+
+

+ 3.35
(27955ns)
+

+
+

+ 10.09
(84227ns)
+

+
+

+ 2.28
(19057ns)
+

+
+

+ 4.08
(34080ns)
+

+
+

+ 18.55
(154835ns)
+

+
+

+ 2.17
(18097ns)
+

+
+

+ 3.96
(33018ns)
+

+
+

+ 6.98
(58232ns)
+

+
+

+ 18.59
(155185ns)
+

+
+

+ gcd<unsigned long long> (permutations of Fibonacci numbers) +

+
+

+ 2.35
(3296845ns)
+

+
+

+ 1.09
(1534499ns)
+

+
+

+ 2.64
(3696696ns)
+

+
+

+ 1.06
(1481449ns)
+

+
+

+ 1.00
(1402222ns)
+

+
+

+ 1.84
(2586948ns)
+

+
+

+ 1.88
(2640516ns)
+

+
+

+ 3.20
(4486070ns)
+

+
+

+ 1.83
(2569310ns)
+

+
+

+ 5.42
(7600105ns)
+

+
+

+ 1.91
(2679063ns)
+

+
+

+ gcd<unsigned long long> (random prime number products) +

+
+

+ 1.48
(614650ns)
+

+
+

+ 1.05
(435946ns)
+

+
+

+ 1.61
(668617ns)
+

+
+

+ 1.03
(429584ns)
+

+
+

+ 1.00
(415667ns)
+

+
+

+ 1.84
(763379ns)
+

+
+

+ 2.50
(1038355ns)
+

+
+

+ 2.02
(840855ns)
+

+
+

+ 1.83
(760952ns)
+

+
+

+ 3.40
(1411408ns)
+

+
+

+ 2.53
(1052873ns)
+

+
+

+ gcd<unsigned long long> (uniform random numbers) +

+
+

+ 1.06
(807246ns)
+

+
+

+ 1.02
(774035ns)
+

+
+

+ 1.16
(883077ns)
+

+
+

+ 1.00
(763348ns)
+

+
+

+ 1.00
(760748ns)
+

+
+

+ 2.00
(1524748ns)
+

+
+

+ 2.62
(1993795ns)
+

+
+

+ 1.43
(1087596ns)
+

+
+

+ 1.95
(1484810ns)
+

+
+

+ 2.37
(1804142ns)
+

+
+

+ 2.67
(2027528ns)
+

+
+

+ gcd<unsigned long> (Trivial cases) +

+
+

+ 1.39
(114ns)
+

+
+

+ 1.09
(89ns)
+

+
+

+ 2.04
(167ns)
+

+
+

+ 1.00
(82ns)
+

+
+

+ 1.15
(94ns)
+

+
+

+ 1.57
(129ns)
+

+
+

+ 1.13
(93ns)
+

+
+

+ 1.29
(106ns)
+

+
+

+ 1.51
(124ns)
+

+
+

+ 3.16
(259ns)
+

+
+

+ 1.23
(101ns)
+

+
+

+ gcd<unsigned long> (adjacent Fibonacci numbers) +

+
+

+ 1.00
(2005ns)
+

+
+

+ 7.64
(15319ns)
+

+
+

+ 3.75
(7524ns)
+

+
+

+ 7.55
(15137ns)
+

+
+

+ 1.84
(3694ns)
+

+
+

+ 1.79
(3585ns)
+

+
+

+ 6.95
(13927ns)
+

+
+

+ 1.12
(2242ns)
+

+
+

+ 1.78
(3577ns)
+

+
+

+ 4.04
(8104ns)
+

+
+

+ 6.99
(14016ns)
+

+
+

+ gcd<unsigned long> (permutations of Fibonacci numbers) +

+
+

+ 2.46
(346174ns)
+

+
+

+ 1.26
(177975ns)
+

+
+

+ 3.61
(508462ns)
+

+
+

+ 1.17
(164321ns)
+

+
+

+ 1.06
(149731ns)
+

+
+

+ 1.01
(141952ns)
+

+
+

+ 1.31
(184194ns)
+

+
+

+ 1.43
(201433ns)
+

+
+

+ 1.00
(140948ns)
+

+
+

+ 4.11
(579023ns)
+

+
+

+ 1.31
(184313ns)
+

+
+

+ gcd<unsigned long> (random prime number products) +

+
+

+ 2.55
(317220ns)
+

+
+

+ 1.48
(184591ns)
+

+
+

+ 3.34
(416236ns)
+

+
+

+ 1.40
(174283ns)
+

+
+

+ 1.58
(196343ns)
+

+
+

+ 1.03
(128583ns)
+

+
+

+ 1.57
(195103ns)
+

+
+

+ 1.31
(163491ns)
+

+
+

+ 1.00
(124586ns)
+

+
+

+ 3.85
(479591ns)
+

+
+

+ 1.58
(196783ns)
+

+
+

+ gcd<unsigned long> (uniform random numbers) +

+
+

+ 1.83
(401554ns)
+

+
+

+ 1.26
(277398ns)
+

+
+

+ 2.31
(508645ns)
+

+
+

+ 1.25
(274854ns)
+

+
+

+ 1.48
(325496ns)
+

+
+

+ 1.01
(221040ns)
+

+
+

+ 1.36
(298196ns)
+

+
+

+ 1.00
(219844ns)
+

+
+

+ 1.02
(224566ns)
+

+
+

+ 2.69
(591153ns)
+

+
+

+ 1.36
(298483ns)
+

+
+

+ gcd<unsigned short> (Trivial cases) +

+
+

+ 1.63
(122ns)
+

+
+

+ 1.12
(84ns)
+

+
+

+ 2.29
(172ns)
+

+
+

+ 1.00
(75ns)
+

+
+

+ 1.31
(98ns)
+

+
+

+ 1.87
(140ns)
+

+
+

+ 1.40
(105ns)
+

+
+

+ 1.93
(145ns)
+

+
+

+ 1.96
(147ns)
+

+
+

+ 3.35
(251ns)
+

+
+

+ 1.24
(93ns)
+

+
+

+ gcd<unsigned short> (adjacent Fibonacci numbers) +

+
+

+ 1.00
(590ns)
+

+
+

+ 6.11
(3605ns)
+

+
+

+ 2.69
(1588ns)
+

+
+

+ 5.51
(3250ns)
+

+
+

+ 1.52
(898ns)
+

+
+

+ 2.14
(1260ns)
+

+
+

+ 5.94
(3507ns)
+

+
+

+ 2.56
(1513ns)
+

+
+

+ 2.15
(1267ns)
+

+
+

+ 3.42
(2017ns)
+

+
+

+ 6.01
(3544ns)
+

+
+

+ gcd<unsigned short> (permutations of Fibonacci numbers) +

+
+

+ 1.43
(16631ns)
+

+
+

+ 2.17
(25211ns)
+

+
+

+ 4.08
(47419ns)
+

+
+

+ 1.97
(22841ns)
+

+
+

+ 1.00
(11611ns)
+

+
+

+ 1.67
(19374ns)
+

+
+

+ 2.15
(24936ns)
+

+
+

+ 2.34
(27203ns)
+

+
+

+ 1.57
(18246ns)
+

+
+

+ 4.54
(52686ns)
+

+
+

+ 2.15
(25006ns)
+

+
+

+ gcd<unsigned short> (random prime number products) +

+
+

+ 1.75
(144505ns)
+

+
+

+ 1.24
(102665ns)
+

+
+

+ 2.48
(205019ns)
+

+
+

+ 1.13
(92984ns)
+

+
+

+ 1.23
(101392ns)
+

+
+

+ 1.04
(86096ns)
+

+
+

+ 1.17
(96237ns)
+

+
+

+ 1.53
(126473ns)
+

+
+

+ 1.00
(82541ns)
+

+
+

+ 2.82
(232912ns)
+

+
+

+ 1.20
(98822ns)
+

+
+

+ gcd<unsigned short> (uniform random numbers) +

+
+

+ 1.46
(189654ns)
+

+
+

+ 1.13
(146973ns)
+

+
+

+ 1.95
(254281ns)
+

+
+

+ 1.05
(136708ns)
+

+
+

+ 1.18
(154282ns)
+

+
+

+ 1.01
(131622ns)
+

+
+

+ 1.10
(143161ns)
+

+
+

+ 1.09
(142318ns)
+

+
+

+ 1.00
(130263ns)
+

+
+

+ 2.26
(293895ns)
+

+
+

+ 1.10
(142885ns)
+

+
+

+ gcd<unsigned> (Trivial cases) +

+
+

+ 1.40
(113ns)
+

+
+

+ 1.07
(87ns)
+

+
+

+ 2.11
(171ns)
+

+
+

+ 1.00
(81ns)
+

+
+

+ 1.15
(93ns)
+

+
+

+ 1.59
(129ns)
+

+
+

+ 1.16
(94ns)
+

+
+

+ 1.40
(113ns)
+

+
+

+ 1.58
(128ns)
+

+
+

+ 3.17
(257ns)
+

+
+

+ 1.25
(101ns)
+

+
+

+ gcd<unsigned> (adjacent Fibonacci numbers) +

+
+

+ 1.00
(1993ns)
+

+
+

+ 6.98
(13906ns)
+

+
+

+ 3.70
(7384ns)
+

+
+

+ 6.68
(13323ns)
+

+
+

+ 1.59
(3165ns)
+

+
+

+ 1.71
(3414ns)
+

+
+

+ 6.80
(13554ns)
+

+
+

+ 1.12
(2225ns)
+

+
+

+ 1.80
(3580ns)
+

+
+

+ 4.23
(8433ns)
+

+
+

+ 7.34
(14638ns)
+

+
+

+ gcd<unsigned> (permutations of Fibonacci numbers) +

+
+

+ 2.56
(345911ns)
+

+
+

+ 1.32
(177891ns)
+

+
+

+ 3.80
(512584ns)
+

+
+

+ 1.20
(162012ns)
+

+
+

+ 1.10
(148982ns)
+

+
+

+ 1.04
(140892ns)
+

+
+

+ 1.33
(179530ns)
+

+
+

+ 1.43
(193505ns)
+

+
+

+ 1.00
(134997ns)
+

+
+

+ 4.44
(599245ns)
+

+
+

+ 1.41
(190200ns)
+

+
+

+ gcd<unsigned> (random prime number products) +

+
+

+ 2.48
(316605ns)
+

+
+

+ 1.47
(187049ns)
+

+
+

+ 3.26
(415886ns)
+

+
+

+ 1.38
(176518ns)
+

+
+

+ 1.57
(200933ns)
+

+
+

+ 1.01
(128436ns)
+

+
+

+ 1.53
(194872ns)
+

+
+

+ 1.18
(150531ns)
+

+
+

+ 1.00
(127624ns)
+

+
+

+ 3.81
(486079ns)
+

+
+

+ 1.49
(190453ns)
+

+
+

+ gcd<unsigned> (uniform random numbers) +

+
+

+ 1.96
(400024ns)
+

+
+

+ 1.39
(283292ns)
+

+
+

+ 2.52
(513812ns)
+

+
+

+ 1.37
(279687ns)
+

+
+

+ 1.60
(326341ns)
+

+
+

+ 1.04
(211406ns)
+

+
+

+ 1.39
(284097ns)
+

+
+

+ 1.00
(203744ns)
+

+
+

+ 1.02
(208526ns)
+

+
+

+ 2.93
(595972ns)
+

+
+

+ 1.43
(291793ns)
+

+
+
+
+
+
+ +
+

Table 28. gcd method comparison with Microsoft Visual C++ version 14.1 on Windows + x64

+
+++++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ Function +

+
+

+ gcd boost 1.64 +

+
+

+ Euclid_gcd boost 1.64 +

+
+

+ Stein_gcd boost 1.64 +

+
+

+ mixed_binary_gcd boost 1.64 +

+
+

+ Stein_gcd_textbook boost 1.64 +

+
+

+ gcd_euclid_textbook boost 1.64 +

+
+

+ gcd<boost::multiprecision::uint1024_t> (Trivial cases) +

+
+

+ 1.09
(801ns)
+

+
+

+ 1.00
(732ns)
+

+
+

+ 4.16
(3043ns)
+

+
+

+ 4.03
(2953ns)
+

+
+

+ 1.56
(1142ns)
+

+
+

+ 1.09
(796ns)
+

+
+

+ gcd<boost::multiprecision::uint1024_t> (adjacent Fibonacci + numbers) +

+
+

+ 1.00
(18814466ns)
+

+
+

+ 3.14
(59009620ns)
+

+
+

+ 3.99
(75116072ns)
+

+
+

+ 2.26
(42593821ns)
+

+
+

+ 1.58
(29655430ns)
+

+
+

+ 2.77
(52174915ns)
+

+
+

+ gcd<boost::multiprecision::uint1024_t> (permutations of Fibonacci + numbers) +

+
+

+ 4.67
(9475590235ns)
+

+
+

+ 1.07
(2173235780ns)
+

+
+

+ 22.49
(45639139129ns)
+

+
+

+ 3.14
(6369244677ns)
+

+
+

+ 8.18
(16601284933ns)
+

+
+

+ 1.00
(2028937087ns)
+

+
+

+ gcd<boost::multiprecision::uint1024_t> (random prime number + products) +

+
+

+ 1.20
(1551460ns)
+

+
+

+ 1.02
(1314451ns)
+

+
+

+ 7.92
(10230767ns)
+

+
+

+ 1.74
(2243194ns)
+

+
+

+ 3.36
(4338456ns)
+

+
+

+ 1.00
(1291852ns)
+

+
+

+ gcd<boost::multiprecision::uint1024_t> (uniform random numbers) +

+
+

+ 1.13
(97004967ns)
+

+
+

+ 1.20
(102255110ns)
+

+
+

+ 3.36
(287286304ns)
+

+
+

+ 2.23
(190999693ns)
+

+
+

+ 1.42
(121531123ns)
+

+
+

+ 1.00
(85503149ns)
+

+
+

+ gcd<boost::multiprecision::uint256_t> (Trivial cases) +

+
+

+ 1.15
(575ns)
+

+
+

+ 1.00
(502ns)
+

+
+

+ 4.94
(2481ns)
+

+
+

+ 4.62
(2320ns)
+

+
+

+ 1.86
(936ns)
+

+
+

+ 1.17
(589ns)
+

+
+

+ gcd<boost::multiprecision::uint256_t> (adjacent Fibonacci numbers) +

+
+

+ 1.00
(7847419ns)
+

+
+

+ 1.78
(13945600ns)
+

+
+

+ 4.42
(34688200ns)
+

+
+

+ 2.42
(19021587ns)
+

+
+

+ 1.84
(14421195ns)
+

+
+

+ 1.70
(13359068ns)
+

+
+

+ gcd<boost::multiprecision::uint256_t> (permutations of Fibonacci + numbers) +

+
+

+ 1.00
(4067225231ns)
+

+
+

+ 1.08
(4386735265ns)
+

+
+

+ 4.75
(19329382899ns)
+

+
+

+ 1.93
(7850681530ns)
+

+
+

+ 1.90
(7708396164ns)
+

+
+

+ 1.04
(4231899027ns)
+

+
+

+ gcd<boost::multiprecision::uint256_t> (random prime number + products) +

+
+

+ 1.27
(1581415ns)
+

+
+

+ 1.00
(1243668ns)
+

+
+

+ 7.91
(9831772ns)
+

+
+

+ 1.70
(2114775ns)
+

+
+

+ 3.45
(4294739ns)
+

+
+

+ 1.00
(1245471ns)
+

+
+

+ gcd<boost::multiprecision::uint256_t> (uniform random numbers) +

+
+

+ 1.00
(10845788ns)
+

+
+

+ 1.26
(13713724ns)
+

+
+

+ 4.11
(44625137ns)
+

+
+

+ 2.25
(24360370ns)
+

+
+

+ 1.67
(18100420ns)
+

+
+

+ 1.19
(12859732ns)
+

+
+

+ gcd<boost::multiprecision::uint512_t> (Trivial cases) +

+
+

+ 1.14
(644ns)
+

+
+

+ 1.00
(565ns)
+

+
+

+ 4.98
(2812ns)
+

+
+

+ 4.64
(2621ns)
+

+
+

+ 1.73
(980ns)
+

+
+

+ 1.15
(647ns)
+

+
+

+ gcd<boost::multiprecision::uint512_t> (adjacent Fibonacci numbers) +

+
+

+ 1.00
(17186167ns)
+

+
+

+ 2.44
(41861352ns)
+

+
+

+ 3.98
(68425931ns)
+

+
+

+ 2.23
(38284219ns)
+

+
+

+ 1.56
(26755034ns)
+

+
+

+ 1.95
(33477468ns)
+

+
+

+ gcd<boost::multiprecision::uint512_t> (permutations of Fibonacci + numbers) +

+
+

+ 1.64
(8226882537ns)
+

+
+

+ 1.03
(5195847139ns)
+

+
+

+ 7.47
(37520762454ns)
+

+
+

+ 2.12
(10640326024ns)
+

+
+

+ 2.89
(14533607689ns)
+

+
+

+ 1.00
(5022876982ns)
+

+
+

+ gcd<boost::multiprecision::uint512_t> (random prime number + products) +

+
+

+ 1.23
(1627487ns)
+

+
+

+ 1.00
(1322335ns)
+

+
+

+ 7.94
(10496834ns)
+

+
+

+ 1.82
(2406752ns)
+

+
+

+ 3.37
(4461261ns)
+

+
+

+ 1.02
(1343775ns)
+

+
+

+ gcd<boost::multiprecision::uint512_t> (uniform random numbers) +

+
+

+ 1.00
(32451969ns)
+

+
+

+ 1.10
(35543655ns)
+

+
+

+ 3.55
(115155205ns)
+

+
+

+ 2.01
(65156734ns)
+

+
+

+ 1.43
(46259709ns)
+

+
+

+ 1.03
(33493171ns)
+

+
+

+ gcd<unsigned long long> (Trivial cases) +

+
+

+ 1.46
(161ns)
+

+
+

+ 1.35
(148ns)
+

+
+

+ 1.00
(110ns)
+

+
+

+ 1.42
(156ns)
+

+
+

+ 1.02
(112ns)
+

+
+

+ 1.23
(135ns)
+

+
+

+ gcd<unsigned long long> (adjacent Fibonacci numbers) +

+
+

+ 1.43
(20054ns)
+

+
+

+ 7.90
(110522ns)
+

+
+

+ 1.00
(13990ns)
+

+
+

+ 1.42
(19927ns)
+

+
+

+ 1.11
(15489ns)
+

+
+

+ 6.02
(84223ns)
+

+
+

+ gcd<unsigned long long> (permutations of Fibonacci numbers) +

+
+

+ 1.16
(1706761ns)
+

+
+

+ 1.28
(1892450ns)
+

+
+

+ 2.65
(3915173ns)
+

+
+

+ 1.16
(1718303ns)
+

+
+

+ 1.97
(2909805ns)
+

+
+

+ 1.00
(1477319ns)
+

+
+

+ gcd<unsigned long long> (random prime number products) +

+
+

+ 1.00
(405449ns)
+

+
+

+ 1.39
(562829ns)
+

+
+

+ 1.81
(734508ns)
+

+
+

+ 1.01
(408757ns)
+

+
+

+ 1.30
(527805ns)
+

+
+

+ 1.04
(422687ns)
+

+
+

+ gcd<unsigned long long> (uniform random numbers) +

+
+

+ 1.13
(800534ns)
+

+
+

+ 1.41
(1002100ns)
+

+
+

+ 1.43
(1016520ns)
+

+
+

+ 1.11
(790908ns)
+

+
+

+ 1.00
(711010ns)
+

+
+

+ 1.06
(755843ns)
+

+
+

+ gcd<unsigned long> (Trivial cases) +

+
+

+ 1.88
(152ns)
+

+
+

+ 1.21
(98ns)
+

+
+

+ 1.46
(118ns)
+

+
+

+ 1.75
(142ns)
+

+
+

+ 1.48
(120ns)
+

+
+

+ 1.00
(81ns)
+

+
+

+ gcd<unsigned long> (adjacent Fibonacci numbers) +

+
+

+ 1.08
(3560ns)
+

+
+

+ 6.50
(21428ns)
+

+
+

+ 1.00
(3299ns)
+

+
+

+ 1.06
(3481ns)
+

+
+

+ 1.23
(4074ns)
+

+
+

+ 4.06
(13399ns)
+

+
+

+ gcd<unsigned long> (permutations of Fibonacci numbers) +

+
+

+ 1.26
(200999ns)
+

+
+

+ 1.66
(265917ns)
+

+
+

+ 2.75
(439667ns)
+

+
+

+ 1.24
(197917ns)
+

+
+

+ 2.32
(370746ns)
+

+
+

+ 1.00
(159839ns)
+

+
+

+ gcd<unsigned long> (random prime number products) +

+
+

+ 1.25
(218611ns)
+

+
+

+ 1.58
(276521ns)
+

+
+

+ 2.23
(391315ns)
+

+
+

+ 1.14
(200690ns)
+

+
+

+ 1.79
(313229ns)
+

+
+

+ 1.00
(175307ns)
+

+
+

+ gcd<unsigned long> (uniform random numbers) +

+
+

+ 1.35
(362872ns)
+

+
+

+ 1.50
(401677ns)
+

+
+

+ 1.90
(510064ns)
+

+
+

+ 1.33
(357968ns)
+

+
+

+ 1.47
(394095ns)
+

+
+

+ 1.00
(268295ns)
+

+
+

+ gcd<unsigned short> (Trivial cases) +

+
+

+ 1.65
(137ns)
+

+
+

+ 1.11
(92ns)
+

+
+

+ 1.41
(117ns)
+

+
+

+ 1.54
(128ns)
+

+
+

+ 1.46
(121ns)
+

+
+

+ 1.00
(83ns)
+

+
+

+ gcd<unsigned short> (adjacent Fibonacci numbers) +

+
+

+ 1.14
(859ns)
+

+
+

+ 6.80
(5139ns)
+

+
+

+ 1.00
(756ns)
+

+
+

+ 1.15
(866ns)
+

+
+

+ 1.35
(1020ns)
+

+
+

+ 4.17
(3155ns)
+

+
+

+ gcd<unsigned short> (permutations of Fibonacci numbers) +

+
+

+ 1.01
(12759ns)
+

+
+

+ 3.33
(42011ns)
+

+
+

+ 1.27
(16050ns)
+

+
+

+ 1.00
(12623ns)
+

+
+

+ 2.17
(27411ns)
+

+
+

+ 1.80
(22712ns)
+

+
+

+ gcd<unsigned short> (random prime number products) +

+
+

+ 1.22
(101653ns)
+

+
+

+ 1.95
(161889ns)
+

+
+

+ 2.33
(193556ns)
+

+
+

+ 1.19
(98879ns)
+

+
+

+ 1.85
(153556ns)
+

+
+

+ 1.00
(83031ns)
+

+
+

+ gcd<unsigned short> (uniform random numbers) +

+
+

+ 1.34
(169127ns)
+

+
+

+ 1.66
(208641ns)
+

+
+

+ 2.06
(259536ns)
+

+
+

+ 1.36
(170992ns)
+

+
+

+ 1.59
(199734ns)
+

+
+

+ 1.00
(125927ns)
+

+
+

+ gcd<unsigned> (Trivial cases) +

+
+

+ 1.85
(165ns)
+

+
+

+ 1.25
(111ns)
+

+
+

+ 1.49
(133ns)
+

+
+

+ 1.90
(169ns)
+

+
+

+ 1.63
(145ns)
+

+
+

+ 1.00
(89ns)
+

+
+

+ gcd<unsigned> (adjacent Fibonacci numbers) +

+
+

+ 1.09
(3472ns)
+

+
+

+ 6.86
(21847ns)
+

+
+

+ 1.00
(3184ns)
+

+
+

+ 1.08
(3428ns)
+

+
+

+ 1.29
(4110ns)
+

+
+

+ 4.22
(13439ns)
+

+
+

+ gcd<unsigned> (permutations of Fibonacci numbers) +

+
+

+ 1.19
(201037ns)
+

+
+

+ 1.62
(273197ns)
+

+
+

+ 2.74
(463170ns)
+

+
+

+ 1.21
(204339ns)
+

+
+

+ 2.36
(398909ns)
+

+
+

+ 1.00
(168891ns)
+

+
+

+ gcd<unsigned> (random prime number products) +

+
+

+ 1.23
(215380ns)
+

+
+

+ 1.57
(276143ns)
+

+
+

+ 2.22
(389655ns)
+

+
+

+ 1.16
(204160ns)
+

+
+

+ 1.77
(311616ns)
+

+
+

+ 1.00
(175753ns)
+

+
+

+ gcd<unsigned> (uniform random numbers) +

+
+

+ 1.31
(360158ns)
+

+
+

+ 1.48
(407011ns)
+

+
+

+ 1.85
(510333ns)
+

+
+

+ 1.31
(360097ns)
+

+
+

+ 1.42
(389754ns)
+

+
+

+ 1.00
(275392ns)
+

+
+
+
+
+
+ + + +

Last revised: April 09, 2017 at 16:45:49 GMT

+
+
+ + diff --git a/src/boost/libs/math/reporting/performance/is_intel_win.cpp b/src/boost/libs/math/reporting/performance/is_intel_win.cpp new file mode 100644 index 00000000..fd1d94d1 --- /dev/null +++ b/src/boost/libs/math/reporting/performance/is_intel_win.cpp @@ -0,0 +1,10 @@ +// Copyright John Maddock 2015. +// 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 + +#ifndef __ICL +#error "wrong compiler" +#endif diff --git a/src/boost/libs/math/reporting/performance/performance.hpp b/src/boost/libs/math/reporting/performance/performance.hpp new file mode 100644 index 00000000..e52fd5c5 --- /dev/null +++ b/src/boost/libs/math/reporting/performance/performance.hpp @@ -0,0 +1,115 @@ +// Copyright John Maddock 2015. +// 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) + +#ifndef PERFORMANCE_HPP +#define PERFORMANCE_HPP + +#include +#include +#include +#include + +template +void add_data(const Array& a) +{ + // + // This function is called multiple times to merge multiple data sets into one big table: + // + for(typename Array::const_iterator i = a.begin(); i != a.end(); ++i) + { + data.push_back(std::vector()); + for(typename Array::value_type::const_iterator j = i->begin(); j != i->end(); ++j) + { + data.back().push_back(*j); + } + } +} + +template +void screen_data(Func f, Result r) +{ + // + // If any of the implementations being tested produces garbage for one of our + // test cases (or else if we test a domain they don't support), then we remove that + // row from the table. This allows us to only test a common supported sub-set for performance: + // + for(std::vector >::size_type row = 0; row < data.size(); ++row) + { + try + { + double computed = f(data[row]); + double expected = r(data[row]); + double err = boost::math::relative_difference(computed, expected); + if(err > 1e-7) + { + std::cout << "Erasing row: "; + for(unsigned i = 0; i < data[row].size(); ++i) + { + std::cout << data[row][i] << " "; + } + std::cout << "Error was " << err << std::endl; + data.erase(data.begin() + row); + --row; + } + } + catch(const std::exception& e) + { + std::cout << "Erasing row: "; + for(unsigned i = 0; i < data[row].size(); ++i) + { + std::cout << data[row][i] << " "; + } + std::cout << "due to thrown exception: " << e.what() << std::endl; + data.erase(data.begin() + row); + --row; + } + } +} + +template +struct stopwatch +{ + typedef typename Clock::duration duration; + stopwatch() + { + m_start = Clock::now(); + } + duration elapsed() + { + return Clock::now() - m_start; + } + void reset() + { + m_start = Clock::now(); + } + +private: + typename Clock::time_point m_start; +}; + +double sum = 0; + +template +double exec_timed_test(Func f) +{ + double t = 0; + unsigned repeats = 1; + do{ + stopwatch w; + + for(unsigned count = 0; count < repeats; ++count) + { + for(std::vector >::const_iterator i = data.begin(); i != data.end(); ++i) + sum += f(*i); + } + + t = boost::chrono::duration_cast>(w.elapsed()).count(); + if(t < 0.5) + repeats *= 2; + } while(t < 0.5); + return t / (repeats * data.size()); +} + +#endif // PERFORMANCE_HPP diff --git a/src/boost/libs/math/reporting/performance/table_helper.cpp b/src/boost/libs/math/reporting/performance/table_helper.cpp new file mode 100644 index 00000000..c8ecfe23 --- /dev/null +++ b/src/boost/libs/math/reporting/performance/table_helper.cpp @@ -0,0 +1,400 @@ +// Copyright John Maddock 2015. +// 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) + +#ifdef _MSC_VER +# pragma warning (disable : 4224) +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "table_helper.hpp" + +void add_cell(boost::intmax_t val, const std::string& table_name, const std::string& row_name, const std::string& column_heading); +void add_to_all_sections(const std::string& id, std::string list_name = "performance_all_sections"); + +std::vector > data; +std::vector > items_to_add; + +inline std::string sanitize_string(const std::string& s) +{ + static const boost::regex e("[^a-zA-Z0-9]+"); + std::string result = boost::regex_replace(s, e, "_"); + while(result[0] == '_') + result.erase(0); + return result; +} + +std::string format_precision(double val, int digits) +{ + std::stringstream ss; + ss << std::setprecision(digits); + ss << std::fixed; + ss << val; + return ss.str(); +} + +static std::string content; +boost::filesystem::path path_to_content; + +struct content_loader +{ + content_loader(){} + ~content_loader() + { + boost::interprocess::named_mutex mu(boost::interprocess::open_or_create, "handle_test_result"); + boost::interprocess::scoped_lock lock(mu); + boost::filesystem::path p(__FILE__); + p = p.parent_path(); + p /= "doc"; + p /= "performance_tables.qbk"; + path_to_content = p; + if(boost::filesystem::exists(p)) + { + boost::filesystem::ifstream is(p); + if(is.good()) + { + do + { + char c = static_cast(is.get()); + if(c != EOF) + content.append(1, c); + } while(is.good()); + } + } + // + // Now iterate through results and add them one at a time: + // + for(auto i = items_to_add.begin(); i != items_to_add.end(); ++i) + { + add_cell(static_cast(std::get<0>(*i) / 1e-9), std::get<1>(*i), std::get<2>(*i), std::get<3>(*i)); + } + // + // Write out the results: + // + boost::filesystem::ofstream os(path_to_content); + os << content; + } + void instantiate()const + { + } +}; + +static const content_loader loader; + +void load_table(std::vector >& table, std::string::const_iterator begin, std::string::const_iterator end) +{ + static const boost::regex item_e( + "\\[" + "([^\\[\\]]*(?0)?)*" + "\\]" + ); + + boost::regex_token_iterator i(begin, end, item_e), j; + + while(i != j) + { + // Add a row: + table.push_back(std::vector()); + boost::regex_token_iterator k(i->first + 1, i->second - 1, item_e); + while(k != j) + { + // Add a cell: + table.back().push_back(std::string(k->first + 1, k->second - 1)); + ++k; + } + ++i; + } +} + +std::string save_table(std::vector >& table) +{ + std::string result; + + for(std::vector >::const_iterator i = table.begin(), j = table.end(); i != j; ++i) + { + result += "["; + for(std::vector::const_iterator k = i->begin(), l = i->end(); k != l; ++k) + { + result += "["; + result += *k; + result += "]"; + } + result += "]\n"; + } + return result; +} + +void add_to_all_sections(const std::string& id, std::string list_name) +{ + std::string::size_type pos = content.find("[template " + list_name + "[]"), end_pos; + if(pos == std::string::npos) + { + // + // Just append to the end: + // + content.append("\n[template ").append(list_name).append("[]\n[").append(id).append("]\n]\n"); + } + else + { + // + // Read in the all list of sections, add our new one (in alphabetical order), + // and then rewrite the whole thing: + // + static const boost::regex item_e( + "\\[" + "((?=[^\\]])[^\\[\\]]*+(?0)?+)*+" + "\\]|\\]" + ); + boost::regex_token_iterator i(content.begin() + pos + 12 + list_name.size(), content.end(), item_e), j; + std::set sections; + while(i != j) + { + if(i->length() == 1) + { + end_pos = i->first - content.begin(); + break; + } + sections.insert(std::string(i->first + 1, i->second - 1)); + ++i; + } + sections.insert(id); + std::string new_list = "\n"; + for(std::set::const_iterator sec = sections.begin(); sec != sections.end(); ++sec) + { + new_list += "[" + *sec + "]\n"; + } + content.replace(pos + 12 + list_name.size(), end_pos - pos - 12 - list_name.size(), new_list); + } +} + +std::string get_colour(boost::uintmax_t val, boost::uintmax_t best) +{ + if(val <= best * 1.2) + return "green"; + if(val > best * 2) + return "red"; + return "blue"; +} + +boost::intmax_t get_value_from_cell(const std::string& cell) +{ + static const boost::regex time_e("(\\d+)ns"); + boost::smatch what; + if(regex_search(cell, what, time_e)) + { + return boost::lexical_cast(what.str(1)); + } + return -1; +} + +void add_cell(boost::intmax_t val, const std::string& table_name, const std::string& row_name, const std::string& column_heading) +{ + // + // Load the table, add our data, and re-write: + // + std::string table_id = "table_" + sanitize_string(table_name); + boost::regex table_e("\\[table:" + table_id + + "\\s[^\\[]++" + "((\\[" + "([^\\[\\]]*+(?2)?+)*+" + "\\]\\s*+)*+\\s*+)" + "\\]" + ); + + boost::smatch table_location; + if(regex_search(content, table_location, table_e)) + { + std::vector > table_data; + load_table(table_data, table_location[1].first, table_location[1].second); + // + // Figure out which column we're on: + // + unsigned column_id = 1001u; + for(unsigned i = 0; i < table_data[0].size(); ++i) + { + if(table_data[0][i] == column_heading) + { + column_id = i; + break; + } + } + if(column_id > 1000) + { + // + // Need a new column, must be adding a new compiler to the table! + // + table_data[0].push_back(column_heading); + for(unsigned i = 1; i < table_data.size(); ++i) + table_data[i].push_back(std::string()); + column_id = table_data[0].size() - 1; + } + // + // Figure out the row: + // + unsigned row_id = 1001; + for(unsigned i = 1; i < table_data.size(); ++i) + { + if(table_data[i][0] == row_name) + { + row_id = i; + break; + } + } + if(row_id > 1000) + { + // + // Need a new row, add it now: + // + table_data.push_back(std::vector()); + table_data.back().push_back(row_name); + for(unsigned i = 1; i < table_data[0].size(); ++i) + table_data.back().push_back(std::string()); + row_id = table_data.size() - 1; + } + // + // Find the best result in this row: + // + boost::uintmax_t best = (std::numeric_limits::max)(); + std::vector values; + for(unsigned i = 1; i < table_data[row_id].size(); ++i) + { + if(i == column_id) + { + if(val < best) + best = val; + values.push_back(val); + } + else + { + std::cout << "Existing cell value was " << table_data[row_id][i] << std::endl; + boost::uintmax_t cell_val = get_value_from_cell(table_data[row_id][i]); + std::cout << "Extracted value: " << cell_val << std::endl; + if(cell_val < best) + best = cell_val; + values.push_back(cell_val); + } + } + // + // Update the row: + // + for(unsigned i = 1; i < table_data[row_id].size(); ++i) + { + std::string& s = table_data[row_id][i]; + s = "[role "; + if(values[i - 1] < 0) + { + s += "grey -]"; + } + else + { + s += get_colour(values[i - 1], best); + s += " "; + s += format_precision(static_cast(values[i - 1]) / best, 2); + s += "[br]("; + s += boost::lexical_cast(values[i - 1]) + "ns)]"; + } + } + // + // Convert back to a string and insert into content: + std::sort(table_data.begin() + 1, table_data.end(), [](std::vector const& a, std::vector const& b) { return a[0] < b[0]; } ); + std::string c = save_table(table_data); + content.replace(table_location.position(1), table_location.length(1), c); + } + else + { + // + // Create a new table and try again: + // + std::string new_table = "\n[template " + table_id; + new_table += "[]\n[table:" + table_id; + new_table += " "; + new_table += table_name; + new_table += "\n[[Function]["; + new_table += column_heading; + new_table += "]]\n"; + new_table += "[["; + new_table += row_name; + new_table += "][[role blue 1.00[br]("; + new_table += boost::lexical_cast(val); + new_table += "ns)]]]\n]\n]\n"; + + std::string::size_type pos = content.find("[/tables:]"); + if(pos != std::string::npos) + content.insert(pos + 10, new_table); + else + content += "\n\n[/tables:]\n" + new_table; + // + // Add a section for this table as well: + // + std::string section_id = "section_" + sanitize_string(table_name); + if(content.find(section_id + "[]") == std::string::npos) + { + std::string new_section = "\n[template " + section_id + "[]\n[section:" + section_id + " " + table_name + "]\n[" + table_id + "]\n[endsect]\n]\n"; + pos = content.find("[/sections:]"); + if(pos != std::string::npos) + content.insert(pos + 12, new_section); + else + content += "\n\n[/sections:]\n" + new_section; + add_to_all_sections(section_id); + } + // + // Add to list of all tables (not in sections): + // + add_to_all_sections(table_id, "performance_all_tables"); + } +} + +void report_execution_time(double t, std::string table, std::string row, std::string heading) +{ + items_to_add.push_back(std::make_tuple(t, table, row, heading)); + //add_cell(static_cast(t / 1e-9), table, row, heading); +} + +std::string get_compiler_options_name() +{ +#if defined(BOOST_MSVC) || defined(__ICL) + std::string result; +#ifdef BOOST_MSVC + result = "cl "; +#else + result = "icl "; +#endif +#ifdef _M_AMD64 +#ifdef __AVX__ + result += "/arch:AVX /Ox"; +#else + result += "/Ox"; +#endif + result += " (x64 build)"; +#else +#ifdef _DEBUG + result += "/Od"; +#elif defined(__AVX2__) + result += "/arch:AVX2 /Ox"; +#elif defined(__AVX__) + result += "/arch:AVX /Ox"; +#elif _M_IX86_FP == 2 + result += "/arch:sse2 /Ox"; +#else + result += "/arch:ia32 /Ox"; +#endif + result += " (x86 build)"; +#endif + std::cout << "Compiler options are found as: " << result << std::endl; + return result; +#else + return "Unknown"; +#endif +} + diff --git a/src/boost/libs/math/reporting/performance/table_helper.hpp b/src/boost/libs/math/reporting/performance/table_helper.hpp new file mode 100644 index 00000000..e9eca81b --- /dev/null +++ b/src/boost/libs/math/reporting/performance/table_helper.hpp @@ -0,0 +1,325 @@ +// Copyright John Maddock 2015. +// 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) + +#ifndef TABLE_HELPER_HPP +#define TABLE_HELPER_HPP + +#include +#include +#include +#include + +// +// Also include headers for whatever else we may be testing: +// +#ifdef TEST_LIBSTDCXX +#include +#include +#endif +#ifdef TEST_GSL +#include +#include +#include + +void gsl_handler(const char * reason, const char * file, int line, int gsl_errno) +{ + if(gsl_errno == GSL_ERANGE) return; // handle zero or infinity in our test code. +#ifdef DISTRIBUTIONS_TEST + return; +#else + throw std::domain_error(reason); +#endif +} + +struct gsl_error_handler_setter +{ + gsl_error_handler_t * old_handler; + gsl_error_handler_setter() + { + old_handler = gsl_set_error_handler(gsl_handler); + } + ~gsl_error_handler_setter() + { + gsl_set_error_handler(old_handler); + } +}; + +static const gsl_error_handler_setter handler; + +#endif + +#ifdef TEST_RMATH +// Rmath overloads ftrunc, leading to strange errors from GCC unless we include this: +#include +#define MATHLIB_STANDALONE +#include +#endif + +#ifdef TEST_DCDFLIB +extern "C" { + extern void cdfbet(int*, double*, double*, double*, double*, double*, double*, int*, double*); + extern void cdfbin(int*, double*, double*, double*, double*, double*, double*, int*, double*); + extern void cdfchi(int*, double*, double*, double*, double*, int*, double*); + extern void cdfchn(int*, double*, double*, double*, double*, double*, int*, double*); + extern void cdff(int*, double*, double*, double*, double*, double*, int*, double*); + extern void cdffnc(int*, double*, double*, double*, double*, double*, double*, int*s, double*); + extern void cdfgam(int*, double*, double*, double*, double*, double*, int*, double*); + extern void cdfnbn(int*, double*, double*, double*, double*, double*, double*, int*, double*); + extern void cdfnor(int*, double*, double*, double*, double*, double*, int*, double*); + extern void cdfpoi(int*, double*, double*, double*, double*, int*, double*); + extern void cdft(int*, double*, double*, double*, double*, int*, double*); + extern void cdftnc(int*, double*, double*, double*, double*, double*, int*, double*); +} + +inline double dcdflib_beta_cdf(double x, double a, double b) +{ + int what = 1; + int status = 0; + double p, q, bound, y(1-x); + cdfbet(&what, &p, &q, &x, &y, &a, &b, &status, &bound); + return p; +} + +inline double dcdflib_beta_quantile(double p, double a, double b) +{ + int what = 2; + int status = 0; + double x, y, bound, q(1 - p); + cdfbet(&what, &p, &q, &x, &y, &a, &b, &status, &bound); + return x; +} + +inline double dcdflib_binomial_cdf(double x, double s, double sf) +{ + int what = 1; + int status = 0; + double p, q, bound, sfc(1-sf); + cdfbin(&what, &p, &q, &x, &s, &sf, &sfc, &status, &bound); + return p; +} + +inline double dcdflib_binomial_quantile(double p, double s, double sf) +{ + int what = 2; + int status = 0; + double x, bound, q(1 - p), sfc(1-sf); + cdfbin(&what, &p, &q, &x, &s, &sf, &sfc, &status, &bound); + return x; +} + +inline double dcdflib_chi_cdf(double x, double df) +{ + int what = 1; + int status = 0; + double p, q, bound; + cdfchi(&what, &p, &q, &x, &df, &status, &bound); + return p; +} + +inline double dcdflib_chi_quantile(double p, double df) +{ + int what = 2; + int status = 0; + double x, bound, q(1 - p); + cdfchi(&what, &p, &q, &x, &df, &status, &bound); + return x; +} + +inline double dcdflib_chi_n_cdf(double x, double df, double nc) +{ + int what = 1; + int status = 0; + double p, q, bound; + cdfchn(&what, &p, &q, &x, &df, &nc, &status, &bound); + return p; +} + +inline double dcdflib_chi_n_quantile(double p, double df, double nc) +{ + int what = 2; + int status = 0; + double x, bound, q(1 - p); + cdfchn(&what, &p, &q, &x, &df, &nc, &status, &bound); + return x; +} + +inline double dcdflib_f_cdf(double x, double df1, double df2) +{ + int what = 1; + int status = 0; + double p, q, bound; + cdff(&what, &p, &q, &x, &df1, &df2, &status, &bound); + return p; +} + +inline double dcdflib_f_quantile(double p, double df1, double df2) +{ + int what = 2; + int status = 0; + double x, bound, q(1 - p); + cdff(&what, &p, &q, &x, &df1, &df2, &status, &bound); + return x; +} + +inline double dcdflib_f_n_cdf(double x, double df1, double df2, double nc) +{ + int what = 1; + int status = 0; + double p, q, bound; + cdffnc(&what, &p, &q, &x, &df1, &df2, &nc, &status, &bound); + return p; +} + +inline double dcdflib_f_n_quantile(double p, double df1, double df2, double nc) +{ + int what = 2; + int status = 0; + double x, bound, q(1 - p); + cdffnc(&what, &p, &q, &x, &df1, &df2, &nc, &status, &bound); + return x; +} + +inline double dcdflib_gamma_cdf(double x, double shape, double scale) +{ + int what = 1; + int status = 0; + double p, q, bound; + scale = 1 / scale; + cdfgam(&what, &p, &q, &x, &shape, &scale, &status, &bound); + return p; +} + +inline double dcdflib_gamma_quantile(double p, double shape, double scale) +{ + int what = 2; + int status = 0; + double x, bound, q(1 - p); + scale = 1 / scale; + cdfgam(&what, &p, &q, &x, &shape, &scale, &status, &bound); + return x; +} + +inline double dcdflib_nbin_cdf(double x, double r, double sf) +{ + int what = 1; + int status = 0; + double p, q, bound, sfc(1 - sf); + cdfnbn(&what, &p, &q, &x, &r, &sf, &sfc, &status, &bound); + return p; +} + +inline double dcdflib_nbin_quantile(double p, double r, double sf) +{ + int what = 2; + int status = 0; + double x, bound, q(1 - p), sfc(1 - sf); + cdfnbn(&what, &p, &q, &x, &r, &sf, &sfc, &status, &bound); + return x; +} + +inline double dcdflib_norm_cdf(double x, double mean, double sd) +{ + int what = 1; + int status = 0; + double p, q, bound; + cdfnor(&what, &p, &q, &x, &mean, &sd, &status, &bound); + return p; +} + +inline double dcdflib_norm_quantile(double p, double mean, double sd) +{ + int what = 2; + int status = 0; + double x, bound, q(1 - p); + cdfnor(&what, &p, &q, &x, &mean, &sd, &status, &bound); + return x; +} + +inline double dcdflib_poisson_cdf(double x, double param) +{ + int what = 1; + int status = 0; + double p, q, bound; + cdfpoi(&what, &p, &q, &x, ¶m, &status, &bound); + return p; +} + +inline double dcdflib_poisson_quantile(double p, double param) +{ + int what = 2; + int status = 0; + double x, bound, q(1 - p); + cdfpoi(&what, &p, &q, &x, ¶m, &status, &bound); + return x; +} + +inline double dcdflib_t_cdf(double x, double param) +{ + int what = 1; + int status = 0; + double p, q, bound; + cdft(&what, &p, &q, &x, ¶m, &status, &bound); + return p; +} + +inline double dcdflib_t_quantile(double p, double param) +{ + int what = 2; + int status = 0; + double x, bound, q(1 - p); + cdft(&what, &p, &q, &x, ¶m, &status, &bound); + return x; +} + +inline double dcdflib_t_n_cdf(double x, double param, double nc) +{ + int what = 1; + int status = 0; + double p, q, bound; + cdftnc(&what, &p, &q, &x, ¶m, &nc, &status, &bound); + return p; +} + +inline double dcdflib_t_n_quantile(double p, double param, double nc) +{ + int what = 2; + int status = 0; + double x, bound, q(1 - p); + cdftnc(&what, &p, &q, &x, ¶m, &nc, &status, &bound); + return x; +} + +#endif + +extern std::vector > data; + +void report_execution_time(double t, std::string table, std::string row, std::string heading); +std::string get_compiler_options_name(); + +inline std::string boost_name() +{ + return "boost " + boost::lexical_cast(BOOST_VERSION / 100000) + "." + boost::lexical_cast((BOOST_VERSION / 100) % 1000); +} + +inline std::string compiler_name() +{ +#ifdef COMPILER_NAME + return COMPILER_NAME; +#else + return BOOST_COMPILER; +#endif +} + +inline std::string platform_name() +{ +#ifdef _WIN32 + return "Windows x64"; +#else + return BOOST_PLATFORM; +#endif +} + +#endif // TABLE_HELPER_HPP + diff --git a/src/boost/libs/math/reporting/performance/test_assoc_laguerre.cpp b/src/boost/libs/math/reporting/performance/test_assoc_laguerre.cpp new file mode 100644 index 00000000..0232bb4e --- /dev/null +++ b/src/boost/libs/math/reporting/performance/test_assoc_laguerre.cpp @@ -0,0 +1,81 @@ +// Copyright John Maddock 2015. +// 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) + +#ifdef _MSC_VER +# pragma warning (disable : 4224) +#endif + +#include +#include +#include +#include "../../test/table_type.hpp" +#include "table_helper.hpp" +#include "performance.hpp" +#include + +typedef double T; +#define SC_(x) static_cast(x) + +int main() +{ +# include "laguerre3.ipp" + + add_data(laguerre3); + + unsigned data_total = data.size(); + + screen_data([](const std::vector& v){ return boost::math::laguerre(v[0], v[1], v[2]); }, [](const std::vector& v){ return v[3]; }); + + +#if defined(TEST_LIBSTDCXX) && !defined(COMPILER_COMPARISON_TABLES) + screen_data([](const std::vector& v){ return std::tr1::assoc_laguerre(v[0], v[1], v[2]); }, [](const std::vector& v){ return v[3]; }); +#endif +#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES) + screen_data([](const std::vector& v){ return gsl_sf_laguerre_n(v[0], v[1], v[2]); }, [](const std::vector& v){ return v[3]; }); +#endif + + unsigned data_used = data.size(); + std::string function = "assoc_laguerre[br](" + boost::lexical_cast(data_used) + "/" + boost::lexical_cast(data_total) + " tests selected)"; + std::string function_short = "assoc_laguerre"; + + double time; + + time = exec_timed_test([](const std::vector& v){ return boost::math::laguerre(v[0], v[1], v[2]); }); + std::cout << time << std::endl; +#if !defined(COMPILER_COMPARISON_TABLES) && (defined(TEST_GSL) || defined(TEST_RMATH) || defined(TEST_LIBSTDCXX)) + report_execution_time(time, std::string("Library Comparison with ") + std::string(compiler_name()) + std::string(" on ") + platform_name(), function, boost_name()); +#endif + report_execution_time(time, std::string("Compiler Comparison on ") + std::string(platform_name()), function_short, compiler_name() + std::string("[br]") + boost_name()); + // + // Boost again, but with promotion to long double turned off: + // +#if !defined(COMPILER_COMPARISON_TABLES) + if(sizeof(long double) != sizeof(double)) + { + time = exec_timed_test([](const std::vector& v){ return boost::math::laguerre(v[0], v[1], v[2], boost::math::policies::make_policy(boost::math::policies::promote_double())); }); + std::cout << time << std::endl; +#if !defined(COMPILER_COMPARISON_TABLES) && (defined(TEST_GSL) || defined(TEST_RMATH) || defined(TEST_LIBSTDCXX)) + report_execution_time(time, std::string("Library Comparison with ") + std::string(compiler_name()) + std::string(" on ") + platform_name(), function, boost_name() + "[br]promote_double"); +#endif + report_execution_time(time, std::string("Compiler Comparison on ") + std::string(platform_name()), function_short, compiler_name() + std::string("[br]") + boost_name() + "[br]promote_double"); + } +#endif + + +#if defined(TEST_LIBSTDCXX) && !defined(COMPILER_COMPARISON_TABLES) + time = exec_timed_test([](const std::vector& v){ return std::tr1::assoc_laguerre(v[0], v[1], v[2]); }); + std::cout << time << std::endl; + report_execution_time(time, std::string("Library Comparison with ") + std::string(compiler_name()) + std::string(" on ") + platform_name(), function, "tr1/cmath"); +#endif +#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES) + time = exec_timed_test([](const std::vector& v){ return gsl_sf_laguerre_n(v[0], v[1], v[2]); }); + std::cout << time << std::endl; + report_execution_time(time, std::string("Library Comparison with ") + std::string(compiler_name()) + std::string(" on ") + platform_name(), function, "GSL " GSL_VERSION); +#endif + + + return 0; +} + diff --git a/src/boost/libs/math/reporting/performance/test_assoc_legendre.cpp b/src/boost/libs/math/reporting/performance/test_assoc_legendre.cpp new file mode 100644 index 00000000..8245f9f4 --- /dev/null +++ b/src/boost/libs/math/reporting/performance/test_assoc_legendre.cpp @@ -0,0 +1,80 @@ +// Copyright John Maddock 2015. +// 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) + +#ifdef _MSC_VER +# pragma warning (disable : 4224) +#endif + +#include +#include +#include +#include "../../test/table_type.hpp" +#include "table_helper.hpp" +#include "performance.hpp" +#include + +typedef double T; +#define SC_(x) static_cast(x) + +int main() +{ +# include "assoc_legendre_p.ipp" + + add_data(assoc_legendre_p); + + unsigned data_total = data.size(); + + screen_data([](const std::vector& v){ return boost::math::legendre_p(v[0], v[1], v[2]); }, [](const std::vector& v){ return v[3]; }); + + +#if defined(TEST_LIBSTDCXX) && !defined(COMPILER_COMPARISON_TABLES) + screen_data([](const std::vector& v){ return std::tr1::assoc_legendre(v[0], v[1], v[2]); }, [](const std::vector& v){ return v[3]; }); +#endif +#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES) + screen_data([](const std::vector& v){ return gsl_sf_legendre_Plm(v[0], v[1], v[2]); }, [](const std::vector& v){ return v[3]; }); +#endif + + unsigned data_used = data.size(); + std::string function = "assoc_legendre[br](" + boost::lexical_cast(data_used) + "/" + boost::lexical_cast(data_total) + " tests selected)"; + std::string function_short = "assoc_legendre"; + + double time; + + time = exec_timed_test([](const std::vector& v){ return boost::math::legendre_p(v[0], v[1], v[2]); }); + std::cout << time << std::endl; +#if !defined(COMPILER_COMPARISON_TABLES) && (defined(TEST_GSL) || defined(TEST_RMATH)) + report_execution_time(time, std::string("Library Comparison with ") + std::string(compiler_name()) + std::string(" on ") + platform_name(), function, boost_name()); +#endif + report_execution_time(time, std::string("Compiler Comparison on ") + std::string(platform_name()), function_short, compiler_name() + std::string("[br]") + boost_name()); + // + // Boost again, but with promotion to long double turned off: + // +#if !defined(COMPILER_COMPARISON_TABLES) + if(sizeof(long double) != sizeof(double)) + { + time = exec_timed_test([](const std::vector& v){ return boost::math::legendre_p(v[0], v[1], v[2], boost::math::policies::make_policy(boost::math::policies::promote_double())); }); + std::cout << time << std::endl; +#if !defined(COMPILER_COMPARISON_TABLES) && (defined(TEST_GSL) || defined(TEST_RMATH)) + report_execution_time(time, std::string("Library Comparison with ") + std::string(compiler_name()) + std::string(" on ") + platform_name(), function, boost_name() + "[br]promote_double"); +#endif + report_execution_time(time, std::string("Compiler Comparison on ") + std::string(platform_name()), function_short, compiler_name() + std::string("[br]") + boost_name() + "[br]promote_double"); + } +#endif + + +#if defined(TEST_LIBSTDCXX) && !defined(COMPILER_COMPARISON_TABLES) + time = exec_timed_test([](const std::vector& v){ return std::tr1::assoc_legendre(v[0], v[1], v[2]); }); + std::cout << time << std::endl; + report_execution_time(time, std::string("Library Comparison with ") + std::string(compiler_name()) + std::string(" on ") + platform_name(), function, "tr1/cmath"); +#endif +#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES) + time = exec_timed_test([](const std::vector& v){ return gsl_sf_legendre_Plm(v[0], v[1], v[2]); }); + std::cout << time << std::endl; + report_execution_time(time, std::string("Library Comparison with ") + std::string(compiler_name()) + std::string(" on ") + platform_name(), function, "GSL " GSL_VERSION); +#endif + + return 0; +} + diff --git a/src/boost/libs/math/reporting/performance/test_beta.cpp b/src/boost/libs/math/reporting/performance/test_beta.cpp new file mode 100644 index 00000000..7ed8cca8 --- /dev/null +++ b/src/boost/libs/math/reporting/performance/test_beta.cpp @@ -0,0 +1,92 @@ +// Copyright John Maddock 2015. +// 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) + +#ifdef _MSC_VER +# pragma warning (disable : 4224) +#endif + +#include +#include +#include +#include "../../test/table_type.hpp" +#include "table_helper.hpp" +#include "performance.hpp" +#include + +typedef double T; +#define SC_(x) static_cast(x) + +int main() +{ +# include "beta_small_data.ipp" +# include "beta_med_data.ipp" +# include "beta_exp_data.ipp" + + add_data(beta_small_data); + add_data(beta_med_data); + add_data(beta_exp_data); + + unsigned data_total = data.size(); + + screen_data([](const std::vector& v){ return boost::math::beta(v[0], v[1]); }, [](const std::vector& v){ return v[2]; }); + + +#if defined(TEST_LIBSTDCXX) && !defined(COMPILER_COMPARISON_TABLES) + screen_data([](const std::vector& v){ return std::tr1::beta(v[0], v[1]); }, [](const std::vector& v){ return v[2]; }); +#endif +#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES) + screen_data([](const std::vector& v){ return gsl_sf_beta(v[0], v[1]); }, [](const std::vector& v){ return v[2]; }); +#endif +#if defined(TEST_RMATH) && !defined(COMPILER_COMPARISON_TABLES) + screen_data([](const std::vector& v){ return beta(v[0], v[1]); }, [](const std::vector& v){ return v[2]; }); +#endif + + unsigned data_used = data.size(); + std::string function = "beta[br](" + boost::lexical_cast(data_used) + "/" + boost::lexical_cast(data_total) + " tests selected)"; + std::string function_short = "beta"; + + double time; + + time = exec_timed_test([](const std::vector& v){ return boost::math::beta(v[0], v[1]); }); + std::cout << time << std::endl; +#if !defined(COMPILER_COMPARISON_TABLES) && (defined(TEST_GSL) || defined(TEST_RMATH) || defined(TEST_LIBSTDCXX)) + report_execution_time(time, std::string("Library Comparison with ") + std::string(compiler_name()) + std::string(" on ") + platform_name(), function, boost_name()); +#endif + report_execution_time(time, std::string("Compiler Comparison on ") + std::string(platform_name()), function_short, compiler_name() + std::string("[br]") + boost_name()); + // + // Boost again, but with promotion to long double turned off: + // +#if !defined(COMPILER_COMPARISON_TABLES) + if(sizeof(long double) != sizeof(double)) + { + time = exec_timed_test([](const std::vector& v){ return boost::math::beta(v[0], v[1], boost::math::policies::make_policy(boost::math::policies::promote_double())); }); + std::cout << time << std::endl; +#if !defined(COMPILER_COMPARISON_TABLES) && (defined(TEST_GSL) || defined(TEST_RMATH) || defined(TEST_LIBSTDCXX)) + report_execution_time(time, std::string("Library Comparison with ") + std::string(compiler_name()) + std::string(" on ") + platform_name(), function, boost_name() + "[br]promote_double"); +#endif + report_execution_time(time, std::string("Compiler Comparison on ") + std::string(platform_name()), function_short, compiler_name() + std::string("[br]") + boost_name() + "[br]promote_double"); + } +#endif + + +#if defined(TEST_LIBSTDCXX) && !defined(COMPILER_COMPARISON_TABLES) + time = exec_timed_test([](const std::vector& v){ return std::tr1::beta(v[0], v[1]); }); + std::cout << time << std::endl; + report_execution_time(time, std::string("Library Comparison with ") + std::string(compiler_name()) + std::string(" on ") + platform_name(), function, "tr1/cmath"); +#endif +#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES) + time = exec_timed_test([](const std::vector& v){ return gsl_sf_beta(v[0], v[1]); }); + std::cout << time << std::endl; + report_execution_time(time, std::string("Library Comparison with ") + std::string(compiler_name()) + std::string(" on ") + platform_name(), function, "GSL " GSL_VERSION); +#endif +#if defined(TEST_RMATH) && !defined(COMPILER_COMPARISON_TABLES) + time = exec_timed_test([](const std::vector& v){ return beta(v[0], v[1]); }); + std::cout << time << std::endl; + report_execution_time(time, std::string("Library Comparison with ") + std::string(compiler_name()) + std::string(" on ") + platform_name(), function, "Rmath " R_VERSION_STRING); +#endif + + return 0; +} + diff --git a/src/boost/libs/math/reporting/performance/test_beta_inc.cpp b/src/boost/libs/math/reporting/performance/test_beta_inc.cpp new file mode 100644 index 00000000..a9b78a87 --- /dev/null +++ b/src/boost/libs/math/reporting/performance/test_beta_inc.cpp @@ -0,0 +1,81 @@ +// Copyright John Maddock 2015. +// 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) + +#ifdef _MSC_VER +# pragma warning (disable : 4224) +#endif + +#include +#include +#include +#include "../../test/table_type.hpp" +#include "table_helper.hpp" +#include "performance.hpp" +#include + +typedef double T; +#define SC_(x) static_cast(x) + + +int main() +{ +# include "ibeta_small_data.ipp" +# include "ibeta_data.ipp" +# include "ibeta_large_data.ipp" +# include "ibeta_int_data.ipp" + + add_data(ibeta_small_data); + add_data(ibeta_data); + add_data(ibeta_large_data); + add_data(ibeta_int_data); + + unsigned data_total = data.size(); + + std::cout << "Screening boost data:\n"; + screen_data([](const std::vector& v){ return boost::math::ibeta(v[0], v[1], v[2]); }, [](const std::vector& v){ return v[5]; }); + + +#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES) + std::cout << "Screening gsl data:\n"; + screen_data([](const std::vector& v){ return gsl_sf_beta_inc(v[0], v[1], v[2]); }, [](const std::vector& v){ return v[5]; }); +#endif + + unsigned data_used = data.size(); + std::string function = "beta (incomplete)[br](" + boost::lexical_cast(data_used) + "/" + boost::lexical_cast(data_total) + " tests selected)"; + std::string function_short = "beta (incomplete)"; + + double time; + + time = exec_timed_test([](const std::vector& v){ return boost::math::beta(v[0], v[1], v[2]); }); + std::cout << time << std::endl; +#if !defined(COMPILER_COMPARISON_TABLES) && (defined(TEST_GSL) || defined(TEST_RMATH)) + report_execution_time(time, std::string("Library Comparison with ") + std::string(compiler_name()) + std::string(" on ") + platform_name(), function, boost_name()); +#endif + report_execution_time(time, std::string("Compiler Comparison on ") + std::string(platform_name()), function_short, compiler_name() + std::string("[br]") + boost_name()); + // + // Boost again, but with promotion to long double turned off: + // +#if !defined(COMPILER_COMPARISON_TABLES) + if(sizeof(long double) != sizeof(double)) + { + time = exec_timed_test([](const std::vector& v){ return boost::math::beta(v[0], v[1], v[2], boost::math::policies::make_policy(boost::math::policies::promote_double())); }); + std::cout << time << std::endl; +#if !defined(COMPILER_COMPARISON_TABLES) && (defined(TEST_GSL) || defined(TEST_RMATH)) + report_execution_time(time, std::string("Library Comparison with ") + std::string(compiler_name()) + std::string(" on ") + platform_name(), function, boost_name() + "[br]promote_double"); +#endif + report_execution_time(time, std::string("Compiler Comparison on ") + std::string(platform_name()), function_short, compiler_name() + std::string("[br]") + boost_name() + "[br]promote_double"); + } +#endif + + +#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES) + time = exec_timed_test([](const std::vector& v){ return gsl_sf_beta_inc(v[0], v[1], v[2]); }); + std::cout << time << std::endl; + report_execution_time(time, std::string("Library Comparison with ") + std::string(compiler_name()) + std::string(" on ") + platform_name(), function, "GSL " GSL_VERSION); +#endif + + return 0; +} + diff --git a/src/boost/libs/math/reporting/performance/test_cbrt.cpp b/src/boost/libs/math/reporting/performance/test_cbrt.cpp new file mode 100644 index 00000000..8be48f90 --- /dev/null +++ b/src/boost/libs/math/reporting/performance/test_cbrt.cpp @@ -0,0 +1,81 @@ +// Copyright John Maddock 2015. +// 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) + +#ifdef _MSC_VER +# pragma warning (disable : 4224) +#endif + +#include +#include +#include +#include "../../test/table_type.hpp" +#include "table_helper.hpp" +#include "performance.hpp" +#include + +int main() +{ + typedef double T; +#define SC_(x) static_cast(x) +# include "../../test/cbrt_data.ipp" + + add_data(cbrt_data); + + unsigned data_total = data.size(); + + screen_data([](const std::vector& v){ return boost::math::cbrt(v[1]); }, [](const std::vector& v){ return v[0]; }); + +#if defined(TEST_C99) && !defined(COMPILER_COMPARISON_TABLES) + screen_data([](const std::vector& v){ return ::cbrt(v[1]); }, [](const std::vector& v){ return v[0]; }); +#endif +#if defined(TEST_LIBSTDCXX) && !defined(COMPILER_COMPARISON_TABLES) + screen_data([](const std::vector& v){ return std::tr1::cbrt(v[1]); }, [](const std::vector& v){ return v[0]; }); +#endif + + unsigned data_used = data.size(); + std::string function = "cbrt[br](" + boost::lexical_cast(data_used) + "/" + boost::lexical_cast(data_total) + " tests selected)"; + std::string function_short = "cbrt"; + + double time = exec_timed_test([](const std::vector& v){ return boost::math::cbrt(v[1]); }); + std::cout << time << std::endl; +#if defined(COMPILER_COMPARISON_TABLES) + report_execution_time(time, std::string("Compiler Option Comparison on ") + platform_name(), "boost::math::cbrt", get_compiler_options_name()); +#else +#if !defined(COMPILER_COMPARISON_TABLES) && (defined(TEST_GSL) || defined(TEST_RMATH) || defined(TEST_C99) || defined(TEST_LIBSTDCXX)) + report_execution_time(time, std::string("Library Comparison with ") + std::string(compiler_name()) + std::string(" on ") + platform_name(), function, boost_name()); +#endif + report_execution_time(time, std::string("Compiler Comparison on ") + std::string(platform_name()), function_short, compiler_name() + std::string("[br]") + boost_name()); +#endif + // + // Boost again, but with promotion to long double turned off: + // +#if !defined(COMPILER_COMPARISON_TABLES) + if(sizeof(long double) != sizeof(double)) + { + double time = exec_timed_test([](const std::vector& v){ return boost::math::cbrt(v[1], boost::math::policies::make_policy(boost::math::policies::promote_double())); }); + std::cout << time << std::endl; +#if !defined(COMPILER_COMPARISON_TABLES) && (defined(TEST_GSL) || defined(TEST_RMATH) || defined(TEST_C99) || defined(TEST_LIBSTDCXX)) + report_execution_time(time, std::string("Library Comparison with ") + std::string(compiler_name()) + std::string(" on ") + platform_name(), function, boost_name() + "[br]promote_double"); +#endif + report_execution_time(time, std::string("Compiler Comparison on ") + std::string(platform_name()), function_short, compiler_name() + std::string("[br]") + boost_name() + "[br]promote_double"); + } +#endif + + +#if defined(TEST_C99) && !defined(COMPILER_COMPARISON_TABLES) + time = exec_timed_test([](const std::vector& v){ return ::cbrt(v[1]); }); + std::cout << time << std::endl; + report_execution_time(time, std::string("Library Comparison with ") + std::string(compiler_name()) + std::string(" on ") + platform_name(), function, "math.h"); +#endif +#if defined(TEST_LIBSTDCXX) && !defined(COMPILER_COMPARISON_TABLES) + time = exec_timed_test([](const std::vector& v){ return std::tr1::cbrt(v[1]); }); + std::cout << time << std::endl; + report_execution_time(time, std::string("Library Comparison with ") + std::string(compiler_name()) + std::string(" on ") + platform_name(), function, "tr1/cmath"); +#endif + + + return 0; +} + diff --git a/src/boost/libs/math/reporting/performance/test_cn.cpp b/src/boost/libs/math/reporting/performance/test_cn.cpp new file mode 100644 index 00000000..eac28da7 --- /dev/null +++ b/src/boost/libs/math/reporting/performance/test_cn.cpp @@ -0,0 +1,135 @@ +// Copyright John Maddock 2015. +// 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) + +#ifdef _MSC_VER +# pragma warning (disable : 4224) +#endif + +#include +#include +#include +#include "../../test/table_type.hpp" +#include "table_helper.hpp" +#include "performance.hpp" +#include + +typedef double T; +#define SC_(x) static_cast(x) + static const boost::array, 36> data1 = {{ + {{ SC_(0.0), SC_(0.0), SC_(0.0), SC_(1.0), SC_(1.0) }}, + {{ ldexp(T(1), -25), ldexp(T(1), -25), SC_(2.98023223876953080883700663838486782870427050521881839342311e-8), SC_(0.99999999999999955591079014993741669975171697261290223678373), SC_(0.99999999999999999999999999999960556954738949421406900774443) }}, + {{ -ldexp(T(1), -25), ldexp(T(1), -25), SC_(-2.98023223876953080883700663838486782870427050521881839342311e-8), SC_(0.99999999999999955591079014993741669975171697261290223678373), SC_(0.99999999999999999999999999999960556954738949421406900774443) }}, + {{ SC_(0.25), ldexp(T(1), -25), SC_(0.247403959254522927383635623557663763268693729825996390997241), SC_(0.968912421710644784709721529742747886950140086772629513814665), SC_(0.99999999999999997281786831901333837240938011109848356555885) }}, + {{ SC_(-0.25), ldexp(T(1), -25), SC_(-0.247403959254522927383635623557663763268693729825996390997241), SC_(0.968912421710644784709721529742747886950140086772629513814665), SC_(0.99999999999999997281786831901333837240938011109848356555885) }}, + {{ SC_(1.25), ldexp(T(1), -25), SC_(0.948984619355586147780156037971989352776684194861616269831136), SC_(0.315322362395268865789580233344649598639316847638615703458263), SC_(0.99999999999999960006577747263860127231780811081154547949983) }}, + {{ SC_(-1.25), ldexp(T(1), -25), SC_(-0.948984619355586147780156037971989352776684194861616269831136), SC_(0.315322362395268865789580233344649598639316847638615703458263), SC_(0.99999999999999960006577747263860127231780811081154547949983) }}, + {{ SC_(25.0), ldexp(T(1), -25), SC_(-0.132351750097778560056127137329035522219365438979106560464704), SC_(0.991202811863472859528158119981178957382802975691690722810123), SC_(0.99999999999999999222089563757583834413059580275315226870704) }}, + {{ SC_(-25.0), ldexp(T(1), -25), SC_(0.132351750097778560056127137329035522219365438979106560464704), SC_(0.991202811863472859528158119981178957382802975691690722810123), SC_(0.99999999999999999222089563757583834413059580275315226870704) }}, + {{ ldexp(T(1), -25), SC_(0.5), SC_(2.98023223876953058825550995757802173334628440851964836958219e-8), SC_(0.99999999999999955591079014993744956895610118130967536624417), SC_(0.99999999999999988897769753748438088116649141278818704012037) }}, + {{ -ldexp(T(1), -25), SC_(0.5), SC_(-2.98023223876953058825550995757802173334628440851964836958219e-8), SC_(0.99999999999999955591079014993744956895610118130967536624417), SC_(0.99999999999999988897769753748438088116649141278818704012037) }}, + {{ SC_(0.25), SC_(0.5), SC_(0.246781405136141600483623741101255389743847413013817188632739), SC_(0.969071172865559727608777289021929824625726812182428398055476), SC_(0.992358168465276394946615469032829292963938826683866720698130) }}, + {{ SC_(-0.25), SC_(0.5), SC_(-0.246781405136141600483623741101255389743847413013817188632739), SC_(0.969071172865559727608777289021929824625726812182428398055476), SC_(0.992358168465276394946615469032829292963938826683866720698130) }}, + {{ SC_(1.25), SC_(0.5), SC_(0.928561236426319775700204388269999130782711902203415239399579), SC_(0.371179242693370810357222594552131893184749696381729988511999), SC_(0.885688154799196841458565445994481097477880319663264816077719) }}, + {{ SC_(-1.25), SC_(0.5), SC_(-0.928561236426319775700204388269999130782711902203415239399579), SC_(0.371179242693370810357222594552131893184749696381729988511999), SC_(0.885688154799196841458565445994481097477880319663264816077719) }}, + {{ SC_(25.0), SC_(0.5), SC_(-0.969223071486651608400225080456020493867827336842041561445359), SC_(-0.246184154035106463351874891855925292474628176040625311168501), SC_(0.874729477852721764836147376110255133761608728373832418508248) }}, + {{ SC_(-25.0), SC_(0.5), SC_(0.969223071486651608400225080456020493867827336842041561445359), SC_(-0.246184154035106463351874891855925292474628176040625311168501), SC_(0.874729477852721764836147376110255133761608728373832418508248) }}, + {{ ldexp(T(1), -25), 1 - ldexp(T(1), -9), SC_(2.98023223876953036939562331632512854347569015560128614888589e-8), SC_(0.99999999999999955591079014993754766348947956082687878223721), SC_(0.99999999999999955764381956001984590118394542979655101564079) }}, + {{ -ldexp(T(1), -25), 1 - ldexp(T(1), -9), SC_(-2.98023223876953036939562331632512854347569015560128614888589e-8), SC_(0.99999999999999955591079014993754766348947956082687878223721), SC_(0.99999999999999955764381956001984590118394542979655101564079) }}, + {{ SC_(0.25), 1 - ldexp(T(1), -9), SC_(0.244928335616519632082236089277654937383208524525331032303082), SC_(0.969541185516180906431546524888118346090913555188425579774305), SC_(0.969661908643964623248878987955178702010392829596222190545649) }}, + {{ SC_(-0.25), 1 - ldexp(T(1), -9), SC_(-0.244928335616519632082236089277654937383208524525331032303082), SC_(0.969541185516180906431546524888118346090913555188425579774305), SC_(0.969661908643964623248878987955178702010392829596222190545649) }}, + {{ SC_(1.25), 1 - ldexp(T(1), -9), SC_(0.848768940045053312079390719205939167551169094157365783446523), SC_(0.528763923140371497228677918580246099580380684604621321430057), SC_(0.531415689278260818860813380561526095359692710060403584603095) }}, + {{ SC_(-1.25), 1 - ldexp(T(1), -9), SC_(-0.848768940045053312079390719205939167551169094157365783446523), SC_(0.528763923140371497228677918580246099580380684604621321430057), SC_(0.531415689278260818860813380561526095359692710060403584603095) }}, + {{ SC_(25.0), 1 - ldexp(T(1), -9), SC_(-0.0252326124525503880903568715488227138184083895871544015366337), SC_(-0.999681606947341709011836635135181960590782564534371631099332), SC_(0.999682849652724146508471774051629114156076052044812654903417) }}, + {{ SC_(-25.0), 1 - ldexp(T(1), -9), SC_(0.0252326124525503880903568715488227138184083895871544015366337), SC_(-0.999681606947341709011836635135181960590782564534371631099332), SC_(0.999682849652724146508471774051629114156076052044812654903417) }}, + + // Try modulus > 1 + {{ ldexp(T(1), -25), SC_(1.5), SC_(2.98023223876952981622027157475276613133414644789222481971590e-8), SC_(0.999999999999999555910790149937712522591174851747994454928040), SC_(0.999999999999999000799277837359575841918151654603571877092161) }}, + {{ -ldexp(T(1), -25), SC_(1.5), SC_(-2.98023223876952981622027157475276613133414644789222481971590e-8), SC_(0.999999999999999555910790149937712522591174851747994454928040), SC_(0.999999999999999000799277837359575841918151654603571877092161) }}, + {{ SC_(0.25), SC_(1.5), SC_(0.241830488135945315134822478837394038661484435596992059686086), SC_(0.970318512143270619246031961334217540099946232418710982266812), SC_(0.931888155181641649031244632258710371461078255228024421800363) }}, + {{ SC_(-0.25), SC_(1.5), SC_(-0.241830488135945315134822478837394038661484435596992059686086), SC_(0.970318512143270619246031961334217540099946232418710982266812), SC_(0.931888155181641649031244632258710371461078255228024421800363) }}, + {{ SC_(1.25), SC_(1.5), SC_(0.665875890711922169121186264316618499018039094009893317545462), SC_(0.746062529663971452521312655373498959968622875614588791642250), SC_(-0.0486921028438866868299166778939466685768843580182675008164949) }}, + {{ SC_(-1.25), SC_(1.5), SC_(-0.665875890711922169121186264316618499018039094009893317545462), SC_(0.746062529663971452521312655373498959968622875614588791642250), SC_(-0.0486921028438866868299166778939466685768843580182675008164949) }}, + {{ SC_(25.0), SC_(1.5), SC_(0.618665338981368217712277210270169521641154921220796362724248), SC_(0.785654630447163313102421517325310755764805805534154371583941), SC_(0.372585153048138377269609818284480926623056458773704266654150) }}, + {{ SC_(-25.0), SC_(1.5), SC_(-0.618665338981368217712277210270169521641154921220796362724248), SC_(0.785654630447163313102421517325310755764805805534154371583941), SC_(0.372585153048138377269609818284480926623056458773704266654150) }}, + + // Special Values: + {{ SC_(0.0), SC_(0.5), SC_(0.0), SC_(1.0), SC_(1.0) }}, + {{ SC_(5.0), SC_(0.0), SC_(-0.958924274663138468893154406155993973352461543964601778131672), SC_(0.283662185463226264466639171513557308334422592252215944930359), SC_(1.0) }}, + {{ SC_(5.0), SC_(1.0), SC_(0.999909204262595131210990447534473021089812615990547862736429), SC_(0.0134752822213045573055191382448821552908373539417006868332819), SC_(0.0134752822213045573055191382448821552908373539417006868332819) }}, + }}; + + +int main() +{ +#include "jacobi_elliptic.ipp" +#include "jacobi_elliptic_small.ipp" +#include "jacobi_near_1.ipp" +#include "jacobi_large_phi.ipp" + + add_data(data1); + add_data(jacobi_elliptic); + add_data(jacobi_elliptic_small); + add_data(jacobi_near_1); + add_data(jacobi_large_phi); + + unsigned data_total = data.size(); + + + std::cout << "Screening Boost data:\n"; + screen_data([](const std::vector& v){ return boost::math::jacobi_cn(v[1], v[0]); }, [](const std::vector& v){ return v[3]; }); + + +#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES) + std::cout << "Screening GSL data:\n"; + screen_data([](const std::vector& v) + { + double s, c, d; + gsl_sf_elljac_e(v[0], v[1] * v[1], &s, &c, &d); + return c; + }, [](const std::vector& v){ return v[3]; }); +#endif + + unsigned data_used = data.size(); + std::string function = "jacobi_cn[br](" + boost::lexical_cast(data_used) + "/" + boost::lexical_cast(data_total) + " tests selected)"; + std::string function_short = "jacobi_cn"; + + double time; + + time = exec_timed_test([](const std::vector& v){ return boost::math::jacobi_cn(v[1], v[2]); }); + std::cout << time << std::endl; +#if !defined(COMPILER_COMPARISON_TABLES) && (defined(TEST_GSL) || defined(TEST_RMATH)) + report_execution_time(time, std::string("Library Comparison with ") + std::string(compiler_name()) + std::string(" on ") + platform_name(), function, boost_name()); +#endif + report_execution_time(time, std::string("Compiler Comparison on ") + std::string(platform_name()), function_short, compiler_name() + std::string("[br]") + boost_name()); + // + // Boost again, but with promotion to long double turned off: + // +#if !defined(COMPILER_COMPARISON_TABLES) + if(sizeof(long double) != sizeof(double)) + { + time = exec_timed_test([](const std::vector& v){ return boost::math::jacobi_cn(v[1], v[0], boost::math::policies::make_policy(boost::math::policies::promote_double())); }); + std::cout << time << std::endl; +#if !defined(COMPILER_COMPARISON_TABLES) && (defined(TEST_GSL) || defined(TEST_RMATH)) + report_execution_time(time, std::string("Library Comparison with ") + std::string(compiler_name()) + std::string(" on ") + platform_name(), function, boost_name() + "[br]promote_double"); +#endif + report_execution_time(time, std::string("Compiler Comparison on ") + std::string(platform_name()), function_short, compiler_name() + std::string("[br]") + boost_name() + "[br]promote_double"); + } +#endif + + +#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES) + time = exec_timed_test([](const std::vector& v) + { + double s, c, d; + gsl_sf_elljac_e(v[0], v[1] * v[1], &s, &c, &d); + return c; + }); + std::cout << time << std::endl; + report_execution_time(time, std::string("Library Comparison with ") + std::string(compiler_name()) + std::string(" on ") + platform_name(), function, "GSL " GSL_VERSION); +#endif + + return 0; +} + diff --git a/src/boost/libs/math/reporting/performance/test_digamma.cpp b/src/boost/libs/math/reporting/performance/test_digamma.cpp new file mode 100644 index 00000000..57a598e1 --- /dev/null +++ b/src/boost/libs/math/reporting/performance/test_digamma.cpp @@ -0,0 +1,100 @@ +// Copyright John Maddock 2015. +// 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) + +#ifdef _MSC_VER +# pragma warning (disable : 4224) +#endif + +#include +#include +#include +#include "../../test/table_type.hpp" +#include "table_helper.hpp" +#include "performance.hpp" +#include + +int main() +{ + typedef double T; +#define SC_(x) static_cast(x) +# include "digamma_data.ipp" +# include "digamma_root_data.ipp" +# include "digamma_small_data.ipp" +# include "digamma_neg_data.ipp" + static const boost::array, 5> digamma_bugs = {{ + // Test cases from Rocco Romeo: + {{ static_cast(std::ldexp(1.0, -100)), SC_(-1.26765060022822940149670320537657721566490153286060651209008e30) }}, + {{ static_cast(-std::ldexp(1.0, -100)), SC_(1.26765060022822940149670320537542278433509846713939348790992e30) }}, + {{ static_cast(1), SC_(-0.577215664901532860606512090082402431042159335939923598805767) }}, + {{ static_cast(-1) + static_cast(std::ldexp(1.0, -20)), SC_(-1.04857557721314249602848739817764518743062133735858753112190e6) }}, + {{ static_cast(-1) - static_cast(std::ldexp(1.0, -20)), SC_(1.04857642278181269259522681939281063878220298942888100442172e6) }}, + }}; + static const boost::array, 40> digamma_integers = { { + { 1, SC_(-0.57721566490153286060651209008240243) }, { 2, SC_(0.42278433509846713939348790991759757) }, { 3, SC_(0.92278433509846713939348790991759757) }, { 4, SC_(1.2561176684318004727268212432509309) }, { 5, SC_(1.5061176684318004727268212432509309) }, { 6, SC_(1.7061176684318004727268212432509309) }, { 7, SC_(1.8727843350984671393934879099175976) }, { 8, SC_(2.0156414779556099965363450527747404) }, { 9, SC_(2.1406414779556099965363450527747404) }, { SC_(10.0), SC_(2.2517525890667211076474561638858515) }, { SC_(11.0), SC_(2.3517525890667211076474561638858515) }, { SC_(12.0), SC_(2.4426616799758120167383652547949424) }, { SC_(13.0), SC_(2.5259950133091453500716985881282758) }, { SC_(14.0), SC_(2.6029180902322222731486216650513527) }, { SC_(15.0), SC_(2.6743466616607937017200502364799241) }, { SC_(16.0), SC_(2.7410133283274603683867169031465908) }, { SC_(17.0), SC_(2.8035133283274603683867169031465908) }, { SC_(18.0), SC_(2.8623368577392250742690698443230614) }, { SC_(19.0), SC_(2.9178924132947806298246253998786169) }, { SC_(20.0), SC_(2.9705239922421490508772569788259854) }, { SC_(21.0), SC_(3.0205239922421490508772569788259854) }, { SC_(22.0), SC_(3.0681430398611966699248760264450330) }, { SC_(23.0), SC_(3.1135975853157421244703305718995784) }, { SC_(24.0), SC_(3.1570758461853073418616349197256654) }, { SC_(25.0), SC_(3.1987425128519740085283015863923321) }, { SC_(26.0), SC_(3.2387425128519740085283015863923321) }, { SC_(27.0), SC_(3.2772040513135124700667631248538705) }, { SC_(28.0), SC_(3.3142410883505495071038001618909076) }, { SC_(29.0), SC_(3.3499553740648352213895144476051933) }, { SC_(30.0), SC_(3.3844381326855248765619282407086415) }, { SC_(31.0), SC_(3.4177714660188582098952615740419749) }, { SC_(32.0), SC_(3.4500295305349872421533260901710071) }, { SC_(33.0), SC_(3.4812795305349872421533260901710071) }, { SC_(34.0), SC_(3.5115825608380175451836291204740374) }, { SC_(35.0), SC_(3.5409943255438998981248055910622727) }, { SC_(36.0), SC_(3.5695657541153284695533770196337013) }, { SC_(37.0), SC_(3.5973435318931062473311547974114791) }, { SC_(38.0), SC_(3.6243705589201332743581818244385061) }, { SC_(39.0), SC_(3.6506863483938174848844976139121903) }, { SC_(40.0), SC_(3.6763273740348431259101386395532160) } + } }; + static const boost::array, 41> digamma_half_integers = { { + { SC_(0.5), SC_(-1.9635100260214234794409763329987556) }, { SC_(1.5), SC_(0.036489973978576520559023667001244433) }, { SC_(2.5), SC_(0.70315664064524318722569033366791110) }, { SC_(3.5), SC_(1.1031566406452431872256903336679111) }, { SC_(4.5), SC_(1.3888709263595289015114046193821968) }, { SC_(5.5), SC_(1.6110931485817511237336268416044190) }, { SC_(6.5), SC_(1.7929113303999329419154450234226009) }, { SC_(7.5), SC_(1.9467574842460867880692911772687547) }, { SC_(8.5), SC_(2.0800908175794201214026245106020880) }, { SC_(9.5), SC_(2.1977378764029495331673303929550292) }, { SC_(10.5), SC_(2.3030010342976863752725935508497661) }, { SC_(11.5), SC_(2.3982391295357816133678316460878613) }, { SC_(12.5), SC_(2.4851956512749120481504403417400352) }, { SC_(13.5), SC_(2.5651956512749120481504403417400352) }, { SC_(14.5), SC_(2.6392697253489861222245144158141093) }, { SC_(15.5), SC_(2.7082352425903654325693420020210058) }, { SC_(16.5), SC_(2.7727513716226234970854710342790703) }, { SC_(17.5), SC_(2.8333574322286841031460770948851310) }, { SC_(18.5), SC_(2.8905002893715412460032199520279881) }, { SC_(19.5), SC_(2.9445543434255953000572740060820421) }, { SC_(20.5), SC_(2.9958363947076465821085560573640934) }, { SC_(21.5), SC_(3.0446168825125246308890438622421422) }, { SC_(22.5), SC_(3.0911285104195013750750903738700492) }, { SC_(23.5), SC_(3.1355729548639458195195348183144936) }, { SC_(24.5), SC_(3.1781261463533075216471943927825787) }, { SC_(25.5), SC_(3.2189424728839197665451535764560481) }, { SC_(26.5), SC_(3.2581581591584295704667222039070285) }, { SC_(27.5), SC_(3.2958940082150333440516278642843870) }, { SC_(28.5), SC_(3.3322576445786697076879915006480234) }, { SC_(29.5), SC_(3.3673453638769153217230792199462690) }, { SC_(30.5), SC_(3.4012436689616610844349436267259300) }, { SC_(31.5), SC_(3.4340305542075627237792059218078972) }, { SC_(32.5), SC_(3.4657765859535944698109519535539290) }, { SC_(33.5), SC_(3.4965458167228252390417211843231597) }, { SC_(34.5), SC_(3.5263965629914819554596316320843538) }, { SC_(35.5), SC_(3.5553820702378587670538345306350784) }, { SC_(36.5), SC_(3.5835510843223658093073556573956418) }, { SC_(37.5), SC_(3.6109483445963384120470816847929021) }, { SC_(38.5), SC_(3.6376150112630050787137483514595687) }, { SC_(39.5), SC_(3.6635890372370310527397223774335947) }, { SC_(40.5), SC_(3.6889054929332335843852919976867593) } + } }; + + add_data(digamma_data); + add_data(digamma_root_data); + add_data(digamma_small_data); + add_data(digamma_neg_data); + add_data(digamma_bugs); + add_data(digamma_integers); + add_data(digamma_half_integers); + + unsigned data_total = data.size(); + + screen_data([](const std::vector& v){ return boost::math::digamma(v[0]); }, [](const std::vector& v){ return v[1]; }); + + +#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES) + screen_data([](const std::vector& v){ return gsl_sf_psi(v[0]); }, [](const std::vector& v){ return v[1]; }); +#endif +#if defined(TEST_RMATH) && !defined(COMPILER_COMPARISON_TABLES) + screen_data([](const std::vector& v){ return ::digamma(v[0]); }, [](const std::vector& v){ return v[1]; }); +#endif + + unsigned data_used = data.size(); + std::string function = "digamma[br](" + boost::lexical_cast(data_used) + "/" + boost::lexical_cast(data_total) + " tests selected)"; + std::string function_short = "digamma"; + + double time = exec_timed_test([](const std::vector& v){ return boost::math::digamma(v[0]); }); + std::cout << time << std::endl; +#if !defined(COMPILER_COMPARISON_TABLES) && (defined(TEST_GSL) || defined(TEST_RMATH)) + report_execution_time(time, std::string("Library Comparison with ") + std::string(compiler_name()) + std::string(" on ") + platform_name(), function, boost_name()); +#endif + report_execution_time(time, std::string("Compiler Comparison on ") + std::string(platform_name()), function_short, compiler_name() + std::string("[br]") + boost_name()); + // + // Boost again, but with promotion to long double turned off: + // +#if !defined(COMPILER_COMPARISON_TABLES) + if(sizeof(long double) != sizeof(double)) + { + double time = exec_timed_test([](const std::vector& v){ return boost::math::digamma(v[0], boost::math::policies::make_policy(boost::math::policies::promote_double())); }); + std::cout << time << std::endl; +#if !defined(COMPILER_COMPARISON_TABLES) && (defined(TEST_GSL) || defined(TEST_RMATH)) + report_execution_time(time, std::string("Library Comparison with ") + std::string(compiler_name()) + std::string(" on ") + platform_name(), function, boost_name() + "[br]promote_double"); +#endif + report_execution_time(time, std::string("Compiler Comparison on ") + std::string(platform_name()), function_short, compiler_name() + std::string("[br]") + boost_name() + "[br]promote_double"); + } +#endif + + +#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES) + time = exec_timed_test([](const std::vector& v){ return gsl_sf_psi(v[0]); }); + std::cout << time << std::endl; + report_execution_time(time, std::string("Library Comparison with ") + std::string(compiler_name()) + std::string(" on ") + platform_name(), function, "GSL " GSL_VERSION); +#endif +#if defined(TEST_RMATH) && !defined(COMPILER_COMPARISON_TABLES) + time = exec_timed_test([](const std::vector& v){ return ::digamma(v[0]); }); + std::cout << time << std::endl; + report_execution_time(time, std::string("Library Comparison with ") + std::string(compiler_name()) + std::string(" on ") + platform_name(), function, "Rmath " R_VERSION_STRING); +#endif + + return 0; +} + diff --git a/src/boost/libs/math/reporting/performance/test_distributions.cpp b/src/boost/libs/math/reporting/performance/test_distributions.cpp new file mode 100644 index 00000000..016df73f --- /dev/null +++ b/src/boost/libs/math/reporting/performance/test_distributions.cpp @@ -0,0 +1,750 @@ +// Copyright John Maddock 2015. +// 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) + +#ifdef _MSC_VER +# pragma warning (disable : 4224) +#endif + +#define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error +#define DISTRIBUTIONS_TEST + +#include +#include +#include +#include "../../test/table_type.hpp" +#include "table_helper.hpp" +#include "performance.hpp" +#include + +#ifdef TEST_GSL +#include +#endif + +class distribution_tester +{ + std::string distro_name; + static const double quantiles[19]; + double sum; + + struct param_info + { + std::vector params; + std::vector x_values; + }; + std::vector tests; + double sanitize_x(double x) + { + if(x > boost::math::tools::max_value() / 2) + return boost::math::tools::max_value() / 2; + if(x < -boost::math::tools::max_value() / 2) + return -boost::math::tools::max_value() / 2; + return x; + } +public: + distribution_tester(const char* name) : distro_name(name), sum(0) {} + + template + void add_test_case(F f) + { + tests.push_back(param_info()); + for(unsigned i = 0; i < sizeof(quantiles) / sizeof(quantiles[0]); ++i) + { + tests.back().x_values.push_back(sanitize_x(f(quantiles[i]))); + } + } + template + void add_test_case(double p1, F f) + { + tests.push_back(param_info()); + tests.back().params.push_back(p1); + for(unsigned i = 0; i < sizeof(quantiles) / sizeof(quantiles[0]); ++i) + { + tests.back().x_values.push_back(sanitize_x(f(p1, quantiles[i]))); + } + } + template + void add_test_case(double p1, double p2, F f) + { + tests.push_back(param_info()); + tests.back().params.push_back(p1); + tests.back().params.push_back(p2); + for(unsigned i = 0; i < sizeof(quantiles) / sizeof(quantiles[0]); ++i) + { + tests.back().x_values.push_back(sanitize_x(f(p1, p2, quantiles[i]))); + } + } + template + void add_test_case(double p1, double p2, double p3, F f) + { + tests.push_back(param_info()); + tests.back().params.push_back(p1); + tests.back().params.push_back(p2); + tests.back().params.push_back(p3); + for(unsigned i = 0; i < sizeof(quantiles) / sizeof(quantiles[0]); ++i) + { + tests.back().x_values.push_back(sanitize_x(f(p1, p2, p3, quantiles[i]))); + } + } + + enum + { + main_table = 1, + boost_only_table = 2, + both_tables = 3 + }; + + template + void run_timed_tests(F f, std::string sub_name, std::string column, bool p_value = false, int where = main_table) + { + std::cout << "Testing " << distro_name + " (" + std::string(sub_name) + ")" << " with library " << column << std::endl; + try{ + double t = 0; + unsigned repeats = 1; + unsigned data_size; + do{ + data_size = 0; + stopwatch w; + + for(unsigned count = 0; count < repeats; ++count) + { + for(unsigned i = 0; i < tests.size(); ++i) + { + for(unsigned j = 0; j < tests[i].x_values.size(); ++j) + { + if((boost::math::isfinite)(tests[i].x_values[j])) + sum += f(tests[i].params, p_value ? quantiles[j] : tests[i].x_values[j]); + ++data_size; + } + } + } + + t = boost::chrono::duration_cast>(w.elapsed()).count(); + if(t < 0.5) + repeats *= 2; + } while(t < 0.5); + + static const std::string main_table_name = std::string("Distribution performance comparison with ") + compiler_name() + std::string(" on ") + platform_name(); + static const std::string boost_table_name = std::string("Distribution performance comparison for different performance options with ") + compiler_name() + std::string(" on ") + platform_name(); + + if (where & 1) + { + report_execution_time( + t / data_size, + main_table_name, + distro_name + " (" + std::string(sub_name) + ")", + column); + } + if (where & 2) + { + report_execution_time( + t / data_size, + boost_table_name, + distro_name + " (" + std::string(sub_name) + ")", + column); + } + } + catch(const std::exception& e) + { + std::cerr << "Aborting due to exception: " << e.what() << std::endl; + std::cerr << "In " << distro_name + " (" + std::string(sub_name) + ")" << std::endl; + report_execution_time( + (std::numeric_limits::max)(), + std::string("Distribution performance comparison with ") + compiler_name() + std::string(" on ") + platform_name(), + distro_name + " (" + std::string(sub_name) + ")", + column); + } + } +}; + +const double distribution_tester::quantiles[19] = +{ + 0.000001, + 0.00001, + 0.0001, + 0.001, + 0.01, + 0.1, + 0.2, + 0.3, + 0.4, + 0.5, + 0.6, + 0.7, + 0.8, + 0.9, + 0.99, + 0.999, + 0.9999, + 0.99999, + 0.999999 +}; + +template +struct three_param_quantile +{ + template + double operator()(T x, U y, V z, X q)const + { + return quantile(D(x, y, z), q); + } +}; + +template +struct two_param_quantile +{ + template + double operator()(T x, U y, V q)const + { + return quantile(D(x, y), q); + } +}; + +template +struct one_param_quantile +{ + template + double operator()(T x, V q)const + { + return quantile(D(x), q); + } +}; + +template