File indexing completed on 2025-01-18 09:40:27
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef BOOST_MATH_TOOLS_POLY_EVAL_13_HPP
0010 #define BOOST_MATH_TOOLS_POLY_EVAL_13_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 return static_cast<V>((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x);
0049 }
0050
0051 template <class T, class V>
0052 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant<int, 6>*) BOOST_MATH_NOEXCEPT(V)
0053 {
0054 V x2 = x * x;
0055 return static_cast<V>(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]);
0056 }
0057
0058 template <class T, class V>
0059 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant<int, 7>*) BOOST_MATH_NOEXCEPT(V)
0060 {
0061 V x2 = x * x;
0062 return static_cast<V>(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x);
0063 }
0064
0065 template <class T, class V>
0066 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant<int, 8>*) BOOST_MATH_NOEXCEPT(V)
0067 {
0068 V x2 = x * x;
0069 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]);
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, 9>*) BOOST_MATH_NOEXCEPT(V)
0074 {
0075 V x2 = x * x;
0076 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);
0077 }
0078
0079 template <class T, class V>
0080 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant<int, 10>*) BOOST_MATH_NOEXCEPT(V)
0081 {
0082 V x2 = x * x;
0083 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]);
0084 }
0085
0086 template <class T, class V>
0087 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant<int, 11>*) BOOST_MATH_NOEXCEPT(V)
0088 {
0089 V x2 = x * x;
0090 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);
0091 }
0092
0093 template <class T, class V>
0094 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant<int, 12>*) BOOST_MATH_NOEXCEPT(V)
0095 {
0096 V x2 = x * x;
0097 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]);
0098 }
0099
0100 template <class T, class V>
0101 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant<int, 13>*) BOOST_MATH_NOEXCEPT(V)
0102 {
0103 V x2 = x * x;
0104 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);
0105 }
0106
0107
0108 }}}}
0109
0110 #endif
0111