BitMagic-C++: svsample06.cpp File Reference

BitMagic-C++

Typedefs | Functions | Variables
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 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

Examples
  svsample06.cpp.

Definition at line 46 of file svsample06.cpp.

## Function Documentation

## ◆ gen()

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

Examples
  svsample06.cpp.

Referenced by generate_test_set(), and main().

## ◆ generate_test_set()

static 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 bm::sparse_vector< Val, BV >::back_insert_iterator, 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 |  | ) |

Examples
  svsample06.cpp.

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::sparse_vector< Val, BV >::const_iterator, bm::chrono_taker::ct_ops_per_sec, bm::sparse_vector< Val, BV >::end(), bm::bvector< Alloc >::end(), bm::sparse_vector_scanner< SV >::find_eq(), gen(), generate_test_set(), bm::bvector< Alloc >::init(), bm::sparse_vector_scanner< SV >::invert(), print_bvector(), bm::chrono_taker::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

Examples
  svsample06.cpp.

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 |
| ) |  |

Examples
  svsample06.cpp.

Referenced by generate_test_set(), and main().

## ◆ vector_search()

static 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

Examples
  svsample06.cpp.

Definition at line 60 of file svsample06.cpp.

## ◆ test_size

const unsigned test_size = 250000000

Examples
  svsample06.cpp.

Definition at line 54 of file svsample06.cpp.

Referenced by generate_test_set().

## ◆ timing_map

bm::chrono_taker::duration_map_type timing_map

Examples
  svsample06.cpp.

Definition at line 65 of file svsample06.cpp.

Referenced by main().

## ◆ value_max

const unsigned value_max = 1250000

Examples
  svsample06.cpp.

Definition at line 53 of file svsample06.cpp.