Simple Parallel Statements

Generally parallel operands may appear in situations where scalar operands may appear. The use of parallel operands within expressions is limited to their conformance or compatability. Parallel operands used within expressions must be compatible with each other. Two parallel types are said be compatible if they are derived from compatible shape types.

Fully specified shapes are compatible with other fully specified shapes only if their rank, dimensions, and layout are identical. Fully specified shapes are compatible with Partially specified shapes if their ranks are identical.

Partially specified shapes are compatiable with other Partially specified shapes if their ranks are identical.

Fully unspecified shapes are compatible with all other shape types.

shape [10]S;
float:S a,b;   /* parallel floats of shape S */
...

a = b;   /* copy all values in pvar "b" into pvar "a" */

b = b + a;  /* add all values of pvar "a" to pvar "b" and store into "b" */

b += a;  /* same as above */

...
float:S x[5]  /* array of 5 parallel float of shape S */
...
for ( i = 0; i < 5; i++ )
   x[i] = i+1;

/* yields :     Parallel elements
         x[0]  1 1 1 1 1 1 1 1 1 1
         x[1]  2 2 2 2 2 2 2 2 2 2
         x[2]  3 3 3 3 3 3 3 3 3 3
         x[3]  4 4 4 4 4 4 4 4 4 4
Parallel variables may be referenced in their entirety, as above, as sliced expressions or as scalar objects. Whenever a parallel variable is to be referenced in a way other then the whole variable, the index notation must appear on the left hand side of the parallel variable in order to differentiate from array indexing (which occurs on the right hand side of the parallel variable):

  [4]x[2]  /* refers to int at the 4-th parallel position in 
              array element x[2] */
Storing into individual parallel elements can be inefficient. Most references of parallel variables should use all or most of the parallel variable.

Options:

©1995 Pacific-Sierra Research Corporation. All rights reserved.

Send comments or suggestions to dpce2 at crescentbaysoftware.com.