8 #ifndef XGBOOST_COMMON_BITMAP_H_ 9 #define XGBOOST_COMMON_BITMAP_H_ 19 std::vector<uint32_t>
data;
25 data.resize((size + 31U) >> 5, 0);
31 inline bool Get(
size_t i)
const {
32 return (data[i >> 5] >> (i & 31U)) & 1U;
39 data[i >> 5] |= (1 << (i & 31U));
46 #pragma omp parallel for schedule(static) 49 for (
int k = 0; k < 32; ++k) {
50 uint32_t bit = vec[(i << 5) | k];
55 if (nsize != vec.size()) data.back() = 0;
56 for (
size_t i = nsize; i < vec.size(); ++i) {
62 std::fill(data.begin(), data.end(), 0U);
67 #endif // XGBOOST_COMMON_BITMAP_H_ dmlc::omp_uint bst_omp_uint
define unsigned int for openmp loop
Definition: base.h:246
void Clear()
clear the bitmap, set all places to false
Definition: bitmap.h:61
namespace of xgboost
Definition: base.h:102
bool Get(size_t i) const
query the i-th position of bitmap
Definition: bitmap.h:31
std::vector< uint32_t > data
internal data structure
Definition: bitmap.h:19
void SetTrue(size_t i)
set i-th position to true
Definition: bitmap.h:38
void Resize(size_t size)
resize the bitmap to be certain size
Definition: bitmap.h:24
bit map that contains set of bit indicators
Definition: bitmap.h:17
void InitFromBool(const std::vector< int > &vec)
initialize the value of bit map from vector of bool
Definition: bitmap.h:42