all_ones_sequence bitsize function
xuzhouchuan opened this issue · 1 comments
xuzhouchuan commented
Hi,bro:
I am reading the code of pef;when I see the bitsize compute, I think the function of all_ones_sequence:bitsize return 0 makes optimal_partition has 0 windows. the code like this:
//all_ones_sequence.hpp
struct all_ones_sequence {
inline static uint64_t
bitsize(global_parameters const& /* params */, uint64_t universe, uint64_t n)
{
return (universe == n) ? 0 : uint64_t(-1);
}
//optimal_partition.hpp
// create the required window: one for each power of approx_factor
std::vector<cost_window<ForwardIterator>> windows;
cost_t cost_lb = cost_fun(1, 1); // minimum cost
cost_t cost_bound = cost_lb;
while (eps1 == 0 || cost_bound < cost_lb / eps1) {
windows.emplace_back(begin, cost_bound);
if (cost_bound >= single_block_cost)
break;
cost_bound = cost_bound * (1 + eps2);
}
the cost_fun is this:
static DS2I_FLATTEN_FUNC uint64_t bitsize(global_parameters const& params,
uint64_t universe, uint64_t n) {
uint64_t best_cost = all_ones_sequence::bitsize(params, universe, n);
uint64_t ef_cost =
compact_elias_fano::bitsize(params, universe, n) + type_bits;
if (ef_cost < best_cost) {
best_cost = ef_cost;
}
uint64_t rb_cost =
compact_ranked_bitvector::bitsize(params, universe, n) + type_bits;
if (rb_cost < best_cost) {
best_cost = rb_cost;
}
return best_cost;
}
whereas I misunderstand by the code, i'm glad to know what works here?0 windows?
xuzhouchuan commented
And I see the Java version of this cost_fn returns 128 fixed size(for all ones),the code is not the latest or some other reasons?