Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:40:29

0001 //  (C) Copyright John Maddock 2007.
0002 //  Use, modification and distribution are subject to the
0003 //  Boost Software License, Version 1.0. (See accompanying file
0004 //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0005 //
0006 //  This file is machine generated, do not edit by hand
0007 
0008 // Unrolled polynomial evaluation using second order Horners rule
0009 #ifndef BOOST_MATH_TOOLS_POLY_EVAL_9_HPP
0010 #define BOOST_MATH_TOOLS_POLY_EVAL_9_HPP
0011 
0012 namespace boost{ namespace math{ namespace tools{ namespace detail{
0013 
0014 template <class T, class V>
0015 inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant<int, 0>*) BOOST_MATH_NOEXCEPT(V)
0016 {
0017    return static_cast<V>(0);
0018 }
0019 
0020 template <class T, class V>
0021 inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant<int, 1>*) BOOST_MATH_NOEXCEPT(V)
0022 {
0023    return static_cast<V>(a[0]);
0024 }
0025 
0026 template <class T, class V>
0027 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant<int, 2>*) BOOST_MATH_NOEXCEPT(V)
0028 {
0029    return static_cast<V>(a[1] * x + a[0]);
0030 }
0031 
0032 template <class T, class V>
0033 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant<int, 3>*) BOOST_MATH_NOEXCEPT(V)
0034 {
0035    return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
0036 }
0037 
0038 template <class T, class V>
0039 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant<int, 4>*) BOOST_MATH_NOEXCEPT(V)
0040 {
0041    return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
0042 }
0043 
0044 template <class T, class V>
0045 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant<int, 5>*) BOOST_MATH_NOEXCEPT(V)
0046 {
0047    V x2 = x * x;
0048    V t[2];
0049    t[0] = static_cast<V>(a[4] * x2 + a[2]);
0050    t[1] = static_cast<V>(a[3] * x2 + a[1]);
0051    t[0] *= x2;
0052    t[0] += static_cast<V>(a[0]);
0053    t[1] *= x;
0054    return t[0] + t[1];
0055 }
0056 
0057 template <class T, class V>
0058 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant<int, 6>*) BOOST_MATH_NOEXCEPT(V)
0059 {
0060    V x2 = x * x;
0061    V t[2];
0062    t[0] = a[5] * x2 + a[3];
0063    t[1] = a[4] * x2 + a[2];
0064    t[0] *= x2;
0065    t[1] *= x2;
0066    t[0] += static_cast<V>(a[1]);
0067    t[1] += static_cast<V>(a[0]);
0068    t[0] *= x;
0069    return t[0] + t[1];
0070 }
0071 
0072 template <class T, class V>
0073 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant<int, 7>*) BOOST_MATH_NOEXCEPT(V)
0074 {
0075    V x2 = x * x;
0076    V t[2];
0077    t[0] = static_cast<V>(a[6] * x2 + a[4]);
0078    t[1] = static_cast<V>(a[5] * x2 + a[3]);
0079    t[0] *= x2;
0080    t[1] *= x2;
0081    t[0] += static_cast<V>(a[2]);
0082    t[1] += static_cast<V>(a[1]);
0083    t[0] *= x2;
0084    t[0] += static_cast<V>(a[0]);
0085    t[1] *= x;
0086    return t[0] + t[1];
0087 }
0088 
0089 template <class T, class V>
0090 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant<int, 8>*) BOOST_MATH_NOEXCEPT(V)
0091 {
0092    V x2 = x * x;
0093    V t[2];
0094    t[0] = a[7] * x2 + a[5];
0095    t[1] = a[6] * x2 + a[4];
0096    t[0] *= x2;
0097    t[1] *= x2;
0098    t[0] += static_cast<V>(a[3]);
0099    t[1] += static_cast<V>(a[2]);
0100    t[0] *= x2;
0101    t[1] *= x2;
0102    t[0] += static_cast<V>(a[1]);
0103    t[1] += static_cast<V>(a[0]);
0104    t[0] *= x;
0105    return t[0] + t[1];
0106 }
0107 
0108 template <class T, class V>
0109 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant<int, 9>*) BOOST_MATH_NOEXCEPT(V)
0110 {
0111    V x2 = x * x;
0112    V t[2];
0113    t[0] = static_cast<V>(a[8] * x2 + a[6]);
0114    t[1] = static_cast<V>(a[7] * x2 + a[5]);
0115    t[0] *= x2;
0116    t[1] *= x2;
0117    t[0] += static_cast<V>(a[4]);
0118    t[1] += static_cast<V>(a[3]);
0119    t[0] *= x2;
0120    t[1] *= x2;
0121    t[0] += static_cast<V>(a[2]);
0122    t[1] += static_cast<V>(a[1]);
0123    t[0] *= x2;
0124    t[0] += static_cast<V>(a[0]);
0125    t[1] *= x;
0126    return t[0] + t[1];
0127 }
0128 
0129 
0130 }}}} // namespaces
0131 
0132 #endif // include guard
0133