]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/math/include/boost/math/special_functions/detail/bessel_derivatives_linear.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / math / include / boost / math / special_functions / detail / bessel_derivatives_linear.hpp
1 // Copyright (c) 2013 Anton Bikineev
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 //
7 // This is a partial header, do not include on it's own!!!
8 //
9 // Linear combination for bessel derivatives are defined here
10 #ifndef BOOST_MATH_SF_DETAIL_BESSEL_DERIVATIVES_LINEAR_HPP
11 #define BOOST_MATH_SF_DETAIL_BESSEL_DERIVATIVES_LINEAR_HPP
12
13 #ifdef _MSC_VER
14 #pragma once
15 #endif
16
17 namespace boost{ namespace math{ namespace detail{
18
19 template <class T, class Tag, class Policy>
20 inline T bessel_j_derivative_linear(T v, T x, Tag tag, Policy pol)
21 {
22 return (boost::math::detail::cyl_bessel_j_imp<T>(v-1, x, tag, pol) - boost::math::detail::cyl_bessel_j_imp<T>(v+1, x, tag, pol)) / 2;
23 }
24
25 template <class T, class Policy>
26 inline T bessel_j_derivative_linear(T v, T x, const bessel_int_tag& tag, Policy pol)
27 {
28 return (boost::math::detail::cyl_bessel_j_imp<T>(itrunc(v-1), x, tag, pol) - boost::math::detail::cyl_bessel_j_imp<T>(itrunc(v+1), x, tag, pol)) / 2;
29 }
30
31 template <class T, class Policy>
32 inline T sph_bessel_j_derivative_linear(unsigned v, T x, Policy pol)
33 {
34 return (v / x) * boost::math::detail::sph_bessel_j_imp<T>(v, x, pol) - boost::math::detail::sph_bessel_j_imp<T>(v+1, x, pol);
35 }
36
37 template <class T, class Policy>
38 inline T bessel_i_derivative_linear(T v, T x, Policy pol)
39 {
40 T result = boost::math::detail::cyl_bessel_i_imp<T>(v - 1, x, pol);
41 if(result >= tools::max_value<T>())
42 return result; // result is infinite
43 T result2 = boost::math::detail::cyl_bessel_i_imp<T>(v + 1, x, pol);
44 if(result2 >= tools::max_value<T>() - result)
45 return result2; // result is infinite
46 return (result + result2) / 2;
47 }
48
49 template <class T, class Tag, class Policy>
50 inline T bessel_k_derivative_linear(T v, T x, Tag tag, Policy pol)
51 {
52 T result = boost::math::detail::cyl_bessel_k_imp<T>(v - 1, x, tag, pol);
53 if(result >= tools::max_value<T>())
54 return -result; // result is infinite
55 T result2 = boost::math::detail::cyl_bessel_k_imp<T>(v + 1, x, tag, pol);
56 if(result2 >= tools::max_value<T>() - result)
57 return -result2; // result is infinite
58 return (result + result2) / -2;
59 }
60
61 template <class T, class Policy>
62 inline T bessel_k_derivative_linear(T v, T x, const bessel_int_tag& tag, Policy pol)
63 {
64 return (boost::math::detail::cyl_bessel_k_imp<T>(itrunc(v-1), x, tag, pol) + boost::math::detail::cyl_bessel_k_imp<T>(itrunc(v+1), x, tag, pol)) / -2;
65 }
66
67 template <class T, class Tag, class Policy>
68 inline T bessel_y_derivative_linear(T v, T x, Tag tag, Policy pol)
69 {
70 return (boost::math::detail::cyl_neumann_imp<T>(v-1, x, tag, pol) - boost::math::detail::cyl_neumann_imp<T>(v+1, x, tag, pol)) / 2;
71 }
72
73 template <class T, class Policy>
74 inline T bessel_y_derivative_linear(T v, T x, const bessel_int_tag& tag, Policy pol)
75 {
76 return (boost::math::detail::cyl_neumann_imp<T>(itrunc(v-1), x, tag, pol) - boost::math::detail::cyl_neumann_imp<T>(itrunc(v+1), x, tag, pol)) / 2;
77 }
78
79 template <class T, class Policy>
80 inline T sph_neumann_derivative_linear(unsigned v, T x, Policy pol)
81 {
82 return (v / x) * boost::math::detail::sph_neumann_imp<T>(v, x, pol) - boost::math::detail::sph_neumann_imp<T>(v+1, x, pol);
83 }
84
85 }}} // namespaces
86
87 #endif // BOOST_MATH_SF_DETAIL_BESSEL_DERIVATIVES_LINEAR_HPP