<commit_before>
#include "Math/IParamFunction.h"
#include <cmath>


class GaussFunction : public ROOT::Math::IParamMultiGradFunction { 

public: 

   enum { 
      kNPar = 3 
   }; 

   GaussFunction(double amp = 1, double mean = 0, double sigma = 1) {
      fParams[0] = amp;
      fParams[1] = mean; 
      fParams[2] = sigma; 
      fLogAmp = std::log(amp);
   }

   unsigned int NDim() const { return 1; }

   unsigned int NPar() const { return kNPar; }

   inline double amp()   const { return fParams[0]; }
   inline double logamp()   const { return fLogAmp; }
   inline double mean()  const { return fParams[1]; }
   inline double sigma() const { return fParams[2]; }

   const double * Parameters() const { return fParams; } 
   
   void SetParameters(const double * p) { std::copy(p,p+kNPar,fParams); /* fLogAmp = std::log( p[0] ); */ }


   ROOT::Math::IMultiGenFunction * Clone() const { return new GaussFunction(amp(), mean(), sigma() ); }


   // implementing this is much faster
   double operator()(const double *x, const double * p) { 
      double y = (x[0]-p[1])/p[2];
      return p[0]*std::exp(-0.5*y*y);
   }

   using  ROOT::Math::IParamMultiGradFunction::operator();

   void ParameterGradient(const double *x, const double * p, double * g) const { 
      double a = p[0]; 
      double m = p[1]; 
      double s = p[2]; 
      double y = (x[0]- m )/s;
      g[0] = std::exp(-0.5*y*y);
      g[1] =  a *g[0]*y/s;
      g[2] = g[1]*y; 
   }


private: 


   double DoEvalPar(const double * x, const double * p) const { 
      double a = p[0]; 
      double m = p[1]; 
      double s = p[2]; 
      double y = (x[0]-m)/s;
      return a*std::exp(-0.5*y*y);
   }

   double DoDerivative(const double *x, unsigned int icoord) const { 
      assert (icoord == 0); 
      double dGdx = -(*this)(x) * (x[0]-mean())/(sigma()*sigma());
      return dGdx; 
   }

   double DoParameterDerivative(const double *x, const double * p, unsigned int ipar) const { 
      double grad[3];
      ParameterGradient(x, p, &grad[0] ); 
      return grad[ipar]; 
   }


   double fParams[kNPar]; 
   double fLogAmp; 
}; <commit_msg>Another warning in the tests<commit_after>
#include "Math/IParamFunction.h"
#include <cmath>


class GaussFunction : public ROOT::Math::IParamMultiGradFunction { 

public: 

   enum { 
      kNPar = 3 
   }; 

   GaussFunction(double amp = 1, double mean = 0, double sigma = 1) {
      fParams[0] = amp;
      fParams[1] = mean; 
      fParams[2] = sigma; 
      fLogAmp = std::log(amp);
   }

   unsigned int NDim() const { return 1; }

   unsigned int NPar() const { return kNPar; }

   inline double amp()   const { return fParams[0]; }
   inline double logamp()   const { return fLogAmp; }
   inline double mean()  const { return fParams[1]; }
   inline double sigma() const { return fParams[2]; }

   const double * Parameters() const { return fParams; } 
   
   void SetParameters(const double * p) { std::copy(p,p+kNPar,fParams); /* fLogAmp = std::log( p[0] ); */ }


   ROOT::Math::IMultiGenFunction * Clone() const { return new GaussFunction(amp(), mean(), sigma() ); }


   // implementing this is much faster
   double operator()(const double *x, const double * p) { 
      double y = (x[0]-p[1])/p[2];
      return p[0]*std::exp(-0.5*y*y);
   }

   using  ROOT::Math::IParamMultiGradFunction::operator();

   void ParameterGradient(const double *x, const double * p, double * g) const { 
      double a = p[0]; 
      double m = p[1]; 
      double s = p[2]; 
      double y = (x[0]- m )/s;
      g[0] = std::exp(-0.5*y*y);
      g[1] =  a *g[0]*y/s;
      g[2] = g[1]*y; 
   }


private: 


   double DoEvalPar(const double * x, const double * p) const { 
      double a = p[0]; 
      double m = p[1]; 
      double s = p[2]; 
      double y = (x[0]-m)/s;
      return a*std::exp(-0.5*y*y);
   }

   double DoDerivative(const double *x, unsigned int icoord) const {
      (void)icoord;
      assert (icoord == 0); 
      double dGdx = -(*this)(x) * (x[0]-mean())/(sigma()*sigma());
      return dGdx; 
   }

   double DoParameterDerivative(const double *x, const double * p, unsigned int ipar) const { 
      double grad[3];
      ParameterGradient(x, p, &grad[0] ); 
      return grad[ipar]; 
   }


   double fParams[kNPar]; 
   double fLogAmp; 
}; 
{'fraction_non_alphanumeric': 0.1585195530726257, 'fraction_numerical': 0.018156424581005588, 'mean_word_length': 2.6200505475989893, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1772296', 'n_tokens_mistral': 1638, 'n_tokens_neox': 1501, 'n_words': 405}