dlvhex  2.5.0
bm::random_subset< BV > Class Template Reference

#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_subsetoperator= (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_subsetoperator= (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_tsub_block_

Detailed Description

template<class BV>
class bm::random_subset< BV >

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.


Member Typedef Documentation

template<class BV >
typedef BV::blocks_manager_type bm::random_subset< BV >::blocks_manager_type [private]

Definition at line 70 of file bmrandom.h.

template<class BV >
typedef BV::blocks_manager_type bm::random_subset< BV >::blocks_manager_type [private]

Definition at line 70 of file bmrandom.h.


Constructor & Destructor Documentation

template<class BV >
bm::random_subset< BV >::random_subset ( )

Definition at line 115 of file bmrandom.h.

template<class BV >
bm::random_subset< BV >::~random_subset ( )

Definition at line 125 of file bmrandom.h.

template<class BV >
bm::random_subset< BV >::random_subset ( const random_subset< BV > &  ) [private]
template<class BV >
bm::random_subset< BV >::random_subset ( )
template<class BV >
bm::random_subset< BV >::~random_subset ( )
template<class BV >
bm::random_subset< BV >::random_subset ( const random_subset< BV > &  ) [private]

Member Function Documentation

template<class BV >
unsigned bm::random_subset< BV >::find_max_block ( ) [private]

Definition at line 397 of file bmrandom.h.

template<class BV >
unsigned bm::random_subset< BV >::find_max_block ( ) [private]
template<class BV >
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().

template<class BV >
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]
template<class BV >
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.

template<class BV >
void bm::random_subset< BV >::get_random_subset ( bm::word_t blk_out,
const bm::word_t blk_src,
unsigned  count 
) [private]
template<class BV >
void bm::random_subset< BV >::get_subset ( BV &  bv_out,
const BV &  bv_in,
unsigned  bv_in_count,
unsigned  count 
) [private]
template<class BV >
void bm::random_subset< BV >::get_subset ( BV &  bv_out,
const BV &  bv_in,
unsigned  bv_in_count,
unsigned  count 
) [private]
template<class BV >
random_subset& bm::random_subset< BV >::operator= ( const random_subset< BV > &  ) [private]
template<class BV >
random_subset& bm::random_subset< BV >::operator= ( const random_subset< BV > &  ) [private]
template<class BV >
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().

template<class BV >
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]
template<class BV >
void bm::random_subset< BV >::sample ( BV &  bv_out,
const BV &  bv_in,
unsigned  count 
)

Get random subset of input vector.

Parameters:
bv_out- destination vector
bv_in- input vector
count- number of bits to pick
template<class BV >
void bm::random_subset< BV >::sample ( BV &  bv_out,
const BV &  bv_in,
unsigned  count 
)

Get random subset of input vector.

Parameters:
bv_out- destination vector
bv_in- input vector
count- number of bits to pick

Definition at line 134 of file bmrandom.h.


Field Documentation

template<class BV >
bm::gap_word_t bm::random_subset< BV >::bit_list_ [private]

Definition at line 103 of file bmrandom.h.

template<class BV >
unsigned short * bm::random_subset< BV >::block_bits_take_ [private]

Definition at line 101 of file bmrandom.h.

template<class BV >
unsigned * bm::random_subset< BV >::block_candidates_ [private]

Definition at line 104 of file bmrandom.h.

template<class BV >
unsigned * bm::random_subset< BV >::block_counts_ [private]

Definition at line 100 of file bmrandom.h.

template<class BV >
unsigned bm::random_subset< BV >::blocks_ [private]

Definition at line 102 of file bmrandom.h.

template<class BV >
unsigned bm::random_subset< BV >::candidates_count_ [private]

Definition at line 105 of file bmrandom.h.

template<class BV >
bm::word_t * bm::random_subset< BV >::sub_block_ [private]

Definition at line 106 of file bmrandom.h.


The documentation for this class was generated from the following files: