next up previous contents
Next: New Expander for Macro Up: Old Expander for Macro Previous: 2.4.2.1 The Expansion of

2.4.2.2 The Expansion of Distributors

Let tex2html_wrap_inline5657 be a slice event representing an array slice tex2html_wrap_inline6189 . Define:

displaymath6157

Consider the following collectivisor

displaymath6158

The sets tex2html_wrap_inline6191 and Indices (a(,9)) are depicted in Figure 2.5.

For every dimension j of tex2html_wrap_inline5657 , let tex2html_wrap_inline6199 denote the projection of tex2html_wrap_inline6201 onto the jth coordinate, i.e.,

displaymath6159

  figure2776
Figure 2.5: Indices(a) defined by C11 

Suppose that j is a distributable dimension of tex2html_wrap_inline5657 ,

tex2html_wrap_inline6329 and tex2html_wrap_inline6331 . This means that the jth dimension of tex2html_wrap_inline5657 generates n sections which are ordered as follows:

displaymath6160

Let tex2html_wrap_inline6339 denote the following integer expression with the variable i:

displaymath6161

  figure3026
Figure 2.6: tex2html_wrap_inline6433 , tex2html_wrap_inline6435 , tex2html_wrap_inline6437 , tex2html_wrap_inline6439 , where a is defined by the collectivisor C11 

  lem3101

Proof. Clearly

displaymath6163

since

displaymath6164

The above lemma gives the following interpretation of tex2html_wrap_inline6339 : tex2html_wrap_inline6339 computes the value of the index of the ith section of tex2html_wrap_inline5657 along the dimension j. Figure 2.6 illustrates this concept.

Suppose now that tex2html_wrap_inline5709 , tex2html_wrap_inline5711 , tex2html_wrap_inline5713 are some integers. Define: tex2html_wrap_inline5729 , and let tex2html_wrap_inline6467 be the following integer function: tex2html_wrap_inline6469 . Suppose also that tex2html_wrap_inline6471 . Define tex2html_wrap_inline6473 to be the following subset of tex2html_wrap_inline6329 :

displaymath6165

The above definition is correct because tex2html_wrap_inline6477 .

For example if a is declared by the collectivisor C11 (see Fig. 2.5) then tex2html_wrap_inline6481 , and for instance tex2html_wrap_inline6483 .

Suppose that tex2html_wrap_inline6485 .

Let tex2html_wrap_inline6487 denote the following integer expression with the variable i:

displaymath6166

  lem3198

Proof. As for Lemma 2.1. tex2html_wrap_inline6155

We may now say that tex2html_wrap_inline6487 computes the value of the index of the ith section of tex2html_wrap_inline5657 along a subrange defined by tex2html_wrap_inline5709 , tex2html_wrap_inline5711 , tex2html_wrap_inline5713 over the dimension j.

Let tex2html_wrap_inline6511 be an operator where i, d, tex2html_wrap_inline5709 , tex2html_wrap_inline5711 , tex2html_wrap_inline5713 are parameters, i is the name (of an integer variable), tex2html_wrap_inline6525 , tex2html_wrap_inline5709 , tex2html_wrap_inline5711 , tex2html_wrap_inline5713 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 tex2html_wrap_inline6511 produces the following slice event or indexed event:

displaymath6167

Similarily, let tex2html_wrap_inline6543 , tex2html_wrap_inline6545 , tex2html_wrap_inline6547 be operators, where i, d, tex2html_wrap_inline5709 , tex2html_wrap_inline5711 , tex2html_wrap_inline5713 , x are as above, defined as follows:

tex2html_wrap_inline6561 , where r is an integer satisfying: tex2html_wrap_inline6565 and for each j, tex2html_wrap_inline6569 , tex2html_wrap_inline6571 .

In other words, r is the number of the rightmost distributable dimension.

displaymath6168

and

tex2html_wrap_inline6575 , where r is an integer satisfying: tex2html_wrap_inline6565 and for each j, tex2html_wrap_inline6569 , tex2html_wrap_inline6571 .

Let tex2html_wrap_inline6587 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 tex2html_wrap_inline6587 produces the following slice event or indexed event:

displaymath6169

We can now define expdistr as follows:

displaymath6170

where the name i does not occur in mseq and range, tex2html_wrap_inline5729 if tex2html_wrap_inline6621 , or m is the number of sections generated by jth dimension of some slice event tex2html_wrap_inline5657 occurring in mseq with tex2html_wrap_inline5671 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 tex2html_wrap_inline5308 (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))
tex2html_wrap_inline6651

The result of expanded M(1) will be:

tex2html_wrap_inline6655
tex2html_wrap_inline6657
tex2html_wrap_inline6659
tex2html_wrap_inline6661
tex2html_wrap_inline6663

Next we expand M(2):

tex2html_wrap_inline6667

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:


next up previous contents
Next: New Expander for Macro Up: Old Expander for Macro Previous: 2.4.2.1 The Expansion of

Peter Lauer
Mon Jul 22 17:29:46 EDT 1996