Re: [ROOT] matrix inversion class; comments please

From: Valeri Fine (Faine) (fine@bnl.gov)
Date: Tue Dec 12 2000 - 17:23:56 MET


----- Original Message ----- 
From: George A. Heintzelman <gah@bnl.gov>
To: Eddy Offermann <eddy@rentec.com>; <roottalk@pcroot.cern.ch>
Subject: Re: [ROOT] matrix inversion class; comments please 


> > Hi George,
> > 
> > The efficiency issue (TArrayD vs. Double_t *) will be resolved quickly later
> > this week by some profiling. I do remember from similar checks that
> > the difference was noticable, in particular the boundary checking. Anyhow,
> > I will try to get more quantitative.
> 
   I'd like to call your attention to 

http://root.cern.ch/root/htmldoc/TArrayD.html

it says:
  Data Members
    public:
      Double_t* fArray  [fN] Array of fN doubles

 So there no problem with GetArray() etc,  just use fArray "as is"
 But then we may ask ourselve why we need TArrayD at this point
 at all.  The only explanation it is convinient otherwise one has to bother
 about "new" / "delete" for all intermediate arrays.

By the way I don't like

#define ZEROO 0.0

may be we need:
  
   static  Float_t TMath::Epsilon(Float_t ) ?
   static  Double_t TMath::Epsilon(Double_t d=0) ?


                Valery

> If you use operator[] or At() in the inner loop, you could definitely 
> see something, particularly in a less-optimized compilation mode (a 
> good optimizer will probably be able to observe that the value of size 
> is not changing in the loop and do the check only once or twice at the 
> edge conditions). I note that while ROOT does not provide the 
> equivalent of an UncheckedAt() function for the TArrayD (would probably 
> be a nice addition), it's not all THAT hard to evade the checks, since 
> TArrayD does give you unfettered access to its internals with 
> GetArray() (1). So if you need efficiency in your inner loop, just grab 
> the array afterwards and index off that.
> 
> (1) Could ROOT at least change the overloading of this operator so that 
> GetArray() const returns a const Double_t *, not a Double_t *, as well 
> as having Double_t * GetArray()?
> 
> George Heintzelman
> gah@bnl.gov
> 
> 
> 
> 



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