svsample06.cpp File Reference

Example: sparse_vector<> scan search (non-ordered set functionality). More...

`#include <iostream>`
`#include <vector>`
`#include <chrono>`
`#include <algorithm>`
`#include <random>`
`#include <stdexcept>`
`#include "bm.h"`
`#include "bmsparsevec.h"`
`#include "bmsparsevec_algo.h"`
`#include "bmtimer.h"`
`#include "bmundef.h"`
Include dependency graph for svsample06.cpp:

Go to the source code of this file.

## Typedefs

typedef bm::sparse_vector< bm::id_t, bm::bvector<> > | sparse_vector_u32

## Functions

std::mt19937 | gen (rand_dev())
std::uniform_int_distribution | rand_dis (1, value_max)
static void | generate_test_set (std::vector< unsigned > &vect, bm::bvector<> &bv_null, sparse_vector_u32 &sv)
static void | vector_search (const std::vector< unsigned > &vect, const bm::bvector<> &bv_null, unsigned value, bm::bvector<> &bv_res)
void | print_bvector (const bm::bvector<> &bv)
int | main (void)

## Variables

const unsigned | value_max = 1250000
const unsigned | test_size = 250000000
std::random_device | rand_dev
bm::chrono_taker ::duration_map_type | timing_map

## Detailed Description

Example: sparse_vector<> scan search (non-ordered set functionality).

Definition in file svsample06.cpp.

## Typedef Documentation

## sparse_vector_u32

typedef bm::sparse_vector<bm::id_t, bm::bvector<> > sparse_vector_u32

Definition at line 46 of file svsample06.cpp.

## Function Documentation

## gen()

std::mt19937 gen | ( | rand_dev() |  | ) |

## generate_test_set()

void generate_test_set | ( | std::vector< unsigned > & | vect,
|  | bm::bvector<> & | bv_null,
|  | sparse_vector_u32 & | sv )

static

Examples
  svsample06.cpp.

Definition at line 73 of file svsample06.cpp.

References gen(), bm::sparse_vector< Val, BV >::get_back_inserter(), rand_dis(), bm::bvector< Alloc >::reset(), and test_size.

Referenced by main().

## main()

int main | ( | void |  | ) |

Definition at line 133 of file svsample06.cpp.

References bm::sparse_vector< Val, BV >::begin(), bm::BM_GAP, bm::combine_or(), bm::bvector< Alloc >::compare(), bm::chrono_taker< TOut >::ct_ops_per_sec, bm::bvector< Alloc >::end(), bm::sparse_vector< Val, BV >::end(), bm::sparse_vector_scanner< SV, S_FACTOR >::find_eq(), gen(), generate_test_set(), bm::bvector< Alloc >::init(), bm::sparse_vector_scanner< SV, S_FACTOR >::invert(), print_bvector(), bm::chrono_taker< TOut >::print_duration_map(), rand_dis(), bm::sparse_vector< Val, BV >::set(), bm::bvector< Alloc >::set_bit_no_check(), bm::bvector< Alloc >::test(), timing_map, bm::use_null, and vector_search().

## print_bvector()

void print_bvector | ( | const bm::bvector<> & | bv | ) |

inline

Definition at line 122 of file svsample06.cpp.

References bm::bvector< Alloc >::count(), bm::bvector< Alloc >::first(), and bm::bvector< Alloc >::iterator_base::valid().

Referenced by main().

## rand_dis()

std::uniform_int_distribution rand_dis | ( | 1 | ,
|  | value_max | )

References value_max.

Referenced by generate_test_set(), and main().

## vector_search()

void vector_search | ( | const std::vector< unsigned > & | vect,
|  | const bm::bvector<> & | bv_null,
|  | unsigned | value,
|  | bm::bvector<> & | bv_res )

static

Examples
  svsample06.cpp.

Definition at line 106 of file svsample06.cpp.

References bm::bvector< Alloc >::init(), and bm::bvector< Alloc >::set_bit_no_check().

Referenced by main().

## Variable Documentation

## rand_dev

std::random_device rand_dev

Definition at line 60 of file svsample06.cpp.

## test_size

const unsigned test_size = 250000000

Definition at line 54 of file svsample06.cpp.

## timing_map

bm::chrono_taker ::duration_map_type timing_map

Definition at line 65 of file svsample06.cpp.

## value_max

const unsigned value_max = 1250000

Definition at line 53 of file svsample06.cpp.