Persistence_intervals_with_distances.h
1 /* This file is part of the Gudhi hiLibrary. The Gudhi library
2  * (Geometric Understanding in Higher Dimensions) is a generic C++
3  * library for computational topology.
4  *
5  * Author(s): Pawel Dlotko
6  *
7  * Copyright (C) 2016 Inria
8  *
9  * This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <http://www.gnu.org/licenses/>.
21  */
22 
23 #ifndef PERSISTENCE_INTERVALS_WITH_DISTANCES_H_
24 #define PERSISTENCE_INTERVALS_WITH_DISTANCES_H_
25 
26 #include <gudhi/Persistence_intervals.h>
27 #include <gudhi/Bottleneck.h>
28 
29 #include <limits>
30 
31 namespace Gudhi {
32 namespace Persistence_representations {
33 
34 class Persistence_intervals_with_distances : public Persistence_intervals {
35  public:
37 
48  double distance(const Persistence_intervals_with_distances& second, double power = std::numeric_limits<double>::max(),
49  double tolerance = (std::numeric_limits<double>::min)()) const {
50  if (power >= std::numeric_limits<double>::max()) {
51  return Gudhi::persistence_diagram::bottleneck_distance(this->intervals, second.intervals, tolerance);
52  } else {
53  std::cerr << "At the moment Gudhi do not support Wasserstein distances. We only support Bottleneck distance."
54  << std::endl;
55  throw "At the moment Gudhi do not support Wasserstein distances. We only support Bottleneck distance.";
56  }
57  }
58 };
59 
60 } // namespace Persistence_representations
61 } // namespace Gudhi
62 
63 #endif // PERSISTENCE_INTERVALS_WITH_DISTANCES_H_
Definition: SimplicialComplexForAlpha.h:26
Persistence_intervals(const char *filename, unsigned dimension=std::numeric_limits< unsigned >::max())
Definition: Persistence_intervals.h:262
Definition: Persistence_intervals.h:47
double bottleneck_distance(const Persistence_diagram1 &diag1, const Persistence_diagram2 &diag2, double e=(std::numeric_limits< double >::min)())
Function to compute the Bottleneck distance between two persistence diagrams.
Definition: Bottleneck.h:111
GUDHI  Version 2.2.0  - C++ library for Topological Data Analysis (TDA) and Higher Dimensional Geometry Understanding.  - Copyright : GPL v3 Generated on Fri Jun 22 2018 08:12:19 for GUDHI by Doxygen 1.8.13