HI All, I agree with Jan that it would be good to use Hep3Vector to represent positions (although I think it is safe to assume that coordinates are cartesian unless stated otherwise).
It is important to understand that the overhead of List<Double> vs double[] can be astronomical in some cases, since you go from one object to N objects, with possible conversion to/from double<->Double and object creation on every use. I think this overhead really has to be evaluated on a case-by-case basis.
Tony
> -----Original Message-----
> From: [log in to unmask]
> [mailto:[log in to unmask]] On Behalf Of
> Tim Nelson
> Sent: Wednesday, July 27, 2005 12:43 PM
> To: Strube, Jan
> Cc: lcd-dev
> Subject: Re: Use of double[]
>
> Hi Jan,
>
> I will second that and go one further... I'd like to
> encourage people
> to use generic Java collections instead of arrays where
> appropriate.
> Except in the simplest cases, the additional power and
> flexibility is worth the overhead.
>
> Tim Nelson
>
> On Jul 27, 2005, at 12:17 PM, Jan Strube wrote:
>
> > Hi LCD Developers,
> >
> > I would like to encourage again the use of classes like
> > SpacePoint/SpaceVector or HepVector.
> >
> > Let's look at the class Cluster.
> > It has a method double[] getPosition(). aha.
> > The javadoc says "Position of the cluster."
> > Not very helpful, the method name already states that.
> >
> > Now, the problem here is: what does this return ?
> > A three-dimensional cartesian vector ?
> > A three-dimensional cylindrical vector ?
> > A three-dimensional spherical vector ?
> > Just the two spherical angles ? Because after all, the radius is
> > fixed...
> >
> > The second problem is this:
> > The cluster has a finite extension. How is this position defined ?
> >
> > The problem is that all of these things are obvious to the
> developers
> > of the class, but I don't think this is obvious to our
> users. Please
> > let's all try to make it easy on them. I am thinking primarily of
> > graduate students like myself who may or may not know what they are
> > doing.
> >
> >
> > Thank you,
> > Jan
> >
> >
> > --
> > Jan Fridolf Strube University of Oregon
> >
> > Stanford Linear Accelerator Center
> > mailstop 35
> > bldg 48, rm 244
> > phone: (650) 926-2913
> >
> >
>
>
|