|
BitMagic-C++
|
Example: sparse_vector<> used for counting sort / historgam construction. More...
#include <iostream>#include <memory>#include <map>#include <vector>#include <chrono>#include <algorithm>#include <random>#include <stdexcept>#include <future>#include <thread>#include "bm.h"#include "bmtimer.h"#include "bmsparsevec.h"
Go to the source code of this file.
Typedefs | |
| typedef bm::sparse_vector< unsigned, bm::bvector<> > | sparse_vector_u32 |
| typedef std::map< unsigned, unsigned > | map_u32 |
Functions | |
| std::mt19937 | gen (rand_dev()) |
| std::uniform_int_distribution | rand_dis (1, value_max) |
| static void | sort_map (map_u32 &hmap, const std::vector< unsigned > &vin) |
| static void | counting_sort_naive (sparse_vector_u32 &sv_out, const std::vector< unsigned > &vin) |
| static void | counting_sort (sparse_vector_u32 &sv_out, const std::vector< unsigned > &vin) |
| unsigned | counting_sort_subbatch (sparse_vector_u32 *sv_out, const std::vector< unsigned > *vin) |
| static void | counting_sort_parallel (sparse_vector_u32 &sv_out, const std::vector< unsigned > &vin) |
| static void | print_sorted (const sparse_vector_u32 &sv) |
| static void | print_sorted (const map_u32 &hmap) |
| static void | build_histogram (sparse_vector_u32 &sv_out, const std::vector< unsigned > &vin) |
| 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 |
Example: sparse_vector<> used for counting sort / historgam construction.
Definition in file xsample02.cpp.
| typedef std::map<unsigned, unsigned> map_u32 |
Definition at line 67 of file xsample02.cpp.
| typedef bm::sparse_vector<unsigned, bm::bvector<> > sparse_vector_u32 |
Definition at line 66 of file xsample02.cpp.
|
static |
Definition at line 211 of file xsample02.cpp.
References bm::sparse_vector< Val, BV >::set().
Referenced by main().
|
static |
Definition at line 116 of file xsample02.cpp.
References bm::sparse_vector< Val, BV >::inc().
Referenced by main().
|
static |
Definition at line 96 of file xsample02.cpp.
References bm::sparse_vector< Val, BV >::get(), and bm::sparse_vector< Val, BV >::set().
Referenced by main().
|
static |
Definition at line 145 of file xsample02.cpp.
References counting_sort_subbatch(), bm::sparse_vector< Val, BV >::inc(), bm::sparse_vector< Val, BV >::merge(), and bm::use_null.
Referenced by main().
|
inline |
Definition at line 128 of file xsample02.cpp.
References bm::sparse_vector< Val, BV >::inc().
Referenced by counting_sort_parallel().
| std::mt19937 gen | ( | rand_dev() | ) |
Referenced by main().
| int main | ( | void | ) |
Definition at line 238 of file xsample02.cpp.
References BM_DECLARE_TEMP_BLOCK, build_histogram(), counting_sort(), counting_sort_naive(), counting_sort_parallel(), bm::chrono_taker::ct_ops_per_sec, bm::sparse_vector< Val, BV >::equal(), gen(), bm::bvector<>::opt_compress, bm::sparse_vector< Val, BV >::optimize(), bm::chrono_taker::print_duration_map(), print_sorted(), rand_dis(), sort_map(), test_size, and bm::use_null.
|
static |
Definition at line 170 of file xsample02.cpp.
References bm::bvector<>::enumerator, bm::bvector< Alloc >::first(), bm::sparse_vector< Val, BV >::get(), and bm::base_sparse_vector< Val, BV, MAX_SIZE >::get_null_bvector().
Referenced by main().
|
static |
Definition at line 190 of file xsample02.cpp.
| std::uniform_int_distribution rand_dis | ( | 1 | , |
| value_max | |||
| ) |
Referenced by main().
|
static |
| std::random_device rand_dev |
Definition at line 61 of file xsample02.cpp.
| const unsigned test_size = 250000000 |
| bm::chrono_taker::duration_map_type timing_map |
Definition at line 71 of file xsample02.cpp.
| const unsigned value_max = 1250000 |
Definition at line 54 of file xsample02.cpp.
1.8.13