Re: TMatrix as vector

From: Victor Perevoztchikov (perev@bnl.gov)
Date: Mon Mar 06 2000 - 16:10:54 MET


Hi Nicolas,

> I dont think that providing overloading of
> Double_t& operator[](Int_t i)
> and
> Double_t operator[](Int_t i) const

yes, you are right. I have misunderstand you.
I thought that you want pointer to array. 
But functions above do not violate encapsulation. 
There could be some complications for sparced matricies,
number of words is less than N*M , but it is solvable.

Victor

Nicolas Produit wrote:
> 
> Hi Victor,
> 
> > to provide such method you will broke encapsulation. Your code
> > must not be dependent of matrix implementation inside a class.
> > Let say, TMatrix will be improved and sparce matrices will be
> > added.
> > Then your method becomes unavailable, what leads to vialation
> > of encapsulation.
> 
> I dont think that providing overloading of
> Double_t& operator[](Int_t i)
> and
> Double_t operator[](Int_t i) const
> 
> on TMatrix to fetch or store a value in a 2 D matrix
> at place (i/fCols,i%fCols)
> would break encapsulation.
> 
> I agree that method GetfElement is, it is why I prefer [].
> 
> For Eddy,
> 
> thanks a lot for the suggestion. But I think your suggestion
> is actually a fancy way of doing a copy to TArray, I would rather
> have a solution not involving copying.
> Anyway I can perhaps use your trick in some case.
> 
> --
> Nicolas Produit
> INTEGRAL Science Data Center    Phone:  +41 22 950 91 40
> 16, Chemin d'Ecogia             Fax:    +41 22 950 91 33
> CH-1290 Versoix                 www:    http://isdc.unige.ch/

-- 
Victor M. Perevoztchikov   perev@bnl.gov  perev@vxcern.cern.ch       
Brookhaven National Laboratory MS 510A PO Box 5000 Upton NY 11973-5000
tel office : 631-344-7894; fax 631-344-4206; home 631-345-2690



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