Logo ROOT   6.10/09
Reference Guide
TPyFitFunction.h
Go to the documentation of this file.
1 // Author: Wim Lavrijsen November 2010
2 
3 #ifndef ROOT_TPyFitFunction
4 #define ROOT_TPyFitFunction
5 
6 //////////////////////////////////////////////////////////////////////////////
7 // //
8 // TPyFitFunction //
9 // //
10 // Python base class to work with Math::IMultiGenFunction //
11 // //
12 //////////////////////////////////////////////////////////////////////////////
13 
14 
15 //- ROOT
16 #include "Math/IFunction.h"
17 #include "Rtypes.h"
18 
19 // Python
20 struct _object;
21 typedef _object PyObject;
22 
23 
25 public:
26 // ctor/dtor, and assignment
27  TPyMultiGenFunction( PyObject* self = 0 );
28  virtual ~TPyMultiGenFunction();
29 
30 // Math::IMultiGenFunction implementation
32  { return new TPyMultiGenFunction( fPySelf ); }
33  virtual unsigned int NDim() const;
34  virtual double DoEval( const double* x ) const;
35 
36  ClassDef( TPyMultiGenFunction, 1 ); //Python for Math::IMultiGenFunction equivalent
37 
38 private:
39 // to prevent confusion when handing 'self' from python
41  TPyMultiGenFunction& operator=( const TPyMultiGenFunction& ) { return *this; }
42 
43 private:
44  PyObject* fPySelf; //! actual python object
45 };
46 
47 
49 public:
50 // ctor/dtor, and assignment
51  TPyMultiGradFunction( PyObject* self = 0 );
52  virtual ~TPyMultiGradFunction();
53 
54 // Math::IMultiGenFunction implementation
56  { return new TPyMultiGradFunction( fPySelf ); }
57  virtual unsigned int NDim() const;
58  virtual double DoEval( const double* x ) const;
59 
60  virtual void Gradient( const double* x, double* grad ) const;
61  virtual void FdF( const double* x, double& f, double* df ) const;
62  virtual double DoDerivative( const double * x, unsigned int icoord ) const;
63 
64  ClassDef( TPyMultiGradFunction, 1 ); //Python for Math::IMultiGradFunction equivalent
65 
66 private:
67 // to prevent confusion when handing 'self' from python
71 
72 private:
73  PyObject* fPySelf; //! actual python object
74 };
75 
76 #endif
virtual ROOT::Math::IBaseFunctionMultiDim * Clone() const
Clone a function.
Interface (abstract class) for multi-dimensional functions providing a gradient calculation.
Definition: IFunction.h:330
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21
virtual unsigned int NDim() const
Retrieve the dimension of the function.
virtual double DoEval(const double *x) const
Simply forward the call to python self.
_object PyObject
TPyMultiGenFunction(const TPyMultiGenFunction &src)
TPyMultiGenFunction & operator=(const TPyMultiGenFunction &)
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:297
TPyMultiGenFunction(PyObject *self=0)
TPyMultiGradFunction & operator=(const TPyMultiGradFunction &)
Documentation for the abstract class IBaseFunctionMultiDim.
Definition: IFunction.h:62
TPyMultiGradFunction(const TPyMultiGradFunction &src)
IGradientFunctionMultiDim IMultiGradFunction
Definition: IFunctionfwd.h:36
virtual ROOT::Math::IBaseFunctionMultiDim * Clone() const
Clone a function.
double f(double x)
IMultiGenFunctionTempl< double > IMultiGenFunction
Definition: IFunctionfwd.h:30
Namespace for new Math classes and functions.
virtual ~TPyMultiGenFunction()
Destructor. Only deref if still holding on to Py_None (circular otherwise).
_object PyObject
Definition: TPyArg.h:20