|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Bloom filter in Aleph-w (probabilistic set membership, false positives, and tuning). More...
#include <iostream>#include <iomanip>#include <string>#include <vector>#include <cmath>#include <tclap/CmdLine.h>#include <bloom-filter.H>Go to the source code of this file.
Functions | |
| void | print_section (const string &title) |
| void | print_subsection (const string &title) |
| void | demo_basic () |
| void | demo_false_positives () |
| void | demo_optimal_params () |
| void | demo_spell_checker () |
| void | demo_cache_filter () |
| void | demo_space_comparison () |
| int | main (int argc, char *argv[]) |
Bloom filter in Aleph-w (probabilistic set membership, false positives, and tuning).
This example demonstrates Aleph-w's Bloom_Filter<T>: a probabilistic data structure for set membership queries.
The program is structured as a set of independent demos:
Bloom_Filter<string>m: bit array sizek: number of hash functionsThis example uses TCLAP and a selector:
--section / -s <section>: run only one section. Valid values: basic, fp, params, spell, cache, space, all (default).--help: show help.Let k be the number of hash functions.
O(k)O(k)O(m) bitsm, too large/small k) increase the false positive rate.bloom-filter.H (implementation)bitArray.H / bitarray_example.C (bitset storage)Definition in file bloom_filter_example.C.
| void demo_basic | ( | ) |
Definition at line 114 of file bloom_filter_example.C.
References Aleph::filter(), Aleph::DynList< T >::insert(), Aleph::maps(), print_section(), print_subsection(), and w.
Referenced by main().
| void demo_cache_filter | ( | ) |
Definition at line 315 of file bloom_filter_example.C.
References Aleph::DynList< T >::insert(), Aleph::maps(), print_section(), and print_subsection().
Referenced by main().
| void demo_false_positives | ( | ) |
Definition at line 162 of file bloom_filter_example.C.
References exp(), Aleph::filter(), Aleph::maps(), pow(), print_section(), and print_subsection().
Referenced by main().
| void demo_optimal_params | ( | ) |
Definition at line 214 of file bloom_filter_example.C.
References ceil(), exp(), log(), Aleph::maps(), pow(), print_section(), and print_subsection().
Referenced by main().
| void demo_space_comparison | ( | ) |
Definition at line 380 of file bloom_filter_example.C.
References log(), Aleph::maps(), and print_section().
Referenced by main().
| void demo_spell_checker | ( | ) |
Definition at line 260 of file bloom_filter_example.C.
References Aleph::DynList< T >::insert(), Aleph::maps(), print_section(), print_subsection(), Aleph::HTList::size(), and w.
Referenced by main().
| int main | ( | int | argc, |
| char * | argv[] | ||
| ) |
Definition at line 422 of file bloom_filter_example.C.
References demo_basic(), demo_cache_filter(), demo_false_positives(), demo_optimal_params(), demo_space_comparison(), demo_spell_checker(), and Aleph::maps().
| void print_section | ( | const string & | title | ) |
Definition at line 98 of file bloom_filter_example.C.
References Aleph::maps().
Referenced by demo_basic(), demo_cache_filter(), demo_false_positives(), demo_optimal_params(), demo_space_comparison(), and demo_spell_checker().
| void print_subsection | ( | const string & | title | ) |
Definition at line 105 of file bloom_filter_example.C.
References Aleph::maps().
Referenced by demo_basic(), demo_cache_filter(), demo_false_positives(), demo_optimal_params(), and demo_spell_checker().