Gather-scatter (vector addressing)
Gather-scatter is a type of memory addressing that often arises when addressing vectors in sparse linear algebra operations. It is the vector-equivalent of register indirect addressing, with gather involving indexed reads and scatter indexed writes. Vector processors have hardware support for gather-scatter operations, providing instructions such as Load Vector Indexed for gather and Store Vector Indexed for scatter.
Denoting by the list of indices of sparse vector , the sparse gather of dense into denoted , assigns .
for (i=0; i<N; ++i) x[i] = y[idx[i]];
for (i=0; i<N; ++i) y[idx[i]] = x[i];