DriveHQ Start Menu
Cloud Drive Mapping
Folder Sync
Cloud Backup
True Drop Box
FTP/SFTP Hosting
Group Account
DriveHQ Start Menu
Online File Server
My Storage
|
Manage Shares
|
Publishes
|
Drop Boxes
|
Group Account
WebDAV Drive Mapping
Cloud Drive Home
|
WebDAV Guide
|
Drive Mapping Tool
|
Drive Mapping URL
Complete Data Backup
Backup Guide
|
Online Backup Tool
|
Cloud-to-Cloud Backup
FTP, Email & Web Service
FTP Home
|
FTP Hosting FAQ
|
Email Hosting
|
EmailManager
|
Web Hosting
Help & Resources
About
|
Enterprise Service
|
Partnership
|
Comparisons
|
Support
Quick Links
Security and Privacy
Download Software
Service Manual
Use Cases
Group Account
Online Help
Blog
Contact
Cloud Surveillance
Sign Up
Login
Features
Business Features
Online File Server
FTP Hosting
Cloud Drive Mapping
Cloud File Backup
Email Backup & Hosting
Cloud File Sharing
Folder Synchronization
Group Management
True Drop Box
Full-text Search
AD Integration/SSO
Mobile Access
IP Camera & DVR Solution
More...
Personal Features
Personal Cloud Drive
Backup All Devices
Mobile APPs
Personal Web Hosting
Sub-Account (for Kids)
Home/PC/Kids Monitoring
More...
Software
DriveHQ Drive Mapping Tool
DriveHQ FileManager
DriveHQ Online Backup
DriveHQ Mobile Apps
Pricing
Business Plans & Pricing
Personal Plans & Pricing
Price Comparison with Others
Feature Comparison with Others
Install Mobile App
Sign up
Creating account...
Invalid character in username! Only 0-9, a-z, A-Z, _, -, . allowed.
Username is required!
Invalid email address!
E-mail is required!
Password is required!
Password is invalid!
Password and confirmation do not match.
Confirm password is required!
I accept
Membership Agreement
Please read the Membership Agreement and check "I accept"!
Free Quick Sign-up
Sign-up Page
Log in
Signing in...
Username or e-mail address is required!
Password is required!
Keep me logged in
Quick Login
Forgot Password
Up
Upload
Download
Share
Publish
New Folder
New File
Copy
Cut
Delete
Paste
Rate
Upgrade
Rotate
Effect
Edit
Slide
History
// Copyright (c) 2007 John Maddock // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // This header just defines the function entry points, and adds dispatch // to the right implementation method. Most of the implementation details // are in separate headers and copyright Xiaogang Zhang. // #ifndef BOOST_MATH_BESSEL_HPP #define BOOST_MATH_BESSEL_HPP #include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
namespace boost{ namespace math{ namespace detail{ template
struct bessel_j_small_z_series_term { typedef T result_type; bessel_j_small_z_series_term(T v_, T x) : N(0), v(v_) { BOOST_MATH_STD_USING mult = x / 2; term = pow(mult, v) / boost::math::tgamma(v+1, Policy()); mult *= -mult; } T operator()() { T r = term; ++N; term *= mult / (N * (N + v)); return r; } private: unsigned N; T v; T mult; T term; }; template
struct sph_bessel_j_small_z_series_term { typedef T result_type; sph_bessel_j_small_z_series_term(unsigned v_, T x) : N(0), v(v_) { BOOST_MATH_STD_USING mult = x / 2; term = pow(mult, T(v)) / boost::math::tgamma(v+1+T(0.5f), Policy()); mult *= -mult; } T operator()() { T r = term; ++N; term *= mult / (N * T(N + v + 0.5f)); return r; } private: unsigned N; unsigned v; T mult; T term; }; template
inline T bessel_j_small_z_series(T v, T x, const Policy& pol) { bessel_j_small_z_series_term
s(v, x); boost::uintmax_t max_iter = policies::get_max_series_iterations
(); #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582)) T zero = 0; T result = boost::math::tools::sum_series(s, boost::math::policies::digits
(), max_iter, zero); #else T result = boost::math::tools::sum_series(s, boost::math::policies::digits
(), max_iter); #endif policies::check_series_iterations("boost::math::bessel_j_small_z_series<%1%>(%1%,%1%)", max_iter, pol); return result; } template
inline T sph_bessel_j_small_z_series(unsigned v, T x, const Policy& pol) { BOOST_MATH_STD_USING // ADL of std names sph_bessel_j_small_z_series_term
s(v, x); boost::uintmax_t max_iter = policies::get_max_series_iterations
(); #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582)) T zero = 0; T result = boost::math::tools::sum_series(s, boost::math::policies::digits
(), max_iter, zero); #else T result = boost::math::tools::sum_series(s, boost::math::policies::digits
(), max_iter); #endif policies::check_series_iterations("boost::math::sph_bessel_j_small_z_series<%1%>(%1%,%1%)", max_iter, pol); return result * sqrt(constants::pi
() / 4); } template
T cyl_bessel_j_imp(T v, T x, const bessel_no_int_tag& t, const Policy& pol) { BOOST_MATH_STD_USING static const char* function = "boost::math::bessel_j<%1%>(%1%,%1%)"; if(x < 0) { // better have integer v: if(floor(v) == v) { T r = cyl_bessel_j_imp(v, -x, t, pol); if(tools::real_cast
(v) & 1) r = -r; return r; } else return policies::raise_domain_error
( function, "Got x = %1%, but we need x >= 0", x, pol); } if(x == 0) return (v == 0) ? 1 : (v > 0) ? 0 : policies::raise_domain_error
( function, "Got v = %1%, but require v >= 0 or a negative integer: the result would be complex.", v, pol); if((v >= 0) && ((x < 1) || (v > x * x / 4))) { return bessel_j_small_z_series(v, x, pol); } T j, y; bessel_jy(v, x, &j, &y, need_j, pol); return j; } template
inline T cyl_bessel_j_imp(T v, T x, const bessel_maybe_int_tag&, const Policy& pol) { BOOST_MATH_STD_USING // ADL of std names. typedef typename bessel_asymptotic_tag
::type tag_type; if((fabs(v) < 200) && (floor(v) == v)) { if(fabs(x) > asymptotic_bessel_j_limit
(v, tag_type())) return asymptotic_bessel_j_large_x_2(v, x); else return bessel_jn(tools::real_cast
(v), x, pol); } return cyl_bessel_j_imp(v, x, bessel_no_int_tag(), pol); } template
inline T cyl_bessel_j_imp(int v, T x, const bessel_int_tag&, const Policy& pol) { BOOST_MATH_STD_USING typedef typename bessel_asymptotic_tag
::type tag_type; if(fabs(x) > asymptotic_bessel_j_limit
(abs(v), tag_type())) { T r = asymptotic_bessel_j_large_x_2(static_cast
(abs(v)), x); if((v < 0) && (v & 1)) r = -r; return r; } else return bessel_jn(v, x, pol); } template
inline T sph_bessel_j_imp(unsigned n, T x, const Policy& pol) { BOOST_MATH_STD_USING // ADL of std names if(x < 0) return policies::raise_domain_error
( "boost::math::sph_bessel_j<%1%>(%1%,%1%)", "Got x = %1%, but function requires x > 0.", x, pol); // // Special case, n == 0 resolves down to the sinus cardinal of x: // if(n == 0) return boost::math::sinc_pi(x, pol); // // When x is small we may end up with 0/0, use series evaluation // instead, especially as it converges rapidly: // if(x < 1) return sph_bessel_j_small_z_series(n, x, pol); // // Default case is just a naive evaluation of the definition: // return sqrt(constants::pi
() / (2 * x)) * cyl_bessel_j_imp(T(n)+T(0.5f), x, bessel_no_int_tag(), pol); } template
T cyl_bessel_i_imp(T v, T x, const Policy& pol) { // // This handles all the bessel I functions, note that we don't optimise // for integer v, other than the v = 0 or 1 special cases, as Millers // algorithm is at least as inefficient as the general case (the general // case has better error handling too). // BOOST_MATH_STD_USING if(x < 0) { // better have integer v: if(floor(v) == v) { T r = cyl_bessel_i_imp(v, -x, pol); if(tools::real_cast
(v) & 1) r = -r; return r; } else return policies::raise_domain_error
( "boost::math::cyl_bessel_i<%1%>(%1%,%1%)", "Got x = %1%, but we need x >= 0", x, pol); } if(x == 0) { return (v == 0) ? 1 : 0; } if(v == 0.5f) { // common special case, note try and avoid overflow in exp(x): T e = exp(x / 2); return e * (e / sqrt(2 * x * constants::pi
())); } if(policies::digits
() <= 64) { if(v == 0) { return bessel_i0(x); } if(v == 1) { return bessel_i1(x); } } T I, K; bessel_ik(v, x, &I, &K, need_i, pol); return I; } template
inline T cyl_bessel_k_imp(T v, T x, const bessel_no_int_tag& /* t */, const Policy& pol) { static const char* function = "boost::math::cyl_bessel_k<%1%>(%1%,%1%)"; BOOST_MATH_STD_USING if(x < 0) { return policies::raise_domain_error
( function, "Got x = %1%, but we need x > 0", x, pol); } if(x == 0) { return (v == 0) ? policies::raise_overflow_error
(function, 0, pol) : policies::raise_domain_error
( function, "Got x = %1%, but we need x > 0", x, pol); } T I, K; bessel_ik(v, x, &I, &K, need_k, pol); return K; } template
inline T cyl_bessel_k_imp(T v, T x, const bessel_maybe_int_tag&, const Policy& pol) { BOOST_MATH_STD_USING if((floor(v) == v)) { return bessel_kn(tools::real_cast
(v), x, pol); } return cyl_bessel_k_imp(v, x, bessel_no_int_tag(), pol); } template
inline T cyl_bessel_k_imp(int v, T x, const bessel_int_tag&, const Policy& pol) { return bessel_kn(v, x, pol); } template
inline T cyl_neumann_imp(T v, T x, const bessel_no_int_tag&, const Policy& pol) { static const char* function = "boost::math::cyl_neumann<%1%>(%1%,%1%)"; if(x <= 0) { return (v == 0) && (x == 0) ? policies::raise_overflow_error
(function, 0, pol) : policies::raise_domain_error
( function, "Got x = %1%, but result is complex for x <= 0", x, pol); } T j, y; bessel_jy(v, x, &j, &y, need_y, pol); // // Post evaluation check for internal overflow during evaluation, // can occur when x is small and v is large, in which case the result // is -INF: // if(!(boost::math::isfinite)(y)) return -policies::raise_overflow_error
(function, 0, pol); return y; } template
inline T cyl_neumann_imp(T v, T x, const bessel_maybe_int_tag&, const Policy& pol) { BOOST_MATH_STD_USING typedef typename bessel_asymptotic_tag
::type tag_type; if(floor(v) == v) { if((fabs(x) > asymptotic_bessel_y_limit
(tag_type())) && (fabs(x) > 5 * abs(v))) { T r = asymptotic_bessel_y_large_x_2(static_cast
(abs(v)), x); if((v < 0) && (tools::real_cast
(v) & 1)) r = -r; return r; } else return bessel_yn(tools::real_cast
(v), x, pol); } return cyl_neumann_imp
(v, x, bessel_no_int_tag(), pol); } template
inline T cyl_neumann_imp(int v, T x, const bessel_int_tag&, const Policy& pol) { BOOST_MATH_STD_USING typedef typename bessel_asymptotic_tag
::type tag_type; if((fabs(x) > asymptotic_bessel_y_limit
(tag_type())) && (fabs(x) > 5 * abs(v))) { T r = asymptotic_bessel_y_large_x_2(static_cast
(abs(v)), x); if((v < 0) && (v & 1)) r = -r; return r; } else return bessel_yn(tools::real_cast
(v), x, pol); } template
inline T sph_neumann_imp(unsigned v, T x, const Policy& pol) { BOOST_MATH_STD_USING // ADL of std names static const char* function = "boost::math::sph_neumann<%1%>(%1%,%1%)"; // // Nothing much to do here but check for errors, and // evaluate the function's definition directly: // if(x < 0) return policies::raise_domain_error
( function, "Got x = %1%, but function requires x > 0.", x, pol); if(x < 2 * tools::min_value
()) return -policies::raise_overflow_error
(function, 0, pol); T result = cyl_neumann_imp(T(v)+0.5f, x, bessel_no_int_tag(), pol); T tx = sqrt(constants::pi
() / (2 * x)); if((tx > 1) && (tools::max_value
() / tx < result)) return -policies::raise_overflow_error
(function, 0, pol); return result * tx; } } // namespace detail template
inline typename detail::bessel_traits
::result_type cyl_bessel_j(T1 v, T2 x, const Policy& pol) { BOOST_FPU_EXCEPTION_GUARD typedef typename detail::bessel_traits
::result_type result_type; typedef typename detail::bessel_traits
::optimisation_tag tag_type; typedef typename policies::evaluation
::type value_type; return policies::checked_narrowing_cast
(detail::cyl_bessel_j_imp
(v, static_cast
(x), tag_type(), pol), "boost::math::cyl_bessel_j<%1%>(%1%,%1%)"); } template
inline typename detail::bessel_traits
>::result_type cyl_bessel_j(T1 v, T2 x) { return cyl_bessel_j(v, x, policies::policy<>()); } template
inline typename detail::bessel_traits
::result_type sph_bessel(unsigned v, T x, const Policy& pol) { BOOST_FPU_EXCEPTION_GUARD typedef typename detail::bessel_traits
::result_type result_type; typedef typename policies::evaluation
::type value_type; return policies::checked_narrowing_cast
(detail::sph_bessel_j_imp
(v, static_cast
(x), pol), "boost::math::sph_bessel<%1%>(%1%,%1%)"); } template
inline typename detail::bessel_traits
>::result_type sph_bessel(unsigned v, T x) { return sph_bessel(v, x, policies::policy<>()); } template
inline typename detail::bessel_traits
::result_type cyl_bessel_i(T1 v, T2 x, const Policy& pol) { BOOST_FPU_EXCEPTION_GUARD typedef typename detail::bessel_traits
::result_type result_type; typedef typename policies::evaluation
::type value_type; return policies::checked_narrowing_cast
(detail::cyl_bessel_i_imp
(v, static_cast
(x), pol), "boost::math::cyl_bessel_i<%1%>(%1%,%1%)"); } template
inline typename detail::bessel_traits
>::result_type cyl_bessel_i(T1 v, T2 x) { return cyl_bessel_i(v, x, policies::policy<>()); } template
inline typename detail::bessel_traits
::result_type cyl_bessel_k(T1 v, T2 x, const Policy& pol) { BOOST_FPU_EXCEPTION_GUARD typedef typename detail::bessel_traits
::result_type result_type; typedef typename detail::bessel_traits
::optimisation_tag tag_type; typedef typename policies::evaluation
::type value_type; return policies::checked_narrowing_cast
(detail::cyl_bessel_k_imp
(v, static_cast
(x), tag_type(), pol), "boost::math::cyl_bessel_k<%1%>(%1%,%1%)"); } template
inline typename detail::bessel_traits
>::result_type cyl_bessel_k(T1 v, T2 x) { return cyl_bessel_k(v, x, policies::policy<>()); } template
inline typename detail::bessel_traits
::result_type cyl_neumann(T1 v, T2 x, const Policy& pol) { BOOST_FPU_EXCEPTION_GUARD typedef typename detail::bessel_traits
::result_type result_type; typedef typename detail::bessel_traits
::optimisation_tag tag_type; typedef typename policies::evaluation
::type value_type; return policies::checked_narrowing_cast
(detail::cyl_neumann_imp
(v, static_cast
(x), tag_type(), pol), "boost::math::cyl_neumann<%1%>(%1%,%1%)"); } template
inline typename detail::bessel_traits
>::result_type cyl_neumann(T1 v, T2 x) { return cyl_neumann(v, x, policies::policy<>()); } template
inline typename detail::bessel_traits
::result_type sph_neumann(unsigned v, T x, const Policy& pol) { BOOST_FPU_EXCEPTION_GUARD typedef typename detail::bessel_traits
::result_type result_type; typedef typename policies::evaluation
::type value_type; return policies::checked_narrowing_cast
(detail::sph_neumann_imp
(v, static_cast
(x), pol), "boost::math::sph_neumann<%1%>(%1%,%1%)"); } template
inline typename detail::bessel_traits
>::result_type sph_neumann(unsigned v, T x) { return sph_neumann(v, x, policies::policy<>()); } } // namespace math } // namespace boost #endif // BOOST_MATH_BESSEL_HPP
bessel.hpp
Page URL
File URL
Prev
4/35
Next
Download
( 16 KB )
Note: The DriveHQ service banners will NOT be displayed if the file owner is a paid member.
Comments
Total ratings:
0
Average rating:
Not Rated
Would you like to comment?
Join DriveHQ
for a free account, or
Logon
if you are already a member.