test_expint_hooks.hpp 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. // (C) Copyright John Maddock 2006.
  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. #ifndef BOOST_MATH_TEST_ZETA_OTHER_HOOKS_HPP
  6. #define BOOST_MATH_TEST_ZETA_OTHER_HOOKS_HPP
  7. #ifdef TEST_CEPHES
  8. namespace other{
  9. extern "C" {
  10. double expn(int, double);
  11. float expnf(int, float);
  12. long double expnl(int, long double);
  13. }
  14. inline float expint(unsigned n, float a)
  15. { return expnf(n, a); }
  16. inline double expint(unsigned n, double a)
  17. { return expn(n, a); }
  18. inline long double expint(unsigned n, long double a)
  19. {
  20. #ifdef BOOST_MSVC
  21. return expn(n, (double)a);
  22. #else
  23. return expnl(n, a);
  24. #endif
  25. }
  26. // Ei is not supported:
  27. template <class T>
  28. inline T expint(T){ return 0; }
  29. }
  30. #define TEST_OTHER
  31. #endif
  32. #ifdef TEST_GSL
  33. #include <gsl/gsl_sf_expint.h>
  34. namespace other{
  35. inline float expint(float a)
  36. { return (float)gsl_sf_expint_Ei(a); }
  37. inline double expint(double a)
  38. { return gsl_sf_expint_Ei(a); }
  39. inline long double expint(long double a)
  40. { return gsl_sf_expint_Ei(a); }
  41. // En is not supported:
  42. template <class T>
  43. inline T expint(unsigned, T){ return 0; }
  44. }
  45. #define TEST_OTHER
  46. #endif
  47. #ifdef TEST_SPECFUN
  48. namespace other{
  49. extern "C" int calcei_(double *arg, double *result, int*);
  50. inline float expint(float a)
  51. {
  52. double r, a_(a);
  53. int v = 1;
  54. calcei_(&a_, &r, &v);
  55. return (float)r;
  56. }
  57. inline double expint(double a)
  58. {
  59. double r, a_(a);
  60. int v = 1;
  61. calcei_(&a_, &r, &v);
  62. return r;
  63. }
  64. inline long double expint(long double a)
  65. {
  66. double r, a_(a);
  67. int v = 1;
  68. calcei_(&a_, &r, &v);
  69. return r;
  70. }
  71. // En is not supported:
  72. template <class T>
  73. inline T expint(unsigned, T){ return 0; }
  74. }
  75. #define TEST_OTHER
  76. #endif
  77. #ifdef TEST_OTHER
  78. namespace other{
  79. boost::math::concepts::real_concept expint(unsigned, boost::math::concepts::real_concept){ return 0; }
  80. boost::math::concepts::real_concept expint(boost::math::concepts::real_concept){ return 0; }
  81. }
  82. #endif
  83. #endif