summaryrefslogtreecommitdiff
path: root/src/Rips_complex/include/gudhi/Sparse_rips_complex.h
diff options
context:
space:
mode:
authorMarc Glisse <marc.glisse@inria.fr>2020-12-10 23:36:58 +0100
committerGitHub <noreply@github.com>2020-12-10 23:36:58 +0100
commit10794c300e349fef918b9b8e91d4c2aee7a01890 (patch)
tree1ccbbaa9b31c98d4921f2745eb88ae45f9d43aef /src/Rips_complex/include/gudhi/Sparse_rips_complex.h
parentd1b7c8fd3e66c19203967d559582af713417aeca (diff)
parenta2783dd8db753a407cfad329d03e2a56b2095f3d (diff)
Merge pull request #409 from mglisse/fardist
Pass a distance function instead of a kernel to choose_n_farthest_points
Diffstat (limited to 'src/Rips_complex/include/gudhi/Sparse_rips_complex.h')
-rw-r--r--src/Rips_complex/include/gudhi/Sparse_rips_complex.h14
1 files changed, 1 insertions, 13 deletions
diff --git a/src/Rips_complex/include/gudhi/Sparse_rips_complex.h b/src/Rips_complex/include/gudhi/Sparse_rips_complex.h
index 1b250818..a5501004 100644
--- a/src/Rips_complex/include/gudhi/Sparse_rips_complex.h
+++ b/src/Rips_complex/include/gudhi/Sparse_rips_complex.h
@@ -67,8 +67,7 @@ class Sparse_rips_complex {
: epsilon_(epsilon) {
GUDHI_CHECK(epsilon > 0, "epsilon must be positive");
auto dist_fun = [&](Vertex_handle i, Vertex_handle j) { return distance(points[i], points[j]); };
- Ker<decltype(dist_fun)> kernel(dist_fun);
- subsampling::choose_n_farthest_points(kernel, boost::irange<Vertex_handle>(0, boost::size(points)), -1, -1,
+ subsampling::choose_n_farthest_points(dist_fun, boost::irange<Vertex_handle>(0, boost::size(points)), -1, -1,
std::back_inserter(sorted_points), std::back_inserter(params));
compute_sparse_graph(dist_fun, epsilon, mini, maxi);
}
@@ -128,17 +127,6 @@ class Sparse_rips_complex {
}
private:
- // choose_n_farthest_points wants the distance function in this form...
- template <class Distance>
- struct Ker {
- typedef std::size_t Point_d; // index into point range
- Ker(Distance& d) : dist(d) {}
- // Despite the name, this is not squared...
- typedef Distance Squared_distance_d;
- Squared_distance_d& squared_distance_d_object() const { return dist; }
- Distance& dist;
- };
-
// PointRange must be random access.
template <typename Distance>
void compute_sparse_graph(Distance& dist, double epsilon, Filtration_value mini, Filtration_value maxi) {