(j3.2006) reverse section contiguous?
John Reid
John.Reid
Thu Jan 5 17:43:22 EST 2012
Dick Hendrickson wrote:
> On Thu, Jan 5, 2012 at 12:56 PM, Bill Long<longb at cray.com> wrote:
>> The question arose as to, given
>>
>> real x(10)
>>
>> whether
>>
>> x(10:1:-1)
>>
>> is CONTIGUOUS.
>>
>> The relevant part of the "is contiguous" rules is
>>
>> "An object is contiguous if it is ...
>>
>> (6) a nonzero-sized array section (6.5.3) provided that ...
>>
>> (c) the elements of the section, in array element order, are a subset
>> of
>> the base object elements that are consecutive in array element order,"
>>
>> The elements of the section are {A(10), A(9), A(8), ..., A(1)} which, as a
>> set of elements, is a subset of {A(1), A(2), ..., A(10)}. (Perhaps "subset"
>> is a flawed word here.)
>>
>> The test for NOT contiguous includes:
>>
>> "the elements of the object in array element order are not consecutive in
>> the
>> elements of the base object"
>>
>> which does appear to be satisfied, since "consecutive" implies both an
>> ordering and adjacent.
>>
>> Did we intent for X(10:1:-1) to be CONTIGUOUS? In other words, is "packed
>> in memory with no gaps" good enough here, or do we also require "memory
>> locations in the same order as the memory locations of an explicit-shape
>> whole array"?
>
> Since I don't go to the meetings, I'll vote early. I think the second
> choice is the one we meant. I think we added contiguous to
>
> A) allow optimizers to do fast addressing without having to worry
> about the stride part of the dope vector and
> B) to allow contiguous arrays to be easily passed to other languages
> which don't naturally have strided arrays.
I agree. The definitive quote is (6)(c) above, where "in array element
order" appears for both the section and the base object. There is
further evidence in 6.5.4. "A section-subscript-list speci
es a simply
contiguous section if and only if .... the last subscript-triplet does
not have a stride, ..." And in 7.2.2.3, p9 "If bounds-remapping-list
is speci
fied, the pointer target shall be simply contiguous (6.5.4) or
of rank one. ... The elements of the target of the pointer object, in
array element order (6.5.3.2), are the
first SIZE (data-pointer-object)
elements of the pointer target." Further, I see no examples of
contiguous objects with strides of -1.
John.
More information about the J3
mailing list