YouTube

Got a YouTube account?

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

English subtitles

← What Scan Actually Does - Intro to Parallel Programming

Get Embed Code
2 Languages

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

  1. The identity element for unsigned int is the element
  2. that will give us back the same output for any given input,
  3. and for us that's going to be the smallest representable value,
  4. and that's going to be a big, fat 0.
  5. Any element max 0 is going to give us back that element.
  6. Now we're going to start computing the output here.
  7. So remember, we always start with the identity element here
  8. and then for each output element we take the max of all the elements that precede it.
  9. So here, that's the max of 3, so that's simply 3,
  10. next the max of 3 and 1, that's going to give us 3,
  11. next max of 3, 1, and 4,
  12. max of 3, 1, 4, 1,
  13. max of 3, 1, 4, 1, 5,
  14. so our output array here is 0, 3, 3, 4, 4, 5.
  15. This is the max scan on unsigned ints of this 6-element input vector.
  16. You might note that the input element 9 is not used in this calculation, and that's correct.
  17. That's simply the nature of this formulation of scan.