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

Wouter Hulsbergen (s37@nikhef.nl)
Fri, 14 Nov 1997 15:43:15 +0100 (MET)


On Fri, 14 Nov 1997, 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.
>
> --
> Org: CERN, European Laboratory for Particle Physics.
> Mail: 1211 Geneve 23, Switzerland Phone: +41 22 7679248
> E-Mail: Fons.Rademakers@cern.ch Fax: +41 22 7677910
>

Dear Fons,
You probably know this already, but ...

In CLHEP both the 0 and 1 option are supported, but there exist two
ways of accessing elements:

* Matrix[i][j] 0 <= i,j < n (C style)
* Matrix(k,l) 1 <= k,l < n+1 (Fortran style)

In the Template Numerical Toolkit (successor of packages as
Lapack, based on STL), one distinguishes two types, `C_matrix' and
`Fortran_matrix', which are both accessed with (,) . This is just
terrible, even if these classes have other functionality.

Anyway, we should just choose. I prefer the C style solution, with square
brackets only.

Wouter, NIKHEF.