Parallel reduction should work for any non-commutative binary operator as long as it is associative. A typical example is matrix multiplication, which is associative but not commutative. A naive reading of the code gave me the impression that the library will work for n-ary matrix multiplication (or any semigroup). I wonder why the documentation says the operator must be commutative? And if it is true the current code only works for commutative operators, could we improve the code so that both parallel_for_reduce and parallel_scan can work with non-commutative ones? This will make these functions much more useful.
Parallel reduction should work for any non-commutative binary operator as long as it is associative. A typical example is matrix multiplication, which is associative but not commutative. A naive reading of the code gave me the impression that the library will work for n-ary matrix multiplication (or any semigroup). I wonder why the documentation says the operator must be commutative? And if it is true the current code only works for commutative operators, could we improve the code so that both
parallel_for_reduce
andparallel_scan
can work with non-commutative ones? This will make these functions much more useful.