GrPPI
0.3.1
Generic and Reusable Parallel Pattern Interface
|
The map pattern applies an operation to every element in one or multiple data sets, generating a new data set as an output.
The interface to the map pattern is provided by function grppi::map()
. As all functions in GrPPI, this function takes as its first argument an execution policy.
There are several variants:
The key element in a map pattern is the Transformer operation.
The transformer may be a UnaryTransformer or a MultiTransformer.
A UnaryTransformer is any C++ callable entity that takes a data item and transforms it. The input type and the output type may differ. Thus, a unary transformer op
is any operation that, given an input x
of type T
and output type U
, makes valid the following:
A MultiTransformer is any C++ callable entity that takes data items, one of each input sequence, and transforms them into an output value. The input types and the output type may differ. Thus, a multi-transformer op
is any operation that, given inputs x1, x2, ... , xN
of types T1, T2, ... , TN
and an output type U
, makes valid the following:
An unary map takes a data set and transforms each element in the data set by applying an unary function and generating a new data set.
The only interface currently offered for this pattern is based in iterators (following the C++ standard library conventions):
A n-ary map takes multiple data sets and transforms a tuple of elements from those data sets by applying a n-ary function and generating a new data set.
The only interface currently offered for this pattern is based in iterators: