(j3.2006) "Contiguous" doesn't quite do what I need

Van Snyder van.snyder
Thu Mar 22 21:55:40 EDT 2007

I earlier proposed a notation for an array dimension for pointers and
dummy arguments using [low]:[high]:[1] to indicate that a dimension has
an explicit extent if "high" appears, and it's contiguous w.r.t the
earlier dimensions if "1" appears at the end.

In some applications, I have multidimensional arrays for which I know
apriori the first few extents from the physics of the problem, but the
other extents vary as the calculation proceeds.  The "contiguous"
attribute would help the processor avoid digging up strides from dope
vectors, but it won't help with loop peeling, which I hope would happen
if, for example, the first extent is 3 or the first two extents are 2,2.

Sometimes I know the first few dimensions are contiguous  but I don't
know about the rest.  For example, if I'm integrating the 2x2 absorption
tensor along a line of sight using a coarse grid, and then I later use a
fine grid to get better enough accuracy.  In the first case, the third
dimension is evenly spaced but not contiguous w.r.t the first two
dimensions (the spacing is three times bigger than it would be if the
array were entirely contiguous), while in the second case it's entirely
contiguous.  The "contiguous" attribute can't be used in this case,
while a dimension declaration (1:2:1,1:2:1,:) would work.

This would let me say that a dimension is contiguous and still inquire
the bounds using "::1", or say it's not necessarily contiguous but I
know the extent with ":high:" or say it's contiguous and I know the
extent with ":high:1".

I think a lot of the words we have concerning the "contiguous" attribute
would work with this notation.  A few more words would be needed for
allocation and pointer association to make sure the extents of declared-
extent dimensions match up.

I'd like to see contiguity specification done in the most useful way
before it's cast in stone wrongly (or at least incompletely).  If we
proceed with the "contiguous" attribute and later decide we really
should have done what I propose above, we'll end up with a warty

Van Snyder                    |  What fraction of Americans believe 
Van.Snyder at jpl.nasa.gov       |  Wrestling is real and NASA is fake?
Any alleged opinions are my own and have not been approved or
disapproved by JPL, CalTech, NASA, the President, or anybody else.

More information about the J3 mailing list