pulsatrix 1.1.0
Loading...
Searching...
No Matches
distance_matrix.hpp File Reference

Pairwise Euclidean distances of a point cloud, computed with one GEMM on any backend, with a certified bound on their floating-point error. More...

#include <cstddef>
#include <cstdint>
#include <vector>
#include "pulsatrix/tda/point_cloud.hpp"
#include "pulsatrix/tensor.hpp"
Include dependency graph for distance_matrix.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  pulsatrix::DistanceOptions
 PairwiseDistances()'s settings. More...
 
struct  pulsatrix::DistanceMatrix
 The distances between every pair of n points, condensed. More...
 

Namespaces

namespace  pulsatrix
 

Enumerations

enum class  pulsatrix::DistanceMethod { pulsatrix::Gemm , pulsatrix::Exact }
 How PairwiseDistances() computes the distances. More...
 

Functions

DistanceMatrix pulsatrix::PairwiseDistances (const Tensor &points, const DistanceOptions &options={})
 Euclidean distances between every pair of rows.
 
DistanceMatrix pulsatrix::PairwiseDistances (const PointCloud &cloud, DeviceBackend *backend, const DistanceOptions &options={})
 Euclidean distances between every pair of a cloud's points, on the given backend.
 

Detailed Description

Pairwise Euclidean distances of a point cloud, computed with one GEMM on any backend, with a certified bound on their floating-point error.

Distances are the only stage of persistent homology that touches the points' dimension, so they run as a matrix product on the device: |x - y|^2 = |x|^2 + |y|^2 - 2 x.y. In float32 that formula cancels badly for points close together (the research notes' warning for TDA-2), so the result carries an error bound instead of hiding it. Stability (Cohen-Steiner, Edelsbrunner and Harer, 2007) turns the bound into one on everything computed later: a persistence diagram built from these distances is within error_bound, in bottleneck distance, of the exact one.