mseq
mseq changes the number of elements in every region of one direction of the open part.
Syntax
mseq direction d1 d2 ... dn [ ; ]
direction:i,jork.d1todn: signed whole numbers, one for each region of that direction. Each is added to that region’s element count. A direction withn + 1index entries hasnregions.
The closing ; may be left out.
What it does
mseq gives each region a new element count and leaves the partitions and coordinates alone. The result is the same as writing the new counts into the part’s own index list.
When James applies it
When it is read, in the Part phase. mseq is not one of the 21 steps. James folds it into the part’s index list at once, so every later command sees the new element counts.
Rules James adds
mseqreads every number it finds, up to the;or the first word that is not a number, and then compares the count with the number of regions. Too many values and too few both give E0406.mseqafter a coordinate equation is accepted (tests/corpus/269-mseq-after-equation-accepted): the equation runs at step 20 over the part’s lists as they stand at the end, and TrueGrid’s own examples issuemseqafter az=.updateis not supported in this version (E0100); once it is,mseqafter it will be refused (E0408), not ignored.- A number written in an equation, such as the
3ofi .eq. 3or the14of(j-14)/3, names a node of the part’s final lattice, so anmseqwritten after the equation changes which node it names.%idxlist(n)names the n-th partition whatever the lattice (x=).
Diagnostics
- E0406: the direction is not
i,jork, or the number of values is not the number of regions.
Example
The script tests/corpus/166-mseq-doubles-j/input.tg, which make test runs:
c mseq j adds two elements to each j region, so 1 3 5 becomes 1 5 9.
block 1 3;1 3 5;1 2;0 1;0 1 2;0 1;
mseq j 2 2
endpart
The j list 1 3 5 has two regions of two elements. Adding 2 to each makes them four, and the IR shows the j list as [1 5 9]. The part has twice as many elements along j.