Logo ROOT   6.18/05
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
20struct _object;
21typedef _object PyObject;
22
23
25public:
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
38private:
39// to prevent confusion when handing 'self' from python
42
43private:
44 PyObject* fPySelf; //! actual python object
45};
46
47
49public:
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
66private:
67// to prevent confusion when handing 'self' from python
71
72private:
73 PyObject* fPySelf; //! actual python object
74};
75
76#endif
#define f(i)
Definition: RSha256.hxx:104
#define ClassDef(name, id)
Definition: Rtypes.h:326
_object PyObject
Definition: TPyArg.h:20
_object PyObject
Documentation for the abstract class IBaseFunctionMultiDim.
Definition: IFunction.h:62
Interface (abstract class) for multi-dimensional functions providing a gradient calculation.
Definition: IFunction.h:327
virtual unsigned int NDim() const
Retrieve the dimension of the function.
TPyMultiGenFunction(PyObject *self=0)
virtual ROOT::Math::IBaseFunctionMultiDim * Clone() const
Clone a function.
TPyMultiGenFunction(const TPyMultiGenFunction &src)
virtual double DoEval(const double *x) const
Simply forward the call to python self.
virtual ~TPyMultiGenFunction()
Destructor. Only deref if still holding on to Py_None (circular otherwise).
TPyMultiGenFunction & operator=(const TPyMultiGenFunction &)
TPyMultiGradFunction(PyObject *self=0)
virtual unsigned int NDim() const
Retrieve the dimension of the function.
virtual void Gradient(const double *x, double *grad) const
Simply forward the call to python self.
virtual double DoDerivative(const double *x, unsigned int icoord) const
Simply forward the call to python self.
TPyMultiGradFunction & operator=(const TPyMultiGradFunction &)
virtual ROOT::Math::IBaseFunctionMultiDim * Clone() const
Clone a function.
virtual ~TPyMultiGradFunction()
Destructor. Only deref if still holding on to Py_None (circular otherwise).
virtual double DoEval(const double *x) const
Simply forward the call to python self.
virtual void FdF(const double *x, double &f, double *df) const
Simply forward the call to python self.
TPyMultiGradFunction(const TPyMultiGradFunction &src)
Double_t x[n]
Definition: legend1.C:17
Namespace for new Math classes and functions.
IGradientFunctionMultiDim IMultiGradFunction
Definition: IFunctionfwd.h:41
IMultiGenFunctionTempl< double > IMultiGenFunction
Definition: IFunctionfwd.h:32
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21