summaryrefslogtreecommitdiff
path: root/example/Subsampling
diff options
context:
space:
mode:
Diffstat (limited to 'example/Subsampling')
-rw-r--r--example/Subsampling/CMakeLists.txt22
-rw-r--r--example/Subsampling/example_choose_n_farthest_points.cpp29
-rw-r--r--example/Subsampling/example_custom_kernel.cpp65
-rw-r--r--example/Subsampling/example_pick_n_random_points.cpp27
-rw-r--r--example/Subsampling/example_sparsify_point_set.cpp27
5 files changed, 0 insertions, 170 deletions
diff --git a/example/Subsampling/CMakeLists.txt b/example/Subsampling/CMakeLists.txt
deleted file mode 100644
index f26d107f..00000000
--- a/example/Subsampling/CMakeLists.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-project(Subsampling_examples)
-
-if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1)
- add_executable(Subsampling_example_pick_n_random_points example_pick_n_random_points.cpp)
- add_executable(Subsampling_example_choose_n_farthest_points example_choose_n_farthest_points.cpp)
- add_executable(Subsampling_example_custom_kernel example_custom_kernel.cpp)
- add_executable(Subsampling_example_sparsify_point_set example_sparsify_point_set.cpp)
- target_link_libraries(Subsampling_example_sparsify_point_set ${CGAL_LIBRARY})
-
- add_test(NAME Subsampling_example_pick_n_random_points
- COMMAND $<TARGET_FILE:Subsampling_example_pick_n_random_points>)
- add_test(NAME Subsampling_example_choose_n_farthest_points
- COMMAND $<TARGET_FILE:Subsampling_example_choose_n_farthest_points>)
- add_test(NAME Subsampling_example_sparsify_point_set
- COMMAND $<TARGET_FILE:Subsampling_example_sparsify_point_set>)
-
- install(TARGETS Subsampling_example_pick_n_random_points DESTINATION bin)
- install(TARGETS Subsampling_example_choose_n_farthest_points DESTINATION bin)
- install(TARGETS Subsampling_example_custom_kernel DESTINATION bin)
- install(TARGETS Subsampling_example_sparsify_point_set DESTINATION bin)
-
-endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1)
diff --git a/example/Subsampling/example_choose_n_farthest_points.cpp b/example/Subsampling/example_choose_n_farthest_points.cpp
deleted file mode 100644
index ebf631fc..00000000
--- a/example/Subsampling/example_choose_n_farthest_points.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-#include <gudhi/choose_n_farthest_points.h>
-
-#include <CGAL/Epick_d.h>
-#include <CGAL/Random.h>
-
-#include <vector>
-#include <iterator>
-
-int main(void) {
- typedef CGAL::Epick_d<CGAL::Dimension_tag<4> > K;
- typedef typename K::Point_d Point_d;
-
- CGAL::Random rd;
-
- std::vector<Point_d> points;
- for (int i = 0; i < 500; ++i)
- points.push_back(Point_d(rd.get_double(-1., 1), rd.get_double(-1., 1),
- rd.get_double(-1., 1), rd.get_double(-1., 1)));
-
- K k;
- std::vector<Point_d> results;
- Gudhi::subsampling::choose_n_farthest_points(k, points, 100,
- Gudhi::subsampling::random_starting_point,
- std::back_inserter(results));
- std::cout << "Before sparsification: " << points.size() << " points.\n";
- std::cout << "After sparsification: " << results.size() << " points.\n";
-
- return 0;
-}
diff --git a/example/Subsampling/example_custom_kernel.cpp b/example/Subsampling/example_custom_kernel.cpp
deleted file mode 100644
index 2d42bdde..00000000
--- a/example/Subsampling/example_custom_kernel.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-#include <gudhi/choose_n_farthest_points.h>
-
-#include <CGAL/Epick_d.h>
-#include <CGAL/Random.h>
-
-#include <vector>
-#include <iterator>
-
-
-/* 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
- * 2 4 0 1
- * 4 2 1 0
- */
-class Kernel {
- public:
- typedef double FT;
- typedef unsigned Point_d;
-
- // Class Squared_distance_d
- class Squared_distance_d {
- 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) {
- return matrix_[p1][p2];
- }
- };
-
- // Constructor
- Kernel() {}
-
- // Object of type Squared_distance_d
- Squared_distance_d squared_distance_d_object() const {
- return Squared_distance_d();
- }
-};
-
-int main(void) {
- typedef Kernel K;
- typedef typename K::Point_d Point_d;
-
- K k;
- std::vector<Point_d> points = {0, 1, 2, 3};
- std::vector<Point_d> results;
-
- Gudhi::subsampling::choose_n_farthest_points(k, points, 2,
- Gudhi::subsampling::random_starting_point,
- std::back_inserter(results));
- std::cout << "Before sparsification: " << points.size() << " points.\n";
- std::cout << "After sparsification: " << results.size() << " points.\n";
- std::cout << "Result table: {" << results[0] << "," << results[1] << "}\n";
-
- return 0;
-}
diff --git a/example/Subsampling/example_pick_n_random_points.cpp b/example/Subsampling/example_pick_n_random_points.cpp
deleted file mode 100644
index 1e38e405..00000000
--- a/example/Subsampling/example_pick_n_random_points.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-#include <gudhi/pick_n_random_points.h>
-
-#include <CGAL/Epick_d.h>
-#include <CGAL/Random.h>
-
-#include <vector>
-#include <iterator>
-
-int main(void) {
- typedef CGAL::Epick_d<CGAL::Dimension_tag<4> > K;
- typedef typename K::Point_d Point_d;
-
- CGAL::Random rd;
-
- std::vector<Point_d> points;
- for (int i = 0; i < 500; ++i)
- points.push_back(Point_d(rd.get_double(-1., 1), rd.get_double(-1., 1),
- rd.get_double(-1., 1), rd.get_double(-1., 1)));
-
- K k;
- std::vector<Point_d> results;
- Gudhi::subsampling::pick_n_random_points(points, 100, std::back_inserter(results));
- std::cout << "Before sparsification: " << points.size() << " points.\n";
- std::cout << "After sparsification: " << results.size() << " points.\n";
-
- return 0;
-}
diff --git a/example/Subsampling/example_sparsify_point_set.cpp b/example/Subsampling/example_sparsify_point_set.cpp
deleted file mode 100644
index b35a18d9..00000000
--- a/example/Subsampling/example_sparsify_point_set.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-#include <gudhi/sparsify_point_set.h>
-
-#include <CGAL/Epick_d.h>
-#include <CGAL/Random.h>
-
-#include <vector>
-#include <iterator>
-
-int main(void) {
- typedef CGAL::Epick_d<CGAL::Dimension_tag<4> > K;
- typedef typename K::Point_d Point_d;
-
- CGAL::Random rd;
-
- std::vector<Point_d> points;
- for (int i = 0; i < 500; ++i)
- points.push_back(Point_d(rd.get_double(-1., 1), rd.get_double(-1., 1),
- rd.get_double(-1., 1), rd.get_double(-1., 1)));
-
- K k;
- std::vector<Point_d> results;
- Gudhi::subsampling::sparsify_point_set(k, points, 0.4, std::back_inserter(results));
- std::cout << "Before sparsification: " << points.size() << " points.\n";
- std::cout << "After sparsification: " << results.size() << " points.\n";
-
- return 0;
-}