BitMagic-C++
|
Example: Example on how to use bit-transposed string sparse vector. More...
#include <iostream>
#include <sstream>
#include <chrono>
#include <regex>
#include <time.h>
#include <stdio.h>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <random>
#include "bm.h"
#include "bmalgo.h"
#include "bmserial.h"
#include "bmrandom.h"
#include "bmstrsparsevec.h"
#include "bmsparsevec_algo.h"
#include "bmsparsevec_serial.h"
#include "bmalgo_similarity.h"
#include "bmsparsevec_util.h"
#include "bmdbg.h"
#include "bmtimer.h"
#include "bmundef.h"
Go to the source code of this file.
Typedefs | |
typedef bm::str_sparse_vector< char, bm::bvector<>, 64 > | str_sparse_vect |
typedef vector< string > | string_vector |
Functions | |
static void | show_help () |
Print help. More... | |
static int | parse_args (int argc, char *argv[]) |
More... | |
static int | load_dict_report (const std::string &fname, string_vector &str_vec) |
Parse the input file and extract dictionary values. More... | |
static void | check_sparse (const str_sparse_vect &str_sv, const string_vector &str_vec) |
Compare STL vector with bit-transposed container to check correctness. More... | |
static void | pick_benchmark_set (string_vector &bench_vec, string_vector &bench_vec_not_found, const string_vector &str_vec) |
Sample a few random terms out of collection. More... | |
static void | run_benchmark (const str_sparse_vect &str_sv, const string_vector &str_vec) |
More... | |
int | main (int argc, char *argv[]) |
More... | |
Variables | |
std::string | sv_out_name |
More... | |
std::string | sv_in_name |
More... | |
std::string | i_name |
More... | |
bool | is_diag = false |
More... | |
bool | is_timing = false |
More... | |
bool | is_bench = false |
More... | |
bool | is_remap = false |
More... | |
bool | is_xor = false |
More... | |
bm::chrono_taker ::duration_map_type | timing_map |
More... | |
const unsigned | benchmark_max = 50000 |
More... | |
Example: Example on how to use bit-transposed string sparse vector.
Illustrates how to build a sparse vector, serialize it to disk, load back and do search or binary hybrid search.
Definition in file xsample05.cpp.
|
static |
Compare STL vector with bit-transposed container to check correctness.
Definition at line 248 of file xsample05.cpp.
References bm::str_sparse_vector< CharType, BV, STR_SIZE >::get(), and bm::str_sparse_vector< CharType, BV, STR_SIZE >::size().
Referenced by main().
|
static |
Parse the input file and extract dictionary values.
Definition at line 198 of file xsample05.cpp.
References timing_map.
Referenced by main().
int main | ( | int | argc, |
char * | argv[] | ||
) |
Definition at line 465 of file xsample05.cpp.
References BM_DECLARE_TEMP_BLOCK, check_sparse(), bm::str_sparse_vector< CharType, BV, STR_SIZE >::empty(), bm::str_sparse_vector< CharType, BV, STR_SIZE >::equal(), bm::str_sparse_vector< CharType, BV, STR_SIZE >::back_insert_iterator::flush(), bm::str_sparse_vector< CharType, BV, STR_SIZE >::get(), bm::str_sparse_vector< CharType, BV, STR_SIZE >::get_back_inserter(), i_name, is_bench, is_diag, is_remap, is_timing, is_xor, load_dict_report(), bm::str_sparse_vector< CharType, BV, STR_SIZE >::optimize(), parse_args(), bm::chrono_taker< TOut >::print_duration_map(), bm::str_sparse_vector< CharType, BV, STR_SIZE >::remap_from(), run_benchmark(), show_help(), bm::str_sparse_vector< CharType, BV, STR_SIZE >::size(), sv_in_name, sv_out_name, bm::str_sparse_vector< CharType, BV, STR_SIZE >::swap(), and timing_map.
|
static |
Definition at line 98 of file xsample05.cpp.
References i_name, is_bench, is_diag, is_remap, is_timing, is_xor, show_help(), sv_in_name, and sv_out_name.
Referenced by main().
|
static |
Sample a few random terms out of collection.
Definition at line 270 of file xsample05.cpp.
References benchmark_max, gen(), rand_dev, rand_dis(), bm::bvector< Alloc >::resize(), bm::bvector< Alloc >::set(), and bm::bvector< Alloc >::test().
Referenced by run_benchmark().
|
static |
Definition at line 318 of file xsample05.cpp.
References bm::sparse_vector_scanner< SV >::bfind_eq_str(), bm::sparse_vector_scanner< SV >::bind(), bm::bvector< Alloc >::compare(), bm::bvector< Alloc >::count(), bm::sparse_vector_scanner< SV >::find_eq_str(), pick_benchmark_set(), bm::bvector< Alloc >::set(), bm::bvector< Alloc >::size(), and timing_map.
Referenced by main().
|
static |
Print help.
Definition at line 69 of file xsample05.cpp.
Referenced by main(), and parse_args().