Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TFormula.h
Go to the documentation of this file.
1// @(#)root/hist:$Id$
2// Author: Maciej Zimnoch 30/09/2013
3
4/*************************************************************************
5 * Copyright (C) 1995-2013, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11#ifndef ROOT_TFormula
12#define ROOT_TFormula
13
14
15#include "TNamed.h"
16#include "TBits.h"
17#include "TInterpreter.h"
18#include "TMath.h"
19#include <Math/Types.h>
20
21#include <atomic>
22#include <cassert>
23#include <list>
24#include <map>
25#include <string>
26#include <vector>
27
28class TMethodCall;
29
30
32{
33public:
39 const char * GetName() const { return fName.Data(); }
40 const char * GetBody() const { return fBody.Data(); }
41 Int_t GetNargs() const { return fNargs;}
42 Bool_t IsFuncCall() const { return fFuncCall;}
44 TFormulaFunction(const TString &name, const TString &body, int numArgs)
45 : fName(name),fBody(body),fNargs(numArgs),fFound(false),fFuncCall(true) {}
47 : fName(name),fBody(""),fNargs(0),fFound(false),fFuncCall(false){}
48 Bool_t operator<(const TFormulaFunction &rhv) const
49 {
50 // order by length - first the longer ones to avoid replacing wrong functions
51 if ( fName.Length() < rhv.fName.Length() )
52 return true;
53 else if ( fName.Length() > rhv.fName.Length() )
54 return false;
55 // case of equal length
56 return fName < rhv.fName && fBody < rhv.fBody;
57 }
58 Bool_t operator==(const TFormulaFunction &rhv) const
59 {
60 return fName == rhv.fName && fBody == rhv.fBody && fNargs == rhv.fNargs;
61 }
62};
63
65{
66public:
71 const char * GetName() const { return fName.Data(); }
72 Double_t GetInitialValue() const { return fValue; }
73 Int_t GetArrayPos() const { return fArrayPos; }
74 TFormulaVariable():fName(""),fValue(-1),fArrayPos(-1),fFound(false){}
76 : fName(name), fValue(value), fArrayPos(pos),fFound(false) {}
77 Bool_t operator<(const TFormulaVariable &rhv) const
78 {
79 return fName < rhv.fName;
80 }
81};
82
83struct TFormulaParamOrder {
84 bool operator() (const TString& a, const TString& b) const;
85};
86
87
88class TFormula : public TNamed
89{
90private:
91
92// All data members are transient apart from the string defining the formula and the parameter values
93 TString fClingInput; ///<! Input function passed to Cling
94 std::vector<Double_t> fClingVariables; ///<! Cached variables
95 std::vector<Double_t> fClingParameters; ///< Parameter values
96 Bool_t fReadyToExecute; ///<! Transient to force initialization
97 std::atomic<Bool_t> fClingInitialized; ///<! Transient to force re-initialization
98 Bool_t fAllParametersSetted; ///< Flag to control if all parameters are setted
99 Bool_t fLazyInitialization = kFALSE; ///<! Transient flag to control lazy initialization (needed for reading from files)
100 std::unique_ptr<TMethodCall> fMethod; ///<! Pointer to methodcall
101 TString fClingName; ///<! Unique name passed to Cling to define the function ( double clingName(double*x, double*p) )
102 std::string fSavedInputFormula; ///<! Unique name used to defined the function and used in the global map (need to be saved in case of lazy initialization)
103
105 std::string fGradGenerationInput; ///<! Input query to clad to generate a gradient
106 std::string fHessGenerationInput; ///<! Input query to clad to generate a hessian
107 CallFuncSignature fFuncPtr = nullptr; ///<! Function pointer, owned by the JIT.
108 CallFuncSignature fGradFuncPtr = nullptr; ///<! Function pointer, owned by the JIT.
109 CallFuncSignature fHessFuncPtr = nullptr; ///<! Function pointer, owned by the JIT.
110 void * fLambdaPtr = nullptr; ///<! Pointer to the lambda function
111 static bool fIsCladRuntimeIncluded;
112
115 void FillDefaults();
116 void HandlePolN(TString &formula);
118 void HandleParamRanges(TString &formula);
119 void HandleFunctionArguments(TString &formula);
120 void HandleExponentiation(TString &formula);
121 void HandleLinear(TString &formula);
122 Bool_t InitLambdaExpression(const char * formula);
124 void ReplaceAllNames(TString &formula, std::map<TString, TString> &substitutions);
125 void FillParametrizedFunctions(std::map<std::pair<TString, Int_t>, std::pair<TString, TString>> &functions);
128 std::string GetGradientFuncName() const {
129 return std::string(GetUniqueFuncName().Data()) + "_grad_1";
130 }
131 std::string GetHessianFuncName() const {
132 return std::string(GetUniqueFuncName().Data()) + "_hessian_1";
133 }
134 bool HasGradientGenerationFailed() const {
135 return !fGradFuncPtr && !fGradGenerationInput.empty();
136 }
137 bool HasHessianGenerationFailed() const {
138 return !fHessFuncPtr && !fHessGenerationInput.empty();
139 }
140
141protected:
142
143 std::list<TFormulaFunction> fFuncs; ///<!
144 std::map<TString,TFormulaVariable> fVars; ///<! List of variable names
145 std::map<TString,Int_t,TFormulaParamOrder> fParams; ///<|| List of parameter names
146 std::map<TString,Double_t> fConsts; ///<!
147 std::map<TString,TString> fFunctionsShortcuts; ///<!
148 TString fFormula; ///< String representing the formula expression
149 Int_t fNdim; ///< Dimension - needed for lambda expressions
150 Int_t fNpar; ///<! Number of parameter (transient since we save the vector)
151 Int_t fNumber; ///< Number used to identify pre-defined functions (gaus, expo,..)
152 std::vector<TObject*> fLinearParts; ///< Vector of linear functions
153 Bool_t fVectorized = false; ///< Whether we should use vectorized or regular variables
154 // (we default to false since a lot of functions still cannot be expressed in vectorized form)
155
156 static Bool_t IsOperator(const char c);
157 static Bool_t IsBracket(const char c);
158 static Bool_t IsFunctionNameChar(const char c);
159 static Bool_t IsScientificNotation(const TString & formula, int ipos);
160 static Bool_t IsHexadecimal(const TString & formula, int ipos);
161 static Bool_t IsAParameterName(const TString & formula, int ipos);
162 void ExtractFunctors(TString &formula);
163 void PreProcessFormula(TString &formula);
164 void ProcessFormula(TString &formula);
165 Bool_t PrepareFormula(TString &formula);
166 void ReplaceParamName(TString &formula, const TString & oldname, const TString & name);
167 void DoAddParameter(const TString &name, Double_t value, bool processFormula);
168 void DoSetParameters(const Double_t * p, Int_t size);
170
171 Double_t DoEval(const Double_t * x, const Double_t * p = nullptr) const;
172#ifdef R__HAS_VECCORE
173 ROOT::Double_v DoEvalVec(const ROOT::Double_v *x, const Double_t *p = nullptr) const;
174#endif
175
176public:
177
178 enum EStatusBits {
179 kNotGlobal = BIT(10), ///< Don't store in gROOT->GetListOfFunction (it should be protected)
180 kNormalized = BIT(14), ///< Set to true if the TFormula (ex gausn) is normalized
181 kLinear = BIT(16), ///< Set to true if the TFormula is for linear fitting
182 kLambda = BIT(17) ///< Set to true if TFormula has been build with a lambda
183 };
184 using CladStorage = std::vector<Double_t>;
185
186 TFormula();
187 ~TFormula() override;
188 TFormula& operator=(const TFormula &rhs);
189 TFormula(const char *name, const char * formula = "", bool addToGlobList = true, bool vectorize = false);
190 TFormula(const char *name, const char * formula, int ndim, int npar, bool addToGlobList = true);
191 TFormula(const TFormula &formula);
192 // TFormula(const char *name, Int_t nparams, Int_t ndims);
193
194 void AddParameter(const TString &name, Double_t value = 0) { DoAddParameter(name,value,true); }
195 void AddVariable(const TString &name, Double_t value = 0);
196 void AddVariables(const TString *vars, const Int_t size);
197 Int_t Compile(const char *expression="");
198 void Copy(TObject &f1) const override;
199 void Clear(Option_t * option="") override;
200 template <typename... Args>
201 Double_t Eval(Args... args) const;
202 Double_t EvalPar(const Double_t *x, const Double_t *params = nullptr) const;
203
204 /// Generate gradient computation routine with respect to the parameters.
205 /// \returns true if a gradient was generated and GradientPar can be called.
206 bool GenerateGradientPar();
207
208 /// Generate hessian computation routine with respect to the parameters.
209 /// \returns true if a hessian was generated and HessianPar can be called.
210 bool GenerateHessianPar();
211
212 /// Compute the gradient employing automatic differentiation.
213 ///
214 /// \param[in] x - The given variables, if nullptr the already stored
215 /// variables are used.
216 /// \param[out] result - The result of the computation wrt each direction.
218
219 void GradientPar(const Double_t *x, Double_t *result);
220
221 /// Compute the gradient employing automatic differentiation.
222 ///
223 /// \param[in] x - The given variables, if nullptr the already stored
224 /// variables are used.
225 /// \param[out] result - The 2D hessian matrix flattened to form a vector
226 /// in row-major order.
228
229 void HessianPar(const Double_t *x, Double_t *result);
230
231 // query if TFormula provides gradient computation using AD (CLAD)
232 bool HasGeneratedGradient() const {
233 return fGradFuncPtr != nullptr;
234 }
235
236 // query if TFormula provides hessian computation using AD (CLAD)
237 bool HasGeneratedHessian() const {
238 return fHessFuncPtr != nullptr;
239 }
240
241 // template <class T>
242 // T Eval(T x, T y = 0, T z = 0, T t = 0) const;
243 template <class T>
244 T EvalPar(const T *x, const Double_t *params = nullptr) const {
245 return EvalParVec(x, params);
246 }
247#ifdef R__HAS_VECCORE
248 ROOT::Double_v EvalParVec(const ROOT::Double_v *x, const Double_t *params = nullptr) const;
249#endif
253 TString GetUniqueFuncName() const {
254 assert(fClingName.Length() && "TFormula is not initialized yet!");
255 return fClingName;
256 }
257
258 const TObject *GetLinearPart(Int_t i) const;
259 Int_t GetNdim() const {return fNdim;}
260 Int_t GetNpar() const {return fNpar;}
261 Int_t GetNumber() const { return fNumber; }
262 const char * GetParName(Int_t ipar) const;
263 Int_t GetParNumber(const char * name) const;
264 Double_t GetParameter(const char * name) const;
265 Double_t GetParameter(Int_t param) const;
266 Double_t* GetParameters() const;
267 void GetParameters(Double_t *params) const;
268 Double_t GetVariable(const char *name) const;
269 Int_t GetVarNumber(const char *name) const;
270 TString GetVarName(Int_t ivar) const;
271 Bool_t IsValid() const { return fReadyToExecute && fClingInitialized; }
272 Bool_t IsVectorized() const { return fVectorized; }
273 Bool_t IsLinear() const { return TestBit(kLinear); }
274 void Print(Option_t *option = "") const override;
275 void SetName(const char* name) override;
276 void SetParameter(const char* name, Double_t value);
277 void SetParameter(Int_t param, Double_t value);
278 void SetParameters(const Double_t *params);
279 //void SetParameters(const pair<TString,Double_t> *params, const Int_t size);
280 template <typename... Args>
281 void SetParameters(Double_t arg1, Args &&... args);
282 void SetParName(Int_t ipar, const char *name);
283 template <typename... Args>
284 void SetParNames(Args &&... args);
285 void SetVariable(const TString &name, Double_t value);
286 void SetVariables(const std::pair<TString,Double_t> *vars, const Int_t size);
287 void SetVectorized(Bool_t vectorized);
288
290};
291
292////////////////////////////////////////////////////////////////////////////////
293/// Set a list of parameters.
294/// The order is by default the alphabetic order given to the parameters,
295/// apart if the users has defined explicitly the parameter names.
296/// NaN values will be skipped, meaning that the corresponding parameters will not be changed.
297
298template <typename... Args>
299void TFormula::SetParameters(Double_t arg1, Args &&...args)
300{
301 int i = 0;
302 for (double val : {arg1, static_cast<Double_t>(args)...}) {
303 if(!TMath::IsNaN(val)) SetParameter(i++, val);
304 }
305}
306
307////////////////////////////////////////////////////////////////////////////////
308/// Set parameter names.
309/// Empty strings will be skipped, meaning that the corresponding name will not be changed.
310template <typename... Args>
311void TFormula::SetParNames(Args &&...args)
312{
313 int i = 0;
314 for (auto name : {static_cast<std::string const&>(args)...}) {
315 if(!name.empty()) SetParName(i++, name.c_str());
316 }
317}
318
319////////////////////////////////////////////////////////////////////////////////
320/// Set first 1, 2, 3 or 4 variables (e.g. x, y, z and t)
321/// and evaluate formula.
322
323template <typename... Args>
324Double_t TFormula::Eval(Args... args) const
325{
326 if (sizeof...(args) > 4) {
327 Error("Eval", "Eval() only support setting up to 4 variables");
328 }
329 double xxx[] = {static_cast<Double_t>(args)...};
330 return EvalPar(xxx, nullptr);
331}
332
333#endif
#define b(i)
Definition RSha256.hxx:100
#define c(i)
Definition RSha256.hxx:101
#define a(i)
Definition RSha256.hxx:99
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
constexpr Bool_t kFALSE
Definition RtypesCore.h:94
double Double_t
Definition RtypesCore.h:59
const char Option_t
Definition RtypesCore.h:66
#define BIT(n)
Definition Rtypes.h:90
#define ClassDefOverride(name, id)
Definition Rtypes.h:346
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
char name[80]
Definition TGX11.cxx:110
Helper class for TFormula.
Definition TFormula.h:32
const char * GetName() const
Definition TFormula.h:39
const char * GetBody() const
Definition TFormula.h:40
Int_t GetNargs() const
Definition TFormula.h:41
TString fName
Definition TFormula.h:34
TString fBody
Definition TFormula.h:35
Bool_t operator<(const TFormulaFunction &rhv) const
Definition TFormula.h:48
Bool_t fFuncCall
Definition TFormula.h:38
Bool_t IsFuncCall() const
Definition TFormula.h:42
Bool_t operator==(const TFormulaFunction &rhv) const
Definition TFormula.h:58
Another helper class for TFormula.
Definition TFormula.h:65
TString fName
Definition TFormula.h:67
Bool_t operator<(const TFormulaVariable &rhv) const
Definition TFormula.h:77
const char * GetName() const
Definition TFormula.h:71
Int_t GetArrayPos() const
Definition TFormula.h:73
Double_t GetInitialValue() const
Definition TFormula.h:72
Double_t fValue
Definition TFormula.h:68
The Formula class.
Definition TFormula.h:89
CallFuncSignature fHessFuncPtr
! Function pointer, owned by the JIT.
Definition TFormula.h:109
Double_t GetParameter(const char *name) const
Returns parameter value given by string.
Bool_t PrepareFormula(TString &formula)
prepare the formula to be executed normally is called with fFormula
std::atomic< Bool_t > fClingInitialized
! Transient to force re-initialization
Definition TFormula.h:97
void GradientPar(const Double_t *x, TFormula::CladStorage &result)
Compute the gradient employing automatic differentiation.
void FillDefaults()
Fill structures with default variables, constants and function shortcuts.
Definition TFormula.cxx:902
void SetParNames(Args &&... args)
Set parameter names.
Definition TFormula.h:311
TString GetHessianFormula() const
void Clear(Option_t *option="") override
Clear the formula setting expression to empty and reset the variables and parameters containers.
Definition TFormula.cxx:767
const TObject * GetLinearPart(Int_t i) const
Return linear part.
Bool_t IsLinear() const
Definition TFormula.h:273
void InputFormulaIntoCling()
Inputs formula, transfered to C++ code into Cling.
Definition TFormula.cxx:876
bool HasGeneratedHessian() const
Definition TFormula.h:237
void DoAddParameter(const TString &name, Double_t value, bool processFormula)
Adds parameter to known parameters.
bool HasGeneratedGradient() const
Definition TFormula.h:232
void HandleLinear(TString &formula)
Handle linear functions defined with the operator ++.
TString fClingName
! Unique name passed to Cling to define the function ( double clingName(double*x, double*p) )
Definition TFormula.h:101
TString GetVarName(Int_t ivar) const
Returns variable name given its position in the array.
void SetVariable(const TString &name, Double_t value)
Sets variable value.
void HessianPar(const Double_t *x, TFormula::CladStorage &result)
Compute the gradient employing automatic differentiation.
Int_t GetParNumber(const char *name) const
Return parameter index given a name (return -1 for not existing parameters) non need to print an erro...
void DoSetParameters(const Double_t *p, Int_t size)
bool GenerateHessianPar()
Generate hessian computation routine with respect to the parameters.
TString GetGradientFormula() const
void HandleParametrizedFunctions(TString &formula)
Handling parametrized functions Function can be normalized, and have different variable then x.
~TFormula() override
Definition TFormula.cxx:465
TInterpreter::CallFuncIFacePtr_t::Generic_t CallFuncSignature
Definition TFormula.h:104
Double_t * GetParameters() const
void SetParName(Int_t ipar, const char *name)
void SetName(const char *name) override
Set the name of the formula.
std::string GetHessianFuncName() const
Definition TFormula.h:131
std::string fGradGenerationInput
! Input query to clad to generate a gradient
Definition TFormula.h:105
static Bool_t IsAParameterName(const TString &formula, int ipos)
Definition TFormula.cxx:353
bool HasGradientGenerationFailed() const
Definition TFormula.h:134
Double_t Eval(Args... args) const
Set first 1, 2, 3 or 4 variables (e.g.
Definition TFormula.h:324
void ReplaceParamName(TString &formula, const TString &oldname, const TString &name)
Replace in Formula expression the parameter name.
void SetPredefinedParamNames()
Set parameter names only in case of pre-defined functions.
void Copy(TObject &f1) const override
Copy this to obj.
Definition TFormula.cxx:684
std::map< TString, Double_t > fConsts
!
Definition TFormula.h:146
std::map< TString, TString > fFunctionsShortcuts
!
Definition TFormula.h:147
void HandleParamRanges(TString &formula)
Handling parameter ranges, in the form of [1..5].
std::vector< TObject * > fLinearParts
Vector of linear functions.
Definition TFormula.h:152
static Bool_t IsBracket(const char c)
Definition TFormula.cxx:294
Bool_t fVectorized
Whether we should use vectorized or regular variables.
Definition TFormula.h:153
TString fClingInput
! Input function passed to Cling
Definition TFormula.h:93
Bool_t PrepareEvalMethod()
Sets TMethodCall to function inside Cling environment.
Definition TFormula.cxx:861
Int_t fNumber
Number used to identify pre-defined functions (gaus, expo,..)
Definition TFormula.h:151
std::string GetGradientFuncName() const
Definition TFormula.h:128
static bool fIsCladRuntimeIncluded
Definition TFormula.h:111
std::vector< Double_t > CladStorage
Definition TFormula.h:184
Double_t GetVariable(const char *name) const
Returns variable value.
std::list< TFormulaFunction > fFuncs
!
Definition TFormula.h:143
Bool_t fAllParametersSetted
Flag to control if all parameters are setted.
Definition TFormula.h:98
void ProcessFormula(TString &formula)
Iterates through functors in fFuncs and performs the appropriate action.
static Bool_t IsOperator(const char c)
Definition TFormula.cxx:286
bool HasHessianGenerationFailed() const
Definition TFormula.h:137
void SetVectorized(Bool_t vectorized)
void FillVecFunctionsShurtCuts()
Fill the shortcuts for vectorized functions We will replace for example sin with vecCore::Mat::Sin.
Definition TFormula.cxx:970
const char * GetParName(Int_t ipar) const
Return parameter name given by integer.
std::map< TString, TFormulaVariable > fVars
! List of variable names
Definition TFormula.h:144
CallFuncSignature fFuncPtr
! Function pointer, owned by the JIT.
Definition TFormula.h:107
void HandlePolN(TString &formula)
Handling polN If before 'pol' exist any name, this name will be treated as variable used in polynomia...
static Bool_t IsHexadecimal(const TString &formula, int ipos)
Definition TFormula.cxx:330
void ExtractFunctors(TString &formula)
Extracts functors from formula, and put them in fFuncs.
Int_t GetNumber() const
Definition TFormula.h:261
Bool_t InitLambdaExpression(const char *formula)
Definition TFormula.cxx:605
TString GetUniqueFuncName() const
Definition TFormula.h:253
void SetParameters(const Double_t *params)
Set a vector of parameters value.
void AddParameter(const TString &name, Double_t value=0)
Definition TFormula.h:194
std::string fSavedInputFormula
! Unique name used to defined the function and used in the global map (need to be saved in case of la...
Definition TFormula.h:102
Bool_t IsValid() const
Definition TFormula.h:271
void ReplaceAllNames(TString &formula, std::map< TString, TString > &substitutions)
Definition TFormula.cxx:405
static Bool_t IsDefaultVariableName(const TString &name)
Definition TFormula.cxx:312
Int_t GetNpar() const
Definition TFormula.h:260
void FillParametrizedFunctions(std::map< std::pair< TString, Int_t >, std::pair< TString, TString > > &functions)
Fill map with parametrized functions.
Double_t EvalPar(const Double_t *x, const Double_t *params=nullptr) const
void AddVariables(const TString *vars, const Int_t size)
Adds multiple variables.
Int_t GetVarNumber(const char *name) const
Returns variable number (positon in array) given its name.
std::vector< Double_t > fClingVariables
! Cached variables
Definition TFormula.h:94
std::unique_ptr< TMethodCall > fMethod
! Pointer to methodcall
Definition TFormula.h:100
TString fFormula
String representing the formula expression.
Definition TFormula.h:148
static Bool_t IsScientificNotation(const TString &formula, int ipos)
Definition TFormula.cxx:318
CallFuncSignature fGradFuncPtr
! Function pointer, owned by the JIT.
Definition TFormula.h:108
std::vector< Double_t > fClingParameters
Parameter values.
Definition TFormula.h:95
void SetParameter(const char *name, Double_t value)
Sets parameter value.
void Print(Option_t *option="") const override
Print the formula and its attributes.
void PreProcessFormula(TString &formula)
Preprocessing of formula Replace all ** by ^, and removes spaces.
TString GetExpFormula(Option_t *option="") const
Return the expression formula.
Int_t fNdim
Dimension - needed for lambda expressions.
Definition TFormula.h:149
void SetVariables(const std::pair< TString, Double_t > *vars, const Int_t size)
Sets multiple variables.
void ReInitializeEvalMethod()
Re-initialize eval method.
@ kNotGlobal
Don't store in gROOT->GetListOfFunction (it should be protected)
Definition TFormula.h:179
@ kLambda
Set to true if TFormula has been build with a lambda.
Definition TFormula.h:182
@ kLinear
Set to true if the TFormula is for linear fitting.
Definition TFormula.h:181
@ kNormalized
Set to true if the TFormula (ex gausn) is normalized.
Definition TFormula.h:180
void * fLambdaPtr
! Pointer to the lambda function
Definition TFormula.h:110
TFormula & operator=(const TFormula &rhs)
= operator.
Definition TFormula.cxx:597
Int_t Compile(const char *expression="")
Compile the given expression with Cling backward compatibility method to be used in combination with ...
Definition TFormula.cxx:650
Int_t fNpar
! Number of parameter (transient since we save the vector)
Definition TFormula.h:150
void HandleFunctionArguments(TString &formula)
Handling user functions (and parametrized functions) to take variables and optionally parameters as a...
std::map< TString, Int_t, TFormulaParamOrder > fParams
|| List of parameter names
Definition TFormula.h:145
Bool_t IsVectorized() const
Definition TFormula.h:272
void AddVariable(const TString &name, Double_t value=0)
Adds variable to known variables, and reprocess formula.
Bool_t fLazyInitialization
! Transient flag to control lazy initialization (needed for reading from files)
Definition TFormula.h:99
Int_t GetNdim() const
Definition TFormula.h:259
void HandleExponentiation(TString &formula)
Handling exponentiation Can handle multiple carets, eg.
static Bool_t IsFunctionNameChar(const char c)
Definition TFormula.cxx:306
std::string fHessGenerationInput
! Input query to clad to generate a hessian
Definition TFormula.h:106
Double_t DoEval(const Double_t *x, const Double_t *p=nullptr) const
Evaluate formula.
Bool_t fReadyToExecute
! Transient to force initialization
Definition TFormula.h:96
bool GenerateGradientPar()
Generate gradient computation routine with respect to the parameters.
Method or function calling interface.
Definition TMethodCall.h:37
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
Mother of all ROOT objects.
Definition TObject.h:41
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition TObject.h:199
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:993
Basic string class.
Definition TString.h:139
Ssiz_t Length() const
Definition TString.h:417
const char * Data() const
Definition TString.h:376
Double_t x[n]
Definition legend1.C:17
TF1 * f1
Definition legend1.C:11
double T(double x)
Bool_t IsNaN(Double_t x)
Definition TMath.h:892
Functor defining the parameter order.
Definition TFormula.h:83
bool operator()(const TString &a, const TString &b) const
Definition TFormula.cxx:375
void(* Generic_t)(void *, int, void **, void *)