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 (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.

Definitions

Gather

A sparsely populated vector holding non-empty elements can be represented by two densely-populated vectors of length ; containing the non-empty elements of , and giving the index in where 's element is located. The gather of into , denoted , assigns with having already been calculated.[1] A C implementation is

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

Scatter

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

for (i=0; i<N; ++i)
  y[idx[i]] = x[i];
gollark: Just listen on rednet.CHANNEL_REPEAT.
gollark: What? They can easily.
gollark: There is literally nothing stopping people from- reading all messages and seeing what transactions happen- pretending to be an ATM or the bank server
gollark: Also, my main worry with this is that it doesn't seem to be very secure.
gollark: It has Ctrl and stuff, sure.

See also

References

This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.