Let
be a
slice event representing an array slice
.
Define:
Consider the following collectivisor
The sets
and Indices (a(,9)) are depicted in
Figure 2.5.
For every dimension j of
, let
denote the projection of
onto the jth coordinate, i.e.,
Figure 2.5: Indices(a) defined by C11
Suppose that j is a distributable dimension of
,
and
. This means that the jth dimension
of
generates n sections which are ordered
as follows:
Let
denote the following integer
expression with the variable i:
Figure 2.6:
,
,
,
, where a is defined by the collectivisor C11
Proof. Clearly
since
The above lemma gives the following interpretation of
:
computes the value of the index of the ith section of
along the dimension j.
Figure 2.6 illustrates this concept.
Suppose now that
,
,
are some integers.
Define:
, and let
be the
following integer function:
. Suppose
also that
. Define
to be the
following subset of
:
The above
definition is correct because
.
For example if a is declared by the collectivisor C11 (see
Fig. 2.5) then
, and
for instance
.
Suppose that
.
Let
denote
the following integer expression with the
variable i:
Proof.
As for Lemma 2.1.
We may now say that
computes
the value of the index of the ith section of
along a subrange defined by
,
,
over the dimension j.
Let
be an operator where i,
d,
,
,
are parameters, i is the name (of an integer
variable),
,
,
,
are integer
values, x
is an argument which is a slice event. It is assumed that the name
i does
not occur in x, and if it is not a distributable dimension of x
the
operator simply does nothing. The operator
produces the following slice
event
or indexed event:
Similarily, let
,
,
be operators, where i, d,
,
,
, x are as above, defined as
follows:
, where
r is an integer satisfying:
and for each
j,
,
.
In other words, r is the number of the rightmost distributable dimension.
and
, where r is an integer satisfying:
and for each j,
,
.
Let
be an operator where i, dim,
range are parameters, i is the name (of an integer variable),
dim and range are strings as in the syntax for distributor, x
is an argument and x is a slice event and the name i does not
occur in x. The operator
produces the following slice event or indexed event:
We can now define expdistr as follows:
where the name i does not occur in mseq and range,
if
, or
m is the number of sections generated by jth dimension of some
slice event
occurring in mseq with
if range is blank but dim=j, or m is the
number of sections generated by the rightmost distributable
dimension of some slice event occurring in mseq if both
range and dim are blank.
Now, we will use
(Section 2.3.3) as an example to see how the
old expander expands this linereader/lineprinter with interrupt handler
specification.
Firstly, the expander will expand M(1):
expand(M(1))
The result of expanded M(1) will be:
Next we expand M(2):
Similarly, the expander will expand M(3) to M(6) to the form of basic COSY program. P(1) and P(2) are basic COSY programs. Therefore, the expander does not expand them. Finally, the expanded program will be represented as follows: