diff options
author | Gard Spreemann <gspreemann@gmail.com> | 2018-09-09 05:51:46 +0200 |
---|---|---|
committer | Gard Spreemann <gspreemann@gmail.com> | 2018-09-09 05:51:46 +0200 |
commit | 75d365e9df3b9c25f48a475a53188668b5cd2951 (patch) | |
tree | 3906301decc85aeaedf90e140550f5836a6e7fac /include/gudhi/GIC.h | |
parent | 41482b4260b4aff3d6803e340d5c94fbefb9af67 (diff) | |
parent | ef5c01b599c6a6b23b1f3e92736ec67a6e62b55f (diff) |
Merge branch 'upstream/latest' into dfsg/latest
Diffstat (limited to 'include/gudhi/GIC.h')
-rw-r--r-- | include/gudhi/GIC.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/include/gudhi/GIC.h b/include/gudhi/GIC.h index 7aa95210..fea0b861 100644 --- a/include/gudhi/GIC.h +++ b/include/gudhi/GIC.h @@ -1193,8 +1193,8 @@ class Cover_complex { } Cboot.set_graph_from_automatic_rips(Gudhi::Euclidean_distance()); - Cboot.set_automatic_resolution(); Cboot.set_gain(); + Cboot.set_automatic_resolution(); Cboot.set_cover_from_function(); Cboot.find_simplices(); Cboot.compute_PD(); @@ -1215,7 +1215,9 @@ class Cover_complex { */ double compute_distance_from_confidence_level(double alpha) { unsigned int N = distribution.size(); - return distribution[std::floor(alpha * N)]; + double d = distribution[std::floor(alpha * N)]; + if (verbose) std::cout << "Distance corresponding to confidence " << alpha << " is " << d << std::endl; + return d; } public: @@ -1229,6 +1231,7 @@ class Cover_complex { double level = 1; for (unsigned int i = 0; i < N; i++) if (distribution[i] > d){ level = i * 1.0 / N; break; } + if (verbose) std::cout << "Confidence level of distance " << d << " is " << level << std::endl; return level; } @@ -1238,9 +1241,8 @@ class Cover_complex { * */ double compute_p_value() { - double distancemin = -std::numeric_limits<double>::lowest(); - int N = PD.size(); - for (int i = 0; i < N; i++) distancemin = std::min(distancemin, 0.5 * (PD[i].second - PD[i].first)); + double distancemin = std::numeric_limits<double>::max(); int N = PD.size(); + for (int i = 0; i < N; i++) distancemin = std::min(distancemin, 0.5 * std::abs(PD[i].second - PD[i].first)); double p_value = 1 - compute_confidence_level_from_distance(distancemin); if (verbose) std::cout << "p value = " << p_value << std::endl; return p_value; |