This is the mail archive of the
gsl-discuss@sourceware.org
mailing list for the GSL project.
Re: [row/column majority] gslclapack
- From: Z F <mail4me9999 at yahoo dot com>
- To: "Robert G. Brown" <rgb at phy dot duke dot edu>
- Cc: James Bergstra <james dot bergstra at umontreal dot ca>, gsl-discuss <gsl-discuss at sources dot redhat dot com>
- Date: Thu, 30 Mar 2006 13:04:36 -0800 (PST)
- Subject: Re: [row/column majority] gslclapack
--- "Robert G. Brown" <rgb@phy.duke.edu> wrote:
> On Thu, 30 Mar 2006, Z F wrote:
>
> >
> > Row/column majority question comes from the times when
> > God was REAL and Infinity was INTEGER (FORTRAN). But even
> > at that time, some people, I hope, knew that the question of
> > row/column majority is irrelevant. Think about it!
> >
> > So think.... Sorry, but I will use capital letters...
> >
> > COLUMN-MAJOR or ROW-MAJOR ??? IT IS ALL IN YOUR HEAD!!!!
> > IT IS NOT REAL AND DOES NOT EXIST!!! THE MATRIX IS STORED
> > AS A CONTINUOUS OBJECT AND ADDRESSING IS DONE VIA a FORUMLA
> > LIKE THIS
> >
> > index = j*Ni+i!!!
> >
> > SO GIVE THE MAJORITY A REST!!!
> >
> > Once again, sorry if I offended anyone, but someone had to point it
> > out.
>
> Yes, but CPUs really HATE doing arithmetic with a string of objects
> separated by a large offset. They much prefer to do arithmetic with
> a
> string of objects with unit offset. That way caches, prefetch and so
> on
> work. They indicate their disapproval by running really really
> slowly.
I agree 100% with you here. This is where hardware has to be
taken into account when optimizations are done.
> In other words, it is good if "j" isn't the rapidly varying index in
> your example of offset arithmetic.
Sorry, I fail to see how this is relatated to the problem of
the majority. In my example 'i' was the rapidly changing index by
definition. If you want to see 'j' as the rapidly changing one, I
would write:
index = i*Nj+j
but what does it change?
The difference is how a[i,j] are interpreted
a[i,j] => a[i*Nj+j]
a[i,j] => a[j*Ni+i]
one is called the row major, the other is the column major (sorry do
not know which is which), but
nothing changed. As long as the access is done via this indexing.
Can someone tell me why one is faster than the other? Or more
convenient?
Thanks
Lazar
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com