Got a YouTube account?

New: enable viewer-created translations and captions on your YouTube channel!

English subtitles

← Serial Implementation of Scan - Intro to Parallel Programming

Get Embed Code
2 Languages

Showing Revision 4 created 05/25/2016 by Udacity Robot.

  1. So it turns out doing this conversion is actually very straightforward.
  2. All we're going to do is flip these 2 lines around, okay?
  3. If we interchange these 2 lines, then we've turned this scan from inclusive to exclusive.
  4. And why is this the case?
  5. So if we remember, an inclusive scan sums up all the elements,
  6. including the current element, and then writes its output.
  7. Instead, we want to convert this to an exclusive scan,
  8. which is going to sum up all of the elements except for the current element,
  9. and then set the output.
  10. So what we do in the inclusive code that we see here
  11. is first we apply the current element and then output the result.
  12. But for an exclusive scan, we will output the result and then apply the current element.
  13. So it's a very simple transformation to go from one to the next.