Re: Input on Linear Algebra: start at zero ! Please!

Fons Rademakers (Fons.Rademakers@cern.ch)
Fri, 14 Nov 1997 15:52:01 +0100


Just a clarification.

Matrices use internally, for efficiency reasons, column
wise storage. This however is completely hidden from the
user. The element m(i,j) is the element at the i-th row
and j-th column (like in math and C/C++). The issue is: is,
by default, the first element m(1,1) or m(0,0). Currently
I've implemented (0,0) as first element. For example:

TMatrix m1(4,20); // m1(0,0) ... m1(3,19), same as
TMatrix m2(0,3,0,19); // m2(0,0) ... m2(3,19)
TMatrix m3(1,4,1,20; // m3(1,1) ... m3(4,20)

It could be:

TMatrix m4(4,20); // m4(1,1) ... m4(4,20)

I've seen a number of packages using 1 as lowerbound
and a number of packages using 0.

Let me know your preference.

-- Fons.

Jobst Heinrich Koehne wrote:
>
> Hi Fons,
>
> there are nice wrapper classes for FORTRAN style matrix storage
> organisation in Barton & Nackman's book (e.g. for LAPACK-matrix
> routines). Numerical recipes in C and other textbooks exist.
>
> Everybody will be totally confused if root comes with a
> mixture of FORTRAN style (indexing) and storage style (C).
>
> ahoi
> Jobst

-- 
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