comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Row major / column major
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Row major / column major [message #83016] Thu, 31 January 2013 15:53
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
markjamie@gmail.com writes:

> I can hear you all sigh already.... I know... We've all been here before... but after all my reading I'm still utterly confused.
>
> I need to loop over the large dimension of a 3 x very large array,let's say 3 x 1E9. Sadly, given the operation I'm performing, there's no easy way to get round the loop using histogram etc.
>
> To improve the loop efficiency should the array be defined as:
>
> Myarray = intarr(3,1E9)
>
> Or
>
> Myarray = intarr(1E9,3)
>
> Does it matter at all? Have I got totally the wrong idea with this?

It matters. A LOT!

You have GOT to make sure your loop matches the order in which adjacent
values are laid out in memory (which is row order). Transpose your array
to make it a (1e9,3) array and loop over the three rows, handling all
the values in the columns as you go. Outer loop: rows. Inner loop:
columns.

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Previous Topic: Row major / column major
Next Topic: Some questions of efficiency when matching items in lists

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:22:06 PDT 2025

Total time taken to generate the page: 0.00351 seconds