To: J3 J3/20-144r2
From: Tom Clune
Subject: Rank-agnostic array element and section denotation, Edits
Date: 2020-October-14
Reference: 20-007 20-125r1 19-150 20-113
Introduction:
This paper updates 20-125r1 to reference 20-007.
Edits:
[Introduction Data usage and computation]
"o An array can be used to specify a sequence of subscripts. Arrays
can be used to specify a sequence of subscripts and strides in
subscript triplets."
[128:6-7 9.4.2 Structure components] Replace constraint C913 with:
"C913 (R912) If appears, the sum of the rank of
, the sizes of the arrays in each multiple subscript,
and the number of s, shall be equal to the rank of
."
[128:18-19 Structure components p2] Replace the second sentence (they
both begin "The rank of ...):
"If appears, the rank of is the sum
of the number of subscript triplets, the number of vector subscripts,
and the size of one of the arrays in each multiple section subscript."
{Don't count size(lower bound) + size (upper bound) + size(stride).}
[130:23+ 9.5.3.1 Syntax in 9.5.3 Array Elements and Sections R919+]
Insert a syntax rule:
"R919a <> @ "
[130:24+ 9.5.3.1 Syntax in 9.5.3 Array Elements and Sections R920]
Insert an alternative after <> :
" <> "
[130:25+ 9.5.3.1 Syntax in 9.5.3 Array Elements and Sections R920]
Insert an alternative after <> :
" <> "
[131:2+ 9.5.3.1 Syntax in 9.5.3 Array Elements and Sections R921+]
Insert a syntax rule:
"R921a <>
@ [ ] : [ : ]"
[131:4+ 9.5.3.1 Syntax in 9.5.3 Array Elements and Sections] Insert
constraints:
"C926a (R919a) shall be an array of rank one.
"C926b (R921a) At least one that is an array of rank one
shall appear in a . The s
shall be conformable."
[131:7+ 9.5.3.1 Syntax in 9.5.3 Array Elements and Sections] Insert
new constraint:
"C928a (R921a) If is the last
in , the second
shall appear."
[131:11- 9.5.3.2 Array element order-] Between NOTE 3 and the subclause
heading 9.5.3.2 Array element order insert
"NOTE 4
Examples of references to parts of arrays using one-dimensional
arrays to specify sequences of subscripts or sequences of subscript
section boundaries or strides, assuming V1, V2, and V3 are rank-one
arrays are:
A(@[3,5]) ! Element A(3,5)
A(6,@[3,5],1) ! Element A(6,3,5,1)
A(@[1,2]:[3,4]) ! Section of A, equivalent to A(1:3,2:4)
A(@:[4,6]:2,:,1) ! Strided section of A, equivalent
! to A(:4:2,:6:2,:,1)
A(@V1, :, @V2 ) ! Section of A, whose rank is size(V1) + 1 +
! size(V2). The rank of is one.
B(@V1, :, @V2: ) ! Section of B, whose rank is size(V1) + 1 +
! size(V2). The rank of is 1 +
! size(V2).
C(@V1, :, @::V3 ) ! Strided section of C, whose rank is size(V1) +
! 1 + size(V3). The rank of is 1 +
! size(V3).
"
{Editor - please format the comments nicely.}
[131:11- 9.5.3.2 Array element order-] Before subclause 9.5.3.2 Array
element order, insert a subclause:
"9.5.3.1a Sequences of subscripts and subscript triplets
A specifies a sequence of subscripts, the number of
which is equal to the size of . The effect is as if
the array elements were specified individually as subscripts of
consecutive dimensions (not preceded by @).
In a , if the first does not
appear, the effect is as if it were a one-dimensional array whose
element values are the lower bounds of the corresponding dimensions. If
the second does not appear, the effect is as if it were a
one-dimensional array whose element values are the upper bounds of the
corresponding dimensions. If the third does not appear, the
effect is as if it appeared with the value one.
A specifies a sequence of subscript
triplets, the number of which is equal to the size of an
that is an array. If any is a scalar, the effect is as if
it were broadcast to the shape of one that is an array. An element of
the first array acts as if it were the first in a
triplet; the corresponding element of the second array
acts as if it were the second ; the corresponding element
of the third array acts as if it were the .
[132:3 9.5.3.3.1 Section subscript lists, p1] Replace
" by "subscript triplet".
[132:16 9.5.3.3.2 Subscript triplet, p1] Replace "" by "stride".