Virtual Processors

One way to think about DAPPLE collections (vectors and matrices) is as a set of data elements. Another way to think of them is as a set of data elements, each of which has a virtual processor for manipulating that element. Thus, for elementwise operations like

intVector A(N), B(N), C(N); ... A = B + C; one can imagine the virtual processor at position 3 adding element 3 of B to element 3 of C and then assigning the result to element 3 of A.

It is often convenient to define

const intVector VP(N, Identity); const intMatrix VProw(N, M, IdentityR); const intMatrix VPcol(N, M, IdentityC); for use in expressions that depend on the position, e.g., intVector X(N), Y(N); ... Y = VP * X; // compute i * x[i], for i = 0 to N-1