An optimization of cumulativeSum for cases when a particular key has many entries.
An optimization of cumulativeSum for cases when a particular key has many entries. Requires a sortable partitioning of U. Accomplishes the optimization by not requiring all the entries for a single key to go through a single scan. Instead requires the sums of the partitions for a single key to go through a single scan.
Takes a sortable field and a monoid and returns the cumulative sum of that monoid *