test_nccs_hooks.hpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // (C) Copyright John Maddock 2008.
  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_NCCS_OTHER_HOOKS_HPP
  6. #define BOOST_MATH_TEST_NCCS_OTHER_HOOKS_HPP
  7. #ifdef TEST_R
  8. #define MATHLIB_STANDALONE
  9. #include <rmath.h>
  10. namespace other{
  11. inline float nccs_cdf(float df, float nc, float x)
  12. {
  13. return (float)pnchisq(x, df, nc, 1, 0);
  14. }
  15. inline double nccs_cdf(double df, double nc, double x)
  16. {
  17. return pnchisq(x, df, nc, 1, 0);
  18. }
  19. inline long double nccs_cdf(long double df, long double nc, long double x)
  20. {
  21. return pnchisq((double)x, (double)df, (double)nc, 1, 0);
  22. }
  23. }
  24. #define TEST_OTHER
  25. #endif
  26. #ifdef TEST_CDFLIB
  27. #include <cdflib.h>
  28. namespace other{
  29. inline double nccs_cdf(double df, double nc, double x)
  30. {
  31. int kind(1), status(0);
  32. double p, q, bound(0);
  33. cdfchn(&kind, &p, &q, &x, &df, &nc, &status, &bound);
  34. return p;
  35. }
  36. inline float nccs_cdf(float df, float nc, float x)
  37. {
  38. return (double)nccs_cdf((double)df, (double)nc, (double)x);
  39. }
  40. inline long double nccs_cdf(long double df, long double nc, long double x)
  41. {
  42. return nccs_cdf((double)df, (double)nc, (double)x);
  43. }
  44. }
  45. #define TEST_OTHER
  46. #endif
  47. #ifdef TEST_OTHER
  48. namespace other{
  49. boost::math::concepts::real_concept nccs_cdf(boost::math::concepts::real_concept, boost::math::concepts::real_concept, boost::math::concepts::real_concept){ return 0; }
  50. }
  51. #endif
  52. #endif