Previous | Next --- Slide 63 of 69
Back to Lecture Thumbnails
arjunh

Question: Would anyone like to take a crack at providing some pseudo-code that would demonstrate how gather/scatter work? Your solution may implement the the index/result vectors and memory as arrays.

iZac

Gather:

for(i = 0; i < N; i++) {
    R1[i] = mem_base[R0[i]];
}

Scatter:

for(i = 0; i < N; i++) {
    mem_base[R0[i]] = R1[i];
}