Gather/scatter (vector addressing)

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by 5.2.114.144 (talk) at 10:30, 19 April 2016. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

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 (and some SIMD units in CPUs) have hardware support for gather-scatter operations, providing instructions such as Load Vector Indexed for gather and Store Vector Indexed for scatter.

Definition

Denoting by the list of indices of sparse vector , the sparse gather of dense into denoted , assigns .[1]

The sparse scatter, denoted is the reverse operation. It copies the nonzero values of sparse into the corresponding locations in the dense vector , i.e. .

Examples

Gather:

for (i=0; i<N; ++i)
  x[i] = y[idx[i]];

Scatter:

for (i=0; i<N; ++i)
  y[idx[i]] = x[i];

See also

References