summaryrefslogtreecommitdiff
path: root/include/gudhi/Persistent_cohomology.h
diff options
context:
space:
mode:
authorGard Spreemann <gspreemann@gmail.com>2017-10-08 11:15:17 +0200
committerGard Spreemann <gspreemann@gmail.com>2017-10-08 11:15:17 +0200
commit866f6ce614e9c09c97fed12c8c0c2c9fb84fad3f (patch)
tree0c90eb9bab09ccc9785cdf2dc59f0ec861670b85 /include/gudhi/Persistent_cohomology.h
parent8d7329f3e5ad843e553c3c5503cecc28ef2eead6 (diff)
GUDHI 2.0.1 as released by upstream in a tarball.upstream/2.0.1
Diffstat (limited to 'include/gudhi/Persistent_cohomology.h')
-rw-r--r--include/gudhi/Persistent_cohomology.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/include/gudhi/Persistent_cohomology.h b/include/gudhi/Persistent_cohomology.h
index 672fda48..e0a147b3 100644
--- a/include/gudhi/Persistent_cohomology.h
+++ b/include/gudhi/Persistent_cohomology.h
@@ -591,10 +591,17 @@ class Persistent_cohomology {
std::ofstream diagram_out(diagram_name.c_str());
cmp_intervals_by_length cmp(cpx_);
std::sort(std::begin(persistent_pairs_), std::end(persistent_pairs_), cmp);
+ bool has_infinity = std::numeric_limits<Filtration_value>::has_infinity;
for (auto pair : persistent_pairs_) {
- diagram_out << cpx_->dimension(get<0>(pair)) << " "
- << cpx_->filtration(get<0>(pair)) << " "
- << cpx_->filtration(get<1>(pair)) << std::endl;
+ // Special case on windows, inf is "1.#INF"
+ if (has_infinity && cpx_->filtration(get<1>(pair)) == std::numeric_limits<Filtration_value>::infinity()) {
+ diagram_out << cpx_->dimension(get<0>(pair)) << " "
+ << cpx_->filtration(get<0>(pair)) << " inf" << std::endl;
+ } else {
+ diagram_out << cpx_->dimension(get<0>(pair)) << " "
+ << cpx_->filtration(get<0>(pair)) << " "
+ << cpx_->filtration(get<1>(pair)) << std::endl;
+ }
}
}