Rahul Sharma (Editor)

Gather scatter (vector addressing)

Updated on
Edit
Like
Comment
Share on FacebookTweet on TwitterShare on LinkedInShare on Reddit

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.

Contents

Gather

A sparsely-populated vector y holding N non-empty elements can be represented by two densely-populated vectors of length N ; x containing the non-empty elements of y , and i d x giving the index in y where x 's element is located. The gather of y into x , denoted x y | x , assigns x ( i ) = y ( i d x ( i ) ) with i d x having already been calculated. A C implementation is

Scatter

The sparse scatter, denoted y | x x is the reverse operation. It copies the values of x into the corresponding locations in the sparsely-populated vector y , i.e. y ( i d x ( i ) ) = x ( i ) .

References

Gather-scatter (vector addressing) Wikipedia