Persistence_intervals_with_distances.h
1/* This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT.
2 * See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details.
3 * Author(s): Pawel Dlotko
4 *
5 * Copyright (C) 2016 Inria
6 *
7 * Modification(s):
8 * - YYYY/MM Author: Description of the modification
9 */
10
11#ifndef PERSISTENCE_INTERVALS_WITH_DISTANCES_H_
12#define PERSISTENCE_INTERVALS_WITH_DISTANCES_H_
13
14#include <gudhi/Persistence_intervals.h>
15#include <gudhi/Bottleneck.h>
16
17#include <limits>
18
19namespace Gudhi {
20namespace Persistence_representations {
21
22class Persistence_intervals_with_distances : public Persistence_intervals {
23 public:
25
36 double distance(const Persistence_intervals_with_distances& second, double power = std::numeric_limits<double>::max(),
37 double tolerance = (std::numeric_limits<double>::min)()) const {
38 if (power >= std::numeric_limits<double>::max()) {
39 return Gudhi::persistence_diagram::bottleneck_distance(this->intervals, second.intervals, tolerance);
40 } else {
41 std::cerr << "At the moment Gudhi do not support Wasserstein distances. We only support Bottleneck distance."
42 << std::endl;
43 throw "At the moment Gudhi do not support Wasserstein distances. We only support Bottleneck distance.";
44 }
45 }
46};
47
48} // namespace Persistence_representations
49} // namespace Gudhi
50
51#endif // PERSISTENCE_INTERVALS_WITH_DISTANCES_H_
Definition: Persistence_intervals.h:37
Persistence_intervals(const char *filename, unsigned dimension=std::numeric_limits< unsigned >::max())
Definition: Persistence_intervals.h:252
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:116