Open jzc opened 1 year ago
I stumbled across this same issue yesterday. I think this is an oversight, and something that needs clarification.
We originally prototyped the group algorithms as part of a DPC++ extension, and that extension says:
Functions with arguments of type
vec<T,N>
are applied component-wise: they are semantically equivalent toN
calls to a scalar function of typeT
.
(Note that the extension doesn't mention marray
only because marray
didn't exist at the time.)
Somewhere along the way, this text got dropped. We kept the part about supporting vec
and marray
, but lost the explanation of how these types behave. I propose that we restore text like this. The component-wise behavior is intuitive, because all the operators (e.g., +
) for vec
and marray
are defined to be component-wise.
From 4.17.4. Group algorithms library:
However, not all the specifications of the group functions adhere to this rule. Specifically, the reduce and scan algorithms do not allow for vec and marray, e.g. 4.17.4.5. reduce:
However, this could be argued to be fine (although in my opinion, confusing) because of the following statement in 4.17.4:
Should the reduce and scan specifications be amended to allow for vec and marray?