summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp30
1 files changed, 28 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 448ae5a..0626db5 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -17,10 +17,12 @@ void print_help(const std::string & invocation)
std::cout << " If the same file name is given twice, the computation will exploit symmetry." << std::endl;
std::cout << " --dimension, -d dim" << std::endl;
std::cout << " Mandatory integer. Degree to read from the persistence diagrams." << std::endl;
- std::cout << " --sigma, -d s" << std::endl;
+ std::cout << " --sigma, -s σ" << std::endl;
std::cout << " Mandatory decimal. σ parameter in heat kernel." << std::endl;
std::cout << " --finitize, -f x" << std::endl;
std::cout << " Optional decimal. Finitize all infinite intervals to scale x. If not given (default), infinite intervals are ignored." << std::endl;
+ std::cout << " --discretize, -t x" << std::endl;
+ std::cout << " Optional decimal. Discretize to and x-by-x grid." << std::endl;
std::cout << " --out, -o file" << std::endl;
std::cout << " Mandatory output file name. Plain text." << std::endl;
std::cout << " --chunk, -c c" << std::endl;
@@ -77,6 +79,7 @@ int main(int argc, char ** argv)
int dim = -1;
double sigma = std::numeric_limits<double>::quiet_NaN();
double finitization = std::numeric_limits<double>::infinity();
+ double discretization = 0;
std::string out_file_name;
int chunk_size = 10;
@@ -114,6 +117,13 @@ int main(int argc, char ** argv)
else
arg_fail(invocation, world_rank, "Missing argument for --finitize.");
}
+ else if (arg == std::string("--discretize") || arg == std::string("-x"))
+ {
+ if (i < argc - 1)
+ discretization = std::atof(argv[++i]);
+ else
+ arg_fail(invocation, world_rank, "Missing argument for --discretize.");
+ }
else if (arg == std::string("--out") || arg == std::string("-o"))
{
if (i < argc - 1)
@@ -151,6 +161,8 @@ int main(int argc, char ** argv)
arg_fail(invocation, world_rank, "σ must be positive.");
if (finitization <= 0)
arg_fail(invocation, world_rank, "Finitization must be positive.");
+ if (discretization < 0)
+ arg_fail(invocation, world_rank, "Discretization must be non-negative.");
if (out_file_name == std::string(""))
arg_fail(invocation, world_rank, "Need output file.");
if (chunk_size <= 0)
@@ -307,7 +319,7 @@ int main(int argc, char ** argv)
j = idxs[k].second;
int load_status = 1;
-
+
if (i != i_prev)
{
pd_1.clear();
@@ -317,6 +329,13 @@ int main(int argc, char ** argv)
fail(world_rank, std::string("Failed to load file ") + files_1[i] + std::string("."));
pd_1.finitize(finitization);
+ if (discretization > 0)
+ {
+ std::cout << pd_1.size_2() << " --> ";
+ pd_1.discretize(discretization);
+ pd_1.compress_and_sort();
+ std::cout << pd_1.size_2() << std::endl;
+ }
}
if (j != j_prev)
@@ -328,6 +347,13 @@ int main(int argc, char ** argv)
fail(world_rank, std::string("Failed to load file ") + files_2[j] + std::string("."));
pd_2.finitize(finitization);
+ if (discretization > 0)
+ {
+ std::cout << pd_2.size_2() << " --> ";
+ pd_2.discretize(discretization);
+ pd_2.compress_and_sort();
+ std::cout << pd_2.size_2() << std::endl;
+ }
}
result[k - work[0]] = heat_kernel<double>(sigma, pd_1, pd_2);