STL Adaptors can combine operations and are used in elimination of temporaries in a C++ array class; this technique is known as Expression Templates or Template closures. Since the technique is dependent on a simple expansion of element references, some difficulties exist in applying the technique to a parallel array class, where distribution with ghost-cells and notation of array sections complicate the expansion of element references. The technique is extended so that it separates element references in two cases to keep the expansion simple in each case. This achieves good performance even with the existence of ghost-cells, whereas the implementation of an existing technique does not support it well because of the required amount of coding. In addition, currying facility of Adaptors is used for supporting nested data structures, where operations are required to nest so that they can be applied to sub-structures. An example shows a mapping of reductions is concisely expressed in a matrix-vector multiplication.
展开▼