(j3.2006) reverse section contiguous?

Bill Long longb
Thu Jan 5 13:56:10 EST 2012


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"?

Cheers,
Bill

-- 
Bill Long                                           longb at cray.com
Fortran Technical Support    &                 voice: 651-605-9024
Bioinformatics Software Development            fax:   651-605-9142
Cray Inc./Cray Plaza, Suite 210/380 Jackson St./St. Paul, MN 55101





More information about the J3 mailing list