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_20_HPP
0010 #define BOOST_MATH_TOOLS_POLY_EVAL_20_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 template <class T, class V>
0130 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant<int, 10>*) BOOST_MATH_NOEXCEPT(V)
0131 {
0132    V x2 = x * x;
0133    V t[2];
0134    t[0] = a[9] * x2 + a[7];
0135    t[1] = a[8] * x2 + a[6];
0136    t[0] *= x2;
0137    t[1] *= x2;
0138    t[0] += static_cast<V>(a[5]);
0139    t[1] += static_cast<V>(a[4]);
0140    t[0] *= x2;
0141    t[1] *= x2;
0142    t[0] += static_cast<V>(a[3]);
0143    t[1] += static_cast<V>(a[2]);
0144    t[0] *= x2;
0145    t[1] *= x2;
0146    t[0] += static_cast<V>(a[1]);
0147    t[1] += static_cast<V>(a[0]);
0148    t[0] *= x;
0149    return t[0] + t[1];
0150 }
0151 
0152 template <class T, class V>
0153 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant<int, 11>*) BOOST_MATH_NOEXCEPT(V)
0154 {
0155    V x2 = x * x;
0156    V t[2];
0157    t[0] = static_cast<V>(a[10] * x2 + a[8]);
0158    t[1] = static_cast<V>(a[9] * x2 + a[7]);
0159    t[0] *= x2;
0160    t[1] *= x2;
0161    t[0] += static_cast<V>(a[6]);
0162    t[1] += static_cast<V>(a[5]);
0163    t[0] *= x2;
0164    t[1] *= x2;
0165    t[0] += static_cast<V>(a[4]);
0166    t[1] += static_cast<V>(a[3]);
0167    t[0] *= x2;
0168    t[1] *= x2;
0169    t[0] += static_cast<V>(a[2]);
0170    t[1] += static_cast<V>(a[1]);
0171    t[0] *= x2;
0172    t[0] += static_cast<V>(a[0]);
0173    t[1] *= x;
0174    return t[0] + t[1];
0175 }
0176 
0177 template <class T, class V>
0178 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant<int, 12>*) BOOST_MATH_NOEXCEPT(V)
0179 {
0180    V x2 = x * x;
0181    V t[2];
0182    t[0] = a[11] * x2 + a[9];
0183    t[1] = a[10] * x2 + a[8];
0184    t[0] *= x2;
0185    t[1] *= x2;
0186    t[0] += static_cast<V>(a[7]);
0187    t[1] += static_cast<V>(a[6]);
0188    t[0] *= x2;
0189    t[1] *= x2;
0190    t[0] += static_cast<V>(a[5]);
0191    t[1] += static_cast<V>(a[4]);
0192    t[0] *= x2;
0193    t[1] *= x2;
0194    t[0] += static_cast<V>(a[3]);
0195    t[1] += static_cast<V>(a[2]);
0196    t[0] *= x2;
0197    t[1] *= x2;
0198    t[0] += static_cast<V>(a[1]);
0199    t[1] += static_cast<V>(a[0]);
0200    t[0] *= x;
0201    return t[0] + t[1];
0202 }
0203 
0204 template <class T, class V>
0205 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant<int, 13>*) BOOST_MATH_NOEXCEPT(V)
0206 {
0207    V x2 = x * x;
0208    V t[2];
0209    t[0] = static_cast<V>(a[12] * x2 + a[10]);
0210    t[1] = static_cast<V>(a[11] * x2 + a[9]);
0211    t[0] *= x2;
0212    t[1] *= x2;
0213    t[0] += static_cast<V>(a[8]);
0214    t[1] += static_cast<V>(a[7]);
0215    t[0] *= x2;
0216    t[1] *= x2;
0217    t[0] += static_cast<V>(a[6]);
0218    t[1] += static_cast<V>(a[5]);
0219    t[0] *= x2;
0220    t[1] *= x2;
0221    t[0] += static_cast<V>(a[4]);
0222    t[1] += static_cast<V>(a[3]);
0223    t[0] *= x2;
0224    t[1] *= x2;
0225    t[0] += static_cast<V>(a[2]);
0226    t[1] += static_cast<V>(a[1]);
0227    t[0] *= x2;
0228    t[0] += static_cast<V>(a[0]);
0229    t[1] *= x;
0230    return t[0] + t[1];
0231 }
0232 
0233 template <class T, class V>
0234 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant<int, 14>*) BOOST_MATH_NOEXCEPT(V)
0235 {
0236    V x2 = x * x;
0237    V t[2];
0238    t[0] = a[13] * x2 + a[11];
0239    t[1] = a[12] * x2 + a[10];
0240    t[0] *= x2;
0241    t[1] *= x2;
0242    t[0] += static_cast<V>(a[9]);
0243    t[1] += static_cast<V>(a[8]);
0244    t[0] *= x2;
0245    t[1] *= x2;
0246    t[0] += static_cast<V>(a[7]);
0247    t[1] += static_cast<V>(a[6]);
0248    t[0] *= x2;
0249    t[1] *= x2;
0250    t[0] += static_cast<V>(a[5]);
0251    t[1] += static_cast<V>(a[4]);
0252    t[0] *= x2;
0253    t[1] *= x2;
0254    t[0] += static_cast<V>(a[3]);
0255    t[1] += static_cast<V>(a[2]);
0256    t[0] *= x2;
0257    t[1] *= x2;
0258    t[0] += static_cast<V>(a[1]);
0259    t[1] += static_cast<V>(a[0]);
0260    t[0] *= x;
0261    return t[0] + t[1];
0262 }
0263 
0264 template <class T, class V>
0265 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant<int, 15>*) BOOST_MATH_NOEXCEPT(V)
0266 {
0267    V x2 = x * x;
0268    V t[2];
0269    t[0] = static_cast<V>(a[14] * x2 + a[12]);
0270    t[1] = static_cast<V>(a[13] * x2 + a[11]);
0271    t[0] *= x2;
0272    t[1] *= x2;
0273    t[0] += static_cast<V>(a[10]);
0274    t[1] += static_cast<V>(a[9]);
0275    t[0] *= x2;
0276    t[1] *= x2;
0277    t[0] += static_cast<V>(a[8]);
0278    t[1] += static_cast<V>(a[7]);
0279    t[0] *= x2;
0280    t[1] *= x2;
0281    t[0] += static_cast<V>(a[6]);
0282    t[1] += static_cast<V>(a[5]);
0283    t[0] *= x2;
0284    t[1] *= x2;
0285    t[0] += static_cast<V>(a[4]);
0286    t[1] += static_cast<V>(a[3]);
0287    t[0] *= x2;
0288    t[1] *= x2;
0289    t[0] += static_cast<V>(a[2]);
0290    t[1] += static_cast<V>(a[1]);
0291    t[0] *= x2;
0292    t[0] += static_cast<V>(a[0]);
0293    t[1] *= x;
0294    return t[0] + t[1];
0295 }
0296 
0297 template <class T, class V>
0298 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant<int, 16>*) BOOST_MATH_NOEXCEPT(V)
0299 {
0300    V x2 = x * x;
0301    V t[2];
0302    t[0] = a[15] * x2 + a[13];
0303    t[1] = a[14] * x2 + a[12];
0304    t[0] *= x2;
0305    t[1] *= x2;
0306    t[0] += static_cast<V>(a[11]);
0307    t[1] += static_cast<V>(a[10]);
0308    t[0] *= x2;
0309    t[1] *= x2;
0310    t[0] += static_cast<V>(a[9]);
0311    t[1] += static_cast<V>(a[8]);
0312    t[0] *= x2;
0313    t[1] *= x2;
0314    t[0] += static_cast<V>(a[7]);
0315    t[1] += static_cast<V>(a[6]);
0316    t[0] *= x2;
0317    t[1] *= x2;
0318    t[0] += static_cast<V>(a[5]);
0319    t[1] += static_cast<V>(a[4]);
0320    t[0] *= x2;
0321    t[1] *= x2;
0322    t[0] += static_cast<V>(a[3]);
0323    t[1] += static_cast<V>(a[2]);
0324    t[0] *= x2;
0325    t[1] *= x2;
0326    t[0] += static_cast<V>(a[1]);
0327    t[1] += static_cast<V>(a[0]);
0328    t[0] *= x;
0329    return t[0] + t[1];
0330 }
0331 
0332 template <class T, class V>
0333 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant<int, 17>*) BOOST_MATH_NOEXCEPT(V)
0334 {
0335    V x2 = x * x;
0336    V t[2];
0337    t[0] = static_cast<V>(a[16] * x2 + a[14]);
0338    t[1] = static_cast<V>(a[15] * x2 + a[13]);
0339    t[0] *= x2;
0340    t[1] *= x2;
0341    t[0] += static_cast<V>(a[12]);
0342    t[1] += static_cast<V>(a[11]);
0343    t[0] *= x2;
0344    t[1] *= x2;
0345    t[0] += static_cast<V>(a[10]);
0346    t[1] += static_cast<V>(a[9]);
0347    t[0] *= x2;
0348    t[1] *= x2;
0349    t[0] += static_cast<V>(a[8]);
0350    t[1] += static_cast<V>(a[7]);
0351    t[0] *= x2;
0352    t[1] *= x2;
0353    t[0] += static_cast<V>(a[6]);
0354    t[1] += static_cast<V>(a[5]);
0355    t[0] *= x2;
0356    t[1] *= x2;
0357    t[0] += static_cast<V>(a[4]);
0358    t[1] += static_cast<V>(a[3]);
0359    t[0] *= x2;
0360    t[1] *= x2;
0361    t[0] += static_cast<V>(a[2]);
0362    t[1] += static_cast<V>(a[1]);
0363    t[0] *= x2;
0364    t[0] += static_cast<V>(a[0]);
0365    t[1] *= x;
0366    return t[0] + t[1];
0367 }
0368 
0369 template <class T, class V>
0370 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant<int, 18>*) BOOST_MATH_NOEXCEPT(V)
0371 {
0372    V x2 = x * x;
0373    V t[2];
0374    t[0] = a[17] * x2 + a[15];
0375    t[1] = a[16] * x2 + a[14];
0376    t[0] *= x2;
0377    t[1] *= x2;
0378    t[0] += static_cast<V>(a[13]);
0379    t[1] += static_cast<V>(a[12]);
0380    t[0] *= x2;
0381    t[1] *= x2;
0382    t[0] += static_cast<V>(a[11]);
0383    t[1] += static_cast<V>(a[10]);
0384    t[0] *= x2;
0385    t[1] *= x2;
0386    t[0] += static_cast<V>(a[9]);
0387    t[1] += static_cast<V>(a[8]);
0388    t[0] *= x2;
0389    t[1] *= x2;
0390    t[0] += static_cast<V>(a[7]);
0391    t[1] += static_cast<V>(a[6]);
0392    t[0] *= x2;
0393    t[1] *= x2;
0394    t[0] += static_cast<V>(a[5]);
0395    t[1] += static_cast<V>(a[4]);
0396    t[0] *= x2;
0397    t[1] *= x2;
0398    t[0] += static_cast<V>(a[3]);
0399    t[1] += static_cast<V>(a[2]);
0400    t[0] *= x2;
0401    t[1] *= x2;
0402    t[0] += static_cast<V>(a[1]);
0403    t[1] += static_cast<V>(a[0]);
0404    t[0] *= x;
0405    return t[0] + t[1];
0406 }
0407 
0408 template <class T, class V>
0409 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant<int, 19>*) BOOST_MATH_NOEXCEPT(V)
0410 {
0411    V x2 = x * x;
0412    V t[2];
0413    t[0] = static_cast<V>(a[18] * x2 + a[16]);
0414    t[1] = static_cast<V>(a[17] * x2 + a[15]);
0415    t[0] *= x2;
0416    t[1] *= x2;
0417    t[0] += static_cast<V>(a[14]);
0418    t[1] += static_cast<V>(a[13]);
0419    t[0] *= x2;
0420    t[1] *= x2;
0421    t[0] += static_cast<V>(a[12]);
0422    t[1] += static_cast<V>(a[11]);
0423    t[0] *= x2;
0424    t[1] *= x2;
0425    t[0] += static_cast<V>(a[10]);
0426    t[1] += static_cast<V>(a[9]);
0427    t[0] *= x2;
0428    t[1] *= x2;
0429    t[0] += static_cast<V>(a[8]);
0430    t[1] += static_cast<V>(a[7]);
0431    t[0] *= x2;
0432    t[1] *= x2;
0433    t[0] += static_cast<V>(a[6]);
0434    t[1] += static_cast<V>(a[5]);
0435    t[0] *= x2;
0436    t[1] *= x2;
0437    t[0] += static_cast<V>(a[4]);
0438    t[1] += static_cast<V>(a[3]);
0439    t[0] *= x2;
0440    t[1] *= x2;
0441    t[0] += static_cast<V>(a[2]);
0442    t[1] += static_cast<V>(a[1]);
0443    t[0] *= x2;
0444    t[0] += static_cast<V>(a[0]);
0445    t[1] *= x;
0446    return t[0] + t[1];
0447 }
0448 
0449 template <class T, class V>
0450 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant<int, 20>*) BOOST_MATH_NOEXCEPT(V)
0451 {
0452    V x2 = x * x;
0453    V t[2];
0454    t[0] = a[19] * x2 + a[17];
0455    t[1] = a[18] * x2 + a[16];
0456    t[0] *= x2;
0457    t[1] *= x2;
0458    t[0] += static_cast<V>(a[15]);
0459    t[1] += static_cast<V>(a[14]);
0460    t[0] *= x2;
0461    t[1] *= x2;
0462    t[0] += static_cast<V>(a[13]);
0463    t[1] += static_cast<V>(a[12]);
0464    t[0] *= x2;
0465    t[1] *= x2;
0466    t[0] += static_cast<V>(a[11]);
0467    t[1] += static_cast<V>(a[10]);
0468    t[0] *= x2;
0469    t[1] *= x2;
0470    t[0] += static_cast<V>(a[9]);
0471    t[1] += static_cast<V>(a[8]);
0472    t[0] *= x2;
0473    t[1] *= x2;
0474    t[0] += static_cast<V>(a[7]);
0475    t[1] += static_cast<V>(a[6]);
0476    t[0] *= x2;
0477    t[1] *= x2;
0478    t[0] += static_cast<V>(a[5]);
0479    t[1] += static_cast<V>(a[4]);
0480    t[0] *= x2;
0481    t[1] *= x2;
0482    t[0] += static_cast<V>(a[3]);
0483    t[1] += static_cast<V>(a[2]);
0484    t[0] *= x2;
0485    t[1] *= x2;
0486    t[0] += static_cast<V>(a[1]);
0487    t[1] += static_cast<V>(a[0]);
0488    t[0] *= x;
0489    return t[0] + t[1];
0490 }
0491 
0492 
0493 }}}} // namespaces
0494 
0495 #endif // include guard
0496