dlvhex
2.5.0
|
#include <vs10/bm/bmrandom.h>
Public Member Functions | |
random_subset () | |
~random_subset () | |
void | sample (BV &bv_out, const BV &bv_in, unsigned count) |
Get random subset of input vector. | |
random_subset () | |
~random_subset () | |
void | sample (BV &bv_out, const BV &bv_in, unsigned count) |
Get random subset of input vector. | |
Private Types | |
typedef BV::blocks_manager_type | blocks_manager_type |
typedef BV::blocks_manager_type | blocks_manager_type |
Private Member Functions | |
void | get_subset (BV &bv_out, const BV &bv_in, unsigned bv_in_count, unsigned count) |
unsigned | find_max_block () |
void | get_random_subset (bm::word_t *blk_out, const bm::word_t *blk_src, unsigned count) |
random_subset (const random_subset &) | |
random_subset & | operator= (const random_subset &) |
void | get_subset (BV &bv_out, const BV &bv_in, unsigned bv_in_count, unsigned count) |
unsigned | find_max_block () |
void | get_random_subset (bm::word_t *blk_out, const bm::word_t *blk_src, unsigned count) |
random_subset (const random_subset &) | |
random_subset & | operator= (const random_subset &) |
Static Private Member Functions | |
static unsigned | process_word (bm::word_t *blk_out, const bm::word_t *blk_src, unsigned i, unsigned count) |
static void | get_random_array (bm::word_t *blk_out, bm::gap_word_t *bit_list, unsigned bit_list_size, unsigned count) |
static unsigned | process_word (bm::word_t *blk_out, const bm::word_t *blk_src, unsigned i, unsigned count) |
static void | get_random_array (bm::word_t *blk_out, bm::gap_word_t *bit_list, unsigned bit_list_size, unsigned count) |
Private Attributes | |
unsigned * | block_counts_ |
unsigned short * | block_bits_take_ |
unsigned | blocks_ |
bm::gap_word_t | bit_list_ [bm::gap_max_bits] |
unsigned * | block_candidates_ |
unsigned | candidates_count_ |
bm::word_t * | sub_block_ |
Class implements algorithm for random subset generation.
Implemented method tries to be fair, but doesn't guarantee true randomeness.
Performace note: Class holds temporary buffers and variables, so it is recommended to re-use instances over multiple calls.
Definition at line 53 of file bmrandom.h.
typedef BV::blocks_manager_type bm::random_subset< BV >::blocks_manager_type [private] |
Definition at line 70 of file bmrandom.h.
typedef BV::blocks_manager_type bm::random_subset< BV >::blocks_manager_type [private] |
Definition at line 70 of file bmrandom.h.
bm::random_subset< BV >::random_subset | ( | ) |
Definition at line 115 of file bmrandom.h.
bm::random_subset< BV >::~random_subset | ( | ) |
Definition at line 125 of file bmrandom.h.
bm::random_subset< BV >::random_subset | ( | const random_subset< BV > & | ) | [private] |
bm::random_subset< BV >::random_subset | ( | ) |
bm::random_subset< BV >::~random_subset | ( | ) |
bm::random_subset< BV >::random_subset | ( | const random_subset< BV > & | ) | [private] |
unsigned bm::random_subset< BV >::find_max_block | ( | ) | [private] |
Definition at line 397 of file bmrandom.h.
unsigned bm::random_subset< BV >::find_max_block | ( | ) | [private] |
void bm::random_subset< BV >::get_random_array | ( | bm::word_t * | blk_out, |
bm::gap_word_t * | bit_list, | ||
unsigned | bit_list_size, | ||
unsigned | count | ||
) | [static, private] |
Definition at line 384 of file bmrandom.h.
References bm::set_bit().
static void bm::random_subset< BV >::get_random_array | ( | bm::word_t * | blk_out, |
bm::gap_word_t * | bit_list, | ||
unsigned | bit_list_size, | ||
unsigned | count | ||
) | [static, private] |
void bm::random_subset< BV >::get_random_subset | ( | bm::word_t * | blk_out, |
const bm::word_t * | blk_src, | ||
unsigned | count | ||
) | [private] |
Definition at line 291 of file bmrandom.h.
References bm::bit_convert_to_arr(), bm::gap_max_bits, and bm::set_block_size.
void bm::random_subset< BV >::get_random_subset | ( | bm::word_t * | blk_out, |
const bm::word_t * | blk_src, | ||
unsigned | count | ||
) | [private] |
void bm::random_subset< BV >::get_subset | ( | BV & | bv_out, |
const BV & | bv_in, | ||
unsigned | bv_in_count, | ||
unsigned | count | ||
) | [private] |
void bm::random_subset< BV >::get_subset | ( | BV & | bv_out, |
const BV & | bv_in, | ||
unsigned | bv_in_count, | ||
unsigned | count | ||
) | [private] |
Definition at line 168 of file bmrandom.h.
References bm::bit_block_copy(), bm::bit_block_set(), bm::bit_convert_to_arr(), BM_IS_GAP, BMGAP_PTR, bm::gap_convert_to_arr(), bm::gap_convert_to_bitset(), and bm::gap_max_bits.
random_subset& bm::random_subset< BV >::operator= | ( | const random_subset< BV > & | ) | [private] |
random_subset& bm::random_subset< BV >::operator= | ( | const random_subset< BV > & | ) | [private] |
unsigned bm::random_subset< BV >::process_word | ( | bm::word_t * | blk_out, |
const bm::word_t * | blk_src, | ||
unsigned | i, | ||
unsigned | count | ||
) | [static, private] |
Definition at line 334 of file bmrandom.h.
References bm::bit_list_4(), and bm::word_bitcount().
static unsigned bm::random_subset< BV >::process_word | ( | bm::word_t * | blk_out, |
const bm::word_t * | blk_src, | ||
unsigned | i, | ||
unsigned | count | ||
) | [static, private] |
void bm::random_subset< BV >::sample | ( | BV & | bv_out, |
const BV & | bv_in, | ||
unsigned | count | ||
) |
Get random subset of input vector.
bv_out | - destination vector |
bv_in | - input vector |
count | - number of bits to pick |
void bm::random_subset< BV >::sample | ( | BV & | bv_out, |
const BV & | bv_in, | ||
unsigned | count | ||
) |
Get random subset of input vector.
bv_out | - destination vector |
bv_in | - input vector |
count | - number of bits to pick |
Definition at line 134 of file bmrandom.h.
bm::gap_word_t bm::random_subset< BV >::bit_list_ [private] |
Definition at line 103 of file bmrandom.h.
unsigned short * bm::random_subset< BV >::block_bits_take_ [private] |
Definition at line 101 of file bmrandom.h.
unsigned * bm::random_subset< BV >::block_candidates_ [private] |
Definition at line 104 of file bmrandom.h.
unsigned * bm::random_subset< BV >::block_counts_ [private] |
Definition at line 100 of file bmrandom.h.
unsigned bm::random_subset< BV >::blocks_ [private] |
Definition at line 102 of file bmrandom.h.
unsigned bm::random_subset< BV >::candidates_count_ [private] |
Definition at line 105 of file bmrandom.h.
bm::word_t * bm::random_subset< BV >::sub_block_ [private] |
Definition at line 106 of file bmrandom.h.