diff options
author | Arnur Nigmetov <nigmetov@tugraz.at> | 2020-02-19 15:25:33 +0100 |
---|---|---|
committer | Arnur Nigmetov <nigmetov@tugraz.at> | 2020-02-19 15:29:44 +0100 |
commit | be93a006a3f2c630abf9d0169a70e6292ac7504f (patch) | |
tree | 57ead4dd37953dc69aadd7e847f9997a72347013 | |
parent | dfb161cb17a546329921ce27e1d9c4fa93e2a506 (diff) |
Fix BifiltrationProxy bug; disable debug output.
1. Same bifiltration was used in constructing
two bifiltration proxies; the second bifiltration
was ignored. Fixed.
2. Switched from spd::info to spd::debug in most places.
3. Get rid of absolute paths for test bifiltrations.
-rw-r--r-- | matching/include/matching_distance.h | 3 | ||||
-rw-r--r-- | matching/include/matching_distance.hpp | 13 | ||||
-rw-r--r-- | matching/src/matching_distance.cpp | 2 | ||||
-rw-r--r-- | matching/src/tests/prism_1.bif (renamed from matching/src/tests/prism_1_lesnick.bif) | 0 | ||||
-rw-r--r-- | matching/src/tests/prism_2.bif (renamed from matching/src/tests/prism_2_lesnick.bif) | 0 | ||||
-rw-r--r-- | matching/src/tests/test_matching_distance.cpp | 8 |
6 files changed, 14 insertions, 12 deletions
diff --git a/matching/include/matching_distance.h b/matching/include/matching_distance.h index bb1dfea..bb10203 100644 --- a/matching/include/matching_distance.h +++ b/matching/include/matching_distance.h @@ -72,6 +72,9 @@ namespace md { // (we just return something large enough to prune the cell) bool stop_asap { true }; + // print statistics on each quad-tree level + bool print_stats { false }; + #ifdef PRINT_HEAT_MAP HeatMaps heat_maps; #endif diff --git a/matching/include/matching_distance.hpp b/matching/include/matching_distance.hpp index 218f33b..d2d2fbc 100644 --- a/matching/include/matching_distance.hpp +++ b/matching/include/matching_distance.hpp @@ -209,7 +209,7 @@ namespace md { assert(std::min({module_a_.min_x(), module_b_.min_x(), module_a_.min_y(), module_b_.min_y()}) >= 0); - spd::info("DistanceCalculator constructed, module_a: max_x = {}, max_y = {}, module_b: max_x = {}, max_y = {}", + spd::debug("DistanceCalculator constructed, module_a: max_x = {}, max_y = {}, module_b: max_x = {}, max_y = {}", module_a_.max_x(), module_a_.max_y(), module_b_.max_x(), module_b_.max_y()); } @@ -514,7 +514,7 @@ namespace md { std::map<int, long> n_cells_discarded; std::map<int, long> n_cells_pruned; - spd::info("Enter get_distance_pq, bound strategy = {}, traverse strategy = {}, stop_asap = {} ", + spd::debug("Enter get_distance_pq, bound strategy = {}, traverse strategy = {}, stop_asap = {} ", params_.bound_strategy, params_.traverse_strategy, params_.stop_asap); std::chrono::high_resolution_clock timer; @@ -748,16 +748,15 @@ namespace md { // otherwise actual_error in params can be larger than delta, // but this is OK - spd::info("#############################################################"); - spd::info( + spd::debug("#############################################################"); + spd::debug( "Exiting get_distance_pq, bound_strategy = {}, traverse_strategy = {}, lower_bound = {}, upper_bound = {}, current_error = {}, actual_max_level = {}", params_.bound_strategy, params_.traverse_strategy, lower_bound, upper_bound, params_.actual_error, params_.actual_max_depth); - spd::info("#############################################################"); + spd::debug("#############################################################"); - bool print_stats = true; - if (print_stats) { + if (params_.print_stats) { fmt::print("EXIT STATS, cells considered:\n"); print_map(n_cells_considered); fmt::print("EXIT STATS, cells discarded:\n"); diff --git a/matching/src/matching_distance.cpp b/matching/src/matching_distance.cpp index daaff5f..e53233f 100644 --- a/matching/src/matching_distance.cpp +++ b/matching/src/matching_distance.cpp @@ -15,7 +15,7 @@ namespace md { // compute distance only in one dimension if (params.dim != CalculationParams::ALL_DIMENSIONS) { BifiltrationProxy bifp_a(bif_a, params.dim); - BifiltrationProxy bifp_b(bif_a, params.dim); + BifiltrationProxy bifp_b(bif_b, params.dim); DistanceCalculator<BifiltrationProxy> runner(bifp_a, bifp_b, params); result = runner.distance(); params.n_hera_calls = runner.get_hera_calls_number(); diff --git a/matching/src/tests/prism_1_lesnick.bif b/matching/src/tests/prism_1.bif index 416c40c..416c40c 100644 --- a/matching/src/tests/prism_1_lesnick.bif +++ b/matching/src/tests/prism_1.bif diff --git a/matching/src/tests/prism_2_lesnick.bif b/matching/src/tests/prism_2.bif index e11faa9..e11faa9 100644 --- a/matching/src/tests/prism_2_lesnick.bif +++ b/matching/src/tests/prism_2.bif diff --git a/matching/src/tests/test_matching_distance.cpp b/matching/src/tests/test_matching_distance.cpp index 90baa0f..7cd71b2 100644 --- a/matching/src/tests/test_matching_distance.cpp +++ b/matching/src/tests/test_matching_distance.cpp @@ -112,8 +112,8 @@ TEST_CASE("Bifiltrations from file", "[matching_distance][small_example][lesnick { std::string fname_a, fname_b; - fname_a = "/home/narn/code/matching_distance/code/python_scripts/prism_1_lesnick.bif"; - fname_b = "/home/narn/code/matching_distance/code/python_scripts/prism_2_lesnick.bif"; + fname_a = "../src/tests/prism_1.bif"; + fname_b = "../src/tests/prism_2.bif"; Bifiltration bif_a(fname_a, BifiltrationFormat::phat_like); Bifiltration bif_b(fname_b, BifiltrationFormat::phat_like); @@ -137,11 +137,11 @@ TEST_CASE("Bifiltrations from file", "[matching_distance][small_example][lesnick params.bound_strategy = bs; params.traverse_strategy = ts; params.max_depth = 7; - params.delta = 0.01; + params.delta = 0.1; params.dim = 1; Real answer = matching_distance(bif_a_copy, bif_b_copy, params); Real correct_answer = lambda * 1.0; - REQUIRE(fabs(answer - correct_answer) < lambda * 0.05); + REQUIRE(fabs(answer - correct_answer) / correct_answer < params.delta); } } } |