[ROOT] running sum of arrays ?

From: Andre Holzner (Andre.Holzner@cern.ch)
Date: Thu Jun 14 2001 - 14:41:11 MEST


Hello Rooters,

Would it be possible to add a function (in the 
spirit of sigma's like sumv):

TArrayD 
TArrayD::RunningSum()
{
  TArrayD result(fN);

  Double_t cur_sum = 0;
  for (Int_t i=0; i<fN; i++) 
    { cur_sum += fArray[i]; 
      result.AddAt(cur_sum,i);
    }

  return result;

}

to TArrayD ? 
(And for completeness similar functions
to the other TArrayXs) ?

I didn't test this function, though...

Or is there already a similar function ?


thanks,

André



-- 
------------------+----------------------------------
Andre Holzner     | +41 22 76 76750 
Bureau 32 2-C13   | Building 32     
CERN              | Office 2-C13    
CH-1211 Geneve 23 | http://wwweth.cern.ch/~holzner/



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:49 MET