Use the counter hierarchy to better save space while preserving accuracy! More...
#include <hierarchy.h>
Public Member Functions | |
| CounterHierarchy (const std::vector< size_t > &no_cnt, const std::vector< size_t > &width_cnt, const std::vector< size_t > &no_hash) | |
| Construct by specifying detailed architectural parameters. More... | |
| ~CounterHierarchy () | |
| Destructor. More... | |
| void | updateCnt (size_t index, T val) |
| Update a counter. More... | |
| T | getCnt (size_t index) |
| Get the value of counters in CH. More... | |
| T | getOriginalCnt (size_t index) const |
| Get the original value of counters. More... | |
| size_t | size () const |
| Size of CH. More... | |
| size_t | originalSize () const |
| Size of counters without CH. More... | |
| void | clear () |
| Reset CH. More... | |
Use the counter hierarchy to better save space while preserving accuracy!
| no_layer | Number of layers in CH |
| T | Counter Type of CH |
| hash_t | Hashing classes used internally |
size_t.| OmniSketch::Sketch::CounterHierarchy< no_layer, T, hash_t >::CounterHierarchy | ( | const std::vector< size_t > & | no_cnt, |
| const std::vector< size_t > & | width_cnt, | ||
| const std::vector< size_t > & | no_hash | ||
| ) |
Construct by specifying detailed architectural parameters.
| no_cnt | number of counters on each layer, from low to high |
| width_cnt | width of counters on each layer, from low to high |
| no_hash | number of hash functions used on each layer, from low to high (except for the last layer) |
The meaning of the three parameters stipulates the following requirements:
no_cnt should equal no_layer.width_cnt should equal no_layer.no_hash should equal no_layer - 1.If any of these is violated, an exception would be thrown. Other conditions that trigger an exception:
no_layer <= 0width_cnt exceeds sizeof(T) * 8. This constraint is imposed to guarantee proper shifting of counters when decoding. | OmniSketch::Sketch::CounterHierarchy< no_layer, T, hash_t >::~CounterHierarchy |
Destructor.
| void OmniSketch::Sketch::CounterHierarchy< no_layer, T, hash_t >::clear |
Reset CH.
| T OmniSketch::Sketch::CounterHierarchy< no_layer, T, hash_t >::getCnt | ( | size_t | index | ) |
Get the value of counters in CH.
An overflow exception would be thrown if there is an overflow at the last layer. An out-of-range exception would be thrown if the index is out of range.
| index | Serialized index of a counter. It is the user's job to get the index serialized in advance. |
| T OmniSketch::Sketch::CounterHierarchy< no_layer, T, hash_t >::getOriginalCnt | ( | size_t | index | ) | const |
Get the original value of counters.
I.e., the value of the counter without CH.
| index | Serialized index of a counter. It is the user's job to get the index serialized in advance. |
| size_t OmniSketch::Sketch::CounterHierarchy< no_layer, T, hash_t >::originalSize |
Size of counters without CH.
| size_t OmniSketch::Sketch::CounterHierarchy< no_layer, T, hash_t >::size |
Size of CH.
| void OmniSketch::Sketch::CounterHierarchy< no_layer, T, hash_t >::updateCnt | ( | size_t | index, |
| T | val | ||
| ) |
Update a counter.
| index | Serialized index of a counter. It is the user's job to get the index serialized in advance. |
| val | Value to be updated |
index is out of range.