BitMagic-C++
Typedefs | Functions | Variables
xsample02.cpp File Reference

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"
#include "bmundef.h"
Include dependency graph for xsample02.cpp:

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())
  More...
 
std::uniform_int_distribution rand_dis (1, value_max)
  More...
 
static void sort_map (map_u32 &hmap, const std::vector< unsigned > &vin)
  More...
 
static void counting_sort_naive (sparse_vector_u32 &sv_out, const std::vector< unsigned > &vin)
  More...
 
static void counting_sort (sparse_vector_u32 &sv_out, const std::vector< unsigned > &vin)
  More...
 
unsigned counting_sort_subbatch (sparse_vector_u32 *sv_out, const std::vector< unsigned > *vin)
  More...
 
static void counting_sort_parallel (sparse_vector_u32 &sv_out, const std::vector< unsigned > &vin)
  More...
 
static void print_sorted (const sparse_vector_u32 &sv)
  More...
 
static void print_sorted (const map_u32 &hmap)
 
static void build_histogram (sparse_vector_u32 &sv_out, const std::vector< unsigned > &vin)
  More...
 
int main (void)
  More...
 

Variables

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

Detailed Description

Example: sparse_vector<> used for counting sort / historgam construction.

Definition in file xsample02.cpp.