38 template <
typename IndexType,
typename CharType>
44 std::ostream& os,
const IndexChar& ri) {
45 return os <<
'(' << ri.index <<
'|' << ri.c <<
')';
49 template <
typename InputDIA>
54 using ValueType =
typename InputDIA::ValueType;
55 using PairIC = IndexChar<uint8_t, ValueType>;
57 size_t input_size = input_dia.Size();
60 std::vector<uint8_t> length(input_size, 1);
62 return input_dia.Zip(rl,
63 [](
const ValueType& c,
const uint8_t& i) {
64 return PairIC { i, c };
68 auto rl_bwt = input_dia
69 .template FlatWindow<PairIC>(
71 [](size_t,
const std::vector<ValueType>& v,
auto emit) {
74 while (++i < v.size()) {
75 if (v[i - 1] != v[i]) {
76 emit(PairIC {
static_cast<uint8_t
>(i - run_start - 1), v[i - 1] });
80 emit(PairIC {
static_cast<uint8_t
>(i - run_start - 1), v[i - 1] });
85 int main(
int argc,
char* argv[]) {
91 size_t output_result = 0;
94 "Path to input file.");
103 if (input_path.size()) {
104 auto input_dia = ReadBinary<uint8_t>(ctx, input_path);
107 output_dia.Print(
"rl_bwt");
108 sLOG1 <<
"RLE size = " << output_dia.Size();
111 std::string bwt =
"aaaaaaaaaaabbbbaaaaaaaccccdddaacacaffatttttttttttyyyyaaaaa";
114 [&](
size_t i) {
return (uint8_t)bwt[i]; });
117 output_dia.Print(
"rl_bwt");
DIA is the interface between the user and the Thrill framework.
auto Generate(Context &ctx, size_t size, const GenerateFunction &generate_function)
Generate is a Source-DOp, which creates a DIA of given size using a generator function.
auto EqualToDIA(Context &ctx, const std::vector< ValueType > &in_vector)
EqualToDIA is a Source-DOp, which takes a vector of data EQUAL on all workers, and returns the data i...
int Run(const std::function< void(Context &)> &job_startpoint)
Runs the given job startpoint with a Context instance.
void add_opt_param_string(const std::string &name, std::string &dest, const std::string &desc)
add optional string parameter [name] with description and store to dest
int main(int argc, char *argv[])
The Context of a job is a unique instance per worker which holds references to all underlying parts o...
struct IndexChar TLX_ATTRIBUTE_PACKED
std::basic_string< char, std::char_traits< char >, Allocator< char > > string
string with Manager tracking
Command line parser which automatically fills variables and prints nice usage messages.
void add_opt_param_size_t(const std::string &name, size_t &dest, const std::string &desc)
add optional size_t parameter [name] with description and store to dest
void set_author(const std::string &author)
Set author of program, will be wrapped.
const struct DisjointTag DisjointTag
global const DisjointTag instance
bool process(int argc, const char *const *argv, std::ostream &os)
std::ostream & operator<<(std::ostream &os, const DIABase &d)
make ostream-able.
auto ConstructRLBWT(const InputDIA &input_dia)