All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Attributes | List of all members
NetworKit::SparseAccumulator Class Reference

The SparseAccumulator class represents the sparse accumulator datastructure as described in Kepner, Jeremy, and John Gilbert, eds. More...

#include <SparseAccumulator.h>

Public Member Functions

 SparseAccumulator (count size)
 Constructs the SparseAccumulator with size size. More...
 
void scatter (double value, index pos)
 Stores value at pos. More...
 
template<typename L >
void scatter (double value, index pos, L &handle)
 Stores value at pos. More...
 
template<typename L >
count gather (L handle)
 Calls handle for each non zero value of the current row. More...
 
void increaseRow ()
 Sets the SparseAccumulator to the next row which invalidates all currently stored data. More...
 

Protected Attributes

std::vector< double > values
 dense vector of doubles which stores the computed values More...
 
std::vector< countoccupied
 dense vector of integers which stores whether a valid value is stored in values at each position More...
 
std::vector< indexindices
 unordered list to store the position of valid values in values vector More...
 

Detailed Description

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.

Constructor & Destructor Documentation

NetworKit::SparseAccumulator::SparseAccumulator ( count  size)
inline

Constructs the SparseAccumulator with size size.

Parameters
sizeThe size of the SparseAccumulator.

Member Function Documentation

template<typename L >
count NetworKit::SparseAccumulator::gather ( handle)
inline

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.
void NetworKit::SparseAccumulator::increaseRow ( )
inline

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

void NetworKit::SparseAccumulator::scatter ( double  value,
index  pos 
)
inline

Stores value at pos.

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

Parameters
valueThe value to store or add at pos in values.
posThe position in values.
template<typename L >
void NetworKit::SparseAccumulator::scatter ( double  value,
index  pos,
L &  handle 
)
inline

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
valueThe value to store or add at pos in values.
posThe position in values.
handle(double, double) -> double

Member Data Documentation

std::vector<index> NetworKit::SparseAccumulator::indices
protected

unordered list to store the position of valid values in values vector

std::vector<count> NetworKit::SparseAccumulator::occupied
protected

dense vector of integers which stores whether a valid value is stored in values at each position

std::vector<double> NetworKit::SparseAccumulator::values
protected

dense vector of doubles which stores the computed values


The documentation for this class was generated from the following file: