implement a converter from aprob to bmap
This commit is contained in:
parent
83ee7f5f1e
commit
4ddd15f34e
@ -1,3 +1,4 @@
|
||||
# ---- main procedural
|
||||
add_executable(dcode_feat common.hh dcode_feat.cc)
|
||||
target_link_libraries(dcode_feat PRIVATE args)
|
||||
|
||||
@ -18,3 +19,8 @@ target_link_libraries(fprob_feat PRIVATE args)
|
||||
|
||||
add_executable(feat_dcode common.hh feat_dcode.cc)
|
||||
target_link_libraries(feat_dcode PRIVATE args)
|
||||
|
||||
|
||||
# ---- procedural of preprocessing
|
||||
add_executable(aprob_bmap common.hh aprob_bmap.cc)
|
||||
target_link_libraries(aprob_bmap PRIVATE args)
|
||||
|
55
conv/aprob_bmap.cc
Normal file
55
conv/aprob_bmap.cc
Normal file
@ -0,0 +1,55 @@
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <args.hxx>
|
||||
|
||||
#include "common.hh"
|
||||
|
||||
|
||||
namespace param {
|
||||
using namespace ::args;
|
||||
|
||||
ArgumentParser parser {
|
||||
"converter: aprob -> bmap"
|
||||
};
|
||||
HelpFlag help {
|
||||
parser, "help", "display this menu", {'h', "help"},
|
||||
};
|
||||
|
||||
ValueFlag<double> min {
|
||||
parser, "0.2", "minimum alter-probability to select", {"min"}, 0.4,
|
||||
};
|
||||
ValueFlag<double> max {
|
||||
parser, "0.6", "maximum alter-probability to select", {"max"}, 0.6,
|
||||
};
|
||||
|
||||
} // namespace param
|
||||
|
||||
|
||||
static void Exec() {
|
||||
const auto aprob = ReadMatrix<double>(std::cin);
|
||||
|
||||
for (auto& probs : aprob) {
|
||||
for (size_t i = 0; i < probs.size(); ++i) {
|
||||
if (args::get(param::min) <= probs[i] && probs[i] <= args::get(param::max)) {
|
||||
std::cout << i << ' ';
|
||||
}
|
||||
}
|
||||
std::cout << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
try {
|
||||
param::parser.ParseCLI(argc, argv);
|
||||
Exec();
|
||||
return EXIT_SUCCESS;
|
||||
} catch (const args::Help&) {
|
||||
std::cout << param::parser << std::endl;
|
||||
return EXIT_SUCCESS;
|
||||
} catch (const std::exception& e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user