3 // TODO revise completely for new distribution classes.
5 // Copyright Paul A. Bristow 2006.
6 // Copyright John Maddock 2006.
8 // Use, modification and distribution are subject to the
9 // Boost Software License, Version 1.0.
10 // (See accompanying file LICENSE_1_0.txt
11 // or copy at http://www.boost.org/LICENSE_1_0.txt)
13 // Omnibus list of forward declarations of math special functions.
16 // RT = Real type (built-in floating-point types, float, double, long double) & User Defined Types
17 // AT = Integer or Real type
19 #ifndef BOOST_MATH_SPECIAL_MATH_FWD_HPP
20 #define BOOST_MATH_SPECIAL_MATH_FWD_HPP
26 #include <boost/math/special_functions/detail/round_fwd.hpp>
27 #include <boost/math/tools/promotion.hpp> // for argument promotion.
28 #include <boost/math/policies/policy.hpp>
29 #include <boost/mpl/comparison.hpp>
30 #include <boost/config/no_tr1/complex.hpp>
32 #define BOOST_NO_MACRO_EXPAND /**/
37 { // Math functions (in roughly alphabetic order).
40 template <class RT1, class RT2>
41 typename tools::promote_args<RT1, RT2>::type
42 beta(RT1 a, RT2 b); // Beta function (2 arguments).
44 template <class RT1, class RT2, class A>
45 typename tools::promote_args<RT1, RT2, A>::type
46 beta(RT1 a, RT2 b, A x); // Beta function (3 arguments).
48 template <class RT1, class RT2, class RT3, class Policy>
49 typename tools::promote_args<RT1, RT2, RT3>::type
50 beta(RT1 a, RT2 b, RT3 x, const Policy& pol); // Beta function (3 arguments).
52 template <class RT1, class RT2, class RT3>
53 typename tools::promote_args<RT1, RT2, RT3>::type
54 betac(RT1 a, RT2 b, RT3 x);
56 template <class RT1, class RT2, class RT3, class Policy>
57 typename tools::promote_args<RT1, RT2, RT3>::type
58 betac(RT1 a, RT2 b, RT3 x, const Policy& pol);
60 template <class RT1, class RT2, class RT3>
61 typename tools::promote_args<RT1, RT2, RT3>::type
62 ibeta(RT1 a, RT2 b, RT3 x); // Incomplete beta function.
64 template <class RT1, class RT2, class RT3, class Policy>
65 typename tools::promote_args<RT1, RT2, RT3>::type
66 ibeta(RT1 a, RT2 b, RT3 x, const Policy& pol); // Incomplete beta function.
68 template <class RT1, class RT2, class RT3>
69 typename tools::promote_args<RT1, RT2, RT3>::type
70 ibetac(RT1 a, RT2 b, RT3 x); // Incomplete beta complement function.
72 template <class RT1, class RT2, class RT3, class Policy>
73 typename tools::promote_args<RT1, RT2, RT3>::type
74 ibetac(RT1 a, RT2 b, RT3 x, const Policy& pol); // Incomplete beta complement function.
76 template <class T1, class T2, class T3, class T4>
77 typename tools::promote_args<T1, T2, T3, T4>::type
78 ibeta_inv(T1 a, T2 b, T3 p, T4* py);
80 template <class T1, class T2, class T3, class T4, class Policy>
81 typename tools::promote_args<T1, T2, T3, T4>::type
82 ibeta_inv(T1 a, T2 b, T3 p, T4* py, const Policy& pol);
84 template <class RT1, class RT2, class RT3>
85 typename tools::promote_args<RT1, RT2, RT3>::type
86 ibeta_inv(RT1 a, RT2 b, RT3 p); // Incomplete beta inverse function.
88 template <class RT1, class RT2, class RT3, class Policy>
89 typename tools::promote_args<RT1, RT2, RT3>::type
90 ibeta_inv(RT1 a, RT2 b, RT3 p, const Policy&); // Incomplete beta inverse function.
92 template <class RT1, class RT2, class RT3>
93 typename tools::promote_args<RT1, RT2, RT3>::type
94 ibeta_inva(RT1 a, RT2 b, RT3 p); // Incomplete beta inverse function.
96 template <class RT1, class RT2, class RT3, class Policy>
97 typename tools::promote_args<RT1, RT2, RT3>::type
98 ibeta_inva(RT1 a, RT2 b, RT3 p, const Policy&); // Incomplete beta inverse function.
100 template <class RT1, class RT2, class RT3>
101 typename tools::promote_args<RT1, RT2, RT3>::type
102 ibeta_invb(RT1 a, RT2 b, RT3 p); // Incomplete beta inverse function.
104 template <class RT1, class RT2, class RT3, class Policy>
105 typename tools::promote_args<RT1, RT2, RT3>::type
106 ibeta_invb(RT1 a, RT2 b, RT3 p, const Policy&); // Incomplete beta inverse function.
108 template <class T1, class T2, class T3, class T4>
109 typename tools::promote_args<T1, T2, T3, T4>::type
110 ibetac_inv(T1 a, T2 b, T3 q, T4* py);
112 template <class T1, class T2, class T3, class T4, class Policy>
113 typename tools::promote_args<T1, T2, T3, T4>::type
114 ibetac_inv(T1 a, T2 b, T3 q, T4* py, const Policy& pol);
116 template <class RT1, class RT2, class RT3>
117 typename tools::promote_args<RT1, RT2, RT3>::type
118 ibetac_inv(RT1 a, RT2 b, RT3 q); // Incomplete beta complement inverse function.
120 template <class RT1, class RT2, class RT3, class Policy>
121 typename tools::promote_args<RT1, RT2, RT3>::type
122 ibetac_inv(RT1 a, RT2 b, RT3 q, const Policy&); // Incomplete beta complement inverse function.
124 template <class RT1, class RT2, class RT3>
125 typename tools::promote_args<RT1, RT2, RT3>::type
126 ibetac_inva(RT1 a, RT2 b, RT3 q); // Incomplete beta complement inverse function.
128 template <class RT1, class RT2, class RT3, class Policy>
129 typename tools::promote_args<RT1, RT2, RT3>::type
130 ibetac_inva(RT1 a, RT2 b, RT3 q, const Policy&); // Incomplete beta complement inverse function.
132 template <class RT1, class RT2, class RT3>
133 typename tools::promote_args<RT1, RT2, RT3>::type
134 ibetac_invb(RT1 a, RT2 b, RT3 q); // Incomplete beta complement inverse function.
136 template <class RT1, class RT2, class RT3, class Policy>
137 typename tools::promote_args<RT1, RT2, RT3>::type
138 ibetac_invb(RT1 a, RT2 b, RT3 q, const Policy&); // Incomplete beta complement inverse function.
140 template <class RT1, class RT2, class RT3>
141 typename tools::promote_args<RT1, RT2, RT3>::type
142 ibeta_derivative(RT1 a, RT2 b, RT3 x); // derivative of incomplete beta
144 template <class RT1, class RT2, class RT3, class Policy>
145 typename tools::promote_args<RT1, RT2, RT3>::type
146 ibeta_derivative(RT1 a, RT2 b, RT3 x, const Policy& pol); // derivative of incomplete beta
148 // erf & erfc error functions.
149 template <class RT> // Error function.
150 typename tools::promote_args<RT>::type erf(RT z);
151 template <class RT, class Policy> // Error function.
152 typename tools::promote_args<RT>::type erf(RT z, const Policy&);
154 template <class RT>// Error function complement.
155 typename tools::promote_args<RT>::type erfc(RT z);
156 template <class RT, class Policy>// Error function complement.
157 typename tools::promote_args<RT>::type erfc(RT z, const Policy&);
159 template <class RT>// Error function inverse.
160 typename tools::promote_args<RT>::type erf_inv(RT z);
161 template <class RT, class Policy>// Error function inverse.
162 typename tools::promote_args<RT>::type erf_inv(RT z, const Policy& pol);
164 template <class RT>// Error function complement inverse.
165 typename tools::promote_args<RT>::type erfc_inv(RT z);
166 template <class RT, class Policy>// Error function complement inverse.
167 typename tools::promote_args<RT>::type erfc_inv(RT z, const Policy& pol);
170 template <class T1, class T2, class T3>
171 typename tools::promote_args<T1, T2, T3>::type
172 legendre_next(unsigned l, T1 x, T2 Pl, T3 Plm1);
175 typename tools::promote_args<T>::type
176 legendre_p(int l, T x);
178 template <class T, class Policy>
179 typename tools::promote_args<T>::type
180 legendre_p(int l, T x, const Policy& pol);
183 typename tools::promote_args<T>::type
184 legendre_q(unsigned l, T x);
186 template <class T, class Policy>
187 typename tools::promote_args<T>::type
188 legendre_q(unsigned l, T x, const Policy& pol);
190 template <class T1, class T2, class T3>
191 typename tools::promote_args<T1, T2, T3>::type
192 legendre_next(unsigned l, unsigned m, T1 x, T2 Pl, T3 Plm1);
195 typename tools::promote_args<T>::type
196 legendre_p(int l, int m, T x);
198 template <class T, class Policy>
199 typename tools::promote_args<T>::type
200 legendre_p(int l, int m, T x, const Policy& pol);
202 template <class T1, class T2, class T3>
203 typename tools::promote_args<T1, T2, T3>::type
204 laguerre_next(unsigned n, T1 x, T2 Ln, T3 Lnm1);
206 template <class T1, class T2, class T3>
207 typename tools::promote_args<T1, T2, T3>::type
208 laguerre_next(unsigned n, unsigned l, T1 x, T2 Pl, T3 Plm1);
211 typename tools::promote_args<T>::type
212 laguerre(unsigned n, T x);
214 template <class T, class Policy>
215 typename tools::promote_args<T>::type
216 laguerre(unsigned n, unsigned m, T x, const Policy& pol);
218 template <class T1, class T2>
219 struct laguerre_result
221 typedef typename mpl::if_<
222 policies::is_policy<T2>,
223 typename tools::promote_args<T1>::type,
224 typename tools::promote_args<T2>::type
228 template <class T1, class T2>
229 typename laguerre_result<T1, T2>::type
230 laguerre(unsigned n, T1 m, T2 x);
233 typename tools::promote_args<T>::type
234 hermite(unsigned n, T x);
236 template <class T, class Policy>
237 typename tools::promote_args<T>::type
238 hermite(unsigned n, T x, const Policy& pol);
240 template <class T1, class T2, class T3>
241 typename tools::promote_args<T1, T2, T3>::type
242 hermite_next(unsigned n, T1 x, T2 Hn, T3 Hnm1);
244 template <class T1, class T2>
245 std::complex<typename tools::promote_args<T1, T2>::type>
246 spherical_harmonic(unsigned n, int m, T1 theta, T2 phi);
248 template <class T1, class T2, class Policy>
249 std::complex<typename tools::promote_args<T1, T2>::type>
250 spherical_harmonic(unsigned n, int m, T1 theta, T2 phi, const Policy& pol);
252 template <class T1, class T2>
253 typename tools::promote_args<T1, T2>::type
254 spherical_harmonic_r(unsigned n, int m, T1 theta, T2 phi);
256 template <class T1, class T2, class Policy>
257 typename tools::promote_args<T1, T2>::type
258 spherical_harmonic_r(unsigned n, int m, T1 theta, T2 phi, const Policy& pol);
260 template <class T1, class T2>
261 typename tools::promote_args<T1, T2>::type
262 spherical_harmonic_i(unsigned n, int m, T1 theta, T2 phi);
264 template <class T1, class T2, class Policy>
265 typename tools::promote_args<T1, T2>::type
266 spherical_harmonic_i(unsigned n, int m, T1 theta, T2 phi, const Policy& pol);
268 // Elliptic integrals:
269 template <class T1, class T2, class T3>
270 typename tools::promote_args<T1, T2, T3>::type
271 ellint_rf(T1 x, T2 y, T3 z);
273 template <class T1, class T2, class T3, class Policy>
274 typename tools::promote_args<T1, T2, T3>::type
275 ellint_rf(T1 x, T2 y, T3 z, const Policy& pol);
277 template <class T1, class T2, class T3>
278 typename tools::promote_args<T1, T2, T3>::type
279 ellint_rd(T1 x, T2 y, T3 z);
281 template <class T1, class T2, class T3, class Policy>
282 typename tools::promote_args<T1, T2, T3>::type
283 ellint_rd(T1 x, T2 y, T3 z, const Policy& pol);
285 template <class T1, class T2>
286 typename tools::promote_args<T1, T2>::type
287 ellint_rc(T1 x, T2 y);
289 template <class T1, class T2, class Policy>
290 typename tools::promote_args<T1, T2>::type
291 ellint_rc(T1 x, T2 y, const Policy& pol);
293 template <class T1, class T2, class T3, class T4>
294 typename tools::promote_args<T1, T2, T3, T4>::type
295 ellint_rj(T1 x, T2 y, T3 z, T4 p);
297 template <class T1, class T2, class T3, class T4, class Policy>
298 typename tools::promote_args<T1, T2, T3, T4>::type
299 ellint_rj(T1 x, T2 y, T3 z, T4 p, const Policy& pol);
301 template <typename T>
302 typename tools::promote_args<T>::type ellint_2(T k);
304 template <class T1, class T2>
305 typename tools::promote_args<T1, T2>::type ellint_2(T1 k, T2 phi);
307 template <class T1, class T2, class Policy>
308 typename tools::promote_args<T1, T2>::type ellint_2(T1 k, T2 phi, const Policy& pol);
310 template <typename T>
311 typename tools::promote_args<T>::type ellint_1(T k);
313 template <class T1, class T2>
314 typename tools::promote_args<T1, T2>::type ellint_1(T1 k, T2 phi);
316 template <class T1, class T2, class Policy>
317 typename tools::promote_args<T1, T2>::type ellint_1(T1 k, T2 phi, const Policy& pol);
321 template <class T, class U, class V>
322 struct ellint_3_result
324 typedef typename mpl::if_<
325 policies::is_policy<V>,
326 typename tools::promote_args<T, U>::type,
327 typename tools::promote_args<T, U, V>::type
331 } // namespace detail
334 template <class T1, class T2, class T3>
335 typename detail::ellint_3_result<T1, T2, T3>::type ellint_3(T1 k, T2 v, T3 phi);
337 template <class T1, class T2, class T3, class Policy>
338 typename tools::promote_args<T1, T2, T3>::type ellint_3(T1 k, T2 v, T3 phi, const Policy& pol);
340 template <class T1, class T2>
341 typename tools::promote_args<T1, T2>::type ellint_3(T1 k, T2 v);
343 // Factorial functions.
344 // Note: not for integral types, at present.
346 struct max_factorial;
348 RT factorial(unsigned int);
349 template <class RT, class Policy>
350 RT factorial(unsigned int, const Policy& pol);
352 RT unchecked_factorial(unsigned int BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(RT));
354 RT double_factorial(unsigned i);
355 template <class RT, class Policy>
356 RT double_factorial(unsigned i, const Policy& pol);
359 typename tools::promote_args<RT>::type falling_factorial(RT x, unsigned n);
361 template <class RT, class Policy>
362 typename tools::promote_args<RT>::type falling_factorial(RT x, unsigned n, const Policy& pol);
365 typename tools::promote_args<RT>::type rising_factorial(RT x, int n);
367 template <class RT, class Policy>
368 typename tools::promote_args<RT>::type rising_factorial(RT x, int n, const Policy& pol);
372 typename tools::promote_args<RT>::type tgamma(RT z);
375 typename tools::promote_args<RT>::type tgamma1pm1(RT z);
377 template <class RT, class Policy>
378 typename tools::promote_args<RT>::type tgamma1pm1(RT z, const Policy& pol);
380 template <class RT1, class RT2>
381 typename tools::promote_args<RT1, RT2>::type tgamma(RT1 a, RT2 z);
383 template <class RT1, class RT2, class Policy>
384 typename tools::promote_args<RT1, RT2>::type tgamma(RT1 a, RT2 z, const Policy& pol);
387 typename tools::promote_args<RT>::type lgamma(RT z, int* sign);
389 template <class RT, class Policy>
390 typename tools::promote_args<RT>::type lgamma(RT z, int* sign, const Policy& pol);
393 typename tools::promote_args<RT>::type lgamma(RT x);
395 template <class RT, class Policy>
396 typename tools::promote_args<RT>::type lgamma(RT x, const Policy& pol);
398 template <class RT1, class RT2>
399 typename tools::promote_args<RT1, RT2>::type tgamma_lower(RT1 a, RT2 z);
401 template <class RT1, class RT2, class Policy>
402 typename tools::promote_args<RT1, RT2>::type tgamma_lower(RT1 a, RT2 z, const Policy&);
404 template <class RT1, class RT2>
405 typename tools::promote_args<RT1, RT2>::type gamma_q(RT1 a, RT2 z);
407 template <class RT1, class RT2, class Policy>
408 typename tools::promote_args<RT1, RT2>::type gamma_q(RT1 a, RT2 z, const Policy&);
410 template <class RT1, class RT2>
411 typename tools::promote_args<RT1, RT2>::type gamma_p(RT1 a, RT2 z);
413 template <class RT1, class RT2, class Policy>
414 typename tools::promote_args<RT1, RT2>::type gamma_p(RT1 a, RT2 z, const Policy&);
416 template <class T1, class T2>
417 typename tools::promote_args<T1, T2>::type tgamma_delta_ratio(T1 z, T2 delta);
419 template <class T1, class T2, class Policy>
420 typename tools::promote_args<T1, T2>::type tgamma_delta_ratio(T1 z, T2 delta, const Policy&);
422 template <class T1, class T2>
423 typename tools::promote_args<T1, T2>::type tgamma_ratio(T1 a, T2 b);
425 template <class T1, class T2, class Policy>
426 typename tools::promote_args<T1, T2>::type tgamma_ratio(T1 a, T2 b, const Policy&);
428 template <class T1, class T2>
429 typename tools::promote_args<T1, T2>::type gamma_p_derivative(T1 a, T2 x);
431 template <class T1, class T2, class Policy>
432 typename tools::promote_args<T1, T2>::type gamma_p_derivative(T1 a, T2 x, const Policy&);
435 template <class T1, class T2>
436 typename tools::promote_args<T1, T2>::type gamma_p_inv(T1 a, T2 p);
438 template <class T1, class T2, class Policy>
439 typename tools::promote_args<T1, T2>::type gamma_p_inva(T1 a, T2 p, const Policy&);
441 template <class T1, class T2>
442 typename tools::promote_args<T1, T2>::type gamma_p_inva(T1 a, T2 p);
444 template <class T1, class T2, class Policy>
445 typename tools::promote_args<T1, T2>::type gamma_p_inv(T1 a, T2 p, const Policy&);
447 template <class T1, class T2>
448 typename tools::promote_args<T1, T2>::type gamma_q_inv(T1 a, T2 q);
450 template <class T1, class T2, class Policy>
451 typename tools::promote_args<T1, T2>::type gamma_q_inv(T1 a, T2 q, const Policy&);
453 template <class T1, class T2>
454 typename tools::promote_args<T1, T2>::type gamma_q_inva(T1 a, T2 q);
456 template <class T1, class T2, class Policy>
457 typename tools::promote_args<T1, T2>::type gamma_q_inva(T1 a, T2 q, const Policy&);
461 typename tools::promote_args<T>::type digamma(T x);
463 template <class T, class Policy>
464 typename tools::promote_args<T>::type digamma(T x, const Policy&);
466 // Hypotenuse function sqrt(x ^ 2 + y ^ 2).
467 template <class T1, class T2>
468 typename tools::promote_args<T1, T2>::type
471 template <class T1, class T2, class Policy>
472 typename tools::promote_args<T1, T2>::type
473 hypot(T1 x, T2 y, const Policy&);
477 typename tools::promote_args<RT>::type cbrt(RT z);
479 template <class RT, class Policy>
480 typename tools::promote_args<RT>::type cbrt(RT z, const Policy&);
482 // log1p is log(x + 1)
484 typename tools::promote_args<T>::type log1p(T);
486 template <class T, class Policy>
487 typename tools::promote_args<T>::type log1p(T, const Policy&);
489 // log1pmx is log(x + 1) - x
491 typename tools::promote_args<T>::type log1pmx(T);
493 template <class T, class Policy>
494 typename tools::promote_args<T>::type log1pmx(T, const Policy&);
496 // Exp (x) minus 1 functions.
498 typename tools::promote_args<T>::type expm1(T);
500 template <class T, class Policy>
501 typename tools::promote_args<T>::type expm1(T, const Policy&);
504 template <class T1, class T2>
505 typename tools::promote_args<T1, T2>::type
506 powm1(const T1 a, const T2 z);
508 template <class T1, class T2, class Policy>
509 typename tools::promote_args<T1, T2>::type
510 powm1(const T1 a, const T2 z, const Policy&);
514 typename tools::promote_args<T>::type sqrt1pm1(const T& val);
516 template <class T, class Policy>
517 typename tools::promote_args<T>::type sqrt1pm1(const T& val, const Policy&);
521 typename tools::promote_args<T>::type sinc_pi(T x);
523 template <class T, class Policy>
524 typename tools::promote_args<T>::type sinc_pi(T x, const Policy&);
527 typename tools::promote_args<T>::type sinhc_pi(T x);
529 template <class T, class Policy>
530 typename tools::promote_args<T>::type sinhc_pi(T x, const Policy&);
532 // inverse hyperbolics:
534 typename tools::promote_args<T>::type asinh(T x);
536 template<typename T, class Policy>
537 typename tools::promote_args<T>::type asinh(T x, const Policy&);
540 typename tools::promote_args<T>::type acosh(T x);
542 template<typename T, class Policy>
543 typename tools::promote_args<T>::type acosh(T x, const Policy&);
546 typename tools::promote_args<T>::type atanh(T x);
548 template<typename T, class Policy>
549 typename tools::promote_args<T>::type atanh(T x, const Policy&);
553 typedef mpl::int_<0> bessel_no_int_tag; // No integer optimisation possible.
554 typedef mpl::int_<1> bessel_maybe_int_tag; // Maybe integer optimisation.
555 typedef mpl::int_<2> bessel_int_tag; // Definite integer optimistaion.
557 template <class T1, class T2, class Policy>
560 typedef typename tools::promote_args<
564 typedef typename policies::precision<result_type, Policy>::type precision_type;
566 typedef typename mpl::if_<
568 mpl::less_equal<precision_type, mpl::int_<0> >,
569 mpl::greater<precision_type, mpl::int_<64> > >,
576 >::type optimisation_tag;
581 template <class T1, class T2, class Policy>
582 typename detail::bessel_traits<T1, T2, Policy>::result_type cyl_bessel_j(T1 v, T2 x, const Policy& pol);
584 template <class T1, class T2>
585 typename detail::bessel_traits<T1, T2, policies::policy<> >::result_type cyl_bessel_j(T1 v, T2 x);
587 template <class T, class Policy>
588 typename detail::bessel_traits<T, T, Policy>::result_type sph_bessel(unsigned v, T x, const Policy& pol);
591 typename detail::bessel_traits<T, T, policies::policy<> >::result_type sph_bessel(unsigned v, T x);
593 template <class T1, class T2, class Policy>
594 typename detail::bessel_traits<T1, T2, Policy>::result_type cyl_bessel_i(T1 v, T2 x, const Policy& pol);
596 template <class T1, class T2>
597 typename detail::bessel_traits<T1, T2, policies::policy<> >::result_type cyl_bessel_i(T1 v, T2 x);
599 template <class T1, class T2, class Policy>
600 typename detail::bessel_traits<T1, T2, Policy>::result_type cyl_bessel_k(T1 v, T2 x, const Policy& pol);
602 template <class T1, class T2>
603 typename detail::bessel_traits<T1, T2, policies::policy<> >::result_type cyl_bessel_k(T1 v, T2 x);
605 template <class T1, class T2, class Policy>
606 typename detail::bessel_traits<T1, T2, Policy>::result_type cyl_neumann(T1 v, T2 x, const Policy& pol);
608 template <class T1, class T2>
609 typename detail::bessel_traits<T1, T2, policies::policy<> >::result_type cyl_neumann(T1 v, T2 x);
611 template <class T, class Policy>
612 typename detail::bessel_traits<T, T, Policy>::result_type sph_neumann(unsigned v, T x, const Policy& pol);
615 typename detail::bessel_traits<T, T, policies::policy<> >::result_type sph_neumann(unsigned v, T x);
617 template <class T, class Policy>
618 typename tools::promote_args<T>::type sin_pi(T x, const Policy&);
621 typename tools::promote_args<T>::type sin_pi(T x);
623 template <class T, class Policy>
624 typename tools::promote_args<T>::type cos_pi(T x, const Policy&);
627 typename tools::promote_args<T>::type cos_pi(T x);
630 int fpclassify BOOST_NO_MACRO_EXPAND(T t);
633 bool isfinite BOOST_NO_MACRO_EXPAND(T z);
636 bool isinf BOOST_NO_MACRO_EXPAND(T t);
639 bool isnan BOOST_NO_MACRO_EXPAND(T t);
642 bool isnormal BOOST_NO_MACRO_EXPAND(T t);
644 // Exponential integrals:
647 template <class T, class U>
650 typedef typename mpl::if_<
651 policies::is_policy<U>,
652 typename tools::promote_args<T>::type,
653 typename tools::promote_args<U>::type
657 } // namespace detail
659 template <class T, class Policy>
660 typename tools::promote_args<T>::type expint(unsigned n, T z, const Policy&);
662 template <class T, class U>
663 typename detail::expint_result<T, U>::type expint(T const z, U const u);
666 typename tools::promote_args<T>::type expint(T z);
669 template <class T, class Policy>
670 typename tools::promote_args<T>::type zeta(T s, const Policy&);
673 typename tools::promote_args<T>::type zeta(T s);
676 template <int N, typename T, class Policy>
677 typename tools::promote_args<T>::type pow(T base, const Policy& policy);
679 template <int N, typename T>
680 typename tools::promote_args<T>::type pow(T base);
683 template <class T, class Policy>
684 T nextafter(const T&, const T&, const Policy&);
686 T nextafter(const T&, const T&);
687 template <class T, class Policy>
688 T float_next(const T&, const Policy&);
690 T float_next(const T&);
691 template <class T, class Policy>
692 T float_prior(const T&, const Policy&);
694 T float_prior(const T&);
695 template <class T, class Policy>
696 T float_distance(const T&, const T&, const Policy&);
698 T float_distance(const T&, const T&);
703 #ifdef BOOST_HAS_LONG_LONG
704 #define BOOST_MATH_DETAIL_LL_FUNC(Policy)\
707 inline T modf(const T& v, boost::long_long_type* ipart){ using boost::math::modf; return modf(v, ipart, Policy()); }\
710 inline boost::long_long_type lltrunc(const T& v){ using boost::math::lltrunc; return lltrunc(v, Policy()); }\
713 inline boost::long_long_type llround(const T& v){ using boost::math::llround; return llround(v, Policy()); }\
716 #define BOOST_MATH_DETAIL_LL_FUNC(Policy)
719 #define BOOST_MATH_DECLARE_SPECIAL_FUNCTIONS(Policy)\
721 BOOST_MATH_DETAIL_LL_FUNC(Policy)\
723 template <class RT1, class RT2>\
724 inline typename boost::math::tools::promote_args<RT1, RT2>::type \
725 beta(RT1 a, RT2 b) { return ::boost::math::beta(a, b, Policy()); }\
727 template <class RT1, class RT2, class A>\
728 inline typename boost::math::tools::promote_args<RT1, RT2, A>::type \
729 beta(RT1 a, RT2 b, A x){ return ::boost::math::beta(a, b, x, Policy()); }\
731 template <class RT1, class RT2, class RT3>\
732 inline typename boost::math::tools::promote_args<RT1, RT2, RT3>::type \
733 betac(RT1 a, RT2 b, RT3 x) { return ::boost::math::betac(a, b, x, Policy()); }\
735 template <class RT1, class RT2, class RT3>\
736 inline typename boost::math::tools::promote_args<RT1, RT2, RT3>::type \
737 ibeta(RT1 a, RT2 b, RT3 x){ return ::boost::math::ibeta(a, b, x, Policy()); }\
739 template <class RT1, class RT2, class RT3>\
740 inline typename boost::math::tools::promote_args<RT1, RT2, RT3>::type \
741 ibetac(RT1 a, RT2 b, RT3 x){ return ::boost::math::ibetac(a, b, x, Policy()); }\
743 template <class T1, class T2, class T3, class T4>\
744 inline typename boost::math::tools::promote_args<T1, T2, T3, T4>::type \
745 ibeta_inv(T1 a, T2 b, T3 p, T4* py){ return ::boost::math::ibeta_inv(a, b, p, py, Policy()); }\
747 template <class RT1, class RT2, class RT3>\
748 inline typename boost::math::tools::promote_args<RT1, RT2, RT3>::type \
749 ibeta_inv(RT1 a, RT2 b, RT3 p){ return ::boost::math::ibeta_inv(a, b, p, Policy()); }\
751 template <class T1, class T2, class T3, class T4>\
752 inline typename boost::math::tools::promote_args<T1, T2, T3, T4>::type \
753 ibetac_inv(T1 a, T2 b, T3 q, T4* py){ return ::boost::math::ibetac_inv(a, b, q, py, Policy()); }\
755 template <class RT1, class RT2, class RT3>\
756 inline typename boost::math::tools::promote_args<RT1, RT2, RT3>::type \
757 ibeta_inva(RT1 a, RT2 b, RT3 p){ return ::boost::math::ibeta_inva(a, b, p, Policy()); }\
759 template <class T1, class T2, class T3>\
760 inline typename boost::math::tools::promote_args<T1, T2, T3>::type \
761 ibetac_inva(T1 a, T2 b, T3 q){ return ::boost::math::ibetac_inva(a, b, q, Policy()); }\
763 template <class RT1, class RT2, class RT3>\
764 inline typename boost::math::tools::promote_args<RT1, RT2, RT3>::type \
765 ibeta_invb(RT1 a, RT2 b, RT3 p){ return ::boost::math::ibeta_invb(a, b, p, Policy()); }\
767 template <class T1, class T2, class T3>\
768 inline typename boost::math::tools::promote_args<T1, T2, T3>::type \
769 ibetac_invb(T1 a, T2 b, T3 q){ return ::boost::math::ibetac_invb(a, b, q, Policy()); }\
771 template <class RT1, class RT2, class RT3>\
772 inline typename boost::math::tools::promote_args<RT1, RT2, RT3>::type \
773 ibetac_inv(RT1 a, RT2 b, RT3 q){ return ::boost::math::ibetac_inv(a, b, q, Policy()); }\
775 template <class RT1, class RT2, class RT3>\
776 inline typename boost::math::tools::promote_args<RT1, RT2, RT3>::type \
777 ibeta_derivative(RT1 a, RT2 b, RT3 x){ return ::boost::math::ibeta_derivative(a, b, x, Policy()); }\
780 inline typename boost::math::tools::promote_args<RT>::type erf(RT z) { return ::boost::math::erf(z, Policy()); }\
783 inline typename boost::math::tools::promote_args<RT>::type erfc(RT z){ return ::boost::math::erfc(z, Policy()); }\
786 inline typename boost::math::tools::promote_args<RT>::type erf_inv(RT z) { return ::boost::math::erf_inv(z, Policy()); }\
789 inline typename boost::math::tools::promote_args<RT>::type erfc_inv(RT z){ return ::boost::math::erfc_inv(z, Policy()); }\
791 using boost::math::legendre_next;\
794 inline typename boost::math::tools::promote_args<T>::type \
795 legendre_p(int l, T x){ return ::boost::math::legendre_p(l, x, Policy()); }\
798 inline typename boost::math::tools::promote_args<T>::type \
799 legendre_q(unsigned l, T x){ return ::boost::math::legendre_q(l, x, Policy()); }\
801 using ::boost::math::legendre_next;\
804 inline typename boost::math::tools::promote_args<T>::type \
805 legendre_p(int l, int m, T x){ return ::boost::math::legendre_p(l, m, x, Policy()); }\
807 using ::boost::math::laguerre_next;\
810 inline typename boost::math::tools::promote_args<T>::type \
811 laguerre(unsigned n, T x){ return ::boost::math::laguerre(n, x, Policy()); }\
813 template <class T1, class T2>\
814 inline typename boost::math::laguerre_result<T1, T2>::type \
815 laguerre(unsigned n, T1 m, T2 x) { return ::boost::math::laguerre(n, m, x, Policy()); }\
818 inline typename boost::math::tools::promote_args<T>::type \
819 hermite(unsigned n, T x){ return ::boost::math::hermite(n, x, Policy()); }\
821 using boost::math::hermite_next;\
823 template <class T1, class T2>\
824 inline std::complex<typename boost::math::tools::promote_args<T1, T2>::type> \
825 spherical_harmonic(unsigned n, int m, T1 theta, T2 phi){ return boost::math::spherical_harmonic(n, m, theta, phi, Policy()); }\
827 template <class T1, class T2>\
828 inline typename boost::math::tools::promote_args<T1, T2>::type \
829 spherical_harmonic_r(unsigned n, int m, T1 theta, T2 phi){ return ::boost::math::spherical_harmonic_r(n, m, theta, phi, Policy()); }\
831 template <class T1, class T2>\
832 inline typename boost::math::tools::promote_args<T1, T2>::type \
833 spherical_harmonic_i(unsigned n, int m, T1 theta, T2 phi){ return boost::math::spherical_harmonic_i(n, m, theta, phi, Policy()); }\
835 template <class T1, class T2, class Policy>\
836 inline typename boost::math::tools::promote_args<T1, T2>::type \
837 spherical_harmonic_i(unsigned n, int m, T1 theta, T2 phi, const Policy& pol);\
839 template <class T1, class T2, class T3>\
840 inline typename boost::math::tools::promote_args<T1, T2, T3>::type \
841 ellint_rf(T1 x, T2 y, T3 z){ return ::boost::math::ellint_rf(x, y, z, Policy()); }\
843 template <class T1, class T2, class T3>\
844 inline typename boost::math::tools::promote_args<T1, T2, T3>::type \
845 ellint_rd(T1 x, T2 y, T3 z){ return ::boost::math::ellint_rd(x, y, z, Policy()); }\
847 template <class T1, class T2>\
848 inline typename boost::math::tools::promote_args<T1, T2>::type \
849 ellint_rc(T1 x, T2 y){ return ::boost::math::ellint_rc(x, y, Policy()); }\
851 template <class T1, class T2, class T3, class T4>\
852 inline typename boost::math::tools::promote_args<T1, T2, T3, T4>::type \
853 ellint_rj(T1 x, T2 y, T3 z, T4 p){ return boost::math::ellint_rj(x, y, z, p, Policy()); }\
855 template <typename T>\
856 inline typename boost::math::tools::promote_args<T>::type ellint_2(T k){ return boost::math::ellint_2(k, Policy()); }\
858 template <class T1, class T2>\
859 inline typename boost::math::tools::promote_args<T1, T2>::type ellint_2(T1 k, T2 phi){ return boost::math::ellint_2(k, phi, Policy()); }\
861 template <typename T>\
862 inline typename boost::math::tools::promote_args<T>::type ellint_1(T k){ return boost::math::ellint_1(k, Policy()); }\
864 template <class T1, class T2>\
865 inline typename boost::math::tools::promote_args<T1, T2>::type ellint_1(T1 k, T2 phi){ return boost::math::ellint_1(k, phi, Policy()); }\
867 template <class T1, class T2, class T3>\
868 inline typename boost::math::tools::promote_args<T1, T2, T3>::type ellint_3(T1 k, T2 v, T3 phi){ return boost::math::ellint_3(k, v, phi, Policy()); }\
870 template <class T1, class T2>\
871 inline typename boost::math::tools::promote_args<T1, T2>::type ellint_3(T1 k, T2 v){ return boost::math::ellint_3(k, v, Policy()); }\
873 using boost::math::max_factorial;\
875 inline RT factorial(unsigned int i) { return boost::math::factorial<RT>(i, Policy()); }\
876 using boost::math::unchecked_factorial;\
878 inline RT double_factorial(unsigned i){ return boost::math::double_factorial<RT>(i, Policy()); }\
880 inline typename boost::math::tools::promote_args<RT>::type falling_factorial(RT x, unsigned n){ return boost::math::falling_factorial(x, n, Policy()); }\
882 inline typename boost::math::tools::promote_args<RT>::type rising_factorial(RT x, unsigned n){ return boost::math::rising_factorial(x, n, Policy()); }\
883 using boost::math::fpclassify;\
886 inline typename boost::math::tools::promote_args<RT>::type tgamma(RT z){ return boost::math::tgamma(z, Policy()); }\
889 inline typename boost::math::tools::promote_args<RT>::type tgamma1pm1(RT z){ return boost::math::tgamma1pm1(z, Policy()); }\
891 template <class RT1, class RT2>\
892 inline typename boost::math::tools::promote_args<RT1, RT2>::type tgamma(RT1 a, RT2 z){ return boost::math::tgamma(a, z, Policy()); }\
895 inline typename boost::math::tools::promote_args<RT>::type lgamma(RT z, int* sign){ return boost::math::lgamma(z, sign, Policy()); }\
898 inline typename boost::math::tools::promote_args<RT>::type lgamma(RT x){ return boost::math::lgamma(x, Policy()); }\
900 template <class RT1, class RT2>\
901 inline typename boost::math::tools::promote_args<RT1, RT2>::type tgamma_lower(RT1 a, RT2 z){ return boost::math::tgamma_lower(a, z, Policy()); }\
903 template <class RT1, class RT2>\
904 inline typename boost::math::tools::promote_args<RT1, RT2>::type gamma_q(RT1 a, RT2 z){ return boost::math::gamma_q(a, z, Policy()); }\
906 template <class RT1, class RT2>\
907 inline typename boost::math::tools::promote_args<RT1, RT2>::type gamma_p(RT1 a, RT2 z){ return boost::math::gamma_p(a, z, Policy()); }\
909 template <class T1, class T2>\
910 inline typename boost::math::tools::promote_args<T1, T2>::type tgamma_delta_ratio(T1 z, T2 delta){ return boost::math::tgamma_delta_ratio(z, delta, Policy()); }\
912 template <class T1, class T2>\
913 inline typename boost::math::tools::promote_args<T1, T2>::type tgamma_ratio(T1 a, T2 b) { return boost::math::tgamma_ratio(a, b, Policy()); }\
915 template <class T1, class T2>\
916 inline typename boost::math::tools::promote_args<T1, T2>::type gamma_p_derivative(T1 a, T2 x){ return boost::math::gamma_p_derivative(a, x, Policy()); }\
918 template <class T1, class T2>\
919 inline typename boost::math::tools::promote_args<T1, T2>::type gamma_p_inv(T1 a, T2 p){ return boost::math::gamma_p_inv(a, p, Policy()); }\
921 template <class T1, class T2>\
922 inline typename boost::math::tools::promote_args<T1, T2>::type gamma_p_inva(T1 a, T2 p){ return boost::math::gamma_p_inva(a, p, Policy()); }\
924 template <class T1, class T2>\
925 inline typename boost::math::tools::promote_args<T1, T2>::type gamma_q_inv(T1 a, T2 q){ return boost::math::gamma_q_inv(a, q, Policy()); }\
927 template <class T1, class T2>\
928 inline typename boost::math::tools::promote_args<T1, T2>::type gamma_q_inva(T1 a, T2 q){ return boost::math::gamma_q_inva(a, q, Policy()); }\
931 inline typename boost::math::tools::promote_args<T>::type digamma(T x){ return boost::math::digamma(x, Policy()); }\
933 template <class T1, class T2>\
934 inline typename boost::math::tools::promote_args<T1, T2>::type \
935 hypot(T1 x, T2 y){ return boost::math::hypot(x, y, Policy()); }\
938 inline typename boost::math::tools::promote_args<RT>::type cbrt(RT z){ return boost::math::cbrt(z, Policy()); }\
941 inline typename boost::math::tools::promote_args<T>::type log1p(T x){ return boost::math::log1p(x, Policy()); }\
944 inline typename boost::math::tools::promote_args<T>::type log1pmx(T x){ return boost::math::log1pmx(x, Policy()); }\
947 inline typename boost::math::tools::promote_args<T>::type expm1(T x){ return boost::math::expm1(x, Policy()); }\
949 template <class T1, class T2>\
950 inline typename boost::math::tools::promote_args<T1, T2>::type \
951 powm1(const T1 a, const T2 z){ return boost::math::powm1(a, z, Policy()); }\
954 inline typename boost::math::tools::promote_args<T>::type sqrt1pm1(const T& val){ return boost::math::sqrt1pm1(val, Policy()); }\
957 inline typename boost::math::tools::promote_args<T>::type sinc_pi(T x){ return boost::math::sinc_pi(x, Policy()); }\
960 inline typename boost::math::tools::promote_args<T>::type sinhc_pi(T x){ return boost::math::sinhc_pi(x, Policy()); }\
962 template<typename T>\
963 inline typename boost::math::tools::promote_args<T>::type asinh(const T x){ return boost::math::asinh(x, Policy()); }\
965 template<typename T>\
966 inline typename boost::math::tools::promote_args<T>::type acosh(const T x){ return boost::math::acosh(x, Policy()); }\
968 template<typename T>\
969 inline typename boost::math::tools::promote_args<T>::type atanh(const T x){ return boost::math::atanh(x, Policy()); }\
971 template <class T1, class T2>\
972 inline typename boost::math::detail::bessel_traits<T1, T2, Policy >::result_type cyl_bessel_j(T1 v, T2 x)\
973 { return boost::math::cyl_bessel_j(v, x, Policy()); }\
976 inline typename boost::math::detail::bessel_traits<T, T, Policy >::result_type sph_bessel(unsigned v, T x)\
977 { return boost::math::sph_bessel(v, x, Policy()); }\
979 template <class T1, class T2>\
980 inline typename boost::math::detail::bessel_traits<T1, T2, Policy >::result_type \
981 cyl_bessel_i(T1 v, T2 x) { return boost::math::cyl_bessel_i(v, x, Policy()); }\
983 template <class T1, class T2>\
984 inline typename boost::math::detail::bessel_traits<T1, T2, Policy >::result_type \
985 cyl_bessel_k(T1 v, T2 x) { return boost::math::cyl_bessel_k(v, x, Policy()); }\
987 template <class T1, class T2>\
988 inline typename boost::math::detail::bessel_traits<T1, T2, Policy >::result_type \
989 cyl_neumann(T1 v, T2 x){ return boost::math::cyl_neumann(v, x, Policy()); }\
992 inline typename boost::math::detail::bessel_traits<T, T, Policy >::result_type \
993 sph_neumann(unsigned v, T x){ return boost::math::sph_neumann(v, x, Policy()); }\
996 inline typename boost::math::tools::promote_args<T>::type sin_pi(T x){ return boost::math::sin_pi(x); }\
999 inline typename boost::math::tools::promote_args<T>::type cos_pi(T x){ return boost::math::cos_pi(x); }\
1001 using boost::math::fpclassify;\
1002 using boost::math::isfinite;\
1003 using boost::math::isinf;\
1004 using boost::math::isnan;\
1005 using boost::math::isnormal;\
1007 template <class T, class U>\
1008 inline typename boost::math::tools::promote_args<T,U>::type expint(T const& z, U const& u)\
1009 { return boost::math::expint(z, u, Policy()); }\
1012 inline typename boost::math::tools::promote_args<T>::type expint(T z){ return boost::math::expint(z, Policy()); }\
1015 inline typename boost::math::tools::promote_args<T>::type zeta(T s){ return boost::math::zeta(s, Policy()); }\
1018 inline T round(const T& v){ using boost::math::round; return round(v, Policy()); }\
1021 inline int iround(const T& v){ using boost::math::iround; return iround(v, Policy()); }\
1024 inline long lround(const T& v){ using boost::math::lround; return lround(v, Policy()); }\
1027 inline T trunc(const T& v){ using boost::math::trunc; return trunc(v, Policy()); }\
1030 inline int itrunc(const T& v){ using boost::math::itrunc; return itrunc(v, Policy()); }\
1033 inline long ltrunc(const T& v){ using boost::math::ltrunc; return ltrunc(v, Policy()); }\
1036 inline T modf(const T& v, T* ipart){ using boost::math::modf; return modf(v, ipart, Policy()); }\
1039 inline T modf(const T& v, int* ipart){ using boost::math::modf; return modf(v, ipart, Policy()); }\
1042 inline T modf(const T& v, long* ipart){ using boost::math::modf; return modf(v, ipart, Policy()); }\
1044 template <int N, class T>\
1045 inline typename boost::math::tools::promote_args<T>::type pow(T v){ return boost::math::pow<N>(v, Policy()); }\
1047 template <class T> T nextafter(const T& a, const T& b){ return boost::math::nextafter(a, b, Policy()); }\
1048 template <class T> T float_next(const T& a){ return boost::math::float_next(a, Policy()); }\
1049 template <class T> T float_prior(const T& a){ return boost::math::float_prior(a, Policy()); }\
1050 template <class T> T float_distance(const T& a, const T& b){ return boost::math::float_distance(a, b, Policy()); }\
1053 #endif // BOOST_MATH_SPECIAL_MATH_FWD_HPP