summaryrefslogtreecommitdiff
path: root/src/Subsampling
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-12-16 14:07:02 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-12-16 14:07:02 +0000
commitc8dbfc68cca3c5462226e5d953f721143fc645f0 (patch)
treee80159fd3f967ac26540a95c0d4552bebfada0a1 /src/Subsampling
parent251d5726f17275b0af8333440b21476751925e1b (diff)
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
Diffstat (limited to 'src/Subsampling')
-rw-r--r--src/Subsampling/example/example_custom_kernel.cpp38
-rw-r--r--src/Subsampling/include/gudhi/sparsify_point_set.h2
2 files changed, 16 insertions, 24 deletions
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 <iterator>
-/* 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<std::vector<FT>> matrix_;
-
- public:
- Squared_distance_d()
- {
- matrix_.push_back(std::vector<FT>({0,1,2,4}));
- matrix_.push_back(std::vector<FT>({1,0,4,2}));
- matrix_.push_back(std::vector<FT>({2,4,0,1}));
- matrix_.push_back(std::vector<FT>({4,2,1,0}));
- }
-
- FT operator()(Point_d p1, Point_d p2)
- {
+ public:
+ Squared_distance_d() {
+ matrix_.push_back(std::vector<FT>({0,1,2,4}));
+ matrix_.push_back(std::vector<FT>({1,0,4,2}));
+ matrix_.push_back(std::vector<FT>({2,4,0,1}));
+ matrix_.push_back(std::vector<FT>({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<Point_d> points = {0,1,2,3};
+ std::vector<Point_d> points = {0, 1, 2, 3};
std::vector<Point_d> 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