mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2026-06-05 15:34:39 -04:00
Squashed 'boost/' content from commit b4feb19f2
git-subtree-dir: boost git-subtree-split: b4feb19f287ee92d87a9624b5d36b7cf46aeadeb
This commit is contained in:
@@ -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>../../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 ;
|
||||
|
||||
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
|
||||
<link>static
|
||||
[ check-target-builds $(here)/third_party/cephes_double/acosh.c : : <build>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 : <define>ALWAYS_TEST_DOUBLE : ]
|
||||
<target-os>linux:<linkflags>-lpthread
|
||||
<target-os>linux:<linkflags>-lrt
|
||||
<toolset>gcc:<linkflags>$(OTHERFLAGS) ]
|
||||
;
|
||||
result += [ run $(source) /boost/regex//boost_regex /boost/system /boost/filesystem /boost/test//boost_unit_test_framework
|
||||
: : : [ check-target-builds has_libstdcxx_tr1 : <define>TEST_LIBSTDCXX : <build>no ]
|
||||
<target-os>linux:<linkflags>-lpthread
|
||||
<target-os>linux:<linkflags>-lrt
|
||||
<toolset>gcc:<linkflags>$(OTHERFLAGS)
|
||||
: $(source:B)_libstdcxx_tr1 ]
|
||||
;
|
||||
result += [ run $(source) /boost/regex//boost_regex /boost/system /boost/filesystem /boost/test//boost_unit_test_framework
|
||||
: : : [ check-target-builds has_c99_cmath : <define>TEST_C99 : <build>no ]
|
||||
<target-os>linux:<linkflags>-lpthread
|
||||
<target-os>linux:<linkflags>-lrt
|
||||
<toolset>gcc:<linkflags>$(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 : <define>TEST_GSL : <build>no ]
|
||||
<target-os>linux:<linkflags>-lpthread
|
||||
<target-os>linux:<linkflags>-lrt
|
||||
<toolset>gcc:<linkflags>$(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 : <define>TEST_RMATH : <build>no ]
|
||||
<target-os>linux:<linkflags>-lpthread
|
||||
<target-os>linux:<linkflags>-lrt
|
||||
<toolset>gcc:<linkflags>$(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 : <define>TEST_CEPHES <source>cephes_double : <build>no ]
|
||||
<target-os>linux:<linkflags>-lpthread
|
||||
<target-os>linux:<linkflags>-lrt
|
||||
<toolset>gcc:<linkflags>$(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 : <dependency>report_gen ;
|
||||
boostbook standalone
|
||||
:
|
||||
report
|
||||
:
|
||||
# Path for links to Boost:
|
||||
<xsl:param>boost.root=../../../../..
|
||||
|
||||
# Some general style settings:
|
||||
<xsl:param>table.footnote.number.format=1
|
||||
<xsl:param>footnote.number.format=1
|
||||
<xsl:param>html.stylesheet=http://www.boost.org/doc/libs/1_58_0/doc/src/boostbook.css
|
||||
|
||||
# HTML options first:
|
||||
# Use graphics not text for navigation:
|
||||
<xsl:param>navig.graphics=1
|
||||
# How far down we chunk nested sections, basically all of them:
|
||||
<xsl:param>chunk.section.depth=0
|
||||
# Don't put the first section on the same page as the TOC:
|
||||
<xsl:param>chunk.first.sections=0
|
||||
# How far down sections get TOC's
|
||||
<xsl:param>toc.section.depth=2
|
||||
# Max depth in each TOC:
|
||||
<xsl:param>toc.max.depth=4
|
||||
# How far down we go with TOC's
|
||||
<xsl:param>generate.section.toc.level=10
|
||||
;
|
||||
|
||||
@@ -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)
|
||||
|
||||
#ifndef BOOST_MATH_BINDINGS
|
||||
#define BOOST_MATH_BINDINGS
|
||||
|
||||
#define ERROR_REPORTING_MODE
|
||||
|
||||
#if TEST_LIBSTDCXX
|
||||
|
||||
#include <tr1/cmath>
|
||||
#include <stdexcept>
|
||||
|
||||
#define TEST_LIBRARY_NAME "<tr1/cmath>"
|
||||
|
||||
#define LOG1P_FUNCTION_TO_TEST std::tr1::log1p
|
||||
#define EXPM1_FUNCTION_TO_TEST std::tr1::log1p
|
||||
|
||||
#define CBRT_FUNCTION_TO_TEST std::tr1::cbrt
|
||||
#define ERF_FUNCTION_TO_TEST std::tr1::erf
|
||||
#define ERFC_FUNCTION_TO_TEST std::tr1::erfc
|
||||
|
||||
#define LGAMMA_FUNCTION_TO_TEST std::tr1::lgamma
|
||||
#define TGAMMA_FUNCTION_TO_TEST std::tr1::tgamma
|
||||
|
||||
#define BESSEL_I_FUNCTION_TO_TEST std::tr1::cyl_bessel_i
|
||||
#define BESSEL_IN_FUNCTION_TO_TEST std::tr1::cyl_bessel_i
|
||||
#define BESSEL_J_FUNCTION_TO_TEST std::tr1::cyl_bessel_j
|
||||
#define BESSEL_JN_FUNCTION_TO_TEST std::tr1::cyl_bessel_j
|
||||
#define BESSEL_JS_FUNCTION_TO_TEST std::tr1::sph_bessel
|
||||
#define BESSEL_K_FUNCTION_TO_TEST std::tr1::cyl_bessel_k
|
||||
#define BESSEL_KN_FUNCTION_TO_TEST std::tr1::cyl_bessel_k
|
||||
#define BESSEL_Y_FUNCTION_TO_TEST std::tr1::cyl_neumann
|
||||
#define BESSEL_YN_FUNCTION_TO_TEST std::tr1::cyl_neumann
|
||||
#define BESSEL_YS_FUNCTION_TO_TEST std::tr1::sph_neumann
|
||||
|
||||
#define BETA_FUNCTION_TO_TEST std::tr1::beta
|
||||
|
||||
#define ELLINT_1_FUNCTION_TO_TEST std::tr1::ellint_1
|
||||
#define ELLINT_1C_FUNCTION_TO_TEST std::tr1::comp_ellint_1
|
||||
#define ELLINT_2_FUNCTION_TO_TEST std::tr1::ellint_2
|
||||
#define ELLINT_2C_FUNCTION_TO_TEST std::tr1::comp_ellint_2
|
||||
#define ELLINT_3_FUNCTION_TO_TEST std::tr1::ellint_3
|
||||
#define ELLINT_3C_FUNCTION_TO_TEST std::tr1::comp_ellint_3
|
||||
|
||||
#define EI_FUNCTION_TO_TEST std::tr1::expint
|
||||
|
||||
#define LAGUERRE_FUNCTION_TO_TEST std::tr1::laguerre
|
||||
#define ASSOC_LAGUERRE_FUNCTION_TO_TEST std::tr1::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::tr1::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::tr1::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::tr1::riemann_zeta
|
||||
|
||||
#define TYPE_TO_TEST long double
|
||||
|
||||
#elif defined(TEST_C99)
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#define TEST_LIBRARY_NAME "<math.h>"
|
||||
|
||||
#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 <stdexcept>
|
||||
|
||||
#include <gsl/gsl_sf.h>
|
||||
#include <gsl/gsl_errno.h>
|
||||
#include <gsl/gsl_version.h>
|
||||
|
||||
#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<T>
|
||||
|
||||
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, 0.0, 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 <Rmath.h>
|
||||
|
||||
#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) { 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) { 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<T>
|
||||
|
||||
//#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) { 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 <class T> T do_nc_beta_cdf(T a, T b, T nc, T x){ return pnbeta(x, a, b, nc, 1, 0); }
|
||||
template <class T> T do_nc_beta_ccdf(T a, T b, T nc, T x){ return pnbeta(x, a, b, nc, 0, 0); }
|
||||
template <class T> T do_nc_chi_squared_cdf(T df, T nc, T x){ return pnchisq(x, df, nc, 1, 0); }
|
||||
template <class T> T do_nc_chi_squared_ccdf(T df, T nc, T x){ return pnchisq(x, df, nc, 0, 0); }
|
||||
template <class T> T do_nc_t_cdf(T df, T nc, T x){ return pnt(x, df, nc, 1, 0); }
|
||||
template <class T> 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<T>
|
||||
|
||||
//#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 <boost/math/distributions/non_central_beta.hpp>
|
||||
#include <boost/math/distributions/non_central_chi_squared.hpp>
|
||||
#include <boost/math/distributions/non_central_t.hpp>
|
||||
|
||||
#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<T>
|
||||
|
||||
#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 <class T> T do_nc_beta_cdf(T a, T b, T nc, T x){ return cdf(boost::math::non_central_beta_distribution<T>(a, b, nc), x); }
|
||||
template <class T> T do_nc_beta_ccdf(T a, T b, T nc, T x){ return cdf(complement(boost::math::non_central_beta_distribution<T>(a, b, nc), x)); }
|
||||
template <class T> T do_nc_chi_squared_cdf(T df, T nc, T x){ return cdf(boost::math::non_central_chi_squared_distribution<T>(df, nc), x); }
|
||||
template <class T> T do_nc_chi_squared_ccdf(T df, T nc, T x){ return cdf(complement(boost::math::non_central_chi_squared_distribution<T>(df, nc), x)); }
|
||||
template <class T> T do_nc_t_cdf(T df, T nc, T x){ return cdf(boost::math::non_central_t_distribution<T>(df, nc), x); }
|
||||
template <class T> T do_nc_t_ccdf(T df, T nc, T x){ return cdf(complement(boost::math::non_central_t_distribution<T>(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
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,33 @@
|
||||
[article Special Function Error Rates Report
|
||||
[quickbook 1.6]
|
||||
[/purpose ISBN 0-9504833-2-X 978-0-9504833-2-0, Classification 519.2-dc22]
|
||||
[license
|
||||
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 accuracy_tables.qbk]
|
||||
[import ../../../doc/html4_symbols.qbk]
|
||||
|
||||
[all_sections]
|
||||
|
||||
[section:error_logs Error Logs]
|
||||
|
||||
[all_errors]
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:all_the_tables Tables]
|
||||
|
||||
[all_tables]
|
||||
|
||||
[endsect]
|
||||
|
||||
[/
|
||||
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).
|
||||
]
|
||||
@@ -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 <boost/math/tools/stats.hpp>
|
||||
#include <boost/math/tools/precision.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/regex.hpp>
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/filesystem/fstream.hpp>
|
||||
#include <boost/interprocess/sync/named_mutex.hpp>
|
||||
#include <boost/interprocess/sync/scoped_lock.hpp>
|
||||
#include <boost/math/special_functions/fpclassify.hpp>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
|
||||
#include <boost/math/tools/test.hpp>
|
||||
|
||||
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<boost::interprocess::named_mutex> 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<char>(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<std::vector<std::string> >& table, std::string::const_iterator begin, std::string::const_iterator end)
|
||||
{
|
||||
static const boost::regex item_e(
|
||||
"\\["
|
||||
"([^\\[\\]]*(?0)?)*"
|
||||
"\\]"
|
||||
);
|
||||
|
||||
boost::regex_token_iterator<std::string::const_iterator> i(begin, end, item_e), j;
|
||||
|
||||
while(i != j)
|
||||
{
|
||||
// Add a row:
|
||||
table.push_back(std::vector<std::string>());
|
||||
boost::regex_token_iterator<std::string::const_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<std::vector<std::string> >& table)
|
||||
{
|
||||
std::string result;
|
||||
|
||||
for(std::vector<std::vector<std::string> >::const_iterator i = table.begin(), j = table.end(); i != j; ++i)
|
||||
{
|
||||
result += "[";
|
||||
for(std::vector<std::string>::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<std::string::const_iterator> i(content.begin() + pos + 12 + list_name.size(), content.end(), item_e), j;
|
||||
std::set<std::string> 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<std::string>::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<std::vector<std::string> > 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<std::string>());
|
||||
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 <class T, class Seq>
|
||||
void handle_test_result(const boost::math::tools::test_result<T>& 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>();
|
||||
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::stringbuf*>(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
|
||||
|
||||
@@ -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 <math.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
long double d = 1;
|
||||
|
||||
d = ::erf(d);
|
||||
d = ::erfc(d);
|
||||
d = ::tgamma(d);
|
||||
d = ::lgamma(d);
|
||||
return d != 0 ? 0 : 1;
|
||||
}
|
||||
@@ -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 <gsl/gsl_sf.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
double d = gsl_sf_bessel_Jn(2, 1.0);
|
||||
return d != 0 ? 0 : 1;
|
||||
}
|
||||
@@ -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 <tr1/cmath>
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -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 <Rmath.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
double d = psigamma(2.0, 4);
|
||||
return d != 0 ? 0 : 1;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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/math/special_functions/bessel.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_bessel(static_cast<TYPE_TO_TEST>(0), NAME_OF_TYPE_TO_TEST);
|
||||
|
||||
#else
|
||||
bool test_float = false;
|
||||
bool test_double = false;
|
||||
bool test_long_double = false;
|
||||
|
||||
if(std::numeric_limits<long double>::digits == std::numeric_limits<double>::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
|
||||
}
|
||||
|
||||
@@ -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/math/special_functions/bessel_prime.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_bessel(static_cast<TYPE_TO_TEST>(0), NAME_OF_TYPE_TO_TEST);
|
||||
|
||||
#else
|
||||
bool test_float = false;
|
||||
bool test_double = false;
|
||||
bool test_long_double = false;
|
||||
|
||||
if(std::numeric_limits<long double>::digits == std::numeric_limits<double>::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
|
||||
}
|
||||
|
||||
@@ -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/math/special_functions/bessel.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_bessel(static_cast<TYPE_TO_TEST>(0), NAME_OF_TYPE_TO_TEST);
|
||||
|
||||
#else
|
||||
bool test_float = false;
|
||||
bool test_double = false;
|
||||
bool test_long_double = false;
|
||||
|
||||
if(std::numeric_limits<long double>::digits == std::numeric_limits<double>::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
|
||||
}
|
||||
|
||||
@@ -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/math/special_functions/bessel_prime.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_bessel_prime(static_cast<TYPE_TO_TEST>(0), NAME_OF_TYPE_TO_TEST);
|
||||
|
||||
#else
|
||||
bool test_float = false;
|
||||
bool test_double = false;
|
||||
bool test_long_double = false;
|
||||
|
||||
if(std::numeric_limits<long double>::digits == std::numeric_limits<double>::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
|
||||
}
|
||||
|
||||
@@ -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/math/special_functions/bessel.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_bessel(static_cast<TYPE_TO_TEST>(0), NAME_OF_TYPE_TO_TEST);
|
||||
|
||||
#else
|
||||
bool test_float = false;
|
||||
bool test_double = false;
|
||||
bool test_long_double = false;
|
||||
|
||||
if(std::numeric_limits<long double>::digits == std::numeric_limits<double>::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
|
||||
}
|
||||
|
||||
@@ -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/math/special_functions/bessel_prime.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_bessel(static_cast<TYPE_TO_TEST>(0), NAME_OF_TYPE_TO_TEST);
|
||||
|
||||
#else
|
||||
bool test_float = false;
|
||||
bool test_double = false;
|
||||
bool test_long_double = false;
|
||||
|
||||
if(std::numeric_limits<long double>::digits == std::numeric_limits<double>::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
|
||||
}
|
||||
|
||||
@@ -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/math/special_functions/bessel.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_bessel(static_cast<TYPE_TO_TEST>(0), NAME_OF_TYPE_TO_TEST);
|
||||
|
||||
#else
|
||||
bool test_float = false;
|
||||
bool test_double = false;
|
||||
bool test_long_double = false;
|
||||
|
||||
if(std::numeric_limits<long double>::digits == std::numeric_limits<double>::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
|
||||
}
|
||||
|
||||
@@ -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/math/special_functions/bessel_prime.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_bessel_prime(static_cast<TYPE_TO_TEST>(0), NAME_OF_TYPE_TO_TEST);
|
||||
|
||||
#else
|
||||
bool test_float = false;
|
||||
bool test_double = false;
|
||||
bool test_long_double = false;
|
||||
|
||||
if(std::numeric_limits<long double>::digits == std::numeric_limits<double>::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
|
||||
}
|
||||
|
||||
@@ -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/math/special_functions/beta.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_beta(static_cast<TYPE_TO_TEST>(0), NAME_OF_TYPE_TO_TEST);
|
||||
|
||||
#else
|
||||
bool test_float = false;
|
||||
bool test_double = false;
|
||||
bool test_long_double = false;
|
||||
|
||||
if(std::numeric_limits<long double>::digits == std::numeric_limits<double>::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
|
||||
}
|
||||
|
||||
@@ -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/math/special_functions/binomial.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_binomial(static_cast<TYPE_TO_TEST>(0), NAME_OF_TYPE_TO_TEST);
|
||||
|
||||
#else
|
||||
bool test_float = false;
|
||||
bool test_double = false;
|
||||
bool test_long_double = false;
|
||||
|
||||
if(std::numeric_limits<long double>::digits == std::numeric_limits<double>::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
|
||||
}
|
||||
|
||||
@@ -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 <boost/math/special_functions/ellint_rc.hpp>
|
||||
#include <boost/math/special_functions/ellint_rg.hpp>
|
||||
#include <boost/math/special_functions/ellint_rf.hpp>
|
||||
#include <boost/math/special_functions/ellint_rd.hpp>
|
||||
#include <boost/math/special_functions/ellint_rj.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_spots(static_cast<TYPE_TO_TEST>(0), NAME_OF_TYPE_TO_TEST);
|
||||
|
||||
#else
|
||||
bool test_float = false;
|
||||
bool test_double = false;
|
||||
bool test_long_double = false;
|
||||
|
||||
if(std::numeric_limits<long double>::digits == std::numeric_limits<double>::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
|
||||
}
|
||||
|
||||
@@ -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 <boost/math/special_functions/cbrt.hpp>
|
||||
#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<TYPE_TO_TEST>(0), NAME_OF_TYPE_TO_TEST);
|
||||
|
||||
#else
|
||||
bool test_float = false;
|
||||
bool test_double = false;
|
||||
bool test_long_double = false;
|
||||
|
||||
if(std::numeric_limits<long double>::digits == std::numeric_limits<double>::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
|
||||
}
|
||||
|
||||
@@ -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/math/special_functions/digamma.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_digamma(static_cast<TYPE_TO_TEST>(0), NAME_OF_TYPE_TO_TEST);
|
||||
|
||||
#else
|
||||
bool test_float = false;
|
||||
bool test_double = false;
|
||||
bool test_long_double = false;
|
||||
|
||||
if(std::numeric_limits<long double>::digits == std::numeric_limits<double>::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
|
||||
}
|
||||
|
||||
@@ -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/math/special_functions/ellint_1.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_spots(static_cast<TYPE_TO_TEST>(0), NAME_OF_TYPE_TO_TEST);
|
||||
|
||||
#else
|
||||
bool test_float = false;
|
||||
bool test_double = false;
|
||||
bool test_long_double = false;
|
||||
|
||||
if(std::numeric_limits<long double>::digits == std::numeric_limits<double>::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
|
||||
}
|
||||
|
||||
@@ -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/math/special_functions/ellint_2.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_spots(static_cast<TYPE_TO_TEST>(0), NAME_OF_TYPE_TO_TEST);
|
||||
|
||||
#else
|
||||
bool test_float = false;
|
||||
bool test_double = false;
|
||||
bool test_long_double = false;
|
||||
|
||||
if(std::numeric_limits<long double>::digits == std::numeric_limits<double>::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
|
||||
}
|
||||
|
||||
@@ -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/math/special_functions/ellint_3.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_spots(static_cast<TYPE_TO_TEST>(0), NAME_OF_TYPE_TO_TEST);
|
||||
|
||||
#else
|
||||
bool test_float = false;
|
||||
bool test_double = false;
|
||||
bool test_long_double = false;
|
||||
|
||||
if(std::numeric_limits<long double>::digits == std::numeric_limits<double>::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
|
||||
}
|
||||
|
||||
@@ -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/math/special_functions/ellint_d.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_spots(static_cast<TYPE_TO_TEST>(0), NAME_OF_TYPE_TO_TEST);
|
||||
|
||||
#else
|
||||
bool test_float = false;
|
||||
bool test_double = false;
|
||||
bool test_long_double = false;
|
||||
|
||||
if(std::numeric_limits<long double>::digits == std::numeric_limits<double>::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
|
||||
}
|
||||
|
||||
@@ -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 <boost/math/special_functions/erf.hpp>
|
||||
#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<TYPE_TO_TEST>(0), NAME_OF_TYPE_TO_TEST);
|
||||
|
||||
#else
|
||||
bool test_float = false;
|
||||
bool test_double = false;
|
||||
bool test_long_double = false;
|
||||
|
||||
if(std::numeric_limits<long double>::digits == std::numeric_limits<double>::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
|
||||
}
|
||||
|
||||
@@ -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/math/special_functions/expint.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_expint(static_cast<TYPE_TO_TEST>(0), NAME_OF_TYPE_TO_TEST);
|
||||
|
||||
#else
|
||||
bool test_float = false;
|
||||
bool test_double = false;
|
||||
bool test_long_double = false;
|
||||
|
||||
if(std::numeric_limits<long double>::digits == std::numeric_limits<double>::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
|
||||
}
|
||||
|
||||
@@ -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 <boost/math/special_functions/gamma.hpp>
|
||||
#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<TYPE_TO_TEST>(0), NAME_OF_TYPE_TO_TEST);
|
||||
|
||||
#else
|
||||
bool test_float = false;
|
||||
bool test_double = false;
|
||||
bool test_long_double = false;
|
||||
|
||||
if(std::numeric_limits<long double>::digits == std::numeric_limits<double>::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
|
||||
}
|
||||
|
||||
@@ -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/math/special_functions/hermite.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_hermite(static_cast<TYPE_TO_TEST>(0), NAME_OF_TYPE_TO_TEST);
|
||||
|
||||
#else
|
||||
bool test_float = false;
|
||||
bool test_double = false;
|
||||
bool test_long_double = false;
|
||||
|
||||
if(std::numeric_limits<long double>::digits == std::numeric_limits<double>::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
|
||||
}
|
||||
|
||||
@@ -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/math/special_functions/heuman_lambda.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_spots(static_cast<TYPE_TO_TEST>(0), NAME_OF_TYPE_TO_TEST);
|
||||
|
||||
#else
|
||||
bool test_float = false;
|
||||
bool test_double = false;
|
||||
bool test_long_double = false;
|
||||
|
||||
if(std::numeric_limits<long double>::digits == std::numeric_limits<double>::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
|
||||
}
|
||||
|
||||
@@ -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/math/special_functions/beta.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_beta(static_cast<TYPE_TO_TEST>(0), NAME_OF_TYPE_TO_TEST);
|
||||
|
||||
#else
|
||||
bool test_float = false;
|
||||
bool test_double = false;
|
||||
bool test_long_double = false;
|
||||
|
||||
if(std::numeric_limits<long double>::digits == std::numeric_limits<double>::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
|
||||
}
|
||||
|
||||
@@ -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/math/special_functions/beta.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_beta(static_cast<TYPE_TO_TEST>(0), NAME_OF_TYPE_TO_TEST);
|
||||
|
||||
#else
|
||||
bool test_float = false;
|
||||
bool test_double = false;
|
||||
bool test_long_double = false;
|
||||
|
||||
if(std::numeric_limits<long double>::digits == std::numeric_limits<double>::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
|
||||
}
|
||||
|
||||
@@ -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/math/special_functions/beta.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_beta(static_cast<TYPE_TO_TEST>(0), NAME_OF_TYPE_TO_TEST);
|
||||
|
||||
#else
|
||||
bool test_float = false;
|
||||
bool test_double = false;
|
||||
bool test_long_double = false;
|
||||
|
||||
if(std::numeric_limits<long double>::digits == std::numeric_limits<double>::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
|
||||
}
|
||||
|
||||
@@ -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/math/special_functions/gamma.hpp>
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_main)
|
||||
{
|
||||
BOOST_MATH_CONTROL_FP;
|
||||
|
||||
error_stream_replacer rep;
|
||||
|
||||
#ifdef TYPE_TO_TEST
|
||||
|
||||
test_gamma(static_cast<TYPE_TO_TEST>(0), NAME_OF_TYPE_TO_TEST);
|
||||
|
||||
#else
|
||||
bool test_float = false;
|
||||
bool test_double = false;
|
||||
bool test_long_double = false;
|
||||
|
||||
if(std::numeric_limits<long double>::digits == std::numeric_limits<double>::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
|
||||
}
|
||||
|
||||
@@ -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/math/special_functions/gamma.hpp>
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_main)
|
||||
{
|
||||
BOOST_MATH_CONTROL_FP;
|
||||
|
||||
error_stream_replacer rep;
|
||||
|
||||
#ifdef TYPE_TO_TEST
|
||||
|
||||
test_gamma(static_cast<TYPE_TO_TEST>(0), NAME_OF_TYPE_TO_TEST);
|
||||
|
||||
#else
|
||||
bool test_float = false;
|
||||
bool test_double = false;
|
||||
bool test_long_double = false;
|
||||
|
||||
if(std::numeric_limits<long double>::digits == std::numeric_limits<double>::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
|
||||
}
|
||||
|
||||
@@ -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/math/special_functions/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<TYPE_TO_TEST>(0), NAME_OF_TYPE_TO_TEST);
|
||||
|
||||
#else
|
||||
bool test_float = false;
|
||||
bool test_double = false;
|
||||
bool test_long_double = false;
|
||||
|
||||
if(std::numeric_limits<long double>::digits == std::numeric_limits<double>::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
|
||||
}
|
||||
|
||||
@@ -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/math/special_functions/jacobi_elliptic.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_spots(static_cast<TYPE_TO_TEST>(0), NAME_OF_TYPE_TO_TEST);
|
||||
|
||||
#else
|
||||
bool test_float = false;
|
||||
bool test_double = false;
|
||||
bool test_long_double = false;
|
||||
|
||||
if(std::numeric_limits<long double>::digits == std::numeric_limits<double>::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
|
||||
}
|
||||
|
||||
@@ -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/math/special_functions/jacobi_zeta.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_spots(static_cast<TYPE_TO_TEST>(0), NAME_OF_TYPE_TO_TEST);
|
||||
|
||||
#else
|
||||
bool test_float = false;
|
||||
bool test_double = false;
|
||||
bool test_long_double = false;
|
||||
|
||||
if(std::numeric_limits<long double>::digits == std::numeric_limits<double>::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
|
||||
}
|
||||
|
||||
@@ -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/math/special_functions/laguerre.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_laguerre(static_cast<TYPE_TO_TEST>(0), NAME_OF_TYPE_TO_TEST);
|
||||
|
||||
#else
|
||||
bool test_float = false;
|
||||
bool test_double = false;
|
||||
bool test_long_double = false;
|
||||
|
||||
if(std::numeric_limits<long double>::digits == std::numeric_limits<double>::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
|
||||
}
|
||||
|
||||
@@ -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/math/special_functions/legendre.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_legendre_p(static_cast<TYPE_TO_TEST>(0), NAME_OF_TYPE_TO_TEST);
|
||||
|
||||
#else
|
||||
bool test_float = false;
|
||||
bool test_double = false;
|
||||
bool test_long_double = false;
|
||||
|
||||
if(std::numeric_limits<long double>::digits == std::numeric_limits<double>::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
|
||||
}
|
||||
|
||||
@@ -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 <boost/math/special_functions/expm1.hpp>
|
||||
#include <boost/math/special_functions/log1p.hpp>
|
||||
#define BOOST_TEST_MAIN
|
||||
#include <boost/test/unit_test.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(static_cast<TYPE_TO_TEST>(0), NAME_OF_TYPE_TO_TEST);
|
||||
|
||||
#else
|
||||
bool test_float = false;
|
||||
bool test_double = false;
|
||||
bool test_long_double = false;
|
||||
|
||||
if(std::numeric_limits<long double>::digits == std::numeric_limits<double>::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
|
||||
}
|
||||
|
||||
@@ -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/test/unit_test.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_accuracy(static_cast<TYPE_TO_TEST>(0), NAME_OF_TYPE_TO_TEST);
|
||||
|
||||
#else
|
||||
bool test_float = false;
|
||||
bool test_double = false;
|
||||
bool test_long_double = false;
|
||||
|
||||
if(std::numeric_limits<long double>::digits == std::numeric_limits<double>::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
|
||||
}
|
||||
|
||||
@@ -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/test/unit_test.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_accuracy(static_cast<TYPE_TO_TEST>(0), NAME_OF_TYPE_TO_TEST);
|
||||
|
||||
#else
|
||||
bool test_float = false;
|
||||
bool test_double = false;
|
||||
bool test_long_double = false;
|
||||
|
||||
if(std::numeric_limits<long double>::digits == std::numeric_limits<double>::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
|
||||
}
|
||||
|
||||
@@ -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/test/unit_test.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_accuracy(static_cast<TYPE_TO_TEST>(0), NAME_OF_TYPE_TO_TEST);
|
||||
|
||||
#else
|
||||
bool test_float = false;
|
||||
bool test_double = false;
|
||||
bool test_long_double = false;
|
||||
|
||||
if(std::numeric_limits<long double>::digits == std::numeric_limits<double>::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
|
||||
}
|
||||
|
||||
@@ -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 <boost/math/special_functions/owens_t.hpp> // for owens_t function.
|
||||
#include <boost/test/unit_test.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_owens_t(static_cast<TYPE_TO_TEST>(0), NAME_OF_TYPE_TO_TEST);
|
||||
|
||||
#else
|
||||
bool test_float = false;
|
||||
bool test_double = false;
|
||||
bool test_long_double = false;
|
||||
|
||||
if(std::numeric_limits<long double>::digits == std::numeric_limits<double>::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
|
||||
}
|
||||
|
||||
@@ -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/math/special_functions/polygamma.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_polygamma(static_cast<TYPE_TO_TEST>(0), NAME_OF_TYPE_TO_TEST);
|
||||
|
||||
#else
|
||||
bool test_float = false;
|
||||
bool test_double = false;
|
||||
bool test_long_double = false;
|
||||
|
||||
if(std::numeric_limits<long double>::digits == std::numeric_limits<double>::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
|
||||
}
|
||||
|
||||
@@ -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 <boost/math/special_functions/powm1.hpp>
|
||||
#include <boost/math/special_functions/sqrt1pm1.hpp>
|
||||
#include <boost/test/unit_test.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_powm1_sqrtp1m1(static_cast<TYPE_TO_TEST>(0), NAME_OF_TYPE_TO_TEST);
|
||||
|
||||
#else
|
||||
bool test_float = false;
|
||||
bool test_double = false;
|
||||
bool test_long_double = false;
|
||||
|
||||
if(std::numeric_limits<long double>::digits == std::numeric_limits<double>::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
|
||||
}
|
||||
|
||||
@@ -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 <boost/math/special_functions/spherical_harmonic.hpp>
|
||||
#define BOOST_TEST_MAIN
|
||||
#include <boost/test/unit_test.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_spherical_harmonic(static_cast<TYPE_TO_TEST>(0), NAME_OF_TYPE_TO_TEST);
|
||||
|
||||
#else
|
||||
bool test_float = false;
|
||||
bool test_double = false;
|
||||
bool test_long_double = false;
|
||||
|
||||
if(std::numeric_limits<long double>::digits == std::numeric_limits<double>::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
|
||||
}
|
||||
|
||||
@@ -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/math/special_functions/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_tgamma_ratio(static_cast<TYPE_TO_TEST>(0), NAME_OF_TYPE_TO_TEST);
|
||||
|
||||
#else
|
||||
bool test_float = false;
|
||||
bool test_double = false;
|
||||
bool test_long_double = false;
|
||||
|
||||
if(std::numeric_limits<long double>::digits == std::numeric_limits<double>::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
|
||||
}
|
||||
|
||||
@@ -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 <boost/math/special_functions/sin_pi.hpp>
|
||||
#include <boost/math/special_functions/cos_pi.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_trig(static_cast<TYPE_TO_TEST>(0), NAME_OF_TYPE_TO_TEST);
|
||||
|
||||
#else
|
||||
bool test_float = false;
|
||||
bool test_double = false;
|
||||
bool test_long_double = false;
|
||||
|
||||
if(std::numeric_limits<long double>::digits == std::numeric_limits<double>::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
|
||||
}
|
||||
|
||||
@@ -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/math/special_functions/trigamma.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_trigamma(static_cast<TYPE_TO_TEST>(0), NAME_OF_TYPE_TO_TEST);
|
||||
|
||||
#else
|
||||
bool test_float = false;
|
||||
bool test_double = false;
|
||||
bool test_long_double = false;
|
||||
|
||||
if(std::numeric_limits<long double>::digits == std::numeric_limits<double>::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
|
||||
}
|
||||
|
||||
@@ -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/math/special_functions/zeta.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_zeta(static_cast<TYPE_TO_TEST>(0), NAME_OF_TYPE_TO_TEST);
|
||||
|
||||
#else
|
||||
bool test_float = false;
|
||||
bool test_double = false;
|
||||
bool test_long_double = false;
|
||||
|
||||
if(std::numeric_limits<long double>::digits == std::numeric_limits<double>::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
|
||||
}
|
||||
|
||||
@@ -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).
|
||||
@@ -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>../../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
|
||||
<link>static
|
||||
[ check-target-builds $(here)/third_party/cephes_double/acosh.c : : <build>no ]
|
||||
;
|
||||
|
||||
explicit cephes_double ;
|
||||
|
||||
lib dcdflib : $(here)/third_party/dcdflib/$(DCDFLIB_SOURCE)
|
||||
:
|
||||
release
|
||||
<link>static
|
||||
[ check-target-builds $(here)/third_party/dcdflib/dcdflib.c : : <build>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 <include>../../test
|
||||
[ check-target-builds ../accuracy//has_c99_cmath : <define>TEST_C99 ]
|
||||
[ check-target-builds ../accuracy//has_libstdcxx_tr1 : <define>TEST_LIBSTDCXX ]
|
||||
[ check-target-builds ../accuracy//has_gsl : <define>TEST_GSL <source>gsl <source>gslcblas ]
|
||||
[ check-target-builds ../accuracy//has_rmath : <define>TEST_RMATH <source>Rmath ]
|
||||
# [ check-target-builds is_intel_win : <build>no : ]
|
||||
[ check-target-builds $(here)/third_party/dcdflib/dcdflib.c : <define>TEST_DCDFLIB <source>dcdflib ]
|
||||
<target-os>linux:<linkflags>-lpthread <target-os>linux:<linkflags>-lrt
|
||||
#<toolset>msvc:<address-model>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 <define>COMPILER_COMPARISON_TABLES [ predef-require "BOOST_COMP_MSVC" ] <address-model>32 : test_cbrt_msvc_debug ;
|
||||
run test_cbrt.cpp /boost/regex//boost_regex /boost/system /boost/chrono /boost/filesystem table_helper
|
||||
: : : release <define>COMPILER_COMPARISON_TABLES [ predef-require "BOOST_COMP_MSVC" ] <cxxflags>-Ox <address-model>32 : test_cbrt_msvc_release_32 ;
|
||||
run test_cbrt.cpp /boost/regex//boost_regex /boost/system /boost/chrono /boost/filesystem table_helper
|
||||
: : : release <define>COMPILER_COMPARISON_TABLES [ predef-require "BOOST_COMP_MSVC" ] <cxxflags>-Ox <address-model>64 : test_cbrt_msvc_release_64 ;
|
||||
run test_cbrt.cpp /boost/regex//boost_regex /boost/system /boost/chrono /boost/filesystem table_helper
|
||||
: : : release <define>COMPILER_COMPARISON_TABLES [ check-target-builds is_intel_win : : <build>no ] <toolset>intel:<cxxflags>-Ox <address-model>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 <define>COMPILER_COMPARISON_TABLES <include>../../test [ predef-require "BOOST_COMP_MSVC" ] <address-model>32 : test_jn_msvc_debug ;
|
||||
run test_jn.cpp /boost/regex//boost_regex /boost/system /boost/chrono /boost/filesystem table_helper
|
||||
: : : release <define>COMPILER_COMPARISON_TABLES <include>../../test [ predef-require "BOOST_COMP_MSVC" ] <cxxflags>-Ox <address-model>32 : test_jn_msvc_release_32 ;
|
||||
run test_jn.cpp /boost/regex//boost_regex /boost/system /boost/chrono /boost/filesystem table_helper
|
||||
: : : release <define>COMPILER_COMPARISON_TABLES <include>../../test [ predef-require "BOOST_COMP_MSVC" ] <cxxflags>-Ox <address-model>64 : test_jn_msvc_release_64 ;
|
||||
run test_jn.cpp /boost/regex//boost_regex /boost/system /boost/chrono /boost/filesystem table_helper
|
||||
: : : release <define>COMPILER_COMPARISON_TABLES <include>../../test [ check-target-builds is_intel_win : : <build>no ] <address-model>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 <define>COMPILER_COMPARISON_TABLES <include>../../test [ predef-require "BOOST_COMP_MSVC" ] <address-model>32 : test_ibeta_inv_msvc_debug ;
|
||||
run test_ibeta_inv.cpp /boost/regex//boost_regex /boost/system /boost/chrono /boost/filesystem table_helper
|
||||
: : : release <define>COMPILER_COMPARISON_TABLES <include>../../test [ predef-require "BOOST_COMP_MSVC" ] <cxxflags>-Ox <address-model>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 <define>COMPILER_COMPARISON_TABLES <include>../../test [ predef-require "BOOST_COMP_MSVC" ] <cxxflags>-Ox <address-model>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 <define>COMPILER_COMPARISON_TABLES <include>../../test [ check-target-builds is_intel_win : : <build>no ] <toolset>intel:<cxxflags>-Ox <address-model>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 : <dependency>report_gen ;
|
||||
boostbook standalone
|
||||
:
|
||||
report
|
||||
:
|
||||
# Path for links to Boost:
|
||||
<xsl:param>boost.root=../../../../..
|
||||
|
||||
# Some general style settings:
|
||||
<xsl:param>table.footnote.number.format=1
|
||||
<xsl:param>footnote.number.format=1
|
||||
<xsl:param>html.stylesheet=boostbook.css
|
||||
|
||||
# HTML options first:
|
||||
# Use graphics not text for navigation:
|
||||
<xsl:param>navig.graphics=1
|
||||
# How far down we chunk nested sections, basically all of them:
|
||||
<xsl:param>chunk.section.depth=0
|
||||
# Don't put the first section on the same page as the TOC:
|
||||
<xsl:param>chunk.first.sections=0
|
||||
# How far down sections get TOC's
|
||||
<xsl:param>toc.section.depth=2
|
||||
# Max depth in each TOC:
|
||||
<xsl:param>toc.max.depth=4
|
||||
# How far down we go with TOC's
|
||||
<xsl:param>generate.section.toc.level=10
|
||||
;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,21 @@
|
||||
[article Special Function and Distribution Performance Report
|
||||
[quickbook 1.6]
|
||||
[/purpose ISBN 0-9504833-2-X 978-0-9504833-2-0, Classification 519.2-dc22]
|
||||
[license
|
||||
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 performance_tables.qbk]
|
||||
[import ../../../doc/html4_symbols.qbk]
|
||||
|
||||
[performance_all_sections]
|
||||
|
||||
[/
|
||||
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).
|
||||
]
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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 */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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 <boost/config.hpp>
|
||||
|
||||
#ifndef __ICL
|
||||
#error "wrong compiler"
|
||||
#endif
|
||||
@@ -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 <boost/math/special_functions/relative_difference.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/chrono.hpp>
|
||||
#include <boost/regex.hpp>
|
||||
|
||||
template <class Array>
|
||||
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<double>());
|
||||
for(typename Array::value_type::const_iterator j = i->begin(); j != i->end(); ++j)
|
||||
{
|
||||
data.back().push_back(*j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class Func, class Result>
|
||||
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<std::vector<double> >::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 <class Clock>
|
||||
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 <class Func>
|
||||
double exec_timed_test(Func f)
|
||||
{
|
||||
double t = 0;
|
||||
unsigned repeats = 1;
|
||||
do{
|
||||
stopwatch<boost::chrono::high_resolution_clock> w;
|
||||
|
||||
for(unsigned count = 0; count < repeats; ++count)
|
||||
{
|
||||
for(std::vector<std::vector<double> >::const_iterator i = data.begin(); i != data.end(); ++i)
|
||||
sum += f(*i);
|
||||
}
|
||||
|
||||
t = boost::chrono::duration_cast<boost::chrono::duration<double>>(w.elapsed()).count();
|
||||
if(t < 0.5)
|
||||
repeats *= 2;
|
||||
} while(t < 0.5);
|
||||
return t / (repeats * data.size());
|
||||
}
|
||||
|
||||
#endif // PERFORMANCE_HPP
|
||||
@@ -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 <boost/regex.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/filesystem/fstream.hpp>
|
||||
#include <boost/interprocess/sync/named_mutex.hpp>
|
||||
#include <boost/interprocess/sync/scoped_lock.hpp>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#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<std::vector<double> > data;
|
||||
std::vector<std::tuple<double, std::string, std::string, std::string> > 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<boost::interprocess::named_mutex> 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<char>(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<boost::uintmax_t>(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<std::vector<std::string> >& table, std::string::const_iterator begin, std::string::const_iterator end)
|
||||
{
|
||||
static const boost::regex item_e(
|
||||
"\\["
|
||||
"([^\\[\\]]*(?0)?)*"
|
||||
"\\]"
|
||||
);
|
||||
|
||||
boost::regex_token_iterator<std::string::const_iterator> i(begin, end, item_e), j;
|
||||
|
||||
while(i != j)
|
||||
{
|
||||
// Add a row:
|
||||
table.push_back(std::vector<std::string>());
|
||||
boost::regex_token_iterator<std::string::const_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<std::vector<std::string> >& table)
|
||||
{
|
||||
std::string result;
|
||||
|
||||
for(std::vector<std::vector<std::string> >::const_iterator i = table.begin(), j = table.end(); i != j; ++i)
|
||||
{
|
||||
result += "[";
|
||||
for(std::vector<std::string>::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<std::string::const_iterator> i(content.begin() + pos + 12 + list_name.size(), content.end(), item_e), j;
|
||||
std::set<std::string> 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<std::string>::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<boost::uintmax_t>(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<std::vector<std::string> > 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<std::string>());
|
||||
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<boost::uintmax_t>::max)();
|
||||
std::vector<boost::intmax_t> 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<double>(values[i - 1]) / best, 2);
|
||||
s += "[br](";
|
||||
s += boost::lexical_cast<std::string>(values[i - 1]) + "ns)]";
|
||||
}
|
||||
}
|
||||
//
|
||||
// Convert back to a string and insert into content:
|
||||
std::sort(table_data.begin() + 1, table_data.end(), [](std::vector<std::string> const& a, std::vector<std::string> 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<std::string>(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<boost::uintmax_t>(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
|
||||
}
|
||||
|
||||
@@ -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 <vector>
|
||||
#include <string>
|
||||
#include <boost/version.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
//
|
||||
// Also include headers for whatever else we may be testing:
|
||||
//
|
||||
#ifdef TEST_LIBSTDCXX
|
||||
#include <tr1/cmath>
|
||||
#include <stdexcept>
|
||||
#endif
|
||||
#ifdef TEST_GSL
|
||||
#include <gsl/gsl_sf.h>
|
||||
#include <gsl/gsl_errno.h>
|
||||
#include <gsl/gsl_version.h>
|
||||
|
||||
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 <boost/math/special_functions.hpp>
|
||||
#define MATHLIB_STANDALONE
|
||||
#include <Rmath.h>
|
||||
#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<std::vector<double> > 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<std::string>(BOOST_VERSION / 100000) + "." + boost::lexical_cast<std::string>((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
|
||||
|
||||
@@ -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 <boost/math/special_functions/laguerre.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "../../test/table_type.hpp"
|
||||
#include "table_helper.hpp"
|
||||
#include "performance.hpp"
|
||||
#include <iostream>
|
||||
|
||||
typedef double T;
|
||||
#define SC_(x) static_cast<double>(x)
|
||||
|
||||
int main()
|
||||
{
|
||||
# include "laguerre3.ipp"
|
||||
|
||||
add_data(laguerre3);
|
||||
|
||||
unsigned data_total = data.size();
|
||||
|
||||
screen_data([](const std::vector<double>& v){ return boost::math::laguerre(v[0], v[1], v[2]); }, [](const std::vector<double>& v){ return v[3]; });
|
||||
|
||||
|
||||
#if defined(TEST_LIBSTDCXX) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
screen_data([](const std::vector<double>& v){ return std::tr1::assoc_laguerre(v[0], v[1], v[2]); }, [](const std::vector<double>& v){ return v[3]; });
|
||||
#endif
|
||||
#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
screen_data([](const std::vector<double>& v){ return gsl_sf_laguerre_n(v[0], v[1], v[2]); }, [](const std::vector<double>& v){ return v[3]; });
|
||||
#endif
|
||||
|
||||
unsigned data_used = data.size();
|
||||
std::string function = "assoc_laguerre[br](" + boost::lexical_cast<std::string>(data_used) + "/" + boost::lexical_cast<std::string>(data_total) + " tests selected)";
|
||||
std::string function_short = "assoc_laguerre";
|
||||
|
||||
double time;
|
||||
|
||||
time = exec_timed_test([](const std::vector<double>& 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<double>& v){ return boost::math::laguerre(v[0], v[1], v[2], boost::math::policies::make_policy(boost::math::policies::promote_double<false>())); });
|
||||
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<false>");
|
||||
#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<false>");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(TEST_LIBSTDCXX) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
time = exec_timed_test([](const std::vector<double>& 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<double>& 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;
|
||||
}
|
||||
|
||||
@@ -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 <boost/math/special_functions/legendre.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "../../test/table_type.hpp"
|
||||
#include "table_helper.hpp"
|
||||
#include "performance.hpp"
|
||||
#include <iostream>
|
||||
|
||||
typedef double T;
|
||||
#define SC_(x) static_cast<double>(x)
|
||||
|
||||
int main()
|
||||
{
|
||||
# include "assoc_legendre_p.ipp"
|
||||
|
||||
add_data(assoc_legendre_p);
|
||||
|
||||
unsigned data_total = data.size();
|
||||
|
||||
screen_data([](const std::vector<double>& v){ return boost::math::legendre_p(v[0], v[1], v[2]); }, [](const std::vector<double>& v){ return v[3]; });
|
||||
|
||||
|
||||
#if defined(TEST_LIBSTDCXX) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
screen_data([](const std::vector<double>& v){ return std::tr1::assoc_legendre(v[0], v[1], v[2]); }, [](const std::vector<double>& v){ return v[3]; });
|
||||
#endif
|
||||
#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
screen_data([](const std::vector<double>& v){ return gsl_sf_legendre_Plm(v[0], v[1], v[2]); }, [](const std::vector<double>& v){ return v[3]; });
|
||||
#endif
|
||||
|
||||
unsigned data_used = data.size();
|
||||
std::string function = "assoc_legendre[br](" + boost::lexical_cast<std::string>(data_used) + "/" + boost::lexical_cast<std::string>(data_total) + " tests selected)";
|
||||
std::string function_short = "assoc_legendre";
|
||||
|
||||
double time;
|
||||
|
||||
time = exec_timed_test([](const std::vector<double>& 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<double>& v){ return boost::math::legendre_p(v[0], v[1], v[2], boost::math::policies::make_policy(boost::math::policies::promote_double<false>())); });
|
||||
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<false>");
|
||||
#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<false>");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(TEST_LIBSTDCXX) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
time = exec_timed_test([](const std::vector<double>& 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<double>& 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;
|
||||
}
|
||||
|
||||
@@ -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 <boost/math/special_functions/beta.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "../../test/table_type.hpp"
|
||||
#include "table_helper.hpp"
|
||||
#include "performance.hpp"
|
||||
#include <iostream>
|
||||
|
||||
typedef double T;
|
||||
#define SC_(x) static_cast<double>(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<double>& v){ return boost::math::beta(v[0], v[1]); }, [](const std::vector<double>& v){ return v[2]; });
|
||||
|
||||
|
||||
#if defined(TEST_LIBSTDCXX) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
screen_data([](const std::vector<double>& v){ return std::tr1::beta(v[0], v[1]); }, [](const std::vector<double>& v){ return v[2]; });
|
||||
#endif
|
||||
#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
screen_data([](const std::vector<double>& v){ return gsl_sf_beta(v[0], v[1]); }, [](const std::vector<double>& v){ return v[2]; });
|
||||
#endif
|
||||
#if defined(TEST_RMATH) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
screen_data([](const std::vector<double>& v){ return beta(v[0], v[1]); }, [](const std::vector<double>& v){ return v[2]; });
|
||||
#endif
|
||||
|
||||
unsigned data_used = data.size();
|
||||
std::string function = "beta[br](" + boost::lexical_cast<std::string>(data_used) + "/" + boost::lexical_cast<std::string>(data_total) + " tests selected)";
|
||||
std::string function_short = "beta";
|
||||
|
||||
double time;
|
||||
|
||||
time = exec_timed_test([](const std::vector<double>& 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<double>& v){ return boost::math::beta(v[0], v[1], boost::math::policies::make_policy(boost::math::policies::promote_double<false>())); });
|
||||
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<false>");
|
||||
#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<false>");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(TEST_LIBSTDCXX) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
time = exec_timed_test([](const std::vector<double>& 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<double>& 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<double>& 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;
|
||||
}
|
||||
|
||||
@@ -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 <boost/math/special_functions/beta.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "../../test/table_type.hpp"
|
||||
#include "table_helper.hpp"
|
||||
#include "performance.hpp"
|
||||
#include <iostream>
|
||||
|
||||
typedef double T;
|
||||
#define SC_(x) static_cast<double>(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<double>& v){ return boost::math::ibeta(v[0], v[1], v[2]); }, [](const std::vector<double>& v){ return v[5]; });
|
||||
|
||||
|
||||
#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
std::cout << "Screening gsl data:\n";
|
||||
screen_data([](const std::vector<double>& v){ return gsl_sf_beta_inc(v[0], v[1], v[2]); }, [](const std::vector<double>& v){ return v[5]; });
|
||||
#endif
|
||||
|
||||
unsigned data_used = data.size();
|
||||
std::string function = "beta (incomplete)[br](" + boost::lexical_cast<std::string>(data_used) + "/" + boost::lexical_cast<std::string>(data_total) + " tests selected)";
|
||||
std::string function_short = "beta (incomplete)";
|
||||
|
||||
double time;
|
||||
|
||||
time = exec_timed_test([](const std::vector<double>& 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<double>& v){ return boost::math::beta(v[0], v[1], v[2], boost::math::policies::make_policy(boost::math::policies::promote_double<false>())); });
|
||||
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<false>");
|
||||
#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<false>");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
time = exec_timed_test([](const std::vector<double>& 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;
|
||||
}
|
||||
|
||||
@@ -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 <boost/math/special_functions/cbrt.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "../../test/table_type.hpp"
|
||||
#include "table_helper.hpp"
|
||||
#include "performance.hpp"
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
{
|
||||
typedef double T;
|
||||
#define SC_(x) static_cast<double>(x)
|
||||
# include "../../test/cbrt_data.ipp"
|
||||
|
||||
add_data(cbrt_data);
|
||||
|
||||
unsigned data_total = data.size();
|
||||
|
||||
screen_data([](const std::vector<double>& v){ return boost::math::cbrt(v[1]); }, [](const std::vector<double>& v){ return v[0]; });
|
||||
|
||||
#if defined(TEST_C99) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
screen_data([](const std::vector<double>& v){ return ::cbrt(v[1]); }, [](const std::vector<double>& v){ return v[0]; });
|
||||
#endif
|
||||
#if defined(TEST_LIBSTDCXX) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
screen_data([](const std::vector<double>& v){ return std::tr1::cbrt(v[1]); }, [](const std::vector<double>& v){ return v[0]; });
|
||||
#endif
|
||||
|
||||
unsigned data_used = data.size();
|
||||
std::string function = "cbrt[br](" + boost::lexical_cast<std::string>(data_used) + "/" + boost::lexical_cast<std::string>(data_total) + " tests selected)";
|
||||
std::string function_short = "cbrt";
|
||||
|
||||
double time = exec_timed_test([](const std::vector<double>& 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<double>& v){ return boost::math::cbrt(v[1], boost::math::policies::make_policy(boost::math::policies::promote_double<false>())); });
|
||||
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<false>");
|
||||
#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<false>");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(TEST_C99) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
time = exec_timed_test([](const std::vector<double>& 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<double>& 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;
|
||||
}
|
||||
|
||||
@@ -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 <boost/math/special_functions/jacobi_elliptic.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "../../test/table_type.hpp"
|
||||
#include "table_helper.hpp"
|
||||
#include "performance.hpp"
|
||||
#include <iostream>
|
||||
|
||||
typedef double T;
|
||||
#define SC_(x) static_cast<double>(x)
|
||||
static const boost::array<boost::array<T, 5>, 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<double>& v){ return boost::math::jacobi_cn(v[1], v[0]); }, [](const std::vector<double>& v){ return v[3]; });
|
||||
|
||||
|
||||
#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
std::cout << "Screening GSL data:\n";
|
||||
screen_data([](const std::vector<double>& v)
|
||||
{
|
||||
double s, c, d;
|
||||
gsl_sf_elljac_e(v[0], v[1] * v[1], &s, &c, &d);
|
||||
return c;
|
||||
}, [](const std::vector<double>& v){ return v[3]; });
|
||||
#endif
|
||||
|
||||
unsigned data_used = data.size();
|
||||
std::string function = "jacobi_cn[br](" + boost::lexical_cast<std::string>(data_used) + "/" + boost::lexical_cast<std::string>(data_total) + " tests selected)";
|
||||
std::string function_short = "jacobi_cn";
|
||||
|
||||
double time;
|
||||
|
||||
time = exec_timed_test([](const std::vector<double>& 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<double>& v){ return boost::math::jacobi_cn(v[1], v[0], boost::math::policies::make_policy(boost::math::policies::promote_double<false>())); });
|
||||
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<false>");
|
||||
#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<false>");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
time = exec_timed_test([](const std::vector<double>& 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;
|
||||
}
|
||||
|
||||
@@ -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 <boost/math/special_functions/digamma.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "../../test/table_type.hpp"
|
||||
#include "table_helper.hpp"
|
||||
#include "performance.hpp"
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
{
|
||||
typedef double T;
|
||||
#define SC_(x) static_cast<double>(x)
|
||||
# include "digamma_data.ipp"
|
||||
# include "digamma_root_data.ipp"
|
||||
# include "digamma_small_data.ipp"
|
||||
# include "digamma_neg_data.ipp"
|
||||
static const boost::array<boost::array<T, 2>, 5> digamma_bugs = {{
|
||||
// Test cases from Rocco Romeo:
|
||||
{{ static_cast<T>(std::ldexp(1.0, -100)), SC_(-1.26765060022822940149670320537657721566490153286060651209008e30) }},
|
||||
{{ static_cast<T>(-std::ldexp(1.0, -100)), SC_(1.26765060022822940149670320537542278433509846713939348790992e30) }},
|
||||
{{ static_cast<T>(1), SC_(-0.577215664901532860606512090082402431042159335939923598805767) }},
|
||||
{{ static_cast<T>(-1) + static_cast<T>(std::ldexp(1.0, -20)), SC_(-1.04857557721314249602848739817764518743062133735858753112190e6) }},
|
||||
{{ static_cast<T>(-1) - static_cast<T>(std::ldexp(1.0, -20)), SC_(1.04857642278181269259522681939281063878220298942888100442172e6) }},
|
||||
}};
|
||||
static const boost::array<boost::array<T, 2>, 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<boost::array<T, 2>, 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<double>& v){ return boost::math::digamma(v[0]); }, [](const std::vector<double>& v){ return v[1]; });
|
||||
|
||||
|
||||
#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
screen_data([](const std::vector<double>& v){ return gsl_sf_psi(v[0]); }, [](const std::vector<double>& v){ return v[1]; });
|
||||
#endif
|
||||
#if defined(TEST_RMATH) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
screen_data([](const std::vector<double>& v){ return ::digamma(v[0]); }, [](const std::vector<double>& v){ return v[1]; });
|
||||
#endif
|
||||
|
||||
unsigned data_used = data.size();
|
||||
std::string function = "digamma[br](" + boost::lexical_cast<std::string>(data_used) + "/" + boost::lexical_cast<std::string>(data_total) + " tests selected)";
|
||||
std::string function_short = "digamma";
|
||||
|
||||
double time = exec_timed_test([](const std::vector<double>& 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<double>& v){ return boost::math::digamma(v[0], boost::math::policies::make_policy(boost::math::policies::promote_double<false>())); });
|
||||
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<false>");
|
||||
#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<false>");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
time = exec_timed_test([](const std::vector<double>& 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<double>& 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;
|
||||
}
|
||||
|
||||
@@ -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 <boost/math/distributions.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "../../test/table_type.hpp"
|
||||
#include "table_helper.hpp"
|
||||
#include "performance.hpp"
|
||||
#include <iostream>
|
||||
|
||||
#ifdef TEST_GSL
|
||||
#include <gsl/gsl_cdf.h>
|
||||
#endif
|
||||
|
||||
class distribution_tester
|
||||
{
|
||||
std::string distro_name;
|
||||
static const double quantiles[19];
|
||||
double sum;
|
||||
|
||||
struct param_info
|
||||
{
|
||||
std::vector<double> params;
|
||||
std::vector<double> x_values;
|
||||
};
|
||||
std::vector<param_info> tests;
|
||||
double sanitize_x(double x)
|
||||
{
|
||||
if(x > boost::math::tools::max_value<float>() / 2)
|
||||
return boost::math::tools::max_value<float>() / 2;
|
||||
if(x < -boost::math::tools::max_value<float>() / 2)
|
||||
return -boost::math::tools::max_value<float>() / 2;
|
||||
return x;
|
||||
}
|
||||
public:
|
||||
distribution_tester(const char* name) : distro_name(name), sum(0) {}
|
||||
|
||||
template <class F>
|
||||
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 <class F>
|
||||
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 <class F>
|
||||
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 <class F>
|
||||
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 <class F>
|
||||
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<boost::chrono::high_resolution_clock> 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<boost::chrono::duration<double>>(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<boost::uintmax_t>::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 <class D>
|
||||
struct three_param_quantile
|
||||
{
|
||||
template <class T, class U, class V, class X>
|
||||
double operator()(T x, U y, V z, X q)const
|
||||
{
|
||||
return quantile(D(x, y, z), q);
|
||||
}
|
||||
};
|
||||
|
||||
template <class D>
|
||||
struct two_param_quantile
|
||||
{
|
||||
template <class T, class U, class V>
|
||||
double operator()(T x, U y, V q)const
|
||||
{
|
||||
return quantile(D(x, y), q);
|
||||
}
|
||||
};
|
||||
|
||||
template <class D>
|
||||
struct one_param_quantile
|
||||
{
|
||||
template <class T, class V>
|
||||
double operator()(T x, V q)const
|
||||
{
|
||||
return quantile(D(x), q);
|
||||
}
|
||||
};
|
||||
|
||||
template <template <class T, class U> class D>
|
||||
void test_boost_1_param(distribution_tester& tester)
|
||||
{
|
||||
//
|
||||
// Define some custom policies to test:
|
||||
//
|
||||
typedef boost::math::policies::policy<> default_policy;
|
||||
typedef boost::math::policies::policy<boost::math::policies::promote_double<false> > no_promote_double_policy;
|
||||
typedef boost::math::policies::policy<boost::math::policies::promote_double<false>, boost::math::policies::digits10<10> > no_promote_double_10_digits_policy;
|
||||
typedef boost::math::policies::policy<boost::math::policies::promote_float<false> > no_promote_float_policy;
|
||||
|
||||
tester.run_timed_tests([](const std::vector<double>& v, double x){ return pdf(D<double, default_policy>(v[0]), x); }, "PDF", boost_name(), false, distribution_tester::both_tables);
|
||||
tester.run_timed_tests([](const std::vector<double>& v, double x){ return cdf(D<double, default_policy>(v[0]), x); }, "CDF", boost_name(), false, distribution_tester::both_tables);
|
||||
tester.run_timed_tests([](const std::vector<double>& v, double x){ return quantile(D<double, default_policy>(v[0]), x); }, "quantile", boost_name(), true, distribution_tester::both_tables);
|
||||
if(sizeof(double) != sizeof(long double))
|
||||
{
|
||||
tester.run_timed_tests([](const std::vector<double>& v, double x){ return pdf(D<double, no_promote_double_policy>(v[0]), x); }, "PDF", "Boost[br]promote_double<false>", false, distribution_tester::both_tables);
|
||||
tester.run_timed_tests([](const std::vector<double>& v, double x){ return cdf(D<double, no_promote_double_policy>(v[0]), x); }, "CDF", "Boost[br]promote_double<false>", false, distribution_tester::both_tables);
|
||||
tester.run_timed_tests([](const std::vector<double>& v, double x){ return quantile(D<double, no_promote_double_policy>(v[0]), x); }, "quantile", "Boost[br]promote_double<false>", true, distribution_tester::both_tables);
|
||||
}
|
||||
tester.run_timed_tests([](const std::vector<double>& v, double x){ return pdf(D<double, no_promote_double_10_digits_policy>(v[0]), x); }, "PDF", "Boost[br]promote_double<false>[br]digits10<10>", false, distribution_tester::boost_only_table);
|
||||
tester.run_timed_tests([](const std::vector<double>& v, double x){ return cdf(D<double, no_promote_double_10_digits_policy>(v[0]), x); }, "CDF", "Boost[br]promote_double<false>[br]digits10<10>", false, distribution_tester::boost_only_table);
|
||||
tester.run_timed_tests([](const std::vector<double>& v, double x){ return quantile(D<double, no_promote_double_10_digits_policy>(v[0]), x); }, "quantile", "Boost[br]promote_double<false>[br]digits10<10>", true, distribution_tester::boost_only_table);
|
||||
|
||||
tester.run_timed_tests([](const std::vector<double>& v, double x){ return pdf(D<float, no_promote_float_policy>(static_cast<float>(v[0])), static_cast<float>(x)); }, "PDF", "Boost[br]float[br]promote_float<false>", false, distribution_tester::boost_only_table);
|
||||
tester.run_timed_tests([](const std::vector<double>& v, double x){ return cdf(D<float, no_promote_float_policy>(static_cast<float>(v[0])), static_cast<float>(x)); }, "CDF", "Boost[br]float[br]promote_float<false>", false, distribution_tester::boost_only_table);
|
||||
tester.run_timed_tests([](const std::vector<double>& v, double x){ return quantile(D<float, no_promote_float_policy>(static_cast<float>(v[0])), static_cast<float>(x)); }, "quantile", "Boost[br]float[br]promote_float<false>", true, distribution_tester::boost_only_table);
|
||||
}
|
||||
|
||||
template <template <class T, class U> class D>
|
||||
void test_boost_2_param(distribution_tester& tester)
|
||||
{
|
||||
//
|
||||
// Define some custom policies to test:
|
||||
//
|
||||
typedef boost::math::policies::policy<> default_policy;
|
||||
typedef boost::math::policies::policy<boost::math::policies::promote_double<false> > no_promote_double_policy;
|
||||
typedef boost::math::policies::policy<boost::math::policies::promote_double<false>, boost::math::policies::digits10<10> > no_promote_double_10_digits_policy;
|
||||
typedef boost::math::policies::policy<boost::math::policies::promote_float<false> > no_promote_float_policy;
|
||||
|
||||
tester.run_timed_tests([](const std::vector<double>& v, double x){ return pdf(D<double, default_policy>(v[0], v[1]), x); }, "PDF", boost_name(), false, distribution_tester::both_tables);
|
||||
tester.run_timed_tests([](const std::vector<double>& v, double x){ return cdf(D<double, default_policy>(v[0], v[1]), x); }, "CDF", boost_name(), false, distribution_tester::both_tables);
|
||||
tester.run_timed_tests([](const std::vector<double>& v, double x){ return quantile(D<double, default_policy>(v[0], v[1]), x); }, "quantile", boost_name(), true, distribution_tester::both_tables);
|
||||
if(sizeof(double) != sizeof(long double))
|
||||
{
|
||||
tester.run_timed_tests([](const std::vector<double>& v, double x){ return pdf(D<double, no_promote_double_policy>(v[0], v[1]), x); }, "PDF", "Boost[br]promote_double<false>", false, distribution_tester::both_tables);
|
||||
tester.run_timed_tests([](const std::vector<double>& v, double x){ return cdf(D<double, no_promote_double_policy>(v[0], v[1]), x); }, "CDF", "Boost[br]promote_double<false>", false, distribution_tester::both_tables);
|
||||
tester.run_timed_tests([](const std::vector<double>& v, double x){ return quantile(D<double, no_promote_double_policy>(v[0], v[1]), x); }, "quantile", "Boost[br]promote_double<false>", true, distribution_tester::both_tables);
|
||||
}
|
||||
tester.run_timed_tests([](const std::vector<double>& v, double x){ return pdf(D<double, no_promote_double_10_digits_policy>(v[0], v[1]), x); }, "PDF", "Boost[br]promote_double<false>[br]digits10<10>", false, distribution_tester::boost_only_table);
|
||||
tester.run_timed_tests([](const std::vector<double>& v, double x){ return cdf(D<double, no_promote_double_10_digits_policy>(v[0], v[1]), x); }, "CDF", "Boost[br]promote_double<false>[br]digits10<10>", false, distribution_tester::boost_only_table);
|
||||
tester.run_timed_tests([](const std::vector<double>& v, double x){ return quantile(D<double, no_promote_double_10_digits_policy>(v[0], v[1]), x); }, "quantile", "Boost[br]promote_double<false>[br]digits10<10>", true, distribution_tester::boost_only_table);
|
||||
|
||||
tester.run_timed_tests([](const std::vector<double>& v, double x){ return pdf(D<float, no_promote_float_policy>(static_cast<float>(v[0]), static_cast<float>(v[1])), static_cast<float>(x)); }, "PDF", "Boost[br]float[br]promote_float<false>", false, distribution_tester::boost_only_table);
|
||||
tester.run_timed_tests([](const std::vector<double>& v, double x){ return cdf(D<float, no_promote_float_policy>(static_cast<float>(v[0]), static_cast<float>(v[1])), static_cast<float>(x)); }, "CDF", "Boost[br]float[br]promote_float<false>", false, distribution_tester::boost_only_table);
|
||||
tester.run_timed_tests([](const std::vector<double>& v, double x){ return quantile(D<float, no_promote_float_policy>(static_cast<float>(v[0]), static_cast<float>(v[1])), static_cast<float>(x)); }, "quantile", "Boost[br]float[br]promote_float<false>", true, distribution_tester::boost_only_table);
|
||||
}
|
||||
|
||||
template <template <class T, class U> class D>
|
||||
void test_boost_3_param(distribution_tester& tester)
|
||||
{
|
||||
//
|
||||
// Define some custom policies to test:
|
||||
//
|
||||
typedef boost::math::policies::policy<> default_policy;
|
||||
typedef boost::math::policies::policy<boost::math::policies::promote_double<false> > no_promote_double_policy;
|
||||
typedef boost::math::policies::policy<boost::math::policies::promote_double<false>, boost::math::policies::digits10<10> > no_promote_double_10_digits_policy;
|
||||
typedef boost::math::policies::policy<boost::math::policies::promote_float<false> > no_promote_float_policy;
|
||||
|
||||
tester.run_timed_tests([](const std::vector<double>& v, double x){ return pdf(D<double, default_policy>(v[0], v[1], v[2]), x); }, "PDF", boost_name(), false, distribution_tester::both_tables);
|
||||
tester.run_timed_tests([](const std::vector<double>& v, double x){ return cdf(D<double, default_policy>(v[0], v[1], v[2]), x); }, "CDF", boost_name(), false, distribution_tester::both_tables);
|
||||
tester.run_timed_tests([](const std::vector<double>& v, double x){ return quantile(D<double, default_policy>(v[0], v[1], v[2]), x); }, "quantile", boost_name(), true, distribution_tester::both_tables);
|
||||
if(sizeof(double) != sizeof(long double))
|
||||
{
|
||||
tester.run_timed_tests([](const std::vector<double>& v, double x){ return pdf(D<double, no_promote_double_policy>(v[0], v[1], v[2]), x); }, "PDF", "Boost[br]promote_double<false>", false, distribution_tester::both_tables);
|
||||
tester.run_timed_tests([](const std::vector<double>& v, double x){ return cdf(D<double, no_promote_double_policy>(v[0], v[1], v[2]), x); }, "CDF", "Boost[br]promote_double<false>", false, distribution_tester::both_tables);
|
||||
tester.run_timed_tests([](const std::vector<double>& v, double x){ return quantile(D<double, no_promote_double_policy>(v[0], v[1], v[2]), x); }, "quantile", "Boost[br]promote_double<false>", true, distribution_tester::both_tables);
|
||||
}
|
||||
tester.run_timed_tests([](const std::vector<double>& v, double x){ return pdf(D<double, no_promote_double_10_digits_policy>(v[0], v[1], v[2]), x); }, "PDF", "Boost[br]promote_double<false>[br]digits10<10>", false, distribution_tester::boost_only_table);
|
||||
tester.run_timed_tests([](const std::vector<double>& v, double x){ return cdf(D<double, no_promote_double_10_digits_policy>(v[0], v[1], v[2]), x); }, "CDF", "Boost[br]promote_double<false>[br]digits10<10>", false, distribution_tester::boost_only_table);
|
||||
tester.run_timed_tests([](const std::vector<double>& v, double x){ return quantile(D<double, no_promote_double_10_digits_policy>(v[0], v[1], v[2]), x); }, "quantile", "Boost[br]promote_double<false>[br]digits10<10>", true, distribution_tester::boost_only_table);
|
||||
|
||||
tester.run_timed_tests([](const std::vector<double>& v, double x){ return pdf(D<float, no_promote_float_policy>(static_cast<float>(v[0]), static_cast<float>(v[1]), static_cast<float>(v[2])), static_cast<float>(x)); }, "PDF", "Boost[br]float[br]promote_float<false>", false, distribution_tester::boost_only_table);
|
||||
tester.run_timed_tests([](const std::vector<double>& v, double x){ return cdf(D<float, no_promote_float_policy>(static_cast<float>(v[0]), static_cast<float>(v[1]), static_cast<float>(v[2])), static_cast<float>(x)); }, "CDF", "Boost[br]float[br]promote_float<false>", false, distribution_tester::boost_only_table);
|
||||
tester.run_timed_tests([](const std::vector<double>& v, double x){ return quantile(D<float, no_promote_float_policy>(static_cast<float>(v[0]), static_cast<float>(v[1]), static_cast<float>(v[2])), static_cast<float>(x)); }, "quantile", "Boost[br]float[br]promote_float<false>", true, distribution_tester::boost_only_table);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
try {
|
||||
//
|
||||
// Normal:
|
||||
//
|
||||
distribution_tester n("Normal");
|
||||
n.add_test_case(0, 1, two_param_quantile<boost::math::normal_distribution<> >());
|
||||
n.add_test_case(20, 20, two_param_quantile<boost::math::normal_distribution<> >());
|
||||
n.add_test_case(-20, 0.0125, two_param_quantile<boost::math::normal_distribution<> >());
|
||||
|
||||
test_boost_2_param<boost::math::normal_distribution>(n);
|
||||
|
||||
distribution_tester arcsine("ArcSine");
|
||||
arcsine.add_test_case(0, 1, two_param_quantile<boost::math::arcsine_distribution<> >());
|
||||
arcsine.add_test_case(20, 500, two_param_quantile<boost::math::arcsine_distribution<> >());
|
||||
arcsine.add_test_case(-20, 100000, two_param_quantile<boost::math::arcsine_distribution<> >());
|
||||
|
||||
test_boost_2_param<boost::math::arcsine_distribution>(arcsine);
|
||||
|
||||
distribution_tester beta("Beta");
|
||||
beta.add_test_case(1, 4, two_param_quantile<boost::math::beta_distribution<> >());
|
||||
beta.add_test_case(20, 500, two_param_quantile<boost::math::beta_distribution<> >());
|
||||
beta.add_test_case(0.1, 0.01, two_param_quantile<boost::math::beta_distribution<> >());
|
||||
|
||||
test_boost_2_param<boost::math::beta_distribution>(beta);
|
||||
|
||||
distribution_tester binomial("Binomial");
|
||||
binomial.add_test_case(5, 0.125, two_param_quantile<boost::math::binomial_distribution<> >());
|
||||
binomial.add_test_case(200, 0.75, two_param_quantile<boost::math::binomial_distribution<> >());
|
||||
binomial.add_test_case(2000, 0.5, two_param_quantile<boost::math::binomial_distribution<> >());
|
||||
binomial.add_test_case(20000, 0.001, two_param_quantile<boost::math::binomial_distribution<> >());
|
||||
binomial.add_test_case(200000, 0.99, two_param_quantile<boost::math::binomial_distribution<> >());
|
||||
|
||||
test_boost_2_param<boost::math::binomial_distribution>(binomial);
|
||||
|
||||
distribution_tester cauchy("Cauchy");
|
||||
cauchy.add_test_case(0, 1, two_param_quantile<boost::math::cauchy_distribution<> >());
|
||||
cauchy.add_test_case(20, 20, two_param_quantile<boost::math::cauchy_distribution<> >());
|
||||
cauchy.add_test_case(-20, 0.0125, two_param_quantile<boost::math::cauchy_distribution<> >());
|
||||
|
||||
test_boost_2_param<boost::math::cauchy_distribution>(cauchy);
|
||||
|
||||
distribution_tester chi_squared("ChiSquared");
|
||||
chi_squared.add_test_case(3, one_param_quantile<boost::math::chi_squared_distribution<> >());
|
||||
chi_squared.add_test_case(20, one_param_quantile<boost::math::chi_squared_distribution<> >());
|
||||
chi_squared.add_test_case(200, one_param_quantile<boost::math::chi_squared_distribution<> >());
|
||||
chi_squared.add_test_case(2000, one_param_quantile<boost::math::chi_squared_distribution<> >());
|
||||
chi_squared.add_test_case(20000, one_param_quantile<boost::math::chi_squared_distribution<> >());
|
||||
chi_squared.add_test_case(200000, one_param_quantile<boost::math::chi_squared_distribution<> >());
|
||||
|
||||
test_boost_1_param<boost::math::chi_squared_distribution>(chi_squared);
|
||||
|
||||
distribution_tester exponential("Exponential");
|
||||
exponential.add_test_case(0.001, one_param_quantile<boost::math::exponential_distribution<> >());
|
||||
exponential.add_test_case(0.01, one_param_quantile<boost::math::exponential_distribution<> >());
|
||||
exponential.add_test_case(0.1, one_param_quantile<boost::math::exponential_distribution<> >());
|
||||
exponential.add_test_case(1, one_param_quantile<boost::math::exponential_distribution<> >());
|
||||
exponential.add_test_case(10, one_param_quantile<boost::math::exponential_distribution<> >());
|
||||
exponential.add_test_case(100, one_param_quantile<boost::math::exponential_distribution<> >());
|
||||
exponential.add_test_case(1000, one_param_quantile<boost::math::exponential_distribution<> >());
|
||||
|
||||
test_boost_1_param<boost::math::exponential_distribution>(exponential);
|
||||
|
||||
distribution_tester extreme_value("ExtremeValue");
|
||||
extreme_value.add_test_case(0, 1, two_param_quantile<boost::math::extreme_value_distribution<> >());
|
||||
extreme_value.add_test_case(20, 20, two_param_quantile<boost::math::extreme_value_distribution<> >());
|
||||
extreme_value.add_test_case(-20, 0.0125, two_param_quantile<boost::math::extreme_value_distribution<> >());
|
||||
|
||||
test_boost_2_param<boost::math::extreme_value_distribution>(extreme_value);
|
||||
|
||||
distribution_tester fisher("F");
|
||||
for (unsigned i = 2; i <= 200000; i *= 10)
|
||||
{
|
||||
for (unsigned j = 2; j <= 200000; j *= 10)
|
||||
{
|
||||
fisher.add_test_case(i, j, two_param_quantile<boost::math::fisher_f_distribution<> >());
|
||||
}
|
||||
}
|
||||
test_boost_2_param<boost::math::fisher_f_distribution>(fisher);
|
||||
|
||||
distribution_tester gamma("Gamma");
|
||||
gamma.add_test_case(0.1, 1, two_param_quantile<boost::math::gamma_distribution<> >());
|
||||
gamma.add_test_case(20, 20, two_param_quantile<boost::math::gamma_distribution<> >());
|
||||
gamma.add_test_case(200, 0.0125, two_param_quantile<boost::math::gamma_distribution<> >());
|
||||
gamma.add_test_case(2000, 500, two_param_quantile<boost::math::gamma_distribution<> >());
|
||||
|
||||
test_boost_2_param<boost::math::gamma_distribution>(gamma);
|
||||
|
||||
distribution_tester geometric("Geometric");
|
||||
geometric.add_test_case(0.001, one_param_quantile<boost::math::geometric_distribution<> >());
|
||||
geometric.add_test_case(0.01, one_param_quantile<boost::math::geometric_distribution<> >());
|
||||
geometric.add_test_case(0.1, one_param_quantile<boost::math::geometric_distribution<> >());
|
||||
geometric.add_test_case(0.5, one_param_quantile<boost::math::geometric_distribution<> >());
|
||||
geometric.add_test_case(0.9, one_param_quantile<boost::math::geometric_distribution<> >());
|
||||
geometric.add_test_case(0.99, one_param_quantile<boost::math::geometric_distribution<> >());
|
||||
geometric.add_test_case(0.999, one_param_quantile<boost::math::geometric_distribution<> >());
|
||||
|
||||
test_boost_1_param<boost::math::geometric_distribution>(geometric);
|
||||
|
||||
distribution_tester hypergeometric("Hypergeometric");
|
||||
hypergeometric.add_test_case(10, 5, 100, three_param_quantile<boost::math::hypergeometric_distribution<> >());
|
||||
hypergeometric.add_test_case(50, 75, 100, three_param_quantile<boost::math::hypergeometric_distribution<> >());
|
||||
hypergeometric.add_test_case(30, 20, 100, three_param_quantile<boost::math::hypergeometric_distribution<> >());
|
||||
hypergeometric.add_test_case(100, 50, 1000000, three_param_quantile<boost::math::hypergeometric_distribution<> >());
|
||||
hypergeometric.add_test_case(500000, 3000, 1000000, three_param_quantile<boost::math::hypergeometric_distribution<> >());
|
||||
hypergeometric.add_test_case(20000, 800000, 1000000, three_param_quantile<boost::math::hypergeometric_distribution<> >());
|
||||
hypergeometric.add_test_case(100, 5, 1000, three_param_quantile<boost::math::hypergeometric_distribution<> >());
|
||||
hypergeometric.add_test_case(500, 50, 1000, three_param_quantile<boost::math::hypergeometric_distribution<> >());
|
||||
hypergeometric.add_test_case(2, 25, 1000, three_param_quantile<boost::math::hypergeometric_distribution<> >());
|
||||
hypergeometric.add_test_case(1, 5, 1000, three_param_quantile<boost::math::hypergeometric_distribution<> >());
|
||||
hypergeometric.add_test_case(100, 500, 1000, three_param_quantile<boost::math::hypergeometric_distribution<> >());
|
||||
|
||||
test_boost_3_param<boost::math::hypergeometric_distribution>(hypergeometric);
|
||||
|
||||
distribution_tester inverse_chi_squared("InverseChiSquared");
|
||||
inverse_chi_squared.add_test_case(5, 0.125, two_param_quantile<boost::math::inverse_chi_squared_distribution<> >());
|
||||
inverse_chi_squared.add_test_case(200, 0.75, two_param_quantile<boost::math::inverse_chi_squared_distribution<> >());
|
||||
inverse_chi_squared.add_test_case(2000, 1, two_param_quantile<boost::math::inverse_chi_squared_distribution<> >());
|
||||
inverse_chi_squared.add_test_case(20000, 10, two_param_quantile<boost::math::inverse_chi_squared_distribution<> >());
|
||||
inverse_chi_squared.add_test_case(200000, 100, two_param_quantile<boost::math::inverse_chi_squared_distribution<> >());
|
||||
|
||||
test_boost_2_param<boost::math::inverse_chi_squared_distribution>(inverse_chi_squared);
|
||||
|
||||
distribution_tester inverse_gamma("InverseGamma");
|
||||
inverse_gamma.add_test_case(0.1, 1, two_param_quantile<boost::math::inverse_gamma_distribution<> >());
|
||||
inverse_gamma.add_test_case(20, 20, two_param_quantile<boost::math::inverse_gamma_distribution<> >());
|
||||
inverse_gamma.add_test_case(200, 0.0125, two_param_quantile<boost::math::inverse_gamma_distribution<> >());
|
||||
inverse_gamma.add_test_case(2000, 500, two_param_quantile<boost::math::inverse_gamma_distribution<> >());
|
||||
|
||||
test_boost_2_param<boost::math::inverse_gamma_distribution>(inverse_gamma);
|
||||
|
||||
distribution_tester inverse_gaussian("InverseGaussian");
|
||||
inverse_gaussian.add_test_case(0.001, 1, two_param_quantile<boost::math::inverse_gaussian_distribution<> >());
|
||||
inverse_gaussian.add_test_case(20, 20, two_param_quantile<boost::math::inverse_gaussian_distribution<> >());
|
||||
|
||||
test_boost_2_param<boost::math::inverse_gaussian_distribution>(inverse_gaussian);
|
||||
|
||||
distribution_tester laplace("Laplace");
|
||||
laplace.add_test_case(0, 1, two_param_quantile<boost::math::laplace_distribution<> >());
|
||||
laplace.add_test_case(20, 20, two_param_quantile<boost::math::laplace_distribution<> >());
|
||||
laplace.add_test_case(-20, 0.0125, two_param_quantile<boost::math::laplace_distribution<> >());
|
||||
|
||||
test_boost_2_param<boost::math::laplace_distribution>(laplace);
|
||||
|
||||
distribution_tester logistic("Logistic");
|
||||
logistic.add_test_case(0, 1, two_param_quantile<boost::math::logistic_distribution<> >());
|
||||
logistic.add_test_case(20, 20, two_param_quantile<boost::math::logistic_distribution<> >());
|
||||
logistic.add_test_case(-20, 0.0125, two_param_quantile<boost::math::logistic_distribution<> >());
|
||||
|
||||
test_boost_2_param<boost::math::logistic_distribution>(logistic);
|
||||
|
||||
distribution_tester lognormal("LogNormal");
|
||||
lognormal.add_test_case(0, 1, two_param_quantile<boost::math::lognormal_distribution<> >());
|
||||
lognormal.add_test_case(20, 20, two_param_quantile<boost::math::lognormal_distribution<> >());
|
||||
lognormal.add_test_case(-20, 0.0125, two_param_quantile<boost::math::lognormal_distribution<> >());
|
||||
|
||||
test_boost_2_param<boost::math::lognormal_distribution>(lognormal);
|
||||
|
||||
distribution_tester negative_binomial("NegativeBinomial");
|
||||
negative_binomial.add_test_case(5, 0.125, two_param_quantile<boost::math::negative_binomial_distribution<> >());
|
||||
negative_binomial.add_test_case(200, 0.75, two_param_quantile<boost::math::negative_binomial_distribution<> >());
|
||||
negative_binomial.add_test_case(2000, 0.001, two_param_quantile<boost::math::negative_binomial_distribution<> >());
|
||||
negative_binomial.add_test_case(20000, 0.5, two_param_quantile<boost::math::negative_binomial_distribution<> >());
|
||||
negative_binomial.add_test_case(200000, 0.99, two_param_quantile<boost::math::negative_binomial_distribution<> >());
|
||||
|
||||
test_boost_2_param<boost::math::negative_binomial_distribution>(negative_binomial);
|
||||
|
||||
distribution_tester non_central_beta("NonCentralBeta");
|
||||
non_central_beta.add_test_case(2, 5, 2.1, three_param_quantile<boost::math::non_central_beta_distribution<> >());
|
||||
non_central_beta.add_test_case(0.25, 0.01, 20, three_param_quantile<boost::math::non_central_beta_distribution<> >());
|
||||
non_central_beta.add_test_case(20, 3, 30, three_param_quantile<boost::math::non_central_beta_distribution<> >());
|
||||
non_central_beta.add_test_case(100, 200, 400, three_param_quantile<boost::math::non_central_beta_distribution<> >());
|
||||
non_central_beta.add_test_case(100, 0.25, 20, three_param_quantile<boost::math::non_central_beta_distribution<> >());
|
||||
|
||||
test_boost_3_param<boost::math::non_central_beta_distribution>(non_central_beta);
|
||||
|
||||
distribution_tester non_central_chi_squared("NonCentralChiSquared");
|
||||
non_central_chi_squared.add_test_case(5, 0.5, two_param_quantile<boost::math::non_central_chi_squared_distribution<> >());
|
||||
non_central_chi_squared.add_test_case(200, 2, two_param_quantile<boost::math::non_central_chi_squared_distribution<> >());
|
||||
non_central_chi_squared.add_test_case(2000, 20, two_param_quantile<boost::math::non_central_chi_squared_distribution<> >());
|
||||
non_central_chi_squared.add_test_case(20000, 10, two_param_quantile<boost::math::non_central_chi_squared_distribution<> >());
|
||||
non_central_chi_squared.add_test_case(200000, 50, two_param_quantile<boost::math::non_central_chi_squared_distribution<> >());
|
||||
|
||||
test_boost_2_param<boost::math::non_central_chi_squared_distribution>(non_central_chi_squared);
|
||||
|
||||
distribution_tester non_central_f("NonCentralF");
|
||||
non_central_f.add_test_case(20, 20, 3, three_param_quantile<boost::math::non_central_f_distribution<> >());
|
||||
non_central_f.add_test_case(20, 50, 20, three_param_quantile<boost::math::non_central_f_distribution<> >());
|
||||
non_central_f.add_test_case(100, 20, 30, three_param_quantile<boost::math::non_central_f_distribution<> >());
|
||||
non_central_f.add_test_case(100, 200, 100, three_param_quantile<boost::math::non_central_f_distribution<> >());
|
||||
non_central_f.add_test_case(1000, 100000, 20, three_param_quantile<boost::math::non_central_f_distribution<> >());
|
||||
|
||||
test_boost_3_param<boost::math::non_central_f_distribution>(non_central_f);
|
||||
|
||||
distribution_tester non_central_t("NonCentralT");
|
||||
non_central_t.add_test_case(5, 0.5, two_param_quantile<boost::math::non_central_t_distribution<> >());
|
||||
non_central_t.add_test_case(200, 2, two_param_quantile<boost::math::non_central_t_distribution<> >());
|
||||
non_central_t.add_test_case(2000, 20, two_param_quantile<boost::math::non_central_t_distribution<> >());
|
||||
non_central_t.add_test_case(20000, 10, two_param_quantile<boost::math::non_central_t_distribution<> >());
|
||||
non_central_t.add_test_case(200000, 50, two_param_quantile<boost::math::non_central_t_distribution<> >());
|
||||
|
||||
test_boost_2_param<boost::math::non_central_t_distribution>(non_central_t);
|
||||
|
||||
distribution_tester pareto("Pareto");
|
||||
pareto.add_test_case(0.1, 1, two_param_quantile<boost::math::pareto_distribution<> >());
|
||||
pareto.add_test_case(20, 20, two_param_quantile<boost::math::pareto_distribution<> >());
|
||||
pareto.add_test_case(200, 0.0125, two_param_quantile<boost::math::pareto_distribution<> >());
|
||||
pareto.add_test_case(2000, 500, two_param_quantile<boost::math::pareto_distribution<> >());
|
||||
|
||||
test_boost_2_param<boost::math::pareto_distribution>(pareto);
|
||||
|
||||
distribution_tester poisson("Poisson");
|
||||
poisson.add_test_case(0.001, one_param_quantile<boost::math::poisson_distribution<> >());
|
||||
poisson.add_test_case(0.01, one_param_quantile<boost::math::poisson_distribution<> >());
|
||||
poisson.add_test_case(0.1, one_param_quantile<boost::math::poisson_distribution<> >());
|
||||
poisson.add_test_case(1, one_param_quantile<boost::math::poisson_distribution<> >());
|
||||
poisson.add_test_case(10, one_param_quantile<boost::math::poisson_distribution<> >());
|
||||
poisson.add_test_case(100, one_param_quantile<boost::math::poisson_distribution<> >());
|
||||
poisson.add_test_case(1000, one_param_quantile<boost::math::poisson_distribution<> >());
|
||||
|
||||
test_boost_1_param<boost::math::poisson_distribution>(poisson);
|
||||
|
||||
distribution_tester rayleigh("Rayleigh");
|
||||
rayleigh.add_test_case(0.001, one_param_quantile<boost::math::rayleigh_distribution<> >());
|
||||
rayleigh.add_test_case(0.01, one_param_quantile<boost::math::rayleigh_distribution<> >());
|
||||
rayleigh.add_test_case(0.1, one_param_quantile<boost::math::rayleigh_distribution<> >());
|
||||
rayleigh.add_test_case(1, one_param_quantile<boost::math::rayleigh_distribution<> >());
|
||||
rayleigh.add_test_case(10, one_param_quantile<boost::math::rayleigh_distribution<> >());
|
||||
rayleigh.add_test_case(100, one_param_quantile<boost::math::rayleigh_distribution<> >());
|
||||
rayleigh.add_test_case(1000, one_param_quantile<boost::math::rayleigh_distribution<> >());
|
||||
|
||||
test_boost_1_param<boost::math::rayleigh_distribution>(rayleigh);
|
||||
|
||||
distribution_tester skew_norm("SkewNormal");
|
||||
skew_norm.add_test_case(0, 1, 0.1, three_param_quantile<boost::math::skew_normal_distribution<> >());
|
||||
skew_norm.add_test_case(20, 20, 30, three_param_quantile<boost::math::skew_normal_distribution<> >());
|
||||
skew_norm.add_test_case(-20, 0.0125, 10, three_param_quantile<boost::math::skew_normal_distribution<> >());
|
||||
|
||||
test_boost_3_param<boost::math::skew_normal_distribution>(skew_norm);
|
||||
|
||||
distribution_tester students_t("StudentsT");
|
||||
students_t.add_test_case(3, one_param_quantile<boost::math::students_t_distribution<> >());
|
||||
students_t.add_test_case(20, one_param_quantile<boost::math::students_t_distribution<> >());
|
||||
students_t.add_test_case(200, one_param_quantile<boost::math::students_t_distribution<> >());
|
||||
students_t.add_test_case(2000, one_param_quantile<boost::math::students_t_distribution<> >());
|
||||
students_t.add_test_case(20000, one_param_quantile<boost::math::students_t_distribution<> >());
|
||||
students_t.add_test_case(200000, one_param_quantile<boost::math::students_t_distribution<> >());
|
||||
|
||||
test_boost_1_param<boost::math::students_t_distribution>(students_t);
|
||||
|
||||
distribution_tester weibull("Weibull");
|
||||
weibull.add_test_case(0.1, 1, two_param_quantile<boost::math::weibull_distribution<> >());
|
||||
weibull.add_test_case(20, 20, two_param_quantile<boost::math::weibull_distribution<> >());
|
||||
weibull.add_test_case(200, 0.0125, two_param_quantile<boost::math::weibull_distribution<> >());
|
||||
weibull.add_test_case(2000, 500, two_param_quantile<boost::math::weibull_distribution<> >());
|
||||
|
||||
test_boost_2_param<boost::math::weibull_distribution>(weibull);
|
||||
|
||||
#ifdef TEST_GSL
|
||||
// normal, note no location param
|
||||
n.run_timed_tests([](const std::vector<double>& v, double x) { return gsl_cdf_gaussian_P(x, v[1]); }, "CDF", "GSL");
|
||||
n.run_timed_tests([](const std::vector<double>& v, double x) { return gsl_cdf_gaussian_Pinv(x, v[1]); }, "quantile", "GSL", true);
|
||||
// exponential:
|
||||
exponential.run_timed_tests([](const std::vector<double>& v, double x) { return gsl_cdf_exponential_P(x, 1 / v[0]); }, "CDF", "GSL");
|
||||
exponential.run_timed_tests([](const std::vector<double>& v, double x) { return gsl_cdf_exponential_Pinv(x, 1 / v[0]); }, "quantile", "GSL", true);
|
||||
// laplace, note no location param:
|
||||
laplace.run_timed_tests([](const std::vector<double>& v, double x) { return gsl_cdf_laplace_P(x, v[1]); }, "CDF", "GSL");
|
||||
laplace.run_timed_tests([](const std::vector<double>& v, double x) { return gsl_cdf_laplace_Pinv(x, v[1]); }, "quantile", "GSL", true);
|
||||
// cauchy, note no location param:
|
||||
cauchy.run_timed_tests([](const std::vector<double>& v, double x) { return gsl_cdf_cauchy_P(x, v[1]); }, "CDF", "GSL");
|
||||
cauchy.run_timed_tests([](const std::vector<double>& v, double x) { return gsl_cdf_cauchy_Pinv(x, v[1]); }, "quantile", "GSL", true);
|
||||
// rayleigh:
|
||||
rayleigh.run_timed_tests([](const std::vector<double>& v, double x) { return gsl_cdf_rayleigh_P(x, v[0]); }, "CDF", "GSL");
|
||||
rayleigh.run_timed_tests([](const std::vector<double>& v, double x) { return gsl_cdf_rayleigh_Pinv(x, v[0]); }, "quantile", "GSL", true);
|
||||
// gamma:
|
||||
gamma.run_timed_tests([](const std::vector<double>& v, double x) { return gsl_cdf_gamma_P(x, v[0], v[1]); }, "CDF", "GSL");
|
||||
gamma.run_timed_tests([](const std::vector<double>& v, double x) { return gsl_cdf_gamma_Pinv(x, v[0], v[1]); }, "quantile", "GSL", true);
|
||||
// lognormal:
|
||||
lognormal.run_timed_tests([](const std::vector<double>& v, double x) { return gsl_cdf_lognormal_P(x, v[0], v[1]); }, "CDF", "GSL");
|
||||
lognormal.run_timed_tests([](const std::vector<double>& v, double x) { return gsl_cdf_lognormal_Pinv(x, v[0], v[1]); }, "quantile", "GSL", true);
|
||||
// chi squared:
|
||||
chi_squared.run_timed_tests([](const std::vector<double>& v, double x) { return gsl_cdf_chisq_P(x, v[0]); }, "CDF", "GSL");
|
||||
chi_squared.run_timed_tests([](const std::vector<double>& v, double x) { return gsl_cdf_chisq_Pinv(x, v[0]); }, "quantile", "GSL", true);
|
||||
// F:
|
||||
fisher.run_timed_tests([](const std::vector<double>& v, double x) { return gsl_cdf_fdist_P(x, v[0], v[1]); }, "CDF", "GSL");
|
||||
fisher.run_timed_tests([](const std::vector<double>& v, double x) { return gsl_cdf_fdist_Pinv(x, v[0], v[1]); }, "quantile", "GSL", true);
|
||||
// T:
|
||||
students_t.run_timed_tests([](const std::vector<double>& v, double x) { return gsl_cdf_tdist_P(x, v[0]); }, "CDF", "GSL");
|
||||
students_t.run_timed_tests([](const std::vector<double>& v, double x) { return gsl_cdf_tdist_Pinv(x, v[0]); }, "quantile", "GSL", true);
|
||||
// beta:
|
||||
beta.run_timed_tests([](const std::vector<double>& v, double x) { return gsl_cdf_beta_P(x, v[0], v[1]); }, "CDF", "GSL");
|
||||
beta.run_timed_tests([](const std::vector<double>& v, double x) { return gsl_cdf_beta_Pinv(x, v[0], v[1]); }, "quantile", "GSL", true);
|
||||
// logistic, note no location param
|
||||
logistic.run_timed_tests([](const std::vector<double>& v, double x) { return gsl_cdf_logistic_P(x, v[1]); }, "CDF", "GSL");
|
||||
logistic.run_timed_tests([](const std::vector<double>& v, double x) { return gsl_cdf_logistic_Pinv(x, v[1]); }, "quantile", "GSL", true);
|
||||
// pareto:
|
||||
pareto.run_timed_tests([](const std::vector<double>& v, double x) { return gsl_cdf_pareto_P(x, v[1], v[0]); }, "CDF", "GSL");
|
||||
pareto.run_timed_tests([](const std::vector<double>& v, double x) { return gsl_cdf_pareto_Pinv(x, v[1], v[0]); }, "quantile", "GSL", true);
|
||||
// weibull:
|
||||
weibull.run_timed_tests([](const std::vector<double>& v, double x) { return gsl_cdf_weibull_P(x, v[1], v[0]); }, "CDF", "GSL");
|
||||
weibull.run_timed_tests([](const std::vector<double>& v, double x) { return gsl_cdf_weibull_Pinv(x, v[1], v[0]); }, "quantile", "GSL", true);
|
||||
// poisson:
|
||||
poisson.run_timed_tests([](const std::vector<double>& v, double x) { return gsl_cdf_poisson_P(x, v[0]); }, "CDF", "GSL");
|
||||
//poisson.run_timed_tests([](const std::vector<double>& v, double x){ return gsl_cdf_poisson_Pinv(x, v[0]); }, "quantile", "GSL", true);
|
||||
// binomial:
|
||||
binomial.run_timed_tests([](const std::vector<double>& v, double x) { return gsl_cdf_binomial_P(x, v[1], v[0]); }, "CDF", "GSL");
|
||||
//binomial.run_timed_tests([](const std::vector<double>& v, double x){ return gsl_cdf_binomial_Pinv(x, v[1], v[0]); }, "quantile", "GSL", true);
|
||||
// negative_binomial:
|
||||
negative_binomial.run_timed_tests([](const std::vector<double>& v, double x) { return gsl_cdf_negative_binomial_P(x, v[1], v[0]); }, "CDF", "GSL");
|
||||
//negative_binomial.run_timed_tests([](const std::vector<double>& v, double x){ return gsl_cdf_negative_binomial_Pinv(x, v[1], v[0]); }, "quantile", "GSL", true);
|
||||
// geometric:
|
||||
geometric.run_timed_tests([](const std::vector<double>& v, double x) { return gsl_cdf_geometric_P(x + 1, v[0]); }, "CDF", "GSL");
|
||||
//geometric.run_timed_tests([](const std::vector<double>& v, double x){ return gsl_cdf_geometric_Pinv(x, v[0]) - 1; }, "quantile", "GSL", true);
|
||||
// hypergeometric:
|
||||
hypergeometric.run_timed_tests([](const std::vector<double>& v, double x) { return gsl_cdf_hypergeometric_P(x, v[0], v[2] - v[0], v[1]); }, "CDF", "GSL");
|
||||
//hypergeometric.run_timed_tests([](const std::vector<double>& v, double x){ return gsl_cdf_hypergeometric_Pinv(x, v[0], v[2] - v[0], v[1]); }, "quantile", "GSL", true);
|
||||
#endif
|
||||
|
||||
#ifdef TEST_RMATH
|
||||
// beta
|
||||
beta.run_timed_tests([](const std::vector<double>& v, double x) { return dbeta(x, v[0], v[1], 0); }, "PDF", "Rmath " R_VERSION_STRING);
|
||||
beta.run_timed_tests([](const std::vector<double>& v, double x) { return pbeta(x, v[0], v[1], 1, 0); }, "CDF", "Rmath " R_VERSION_STRING);
|
||||
beta.run_timed_tests([](const std::vector<double>& v, double x) { return qbeta(x, v[0], v[1], 1, 0); }, "quantile", "Rmath " R_VERSION_STRING, true);
|
||||
// non-central beta
|
||||
non_central_beta.run_timed_tests([](const std::vector<double>& v, double x) { return dnbeta(x, v[0], v[1], v[2], 0); }, "PDF", "Rmath " R_VERSION_STRING);
|
||||
non_central_beta.run_timed_tests([](const std::vector<double>& v, double x) { return pnbeta(x, v[0], v[1], v[2], 1, 0); }, "CDF", "Rmath " R_VERSION_STRING);
|
||||
non_central_beta.run_timed_tests([](const std::vector<double>& v, double x) { return qnbeta(x, v[0], v[1], v[2], 1, 0); }, "quantile", "Rmath " R_VERSION_STRING, true);
|
||||
// binomial
|
||||
binomial.run_timed_tests([](const std::vector<double>& v, double x) { return dbinom(x, v[0], v[1], 0); }, "PDF", "Rmath " R_VERSION_STRING);
|
||||
binomial.run_timed_tests([](const std::vector<double>& v, double x) { return pbinom(x, v[0], v[1], 1, 0); }, "CDF", "Rmath " R_VERSION_STRING);
|
||||
binomial.run_timed_tests([](const std::vector<double>& v, double x) { return qbinom(x, v[0], v[1], 1, 0); }, "quantile", "Rmath " R_VERSION_STRING, true);
|
||||
// cauchy
|
||||
cauchy.run_timed_tests([](const std::vector<double>& v, double x) { return dcauchy(x, v[0], v[1], 0); }, "PDF", "Rmath " R_VERSION_STRING);
|
||||
cauchy.run_timed_tests([](const std::vector<double>& v, double x) { return pcauchy(x, v[0], v[1], 1, 0); }, "CDF", "Rmath " R_VERSION_STRING);
|
||||
cauchy.run_timed_tests([](const std::vector<double>& v, double x) { return qcauchy(x, v[0], v[1], 1, 0); }, "quantile", "Rmath " R_VERSION_STRING, true);
|
||||
// chi squared
|
||||
chi_squared.run_timed_tests([](const std::vector<double>& v, double x) { return dchisq(x, v[0], 0); }, "PDF", "Rmath " R_VERSION_STRING);
|
||||
chi_squared.run_timed_tests([](const std::vector<double>& v, double x) { return pchisq(x, v[0], 1, 0); }, "CDF", "Rmath " R_VERSION_STRING);
|
||||
chi_squared.run_timed_tests([](const std::vector<double>& v, double x) { return qchisq(x, v[0], 1, 0); }, "quantile", "Rmath " R_VERSION_STRING, true);
|
||||
// non central chi squared
|
||||
non_central_chi_squared.run_timed_tests([](const std::vector<double>& v, double x) { return dnchisq(x, v[0], v[1], 0); }, "PDF", "Rmath " R_VERSION_STRING);
|
||||
non_central_chi_squared.run_timed_tests([](const std::vector<double>& v, double x) { return pnchisq(x, v[0], v[1], 1, 0); }, "CDF", "Rmath " R_VERSION_STRING);
|
||||
non_central_chi_squared.run_timed_tests([](const std::vector<double>& v, double x) { return qnchisq(x, v[0], v[1], 1, 0); }, "quantile", "Rmath " R_VERSION_STRING, true);
|
||||
// exponential
|
||||
exponential.run_timed_tests([](const std::vector<double>& v, double x) { return dexp(x, 1 / v[0], 0); }, "PDF", "Rmath " R_VERSION_STRING);
|
||||
exponential.run_timed_tests([](const std::vector<double>& v, double x) { return pexp(x, 1 / v[0], 1, 0); }, "CDF", "Rmath " R_VERSION_STRING);
|
||||
exponential.run_timed_tests([](const std::vector<double>& v, double x) { return qexp(x, 1 / v[0], 1, 0); }, "quantile", "Rmath " R_VERSION_STRING, true);
|
||||
// F
|
||||
fisher.run_timed_tests([](const std::vector<double>& v, double x) { return df(x, v[0], v[1], 0); }, "PDF", "Rmath " R_VERSION_STRING);
|
||||
fisher.run_timed_tests([](const std::vector<double>& v, double x) { return pf(x, v[0], v[1], 1, 0); }, "CDF", "Rmath " R_VERSION_STRING);
|
||||
fisher.run_timed_tests([](const std::vector<double>& v, double x) { return qf(x, v[0], v[1], 1, 0); }, "quantile", "Rmath " R_VERSION_STRING, true);
|
||||
// non central F
|
||||
non_central_f.run_timed_tests([](const std::vector<double>& v, double x) { return dnf(x, v[0], v[1], v[2], 0); }, "PDF", "Rmath " R_VERSION_STRING);
|
||||
non_central_f.run_timed_tests([](const std::vector<double>& v, double x) { return pnf(x, v[0], v[1], v[2], 1, 0); }, "CDF", "Rmath " R_VERSION_STRING);
|
||||
non_central_f.run_timed_tests([](const std::vector<double>& v, double x) { return qnf(x, v[0], v[1], v[2], 1, 0); }, "quantile", "Rmath " R_VERSION_STRING, true);
|
||||
// gamma
|
||||
gamma.run_timed_tests([](const std::vector<double>& v, double x) { return dgamma(x, v[0], v[1], 0); }, "PDF", "Rmath " R_VERSION_STRING);
|
||||
gamma.run_timed_tests([](const std::vector<double>& v, double x) { return pgamma(x, v[0], v[1], 1, 0); }, "CDF", "Rmath " R_VERSION_STRING);
|
||||
gamma.run_timed_tests([](const std::vector<double>& v, double x) { return qgamma(x, v[0], v[1], 1, 0); }, "quantile", "Rmath " R_VERSION_STRING, true);
|
||||
// geometric
|
||||
geometric.run_timed_tests([](const std::vector<double>& v, double x) { return dgeom(x, v[0], 0); }, "PDF", "Rmath " R_VERSION_STRING);
|
||||
geometric.run_timed_tests([](const std::vector<double>& v, double x) { return pgeom(x, v[0], 1, 0); }, "CDF", "Rmath " R_VERSION_STRING);
|
||||
geometric.run_timed_tests([](const std::vector<double>& v, double x) { return qgeom(x, v[0], 1, 0); }, "quantile", "Rmath " R_VERSION_STRING, true);
|
||||
// hypergeometric
|
||||
hypergeometric.run_timed_tests([](const std::vector<double>& v, double x) { return dhyper(x, v[0], v[2] - v[0], v[1], 0); }, "PDF", "Rmath " R_VERSION_STRING);
|
||||
hypergeometric.run_timed_tests([](const std::vector<double>& v, double x) { return phyper(x, v[0], v[2] - v[0], v[1], 1, 0); }, "CDF", "Rmath " R_VERSION_STRING);
|
||||
hypergeometric.run_timed_tests([](const std::vector<double>& v, double x) { return qhyper(x, v[0], v[2] - v[0], v[1], 1, 0); }, "quantile", "Rmath " R_VERSION_STRING, true);
|
||||
// logistic
|
||||
logistic.run_timed_tests([](const std::vector<double>& v, double x) { return dlogis(x, v[0], v[1], 0); }, "PDF", "Rmath " R_VERSION_STRING);
|
||||
logistic.run_timed_tests([](const std::vector<double>& v, double x) { return plogis(x, v[0], v[1], 1, 0); }, "CDF", "Rmath " R_VERSION_STRING);
|
||||
logistic.run_timed_tests([](const std::vector<double>& v, double x) { return qlogis(x, v[0], v[1], 1, 0); }, "quantile", "Rmath " R_VERSION_STRING, true);
|
||||
// lognormal
|
||||
lognormal.run_timed_tests([](const std::vector<double>& v, double x) { return dlnorm(x, v[0], v[1], 0); }, "PDF", "Rmath " R_VERSION_STRING);
|
||||
lognormal.run_timed_tests([](const std::vector<double>& v, double x) { return plnorm(x, v[0], v[1], 1, 0); }, "CDF", "Rmath " R_VERSION_STRING);
|
||||
lognormal.run_timed_tests([](const std::vector<double>& v, double x) { return qlnorm(x, v[0], v[1], 1, 0); }, "quantile", "Rmath " R_VERSION_STRING, true);
|
||||
// negative_binomial
|
||||
negative_binomial.run_timed_tests([](const std::vector<double>& v, double x) { return dnbinom(x, v[0], v[1], 0); }, "PDF", "Rmath " R_VERSION_STRING);
|
||||
negative_binomial.run_timed_tests([](const std::vector<double>& v, double x) { return pnbinom(x, v[0], v[1], 1, 0); }, "CDF", "Rmath " R_VERSION_STRING);
|
||||
negative_binomial.run_timed_tests([](const std::vector<double>& v, double x) { return qnbinom(x, v[0], v[1], 1, 0); }, "quantile", "Rmath " R_VERSION_STRING, true);
|
||||
// normal
|
||||
n.run_timed_tests([](const std::vector<double>& v, double x) { return dnorm(x, v[0], v[1], 0); }, "PDF", "Rmath " R_VERSION_STRING);
|
||||
n.run_timed_tests([](const std::vector<double>& v, double x) { return pnorm(x, v[0], v[1], 1, 0); }, "CDF", "Rmath " R_VERSION_STRING);
|
||||
n.run_timed_tests([](const std::vector<double>& v, double x) { return qnorm(x, v[0], v[1], 1, 0); }, "quantile", "Rmath " R_VERSION_STRING, true);
|
||||
// poisson
|
||||
poisson.run_timed_tests([](const std::vector<double>& v, double x) { return dpois(x, v[0], 0); }, "PDF", "Rmath " R_VERSION_STRING);
|
||||
poisson.run_timed_tests([](const std::vector<double>& v, double x) { return ppois(x, v[0], 1, 0); }, "CDF", "Rmath " R_VERSION_STRING);
|
||||
poisson.run_timed_tests([](const std::vector<double>& v, double x) { return qpois(x, v[0], 1, 0); }, "quantile", "Rmath " R_VERSION_STRING, true);
|
||||
// T
|
||||
students_t.run_timed_tests([](const std::vector<double>& v, double x) { return dt(x, v[0], 0); }, "PDF", "Rmath " R_VERSION_STRING);
|
||||
students_t.run_timed_tests([](const std::vector<double>& v, double x) { return pt(x, v[0], 1, 0); }, "CDF", "Rmath " R_VERSION_STRING);
|
||||
students_t.run_timed_tests([](const std::vector<double>& v, double x) { return qt(x, v[0], 1, 0); }, "quantile", "Rmath " R_VERSION_STRING, true);
|
||||
// non central T
|
||||
non_central_t.run_timed_tests([](const std::vector<double>& v, double x) { return dnt(x, v[0], v[1], 0); }, "PDF", "Rmath " R_VERSION_STRING);
|
||||
non_central_t.run_timed_tests([](const std::vector<double>& v, double x) { return pnt(x, v[0], v[1], 1, 0); }, "CDF", "Rmath " R_VERSION_STRING);
|
||||
non_central_t.run_timed_tests([](const std::vector<double>& v, double x) { return qnt(x, v[0], v[1], 1, 0); }, "quantile", "Rmath " R_VERSION_STRING, true);
|
||||
// weibull
|
||||
weibull.run_timed_tests([](const std::vector<double>& v, double x) { return dweibull(x, v[0], v[1], 0); }, "PDF", "Rmath " R_VERSION_STRING);
|
||||
weibull.run_timed_tests([](const std::vector<double>& v, double x) { return pweibull(x, v[0], v[1], 1, 0); }, "CDF", "Rmath " R_VERSION_STRING);
|
||||
weibull.run_timed_tests([](const std::vector<double>& v, double x) { return qweibull(x, v[0], v[1], 1, 0); }, "quantile", "Rmath " R_VERSION_STRING, true);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef TEST_DCDFLIB
|
||||
n.run_timed_tests([](const std::vector<double>& v, double x) { return dcdflib_norm_cdf(x, v[0], v[1]); }, "CDF", "DCDFLIB");
|
||||
n.run_timed_tests([](const std::vector<double>& v, double x) { return dcdflib_norm_quantile(x, v[0], v[1]); }, "quantile", "DCDFLIB", true);
|
||||
|
||||
beta.run_timed_tests([](const std::vector<double>& v, double x) { return dcdflib_beta_cdf(x, v[0], v[1]); }, "CDF", "DCDFLIB");
|
||||
beta.run_timed_tests([](const std::vector<double>& v, double x) { return dcdflib_beta_quantile(x, v[0], v[1]); }, "quantile", "DCDFLIB", true);
|
||||
|
||||
binomial.run_timed_tests([](const std::vector<double>& v, double x) { return dcdflib_binomial_cdf(x, v[0], v[1]); }, "CDF", "DCDFLIB");
|
||||
binomial.run_timed_tests([](const std::vector<double>& v, double x) { return dcdflib_binomial_quantile(x, v[0], v[1]); }, "quantile", "DCDFLIB", true);
|
||||
|
||||
chi_squared.run_timed_tests([](const std::vector<double>& v, double x) { return dcdflib_chi_cdf(x, v[0]); }, "CDF", "DCDFLIB");
|
||||
chi_squared.run_timed_tests([](const std::vector<double>& v, double x) { return dcdflib_chi_quantile(x, v[0]); }, "quantile", "DCDFLIB", true);
|
||||
|
||||
non_central_chi_squared.run_timed_tests([](const std::vector<double>& v, double x) { return dcdflib_chi_n_cdf(x, v[0], v[1]); }, "CDF", "DCDFLIB");
|
||||
non_central_chi_squared.run_timed_tests([](const std::vector<double>& v, double x) { return dcdflib_chi_n_quantile(x, v[0], v[1]); }, "quantile", "DCDFLIB", true);
|
||||
|
||||
fisher.run_timed_tests([](const std::vector<double>& v, double x) { return dcdflib_f_cdf(x, v[0], v[1]); }, "CDF", "DCDFLIB");
|
||||
fisher.run_timed_tests([](const std::vector<double>& v, double x) { return dcdflib_f_quantile(x, v[0], v[1]); }, "quantile", "DCDFLIB", true);
|
||||
|
||||
non_central_f.run_timed_tests([](const std::vector<double>& v, double x) { return dcdflib_f_n_cdf(x, v[0], v[1], v[2]); }, "CDF", "DCDFLIB");
|
||||
non_central_f.run_timed_tests([](const std::vector<double>& v, double x) { return dcdflib_f_n_quantile(x, v[0], v[1], v[2]); }, "quantile", "DCDFLIB", true);
|
||||
|
||||
gamma.run_timed_tests([](const std::vector<double>& v, double x) { return dcdflib_gamma_cdf(x, v[0], v[1]); }, "CDF", "DCDFLIB");
|
||||
gamma.run_timed_tests([](const std::vector<double>& v, double x) { return dcdflib_gamma_quantile(x, v[0], v[1]); }, "quantile", "DCDFLIB", true);
|
||||
|
||||
negative_binomial.run_timed_tests([](const std::vector<double>& v, double x) { return dcdflib_nbin_cdf(x, v[0], v[1]); }, "CDF", "DCDFLIB");
|
||||
negative_binomial.run_timed_tests([](const std::vector<double>& v, double x) { return dcdflib_nbin_quantile(x, v[0], v[1]); }, "quantile", "DCDFLIB", true);
|
||||
|
||||
poisson.run_timed_tests([](const std::vector<double>& v, double x) { return dcdflib_poisson_cdf(x, v[0]); }, "CDF", "DCDFLIB");
|
||||
poisson.run_timed_tests([](const std::vector<double>& v, double x) { return dcdflib_poisson_quantile(x, v[0]); }, "quantile", "DCDFLIB", true);
|
||||
|
||||
students_t.run_timed_tests([](const std::vector<double>& v, double x) { return dcdflib_t_cdf(x, v[0]); }, "CDF", "DCDFLIB");
|
||||
students_t.run_timed_tests([](const std::vector<double>& v, double x) { return dcdflib_t_quantile(x, v[0]); }, "quantile", "DCDFLIB", true);
|
||||
|
||||
non_central_t.run_timed_tests([](const std::vector<double>& v, double x) { return dcdflib_t_n_cdf(x, v[0], v[1]); }, "CDF", "DCDFLIB");
|
||||
non_central_t.run_timed_tests([](const std::vector<double>& v, double x) { return dcdflib_t_n_quantile(x, v[0], v[1]); }, "quantile", "DCDFLIB", true);
|
||||
#endif
|
||||
|
||||
}
|
||||
catch(const std::exception& e)
|
||||
{
|
||||
std::cout << "Test run aborted due to thrown exception: " << e.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -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 <boost/math/special_functions/jacobi_elliptic.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "../../test/table_type.hpp"
|
||||
#include "table_helper.hpp"
|
||||
#include "performance.hpp"
|
||||
#include <iostream>
|
||||
|
||||
typedef double T;
|
||||
#define SC_(x) static_cast<double>(x)
|
||||
static const boost::array<boost::array<T, 5>, 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<double>& v){ return boost::math::jacobi_dn(v[1], v[0]); }, [](const std::vector<double>& v){ return v[4]; });
|
||||
|
||||
|
||||
#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
std::cout << "Screening GSL data:\n";
|
||||
screen_data([](const std::vector<double>& v)
|
||||
{
|
||||
double s, c, d;
|
||||
gsl_sf_elljac_e(v[0], v[1] * v[1], &s, &c, &d);
|
||||
return d;
|
||||
}, [](const std::vector<double>& v){ return v[4]; });
|
||||
#endif
|
||||
|
||||
unsigned data_used = data.size();
|
||||
std::string function = "jacobi_dn[br](" + boost::lexical_cast<std::string>(data_used) + "/" + boost::lexical_cast<std::string>(data_total) + " tests selected)";
|
||||
std::string function_short = "jacobi_dn";
|
||||
|
||||
double time;
|
||||
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return boost::math::jacobi_dn(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<double>& v){ return boost::math::jacobi_dn(v[1], v[0], boost::math::policies::make_policy(boost::math::policies::promote_double<false>())); });
|
||||
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<false>");
|
||||
#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<false>");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
time = exec_timed_test([](const std::vector<double>& v)
|
||||
{
|
||||
double s, c, d;
|
||||
gsl_sf_elljac_e(v[0], v[1] * v[1], &s, &c, &d);
|
||||
return d;
|
||||
});
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
// 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 <boost/math/special_functions/ellint_1.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "../../test/table_type.hpp"
|
||||
#include "table_helper.hpp"
|
||||
#include "performance.hpp"
|
||||
#include <iostream>
|
||||
|
||||
typedef double T;
|
||||
#define SC_(x) static_cast<double>(x)
|
||||
static const boost::array<boost::array<T, 3>, 19> data1 = { {
|
||||
{ { SC_(0.0), SC_(0.0), SC_(0.0) } },
|
||||
{ { SC_(-10.0), SC_(0.0), SC_(-10.0) } },
|
||||
{ { SC_(-1.0), SC_(-1.0), SC_(-1.2261911708835170708130609674719067527242483502207) } },
|
||||
{ { SC_(-4.0), SC_(0.875), SC_(-5.3190556182262405182189463092940736859067548232647) } },
|
||||
{ { SC_(8.0), SC_(-0.625), SC_(9.0419973860310100524448893214394562615252527557062) } },
|
||||
{ { SC_(1e-05), SC_(0.875), SC_(0.000010000000000127604166668510945638036143355898993088) } },
|
||||
{ { SC_(1e+05), T(10) / 1024, SC_(100002.38431454899771096037307519328741455615271038) } },
|
||||
{ { SC_(1e-20), SC_(1.0), SC_(1.0000000000000000000000000000000000000000166666667e-20) } },
|
||||
{ { SC_(1e-20), SC_(1e-20), SC_(1.000000000000000e-20) } },
|
||||
{ { SC_(1e+20), T(400) / 1024, SC_(1.0418143796499216839719289963154558027005142709763e20) } },
|
||||
{ { SC_(1e+50), SC_(0.875), SC_(1.3913251718238765549409892714295358043696028445944e50) } },
|
||||
{ { SC_(2.0), SC_(0.5), SC_(2.1765877052210673672479877957388515321497888026770) } },
|
||||
{ { SC_(4.0), SC_(0.5), SC_(4.2543274975235836861894752787874633017836785640477) } },
|
||||
{ { SC_(6.0), SC_(0.5), SC_(6.4588766202317746302999080620490579800463614807916) } },
|
||||
{ { SC_(10.0), SC_(0.5), SC_(10.697409951222544858346795279378531495869386960090) } },
|
||||
{ { SC_(-2.0), SC_(0.5), SC_(-2.1765877052210673672479877957388515321497888026770) } },
|
||||
{ { SC_(-4.0), SC_(0.5), SC_(-4.2543274975235836861894752787874633017836785640477) } },
|
||||
{ { SC_(-6.0), SC_(0.5), SC_(-6.4588766202317746302999080620490579800463614807916) } },
|
||||
{ { SC_(-10.0), SC_(0.5), SC_(-10.697409951222544858346795279378531495869386960090) } },
|
||||
} };
|
||||
|
||||
int main()
|
||||
{
|
||||
#include "ellint_f_data.ipp"
|
||||
|
||||
add_data(data1);
|
||||
add_data(ellint_f_data);
|
||||
|
||||
unsigned data_total = data.size();
|
||||
|
||||
screen_data([](const std::vector<double>& v){ return boost::math::ellint_1(v[1], v[0]); }, [](const std::vector<double>& v){ return v[2]; });
|
||||
|
||||
|
||||
#if defined(TEST_LIBSTDCXX) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
screen_data([](const std::vector<double>& v){ return std::tr1::ellint_1(v[1], v[0]); }, [](const std::vector<double>& v){ return v[2]; });
|
||||
#endif
|
||||
#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
screen_data([](const std::vector<double>& v){ return gsl_sf_ellint_F(v[0], v[1], GSL_PREC_DOUBLE); }, [](const std::vector<double>& v){ return v[2]; });
|
||||
#endif
|
||||
|
||||
unsigned data_used = data.size();
|
||||
std::string function = "ellint_1[br](" + boost::lexical_cast<std::string>(data_used) + "/" + boost::lexical_cast<std::string>(data_total) + " tests selected)";
|
||||
std::string function_short = "ellint_1";
|
||||
|
||||
double time;
|
||||
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return boost::math::ellint_1(v[1], v[0]); });
|
||||
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<double>& v){ return boost::math::ellint_1(v[1], v[0], boost::math::policies::make_policy(boost::math::policies::promote_double<false>())); });
|
||||
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<false>");
|
||||
#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<false>");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(TEST_LIBSTDCXX) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return std::tr1::ellint_1(v[1], 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, "tr1/cmath");
|
||||
#endif
|
||||
#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return gsl_sf_ellint_F(v[0], v[1], GSL_PREC_DOUBLE); });
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -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 <boost/math/special_functions/ellint_1.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "../../test/table_type.hpp"
|
||||
#include "table_helper.hpp"
|
||||
#include "performance.hpp"
|
||||
#include <iostream>
|
||||
|
||||
typedef double T;
|
||||
#define SC_(x) static_cast<double>(x)
|
||||
static const boost::array<boost::array<T, 2>, 9> data2 = { {
|
||||
{ { SC_(0.0), SC_(1.5707963267948966192313216916397514420985846996876) } },
|
||||
{ { SC_(0.125), SC_(1.5769867712158131421244030532288080803822271060839) } },
|
||||
{ { SC_(0.25), SC_(1.5962422221317835101489690714979498795055744578951) } },
|
||||
{ { T(300) / 1024, SC_(1.6062331054696636704261124078746600894998873503208) } },
|
||||
{ { T(400) / 1024, SC_(1.6364782007562008756208066125715722889067992997614) } },
|
||||
{ { SC_(-0.5), SC_(1.6857503548125960428712036577990769895008008941411) } },
|
||||
{ { SC_(-0.75), SC_(1.9109897807518291965531482187613425592531451316788) } },
|
||||
{ { 1 - T(1) / 8, SC_(2.185488469278223686913080323730158689730428415766) } },
|
||||
{ { 1 - T(1) / 1024, SC_(4.5074135978990422666372495313621124487894807327687) } },
|
||||
} };
|
||||
|
||||
int main()
|
||||
{
|
||||
#include "ellint_k_data.ipp"
|
||||
|
||||
add_data(data2);
|
||||
add_data(ellint_k_data);
|
||||
|
||||
unsigned data_total = data.size();
|
||||
|
||||
screen_data([](const std::vector<double>& v){ return boost::math::ellint_1(v[0]); }, [](const std::vector<double>& v){ return v[1]; });
|
||||
|
||||
|
||||
#if defined(TEST_LIBSTDCXX) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
screen_data([](const std::vector<double>& v){ return std::tr1::comp_ellint_1(v[0]); }, [](const std::vector<double>& v){ return v[1]; });
|
||||
#endif
|
||||
#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
screen_data([](const std::vector<double>& v){ return gsl_sf_ellint_Kcomp(v[0], GSL_PREC_DOUBLE); }, [](const std::vector<double>& v){ return v[1]; });
|
||||
#endif
|
||||
|
||||
unsigned data_used = data.size();
|
||||
std::string function = "ellint_1 (complete)[br](" + boost::lexical_cast<std::string>(data_used) + "/" + boost::lexical_cast<std::string>(data_total) + " tests selected)";
|
||||
std::string function_short = "ellint_1 (complete)";
|
||||
|
||||
double time;
|
||||
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return boost::math::ellint_1(v[0]); });
|
||||
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<double>& v){ return boost::math::ellint_1(v[0], boost::math::policies::make_policy(boost::math::policies::promote_double<false>())); });
|
||||
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<false>");
|
||||
#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<false>");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(TEST_LIBSTDCXX) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return std::tr1::comp_ellint_1(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, "tr1/cmath");
|
||||
#endif
|
||||
#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return gsl_sf_ellint_Kcomp(v[0], GSL_PREC_DOUBLE); });
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
// 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 <boost/math/special_functions/ellint_2.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "../../test/table_type.hpp"
|
||||
#include "table_helper.hpp"
|
||||
#include "performance.hpp"
|
||||
#include <iostream>
|
||||
|
||||
typedef double T;
|
||||
#define SC_(x) static_cast<double>(x)
|
||||
static const boost::array<boost::array<T, 3>, 10> data1 = { {
|
||||
{ { SC_(0.0), SC_(0.0), SC_(0.0) } },
|
||||
{ { SC_(-10.0), SC_(0.0), SC_(-10.0) } },
|
||||
{ { SC_(-1.0), SC_(-1.0), SC_(-0.84147098480789650665250232163029899962256306079837) } },
|
||||
{ { SC_(-4.0), T(900) / 1024, SC_(-3.1756145986492562317862928524528520686391383168377) } },
|
||||
{ { SC_(8.0), T(-600) / 1024, SC_(7.2473147180505693037677015377802777959345489333465) } },
|
||||
{ { SC_(1e-05), T(800) / 1024, SC_(9.999999999898274739584436515967055859383969942432E-6) } },
|
||||
{ { SC_(1e+05), T(100) / 1024, SC_(99761.153306972066658135668386691227343323331995888) } },
|
||||
{ { SC_(1e+10), SC_(-0.5), SC_(9.3421545766487137036576748555295222252286528414669e9) } },
|
||||
{ { static_cast<T>(ldexp(T(1), 66)), T(400) / 1024, SC_(7.0886102721911705466476846969992069994308167515242e19) } },
|
||||
{ { static_cast<T>(ldexp(T(1), 166)), T(900) / 1024, SC_(7.1259011068364515942912094521783688927118026465790e49) } },
|
||||
} };
|
||||
|
||||
int main()
|
||||
{
|
||||
#include "ellint_e2_data.ipp"
|
||||
|
||||
add_data(data1);
|
||||
add_data(ellint_e2_data);
|
||||
|
||||
unsigned data_total = data.size();
|
||||
|
||||
screen_data([](const std::vector<double>& v){ return boost::math::ellint_2(v[1], v[0]); }, [](const std::vector<double>& v){ return v[2]; });
|
||||
|
||||
|
||||
#if defined(TEST_LIBSTDCXX) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
screen_data([](const std::vector<double>& v){ return std::tr1::ellint_2(v[1], v[0]); }, [](const std::vector<double>& v){ return v[2]; });
|
||||
#endif
|
||||
#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
screen_data([](const std::vector<double>& v){ return gsl_sf_ellint_E(v[0], v[1], GSL_PREC_DOUBLE); }, [](const std::vector<double>& v){ return v[2]; });
|
||||
#endif
|
||||
|
||||
unsigned data_used = data.size();
|
||||
std::string function = "ellint_2[br](" + boost::lexical_cast<std::string>(data_used) + "/" + boost::lexical_cast<std::string>(data_total) + " tests selected)";
|
||||
std::string function_short = "ellint_2";
|
||||
|
||||
double time;
|
||||
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return boost::math::ellint_2(v[1], v[0]); });
|
||||
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<double>& v){ return boost::math::ellint_2(v[1], v[0], boost::math::policies::make_policy(boost::math::policies::promote_double<false>())); });
|
||||
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<false>");
|
||||
#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<false>");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(TEST_LIBSTDCXX) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return std::tr1::ellint_2(v[1], 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, "tr1/cmath");
|
||||
#endif
|
||||
#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return gsl_sf_ellint_E(v[0], v[1], GSL_PREC_DOUBLE); });
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
// 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 <boost/math/special_functions/ellint_2.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "../../test/table_type.hpp"
|
||||
#include "table_helper.hpp"
|
||||
#include "performance.hpp"
|
||||
#include <iostream>
|
||||
|
||||
typedef double T;
|
||||
#define SC_(x) static_cast<double>(x)
|
||||
static const boost::array<boost::array<T, 2>, 10> data2 = { {
|
||||
{ { SC_(-1.0), SC_(1.0) } },
|
||||
{ { SC_(0.0), SC_(1.5707963267948966192313216916397514420985846996876) } },
|
||||
{ { T(100) / 1024, SC_(1.5670445330545086723323795143598956428788609133377) } },
|
||||
{ { T(200) / 1024, SC_(1.5557071588766556854463404816624361127847775545087) } },
|
||||
{ { T(300) / 1024, SC_(1.5365278991162754883035625322482669608948678755743) } },
|
||||
{ { T(400) / 1024, SC_(1.5090417763083482272165682786143770446401437564021) } },
|
||||
{ { SC_(-0.5), SC_(1.4674622093394271554597952669909161360253617523272) } },
|
||||
{ { T(-600) / 1024, SC_(1.4257538571071297192428217218834579920545946473778) } },
|
||||
{ { T(-800) / 1024, SC_(1.2927868476159125056958680222998765985004489572909) } },
|
||||
{ { T(-900) / 1024, SC_(1.1966864890248739524112920627353824133420353430982) } },
|
||||
} };
|
||||
|
||||
int main()
|
||||
{
|
||||
#include "ellint_e_data.ipp"
|
||||
|
||||
add_data(data2);
|
||||
add_data(ellint_e_data);
|
||||
|
||||
unsigned data_total = data.size();
|
||||
|
||||
screen_data([](const std::vector<double>& v){ return boost::math::ellint_2(v[0]); }, [](const std::vector<double>& v){ return v[1]; });
|
||||
|
||||
|
||||
#if defined(TEST_LIBSTDCXX) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
screen_data([](const std::vector<double>& v){ return std::tr1::comp_ellint_2(v[0]); }, [](const std::vector<double>& v){ return v[1]; });
|
||||
#endif
|
||||
#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
screen_data([](const std::vector<double>& v){ return gsl_sf_ellint_Ecomp(v[0], GSL_PREC_DOUBLE); }, [](const std::vector<double>& v){ return v[1]; });
|
||||
#endif
|
||||
|
||||
unsigned data_used = data.size();
|
||||
std::string function = "ellint_2 (complete)[br](" + boost::lexical_cast<std::string>(data_used) + "/" + boost::lexical_cast<std::string>(data_total) + " tests selected)";
|
||||
std::string function_short = "ellint_2 (complete)";
|
||||
|
||||
double time;
|
||||
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return boost::math::ellint_2(v[0]); });
|
||||
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<double>& v){ return boost::math::ellint_2(v[0], boost::math::policies::make_policy(boost::math::policies::promote_double<false>())); });
|
||||
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<false>");
|
||||
#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<false>");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(TEST_LIBSTDCXX) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return std::tr1::comp_ellint_2(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, "tr1/cmath");
|
||||
#endif
|
||||
#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return gsl_sf_ellint_Ecomp(v[0], GSL_PREC_DOUBLE); });
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,162 @@
|
||||
// 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 <boost/math/special_functions/ellint_3.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "../../test/table_type.hpp"
|
||||
#include "table_helper.hpp"
|
||||
#include "performance.hpp"
|
||||
#include <iostream>
|
||||
|
||||
typedef double T;
|
||||
#define SC_(x) static_cast<double>(x)
|
||||
static const boost::array<boost::array<T, 4>, 65> data1 = { {
|
||||
{ { SC_(1.0), SC_(-1.0), SC_(0.0), SC_(-1.557407724654902230506974807458360173087) } },
|
||||
{ { SC_(0.0), SC_(-4.0), SC_(0.4), SC_(-4.153623371196831087495427530365430979011) } },
|
||||
{ { SC_(0.0), SC_(8.0), SC_(-0.6), SC_(8.935930619078575123490612395578518914416) } },
|
||||
{ { SC_(0.0), SC_(0.5), SC_(0.25), SC_(0.501246705365439492445236118603525029757890291780157969500480) } },
|
||||
{ { SC_(0.0), SC_(0.5), SC_(0.0), SC_(0.5) } },
|
||||
{ { SC_(-2.0), SC_(0.5), SC_(0.0), SC_(0.437501067017546278595664813509803743009132067629603474488486) } },
|
||||
{ { SC_(0.25), SC_(0.5), SC_(0.0), SC_(0.510269830229213412212501938035914557628394166585442994564135) } },
|
||||
{ { SC_(0.75), SC_(0.5), SC_(0.0), SC_(0.533293253875952645421201146925578536430596894471541312806165) } },
|
||||
{ { SC_(0.75), SC_(0.75), SC_(0.0), SC_(0.871827580412760575085768367421866079353646112288567703061975) } },
|
||||
{ { SC_(1.0), SC_(0.25), SC_(0.0), SC_(0.255341921221036266504482236490473678204201638800822621740476) } },
|
||||
{ { SC_(2.0), SC_(0.25), SC_(0.0), SC_(0.261119051639220165094943572468224137699644963125853641716219) } },
|
||||
{ { T(1023) / 1024, SC_(1.5), SC_(0.0), SC_(13.2821612239764190363647953338544569682942329604483733197131) } },
|
||||
{ { SC_(0.5), SC_(-1.0), SC_(0.5), SC_(-1.228014414316220642611298946293865487807) } },
|
||||
{ { SC_(0.5), SC_(1e+10), SC_(0.5), SC_(1.536591003599172091573590441336982730551e+10) } },
|
||||
{ { SC_(-1e+05), SC_(10.0), SC_(0.75), SC_(0.0347926099493147087821620459290460547131012904008557007934290) } },
|
||||
{ { SC_(-1e+10), SC_(10.0), SC_(0.875), SC_(0.000109956202759561502329123384755016959364346382187364656768212) } },
|
||||
{ { SC_(-1e+10), SC_(1e+20), SC_(0.875), SC_(1.00000626665567332602765201107198822183913978895904937646809e15) } },
|
||||
{ { SC_(-1e+10), T(1608) / 1024, SC_(0.875), SC_(0.0000157080616044072676127333183571107873332593142625043567690379) } },
|
||||
{ { 1 - T(1) / 1024, SC_(1e+20), SC_(0.875), SC_(6.43274293944380717581167058274600202023334985100499739678963e21) } },
|
||||
{ { SC_(50.0), SC_(0.125), SC_(0.25), SC_(0.196321043776719739372196642514913879497104766409504746018939) } },
|
||||
{ { SC_(1.125), SC_(1.0), SC_(0.25), SC_(1.77299767784815770192352979665283069318388205110727241629752) } },
|
||||
{ { SC_(1.125), SC_(10.0), SC_(0.25), SC_(0.662467818678976949597336360256848770217429434745967677192487) } },
|
||||
{ { SC_(1.125), SC_(3.0), SC_(0.25), SC_(-0.142697285116693775525461312178015106079842313950476205580178) } },
|
||||
{ { T(257) / 256, SC_(1.5), SC_(0.125), SC_(22.2699300473528164111357290313578126108398839810535700884237) } },
|
||||
{ { T(257) / 256, SC_(21.5), SC_(0.125), SC_(-0.535406081652313940727588125663856894154526187713506526799429) } },
|
||||
// Bug cases from Rocco Romeo:
|
||||
{ { SC_(-1E-170), boost::math::constants::pi<T>() / 4, SC_(1E-164), SC_(0.785398163397448309615660845819875721049292349843776455243736) } },
|
||||
{ { SC_(-1E-170), boost::math::constants::pi<T>() / 4, SC_(-1E-164), SC_(0.785398163397448309615660845819875721049292349843776455243736) } },
|
||||
{ { -ldexp(T(1.0), -52), boost::math::constants::pi<T>() / 4, SC_(0.9375), SC_(0.866032844934895872810905364370384153285798081574191920571016) } },
|
||||
{ { -ldexp(T(1.0), -52), boost::math::constants::pi<T>() / 4, SC_(-0.9375), SC_(0.866032844934895872810905364370384153285798081574191920571016) } },
|
||||
{ { std::numeric_limits<T>::max_exponent > 600 ? -ldexp(T(1), 604) : T(0), -ldexp(T(1), -816), ldexp(T(1), -510), std::numeric_limits<T>::max_exponent > 600 ? SC_(-2.28835573409367516299079046268930870596307631872422530813192e-246) : SC_(-2.28835573409367516299079046268930870596307631872422530813192e-246) } },
|
||||
{ { std::numeric_limits<T>::max_exponent > 600 ? -ldexp(T(1), 604) : T(0), -ldexp(T(1), -816), -ldexp(T(1), -510), std::numeric_limits<T>::max_exponent > 600 ? SC_(-2.28835573409367516299079046268930870596307631872422530813192e-246) : SC_(-2.28835573409367516299079046268930870596307631872422530813192e-246) } },
|
||||
{ { -ldexp(T(1), -622), -ldexp(T(1), -800), ldexp(T(1), -132), SC_(-1.49969681389563095481764443762806535353996169623910829793733e-241) } },
|
||||
{ { -ldexp(T(1), -622), -ldexp(T(1), -800), -ldexp(T(1), -132), SC_(-1.49969681389563095481764443762806535353996169623910829793733e-241) } },
|
||||
{ { -ldexp(T(1), -562), ldexp(T(1), -140), ldexp(T(1), -256), SC_(7.174648137343063403129495466444370592154941142407760751e-43) } },
|
||||
{ { -ldexp(T(1), -562), -ldexp(T(1), -140), ldexp(T(1), -256), SC_(-7.17464813734306340312949546644437059215494114240776075e-43) } },
|
||||
{ { ldexp(T(1), -688), -ldexp(T(1), -243), ldexp(T(1), -193), SC_(-7.07474928033336903711649944600608732865822749854620171e-74) } },
|
||||
{ { -ldexp(T(1), -688), -ldexp(T(1), -243), ldexp(T(1), -193), SC_(-7.07474928033336903711649944600608732865822749854620171e-74) } },
|
||||
// Special cases where k = 0:
|
||||
{ { SC_(0.5), SC_(1.0), SC_(0.0), SC_(1.17881507892743738986863357869566288974084658835353613038547) } },
|
||||
{ { SC_(-0.5), SC_(1.0), SC_(0.0), SC_(0.888286691263535380266337576823783210424994266596287990733270) } },
|
||||
{ { SC_(0.5), SC_(-1.0), SC_(0.0), SC_(-1.17881507892743738986863357869566288974084658835353613038547) } },
|
||||
{ { SC_(-0.5), SC_(-1.0), SC_(0.0), SC_(-0.888286691263535380266337576823783210424994266596287990733270) } },
|
||||
// k == 0 and phi > pi/2:
|
||||
{ { SC_(0.5), SC_(2.0), SC_(0.0), SC_(3.03379730757207227653600089552126882582809860566558143254794) } },
|
||||
{ { SC_(-0.5), SC_(2.0), SC_(0.0), SC_(1.57453655812023739911111328195028658229986230310938753315640) } },
|
||||
{ { SC_(0.5), SC_(-2.0), SC_(0.0), SC_(-3.03379730757207227653600089552126882582809860566558143254794) } },
|
||||
{ { SC_(-0.5), SC_(-2.0), SC_(0.0), SC_(-1.57453655812023739911111328195028658229986230310938753315640) } },
|
||||
// Special cases where k = 1:
|
||||
{ { SC_(0.5), SC_(1.0), SC_(1.0), SC_(1.4830998734200773326887632776553375078936815318419194718912351) } },
|
||||
{ { SC_(-0.5), SC_(1.0), SC_(1.0), SC_(1.07048347329000030842347009377117215811122412769516781788253) } },
|
||||
{ { SC_(0.5), SC_(-1.0), SC_(1.0), SC_(-1.4830998734200773326887632776553375078936815318419194718912) } },
|
||||
{ { SC_(-0.5), SC_(-1.0), SC_(1.0), SC_(-1.07048347329000030842347009377117215811122412769516781788253) } },
|
||||
// special cases where v = 1:
|
||||
{ { SC_(1.0), SC_(0.5), SC_(0.5), SC_(0.55225234291197632914658859230278152249148960801635386133501) } },
|
||||
{ { SC_(1.0), SC_(-0.5), SC_(0.5), SC_(-0.55225234291197632914658859230278152249148960801635386133501) } },
|
||||
{ { SC_(1.0), SC_(2.0), SC_(0.5), SC_(-2.87534521505997989921579168327307068134740792740155171368532) } },
|
||||
{ { SC_(1.0), SC_(-2.0), SC_(0.5), SC_(2.87534521505997989921579168327307068134740792740155171368532) } },
|
||||
{ { SC_(1.0), SC_(2.0), ldexp(T(1), -200), SC_(-2.18503986326151899164330610231368254343201774622766316456295) } },
|
||||
{ { SC_(1.0), SC_(-2.0), ldexp(T(1), -200), SC_(2.18503986326151899164330610231368254343201774622766316456295) } },
|
||||
{ { SC_(1.0), ldexp(T(1.0), -150), ldexp(T(1), -200), SC_(7.006492321624085354618647916449580656401309709382578858e-46) } },
|
||||
{ { SC_(1.0), -ldexp(T(1.0), -150), ldexp(T(1), -200), SC_(-7.006492321624085354618647916449580656401309709382578858e-46) } },
|
||||
// Previously unsupported region with v > 1 and |phi| > PI/2, this is the only region
|
||||
// with high-ish error rates caused by argument reduction by Pi:
|
||||
{ { SC_(20.0), ldexp(T(1647611), -19), SC_(0.5), SC_(0.000975940902692994840122139131147517258405256880370413541280) } },
|
||||
{ { SC_(20.0), -ldexp(T(1647611), -19), SC_(0.5), SC_(-0.000975940902692994840122139131147517258405256880370413541280) } },
|
||||
{ { T(1.0) + ldexp(T(1), -6), ldexp(T(889085), -19), SC_(0.5), SC_(-27.1647225624906589308619292363045712770651414487085887109197) } },
|
||||
{ { T(1.0) + ldexp(T(1), -6), -ldexp(T(889085), -19), SC_(0.5), SC_(27.1647225624906589308619292363045712770651414487085887109197) } },
|
||||
// Phi = 0:
|
||||
{ { SC_(1.0), SC_(0.0), SC_(0.5), SC_(0.0) } },
|
||||
{ { SC_(-1.0), SC_(0.0), SC_(0.5), SC_(0.0) } },
|
||||
{ { SC_(100.0), SC_(0.0), SC_(0.5), SC_(0.0) } },
|
||||
{ { SC_(-100.0), SC_(0.0), SC_(0.5), SC_(0.0) } },
|
||||
} };
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
#include "ellint_pi3_data.ipp"
|
||||
#include "ellint_pi3_large_data.ipp"
|
||||
|
||||
add_data(data1);
|
||||
add_data(ellint_pi3_data);
|
||||
add_data(ellint_pi3_large_data);
|
||||
|
||||
unsigned data_total = data.size();
|
||||
|
||||
std::cout << "Screening boost data:\n";
|
||||
screen_data([](const std::vector<double>& v){ return boost::math::ellint_3(v[2], v[0], v[1]); }, [](const std::vector<double>& v){ return v[3]; });
|
||||
|
||||
|
||||
#if defined(TEST_LIBSTDCXX) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
std::cout << "Screening libstdc++ data:\n";
|
||||
screen_data([](const std::vector<double>& v){ return std::tr1 ::ellint_3(v[2], -v[0], v[1]); }, [](const std::vector<double>& v){ return v[3]; });
|
||||
#endif
|
||||
#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
std::cout << "Screening libstdc++ data:\n";
|
||||
screen_data([](const std::vector<double>& v){ return gsl_sf_ellint_P(v[1], v[2], -v[0], GSL_PREC_DOUBLE); }, [](const std::vector<double>& v){ return v[3]; });
|
||||
#endif
|
||||
|
||||
unsigned data_used = data.size();
|
||||
std::string function = "ellint_3[br](" + boost::lexical_cast<std::string>(data_used) + "/" + boost::lexical_cast<std::string>(data_total) + " tests selected)";
|
||||
std::string function_short = "ellint_3";
|
||||
|
||||
double time;
|
||||
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return boost::math::ellint_3(v[2], 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<double>& v){ return boost::math::ellint_3(v[2], v[0], v[1], boost::math::policies::make_policy(boost::math::policies::promote_double<false>())); });
|
||||
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<false>");
|
||||
#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<false>");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(TEST_LIBSTDCXX) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return std::tr1::ellint_3(v[2], -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<double>& v){ return gsl_sf_ellint_P(v[1], v[2], -v[0], GSL_PREC_DOUBLE); });
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -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 <boost/math/special_functions/ellint_3.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "../../test/table_type.hpp"
|
||||
#include "table_helper.hpp"
|
||||
#include "performance.hpp"
|
||||
#include <iostream>
|
||||
|
||||
typedef double T;
|
||||
#define SC_(x) static_cast<double>(x)
|
||||
|
||||
int main()
|
||||
{
|
||||
#include "ellint_pi2_data.ipp"
|
||||
|
||||
add_data(ellint_pi2_data);
|
||||
|
||||
unsigned data_total = data.size();
|
||||
|
||||
screen_data([](const std::vector<double>& v){ return boost::math::ellint_3(v[1], v[0]); }, [](const std::vector<double>& v){ return v[2]; });
|
||||
|
||||
|
||||
#if defined(TEST_LIBSTDCXX) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
screen_data([](const std::vector<double>& v){ return std::tr1::comp_ellint_3(v[1], -v[0]); }, [](const std::vector<double>& v){ return v[2]; });
|
||||
#endif
|
||||
#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
screen_data([](const std::vector<double>& v){ return gsl_sf_ellint_Pcomp(v[1], -v[0], GSL_PREC_DOUBLE); }, [](const std::vector<double>& v){ return v[2]; });
|
||||
#endif
|
||||
|
||||
unsigned data_used = data.size();
|
||||
std::string function = "ellint_3 (complete)[br](" + boost::lexical_cast<std::string>(data_used) + "/" + boost::lexical_cast<std::string>(data_total) + " tests selected)";
|
||||
std::string function_short = "ellint_3 (complete)";
|
||||
|
||||
double time;
|
||||
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return boost::math::ellint_3(v[1], v[0]); });
|
||||
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<double>& v){ return boost::math::ellint_3(v[1], v[0], boost::math::policies::make_policy(boost::math::policies::promote_double<false>())); });
|
||||
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<false>");
|
||||
#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<false>");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(TEST_LIBSTDCXX) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return std::tr1::comp_ellint_3(v[1], -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, "tr1/cmath");
|
||||
#endif
|
||||
#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return gsl_sf_ellint_Pcomp(v[1], -v[0], GSL_PREC_DOUBLE); });
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
// 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 <boost/math/special_functions/ellint_rc.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "../../test/table_type.hpp"
|
||||
#include "table_helper.hpp"
|
||||
#include "performance.hpp"
|
||||
#include <iostream>
|
||||
|
||||
typedef double T;
|
||||
#define SC_(x) static_cast<double>(x)
|
||||
|
||||
int main()
|
||||
{
|
||||
#include "ellint_rc_data.ipp"
|
||||
|
||||
add_data(ellint_rc_data);
|
||||
|
||||
unsigned data_total = data.size();
|
||||
|
||||
screen_data([](const std::vector<double>& v){ return boost::math::ellint_rc(v[0], v[1]); }, [](const std::vector<double>& v){ return v[2]; });
|
||||
|
||||
|
||||
#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
screen_data([](const std::vector<double>& v){ return gsl_sf_ellint_RC(v[0], v[1], GSL_PREC_DOUBLE); }, [](const std::vector<double>& v){ return v[2]; });
|
||||
#endif
|
||||
|
||||
unsigned data_used = data.size();
|
||||
std::string function = "ellint_rc[br](" + boost::lexical_cast<std::string>(data_used) + "/" + boost::lexical_cast<std::string>(data_total) + " tests selected)";
|
||||
std::string function_short = "ellint_rc";
|
||||
|
||||
double time;
|
||||
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return boost::math::ellint_rc(v[0], v[1]); });
|
||||
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<double>& v){ return boost::math::ellint_rc(v[0], v[1], boost::math::policies::make_policy(boost::math::policies::promote_double<false>())); });
|
||||
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<false>");
|
||||
#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<false>");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return gsl_sf_ellint_RC(v[0], v[1], GSL_PREC_DOUBLE); });
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
// 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 <boost/math/special_functions/ellint_rd.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "../../test/table_type.hpp"
|
||||
#include "table_helper.hpp"
|
||||
#include "performance.hpp"
|
||||
#include <iostream>
|
||||
|
||||
typedef double T;
|
||||
#define SC_(x) static_cast<double>(x)
|
||||
|
||||
int main()
|
||||
{
|
||||
#include "ellint_rd_data.ipp"
|
||||
#include "ellint_rd_xyy.ipp"
|
||||
#include "ellint_rd_xxz.ipp"
|
||||
#include "ellint_rd_0yy.ipp"
|
||||
#include "ellint_rd_xxx.ipp"
|
||||
#include "ellint_rd_0xy.ipp"
|
||||
|
||||
add_data(ellint_rd_data);
|
||||
add_data(ellint_rd_xyy);
|
||||
add_data(ellint_rd_xxz);
|
||||
add_data(ellint_rd_0yy);
|
||||
add_data(ellint_rd_xxx);
|
||||
add_data(ellint_rd_0xy);
|
||||
|
||||
unsigned data_total = data.size();
|
||||
|
||||
screen_data([](const std::vector<double>& v){ return boost::math::ellint_rd(v[0], v[1], v[2]); }, [](const std::vector<double>& v){ return v[3]; });
|
||||
|
||||
|
||||
#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
screen_data([](const std::vector<double>& v){ return gsl_sf_ellint_RD(v[0], v[1], v[2], GSL_PREC_DOUBLE); }, [](const std::vector<double>& v){ return v[3]; });
|
||||
#endif
|
||||
|
||||
unsigned data_used = data.size();
|
||||
std::string function = "ellint_rd[br](" + boost::lexical_cast<std::string>(data_used) + "/" + boost::lexical_cast<std::string>(data_total) + " tests selected)";
|
||||
std::string function_short = "ellint_rd";
|
||||
|
||||
double time;
|
||||
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return boost::math::ellint_rd(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<double>& v){ return boost::math::ellint_rd(v[0], v[1], v[2], boost::math::policies::make_policy(boost::math::policies::promote_double<false>())); });
|
||||
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<false>");
|
||||
#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<false>");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return gsl_sf_ellint_RD(v[0], v[1], v[2], GSL_PREC_DOUBLE); });
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -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 <boost/math/special_functions/ellint_rf.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "../../test/table_type.hpp"
|
||||
#include "table_helper.hpp"
|
||||
#include "performance.hpp"
|
||||
#include <iostream>
|
||||
|
||||
typedef double T;
|
||||
#define SC_(x) static_cast<double>(x)
|
||||
|
||||
int main()
|
||||
{
|
||||
#include "ellint_rf_data.ipp"
|
||||
#include "ellint_rf_xxx.ipp"
|
||||
#include "ellint_rf_xyy.ipp"
|
||||
#include "ellint_rf_0yy.ipp"
|
||||
#include "ellint_rf_xy0.ipp"
|
||||
|
||||
add_data(ellint_rf_data);
|
||||
add_data(ellint_rf_xxx);
|
||||
add_data(ellint_rf_xyy);
|
||||
add_data(ellint_rf_0yy);
|
||||
add_data(ellint_rf_xy0);
|
||||
|
||||
unsigned data_total = data.size();
|
||||
|
||||
screen_data([](const std::vector<double>& v){ return boost::math::ellint_rf(v[0], v[1], v[2]); }, [](const std::vector<double>& v){ return v[3]; });
|
||||
|
||||
|
||||
#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
screen_data([](const std::vector<double>& v){ return gsl_sf_ellint_RF(v[0], v[1], v[2], GSL_PREC_DOUBLE); }, [](const std::vector<double>& v){ return v[3]; });
|
||||
#endif
|
||||
|
||||
unsigned data_used = data.size();
|
||||
std::string function = "ellint_rf[br](" + boost::lexical_cast<std::string>(data_used) + "/" + boost::lexical_cast<std::string>(data_total) + " tests selected)";
|
||||
std::string function_short = "ellint_rf";
|
||||
|
||||
double time;
|
||||
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return boost::math::ellint_rf(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<double>& v){ return boost::math::ellint_rf(v[0], v[1], v[2], boost::math::policies::make_policy(boost::math::policies::promote_double<false>())); });
|
||||
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<false>");
|
||||
#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<false>");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return gsl_sf_ellint_RF(v[0], v[1], v[2], GSL_PREC_DOUBLE); });
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -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 <boost/math/special_functions/ellint_rj.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "../../test/table_type.hpp"
|
||||
#include "table_helper.hpp"
|
||||
#include "performance.hpp"
|
||||
#include <iostream>
|
||||
|
||||
typedef double T;
|
||||
#define SC_(x) static_cast<double>(x)
|
||||
|
||||
int main()
|
||||
{
|
||||
#include "ellint_rj_data.ipp"
|
||||
#include "ellint_rj_e4.ipp"
|
||||
#include "ellint_rj_e3.ipp"
|
||||
#include "ellint_rj_e2.ipp"
|
||||
#include "ellint_rj_zp.ipp"
|
||||
|
||||
add_data(ellint_rj_data);
|
||||
add_data(ellint_rj_e4);
|
||||
add_data(ellint_rj_e3);
|
||||
add_data(ellint_rj_e2);
|
||||
add_data(ellint_rj_zp);
|
||||
|
||||
unsigned data_total = data.size();
|
||||
|
||||
screen_data([](const std::vector<double>& v){ return boost::math::ellint_rj(v[0], v[1], v[2], v[3]); }, [](const std::vector<double>& v){ return v[4]; });
|
||||
|
||||
|
||||
#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
screen_data([](const std::vector<double>& v){ return gsl_sf_ellint_RJ(v[0], v[1], v[2], v[3], GSL_PREC_DOUBLE); }, [](const std::vector<double>& v){ return v[4]; });
|
||||
#endif
|
||||
|
||||
unsigned data_used = data.size();
|
||||
std::string function = "ellint_rj[br](" + boost::lexical_cast<std::string>(data_used) + "/" + boost::lexical_cast<std::string>(data_total) + " tests selected)";
|
||||
std::string function_short = "ellint_rj";
|
||||
|
||||
double time;
|
||||
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return boost::math::ellint_rj(v[0], v[1], v[2], v[3]); });
|
||||
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<double>& v){ return boost::math::ellint_rj(v[0], v[1], v[2], v[3], boost::math::policies::make_policy(boost::math::policies::promote_double<false>())); });
|
||||
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<false>");
|
||||
#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<false>");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return gsl_sf_ellint_RJ(v[0], v[1], v[2], v[3], GSL_PREC_DOUBLE); });
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
// 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 <boost/math/special_functions/erf.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "../../test/table_type.hpp"
|
||||
#include "table_helper.hpp"
|
||||
#include "performance.hpp"
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
{
|
||||
typedef double T;
|
||||
#define SC_(x) static_cast<double>(x)
|
||||
# include "erf_small_data.ipp"
|
||||
# include "erf_data.ipp"
|
||||
# include "erf_large_data.ipp"
|
||||
|
||||
add_data(erf_small_data);
|
||||
add_data(erf_data);
|
||||
add_data(erf_large_data);
|
||||
|
||||
unsigned data_total = data.size();
|
||||
|
||||
screen_data([](const std::vector<double>& v){ return boost::math::erf(v[0]); }, [](const std::vector<double>& v){ return v[1]; });
|
||||
|
||||
|
||||
#if defined(TEST_C99) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
screen_data([](const std::vector<double>& v){ return ::erf(v[0]); }, [](const std::vector<double>& v){ return v[1]; });
|
||||
#endif
|
||||
#if defined(TEST_LIBSTDCXX) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
screen_data([](const std::vector<double>& v){ return std::tr1::erf(v[0]); }, [](const std::vector<double>& v){ return v[1]; });
|
||||
#endif
|
||||
#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
screen_data([](const std::vector<double>& v){ return gsl_sf_erf(v[0]); }, [](const std::vector<double>& v){ return v[1]; });
|
||||
#endif
|
||||
unsigned data_used = data.size();
|
||||
std::string function = "erf[br](" + boost::lexical_cast<std::string>(data_used) + "/" + boost::lexical_cast<std::string>(data_total) + " tests selected)";
|
||||
std::string function_short = "erf";
|
||||
|
||||
double time = exec_timed_test([](const std::vector<double>& v){ return boost::math::erf(v[0]); });
|
||||
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());
|
||||
#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<double>& v){ return boost::math::erf(v[0], boost::math::policies::make_policy(boost::math::policies::promote_double<false>())); });
|
||||
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());
|
||||
#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<false>");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(TEST_C99) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return ::erf(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, "math.h");
|
||||
#endif
|
||||
#if defined(TEST_LIBSTDCXX) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return std::tr1::erf(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, "tr1/cmath");
|
||||
#endif
|
||||
#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return gsl_sf_erf(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
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
// 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 <boost/math/special_functions/erf.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "../../test/table_type.hpp"
|
||||
#include "table_helper.hpp"
|
||||
#include "performance.hpp"
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
{
|
||||
typedef double T;
|
||||
#define SC_(x) static_cast<double>(x)
|
||||
# include "erf_small_data.ipp"
|
||||
# include "erf_data.ipp"
|
||||
# include "erf_large_data.ipp"
|
||||
|
||||
add_data(erf_small_data);
|
||||
add_data(erf_data);
|
||||
add_data(erf_large_data);
|
||||
|
||||
unsigned data_total = data.size();
|
||||
|
||||
screen_data([](const std::vector<double>& v){ return boost::math::erfc(v[0]); }, [](const std::vector<double>& v){ return v[2]; });
|
||||
|
||||
|
||||
#if defined(TEST_C99) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
screen_data([](const std::vector<double>& v){ return ::erfc(v[0]); }, [](const std::vector<double>& v){ return v[2]; });
|
||||
#endif
|
||||
#if defined(TEST_LIBSTDCXX) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
screen_data([](const std::vector<double>& v){ return std::tr1::erfc(v[0]); }, [](const std::vector<double>& v){ return v[2]; });
|
||||
#endif
|
||||
#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
screen_data([](const std::vector<double>& v){ return gsl_sf_erfc(v[0]); }, [](const std::vector<double>& v){ return v[2]; });
|
||||
#endif
|
||||
|
||||
unsigned data_used = data.size();
|
||||
std::string function = "erfc[br](" + boost::lexical_cast<std::string>(data_used) + "/" + boost::lexical_cast<std::string>(data_total) + " tests selected)";
|
||||
std::string function_short = "erfc";
|
||||
|
||||
double time = exec_timed_test([](const std::vector<double>& v){ return boost::math::erfc(v[0]); });
|
||||
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());
|
||||
#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<double>& v){ return boost::math::erfc(v[0], boost::math::policies::make_policy(boost::math::policies::promote_double<false>())); });
|
||||
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<false>");
|
||||
#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<false>");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(TEST_C99) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return ::erfc(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, "math.h");
|
||||
#endif
|
||||
|
||||
#if defined(TEST_LIBSTDCXX) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return std::tr1::erfc(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, "tr1/cmath");
|
||||
#endif
|
||||
#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return gsl_sf_erfc(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
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
// 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 <boost/math/special_functions/expint.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "../../test/table_type.hpp"
|
||||
#include "table_helper.hpp"
|
||||
#include "performance.hpp"
|
||||
#include <iostream>
|
||||
|
||||
typedef double T;
|
||||
#define SC_(x) static_cast<double>(x)
|
||||
|
||||
int main()
|
||||
{
|
||||
#include "expinti_data.ipp"
|
||||
#include "expinti_data_double.ipp"
|
||||
|
||||
add_data(expinti_data);
|
||||
add_data(expinti_data_double);
|
||||
|
||||
unsigned data_total = data.size();
|
||||
|
||||
screen_data([](const std::vector<double>& v){ return boost::math::expint(v[0]); }, [](const std::vector<double>& v){ return v[1]; });
|
||||
|
||||
|
||||
#if defined(TEST_LIBSTDCXX) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
screen_data([](const std::vector<double>& v){ return std::tr1::expint(v[0]); }, [](const std::vector<double>& v){ return v[1]; });
|
||||
#endif
|
||||
#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
screen_data([](const std::vector<double>& v){ return gsl_sf_expint_Ei(v[0]); }, [](const std::vector<double>& v){ return v[1]; });
|
||||
#endif
|
||||
|
||||
unsigned data_used = data.size();
|
||||
std::string function = "expint[br](" + boost::lexical_cast<std::string>(data_used) + "/" + boost::lexical_cast<std::string>(data_total) + " tests selected)";
|
||||
std::string function_short = "expint";
|
||||
|
||||
double time;
|
||||
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return boost::math::expint(v[0]); });
|
||||
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<double>& v){ return boost::math::expint(v[0], boost::math::policies::make_policy(boost::math::policies::promote_double<false>())); });
|
||||
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<false>");
|
||||
#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<false>");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(TEST_LIBSTDCXX) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return std::tr1::expint(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, "tr1/cmath");
|
||||
#endif
|
||||
#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return gsl_sf_expint_Ei(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
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
// 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 <boost/math/special_functions/expint.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "../../test/table_type.hpp"
|
||||
#include "table_helper.hpp"
|
||||
#include "performance.hpp"
|
||||
#include <iostream>
|
||||
|
||||
typedef double T;
|
||||
#define SC_(x) static_cast<double>(x)
|
||||
|
||||
int main()
|
||||
{
|
||||
#include "expint_data.ipp"
|
||||
#include "expint_small_data.ipp"
|
||||
#include "expint_1_data.ipp"
|
||||
|
||||
add_data(expint_data);
|
||||
add_data(expint_small_data);
|
||||
add_data(expint_1_data);
|
||||
|
||||
unsigned data_total = data.size();
|
||||
|
||||
screen_data([](const std::vector<double>& v){ return boost::math::expint(static_cast<int>(v[0]), v[1]); }, [](const std::vector<double>& v){ return v[2]; });
|
||||
|
||||
|
||||
#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
screen_data([](const std::vector<double>& v){ return gsl_sf_expint_En(static_cast<int>(v[0]), v[1]); }, [](const std::vector<double>& v){ return v[2]; });
|
||||
#endif
|
||||
|
||||
unsigned data_used = data.size();
|
||||
std::string function = "expint (En)[br](" + boost::lexical_cast<std::string>(data_used) + "/" + boost::lexical_cast<std::string>(data_total) + " tests selected)";
|
||||
std::string function_short = "expint (En)";
|
||||
|
||||
double time;
|
||||
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return boost::math::expint(static_cast<int>(v[0]), v[1]); });
|
||||
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<double>& v){ return boost::math::expint(static_cast<int>(v[0]), v[1], boost::math::policies::make_policy(boost::math::policies::promote_double<false>())); });
|
||||
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<false>");
|
||||
#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<false>");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return gsl_sf_expint_En(static_cast<int>(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
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
// 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 <boost/math/special_functions/expm1.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "../../test/table_type.hpp"
|
||||
#include "table_helper.hpp"
|
||||
#include "performance.hpp"
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
{
|
||||
typedef double T;
|
||||
#define SC_(x) static_cast<double>(x)
|
||||
# include "../../test/log1p_expm1_data.ipp"
|
||||
|
||||
add_data(log1p_expm1_data);
|
||||
|
||||
unsigned data_total = data.size();
|
||||
|
||||
screen_data([](const std::vector<double>& v){ return boost::math::expm1(v[0]); }, [](const std::vector<double>& v){ return v[2]; });
|
||||
|
||||
|
||||
#if defined(TEST_C99) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
screen_data([](const std::vector<double>& v){ return ::expm1(v[0]); }, [](const std::vector<double>& v){ return v[2]; });
|
||||
#endif
|
||||
#if defined(TEST_LIBSTDCXX) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
screen_data([](const std::vector<double>& v){ return std::tr1::expm1(v[0]); }, [](const std::vector<double>& v){ return v[2]; });
|
||||
#endif
|
||||
|
||||
unsigned data_used = data.size();
|
||||
std::string function = "expm1[br](" + boost::lexical_cast<std::string>(data_used) + "/" + boost::lexical_cast<std::string>(data_total) + " tests selected)";
|
||||
std::string function_short = "expm1";
|
||||
|
||||
double time = exec_timed_test([](const std::vector<double>& v){ return boost::math::expm1(v[0]); });
|
||||
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());
|
||||
#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<double>& v){ return boost::math::expm1(v[0], boost::math::policies::make_policy(boost::math::policies::promote_double<false>())); });
|
||||
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<false>");
|
||||
#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<false>");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(TEST_C99) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return ::expm1(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, "math.h");
|
||||
#endif
|
||||
#if defined(TEST_LIBSTDCXX) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return std::tr1::expm1(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, "tr1/cmath");
|
||||
#endif
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
// 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 <boost/math/special_functions/gamma.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "../../test/table_type.hpp"
|
||||
#include "table_helper.hpp"
|
||||
#include "performance.hpp"
|
||||
#include <iostream>
|
||||
|
||||
typedef double T;
|
||||
#define SC_(x) static_cast<double>(x)
|
||||
|
||||
int main()
|
||||
{
|
||||
# include "igamma_med_data.ipp"
|
||||
# include "igamma_small_data.ipp"
|
||||
# include "igamma_big_data.ipp"
|
||||
# include "igamma_int_data.ipp"
|
||||
|
||||
add_data(igamma_med_data);
|
||||
add_data(igamma_small_data);
|
||||
add_data(igamma_big_data);
|
||||
add_data(igamma_int_data);
|
||||
|
||||
unsigned data_total = data.size();
|
||||
|
||||
screen_data([](const std::vector<double>& v){ return boost::math::gamma_p(v[0], v[1]); }, [](const std::vector<double>& v){ return v[5]; });
|
||||
|
||||
|
||||
#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
screen_data([](const std::vector<double>& v){ return gsl_sf_gamma_inc_P(v[0], v[1]); }, [](const std::vector<double>& v){ return v[5]; });
|
||||
#endif
|
||||
#if defined(TEST_RMATH) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
screen_data([](const std::vector<double>& v){ return pgamma(v[1], v[0], 1.0, 1, 0); }, [](const std::vector<double>& v){ return v[5]; });
|
||||
#endif
|
||||
|
||||
unsigned data_used = data.size();
|
||||
std::string function = "gamma_p[br](" + boost::lexical_cast<std::string>(data_used) + "/" + boost::lexical_cast<std::string>(data_total) + " tests selected)";
|
||||
std::string function_short = "gamma_p";
|
||||
|
||||
double time;
|
||||
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return boost::math::gamma_p(v[0], v[1]); });
|
||||
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<double>& v){ return boost::math::gamma_p(v[0], v[1], boost::math::policies::make_policy(boost::math::policies::promote_double<false>())); });
|
||||
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<false>");
|
||||
#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<false>");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return gsl_sf_gamma_inc_P(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<double>& v){ return pgamma(v[1], v[0], 1.0, 1, 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;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
// 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 <boost/math/special_functions/gamma.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "../../test/table_type.hpp"
|
||||
#include "table_helper.hpp"
|
||||
#include "performance.hpp"
|
||||
#include <iostream>
|
||||
|
||||
typedef double T;
|
||||
#define SC_(x) static_cast<double>(x)
|
||||
|
||||
int main()
|
||||
{
|
||||
# include "gamma_inv_data.ipp"
|
||||
# include "gamma_inv_big_data.ipp"
|
||||
# include "gamma_inv_small_data.ipp"
|
||||
|
||||
add_data(gamma_inv_data);
|
||||
add_data(gamma_inv_big_data);
|
||||
add_data(gamma_inv_small_data);
|
||||
|
||||
unsigned data_total = data.size();
|
||||
|
||||
std::cout << "screening Boost data:\n";
|
||||
screen_data([](const std::vector<double>& v){ return boost::math::gamma_p_inv(v[0], v[1]); }, [](const std::vector<double>& v){ return v[2]; });
|
||||
|
||||
|
||||
#if defined(TEST_RMATH) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
std::cout << "screening Rmath data:\n";
|
||||
screen_data([](const std::vector<double>& v){ return qgamma(v[1], v[0], 1.0, 1, 0); }, [](const std::vector<double>& v){ return v[2]; });
|
||||
#endif
|
||||
|
||||
unsigned data_used = data.size();
|
||||
std::string function = "gamma_p_inv[br](" + boost::lexical_cast<std::string>(data_used) + "/" + boost::lexical_cast<std::string>(data_total) + " tests selected)";
|
||||
std::string function_short = "gamma_p_inv";
|
||||
|
||||
double time;
|
||||
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return boost::math::gamma_p_inv(v[0], v[1]); });
|
||||
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<double>& v){ return boost::math::gamma_p_inv(v[0], v[1], boost::math::policies::make_policy(boost::math::policies::promote_double<false>())); });
|
||||
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<false>");
|
||||
#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<false>");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(TEST_RMATH) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return qgamma(v[1], v[0], 1.0, 1, 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;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
// 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 <boost/math/special_functions/gamma.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "../../test/table_type.hpp"
|
||||
#include "table_helper.hpp"
|
||||
#include "performance.hpp"
|
||||
#include <iostream>
|
||||
|
||||
typedef double T;
|
||||
#define SC_(x) static_cast<double>(x)
|
||||
|
||||
int main()
|
||||
{
|
||||
# include "igamma_med_data.ipp"
|
||||
# include "igamma_small_data.ipp"
|
||||
# include "igamma_big_data.ipp"
|
||||
# include "igamma_int_data.ipp"
|
||||
|
||||
add_data(igamma_med_data);
|
||||
add_data(igamma_small_data);
|
||||
add_data(igamma_big_data);
|
||||
add_data(igamma_int_data);
|
||||
|
||||
unsigned data_total = data.size();
|
||||
|
||||
|
||||
std::cout << "Screening Boost data:\n";
|
||||
screen_data([](const std::vector<double>& v){ return boost::math::gamma_q(v[0], v[1]); }, [](const std::vector<double>& v){ return v[3]; });
|
||||
|
||||
|
||||
#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
std::cout << "Screening GSL data:\n";
|
||||
screen_data([](const std::vector<double>& v){ return gsl_sf_gamma_inc_Q(v[0], v[1]); }, [](const std::vector<double>& v){ return v[3]; });
|
||||
#endif
|
||||
#if defined(TEST_RMATH) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
std::cout << "Screening GSL data:\n";
|
||||
screen_data([](const std::vector<double>& v){ return pgamma(v[1], v[0], 1.0, 0, 0); }, [](const std::vector<double>& v){ return v[3]; });
|
||||
#endif
|
||||
|
||||
unsigned data_used = data.size();
|
||||
std::string function = "gamma_q[br](" + boost::lexical_cast<std::string>(data_used) + "/" + boost::lexical_cast<std::string>(data_total) + " tests selected)";
|
||||
std::string function_short = "gamma_q";
|
||||
|
||||
double time;
|
||||
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return boost::math::gamma_q(v[0], v[1]); });
|
||||
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<double>& v){ return boost::math::gamma_q(v[0], v[1], boost::math::policies::make_policy(boost::math::policies::promote_double<false>())); });
|
||||
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<false>");
|
||||
#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<false>");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return gsl_sf_gamma_inc_Q(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<double>& v){ return pgamma(v[1], v[0], 1.0, 0, 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;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
// 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 <boost/math/special_functions/gamma.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "../../test/table_type.hpp"
|
||||
#include "table_helper.hpp"
|
||||
#include "performance.hpp"
|
||||
#include <iostream>
|
||||
|
||||
typedef double T;
|
||||
#define SC_(x) static_cast<double>(x)
|
||||
|
||||
int main()
|
||||
{
|
||||
# include "gamma_inv_data.ipp"
|
||||
# include "gamma_inv_big_data.ipp"
|
||||
# include "gamma_inv_small_data.ipp"
|
||||
|
||||
add_data(gamma_inv_data);
|
||||
add_data(gamma_inv_big_data);
|
||||
add_data(gamma_inv_small_data);
|
||||
|
||||
unsigned data_total = data.size();
|
||||
|
||||
std::cout << "screening Boost data:\n";
|
||||
screen_data([](const std::vector<double>& v){ return boost::math::gamma_q_inv(v[0], v[1]); }, [](const std::vector<double>& v){ return v[3]; });
|
||||
|
||||
|
||||
#if defined(TEST_RMATH) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
std::cout << "screening Rmath data:\n";
|
||||
screen_data([](const std::vector<double>& v){ return qgamma(v[1], v[0], 1.0, 0, 0); }, [](const std::vector<double>& v){ return v[2]; });
|
||||
#endif
|
||||
|
||||
unsigned data_used = data.size();
|
||||
std::string function = "gamma_q_inv[br](" + boost::lexical_cast<std::string>(data_used) + "/" + boost::lexical_cast<std::string>(data_total) + " tests selected)";
|
||||
std::string function_short = "gamma_q_inv";
|
||||
|
||||
double time;
|
||||
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return boost::math::gamma_q_inv(v[0], v[1]); });
|
||||
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<double>& v){ return boost::math::gamma_q_inv(v[0], v[1], boost::math::policies::make_policy(boost::math::policies::promote_double<false>())); });
|
||||
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<false>");
|
||||
#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<false>");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(TEST_RMATH) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return qgamma(v[1], v[0], 1.0, 0, 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;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,509 @@
|
||||
// Copyright Jeremy Murphy 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)
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning (disable : 4224)
|
||||
#endif
|
||||
|
||||
#include <boost/math/common_factor_rt.hpp>
|
||||
#include <boost/math/special_functions/prime.hpp>
|
||||
#include <boost/multiprecision/cpp_int.hpp>
|
||||
#include <boost/multiprecision/integer.hpp>
|
||||
#include <boost/random.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <numeric>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
#include "fibonacci.hpp"
|
||||
#include "../../test/table_type.hpp"
|
||||
#include "table_helper.hpp"
|
||||
#include "performance.hpp"
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
boost::multiprecision::cpp_int total_sum(0);
|
||||
|
||||
template <typename Func, class Table>
|
||||
double exec_timed_test_foo(Func f, const Table& data, double min_elapsed = 0.5)
|
||||
{
|
||||
double t = 0;
|
||||
unsigned repeats = 1;
|
||||
typename Table::value_type::first_type sum{0};
|
||||
stopwatch<boost::chrono::high_resolution_clock> w;
|
||||
do
|
||||
{
|
||||
for(unsigned count = 0; count < repeats; ++count)
|
||||
{
|
||||
for(typename Table::size_type n = 0; n < data.size(); ++n)
|
||||
sum += f(data[n].first, data[n].second);
|
||||
}
|
||||
|
||||
t = boost::chrono::duration_cast<boost::chrono::duration<double>>(w.elapsed()).count();
|
||||
if(t < min_elapsed)
|
||||
repeats *= 2;
|
||||
}
|
||||
while(t < min_elapsed);
|
||||
total_sum += sum;
|
||||
return t / repeats;
|
||||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
struct test_function_template
|
||||
{
|
||||
vector<pair<T, T> > const & data;
|
||||
const char* data_name;
|
||||
|
||||
test_function_template(vector<pair<T, T> > const &data, const char* name) : data(data), data_name(name) {}
|
||||
|
||||
template <typename Function>
|
||||
void operator()(pair<Function, string> const &f) const
|
||||
{
|
||||
auto result = exec_timed_test_foo(f.first, data);
|
||||
auto table_name = string("gcd method comparison with ") + compiler_name() + string(" on ") + platform_name();
|
||||
|
||||
report_execution_time(result,
|
||||
table_name,
|
||||
string(data_name),
|
||||
string(f.second) + "\n" + boost_name());
|
||||
}
|
||||
};
|
||||
|
||||
boost::random::mt19937 rng;
|
||||
boost::random::uniform_int_distribution<> d_0_6(0, 6);
|
||||
boost::random::uniform_int_distribution<> d_1_20(1, 20);
|
||||
|
||||
template <class T>
|
||||
T get_prime_products()
|
||||
{
|
||||
int n_primes = d_0_6(rng);
|
||||
switch(n_primes)
|
||||
{
|
||||
case 0:
|
||||
// Generate a power of 2:
|
||||
return static_cast<T>(1u) << d_1_20(rng);
|
||||
case 1:
|
||||
// prime number:
|
||||
return boost::math::prime(d_1_20(rng) + 3);
|
||||
}
|
||||
T result = 1;
|
||||
for(int i = 0; i < n_primes; ++i)
|
||||
result *= boost::math::prime(d_1_20(rng) + 3) * boost::math::prime(d_1_20(rng) + 3) * boost::math::prime(d_1_20(rng) + 3) * boost::math::prime(d_1_20(rng) + 3) * boost::math::prime(d_1_20(rng) + 3);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
T get_uniform_random()
|
||||
{
|
||||
static boost::random::uniform_int_distribution<T> minmax(std::numeric_limits<T>::min(), std::numeric_limits<T>::max());
|
||||
return minmax(rng);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline bool even(T const& val)
|
||||
{
|
||||
return !(val & 1u);
|
||||
}
|
||||
|
||||
template <class Backend, boost::multiprecision::expression_template_option ExpressionTemplates>
|
||||
inline bool even(boost::multiprecision::number<Backend, ExpressionTemplates> const& val)
|
||||
{
|
||||
return !bit_test(val, 0);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
T euclid_textbook(T a, T b)
|
||||
{
|
||||
using std::swap;
|
||||
if(a < b)
|
||||
swap(a, b);
|
||||
while(b)
|
||||
{
|
||||
T t = b;
|
||||
b = a % b;
|
||||
a = t;
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
T binary_textbook(T u, T v)
|
||||
{
|
||||
if(u && v)
|
||||
{
|
||||
unsigned shifts = std::min(boost::multiprecision::lsb(u), boost::multiprecision::lsb(v));
|
||||
if(shifts)
|
||||
{
|
||||
u >>= shifts;
|
||||
v >>= shifts;
|
||||
}
|
||||
while(u)
|
||||
{
|
||||
unsigned bit_index = boost::multiprecision::lsb(u);
|
||||
if(bit_index)
|
||||
{
|
||||
u >>= bit_index;
|
||||
}
|
||||
else if(bit_index = boost::multiprecision::lsb(v))
|
||||
{
|
||||
v >>= bit_index;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(u < v)
|
||||
v = (v - u) >> 1u;
|
||||
else
|
||||
u = (u - v) >> 1u;
|
||||
}
|
||||
}
|
||||
return v << shifts;
|
||||
}
|
||||
return u + v;
|
||||
}
|
||||
|
||||
//
|
||||
// The Mixed Binary Euclid Algorithm
|
||||
// Sidi Mohamed Sedjelmaci
|
||||
// Electronic Notes in Discrete Mathematics 35 (2009) 169–176
|
||||
//
|
||||
template <class T>
|
||||
T mixed_binary_gcd(T u, T v)
|
||||
{
|
||||
using std::swap;
|
||||
if(u < v)
|
||||
swap(u, v);
|
||||
|
||||
unsigned shifts = 0;
|
||||
|
||||
if(!u)
|
||||
return v;
|
||||
if(!v)
|
||||
return u;
|
||||
|
||||
while(even(u) && even(v))
|
||||
{
|
||||
u >>= 1u;
|
||||
v >>= 1u;
|
||||
++shifts;
|
||||
}
|
||||
|
||||
while(v > 1)
|
||||
{
|
||||
u %= v;
|
||||
v -= u;
|
||||
if(!u)
|
||||
return v << shifts;
|
||||
if(!v)
|
||||
return u << shifts;
|
||||
while(even(u)) u >>= 1u;
|
||||
while(even(v)) v >>= 1u;
|
||||
if(u < v)
|
||||
swap(u, v);
|
||||
}
|
||||
return (v == 1 ? v : u) << shifts;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void test_type(const char* name)
|
||||
{
|
||||
using namespace boost::math::detail;
|
||||
typedef T int_type;
|
||||
std::vector<pair<int_type, int_type> > data;
|
||||
|
||||
for(unsigned i = 0; i < 1000; ++i)
|
||||
{
|
||||
data.push_back(std::make_pair(get_prime_products<T>(), get_prime_products<T>()));
|
||||
}
|
||||
std::string row_name("gcd<");
|
||||
row_name += name;
|
||||
row_name += "> (random prime number products)";
|
||||
|
||||
typedef pair< function<int_type(int_type, int_type)>, string> f_test;
|
||||
array<f_test, 5> test_functions{ {
|
||||
{ Stein_gcd<int_type>, "Stein_gcd" } ,
|
||||
{ Euclid_gcd<int_type>, "Euclid_gcd" },
|
||||
{ binary_textbook<int_type>, "Stein_gcd_textbook" },
|
||||
{ euclid_textbook<int_type>, "gcd_euclid_textbook" },
|
||||
{ mixed_binary_gcd<int_type>, "mixed_binary_gcd" }
|
||||
} };
|
||||
for_each(begin(test_functions), end(test_functions), test_function_template<int_type>(data, row_name.c_str()));
|
||||
|
||||
data.clear();
|
||||
for(unsigned i = 0; i < 1000; ++i)
|
||||
{
|
||||
data.push_back(std::make_pair(get_uniform_random<T>(), get_uniform_random<T>()));
|
||||
}
|
||||
row_name.erase();
|
||||
row_name += "gcd<";
|
||||
row_name += name;
|
||||
row_name += "> (uniform random numbers)";
|
||||
for_each(begin(test_functions), end(test_functions), test_function_template<int_type>(data, row_name.c_str()));
|
||||
|
||||
// Fibonacci number tests:
|
||||
row_name.erase();
|
||||
row_name += "gcd<";
|
||||
row_name += name;
|
||||
row_name += "> (adjacent Fibonacci numbers)";
|
||||
for_each(begin(test_functions), end(test_functions), test_function_template<int_type>(fibonacci_numbers_permution_1<T>(), row_name.c_str()));
|
||||
|
||||
row_name.erase();
|
||||
row_name += "gcd<";
|
||||
row_name += name;
|
||||
row_name += "> (permutations of Fibonacci numbers)";
|
||||
for_each(begin(test_functions), end(test_functions), test_function_template<int_type>(fibonacci_numbers_permution_2<T>(), row_name.c_str()));
|
||||
|
||||
row_name.erase();
|
||||
row_name += "gcd<";
|
||||
row_name += name;
|
||||
row_name += "> (Trivial cases)";
|
||||
for_each(begin(test_functions), end(test_functions), test_function_template<int_type>(trivial_gcd_test_cases<T>(), row_name.c_str()));
|
||||
}
|
||||
|
||||
/*******************************************************************************************************************/
|
||||
|
||||
template <class T>
|
||||
T generate_random(unsigned bits_wanted)
|
||||
{
|
||||
static boost::random::mt19937 gen;
|
||||
typedef boost::random::mt19937::result_type random_type;
|
||||
|
||||
T max_val;
|
||||
unsigned digits;
|
||||
if(std::numeric_limits<T>::is_bounded && (bits_wanted == (unsigned)std::numeric_limits<T>::digits))
|
||||
{
|
||||
max_val = (std::numeric_limits<T>::max)();
|
||||
digits = std::numeric_limits<T>::digits;
|
||||
}
|
||||
else
|
||||
{
|
||||
max_val = T(1) << bits_wanted;
|
||||
digits = bits_wanted;
|
||||
}
|
||||
|
||||
unsigned bits_per_r_val = std::numeric_limits<random_type>::digits - 1;
|
||||
while((random_type(1) << bits_per_r_val) > (gen.max)()) --bits_per_r_val;
|
||||
|
||||
unsigned terms_needed = digits / bits_per_r_val + 1;
|
||||
|
||||
T val = 0;
|
||||
for(unsigned i = 0; i < terms_needed; ++i)
|
||||
{
|
||||
val *= (gen.max)();
|
||||
val += gen();
|
||||
}
|
||||
val %= max_val;
|
||||
return val;
|
||||
}
|
||||
|
||||
template <typename N>
|
||||
N gcd_stein(N m, N n)
|
||||
{
|
||||
BOOST_ASSERT(m >= static_cast<N>(0));
|
||||
BOOST_ASSERT(n >= static_cast<N>(0));
|
||||
if(m == N(0)) return n;
|
||||
if(n == N(0)) return m;
|
||||
// m > 0 && n > 0
|
||||
unsigned d_m = 0;
|
||||
while(even(m)) { m >>= 1; d_m++; }
|
||||
unsigned d_n = 0;
|
||||
while(even(n)) { n >>= 1; d_n++; }
|
||||
// odd(m) && odd(n)
|
||||
while(m != n) {
|
||||
if(n > m) swap(n, m);
|
||||
m -= n;
|
||||
do m >>= 1; while(even(m));
|
||||
// m == n
|
||||
}
|
||||
return m << std::min(d_m, d_n);
|
||||
}
|
||||
|
||||
boost::multiprecision::cpp_int big_gcd(const boost::multiprecision::cpp_int& a, const boost::multiprecision::cpp_int& b)
|
||||
{
|
||||
return boost::multiprecision::gcd(a, b);
|
||||
}
|
||||
|
||||
namespace boost { namespace multiprecision { namespace backends {
|
||||
|
||||
template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1>
|
||||
inline typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value>::type
|
||||
eval_gcd_new(
|
||||
cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
|
||||
const cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& a,
|
||||
const cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& b)
|
||||
{
|
||||
using default_ops::eval_lsb;
|
||||
using default_ops::eval_is_zero;
|
||||
using default_ops::eval_get_sign;
|
||||
|
||||
if(a.size() == 1)
|
||||
{
|
||||
eval_gcd(result, b, *a.limbs());
|
||||
return;
|
||||
}
|
||||
if(b.size() == 1)
|
||||
{
|
||||
eval_gcd(result, a, *b.limbs());
|
||||
return;
|
||||
}
|
||||
|
||||
int shift;
|
||||
|
||||
cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> u(a), v(b), mod;
|
||||
|
||||
int s = eval_get_sign(u);
|
||||
|
||||
/* GCD(0,x) := x */
|
||||
if(s < 0)
|
||||
{
|
||||
u.negate();
|
||||
}
|
||||
else if(s == 0)
|
||||
{
|
||||
result = v;
|
||||
return;
|
||||
}
|
||||
s = eval_get_sign(v);
|
||||
if(s < 0)
|
||||
{
|
||||
v.negate();
|
||||
}
|
||||
else if(s == 0)
|
||||
{
|
||||
result = u;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Let shift := lg K, where K is the greatest power of 2
|
||||
dividing both u and v. */
|
||||
|
||||
unsigned us = eval_lsb(u);
|
||||
unsigned vs = eval_lsb(v);
|
||||
shift = (std::min)(us, vs);
|
||||
eval_right_shift(u, us);
|
||||
eval_right_shift(v, vs);
|
||||
|
||||
// From now on access u and v via pointers, that way we have a trivial swap:
|
||||
cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>* up(&u), *vp(&v), *mp(&mod);
|
||||
|
||||
do
|
||||
{
|
||||
/* Now u and v are both odd, so diff(u, v) is even.
|
||||
Let u = min(u, v), v = diff(u, v)/2. */
|
||||
s = up->compare(*vp);
|
||||
if(s > 0)
|
||||
std::swap(up, vp);
|
||||
if(s == 0)
|
||||
break;
|
||||
if(vp->size() <= 2)
|
||||
{
|
||||
if(vp->size() == 1)
|
||||
*up = mixed_binary_gcd(*vp->limbs(), *up->limbs());
|
||||
else
|
||||
{
|
||||
double_limb_type i, j;
|
||||
i = vp->limbs()[0] | (static_cast<double_limb_type>(vp->limbs()[1]) << sizeof(limb_type) * CHAR_BIT);
|
||||
j = (up->size() == 1) ? *up->limbs() : up->limbs()[0] | (static_cast<double_limb_type>(up->limbs()[1]) << sizeof(limb_type) * CHAR_BIT);
|
||||
u = mixed_binary_gcd(i, j);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if(vp->size() > up->size() /*eval_msb(*vp) > eval_msb(*up) + 32*/)
|
||||
{
|
||||
eval_modulus(*mp, *vp, *up);
|
||||
std::swap(vp, mp);
|
||||
eval_subtract(*up, *vp);
|
||||
if(eval_is_zero(*vp) == 0)
|
||||
{
|
||||
vs = eval_lsb(*vp);
|
||||
eval_right_shift(*vp, vs);
|
||||
}
|
||||
else
|
||||
break;
|
||||
if(eval_is_zero(*up) == 0)
|
||||
{
|
||||
vs = eval_lsb(*up);
|
||||
eval_right_shift(*up, vs);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::swap(up, vp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
eval_subtract(*vp, *up);
|
||||
vs = eval_lsb(*vp);
|
||||
eval_right_shift(*vp, vs);
|
||||
}
|
||||
}
|
||||
while(true);
|
||||
|
||||
result = *up;
|
||||
eval_left_shift(result, shift);
|
||||
}
|
||||
|
||||
}}}
|
||||
|
||||
|
||||
boost::multiprecision::cpp_int big_gcd_new(const boost::multiprecision::cpp_int& a, const boost::multiprecision::cpp_int& b)
|
||||
{
|
||||
boost::multiprecision::cpp_int result;
|
||||
boost::multiprecision::backends::eval_gcd_new(result.backend(), a.backend(), b.backend());
|
||||
return result;
|
||||
}
|
||||
|
||||
#if 0
|
||||
void test_n_bits(unsigned n, std::string data_name, const std::vector<pair<boost::multiprecision::cpp_int, boost::multiprecision::cpp_int> >* p_data = 0)
|
||||
{
|
||||
using namespace boost::math::detail;
|
||||
typedef boost::multiprecision::cpp_int int_type;
|
||||
std::vector<pair<int_type, int_type> > data, data2;
|
||||
|
||||
for(unsigned i = 0; i < 1000; ++i)
|
||||
{
|
||||
data.push_back(std::make_pair(generate_random<int_type>(n), generate_random<int_type>(n)));
|
||||
}
|
||||
|
||||
typedef pair< function<int_type(int_type, int_type)>, string> f_test;
|
||||
array<f_test, 2> test_functions{ { /*{ Stein_gcd<int_type>, "Stein_gcd" } ,{ Euclid_gcd<int_type>, "Euclid_gcd" },{ binary_textbook<int_type>, "Stein_gcd_textbook" },{ euclid_textbook<int_type>, "gcd_euclid_textbook" },{ mixed_binary_gcd<int_type>, "mixed_binary_gcd" },{ gcd_stein<int_type>, "gcd_stein" },*/{ big_gcd, "boost::multiprecision::gcd" },{ big_gcd_new, "big_gcd_new" } } };
|
||||
for_each(begin(test_functions), end(test_functions), test_function_template<int_type>(p_data ? *p_data : data, data_name.c_str(), true));
|
||||
}
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
test_type<unsigned short>("unsigned short");
|
||||
test_type<unsigned>("unsigned");
|
||||
test_type<unsigned long>("unsigned long");
|
||||
test_type<unsigned long long>("unsigned long long");
|
||||
|
||||
test_type<boost::multiprecision::uint256_t>("boost::multiprecision::uint256_t");
|
||||
test_type<boost::multiprecision::uint512_t>("boost::multiprecision::uint512_t");
|
||||
test_type<boost::multiprecision::uint1024_t>("boost::multiprecision::uint1024_t");
|
||||
|
||||
/*
|
||||
test_n_bits(16, " 16 bit random values");
|
||||
test_n_bits(32, " 32 bit random values");
|
||||
test_n_bits(64, " 64 bit random values");
|
||||
test_n_bits(125, " 125 bit random values");
|
||||
test_n_bits(250, " 250 bit random values");
|
||||
test_n_bits(500, " 500 bit random values");
|
||||
test_n_bits(1000, " 1000 bit random values");
|
||||
test_n_bits(5000, " 5000 bit random values");
|
||||
test_n_bits(10000, "10000 bit random values");
|
||||
//test_n_bits(100000);
|
||||
//test_n_bits(1000000);
|
||||
|
||||
test_n_bits(0, "consecutive first 1000 fibonacci numbers", &fibonacci_numbers_cpp_int_permution_1());
|
||||
test_n_bits(0, "permutations of first 1000 fibonacci numbers", &fibonacci_numbers_cpp_int_permution_2());
|
||||
*/
|
||||
}
|
||||
@@ -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 <boost/math/special_functions/beta.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "../../test/table_type.hpp"
|
||||
#include "table_helper.hpp"
|
||||
#include "performance.hpp"
|
||||
#include <iostream>
|
||||
|
||||
typedef double T;
|
||||
#define SC_(x) static_cast<double>(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<double>& v){ return boost::math::ibeta(v[0], v[1], v[2]); }, [](const std::vector<double>& v){ return v[5]; });
|
||||
|
||||
|
||||
#if defined(TEST_RMATH) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
std::cout << "Screening libstdc++ data:\n";
|
||||
screen_data([](const std::vector<double>& v){ return ::pbeta(v[2], v[0], v[1], 1, 0); }, [](const std::vector<double>& v){ return v[5]; });
|
||||
#endif
|
||||
|
||||
unsigned data_used = data.size();
|
||||
std::string function = "ibeta[br](" + boost::lexical_cast<std::string>(data_used) + "/" + boost::lexical_cast<std::string>(data_total) + " tests selected)";
|
||||
std::string function_short = "ibeta";
|
||||
|
||||
double time;
|
||||
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return boost::math::ibeta(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<double>& v){ return boost::math::ibeta(v[0], v[1], v[2], boost::math::policies::make_policy(boost::math::policies::promote_double<false>())); });
|
||||
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<false>");
|
||||
#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<false>");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(TEST_RMATH) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return ::pbeta(v[2], v[0], v[1], 1, 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;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
// 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 <boost/math/special_functions/beta.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "../../test/table_type.hpp"
|
||||
#include "table_helper.hpp"
|
||||
#include "performance.hpp"
|
||||
#include <iostream>
|
||||
|
||||
typedef double T;
|
||||
#define SC_(x) static_cast<double>(x)
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
# include "ibeta_inv_data.ipp"
|
||||
|
||||
add_data(ibeta_inv_data);
|
||||
|
||||
unsigned data_total = data.size();
|
||||
|
||||
std::cout << "Screening boost data:\n";
|
||||
screen_data([](const std::vector<double>& v){ return boost::math::ibeta_inv(v[0], v[1], v[2]); }, [](const std::vector<double>& v){ return v[3]; });
|
||||
|
||||
|
||||
#if defined(TEST_RMATH) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
std::cout << "Screening libstdc++ data:\n";
|
||||
screen_data([](const std::vector<double>& v){ return ::qbeta(v[2], v[0], v[1], 1, 0); }, [](const std::vector<double>& v){ return v[3]; });
|
||||
#endif
|
||||
|
||||
unsigned data_used = data.size();
|
||||
std::string function = "ibeta_inv[br](" + boost::lexical_cast<std::string>(data_used) + "/" + boost::lexical_cast<std::string>(data_total) + " tests selected)";
|
||||
std::string function_short = "ibeta_inv";
|
||||
|
||||
double time;
|
||||
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return boost::math::ibeta_inv(v[0], v[1], v[2]); });
|
||||
std::cout << time << std::endl;
|
||||
#if defined(COMPILER_COMPARISON_TABLES)
|
||||
report_execution_time(time, std::string("Compiler Option Comparison on ") + platform_name(), "boost::math::ibeta_inv", get_compiler_options_name());
|
||||
#else
|
||||
#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());
|
||||
#endif
|
||||
//
|
||||
// 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<double>& v){ return boost::math::ibeta_inv(v[0], v[1], v[2], boost::math::policies::make_policy(boost::math::policies::promote_double<false>())); });
|
||||
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<false>");
|
||||
#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<false>");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(TEST_RMATH) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return ::qbeta(v[2], v[0], v[1], 1, 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;
|
||||
}
|
||||
|
||||
@@ -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 <boost/math/special_functions/beta.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "../../test/table_type.hpp"
|
||||
#include "table_helper.hpp"
|
||||
#include "performance.hpp"
|
||||
#include <iostream>
|
||||
|
||||
typedef double T;
|
||||
#define SC_(x) static_cast<double>(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<double>& v){ return boost::math::ibetac(v[0], v[1], v[2]); }, [](const std::vector<double>& v){ return v[6]; });
|
||||
|
||||
|
||||
#if defined(TEST_RMATH) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
std::cout << "Screening libstdc++ data:\n";
|
||||
screen_data([](const std::vector<double>& v){ return ::pbeta(v[2], v[0], v[1], 0, 0); }, [](const std::vector<double>& v){ return v[6]; });
|
||||
#endif
|
||||
|
||||
unsigned data_used = data.size();
|
||||
std::string function = "ibetac[br](" + boost::lexical_cast<std::string>(data_used) + "/" + boost::lexical_cast<std::string>(data_total) + " tests selected)";
|
||||
std::string function_short = "ibetac";
|
||||
|
||||
double time;
|
||||
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return boost::math::ibetac(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<double>& v){ return boost::math::ibetac(v[0], v[1], v[2], boost::math::policies::make_policy(boost::math::policies::promote_double<false>())); });
|
||||
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<false>");
|
||||
#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<false>");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(TEST_RMATH) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return ::pbeta(v[2], v[0], v[1], 0, 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;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
// 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 <boost/math/special_functions/beta.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "../../test/table_type.hpp"
|
||||
#include "table_helper.hpp"
|
||||
#include "performance.hpp"
|
||||
#include <iostream>
|
||||
|
||||
typedef double T;
|
||||
#define SC_(x) static_cast<double>(x)
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
# include "ibeta_inv_data.ipp"
|
||||
|
||||
add_data(ibeta_inv_data);
|
||||
|
||||
unsigned data_total = data.size();
|
||||
|
||||
std::cout << "Screening boost data:\n";
|
||||
screen_data([](const std::vector<double>& v){ return boost::math::ibetac_inv(v[0], v[1], v[2]); }, [](const std::vector<double>& v){ return v[4]; });
|
||||
|
||||
|
||||
#if defined(TEST_RMATH) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
std::cout << "Screening libstdc++ data:\n";
|
||||
screen_data([](const std::vector<double>& v){ return ::qbeta(v[2], v[0], v[1], 0, 0); }, [](const std::vector<double>& v){ return v[4]; });
|
||||
#endif
|
||||
|
||||
unsigned data_used = data.size();
|
||||
std::string function = "ibetac_inv[br](" + boost::lexical_cast<std::string>(data_used) + "/" + boost::lexical_cast<std::string>(data_total) + " tests selected)";
|
||||
std::string function_short = "ibetac_inv";
|
||||
|
||||
double time;
|
||||
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return boost::math::ibetac_inv(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<double>& v){ return boost::math::ibetac_inv(v[0], v[1], v[2], boost::math::policies::make_policy(boost::math::policies::promote_double<false>())); });
|
||||
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<false>");
|
||||
#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<false>");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(TEST_RMATH) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return ::qbeta(v[2], v[0], v[1], 0, 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;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
// 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 <boost/math/special_functions/gamma.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "../../test/table_type.hpp"
|
||||
#include "table_helper.hpp"
|
||||
#include "performance.hpp"
|
||||
#include <iostream>
|
||||
|
||||
typedef double T;
|
||||
#define SC_(x) static_cast<double>(x)
|
||||
|
||||
int main()
|
||||
{
|
||||
# include "igamma_med_data.ipp"
|
||||
# include "igamma_small_data.ipp"
|
||||
# include "igamma_big_data.ipp"
|
||||
# include "igamma_int_data.ipp"
|
||||
|
||||
add_data(igamma_med_data);
|
||||
add_data(igamma_small_data);
|
||||
add_data(igamma_big_data);
|
||||
add_data(igamma_int_data);
|
||||
|
||||
unsigned data_total = data.size();
|
||||
|
||||
screen_data([](const std::vector<double>& v){ return boost::math::tgamma(v[0], v[1]); }, [](const std::vector<double>& v){ return v[2]; });
|
||||
|
||||
|
||||
#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
screen_data([](const std::vector<double>& v){ return gsl_sf_gamma_inc(v[0], v[1]); }, [](const std::vector<double>& v){ return v[2]; });
|
||||
#endif
|
||||
|
||||
unsigned data_used = data.size();
|
||||
std::string function = "tgamma (incomplete)[br](" + boost::lexical_cast<std::string>(data_used) + "/" + boost::lexical_cast<std::string>(data_total) + " tests selected)";
|
||||
std::string function_short = "tgamma (incomplete)";
|
||||
|
||||
double time;
|
||||
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return boost::math::tgamma(v[0], v[1]); });
|
||||
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<double>& v){ return boost::math::tgamma(v[0], v[1], boost::math::policies::make_policy(boost::math::policies::promote_double<false>())); });
|
||||
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<false>");
|
||||
#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<false>");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return gsl_sf_gamma_inc(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
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
// 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 <boost/math/special_functions/bessel.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "../../test/table_type.hpp"
|
||||
#include "table_helper.hpp"
|
||||
#include "performance.hpp"
|
||||
#include <iostream>
|
||||
|
||||
typedef double T;
|
||||
#define SC_(x) static_cast<double>(x)
|
||||
static const boost::array<boost::array<T, 3>, 10> i0_data = { {
|
||||
{ { SC_(0.0), SC_(0.0), SC_(1.0) } },
|
||||
{ { SC_(0.0), SC_(1.0), SC_(1.26606587775200833559824462521471753760767031135496220680814) } },
|
||||
{ { SC_(0.0), SC_(-2.0), SC_(2.27958530233606726743720444081153335328584110278545905407084) } },
|
||||
{ { SC_(0.0), SC_(4.0), SC_(11.3019219521363304963562701832171024974126165944353377060065) } },
|
||||
{ { SC_(0.0), SC_(-7.0), SC_(168.593908510289698857326627187500840376522679234531714193194) } },
|
||||
{ { SC_(0.0), T(1) / 1024, SC_(1.00000023841859331241759166109699567801556273303717896447683) } },
|
||||
{ { SC_(0.0), T(SC_(1.0)) / (1024 * 1024), SC_(1.00000000000022737367544324498417583090700894607432256476338) } },
|
||||
{ { SC_(0.0), SC_(-1.0), SC_(1.26606587775200833559824462521471753760767031135496220680814) } },
|
||||
{ { SC_(0.0), SC_(100.0), SC_(1.07375170713107382351972085760349466128840319332527279540154e42) } },
|
||||
{ { SC_(0.0), SC_(200.0), SC_(2.03968717340972461954167312677945962233267573614834337894328e85) } },
|
||||
} };
|
||||
static const boost::array<boost::array<T, 3>, 10> i1_data = { {
|
||||
{ { SC_(1.0), SC_(0.0), SC_(0.0) } },
|
||||
{ { SC_(1.0), SC_(1.0), SC_(0.565159103992485027207696027609863307328899621621092009480294) } },
|
||||
{ { SC_(1.0), SC_(-2.0), SC_(-1.59063685463732906338225442499966624795447815949553664713229) } },
|
||||
{ { SC_(1.0), SC_(4.0), SC_(9.75946515370444990947519256731268090005597033325296730692753) } },
|
||||
{ { SC_(1.0), SC_(-8.0), SC_(-399.873136782560098219083086145822754889628443904067647306574) } },
|
||||
{ { SC_(1.0), T(SC_(1.0)) / 1024, SC_(0.000488281308207663226432087816784315537514225208473395063575150) } },
|
||||
{ { SC_(1.0), T(SC_(1.0)) / (1024 * 1024), SC_(4.76837158203179210108624277276025646653133998635956784292029E-7) } },
|
||||
{ { SC_(1.0), SC_(-10.0), SC_(-2670.98830370125465434103196677215254914574515378753771310849) } },
|
||||
{ { SC_(1.0), SC_(100.0), SC_(1.06836939033816248120614576322429526544612284405623226965918e42) } },
|
||||
{ { SC_(1.0), SC_(200.0), SC_(2.03458154933206270342742797713906950389661161681122964159220e85) } },
|
||||
} };
|
||||
static const boost::array<boost::array<T, 3>, 11> in_data = { {
|
||||
{ { SC_(-2.0), SC_(0.0), SC_(0.0) } },
|
||||
{ { SC_(2.0), T(SC_(1.0)) / (1024 * 1024), SC_(1.13686837721624646204093977095674566928522671779753217215467e-13) } },
|
||||
{ { SC_(5.0), SC_(10.0), SC_(777.188286403259959907293484802339632852674154572666041953297) } },
|
||||
{ { SC_(-5.0), SC_(100.0), SC_(9.47009387303558124618275555002161742321578485033007130107740e41) } },
|
||||
{ { SC_(-5.0), SC_(-1.0), SC_(-0.000271463155956971875181073905153777342383564426758143634974124) } },
|
||||
{ { SC_(10.0), SC_(20.0), SC_(3.54020020901952109905289138244985607057267103782948493874391e6) } },
|
||||
{ { SC_(10.0), SC_(-5.0), SC_(0.00458004441917605126118647027872016953192323139337073320016447) } },
|
||||
{ { SC_(1e+02), SC_(9.0), SC_(2.74306601746058997093587654668959071522869282506446891736820e-93) } },
|
||||
{ { SC_(1e+02), SC_(80.0), SC_(4.65194832850610205318128191404145885093970505338730540776711e8) } },
|
||||
{ { SC_(-100.0), SC_(-200.0), SC_(4.35275044972702191438729017441198257508190719030765213981307e74) } },
|
||||
{ { SC_(10.0), SC_(1e-100), SC_(2.69114445546737213403880070546737213403880070546737213403880e-1010) } },
|
||||
} };
|
||||
|
||||
int main()
|
||||
{
|
||||
#include "bessel_i_int_data.ipp"
|
||||
|
||||
add_data(i0_data);
|
||||
add_data(i1_data);
|
||||
add_data(in_data);
|
||||
add_data(bessel_i_int_data);
|
||||
|
||||
unsigned data_total = data.size();
|
||||
|
||||
screen_data([](const std::vector<double>& v){ return boost::math::cyl_bessel_i(static_cast<int>(v[0]), v[1]); }, [](const std::vector<double>& v){ return v[2]; });
|
||||
|
||||
#if defined(TEST_LIBSTDCXX) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
screen_data([](const std::vector<double>& v){ return std::tr1::cyl_bessel_i(static_cast<int>(v[0]), v[1]); }, [](const std::vector<double>& v){ return v[2]; });
|
||||
#endif
|
||||
#if defined(TEST_GSL) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
screen_data([](const std::vector<double>& v){ return gsl_sf_bessel_In(static_cast<int>(v[0]), v[1]); }, [](const std::vector<double>& v){ return v[2]; });
|
||||
#endif
|
||||
#if defined(TEST_RMATH) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
screen_data([](const std::vector<double>& v){ return bessel_i(v[1], static_cast<int>(v[0]), 1); }, [](const std::vector<double>& v){ return v[2]; });
|
||||
#endif
|
||||
|
||||
unsigned data_used = data.size();
|
||||
std::string function = "cyl_bessel_i (integer order)[br](" + boost::lexical_cast<std::string>(data_used) + "/" + boost::lexical_cast<std::string>(data_total) + " tests selected)";
|
||||
std::string function_short = "cyl_bessel_i (integer order)";
|
||||
|
||||
double time;
|
||||
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return boost::math::cyl_bessel_i(static_cast<int>(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<double>& v){ return boost::math::cyl_bessel_i(static_cast<int>(v[0]), v[1], boost::math::policies::make_policy(boost::math::policies::promote_double<false>())); });
|
||||
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<false>");
|
||||
#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<false>");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(TEST_LIBSTDCXX) && !defined(COMPILER_COMPARISON_TABLES)
|
||||
time = exec_timed_test([](const std::vector<double>& v){ return std::tr1::cyl_bessel_i(static_cast<int>(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<double>& v){ return gsl_sf_bessel_In(static_cast<int>(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<double>& v){ return bessel_i(v[1], static_cast<int>(v[0]), 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;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user