Need some help with Array2 and regions

Natalia Beatriz Bidart <[email protected]>
Newsgroups gmane.comp.lang.sml.smlnj
Message-ID <[email protected]>
Hello,

Trying to debug a Matrix implementation that I'm coding using Array2 as 
the hidden data structure, I've just discovered that depending on the 
traversal used to traverse a given region, I've got different results 
for the same region.

Example: (A2 is Array2)

Given an A2.array "arr" such that (A2.dimensions arr > (0,0)), if I define:

val reg = {base=arr, row=0, col=0, nrows=SOME(0), ncols=NONE};

when traversing "reg" using RowMajor, I've got as the result the first 
row of "arr", but if traversing with ColMajor, I've got nothing (which 
was what I expected in both cases).

This surprised me a lot, 'cause according to the library documentation, 
the definition of a region has nothing to do with the traversal.
I mean, when it says:

"""
If ncols equals SOME(w), with 0 <= w, the region includes only those 
elements in columns with indices in the range from col to col + (w - 1)
...
A similar interpretation holds for the row and nrows fields.
"""

using nrows=SOME(0), which gives w=0, and the list of indices in the 
range row=0 to row+(w-1)=0+(0-1)=-1 should be the empty list, right???

Please, I appreciate a lot if anyone can explain me if the behavior 
above is correct (and why?!) or if anyone can point me how to create an 
empty region using RowMajor as traversal.

Thanks a lot, Natalia.


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.