Re: TFormula::Update()

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Feb 18 2000 - 08:29:38 MET


Hi Rutger,
What you request is already implemented in TF1.
TF1::Save(xmin,xmax) can be called by a user to tabulate the function
values at fNpx points. You can call TF1::SetNpx() to change the number
of points. fNpx=100 by default for 1-d functions. Note that this also
works
for 2-d functions.
Then, you can call TF1::GetSave(x) to interpolate a point.
The array of saved values is automatically made persistent when you
write
or stream a TF1 object to a file. TF1::Save is automatically called
by TF1::Streamer. This is necessary in case a TF1 object is of type 2 or
3 (CINT interpreted or compiled function). ROOT cannot assume that your
function
will be available to the reading program.
So, in your case, simply call TF1::Save when your parameters change.
You can call TF1::GetSave() to return a value from the interpolated
table.
Note again that TF1::Eval, TF1::EvalPar will automatically call
TF1::GetSave if the original function is not available.

Rene Brun

Rutger van der Eijk wrote:
> 
> Hi,
> 
> I have a function where the evaluation is expensive (i.e. time). Therefore
> for a given parameters I want to tabelize some values in the allowed range
> and extrapolate between the tabelized values. This I can do because the
> function is called much more often than the that the parameters change.
> 
> I have derived a class from TF1 which has now a lookup table. I overloaded
> TF1::Eval() to look in the lookup table.
> 
> the question:
> 
> I have to make sure my lookup table is reset if parameters or range
> changes. I see there is a member TFormula::Update(). Can I savely assume
> this member is always called when a range or parameters changes takes
> place? (i.e. can I overload TF1::Update() to fill my lookup table)
> 
> cheers,
> 
> Rutger



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:19 MET