diff --git a/include/sdsl/wm_int.hpp b/include/sdsl/wm_int.hpp index 7dfc816c7..9af4b4df9 100644 --- a/include/sdsl/wm_int.hpp +++ b/include/sdsl/wm_int.hpp @@ -95,8 +95,6 @@ class wm_int uint32_t m_max_level = 0; int_vector<64> m_zero_cnt; // m_zero_cnt[i] contains the number of zeros in level i int_vector<64> m_rank_level; // m_rank_level[i] contains m_tree_rank(i*size()) - mutable int_vector<64> m_path_off; // array keeps track of path offset in select-like methods - mutable int_vector<64> m_path_rank_off;// array keeps track of rank values for the offsets void copy(const wm_int& wt) { m_size = wt.m_size; @@ -111,15 +109,6 @@ class wm_int m_max_level = wt.m_max_level; m_zero_cnt = wt.m_zero_cnt; m_rank_level = wt.m_rank_level; - m_path_off = wt.m_path_off; - m_path_rank_off = wt.m_path_rank_off; - } - - private: - - void init_buffers(uint32_t max_level) { - m_path_off = int_vector<64>(max_level+1); - m_path_rank_off = int_vector<64>(max_level+1); } public: @@ -129,9 +118,7 @@ class wm_int const uint32_t& max_level = m_max_level; //!< Maximal level of the wavelet tree. //! Default constructor - wm_int() { - init_buffers(m_max_level); - }; + wm_int() { }; //! Semi-external constructor /*! \param buf File buffer of the int_vector for which the wm_int should be build. @@ -146,7 +133,6 @@ class wm_int template wm_int(int_vector_buffer& buf, size_type size, uint32_t max_level=0) : m_size(size) { - init_buffers(m_max_level); if (0 == m_size) return; size_type n = buf.size(); // set n @@ -170,7 +156,6 @@ class wm_int } else { m_max_level = max_level; } - init_buffers(m_max_level); std::string tree_out_buf_file_name = tmp_file(buf.filename(), "_m_tree"); @@ -263,8 +248,6 @@ class wm_int m_max_level = std::move(wt.m_max_level); m_zero_cnt = std::move(wt.m_zero_cnt); m_rank_level = std::move(wt.m_rank_level); - m_path_off = std::move(wt.m_path_off); - m_path_rank_off = std::move(wt.m_path_rank_off); } return *this; } @@ -281,8 +264,6 @@ class wm_int std::swap(m_max_level, wt.m_max_level); m_zero_cnt.swap(wt.m_zero_cnt); m_rank_level.swap(wt.m_rank_level); - m_path_off.swap(wt.m_path_off); - m_path_rank_off.swap(wt.m_path_rank_off); } } @@ -395,6 +376,8 @@ class wm_int size_type select(size_type i, value_type c)const { assert(1 <= i and i <= rank(size(), c)); uint64_t mask = 1ULL << (m_max_level-1); + int_vector<64> m_path_off(max_level+1); + int_vector<64> m_path_rank_off(max_level+1); m_path_off[0] = m_path_rank_off[0] = 0; size_type b = 0; // start position of the interval size_type r = i; @@ -544,7 +527,6 @@ class wm_int read_member(m_max_level, in); m_zero_cnt.load(in); m_rank_level.load(in); - init_buffers(m_max_level); } //! Represents a node in the wavelet tree diff --git a/include/sdsl/wt_int.hpp b/include/sdsl/wt_int.hpp index 1d7b4ca66..70fd1d37a 100644 --- a/include/sdsl/wt_int.hpp +++ b/include/sdsl/wt_int.hpp @@ -88,8 +88,6 @@ class wt_int select_1_type m_tree_select1; // select support for the wavelet tree bit vector select_0_type m_tree_select0; uint32_t m_max_level = 0; - mutable int_vector<64> m_path_off; // array keeps track of path offset in select-like methods - mutable int_vector<64> m_path_rank_off;// array keeps track of rank values for the offsets void copy(const wt_int& wt) { m_size = wt.m_size; @@ -102,17 +100,10 @@ class wt_int m_tree_select0 = wt.m_tree_select0; m_tree_select0.set_vector(&m_tree); m_max_level = wt.m_max_level; - m_path_off = wt.m_path_off; - m_path_rank_off = wt.m_path_rank_off; } private: - void init_buffers(uint32_t max_level) { - m_path_off = int_vector<64>(max_level+1); - m_path_rank_off = int_vector<64>(max_level+1); - } - // recursive internal version of the method interval_symbols void _interval_symbols(size_type i, size_type j, size_type& k, std::vector& cs, @@ -162,9 +153,7 @@ class wt_int const uint32_t& max_level = m_max_level; //!< Maximal level of the wavelet tree. //! Default constructor - wt_int() { - init_buffers(m_max_level); - }; + wt_int() { }; //! Semi-external constructor /*! \param buf File buffer of the int_vector for which the wt_int should be build. @@ -179,7 +168,7 @@ class wt_int template wt_int(int_vector_buffer& buf, size_type size, uint32_t max_level=0) : m_size(size) { - init_buffers(m_max_level); + //init_buffers(m_max_level); if (0 == m_size) return; size_type n = buf.size(); // set n @@ -202,7 +191,6 @@ class wt_int } else { m_max_level = max_level; } - init_buffers(m_max_level); // buffer for elements in the right node int_vector_buffer<> buf1(tmp_file(buf.filename(), "_wt_constr_buf"), @@ -298,8 +286,6 @@ class wt_int m_tree_select0 = std::move(wt.m_tree_select0); m_tree_select0.set_vector(&m_tree); m_max_level = std::move(wt.m_max_level); - m_path_off = std::move(wt.m_path_off); - m_path_rank_off = std::move(wt.m_path_rank_off); } return *this; } @@ -314,8 +300,6 @@ class wt_int util::swap_support(m_tree_select1, wt.m_tree_select1, &m_tree, &(wt.m_tree)); util::swap_support(m_tree_select0, wt.m_tree_select0, &m_tree, &(wt.m_tree)); std::swap(m_max_level, wt.m_max_level); - m_path_off.swap(wt.m_path_off); - m_path_rank_off.swap(wt.m_path_rank_off); } } @@ -444,6 +428,8 @@ class wt_int size_type offset = 0; uint64_t mask = (1ULL) << (m_max_level-1); size_type node_size = m_size; + int_vector<64> m_path_off(max_level+1); + int_vector<64> m_path_rank_off(max_level+1); m_path_off[0] = m_path_rank_off[0] = 0; for (uint32_t k=0; k < m_max_level and node_size; ++k) { @@ -727,7 +713,6 @@ class wt_int m_tree_select1.load(in, &m_tree); m_tree_select0.load(in, &m_tree); read_member(m_max_level, in); - init_buffers(m_max_level); } //! Represents a node in the wavelet tree