From c8dbfc68cca3c5462226e5d953f721143fc645f0 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Fri, 16 Dec 2016 14:07:02 +0000 Subject: Fix cpplint and warnings git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@1902 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 24c5aacf579eb1ceb35c680770d5168524c4c84b --- src/Subsampling/example/example_custom_kernel.cpp | 38 +++++++++------------- src/Subsampling/include/gudhi/sparsify_point_set.h | 2 -- 2 files changed, 16 insertions(+), 24 deletions(-) (limited to 'src/Subsampling') diff --git a/src/Subsampling/example/example_custom_kernel.cpp b/src/Subsampling/example/example_custom_kernel.cpp index 05797ebe..f87ef0b3 100644 --- a/src/Subsampling/example/example_custom_kernel.cpp +++ b/src/Subsampling/example/example_custom_kernel.cpp @@ -7,7 +7,7 @@ #include -/* The class Kernel contains a distance function defined on the set of points {0,1,2,3} +/* The class Kernel contains a distance function defined on the set of points {0, 1, 2, 3} * and computes a distance according to the matrix: * 0 1 2 4 * 1 0 4 2 @@ -15,41 +15,35 @@ * 4 2 1 0 */ class Kernel { -public: + public: typedef double FT; typedef unsigned Point_d; // Class Squared_distance_d class Squared_distance_d { - private: + private: std::vector> matrix_; - - public: - Squared_distance_d() - { - matrix_.push_back(std::vector({0,1,2,4})); - matrix_.push_back(std::vector({1,0,4,2})); - matrix_.push_back(std::vector({2,4,0,1})); - matrix_.push_back(std::vector({4,2,1,0})); - } - - FT operator()(Point_d p1, Point_d p2) - { + public: + Squared_distance_d() { + matrix_.push_back(std::vector({0,1,2,4})); + matrix_.push_back(std::vector({1,0,4,2})); + matrix_.push_back(std::vector({2,4,0,1})); + matrix_.push_back(std::vector({4,2,1,0})); + } + + FT operator()(Point_d p1, Point_d p2) { return matrix_[p1][p2]; } }; // Constructor - Kernel() - {} + Kernel() {} // Object of type Squared_distance_d - Squared_distance_d squared_distance_d_object() const - { + Squared_distance_d squared_distance_d_object() const { return Squared_distance_d(); } - }; int main(void) { @@ -57,9 +51,9 @@ int main(void) { typedef typename K::Point_d Point_d; K k; - std::vector points = {0,1,2,3}; + std::vector points = {0, 1, 2, 3}; std::vector results; - + Gudhi::subsampling::choose_n_farthest_points(k, points, 2, std::back_inserter(results)); std::cout << "Before sparsification: " << points.size() << " points.\n"; std::cout << "After sparsification: " << results.size() << " points.\n"; diff --git a/src/Subsampling/include/gudhi/sparsify_point_set.h b/src/Subsampling/include/gudhi/sparsify_point_set.h index 7ff11b4c..507f8c79 100644 --- a/src/Subsampling/include/gudhi/sparsify_point_set.h +++ b/src/Subsampling/include/gudhi/sparsify_point_set.h @@ -64,8 +64,6 @@ sparsify_point_set( typedef typename Gudhi::spatial_searching::Kd_tree_search< Kernel, Point_range> Points_ds; - typename Kernel::Squared_distance_d sqdist = k.squared_distance_d_object(); - #ifdef GUDHI_SUBSAMPLING_PROFILING Gudhi::Clock t; #endif -- cgit v1.2.3