Class SparseAccumulator

Class Documentation

class SparseAccumulator

The SparseAccumulator class represents the sparse accumulator datastructure as described in Kepner, Jeremy, and John Gilbert, eds. Graph algorithms in the language of linear algebra. Vol. 22. SIAM, 2011. It is used as temporal storage for efficient computations on matrices.

Public Functions

inline SparseAccumulator(count size)

Constructs the SparseAccumulator with size size.

Parameters:

size – The size of the SparseAccumulator.

inline void scatter(double value, index pos)

Stores value at pos. If a valid value is already stored at pos then @value is added to that.

Parameters:
  • value – The value to store or add at pos in values.

  • pos – The position in values.

template<typename L>
inline void scatter(double value, index pos, L &handle)

Stores value at pos. If a valid value is already stored at pos then we call the binary handle function with the stored value and the new value as arguments.

Parameters:
  • value – The value to store or add at pos in values.

  • pos – The position in values.

  • handle – (double, double) -> double

template<typename L>
inline count gather(L handle)

Calls handle for each non zero value of the current row.

Note

handle signature: handle(index row, index column, double value)

Returns:

The number of non zero values in the current row.

inline void increaseRow()

Sets the SparseAccumulator to the next row which invalidates all currently stored data.