|
Boost-Commit : |
From: johnmaddock_at_[hidden]
Date: 2007-05-22 04:53:01
Author: johnmaddock
Date: 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
New Revision: 4172
URL: http://svn.boost.org/trac/boost/changeset/4172
Log:
Added alternative polynomial and rational function evaluation methods.
Added new optimisation config options (still need documenting).
Tidied up use of instrumentation code so they all use BOOST_MATH_INSTRUMENT now.
Various tweaks to inverse incomplete beta and gamma to reduce number of iterations.
Changed incomplete gamma and beta to calculate derivative at the same time as the function (performance optimisation for inverses).
Fixed MinGW failures.
Refactored and extended rational / polynomial test cases.
Added:
sandbox/math_toolkit/boost/math/tools/detail/
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_10.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_11.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_12.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_13.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_14.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_15.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_16.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_17.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_18.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_19.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_2.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_20.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_3.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_4.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_5.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_6.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_7.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_8.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_9.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_10.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_11.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_12.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_13.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_14.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_15.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_16.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_17.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_18.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_19.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_2.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_20.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_3.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_4.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_5.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_6.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_7.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_8.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_9.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_10.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_11.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_12.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_13.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_14.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_15.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_16.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_17.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_18.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_19.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_2.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_20.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_3.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_4.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_5.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_6.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_7.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_8.hpp
sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_9.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_10.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_11.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_12.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_13.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_14.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_15.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_16.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_17.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_18.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_19.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_2.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_20.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_3.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_4.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_5.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_6.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_7.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_8.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_9.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_10.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_11.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_12.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_13.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_14.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_15.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_16.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_17.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_18.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_19.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_2.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_20.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_3.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_4.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_5.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_6.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_7.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_8.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_9.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_10.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_11.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_12.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_13.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_14.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_15.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_16.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_17.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_18.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_19.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_2.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_20.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_3.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_4.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_5.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_6.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_7.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_8.hpp
sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_9.hpp
sandbox/math_toolkit/libs/math/test/test_rational_double.cpp
sandbox/math_toolkit/libs/math/test/test_rational_float.cpp
sandbox/math_toolkit/libs/math/test/test_rational_ldouble.cpp
sandbox/math_toolkit/libs/math/tools/generate_rational_code.cpp
Text files modified:
sandbox/math_toolkit/boost/math/special_functions/beta.hpp | 372 +++--
sandbox/math_toolkit/boost/math/special_functions/detail/ibeta_inverse.hpp | 82
sandbox/math_toolkit/boost/math/special_functions/detail/igamma_inverse.hpp | 33
sandbox/math_toolkit/boost/math/special_functions/detail/igamma_large.hpp | 190 +-
sandbox/math_toolkit/boost/math/special_functions/fpclassify.hpp | 4
sandbox/math_toolkit/boost/math/special_functions/gamma.hpp | 151 +
sandbox/math_toolkit/boost/math/special_functions/lanczos.hpp | 46
sandbox/math_toolkit/boost/math/tools/config.hpp | 42
sandbox/math_toolkit/boost/math/tools/rational.hpp | 116 -
sandbox/math_toolkit/boost/math/tools/remez.hpp | 8
sandbox/math_toolkit/boost/math/tools/roots.hpp | 84 +
sandbox/math_toolkit/libs/math/test/Jamfile.v2 | 3
sandbox/math_toolkit/libs/math/test/test_bessel_j.cpp | 2
sandbox/math_toolkit/libs/math/test/test_bessel_y.cpp | 25
sandbox/math_toolkit/libs/math/test/test_beta_dist.cpp | 10
sandbox/math_toolkit/libs/math/test/test_ibeta.cpp | 19
sandbox/math_toolkit/libs/math/test/test_ibeta_inv.cpp | 20
sandbox/math_toolkit/libs/math/test/test_laguerre.cpp | 14
sandbox/math_toolkit/libs/math/test/test_legendre.cpp | 60
sandbox/math_toolkit/libs/math/test/test_rationals.cpp | 2321 ---------------------------------------
sandbox/math_toolkit/libs/math/test/test_toms748_solve.cpp | 2
sandbox/math_toolkit/libs/math/tools/generate_rational_test.cpp | 186 ++
22 files changed, 954 insertions(+), 2836 deletions(-)
Modified: sandbox/math_toolkit/boost/math/special_functions/beta.hpp
==============================================================================
--- sandbox/math_toolkit/boost/math/special_functions/beta.hpp (original)
+++ sandbox/math_toolkit/boost/math/special_functions/beta.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -175,136 +175,6 @@
//
-// Series approximation to the incomplete beta:
-//
-template <class T>
-struct ibeta_series_t
-{
- typedef T result_type;
- ibeta_series_t(T a_, T b_, T x_, T mult) : result(mult), x(x_), apn(a_), poch(1-b_), n(1) {}
- T operator()()
- {
- T r = result / apn;
- apn += 1;
- result *= poch * x / n;
- ++n;
- poch += 1;
- return r;
- }
-private:
- T result, x, apn, poch;
- int n;
-};
-
-template <class T, class L>
-T ibeta_series(T a, T b, T x, T s0, const L&, bool normalised)
-{
- using namespace std;
-
- T result;
-
- if(normalised)
- {
- T prefix = 1;
- T c = a + b;
-
- // incomplete beta power term, combined with the Lanczos approximation:
- T agh = a + L::g() - T(0.5);
- T bgh = b + L::g() - T(0.5);
- T cgh = c + L::g() - T(0.5);
- result = L::lanczos_sum_expG_scaled(c) / (L::lanczos_sum_expG_scaled(a) * L::lanczos_sum_expG_scaled(b));
- if(a * b < bgh * 10)
- result *= exp((b - 0.5f) * boost::math::log1p(a / bgh));
- else
- result *= pow(cgh / bgh, b - 0.5f);
- result *= pow(x * cgh / agh, a);
- result *= sqrt(agh / boost::math::constants::e<T>());
- result *= prefix;
- }
- else
- {
- // Non-normalised, just compute the power:
- result = pow(x, a);
- }
- ibeta_series_t<T> s(a, b, x, result);
- boost::uintmax_t max_iter = BOOST_MATH_MAX_ITER;
- result = boost::math::tools::sum_series(s, boost::math::tools::digits<T>(), max_iter, s0);
- tools::check_series_iterations(BOOST_CURRENT_FUNCTION, max_iter);
- return result;
-}
-//
-// Incomplete Beta series again, this time without Lanczos support:
-//
-template <class T>
-T ibeta_series(T a, T b, T x, T s0, const boost::math::lanczos::undefined_lanczos&, bool normalised)
-{
- using namespace std;
-
- T result;
-
- if(normalised)
- {
- T prefix = 1;
- T c = a + b;
-
- // figure out integration limits for the gamma function:
- //T la = (std::max)(T(10), a);
- //T lb = (std::max)(T(10), b);
- //T lc = (std::max)(T(10), a+b);
- T la = a + 5;
- T lb = b + 5;
- T lc = a + b + 5;
-
- // calculate the gamma parts:
- T sa = detail::lower_gamma_series(a, la, ::boost::math::tools::digits<T>()) / a;
- sa += detail::upper_gamma_fraction(a, la, ::boost::math::tools::digits<T>());
- T sb = detail::lower_gamma_series(b, lb, ::boost::math::tools::digits<T>()) / b;
- sb += detail::upper_gamma_fraction(b, lb, ::boost::math::tools::digits<T>());
- T sc = detail::lower_gamma_series(c, lc, ::boost::math::tools::digits<T>()) / c;
- sc += detail::upper_gamma_fraction(c, lc, ::boost::math::tools::digits<T>());
-
- // and their combined power-terms:
- T b1 = (x * lc) / la;
- T b2 = lc/lb;
- T e1 = lc - la - lb;
- T lb1 = a * log(b1);
- T lb2 = b * log(b2);
-
- if((lb1 >= tools::log_max_value<T>())
- || (lb1 <= tools::log_min_value<T>())
- || (lb2 >= tools::log_max_value<T>())
- || (lb2 <= tools::log_min_value<T>())
- || (e1 >= tools::log_max_value<T>())
- || (e1 <= tools::log_min_value<T>()) )
- {
- T p = lb1 + lb2 - e1;
- result = exp(p);
- }
- else
- {
- result = pow(b1, a);
- if(a * b < lb * 10)
- result *= exp(b * boost::math::log1p(a / lb));
- else
- result *= pow(b2, b);
- result /= exp(e1);
- }
- // and combine the results:
- result /= sa * sb / sc;
- }
- else
- {
- // Non-normalised, just compute the power:
- result = pow(x, a);
- }
- ibeta_series_t<T> s(a, b, x, result);
- boost::uintmax_t max_iter = BOOST_MATH_MAX_ITER;
- result = boost::math::tools::sum_series(s, boost::math::tools::digits<T>(), max_iter, s0);
- tools::check_series_iterations(BOOST_CURRENT_FUNCTION, max_iter);
- return result;
-}
-
-//
// Compute the leading power terms in the incomplete Beta:
//
// (x^a)(y^b)/Beta(a,b) when normalised, and
@@ -543,6 +413,149 @@
return result;
}
//
+// Series approximation to the incomplete beta:
+//
+template <class T>
+struct ibeta_series_t
+{
+ typedef T result_type;
+ ibeta_series_t(T a_, T b_, T x_, T mult) : result(mult), x(x_), apn(a_), poch(1-b_), n(1) {}
+ T operator()()
+ {
+ T r = result / apn;
+ apn += 1;
+ result *= poch * x / n;
+ ++n;
+ poch += 1;
+ return r;
+ }
+private:
+ T result, x, apn, poch;
+ int n;
+};
+
+template <class T, class L>
+T ibeta_series(T a, T b, T x, T s0, const L&, bool normalised, T* p_derivative, T y)
+{
+ using namespace std;
+
+ T result;
+
+ BOOST_ASSERT((p_derivative == 0) || normalised);
+
+ if(normalised)
+ {
+ T c = a + b;
+
+ // incomplete beta power term, combined with the Lanczos approximation:
+ T agh = a + L::g() - T(0.5);
+ T bgh = b + L::g() - T(0.5);
+ T cgh = c + L::g() - T(0.5);
+ result = L::lanczos_sum_expG_scaled(c) / (L::lanczos_sum_expG_scaled(a) * L::lanczos_sum_expG_scaled(b));
+ if(a * b < bgh * 10)
+ result *= exp((b - 0.5f) * boost::math::log1p(a / bgh));
+ else
+ result *= pow(cgh / bgh, b - 0.5f);
+ result *= pow(x * cgh / agh, a);
+ result *= sqrt(agh / boost::math::constants::e<T>());
+
+ if(p_derivative)
+ {
+ *p_derivative = result * pow(y, b);
+ BOOST_ASSERT(*p_derivative >= 0);
+ }
+ }
+ else
+ {
+ // Non-normalised, just compute the power:
+ result = pow(x, a);
+ }
+ ibeta_series_t<T> s(a, b, x, result);
+ boost::uintmax_t max_iter = BOOST_MATH_MAX_ITER;
+ result = boost::math::tools::sum_series(s, boost::math::tools::digits<T>(), max_iter, s0);
+ tools::check_series_iterations(BOOST_CURRENT_FUNCTION, max_iter);
+ return result;
+}
+//
+// Incomplete Beta series again, this time without Lanczos support:
+//
+template <class T>
+T ibeta_series(T a, T b, T x, T s0, const boost::math::lanczos::undefined_lanczos&, bool normalised, T* p_derivative, T y)
+{
+ using namespace std;
+
+ T result;
+ BOOST_ASSERT((p_derivative == 0) || normalised);
+
+ if(normalised)
+ {
+ T prefix = 1;
+ T c = a + b;
+
+ // figure out integration limits for the gamma function:
+ //T la = (std::max)(T(10), a);
+ //T lb = (std::max)(T(10), b);
+ //T lc = (std::max)(T(10), a+b);
+ T la = a + 5;
+ T lb = b + 5;
+ T lc = a + b + 5;
+
+ // calculate the gamma parts:
+ T sa = detail::lower_gamma_series(a, la, ::boost::math::tools::digits<T>()) / a;
+ sa += detail::upper_gamma_fraction(a, la, ::boost::math::tools::digits<T>());
+ T sb = detail::lower_gamma_series(b, lb, ::boost::math::tools::digits<T>()) / b;
+ sb += detail::upper_gamma_fraction(b, lb, ::boost::math::tools::digits<T>());
+ T sc = detail::lower_gamma_series(c, lc, ::boost::math::tools::digits<T>()) / c;
+ sc += detail::upper_gamma_fraction(c, lc, ::boost::math::tools::digits<T>());
+
+ // and their combined power-terms:
+ T b1 = (x * lc) / la;
+ T b2 = lc/lb;
+ T e1 = lc - la - lb;
+ T lb1 = a * log(b1);
+ T lb2 = b * log(b2);
+
+ if((lb1 >= tools::log_max_value<T>())
+ || (lb1 <= tools::log_min_value<T>())
+ || (lb2 >= tools::log_max_value<T>())
+ || (lb2 <= tools::log_min_value<T>())
+ || (e1 >= tools::log_max_value<T>())
+ || (e1 <= tools::log_min_value<T>()) )
+ {
+ T p = lb1 + lb2 - e1;
+ result = exp(p);
+ }
+ else
+ {
+ result = pow(b1, a);
+ if(a * b < lb * 10)
+ result *= exp(b * boost::math::log1p(a / lb));
+ else
+ result *= pow(b2, b);
+ result /= exp(e1);
+ }
+ // and combine the results:
+ result /= sa * sb / sc;
+
+ if(p_derivative)
+ {
+ *p_derivative = result * pow(y, b);
+ BOOST_ASSERT(*p_derivative >= 0);
+ }
+ }
+ else
+ {
+ // Non-normalised, just compute the power:
+ result = pow(x, a);
+ }
+ ibeta_series_t<T> s(a, b, x, result);
+ boost::uintmax_t max_iter = BOOST_MATH_MAX_ITER;
+ result = boost::math::tools::sum_series(s, boost::math::tools::digits<T>(), max_iter, s0);
+ tools::check_series_iterations(BOOST_CURRENT_FUNCTION, max_iter);
+ return result;
+}
+
+//
// Continued fraction for the incomplete beta:
//
template <class T>
@@ -575,10 +588,15 @@
// Evaluate the incomplete beta via the continued fraction representation:
//
template <class T, class L>
-T ibeta_fraction2(T a, T b, T x, T y, const L& l, bool normalised)
+T ibeta_fraction2(T a, T b, T x, T y, const L& l, bool normalised, T* p_derivative)
{
using namespace std;
T result = ibeta_power_terms(a, b, x, y, l, normalised);
+ if(p_derivative)
+ {
+ *p_derivative = result;
+ BOOST_ASSERT(*p_derivative >= 0);
+ }
if(result == 0)
return result;
@@ -590,9 +608,15 @@
// Computes the difference between ibeta(a,b,x) and ibeta(a+k,b,x):
//
template <class T, class L>
-T ibeta_a_step(T a, T b, T x, T y, int k, const L& l, bool normalised)
+T ibeta_a_step(T a, T b, T x, T y, int k, const L& l, bool normalised, T* p_derivative)
{
- T prefix = ibeta_power_terms(a, b, x, y, l, normalised)/a;
+ T prefix = ibeta_power_terms(a, b, x, y, l, normalised);
+ if(p_derivative)
+ {
+ *p_derivative = prefix;
+ BOOST_ASSERT(*p_derivative >= 0);
+ }
+ prefix /= a;
if(prefix == 0)
return prefix;
T sum = 1;
@@ -800,7 +824,7 @@
// each domain:
//
template <class T, class L>
-T ibeta_imp(T a, T b, T x, const L& l, bool inv, bool normalised)
+T ibeta_imp(T a, T b, T x, const L& l, bool inv, bool normalised, T* p_derivative)
{
using namespace std; // for ADL of std math functions.
@@ -808,6 +832,11 @@
T fract;
T y = 1 - x;
+ BOOST_ASSERT((p_derivative == 0) || normalised);
+
+ if(p_derivative)
+ *p_derivative = -1; // value not set.
+
if(normalised)
{
// extend to a few very special cases:
@@ -825,9 +854,21 @@
tools::domain_error<T>(BOOST_CURRENT_FUNCTION, "Parameter x outside the range [0,1] in the incomplete beta function (got x=%1%).", x);
if(x == 0)
+ {
+ if(p_derivative)
+ {
+ *p_derivative = (a == 1) ? 1 : (a < 1) ? tools::max_value<T>() / 2 : tools::min_value<T>() * 2;
+ }
return (invert ? (normalised ? 1 : beta_imp(a, b, l)) : 0);
+ }
if(x == 1)
+ {
+ if(p_derivative)
+ {
+ *p_derivative = (b == 1) ? 1 : (b < 1) ? tools::max_value<T>() / 2 : tools::min_value<T>() * 2;
+ }
return (invert == 0 ? (normalised ? 1 : beta_imp(a, b, l)) : 0);
+ }
if((std::min)(a, b) <= 1)
{
@@ -843,12 +884,12 @@
if((a >= (std::min)(T(0.2), b)) || (pow(x, a) <= 0.9))
{
if(!invert)
- fract = ibeta_series(a, b, x, T(0), l, normalised);
+ fract = ibeta_series(a, b, x, T(0), l, normalised, p_derivative, y);
else
{
fract = -(normalised ? 1 : beta_imp(a, b, l));
invert = false;
- fract = -ibeta_series(a, b, x, fract, l, normalised);
+ fract = -ibeta_series(a, b, x, fract, l, normalised, p_derivative, y);
}
}
else
@@ -859,12 +900,12 @@
if(y >= 0.3)
{
if(!invert)
- fract = ibeta_series(a, b, x, T(0), l, normalised);
+ fract = ibeta_series(a, b, x, T(0), l, normalised, p_derivative, y);
else
{
fract = -(normalised ? 1 : beta_imp(a, b, l));
invert = false;
- fract = -ibeta_series(a, b, x, fract, l, normalised);
+ fract = -ibeta_series(a, b, x, fract, l, normalised, p_derivative, y);
}
}
else
@@ -879,7 +920,7 @@
{
prefix = 1;
}
- fract = ibeta_a_step(a, b, x, y, 20, l, normalised);
+ fract = ibeta_a_step(a, b, x, y, 20, l, normalised, p_derivative);
if(!invert)
fract = beta_small_b_large_a_series(a + 20, b, x, y, fract, prefix, l, normalised);
else
@@ -897,12 +938,12 @@
if((b <= 1) || ((x < 0.1) && (pow(b * x, a) <= 0.7)))
{
if(!invert)
- fract = ibeta_series(a, b, x, T(0), l, normalised);
+ fract = ibeta_series(a, b, x, T(0), l, normalised, p_derivative, y);
else
{
fract = -(normalised ? 1 : beta_imp(a, b, l));
invert = false;
- fract = -ibeta_series(a, b, x, fract, l, normalised);
+ fract = -ibeta_series(a, b, x, fract, l, normalised, p_derivative, y);
}
}
else
@@ -914,12 +955,12 @@
if(y >= 0.3)
{
if(!invert)
- fract = ibeta_series(a, b, x, T(0), l, normalised);
+ fract = ibeta_series(a, b, x, T(0), l, normalised, p_derivative, y);
else
{
fract = -(normalised ? 1 : beta_imp(a, b, l));
invert = false;
- fract = -ibeta_series(a, b, x, fract, l, normalised);
+ fract = -ibeta_series(a, b, x, fract, l, normalised, p_derivative, y);
}
}
else if(a >= 15)
@@ -945,7 +986,7 @@
{
prefix = 1;
}
- fract = ibeta_a_step(a, b, x, y, 20, l, normalised);
+ fract = ibeta_a_step(a, b, x, y, 20, l, normalised, p_derivative);
if(!invert)
fract = beta_small_b_large_a_series(a + 20, b, x, y, fract, prefix, l, normalised);
else
@@ -991,12 +1032,12 @@
else if(b * x <= 0.7)
{
if(!invert)
- fract = ibeta_series(a, b, x, T(0), l, normalised);
+ fract = ibeta_series(a, b, x, T(0), l, normalised, p_derivative, y);
else
{
fract = -(normalised ? 1 : beta_imp(a, b, l));
invert = false;
- fract = -ibeta_series(a, b, x, fract, l, normalised);
+ fract = -ibeta_series(a, b, x, fract, l, normalised, p_derivative, y);
}
}
else if(a > 15)
@@ -1015,7 +1056,7 @@
{
prefix = 1;
}
- fract = ibeta_a_step(bbar, a, y, x, n, l, normalised);
+ fract = ibeta_a_step(bbar, a, y, x, n, l, normalised, static_cast<T*>(0));
fract = beta_small_b_large_a_series(a, bbar, x, y, fract, T(1), l, normalised);
fract /= prefix;
}
@@ -1031,11 +1072,11 @@
--n;
bbar += 1;
}
- fract = ibeta_a_step(bbar, a, y, x, n, l, normalised);
- fract += ibeta_a_step(a, bbar, x, y, 20, l, normalised);
+ fract = ibeta_a_step(bbar, a, y, x, n, l, normalised, static_cast<T*>(0));
+ fract += ibeta_a_step(a, bbar, x, y, 20, l, normalised, static_cast<T*>(0));
if(invert)
fract -= (normalised ? 1 : beta_imp(a, b, l));
- //fract = ibeta_series(a+20, bbar, x, fract, l, normalised);
+ //fract = ibeta_series(a+20, bbar, x, fract, l, normalised, p_derivative, y);
fract = beta_small_b_large_a_series(a+20, bbar, x, y, fract, T(1), l, normalised);
if(invert)
{
@@ -1044,15 +1085,42 @@
}
}
else
- fract = ibeta_fraction2(a, b, x, y, l, normalised);
+ fract = ibeta_fraction2(a, b, x, y, l, normalised, p_derivative);
}
else
- fract = ibeta_fraction2(a, b, x, y, l, normalised);
+ fract = ibeta_fraction2(a, b, x, y, l, normalised, p_derivative);
+ }
+ if(p_derivative)
+ {
+ if(*p_derivative < 0)
+ {
+ *p_derivative = ibeta_power_terms(a, b, x, y, l, true);
+ }
+ T div = y * x;
+
+ if(*p_derivative != 0)
+ {
+ if((tools::max_value<T>() * div < *p_derivative))
+ {
+ // overflow, return an arbitarily large value:
+ *p_derivative = tools::max_value<T>() / 2;
+ }
+ else
+ {
+ *p_derivative /= div;
+ }
+ }
}
return invert ? (normalised ? 1 : beta_imp(a, b, l)) - fract : fract;
} // template <class T, class L>T ibeta_imp(T a, T b, T x, const L& l, bool inv, bool normalised)
template <class T, class L>
+inline T ibeta_imp(T a, T b, T x, const L& l, bool inv, bool normalised)
+{
+ return ibeta_imp(a, b, x, l, inv, normalised, static_cast<T*>(0));
+}
+
+template <class T, class L>
T ibeta_derivative_imp(T a, T b, T x, const L& l)
{
//
Modified: sandbox/math_toolkit/boost/math/special_functions/detail/ibeta_inverse.hpp
==============================================================================
--- sandbox/math_toolkit/boost/math/special_functions/detail/ibeta_inverse.hpp (original)
+++ sandbox/math_toolkit/boost/math/special_functions/detail/ibeta_inverse.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -166,35 +166,35 @@
// Calculate e1 and put it in terms[1], see the middle of page 151:
//
workspace[0] = (2 * s * s - 1) / (3 * s * c);
- static const int co1[] = { -1, -5, 5 };
+ static const BOOST_MATH_INT_TABLE_TYPE(T, int) co1[] = { -1, -5, 5 };
workspace[1] = -tools::evaluate_even_polynomial(co1, s, 3) / (36 * sc_2);
- static const int co2[] = { 1, 21, -69, 46 };
+ static const BOOST_MATH_INT_TABLE_TYPE(T, int) co2[] = { 1, 21, -69, 46 };
workspace[2] = tools::evaluate_even_polynomial(co2, s, 4) / (1620 * sc_3);
- static const int co3[] = { 7, -2, 33, -62, 31 };
+ static const BOOST_MATH_INT_TABLE_TYPE(T, int) co3[] = { 7, -2, 33, -62, 31 };
workspace[3] = -tools::evaluate_even_polynomial(co3, s, 5) / (6480 * sc_4);
- static const int co4[] = { 25, -52, -17, 88, -115, 46 };
+ static const BOOST_MATH_INT_TABLE_TYPE(T, int) co4[] = { 25, -52, -17, 88, -115, 46 };
workspace[4] = tools::evaluate_even_polynomial(co4, s, 6) / (90720 * sc_5);
terms[1] = tools::evaluate_polynomial(workspace, eta0, 5);
//
// Now evaluate e2 and put it in terms[2]:
//
- static const int co5[] = { 7, 12, -78, 52 };
+ static const BOOST_MATH_INT_TABLE_TYPE(T, int) co5[] = { 7, 12, -78, 52 };
workspace[0] = -tools::evaluate_even_polynomial(co5, s, 4) / (405 * sc_3);
- static const int co6[] = { -7, 2, 183, -370, 185 };
+ static const BOOST_MATH_INT_TABLE_TYPE(T, int) co6[] = { -7, 2, 183, -370, 185 };
workspace[1] = tools::evaluate_even_polynomial(co6, s, 5) / (2592 * sc_4);
- static const int co7[] = { -533, 776, -1835, 10240, -13525, 5410 };
+ static const BOOST_MATH_INT_TABLE_TYPE(T, int) co7[] = { -533, 776, -1835, 10240, -13525, 5410 };
workspace[2] = -tools::evaluate_even_polynomial(co7, s, 6) / (204120 * sc_5);
- static const int co8[] = { -1579, 3747, -3372, -15821, 45588, -45213, 15071 };
+ static const BOOST_MATH_INT_TABLE_TYPE(T, int) co8[] = { -1579, 3747, -3372, -15821, 45588, -45213, 15071 };
workspace[3] = -tools::evaluate_even_polynomial(co8, s, 7) / (2099520 * sc_6);
terms[2] = tools::evaluate_polynomial(workspace, eta0, 4);
//
// And e3, and put it in terms[3]:
//
- static const int co9[] = {449, -1259, -769, 6686, -9260, 3704 };
+ static const BOOST_MATH_INT_TABLE_TYPE(T, int) co9[] = {449, -1259, -769, 6686, -9260, 3704 };
workspace[0] = tools::evaluate_even_polynomial(co9, s, 6) / (102060 * sc_5);
- static const int co10[] = { 63149, -151557, 140052, -727469, 2239932, -2251437, 750479 };
+ static const BOOST_MATH_INT_TABLE_TYPE(T, int) co10[] = { 63149, -151557, 140052, -727469, 2239932, -2251437, 750479 };
workspace[1] = -tools::evaluate_even_polynomial(co10, s, 7) / (20995200 * sc_6);
- static const int co11[] = { 29233, -78755, 105222, 146879, -1602610, 3195183, -2554139, 729754 };
+ static const BOOST_MATH_INT_TABLE_TYPE(T, int) co11[] = { 29233, -78755, 105222, 146879, -1602610, 3195183, -2554139, 729754 };
workspace[2] = tools::evaluate_even_polynomial(co11, s, 8) / (36741600 * sc_7);
terms[3] = tools::evaluate_polynomial(workspace, eta0, 3);
//
@@ -228,9 +228,9 @@
workspace[0] = s * s;
workspace[1] = s * c;
workspace[2] = (1 - 2 * workspace[0]) / 3;
- static const int co3[] = { 1, -13, 13 };
+ static const BOOST_MATH_INT_TABLE_TYPE(T, int) co3[] = { 1, -13, 13 };
workspace[3] = tools::evaluate_polynomial(co3, workspace[0], 3) / (36 * s * c);
- static const int co4[] = { 1, 21, -69, 46 };
+ static const BOOST_MATH_INT_TABLE_TYPE(T, int) co4[] = { 1, 21, -69, 46 };
workspace[4] = tools::evaluate_polynomial(co4, workspace[0], 4) / (270 * workspace[0] * c * c);
x = tools::evaluate_polynomial(workspace, eta, 5);
#ifdef BOOST_INSTRUMENT
@@ -415,16 +415,17 @@
using namespace std; // ADL of std names
BOOST_FPU_EXCEPTION_GUARD
- T f = ibeta_imp(a, b, x, L(), invert, true) - target;
- T f1 = invert ?
- -ibeta_power_terms(b, a, 1 - x, x, L(), true)
- : ibeta_power_terms(a, b, x, 1 - x, L(), true);
+
+ T f1;
T y = 1 - x;
+ T f = ibeta_imp(a, b, x, L(), invert, true, &f1) - target;
+ if(invert)
+ f1 = -f1;
if(y == 0)
y = tools::min_value<T>() * 64;
if(x == 0)
x = tools::min_value<T>() * 64;
- f1 /= y * x;
+
T f2 = f1 * (-y * a + (b - 2) * x + 1);
if(fabs(f2) < y * x * tools::max_value<T>())
f2 /= (y * x);
@@ -551,19 +552,23 @@
std::swap(p, q);
invert = !invert;
}
- T qpb = pow(q, 1/b);
- if(qpb > 1e-3)
+ //
+ // Try and compute the easy way first:
+ //
+ T bet = 0;
+ if(b < 2)
+ bet = boost::math::beta(a, b);
+ if(bet != 0)
{
- x = temme_method_3_ibeta_inverse(a, b, p, q);
- y = 1 - x;
+ y = pow(b * q * bet, 1/b);
+ x = 1 - y;
}
- else
+ else
+ y = 1;
+ if(y > 1e-5)
{
- if(qpb < tools::min_value<T>())
- y = pow(b * q * boost::math::beta(a, b), 1/b);
- else
- y = qpb * pow(b * boost::math::beta(a, b), 1/b);
- x = 1 - y;
+ x = temme_method_3_ibeta_inverse(a, b, p, q);
+ y = 1 - x;
}
}
}
@@ -580,8 +585,12 @@
// right side of the inflection point:
//
T fs = boost::math::ibeta(a, b, xs) - p;
- if(fs == 0)
+ if(fabs(fs) / p < tools::epsilon<T>() * 3)
+ {
+ // The result is at the point of inflection, best just return it:
+ *py = invert ? xs : 1 - xs;
return invert ? 1-xs : xs;
+ }
if(fs < 0)
{
std::swap(a, b);
@@ -699,15 +708,6 @@
y = boost::math::tools::min_value<T>();
x = 1 - y;
}
- /*
- // heavyweight solution that appears to be no longer required...?
- else
- {
- y = temme_method_3_ibeta_inverse(b, a, q, p);
- if(y == 0)
- y = boost::math::tools::min_value<T>();
- x = 1 - y;
- }*/
}
//
@@ -800,11 +800,11 @@
typedef typename lanczos::lanczos_traits<result_type>::evaluation_type evaluation_type;
if(a <= 0)
- tools::domain_error<result_type>(BOOST_CURRENT_FUNCTION, "The argument a to the incomplete beta function inverse must be greater than zero (got a=%1%).", a);
+ return tools::domain_error<result_type>(BOOST_CURRENT_FUNCTION, "The argument a to the incomplete beta function inverse must be greater than zero (got a=%1%).", a);
if(b <= 0)
- tools::domain_error<result_type>(BOOST_CURRENT_FUNCTION, "The argument b to the incomplete beta function inverse must be greater than zero (got b=%1%).", b);
+ return tools::domain_error<result_type>(BOOST_CURRENT_FUNCTION, "The argument b to the incomplete beta function inverse must be greater than zero (got b=%1%).", b);
if((p < 0) || (p > 1))
- tools::domain_error<result_type>(BOOST_CURRENT_FUNCTION, "Argument p outside the range [0,1] in the incomplete beta function inverse (got p=%1%).", p);
+ return tools::domain_error<result_type>(BOOST_CURRENT_FUNCTION, "Argument p outside the range [0,1] in the incomplete beta function inverse (got p=%1%).", p);
value_type rx, ry;
Modified: sandbox/math_toolkit/boost/math/special_functions/detail/igamma_inverse.hpp
==============================================================================
--- sandbox/math_toolkit/boost/math/special_functions/detail/igamma_inverse.hpp (original)
+++ sandbox/math_toolkit/boost/math/special_functions/detail/igamma_inverse.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -297,30 +297,27 @@
using namespace std; // For ADL of std functions.
- T f = !invert ? boost::math::gamma_p(a, x) : boost::math::gamma_q(a, x);
- T f1 = static_cast<T>(boost::math::detail::regularised_gamma_prefix(value_type(a), value_type(x), evaluation_type()));
+ T f, f1;
+ value_type ft;
+ f = static_cast<T>(boost::math::detail::gamma_incomplete_imp(
+ static_cast<value_type>(a),
+ static_cast<value_type>(x),
+ true, invert, evaluation_type(),
+ &ft));
+ f1 = static_cast<T>(ft);
T f2;
- if((x < 1) && (tools::max_value<T>() * x < fabs(f1)))
+ T div = (a - x - 1) / x;
+ f2 = f1;
+ if((fabs(div) > 1) && (tools::max_value<T>() / fabs(div) < f2))
{
// overflow:
- f1 = tools::max_value<T>() / 2;
- f2 = -f1;
+ f2 = -tools::max_value<T>() / 2;
}
else
{
- f1 /= x;
- T div = (a - x - 1) / x;
- f2 = f1;
- if((fabs(div) > 1) && (tools::max_value<T>() / fabs(div) < f2))
- {
- // overflow:
- f2 = -tools::max_value<T>() / 2;
- }
- else
- {
- f2 *= div;
- }
+ f2 *= div;
}
+
if(invert)
{
f1 = -f1;
@@ -359,7 +356,7 @@
//
unsigned digits = (tools::digits<T>() * 2) / 3;
if((a < 0.125) && (fabs(gamma_p_derivative(a, guess)) > 1 / sqrt(tools::epsilon<T>())))
- digits = tools::digits<T>();
+ digits = tools::digits<T>() - 2;
//
// Go ahead and iterate:
//
Modified: sandbox/math_toolkit/boost/math/special_functions/detail/igamma_large.hpp
==============================================================================
--- sandbox/math_toolkit/boost/math/special_functions/detail/igamma_large.hpp (original)
+++ sandbox/math_toolkit/boost/math/special_functions/detail/igamma_large.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -286,120 +286,120 @@
T workspace[10];
static const T C0[] = {
- -0.33333333333333333L,
- 0.083333333333333333L,
- -0.014814814814814815L,
- 0.0011574074074074074L,
- 0.0003527336860670194L,
- -0.00017875514403292181L,
- 0.39192631785224378e-4L,
- -0.21854485106799922e-5L,
- -0.185406221071516e-5L,
- 0.8296711340953086e-6L,
- -0.17665952736826079e-6L,
- 0.67078535434014986e-8L,
- 0.10261809784240308e-7L,
- -0.43820360184533532e-8L,
- 0.91476995822367902e-9L,
+ static_cast<T>(-0.33333333333333333L),
+ static_cast<T>(0.083333333333333333L),
+ static_cast<T>(-0.014814814814814815L),
+ static_cast<T>(0.0011574074074074074L),
+ static_cast<T>(0.0003527336860670194L),
+ static_cast<T>(-0.00017875514403292181L),
+ static_cast<T>(0.39192631785224378e-4L),
+ static_cast<T>(-0.21854485106799922e-5L),
+ static_cast<T>(-0.185406221071516e-5L),
+ static_cast<T>(0.8296711340953086e-6L),
+ static_cast<T>(-0.17665952736826079e-6L),
+ static_cast<T>(0.67078535434014986e-8L),
+ static_cast<T>(0.10261809784240308e-7L),
+ static_cast<T>(-0.43820360184533532e-8L),
+ static_cast<T>(0.91476995822367902e-9L),
};
workspace[0] = tools::evaluate_polynomial(C0, z);
static const T C1[] = {
- -0.0018518518518518519L,
- -0.0034722222222222222L,
- 0.0026455026455026455L,
- -0.00099022633744855967L,
- 0.00020576131687242798L,
- -0.40187757201646091e-6L,
- -0.18098550334489978e-4L,
- 0.76491609160811101e-5L,
- -0.16120900894563446e-5L,
- 0.46471278028074343e-8L,
- 0.1378633446915721e-6L,
- -0.5752545603517705e-7L,
- 0.11951628599778147e-7L,
+ static_cast<T>(-0.0018518518518518519L),
+ static_cast<T>(-0.0034722222222222222L),
+ static_cast<T>(0.0026455026455026455L),
+ static_cast<T>(-0.00099022633744855967L),
+ static_cast<T>(0.00020576131687242798L),
+ static_cast<T>(-0.40187757201646091e-6L),
+ static_cast<T>(-0.18098550334489978e-4L),
+ static_cast<T>(0.76491609160811101e-5L),
+ static_cast<T>(-0.16120900894563446e-5L),
+ static_cast<T>(0.46471278028074343e-8L),
+ static_cast<T>(0.1378633446915721e-6L),
+ static_cast<T>(-0.5752545603517705e-7L),
+ static_cast<T>(0.11951628599778147e-7L),
};
workspace[1] = tools::evaluate_polynomial(C1, z);
static const T C2[] = {
- 0.0041335978835978836L,
- -0.0026813271604938272L,
- 0.00077160493827160494L,
- 0.20093878600823045e-5L,
- -0.00010736653226365161L,
- 0.52923448829120125e-4L,
- -0.12760635188618728e-4L,
- 0.34235787340961381e-7L,
- 0.13721957309062933e-5L,
- -0.6298992138380055e-6L,
- 0.14280614206064242e-6L,
+ static_cast<T>(0.0041335978835978836L),
+ static_cast<T>(-0.0026813271604938272L),
+ static_cast<T>(0.00077160493827160494L),
+ static_cast<T>(0.20093878600823045e-5L),
+ static_cast<T>(-0.00010736653226365161L),
+ static_cast<T>(0.52923448829120125e-4L),
+ static_cast<T>(-0.12760635188618728e-4L),
+ static_cast<T>(0.34235787340961381e-7L),
+ static_cast<T>(0.13721957309062933e-5L),
+ static_cast<T>(-0.6298992138380055e-6L),
+ static_cast<T>(0.14280614206064242e-6L),
};
workspace[2] = tools::evaluate_polynomial(C2, z);
static const T C3[] = {
- 0.00064943415637860082L,
- 0.00022947209362139918L,
- -0.00046918949439525571L,
- 0.00026772063206283885L,
- -0.75618016718839764e-4L,
- -0.23965051138672967e-6L,
- 0.11082654115347302e-4L,
- -0.56749528269915966e-5L,
- 0.14230900732435884e-5L,
+ static_cast<T>(0.00064943415637860082L),
+ static_cast<T>(0.00022947209362139918L),
+ static_cast<T>(-0.00046918949439525571L),
+ static_cast<T>(0.00026772063206283885L),
+ static_cast<T>(-0.75618016718839764e-4L),
+ static_cast<T>(-0.23965051138672967e-6L),
+ static_cast<T>(0.11082654115347302e-4L),
+ static_cast<T>(-0.56749528269915966e-5L),
+ static_cast<T>(0.14230900732435884e-5L),
};
workspace[3] = tools::evaluate_polynomial(C3, z);
static const T C4[] = {
- -0.0008618882909167117L,
- 0.00078403922172006663L,
- -0.00029907248030319018L,
- -0.14638452578843418e-5L,
- 0.66414982154651222e-4L,
- -0.39683650471794347e-4L,
- 0.11375726970678419e-4L,
+ static_cast<T>(-0.0008618882909167117L),
+ static_cast<T>(0.00078403922172006663L),
+ static_cast<T>(-0.00029907248030319018L),
+ static_cast<T>(-0.14638452578843418e-5L),
+ static_cast<T>(0.66414982154651222e-4L),
+ static_cast<T>(-0.39683650471794347e-4L),
+ static_cast<T>(0.11375726970678419e-4L),
};
workspace[4] = tools::evaluate_polynomial(C4, z);
static const T C5[] = {
- -0.00033679855336635815L,
- -0.69728137583658578e-4L,
- 0.00027727532449593921L,
- -0.00019932570516188848L,
- 0.67977804779372078e-4L,
- 0.1419062920643967e-6L,
- -0.13594048189768693e-4L,
- 0.80184702563342015e-5L,
- -0.22914811765080952e-5L,
+ static_cast<T>(-0.00033679855336635815L),
+ static_cast<T>(-0.69728137583658578e-4L),
+ static_cast<T>(0.00027727532449593921L),
+ static_cast<T>(-0.00019932570516188848L),
+ static_cast<T>(0.67977804779372078e-4L),
+ static_cast<T>(0.1419062920643967e-6L),
+ static_cast<T>(-0.13594048189768693e-4L),
+ static_cast<T>(0.80184702563342015e-5L),
+ static_cast<T>(-0.22914811765080952e-5L),
};
workspace[5] = tools::evaluate_polynomial(C5, z);
static const T C6[] = {
- 0.00053130793646399222L,
- -0.00059216643735369388L,
- 0.00027087820967180448L,
- 0.79023532326603279e-6L,
- -0.81539693675619688e-4L,
- 0.56116827531062497e-4L,
- -0.18329116582843376e-4L,
+ static_cast<T>(0.00053130793646399222L),
+ static_cast<T>(-0.00059216643735369388L),
+ static_cast<T>(0.00027087820967180448L),
+ static_cast<T>(0.79023532326603279e-6L),
+ static_cast<T>(-0.81539693675619688e-4L),
+ static_cast<T>(0.56116827531062497e-4L),
+ static_cast<T>(-0.18329116582843376e-4L),
};
workspace[6] = tools::evaluate_polynomial(C6, z);
static const T C7[] = {
- 0.00034436760689237767L,
- 0.51717909082605922e-4L,
- -0.00033493161081142236L,
- 0.0002812695154763237L,
- -0.00010976582244684731L,
+ static_cast<T>(0.00034436760689237767L),
+ static_cast<T>(0.51717909082605922e-4L),
+ static_cast<T>(-0.00033493161081142236L),
+ static_cast<T>(0.0002812695154763237L),
+ static_cast<T>(-0.00010976582244684731L),
};
workspace[7] = tools::evaluate_polynomial(C7, z);
static const T C8[] = {
- -0.00065262391859530942L,
- 0.00083949872067208728L,
- -0.00043829709854172101L,
+ static_cast<T>(-0.00065262391859530942L),
+ static_cast<T>(0.00083949872067208728L),
+ static_cast<T>(-0.00043829709854172101L),
};
workspace[8] = tools::evaluate_polynomial(C8, z);
- workspace[9] = -0.00059676129019274625L;
+ workspace[9] = static_cast<T>(-0.00059676129019274625L);
T result = tools::evaluate_polynomial(workspace, 1/a);
result *= exp(-y) / sqrt(2 * constants::pi<T>() * a);
@@ -428,29 +428,29 @@
T workspace[3];
static const T C0[] = {
- -0.333333333L,
- 0.0833333333L,
- -0.0148148148L,
- 0.00115740741L,
- 0.000352733686L,
- -0.000178755144L,
- 0.391926318e-4L,
+ static_cast<T>(-0.333333333L),
+ static_cast<T>(0.0833333333L),
+ static_cast<T>(-0.0148148148L),
+ static_cast<T>(0.00115740741L),
+ static_cast<T>(0.000352733686L),
+ static_cast<T>(-0.000178755144L),
+ static_cast<T>(0.391926318e-4L),
};
workspace[0] = tools::evaluate_polynomial(C0, z);
static const T C1[] = {
- -0.00185185185L,
- -0.00347222222L,
- 0.00264550265L,
- -0.000990226337L,
- 0.000205761317L,
+ static_cast<T>(-0.00185185185L),
+ static_cast<T>(-0.00347222222L),
+ static_cast<T>(0.00264550265L),
+ static_cast<T>(-0.000990226337L),
+ static_cast<T>(0.000205761317L),
};
workspace[1] = tools::evaluate_polynomial(C1, z);
static const T C2[] = {
- 0.00413359788L,
- -0.00268132716L,
- 0.000771604938L,
+ static_cast<T>(0.00413359788L),
+ static_cast<T>(-0.00268132716L),
+ static_cast<T>(0.000771604938L),
};
workspace[2] = tools::evaluate_polynomial(C2, z);
Modified: sandbox/math_toolkit/boost/math/special_functions/fpclassify.hpp
==============================================================================
--- sandbox/math_toolkit/boost/math/special_functions/fpclassify.hpp (original)
+++ sandbox/math_toolkit/boost/math/special_functions/fpclassify.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -46,6 +46,10 @@
# define BOOST_FPCLASSIFY_PREFIX
#endif
+#ifdef __MINGW32__
+# undef BOOST_HAS_FPCLASSIFY
+#endif
+
#endif
namespace boost{ namespace math{
Modified: sandbox/math_toolkit/boost/math/special_functions/gamma.hpp
==============================================================================
--- sandbox/math_toolkit/boost/math/special_functions/gamma.hpp (original)
+++ sandbox/math_toolkit/boost/math/special_functions/gamma.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -158,7 +158,7 @@
if(z * log(z) > tools::log_max_value<T>())
{
// we're going to overflow unless this is done with care:
- T zgh = (z + L::g() - boost::math::constants::half<T>());
+ T zgh = (z + static_cast<T>(L::g()) - boost::math::constants::half<T>());
if(log(zgh) * z / 2 > tools::log_max_value<T>())
return tools::overflow_error<T>(BOOST_CURRENT_FUNCTION, "Result of tgamma is too large to represent.");
T hp = pow(zgh, (z / 2) - T(0.25));
@@ -169,7 +169,7 @@
}
else
{
- T zgh = (z + L::g() - boost::math::constants::half<T>());
+ T zgh = (z + static_cast<T>(L::g()) - boost::math::constants::half<T>());
result *= pow(zgh, z - boost::math::constants::half<T>()) / exp(zgh);
}
}
@@ -231,23 +231,23 @@
// Maximum Deviation Found (approximation error): 5.900e-24
//
static const T P[] = {
- -0.180355685678449379109e-1L,
- 0.25126649619989678683e-1L,
- 0.494103151567532234274e-1L,
- 0.172491608709613993966e-1L,
- -0.259453563205438108893e-3L,
- -0.541009869215204396339e-3L,
- -0.324588649825948492091e-4L
+ static_cast<T>(-0.180355685678449379109e-1L),
+ static_cast<T>(0.25126649619989678683e-1L),
+ static_cast<T>(0.494103151567532234274e-1L),
+ static_cast<T>(0.172491608709613993966e-1L),
+ static_cast<T>(-0.259453563205438108893e-3L),
+ static_cast<T>(-0.541009869215204396339e-3L),
+ static_cast<T>(-0.324588649825948492091e-4L)
};
static const T Q[] = {
- 0.1e1,
- 0.196202987197795200688e1L,
- 0.148019669424231326694e1L,
- 0.541391432071720958364e0L,
- 0.988504251128010129477e-1L,
- 0.82130967464889339326e-2L,
- 0.224936291922115757597e-3L,
- -0.223352763208617092964e-6L
+ static_cast<T>(0.1e1),
+ static_cast<T>(0.196202987197795200688e1L),
+ static_cast<T>(0.148019669424231326694e1L),
+ static_cast<T>(0.541391432071720958364e0L),
+ static_cast<T>(0.988504251128010129477e-1L),
+ static_cast<T>(0.82130967464889339326e-2L),
+ static_cast<T>(0.224936291922115757597e-3L),
+ static_cast<T>(-0.223352763208617092964e-6L)
};
static const float Y = 0.158963680267333984375e0f;
@@ -298,22 +298,22 @@
static const float Y = 0.52815341949462890625f;
static const T P[] = {
- 0.490622454069039543534e-1L,
- -0.969117530159521214579e-1L,
- -0.414983358359495381969e0L,
- -0.406567124211938417342e0L,
- -0.158413586390692192217e0L,
- -0.240149820648571559892e-1L,
- -0.100346687696279557415e-2L
+ static_cast<T>(0.490622454069039543534e-1L),
+ static_cast<T>(-0.969117530159521214579e-1L),
+ static_cast<T>(-0.414983358359495381969e0L),
+ static_cast<T>(-0.406567124211938417342e0L),
+ static_cast<T>(-0.158413586390692192217e0L),
+ static_cast<T>(-0.240149820648571559892e-1L),
+ static_cast<T>(-0.100346687696279557415e-2L)
};
static const T Q[] = {
- 0.1e1L,
- 0.302349829846463038743e1L,
- 0.348739585360723852576e1L,
- 0.191415588274426679201e1L,
- 0.507137738614363510846e0L,
- 0.577039722690451849648e-1L,
- 0.195768102601107189171e-2L
+ static_cast<T>(0.1e1L),
+ static_cast<T>(0.302349829846463038743e1L),
+ static_cast<T>(0.348739585360723852576e1L),
+ static_cast<T>(0.191415588274426679201e1L),
+ static_cast<T>(0.507137738614363510846e0L),
+ static_cast<T>(0.577039722690451849648e-1L),
+ static_cast<T>(0.195768102601107189171e-2L)
};
T r = tools::evaluate_polynomial(P, zm1) / tools::evaluate_polynomial(Q, zm1);
@@ -343,21 +343,21 @@
static const float Y = 0.452017307281494140625f;
static const T P[] = {
- -0.292329721830270012337e-1L,
- 0.144216267757192309184e0L,
- -0.142440390738631274135e0L,
- 0.542809694055053558157e-1L,
- -0.850535976868336437746e-2L,
- 0.431171342679297331241e-3L
+ static_cast<T>(-0.292329721830270012337e-1L),
+ static_cast<T>(0.144216267757192309184e0L),
+ static_cast<T>(-0.142440390738631274135e0L),
+ static_cast<T>(0.542809694055053558157e-1L),
+ static_cast<T>(-0.850535976868336437746e-2L),
+ static_cast<T>(0.431171342679297331241e-3L)
};
static const T Q[] = {
- 0.1e1,
- -0.150169356054485044494e1L,
- 0.846973248876495016101e0L,
- -0.220095151814995745555e0L,
- 0.25582797155975869989e-1L,
- -0.100666795539143372762e-2L,
- -0.827193521891290553639e-6L
+ static_cast<T>(0.1e1),
+ static_cast<T>(-0.150169356054485044494e1L),
+ static_cast<T>(0.846973248876495016101e0L),
+ static_cast<T>(-0.220095151814995745555e0L),
+ static_cast<T>(0.25582797155975869989e-1L),
+ static_cast<T>(-0.100666795539143372762e-2L),
+ static_cast<T>(-0.827193521891290553639e-6L)
};
T r = zm2 * zm1;
T R = tools::evaluate_polynomial(P, -zm2) / tools::evaluate_polynomial(Q, -zm2);
@@ -712,7 +712,7 @@
else
{
// regular evaluation:
- T zgh = (z + L::g() - boost::math::constants::half<T>());
+ T zgh = static_cast<T>(z + L::g() - boost::math::constants::half<T>());
T l = L::lanczos_sum_expG_scaled(z);
result = log(zgh) - 1;
result *= z - 0.5f;
@@ -1058,9 +1058,9 @@
T regularised_gamma_prefix(T a, T z, const L& l)
{
using namespace std;
- T agh = a + L::g() - T(0.5);
+ T agh = a + static_cast<T>(L::g()) - T(0.5);
T prefix;
- T d = ((z - a) - L::g() + T(0.5)) / agh;
+ T d = ((z - a) - static_cast<T>(L::g()) + T(0.5)) / agh;
if(a < 1)
{
@@ -1088,7 +1088,7 @@
else if((fabs(d*d*a) <= 100) && (a > 150))
{
// special case for large a and a ~ z.
- prefix = a * log1pmx(d) + z * (0.5 - L::g()) / agh;
+ prefix = a * log1pmx(d) + z * static_cast<T>(0.5 - L::g()) / agh;
prefix = exp(prefix);
}
else
@@ -1231,7 +1231,7 @@
// Upper gamma fraction for half integer a:
//
template <class T>
-T finite_half_gamma_q(T a, T x)
+T finite_half_gamma_q(T a, T x, T* p_derivative)
{
//
// Calculates normalised Q when a is a half-integer:
@@ -1252,6 +1252,15 @@
sum += term;
}
e += sum;
+ if(p_derivative)
+ {
+ *p_derivative = 0;
+ }
+ }
+ else if(p_derivative)
+ {
+ // We'll be dividing by x later, so calculate derivative * x:
+ *p_derivative = sqrt(x) * exp(-x) / constants::root_pi<T>();
}
return e;
}
@@ -1259,7 +1268,8 @@
// Main incomplete gamma entry point, handles all four incomplete gamma's:
//
template <class T, class L>
-T gamma_incomplete_imp(T a, T x, bool normalised, bool invert, const L& l)
+T gamma_incomplete_imp(T a, T x, bool normalised, bool invert,
+ const L& l, T* p_derivative)
{
if(a <= 0)
tools::domain_error<T>(BOOST_CURRENT_FUNCTION, "Argument a to the incomplete gamma function must be greater than zero (got a=%1%).", a);
@@ -1270,6 +1280,8 @@
T result;
+ BOOST_ASSERT((p_derivative == 0) || (normalised == true));
+
bool is_int = floor(a) == a;
bool is_half_int = (floor(2 * a) == 2 * a) && !is_int;
bool is_small_a = (a < 30) && (a <= x + 1);
@@ -1281,14 +1293,19 @@
result = finite_gamma_q(a, x);
if(normalised == false)
result *= gamma_imp(a, l);
+ // TODO: calculate derivative inside sum:
+ if(p_derivative)
+ *p_derivative = regularised_gamma_prefix(a, x, l);
}
else if(is_half_int && is_small_a && (x > 0.2))
{
// calculate Q via finite sum for half integer a:
invert = !invert;
- result = finite_half_gamma_q(a, x);
+ result = finite_half_gamma_q(a, x, p_derivative);
if(normalised == false)
result *= gamma_imp(a, l);
+ if(p_derivative && (*p_derivative == 0))
+ *p_derivative = regularised_gamma_prefix(a, x, l);
}
else if(x < 0.5)
{
@@ -1299,6 +1316,8 @@
{
// Compute P:
result = normalised ? regularised_gamma_prefix(a, x, l) : full_igamma_prefix(a, x);
+ if(p_derivative)
+ *p_derivative = result;
if(result != 0)
result *= detail::lower_gamma_series(a, x, boost::math::tools::digits<T>()) / a;
}
@@ -1309,6 +1328,8 @@
result = tgamma_small_upper_part(a, x, l);
if(normalised)
result /= gamma_imp(a, l);
+ if(p_derivative)
+ *p_derivative = regularised_gamma_prefix(a, x, l);
}
}
else if(x < 1.1)
@@ -1320,6 +1341,8 @@
{
// Compute P:
result = normalised ? regularised_gamma_prefix(a, x, l) : full_igamma_prefix(a, x);
+ if(p_derivative)
+ *p_derivative = result;
if(result != 0)
result *= detail::lower_gamma_series(a, x, boost::math::tools::digits<T>()) / a;
}
@@ -1330,6 +1353,8 @@
result = tgamma_small_upper_part(a, x, l);
if(normalised)
result /= gamma_imp(a, l);
+ if(p_derivative)
+ *p_derivative = regularised_gamma_prefix(a, x, l);
}
}
else
@@ -1394,6 +1419,8 @@
result = igamma_temme_large(a, x, static_cast<tag_type const*>(0));
if(x >= a)
invert = !invert;
+ if(p_derivative)
+ *p_derivative = regularised_gamma_prefix(a, x, l);
}
else
{
@@ -1403,6 +1430,8 @@
// Changeover here occurs at P ~ Q ~ 0.5
//
result = normalised ? regularised_gamma_prefix(a, x, l) : full_igamma_prefix(a, x);
+ if(p_derivative)
+ *p_derivative = result;
if(x < a)
{
// Compute P:
@@ -1424,9 +1453,29 @@
T gam = normalised ? 1 : gamma_imp(a, l);
result = gam - result;
}
+ if(p_derivative)
+ {
+ //
+ // Need to convert prefix term to derivative:
+ //
+ if((x < 1) && (tools::max_value<T>() * x < *p_derivative))
+ {
+ // overflow, just return an arbitrarily large value:
+ *p_derivative = tools::max_value<T>() / 2;
+ }
+
+ *p_derivative /= x;
+ }
return result;
}
+
+template <class T, class L>
+inline T gamma_incomplete_imp(T a, T x, bool normalised, bool invert, const L& l)
+{
+ return gamma_incomplete_imp(a, x, normalised, invert, l, static_cast<T*>(0));
+}
+
//
// Ratios of two gamma functions:
//
Modified: sandbox/math_toolkit/boost/math/special_functions/lanczos.hpp
==============================================================================
--- sandbox/math_toolkit/boost/math/special_functions/lanczos.hpp (original)
+++ sandbox/math_toolkit/boost/math/special_functions/lanczos.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -45,7 +45,7 @@
static_cast<T>(63.99951844938187085666201263218840287667L),
static_cast<T>(2.506628274631006311133031631822390264407L)
};
- static const boost::uint16_t denom[6] = {
+ static const BOOST_MATH_INT_TABLE_TYPE(T, boost::uint16_t) denom[6] = {
static_cast<boost::uint16_t>(0u),
static_cast<boost::uint16_t>(24u),
static_cast<boost::uint16_t>(50u),
@@ -67,7 +67,7 @@
static_cast<T>(0.2412010548258800231126240760264822486599L),
static_cast<T>(0.009446967704539249494420221613134244048319L)
};
- static const boost::uint16_t denom[6] = {
+ static const BOOST_MATH_INT_TABLE_TYPE(T, boost::uint16_t) denom[6] = {
static_cast<boost::uint16_t>(0u),
static_cast<boost::uint16_t>(24u),
static_cast<boost::uint16_t>(50u),
@@ -142,7 +142,7 @@
static_cast<T>(261.6140441641668190791708576058805625502L),
static_cast<T>(2.506628274631000502415573855452633787834L)
};
- static const boost::uint32_t denom[11] = {
+ static const BOOST_MATH_INT_TABLE_TYPE(T, boost::uint32_t) denom[11] = {
static_cast<boost::uint32_t>(0u),
static_cast<boost::uint32_t>(362880u),
static_cast<boost::uint32_t>(1026576u),
@@ -174,7 +174,7 @@
static_cast<T>(0.004826466289237661857584712046231435101741L),
static_cast<T>(0.4624429436045378766270459638520555557321e-4L)
};
- static const boost::uint32_t denom[11] = {
+ static const BOOST_MATH_INT_TABLE_TYPE(T, boost::uint32_t) denom[11] = {
static_cast<boost::uint32_t>(0u),
static_cast<boost::uint32_t>(362880u),
static_cast<boost::uint32_t>(1026576u),
@@ -266,7 +266,7 @@
static_cast<T>(381.8801248632926870394389468349331394196L),
static_cast<T>(2.506628274631000502415763426076722427007L)
};
- static const boost::uint32_t denom[13] = {
+ static const BOOST_MATH_INT_TABLE_TYPE(T, boost::uint32_t) denom[13] = {
static_cast<boost::uint32_t>(0u),
static_cast<boost::uint32_t>(39916800u),
static_cast<boost::uint32_t>(120543840u),
@@ -302,7 +302,7 @@
static_cast<T>(0.0007469903808915448316510079585999893674101L),
static_cast<T>(0.4903180573459871862552197089738373164184e-5L)
};
- static const boost::uint32_t denom[13] = {
+ static const BOOST_MATH_INT_TABLE_TYPE(T, boost::uint32_t) denom[13] = {
static_cast<boost::uint32_t>(0u),
static_cast<boost::uint32_t>(39916800u),
static_cast<boost::uint32_t>(120543840u),
@@ -409,7 +409,7 @@
static_cast<T>(1167.501919472435718934219997431551246996L),
static_cast<T>(2.50662827463100050241576528481104525333L)
};
- static const boost::uint64_t denom[22] = {
+ static const BOOST_MATH_INT_TABLE_TYPE(T, boost::uint64_t) denom[22] = {
(0uLL),
(2432902008176640000uLL),
(8752948036761600000uLL),
@@ -463,7 +463,7 @@
static_cast<T>(0.1753839324538447655939518484052327068859e-6L),
static_cast<T>(0.3765495513732730583386223384116545391759e-9L)
};
- static const boost::uint64_t denom[22] = {
+ static const BOOST_MATH_INT_TABLE_TYPE(T, boost::uint64_t) denom[22] = {
(0uLL),
(2432902008176640000uLL),
(8752948036761600000uLL),
@@ -581,7 +581,7 @@
static_cast<T>(27.5192015197455403062503721613097825345L),
static_cast<T>(2.50662858515256974113978724717473206342L)
};
- static const boost::uint16_t denom[6] = {
+ static const BOOST_MATH_INT_TABLE_TYPE(T, boost::uint16_t) denom[6] = {
static_cast<boost::uint16_t>(0u),
static_cast<boost::uint16_t>(24u),
static_cast<boost::uint16_t>(50u),
@@ -603,7 +603,7 @@
static_cast<T>(6.595765571169314946316366571954421695196L),
static_cast<T>(0.6007854010515290065101128585795542383721L)
};
- static const boost::uint16_t denom[6] = {
+ static const BOOST_MATH_INT_TABLE_TYPE(T, boost::uint16_t) denom[6] = {
static_cast<boost::uint16_t>(0u),
static_cast<boost::uint16_t>(24u),
static_cast<boost::uint16_t>(50u),
@@ -680,7 +680,7 @@
static_cast<T>(210.8242777515793458725097339207133627117L),
static_cast<T>(2.506628274631000270164908177133837338626L)
};
- static const boost::uint32_t denom[13] = {
+ static const BOOST_MATH_INT_TABLE_TYPE(T, boost::uint32_t) denom[13] = {
static_cast<boost::uint32_t>(0u),
static_cast<boost::uint32_t>(39916800u),
static_cast<boost::uint32_t>(120543840u),
@@ -716,7 +716,7 @@
static_cast<T>(0.5098416655656676188125178644804694509993L),
static_cast<T>(0.006061842346248906525783753964555936883222L)
};
- static const boost::uint32_t denom[13] = {
+ static const BOOST_MATH_INT_TABLE_TYPE(T, boost::uint32_t) denom[13] = {
static_cast<boost::uint32_t>(0u),
static_cast<boost::uint32_t>(39916800u),
static_cast<boost::uint32_t>(120543840u),
@@ -818,7 +818,7 @@
static_cast<T>(488.0063567520005730476791712814838113252L),
static_cast<T>(2.50662827463100050241576877135758834683L)
};
- static const boost::uint64_t denom[17] = {
+ static const BOOST_MATH_INT_TABLE_TYPE(T, boost::uint64_t) denom[17] = {
(0uLL),
(1307674368000uLL),
(4339163001600uLL),
@@ -862,7 +862,7 @@
static_cast<T>(0.002393749522058449186690627996063983095463L),
static_cast<T>(0.1229541408909435212800785616808830746135e-4L)
};
- static const boost::uint64_t denom[17] = {
+ static const BOOST_MATH_INT_TABLE_TYPE(T, boost::uint64_t) denom[17] = {
(0uLL),
(1307674368000uLL),
(4339163001600uLL),
@@ -1197,9 +1197,6 @@
template<>
struct lanczos_traits<float>
{
- //typedef boost::mpl::if_c<
- // BOOST_MATH_DBL_DIGITS >= 40,
- //double, float>::type value_type;
typedef boost::math::tools::evaluation<float>::type value_type;
typedef boost::mpl::if_c<
BOOST_MATH_DBL_DIGITS >= 40,
@@ -1210,6 +1207,20 @@
struct lanczos_traits<double>
{
typedef boost::math::tools::evaluation<double>::type value_type;
+#ifdef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
+ typedef boost::mpl::if_c<
+ BOOST_MATH_DBL_DIGITS >= 100,
+ lanczos13,
+ boost::mpl::if_c<
+ BOOST_MATH_DBL_DIGITS >= 64,
+ lanczos17m64,
+ boost::mpl::if_c<
+ BOOST_MATH_DBL_DIGITS >= 53,
+ lanczos13m53,
+ lanczos6m24>::type
+ >::type
+ >::type evaluation_type;
+#else
typedef boost::mpl::if_c<
BOOST_MATH_LDBL_DIGITS >= 100,
lanczos13,
@@ -1222,6 +1233,7 @@
lanczos6m24>::type
>::type
>::type evaluation_type;
+#endif
};
template<>
Modified: sandbox/math_toolkit/boost/math/tools/config.hpp
==============================================================================
--- sandbox/math_toolkit/boost/math/tools/config.hpp (original)
+++ sandbox/math_toolkit/boost/math/tools/config.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -3,11 +3,49 @@
#include <boost/math/tools/error_handling.hpp>
#include <boost/cstdint.hpp> // for boost::uintmax_t
+#include <boost/config.hpp>
#define BOOST_MATH_MAX_ITER 1000000
#if defined(__CYGWIN__) || defined(__FreeBSD__)
-#define BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
+# define BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
+#endif
+//
+// Tune performance options for specific compilers:
+//
+#ifdef BOOST_MSVC
+# define BOOST_MATH_POLY_METHOD 3
+# define BOOST_MATH_RATIONAL_METHOD 3
+#elif defined(BOOST_INTEL)
+# define BOOST_MATH_POLY_METHOD 2
+# define BOOST_MATH_RATIONAL_METHOD 0
+#elif defined(__GNUC__)
+# define BOOST_MATH_POLY_METHOD 3
+# define BOOST_MATH_RATIONAL_METHOD 3
+# define BOOST_MATH_INT_TABLE_TYPE(RT, IT) RT
+#endif
+
+//
+// The maximum order of polynomial that will be evaluated
+// via an unrolled specialisation:
+//
+#ifndef BOOST_MATH_MAX_POLY_ORDER
+# define BOOST_MATH_MAX_POLY_ORDER 17
+#endif
+//
+// Set the method used to evaluate polynomials and rationals:
+//
+#ifndef BOOST_MATH_POLY_METHOD
+# define BOOST_MATH_POLY_METHOD 1
+#endif
+#ifndef BOOST_MATH_RATIONAL_METHOD
+# define BOOST_MATH_RATIONAL_METHOD 0
+#endif
+//
+// decide whether to store constants as integers or reals:
+//
+#ifndef BOOST_MATH_INT_TABLE_TYPE
+# define BOOST_MATH_INT_TABLE_TYPE(RT, IT) IT
#endif
namespace boost{ namespace math{
@@ -75,3 +113,5 @@
#endif
#endif // BOOST_MATH_TOOLS_CONFIG_HPP
+
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_10.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_10.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,84 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_10_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_10_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ return static_cast<V>((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
+{
+ return static_cast<V>(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*)
+{
+ return static_cast<V>((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*)
+{
+ return static_cast<V>(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*)
+{
+ return static_cast<V>((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*)
+{
+ return static_cast<V>(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_11.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_11.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,90 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_11_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_11_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ return static_cast<V>((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
+{
+ return static_cast<V>(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*)
+{
+ return static_cast<V>((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*)
+{
+ return static_cast<V>(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*)
+{
+ return static_cast<V>((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*)
+{
+ return static_cast<V>(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*)
+{
+ return static_cast<V>((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_12.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_12.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,96 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_12_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_12_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ return static_cast<V>((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
+{
+ return static_cast<V>(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*)
+{
+ return static_cast<V>((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*)
+{
+ return static_cast<V>(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*)
+{
+ return static_cast<V>((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*)
+{
+ return static_cast<V>(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*)
+{
+ return static_cast<V>((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*)
+{
+ return static_cast<V>(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_13.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_13.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,102 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_13_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_13_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ return static_cast<V>((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
+{
+ return static_cast<V>(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*)
+{
+ return static_cast<V>((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*)
+{
+ return static_cast<V>(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*)
+{
+ return static_cast<V>((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*)
+{
+ return static_cast<V>(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*)
+{
+ return static_cast<V>((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*)
+{
+ return static_cast<V>(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*)
+{
+ return static_cast<V>((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_14.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_14.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,108 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_14_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_14_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ return static_cast<V>((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
+{
+ return static_cast<V>(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*)
+{
+ return static_cast<V>((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*)
+{
+ return static_cast<V>(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*)
+{
+ return static_cast<V>((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*)
+{
+ return static_cast<V>(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*)
+{
+ return static_cast<V>((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*)
+{
+ return static_cast<V>(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*)
+{
+ return static_cast<V>((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*)
+{
+ return static_cast<V>(((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_15.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_15.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,114 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_15_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_15_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ return static_cast<V>((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
+{
+ return static_cast<V>(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*)
+{
+ return static_cast<V>((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*)
+{
+ return static_cast<V>(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*)
+{
+ return static_cast<V>((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*)
+{
+ return static_cast<V>(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*)
+{
+ return static_cast<V>((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*)
+{
+ return static_cast<V>(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*)
+{
+ return static_cast<V>((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*)
+{
+ return static_cast<V>(((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*)
+{
+ return static_cast<V>((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_16.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_16.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,120 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_16_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_16_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ return static_cast<V>((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
+{
+ return static_cast<V>(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*)
+{
+ return static_cast<V>((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*)
+{
+ return static_cast<V>(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*)
+{
+ return static_cast<V>((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*)
+{
+ return static_cast<V>(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*)
+{
+ return static_cast<V>((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*)
+{
+ return static_cast<V>(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*)
+{
+ return static_cast<V>((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*)
+{
+ return static_cast<V>(((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*)
+{
+ return static_cast<V>((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*)
+{
+ return static_cast<V>(((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_17.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_17.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,126 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_17_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_17_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ return static_cast<V>((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
+{
+ return static_cast<V>(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*)
+{
+ return static_cast<V>((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*)
+{
+ return static_cast<V>(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*)
+{
+ return static_cast<V>((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*)
+{
+ return static_cast<V>(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*)
+{
+ return static_cast<V>((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*)
+{
+ return static_cast<V>(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*)
+{
+ return static_cast<V>((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*)
+{
+ return static_cast<V>(((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*)
+{
+ return static_cast<V>((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*)
+{
+ return static_cast<V>(((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<17>*)
+{
+ return static_cast<V>((((((((((((((((a[16] * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_18.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_18.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,132 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_18_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_18_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ return static_cast<V>((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
+{
+ return static_cast<V>(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*)
+{
+ return static_cast<V>((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*)
+{
+ return static_cast<V>(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*)
+{
+ return static_cast<V>((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*)
+{
+ return static_cast<V>(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*)
+{
+ return static_cast<V>((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*)
+{
+ return static_cast<V>(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*)
+{
+ return static_cast<V>((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*)
+{
+ return static_cast<V>(((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*)
+{
+ return static_cast<V>((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*)
+{
+ return static_cast<V>(((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<17>*)
+{
+ return static_cast<V>((((((((((((((((a[16] * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<18>*)
+{
+ return static_cast<V>(((((((((((((((((a[17] * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_19.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_19.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,138 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_19_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_19_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ return static_cast<V>((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
+{
+ return static_cast<V>(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*)
+{
+ return static_cast<V>((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*)
+{
+ return static_cast<V>(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*)
+{
+ return static_cast<V>((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*)
+{
+ return static_cast<V>(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*)
+{
+ return static_cast<V>((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*)
+{
+ return static_cast<V>(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*)
+{
+ return static_cast<V>((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*)
+{
+ return static_cast<V>(((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*)
+{
+ return static_cast<V>((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*)
+{
+ return static_cast<V>(((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<17>*)
+{
+ return static_cast<V>((((((((((((((((a[16] * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<18>*)
+{
+ return static_cast<V>(((((((((((((((((a[17] * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<19>*)
+{
+ return static_cast<V>((((((((((((((((((a[18] * x + a[17]) * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_2.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_2.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,36 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_2_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_2_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_20.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_20.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,144 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_20_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_20_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ return static_cast<V>((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
+{
+ return static_cast<V>(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*)
+{
+ return static_cast<V>((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*)
+{
+ return static_cast<V>(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*)
+{
+ return static_cast<V>((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*)
+{
+ return static_cast<V>(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*)
+{
+ return static_cast<V>((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*)
+{
+ return static_cast<V>(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*)
+{
+ return static_cast<V>((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*)
+{
+ return static_cast<V>(((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*)
+{
+ return static_cast<V>((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*)
+{
+ return static_cast<V>(((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<17>*)
+{
+ return static_cast<V>((((((((((((((((a[16] * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<18>*)
+{
+ return static_cast<V>(((((((((((((((((a[17] * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<19>*)
+{
+ return static_cast<V>((((((((((((((((((a[18] * x + a[17]) * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<20>*)
+{
+ return static_cast<V>(((((((((((((((((((a[19] * x + a[18]) * x + a[17]) * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_3.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_3.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,42 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_3_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_3_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_4.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_4.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,48 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_4_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_4_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_5.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_5.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,54 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_5_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_5_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ return static_cast<V>((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_6.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_6.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,60 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_6_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_6_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ return static_cast<V>((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
+{
+ return static_cast<V>(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_7.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_7.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,66 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_7_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_7_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ return static_cast<V>((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
+{
+ return static_cast<V>(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*)
+{
+ return static_cast<V>((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_8.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_8.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,72 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_8_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_8_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ return static_cast<V>((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
+{
+ return static_cast<V>(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*)
+{
+ return static_cast<V>((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*)
+{
+ return static_cast<V>(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_9.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner1_9.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,78 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_9_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_9_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ return static_cast<V>((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
+{
+ return static_cast<V>(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*)
+{
+ return static_cast<V>((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*)
+{
+ return static_cast<V>(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*)
+{
+ return static_cast<V>((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_10.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_10.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,90 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_10_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_10_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_11.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_11.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,97 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_11_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_11_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_12.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_12.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,104 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_12_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_12_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_13.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_13.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,111 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_13_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_13_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_14.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_14.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,118 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_14_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_14_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_15.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_15.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,125 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_15_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_15_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_16.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_16.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,132 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_16_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_16_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_17.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_17.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,139 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_17_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_17_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<17>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_18.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_18.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,146 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_18_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_18_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<17>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<18>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((((((((a[17] * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_19.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_19.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,153 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_19_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_19_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<17>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<18>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((((((((a[17] * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<19>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((((((((a[18] * x2 + a[16]) * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((((a[17] * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_2.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_2.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,48 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_2_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_2_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_20.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_20.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,160 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_20_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_20_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<17>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<18>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((((((((a[17] * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<19>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((((((((a[18] * x2 + a[16]) * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((((a[17] * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<20>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((((((((a[19] * x2 + a[17]) * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((((a[18] * x2 + a[16]) * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_3.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_3.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,48 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_3_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_3_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_4.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_4.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,48 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_4_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_4_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_5.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_5.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,55 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_5_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_5_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x);
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_6.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_6.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,62 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_6_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_6_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]);
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_7.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_7.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,69 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_7_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_7_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_8.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_8.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,76 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_8_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_8_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_9.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner2_9.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,83 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_9_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_9_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*)
+{
+ V x2 = x * x;
+ return static_cast<V>(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*)
+{
+ V x2 = x * x;
+ return static_cast<V>((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_10.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_10.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,156 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Unrolled polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_10_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_10_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[4] * x2 + a[2]);
+ t[1] = static_cast<V>(a[3] * x2 + a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[5] * x2 + a[3];
+ t[1] = a[4] * x2 + a[2];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[6] * x2 + a[4]);
+ t[1] = static_cast<V>(a[5] * x2 + a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[7] * x2 + a[5];
+ t[1] = a[6] * x2 + a[4];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[8] * x2 + a[6]);
+ t[1] = static_cast<V>(a[7] * x2 + a[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[9] * x2 + a[7];
+ t[1] = a[8] * x2 + a[6];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_11.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_11.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,181 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Unrolled polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_11_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_11_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[4] * x2 + a[2]);
+ t[1] = static_cast<V>(a[3] * x2 + a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[5] * x2 + a[3];
+ t[1] = a[4] * x2 + a[2];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[6] * x2 + a[4]);
+ t[1] = static_cast<V>(a[5] * x2 + a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[7] * x2 + a[5];
+ t[1] = a[6] * x2 + a[4];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[8] * x2 + a[6]);
+ t[1] = static_cast<V>(a[7] * x2 + a[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[9] * x2 + a[7];
+ t[1] = a[8] * x2 + a[6];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[10] * x2 + a[8]);
+ t[1] = static_cast<V>(a[9] * x2 + a[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_12.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_12.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,208 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Unrolled polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_12_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_12_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[4] * x2 + a[2]);
+ t[1] = static_cast<V>(a[3] * x2 + a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[5] * x2 + a[3];
+ t[1] = a[4] * x2 + a[2];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[6] * x2 + a[4]);
+ t[1] = static_cast<V>(a[5] * x2 + a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[7] * x2 + a[5];
+ t[1] = a[6] * x2 + a[4];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[8] * x2 + a[6]);
+ t[1] = static_cast<V>(a[7] * x2 + a[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[9] * x2 + a[7];
+ t[1] = a[8] * x2 + a[6];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[10] * x2 + a[8]);
+ t[1] = static_cast<V>(a[9] * x2 + a[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[11] * x2 + a[9];
+ t[1] = a[10] * x2 + a[8];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_13.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_13.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,237 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Unrolled polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_13_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_13_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[4] * x2 + a[2]);
+ t[1] = static_cast<V>(a[3] * x2 + a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[5] * x2 + a[3];
+ t[1] = a[4] * x2 + a[2];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[6] * x2 + a[4]);
+ t[1] = static_cast<V>(a[5] * x2 + a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[7] * x2 + a[5];
+ t[1] = a[6] * x2 + a[4];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[8] * x2 + a[6]);
+ t[1] = static_cast<V>(a[7] * x2 + a[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[9] * x2 + a[7];
+ t[1] = a[8] * x2 + a[6];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[10] * x2 + a[8]);
+ t[1] = static_cast<V>(a[9] * x2 + a[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[11] * x2 + a[9];
+ t[1] = a[10] * x2 + a[8];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[12] * x2 + a[10]);
+ t[1] = static_cast<V>(a[11] * x2 + a[9]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_14.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_14.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,268 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Unrolled polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_14_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_14_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[4] * x2 + a[2]);
+ t[1] = static_cast<V>(a[3] * x2 + a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[5] * x2 + a[3];
+ t[1] = a[4] * x2 + a[2];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[6] * x2 + a[4]);
+ t[1] = static_cast<V>(a[5] * x2 + a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[7] * x2 + a[5];
+ t[1] = a[6] * x2 + a[4];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[8] * x2 + a[6]);
+ t[1] = static_cast<V>(a[7] * x2 + a[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[9] * x2 + a[7];
+ t[1] = a[8] * x2 + a[6];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[10] * x2 + a[8]);
+ t[1] = static_cast<V>(a[9] * x2 + a[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[11] * x2 + a[9];
+ t[1] = a[10] * x2 + a[8];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[12] * x2 + a[10]);
+ t[1] = static_cast<V>(a[11] * x2 + a[9]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[13] * x2 + a[11];
+ t[1] = a[12] * x2 + a[10];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[9]);
+ t[1] += static_cast<V>(a[8]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_15.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_15.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,301 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Unrolled polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_15_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_15_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[4] * x2 + a[2]);
+ t[1] = static_cast<V>(a[3] * x2 + a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[5] * x2 + a[3];
+ t[1] = a[4] * x2 + a[2];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[6] * x2 + a[4]);
+ t[1] = static_cast<V>(a[5] * x2 + a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[7] * x2 + a[5];
+ t[1] = a[6] * x2 + a[4];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[8] * x2 + a[6]);
+ t[1] = static_cast<V>(a[7] * x2 + a[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[9] * x2 + a[7];
+ t[1] = a[8] * x2 + a[6];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[10] * x2 + a[8]);
+ t[1] = static_cast<V>(a[9] * x2 + a[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[11] * x2 + a[9];
+ t[1] = a[10] * x2 + a[8];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[12] * x2 + a[10]);
+ t[1] = static_cast<V>(a[11] * x2 + a[9]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[13] * x2 + a[11];
+ t[1] = a[12] * x2 + a[10];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[9]);
+ t[1] += static_cast<V>(a[8]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[14] * x2 + a[12]);
+ t[1] = static_cast<V>(a[13] * x2 + a[11]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[9]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_16.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_16.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,336 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Unrolled polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_16_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_16_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[4] * x2 + a[2]);
+ t[1] = static_cast<V>(a[3] * x2 + a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[5] * x2 + a[3];
+ t[1] = a[4] * x2 + a[2];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[6] * x2 + a[4]);
+ t[1] = static_cast<V>(a[5] * x2 + a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[7] * x2 + a[5];
+ t[1] = a[6] * x2 + a[4];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[8] * x2 + a[6]);
+ t[1] = static_cast<V>(a[7] * x2 + a[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[9] * x2 + a[7];
+ t[1] = a[8] * x2 + a[6];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[10] * x2 + a[8]);
+ t[1] = static_cast<V>(a[9] * x2 + a[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[11] * x2 + a[9];
+ t[1] = a[10] * x2 + a[8];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[12] * x2 + a[10]);
+ t[1] = static_cast<V>(a[11] * x2 + a[9]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[13] * x2 + a[11];
+ t[1] = a[12] * x2 + a[10];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[9]);
+ t[1] += static_cast<V>(a[8]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[14] * x2 + a[12]);
+ t[1] = static_cast<V>(a[13] * x2 + a[11]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[9]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[15] * x2 + a[13];
+ t[1] = a[14] * x2 + a[12];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[11]);
+ t[1] += static_cast<V>(a[10]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[9]);
+ t[1] += static_cast<V>(a[8]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_17.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_17.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,373 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Unrolled polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_17_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_17_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[4] * x2 + a[2]);
+ t[1] = static_cast<V>(a[3] * x2 + a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[5] * x2 + a[3];
+ t[1] = a[4] * x2 + a[2];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[6] * x2 + a[4]);
+ t[1] = static_cast<V>(a[5] * x2 + a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[7] * x2 + a[5];
+ t[1] = a[6] * x2 + a[4];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[8] * x2 + a[6]);
+ t[1] = static_cast<V>(a[7] * x2 + a[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[9] * x2 + a[7];
+ t[1] = a[8] * x2 + a[6];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[10] * x2 + a[8]);
+ t[1] = static_cast<V>(a[9] * x2 + a[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[11] * x2 + a[9];
+ t[1] = a[10] * x2 + a[8];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[12] * x2 + a[10]);
+ t[1] = static_cast<V>(a[11] * x2 + a[9]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[13] * x2 + a[11];
+ t[1] = a[12] * x2 + a[10];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[9]);
+ t[1] += static_cast<V>(a[8]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[14] * x2 + a[12]);
+ t[1] = static_cast<V>(a[13] * x2 + a[11]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[9]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[15] * x2 + a[13];
+ t[1] = a[14] * x2 + a[12];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[11]);
+ t[1] += static_cast<V>(a[10]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[9]);
+ t[1] += static_cast<V>(a[8]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<17>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[16] * x2 + a[14]);
+ t[1] = static_cast<V>(a[15] * x2 + a[13]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[12]);
+ t[1] += static_cast<V>(a[11]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[9]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_18.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_18.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,412 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Unrolled polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_18_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_18_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[4] * x2 + a[2]);
+ t[1] = static_cast<V>(a[3] * x2 + a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[5] * x2 + a[3];
+ t[1] = a[4] * x2 + a[2];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[6] * x2 + a[4]);
+ t[1] = static_cast<V>(a[5] * x2 + a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[7] * x2 + a[5];
+ t[1] = a[6] * x2 + a[4];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[8] * x2 + a[6]);
+ t[1] = static_cast<V>(a[7] * x2 + a[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[9] * x2 + a[7];
+ t[1] = a[8] * x2 + a[6];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[10] * x2 + a[8]);
+ t[1] = static_cast<V>(a[9] * x2 + a[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[11] * x2 + a[9];
+ t[1] = a[10] * x2 + a[8];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[12] * x2 + a[10]);
+ t[1] = static_cast<V>(a[11] * x2 + a[9]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[13] * x2 + a[11];
+ t[1] = a[12] * x2 + a[10];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[9]);
+ t[1] += static_cast<V>(a[8]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[14] * x2 + a[12]);
+ t[1] = static_cast<V>(a[13] * x2 + a[11]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[9]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[15] * x2 + a[13];
+ t[1] = a[14] * x2 + a[12];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[11]);
+ t[1] += static_cast<V>(a[10]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[9]);
+ t[1] += static_cast<V>(a[8]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<17>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[16] * x2 + a[14]);
+ t[1] = static_cast<V>(a[15] * x2 + a[13]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[12]);
+ t[1] += static_cast<V>(a[11]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[9]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<18>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[17] * x2 + a[15];
+ t[1] = a[16] * x2 + a[14];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[13]);
+ t[1] += static_cast<V>(a[12]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[11]);
+ t[1] += static_cast<V>(a[10]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[9]);
+ t[1] += static_cast<V>(a[8]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_19.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_19.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,453 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Unrolled polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_19_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_19_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[4] * x2 + a[2]);
+ t[1] = static_cast<V>(a[3] * x2 + a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[5] * x2 + a[3];
+ t[1] = a[4] * x2 + a[2];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[6] * x2 + a[4]);
+ t[1] = static_cast<V>(a[5] * x2 + a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[7] * x2 + a[5];
+ t[1] = a[6] * x2 + a[4];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[8] * x2 + a[6]);
+ t[1] = static_cast<V>(a[7] * x2 + a[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[9] * x2 + a[7];
+ t[1] = a[8] * x2 + a[6];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[10] * x2 + a[8]);
+ t[1] = static_cast<V>(a[9] * x2 + a[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[11] * x2 + a[9];
+ t[1] = a[10] * x2 + a[8];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[12] * x2 + a[10]);
+ t[1] = static_cast<V>(a[11] * x2 + a[9]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[13] * x2 + a[11];
+ t[1] = a[12] * x2 + a[10];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[9]);
+ t[1] += static_cast<V>(a[8]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[14] * x2 + a[12]);
+ t[1] = static_cast<V>(a[13] * x2 + a[11]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[9]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[15] * x2 + a[13];
+ t[1] = a[14] * x2 + a[12];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[11]);
+ t[1] += static_cast<V>(a[10]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[9]);
+ t[1] += static_cast<V>(a[8]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<17>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[16] * x2 + a[14]);
+ t[1] = static_cast<V>(a[15] * x2 + a[13]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[12]);
+ t[1] += static_cast<V>(a[11]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[9]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<18>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[17] * x2 + a[15];
+ t[1] = a[16] * x2 + a[14];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[13]);
+ t[1] += static_cast<V>(a[12]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[11]);
+ t[1] += static_cast<V>(a[10]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[9]);
+ t[1] += static_cast<V>(a[8]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<19>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[18] * x2 + a[16]);
+ t[1] = static_cast<V>(a[17] * x2 + a[15]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[14]);
+ t[1] += static_cast<V>(a[13]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[12]);
+ t[1] += static_cast<V>(a[11]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[9]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_2.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_2.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,48 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Unrolled polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_2_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_2_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_20.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_20.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,496 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Unrolled polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_20_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_20_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[4] * x2 + a[2]);
+ t[1] = static_cast<V>(a[3] * x2 + a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[5] * x2 + a[3];
+ t[1] = a[4] * x2 + a[2];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[6] * x2 + a[4]);
+ t[1] = static_cast<V>(a[5] * x2 + a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[7] * x2 + a[5];
+ t[1] = a[6] * x2 + a[4];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[8] * x2 + a[6]);
+ t[1] = static_cast<V>(a[7] * x2 + a[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[9] * x2 + a[7];
+ t[1] = a[8] * x2 + a[6];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[10] * x2 + a[8]);
+ t[1] = static_cast<V>(a[9] * x2 + a[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[11] * x2 + a[9];
+ t[1] = a[10] * x2 + a[8];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[12] * x2 + a[10]);
+ t[1] = static_cast<V>(a[11] * x2 + a[9]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[13] * x2 + a[11];
+ t[1] = a[12] * x2 + a[10];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[9]);
+ t[1] += static_cast<V>(a[8]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[14] * x2 + a[12]);
+ t[1] = static_cast<V>(a[13] * x2 + a[11]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[9]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[15] * x2 + a[13];
+ t[1] = a[14] * x2 + a[12];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[11]);
+ t[1] += static_cast<V>(a[10]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[9]);
+ t[1] += static_cast<V>(a[8]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<17>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[16] * x2 + a[14]);
+ t[1] = static_cast<V>(a[15] * x2 + a[13]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[12]);
+ t[1] += static_cast<V>(a[11]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[9]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<18>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[17] * x2 + a[15];
+ t[1] = a[16] * x2 + a[14];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[13]);
+ t[1] += static_cast<V>(a[12]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[11]);
+ t[1] += static_cast<V>(a[10]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[9]);
+ t[1] += static_cast<V>(a[8]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<19>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[18] * x2 + a[16]);
+ t[1] = static_cast<V>(a[17] * x2 + a[15]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[14]);
+ t[1] += static_cast<V>(a[13]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[12]);
+ t[1] += static_cast<V>(a[11]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[9]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<20>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[19] * x2 + a[17];
+ t[1] = a[18] * x2 + a[16];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[15]);
+ t[1] += static_cast<V>(a[14]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[13]);
+ t[1] += static_cast<V>(a[12]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[11]);
+ t[1] += static_cast<V>(a[10]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[9]);
+ t[1] += static_cast<V>(a[8]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_3.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_3.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,48 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Unrolled polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_3_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_3_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_4.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_4.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,48 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Unrolled polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_4_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_4_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_5.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_5.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,61 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Unrolled polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_5_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_5_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[4] * x2 + a[2]);
+ t[1] = static_cast<V>(a[3] * x2 + a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_6.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_6.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,76 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Unrolled polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_6_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_6_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[4] * x2 + a[2]);
+ t[1] = static_cast<V>(a[3] * x2 + a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[5] * x2 + a[3];
+ t[1] = a[4] * x2 + a[2];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_7.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_7.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,93 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Unrolled polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_7_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_7_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[4] * x2 + a[2]);
+ t[1] = static_cast<V>(a[3] * x2 + a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[5] * x2 + a[3];
+ t[1] = a[4] * x2 + a[2];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[6] * x2 + a[4]);
+ t[1] = static_cast<V>(a[5] * x2 + a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_8.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_8.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,112 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Unrolled polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_8_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_8_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[4] * x2 + a[2]);
+ t[1] = static_cast<V>(a[3] * x2 + a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[5] * x2 + a[3];
+ t[1] = a[4] * x2 + a[2];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[6] * x2 + a[4]);
+ t[1] = static_cast<V>(a[5] * x2 + a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[7] * x2 + a[5];
+ t[1] = a[6] * x2 + a[4];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_9.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/polynomial_horner3_9.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,133 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Unrolled polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_EVAL_9_HPP
+#define BOOST_MATH_TOOLS_POLY_EVAL_9_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>(a[1] * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
+{
+ return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[4] * x2 + a[2]);
+ t[1] = static_cast<V>(a[3] * x2 + a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[5] * x2 + a[3];
+ t[1] = a[4] * x2 + a[2];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[6] * x2 + a[4]);
+ t[1] = static_cast<V>(a[5] * x2 + a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = a[7] * x2 + a[5];
+ t[1] = a[6] * x2 + a[4];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[0] *= x;
+ return t[0] + t[1];
+}
+
+template <class T, class V>
+inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*)
+{
+ V x2 = x * x;
+ V t[2];
+ t[0] = static_cast<V>(a[8] * x2 + a[6]);
+ t[1] = static_cast<V>(a[7] * x2 + a[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[0] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[1] *= x;
+ return t[0] + t[1];
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_10.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_10.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,138 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_RAT_10_HPP
+#define BOOST_MATH_TOOLS_POLY_RAT_10_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ if(x <= 1)
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((a[0] * z + a[1]) / (b[0] * z + b[1]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ if(x <= 1)
+ 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]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) / ((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) / (((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) / ((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) / (((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]));
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_11.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_11.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,150 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_RAT_11_HPP
+#define BOOST_MATH_TOOLS_POLY_RAT_11_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ if(x <= 1)
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((a[0] * z + a[1]) / (b[0] * z + b[1]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ if(x <= 1)
+ 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]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) / ((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) / (((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) / ((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) / (((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) / ((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]));
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_12.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_12.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,162 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_RAT_12_HPP
+#define BOOST_MATH_TOOLS_POLY_RAT_12_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ if(x <= 1)
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((a[0] * z + a[1]) / (b[0] * z + b[1]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ if(x <= 1)
+ 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]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) / ((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) / (((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) / ((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) / (((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) / ((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) / (((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]));
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_13.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_13.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,174 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_RAT_13_HPP
+#define BOOST_MATH_TOOLS_POLY_RAT_13_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ if(x <= 1)
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((a[0] * z + a[1]) / (b[0] * z + b[1]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ if(x <= 1)
+ 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]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) / ((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) / (((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) / ((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) / (((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) / ((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) / (((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((b[12] * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) / ((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]));
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_14.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_14.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,186 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_RAT_14_HPP
+#define BOOST_MATH_TOOLS_POLY_RAT_14_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ if(x <= 1)
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((a[0] * z + a[1]) / (b[0] * z + b[1]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ if(x <= 1)
+ 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]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) / ((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) / (((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) / ((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) / (((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) / ((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) / (((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((b[12] * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) / ((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((b[13] * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) / (((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]));
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_15.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_15.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,198 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_RAT_15_HPP
+#define BOOST_MATH_TOOLS_POLY_RAT_15_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ if(x <= 1)
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((a[0] * z + a[1]) / (b[0] * z + b[1]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ if(x <= 1)
+ 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]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) / ((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) / (((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) / ((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) / (((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) / ((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) / (((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((b[12] * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) / ((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((b[13] * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) / (((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((b[14] * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) / ((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]));
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_16.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_16.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,210 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_RAT_16_HPP
+#define BOOST_MATH_TOOLS_POLY_RAT_16_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ if(x <= 1)
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((a[0] * z + a[1]) / (b[0] * z + b[1]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ if(x <= 1)
+ 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]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) / ((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) / (((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) / ((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) / (((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) / ((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) / (((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((b[12] * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) / ((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((b[13] * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) / (((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((b[14] * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) / ((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((b[15] * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) / (((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15]));
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_17.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_17.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,222 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_RAT_17_HPP
+#define BOOST_MATH_TOOLS_POLY_RAT_17_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ if(x <= 1)
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((a[0] * z + a[1]) / (b[0] * z + b[1]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ if(x <= 1)
+ 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]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) / ((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) / (((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) / ((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) / (((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) / ((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) / (((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((b[12] * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) / ((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((b[13] * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) / (((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((b[14] * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) / ((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((b[15] * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) / (((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<17>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((((((((((((a[16] * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((((b[16] * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) * z + a[16]) / ((((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15]) * z + b[16]));
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_18.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_18.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,234 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_RAT_18_HPP
+#define BOOST_MATH_TOOLS_POLY_RAT_18_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ if(x <= 1)
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((a[0] * z + a[1]) / (b[0] * z + b[1]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ if(x <= 1)
+ 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]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) / ((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) / (((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) / ((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) / (((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) / ((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) / (((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((b[12] * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) / ((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((b[13] * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) / (((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((b[14] * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) / ((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((b[15] * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) / (((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<17>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((((((((((((a[16] * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((((b[16] * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) * z + a[16]) / ((((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15]) * z + b[16]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<18>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((((((((((((a[17] * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((((b[17] * x + b[16]) * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) * z + a[16]) * z + a[17]) / (((((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15]) * z + b[16]) * z + b[17]));
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_19.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_19.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,246 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_RAT_19_HPP
+#define BOOST_MATH_TOOLS_POLY_RAT_19_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ if(x <= 1)
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((a[0] * z + a[1]) / (b[0] * z + b[1]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ if(x <= 1)
+ 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]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) / ((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) / (((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) / ((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) / (((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) / ((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) / (((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((b[12] * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) / ((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((b[13] * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) / (((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((b[14] * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) / ((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((b[15] * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) / (((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<17>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((((((((((((a[16] * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((((b[16] * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) * z + a[16]) / ((((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15]) * z + b[16]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<18>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((((((((((((a[17] * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((((b[17] * x + b[16]) * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) * z + a[16]) * z + a[17]) / (((((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15]) * z + b[16]) * z + b[17]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<19>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((((((((((((((a[18] * x + a[17]) * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((((((b[18] * x + b[17]) * x + b[16]) * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) * z + a[16]) * z + a[17]) * z + a[18]) / ((((((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15]) * z + b[16]) * z + b[17]) * z + b[18]));
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_2.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_2.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,42 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_RAT_2_HPP
+#define BOOST_MATH_TOOLS_POLY_RAT_2_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ if(x <= 1)
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((a[0] * z + a[1]) / (b[0] * z + b[1]));
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_20.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_20.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,258 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_RAT_20_HPP
+#define BOOST_MATH_TOOLS_POLY_RAT_20_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ if(x <= 1)
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((a[0] * z + a[1]) / (b[0] * z + b[1]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ if(x <= 1)
+ 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]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) / ((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) / (((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) / ((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) / (((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) / ((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) / (((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((b[12] * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) / ((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((b[13] * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) / (((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((b[14] * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) / ((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((b[15] * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) / (((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<17>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((((((((((((a[16] * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((((b[16] * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) * z + a[16]) / ((((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15]) * z + b[16]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<18>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((((((((((((a[17] * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((((b[17] * x + b[16]) * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) * z + a[16]) * z + a[17]) / (((((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15]) * z + b[16]) * z + b[17]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<19>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((((((((((((((a[18] * x + a[17]) * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((((((b[18] * x + b[17]) * x + b[16]) * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) * z + a[16]) * z + a[17]) * z + a[18]) / ((((((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15]) * z + b[16]) * z + b[17]) * z + b[18]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<20>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((((((((((((((a[19] * x + a[18]) * x + a[17]) * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((((((b[19] * x + b[18]) * x + b[17]) * x + b[16]) * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) * z + a[16]) * z + a[17]) * z + a[18]) * z + a[19]) / (((((((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15]) * z + b[16]) * z + b[17]) * z + b[18]) * z + b[19]));
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_3.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_3.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,54 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_RAT_3_HPP
+#define BOOST_MATH_TOOLS_POLY_RAT_3_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ if(x <= 1)
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((a[0] * z + a[1]) / (b[0] * z + b[1]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2]));
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_4.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_4.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,66 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_RAT_4_HPP
+#define BOOST_MATH_TOOLS_POLY_RAT_4_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ if(x <= 1)
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((a[0] * z + a[1]) / (b[0] * z + b[1]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ if(x <= 1)
+ 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]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3]));
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_5.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_5.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,78 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_RAT_5_HPP
+#define BOOST_MATH_TOOLS_POLY_RAT_5_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ if(x <= 1)
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((a[0] * z + a[1]) / (b[0] * z + b[1]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ if(x <= 1)
+ 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]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]));
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_6.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_6.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,90 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_RAT_6_HPP
+#define BOOST_MATH_TOOLS_POLY_RAT_6_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ if(x <= 1)
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((a[0] * z + a[1]) / (b[0] * z + b[1]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ if(x <= 1)
+ 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]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]));
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_7.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_7.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,102 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_RAT_7_HPP
+#define BOOST_MATH_TOOLS_POLY_RAT_7_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ if(x <= 1)
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((a[0] * z + a[1]) / (b[0] * z + b[1]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ if(x <= 1)
+ 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]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) / ((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]));
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_8.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_8.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,114 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_RAT_8_HPP
+#define BOOST_MATH_TOOLS_POLY_RAT_8_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ if(x <= 1)
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((a[0] * z + a[1]) / (b[0] * z + b[1]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ if(x <= 1)
+ 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]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) / ((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) / (((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]));
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_9.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner1_9.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,126 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using Horners rule
+#ifndef BOOST_MATH_TOOLS_POLY_RAT_9_HPP
+#define BOOST_MATH_TOOLS_POLY_RAT_9_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ if(x <= 1)
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((a[0] * z + a[1]) / (b[0] * z + b[1]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ if(x <= 1)
+ 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]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) / ((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*)
+{
+ if(x <= 1)
+ return static_cast<V>((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) / (((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*)
+{
+ if(x <= 1)
+ return static_cast<V>(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
+ else
+ {
+ V z = 1 / x;
+ return static_cast<V>(((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) / ((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]));
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_10.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_10.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,144 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_RAT_EVAL_10_HPP
+#define BOOST_MATH_TOOLS_RAT_EVAL_10_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ 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]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6] + ((a[1] * z2 + a[3]) * z2 + a[5]) * z) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6] + ((b[1] * z2 + b[3]) * z2 + b[5]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z + ((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z + ((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8] + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8] + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]));
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_11.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_11.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,160 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_RAT_EVAL_11_HPP
+#define BOOST_MATH_TOOLS_RAT_EVAL_11_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ 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]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6] + ((a[1] * z2 + a[3]) * z2 + a[5]) * z) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6] + ((b[1] * z2 + b[3]) * z2 + b[5]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z + ((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z + ((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8] + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8] + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10] + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10] + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z));
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_12.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_12.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,176 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_RAT_EVAL_12_HPP
+#define BOOST_MATH_TOOLS_RAT_EVAL_12_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ 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]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6] + ((a[1] * z2 + a[3]) * z2 + a[5]) * z) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6] + ((b[1] * z2 + b[3]) * z2 + b[5]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z + ((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z + ((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8] + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8] + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10] + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10] + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]));
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_13.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_13.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,192 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_RAT_EVAL_13_HPP
+#define BOOST_MATH_TOOLS_RAT_EVAL_13_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ 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]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6] + ((a[1] * z2 + a[3]) * z2 + a[5]) * z) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6] + ((b[1] * z2 + b[3]) * z2 + b[5]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z + ((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z + ((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8] + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8] + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10] + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10] + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12] + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12] + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z));
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_14.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_14.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,208 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_RAT_EVAL_14_HPP
+#define BOOST_MATH_TOOLS_RAT_EVAL_14_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ 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]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6] + ((a[1] * z2 + a[3]) * z2 + a[5]) * z) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6] + ((b[1] * z2 + b[3]) * z2 + b[5]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z + ((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z + ((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8] + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8] + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10] + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10] + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12] + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12] + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) / (((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]));
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_15.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_15.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,224 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_RAT_EVAL_15_HPP
+#define BOOST_MATH_TOOLS_RAT_EVAL_15_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ 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]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6] + ((a[1] * z2 + a[3]) * z2 + a[5]) * z) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6] + ((b[1] * z2 + b[3]) * z2 + b[5]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z + ((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z + ((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8] + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8] + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10] + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10] + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12] + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12] + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) / (((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((((b[14] * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14] + ((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z) / (((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14] + ((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z));
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_16.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_16.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,240 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_RAT_EVAL_16_HPP
+#define BOOST_MATH_TOOLS_RAT_EVAL_16_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ 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]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6] + ((a[1] * z2 + a[3]) * z2 + a[5]) * z) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6] + ((b[1] * z2 + b[3]) * z2 + b[5]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z + ((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z + ((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8] + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8] + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10] + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10] + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12] + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12] + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) / (((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((((b[14] * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14] + ((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z) / (((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14] + ((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((((b[15] * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((((b[14] * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14]) * z + ((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z2 + a[15]) / ((((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14]) * z + ((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z2 + b[15]));
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_17.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_17.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,256 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_RAT_EVAL_17_HPP
+#define BOOST_MATH_TOOLS_RAT_EVAL_17_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ 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]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6] + ((a[1] * z2 + a[3]) * z2 + a[5]) * z) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6] + ((b[1] * z2 + b[3]) * z2 + b[5]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z + ((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z + ((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8] + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8] + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10] + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10] + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12] + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12] + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) / (((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((((b[14] * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14] + ((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z) / (((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14] + ((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((((b[15] * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((((b[14] * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14]) * z + ((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z2 + a[15]) / ((((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14]) * z + ((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z2 + b[15]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<17>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((((b[16] * x2 + b[14]) * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((((b[15] * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14]) * z2 + a[16] + (((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z2 + a[15]) * z) / ((((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14]) * z2 + b[16] + (((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z2 + b[15]) * z));
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_18.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_18.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,272 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_RAT_EVAL_18_HPP
+#define BOOST_MATH_TOOLS_RAT_EVAL_18_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ 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]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6] + ((a[1] * z2 + a[3]) * z2 + a[5]) * z) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6] + ((b[1] * z2 + b[3]) * z2 + b[5]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z + ((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z + ((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8] + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8] + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10] + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10] + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12] + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12] + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) / (((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((((b[14] * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14] + ((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z) / (((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14] + ((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((((b[15] * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((((b[14] * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14]) * z + ((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z2 + a[15]) / ((((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14]) * z + ((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z2 + b[15]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<17>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((((b[16] * x2 + b[14]) * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((((b[15] * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14]) * z2 + a[16] + (((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z2 + a[15]) * z) / ((((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14]) * z2 + b[16] + (((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z2 + b[15]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<18>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((((((((a[17] * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((((((b[17] * x2 + b[15]) * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((((((b[16] * x2 + b[14]) * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14]) * z2 + a[16]) * z + (((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z2 + a[15]) * z2 + a[17]) / (((((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14]) * z2 + b[16]) * z + (((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z2 + b[15]) * z2 + b[17]));
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_19.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_19.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,288 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_RAT_EVAL_19_HPP
+#define BOOST_MATH_TOOLS_RAT_EVAL_19_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ 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]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6] + ((a[1] * z2 + a[3]) * z2 + a[5]) * z) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6] + ((b[1] * z2 + b[3]) * z2 + b[5]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z + ((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z + ((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8] + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8] + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10] + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10] + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12] + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12] + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) / (((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((((b[14] * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14] + ((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z) / (((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14] + ((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((((b[15] * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((((b[14] * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14]) * z + ((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z2 + a[15]) / ((((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14]) * z + ((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z2 + b[15]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<17>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((((b[16] * x2 + b[14]) * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((((b[15] * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14]) * z2 + a[16] + (((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z2 + a[15]) * z) / ((((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14]) * z2 + b[16] + (((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z2 + b[15]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<18>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((((((((a[17] * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((((((b[17] * x2 + b[15]) * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((((((b[16] * x2 + b[14]) * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14]) * z2 + a[16]) * z + (((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z2 + a[15]) * z2 + a[17]) / (((((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14]) * z2 + b[16]) * z + (((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z2 + b[15]) * z2 + b[17]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<19>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((((((((a[18] * x2 + a[16]) * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((((a[17] * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((((((b[18] * x2 + b[16]) * x2 + b[14]) * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((((((b[17] * x2 + b[15]) * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14]) * z2 + a[16]) * z2 + a[18] + ((((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z2 + a[15]) * z2 + a[17]) * z) / (((((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14]) * z2 + b[16]) * z2 + b[18] + ((((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z2 + b[15]) * z2 + b[17]) * z));
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_2.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_2.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,48 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_RAT_EVAL_2_HPP
+#define BOOST_MATH_TOOLS_RAT_EVAL_2_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ 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]));
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_20.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_20.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,304 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_RAT_EVAL_20_HPP
+#define BOOST_MATH_TOOLS_RAT_EVAL_20_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ 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]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6] + ((a[1] * z2 + a[3]) * z2 + a[5]) * z) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6] + ((b[1] * z2 + b[3]) * z2 + b[5]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z + ((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z + ((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8] + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8] + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10] + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10] + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12] + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12] + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) / (((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((((b[14] * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14] + ((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z) / (((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14] + ((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((((b[15] * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((((b[14] * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14]) * z + ((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z2 + a[15]) / ((((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14]) * z + ((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z2 + b[15]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<17>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((((b[16] * x2 + b[14]) * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((((b[15] * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14]) * z2 + a[16] + (((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z2 + a[15]) * z) / ((((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14]) * z2 + b[16] + (((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z2 + b[15]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<18>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((((((((a[17] * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((((((b[17] * x2 + b[15]) * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((((((b[16] * x2 + b[14]) * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14]) * z2 + a[16]) * z + (((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z2 + a[15]) * z2 + a[17]) / (((((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14]) * z2 + b[16]) * z + (((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z2 + b[15]) * z2 + b[17]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<19>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((((((((a[18] * x2 + a[16]) * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((((a[17] * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((((((b[18] * x2 + b[16]) * x2 + b[14]) * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((((((b[17] * x2 + b[15]) * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14]) * z2 + a[16]) * z2 + a[18] + ((((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z2 + a[15]) * z2 + a[17]) * z) / (((((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14]) * z2 + b[16]) * z2 + b[18] + ((((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z2 + b[15]) * z2 + b[17]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<20>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((((((((a[19] * x2 + a[17]) * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((((a[18] * x2 + a[16]) * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((((((b[19] * x2 + b[17]) * x2 + b[15]) * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((((((b[18] * x2 + b[16]) * x2 + b[14]) * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14]) * z2 + a[16]) * z2 + a[18]) * z + ((((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z2 + a[15]) * z2 + a[17]) * z2 + a[19]) / ((((((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14]) * z2 + b[16]) * z2 + b[18]) * z + ((((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z2 + b[15]) * z2 + b[17]) * z2 + b[19]));
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_3.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_3.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,48 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_RAT_EVAL_3_HPP
+#define BOOST_MATH_TOOLS_RAT_EVAL_3_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ 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]));
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_4.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_4.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,48 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_RAT_EVAL_4_HPP
+#define BOOST_MATH_TOOLS_RAT_EVAL_4_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ 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]));
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_5.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_5.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,64 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_RAT_EVAL_5_HPP
+#define BOOST_MATH_TOOLS_RAT_EVAL_5_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ 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]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z));
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_6.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_6.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,80 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_RAT_EVAL_6_HPP
+#define BOOST_MATH_TOOLS_RAT_EVAL_6_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ 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]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5]));
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_7.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_7.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,96 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_RAT_EVAL_7_HPP
+#define BOOST_MATH_TOOLS_RAT_EVAL_7_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ 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]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6] + ((a[1] * z2 + a[3]) * z2 + a[5]) * z) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6] + ((b[1] * z2 + b[3]) * z2 + b[5]) * z));
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_8.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_8.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,112 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_RAT_EVAL_8_HPP
+#define BOOST_MATH_TOOLS_RAT_EVAL_8_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ 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]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6] + ((a[1] * z2 + a[3]) * z2 + a[5]) * z) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6] + ((b[1] * z2 + b[3]) * z2 + b[5]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z + ((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z + ((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]));
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_9.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner2_9.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,128 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_RAT_EVAL_9_HPP
+#define BOOST_MATH_TOOLS_RAT_EVAL_9_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ 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]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6] + ((a[1] * z2 + a[3]) * z2 + a[5]) * z) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6] + ((b[1] * z2 + b[3]) * z2 + b[5]) * z));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z + ((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z + ((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]));
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ return static_cast<V>(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x));
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ return static_cast<V>(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8] + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8] + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z));
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_10.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_10.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,396 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_RAT_EVAL_10_HPP
+#define BOOST_MATH_TOOLS_RAT_EVAL_10_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ 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]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[4] * x2 + a[2];
+ t[1] = a[3] * x2 + a[1];
+ t[2] = b[4] * x2 + b[2];
+ t[3] = b[3] * x2 + b[1];
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[4]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[5] * x2 + a[3];
+ t[1] = a[4] * x2 + a[2];
+ t[2] = b[5] * x2 + b[3];
+ t[3] = b[4] * x2 + b[2];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[6] * x2 + a[4];
+ t[1] = a[5] * x2 + a[3];
+ t[2] = b[6] * x2 + b[4];
+ t[3] = b[5] * x2 + b[3];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[2] += static_cast<V>(b[6]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[7] * x2 + a[5];
+ t[1] = a[6] * x2 + a[4];
+ t[2] = b[7] * x2 + b[5];
+ t[3] = b[6] * x2 + b[4];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[8] * x2 + a[6];
+ t[1] = a[7] * x2 + a[5];
+ t[2] = b[8] * x2 + b[6];
+ t[3] = b[7] * x2 + b[5];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[2] += static_cast<V>(b[8]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[9] * x2 + a[7];
+ t[1] = a[8] * x2 + a[6];
+ t[2] = b[9] * x2 + b[7];
+ t[3] = b[8] * x2 + b[6];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[5]);
+ t[3] += static_cast<V>(b[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_11.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_11.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,482 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_RAT_EVAL_11_HPP
+#define BOOST_MATH_TOOLS_RAT_EVAL_11_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ 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]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[4] * x2 + a[2];
+ t[1] = a[3] * x2 + a[1];
+ t[2] = b[4] * x2 + b[2];
+ t[3] = b[3] * x2 + b[1];
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[4]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[5] * x2 + a[3];
+ t[1] = a[4] * x2 + a[2];
+ t[2] = b[5] * x2 + b[3];
+ t[3] = b[4] * x2 + b[2];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[6] * x2 + a[4];
+ t[1] = a[5] * x2 + a[3];
+ t[2] = b[6] * x2 + b[4];
+ t[3] = b[5] * x2 + b[3];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[2] += static_cast<V>(b[6]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[7] * x2 + a[5];
+ t[1] = a[6] * x2 + a[4];
+ t[2] = b[7] * x2 + b[5];
+ t[3] = b[6] * x2 + b[4];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[8] * x2 + a[6];
+ t[1] = a[7] * x2 + a[5];
+ t[2] = b[8] * x2 + b[6];
+ t[3] = b[7] * x2 + b[5];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[2] += static_cast<V>(b[8]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[9] * x2 + a[7];
+ t[1] = a[8] * x2 + a[6];
+ t[2] = b[9] * x2 + b[7];
+ t[3] = b[8] * x2 + b[6];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[5]);
+ t[3] += static_cast<V>(b[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[10] * x2 + a[8];
+ t[1] = a[9] * x2 + a[7];
+ t[2] = b[10] * x2 + b[8];
+ t[3] = b[9] * x2 + b[7];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[2] += static_cast<V>(b[10]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_12.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_12.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,576 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_RAT_EVAL_12_HPP
+#define BOOST_MATH_TOOLS_RAT_EVAL_12_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ 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]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[4] * x2 + a[2];
+ t[1] = a[3] * x2 + a[1];
+ t[2] = b[4] * x2 + b[2];
+ t[3] = b[3] * x2 + b[1];
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[4]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[5] * x2 + a[3];
+ t[1] = a[4] * x2 + a[2];
+ t[2] = b[5] * x2 + b[3];
+ t[3] = b[4] * x2 + b[2];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[6] * x2 + a[4];
+ t[1] = a[5] * x2 + a[3];
+ t[2] = b[6] * x2 + b[4];
+ t[3] = b[5] * x2 + b[3];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[2] += static_cast<V>(b[6]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[7] * x2 + a[5];
+ t[1] = a[6] * x2 + a[4];
+ t[2] = b[7] * x2 + b[5];
+ t[3] = b[6] * x2 + b[4];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[8] * x2 + a[6];
+ t[1] = a[7] * x2 + a[5];
+ t[2] = b[8] * x2 + b[6];
+ t[3] = b[7] * x2 + b[5];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[2] += static_cast<V>(b[8]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[9] * x2 + a[7];
+ t[1] = a[8] * x2 + a[6];
+ t[2] = b[9] * x2 + b[7];
+ t[3] = b[8] * x2 + b[6];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[5]);
+ t[3] += static_cast<V>(b[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[10] * x2 + a[8];
+ t[1] = a[9] * x2 + a[7];
+ t[2] = b[10] * x2 + b[8];
+ t[3] = b[9] * x2 + b[7];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[2] += static_cast<V>(b[10]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[11] * x2 + a[9];
+ t[1] = a[10] * x2 + a[8];
+ t[2] = b[11] * x2 + b[9];
+ t[3] = b[10] * x2 + b[8];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[2] += static_cast<V>(b[7]);
+ t[3] += static_cast<V>(b[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[5]);
+ t[3] += static_cast<V>(b[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_13.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_13.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,678 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_RAT_EVAL_13_HPP
+#define BOOST_MATH_TOOLS_RAT_EVAL_13_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ 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]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[4] * x2 + a[2];
+ t[1] = a[3] * x2 + a[1];
+ t[2] = b[4] * x2 + b[2];
+ t[3] = b[3] * x2 + b[1];
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[4]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[5] * x2 + a[3];
+ t[1] = a[4] * x2 + a[2];
+ t[2] = b[5] * x2 + b[3];
+ t[3] = b[4] * x2 + b[2];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[6] * x2 + a[4];
+ t[1] = a[5] * x2 + a[3];
+ t[2] = b[6] * x2 + b[4];
+ t[3] = b[5] * x2 + b[3];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[2] += static_cast<V>(b[6]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[7] * x2 + a[5];
+ t[1] = a[6] * x2 + a[4];
+ t[2] = b[7] * x2 + b[5];
+ t[3] = b[6] * x2 + b[4];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[8] * x2 + a[6];
+ t[1] = a[7] * x2 + a[5];
+ t[2] = b[8] * x2 + b[6];
+ t[3] = b[7] * x2 + b[5];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[2] += static_cast<V>(b[8]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[9] * x2 + a[7];
+ t[1] = a[8] * x2 + a[6];
+ t[2] = b[9] * x2 + b[7];
+ t[3] = b[8] * x2 + b[6];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[5]);
+ t[3] += static_cast<V>(b[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[10] * x2 + a[8];
+ t[1] = a[9] * x2 + a[7];
+ t[2] = b[10] * x2 + b[8];
+ t[3] = b[9] * x2 + b[7];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[2] += static_cast<V>(b[10]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[11] * x2 + a[9];
+ t[1] = a[10] * x2 + a[8];
+ t[2] = b[11] * x2 + b[9];
+ t[3] = b[10] * x2 + b[8];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[2] += static_cast<V>(b[7]);
+ t[3] += static_cast<V>(b[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[5]);
+ t[3] += static_cast<V>(b[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[12] * x2 + a[10];
+ t[1] = a[11] * x2 + a[9];
+ t[2] = b[12] * x2 + b[10];
+ t[3] = b[11] * x2 + b[9];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[12]);
+ t[2] += static_cast<V>(b[12]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_14.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_14.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,788 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_RAT_EVAL_14_HPP
+#define BOOST_MATH_TOOLS_RAT_EVAL_14_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ 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]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[4] * x2 + a[2];
+ t[1] = a[3] * x2 + a[1];
+ t[2] = b[4] * x2 + b[2];
+ t[3] = b[3] * x2 + b[1];
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[4]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[5] * x2 + a[3];
+ t[1] = a[4] * x2 + a[2];
+ t[2] = b[5] * x2 + b[3];
+ t[3] = b[4] * x2 + b[2];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[6] * x2 + a[4];
+ t[1] = a[5] * x2 + a[3];
+ t[2] = b[6] * x2 + b[4];
+ t[3] = b[5] * x2 + b[3];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[2] += static_cast<V>(b[6]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[7] * x2 + a[5];
+ t[1] = a[6] * x2 + a[4];
+ t[2] = b[7] * x2 + b[5];
+ t[3] = b[6] * x2 + b[4];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[8] * x2 + a[6];
+ t[1] = a[7] * x2 + a[5];
+ t[2] = b[8] * x2 + b[6];
+ t[3] = b[7] * x2 + b[5];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[2] += static_cast<V>(b[8]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[9] * x2 + a[7];
+ t[1] = a[8] * x2 + a[6];
+ t[2] = b[9] * x2 + b[7];
+ t[3] = b[8] * x2 + b[6];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[5]);
+ t[3] += static_cast<V>(b[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[10] * x2 + a[8];
+ t[1] = a[9] * x2 + a[7];
+ t[2] = b[10] * x2 + b[8];
+ t[3] = b[9] * x2 + b[7];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[2] += static_cast<V>(b[10]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[11] * x2 + a[9];
+ t[1] = a[10] * x2 + a[8];
+ t[2] = b[11] * x2 + b[9];
+ t[3] = b[10] * x2 + b[8];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[2] += static_cast<V>(b[7]);
+ t[3] += static_cast<V>(b[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[5]);
+ t[3] += static_cast<V>(b[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[12] * x2 + a[10];
+ t[1] = a[11] * x2 + a[9];
+ t[2] = b[12] * x2 + b[10];
+ t[3] = b[11] * x2 + b[9];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[12]);
+ t[2] += static_cast<V>(b[12]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[13] * x2 + a[11];
+ t[1] = a[12] * x2 + a[10];
+ t[2] = b[13] * x2 + b[11];
+ t[3] = b[12] * x2 + b[10];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[9]);
+ t[1] += static_cast<V>(a[8]);
+ t[2] += static_cast<V>(b[9]);
+ t[3] += static_cast<V>(b[8]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[2] += static_cast<V>(b[7]);
+ t[3] += static_cast<V>(b[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[5]);
+ t[3] += static_cast<V>(b[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[12]);
+ t[1] += static_cast<V>(a[13]);
+ t[2] += static_cast<V>(b[12]);
+ t[3] += static_cast<V>(b[13]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_15.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_15.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,906 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_RAT_EVAL_15_HPP
+#define BOOST_MATH_TOOLS_RAT_EVAL_15_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ 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]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[4] * x2 + a[2];
+ t[1] = a[3] * x2 + a[1];
+ t[2] = b[4] * x2 + b[2];
+ t[3] = b[3] * x2 + b[1];
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[4]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[5] * x2 + a[3];
+ t[1] = a[4] * x2 + a[2];
+ t[2] = b[5] * x2 + b[3];
+ t[3] = b[4] * x2 + b[2];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[6] * x2 + a[4];
+ t[1] = a[5] * x2 + a[3];
+ t[2] = b[6] * x2 + b[4];
+ t[3] = b[5] * x2 + b[3];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[2] += static_cast<V>(b[6]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[7] * x2 + a[5];
+ t[1] = a[6] * x2 + a[4];
+ t[2] = b[7] * x2 + b[5];
+ t[3] = b[6] * x2 + b[4];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[8] * x2 + a[6];
+ t[1] = a[7] * x2 + a[5];
+ t[2] = b[8] * x2 + b[6];
+ t[3] = b[7] * x2 + b[5];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[2] += static_cast<V>(b[8]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[9] * x2 + a[7];
+ t[1] = a[8] * x2 + a[6];
+ t[2] = b[9] * x2 + b[7];
+ t[3] = b[8] * x2 + b[6];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[5]);
+ t[3] += static_cast<V>(b[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[10] * x2 + a[8];
+ t[1] = a[9] * x2 + a[7];
+ t[2] = b[10] * x2 + b[8];
+ t[3] = b[9] * x2 + b[7];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[2] += static_cast<V>(b[10]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[11] * x2 + a[9];
+ t[1] = a[10] * x2 + a[8];
+ t[2] = b[11] * x2 + b[9];
+ t[3] = b[10] * x2 + b[8];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[2] += static_cast<V>(b[7]);
+ t[3] += static_cast<V>(b[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[5]);
+ t[3] += static_cast<V>(b[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[12] * x2 + a[10];
+ t[1] = a[11] * x2 + a[9];
+ t[2] = b[12] * x2 + b[10];
+ t[3] = b[11] * x2 + b[9];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[12]);
+ t[2] += static_cast<V>(b[12]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[13] * x2 + a[11];
+ t[1] = a[12] * x2 + a[10];
+ t[2] = b[13] * x2 + b[11];
+ t[3] = b[12] * x2 + b[10];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[9]);
+ t[1] += static_cast<V>(a[8]);
+ t[2] += static_cast<V>(b[9]);
+ t[3] += static_cast<V>(b[8]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[2] += static_cast<V>(b[7]);
+ t[3] += static_cast<V>(b[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[5]);
+ t[3] += static_cast<V>(b[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[12]);
+ t[1] += static_cast<V>(a[13]);
+ t[2] += static_cast<V>(b[12]);
+ t[3] += static_cast<V>(b[13]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[14] * x2 + a[12];
+ t[1] = a[13] * x2 + a[11];
+ t[2] = b[14] * x2 + b[12];
+ t[3] = b[13] * x2 + b[11];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[12]);
+ t[1] += static_cast<V>(a[13]);
+ t[2] += static_cast<V>(b[12]);
+ t[3] += static_cast<V>(b[13]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[14]);
+ t[2] += static_cast<V>(b[14]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_16.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_16.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,1032 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_RAT_EVAL_16_HPP
+#define BOOST_MATH_TOOLS_RAT_EVAL_16_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ 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]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[4] * x2 + a[2];
+ t[1] = a[3] * x2 + a[1];
+ t[2] = b[4] * x2 + b[2];
+ t[3] = b[3] * x2 + b[1];
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[4]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[5] * x2 + a[3];
+ t[1] = a[4] * x2 + a[2];
+ t[2] = b[5] * x2 + b[3];
+ t[3] = b[4] * x2 + b[2];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[6] * x2 + a[4];
+ t[1] = a[5] * x2 + a[3];
+ t[2] = b[6] * x2 + b[4];
+ t[3] = b[5] * x2 + b[3];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[2] += static_cast<V>(b[6]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[7] * x2 + a[5];
+ t[1] = a[6] * x2 + a[4];
+ t[2] = b[7] * x2 + b[5];
+ t[3] = b[6] * x2 + b[4];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[8] * x2 + a[6];
+ t[1] = a[7] * x2 + a[5];
+ t[2] = b[8] * x2 + b[6];
+ t[3] = b[7] * x2 + b[5];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[2] += static_cast<V>(b[8]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[9] * x2 + a[7];
+ t[1] = a[8] * x2 + a[6];
+ t[2] = b[9] * x2 + b[7];
+ t[3] = b[8] * x2 + b[6];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[5]);
+ t[3] += static_cast<V>(b[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[10] * x2 + a[8];
+ t[1] = a[9] * x2 + a[7];
+ t[2] = b[10] * x2 + b[8];
+ t[3] = b[9] * x2 + b[7];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[2] += static_cast<V>(b[10]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[11] * x2 + a[9];
+ t[1] = a[10] * x2 + a[8];
+ t[2] = b[11] * x2 + b[9];
+ t[3] = b[10] * x2 + b[8];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[2] += static_cast<V>(b[7]);
+ t[3] += static_cast<V>(b[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[5]);
+ t[3] += static_cast<V>(b[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[12] * x2 + a[10];
+ t[1] = a[11] * x2 + a[9];
+ t[2] = b[12] * x2 + b[10];
+ t[3] = b[11] * x2 + b[9];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[12]);
+ t[2] += static_cast<V>(b[12]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[13] * x2 + a[11];
+ t[1] = a[12] * x2 + a[10];
+ t[2] = b[13] * x2 + b[11];
+ t[3] = b[12] * x2 + b[10];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[9]);
+ t[1] += static_cast<V>(a[8]);
+ t[2] += static_cast<V>(b[9]);
+ t[3] += static_cast<V>(b[8]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[2] += static_cast<V>(b[7]);
+ t[3] += static_cast<V>(b[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[5]);
+ t[3] += static_cast<V>(b[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[12]);
+ t[1] += static_cast<V>(a[13]);
+ t[2] += static_cast<V>(b[12]);
+ t[3] += static_cast<V>(b[13]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[14] * x2 + a[12];
+ t[1] = a[13] * x2 + a[11];
+ t[2] = b[14] * x2 + b[12];
+ t[3] = b[13] * x2 + b[11];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[12]);
+ t[1] += static_cast<V>(a[13]);
+ t[2] += static_cast<V>(b[12]);
+ t[3] += static_cast<V>(b[13]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[14]);
+ t[2] += static_cast<V>(b[14]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[15] * x2 + a[13];
+ t[1] = a[14] * x2 + a[12];
+ t[2] = b[15] * x2 + b[13];
+ t[3] = b[14] * x2 + b[12];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[11]);
+ t[1] += static_cast<V>(a[10]);
+ t[2] += static_cast<V>(b[11]);
+ t[3] += static_cast<V>(b[10]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[9]);
+ t[1] += static_cast<V>(a[8]);
+ t[2] += static_cast<V>(b[9]);
+ t[3] += static_cast<V>(b[8]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[2] += static_cast<V>(b[7]);
+ t[3] += static_cast<V>(b[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[5]);
+ t[3] += static_cast<V>(b[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[12]);
+ t[1] += static_cast<V>(a[13]);
+ t[2] += static_cast<V>(b[12]);
+ t[3] += static_cast<V>(b[13]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[14]);
+ t[1] += static_cast<V>(a[15]);
+ t[2] += static_cast<V>(b[14]);
+ t[3] += static_cast<V>(b[15]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_17.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_17.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,1166 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_RAT_EVAL_17_HPP
+#define BOOST_MATH_TOOLS_RAT_EVAL_17_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ 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]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[4] * x2 + a[2];
+ t[1] = a[3] * x2 + a[1];
+ t[2] = b[4] * x2 + b[2];
+ t[3] = b[3] * x2 + b[1];
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[4]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[5] * x2 + a[3];
+ t[1] = a[4] * x2 + a[2];
+ t[2] = b[5] * x2 + b[3];
+ t[3] = b[4] * x2 + b[2];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[6] * x2 + a[4];
+ t[1] = a[5] * x2 + a[3];
+ t[2] = b[6] * x2 + b[4];
+ t[3] = b[5] * x2 + b[3];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[2] += static_cast<V>(b[6]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[7] * x2 + a[5];
+ t[1] = a[6] * x2 + a[4];
+ t[2] = b[7] * x2 + b[5];
+ t[3] = b[6] * x2 + b[4];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[8] * x2 + a[6];
+ t[1] = a[7] * x2 + a[5];
+ t[2] = b[8] * x2 + b[6];
+ t[3] = b[7] * x2 + b[5];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[2] += static_cast<V>(b[8]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[9] * x2 + a[7];
+ t[1] = a[8] * x2 + a[6];
+ t[2] = b[9] * x2 + b[7];
+ t[3] = b[8] * x2 + b[6];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[5]);
+ t[3] += static_cast<V>(b[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[10] * x2 + a[8];
+ t[1] = a[9] * x2 + a[7];
+ t[2] = b[10] * x2 + b[8];
+ t[3] = b[9] * x2 + b[7];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[2] += static_cast<V>(b[10]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[11] * x2 + a[9];
+ t[1] = a[10] * x2 + a[8];
+ t[2] = b[11] * x2 + b[9];
+ t[3] = b[10] * x2 + b[8];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[2] += static_cast<V>(b[7]);
+ t[3] += static_cast<V>(b[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[5]);
+ t[3] += static_cast<V>(b[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[12] * x2 + a[10];
+ t[1] = a[11] * x2 + a[9];
+ t[2] = b[12] * x2 + b[10];
+ t[3] = b[11] * x2 + b[9];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[12]);
+ t[2] += static_cast<V>(b[12]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[13] * x2 + a[11];
+ t[1] = a[12] * x2 + a[10];
+ t[2] = b[13] * x2 + b[11];
+ t[3] = b[12] * x2 + b[10];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[9]);
+ t[1] += static_cast<V>(a[8]);
+ t[2] += static_cast<V>(b[9]);
+ t[3] += static_cast<V>(b[8]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[2] += static_cast<V>(b[7]);
+ t[3] += static_cast<V>(b[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[5]);
+ t[3] += static_cast<V>(b[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[12]);
+ t[1] += static_cast<V>(a[13]);
+ t[2] += static_cast<V>(b[12]);
+ t[3] += static_cast<V>(b[13]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[14] * x2 + a[12];
+ t[1] = a[13] * x2 + a[11];
+ t[2] = b[14] * x2 + b[12];
+ t[3] = b[13] * x2 + b[11];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[12]);
+ t[1] += static_cast<V>(a[13]);
+ t[2] += static_cast<V>(b[12]);
+ t[3] += static_cast<V>(b[13]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[14]);
+ t[2] += static_cast<V>(b[14]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[15] * x2 + a[13];
+ t[1] = a[14] * x2 + a[12];
+ t[2] = b[15] * x2 + b[13];
+ t[3] = b[14] * x2 + b[12];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[11]);
+ t[1] += static_cast<V>(a[10]);
+ t[2] += static_cast<V>(b[11]);
+ t[3] += static_cast<V>(b[10]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[9]);
+ t[1] += static_cast<V>(a[8]);
+ t[2] += static_cast<V>(b[9]);
+ t[3] += static_cast<V>(b[8]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[2] += static_cast<V>(b[7]);
+ t[3] += static_cast<V>(b[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[5]);
+ t[3] += static_cast<V>(b[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[12]);
+ t[1] += static_cast<V>(a[13]);
+ t[2] += static_cast<V>(b[12]);
+ t[3] += static_cast<V>(b[13]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[14]);
+ t[1] += static_cast<V>(a[15]);
+ t[2] += static_cast<V>(b[14]);
+ t[3] += static_cast<V>(b[15]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<17>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[16] * x2 + a[14];
+ t[1] = a[15] * x2 + a[13];
+ t[2] = b[16] * x2 + b[14];
+ t[3] = b[15] * x2 + b[13];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[12]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[12]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[12]);
+ t[1] += static_cast<V>(a[13]);
+ t[2] += static_cast<V>(b[12]);
+ t[3] += static_cast<V>(b[13]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[14]);
+ t[1] += static_cast<V>(a[15]);
+ t[2] += static_cast<V>(b[14]);
+ t[3] += static_cast<V>(b[15]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[16]);
+ t[2] += static_cast<V>(b[16]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_18.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_18.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,1308 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_RAT_EVAL_18_HPP
+#define BOOST_MATH_TOOLS_RAT_EVAL_18_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ 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]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[4] * x2 + a[2];
+ t[1] = a[3] * x2 + a[1];
+ t[2] = b[4] * x2 + b[2];
+ t[3] = b[3] * x2 + b[1];
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[4]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[5] * x2 + a[3];
+ t[1] = a[4] * x2 + a[2];
+ t[2] = b[5] * x2 + b[3];
+ t[3] = b[4] * x2 + b[2];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[6] * x2 + a[4];
+ t[1] = a[5] * x2 + a[3];
+ t[2] = b[6] * x2 + b[4];
+ t[3] = b[5] * x2 + b[3];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[2] += static_cast<V>(b[6]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[7] * x2 + a[5];
+ t[1] = a[6] * x2 + a[4];
+ t[2] = b[7] * x2 + b[5];
+ t[3] = b[6] * x2 + b[4];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[8] * x2 + a[6];
+ t[1] = a[7] * x2 + a[5];
+ t[2] = b[8] * x2 + b[6];
+ t[3] = b[7] * x2 + b[5];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[2] += static_cast<V>(b[8]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[9] * x2 + a[7];
+ t[1] = a[8] * x2 + a[6];
+ t[2] = b[9] * x2 + b[7];
+ t[3] = b[8] * x2 + b[6];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[5]);
+ t[3] += static_cast<V>(b[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[10] * x2 + a[8];
+ t[1] = a[9] * x2 + a[7];
+ t[2] = b[10] * x2 + b[8];
+ t[3] = b[9] * x2 + b[7];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[2] += static_cast<V>(b[10]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[11] * x2 + a[9];
+ t[1] = a[10] * x2 + a[8];
+ t[2] = b[11] * x2 + b[9];
+ t[3] = b[10] * x2 + b[8];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[2] += static_cast<V>(b[7]);
+ t[3] += static_cast<V>(b[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[5]);
+ t[3] += static_cast<V>(b[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[12] * x2 + a[10];
+ t[1] = a[11] * x2 + a[9];
+ t[2] = b[12] * x2 + b[10];
+ t[3] = b[11] * x2 + b[9];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[12]);
+ t[2] += static_cast<V>(b[12]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[13] * x2 + a[11];
+ t[1] = a[12] * x2 + a[10];
+ t[2] = b[13] * x2 + b[11];
+ t[3] = b[12] * x2 + b[10];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[9]);
+ t[1] += static_cast<V>(a[8]);
+ t[2] += static_cast<V>(b[9]);
+ t[3] += static_cast<V>(b[8]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[2] += static_cast<V>(b[7]);
+ t[3] += static_cast<V>(b[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[5]);
+ t[3] += static_cast<V>(b[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[12]);
+ t[1] += static_cast<V>(a[13]);
+ t[2] += static_cast<V>(b[12]);
+ t[3] += static_cast<V>(b[13]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[14] * x2 + a[12];
+ t[1] = a[13] * x2 + a[11];
+ t[2] = b[14] * x2 + b[12];
+ t[3] = b[13] * x2 + b[11];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[12]);
+ t[1] += static_cast<V>(a[13]);
+ t[2] += static_cast<V>(b[12]);
+ t[3] += static_cast<V>(b[13]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[14]);
+ t[2] += static_cast<V>(b[14]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[15] * x2 + a[13];
+ t[1] = a[14] * x2 + a[12];
+ t[2] = b[15] * x2 + b[13];
+ t[3] = b[14] * x2 + b[12];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[11]);
+ t[1] += static_cast<V>(a[10]);
+ t[2] += static_cast<V>(b[11]);
+ t[3] += static_cast<V>(b[10]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[9]);
+ t[1] += static_cast<V>(a[8]);
+ t[2] += static_cast<V>(b[9]);
+ t[3] += static_cast<V>(b[8]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[2] += static_cast<V>(b[7]);
+ t[3] += static_cast<V>(b[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[5]);
+ t[3] += static_cast<V>(b[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[12]);
+ t[1] += static_cast<V>(a[13]);
+ t[2] += static_cast<V>(b[12]);
+ t[3] += static_cast<V>(b[13]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[14]);
+ t[1] += static_cast<V>(a[15]);
+ t[2] += static_cast<V>(b[14]);
+ t[3] += static_cast<V>(b[15]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<17>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[16] * x2 + a[14];
+ t[1] = a[15] * x2 + a[13];
+ t[2] = b[16] * x2 + b[14];
+ t[3] = b[15] * x2 + b[13];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[12]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[12]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[12]);
+ t[1] += static_cast<V>(a[13]);
+ t[2] += static_cast<V>(b[12]);
+ t[3] += static_cast<V>(b[13]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[14]);
+ t[1] += static_cast<V>(a[15]);
+ t[2] += static_cast<V>(b[14]);
+ t[3] += static_cast<V>(b[15]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[16]);
+ t[2] += static_cast<V>(b[16]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<18>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[17] * x2 + a[15];
+ t[1] = a[16] * x2 + a[14];
+ t[2] = b[17] * x2 + b[15];
+ t[3] = b[16] * x2 + b[14];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[13]);
+ t[1] += static_cast<V>(a[12]);
+ t[2] += static_cast<V>(b[13]);
+ t[3] += static_cast<V>(b[12]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[11]);
+ t[1] += static_cast<V>(a[10]);
+ t[2] += static_cast<V>(b[11]);
+ t[3] += static_cast<V>(b[10]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[9]);
+ t[1] += static_cast<V>(a[8]);
+ t[2] += static_cast<V>(b[9]);
+ t[3] += static_cast<V>(b[8]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[2] += static_cast<V>(b[7]);
+ t[3] += static_cast<V>(b[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[5]);
+ t[3] += static_cast<V>(b[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[12]);
+ t[1] += static_cast<V>(a[13]);
+ t[2] += static_cast<V>(b[12]);
+ t[3] += static_cast<V>(b[13]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[14]);
+ t[1] += static_cast<V>(a[15]);
+ t[2] += static_cast<V>(b[14]);
+ t[3] += static_cast<V>(b[15]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[16]);
+ t[1] += static_cast<V>(a[17]);
+ t[2] += static_cast<V>(b[16]);
+ t[3] += static_cast<V>(b[17]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_19.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_19.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,1458 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_RAT_EVAL_19_HPP
+#define BOOST_MATH_TOOLS_RAT_EVAL_19_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ 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]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[4] * x2 + a[2];
+ t[1] = a[3] * x2 + a[1];
+ t[2] = b[4] * x2 + b[2];
+ t[3] = b[3] * x2 + b[1];
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[4]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[5] * x2 + a[3];
+ t[1] = a[4] * x2 + a[2];
+ t[2] = b[5] * x2 + b[3];
+ t[3] = b[4] * x2 + b[2];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[6] * x2 + a[4];
+ t[1] = a[5] * x2 + a[3];
+ t[2] = b[6] * x2 + b[4];
+ t[3] = b[5] * x2 + b[3];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[2] += static_cast<V>(b[6]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[7] * x2 + a[5];
+ t[1] = a[6] * x2 + a[4];
+ t[2] = b[7] * x2 + b[5];
+ t[3] = b[6] * x2 + b[4];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[8] * x2 + a[6];
+ t[1] = a[7] * x2 + a[5];
+ t[2] = b[8] * x2 + b[6];
+ t[3] = b[7] * x2 + b[5];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[2] += static_cast<V>(b[8]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[9] * x2 + a[7];
+ t[1] = a[8] * x2 + a[6];
+ t[2] = b[9] * x2 + b[7];
+ t[3] = b[8] * x2 + b[6];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[5]);
+ t[3] += static_cast<V>(b[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[10] * x2 + a[8];
+ t[1] = a[9] * x2 + a[7];
+ t[2] = b[10] * x2 + b[8];
+ t[3] = b[9] * x2 + b[7];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[2] += static_cast<V>(b[10]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[11] * x2 + a[9];
+ t[1] = a[10] * x2 + a[8];
+ t[2] = b[11] * x2 + b[9];
+ t[3] = b[10] * x2 + b[8];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[2] += static_cast<V>(b[7]);
+ t[3] += static_cast<V>(b[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[5]);
+ t[3] += static_cast<V>(b[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[12] * x2 + a[10];
+ t[1] = a[11] * x2 + a[9];
+ t[2] = b[12] * x2 + b[10];
+ t[3] = b[11] * x2 + b[9];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[12]);
+ t[2] += static_cast<V>(b[12]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[13] * x2 + a[11];
+ t[1] = a[12] * x2 + a[10];
+ t[2] = b[13] * x2 + b[11];
+ t[3] = b[12] * x2 + b[10];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[9]);
+ t[1] += static_cast<V>(a[8]);
+ t[2] += static_cast<V>(b[9]);
+ t[3] += static_cast<V>(b[8]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[2] += static_cast<V>(b[7]);
+ t[3] += static_cast<V>(b[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[5]);
+ t[3] += static_cast<V>(b[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[12]);
+ t[1] += static_cast<V>(a[13]);
+ t[2] += static_cast<V>(b[12]);
+ t[3] += static_cast<V>(b[13]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[14] * x2 + a[12];
+ t[1] = a[13] * x2 + a[11];
+ t[2] = b[14] * x2 + b[12];
+ t[3] = b[13] * x2 + b[11];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[12]);
+ t[1] += static_cast<V>(a[13]);
+ t[2] += static_cast<V>(b[12]);
+ t[3] += static_cast<V>(b[13]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[14]);
+ t[2] += static_cast<V>(b[14]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[15] * x2 + a[13];
+ t[1] = a[14] * x2 + a[12];
+ t[2] = b[15] * x2 + b[13];
+ t[3] = b[14] * x2 + b[12];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[11]);
+ t[1] += static_cast<V>(a[10]);
+ t[2] += static_cast<V>(b[11]);
+ t[3] += static_cast<V>(b[10]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[9]);
+ t[1] += static_cast<V>(a[8]);
+ t[2] += static_cast<V>(b[9]);
+ t[3] += static_cast<V>(b[8]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[2] += static_cast<V>(b[7]);
+ t[3] += static_cast<V>(b[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[5]);
+ t[3] += static_cast<V>(b[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[12]);
+ t[1] += static_cast<V>(a[13]);
+ t[2] += static_cast<V>(b[12]);
+ t[3] += static_cast<V>(b[13]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[14]);
+ t[1] += static_cast<V>(a[15]);
+ t[2] += static_cast<V>(b[14]);
+ t[3] += static_cast<V>(b[15]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<17>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[16] * x2 + a[14];
+ t[1] = a[15] * x2 + a[13];
+ t[2] = b[16] * x2 + b[14];
+ t[3] = b[15] * x2 + b[13];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[12]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[12]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[12]);
+ t[1] += static_cast<V>(a[13]);
+ t[2] += static_cast<V>(b[12]);
+ t[3] += static_cast<V>(b[13]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[14]);
+ t[1] += static_cast<V>(a[15]);
+ t[2] += static_cast<V>(b[14]);
+ t[3] += static_cast<V>(b[15]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[16]);
+ t[2] += static_cast<V>(b[16]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<18>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[17] * x2 + a[15];
+ t[1] = a[16] * x2 + a[14];
+ t[2] = b[17] * x2 + b[15];
+ t[3] = b[16] * x2 + b[14];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[13]);
+ t[1] += static_cast<V>(a[12]);
+ t[2] += static_cast<V>(b[13]);
+ t[3] += static_cast<V>(b[12]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[11]);
+ t[1] += static_cast<V>(a[10]);
+ t[2] += static_cast<V>(b[11]);
+ t[3] += static_cast<V>(b[10]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[9]);
+ t[1] += static_cast<V>(a[8]);
+ t[2] += static_cast<V>(b[9]);
+ t[3] += static_cast<V>(b[8]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[2] += static_cast<V>(b[7]);
+ t[3] += static_cast<V>(b[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[5]);
+ t[3] += static_cast<V>(b[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[12]);
+ t[1] += static_cast<V>(a[13]);
+ t[2] += static_cast<V>(b[12]);
+ t[3] += static_cast<V>(b[13]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[14]);
+ t[1] += static_cast<V>(a[15]);
+ t[2] += static_cast<V>(b[14]);
+ t[3] += static_cast<V>(b[15]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[16]);
+ t[1] += static_cast<V>(a[17]);
+ t[2] += static_cast<V>(b[16]);
+ t[3] += static_cast<V>(b[17]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<19>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[18] * x2 + a[16];
+ t[1] = a[17] * x2 + a[15];
+ t[2] = b[18] * x2 + b[16];
+ t[3] = b[17] * x2 + b[15];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[14]);
+ t[1] += static_cast<V>(a[13]);
+ t[2] += static_cast<V>(b[14]);
+ t[3] += static_cast<V>(b[13]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[12]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[12]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[12]);
+ t[1] += static_cast<V>(a[13]);
+ t[2] += static_cast<V>(b[12]);
+ t[3] += static_cast<V>(b[13]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[14]);
+ t[1] += static_cast<V>(a[15]);
+ t[2] += static_cast<V>(b[14]);
+ t[3] += static_cast<V>(b[15]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[16]);
+ t[1] += static_cast<V>(a[17]);
+ t[2] += static_cast<V>(b[16]);
+ t[3] += static_cast<V>(b[17]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[18]);
+ t[2] += static_cast<V>(b[18]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_2.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_2.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,48 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_RAT_EVAL_2_HPP
+#define BOOST_MATH_TOOLS_RAT_EVAL_2_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ 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]));
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_20.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_20.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,1616 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_RAT_EVAL_20_HPP
+#define BOOST_MATH_TOOLS_RAT_EVAL_20_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ 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]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[4] * x2 + a[2];
+ t[1] = a[3] * x2 + a[1];
+ t[2] = b[4] * x2 + b[2];
+ t[3] = b[3] * x2 + b[1];
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[4]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[5] * x2 + a[3];
+ t[1] = a[4] * x2 + a[2];
+ t[2] = b[5] * x2 + b[3];
+ t[3] = b[4] * x2 + b[2];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[6] * x2 + a[4];
+ t[1] = a[5] * x2 + a[3];
+ t[2] = b[6] * x2 + b[4];
+ t[3] = b[5] * x2 + b[3];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[2] += static_cast<V>(b[6]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[7] * x2 + a[5];
+ t[1] = a[6] * x2 + a[4];
+ t[2] = b[7] * x2 + b[5];
+ t[3] = b[6] * x2 + b[4];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[8] * x2 + a[6];
+ t[1] = a[7] * x2 + a[5];
+ t[2] = b[8] * x2 + b[6];
+ t[3] = b[7] * x2 + b[5];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[2] += static_cast<V>(b[8]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[9] * x2 + a[7];
+ t[1] = a[8] * x2 + a[6];
+ t[2] = b[9] * x2 + b[7];
+ t[3] = b[8] * x2 + b[6];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[5]);
+ t[3] += static_cast<V>(b[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[10] * x2 + a[8];
+ t[1] = a[9] * x2 + a[7];
+ t[2] = b[10] * x2 + b[8];
+ t[3] = b[9] * x2 + b[7];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[2] += static_cast<V>(b[10]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[11] * x2 + a[9];
+ t[1] = a[10] * x2 + a[8];
+ t[2] = b[11] * x2 + b[9];
+ t[3] = b[10] * x2 + b[8];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[2] += static_cast<V>(b[7]);
+ t[3] += static_cast<V>(b[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[5]);
+ t[3] += static_cast<V>(b[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[12] * x2 + a[10];
+ t[1] = a[11] * x2 + a[9];
+ t[2] = b[12] * x2 + b[10];
+ t[3] = b[11] * x2 + b[9];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[12]);
+ t[2] += static_cast<V>(b[12]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[13] * x2 + a[11];
+ t[1] = a[12] * x2 + a[10];
+ t[2] = b[13] * x2 + b[11];
+ t[3] = b[12] * x2 + b[10];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[9]);
+ t[1] += static_cast<V>(a[8]);
+ t[2] += static_cast<V>(b[9]);
+ t[3] += static_cast<V>(b[8]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[2] += static_cast<V>(b[7]);
+ t[3] += static_cast<V>(b[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[5]);
+ t[3] += static_cast<V>(b[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[12]);
+ t[1] += static_cast<V>(a[13]);
+ t[2] += static_cast<V>(b[12]);
+ t[3] += static_cast<V>(b[13]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[14] * x2 + a[12];
+ t[1] = a[13] * x2 + a[11];
+ t[2] = b[14] * x2 + b[12];
+ t[3] = b[13] * x2 + b[11];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[12]);
+ t[1] += static_cast<V>(a[13]);
+ t[2] += static_cast<V>(b[12]);
+ t[3] += static_cast<V>(b[13]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[14]);
+ t[2] += static_cast<V>(b[14]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[15] * x2 + a[13];
+ t[1] = a[14] * x2 + a[12];
+ t[2] = b[15] * x2 + b[13];
+ t[3] = b[14] * x2 + b[12];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[11]);
+ t[1] += static_cast<V>(a[10]);
+ t[2] += static_cast<V>(b[11]);
+ t[3] += static_cast<V>(b[10]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[9]);
+ t[1] += static_cast<V>(a[8]);
+ t[2] += static_cast<V>(b[9]);
+ t[3] += static_cast<V>(b[8]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[2] += static_cast<V>(b[7]);
+ t[3] += static_cast<V>(b[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[5]);
+ t[3] += static_cast<V>(b[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[12]);
+ t[1] += static_cast<V>(a[13]);
+ t[2] += static_cast<V>(b[12]);
+ t[3] += static_cast<V>(b[13]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[14]);
+ t[1] += static_cast<V>(a[15]);
+ t[2] += static_cast<V>(b[14]);
+ t[3] += static_cast<V>(b[15]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<17>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[16] * x2 + a[14];
+ t[1] = a[15] * x2 + a[13];
+ t[2] = b[16] * x2 + b[14];
+ t[3] = b[15] * x2 + b[13];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[12]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[12]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[12]);
+ t[1] += static_cast<V>(a[13]);
+ t[2] += static_cast<V>(b[12]);
+ t[3] += static_cast<V>(b[13]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[14]);
+ t[1] += static_cast<V>(a[15]);
+ t[2] += static_cast<V>(b[14]);
+ t[3] += static_cast<V>(b[15]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[16]);
+ t[2] += static_cast<V>(b[16]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<18>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[17] * x2 + a[15];
+ t[1] = a[16] * x2 + a[14];
+ t[2] = b[17] * x2 + b[15];
+ t[3] = b[16] * x2 + b[14];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[13]);
+ t[1] += static_cast<V>(a[12]);
+ t[2] += static_cast<V>(b[13]);
+ t[3] += static_cast<V>(b[12]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[11]);
+ t[1] += static_cast<V>(a[10]);
+ t[2] += static_cast<V>(b[11]);
+ t[3] += static_cast<V>(b[10]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[9]);
+ t[1] += static_cast<V>(a[8]);
+ t[2] += static_cast<V>(b[9]);
+ t[3] += static_cast<V>(b[8]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[2] += static_cast<V>(b[7]);
+ t[3] += static_cast<V>(b[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[5]);
+ t[3] += static_cast<V>(b[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[12]);
+ t[1] += static_cast<V>(a[13]);
+ t[2] += static_cast<V>(b[12]);
+ t[3] += static_cast<V>(b[13]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[14]);
+ t[1] += static_cast<V>(a[15]);
+ t[2] += static_cast<V>(b[14]);
+ t[3] += static_cast<V>(b[15]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[16]);
+ t[1] += static_cast<V>(a[17]);
+ t[2] += static_cast<V>(b[16]);
+ t[3] += static_cast<V>(b[17]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<19>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[18] * x2 + a[16];
+ t[1] = a[17] * x2 + a[15];
+ t[2] = b[18] * x2 + b[16];
+ t[3] = b[17] * x2 + b[15];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[14]);
+ t[1] += static_cast<V>(a[13]);
+ t[2] += static_cast<V>(b[14]);
+ t[3] += static_cast<V>(b[13]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[12]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[12]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[12]);
+ t[1] += static_cast<V>(a[13]);
+ t[2] += static_cast<V>(b[12]);
+ t[3] += static_cast<V>(b[13]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[14]);
+ t[1] += static_cast<V>(a[15]);
+ t[2] += static_cast<V>(b[14]);
+ t[3] += static_cast<V>(b[15]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[16]);
+ t[1] += static_cast<V>(a[17]);
+ t[2] += static_cast<V>(b[16]);
+ t[3] += static_cast<V>(b[17]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[18]);
+ t[2] += static_cast<V>(b[18]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<20>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[19] * x2 + a[17];
+ t[1] = a[18] * x2 + a[16];
+ t[2] = b[19] * x2 + b[17];
+ t[3] = b[18] * x2 + b[16];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[15]);
+ t[1] += static_cast<V>(a[14]);
+ t[2] += static_cast<V>(b[15]);
+ t[3] += static_cast<V>(b[14]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[13]);
+ t[1] += static_cast<V>(a[12]);
+ t[2] += static_cast<V>(b[13]);
+ t[3] += static_cast<V>(b[12]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[11]);
+ t[1] += static_cast<V>(a[10]);
+ t[2] += static_cast<V>(b[11]);
+ t[3] += static_cast<V>(b[10]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[9]);
+ t[1] += static_cast<V>(a[8]);
+ t[2] += static_cast<V>(b[9]);
+ t[3] += static_cast<V>(b[8]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[7]);
+ t[1] += static_cast<V>(a[6]);
+ t[2] += static_cast<V>(b[7]);
+ t[3] += static_cast<V>(b[6]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[5]);
+ t[1] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[5]);
+ t[3] += static_cast<V>(b[4]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[1] += static_cast<V>(a[9]);
+ t[2] += static_cast<V>(b[8]);
+ t[3] += static_cast<V>(b[9]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[10]);
+ t[1] += static_cast<V>(a[11]);
+ t[2] += static_cast<V>(b[10]);
+ t[3] += static_cast<V>(b[11]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[12]);
+ t[1] += static_cast<V>(a[13]);
+ t[2] += static_cast<V>(b[12]);
+ t[3] += static_cast<V>(b[13]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[14]);
+ t[1] += static_cast<V>(a[15]);
+ t[2] += static_cast<V>(b[14]);
+ t[3] += static_cast<V>(b[15]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[16]);
+ t[1] += static_cast<V>(a[17]);
+ t[2] += static_cast<V>(b[16]);
+ t[3] += static_cast<V>(b[17]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[18]);
+ t[1] += static_cast<V>(a[19]);
+ t[2] += static_cast<V>(b[18]);
+ t[3] += static_cast<V>(b[19]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_3.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_3.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,48 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_RAT_EVAL_3_HPP
+#define BOOST_MATH_TOOLS_RAT_EVAL_3_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ 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]));
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_4.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_4.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,48 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_RAT_EVAL_4_HPP
+#define BOOST_MATH_TOOLS_RAT_EVAL_4_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ 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]));
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_5.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_5.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,86 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_RAT_EVAL_5_HPP
+#define BOOST_MATH_TOOLS_RAT_EVAL_5_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ 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]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[4] * x2 + a[2];
+ t[1] = a[3] * x2 + a[1];
+ t[2] = b[4] * x2 + b[2];
+ t[3] = b[3] * x2 + b[1];
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[4]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_6.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_6.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,132 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_RAT_EVAL_6_HPP
+#define BOOST_MATH_TOOLS_RAT_EVAL_6_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ 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]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[4] * x2 + a[2];
+ t[1] = a[3] * x2 + a[1];
+ t[2] = b[4] * x2 + b[2];
+ t[3] = b[3] * x2 + b[1];
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[4]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[5] * x2 + a[3];
+ t[1] = a[4] * x2 + a[2];
+ t[2] = b[5] * x2 + b[3];
+ t[3] = b[4] * x2 + b[2];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_7.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_7.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,186 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_RAT_EVAL_7_HPP
+#define BOOST_MATH_TOOLS_RAT_EVAL_7_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ 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]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[4] * x2 + a[2];
+ t[1] = a[3] * x2 + a[1];
+ t[2] = b[4] * x2 + b[2];
+ t[3] = b[3] * x2 + b[1];
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[4]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[5] * x2 + a[3];
+ t[1] = a[4] * x2 + a[2];
+ t[2] = b[5] * x2 + b[3];
+ t[3] = b[4] * x2 + b[2];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[6] * x2 + a[4];
+ t[1] = a[5] * x2 + a[3];
+ t[2] = b[6] * x2 + b[4];
+ t[3] = b[5] * x2 + b[3];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[2] += static_cast<V>(b[6]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_8.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_8.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,248 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_RAT_EVAL_8_HPP
+#define BOOST_MATH_TOOLS_RAT_EVAL_8_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ 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]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[4] * x2 + a[2];
+ t[1] = a[3] * x2 + a[1];
+ t[2] = b[4] * x2 + b[2];
+ t[3] = b[3] * x2 + b[1];
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[4]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[5] * x2 + a[3];
+ t[1] = a[4] * x2 + a[2];
+ t[2] = b[5] * x2 + b[3];
+ t[3] = b[4] * x2 + b[2];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[6] * x2 + a[4];
+ t[1] = a[5] * x2 + a[3];
+ t[2] = b[6] * x2 + b[4];
+ t[3] = b[5] * x2 + b[3];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[2] += static_cast<V>(b[6]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[7] * x2 + a[5];
+ t[1] = a[6] * x2 + a[4];
+ t[2] = b[7] * x2 + b[5];
+ t[3] = b[6] * x2 + b[4];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Added: sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_9.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/tools/detail/rational_horner3_9.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,318 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// This file is machine generated, do not edit by hand
+
+// Polynomial evaluation using second order Horners rule
+#ifndef BOOST_MATH_TOOLS_RAT_EVAL_9_HPP
+#define BOOST_MATH_TOOLS_RAT_EVAL_9_HPP
+
+namespace boost{ namespace math{ namespace tools{ namespace detail{
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*)
+{
+ return static_cast<V>(0);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)
+{
+ return static_cast<V>(a[0]) / static_cast<V>(b[0]);
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)
+{
+ return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)
+{
+ return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)
+{
+ 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]));
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[4] * x2 + a[2];
+ t[1] = a[3] * x2 + a[1];
+ t[2] = b[4] * x2 + b[2];
+ t[3] = b[3] * x2 + b[1];
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[2] += static_cast<V>(b[4]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[5] * x2 + a[3];
+ t[1] = a[4] * x2 + a[2];
+ t[2] = b[5] * x2 + b[3];
+ t[3] = b[4] * x2 + b[2];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[6] * x2 + a[4];
+ t[1] = a[5] * x2 + a[3];
+ t[2] = b[6] * x2 + b[4];
+ t[3] = b[5] * x2 + b[3];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[2] += static_cast<V>(b[6]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[7] * x2 + a[5];
+ t[1] = a[6] * x2 + a[4];
+ t[2] = b[7] * x2 + b[5];
+ t[3] = b[6] * x2 + b[4];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[3]);
+ t[1] += static_cast<V>(a[2]);
+ t[2] += static_cast<V>(b[3]);
+ t[3] += static_cast<V>(b[2]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[1]);
+ t[1] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[1]);
+ t[3] += static_cast<V>(b[0]);
+ t[0] *= x;
+ t[2] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z;
+ t[2] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+template <class T, class U, class V>
+inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*)
+{
+ if(x <= 1)
+ {
+ V x2 = x * x;
+ V t[4];
+ t[0] = a[8] * x2 + a[6];
+ t[1] = a[7] * x2 + a[5];
+ t[2] = b[8] * x2 + b[6];
+ t[3] = b[7] * x2 + b[5];
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[3]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[3]);
+ t[0] *= x2;
+ t[1] *= x2;
+ t[2] *= x2;
+ t[3] *= x2;
+ t[0] += static_cast<V>(a[2]);
+ t[1] += static_cast<V>(a[1]);
+ t[2] += static_cast<V>(b[2]);
+ t[3] += static_cast<V>(b[1]);
+ t[0] *= x2;
+ t[2] *= x2;
+ t[0] += static_cast<V>(a[0]);
+ t[2] += static_cast<V>(b[0]);
+ t[1] *= x;
+ t[3] *= x;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+ else
+ {
+ V z = 1 / x;
+ V z2 = 1 / (x * x);
+ V t[4];
+ t[0] = a[0] * z2 + a[2];
+ t[1] = a[1] * z2 + a[3];
+ t[2] = b[0] * z2 + b[2];
+ t[3] = b[1] * z2 + b[3];
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[4]);
+ t[1] += static_cast<V>(a[5]);
+ t[2] += static_cast<V>(b[4]);
+ t[3] += static_cast<V>(b[5]);
+ t[0] *= z2;
+ t[1] *= z2;
+ t[2] *= z2;
+ t[3] *= z2;
+ t[0] += static_cast<V>(a[6]);
+ t[1] += static_cast<V>(a[7]);
+ t[2] += static_cast<V>(b[6]);
+ t[3] += static_cast<V>(b[7]);
+ t[0] *= z2;
+ t[2] *= z2;
+ t[0] += static_cast<V>(a[8]);
+ t[2] += static_cast<V>(b[8]);
+ t[1] *= z;
+ t[3] *= z;
+ return (t[0] + t[1]) / (t[2] + t[3]);
+ }
+}
+
+
+}}}} // namespaces
+
+#endif // include guard
+
Modified: sandbox/math_toolkit/boost/math/tools/rational.hpp
==============================================================================
--- sandbox/math_toolkit/boost/math/tools/rational.hpp (original)
+++ sandbox/math_toolkit/boost/math/tools/rational.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -7,8 +7,35 @@
#define BOOST_MATH_TOOLS_RATIONAL_HPP
#include <boost/array.hpp>
+#include <boost/math/tools/config.hpp>
#include <boost/mpl/int.hpp>
+#if BOOST_MATH_POLY_METHOD == 1
+# define BOOST_HEADER() <BOOST_JOIN(boost/math/tools/detail/polynomial_horner1_, BOOST_MATH_MAX_POLY_ORDER).hpp>
+# include BOOST_HEADER()
+# undef BOOST_HEADER
+#elif BOOST_MATH_POLY_METHOD == 2
+# define BOOST_HEADER() <BOOST_JOIN(boost/math/tools/detail/polynomial_horner2_, BOOST_MATH_MAX_POLY_ORDER).hpp>
+# include BOOST_HEADER()
+# undef BOOST_HEADER
+#elif BOOST_MATH_POLY_METHOD == 3
+# define BOOST_HEADER() <BOOST_JOIN(boost/math/tools/detail/polynomial_horner3_, BOOST_MATH_MAX_POLY_ORDER).hpp>
+# include BOOST_HEADER()
+# undef BOOST_HEADER
+#endif
+#if BOOST_MATH_RATIONAL_METHOD == 1
+# define BOOST_HEADER() <BOOST_JOIN(boost/math/tools/detail/rational_horner1_, BOOST_MATH_MAX_POLY_ORDER).hpp>
+# include BOOST_HEADER()
+# undef BOOST_HEADER
+#elif BOOST_MATH_RATIONAL_METHOD == 2
+# define BOOST_HEADER() <BOOST_JOIN(boost/math/tools/detail/rational_horner2_, BOOST_MATH_MAX_POLY_ORDER).hpp>
+# include BOOST_HEADER()
+# undef BOOST_HEADER
+#elif BOOST_MATH_RATIONAL_METHOD == 3
+# define BOOST_HEADER() <BOOST_JOIN(boost/math/tools/detail/rational_horner3_, BOOST_MATH_MAX_POLY_ORDER).hpp>
+# include BOOST_HEADER()
+# undef BOOST_HEADER
+#endif
namespace boost{ namespace math{ namespace tools{
//
@@ -18,70 +45,6 @@
U evaluate_polynomial(const T* poly, U const& z, std::size_t count);
namespace detail{
-//
-// These inline functions evaluate polynomials whose size is
-// known at compile time - there's no need for a for-loop
-// just an inline application of Horners rule.
-//
-template <class T, class V>
-inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
-{
- return static_cast<V>(0);
-}
-
-template <class T, class V>
-inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
-{
- return static_cast<V>(a[0]);
-}
-
-template <class T, class V>
-inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
-{
- return static_cast<V>(a[0] + x * a[1]);
-}
-
-template <class T, class V>
-inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
-{
- return static_cast<V>(((a[2] * x) + a[1]) * x + a[0]);
-}
-
-template <class T, class V>
-inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
-{
- return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
-}
-
-template <class T, class V>
-inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
-{
- return static_cast<V>((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
-}
-
-template <class T, class V>
-inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
-{
- return static_cast<V>(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
-}
-
-template <class T, class V>
-inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*)
-{
- return static_cast<V>((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
-}
-
-template <class T, class V>
-inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*)
-{
- return static_cast<V>(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
-}
-
-template <class T, class V>
-inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*)
-{
- return static_cast<V>((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
-}
template <class T, class V, class Tag>
inline V evaluate_polynomial_c_imp(const T* a, const V& val, const Tag*)
@@ -167,6 +130,19 @@
typedef mpl::int_<N-1> tag_type;
return a[0] + z * detail::evaluate_polynomial_c_imp(static_cast<const T*>(a.data()) + 1, z*z, static_cast<tag_type const*>(0));
}
+
+template <class T, class U, class V>
+V evaluate_rational(const T* num, const U* denom, const V& z_, std::size_t count);
+
+namespace detail{
+
+template <class T, class U, class V, class Tag>
+inline V evaluate_rational_c_imp(const T* num, const U* denom, const V& z, const Tag*)
+{
+ return boost::math::tools::evaluate_rational(num, denom, z, Tag::value);
+}
+
+}
//
// Rational functions: numerator and denominator must be
// equal in size. These always have a for-loop and so may be less
@@ -182,8 +158,8 @@
V s1, s2;
if(z <= 1)
{
- s1 = num[count-1];
- s2 = denom[count-1];
+ s1 = static_cast<V>(num[count-1]);
+ s2 = static_cast<V>(denom[count-1]);
for(int i = (int)count - 2; i >= 0; --i)
{
s1 *= z;
@@ -195,8 +171,8 @@
else
{
z = 1 / z;
- s1 = num[0];
- s2 = denom[0];
+ s1 = static_cast<V>(num[0]);
+ s2 = static_cast<V>(denom[0]);
for(unsigned i = 1; i < count; ++i)
{
s1 *= z;
@@ -211,13 +187,13 @@
template <std::size_t N, class T, class U, class V>
inline V evaluate_rational(const T(&a)[N], const U(&b)[N], const V& z)
{
- return evaluate_rational(a, b, z, N);
+ return detail::evaluate_rational_c_imp(a, b, z, static_cast<const mpl::int_<N>*>(0));
}
template <std::size_t N, class T, class U, class V>
inline V evaluate_rational(const boost::array<T,N>& a, const boost::array<U,N>& b, const V& z)
{
- return evaluate_rational(a.data(), b.data(), z, N);
+ return detail::evaluate_rational_c_imp(a.data(), b.data(), z, static_cast<mpl::int_<N>*>(0));
}
} // namespace tools
Modified: sandbox/math_toolkit/boost/math/tools/remez.hpp
==============================================================================
--- sandbox/math_toolkit/boost/math/tools/remez.hpp (original)
+++ sandbox/math_toolkit/boost/math/tools/remez.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -456,7 +456,7 @@
sign = -sign;
}
- #ifdef BOOST_INSTRUMENT
+ #ifdef BOOST_MATH_INSTRUMENT
for(unsigned i = 0; i < b.size(); ++i)
std::cout << b[i] << " ";
std::cout << "\n\n";
@@ -502,13 +502,13 @@
num = this->numerator();
denom = this->denominator();
T e1 = b[0] - num.evaluate(control_points[0]) / denom.evaluate(control_points[0]);
-#ifdef BOOST_INSTRUMENT
+#ifdef BOOST_MATH_INSTRUMENT
std::cout << e1;
#endif
for(unsigned i = 1; i < b.size(); ++i)
{
T e2 = b[i] - num.evaluate(control_points[i]) / denom.evaluate(control_points[i]);
-#ifdef BOOST_INSTRUMENT
+#ifdef BOOST_MATH_INSTRUMENT
std::cout << " " << e2;
#endif
if(e2 * e1 > 0)
@@ -545,7 +545,7 @@
e1 = e2;
}
-#ifdef BOOST_INSTRUMENT
+#ifdef BOOST_MATH_INSTRUMENT
for(unsigned i = 0; i < solution.size(); ++i)
std::cout << solution[i] << " ";
std::cout << std::endl << this->numerator() << std::endl;
Modified: sandbox/math_toolkit/boost/math/tools/roots.hpp
==============================================================================
--- sandbox/math_toolkit/boost/math/tools/roots.hpp (original)
+++ sandbox/math_toolkit/boost/math/tools/roots.hpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -141,6 +141,17 @@
max_iter -= count;
+#ifdef BOOST_MATH_INSTRUMENT
+ std::cout << "Bisection iteration, final count = " << max_iter << std::endl;
+
+ static boost::uintmax_t max_count = 0;
+ if(max_iter > max_count)
+ {
+ max_count = max_iter;
+ std::cout << "Maximum iterations: " << max_iter << std::endl;
+ }
+#endif
+
return std::make_pair(min, max);
}
@@ -176,7 +187,7 @@
if(f1 == 0)
{
// Oops zero derivative!!!
-#ifdef BOOST_INSTRUMENT
+#ifdef BOOST_MATH_INSTRUMENT
std::cout << "Newton iteration, zero derivative found" << std::endl;
#endif
detail::handle_zero_derivative(f, last_f0, f0, delta, result, guess, min, max);
@@ -185,7 +196,7 @@
{
delta = f0 / f1;
}
-#ifdef BOOST_INSTRUMENT
+#ifdef BOOST_MATH_INSTRUMENT
std::cout << "Newton iteration, delta = " << delta << std::endl;
#endif
if(fabs(delta * 2) > fabs(delta2))
@@ -218,7 +229,7 @@
max_iter -= count;
-#ifdef BOOST_INSTRUMENT
+#ifdef BOOST_MATH_INSTRUMENT
std::cout << "Newton Raphson iteration, final count = " << max_iter << std::endl;
static boost::uintmax_t max_count = 0;
@@ -253,7 +264,9 @@
T delta1 = delta;
T delta2 = delta;
-#ifdef BOOST_INSTRUMENT
+ bool out_of_bounds_sentry = false;
+
+#ifdef BOOST_MATH_INSTRUMENT
std::cout << "Halley iteration, limit = " << factor << std::endl;
#endif
@@ -269,7 +282,7 @@
if((f1 == 0) && (f2 == 0))
{
// Oops zero derivative!!!
-#ifdef BOOST_INSTRUMENT
+#ifdef BOOST_MATH_INSTRUMENT
std::cout << "Halley iteration, zero derivative found" << std::endl;
#endif
detail::handle_zero_derivative(f, last_f0, f0, delta, result, guess, min, max);
@@ -296,14 +309,17 @@
else
delta = f0 / f1;
}
-#ifdef BOOST_INSTRUMENT
+#ifdef BOOST_MATH_INSTRUMENT
std::cout << "Halley iteration, delta = " << delta << std::endl;
#endif
T convergence = fabs(delta / delta2);
- if((convergence > 0.5) && (convergence < 2))
+ if((convergence > 0.8) && (convergence < 2))
{
// last two steps haven't converged, try bisection:
delta = (delta > 0) ? (result - min) / 2 : (result - max) / 2;
+ // reset delta2 so that this branch will *not* be taken on the
+ // next iteration:
+ delta2 = delta * 3;
}
guess = result;
result -= delta;
@@ -311,17 +327,45 @@
// check for out of bounds step:
if(result < min)
{
- delta = (guess - min) / 2;
- result = guess - delta;
- if((result == min) || (result == max))
- break;
+ T diff = ((fabs(min) < 1) && (fabs(result) > 1) && (tools::max_value<T>() / fabs(result) < fabs(min))) ? 1000 : result / min;
+ if(fabs(diff) < 1)
+ diff = 1 / diff;
+ if(!out_of_bounds_sentry && (diff > 0) && (diff < 3))
+ {
+ // Only a small out of bounds step, lets assume that the result
+ // is probably approximately at min:
+ delta = 0.99f * (guess - min);
+ result = guess - delta;
+ out_of_bounds_sentry = true; // only take this branch once!
+ }
+ else
+ {
+ delta = (guess - min) / 2;
+ result = guess - delta;
+ if((result == min) || (result == max))
+ break;
+ }
}
else if(result > max)
{
- delta = (guess - max) / 2;
- result = guess - delta;
- if((result == min) || (result == max))
- break;
+ T diff = ((fabs(max) < 1) && (fabs(result) > 1) && (tools::max_value<T>() / fabs(result) < fabs(max))) ? 1000 : result / max;
+ if(fabs(diff) < 1)
+ diff = 1 / diff;
+ if(!out_of_bounds_sentry && (diff > 0) && (diff < 3))
+ {
+ // Only a small out of bounds step, lets assume that the result
+ // is probably approximately at min:
+ delta = 0.99f * (guess - max);
+ result = guess - delta;
+ out_of_bounds_sentry = true; // only take this branch once!
+ }
+ else
+ {
+ delta = (guess - max) / 2;
+ result = guess - delta;
+ if((result == min) || (result == max))
+ break;
+ }
}
// update brackets:
if(delta > 0)
@@ -332,7 +376,7 @@
max_iter -= count;
-#ifdef BOOST_INSTRUMENT
+#ifdef BOOST_MATH_INSTRUMENT
std::cout << "Halley iteration, final count = " << max_iter << std::endl;
static boost::uintmax_t max_count = 0;
@@ -366,7 +410,7 @@
T delta1 = tools::max_value<T>();
T delta2 = tools::max_value<T>();
-#ifdef BOOST_INSTRUMENT
+#ifdef BOOST_MATH_INSTRUMENT
std::cout << "Schroeder iteration, limit = " << factor << std::endl;
#endif
@@ -382,7 +426,7 @@
if((f1 == 0) && (f2 == 0))
{
// Oops zero derivative!!!
-#ifdef BOOST_INSTRUMENT
+#ifdef BOOST_MATH_INSTRUMENT
std::cout << "Halley iteration, zero derivative found" << std::endl;
#endif
detail::handle_zero_derivative(f, last_f0, f0, delta, result, guess, min, max);
@@ -407,7 +451,7 @@
}
guess = result;
result -= delta;
-#ifdef BOOST_INSTRUMENT
+#ifdef BOOST_MATH_INSTRUMENT
std::cout << "Halley iteration, delta = " << delta << std::endl;
#endif
if(result <= min)
@@ -433,7 +477,7 @@
max_iter -= count;
-#ifdef BOOST_INSTRUMENT
+#ifdef BOOST_MATH_INSTRUMENT
std::cout << "Schroeder iteration, final count = " << max_iter << std::endl;
static boost::uintmax_t max_count = 0;
Modified: sandbox/math_toolkit/libs/math/test/Jamfile.v2
==============================================================================
--- sandbox/math_toolkit/libs/math/test/Jamfile.v2 (original)
+++ sandbox/math_toolkit/libs/math/test/Jamfile.v2 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -57,7 +57,7 @@
run test_normal.cpp ;
run test_poisson.cpp ;
run test_rayleigh.cpp ;
-run test_rationals.cpp ;
+run test_rationals.cpp test_rational_float.cpp test_rational_double.cpp test_rational_ldouble.cpp ;
run test_remez.cpp ;
run test_roots.cpp ;
run test_spherical_harmonic.cpp ;
@@ -153,3 +153,4 @@
+
Modified: sandbox/math_toolkit/libs/math/test/test_bessel_j.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/test/test_bessel_j.cpp (original)
+++ sandbox/math_toolkit/libs/math/test/test_bessel_j.cpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -190,7 +190,7 @@
".*", // platform
largest_type, // test type(s)
".*(JN|j).*|.*Tricky.*", // test data group
- ".*", 30000, 20000); // test function
+ ".*", 33000, 20000); // test function
}
add_expected_result(
Modified: sandbox/math_toolkit/libs/math/test/test_bessel_y.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/test/test_bessel_y.cpp (original)
+++ sandbox/math_toolkit/libs/math/test/test_bessel_y.cpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -118,7 +118,30 @@
largest_type, // test type(s)
".*Yn.*", // test data group
".*", 30000, 30000); // test function
-
+ //
+ // MinGW:
+ //
+ add_expected_result(
+ ".*mingw.*", // compiler
+ ".*", // stdlib
+ ".*", // platform
+ largest_type, // test type(s)
+ ".*Yv.*Random.*", // test data group
+ ".*", 200000, 200000); // test function
+ add_expected_result(
+ ".*mingw.*", // compiler
+ ".*", // stdlib
+ ".*", // platform
+ largest_type, // test type(s)
+ ".*Y[01v].*", // test data group
+ ".*", 2000, 1000); // test function
+ add_expected_result(
+ ".*mingw.*", // compiler
+ ".*", // stdlib
+ ".*", // platform
+ largest_type, // test type(s)
+ ".*Yn.*", // test data group
+ ".*", 30000, 30000); // test function
if((std::numeric_limits<double>::digits != std::numeric_limits<long double>::digits)
&& (std::numeric_limits<long double>::digits < 90))
Modified: sandbox/math_toolkit/libs/math/test/test_beta_dist.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/test/test_beta_dist.cpp (original)
+++ sandbox/math_toolkit/libs/math/test/test_beta_dist.cpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -494,9 +494,9 @@
BOOST_CHECK_CLOSE_FRACTION(pdf(mybeta11, 0.5), 1.0, 5*std::numeric_limits<double>::epsilon());
BOOST_CHECK_CLOSE_FRACTION(pdf(mybeta11, 0.0001), 1.0, 5*std::numeric_limits<double>::epsilon());
BOOST_CHECK_CLOSE_FRACTION(pdf(mybeta11, 0.9999), 1.0, 5*std::numeric_limits<double>::epsilon());
- BOOST_CHECK_CLOSE_FRACTION(cdf(mybeta11, 0.1), 0.1, std::numeric_limits<double>::epsilon());
- BOOST_CHECK_CLOSE_FRACTION(cdf(mybeta11, 0.5), 0.5, std::numeric_limits<double>::epsilon());
- BOOST_CHECK_CLOSE_FRACTION(cdf(mybeta11, 0.9), 0.9, std::numeric_limits<double>::epsilon());
+ BOOST_CHECK_CLOSE_FRACTION(cdf(mybeta11, 0.1), 0.1, 2 * std::numeric_limits<double>::epsilon());
+ BOOST_CHECK_CLOSE_FRACTION(cdf(mybeta11, 0.5), 0.5, 2 * std::numeric_limits<double>::epsilon());
+ BOOST_CHECK_CLOSE_FRACTION(cdf(mybeta11, 0.9), 0.9, 2 * std::numeric_limits<double>::epsilon());
BOOST_CHECK_EQUAL(cdf(mybeta11, 1), 1.); // Exact unity expected.
double tol = std::numeric_limits<double>::epsilon() * 10;
@@ -535,8 +535,8 @@
BOOST_CHECK_CLOSE_FRACTION(kurtosis_excess(mybeta22), -144.0 / 168, tol);
BOOST_CHECK_CLOSE_FRACTION(skewness(beta_distribution<>(3, 5)), 0.30983866769659335081434123198259, tol);
- BOOST_CHECK_EQUAL(beta_distribution<double>::estimate_alpha(mean(mybeta22), variance(mybeta22)), mybeta22.alpha()); // mean, variance, probability.
- BOOST_CHECK_EQUAL(beta_distribution<double>::estimate_beta(mean(mybeta22), variance(mybeta22)), mybeta22.beta());// mean, variance, probability.
+ BOOST_CHECK_CLOSE_FRACTION(beta_distribution<double>::estimate_alpha(mean(mybeta22), variance(mybeta22)), mybeta22.alpha(), tol); // mean, variance, probability.
+ BOOST_CHECK_CLOSE_FRACTION(beta_distribution<double>::estimate_beta(mean(mybeta22), variance(mybeta22)), mybeta22.beta(), tol);// mean, variance, probability.
BOOST_CHECK_CLOSE_FRACTION(mybeta22.estimate_alpha(mybeta22.beta(), 0.8, cdf(mybeta22, 0.8)), mybeta22.alpha(), tol);
BOOST_CHECK_CLOSE_FRACTION(mybeta22.estimate_beta(mybeta22.alpha(), 0.8, cdf(mybeta22, 0.8)), mybeta22.beta(), tol);
Modified: sandbox/math_toolkit/libs/math/test/test_ibeta.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/test/test_ibeta.cpp (original)
+++ sandbox/math_toolkit/libs/math/test/test_ibeta.cpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -133,6 +133,25 @@
largest_type, // test type(s)
"(?i).*large.*", // test data group
".*", 200000, 10000); // test function
+
+ //
+ // MinGW:
+ //
+ add_expected_result(
+ "[^|]*mingw[^|]*", // compiler
+ "[^|]*", // stdlib
+ ".*", // platform
+ "double", // test type(s)
+ "(?i).*large.*", // test data group
+ ".*", 20, 10); // test function
+ add_expected_result(
+ "[^|]*mingw[^|]*", // compiler
+ "[^|]*", // stdlib
+ ".*", // platform
+ largest_type, // test type(s)
+ "(?i).*large.*", // test data group
+ ".*", 200000, 10000); // test function
+
#ifdef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
//
// No long doubles:
Modified: sandbox/math_toolkit/libs/math/test/test_ibeta_inv.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/test/test_ibeta_inv.cpp (original)
+++ sandbox/math_toolkit/libs/math/test/test_ibeta_inv.cpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -99,6 +99,26 @@
".*", // test data group
".*", 5000000L, 500000); // test function
//
+ // MinGW,
+ // Extended exponent range of long double
+ // causes more extreme test cases to be executed:
+ //
+ add_expected_result(
+ ".*mingw.*", // compiler
+ ".*", // stdlib
+ ".*", // platform
+ "double", // test type(s)
+ ".*", // test data group
+ ".*", 10, 10); // test function
+ add_expected_result(
+ ".*mingw.*", // compiler
+ ".*", // stdlib
+ ".*", // platform
+ largest_type, // test type(s)
+ ".*", // test data group
+ ".*", 300000, 20000); // test function
+
+ //
// HP-UX
// Extended exponent range of long double
// causes more extreme test cases to be executed:
Modified: sandbox/math_toolkit/libs/math/test/test_laguerre.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/test/test_laguerre.cpp (original)
+++ sandbox/math_toolkit/libs/math/test/test_laguerre.cpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -90,6 +90,20 @@
"real_concept", // test type(s)
".*", // test data group
".*", 40000, 1000); // test function
+ add_expected_result(
+ ".*mingw.*", // compiler
+ ".*", // stdlib
+ ".*", // platform
+ largest_type, // test type(s)
+ ".*", // test data group
+ ".*", 40000, 1000); // test function
+ add_expected_result(
+ ".*mingw.*", // compiler
+ ".*", // stdlib
+ ".*", // platform
+ "real_concept", // test type(s)
+ ".*", // test data group
+ ".*", 40000, 1000); // test function
//
// Catch all cases come last:
Modified: sandbox/math_toolkit/libs/math/test/test_legendre.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/test/test_legendre.cpp (original)
+++ sandbox/math_toolkit/libs/math/test/test_legendre.cpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -74,35 +74,37 @@
".*", 10, 5); // test function
#endif
}
- add_expected_result(
- ".*", // compiler
- ".*", // stdlib
- "linux.*", // platform
- largest_type, // test type(s)
- "Legendre Polynomials.*Large.*", // test data group
- "boost::math::legendre_p", 1000, 200); // test function
- add_expected_result(
- ".*", // compiler
- ".*", // stdlib
- "linux.*", // platform
- largest_type, // test type(s)
- "Legendre Polynomials.*Large.*", // test data group
- "boost::math::legendre_q", 7000, 1000); // test function
- add_expected_result(
- ".*", // compiler
- ".*", // stdlib
- "linux.*", // platform
- "real_concept", // test type(s)
- "Legendre Polynomials.*Large.*", // test data group
- "boost::math::legendre_p", 1000, 200); // test function
- add_expected_result(
- ".*", // compiler
- ".*", // stdlib
- "linux.*", // platform
- "real_concept", // test type(s)
- "Legendre Polynomials.*Large.*", // test data group
- "boost::math::legendre_q", 7000, 1000); // test function
-
+ if(std::numeric_limits<long double>::digits == 64)
+ {
+ add_expected_result(
+ ".*", // compiler
+ ".*", // stdlib
+ ".*", // platform
+ largest_type, // test type(s)
+ "Legendre Polynomials.*Large.*", // test data group
+ "boost::math::legendre_p", 1000, 200); // test function
+ add_expected_result(
+ ".*", // compiler
+ ".*", // stdlib
+ ".*", // platform
+ largest_type, // test type(s)
+ "Legendre Polynomials.*Large.*", // test data group
+ "boost::math::legendre_q", 7000, 1000); // test function
+ add_expected_result(
+ ".*", // compiler
+ ".*", // stdlib
+ ".*", // platform
+ "real_concept", // test type(s)
+ "Legendre Polynomials.*Large.*", // test data group
+ "boost::math::legendre_p", 1000, 200); // test function
+ add_expected_result(
+ ".*", // compiler
+ ".*", // stdlib
+ ".*", // platform
+ "real_concept", // test type(s)
+ "Legendre Polynomials.*Large.*", // test data group
+ "boost::math::legendre_q", 7000, 1000); // test function
+ }
//
// Catch all cases come last:
//
Added: sandbox/math_toolkit/libs/math/test/test_rational_double.cpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/libs/math/test/test_rational_double.cpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,19 @@
+
+#include <boost/test/floating_point_comparison.hpp>
+#include <boost/test/test_exec_monitor.hpp>
+#include <boost/array.hpp>
+#include <boost/math/tools/rational.hpp>
+
+#include "test_rational.hpp"
+
+void test_spots(double t, const char* n)
+{
+ std::cout << "Testing basic sanity checks for type " << n << std::endl;
+ do_test_spots(t, int(0));
+ do_test_spots(t, unsigned(0));
+#ifdef BOOST_HAS_LONG_LONG
+ do_test_spots(t, (unsigned long long)(0));
+#endif
+ do_test_spots(t, float(0));
+ do_test_spots(t, double(0));
+}
Added: sandbox/math_toolkit/libs/math/test/test_rational_float.cpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/libs/math/test/test_rational_float.cpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,19 @@
+
+#include <boost/test/floating_point_comparison.hpp>
+#include <boost/test/test_exec_monitor.hpp>
+#include <boost/array.hpp>
+#include <boost/math/tools/rational.hpp>
+
+#include "test_rational.hpp"
+
+void test_spots(float t, const char* n)
+{
+ std::cout << "Testing basic sanity checks for type " << n << std::endl;
+ do_test_spots(t, int(0));
+ do_test_spots(t, unsigned(0));
+#ifdef BOOST_HAS_LONG_LONG
+ do_test_spots(t, (unsigned long long)(0));
+#endif
+ do_test_spots(t, float(0));
+ do_test_spots(t, float(0));
+}
Added: sandbox/math_toolkit/libs/math/test/test_rational_ldouble.cpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/libs/math/test/test_rational_ldouble.cpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,19 @@
+
+#include <boost/test/floating_point_comparison.hpp>
+#include <boost/test/test_exec_monitor.hpp>
+#include <boost/array.hpp>
+#include <boost/math/tools/rational.hpp>
+
+#include "test_rational.hpp"
+
+void test_spots(long double t, const char* n)
+{
+ std::cout << "Testing basic sanity checks for type " << n << std::endl;
+ do_test_spots(t, int(0));
+ do_test_spots(t, unsigned(0));
+#ifdef BOOST_HAS_LONG_LONG
+ do_test_spots(t, (unsigned long long)(0));
+#endif
+ do_test_spots(t, float(0));
+ do_test_spots(t, static_cast<long double>(0));
+}
Modified: sandbox/math_toolkit/libs/math/test/test_rationals.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/test/test_rationals.cpp (original)
+++ sandbox/math_toolkit/libs/math/test/test_rationals.cpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -9,2322 +9,7 @@
#include <boost/array.hpp>
#include <boost/math/tools/rational.hpp>
-template <class T, class U>
-void do_test_spots(T, U)
-{
- //
- // Tolerance is 4 eps expressed as a persentage:
- //
- T tolerance = boost::math::tools::epsilon<T>() * 4 * 100;
-
- //
- // Everything past this point is generated by the program
- // ../tools/generate_rational_test.cpp
- //
-
- //
- // Polynomials of order 0
- //
- static const U n1c[1] = { 2 };
- static const boost::array<U, 1> n1a = { 2 };
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n1c, static_cast<T>(0.125), 1),
- static_cast<T>(2L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n1c, static_cast<T>(0.25), 1),
- static_cast<T>(2L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n1c, static_cast<T>(0.75), 1),
- static_cast<T>(2L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n1c, static_cast<T>(1.0f - 1.0f/64.0f), 1),
- static_cast<T>(2L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n1c, static_cast<T>(0.125)),
- static_cast<T>(2L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n1c, static_cast<T>(0.25)),
- static_cast<T>(2L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n1c, static_cast<T>(0.75)),
- static_cast<T>(2L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n1c, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(2L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n1a, static_cast<T>(0.125)),
- static_cast<T>(2L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n1a, static_cast<T>(0.25)),
- static_cast<T>(2L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n1a, static_cast<T>(0.75)),
- static_cast<T>(2L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n1a, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(2L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n1c, static_cast<T>(0.125), 1),
- static_cast<T>(2L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n1c, static_cast<T>(0.25), 1),
- static_cast<T>(2L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n1c, static_cast<T>(0.75), 1),
- static_cast<T>(2L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n1c, static_cast<T>(1.0f - 1.0f/64.0f), 1),
- static_cast<T>(2L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n1c, static_cast<T>(0.125)),
- static_cast<T>(2L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n1c, static_cast<T>(0.25)),
- static_cast<T>(2L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n1c, static_cast<T>(0.75)),
- static_cast<T>(2L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n1c, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(2L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n1a, static_cast<T>(0.125)),
- static_cast<T>(2L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n1a, static_cast<T>(0.25)),
- static_cast<T>(2L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n1a, static_cast<T>(0.75)),
- static_cast<T>(2L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n1a, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(2L),
- tolerance);
-
- //
- // Rational functions of order 0
- //
- static const U d1c[1] = { 3 };
- static const boost::array<U, 1> d1a = { 3 };
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n1c, d1c, static_cast<T>(0.125), 1),
- static_cast<T>(0.6666666666666666666666666666666666666667L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n1c, d1c, static_cast<T>(0.25), 1),
- static_cast<T>(0.6666666666666666666666666666666666666667L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n1c, d1c, static_cast<T>(0.75), 1),
- static_cast<T>(0.6666666666666666666666666666666666666667L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n1c, d1c, static_cast<T>(1.0f - 1.0f/64.0f), 1),
- static_cast<T>(0.6666666666666666666666666666666666666667L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n1c, d1c, static_cast<T>(0.125)),
- static_cast<T>(0.6666666666666666666666666666666666666667L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n1c, d1c, static_cast<T>(0.25)),
- static_cast<T>(0.6666666666666666666666666666666666666667L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n1c, d1c, static_cast<T>(0.75)),
- static_cast<T>(0.6666666666666666666666666666666666666667L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n1c, d1c, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(0.6666666666666666666666666666666666666667L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n1a, d1a, static_cast<T>(0.125)),
- static_cast<T>(0.6666666666666666666666666666666666666667L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n1a, d1a, static_cast<T>(0.25)),
- static_cast<T>(0.6666666666666666666666666666666666666667L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n1a, d1a, static_cast<T>(0.75)),
- static_cast<T>(0.6666666666666666666666666666666666666667L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n1a, d1a, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(0.6666666666666666666666666666666666666667L),
- tolerance);
-
- //
- // Polynomials of order 1
- //
- static const U n2c[2] = { 3, 1 };
- static const boost::array<U, 2> n2a = { 3, 1 };
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n2c, static_cast<T>(0.125), 2),
- static_cast<T>(3.125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n2c, static_cast<T>(0.25), 2),
- static_cast<T>(3.25L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n2c, static_cast<T>(0.75), 2),
- static_cast<T>(3.75L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n2c, static_cast<T>(1.0f - 1.0f/64.0f), 2),
- static_cast<T>(3.984375L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n2c, static_cast<T>(0.125)),
- static_cast<T>(3.125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n2c, static_cast<T>(0.25)),
- static_cast<T>(3.25L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n2c, static_cast<T>(0.75)),
- static_cast<T>(3.75L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n2c, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(3.984375L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n2a, static_cast<T>(0.125)),
- static_cast<T>(3.125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n2a, static_cast<T>(0.25)),
- static_cast<T>(3.25L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n2a, static_cast<T>(0.75)),
- static_cast<T>(3.75L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n2a, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(3.984375L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n2c, static_cast<T>(0.125), 2),
- static_cast<T>(3.015625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n2c, static_cast<T>(0.25), 2),
- static_cast<T>(3.0625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n2c, static_cast<T>(0.75), 2),
- static_cast<T>(3.5625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n2c, static_cast<T>(1.0f - 1.0f/64.0f), 2),
- static_cast<T>(3.968994140625L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n2c, static_cast<T>(0.125)),
- static_cast<T>(3.015625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n2c, static_cast<T>(0.25)),
- static_cast<T>(3.0625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n2c, static_cast<T>(0.75)),
- static_cast<T>(3.5625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n2c, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(3.968994140625L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n2a, static_cast<T>(0.125)),
- static_cast<T>(3.015625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n2a, static_cast<T>(0.25)),
- static_cast<T>(3.0625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n2a, static_cast<T>(0.75)),
- static_cast<T>(3.5625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n2a, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(3.968994140625L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n2c, static_cast<T>(0.125), 2),
- static_cast<T>(3.125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n2c, static_cast<T>(0.25), 2),
- static_cast<T>(3.25L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n2c, static_cast<T>(0.75), 2),
- static_cast<T>(3.75L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n2c, static_cast<T>(1.0f - 1.0f/64.0f), 2),
- static_cast<T>(3.984375L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n2c, static_cast<T>(0.125)),
- static_cast<T>(3.125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n2c, static_cast<T>(0.25)),
- static_cast<T>(3.25L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n2c, static_cast<T>(0.75)),
- static_cast<T>(3.75L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n2c, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(3.984375L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n2a, static_cast<T>(0.125)),
- static_cast<T>(3.125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n2a, static_cast<T>(0.25)),
- static_cast<T>(3.25L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n2a, static_cast<T>(0.75)),
- static_cast<T>(3.75L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n2a, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(3.984375L),
- tolerance);
-
- //
- // Rational functions of order 1
- //
- static const U d2c[2] = { 5, 9 };
- static const boost::array<U, 2> d2a = { 5, 9 };
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n2c, d2c, static_cast<T>(0.125), 2),
- static_cast<T>(0.5102040816326530612244897959183673469388L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n2c, d2c, static_cast<T>(0.25), 2),
- static_cast<T>(0.4482758620689655172413793103448275862069L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n2c, d2c, static_cast<T>(0.75), 2),
- static_cast<T>(0.3191489361702127659574468085106382978723L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n2c, d2c, static_cast<T>(1.0f - 1.0f/64.0f), 2),
- static_cast<T>(0.2874859075535512965050732807215332581736L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n2c, d2c, static_cast<T>(0.125)),
- static_cast<T>(0.5102040816326530612244897959183673469388L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n2c, d2c, static_cast<T>(0.25)),
- static_cast<T>(0.4482758620689655172413793103448275862069L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n2c, d2c, static_cast<T>(0.75)),
- static_cast<T>(0.3191489361702127659574468085106382978723L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n2c, d2c, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(0.2874859075535512965050732807215332581736L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n2a, d2a, static_cast<T>(0.125)),
- static_cast<T>(0.5102040816326530612244897959183673469388L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n2a, d2a, static_cast<T>(0.25)),
- static_cast<T>(0.4482758620689655172413793103448275862069L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n2a, d2a, static_cast<T>(0.75)),
- static_cast<T>(0.3191489361702127659574468085106382978723L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n2a, d2a, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(0.2874859075535512965050732807215332581736L),
- tolerance);
-
- //
- // Polynomials of order 2
- //
- static const U n3c[3] = { 10, 6, 11 };
- static const boost::array<U, 3> n3a = { 10, 6, 11 };
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n3c, static_cast<T>(0.125), 3),
- static_cast<T>(10.921875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n3c, static_cast<T>(0.25), 3),
- static_cast<T>(12.1875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n3c, static_cast<T>(0.75), 3),
- static_cast<T>(20.6875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n3c, static_cast<T>(1.0f - 1.0f/64.0f), 3),
- static_cast<T>(26.565185546875L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n3c, static_cast<T>(0.125)),
- static_cast<T>(10.921875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n3c, static_cast<T>(0.25)),
- static_cast<T>(12.1875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n3c, static_cast<T>(0.75)),
- static_cast<T>(20.6875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n3c, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(26.565185546875L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n3a, static_cast<T>(0.125)),
- static_cast<T>(10.921875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n3a, static_cast<T>(0.25)),
- static_cast<T>(12.1875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n3a, static_cast<T>(0.75)),
- static_cast<T>(20.6875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n3a, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(26.565185546875L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n3c, static_cast<T>(0.125), 3),
- static_cast<T>(10.096435546875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n3c, static_cast<T>(0.25), 3),
- static_cast<T>(10.41796875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n3c, static_cast<T>(0.75), 3),
- static_cast<T>(16.85546875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n3c, static_cast<T>(1.0f - 1.0f/64.0f), 3),
- static_cast<T>(26.142410933971405029296875L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n3c, static_cast<T>(0.125)),
- static_cast<T>(10.096435546875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n3c, static_cast<T>(0.25)),
- static_cast<T>(10.41796875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n3c, static_cast<T>(0.75)),
- static_cast<T>(16.85546875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n3c, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(26.142410933971405029296875L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n3a, static_cast<T>(0.125)),
- static_cast<T>(10.096435546875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n3a, static_cast<T>(0.25)),
- static_cast<T>(10.41796875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n3a, static_cast<T>(0.75)),
- static_cast<T>(16.85546875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n3a, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(26.142410933971405029296875L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n3c, static_cast<T>(0.125), 3),
- static_cast<T>(10.771484375L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n3c, static_cast<T>(0.25), 3),
- static_cast<T>(11.671875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n3c, static_cast<T>(0.75), 3),
- static_cast<T>(19.140625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n3c, static_cast<T>(1.0f - 1.0f/64.0f), 3),
- static_cast<T>(26.398639678955078125L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n3c, static_cast<T>(0.125)),
- static_cast<T>(10.771484375L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n3c, static_cast<T>(0.25)),
- static_cast<T>(11.671875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n3c, static_cast<T>(0.75)),
- static_cast<T>(19.140625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n3c, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(26.398639678955078125L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n3a, static_cast<T>(0.125)),
- static_cast<T>(10.771484375L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n3a, static_cast<T>(0.25)),
- static_cast<T>(11.671875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n3a, static_cast<T>(0.75)),
- static_cast<T>(19.140625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n3a, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(26.398639678955078125L),
- tolerance);
-
- //
- // Rational functions of order 2
- //
- static const U d3c[3] = { 3, 4, 10 };
- static const boost::array<U, 3> d3a = { 3, 4, 10 };
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n3c, d3c, static_cast<T>(0.125), 3),
- static_cast<T>(2.987179487179487179487179487179487179487L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n3c, d3c, static_cast<T>(0.25), 3),
- static_cast<T>(2.635135135135135135135135135135135135135L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n3c, d3c, static_cast<T>(0.75), 3),
- static_cast<T>(1.779569892473118279569892473118279569892L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n3c, d3c, static_cast<T>(1.0f - 1.0f/64.0f), 3),
- static_cast<T>(1.597671277126831703520981998649164537633L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n3c, d3c, static_cast<T>(0.125)),
- static_cast<T>(2.987179487179487179487179487179487179487L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n3c, d3c, static_cast<T>(0.25)),
- static_cast<T>(2.635135135135135135135135135135135135135L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n3c, d3c, static_cast<T>(0.75)),
- static_cast<T>(1.779569892473118279569892473118279569892L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n3c, d3c, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(1.597671277126831703520981998649164537633L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n3a, d3a, static_cast<T>(0.125)),
- static_cast<T>(2.987179487179487179487179487179487179487L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n3a, d3a, static_cast<T>(0.25)),
- static_cast<T>(2.635135135135135135135135135135135135135L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n3a, d3a, static_cast<T>(0.75)),
- static_cast<T>(1.779569892473118279569892473118279569892L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n3a, d3a, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(1.597671277126831703520981998649164537633L),
- tolerance);
-
- //
- // Polynomials of order 3
- //
- static const U n4c[4] = { 1, 4, 9, 11 };
- static const boost::array<U, 4> n4a = { 1, 4, 9, 11 };
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n4c, static_cast<T>(0.125), 4),
- static_cast<T>(1.662109375L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n4c, static_cast<T>(0.25), 4),
- static_cast<T>(2.734375L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n4c, static_cast<T>(0.75), 4),
- static_cast<T>(13.703125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n4c, static_cast<T>(1.0f - 1.0f/64.0f), 4),
- static_cast<T>(24.150836944580078125L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n4c, static_cast<T>(0.125)),
- static_cast<T>(1.662109375L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n4c, static_cast<T>(0.25)),
- static_cast<T>(2.734375L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n4c, static_cast<T>(0.75)),
- static_cast<T>(13.703125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n4c, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(24.150836944580078125L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n4a, static_cast<T>(0.125)),
- static_cast<T>(1.662109375L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n4a, static_cast<T>(0.25)),
- static_cast<T>(2.734375L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n4a, static_cast<T>(0.75)),
- static_cast<T>(13.703125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n4a, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(24.150836944580078125L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n4c, static_cast<T>(0.125), 4),
- static_cast<T>(1.064739227294921875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n4c, static_cast<T>(0.25), 4),
- static_cast<T>(1.287841796875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n4c, static_cast<T>(0.75), 4),
- static_cast<T>(8.055419921875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n4c, static_cast<T>(1.0f - 1.0f/64.0f), 4),
- static_cast<T>(23.334727106775972060859203338623046875L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n4c, static_cast<T>(0.125)),
- static_cast<T>(1.064739227294921875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n4c, static_cast<T>(0.25)),
- static_cast<T>(1.287841796875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n4c, static_cast<T>(0.75)),
- static_cast<T>(8.055419921875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n4c, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(23.334727106775972060859203338623046875L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n4a, static_cast<T>(0.125)),
- static_cast<T>(1.064739227294921875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n4a, static_cast<T>(0.25)),
- static_cast<T>(1.287841796875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n4a, static_cast<T>(0.75)),
- static_cast<T>(8.055419921875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n4a, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(23.334727106775972060859203338623046875L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n4c, static_cast<T>(0.125), 4),
- static_cast<T>(1.517913818359375L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n4c, static_cast<T>(0.25), 4),
- static_cast<T>(2.1513671875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n4c, static_cast<T>(0.75), 4),
- static_cast<T>(10.4072265625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n4c, static_cast<T>(1.0f - 1.0f/64.0f), 4),
- static_cast<T>(23.689246584661304950714111328125L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n4c, static_cast<T>(0.125)),
- static_cast<T>(1.517913818359375L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n4c, static_cast<T>(0.25)),
- static_cast<T>(2.1513671875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n4c, static_cast<T>(0.75)),
- static_cast<T>(10.4072265625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n4c, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(23.689246584661304950714111328125L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n4a, static_cast<T>(0.125)),
- static_cast<T>(1.517913818359375L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n4a, static_cast<T>(0.25)),
- static_cast<T>(2.1513671875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n4a, static_cast<T>(0.75)),
- static_cast<T>(10.4072265625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n4a, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(23.689246584661304950714111328125L),
- tolerance);
-
- //
- // Rational functions of order 3
- //
- static const U d4c[4] = { 10, 2, 5, 4 };
- static const boost::array<U, 4> d4a = { 10, 2, 5, 4 };
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n4c, d4c, static_cast<T>(0.125), 4),
- static_cast<T>(0.1608087679516250944822373393801965230537L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n4c, d4c, static_cast<T>(0.25), 4),
- static_cast<T>(0.2514367816091954022988505747126436781609L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n4c, d4c, static_cast<T>(0.75), 4),
- static_cast<T>(0.8564453125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n4c, d4c, static_cast<T>(1.0f - 1.0f/64.0f), 4),
- static_cast<T>(1.170714951947222939292918160495461743806L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n4c, d4c, static_cast<T>(0.125)),
- static_cast<T>(0.1608087679516250944822373393801965230537L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n4c, d4c, static_cast<T>(0.25)),
- static_cast<T>(0.2514367816091954022988505747126436781609L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n4c, d4c, static_cast<T>(0.75)),
- static_cast<T>(0.8564453125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n4c, d4c, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(1.170714951947222939292918160495461743806L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n4a, d4a, static_cast<T>(0.125)),
- static_cast<T>(0.1608087679516250944822373393801965230537L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n4a, d4a, static_cast<T>(0.25)),
- static_cast<T>(0.2514367816091954022988505747126436781609L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n4a, d4a, static_cast<T>(0.75)),
- static_cast<T>(0.8564453125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n4a, d4a, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(1.170714951947222939292918160495461743806L),
- tolerance);
-
- //
- // Polynomials of order 4
- //
- static const U n5c[5] = { 10, 10, 4, 11, 9 };
- static const boost::array<U, 5> n5a = { 10, 10, 4, 11, 9 };
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n5c, static_cast<T>(0.125), 5),
- static_cast<T>(11.336181640625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n5c, static_cast<T>(0.25), 5),
- static_cast<T>(12.95703125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n5c, static_cast<T>(0.75), 5),
- static_cast<T>(27.23828125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n5c, static_cast<T>(1.0f - 1.0f/64.0f), 5),
- static_cast<T>(42.662663042545318603515625L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n5c, static_cast<T>(0.125)),
- static_cast<T>(11.336181640625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n5c, static_cast<T>(0.25)),
- static_cast<T>(12.95703125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n5c, static_cast<T>(0.75)),
- static_cast<T>(27.23828125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n5c, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(42.662663042545318603515625L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n5a, static_cast<T>(0.125)),
- static_cast<T>(11.336181640625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n5a, static_cast<T>(0.25)),
- static_cast<T>(12.95703125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n5a, static_cast<T>(0.75)),
- static_cast<T>(27.23828125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n5a, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(42.662663042545318603515625L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n5c, static_cast<T>(0.125), 5),
- static_cast<T>(10.157269060611724853515625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n5c, static_cast<T>(0.25), 5),
- static_cast<T>(10.6434478759765625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n5c, static_cast<T>(0.75), 5),
- static_cast<T>(19.7494049072265625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n5c, static_cast<T>(1.0f - 1.0f/64.0f), 5),
- static_cast<T>(41.38858164296656028113829961512237787247L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n5c, static_cast<T>(0.125)),
- static_cast<T>(10.157269060611724853515625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n5c, static_cast<T>(0.25)),
- static_cast<T>(10.6434478759765625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n5c, static_cast<T>(0.75)),
- static_cast<T>(19.7494049072265625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n5c, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(41.38858164296656028113829961512237787247L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n5a, static_cast<T>(0.125)),
- static_cast<T>(10.157269060611724853515625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n5a, static_cast<T>(0.25)),
- static_cast<T>(10.6434478759765625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n5a, static_cast<T>(0.75)),
- static_cast<T>(19.7494049072265625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n5a, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(41.38858164296656028113829961512237787247L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n5c, static_cast<T>(0.125), 5),
- static_cast<T>(11.258152484893798828125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n5c, static_cast<T>(0.25), 5),
- static_cast<T>(12.57379150390625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n5c, static_cast<T>(0.75), 5),
- static_cast<T>(22.99920654296875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n5c, static_cast<T>(1.0f - 1.0f/64.0f), 5),
- static_cast<T>(41.88681309761682314274366945028305053711L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n5c, static_cast<T>(0.125)),
- static_cast<T>(11.258152484893798828125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n5c, static_cast<T>(0.25)),
- static_cast<T>(12.57379150390625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n5c, static_cast<T>(0.75)),
- static_cast<T>(22.99920654296875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n5c, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(41.88681309761682314274366945028305053711L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n5a, static_cast<T>(0.125)),
- static_cast<T>(11.258152484893798828125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n5a, static_cast<T>(0.25)),
- static_cast<T>(12.57379150390625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n5a, static_cast<T>(0.75)),
- static_cast<T>(22.99920654296875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n5a, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(41.88681309761682314274366945028305053711L),
- tolerance);
-
- //
- // Rational functions of order 4
- //
- static const U d5c[5] = { 6, 9, 6, 2, 5 };
- static const boost::array<U, 5> d5a = { 6, 9, 6, 2, 5 };
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n5c, d5c, static_cast<T>(0.125), 5),
- static_cast<T>(1.569265605461489066882963263374902835513L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n5c, d5c, static_cast<T>(0.25), 5),
- static_cast<T>(1.493471409275101305718144979738856371004L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n5c, d5c, static_cast<T>(0.75), 5),
- static_cast<T>(1.468309117708991366603495472731101284481L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n5c, d5c, static_cast<T>(1.0f - 1.0f/64.0f), 5),
- static_cast<T>(1.564121691159921277310988862398683772017L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n5c, d5c, static_cast<T>(0.125)),
- static_cast<T>(1.569265605461489066882963263374902835513L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n5c, d5c, static_cast<T>(0.25)),
- static_cast<T>(1.493471409275101305718144979738856371004L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n5c, d5c, static_cast<T>(0.75)),
- static_cast<T>(1.468309117708991366603495472731101284481L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n5c, d5c, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(1.564121691159921277310988862398683772017L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n5a, d5a, static_cast<T>(0.125)),
- static_cast<T>(1.569265605461489066882963263374902835513L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n5a, d5a, static_cast<T>(0.25)),
- static_cast<T>(1.493471409275101305718144979738856371004L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n5a, d5a, static_cast<T>(0.75)),
- static_cast<T>(1.468309117708991366603495472731101284481L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n5a, d5a, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(1.564121691159921277310988862398683772017L),
- tolerance);
-
- //
- // Polynomials of order 5
- //
- static const U n6c[6] = { 6, 8, 12, 5, 7, 5 };
- static const boost::array<U, 6> n6a = { 6, 8, 12, 5, 7, 5 };
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n6c, static_cast<T>(0.125), 6),
- static_cast<T>(7.199127197265625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n6c, static_cast<T>(0.25), 6),
- static_cast<T>(8.8603515625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n6c, static_cast<T>(0.75), 6),
- static_cast<T>(24.2607421875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n6c, static_cast<T>(1.0f - 1.0f/64.0f), 6),
- static_cast<T>(41.466238017193973064422607421875L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n6c, static_cast<T>(0.125)),
- static_cast<T>(7.199127197265625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n6c, static_cast<T>(0.25)),
- static_cast<T>(8.8603515625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n6c, static_cast<T>(0.75)),
- static_cast<T>(24.2607421875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n6c, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(41.466238017193973064422607421875L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n6a, static_cast<T>(0.125)),
- static_cast<T>(7.199127197265625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n6a, static_cast<T>(0.25)),
- static_cast<T>(8.8603515625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n6a, static_cast<T>(0.75)),
- static_cast<T>(24.2607421875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n6a, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(41.466238017193973064422607421875L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n6c, static_cast<T>(0.125), 6),
- static_cast<T>(6.127949182875454425811767578125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n6c, static_cast<T>(0.25), 6),
- static_cast<T>(6.54820728302001953125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n6c, static_cast<T>(0.75), 6),
- static_cast<T>(16.16912555694580078125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n6c, static_cast<T>(1.0f - 1.0f/64.0f), 6),
- static_cast<T>(40.01137167344577683526091194110563264985L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n6c, static_cast<T>(0.125)),
- static_cast<T>(6.127949182875454425811767578125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n6c, static_cast<T>(0.25)),
- static_cast<T>(6.54820728302001953125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n6c, static_cast<T>(0.75)),
- static_cast<T>(16.16912555694580078125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n6c, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(40.01137167344577683526091194110563264985L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n6a, static_cast<T>(0.125)),
- static_cast<T>(6.127949182875454425811767578125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n6a, static_cast<T>(0.25)),
- static_cast<T>(6.54820728302001953125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n6a, static_cast<T>(0.75)),
- static_cast<T>(16.16912555694580078125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n6a, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(40.01137167344577683526091194110563264985L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n6c, static_cast<T>(0.125), 6),
- static_cast<T>(7.023593463003635406494140625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n6c, static_cast<T>(0.25), 6),
- static_cast<T>(8.192829132080078125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n6c, static_cast<T>(0.75), 6),
- static_cast<T>(19.558834075927734375L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n6c, static_cast<T>(1.0f - 1.0f/64.0f), 6),
- static_cast<T>(40.55123471588142408661425974969461094588L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n6c, static_cast<T>(0.125)),
- static_cast<T>(7.023593463003635406494140625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n6c, static_cast<T>(0.25)),
- static_cast<T>(8.192829132080078125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n6c, static_cast<T>(0.75)),
- static_cast<T>(19.558834075927734375L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n6c, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(40.55123471588142408661425974969461094588L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n6a, static_cast<T>(0.125)),
- static_cast<T>(7.023593463003635406494140625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n6a, static_cast<T>(0.25)),
- static_cast<T>(8.192829132080078125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n6a, static_cast<T>(0.75)),
- static_cast<T>(19.558834075927734375L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n6a, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(40.55123471588142408661425974969461094588L),
- tolerance);
-
- //
- // Rational functions of order 5
- //
- static const U d6c[6] = { 5, 11, 7, 12, 10, 5 };
- static const boost::array<U, 6> d6a = { 5, 11, 7, 12, 10, 5 };
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n6c, d6c, static_cast<T>(0.125), 6),
- static_cast<T>(1.105787665293227020667219792530925829572L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n6c, d6c, static_cast<T>(0.25), 6),
- static_cast<T>(1.052430112515949425820670455863588910799L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n6c, d6c, static_cast<T>(0.75), 6),
- static_cast<T>(0.9120378868534087154447666948125848966555L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n6c, d6c, static_cast<T>(1.0f - 1.0f/64.0f), 6),
- static_cast<T>(0.8626539746676637108178973543021882567334L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n6c, d6c, static_cast<T>(0.125)),
- static_cast<T>(1.105787665293227020667219792530925829572L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n6c, d6c, static_cast<T>(0.25)),
- static_cast<T>(1.052430112515949425820670455863588910799L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n6c, d6c, static_cast<T>(0.75)),
- static_cast<T>(0.9120378868534087154447666948125848966555L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n6c, d6c, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(0.8626539746676637108178973543021882567334L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n6a, d6a, static_cast<T>(0.125)),
- static_cast<T>(1.105787665293227020667219792530925829572L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n6a, d6a, static_cast<T>(0.25)),
- static_cast<T>(1.052430112515949425820670455863588910799L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n6a, d6a, static_cast<T>(0.75)),
- static_cast<T>(0.9120378868534087154447666948125848966555L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n6a, d6a, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(0.8626539746676637108178973543021882567334L),
- tolerance);
-
- //
- // Polynomials of order 6
- //
- static const U n7c[7] = { 3, 4, 11, 5, 10, 7, 9 };
- static const boost::array<U, 7> n7a = { 3, 4, 11, 5, 10, 7, 9 };
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n7c, static_cast<T>(0.125), 7),
- static_cast<T>(3.684329986572265625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n7c, static_cast<T>(0.25), 7),
- static_cast<T>(4.813720703125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n7c, static_cast<T>(0.75), 7),
- static_cast<T>(20.723876953125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n7c, static_cast<T>(1.0f - 1.0f/64.0f), 7),
- static_cast<T>(46.413680258337990380823612213134765625L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n7c, static_cast<T>(0.125)),
- static_cast<T>(3.684329986572265625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n7c, static_cast<T>(0.25)),
- static_cast<T>(4.813720703125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n7c, static_cast<T>(0.75)),
- static_cast<T>(20.723876953125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n7c, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(46.413680258337990380823612213134765625L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n7a, static_cast<T>(0.125)),
- static_cast<T>(3.684329986572265625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n7a, static_cast<T>(0.25)),
- static_cast<T>(4.813720703125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n7a, static_cast<T>(0.75)),
- static_cast<T>(20.723876953125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n7a, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(46.413680258337990380823612213134765625L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n7c, static_cast<T>(0.125), 7),
- static_cast<T>(3.065205223058001138269901275634765625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n7c, static_cast<T>(0.25), 7),
- static_cast<T>(3.294349253177642822265625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n7c, static_cast<T>(0.75), 7),
- static_cast<T>(11.300772249698638916015625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n7c, static_cast<T>(1.0f - 1.0f/64.0f), 7),
- static_cast<T>(44.00013192129567626077980251194602528964L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n7c, static_cast<T>(0.125)),
- static_cast<T>(3.065205223058001138269901275634765625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n7c, static_cast<T>(0.25)),
- static_cast<T>(3.294349253177642822265625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n7c, static_cast<T>(0.75)),
- static_cast<T>(11.300772249698638916015625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n7c, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(44.00013192129567626077980251194602528964L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n7a, static_cast<T>(0.125)),
- static_cast<T>(3.065205223058001138269901275634765625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n7a, static_cast<T>(0.25)),
- static_cast<T>(3.294349253177642822265625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n7a, static_cast<T>(0.75)),
- static_cast<T>(11.300772249698638916015625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n7a, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(44.00013192129567626077980251194602528964L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n7c, static_cast<T>(0.125), 7),
- static_cast<T>(3.521641784464009106159210205078125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n7c, static_cast<T>(0.25), 7),
- static_cast<T>(4.1773970127105712890625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n7c, static_cast<T>(0.75), 7),
- static_cast<T>(14.0676963329315185546875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n7c, static_cast<T>(1.0f - 1.0f/64.0f), 7),
- static_cast<T>(44.65092766607814731253821207562770823074L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n7c, static_cast<T>(0.125)),
- static_cast<T>(3.521641784464009106159210205078125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n7c, static_cast<T>(0.25)),
- static_cast<T>(4.1773970127105712890625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n7c, static_cast<T>(0.75)),
- static_cast<T>(14.0676963329315185546875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n7c, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(44.65092766607814731253821207562770823074L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n7a, static_cast<T>(0.125)),
- static_cast<T>(3.521641784464009106159210205078125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n7a, static_cast<T>(0.25)),
- static_cast<T>(4.1773970127105712890625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n7a, static_cast<T>(0.75)),
- static_cast<T>(14.0676963329315185546875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n7a, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(44.65092766607814731253821207562770823074L),
- tolerance);
-
- //
- // Rational functions of order 6
- //
- static const U d7c[7] = { 2, 8, 10, 8, 1, 11, 1 };
- static const boost::array<U, 7> d7a = { 2, 8, 10, 8, 1, 11, 1 };
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n7c, d7c, static_cast<T>(0.125), 7),
- static_cast<T>(1.161348466465698540596242849979738853664L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n7c, d7c, static_cast<T>(0.25), 7),
- static_cast<T>(1.010247476558897371522262642824204539632L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n7c, d7c, static_cast<T>(0.75), 7),
- static_cast<T>(1.03079575951134804308491906398377636644L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n7c, d7c, static_cast<T>(1.0f - 1.0f/64.0f), 7),
- static_cast<T>(1.183671559390403425417413542214181025989L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n7c, d7c, static_cast<T>(0.125)),
- static_cast<T>(1.161348466465698540596242849979738853664L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n7c, d7c, static_cast<T>(0.25)),
- static_cast<T>(1.010247476558897371522262642824204539632L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n7c, d7c, static_cast<T>(0.75)),
- static_cast<T>(1.03079575951134804308491906398377636644L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n7c, d7c, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(1.183671559390403425417413542214181025989L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n7a, d7a, static_cast<T>(0.125)),
- static_cast<T>(1.161348466465698540596242849979738853664L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n7a, d7a, static_cast<T>(0.25)),
- static_cast<T>(1.010247476558897371522262642824204539632L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n7a, d7a, static_cast<T>(0.75)),
- static_cast<T>(1.03079575951134804308491906398377636644L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n7a, d7a, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(1.183671559390403425417413542214181025989L),
- tolerance);
-
- //
- // Polynomials of order 7
- //
- static const U n8c[8] = { 9, 5, 6, 1, 12, 2, 11, 1 };
- static const boost::array<U, 8> n8a = { 9, 5, 6, 1, 12, 2, 11, 1 };
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n8c, static_cast<T>(0.125), 8),
- static_cast<T>(9.723736286163330078125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n8c, static_cast<T>(0.25), 8),
- static_cast<T>(10.69219970703125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n8c, static_cast<T>(0.75), 8),
- static_cast<T>(22.90960693359375L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n8c, static_cast<T>(1.0f - 1.0f/64.0f), 8),
- static_cast<T>(44.70947054706607559637632220983505249023L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n8c, static_cast<T>(0.125)),
- static_cast<T>(9.723736286163330078125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n8c, static_cast<T>(0.25)),
- static_cast<T>(10.69219970703125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n8c, static_cast<T>(0.75)),
- static_cast<T>(22.90960693359375L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n8c, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(44.70947054706607559637632220983505249023L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n8a, static_cast<T>(0.125)),
- static_cast<T>(9.723736286163330078125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n8a, static_cast<T>(0.25)),
- static_cast<T>(10.69219970703125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n8a, static_cast<T>(0.75)),
- static_cast<T>(22.90960693359375L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n8a, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(44.70947054706607559637632220983505249023L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n8c, static_cast<T>(0.125), 8),
- static_cast<T>(9.079594375725946520105935633182525634766L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n8c, static_cast<T>(0.25), 8),
- static_cast<T>(9.3363673128187656402587890625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n8c, static_cast<T>(0.75), 8),
- static_cast<T>(15.5691558457911014556884765625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n8c, static_cast<T>(1.0f - 1.0f/64.0f), 8),
- static_cast<T>(42.58457138999176910226338119632657870077L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n8c, static_cast<T>(0.125)),
- static_cast<T>(9.079594375725946520105935633182525634766L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n8c, static_cast<T>(0.25)),
- static_cast<T>(9.3363673128187656402587890625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n8c, static_cast<T>(0.75)),
- static_cast<T>(15.5691558457911014556884765625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n8c, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(42.58457138999176910226338119632657870077L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n8a, static_cast<T>(0.125)),
- static_cast<T>(9.079594375725946520105935633182525634766L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n8a, static_cast<T>(0.25)),
- static_cast<T>(9.3363673128187656402587890625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n8a, static_cast<T>(0.75)),
- static_cast<T>(15.5691558457911014556884765625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n8a, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(42.58457138999176910226338119632657870077L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n8c, static_cast<T>(0.125), 8),
- static_cast<T>(9.636755005807572160847485065460205078125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n8c, static_cast<T>(0.25), 8),
- static_cast<T>(10.34546925127506256103515625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n8c, static_cast<T>(0.75), 8),
- static_cast<T>(17.75887446105480194091796875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n8c, static_cast<T>(1.0f - 1.0f/64.0f), 8),
- static_cast<T>(43.11765982475354321499772058039525455316L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n8c, static_cast<T>(0.125)),
- static_cast<T>(9.636755005807572160847485065460205078125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n8c, static_cast<T>(0.25)),
- static_cast<T>(10.34546925127506256103515625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n8c, static_cast<T>(0.75)),
- static_cast<T>(17.75887446105480194091796875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n8c, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(43.11765982475354321499772058039525455316L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n8a, static_cast<T>(0.125)),
- static_cast<T>(9.636755005807572160847485065460205078125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n8a, static_cast<T>(0.25)),
- static_cast<T>(10.34546925127506256103515625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n8a, static_cast<T>(0.75)),
- static_cast<T>(17.75887446105480194091796875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n8a, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(43.11765982475354321499772058039525455316L),
- tolerance);
-
- //
- // Rational functions of order 7
- //
- static const U d8c[8] = { 7, 10, 10, 11, 2, 4, 1, 7 };
- static const boost::array<U, 8> d8a = { 7, 10, 10, 11, 2, 4, 1, 7 };
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n8c, d8c, static_cast<T>(0.125), 8),
- static_cast<T>(1.153693678861771369296601206130394355814L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n8c, d8c, static_cast<T>(0.25), 8),
- static_cast<T>(1.03714470093009762768860970830101771981L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n8c, d8c, static_cast<T>(0.75), 8),
- static_cast<T>(0.834289461108456229648481346061946410909L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n8c, d8c, static_cast<T>(1.0f - 1.0f/64.0f), 8),
- static_cast<T>(0.8981362736388035283180082845549732926578L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n8c, d8c, static_cast<T>(0.125)),
- static_cast<T>(1.153693678861771369296601206130394355814L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n8c, d8c, static_cast<T>(0.25)),
- static_cast<T>(1.03714470093009762768860970830101771981L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n8c, d8c, static_cast<T>(0.75)),
- static_cast<T>(0.834289461108456229648481346061946410909L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n8c, d8c, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(0.8981362736388035283180082845549732926578L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n8a, d8a, static_cast<T>(0.125)),
- static_cast<T>(1.153693678861771369296601206130394355814L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n8a, d8a, static_cast<T>(0.25)),
- static_cast<T>(1.03714470093009762768860970830101771981L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n8a, d8a, static_cast<T>(0.75)),
- static_cast<T>(0.834289461108456229648481346061946410909L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n8a, d8a, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(0.8981362736388035283180082845549732926578L),
- tolerance);
-
- //
- // Polynomials of order 8
- //
- static const U n9c[9] = { 3, 9, 3, 9, 5, 6, 10, 7, 10 };
- static const boost::array<U, 9> n9a = { 3, 9, 3, 9, 5, 6, 10, 7, 10 };
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n9c, static_cast<T>(0.125), 9),
- static_cast<T>(4.19089901447296142578125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n9c, static_cast<T>(0.25), 9),
- static_cast<T>(5.606536865234375L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n9c, static_cast<T>(0.75), 9),
- static_cast<T>(21.955535888671875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n9c, static_cast<T>(1.0f - 1.0f/64.0f), 9),
- static_cast<T>(57.7754343750660055434309470001608133316L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n9c, static_cast<T>(0.125)),
- static_cast<T>(4.19089901447296142578125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n9c, static_cast<T>(0.25)),
- static_cast<T>(5.606536865234375L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n9c, static_cast<T>(0.75)),
- static_cast<T>(21.955535888671875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n9c, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(57.7754343750660055434309470001608133316L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n9a, static_cast<T>(0.125)),
- static_cast<T>(4.19089901447296142578125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n9a, static_cast<T>(0.25)),
- static_cast<T>(5.606536865234375L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n9a, static_cast<T>(0.75)),
- static_cast<T>(21.955535888671875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n9a, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(57.7754343750660055434309470001608133316L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n9c, static_cast<T>(0.125), 9),
- static_cast<T>(3.141392057908696244794555241242051124573L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n9c, static_cast<T>(0.25), 9),
- static_cast<T>(3.5764986560679972171783447265625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n9c, static_cast<T>(0.75), 9),
- static_cast<T>(11.9936861679889261722564697265625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n9c, static_cast<T>(1.0f - 1.0f/64.0f), 9),
- static_cast<T>(53.92583642412261279423815221065846904997L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n9c, static_cast<T>(0.125)),
- static_cast<T>(3.141392057908696244794555241242051124573L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n9c, static_cast<T>(0.25)),
- static_cast<T>(3.5764986560679972171783447265625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n9c, static_cast<T>(0.75)),
- static_cast<T>(11.9936861679889261722564697265625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n9c, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(53.92583642412261279423815221065846904997L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n9a, static_cast<T>(0.125)),
- static_cast<T>(3.141392057908696244794555241242051124573L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n9a, static_cast<T>(0.25)),
- static_cast<T>(3.5764986560679972171783447265625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n9a, static_cast<T>(0.75)),
- static_cast<T>(11.9936861679889261722564697265625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n9a, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(53.92583642412261279423815221065846904997L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n9c, static_cast<T>(0.125), 9),
- static_cast<T>(4.131136463269569958356441929936408996582L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n9c, static_cast<T>(0.25), 9),
- static_cast<T>(5.30599462427198886871337890625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n9c, static_cast<T>(0.75), 9),
- static_cast<T>(14.99158155731856822967529296875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n9c, static_cast<T>(1.0f - 1.0f/64.0f), 9),
- static_cast<T>(54.73418303402932093382923399178003205076L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n9c, static_cast<T>(0.125)),
- static_cast<T>(4.131136463269569958356441929936408996582L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n9c, static_cast<T>(0.25)),
- static_cast<T>(5.30599462427198886871337890625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n9c, static_cast<T>(0.75)),
- static_cast<T>(14.99158155731856822967529296875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n9c, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(54.73418303402932093382923399178003205076L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n9a, static_cast<T>(0.125)),
- static_cast<T>(4.131136463269569958356441929936408996582L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n9a, static_cast<T>(0.25)),
- static_cast<T>(5.30599462427198886871337890625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n9a, static_cast<T>(0.75)),
- static_cast<T>(14.99158155731856822967529296875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n9a, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(54.73418303402932093382923399178003205076L),
- tolerance);
-
- //
- // Rational functions of order 8
- //
- static const U d9c[9] = { 12, 3, 10, 4, 6, 6, 6, 10, 7 };
- static const boost::array<U, 9> d9a = { 12, 3, 10, 4, 6, 6, 6, 10, 7 };
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n9c, d9c, static_cast<T>(0.125), 9),
- static_cast<T>(0.3341827920887278954826517708316980450243L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n9c, d9c, static_cast<T>(0.25), 9),
- static_cast<T>(0.4162555242250224594229316089330159747956L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n9c, d9c, static_cast<T>(0.75), 9),
- static_cast<T>(0.7844550246723573100342976024389406178802L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n9c, d9c, static_cast<T>(1.0f - 1.0f/64.0f), 9),
- static_cast<T>(0.959335028097323235424759017468360386113L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n9c, d9c, static_cast<T>(0.125)),
- static_cast<T>(0.3341827920887278954826517708316980450243L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n9c, d9c, static_cast<T>(0.25)),
- static_cast<T>(0.4162555242250224594229316089330159747956L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n9c, d9c, static_cast<T>(0.75)),
- static_cast<T>(0.7844550246723573100342976024389406178802L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n9c, d9c, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(0.959335028097323235424759017468360386113L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n9a, d9a, static_cast<T>(0.125)),
- static_cast<T>(0.3341827920887278954826517708316980450243L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n9a, d9a, static_cast<T>(0.25)),
- static_cast<T>(0.4162555242250224594229316089330159747956L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n9a, d9a, static_cast<T>(0.75)),
- static_cast<T>(0.7844550246723573100342976024389406178802L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n9a, d9a, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(0.959335028097323235424759017468360386113L),
- tolerance);
-
- //
- // Polynomials of order 9
- //
- static const U n10c[10] = { 3, 4, 2, 6, 8, 1, 2, 4, 8, 8 };
- static const boost::array<U, 10> n10a = { 3, 4, 2, 6, 8, 1, 2, 4, 8, 8 };
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n10c, static_cast<T>(0.125), 10),
- static_cast<T>(3.544962465763092041015625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n10c, static_cast<T>(0.25), 10),
- static_cast<T>(4.251861572265625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n10c, static_cast<T>(0.75), 10),
- static_cast<T>(14.716278076171875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n10c, static_cast<T>(1.0f - 1.0f/64.0f), 10),
- static_cast<T>(42.43246072286939307716124858416151255369L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n10c, static_cast<T>(0.125)),
- static_cast<T>(3.544962465763092041015625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n10c, static_cast<T>(0.25)),
- static_cast<T>(4.251861572265625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n10c, static_cast<T>(0.75)),
- static_cast<T>(14.716278076171875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n10c, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(42.43246072286939307716124858416151255369L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n10a, static_cast<T>(0.125)),
- static_cast<T>(3.544962465763092041015625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n10a, static_cast<T>(0.25)),
- static_cast<T>(4.251861572265625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n10a, static_cast<T>(0.75)),
- static_cast<T>(14.716278076171875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n10a, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(42.43246072286939307716124858416151255369L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n10c, static_cast<T>(0.125), 10),
- static_cast<T>(3.063011647232116718697625401546247303486L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n10c, static_cast<T>(0.25), 10),
- static_cast<T>(3.259400503826327621936798095703125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n10c, static_cast<T>(0.75), 10),
- static_cast<T>(8.067807371844537556171417236328125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n10c, static_cast<T>(1.0f - 1.0f/64.0f), 10),
- static_cast<T>(39.22779295817342542834377568121069117613L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n10c, static_cast<T>(0.125)),
- static_cast<T>(3.063011647232116718697625401546247303486L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n10c, static_cast<T>(0.25)),
- static_cast<T>(3.259400503826327621936798095703125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n10c, static_cast<T>(0.75)),
- static_cast<T>(8.067807371844537556171417236328125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n10c, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(39.22779295817342542834377568121069117613L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n10a, static_cast<T>(0.125)),
- static_cast<T>(3.063011647232116718697625401546247303486L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n10a, static_cast<T>(0.25)),
- static_cast<T>(3.259400503826327621936798095703125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n10a, static_cast<T>(0.75)),
- static_cast<T>(8.067807371844537556171417236328125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n10a, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(39.22779295817342542834377568121069117613L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n10c, static_cast<T>(0.125), 10),
- static_cast<T>(3.504093177856933749581003212369978427887L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n10c, static_cast<T>(0.25), 10),
- static_cast<T>(4.0376020153053104877471923828125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n10c, static_cast<T>(0.75), 10),
- static_cast<T>(9.7570764957927167415618896484375L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n10c, static_cast<T>(1.0f - 1.0f/64.0f), 10),
- static_cast<T>(39.80283729084284487958732767615054341702L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n10c, static_cast<T>(0.125)),
- static_cast<T>(3.504093177856933749581003212369978427887L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n10c, static_cast<T>(0.25)),
- static_cast<T>(4.0376020153053104877471923828125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n10c, static_cast<T>(0.75)),
- static_cast<T>(9.7570764957927167415618896484375L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n10c, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(39.80283729084284487958732767615054341702L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n10a, static_cast<T>(0.125)),
- static_cast<T>(3.504093177856933749581003212369978427887L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n10a, static_cast<T>(0.25)),
- static_cast<T>(4.0376020153053104877471923828125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n10a, static_cast<T>(0.75)),
- static_cast<T>(9.7570764957927167415618896484375L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n10a, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(39.80283729084284487958732767615054341702L),
- tolerance);
-
- //
- // Rational functions of order 9
- //
- static const U d10c[10] = { 3, 11, 1, 12, 8, 8, 7, 10, 8, 8 };
- static const boost::array<U, 10> d10a = { 3, 11, 1, 12, 8, 8, 7, 10, 8, 8 };
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n10c, d10c, static_cast<T>(0.125), 10),
- static_cast<T>(0.8027011456035955638016996485812217742707L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n10c, d10c, static_cast<T>(0.25), 10),
- static_cast<T>(0.7037718026559713894599659542655668311705L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n10c, d10c, static_cast<T>(0.75), 10),
- static_cast<T>(0.5819711007563332500606442409694389231031L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n10c, d10c, static_cast<T>(1.0f - 1.0f/64.0f), 10),
- static_cast<T>(0.6021345078884753739086911192013079405483L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n10c, d10c, static_cast<T>(0.125)),
- static_cast<T>(0.8027011456035955638016996485812217742707L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n10c, d10c, static_cast<T>(0.25)),
- static_cast<T>(0.7037718026559713894599659542655668311705L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n10c, d10c, static_cast<T>(0.75)),
- static_cast<T>(0.5819711007563332500606442409694389231031L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n10c, d10c, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(0.6021345078884753739086911192013079405483L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n10a, d10a, static_cast<T>(0.125)),
- static_cast<T>(0.8027011456035955638016996485812217742707L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n10a, d10a, static_cast<T>(0.25)),
- static_cast<T>(0.7037718026559713894599659542655668311705L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n10a, d10a, static_cast<T>(0.75)),
- static_cast<T>(0.5819711007563332500606442409694389231031L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n10a, d10a, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(0.6021345078884753739086911192013079405483L),
- tolerance);
-
- //
- // Polynomials of order 10
- //
- static const U n11c[11] = { 2, 2, 8, 11, 3, 4, 10, 11, 5, 1, 6 };
- static const boost::array<U, 11> n11a = { 2, 2, 8, 11, 3, 4, 10, 11, 5, 1, 6 };
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n11c, static_cast<T>(0.125), 11),
- static_cast<T>(2.39738257043063640594482421875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n11c, static_cast<T>(0.25), 11),
- static_cast<T>(3.1906986236572265625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n11c, static_cast<T>(0.75), 11),
- static_cast<T>(18.7007007598876953125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n11c, static_cast<T>(1.0f - 1.0f/64.0f), 11),
- static_cast<T>(58.07897685780276847943015550157497273176L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n11c, static_cast<T>(0.125)),
- static_cast<T>(2.39738257043063640594482421875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n11c, static_cast<T>(0.25)),
- static_cast<T>(3.1906986236572265625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n11c, static_cast<T>(0.75)),
- static_cast<T>(18.7007007598876953125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n11c, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(58.07897685780276847943015550157497273176L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n11a, static_cast<T>(0.125)),
- static_cast<T>(2.39738257043063640594482421875L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n11a, static_cast<T>(0.25)),
- static_cast<T>(3.1906986236572265625L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n11a, static_cast<T>(0.75)),
- static_cast<T>(18.7007007598876953125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_polynomial(n11a, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(58.07897685780276847943015550157497273176L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n11c, static_cast<T>(0.125), 11),
- static_cast<T>(2.033245269357184586631048794913567689946L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n11c, static_cast<T>(0.25), 11),
- static_cast<T>(2.158985776148256263695657253265380859375L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n11c, static_cast<T>(0.75), 11),
- static_cast<T>(8.727145384755203849636018276214599609375L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n11c, static_cast<T>(1.0f - 1.0f/64.0f), 11),
- static_cast<T>(53.63972553738812062759598952966094072427L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n11c, static_cast<T>(0.125)),
- static_cast<T>(2.033245269357184586631048794913567689946L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n11c, static_cast<T>(0.25)),
- static_cast<T>(2.158985776148256263695657253265380859375L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n11c, static_cast<T>(0.75)),
- static_cast<T>(8.727145384755203849636018276214599609375L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n11c, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(53.63972553738812062759598952966094072427L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n11a, static_cast<T>(0.125)),
- static_cast<T>(2.033245269357184586631048794913567689946L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n11a, static_cast<T>(0.25)),
- static_cast<T>(2.158985776148256263695657253265380859375L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n11a, static_cast<T>(0.75)),
- static_cast<T>(8.727145384755203849636018276214599609375L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_even_polynomial(n11a, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(53.63972553738812062759598952966094072427L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n11c, static_cast<T>(0.125), 11),
- static_cast<T>(2.265962154857476693048390359308541519567L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n11c, static_cast<T>(0.25), 11),
- static_cast<T>(2.6359431045930250547826290130615234375L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n11c, static_cast<T>(0.75), 11),
- static_cast<T>(10.9695271796736051328480243682861328125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n11c, static_cast<T>(1.0f - 1.0f/64.0f), 11),
- static_cast<T>(54.4594037205212653994625925380682572437L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n11c, static_cast<T>(0.125)),
- static_cast<T>(2.265962154857476693048390359308541519567L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n11c, static_cast<T>(0.25)),
- static_cast<T>(2.6359431045930250547826290130615234375L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n11c, static_cast<T>(0.75)),
- static_cast<T>(10.9695271796736051328480243682861328125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n11c, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(54.4594037205212653994625925380682572437L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n11a, static_cast<T>(0.125)),
- static_cast<T>(2.265962154857476693048390359308541519567L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n11a, static_cast<T>(0.25)),
- static_cast<T>(2.6359431045930250547826290130615234375L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n11a, static_cast<T>(0.75)),
- static_cast<T>(10.9695271796736051328480243682861328125L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_odd_polynomial(n11a, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(54.4594037205212653994625925380682572437L),
- tolerance);
-
- //
- // Rational functions of order 10
- //
- static const U d11c[11] = { 4, 1, 3, 9, 11, 8, 11, 2, 6, 6, 4 };
- static const boost::array<U, 11> d11a = { 4, 1, 3, 9, 11, 8, 11, 2, 6, 6, 4 };
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n11c, d11c, static_cast<T>(0.125), 11),
- static_cast<T>(0.5718365676248588095654568811483084403598L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n11c, d11c, static_cast<T>(0.25), 11),
- static_cast<T>(0.6888631839546304707516922567568791812269L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n11c, d11c, static_cast<T>(0.75), 11),
- static_cast<T>(0.9783539912974912482969079012097816310129L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n11c, d11c, static_cast<T>(1.0f - 1.0f/64.0f), 11),
- static_cast<T>(0.9694017102874332007392886881642471036972L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n11c, d11c, static_cast<T>(0.125)),
- static_cast<T>(0.5718365676248588095654568811483084403598L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n11c, d11c, static_cast<T>(0.25)),
- static_cast<T>(0.6888631839546304707516922567568791812269L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n11c, d11c, static_cast<T>(0.75)),
- static_cast<T>(0.9783539912974912482969079012097816310129L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n11c, d11c, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(0.9694017102874332007392886881642471036972L),
- tolerance);
-
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n11a, d11a, static_cast<T>(0.125)),
- static_cast<T>(0.5718365676248588095654568811483084403598L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n11a, d11a, static_cast<T>(0.25)),
- static_cast<T>(0.6888631839546304707516922567568791812269L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n11a, d11a, static_cast<T>(0.75)),
- static_cast<T>(0.9783539912974912482969079012097816310129L),
- tolerance);
- BOOST_CHECK_CLOSE(
- boost::math::tools::evaluate_rational(n11a, d11a, static_cast<T>(1.0f - 1.0f/64.0f)),
- static_cast<T>(0.9694017102874332007392886881642471036972L),
- tolerance);
-}
+#include "test_rational.hpp"
template <class T>
void test_spots(T t, const char* n)
@@ -2339,6 +24,10 @@
do_test_spots(t, T(0));
}
+extern void test_spots(float t, const char* n);
+extern void test_spots(double t, const char* n);
+extern void test_spots(long double t, const char* n);
+
int test_main(int, char* [])
{
test_spots(0.0F, "float");
Modified: sandbox/math_toolkit/libs/math/test/test_toms748_solve.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/test/test_toms748_solve.cpp (original)
+++ sandbox/math_toolkit/libs/math/test/test_toms748_solve.cpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -239,7 +239,7 @@
std::cout << "Total iterations consumed = " << total << std::endl;
std::cout << "Total function invocations consumed = " << invocations << std::endl << std::endl;
- BOOST_CHECK(invocations < 3050);
+ BOOST_CHECK(invocations < 3150);
std::cout << std::setprecision(18);
Added: sandbox/math_toolkit/libs/math/tools/generate_rational_code.cpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/libs/math/tools/generate_rational_code.cpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -0,0 +1,738 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <iostream>
+#include <iomanip>
+#include <fstream>
+#include <string>
+#include <sstream>
+
+int max_order = 20;
+const char* path_prefix = "..\\..\\..\\boost\\math\\tools\\detail\\polynomial_";
+const char* path_prefix2 = "..\\..\\..\\boost\\math\\tools\\detail\\rational_";
+
+const char* copyright_string =
+"// (C) Copyright John Maddock 2007.\n"
+"// Use, modification and distribution are subject to the\n"
+"// Boost Software License, Version 1.0. (See accompanying file\n"
+"// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n"
+"//\n"
+"// This file is machine generated, do not edit by hand\n\n";
+
+
+void print_polynomials(int max_order)
+{
+ for(int i = 2; i <= max_order; ++i)
+ {
+ std::stringstream filename;
+ filename << path_prefix << "horner1_" << i << ".hpp";
+ std::ofstream ofs(filename.str().c_str());
+ if(ofs.bad())
+ break;
+ //
+ // Output the boilerplate at the top of the header:
+ //
+ ofs << copyright_string <<
+ "// Polynomial evaluation using Horners rule\n"
+ "#ifndef BOOST_MATH_TOOLS_POLY_EVAL_" << i << "_HPP\n"
+ "#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"
+ "inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)\n"
+ "{\n"
+ " return static_cast<V>(0);\n"
+ "}\n"
+ "\n"
+ "template <class T, class V>\n"
+ "inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)\n"
+ "{\n"
+ " return static_cast<V>(a[0]);\n"
+ "}\n\n";
+
+ for(int order = 2; order <= i; ++order)
+ {
+ ofs <<
+ "template <class T, class V>\n"
+ "inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<" << order << ">*)\n"
+ "{\n"
+ " return static_cast<V>(";
+
+ for(int bracket = 2; bracket < order; ++bracket)
+ ofs << "(";
+ ofs << "a[" << order - 1 << "] * x + a[" << order - 2 << "]" ;
+ for(int item = order - 3; item >= 0; --item)
+ {
+ ofs << ") * x + a[" << item << "]";
+ }
+
+ ofs << ");\n"
+ "}\n\n";
+ }
+ //
+ // And finally the boilerplate at the end of the header:
+ //
+ ofs << "\n}}}} // namespaces\n\n#endif // include guard\n\n";
+
+ filename.str("");
+ filename << path_prefix << "horner2_" << i << ".hpp";
+ ofs.close();
+ ofs.open(filename.str().c_str());
+ if(ofs.bad())
+ break;
+ //
+ // Output the boilerplate at the top of the header:
+ //
+ ofs << copyright_string <<
+ "// Polynomial evaluation using second order Horners rule\n"
+ "#ifndef BOOST_MATH_TOOLS_POLY_EVAL_" << i << "_HPP\n"
+ "#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"
+ "inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)\n"
+ "{\n"
+ " return static_cast<V>(0);\n"
+ "}\n"
+ "\n"
+ "template <class T, class V>\n"
+ "inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)\n"
+ "{\n"
+ " return static_cast<V>(a[0]);\n"
+ "}\n\n"
+ "template <class T, class V>\n"
+ "inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)\n"
+ "{\n"
+ " return static_cast<V>(a[1] * x + a[0]);\n"
+ "}\n\n"
+ "template <class T, class V>\n"
+ "inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::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"
+ "inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)\n"
+ "{\n"
+ " return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);\n"
+ "}\n\n";
+
+ for(int order = 5; order <= i; ++order)
+ {
+ ofs <<
+ "template <class T, class V>\n"
+ "inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<" << order << ">*)\n"
+ "{\n"
+ " V x2 = x * x;\n"
+ " return static_cast<V>(";
+
+ if(order & 1)
+ {
+ for(int bracket = 0; bracket < (order - 1) / 2 - 1; ++bracket)
+ ofs << "(";
+ ofs << "a[" << order - 1 << "] * x2 + a[" << order - 3 << "]" ;
+ for(int item = order - 5; item >= 0; item -= 2)
+ {
+ ofs << ") * x2 + a[" << item << "]";
+ }
+ ofs << " + ";
+ for(int bracket = 0; bracket < (order - 1) / 2 - 1; ++bracket)
+ ofs << "(";
+ ofs << "a[" << order - 2 << "] * x2 + a[" << order - 4 << "]" ;
+ for(int item = order - 6; item >= 0; item -= 2)
+ {
+ ofs << ") * x2 + a[" << item << "]";
+ }
+ ofs << ") * x";
+ }
+ else
+ {
+ for(int bracket = 0; bracket < (order - 1) / 2; ++bracket)
+ ofs << "(";
+ ofs << "a[" << order - 1 << "] * x2 + a[" << order - 3 << "]" ;
+ for(int item = order - 5; item >= 0; item -= 2)
+ {
+ ofs << ") * x2 + a[" << item << "]";
+ }
+ ofs << ") * x + ";
+ for(int bracket = 0; bracket < (order - 1) / 2 - 1; ++bracket)
+ ofs << "(";
+ ofs << "a[" << order - 2 << "] * x2 + a[" << order - 4 << "]" ;
+ for(int item = order - 6; item >= 0; item -= 2)
+ {
+ ofs << ") * x2 + a[" << item << "]";
+ }
+ }
+ ofs << ");\n"
+ "}\n\n";
+ }
+ //
+ // And finally the boilerplate at the end of the header:
+ //
+ ofs << "\n}}}} // namespaces\n\n#endif // include guard\n\n";
+
+
+ filename.str("");
+ filename << path_prefix << "horner3_" << i << ".hpp";
+ ofs.close();
+ ofs.open(filename.str().c_str());
+ if(ofs.bad())
+ break;
+ //
+ // Output the boilerplate at the top of the header:
+ //
+ ofs << copyright_string <<
+ "// Unrolled polynomial evaluation using second order Horners rule\n"
+ "#ifndef BOOST_MATH_TOOLS_POLY_EVAL_" << i << "_HPP\n"
+ "#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"
+ "inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)\n"
+ "{\n"
+ " return static_cast<V>(0);\n"
+ "}\n"
+ "\n"
+ "template <class T, class V>\n"
+ "inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)\n"
+ "{\n"
+ " return static_cast<V>(a[0]);\n"
+ "}\n\n"
+ "template <class T, class V>\n"
+ "inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)\n"
+ "{\n"
+ " return static_cast<V>(a[1] * x + a[0]);\n"
+ "}\n\n"
+ "template <class T, class V>\n"
+ "inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::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"
+ "inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)\n"
+ "{\n"
+ " return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);\n"
+ "}\n\n";
+
+ for(int order = 5; order <= i; ++order)
+ {
+ ofs <<
+ "template <class T, class V>\n"
+ "inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<" << order << ">*)\n"
+ "{\n"
+ " V x2 = x * x;\n"
+ " V t[2];\n";
+
+ if(order & 1)
+ {
+ ofs << " t[0] = static_cast<V>(a[" << order - 1 << "] * x2 + a[" << order - 3 << "]);\n" ;
+ ofs << " t[1] = static_cast<V>(a[" << order - 2 << "] * x2 + a[" << order - 4 << "]);\n" ;
+ for(int item = order - 5; item >= 0; item -= 2)
+ {
+ ofs << " t[0] *= x2;\n";
+ if(item - 1 >= 0)
+ ofs << " t[1] *= x2;\n";
+ ofs << " t[0] += static_cast<V>(a[" << item << "]);\n";
+ if(item - 1 >= 0)
+ ofs << " t[1] += static_cast<V>(a[" << item - 1 << "]);\n";
+ }
+ ofs <<
+ " t[1] *= x;\n"
+ " return t[0] + t[1];\n";
+ }
+ else
+ {
+ ofs << " t[0] = a[" << order - 1 << "] * x2 + a[" << order - 3 << "];\n" ;
+ ofs << " t[1] = a[" << order - 2 << "] * x2 + a[" << order - 4 << "];\n" ;
+ for(int item = order - 5; item >= 0; item -= 2)
+ {
+ ofs << " t[0] *= x2;\n";
+ if(item - 1 >= 0)
+ ofs << " t[1] *= x2;\n";
+ ofs << " t[0] += static_cast<V>(a[" << item << "]);\n";
+ if(item - 1 >= 0)
+ ofs << " t[1] += static_cast<V>(a[" << item - 1 << "]);\n";
+ }
+ ofs << " t[0] *= x;\n";
+ ofs << " return t[0] + t[1];\n";
+ }
+ ofs << "}\n\n";
+ }
+ //
+ // And finally the boilerplate at the end of the header:
+ //
+ ofs << "\n}}}} // namespaces\n\n#endif // include guard\n\n";
+ }
+}
+
+void print_rationals(int max_order)
+{
+ for(int i = 2; i <= max_order; ++i)
+ {
+ std::stringstream filename;
+ filename << path_prefix2 << "horner1_" << i << ".hpp";
+ std::ofstream ofs(filename.str().c_str());
+ if(ofs.bad())
+ break;
+ //
+ // Output the boilerplate at the top of the header:
+ //
+ ofs << copyright_string <<
+ "// Polynomial evaluation using Horners rule\n"
+ "#ifndef BOOST_MATH_TOOLS_POLY_RAT_" << i << "_HPP\n"
+ "#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"
+ "inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*)\n"
+ "{\n"
+ " return static_cast<V>(0);\n"
+ "}\n"
+ "\n"
+ "template <class T, class U, class V>\n"
+ "inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)\n"
+ "{\n"
+ " return static_cast<V>(a[0]) / static_cast<V>(b[0]);\n"
+ "}\n\n";
+
+ for(int order = 2; order <= i; ++order)
+ {
+ ofs <<
+ "template <class T, class U, class V>\n"
+ "inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<" << order << ">*)\n"
+ "{\n"
+ " if(x <= 1)\n"
+ " return static_cast<V>((";
+
+ for(int bracket = 2; bracket < order; ++bracket)
+ ofs << "(";
+ ofs << "a[" << order - 1 << "] * x + a[" << order - 2 << "]" ;
+ for(int item = order - 3; item >= 0; --item)
+ {
+ ofs << ") * x + a[" << item << "]";
+ }
+
+ ofs << ") / (";
+ for(int bracket = 2; bracket < order; ++bracket)
+ ofs << "(";
+ ofs << "b[" << order - 1 << "] * x + b[" << order - 2 << "]" ;
+ for(int item = order - 3; item >= 0; --item)
+ {
+ ofs << ") * x + b[" << item << "]";
+ }
+
+ ofs << "));\n else\n {\n V z = 1 / x;\n return static_cast<V>((";
+
+ for(int bracket = order - 1; bracket > 1; --bracket)
+ ofs << "(";
+ ofs << "a[" << 0 << "] * z + a[" << 1 << "]" ;
+ for(int item = 2; item <= order - 1; ++item)
+ {
+ ofs << ") * z + a[" << item << "]";
+ }
+
+ ofs << ") / (";
+ for(int bracket = 2; bracket < order; ++bracket)
+ ofs << "(";
+ ofs << "b[" << 0 << "] * z + b[" << 1 << "]" ;
+ for(int item = 2; item <= order - 1; ++item)
+ {
+ ofs << ") * z + b[" << item << "]";
+ }
+
+ ofs << "));\n }\n";
+
+ ofs << "}\n\n";
+ }
+ //
+ // And finally the boilerplate at the end of the header:
+ //
+ ofs << "\n}}}} // namespaces\n\n#endif // include guard\n\n";
+
+ filename.str("");
+ filename << path_prefix2 << "horner2_" << i << ".hpp";
+ ofs.close();
+ ofs.open(filename.str().c_str());
+ if(ofs.bad())
+ break;
+ //
+ // Output the boilerplate at the top of the header:
+ //
+ ofs << copyright_string <<
+ "// Polynomial evaluation using second order Horners rule\n"
+ "#ifndef BOOST_MATH_TOOLS_RAT_EVAL_" << i << "_HPP\n"
+ "#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"
+ "inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*)\n"
+ "{\n"
+ " return static_cast<V>(0);\n"
+ "}\n"
+ "\n"
+ "template <class T, class U, class V>\n"
+ "inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::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"
+ "inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::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"
+ "inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::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"
+ "inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::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";
+
+ for(int order = 5; order <= i; ++order)
+ {
+ ofs <<
+ "template <class T, class U, class V>\n"
+ "inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<" << order << ">*)\n"
+ "{\n"
+ " if(x <= 1)\n {\n"
+ " V x2 = x * x;\n"
+ " return static_cast<V>((";
+
+ if(order & 1)
+ {
+ for(int bracket = 0; bracket < (order - 1) / 2 - 1; ++bracket)
+ ofs << "(";
+ ofs << "a[" << order - 1 << "] * x2 + a[" << order - 3 << "]" ;
+ for(int item = order - 5; item >= 0; item -= 2)
+ {
+ ofs << ") * x2 + a[" << item << "]";
+ }
+ ofs << " + ";
+ for(int bracket = 0; bracket < (order - 1) / 2 - 1; ++bracket)
+ ofs << "(";
+ ofs << "a[" << order - 2 << "] * x2 + a[" << order - 4 << "]" ;
+ for(int item = order - 6; item >= 0; item -= 2)
+ {
+ ofs << ") * x2 + a[" << item << "]";
+ }
+ ofs << ") * x";
+ }
+ else
+ {
+ for(int bracket = 0; bracket < (order - 1) / 2; ++bracket)
+ ofs << "(";
+ ofs << "a[" << order - 1 << "] * x2 + a[" << order - 3 << "]" ;
+ for(int item = order - 5; item >= 0; item -= 2)
+ {
+ ofs << ") * x2 + a[" << item << "]";
+ }
+ ofs << ") * x + ";
+ for(int bracket = 0; bracket < (order - 1) / 2 - 1; ++bracket)
+ ofs << "(";
+ ofs << "a[" << order - 2 << "] * x2 + a[" << order - 4 << "]" ;
+ for(int item = order - 6; item >= 0; item -= 2)
+ {
+ ofs << ") * x2 + a[" << item << "]";
+ }
+ }
+ ofs << ") / (";
+ if(order & 1)
+ {
+ for(int bracket = 0; bracket < (order - 1) / 2 - 1; ++bracket)
+ ofs << "(";
+ ofs << "b[" << order - 1 << "] * x2 + b[" << order - 3 << "]" ;
+ for(int item = order - 5; item >= 0; item -= 2)
+ {
+ ofs << ") * x2 + b[" << item << "]";
+ }
+ ofs << " + ";
+ for(int bracket = 0; bracket < (order - 1) / 2 - 1; ++bracket)
+ ofs << "(";
+ ofs << "b[" << order - 2 << "] * x2 + b[" << order - 4 << "]" ;
+ for(int item = order - 6; item >= 0; item -= 2)
+ {
+ ofs << ") * x2 + b[" << item << "]";
+ }
+ ofs << ") * x";
+ }
+ else
+ {
+ for(int bracket = 0; bracket < (order - 1) / 2; ++bracket)
+ ofs << "(";
+ ofs << "b[" << order - 1 << "] * x2 + b[" << order - 3 << "]" ;
+ for(int item = order - 5; item >= 0; item -= 2)
+ {
+ ofs << ") * x2 + b[" << item << "]";
+ }
+ ofs << ") * x + ";
+ for(int bracket = 0; bracket < (order - 1) / 2 - 1; ++bracket)
+ ofs << "(";
+ ofs << "b[" << order - 2 << "] * x2 + b[" << order - 4 << "]" ;
+ for(int item = order - 6; item >= 0; item -= 2)
+ {
+ ofs << ") * x2 + b[" << item << "]";
+ }
+ }
+
+ ofs << "));\n }\n else\n {\n V z = 1 / x;\n V z2 = 1 / (x * x);\n return static_cast<V>((";
+
+ if(order & 1)
+ {
+ for(int bracket = 0; bracket < (order - 1) / 2 - 1; ++bracket)
+ ofs << "(";
+ ofs << "a[" << 0 << "] * z2 + a[" << 2 << "]" ;
+ for(int item = 4; item < order; item += 2)
+ {
+ ofs << ") * z2 + a[" << item << "]";
+ }
+ ofs << " + ";
+ for(int bracket = 0; bracket < (order - 1) / 2 - 1; ++bracket)
+ ofs << "(";
+ ofs << "a[" << 1 << "] * z2 + a[" << 3 << "]" ;
+ for(int item = 5; item < order; item += 2)
+ {
+ ofs << ") * z2 + a[" << item << "]";
+ }
+ ofs << ") * z";
+ }
+ else
+ {
+ for(int bracket = 0; bracket < (order - 1) / 2; ++bracket)
+ ofs << "(";
+ ofs << "a[" << 0 << "] * z2 + a[" << 2 << "]" ;
+ for(int item = 4; item < order; item += 2)
+ {
+ ofs << ") * z2 + a[" << item << "]";
+ }
+ ofs << ") * z + ";
+ for(int bracket = 0; bracket < (order - 1) / 2 - 1; ++bracket)
+ ofs << "(";
+ ofs << "a[" << 1 << "] * z2 + a[" << 3 << "]" ;
+ for(int item = 5; item < order; item += 2)
+ {
+ ofs << ") * z2 + a[" << item << "]";
+ }
+ }
+
+ ofs << ") / (";
+
+ if(order & 1)
+ {
+ for(int bracket = 0; bracket < (order - 1) / 2 - 1; ++bracket)
+ ofs << "(";
+ ofs << "b[" << 0 << "] * z2 + b[" << 2 << "]" ;
+ for(int item = 4; item < order; item += 2)
+ {
+ ofs << ") * z2 + b[" << item << "]";
+ }
+ ofs << " + ";
+ for(int bracket = 0; bracket < (order - 1) / 2 - 1; ++bracket)
+ ofs << "(";
+ ofs << "b[" << 1 << "] * z2 + b[" << 3 << "]" ;
+ for(int item = 5; item < order; item += 2)
+ {
+ ofs << ") * z2 + b[" << item << "]";
+ }
+ ofs << ") * z";
+ }
+ else
+ {
+ for(int bracket = 0; bracket < (order - 1) / 2; ++bracket)
+ ofs << "(";
+ ofs << "b[" << 0 << "] * z2 + b[" << 2 << "]" ;
+ for(int item = 4; item < order; item += 2)
+ {
+ ofs << ") * z2 + b[" << item << "]";
+ }
+ ofs << ") * z + ";
+ for(int bracket = 0; bracket < (order - 1) / 2 - 1; ++bracket)
+ ofs << "(";
+ ofs << "b[" << 1 << "] * z2 + b[" << 3 << "]" ;
+ for(int item = 5; item < order; item += 2)
+ {
+ ofs << ") * z2 + b[" << item << "]";
+ }
+ }
+ ofs << "));\n }\n";
+
+ ofs << "}\n\n";
+ }
+ //
+ // And finally the boilerplate at the end of the header:
+ //
+ ofs << "\n}}}} // namespaces\n\n#endif // include guard\n\n";
+
+
+ filename.str("");
+ filename << path_prefix2 << "horner3_" << i << ".hpp";
+ ofs.close();
+ ofs.open(filename.str().c_str());
+ if(ofs.bad())
+ break;
+ //
+ // Output the boilerplate at the top of the header:
+ //
+ ofs << copyright_string <<
+ "// Polynomial evaluation using second order Horners rule\n"
+ "#ifndef BOOST_MATH_TOOLS_RAT_EVAL_" << i << "_HPP\n"
+ "#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"
+ "inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*)\n"
+ "{\n"
+ " return static_cast<V>(0);\n"
+ "}\n"
+ "\n"
+ "template <class T, class U, class V>\n"
+ "inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::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"
+ "inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::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"
+ "inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::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"
+ "inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::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";
+
+ for(int order = 5; order <= i; ++order)
+ {
+ ofs <<
+ "template <class T, class U, class V>\n"
+ "inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<" << order << ">*)\n"
+ "{\n"
+ " if(x <= 1)\n {\n"
+ " V x2 = x * x;\n"
+ " V t[4];\n";
+
+ if(order & 1)
+ {
+ ofs << " t[0] = a[" << order - 1 << "] * x2 + a[" << order - 3 << "];\n" ;
+ ofs << " t[1] = a[" << order - 2 << "] * x2 + a[" << order - 4 << "];\n" ;
+ ofs << " t[2] = b[" << order - 1 << "] * x2 + b[" << order - 3 << "];\n" ;
+ ofs << " t[3] = b[" << order - 2 << "] * x2 + b[" << order - 4 << "];\n" ;
+ for(int item = order - 5; item >= 0; item -= 2)
+ {
+ ofs << " t[0] *= x2;\n";
+ if(item - 1 >= 0)
+ ofs << " t[1] *= x2;\n";
+ ofs << " t[2] *= x2;\n";
+ if(item - 1 >= 0)
+ ofs << " t[3] *= x2;\n";
+ ofs << " t[0] += static_cast<V>(a[" << item << "]);\n";
+ if(item - 1 >= 0)
+ ofs << " t[1] += static_cast<V>(a[" << item - 1 << "]);\n";
+ ofs << " t[2] += static_cast<V>(b[" << item << "]);\n";
+ if(item - 1 >= 0)
+ ofs << " t[3] += static_cast<V>(b[" << item - 1 << "]);\n";
+ }
+ ofs << " t[1] *= x;\n";
+ ofs << " t[3] *= x;\n";
+ }
+ else
+ {
+ ofs << " t[0] = a[" << order - 1 << "] * x2 + a[" << order - 3 << "];\n" ;
+ ofs << " t[1] = a[" << order - 2 << "] * x2 + a[" << order - 4 << "];\n" ;
+ ofs << " t[2] = b[" << order - 1 << "] * x2 + b[" << order - 3 << "];\n" ;
+ ofs << " t[3] = b[" << order - 2 << "] * x2 + b[" << order - 4 << "];\n" ;
+ for(int item = order - 5; item >= 0; item -= 2)
+ {
+ ofs << " t[0] *= x2;\n";
+ if(item - 1 >= 0)
+ ofs << " t[1] *= x2;\n";
+ ofs << " t[2] *= x2;\n";
+ if(item - 1 >= 0)
+ ofs << " t[3] *= x2;\n";
+ ofs << " t[0] += static_cast<V>(a[" << item << "]);\n";
+ if(item - 1 >= 0)
+ ofs << " t[1] += static_cast<V>(a[" << item - 1 << "]);\n";
+ ofs << " t[2] += static_cast<V>(b[" << item << "]);\n";
+ if(item - 1 >= 0)
+ ofs << " t[3] += static_cast<V>(b[" << item - 1 << "]);\n";
+ }
+ ofs << " t[0] *= x;\n";
+ ofs << " t[2] *= x;\n";
+ }
+ ofs << " return (t[0] + t[1]) / (t[2] + t[3]);\n";
+
+ ofs << " }\n else\n {\n V z = 1 / x;\n V z2 = 1 / (x * x);\n V t[4];\n";
+
+ if(order & 1)
+ {
+ ofs << " t[0] = a[" << 0 << "] * z2 + a[" << 2 << "];\n" ;
+ ofs << " t[1] = a[" << 1 << "] * z2 + a[" << 3 << "];\n" ;
+ ofs << " t[2] = b[" << 0 << "] * z2 + b[" << 2 << "];\n" ;
+ ofs << " t[3] = b[" << 1 << "] * z2 + b[" << 3 << "];\n" ;
+ for(int item = 4; item < order; item += 2)
+ {
+ ofs << " t[0] *= z2;\n";
+ if(item + 1 < order)
+ ofs << " t[1] *= z2;\n";
+ ofs << " t[2] *= z2;\n";
+ if(item + 1 < order)
+ ofs << " t[3] *= z2;\n";
+ ofs << " t[0] += static_cast<V>(a[" << item << "]);\n";
+ if(item + 1 < order)
+ ofs << " t[1] += static_cast<V>(a[" << item + 1 << "]);\n";
+ ofs << " t[2] += static_cast<V>(b[" << item << "]);\n";
+ if(item + 1 < order)
+ ofs << " t[3] += static_cast<V>(b[" << item + 1 << "]);\n";
+ }
+ ofs << " t[1] *= z;\n";
+ ofs << " t[3] *= z;\n";
+ }
+ else
+ {
+ ofs << " t[0] = a[" << 0 << "] * z2 + a[" << 2 << "];\n" ;
+ ofs << " t[1] = a[" << 1 << "] * z2 + a[" << 3 << "];\n" ;
+ ofs << " t[2] = b[" << 0 << "] * z2 + b[" << 2 << "];\n" ;
+ ofs << " t[3] = b[" << 1 << "] * z2 + b[" << 3 << "];\n" ;
+ for(int item = 4; item < order; item += 2)
+ {
+ ofs << " t[0] *= z2;\n";
+ if(item + 1 < order)
+ ofs << " t[1] *= z2;\n";
+ ofs << " t[2] *= z2;\n";
+ if(item + 1 < order)
+ ofs << " t[3] *= z2;\n";
+ ofs << " t[0] += static_cast<V>(a[" << item << "]);\n";
+ if(item + 1 < order)
+ ofs << " t[1] += static_cast<V>(a[" << item + 1 << "]);\n";
+ ofs << " t[2] += static_cast<V>(b[" << item << "]);\n";
+ if(item + 1 < order)
+ ofs << " t[3] += static_cast<V>(b[" << item + 1 << "]);\n";
+ }
+ ofs << " t[0] *= z;\n";
+ ofs << " t[2] *= z;\n";
+ }
+ ofs << " return (t[0] + t[1]) / (t[2] + t[3]);\n }\n";
+
+ ofs << "}\n\n";
+ }
+ //
+ // And finally the boilerplate at the end of the header:
+ //
+ ofs << "\n}}}} // namespaces\n\n#endif // include guard\n\n";
+ }
+}
+
+int main()
+{
+ for(int i = 2; i <= max_order; ++i)
+ {
+ print_polynomials(i);
+ print_rationals(i);
+ }
+ return 0;
+}
+
+
+
Modified: sandbox/math_toolkit/libs/math/tools/generate_rational_test.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/tools/generate_rational_test.cpp (original)
+++ sandbox/math_toolkit/libs/math/tools/generate_rational_test.cpp 2007-05-22 04:52:48 EDT (Tue, 22 May 2007)
@@ -1,4 +1,7 @@
+#define BOOST_MATH_POLY_METHOD 0
+#define BOOST_MATH_RATIONAL_METHOD 0
+
#include <boost/math/tools/ntl.hpp>
#include <boost/tr1/random.hpp>
#include <boost/math/tools/rational.hpp>
@@ -10,6 +13,8 @@
using namespace boost::math;
using namespace boost::math::tools;
+ static const unsigned max_order = 20;
+
NTL::RR::SetPrecision(500);
NTL::RR::SetOutputPrecision(40);
@@ -18,13 +23,14 @@
std::tr1::mt19937,
std::tr1::uniform_int<> > gen(rnd, std::tr1::uniform_int<>(1, 12));
- for(unsigned i = 1; i < 12; ++i)
+ for(unsigned i = 1; i < max_order; ++i)
{
std::vector<int> coef;
for(unsigned j = 0; j < i; ++j)
{
coef.push_back(gen());
}
+ std::cout << std::scientific;
std::cout <<
" //\n"
" // Polynomials of order " << i-1 << "\n"
@@ -51,6 +57,8 @@
NTL::RR r2 = boost::math::tools::evaluate_polynomial(&coef[0], NTL::RR(0.25), i);
NTL::RR r3 = boost::math::tools::evaluate_polynomial(&coef[0], NTL::RR(0.75), i);
NTL::RR r4 = boost::math::tools::evaluate_polynomial(&coef[0], NTL::RR(1) - NTL::RR(1) / 64, i);
+ NTL::RR r5 = boost::math::tools::evaluate_polynomial(&coef[0], NTL::RR(6.5), i);
+ NTL::RR r6 = boost::math::tools::evaluate_polynomial(&coef[0], NTL::RR(10247.25), i);
std::cout <<
" BOOST_CHECK_CLOSE(\n"
@@ -71,7 +79,19 @@
" BOOST_CHECK_CLOSE(\n"
" boost::math::tools::evaluate_polynomial(n" << i << "c, static_cast<T>(1.0f - 1.0f/64.0f), " << i << "),\n"
" static_cast<T>(" << r4 << "L),\n"
- " tolerance);\n\n";
+ " tolerance);\n";
+ if(fabs(r5) < tools::max_value<float>())
+ std::cout <<
+ " BOOST_CHECK_CLOSE(\n"
+ " boost::math::tools::evaluate_polynomial(n" << i << "c, static_cast<T>(6.5), " << i << "),\n"
+ " static_cast<T>(" << r5 << "L),\n"
+ " tolerance);\n";
+ if(fabs(r6) < tools::max_value<float>())
+ std::cout <<
+ " BOOST_CHECK_CLOSE(\n"
+ " boost::math::tools::evaluate_polynomial(n" << i << "c, static_cast<T>(10247.25), " << i << "),\n"
+ " static_cast<T>(" << r6 << "L),\n"
+ " tolerance);\n\n";
std::cout <<
" BOOST_CHECK_CLOSE(\n"
@@ -92,7 +112,19 @@
" BOOST_CHECK_CLOSE(\n"
" boost::math::tools::evaluate_polynomial(n" << i << "c, static_cast<T>(1.0f - 1.0f/64.0f)),\n"
" static_cast<T>(" << r4 << "L),\n"
- " tolerance);\n\n";
+ " tolerance);\n";
+ if(fabs(r5) < tools::max_value<float>())
+ std::cout <<
+ " BOOST_CHECK_CLOSE(\n"
+ " boost::math::tools::evaluate_polynomial(n" << i << "c, static_cast<T>(6.5)),\n"
+ " static_cast<T>(" << r5 << "L),\n"
+ " tolerance);\n";
+ if(fabs(r6) < tools::max_value<float>())
+ std::cout <<
+ " BOOST_CHECK_CLOSE(\n"
+ " boost::math::tools::evaluate_polynomial(n" << i << "c, static_cast<T>(10247.25)),\n"
+ " static_cast<T>(" << r6 << "L),\n"
+ " tolerance);\n\n";
std::cout <<
" BOOST_CHECK_CLOSE(\n"
@@ -113,12 +145,26 @@
" BOOST_CHECK_CLOSE(\n"
" boost::math::tools::evaluate_polynomial(n" << i << "a, static_cast<T>(1.0f - 1.0f/64.0f)),\n"
" static_cast<T>(" << r4 << "L),\n"
- " tolerance);\n\n";
+ " tolerance);\n";
+ if(fabs(r5) < tools::max_value<float>())
+ std::cout <<
+ " BOOST_CHECK_CLOSE(\n"
+ " boost::math::tools::evaluate_polynomial(n" << i << "a, static_cast<T>(6.5)),\n"
+ " static_cast<T>(" << r5 << "L),\n"
+ " tolerance);\n";
+ if(fabs(r6) < tools::max_value<float>())
+ std::cout <<
+ " BOOST_CHECK_CLOSE(\n"
+ " boost::math::tools::evaluate_polynomial(n" << i << "a, static_cast<T>(10247.25)),\n"
+ " static_cast<T>(" << r6 << "L),\n"
+ " tolerance);\n\n";
r1 = boost::math::tools::evaluate_even_polynomial(&coef[0], NTL::RR(0.125), i);
r2 = boost::math::tools::evaluate_even_polynomial(&coef[0], NTL::RR(0.25), i);
r3 = boost::math::tools::evaluate_even_polynomial(&coef[0], NTL::RR(0.75), i);
r4 = boost::math::tools::evaluate_even_polynomial(&coef[0], NTL::RR(1) - NTL::RR(1) / 64, i);
+ r5 = boost::math::tools::evaluate_even_polynomial(&coef[0], NTL::RR(6.5), i);
+ r6 = boost::math::tools::evaluate_even_polynomial(&coef[0], NTL::RR(10247.25), i);
std::cout <<
" BOOST_CHECK_CLOSE(\n"
@@ -139,7 +185,19 @@
" BOOST_CHECK_CLOSE(\n"
" boost::math::tools::evaluate_even_polynomial(n" << i << "c, static_cast<T>(1.0f - 1.0f/64.0f), " << i << "),\n"
" static_cast<T>(" << r4 << "L),\n"
- " tolerance);\n\n";
+ " tolerance);\n";
+ if(fabs(r5) < tools::max_value<float>())
+ std::cout <<
+ " BOOST_CHECK_CLOSE(\n"
+ " boost::math::tools::evaluate_even_polynomial(n" << i << "c, static_cast<T>(6.5f), " << i << "),\n"
+ " static_cast<T>(" << r5 << "L),\n"
+ " tolerance);\n";
+ if(fabs(r6) < tools::max_value<float>())
+ std::cout <<
+ " BOOST_CHECK_CLOSE(\n"
+ " boost::math::tools::evaluate_even_polynomial(n" << i << "c, static_cast<T>(10247.25f), " << i << "),\n"
+ " static_cast<T>(" << r6 << "L),\n"
+ " tolerance);\n\n";
std::cout <<
" BOOST_CHECK_CLOSE(\n"
@@ -160,7 +218,19 @@
" BOOST_CHECK_CLOSE(\n"
" boost::math::tools::evaluate_even_polynomial(n" << i << "c, static_cast<T>(1.0f - 1.0f/64.0f)),\n"
" static_cast<T>(" << r4 << "L),\n"
- " tolerance);\n\n";
+ " tolerance);\n";
+ if(fabs(r5) < tools::max_value<float>())
+ std::cout <<
+ " BOOST_CHECK_CLOSE(\n"
+ " boost::math::tools::evaluate_even_polynomial(n" << i << "c, static_cast<T>(6.5f)),\n"
+ " static_cast<T>(" << r5 << "L),\n"
+ " tolerance);\n";
+ if(fabs(r6) < tools::max_value<float>())
+ std::cout <<
+ " BOOST_CHECK_CLOSE(\n"
+ " boost::math::tools::evaluate_even_polynomial(n" << i << "c, static_cast<T>(10247.25f)),\n"
+ " static_cast<T>(" << r6 << "L),\n"
+ " tolerance);\n\n";
std::cout <<
" BOOST_CHECK_CLOSE(\n"
@@ -181,7 +251,19 @@
" BOOST_CHECK_CLOSE(\n"
" boost::math::tools::evaluate_even_polynomial(n" << i << "a, static_cast<T>(1.0f - 1.0f/64.0f)),\n"
" static_cast<T>(" << r4 << "L),\n"
- " tolerance);\n\n";
+ " tolerance);\n";
+ if(fabs(r5) < tools::max_value<float>())
+ std::cout <<
+ " BOOST_CHECK_CLOSE(\n"
+ " boost::math::tools::evaluate_even_polynomial(n" << i << "a, static_cast<T>(6.5f)),\n"
+ " static_cast<T>(" << r5 << "L),\n"
+ " tolerance);\n";
+ if(fabs(r6) < tools::max_value<float>())
+ std::cout <<
+ " BOOST_CHECK_CLOSE(\n"
+ " boost::math::tools::evaluate_even_polynomial(n" << i << "a, static_cast<T>(10247.25f)),\n"
+ " static_cast<T>(" << r6 << "L),\n"
+ " tolerance);\n\n";
if(i > 1)
{
@@ -189,6 +271,8 @@
r2 = boost::math::tools::evaluate_odd_polynomial(&coef[0], NTL::RR(0.25), i);
r3 = boost::math::tools::evaluate_odd_polynomial(&coef[0], NTL::RR(0.75), i);
r4 = boost::math::tools::evaluate_odd_polynomial(&coef[0], NTL::RR(1) - NTL::RR(1) / 64, i);
+ r5 = boost::math::tools::evaluate_odd_polynomial(&coef[0], NTL::RR(6.5), i);
+ r6 = boost::math::tools::evaluate_odd_polynomial(&coef[0], NTL::RR(10247.25), i);
std::cout <<
" BOOST_CHECK_CLOSE(\n"
@@ -209,7 +293,19 @@
" BOOST_CHECK_CLOSE(\n"
" boost::math::tools::evaluate_odd_polynomial(n" << i << "c, static_cast<T>(1.0f - 1.0f/64.0f), " << i << "),\n"
" static_cast<T>(" << r4 << "L),\n"
- " tolerance);\n\n";
+ " tolerance);\n";
+ if(fabs(r5) < tools::max_value<float>())
+ std::cout <<
+ " BOOST_CHECK_CLOSE(\n"
+ " boost::math::tools::evaluate_odd_polynomial(n" << i << "c, static_cast<T>(6.5f), " << i << "),\n"
+ " static_cast<T>(" << r5 << "L),\n"
+ " tolerance);\n";
+ if(fabs(r6) < tools::max_value<float>())
+ std::cout <<
+ " BOOST_CHECK_CLOSE(\n"
+ " boost::math::tools::evaluate_odd_polynomial(n" << i << "c, static_cast<T>(10247.25f), " << i << "),\n"
+ " static_cast<T>(" << r6 << "L),\n"
+ " tolerance);\n\n";
std::cout <<
" BOOST_CHECK_CLOSE(\n"
@@ -230,7 +326,19 @@
" BOOST_CHECK_CLOSE(\n"
" boost::math::tools::evaluate_odd_polynomial(n" << i << "c, static_cast<T>(1.0f - 1.0f/64.0f)),\n"
" static_cast<T>(" << r4 << "L),\n"
- " tolerance);\n\n";
+ " tolerance);\n";
+ if(fabs(r5) < tools::max_value<float>())
+ std::cout <<
+ " BOOST_CHECK_CLOSE(\n"
+ " boost::math::tools::evaluate_odd_polynomial(n" << i << "c, static_cast<T>(6.5f)),\n"
+ " static_cast<T>(" << r5 << "L),\n"
+ " tolerance);\n";
+ if(fabs(r6) < tools::max_value<float>())
+ std::cout <<
+ " BOOST_CHECK_CLOSE(\n"
+ " boost::math::tools::evaluate_odd_polynomial(n" << i << "c, static_cast<T>(10247.25f)),\n"
+ " static_cast<T>(" << r6 << "L),\n"
+ " tolerance);\n\n";
std::cout <<
" BOOST_CHECK_CLOSE(\n"
@@ -251,13 +359,27 @@
" BOOST_CHECK_CLOSE(\n"
" boost::math::tools::evaluate_odd_polynomial(n" << i << "a, static_cast<T>(1.0f - 1.0f/64.0f)),\n"
" static_cast<T>(" << r4 << "L),\n"
- " tolerance);\n\n";
+ " tolerance);\n";
+ if(fabs(r5) < tools::max_value<float>())
+ std::cout <<
+ " BOOST_CHECK_CLOSE(\n"
+ " boost::math::tools::evaluate_odd_polynomial(n" << i << "a, static_cast<T>(6.5f)),\n"
+ " static_cast<T>(" << r5 << "L),\n"
+ " tolerance);\n";
+ if(fabs(r6) < tools::max_value<float>())
+ std::cout <<
+ " BOOST_CHECK_CLOSE(\n"
+ " boost::math::tools::evaluate_odd_polynomial(n" << i << "a, static_cast<T>(10247.25f)),\n"
+ " static_cast<T>(" << r6 << "L),\n"
+ " tolerance);\n\n";
}
r1 = boost::math::tools::evaluate_polynomial(&coef[0], NTL::RR(0.125), i);
r2 = boost::math::tools::evaluate_polynomial(&coef[0], NTL::RR(0.25), i);
r3 = boost::math::tools::evaluate_polynomial(&coef[0], NTL::RR(0.75), i);
r4 = boost::math::tools::evaluate_polynomial(&coef[0], NTL::RR(1) - NTL::RR(1) / 64, i);
+ r5 = boost::math::tools::evaluate_polynomial(&coef[0], NTL::RR(6.5), i);
+ r6 = boost::math::tools::evaluate_polynomial(&coef[0], NTL::RR(10247.25), i);
coef.clear();
for(unsigned j = 0; j < i; ++j)
@@ -290,6 +412,8 @@
NTL::RR r2d = boost::math::tools::evaluate_polynomial(&coef[0], NTL::RR(0.25), i);
NTL::RR r3d = boost::math::tools::evaluate_polynomial(&coef[0], NTL::RR(0.75), i);
NTL::RR r4d = boost::math::tools::evaluate_polynomial(&coef[0], NTL::RR(1) - NTL::RR(1) / 64, i);
+ NTL::RR r5d = boost::math::tools::evaluate_polynomial(&coef[0], NTL::RR(6.5), i);
+ NTL::RR r6d = boost::math::tools::evaluate_polynomial(&coef[0], NTL::RR(10247.25), i);
std::cout <<
" BOOST_CHECK_CLOSE(\n"
@@ -310,7 +434,19 @@
" BOOST_CHECK_CLOSE(\n"
" boost::math::tools::evaluate_rational(n" << i << "c, d" << i << "c, static_cast<T>(1.0f - 1.0f/64.0f), " << i << "),\n"
" static_cast<T>(" << r4/r4d << "L),\n"
- " tolerance);\n\n";
+ " tolerance);\n";
+ if(fabs(r5/r5d) < tools::max_value<float>())
+ std::cout <<
+ " BOOST_CHECK_CLOSE(\n"
+ " boost::math::tools::evaluate_rational(n" << i << "c, d" << i << "c, static_cast<T>(6.5f), " << i << "),\n"
+ " static_cast<T>(" << r5/r5d << "L),\n"
+ " tolerance);\n";
+ if(fabs(r6/r6d) < tools::max_value<float>())
+ std::cout <<
+ " BOOST_CHECK_CLOSE(\n"
+ " boost::math::tools::evaluate_rational(n" << i << "c, d" << i << "c, static_cast<T>(10247.25f), " << i << "),\n"
+ " static_cast<T>(" << r6/r6d << "L),\n"
+ " tolerance);\n\n";
std::cout <<
" BOOST_CHECK_CLOSE(\n"
@@ -331,7 +467,19 @@
" BOOST_CHECK_CLOSE(\n"
" boost::math::tools::evaluate_rational(n" << i << "c, d" << i << "c, static_cast<T>(1.0f - 1.0f/64.0f)),\n"
" static_cast<T>(" << r4/r4d << "L),\n"
- " tolerance);\n\n";
+ " tolerance);\n";
+ if(fabs(r5/r5d) < tools::max_value<float>())
+ std::cout <<
+ " BOOST_CHECK_CLOSE(\n"
+ " boost::math::tools::evaluate_rational(n" << i << "c, d" << i << "c, static_cast<T>(6.5f)),\n"
+ " static_cast<T>(" << r5/r5d << "L),\n"
+ " tolerance);\n";
+ if(fabs(r6/r6d) < tools::max_value<float>())
+ std::cout <<
+ " BOOST_CHECK_CLOSE(\n"
+ " boost::math::tools::evaluate_rational(n" << i << "c, d" << i << "c, static_cast<T>(10247.25f)),\n"
+ " static_cast<T>(" << r6/r6d << "L),\n"
+ " tolerance);\n\n";
std::cout <<
" BOOST_CHECK_CLOSE(\n"
@@ -352,7 +500,19 @@
" BOOST_CHECK_CLOSE(\n"
" boost::math::tools::evaluate_rational(n" << i << "a, d" << i << "a, static_cast<T>(1.0f - 1.0f/64.0f)),\n"
" static_cast<T>(" << r4/r4d << "L),\n"
- " tolerance);\n\n";
+ " tolerance);\n";
+ if(fabs(r5/r5d) < tools::max_value<float>())
+ std::cout <<
+ " BOOST_CHECK_CLOSE(\n"
+ " boost::math::tools::evaluate_rational(n" << i << "a, d" << i << "a, static_cast<T>(6.5f)),\n"
+ " static_cast<T>(" << r5/r5d << "L),\n"
+ " tolerance);\n";
+ if(fabs(r6/r6d) < tools::max_value<float>())
+ std::cout <<
+ " BOOST_CHECK_CLOSE(\n"
+ " boost::math::tools::evaluate_rational(n" << i << "a, d" << i << "a, static_cast<T>(10247.25f)),\n"
+ " static_cast<T>(" << r6/r6d << "L),\n"
+ " tolerance);\n\n";
}
return 0;
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk