mirror of
https://github.com/boostorg/math.git
synced 2026-01-19 04:22:09 +00:00
Update polynomial evaluation for NVRTC
This commit is contained in:
@@ -40,13 +40,13 @@ void print_polynomials(int max_order)
|
||||
"#define BOOST_MATH_TOOLS_POLY_EVAL_" << i << "_HPP\n\n"
|
||||
"namespace boost{ namespace math{ namespace tools{ namespace detail{\n\n"
|
||||
"template <class T, class V>\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant<int, 0>*)\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant<int, 0>*)\n"
|
||||
"{\n"
|
||||
" return static_cast<V>(0);\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"template <class T, class V>\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant<int, 1>*)\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant<int, 1>*)\n"
|
||||
"{\n"
|
||||
" return static_cast<V>(a[0]);\n"
|
||||
"}\n\n";
|
||||
@@ -55,7 +55,7 @@ void print_polynomials(int max_order)
|
||||
{
|
||||
ofs <<
|
||||
"template <class T, class V>\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant<int, " << order << ">*)\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant<int, " << order << ">*)\n"
|
||||
"{\n"
|
||||
" return static_cast<V>(";
|
||||
|
||||
@@ -90,28 +90,28 @@ void print_polynomials(int max_order)
|
||||
"#define BOOST_MATH_TOOLS_POLY_EVAL_" << i << "_HPP\n\n"
|
||||
"namespace boost{ namespace math{ namespace tools{ namespace detail{\n\n"
|
||||
"template <class T, class V>\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant<int, 0>*)\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant<int, 0>*)\n"
|
||||
"{\n"
|
||||
" return static_cast<V>(0);\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"template <class T, class V>\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant<int, 1>*)\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant<int, 1>*)\n"
|
||||
"{\n"
|
||||
" return static_cast<V>(a[0]);\n"
|
||||
"}\n\n"
|
||||
"template <class T, class V>\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant<int, 2>*)\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant<int, 2>*)\n"
|
||||
"{\n"
|
||||
" return static_cast<V>(a[1] * x + a[0]);\n"
|
||||
"}\n\n"
|
||||
"template <class T, class V>\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant<int, 3>*)\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant<int, 3>*)\n"
|
||||
"{\n"
|
||||
" return static_cast<V>((a[2] * x + a[1]) * x + a[0]);\n"
|
||||
"}\n\n"
|
||||
"template <class T, class V>\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant<int, 4>*)\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant<int, 4>*)\n"
|
||||
"{\n"
|
||||
" return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);\n"
|
||||
"}\n\n";
|
||||
@@ -120,7 +120,7 @@ void print_polynomials(int max_order)
|
||||
{
|
||||
ofs <<
|
||||
"template <class T, class V>\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant<int, " << order << ">*)\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant<int, " << order << ">*)\n"
|
||||
"{\n"
|
||||
" V x2 = x * x;\n"
|
||||
" return static_cast<V>(";
|
||||
@@ -186,28 +186,28 @@ void print_polynomials(int max_order)
|
||||
"#define BOOST_MATH_TOOLS_POLY_EVAL_" << i << "_HPP\n\n"
|
||||
"namespace boost{ namespace math{ namespace tools{ namespace detail{\n\n"
|
||||
"template <class T, class V>\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant<int, 0>*)\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const boost::math::integral_constant<int, 0>*)\n"
|
||||
"{\n"
|
||||
" return static_cast<V>(0);\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"template <class T, class V>\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant<int, 1>*)\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const boost::math::integral_constant<int, 1>*)\n"
|
||||
"{\n"
|
||||
" return static_cast<V>(a[0]);\n"
|
||||
"}\n\n"
|
||||
"template <class T, class V>\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant<int, 2>*)\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant<int, 2>*)\n"
|
||||
"{\n"
|
||||
" return static_cast<V>(a[1] * x + a[0]);\n"
|
||||
"}\n\n"
|
||||
"template <class T, class V>\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant<int, 3>*)\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant<int, 3>*)\n"
|
||||
"{\n"
|
||||
" return static_cast<V>((a[2] * x + a[1]) * x + a[0]);\n"
|
||||
"}\n\n"
|
||||
"template <class T, class V>\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant<int, 4>*)\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant<int, 4>*)\n"
|
||||
"{\n"
|
||||
" return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);\n"
|
||||
"}\n\n";
|
||||
@@ -216,7 +216,7 @@ void print_polynomials(int max_order)
|
||||
{
|
||||
ofs <<
|
||||
"template <class T, class V>\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant<int, " << order << ">*)\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const boost::math::integral_constant<int, " << order << ">*)\n"
|
||||
"{\n"
|
||||
" V x2 = x * x;\n"
|
||||
" V t[2];\n";
|
||||
@@ -281,13 +281,13 @@ void print_rationals(int max_order)
|
||||
"#define BOOST_MATH_TOOLS_POLY_RAT_" << i << "_HPP\n\n"
|
||||
"namespace boost{ namespace math{ namespace tools{ namespace detail{\n\n"
|
||||
"template <class T, class U, class V>\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant<int, 0>*)\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant<int, 0>*)\n"
|
||||
"{\n"
|
||||
" return static_cast<V>(0);\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"template <class T, class U, class V>\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant<int, 1>*)\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant<int, 1>*)\n"
|
||||
"{\n"
|
||||
" return static_cast<V>(a[0]) / static_cast<V>(b[0]);\n"
|
||||
"}\n\n";
|
||||
@@ -296,7 +296,7 @@ void print_rationals(int max_order)
|
||||
{
|
||||
ofs <<
|
||||
"template <class T, class U, class V>\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant<int, " << order << ">*)\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant<int, " << order << ">*)\n"
|
||||
"{\n"
|
||||
" if((-1 <= x) && (x <= 1))\n"
|
||||
" return static_cast<V>((";
|
||||
@@ -361,28 +361,28 @@ void print_rationals(int max_order)
|
||||
"#define BOOST_MATH_TOOLS_RAT_EVAL_" << i << "_HPP\n\n"
|
||||
"namespace boost{ namespace math{ namespace tools{ namespace detail{\n\n"
|
||||
"template <class T, class U, class V>\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant<int, 0>*)\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant<int, 0>*)\n"
|
||||
"{\n"
|
||||
" return static_cast<V>(0);\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"template <class T, class U, class V>\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant<int, 1>*)\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant<int, 1>*)\n"
|
||||
"{\n"
|
||||
" return static_cast<V>(a[0]) / static_cast<V>(b[0]);\n"
|
||||
"}\n\n"
|
||||
"template <class T, class U, class V>\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant<int, 2>*)\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant<int, 2>*)\n"
|
||||
"{\n"
|
||||
" return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));\n"
|
||||
"}\n\n"
|
||||
"template <class T, class U, class V>\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant<int, 3>*)\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant<int, 3>*)\n"
|
||||
"{\n"
|
||||
" return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));\n"
|
||||
"}\n\n"
|
||||
"template <class T, class U, class V>\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant<int, 4>*)\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant<int, 4>*)\n"
|
||||
"{\n"
|
||||
" return static_cast<V>((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0]));\n"
|
||||
"}\n\n";
|
||||
@@ -391,7 +391,7 @@ void print_rationals(int max_order)
|
||||
{
|
||||
ofs <<
|
||||
"template <class T, class U, class V>\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant<int, " << order << ">*)\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant<int, " << order << ">*)\n"
|
||||
"{\n"
|
||||
" if((-1 <= x) && (x <= 1))\n {\n"
|
||||
" V x2 = x * x;\n"
|
||||
@@ -577,28 +577,28 @@ void print_rationals(int max_order)
|
||||
"#define BOOST_MATH_TOOLS_RAT_EVAL_" << i << "_HPP\n\n"
|
||||
"namespace boost{ namespace math{ namespace tools{ namespace detail{\n\n"
|
||||
"template <class T, class U, class V>\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant<int, 0>*)\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::math::integral_constant<int, 0>*)\n"
|
||||
"{\n"
|
||||
" return static_cast<V>(0);\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"template <class T, class U, class V>\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant<int, 1>*)\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::math::integral_constant<int, 1>*)\n"
|
||||
"{\n"
|
||||
" return static_cast<V>(a[0]) / static_cast<V>(b[0]);\n"
|
||||
"}\n\n"
|
||||
"template <class T, class U, class V>\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant<int, 2>*)\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant<int, 2>*)\n"
|
||||
"{\n"
|
||||
" return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));\n"
|
||||
"}\n\n"
|
||||
"template <class T, class U, class V>\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant<int, 3>*)\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant<int, 3>*)\n"
|
||||
"{\n"
|
||||
" return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));\n"
|
||||
"}\n\n"
|
||||
"template <class T, class U, class V>\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant<int, 4>*)\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant<int, 4>*)\n"
|
||||
"{\n"
|
||||
" return static_cast<V>((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0]));\n"
|
||||
"}\n\n";
|
||||
@@ -607,7 +607,7 @@ void print_rationals(int max_order)
|
||||
{
|
||||
ofs <<
|
||||
"template <class T, class U, class V>\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant<int, " << order << ">*)\n"
|
||||
"BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::math::integral_constant<int, " << order << ">*)\n"
|
||||
"{\n"
|
||||
" if((-1 <= x) && (x <= 1))\n {\n"
|
||||
" V x2 = x * x;\n"
|
||||
|
||||
Reference in New Issue
Block a user