Okay, so this is pretty straightforward.
The output at any particular element is the sum of that element
and all elements that come before it in the current segment.
But we're starting it over at every segment boundary.
So 12, for instance, is the sum of 3, 4, and 5 but nothing from the previous segment.
We're not going to go through how this is implemented,
but it's a terrific exercise to work out on your own,
whether you do it with Hillis and Steele scan or the Blelloch scan.
It has the same complexity as unsegmented scan, but it runs a little slower
because you have to keep track of the segments along the way.
So it requires more memory traffic as well as more complex computation.
We'll have to put a little more information about the implementation of segmented scan
in the supplementary materials.
But again, this is a really great problem for you to work out on your own.
好吧,这是相当简单。
在任何特定元素的输出是该元素
和当前段中该元素之前的所有元素的总和。
但我们在每一段边界就重新开始。
所以,比如,12是 3、4和5的和,但没有从前一段的元素。
我们不打算再回顾这如何实现的,
但这是锻炼你自己的绝好例子,
不管你用Hillis和Steele扫描还是Blelloch扫描。
它具有和未分段扫描一样的复杂性,但它运行慢一点
因为你要同时跟踪这些分段。
所以它需要更多的内存流量,以及更复杂的计算。
我们会把有关的分段扫描执行情况的更多信息放在
补充材料中。
但是,再次说明,这是一个适合你尝试自己解决的很棒的问题。