Storm 1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
storm::bisimulation::SparseAccumulator< ValueType > Class Template Reference

Accumulates a value for each state (numbers are added up, elements are inserted into sets, c.f. More...

#include <SparseAccumulator.h>

Public Member Functions

 SparseAccumulator (uint64_t const numStates)
std::vector< ValueType > const & getValues () const
std::vector< uint64_t > const & getNonDefaultStates () const
void addValue (uint64_t const state, ValueType value)
 Adds value to the currently mapped value of the given state, i.e., inserts it into the set of that state if the values are sets.
void clear ()
 Clears the set, i.e., writes the default value for all states.

Detailed Description

template<typename ValueType>
class storm::bisimulation::SparseAccumulator< ValueType >

Accumulates a value for each state (numbers are added up, elements are inserted into sets, c.f.

WrappingSetAccumulator) and keeps track of the states whose value differs from the default value, i.e., zero or the empty set. Accumulating and reading take constant time, and clearing only takes time linear in the number of touched states, so a single instance can be reused for many small computations. The memory consumption is linear in the total number of states, though. This data structure is also known as a sparse accumulator.

Definition at line 17 of file SparseAccumulator.h.

Constructor & Destructor Documentation

◆ SparseAccumulator()

template<typename ValueType>
storm::bisimulation::SparseAccumulator< ValueType >::SparseAccumulator ( uint64_t const numStates)
explicit

Definition at line 13 of file SparseAccumulator.cpp.

Member Function Documentation

◆ addValue()

template<typename ValueType>
void storm::bisimulation::SparseAccumulator< ValueType >::addValue ( uint64_t const state,
ValueType value )

Adds value to the currently mapped value of the given state, i.e., inserts it into the set of that state if the values are sets.

Definition at line 26 of file SparseAccumulator.cpp.

◆ clear()

template<typename ValueType>
void storm::bisimulation::SparseAccumulator< ValueType >::clear ( )

Clears the set, i.e., writes the default value for all states.

Definition at line 45 of file SparseAccumulator.cpp.

◆ getNonDefaultStates()

template<typename ValueType>
std::vector< uint64_t > const & storm::bisimulation::SparseAccumulator< ValueType >::getNonDefaultStates ( ) const
Returns
the list of states currently holding a non-default value

Definition at line 21 of file SparseAccumulator.cpp.

◆ getValues()

template<typename ValueType>
std::vector< ValueType > const & storm::bisimulation::SparseAccumulator< ValueType >::getValues ( ) const
Returns
the currently stored values

Definition at line 16 of file SparseAccumulator.cpp.


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