8#ifndef INCLUDED_SDSL_K2_TREE_HELPER
9#define INCLUDED_SDSL_K2_TREE_HELPER
30template <
typename t_bv = bit_vector>
38 std::vector<std::deque<t_bv>> & acc)
40 unsigned i, j, b_size = pow(k, 2);
42 bool is_leaf = (l == height);
46 for (i = 0; i < k; i++)
47 for (j = 0; j < k; j++)
48 if (p + i < matrix.size() && q + j < matrix.size() && matrix[p + i][q + j] == 1)
53 for (i = 0; i < k; i++)
54 for (j = 0; j < k; j++)
56 _build_from_matrix(matrix, k, n / k, height, l + 1, p + i * (n / k), q + j * (n / k), acc);
60 for (i = 0; i < b_size; i++)
66 acc[l].push_back(std::move(b));
85 return ((v - r_0) / l) * k + (u - c_0) / l;
88template <
typename t_bv = bit_vector>
int_vector_size_type size_type
int_vector.hpp contains the sdsl::int_vector class.
Namespace for the k2_tree.
uint16_t get_chunk_idx(idx_type v, idx_type u, idx_type c_0, idx_type r_0, size_type l, uint8_t k)
Get the chunk index ([0, k^2[) of a submatrix point.
int _build_from_matrix(std::vector< std::vector< int > > const &matrix, const uint8_t k, int n, int const height, int l, int p, int q, std::vector< std::deque< t_bv > > &acc)
void build_template_vector(bit_vector &k_t_, bit_vector &k_l_, t_bv &k_t, t_bv &k_l)
int_vector ::size_type size_type
void build_template_vector< bit_vector >(bit_vector &k_t_, bit_vector &k_l_, bit_vector &k_t, bit_vector &k_l)
int_vector ::size_type idx_type
Namespace for the succinct data structure library.
int_vector< 1 > bit_vector
bit_vector is a specialization of the int_vector.