1 // (C) Copyright John Maddock 2007.
2 // Use, modification and distribution are subject to the
3 // Boost Software License, Version 1.0. (See accompanying file
4 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 // This file is machine generated, do not edit by hand
8 // Unrolled polynomial evaluation using second order Horners rule
9 #ifndef BOOST_MATH_TOOLS_POLY_EVAL_19_HPP
10 #define BOOST_MATH_TOOLS_POLY_EVAL_19_HPP
12 namespace boost{ namespace math{ namespace tools{ namespace detail{
14 template <class T, class V>
15 inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)
17 return static_cast<V>(0);
20 template <class T, class V>
21 inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
23 return static_cast<V>(a[0]);
26 template <class T, class V>
27 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
29 return static_cast<V>(a[1] * x + a[0]);
32 template <class T, class V>
33 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
35 return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
38 template <class T, class V>
39 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
41 return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
44 template <class T, class V>
45 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
49 t[0] = static_cast<V>(a[4] * x2 + a[2]);
50 t[1] = static_cast<V>(a[3] * x2 + a[1]);
52 t[0] += static_cast<V>(a[0]);
57 template <class T, class V>
58 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
62 t[0] = a[5] * x2 + a[3];
63 t[1] = a[4] * x2 + a[2];
66 t[0] += static_cast<V>(a[1]);
67 t[1] += static_cast<V>(a[0]);
72 template <class T, class V>
73 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*)
77 t[0] = static_cast<V>(a[6] * x2 + a[4]);
78 t[1] = static_cast<V>(a[5] * x2 + a[3]);
81 t[0] += static_cast<V>(a[2]);
82 t[1] += static_cast<V>(a[1]);
84 t[0] += static_cast<V>(a[0]);
89 template <class T, class V>
90 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*)
94 t[0] = a[7] * x2 + a[5];
95 t[1] = a[6] * x2 + a[4];
98 t[0] += static_cast<V>(a[3]);
99 t[1] += static_cast<V>(a[2]);
102 t[0] += static_cast<V>(a[1]);
103 t[1] += static_cast<V>(a[0]);
108 template <class T, class V>
109 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*)
113 t[0] = static_cast<V>(a[8] * x2 + a[6]);
114 t[1] = static_cast<V>(a[7] * x2 + a[5]);
117 t[0] += static_cast<V>(a[4]);
118 t[1] += static_cast<V>(a[3]);
121 t[0] += static_cast<V>(a[2]);
122 t[1] += static_cast<V>(a[1]);
124 t[0] += static_cast<V>(a[0]);
129 template <class T, class V>
130 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*)
134 t[0] = a[9] * x2 + a[7];
135 t[1] = a[8] * x2 + a[6];
138 t[0] += static_cast<V>(a[5]);
139 t[1] += static_cast<V>(a[4]);
142 t[0] += static_cast<V>(a[3]);
143 t[1] += static_cast<V>(a[2]);
146 t[0] += static_cast<V>(a[1]);
147 t[1] += static_cast<V>(a[0]);
152 template <class T, class V>
153 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*)
157 t[0] = static_cast<V>(a[10] * x2 + a[8]);
158 t[1] = static_cast<V>(a[9] * x2 + a[7]);
161 t[0] += static_cast<V>(a[6]);
162 t[1] += static_cast<V>(a[5]);
165 t[0] += static_cast<V>(a[4]);
166 t[1] += static_cast<V>(a[3]);
169 t[0] += static_cast<V>(a[2]);
170 t[1] += static_cast<V>(a[1]);
172 t[0] += static_cast<V>(a[0]);
177 template <class T, class V>
178 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*)
182 t[0] = a[11] * x2 + a[9];
183 t[1] = a[10] * x2 + a[8];
186 t[0] += static_cast<V>(a[7]);
187 t[1] += static_cast<V>(a[6]);
190 t[0] += static_cast<V>(a[5]);
191 t[1] += static_cast<V>(a[4]);
194 t[0] += static_cast<V>(a[3]);
195 t[1] += static_cast<V>(a[2]);
198 t[0] += static_cast<V>(a[1]);
199 t[1] += static_cast<V>(a[0]);
204 template <class T, class V>
205 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*)
209 t[0] = static_cast<V>(a[12] * x2 + a[10]);
210 t[1] = static_cast<V>(a[11] * x2 + a[9]);
213 t[0] += static_cast<V>(a[8]);
214 t[1] += static_cast<V>(a[7]);
217 t[0] += static_cast<V>(a[6]);
218 t[1] += static_cast<V>(a[5]);
221 t[0] += static_cast<V>(a[4]);
222 t[1] += static_cast<V>(a[3]);
225 t[0] += static_cast<V>(a[2]);
226 t[1] += static_cast<V>(a[1]);
228 t[0] += static_cast<V>(a[0]);
233 template <class T, class V>
234 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*)
238 t[0] = a[13] * x2 + a[11];
239 t[1] = a[12] * x2 + a[10];
242 t[0] += static_cast<V>(a[9]);
243 t[1] += static_cast<V>(a[8]);
246 t[0] += static_cast<V>(a[7]);
247 t[1] += static_cast<V>(a[6]);
250 t[0] += static_cast<V>(a[5]);
251 t[1] += static_cast<V>(a[4]);
254 t[0] += static_cast<V>(a[3]);
255 t[1] += static_cast<V>(a[2]);
258 t[0] += static_cast<V>(a[1]);
259 t[1] += static_cast<V>(a[0]);
264 template <class T, class V>
265 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*)
269 t[0] = static_cast<V>(a[14] * x2 + a[12]);
270 t[1] = static_cast<V>(a[13] * x2 + a[11]);
273 t[0] += static_cast<V>(a[10]);
274 t[1] += static_cast<V>(a[9]);
277 t[0] += static_cast<V>(a[8]);
278 t[1] += static_cast<V>(a[7]);
281 t[0] += static_cast<V>(a[6]);
282 t[1] += static_cast<V>(a[5]);
285 t[0] += static_cast<V>(a[4]);
286 t[1] += static_cast<V>(a[3]);
289 t[0] += static_cast<V>(a[2]);
290 t[1] += static_cast<V>(a[1]);
292 t[0] += static_cast<V>(a[0]);
297 template <class T, class V>
298 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*)
302 t[0] = a[15] * x2 + a[13];
303 t[1] = a[14] * x2 + a[12];
306 t[0] += static_cast<V>(a[11]);
307 t[1] += static_cast<V>(a[10]);
310 t[0] += static_cast<V>(a[9]);
311 t[1] += static_cast<V>(a[8]);
314 t[0] += static_cast<V>(a[7]);
315 t[1] += static_cast<V>(a[6]);
318 t[0] += static_cast<V>(a[5]);
319 t[1] += static_cast<V>(a[4]);
322 t[0] += static_cast<V>(a[3]);
323 t[1] += static_cast<V>(a[2]);
326 t[0] += static_cast<V>(a[1]);
327 t[1] += static_cast<V>(a[0]);
332 template <class T, class V>
333 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<17>*)
337 t[0] = static_cast<V>(a[16] * x2 + a[14]);
338 t[1] = static_cast<V>(a[15] * x2 + a[13]);
341 t[0] += static_cast<V>(a[12]);
342 t[1] += static_cast<V>(a[11]);
345 t[0] += static_cast<V>(a[10]);
346 t[1] += static_cast<V>(a[9]);
349 t[0] += static_cast<V>(a[8]);
350 t[1] += static_cast<V>(a[7]);
353 t[0] += static_cast<V>(a[6]);
354 t[1] += static_cast<V>(a[5]);
357 t[0] += static_cast<V>(a[4]);
358 t[1] += static_cast<V>(a[3]);
361 t[0] += static_cast<V>(a[2]);
362 t[1] += static_cast<V>(a[1]);
364 t[0] += static_cast<V>(a[0]);
369 template <class T, class V>
370 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<18>*)
374 t[0] = a[17] * x2 + a[15];
375 t[1] = a[16] * x2 + a[14];
378 t[0] += static_cast<V>(a[13]);
379 t[1] += static_cast<V>(a[12]);
382 t[0] += static_cast<V>(a[11]);
383 t[1] += static_cast<V>(a[10]);
386 t[0] += static_cast<V>(a[9]);
387 t[1] += static_cast<V>(a[8]);
390 t[0] += static_cast<V>(a[7]);
391 t[1] += static_cast<V>(a[6]);
394 t[0] += static_cast<V>(a[5]);
395 t[1] += static_cast<V>(a[4]);
398 t[0] += static_cast<V>(a[3]);
399 t[1] += static_cast<V>(a[2]);
402 t[0] += static_cast<V>(a[1]);
403 t[1] += static_cast<V>(a[0]);
408 template <class T, class V>
409 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<19>*)
413 t[0] = static_cast<V>(a[18] * x2 + a[16]);
414 t[1] = static_cast<V>(a[17] * x2 + a[15]);
417 t[0] += static_cast<V>(a[14]);
418 t[1] += static_cast<V>(a[13]);
421 t[0] += static_cast<V>(a[12]);
422 t[1] += static_cast<V>(a[11]);
425 t[0] += static_cast<V>(a[10]);
426 t[1] += static_cast<V>(a[9]);
429 t[0] += static_cast<V>(a[8]);
430 t[1] += static_cast<V>(a[7]);
433 t[0] += static_cast<V>(a[6]);
434 t[1] += static_cast<V>(a[5]);
437 t[0] += static_cast<V>(a[4]);
438 t[1] += static_cast<V>(a[3]);
441 t[0] += static_cast<V>(a[2]);
442 t[1] += static_cast<V>(a[1]);
444 t[0] += static_cast<V>(a[0]);
452 #endif // include guard