summaryrefslogtreecommitdiff
path: root/src/Bottleneck_distance/include/gudhi/Bottleneck.h
diff options
context:
space:
mode:
authorfgodi <fgodi@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-11-29 10:51:43 +0000
committerfgodi <fgodi@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-11-29 10:51:43 +0000
commit6d1bfe69ea473088eb2ca3ede626a2accaa58205 (patch)
treedc183212f260b71345fab4f9aeded26d225e2304 /src/Bottleneck_distance/include/gudhi/Bottleneck.h
parent759b53891e1572df0ea0562828fcd88d8f8f3031 (diff)
better gestion of infinite points
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/bottleneck_integration@1798 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 28cca4bf35541a677fe08d5f0a8b89dfe9017962
Diffstat (limited to 'src/Bottleneck_distance/include/gudhi/Bottleneck.h')
-rw-r--r--src/Bottleneck_distance/include/gudhi/Bottleneck.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/Bottleneck_distance/include/gudhi/Bottleneck.h b/src/Bottleneck_distance/include/gudhi/Bottleneck.h
index 59df655e..20225e80 100644
--- a/src/Bottleneck_distance/include/gudhi/Bottleneck.h
+++ b/src/Bottleneck_distance/include/gudhi/Bottleneck.h
@@ -37,17 +37,19 @@ namespace bottleneck_distance {
template<typename Persistence_diagram1, typename Persistence_diagram2>
double compute(const Persistence_diagram1 &diag1, const Persistence_diagram2 &diag2, double e=0.) {
Persistence_graph g(diag1, diag2, e);
+ if(!g.alive_match())
+ return std::numeric_limits<double>::infinity();
std::vector<double> sd;
if(e == 0.)
sd = g.sorted_distances();
- int idmin = 0;
- int idmax = e==0. ? sd.size() - 1 : g.diameter_bound()/e + 1;
+ long idmin = 0;
+ long idmax = e==0. ? sd.size() - 1 : g.diameter_bound()/e + 1;
// alpha can change the complexity
double alpha = pow(idmax, 0.25);
Graph_matching m(g);
Graph_matching biggest_unperfect(g);
while (idmin != idmax) {
- int step = static_cast<int>((idmax - idmin) / alpha);
+ long step = static_cast<long>((idmax - idmin) / alpha);
m.set_r(e == 0. ? sd.at(idmin + step) : e*(idmin + step));
while (m.multi_augment());
//The above while compute a maximum matching (according to the r setted before)