Commit c2ba086c authored by Guolin Ke's avatar Guolin Ke
Browse files

fix bug in sparse bin iterator

parent 3ef3a489
...@@ -90,6 +90,7 @@ def cfloat32_array_to_numpy(cptr, length): ...@@ -90,6 +90,7 @@ def cfloat32_array_to_numpy(cptr, length):
else: else:
raise RuntimeError('Expected float pointer') raise RuntimeError('Expected float pointer')
def cfloat64_array_to_numpy(cptr, length): def cfloat64_array_to_numpy(cptr, length):
"""Convert a ctypes double pointer array to a numpy array. """Convert a ctypes double pointer array to a numpy array.
""" """
......
...@@ -181,6 +181,7 @@ public: ...@@ -181,6 +181,7 @@ public:
} }
void GetFastIndex() { void GetFastIndex() {
fast_index_.clear(); fast_index_.clear();
// get shift cnt // get shift cnt
data_size_t mod_size = (num_data_ + kNumFastIndex - 1) / kNumFastIndex; data_size_t mod_size = (num_data_ + kNumFastIndex - 1) / kNumFastIndex;
...@@ -195,7 +196,7 @@ public: ...@@ -195,7 +196,7 @@ public:
data_size_t cur_pos = 0; data_size_t cur_pos = 0;
data_size_t next_threshold = 0; data_size_t next_threshold = 0;
while (NextNonzero(&i_delta, &cur_pos)) { while (NextNonzero(&i_delta, &cur_pos)) {
while (next_threshold < cur_pos) { while (next_threshold <= cur_pos) {
fast_index_.emplace_back(i_delta, cur_pos); fast_index_.emplace_back(i_delta, cur_pos);
next_threshold += pow2_mod_size; next_threshold += pow2_mod_size;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment