Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: column major or row major.

by betterworld (Deacon)
on Aug 09, 2009 at 11:00 UTC ( #787156=note: print w/ replies, xml ) Need Help??


in reply to column major or row major.

Two-dimensional arrays in Perl are implemented either as arrays of array references (where the references may reference arrays that are stored at any arbitrary memory location), or using hashes where there are special separators in the hash keys.

Neither of these methods guarantees the order in which the elements are stored in memory, and there is no straightforward way to iterate over the elements in sequence. Therefore the concept of row major cannot be applied imho.

If one needs a two-dimensional structure on a one-dimensional array, it's usually done by hand as in $array[$row * $columncount + $column]. Maybe one could use operator overloading to access these kinds of arrays with the usual $array[$row][$column] syntax.


Comment on Re: column major or row major.
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://787156]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (11)
As of 2014-07-22 22:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (130 votes), past polls