sample11.cpp File Reference

Example: bvector<> bit-counting techniques analysis. More...

`#include <iostream>`
`#include <random>`
`#include <memory>`
`#include "bm.h"`
`#include "bmalgo.h"`
`#include "bmtimer.h"`
`#include "bmundef.h"`
Include dependency graph for sample11.cpp:

Go to the source code of this file.

## Functions

std::mt19937 | gen (rand_dev())
std::uniform_int_distribution | rand_dis (1, int(vector_max))
static void | generate_bvector (bm::bvector<> &bv)
| generate pseudo-random bit-vector, mix of blocks
static bm::bvector ::size_type | pre_heat (const bm::bvector<> &bv)
| "pre-heat" CPU to minimize dynamic overclocking effects
static void | bv_count_test (const bm::bvector<> &bv)
| simple population count for the whole vector
static void | bv_count_range (const bm::bvector<> &bv)
| count_range() test
static void | bv_count_range_acc (const bm::bvector<> &bv)
| count_range() test using pre-calculated blocks bit count
static void | bv_count_to_acc (const bm::bvector<> &bv)
| count_to() test using pre-calculated rank-select index
static void | bv_count_to_range_acc (const bm::bvector<> &bv)
| count_range implemented via two count_to() calls using pre-calculated rank-select index
static void | bv_count_and (const bm::bvector<> &bv)
| count_range implemented via bm::count_and
static void | bv_counted_enumerator (const bm::bvector<> &bv)
| count_to implemented via bm::bvector<>::counted_enumerator
int | main (void)

## Variables

bm::chrono_taker ::duration_map_type | timing_map
const unsigned | benchmark_count = 10000
unsigned | vector_max = 400000000
std::random_device | rand_dev

## Detailed Description

Example: bvector<> bit-counting techniques analysis.

Definition in file sample11.cpp.

## Function Documentation

## bv_count_and()

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

static

count_range implemented via bm::count_and

this method can be used, when we need co compute multiple ranges in one call

Examples
  sample11.cpp.

Definition at line 239 of file sample11.cpp.

References benchmark_count, bm::BM_GAP, bm::bvector< Alloc >::clear(), bm::count_and(), gen(), rand_dis(), bm::bvector< Alloc >::set_range(), and timing_map.

Referenced by main().

## bv_count_range()

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

static

count_range() test

Examples
  sample11.cpp.

Definition at line 133 of file sample11.cpp.

References benchmark_count, bm::bvector< Alloc >::count_range(), gen(), rand_dis(), and timing_map.

Referenced by main().

## bv_count_range_acc()

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

static

count_range() test using pre-calculated blocks bit count

Examples
  sample11.cpp.

Definition at line 154 of file sample11.cpp.

References benchmark_count, bm::bvector< Alloc >::build_rs_index(), bm::bvector< Alloc >::count_range(), gen(), rand_dis(), and timing_map.

Referenced by main().

## bv_count_test()

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

static

simple population count for the whole vector

Examples
  sample11.cpp.

Definition at line 115 of file sample11.cpp.

References benchmark_count, bm::bvector< Alloc >::count(), and timing_map.

Referenced by main().

## bv_count_to_acc()

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

static

count_to() test using pre-calculated rank-select index

Examples
  sample11.cpp.

Definition at line 180 of file sample11.cpp.

References benchmark_count, bm::bvector< Alloc >::build_rs_index(), bm::bvector< Alloc >::count_to(), gen(), rand_dis(), and timing_map.

Referenced by main().

## bv_count_to_range_acc()

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

static

count_range implemented via two count_to() calls using pre-calculated rank-select index

Examples
  sample11.cpp.

Definition at line 206 of file sample11.cpp.

References benchmark_count, bm::bvector< Alloc >::build_rs_index(), bm::bvector< Alloc >::count_to(), gen(), rand_dis(), and timing_map.

Referenced by main().

## bv_counted_enumerator()

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

static

count_to implemented via bm::bvector<>::counted_enumerator

Counted enumerator is an iterator automata, which counts the running population count along the iteration sequence

Examples
  sample11.cpp.

Definition at line 269 of file sample11.cpp.

References benchmark_count, bm::bvector< Alloc >::counted_enumerator::count(), bm::bvector< Alloc >::first(), gen(), rand_dis(), timing_map, and bm::bvector< Alloc >::iterator_base::valid().

Referenced by main().

## gen()

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

Examples
  sample11.cpp, svsample06.cpp, xsample02.cpp, and xsample05.cpp.

Referenced by bv_count_and(), bv_count_range(), bv_count_range_acc(), bv_count_to_acc(), bv_count_to_range_acc(), bv_counted_enumerator(), generate_test_set(), main(), and pick_benchmark_set().

## generate_bvector()

void generate_bvector | ( | bm::bvector<> & | bv | ) |

static

generate pseudo-random bit-vector, mix of blocks

Examples
  sample11.cpp.

Definition at line 59 of file sample11.cpp.

References bm::bv_statistics::bit_blocks, BM_DECLARE_TEMP_BLOCK, bm::bvector< Alloc >::calc_stat(), bm::bv_statistics::gap_blocks, bm::bvector< Alloc >::optimize(), bm::bvector< Alloc >::set(), bm::bvector< Alloc >::set_range(), and vector_max.

Referenced by main().

## main()

int main | ( | void |  | ) |

pre-heat CPU to minimize dynamic overclocking

Definition at line 294 of file sample11.cpp.

References bv_count_and(), bv_count_range(), bv_count_range_acc(), bv_count_test(), bv_count_to_acc(), bv_count_to_range_acc(), bv_counted_enumerator(), bm::chrono_taker< TOut >::ct_ops_per_sec, generate_bvector(), pre_heat(), bm::chrono_taker< TOut >::print_duration_map(), and timing_map.

## pre_heat()

bm::bvector ::size_type pre_heat | ( | const bm::bvector<> & | bv | ) |

static

"pre-heat" CPU to minimize dynamic overclocking effects

Examples
  sample11.cpp.

Definition at line 98 of file sample11.cpp.

References benchmark_count, and bm::bvector< Alloc >::count().

Referenced by main().

## rand_dis()

std::uniform_int_distribution rand_dis | ( | 1 | ,
|  | int(vector_max) | )

Examples
  sample11.cpp, svsample06.cpp, xsample02.cpp, and xsample05.cpp.

References vector_max.

Referenced by bv_count_and(), bv_count_range(), bv_count_range_acc(), bv_count_to_acc(), bv_count_to_range_acc(), bv_counted_enumerator(), and pick_benchmark_set().

## Variable Documentation

## benchmark_count

const unsigned benchmark_count = 10000

Examples
  sample11.cpp, and sample12.cpp.

Definition at line 48 of file sample11.cpp.

Referenced by bv_count_and(), bv_count_range(), bv_count_range_acc(), bv_count_test(), bv_count_to_acc(), bv_count_to_range_acc(), bv_counted_enumerator(), bv_set_bit_no_check_test(), bv_set_bit_test(), bvector_bulk_set_test(), combine_or_test(), and pre_heat().

## rand_dev

std::random_device rand_dev

Examples
  sample11.cpp, svsample06.cpp, xsample02.cpp, and xsample05.cpp.

Definition at line 51 of file sample11.cpp.

Referenced by pick_benchmark_set().

## timing_map

bm::chrono_taker ::duration_map_type timing_map

Examples
  inv_list.cpp, sample11.cpp, sample12.cpp, strsvsample09.cpp, svsample06.cpp, xsample01.cpp, xsample02.cpp, xsample03.cpp, xsample04.cpp, xsample04a.cpp, xsample05.cpp, xsample06.cpp, xsample07.cpp, xsample07a.cpp, and xsample09.cpp.

Definition at line 46 of file sample11.cpp.

Referenced by bv_count_and(), bv_count_range(), bv_count_range_acc(), bv_count_test(), bv_count_to_acc(), bv_count_to_range_acc(), bv_counted_enumerator(), bv_set_bit_no_check_test(), bv_set_bit_test(), bvector_bulk_set_test(), combine_or_test(), compress_inv_dump_file(), decode_test_dump_file(), generate_k_mer_bvector(), load_dict_report(), load_FASTA(), load_FASTA(), load_FASTA(), load_snp_report(), main(), main(), run_benchmark(), run_benchmark(), speed_test_bv_index(), speed_test_bvs_index(), speed_test_sv_index(), speed_test_vect_index(), test_mismatch_search(), test_strcmp(), test_sv_cmp(), test_sv_cmp_it(), test_vect_mismatch_search(), and verify_inv_dump_file().

## vector_max

unsigned vector_max = 400000000

Examples
  sample11.cpp, and sample12.cpp.

Definition at line 49 of file sample11.cpp.

Referenced by bv_set_bit_no_check_test(), bv_set_bit_test(), generate_bvector(), generate_test_vectors(), and rand_dis().