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) |
5 | // |
6 | // This file is machine generated, do not edit by hand |
7 | |
8 | // Polynomial evaluation using second order Horners rule |
9 | #ifndef BOOST_MATH_TOOLS_RAT_EVAL_20_HPP |
10 | #define BOOST_MATH_TOOLS_RAT_EVAL_20_HPP |
11 | |
12 | namespace boost{ namespace math{ namespace tools{ namespace detail{ |
13 | |
14 | template <class T, class U, class V> |
15 | inline V evaluate_rational_c_imp(const T*, const U*, const V&, const boost::integral_constant<int, 0>*) BOOST_MATH_NOEXCEPT(V) |
16 | { |
17 | return static_cast<V>(0); |
18 | } |
19 | |
20 | template <class T, class U, class V> |
21 | inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const boost::integral_constant<int, 1>*) BOOST_MATH_NOEXCEPT(V) |
22 | { |
23 | return static_cast<V>(a[0]) / static_cast<V>(b[0]); |
24 | } |
25 | |
26 | template <class T, class U, class V> |
27 | inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::integral_constant<int, 2>*) BOOST_MATH_NOEXCEPT(V) |
28 | { |
29 | return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0])); |
30 | } |
31 | |
32 | template <class T, class U, class V> |
33 | inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::integral_constant<int, 3>*) BOOST_MATH_NOEXCEPT(V) |
34 | { |
35 | return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); |
36 | } |
37 | |
38 | template <class T, class U, class V> |
39 | inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::integral_constant<int, 4>*) BOOST_MATH_NOEXCEPT(V) |
40 | { |
41 | 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])); |
42 | } |
43 | |
44 | template <class T, class U, class V> |
45 | inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::integral_constant<int, 5>*) BOOST_MATH_NOEXCEPT(V) |
46 | { |
47 | if(x <= 1) |
48 | { |
49 | V x2 = x * x; |
50 | V t[4]; |
51 | t[0] = a[4] * x2 + a[2]; |
52 | t[1] = a[3] * x2 + a[1]; |
53 | t[2] = b[4] * x2 + b[2]; |
54 | t[3] = b[3] * x2 + b[1]; |
55 | t[0] *= x2; |
56 | t[2] *= x2; |
57 | t[0] += static_cast<V>(a[0]); |
58 | t[2] += static_cast<V>(b[0]); |
59 | t[1] *= x; |
60 | t[3] *= x; |
61 | return (t[0] + t[1]) / (t[2] + t[3]); |
62 | } |
63 | else |
64 | { |
65 | V z = 1 / x; |
66 | V z2 = 1 / (x * x); |
67 | V t[4]; |
68 | t[0] = a[0] * z2 + a[2]; |
69 | t[1] = a[1] * z2 + a[3]; |
70 | t[2] = b[0] * z2 + b[2]; |
71 | t[3] = b[1] * z2 + b[3]; |
72 | t[0] *= z2; |
73 | t[2] *= z2; |
74 | t[0] += static_cast<V>(a[4]); |
75 | t[2] += static_cast<V>(b[4]); |
76 | t[1] *= z; |
77 | t[3] *= z; |
78 | return (t[0] + t[1]) / (t[2] + t[3]); |
79 | } |
80 | } |
81 | |
82 | template <class T, class U, class V> |
83 | inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::integral_constant<int, 6>*) BOOST_MATH_NOEXCEPT(V) |
84 | { |
85 | if(x <= 1) |
86 | { |
87 | V x2 = x * x; |
88 | V t[4]; |
89 | t[0] = a[5] * x2 + a[3]; |
90 | t[1] = a[4] * x2 + a[2]; |
91 | t[2] = b[5] * x2 + b[3]; |
92 | t[3] = b[4] * x2 + b[2]; |
93 | t[0] *= x2; |
94 | t[1] *= x2; |
95 | t[2] *= x2; |
96 | t[3] *= x2; |
97 | t[0] += static_cast<V>(a[1]); |
98 | t[1] += static_cast<V>(a[0]); |
99 | t[2] += static_cast<V>(b[1]); |
100 | t[3] += static_cast<V>(b[0]); |
101 | t[0] *= x; |
102 | t[2] *= x; |
103 | return (t[0] + t[1]) / (t[2] + t[3]); |
104 | } |
105 | else |
106 | { |
107 | V z = 1 / x; |
108 | V z2 = 1 / (x * x); |
109 | V t[4]; |
110 | t[0] = a[0] * z2 + a[2]; |
111 | t[1] = a[1] * z2 + a[3]; |
112 | t[2] = b[0] * z2 + b[2]; |
113 | t[3] = b[1] * z2 + b[3]; |
114 | t[0] *= z2; |
115 | t[1] *= z2; |
116 | t[2] *= z2; |
117 | t[3] *= z2; |
118 | t[0] += static_cast<V>(a[4]); |
119 | t[1] += static_cast<V>(a[5]); |
120 | t[2] += static_cast<V>(b[4]); |
121 | t[3] += static_cast<V>(b[5]); |
122 | t[0] *= z; |
123 | t[2] *= z; |
124 | return (t[0] + t[1]) / (t[2] + t[3]); |
125 | } |
126 | } |
127 | |
128 | template <class T, class U, class V> |
129 | inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::integral_constant<int, 7>*) BOOST_MATH_NOEXCEPT(V) |
130 | { |
131 | if(x <= 1) |
132 | { |
133 | V x2 = x * x; |
134 | V t[4]; |
135 | t[0] = a[6] * x2 + a[4]; |
136 | t[1] = a[5] * x2 + a[3]; |
137 | t[2] = b[6] * x2 + b[4]; |
138 | t[3] = b[5] * x2 + b[3]; |
139 | t[0] *= x2; |
140 | t[1] *= x2; |
141 | t[2] *= x2; |
142 | t[3] *= x2; |
143 | t[0] += static_cast<V>(a[2]); |
144 | t[1] += static_cast<V>(a[1]); |
145 | t[2] += static_cast<V>(b[2]); |
146 | t[3] += static_cast<V>(b[1]); |
147 | t[0] *= x2; |
148 | t[2] *= x2; |
149 | t[0] += static_cast<V>(a[0]); |
150 | t[2] += static_cast<V>(b[0]); |
151 | t[1] *= x; |
152 | t[3] *= x; |
153 | return (t[0] + t[1]) / (t[2] + t[3]); |
154 | } |
155 | else |
156 | { |
157 | V z = 1 / x; |
158 | V z2 = 1 / (x * x); |
159 | V t[4]; |
160 | t[0] = a[0] * z2 + a[2]; |
161 | t[1] = a[1] * z2 + a[3]; |
162 | t[2] = b[0] * z2 + b[2]; |
163 | t[3] = b[1] * z2 + b[3]; |
164 | t[0] *= z2; |
165 | t[1] *= z2; |
166 | t[2] *= z2; |
167 | t[3] *= z2; |
168 | t[0] += static_cast<V>(a[4]); |
169 | t[1] += static_cast<V>(a[5]); |
170 | t[2] += static_cast<V>(b[4]); |
171 | t[3] += static_cast<V>(b[5]); |
172 | t[0] *= z2; |
173 | t[2] *= z2; |
174 | t[0] += static_cast<V>(a[6]); |
175 | t[2] += static_cast<V>(b[6]); |
176 | t[1] *= z; |
177 | t[3] *= z; |
178 | return (t[0] + t[1]) / (t[2] + t[3]); |
179 | } |
180 | } |
181 | |
182 | template <class T, class U, class V> |
183 | inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::integral_constant<int, 8>*) BOOST_MATH_NOEXCEPT(V) |
184 | { |
185 | if(x <= 1) |
186 | { |
187 | V x2 = x * x; |
188 | V t[4]; |
189 | t[0] = a[7] * x2 + a[5]; |
190 | t[1] = a[6] * x2 + a[4]; |
191 | t[2] = b[7] * x2 + b[5]; |
192 | t[3] = b[6] * x2 + b[4]; |
193 | t[0] *= x2; |
194 | t[1] *= x2; |
195 | t[2] *= x2; |
196 | t[3] *= x2; |
197 | t[0] += static_cast<V>(a[3]); |
198 | t[1] += static_cast<V>(a[2]); |
199 | t[2] += static_cast<V>(b[3]); |
200 | t[3] += static_cast<V>(b[2]); |
201 | t[0] *= x2; |
202 | t[1] *= x2; |
203 | t[2] *= x2; |
204 | t[3] *= x2; |
205 | t[0] += static_cast<V>(a[1]); |
206 | t[1] += static_cast<V>(a[0]); |
207 | t[2] += static_cast<V>(b[1]); |
208 | t[3] += static_cast<V>(b[0]); |
209 | t[0] *= x; |
210 | t[2] *= x; |
211 | return (t[0] + t[1]) / (t[2] + t[3]); |
212 | } |
213 | else |
214 | { |
215 | V z = 1 / x; |
216 | V z2 = 1 / (x * x); |
217 | V t[4]; |
218 | t[0] = a[0] * z2 + a[2]; |
219 | t[1] = a[1] * z2 + a[3]; |
220 | t[2] = b[0] * z2 + b[2]; |
221 | t[3] = b[1] * z2 + b[3]; |
222 | t[0] *= z2; |
223 | t[1] *= z2; |
224 | t[2] *= z2; |
225 | t[3] *= z2; |
226 | t[0] += static_cast<V>(a[4]); |
227 | t[1] += static_cast<V>(a[5]); |
228 | t[2] += static_cast<V>(b[4]); |
229 | t[3] += static_cast<V>(b[5]); |
230 | t[0] *= z2; |
231 | t[1] *= z2; |
232 | t[2] *= z2; |
233 | t[3] *= z2; |
234 | t[0] += static_cast<V>(a[6]); |
235 | t[1] += static_cast<V>(a[7]); |
236 | t[2] += static_cast<V>(b[6]); |
237 | t[3] += static_cast<V>(b[7]); |
238 | t[0] *= z; |
239 | t[2] *= z; |
240 | return (t[0] + t[1]) / (t[2] + t[3]); |
241 | } |
242 | } |
243 | |
244 | template <class T, class U, class V> |
245 | inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::integral_constant<int, 9>*) BOOST_MATH_NOEXCEPT(V) |
246 | { |
247 | if(x <= 1) |
248 | { |
249 | V x2 = x * x; |
250 | V t[4]; |
251 | t[0] = a[8] * x2 + a[6]; |
252 | t[1] = a[7] * x2 + a[5]; |
253 | t[2] = b[8] * x2 + b[6]; |
254 | t[3] = b[7] * x2 + b[5]; |
255 | t[0] *= x2; |
256 | t[1] *= x2; |
257 | t[2] *= x2; |
258 | t[3] *= x2; |
259 | t[0] += static_cast<V>(a[4]); |
260 | t[1] += static_cast<V>(a[3]); |
261 | t[2] += static_cast<V>(b[4]); |
262 | t[3] += static_cast<V>(b[3]); |
263 | t[0] *= x2; |
264 | t[1] *= x2; |
265 | t[2] *= x2; |
266 | t[3] *= x2; |
267 | t[0] += static_cast<V>(a[2]); |
268 | t[1] += static_cast<V>(a[1]); |
269 | t[2] += static_cast<V>(b[2]); |
270 | t[3] += static_cast<V>(b[1]); |
271 | t[0] *= x2; |
272 | t[2] *= x2; |
273 | t[0] += static_cast<V>(a[0]); |
274 | t[2] += static_cast<V>(b[0]); |
275 | t[1] *= x; |
276 | t[3] *= x; |
277 | return (t[0] + t[1]) / (t[2] + t[3]); |
278 | } |
279 | else |
280 | { |
281 | V z = 1 / x; |
282 | V z2 = 1 / (x * x); |
283 | V t[4]; |
284 | t[0] = a[0] * z2 + a[2]; |
285 | t[1] = a[1] * z2 + a[3]; |
286 | t[2] = b[0] * z2 + b[2]; |
287 | t[3] = b[1] * z2 + b[3]; |
288 | t[0] *= z2; |
289 | t[1] *= z2; |
290 | t[2] *= z2; |
291 | t[3] *= z2; |
292 | t[0] += static_cast<V>(a[4]); |
293 | t[1] += static_cast<V>(a[5]); |
294 | t[2] += static_cast<V>(b[4]); |
295 | t[3] += static_cast<V>(b[5]); |
296 | t[0] *= z2; |
297 | t[1] *= z2; |
298 | t[2] *= z2; |
299 | t[3] *= z2; |
300 | t[0] += static_cast<V>(a[6]); |
301 | t[1] += static_cast<V>(a[7]); |
302 | t[2] += static_cast<V>(b[6]); |
303 | t[3] += static_cast<V>(b[7]); |
304 | t[0] *= z2; |
305 | t[2] *= z2; |
306 | t[0] += static_cast<V>(a[8]); |
307 | t[2] += static_cast<V>(b[8]); |
308 | t[1] *= z; |
309 | t[3] *= z; |
310 | return (t[0] + t[1]) / (t[2] + t[3]); |
311 | } |
312 | } |
313 | |
314 | template <class T, class U, class V> |
315 | inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::integral_constant<int, 10>*) BOOST_MATH_NOEXCEPT(V) |
316 | { |
317 | if(x <= 1) |
318 | { |
319 | V x2 = x * x; |
320 | V t[4]; |
321 | t[0] = a[9] * x2 + a[7]; |
322 | t[1] = a[8] * x2 + a[6]; |
323 | t[2] = b[9] * x2 + b[7]; |
324 | t[3] = b[8] * x2 + b[6]; |
325 | t[0] *= x2; |
326 | t[1] *= x2; |
327 | t[2] *= x2; |
328 | t[3] *= x2; |
329 | t[0] += static_cast<V>(a[5]); |
330 | t[1] += static_cast<V>(a[4]); |
331 | t[2] += static_cast<V>(b[5]); |
332 | t[3] += static_cast<V>(b[4]); |
333 | t[0] *= x2; |
334 | t[1] *= x2; |
335 | t[2] *= x2; |
336 | t[3] *= x2; |
337 | t[0] += static_cast<V>(a[3]); |
338 | t[1] += static_cast<V>(a[2]); |
339 | t[2] += static_cast<V>(b[3]); |
340 | t[3] += static_cast<V>(b[2]); |
341 | t[0] *= x2; |
342 | t[1] *= x2; |
343 | t[2] *= x2; |
344 | t[3] *= x2; |
345 | t[0] += static_cast<V>(a[1]); |
346 | t[1] += static_cast<V>(a[0]); |
347 | t[2] += static_cast<V>(b[1]); |
348 | t[3] += static_cast<V>(b[0]); |
349 | t[0] *= x; |
350 | t[2] *= x; |
351 | return (t[0] + t[1]) / (t[2] + t[3]); |
352 | } |
353 | else |
354 | { |
355 | V z = 1 / x; |
356 | V z2 = 1 / (x * x); |
357 | V t[4]; |
358 | t[0] = a[0] * z2 + a[2]; |
359 | t[1] = a[1] * z2 + a[3]; |
360 | t[2] = b[0] * z2 + b[2]; |
361 | t[3] = b[1] * z2 + b[3]; |
362 | t[0] *= z2; |
363 | t[1] *= z2; |
364 | t[2] *= z2; |
365 | t[3] *= z2; |
366 | t[0] += static_cast<V>(a[4]); |
367 | t[1] += static_cast<V>(a[5]); |
368 | t[2] += static_cast<V>(b[4]); |
369 | t[3] += static_cast<V>(b[5]); |
370 | t[0] *= z2; |
371 | t[1] *= z2; |
372 | t[2] *= z2; |
373 | t[3] *= z2; |
374 | t[0] += static_cast<V>(a[6]); |
375 | t[1] += static_cast<V>(a[7]); |
376 | t[2] += static_cast<V>(b[6]); |
377 | t[3] += static_cast<V>(b[7]); |
378 | t[0] *= z2; |
379 | t[1] *= z2; |
380 | t[2] *= z2; |
381 | t[3] *= z2; |
382 | t[0] += static_cast<V>(a[8]); |
383 | t[1] += static_cast<V>(a[9]); |
384 | t[2] += static_cast<V>(b[8]); |
385 | t[3] += static_cast<V>(b[9]); |
386 | t[0] *= z; |
387 | t[2] *= z; |
388 | return (t[0] + t[1]) / (t[2] + t[3]); |
389 | } |
390 | } |
391 | |
392 | template <class T, class U, class V> |
393 | inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::integral_constant<int, 11>*) BOOST_MATH_NOEXCEPT(V) |
394 | { |
395 | if(x <= 1) |
396 | { |
397 | V x2 = x * x; |
398 | V t[4]; |
399 | t[0] = a[10] * x2 + a[8]; |
400 | t[1] = a[9] * x2 + a[7]; |
401 | t[2] = b[10] * x2 + b[8]; |
402 | t[3] = b[9] * x2 + b[7]; |
403 | t[0] *= x2; |
404 | t[1] *= x2; |
405 | t[2] *= x2; |
406 | t[3] *= x2; |
407 | t[0] += static_cast<V>(a[6]); |
408 | t[1] += static_cast<V>(a[5]); |
409 | t[2] += static_cast<V>(b[6]); |
410 | t[3] += static_cast<V>(b[5]); |
411 | t[0] *= x2; |
412 | t[1] *= x2; |
413 | t[2] *= x2; |
414 | t[3] *= x2; |
415 | t[0] += static_cast<V>(a[4]); |
416 | t[1] += static_cast<V>(a[3]); |
417 | t[2] += static_cast<V>(b[4]); |
418 | t[3] += static_cast<V>(b[3]); |
419 | t[0] *= x2; |
420 | t[1] *= x2; |
421 | t[2] *= x2; |
422 | t[3] *= x2; |
423 | t[0] += static_cast<V>(a[2]); |
424 | t[1] += static_cast<V>(a[1]); |
425 | t[2] += static_cast<V>(b[2]); |
426 | t[3] += static_cast<V>(b[1]); |
427 | t[0] *= x2; |
428 | t[2] *= x2; |
429 | t[0] += static_cast<V>(a[0]); |
430 | t[2] += static_cast<V>(b[0]); |
431 | t[1] *= x; |
432 | t[3] *= x; |
433 | return (t[0] + t[1]) / (t[2] + t[3]); |
434 | } |
435 | else |
436 | { |
437 | V z = 1 / x; |
438 | V z2 = 1 / (x * x); |
439 | V t[4]; |
440 | t[0] = a[0] * z2 + a[2]; |
441 | t[1] = a[1] * z2 + a[3]; |
442 | t[2] = b[0] * z2 + b[2]; |
443 | t[3] = b[1] * z2 + b[3]; |
444 | t[0] *= z2; |
445 | t[1] *= z2; |
446 | t[2] *= z2; |
447 | t[3] *= z2; |
448 | t[0] += static_cast<V>(a[4]); |
449 | t[1] += static_cast<V>(a[5]); |
450 | t[2] += static_cast<V>(b[4]); |
451 | t[3] += static_cast<V>(b[5]); |
452 | t[0] *= z2; |
453 | t[1] *= z2; |
454 | t[2] *= z2; |
455 | t[3] *= z2; |
456 | t[0] += static_cast<V>(a[6]); |
457 | t[1] += static_cast<V>(a[7]); |
458 | t[2] += static_cast<V>(b[6]); |
459 | t[3] += static_cast<V>(b[7]); |
460 | t[0] *= z2; |
461 | t[1] *= z2; |
462 | t[2] *= z2; |
463 | t[3] *= z2; |
464 | t[0] += static_cast<V>(a[8]); |
465 | t[1] += static_cast<V>(a[9]); |
466 | t[2] += static_cast<V>(b[8]); |
467 | t[3] += static_cast<V>(b[9]); |
468 | t[0] *= z2; |
469 | t[2] *= z2; |
470 | t[0] += static_cast<V>(a[10]); |
471 | t[2] += static_cast<V>(b[10]); |
472 | t[1] *= z; |
473 | t[3] *= z; |
474 | return (t[0] + t[1]) / (t[2] + t[3]); |
475 | } |
476 | } |
477 | |
478 | template <class T, class U, class V> |
479 | inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::integral_constant<int, 12>*) BOOST_MATH_NOEXCEPT(V) |
480 | { |
481 | if(x <= 1) |
482 | { |
483 | V x2 = x * x; |
484 | V t[4]; |
485 | t[0] = a[11] * x2 + a[9]; |
486 | t[1] = a[10] * x2 + a[8]; |
487 | t[2] = b[11] * x2 + b[9]; |
488 | t[3] = b[10] * x2 + b[8]; |
489 | t[0] *= x2; |
490 | t[1] *= x2; |
491 | t[2] *= x2; |
492 | t[3] *= x2; |
493 | t[0] += static_cast<V>(a[7]); |
494 | t[1] += static_cast<V>(a[6]); |
495 | t[2] += static_cast<V>(b[7]); |
496 | t[3] += static_cast<V>(b[6]); |
497 | t[0] *= x2; |
498 | t[1] *= x2; |
499 | t[2] *= x2; |
500 | t[3] *= x2; |
501 | t[0] += static_cast<V>(a[5]); |
502 | t[1] += static_cast<V>(a[4]); |
503 | t[2] += static_cast<V>(b[5]); |
504 | t[3] += static_cast<V>(b[4]); |
505 | t[0] *= x2; |
506 | t[1] *= x2; |
507 | t[2] *= x2; |
508 | t[3] *= x2; |
509 | t[0] += static_cast<V>(a[3]); |
510 | t[1] += static_cast<V>(a[2]); |
511 | t[2] += static_cast<V>(b[3]); |
512 | t[3] += static_cast<V>(b[2]); |
513 | t[0] *= x2; |
514 | t[1] *= x2; |
515 | t[2] *= x2; |
516 | t[3] *= x2; |
517 | t[0] += static_cast<V>(a[1]); |
518 | t[1] += static_cast<V>(a[0]); |
519 | t[2] += static_cast<V>(b[1]); |
520 | t[3] += static_cast<V>(b[0]); |
521 | t[0] *= x; |
522 | t[2] *= x; |
523 | return (t[0] + t[1]) / (t[2] + t[3]); |
524 | } |
525 | else |
526 | { |
527 | V z = 1 / x; |
528 | V z2 = 1 / (x * x); |
529 | V t[4]; |
530 | t[0] = a[0] * z2 + a[2]; |
531 | t[1] = a[1] * z2 + a[3]; |
532 | t[2] = b[0] * z2 + b[2]; |
533 | t[3] = b[1] * z2 + b[3]; |
534 | t[0] *= z2; |
535 | t[1] *= z2; |
536 | t[2] *= z2; |
537 | t[3] *= z2; |
538 | t[0] += static_cast<V>(a[4]); |
539 | t[1] += static_cast<V>(a[5]); |
540 | t[2] += static_cast<V>(b[4]); |
541 | t[3] += static_cast<V>(b[5]); |
542 | t[0] *= z2; |
543 | t[1] *= z2; |
544 | t[2] *= z2; |
545 | t[3] *= z2; |
546 | t[0] += static_cast<V>(a[6]); |
547 | t[1] += static_cast<V>(a[7]); |
548 | t[2] += static_cast<V>(b[6]); |
549 | t[3] += static_cast<V>(b[7]); |
550 | t[0] *= z2; |
551 | t[1] *= z2; |
552 | t[2] *= z2; |
553 | t[3] *= z2; |
554 | t[0] += static_cast<V>(a[8]); |
555 | t[1] += static_cast<V>(a[9]); |
556 | t[2] += static_cast<V>(b[8]); |
557 | t[3] += static_cast<V>(b[9]); |
558 | t[0] *= z2; |
559 | t[1] *= z2; |
560 | t[2] *= z2; |
561 | t[3] *= z2; |
562 | t[0] += static_cast<V>(a[10]); |
563 | t[1] += static_cast<V>(a[11]); |
564 | t[2] += static_cast<V>(b[10]); |
565 | t[3] += static_cast<V>(b[11]); |
566 | t[0] *= z; |
567 | t[2] *= z; |
568 | return (t[0] + t[1]) / (t[2] + t[3]); |
569 | } |
570 | } |
571 | |
572 | template <class T, class U, class V> |
573 | inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::integral_constant<int, 13>*) BOOST_MATH_NOEXCEPT(V) |
574 | { |
575 | if(x <= 1) |
576 | { |
577 | V x2 = x * x; |
578 | V t[4]; |
579 | t[0] = a[12] * x2 + a[10]; |
580 | t[1] = a[11] * x2 + a[9]; |
581 | t[2] = b[12] * x2 + b[10]; |
582 | t[3] = b[11] * x2 + b[9]; |
583 | t[0] *= x2; |
584 | t[1] *= x2; |
585 | t[2] *= x2; |
586 | t[3] *= x2; |
587 | t[0] += static_cast<V>(a[8]); |
588 | t[1] += static_cast<V>(a[7]); |
589 | t[2] += static_cast<V>(b[8]); |
590 | t[3] += static_cast<V>(b[7]); |
591 | t[0] *= x2; |
592 | t[1] *= x2; |
593 | t[2] *= x2; |
594 | t[3] *= x2; |
595 | t[0] += static_cast<V>(a[6]); |
596 | t[1] += static_cast<V>(a[5]); |
597 | t[2] += static_cast<V>(b[6]); |
598 | t[3] += static_cast<V>(b[5]); |
599 | t[0] *= x2; |
600 | t[1] *= x2; |
601 | t[2] *= x2; |
602 | t[3] *= x2; |
603 | t[0] += static_cast<V>(a[4]); |
604 | t[1] += static_cast<V>(a[3]); |
605 | t[2] += static_cast<V>(b[4]); |
606 | t[3] += static_cast<V>(b[3]); |
607 | t[0] *= x2; |
608 | t[1] *= x2; |
609 | t[2] *= x2; |
610 | t[3] *= x2; |
611 | t[0] += static_cast<V>(a[2]); |
612 | t[1] += static_cast<V>(a[1]); |
613 | t[2] += static_cast<V>(b[2]); |
614 | t[3] += static_cast<V>(b[1]); |
615 | t[0] *= x2; |
616 | t[2] *= x2; |
617 | t[0] += static_cast<V>(a[0]); |
618 | t[2] += static_cast<V>(b[0]); |
619 | t[1] *= x; |
620 | t[3] *= x; |
621 | return (t[0] + t[1]) / (t[2] + t[3]); |
622 | } |
623 | else |
624 | { |
625 | V z = 1 / x; |
626 | V z2 = 1 / (x * x); |
627 | V t[4]; |
628 | t[0] = a[0] * z2 + a[2]; |
629 | t[1] = a[1] * z2 + a[3]; |
630 | t[2] = b[0] * z2 + b[2]; |
631 | t[3] = b[1] * z2 + b[3]; |
632 | t[0] *= z2; |
633 | t[1] *= z2; |
634 | t[2] *= z2; |
635 | t[3] *= z2; |
636 | t[0] += static_cast<V>(a[4]); |
637 | t[1] += static_cast<V>(a[5]); |
638 | t[2] += static_cast<V>(b[4]); |
639 | t[3] += static_cast<V>(b[5]); |
640 | t[0] *= z2; |
641 | t[1] *= z2; |
642 | t[2] *= z2; |
643 | t[3] *= z2; |
644 | t[0] += static_cast<V>(a[6]); |
645 | t[1] += static_cast<V>(a[7]); |
646 | t[2] += static_cast<V>(b[6]); |
647 | t[3] += static_cast<V>(b[7]); |
648 | t[0] *= z2; |
649 | t[1] *= z2; |
650 | t[2] *= z2; |
651 | t[3] *= z2; |
652 | t[0] += static_cast<V>(a[8]); |
653 | t[1] += static_cast<V>(a[9]); |
654 | t[2] += static_cast<V>(b[8]); |
655 | t[3] += static_cast<V>(b[9]); |
656 | t[0] *= z2; |
657 | t[1] *= z2; |
658 | t[2] *= z2; |
659 | t[3] *= z2; |
660 | t[0] += static_cast<V>(a[10]); |
661 | t[1] += static_cast<V>(a[11]); |
662 | t[2] += static_cast<V>(b[10]); |
663 | t[3] += static_cast<V>(b[11]); |
664 | t[0] *= z2; |
665 | t[2] *= z2; |
666 | t[0] += static_cast<V>(a[12]); |
667 | t[2] += static_cast<V>(b[12]); |
668 | t[1] *= z; |
669 | t[3] *= z; |
670 | return (t[0] + t[1]) / (t[2] + t[3]); |
671 | } |
672 | } |
673 | |
674 | template <class T, class U, class V> |
675 | inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::integral_constant<int, 14>*) BOOST_MATH_NOEXCEPT(V) |
676 | { |
677 | if(x <= 1) |
678 | { |
679 | V x2 = x * x; |
680 | V t[4]; |
681 | t[0] = a[13] * x2 + a[11]; |
682 | t[1] = a[12] * x2 + a[10]; |
683 | t[2] = b[13] * x2 + b[11]; |
684 | t[3] = b[12] * x2 + b[10]; |
685 | t[0] *= x2; |
686 | t[1] *= x2; |
687 | t[2] *= x2; |
688 | t[3] *= x2; |
689 | t[0] += static_cast<V>(a[9]); |
690 | t[1] += static_cast<V>(a[8]); |
691 | t[2] += static_cast<V>(b[9]); |
692 | t[3] += static_cast<V>(b[8]); |
693 | t[0] *= x2; |
694 | t[1] *= x2; |
695 | t[2] *= x2; |
696 | t[3] *= x2; |
697 | t[0] += static_cast<V>(a[7]); |
698 | t[1] += static_cast<V>(a[6]); |
699 | t[2] += static_cast<V>(b[7]); |
700 | t[3] += static_cast<V>(b[6]); |
701 | t[0] *= x2; |
702 | t[1] *= x2; |
703 | t[2] *= x2; |
704 | t[3] *= x2; |
705 | t[0] += static_cast<V>(a[5]); |
706 | t[1] += static_cast<V>(a[4]); |
707 | t[2] += static_cast<V>(b[5]); |
708 | t[3] += static_cast<V>(b[4]); |
709 | t[0] *= x2; |
710 | t[1] *= x2; |
711 | t[2] *= x2; |
712 | t[3] *= x2; |
713 | t[0] += static_cast<V>(a[3]); |
714 | t[1] += static_cast<V>(a[2]); |
715 | t[2] += static_cast<V>(b[3]); |
716 | t[3] += static_cast<V>(b[2]); |
717 | t[0] *= x2; |
718 | t[1] *= x2; |
719 | t[2] *= x2; |
720 | t[3] *= x2; |
721 | t[0] += static_cast<V>(a[1]); |
722 | t[1] += static_cast<V>(a[0]); |
723 | t[2] += static_cast<V>(b[1]); |
724 | t[3] += static_cast<V>(b[0]); |
725 | t[0] *= x; |
726 | t[2] *= x; |
727 | return (t[0] + t[1]) / (t[2] + t[3]); |
728 | } |
729 | else |
730 | { |
731 | V z = 1 / x; |
732 | V z2 = 1 / (x * x); |
733 | V t[4]; |
734 | t[0] = a[0] * z2 + a[2]; |
735 | t[1] = a[1] * z2 + a[3]; |
736 | t[2] = b[0] * z2 + b[2]; |
737 | t[3] = b[1] * z2 + b[3]; |
738 | t[0] *= z2; |
739 | t[1] *= z2; |
740 | t[2] *= z2; |
741 | t[3] *= z2; |
742 | t[0] += static_cast<V>(a[4]); |
743 | t[1] += static_cast<V>(a[5]); |
744 | t[2] += static_cast<V>(b[4]); |
745 | t[3] += static_cast<V>(b[5]); |
746 | t[0] *= z2; |
747 | t[1] *= z2; |
748 | t[2] *= z2; |
749 | t[3] *= z2; |
750 | t[0] += static_cast<V>(a[6]); |
751 | t[1] += static_cast<V>(a[7]); |
752 | t[2] += static_cast<V>(b[6]); |
753 | t[3] += static_cast<V>(b[7]); |
754 | t[0] *= z2; |
755 | t[1] *= z2; |
756 | t[2] *= z2; |
757 | t[3] *= z2; |
758 | t[0] += static_cast<V>(a[8]); |
759 | t[1] += static_cast<V>(a[9]); |
760 | t[2] += static_cast<V>(b[8]); |
761 | t[3] += static_cast<V>(b[9]); |
762 | t[0] *= z2; |
763 | t[1] *= z2; |
764 | t[2] *= z2; |
765 | t[3] *= z2; |
766 | t[0] += static_cast<V>(a[10]); |
767 | t[1] += static_cast<V>(a[11]); |
768 | t[2] += static_cast<V>(b[10]); |
769 | t[3] += static_cast<V>(b[11]); |
770 | t[0] *= z2; |
771 | t[1] *= z2; |
772 | t[2] *= z2; |
773 | t[3] *= z2; |
774 | t[0] += static_cast<V>(a[12]); |
775 | t[1] += static_cast<V>(a[13]); |
776 | t[2] += static_cast<V>(b[12]); |
777 | t[3] += static_cast<V>(b[13]); |
778 | t[0] *= z; |
779 | t[2] *= z; |
780 | return (t[0] + t[1]) / (t[2] + t[3]); |
781 | } |
782 | } |
783 | |
784 | template <class T, class U, class V> |
785 | inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::integral_constant<int, 15>*) BOOST_MATH_NOEXCEPT(V) |
786 | { |
787 | if(x <= 1) |
788 | { |
789 | V x2 = x * x; |
790 | V t[4]; |
791 | t[0] = a[14] * x2 + a[12]; |
792 | t[1] = a[13] * x2 + a[11]; |
793 | t[2] = b[14] * x2 + b[12]; |
794 | t[3] = b[13] * x2 + b[11]; |
795 | t[0] *= x2; |
796 | t[1] *= x2; |
797 | t[2] *= x2; |
798 | t[3] *= x2; |
799 | t[0] += static_cast<V>(a[10]); |
800 | t[1] += static_cast<V>(a[9]); |
801 | t[2] += static_cast<V>(b[10]); |
802 | t[3] += static_cast<V>(b[9]); |
803 | t[0] *= x2; |
804 | t[1] *= x2; |
805 | t[2] *= x2; |
806 | t[3] *= x2; |
807 | t[0] += static_cast<V>(a[8]); |
808 | t[1] += static_cast<V>(a[7]); |
809 | t[2] += static_cast<V>(b[8]); |
810 | t[3] += static_cast<V>(b[7]); |
811 | t[0] *= x2; |
812 | t[1] *= x2; |
813 | t[2] *= x2; |
814 | t[3] *= x2; |
815 | t[0] += static_cast<V>(a[6]); |
816 | t[1] += static_cast<V>(a[5]); |
817 | t[2] += static_cast<V>(b[6]); |
818 | t[3] += static_cast<V>(b[5]); |
819 | t[0] *= x2; |
820 | t[1] *= x2; |
821 | t[2] *= x2; |
822 | t[3] *= x2; |
823 | t[0] += static_cast<V>(a[4]); |
824 | t[1] += static_cast<V>(a[3]); |
825 | t[2] += static_cast<V>(b[4]); |
826 | t[3] += static_cast<V>(b[3]); |
827 | t[0] *= x2; |
828 | t[1] *= x2; |
829 | t[2] *= x2; |
830 | t[3] *= x2; |
831 | t[0] += static_cast<V>(a[2]); |
832 | t[1] += static_cast<V>(a[1]); |
833 | t[2] += static_cast<V>(b[2]); |
834 | t[3] += static_cast<V>(b[1]); |
835 | t[0] *= x2; |
836 | t[2] *= x2; |
837 | t[0] += static_cast<V>(a[0]); |
838 | t[2] += static_cast<V>(b[0]); |
839 | t[1] *= x; |
840 | t[3] *= x; |
841 | return (t[0] + t[1]) / (t[2] + t[3]); |
842 | } |
843 | else |
844 | { |
845 | V z = 1 / x; |
846 | V z2 = 1 / (x * x); |
847 | V t[4]; |
848 | t[0] = a[0] * z2 + a[2]; |
849 | t[1] = a[1] * z2 + a[3]; |
850 | t[2] = b[0] * z2 + b[2]; |
851 | t[3] = b[1] * z2 + b[3]; |
852 | t[0] *= z2; |
853 | t[1] *= z2; |
854 | t[2] *= z2; |
855 | t[3] *= z2; |
856 | t[0] += static_cast<V>(a[4]); |
857 | t[1] += static_cast<V>(a[5]); |
858 | t[2] += static_cast<V>(b[4]); |
859 | t[3] += static_cast<V>(b[5]); |
860 | t[0] *= z2; |
861 | t[1] *= z2; |
862 | t[2] *= z2; |
863 | t[3] *= z2; |
864 | t[0] += static_cast<V>(a[6]); |
865 | t[1] += static_cast<V>(a[7]); |
866 | t[2] += static_cast<V>(b[6]); |
867 | t[3] += static_cast<V>(b[7]); |
868 | t[0] *= z2; |
869 | t[1] *= z2; |
870 | t[2] *= z2; |
871 | t[3] *= z2; |
872 | t[0] += static_cast<V>(a[8]); |
873 | t[1] += static_cast<V>(a[9]); |
874 | t[2] += static_cast<V>(b[8]); |
875 | t[3] += static_cast<V>(b[9]); |
876 | t[0] *= z2; |
877 | t[1] *= z2; |
878 | t[2] *= z2; |
879 | t[3] *= z2; |
880 | t[0] += static_cast<V>(a[10]); |
881 | t[1] += static_cast<V>(a[11]); |
882 | t[2] += static_cast<V>(b[10]); |
883 | t[3] += static_cast<V>(b[11]); |
884 | t[0] *= z2; |
885 | t[1] *= z2; |
886 | t[2] *= z2; |
887 | t[3] *= z2; |
888 | t[0] += static_cast<V>(a[12]); |
889 | t[1] += static_cast<V>(a[13]); |
890 | t[2] += static_cast<V>(b[12]); |
891 | t[3] += static_cast<V>(b[13]); |
892 | t[0] *= z2; |
893 | t[2] *= z2; |
894 | t[0] += static_cast<V>(a[14]); |
895 | t[2] += static_cast<V>(b[14]); |
896 | t[1] *= z; |
897 | t[3] *= z; |
898 | return (t[0] + t[1]) / (t[2] + t[3]); |
899 | } |
900 | } |
901 | |
902 | template <class T, class U, class V> |
903 | inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::integral_constant<int, 16>*) BOOST_MATH_NOEXCEPT(V) |
904 | { |
905 | if(x <= 1) |
906 | { |
907 | V x2 = x * x; |
908 | V t[4]; |
909 | t[0] = a[15] * x2 + a[13]; |
910 | t[1] = a[14] * x2 + a[12]; |
911 | t[2] = b[15] * x2 + b[13]; |
912 | t[3] = b[14] * x2 + b[12]; |
913 | t[0] *= x2; |
914 | t[1] *= x2; |
915 | t[2] *= x2; |
916 | t[3] *= x2; |
917 | t[0] += static_cast<V>(a[11]); |
918 | t[1] += static_cast<V>(a[10]); |
919 | t[2] += static_cast<V>(b[11]); |
920 | t[3] += static_cast<V>(b[10]); |
921 | t[0] *= x2; |
922 | t[1] *= x2; |
923 | t[2] *= x2; |
924 | t[3] *= x2; |
925 | t[0] += static_cast<V>(a[9]); |
926 | t[1] += static_cast<V>(a[8]); |
927 | t[2] += static_cast<V>(b[9]); |
928 | t[3] += static_cast<V>(b[8]); |
929 | t[0] *= x2; |
930 | t[1] *= x2; |
931 | t[2] *= x2; |
932 | t[3] *= x2; |
933 | t[0] += static_cast<V>(a[7]); |
934 | t[1] += static_cast<V>(a[6]); |
935 | t[2] += static_cast<V>(b[7]); |
936 | t[3] += static_cast<V>(b[6]); |
937 | t[0] *= x2; |
938 | t[1] *= x2; |
939 | t[2] *= x2; |
940 | t[3] *= x2; |
941 | t[0] += static_cast<V>(a[5]); |
942 | t[1] += static_cast<V>(a[4]); |
943 | t[2] += static_cast<V>(b[5]); |
944 | t[3] += static_cast<V>(b[4]); |
945 | t[0] *= x2; |
946 | t[1] *= x2; |
947 | t[2] *= x2; |
948 | t[3] *= x2; |
949 | t[0] += static_cast<V>(a[3]); |
950 | t[1] += static_cast<V>(a[2]); |
951 | t[2] += static_cast<V>(b[3]); |
952 | t[3] += static_cast<V>(b[2]); |
953 | t[0] *= x2; |
954 | t[1] *= x2; |
955 | t[2] *= x2; |
956 | t[3] *= x2; |
957 | t[0] += static_cast<V>(a[1]); |
958 | t[1] += static_cast<V>(a[0]); |
959 | t[2] += static_cast<V>(b[1]); |
960 | t[3] += static_cast<V>(b[0]); |
961 | t[0] *= x; |
962 | t[2] *= x; |
963 | return (t[0] + t[1]) / (t[2] + t[3]); |
964 | } |
965 | else |
966 | { |
967 | V z = 1 / x; |
968 | V z2 = 1 / (x * x); |
969 | V t[4]; |
970 | t[0] = a[0] * z2 + a[2]; |
971 | t[1] = a[1] * z2 + a[3]; |
972 | t[2] = b[0] * z2 + b[2]; |
973 | t[3] = b[1] * z2 + b[3]; |
974 | t[0] *= z2; |
975 | t[1] *= z2; |
976 | t[2] *= z2; |
977 | t[3] *= z2; |
978 | t[0] += static_cast<V>(a[4]); |
979 | t[1] += static_cast<V>(a[5]); |
980 | t[2] += static_cast<V>(b[4]); |
981 | t[3] += static_cast<V>(b[5]); |
982 | t[0] *= z2; |
983 | t[1] *= z2; |
984 | t[2] *= z2; |
985 | t[3] *= z2; |
986 | t[0] += static_cast<V>(a[6]); |
987 | t[1] += static_cast<V>(a[7]); |
988 | t[2] += static_cast<V>(b[6]); |
989 | t[3] += static_cast<V>(b[7]); |
990 | t[0] *= z2; |
991 | t[1] *= z2; |
992 | t[2] *= z2; |
993 | t[3] *= z2; |
994 | t[0] += static_cast<V>(a[8]); |
995 | t[1] += static_cast<V>(a[9]); |
996 | t[2] += static_cast<V>(b[8]); |
997 | t[3] += static_cast<V>(b[9]); |
998 | t[0] *= z2; |
999 | t[1] *= z2; |
1000 | t[2] *= z2; |
1001 | t[3] *= z2; |
1002 | t[0] += static_cast<V>(a[10]); |
1003 | t[1] += static_cast<V>(a[11]); |
1004 | t[2] += static_cast<V>(b[10]); |
1005 | t[3] += static_cast<V>(b[11]); |
1006 | t[0] *= z2; |
1007 | t[1] *= z2; |
1008 | t[2] *= z2; |
1009 | t[3] *= z2; |
1010 | t[0] += static_cast<V>(a[12]); |
1011 | t[1] += static_cast<V>(a[13]); |
1012 | t[2] += static_cast<V>(b[12]); |
1013 | t[3] += static_cast<V>(b[13]); |
1014 | t[0] *= z2; |
1015 | t[1] *= z2; |
1016 | t[2] *= z2; |
1017 | t[3] *= z2; |
1018 | t[0] += static_cast<V>(a[14]); |
1019 | t[1] += static_cast<V>(a[15]); |
1020 | t[2] += static_cast<V>(b[14]); |
1021 | t[3] += static_cast<V>(b[15]); |
1022 | t[0] *= z; |
1023 | t[2] *= z; |
1024 | return (t[0] + t[1]) / (t[2] + t[3]); |
1025 | } |
1026 | } |
1027 | |
1028 | template <class T, class U, class V> |
1029 | inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::integral_constant<int, 17>*) BOOST_MATH_NOEXCEPT(V) |
1030 | { |
1031 | if(x <= 1) |
1032 | { |
1033 | V x2 = x * x; |
1034 | V t[4]; |
1035 | t[0] = a[16] * x2 + a[14]; |
1036 | t[1] = a[15] * x2 + a[13]; |
1037 | t[2] = b[16] * x2 + b[14]; |
1038 | t[3] = b[15] * x2 + b[13]; |
1039 | t[0] *= x2; |
1040 | t[1] *= x2; |
1041 | t[2] *= x2; |
1042 | t[3] *= x2; |
1043 | t[0] += static_cast<V>(a[12]); |
1044 | t[1] += static_cast<V>(a[11]); |
1045 | t[2] += static_cast<V>(b[12]); |
1046 | t[3] += static_cast<V>(b[11]); |
1047 | t[0] *= x2; |
1048 | t[1] *= x2; |
1049 | t[2] *= x2; |
1050 | t[3] *= x2; |
1051 | t[0] += static_cast<V>(a[10]); |
1052 | t[1] += static_cast<V>(a[9]); |
1053 | t[2] += static_cast<V>(b[10]); |
1054 | t[3] += static_cast<V>(b[9]); |
1055 | t[0] *= x2; |
1056 | t[1] *= x2; |
1057 | t[2] *= x2; |
1058 | t[3] *= x2; |
1059 | t[0] += static_cast<V>(a[8]); |
1060 | t[1] += static_cast<V>(a[7]); |
1061 | t[2] += static_cast<V>(b[8]); |
1062 | t[3] += static_cast<V>(b[7]); |
1063 | t[0] *= x2; |
1064 | t[1] *= x2; |
1065 | t[2] *= x2; |
1066 | t[3] *= x2; |
1067 | t[0] += static_cast<V>(a[6]); |
1068 | t[1] += static_cast<V>(a[5]); |
1069 | t[2] += static_cast<V>(b[6]); |
1070 | t[3] += static_cast<V>(b[5]); |
1071 | t[0] *= x2; |
1072 | t[1] *= x2; |
1073 | t[2] *= x2; |
1074 | t[3] *= x2; |
1075 | t[0] += static_cast<V>(a[4]); |
1076 | t[1] += static_cast<V>(a[3]); |
1077 | t[2] += static_cast<V>(b[4]); |
1078 | t[3] += static_cast<V>(b[3]); |
1079 | t[0] *= x2; |
1080 | t[1] *= x2; |
1081 | t[2] *= x2; |
1082 | t[3] *= x2; |
1083 | t[0] += static_cast<V>(a[2]); |
1084 | t[1] += static_cast<V>(a[1]); |
1085 | t[2] += static_cast<V>(b[2]); |
1086 | t[3] += static_cast<V>(b[1]); |
1087 | t[0] *= x2; |
1088 | t[2] *= x2; |
1089 | t[0] += static_cast<V>(a[0]); |
1090 | t[2] += static_cast<V>(b[0]); |
1091 | t[1] *= x; |
1092 | t[3] *= x; |
1093 | return (t[0] + t[1]) / (t[2] + t[3]); |
1094 | } |
1095 | else |
1096 | { |
1097 | V z = 1 / x; |
1098 | V z2 = 1 / (x * x); |
1099 | V t[4]; |
1100 | t[0] = a[0] * z2 + a[2]; |
1101 | t[1] = a[1] * z2 + a[3]; |
1102 | t[2] = b[0] * z2 + b[2]; |
1103 | t[3] = b[1] * z2 + b[3]; |
1104 | t[0] *= z2; |
1105 | t[1] *= z2; |
1106 | t[2] *= z2; |
1107 | t[3] *= z2; |
1108 | t[0] += static_cast<V>(a[4]); |
1109 | t[1] += static_cast<V>(a[5]); |
1110 | t[2] += static_cast<V>(b[4]); |
1111 | t[3] += static_cast<V>(b[5]); |
1112 | t[0] *= z2; |
1113 | t[1] *= z2; |
1114 | t[2] *= z2; |
1115 | t[3] *= z2; |
1116 | t[0] += static_cast<V>(a[6]); |
1117 | t[1] += static_cast<V>(a[7]); |
1118 | t[2] += static_cast<V>(b[6]); |
1119 | t[3] += static_cast<V>(b[7]); |
1120 | t[0] *= z2; |
1121 | t[1] *= z2; |
1122 | t[2] *= z2; |
1123 | t[3] *= z2; |
1124 | t[0] += static_cast<V>(a[8]); |
1125 | t[1] += static_cast<V>(a[9]); |
1126 | t[2] += static_cast<V>(b[8]); |
1127 | t[3] += static_cast<V>(b[9]); |
1128 | t[0] *= z2; |
1129 | t[1] *= z2; |
1130 | t[2] *= z2; |
1131 | t[3] *= z2; |
1132 | t[0] += static_cast<V>(a[10]); |
1133 | t[1] += static_cast<V>(a[11]); |
1134 | t[2] += static_cast<V>(b[10]); |
1135 | t[3] += static_cast<V>(b[11]); |
1136 | t[0] *= z2; |
1137 | t[1] *= z2; |
1138 | t[2] *= z2; |
1139 | t[3] *= z2; |
1140 | t[0] += static_cast<V>(a[12]); |
1141 | t[1] += static_cast<V>(a[13]); |
1142 | t[2] += static_cast<V>(b[12]); |
1143 | t[3] += static_cast<V>(b[13]); |
1144 | t[0] *= z2; |
1145 | t[1] *= z2; |
1146 | t[2] *= z2; |
1147 | t[3] *= z2; |
1148 | t[0] += static_cast<V>(a[14]); |
1149 | t[1] += static_cast<V>(a[15]); |
1150 | t[2] += static_cast<V>(b[14]); |
1151 | t[3] += static_cast<V>(b[15]); |
1152 | t[0] *= z2; |
1153 | t[2] *= z2; |
1154 | t[0] += static_cast<V>(a[16]); |
1155 | t[2] += static_cast<V>(b[16]); |
1156 | t[1] *= z; |
1157 | t[3] *= z; |
1158 | return (t[0] + t[1]) / (t[2] + t[3]); |
1159 | } |
1160 | } |
1161 | |
1162 | template <class T, class U, class V> |
1163 | inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::integral_constant<int, 18>*) BOOST_MATH_NOEXCEPT(V) |
1164 | { |
1165 | if(x <= 1) |
1166 | { |
1167 | V x2 = x * x; |
1168 | V t[4]; |
1169 | t[0] = a[17] * x2 + a[15]; |
1170 | t[1] = a[16] * x2 + a[14]; |
1171 | t[2] = b[17] * x2 + b[15]; |
1172 | t[3] = b[16] * x2 + b[14]; |
1173 | t[0] *= x2; |
1174 | t[1] *= x2; |
1175 | t[2] *= x2; |
1176 | t[3] *= x2; |
1177 | t[0] += static_cast<V>(a[13]); |
1178 | t[1] += static_cast<V>(a[12]); |
1179 | t[2] += static_cast<V>(b[13]); |
1180 | t[3] += static_cast<V>(b[12]); |
1181 | t[0] *= x2; |
1182 | t[1] *= x2; |
1183 | t[2] *= x2; |
1184 | t[3] *= x2; |
1185 | t[0] += static_cast<V>(a[11]); |
1186 | t[1] += static_cast<V>(a[10]); |
1187 | t[2] += static_cast<V>(b[11]); |
1188 | t[3] += static_cast<V>(b[10]); |
1189 | t[0] *= x2; |
1190 | t[1] *= x2; |
1191 | t[2] *= x2; |
1192 | t[3] *= x2; |
1193 | t[0] += static_cast<V>(a[9]); |
1194 | t[1] += static_cast<V>(a[8]); |
1195 | t[2] += static_cast<V>(b[9]); |
1196 | t[3] += static_cast<V>(b[8]); |
1197 | t[0] *= x2; |
1198 | t[1] *= x2; |
1199 | t[2] *= x2; |
1200 | t[3] *= x2; |
1201 | t[0] += static_cast<V>(a[7]); |
1202 | t[1] += static_cast<V>(a[6]); |
1203 | t[2] += static_cast<V>(b[7]); |
1204 | t[3] += static_cast<V>(b[6]); |
1205 | t[0] *= x2; |
1206 | t[1] *= x2; |
1207 | t[2] *= x2; |
1208 | t[3] *= x2; |
1209 | t[0] += static_cast<V>(a[5]); |
1210 | t[1] += static_cast<V>(a[4]); |
1211 | t[2] += static_cast<V>(b[5]); |
1212 | t[3] += static_cast<V>(b[4]); |
1213 | t[0] *= x2; |
1214 | t[1] *= x2; |
1215 | t[2] *= x2; |
1216 | t[3] *= x2; |
1217 | t[0] += static_cast<V>(a[3]); |
1218 | t[1] += static_cast<V>(a[2]); |
1219 | t[2] += static_cast<V>(b[3]); |
1220 | t[3] += static_cast<V>(b[2]); |
1221 | t[0] *= x2; |
1222 | t[1] *= x2; |
1223 | t[2] *= x2; |
1224 | t[3] *= x2; |
1225 | t[0] += static_cast<V>(a[1]); |
1226 | t[1] += static_cast<V>(a[0]); |
1227 | t[2] += static_cast<V>(b[1]); |
1228 | t[3] += static_cast<V>(b[0]); |
1229 | t[0] *= x; |
1230 | t[2] *= x; |
1231 | return (t[0] + t[1]) / (t[2] + t[3]); |
1232 | } |
1233 | else |
1234 | { |
1235 | V z = 1 / x; |
1236 | V z2 = 1 / (x * x); |
1237 | V t[4]; |
1238 | t[0] = a[0] * z2 + a[2]; |
1239 | t[1] = a[1] * z2 + a[3]; |
1240 | t[2] = b[0] * z2 + b[2]; |
1241 | t[3] = b[1] * z2 + b[3]; |
1242 | t[0] *= z2; |
1243 | t[1] *= z2; |
1244 | t[2] *= z2; |
1245 | t[3] *= z2; |
1246 | t[0] += static_cast<V>(a[4]); |
1247 | t[1] += static_cast<V>(a[5]); |
1248 | t[2] += static_cast<V>(b[4]); |
1249 | t[3] += static_cast<V>(b[5]); |
1250 | t[0] *= z2; |
1251 | t[1] *= z2; |
1252 | t[2] *= z2; |
1253 | t[3] *= z2; |
1254 | t[0] += static_cast<V>(a[6]); |
1255 | t[1] += static_cast<V>(a[7]); |
1256 | t[2] += static_cast<V>(b[6]); |
1257 | t[3] += static_cast<V>(b[7]); |
1258 | t[0] *= z2; |
1259 | t[1] *= z2; |
1260 | t[2] *= z2; |
1261 | t[3] *= z2; |
1262 | t[0] += static_cast<V>(a[8]); |
1263 | t[1] += static_cast<V>(a[9]); |
1264 | t[2] += static_cast<V>(b[8]); |
1265 | t[3] += static_cast<V>(b[9]); |
1266 | t[0] *= z2; |
1267 | t[1] *= z2; |
1268 | t[2] *= z2; |
1269 | t[3] *= z2; |
1270 | t[0] += static_cast<V>(a[10]); |
1271 | t[1] += static_cast<V>(a[11]); |
1272 | t[2] += static_cast<V>(b[10]); |
1273 | t[3] += static_cast<V>(b[11]); |
1274 | t[0] *= z2; |
1275 | t[1] *= z2; |
1276 | t[2] *= z2; |
1277 | t[3] *= z2; |
1278 | t[0] += static_cast<V>(a[12]); |
1279 | t[1] += static_cast<V>(a[13]); |
1280 | t[2] += static_cast<V>(b[12]); |
1281 | t[3] += static_cast<V>(b[13]); |
1282 | t[0] *= z2; |
1283 | t[1] *= z2; |
1284 | t[2] *= z2; |
1285 | t[3] *= z2; |
1286 | t[0] += static_cast<V>(a[14]); |
1287 | t[1] += static_cast<V>(a[15]); |
1288 | t[2] += static_cast<V>(b[14]); |
1289 | t[3] += static_cast<V>(b[15]); |
1290 | t[0] *= z2; |
1291 | t[1] *= z2; |
1292 | t[2] *= z2; |
1293 | t[3] *= z2; |
1294 | t[0] += static_cast<V>(a[16]); |
1295 | t[1] += static_cast<V>(a[17]); |
1296 | t[2] += static_cast<V>(b[16]); |
1297 | t[3] += static_cast<V>(b[17]); |
1298 | t[0] *= z; |
1299 | t[2] *= z; |
1300 | return (t[0] + t[1]) / (t[2] + t[3]); |
1301 | } |
1302 | } |
1303 | |
1304 | template <class T, class U, class V> |
1305 | inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::integral_constant<int, 19>*) BOOST_MATH_NOEXCEPT(V) |
1306 | { |
1307 | if(x <= 1) |
1308 | { |
1309 | V x2 = x * x; |
1310 | V t[4]; |
1311 | t[0] = a[18] * x2 + a[16]; |
1312 | t[1] = a[17] * x2 + a[15]; |
1313 | t[2] = b[18] * x2 + b[16]; |
1314 | t[3] = b[17] * x2 + b[15]; |
1315 | t[0] *= x2; |
1316 | t[1] *= x2; |
1317 | t[2] *= x2; |
1318 | t[3] *= x2; |
1319 | t[0] += static_cast<V>(a[14]); |
1320 | t[1] += static_cast<V>(a[13]); |
1321 | t[2] += static_cast<V>(b[14]); |
1322 | t[3] += static_cast<V>(b[13]); |
1323 | t[0] *= x2; |
1324 | t[1] *= x2; |
1325 | t[2] *= x2; |
1326 | t[3] *= x2; |
1327 | t[0] += static_cast<V>(a[12]); |
1328 | t[1] += static_cast<V>(a[11]); |
1329 | t[2] += static_cast<V>(b[12]); |
1330 | t[3] += static_cast<V>(b[11]); |
1331 | t[0] *= x2; |
1332 | t[1] *= x2; |
1333 | t[2] *= x2; |
1334 | t[3] *= x2; |
1335 | t[0] += static_cast<V>(a[10]); |
1336 | t[1] += static_cast<V>(a[9]); |
1337 | t[2] += static_cast<V>(b[10]); |
1338 | t[3] += static_cast<V>(b[9]); |
1339 | t[0] *= x2; |
1340 | t[1] *= x2; |
1341 | t[2] *= x2; |
1342 | t[3] *= x2; |
1343 | t[0] += static_cast<V>(a[8]); |
1344 | t[1] += static_cast<V>(a[7]); |
1345 | t[2] += static_cast<V>(b[8]); |
1346 | t[3] += static_cast<V>(b[7]); |
1347 | t[0] *= x2; |
1348 | t[1] *= x2; |
1349 | t[2] *= x2; |
1350 | t[3] *= x2; |
1351 | t[0] += static_cast<V>(a[6]); |
1352 | t[1] += static_cast<V>(a[5]); |
1353 | t[2] += static_cast<V>(b[6]); |
1354 | t[3] += static_cast<V>(b[5]); |
1355 | t[0] *= x2; |
1356 | t[1] *= x2; |
1357 | t[2] *= x2; |
1358 | t[3] *= x2; |
1359 | t[0] += static_cast<V>(a[4]); |
1360 | t[1] += static_cast<V>(a[3]); |
1361 | t[2] += static_cast<V>(b[4]); |
1362 | t[3] += static_cast<V>(b[3]); |
1363 | t[0] *= x2; |
1364 | t[1] *= x2; |
1365 | t[2] *= x2; |
1366 | t[3] *= x2; |
1367 | t[0] += static_cast<V>(a[2]); |
1368 | t[1] += static_cast<V>(a[1]); |
1369 | t[2] += static_cast<V>(b[2]); |
1370 | t[3] += static_cast<V>(b[1]); |
1371 | t[0] *= x2; |
1372 | t[2] *= x2; |
1373 | t[0] += static_cast<V>(a[0]); |
1374 | t[2] += static_cast<V>(b[0]); |
1375 | t[1] *= x; |
1376 | t[3] *= x; |
1377 | return (t[0] + t[1]) / (t[2] + t[3]); |
1378 | } |
1379 | else |
1380 | { |
1381 | V z = 1 / x; |
1382 | V z2 = 1 / (x * x); |
1383 | V t[4]; |
1384 | t[0] = a[0] * z2 + a[2]; |
1385 | t[1] = a[1] * z2 + a[3]; |
1386 | t[2] = b[0] * z2 + b[2]; |
1387 | t[3] = b[1] * z2 + b[3]; |
1388 | t[0] *= z2; |
1389 | t[1] *= z2; |
1390 | t[2] *= z2; |
1391 | t[3] *= z2; |
1392 | t[0] += static_cast<V>(a[4]); |
1393 | t[1] += static_cast<V>(a[5]); |
1394 | t[2] += static_cast<V>(b[4]); |
1395 | t[3] += static_cast<V>(b[5]); |
1396 | t[0] *= z2; |
1397 | t[1] *= z2; |
1398 | t[2] *= z2; |
1399 | t[3] *= z2; |
1400 | t[0] += static_cast<V>(a[6]); |
1401 | t[1] += static_cast<V>(a[7]); |
1402 | t[2] += static_cast<V>(b[6]); |
1403 | t[3] += static_cast<V>(b[7]); |
1404 | t[0] *= z2; |
1405 | t[1] *= z2; |
1406 | t[2] *= z2; |
1407 | t[3] *= z2; |
1408 | t[0] += static_cast<V>(a[8]); |
1409 | t[1] += static_cast<V>(a[9]); |
1410 | t[2] += static_cast<V>(b[8]); |
1411 | t[3] += static_cast<V>(b[9]); |
1412 | t[0] *= z2; |
1413 | t[1] *= z2; |
1414 | t[2] *= z2; |
1415 | t[3] *= z2; |
1416 | t[0] += static_cast<V>(a[10]); |
1417 | t[1] += static_cast<V>(a[11]); |
1418 | t[2] += static_cast<V>(b[10]); |
1419 | t[3] += static_cast<V>(b[11]); |
1420 | t[0] *= z2; |
1421 | t[1] *= z2; |
1422 | t[2] *= z2; |
1423 | t[3] *= z2; |
1424 | t[0] += static_cast<V>(a[12]); |
1425 | t[1] += static_cast<V>(a[13]); |
1426 | t[2] += static_cast<V>(b[12]); |
1427 | t[3] += static_cast<V>(b[13]); |
1428 | t[0] *= z2; |
1429 | t[1] *= z2; |
1430 | t[2] *= z2; |
1431 | t[3] *= z2; |
1432 | t[0] += static_cast<V>(a[14]); |
1433 | t[1] += static_cast<V>(a[15]); |
1434 | t[2] += static_cast<V>(b[14]); |
1435 | t[3] += static_cast<V>(b[15]); |
1436 | t[0] *= z2; |
1437 | t[1] *= z2; |
1438 | t[2] *= z2; |
1439 | t[3] *= z2; |
1440 | t[0] += static_cast<V>(a[16]); |
1441 | t[1] += static_cast<V>(a[17]); |
1442 | t[2] += static_cast<V>(b[16]); |
1443 | t[3] += static_cast<V>(b[17]); |
1444 | t[0] *= z2; |
1445 | t[2] *= z2; |
1446 | t[0] += static_cast<V>(a[18]); |
1447 | t[2] += static_cast<V>(b[18]); |
1448 | t[1] *= z; |
1449 | t[3] *= z; |
1450 | return (t[0] + t[1]) / (t[2] + t[3]); |
1451 | } |
1452 | } |
1453 | |
1454 | template <class T, class U, class V> |
1455 | inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const boost::integral_constant<int, 20>*) BOOST_MATH_NOEXCEPT(V) |
1456 | { |
1457 | if(x <= 1) |
1458 | { |
1459 | V x2 = x * x; |
1460 | V t[4]; |
1461 | t[0] = a[19] * x2 + a[17]; |
1462 | t[1] = a[18] * x2 + a[16]; |
1463 | t[2] = b[19] * x2 + b[17]; |
1464 | t[3] = b[18] * x2 + b[16]; |
1465 | t[0] *= x2; |
1466 | t[1] *= x2; |
1467 | t[2] *= x2; |
1468 | t[3] *= x2; |
1469 | t[0] += static_cast<V>(a[15]); |
1470 | t[1] += static_cast<V>(a[14]); |
1471 | t[2] += static_cast<V>(b[15]); |
1472 | t[3] += static_cast<V>(b[14]); |
1473 | t[0] *= x2; |
1474 | t[1] *= x2; |
1475 | t[2] *= x2; |
1476 | t[3] *= x2; |
1477 | t[0] += static_cast<V>(a[13]); |
1478 | t[1] += static_cast<V>(a[12]); |
1479 | t[2] += static_cast<V>(b[13]); |
1480 | t[3] += static_cast<V>(b[12]); |
1481 | t[0] *= x2; |
1482 | t[1] *= x2; |
1483 | t[2] *= x2; |
1484 | t[3] *= x2; |
1485 | t[0] += static_cast<V>(a[11]); |
1486 | t[1] += static_cast<V>(a[10]); |
1487 | t[2] += static_cast<V>(b[11]); |
1488 | t[3] += static_cast<V>(b[10]); |
1489 | t[0] *= x2; |
1490 | t[1] *= x2; |
1491 | t[2] *= x2; |
1492 | t[3] *= x2; |
1493 | t[0] += static_cast<V>(a[9]); |
1494 | t[1] += static_cast<V>(a[8]); |
1495 | t[2] += static_cast<V>(b[9]); |
1496 | t[3] += static_cast<V>(b[8]); |
1497 | t[0] *= x2; |
1498 | t[1] *= x2; |
1499 | t[2] *= x2; |
1500 | t[3] *= x2; |
1501 | t[0] += static_cast<V>(a[7]); |
1502 | t[1] += static_cast<V>(a[6]); |
1503 | t[2] += static_cast<V>(b[7]); |
1504 | t[3] += static_cast<V>(b[6]); |
1505 | t[0] *= x2; |
1506 | t[1] *= x2; |
1507 | t[2] *= x2; |
1508 | t[3] *= x2; |
1509 | t[0] += static_cast<V>(a[5]); |
1510 | t[1] += static_cast<V>(a[4]); |
1511 | t[2] += static_cast<V>(b[5]); |
1512 | t[3] += static_cast<V>(b[4]); |
1513 | t[0] *= x2; |
1514 | t[1] *= x2; |
1515 | t[2] *= x2; |
1516 | t[3] *= x2; |
1517 | t[0] += static_cast<V>(a[3]); |
1518 | t[1] += static_cast<V>(a[2]); |
1519 | t[2] += static_cast<V>(b[3]); |
1520 | t[3] += static_cast<V>(b[2]); |
1521 | t[0] *= x2; |
1522 | t[1] *= x2; |
1523 | t[2] *= x2; |
1524 | t[3] *= x2; |
1525 | t[0] += static_cast<V>(a[1]); |
1526 | t[1] += static_cast<V>(a[0]); |
1527 | t[2] += static_cast<V>(b[1]); |
1528 | t[3] += static_cast<V>(b[0]); |
1529 | t[0] *= x; |
1530 | t[2] *= x; |
1531 | return (t[0] + t[1]) / (t[2] + t[3]); |
1532 | } |
1533 | else |
1534 | { |
1535 | V z = 1 / x; |
1536 | V z2 = 1 / (x * x); |
1537 | V t[4]; |
1538 | t[0] = a[0] * z2 + a[2]; |
1539 | t[1] = a[1] * z2 + a[3]; |
1540 | t[2] = b[0] * z2 + b[2]; |
1541 | t[3] = b[1] * z2 + b[3]; |
1542 | t[0] *= z2; |
1543 | t[1] *= z2; |
1544 | t[2] *= z2; |
1545 | t[3] *= z2; |
1546 | t[0] += static_cast<V>(a[4]); |
1547 | t[1] += static_cast<V>(a[5]); |
1548 | t[2] += static_cast<V>(b[4]); |
1549 | t[3] += static_cast<V>(b[5]); |
1550 | t[0] *= z2; |
1551 | t[1] *= z2; |
1552 | t[2] *= z2; |
1553 | t[3] *= z2; |
1554 | t[0] += static_cast<V>(a[6]); |
1555 | t[1] += static_cast<V>(a[7]); |
1556 | t[2] += static_cast<V>(b[6]); |
1557 | t[3] += static_cast<V>(b[7]); |
1558 | t[0] *= z2; |
1559 | t[1] *= z2; |
1560 | t[2] *= z2; |
1561 | t[3] *= z2; |
1562 | t[0] += static_cast<V>(a[8]); |
1563 | t[1] += static_cast<V>(a[9]); |
1564 | t[2] += static_cast<V>(b[8]); |
1565 | t[3] += static_cast<V>(b[9]); |
1566 | t[0] *= z2; |
1567 | t[1] *= z2; |
1568 | t[2] *= z2; |
1569 | t[3] *= z2; |
1570 | t[0] += static_cast<V>(a[10]); |
1571 | t[1] += static_cast<V>(a[11]); |
1572 | t[2] += static_cast<V>(b[10]); |
1573 | t[3] += static_cast<V>(b[11]); |
1574 | t[0] *= z2; |
1575 | t[1] *= z2; |
1576 | t[2] *= z2; |
1577 | t[3] *= z2; |
1578 | t[0] += static_cast<V>(a[12]); |
1579 | t[1] += static_cast<V>(a[13]); |
1580 | t[2] += static_cast<V>(b[12]); |
1581 | t[3] += static_cast<V>(b[13]); |
1582 | t[0] *= z2; |
1583 | t[1] *= z2; |
1584 | t[2] *= z2; |
1585 | t[3] *= z2; |
1586 | t[0] += static_cast<V>(a[14]); |
1587 | t[1] += static_cast<V>(a[15]); |
1588 | t[2] += static_cast<V>(b[14]); |
1589 | t[3] += static_cast<V>(b[15]); |
1590 | t[0] *= z2; |
1591 | t[1] *= z2; |
1592 | t[2] *= z2; |
1593 | t[3] *= z2; |
1594 | t[0] += static_cast<V>(a[16]); |
1595 | t[1] += static_cast<V>(a[17]); |
1596 | t[2] += static_cast<V>(b[16]); |
1597 | t[3] += static_cast<V>(b[17]); |
1598 | t[0] *= z2; |
1599 | t[1] *= z2; |
1600 | t[2] *= z2; |
1601 | t[3] *= z2; |
1602 | t[0] += static_cast<V>(a[18]); |
1603 | t[1] += static_cast<V>(a[19]); |
1604 | t[2] += static_cast<V>(b[18]); |
1605 | t[3] += static_cast<V>(b[19]); |
1606 | t[0] *= z; |
1607 | t[2] *= z; |
1608 | return (t[0] + t[1]) / (t[2] + t[3]); |
1609 | } |
1610 | } |
1611 | |
1612 | |
1613 | }}}} // namespaces |
1614 | |
1615 | #endif // include guard |
1616 | |
1617 | |