Revisão | 8c7c25238ed835851b897abf5e6c76393092faad (tree) |
---|---|
Hora | 2013-01-22 05:19:05 |
Autor | Katsuhiko Nishimra <ktns.87@gmai...> |
Commiter | Katsuhiko Nishimra |
Call boost::math::factorial in MolDS_base::Factorial if available. #30557
git-svn-id: https://svn.sourceforge.jp/svnroot/molds/branches/automake@1240 1136aad2-a195-0410-b898-f5ea1d11b9d8
@@ -23,10 +23,13 @@ | ||
23 | 23 | #include<math.h> |
24 | 24 | #include<stdexcept> |
25 | 25 | #include<boost/format.hpp> |
26 | +#include"config.h" | |
27 | +#ifdef HAVE_BOOST_MATH_SPECIAL_FUNCTIONS_FACTORIALS_HPP | |
28 | +#include<boost/math/special_functions/factorials.hpp> | |
29 | +#endif | |
26 | 30 | #include"PrintController.h" |
27 | 31 | #include"MolDSException.h" |
28 | 32 | #include"Uncopyable.h" |
29 | -#include"config.h" | |
30 | 33 | #include"../wrappers/Lapack.h" |
31 | 34 | #include"Enums.h" |
32 | 35 | #include"MathUtilities.h" |
@@ -42,12 +45,16 @@ int Factorial(int n){ | ||
42 | 45 | ss << "Error in base::MathUtility::Factorial: n<0 \n"; |
43 | 46 | throw MolDSException(ss.str()); |
44 | 47 | } |
48 | +#ifdef HAVE_BOOST_MATH_SPECIAL_FUNCTIONS_FACTORIALS_HPP | |
49 | + return static_cast<int>(boost::math::factorial<double>(n)); | |
50 | +#else | |
45 | 51 | else if (n>1){ |
46 | 52 | return n*Factorial(n-1); |
47 | 53 | } |
48 | 54 | else{ |
49 | 55 | return 1; |
50 | 56 | } |
57 | +#endif | |
51 | 58 | } |
52 | 59 | |
53 | 60 | // nCk |