RE: TGraph::Min/Max

From: Anton Fokin (fokin@tsl.uu.se)
Date: Sun Feb 27 2000 - 12:34:46 MET


Hi Rene,

it is easy to check min/max while you set point in a graph or copy array in
the constructor, so that you do not need to go through the whole x or y
array each time you ask for min/max. The lines below are much more time
consuming if you need to get min/max more than once.

Best,
Anton

-----Original Message-----
From: Rene Brun [mailto:brun@pcbrun.cern.ch]
Sent: Sunday, February 27, 2000 9:36 AM
To: Anton Fokin
Cc: roottalk@pcroot.cern.ch
Subject: Re: TGraph::Min/Max



Anton,
If you have a TGraph *gr, you can do
  int n = gr->GetN();
  float *x = gr->GetX();
  int locmin = TMath::LocMin(n,x);
  float xmin = x[locmin];

I could add the functions TGraph::GetMinimum, etc to save these
few lines of code.

Rene Brun


On Sat, 26 Feb 2000, Anton Fokin wrote:

> Hi rooters,
>
> I think it would be good to have GetMin/MaxX() GetMin/MaxY() in TGraph. At
> least I have a situation where I need it.
>
> Regards,
> Anton
>



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