Skip to content
Snippets Groups Projects
Commit b1035bdf authored by Julien Malik's avatar Julien Malik
Browse files

ENH: use already implemented boost gamma function

parent 2dbabf01
No related branches found
No related tags found
No related merge requests found
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "otbMRFEnergy.h" #include "otbMRFEnergy.h"
#include "otbMath.h" #include "otbMath.h"
#include "otbGamma.h" #include "otbGamma.h"
#include <boost/math/special_functions/gamma.hpp>
namespace otb namespace otb
{ {
...@@ -75,11 +76,12 @@ public: ...@@ -75,11 +76,12 @@ public:
double l = this->m_Parameters[3*static_cast<double>(value2)+1]; double l = this->m_Parameters[3*static_cast<double>(value2)+1];
double m = this->m_Parameters[3*static_cast<double>(value2)+2]; double m = this->m_Parameters[3*static_cast<double>(value2)+2];
double result = -vcl_log((g.gamma(l+m)/(g.gamma(l)*g.gamma(m))) * (2/(mu)) * (vcl_sqrt(l/m)) * double result = -vcl_log((boost::math::tgamma(l+m)/(boost::math::tgamma(l)*boost::math::tgamma(m)))
((pow((vcl_sqrt(l/m)*(val1/mu)), ((2*l)-1))) / * (2/(mu)) * (vcl_sqrt(l/m)) *
(pow(1+(vcl_sqrt(l/m)*(val1/mu)*vcl_sqrt(l/m)*(val1/mu)), (l+m))))); ((vcl_pow((vcl_sqrt(l/m)*(val1/mu)), ((2*l)-1))) /
(vcl_pow(1+(vcl_sqrt(l/m)*(val1/mu)*vcl_sqrt(l/m)*(val1/mu)), (l+m)))));
return static_cast<double>( result ); return result;
} }
protected: protected:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment