BitMagic-C++
Data Structures | Typedefs | Functions | Variables
xsample01.cpp File Reference

Example: Example: memory consumption techniques. More...

#include <iostream>
#include <memory>
#include <map>
#include <vector>
#include <chrono>
#include <algorithm>
#include <stdexcept>
#include "bm.h"
#include "bmalgo.h"
#include "bmtimer.h"
#include "bmserial.h"
#include "bmsparsevec.h"
#include "bmsparsevec_algo.h"
#include "bmsparsevec_serial.h"
#include "bmalgo_similarity.h"
#include "bmdbg.h"
Include dependency graph for xsample01.cpp:

Go to the source code of this file.

Data Structures

struct  gap_len_table_sparse< T >
 
struct  bv_index
 
struct  bvs_index
 
struct  vect_index
 
struct  sparse_vect_index
 
struct  sparse_vect_index::vect_addr
 

Typedefs

typedef bm::bvector TBVector
 

Functions

static TBVectorconstruct_bvector ()
 
template<typename TM >
void destroy_map (TM &id_map)
 
static void generate_random_vector (TBVector *bv)
 
static void generate_bv_index (bv_index &bvi)
 
static size_t calc_memory_footprint (const bv_index &bvi)
 
static size_t convert_bv2bvs (const bv_index &bvi, bvs_index &bvs)
 
static size_t convert_bv2vect (const bv_index &bvi, vect_index &vidx)
 
static void bv2delta (const TBVector &bv, std::vector< unsigned > &vect)
 
static size_t convert_bv2sv (const bv_index &bvi, sparse_vect_index &sv_idx)
 
static void speed_test_bv_index (const bv_index &bvi)
 
static void speed_test_bvs_index (const bvs_index &bvs)
 
static void speed_test_vect_index (const vect_index &vecti)
 
static void speed_test_sv_index (const sparse_vect_index &svi)
 
int main (void)
 

Variables

const unsigned index_size = 1000000
 
const unsigned max_size = 2000000
 
const unsigned bits_per_vect = 5
 
const unsigned benchmark_ops = 1000
 
const unsigned sample_cnt = 250
 
const unsigned result_set_cnt = 200
 
bm::chrono_taker::duration_map_type timing_map
 

Detailed Description

Example: Example: memory consumption techniques.

Definition in file xsample01.cpp.

Typedef Documentation

◆ TBVector

Examples:
xsample01.cpp.

Definition at line 72 of file xsample01.cpp.

Function Documentation

◆ bv2delta()

static void bv2delta ( const TBVector bv,
std::vector< unsigned > &  vect 
)
static
Examples:
xsample01.cpp.

Definition at line 395 of file xsample01.cpp.

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

Referenced by convert_bv2sv().

◆ calc_memory_footprint()

static size_t calc_memory_footprint ( const bv_index bvi)
static
Examples:
xsample01.cpp.

Definition at line 281 of file xsample01.cpp.

References bm::bvector< Alloc >::calc_stat(), bv_index::idx_, and bm::bv_statistics::memory_used.

Referenced by main().

◆ construct_bvector()

static TBVector* construct_bvector ( )
static

◆ convert_bv2bvs()

static size_t convert_bv2bvs ( const bv_index bvi,
bvs_index bvs 
)
static

◆ convert_bv2sv()

static size_t convert_bv2sv ( const bv_index bvi,
sparse_vect_index sv_idx 
)
static

◆ convert_bv2vect()

static size_t convert_bv2vect ( const bv_index bvi,
vect_index vidx 
)
static

◆ destroy_map()

template<typename TM >
void destroy_map ( TM &  id_map)
Examples:
xsample01.cpp.

Definition at line 114 of file xsample01.cpp.

Referenced by bv_index::~bv_index().

◆ generate_bv_index()

static void generate_bv_index ( bv_index bvi)
static
Examples:
xsample01.cpp.

Definition at line 260 of file xsample01.cpp.

References construct_bvector(), generate_random_vector(), bv_index::idx_, and index_size.

Referenced by main().

◆ generate_random_vector()

static void generate_random_vector ( TBVector bv)
static
Examples:
xsample01.cpp.

Definition at line 217 of file xsample01.cpp.

References bits_per_vect, max_size, and bm::bvector< Alloc >::set_bit().

Referenced by generate_bv_index().

◆ main()

int main ( void  )

◆ speed_test_bv_index()

static void speed_test_bv_index ( const bv_index bvi)
static

◆ speed_test_bvs_index()

static void speed_test_bvs_index ( const bvs_index bvs)
static

◆ speed_test_sv_index()

static void speed_test_sv_index ( const sparse_vect_index svi)
static

◆ speed_test_vect_index()

static void speed_test_vect_index ( const vect_index vecti)
static

Variable Documentation

◆ benchmark_ops

const unsigned benchmark_ops = 1000

◆ bits_per_vect

const unsigned bits_per_vect = 5
Examples:
xsample01.cpp.

Definition at line 59 of file xsample01.cpp.

Referenced by generate_random_vector().

◆ index_size

const unsigned index_size = 1000000

◆ max_size

const unsigned max_size = 2000000
Examples:
xsample01.cpp.

Definition at line 56 of file xsample01.cpp.

Referenced by construct_bvector(), and generate_random_vector().

◆ result_set_cnt

const unsigned result_set_cnt = 200

◆ sample_cnt

const unsigned sample_cnt = 250

◆ timing_map