#include "Math/IFunction.h"
#include "Math/IParamFunction.h"
#include "Math/Derivator.h"
#include "GSLDerivator.h"
#include "OneDimFunctionAdapter.h"
#include "gsl/gsl_deriv.h"
namespace ROOT {
namespace Math {
Derivator::Derivator() {
fDerivator = new GSLDerivator();
}
Derivator::Derivator(const IGenFunction &f)
{
fDerivator = new GSLDerivator();
fDerivator->SetFunction(f);
}
Derivator::Derivator(const GSLFuncPointer &f, void * p)
{
fDerivator = new GSLDerivator();
fDerivator->SetFunction(f,p);
}
Derivator::~Derivator()
{
if (fDerivator) delete fDerivator;
}
Derivator::Derivator(const Derivator &)
{
}
Derivator & Derivator::operator = (const Derivator &rhs)
{
if (this == &rhs) return *this;
return *this;
}
void Derivator::SetFunction(const IGenFunction &f) {
fDerivator->SetFunction(f);
}
void Derivator::SetFunction( const GSLFuncPointer &f, void * p) {
fDerivator->SetFunction(f,p);
}
double Derivator::Eval( double x, double h) const {
return fDerivator->EvalCentral(x, h);
}
double Derivator::EvalCentral( double x, double h) const {
return fDerivator->EvalCentral(x, h);
}
double Derivator::EvalForward( double x, double h) const {
return fDerivator->EvalForward(x, h);
}
double Derivator::EvalBackward( double x, double h) const {
return fDerivator->EvalBackward(x, h);
}
double Derivator::Eval(const IGenFunction & f, double x, double h ) {
return GSLDerivator::EvalCentral(f, x, h );
}
double Derivator::EvalCentral(const IGenFunction & f, double x, double h) {
return GSLDerivator::EvalCentral(f,x,h);
}
double Derivator::EvalForward(const IGenFunction & f, double x, double h) {
return GSLDerivator::EvalForward(f, x, h);
}
double Derivator::EvalBackward(const IGenFunction & f, double x, double h) {
return GSLDerivator::EvalBackward(f, x, h);
}
double Derivator::Eval(const IMultiGenFunction & f, const double * x, unsigned int icoord, double h ) {
GSLDerivator d;
OneDimMultiFunctionAdapter<> adapter(f,x,icoord);
d.SetFunction( &GSLFunctionAdapter<OneDimMultiFunctionAdapter<> >::F,static_cast<void *>(&adapter) );
return d.EvalCentral(x[icoord],h);
}
double Derivator::Eval(IParamFunction & f, double x, const double * p, unsigned int ipar, double h ) {
GSLDerivator d;
const double xx = x;
OneDimParamFunctionAdapter<IParamFunction &> adapter(f,&xx,p,ipar);
d.SetFunction( &GSLFunctionAdapter<OneDimParamFunctionAdapter<IParamFunction &> >::F,static_cast<void *>(&adapter) );
return d.EvalCentral(p[ipar],h);
}
double Derivator::Eval(IParamMultiFunction & f, const double * x, const double * p, unsigned int ipar, double h ) {
GSLDerivator d;
OneDimParamFunctionAdapter<IParamMultiFunction &> adapter(f,x,p,ipar);
d.SetFunction( &GSLFunctionAdapter<OneDimParamFunctionAdapter<IParamMultiFunction &> >::F,static_cast<void *>(&adapter) );
return d.EvalCentral(p[ipar],h);
}
double Derivator::Result() const { return fDerivator->Result(); }
double Derivator::Error() const { return fDerivator->Error(); }
int Derivator::Status() const { return fDerivator->Status(); }
}
}
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.