pulsatrix 1.1.0
Loading...
Searching...
No Matches
diagram_distance.hpp
Go to the documentation of this file.
1
17#pragma once
18
19#include <numeric>
20#include <string>
21#include <vector>
22
24
25namespace pulsatrix {
26
28struct ErrorTerm {
30 std::string source;
32 double bound = 0;
33};
34
39template <typename T>
40struct Certified {
42 T value{};
44 std::vector<ErrorTerm> terms;
45
47 [[nodiscard]] double bound() const {
48 return std::accumulate(terms.begin(), terms.end(), 0.0,
49 [](double s, const ErrorTerm& t) { return s + t.bound; });
50 }
51};
52
65
76[[nodiscard]] double WassersteinDistance(const PersistenceDiagram& a, const PersistenceDiagram& b, double order = 2);
77
78} // namespace pulsatrix
Definition acquisition_functions.hpp:16
Certified< double > BottleneckDistance(const PersistenceDiagram &a, const PersistenceDiagram &b)
The bottleneck distance between two diagrams of the same dimension.
double WassersteinDistance(const PersistenceDiagram &a, const PersistenceDiagram &b, double order=2)
The q-Wasserstein distance between two diagrams of the same dimension, with the L-infinity norm betwe...
A persistence diagram: the features of one homology dimension, each born at one scale and dying at a ...
A computed value and a certified bound on its error, itemized by source: the exact value is within bo...
Definition diagram_distance.hpp:40
T value
The value as computed.
Definition diagram_distance.hpp:42
double bound() const
The total bound: the sum of the terms.
Definition diagram_distance.hpp:47
std::vector< ErrorTerm > terms
The error sources and what each contributes.
Definition diagram_distance.hpp:44
One source of error in a Certified value.
Definition diagram_distance.hpp:28
std::string source
Where it comes from, such as "first diagram: float32 distances".
Definition diagram_distance.hpp:30
double bound
Its contribution: the value can be off by at most this much because of it.
Definition diagram_distance.hpp:32
The features of one homology dimension: H0 for components, H1 for loops, H2 for voids.
Definition persistence_diagram.hpp:32