-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
38 lines (28 loc) · 1.02 KB
/
main.cpp
File metadata and controls
38 lines (28 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "include/pruning.hpp"
#include "include/utils.hpp"
#include <iostream>
#include <fstream>
using namespace graded_linalg;
using namespace stable_decomposition;
int main(int argc, char** argv) {
auto opts = parse_arguments(argc, argv);
Mat M(opts.input_file);
M.sort_columns_lexicographically();
M.sort_rows_lexicographically();
double delta = get_delta(opts.delta, M);
delta = 0.01;
std::cout << "Computing pruning of " << opts.input_file
<< " (delta=" << delta << ")" << std::endl;
Mat Pru_M = pruning(M, delta);
if (!opts.no_output) {
std::string output_path = generate_output_path(opts.input_file, delta);
std::ofstream output_file(output_path);
if (!output_file.is_open()) {
std::cerr << "Error: Unable to open " << output_path << std::endl;
return 1;
}
Pru_M.to_stream(output_file);
std::cout << "Saved to: " << output_path << std::endl;
}
return 0;
}