Re: Input requested on Linear Algebra package feature...

Nick van Eijndhoven (Nick@fys.ruu.nl)
Fri, 14 Nov 1997 15:39:20 +0100 (MET)


*** Fons Rademakers wrote :
>
> Hi All,
>
> we have a very nice (I think -:)) Linear Algebra package ready for release.
>
> There is one fundamental point on which I would like to get input.
> The question is:
> Should matrices and vectors by default range from
> 0 - n-1 (like arrays in C/C++)
> or
> 1 - n (like in math and Fortran)
>
> I've heard arguments in favour of the C/C++ style (we are programming
> in C++, aren't we) and the math style (this is a math package and in
> math we start at 1).
>
> Notice, that the package can handle any lower and upper limit. The
> issue is what should be the default value of the lowerbound argument:
>
> 0, 1?
>
> Please, let me know.
>
> Cheers, Fons.
>
>
Hi Fons,
Concerning my data analysis and ALICE sw development using ROOT I have
also made some member functions of my classes which handle vectors
and matrices (e.g. Calorimeter).
Obviously (not to waste memory space) in the internal coding I always
start at 0 (conform C++). However, for the user it always looks as
if everything starts at 1.
I think starting at 1 is more convenient by addressing for instance
elements of a 4-vector, or specifying a certain Calorimeter module
as Cal(1,16) instead of (0,15).
It also matches better the math. notation a_13 to denote matrix element
A(1,3).
So, my preference is to start at 1 as far as the user interface is
concerned; internal coding of course can start at 0 to conform to C++.

Cheers,
Nick.

*----------------------------------------------------------------------*
Dr. Nick van Eijndhoven Department of Subatomic Physics
email : nick@fys.ruu.nl Utrecht University / NIKHEF
tel. +31-30-2532331 (direct) P.O. Box 80.000
tel. +31-30-2531492 (secr.) NL-3508 TA Utrecht
fax. +31-30-2518689 The Netherlands
WWW : http://www.fys.ruu.nl/~nick Office : Ornstein lab. 172
----------------------------------------------------------------------
tel. +41-22-7679751 (direct) CERN PPE Division / ALICE exp.
tel. +41-22-7675857 (secr.) CH-1211 Geneva 23
fax. +41-22-7679480 Switzerland
CERN beep : 13+7294 Office : B 160 1-012
*----------------------------------------------------------------------*