rubyists-

am i the only one who finds the current NArray indexing order
confusing:

irb(main):001:0> na = NArray.to_na a=[[0,1,2],[3,4,5]]
=> NArray.int(3,2):
[ [ 0, 1, 2 ],
[ 3, 4, 5 ] ]
irb(main):002:0> i, j = 0, 1
=> [0, 1]

# ruby uses row major (last varies fastest) indexing
irb(main):003:0> a[i][j]
=> 1

# narray uses column major (first vaires fastest) indexing
irb(main):004:0> na[i, j]
=> 3

# but the storage itself appears to be row major?!
irb(main):007:0> na.to_s.unpack('i6')
=> [0, 1, 2, 3, 4, 5]


this could be really confusing if one starts thinking of narrays as
column major (due to the index ordering) and processes using for k, j,
i... instead of for i, j, k... logic, or writes an narray to disk
expecting to read it back as records of columns instead of records of
rows

it seems that the storage should at least be consistent with the
indexing, and that both should, ideally, be consistent with ruby.

perhaps i am missing something obvious here, or there is a way to
modify the runtime indexing of narray's, but i have not found anything
yet.

-a