Loading...
Searching...
No Matches
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 * - 2025/06 Hannah Schreiber: Various small bug fixes (missing `inline`s, `DEBUG_TRACES`s etc.)
9 * - YYYY/MM Author: Description of the modification
10 */
11
12#ifndef PERSISTENCE_INTERVALS_WITH_DISTANCES_H_
13#define PERSISTENCE_INTERVALS_WITH_DISTANCES_H_
14
15#ifdef DEBUG_TRACES
16#include <iostream> // std::cerr
17#endif
18#include <limits> // std::numeric_limits
19#include <stdexcept> // std::logic_error
20
21#include <gudhi/Persistence_intervals.h>
22#include <gudhi/Bottleneck.h>
23#include <gudhi/Debug_utils.h>
24
25namespace Gudhi {
26namespace Persistence_representations {
27
28// TODO: it would have been better to have this file in a subfolder "Persistence_representations"
29// to avoid including it with "<gudhi/Persistence_intervals_with_distances.h>" which makes it sound universal within
30// gudhi even though it is only used in this format within this module.
31// How critical would it be for retro-compatibility to change that? It does not seem to appear in the documentation.
32
42{
43 public:
45 using Base = Persistence_intervals;
46
58 double power = std::numeric_limits<double>::max(),
59 double tolerance = (std::numeric_limits<double>::min)()) const
60 {
61 if (power >= std::numeric_limits<double>::max()) {
62 return Gudhi::persistence_diagram::bottleneck_distance(Base::intervals_, second.intervals_, tolerance);
63 } else {
64#ifdef DEBUG_TRACES
65 std::cerr << "At the moment Gudhi do not support Wasserstein distances. We only support Bottleneck distance."
66 << std::endl;
67#endif
68 throw std::logic_error(
69 "At the moment Gudhi do not support Wasserstein distances. We only support Bottleneck distance.");
70 }
71 }
72};
73
74} // namespace Persistence_representations
75} // namespace Gudhi
76
77#endif // PERSISTENCE_INTERVALS_WITH_DISTANCES_H_
This class implements the following concepts: Vectorized_topological_data, Topological_data_with_dist...
Definition Persistence_intervals_with_distances.h:42
double distance(const Persistence_intervals_with_distances &second, double power=std::numeric_limits< double >::max(), double tolerance=(std::numeric_limits< double >::min)()) const
Computes the distance to the persistence diagram given as a parameter.
Definition Persistence_intervals_with_distances.h:57
Persistence_intervals(const char *filename, unsigned int dimension=std::numeric_limits< unsigned int >::max())
Constructor from a text file.
Definition Persistence_intervals.h:64
Persistence_intervals(const char *filename, unsigned int dimension=std::numeric_limits< unsigned int >::max())
Constructor from a text file.
Definition Persistence_intervals.h:64
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
Gudhi namespace.
Definition SimplicialComplexForAlpha.h:14