Word list and hashers to test. More...
Public Member Functions | |
Dictionary () | |
Constructor. More... | |
void | Add (Collider c) |
Add a Collider containing a hash function. More... | |
void | Add (const std::string phrase) |
Add a string to the dictionary. More... | |
void | Report () const |
Print the collisions for each Collider. More... | |
void | ReportExpectedCollisions () const |
Report the expected number of collisions. More... | |
void | Time () |
Report the execution time of each hash across the entire Dictionary. More... | |
void | TimeOne (const Collider &collider) |
Time and report the execution of one hash across the entire Dictionary. More... | |
Private Attributes | |
std::vector< Collider > | m_hashes |
List of hash Colliders. More... | |
unsigned long | m_nphrases |
Number of strings hashed. More... | |
std::vector< std::string > | m_words |
List of unique words. More... | |
Word list and hashers to test.
Definition at line 267 of file hash-example.cc.
|
inline |
|
inline |
Add a Collider containing a hash function.
[in] | c | The Collider to add. |
Definition at line 282 of file hash-example.cc.
References m_hashes.
Referenced by ns3::Hash::Example::DictFiles::ReadInto().
|
inline |
Add a string to the dictionary.
[in] | phrase | The string to add. |
Definition at line 292 of file hash-example.cc.
References m_hashes, m_nphrases, and m_words.
|
inline |
Print the collisions for each Collider.
Definition at line 369 of file hash-example.cc.
References m_hashes, and ReportExpectedCollisions().
|
inline |
Report the expected number of collisions.
See, e.g., http://www.math.dartmouth.edu/archive/m19w03/public_html/Section6-5.pdf
where n is the number of entries in the table, and k is the number of buckets.
This form is numerically unstable for low collision rates. Expanding for large we get
For simplicity, we'll use the first two terms of the second form.
Definition at line 349 of file hash-example.cc.
References m_nphrases.
Referenced by Report().
|
inline |
Report the execution time of each hash across the entire Dictionary.
Definition at line 408 of file hash-example.cc.
References m_hashes, and TimeOne().
|
inline |
Time and report the execution of one hash across the entire Dictionary.
[in] | collider | The hash Collider to use. |
Definition at line 384 of file hash-example.cc.
References ns3::Hasher::clear(), two-ray-to-three-gpp-ch-calibration::delta, ns3::Hasher::GetHash32(), ns3::Hash::Example::Collider::GetName(), ns3::Hash::Example::Collider::m_hash, m_nphrases, m_words, two-ray-to-three-gpp-ch-calibration::start, and two-ray-to-three-gpp-ch-calibration::stop.
Referenced by Time().
|
private |
List of hash Colliders.
Definition at line 423 of file hash-example.cc.
|
private |
Number of strings hashed.
Definition at line 422 of file hash-example.cc.
Referenced by Add(), ReportExpectedCollisions(), and TimeOne().
|
private |
List of unique words.
Definition at line 424 of file hash-example.cc.
Referenced by Dictionary(), Add(), and TimeOne().