Logo ROOT   6.08/07
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 #ifndef ROOT_Math_IFunction
17 #include "Math/IFunction.h"
18 #endif
19 #ifndef ROOT_Rtypes
20 #include "Rtypes.h"
21 #endif
22 
23 // Python
24 struct _object;
25 typedef _object PyObject;
26 
27 
29 public:
30 // ctor/dtor, and assignment
31  TPyMultiGenFunction( PyObject* self = 0 );
32  virtual ~TPyMultiGenFunction();
33 
34 // Math::IMultiGenFunction implementation
36  { return new TPyMultiGenFunction( fPySelf ); }
37  virtual unsigned int NDim() const;
38  virtual double DoEval( const double* x ) const;
39 
40  ClassDef( TPyMultiGenFunction, 1 ); //Python for Math::IMultiGenFunction equivalent
41 
42 private:
43 // to prevent confusion when handing 'self' from python
45  TPyMultiGenFunction& operator=( const TPyMultiGenFunction& ) { return *this; }
46 
47 private:
48  PyObject* fPySelf; //! actual python object
49 };
50 
51 
53 public:
54 // ctor/dtor, and assignment
55  TPyMultiGradFunction( PyObject* self = 0 );
56  virtual ~TPyMultiGradFunction();
57 
58 // Math::IMultiGenFunction implementation
60  { return new TPyMultiGradFunction( fPySelf ); }
61  virtual unsigned int NDim() const;
62  virtual double DoEval( const double* x ) const;
63 
64  virtual void Gradient( const double* x, double* grad ) const;
65  virtual void FdF( const double* x, double& f, double* df ) const;
66  virtual double DoDerivative( const double * x, unsigned int icoord ) const;
67 
68  ClassDef( TPyMultiGradFunction, 1 ); //Python for Math::IMultiGradFunction equivalent
69 
70 private:
71 // to prevent confusion when handing 'self' from python
75 
76 private:
77  PyObject* fPySelf; //! actual python object
78 };
79 
80 #endif
virtual ROOT::Math::IBaseFunctionMultiDim * Clone() const
Clone a function.
Interface (abstract class) for multi-dimensional functions providing a gradient calculation.
Definition: IFunction.h:322
This namespace contains pre-defined functions to be used in conjuction with TExecutor::Map and TExecu...
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:254
TPyMultiGenFunction(PyObject *self=0)
TPyMultiGradFunction & operator=(const TPyMultiGradFunction &)
TPyMultiGradFunction(const TPyMultiGradFunction &src)
IGradientFunctionMultiDim IMultiGradFunction
Definition: IFunctionfwd.h:31
virtual ROOT::Math::IBaseFunctionMultiDim * Clone() const
Clone a function.
double f(double x)
IBaseFunctionMultiDim IMultiGenFunction
Definition: IFunctionfwd.h:28
Namespace for new Math classes and functions.
virtual ~TPyMultiGenFunction()
Destructor. Only deref if still holding on to Py_None (circular otherwise).
Documentation for the abstract class IBaseFunctionMultiDim.
Definition: IFunction.h:63
_object PyObject
Definition: TPyArg.h:22