13 #ifndef THRILL_EXAMPLES_SUFFIX_SORTING_CONSTRUCT_WT_HEADER 14 #define THRILL_EXAMPLES_SUFFIX_SORTING_CONSTRUCT_WT_HEADER 32 namespace suffix_sorting {
34 template <
typename InputDIA>
36 const InputDIA& input_dia,
const std::string& output_path) {
37 static constexpr
bool debug =
false;
41 uint64_t max_value = input_dia.Keep().Max();
42 sLOG <<
"max_value" << max_value;
45 uint64_t mask = (~uint64_t(0)) << level;
46 uint64_t maskbit = uint64_t(1) << level;
51 while (mask != (~uint64_t(0))) {
54 mask = (mask >> 1) | 0x8000000000000000llu;
57 sLOG <<
"maskbit" << maskbit <<
"mask" << std::hex << mask;
61 [maskbit](
size_t,
const std::vector<uint8_t>& v) {
63 for (
size_t i = 0; i < v.size(); ++i) {
65 x |= uint64_t(1) << i;
74 [mask](
const uint8_t& a,
const uint8_t& b) {
75 return (a & mask) < (b & mask);
78 if (debug) wt.
Print(
"wt");
85 #endif // !THRILL_EXAMPLES_SUFFIX_SORTING_CONSTRUCT_WT_HEADER
#define sLOG
Default logging method: output if the local debug variable is true.
DIA is the interface between the user and the Thrill framework.
void Print(const std::string &name=std::string()) const
Print is an Action, which collects all data of the DIA at the worker 0 and prints using ostream seria...
auto Window(size_t window_size, const WindowFunction &window_function=WindowFunction()) const
Window is a DOp, which applies a window function to every k consecutive items in a DIA...
std::string ssprintf(const char *fmt,...)
Helper for return the result of a sprintf() call inside a std::string.
std::basic_string< char, std::char_traits< char >, Allocator< char > > string
string with Manager tracking
auto Sort(const CompareFunction &compare_function=CompareFunction()) const
Sort is a DOp, which sorts a given DIA according to the given compare_function.
static constexpr bool debug
auto ConstructWaveletTree(const InputDIA &input_dia, const std::string &output_path)
static unsigned integer_log2_ceil(int i)
calculate the log2 floor of an integer type
tag structure for Window() and FlatWindow()
const DIA & Keep(size_t increase=1) const
Mark the referenced DIANode for keeping, which makes children not consume the data when executing...
DIA< ValueType > Collapse() const
Create a CollapseNode which is mainly used to collapse the LOp chain into a DIA<T> with an empty stac...