From 8e78adfc0f09f128a541cb96dad7a547dd6a9d0c Mon Sep 17 00:00:00 2001 From: cjamin Date: Fri, 24 Jun 2016 12:23:40 +0000 Subject: Add an example git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/subsampling_and_spatialsearching@1334 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: df8ee96b7cbfcc4380e49956b2495ec8bf12895e --- src/Subsampling/example/CMakeLists.txt | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/Subsampling/example/CMakeLists.txt (limited to 'src/Subsampling/example/CMakeLists.txt') diff --git a/src/Subsampling/example/CMakeLists.txt b/src/Subsampling/example/CMakeLists.txt new file mode 100644 index 00000000..e7a8a9f7 --- /dev/null +++ b/src/Subsampling/example/CMakeLists.txt @@ -0,0 +1,29 @@ +cmake_minimum_required(VERSION 2.6) +project(Subsampling_examples) + +if(CGAL_FOUND) + if (NOT CGAL_VERSION VERSION_LESS 4.8.0) + message(STATUS "CGAL version: ${CGAL_VERSION}.") + + find_package(Eigen3 3.1.0) + if (EIGEN3_FOUND) + message(STATUS "Eigen3 version: ${EIGEN3_VERSION}.") + include( ${EIGEN3_USE_FILE} ) + include_directories (BEFORE "../../include") + + #add_executable( Subsampling_example_pick_random_points example_pick_random_points.cpp ) + + #add_executable( Subsampling_example_choose_farthest_point example_choose_farthest_point.cpp ) + #target_link_libraries(Subsampling_example_choose_farthest_point ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) + + add_executable(Subsampling_example_sparsify_point_set example_sparsify_point_set.cpp) + target_link_libraries(Subsampling_example_sparsify_point_set ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) + else() + message(WARNING "Eigen3 not found. Version 3.1.0 is required for Subsampling feature.") + endif() + else() + message(WARNING "CGAL version: ${CGAL_VERSION} is too old to compile Subsampling examples. Version 4.8.0 is required.") + endif () +else() + message(WARNING "CGAL not found. It is required for the Subsampling examples.") +endif() -- cgit v1.2.3 From 7928209595af6f7559fde36fa06c031cd47e7179 Mon Sep 17 00:00:00 2001 From: skachano Date: Fri, 24 Jun 2016 13:42:39 +0000 Subject: Copied Clément's example for 2 functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/subsampling_and_spatialsearching@1338 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 42f29038057980965bfead2c73cbc013448493fb --- src/Subsampling/example/CMakeLists.txt | 4 +- .../example/example_choose_by_farthest_point.cpp | 52 +++++++++ .../example/example_pick_random_points.cpp | 52 +++++++++ .../include/gudhi/choose_by_farthest_point.h | 119 +++++++++++++++++++-- .../test/test_choose_farthest_point.cpp | 65 ++++++++--- 5 files changed, 266 insertions(+), 26 deletions(-) create mode 100644 src/Subsampling/example/example_choose_by_farthest_point.cpp create mode 100644 src/Subsampling/example/example_pick_random_points.cpp (limited to 'src/Subsampling/example/CMakeLists.txt') diff --git a/src/Subsampling/example/CMakeLists.txt b/src/Subsampling/example/CMakeLists.txt index e7a8a9f7..e1e7cc71 100644 --- a/src/Subsampling/example/CMakeLists.txt +++ b/src/Subsampling/example/CMakeLists.txt @@ -11,9 +11,9 @@ if(CGAL_FOUND) include( ${EIGEN3_USE_FILE} ) include_directories (BEFORE "../../include") - #add_executable( Subsampling_example_pick_random_points example_pick_random_points.cpp ) + add_executable( Subsampling_example_pick_random_points example_pick_random_points.cpp ) - #add_executable( Subsampling_example_choose_farthest_point example_choose_farthest_point.cpp ) + add_executable( Subsampling_example_choose_by_farthest_point example_choose_by_farthest_point.cpp ) #target_link_libraries(Subsampling_example_choose_farthest_point ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) add_executable(Subsampling_example_sparsify_point_set example_sparsify_point_set.cpp) diff --git a/src/Subsampling/example/example_choose_by_farthest_point.cpp b/src/Subsampling/example/example_choose_by_farthest_point.cpp new file mode 100644 index 00000000..5b81bc9d --- /dev/null +++ b/src/Subsampling/example/example_choose_by_farthest_point.cpp @@ -0,0 +1,52 @@ +/* This file is part of the Gudhi Library. The Gudhi library + * (Geometric Understanding in Higher Dimensions) is a generic C++ + * library for computational topology. + * + * Author(s): Siargey Kachanovich + * + * Copyright (C) 2016 INRIA + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + +#include + +#include +#include + +#include +#include +#include + +int main (void) +{ + typedef CGAL::Epick_d > K; + typedef typename K::FT FT; + typedef typename K::Point_d Point_d; + + CGAL::Random rd; + + std::vector points; + for (int i = 0 ; i < 500 ; ++i) + points.push_back(Point_d(std::array({rd.get_double(-1.,1),rd.get_double(-1.,1),rd.get_double(-1.,1),rd.get_double(-1.,1)}))); + + K k; + std::vector results; + Gudhi::subsampling::choose_by_farthest_point(k, 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/src/Subsampling/example/example_pick_random_points.cpp b/src/Subsampling/example/example_pick_random_points.cpp new file mode 100644 index 00000000..49a027a4 --- /dev/null +++ b/src/Subsampling/example/example_pick_random_points.cpp @@ -0,0 +1,52 @@ +/* This file is part of the Gudhi Library. The Gudhi library + * (Geometric Understanding in Higher Dimensions) is a generic C++ + * library for computational topology. + * + * Author(s): Siargey Kachanovich + * + * Copyright (C) 2016 INRIA + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + +#include + +#include +#include + +#include +#include +#include + +int main (void) +{ + typedef CGAL::Epick_d > K; + typedef typename K::FT FT; + typedef typename K::Point_d Point_d; + + CGAL::Random rd; + + std::vector points; + for (int i = 0 ; i < 500 ; ++i) + points.push_back(Point_d(std::array({rd.get_double(-1.,1),rd.get_double(-1.,1),rd.get_double(-1.,1),rd.get_double(-1.,1)}))); + + K k; + std::vector results; + Gudhi::subsampling::pick_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/src/Subsampling/include/gudhi/choose_by_farthest_point.h b/src/Subsampling/include/gudhi/choose_by_farthest_point.h index 52647c16..d1db0d1a 100644 --- a/src/Subsampling/include/gudhi/choose_by_farthest_point.h +++ b/src/Subsampling/include/gudhi/choose_by_farthest_point.h @@ -25,6 +25,14 @@ #include +#include + +#include + +#include +#include +#include + #include #include // for sort #include @@ -45,10 +53,11 @@ namespace subsampling { template < typename Kernel, typename Point_container, typename OutputIterator> - void choose_by_farthest_point( Kernel& k, - Point_container const &points, - int final_size, - OutputIterator output_it) + void choose_by_farthest_point_old( Kernel& k, + Point_container const &points, + int final_size, + int starting_point, + OutputIterator output_it) { typename Kernel::Squared_distance_d sqdist = k.squared_distance_d_object(); @@ -60,11 +69,7 @@ namespace subsampling { const double infty = std::numeric_limits::infinity(); // infinity (see next entry) std::vector< double > dist_to_L(nb_points, infty); // vector of current distances to L from points - // Choose randomly the first landmark - std::random_device rd; - std::mt19937 gen(rd()); - std::uniform_int_distribution<> dis(1, 6); - int curr_max_w = dis(gen); + int curr_max_w = starting_point; for (current_number_of_landmarks = 0; current_number_of_landmarks != final_size; current_number_of_landmarks++) { // curr_max_w at this point is the next landmark @@ -86,7 +91,103 @@ namespace subsampling { } } } + + template < typename Kernel, + typename Point_container, + typename OutputIterator> + void choose_by_farthest_point_old( Kernel& k, + Point_container const &points, + int final_size, + OutputIterator output_it) + { + // Choose randomly the first landmark + std::random_device rd; + std::mt19937 gen(rd()); + std::uniform_int_distribution<> dis(1, 6); + int starting_point = dis(gen); + choose_by_farthest_point_old(k, points, final_size, starting_point, output_it); + } + + template < typename Kernel, + typename Point_container, + typename OutputIterator> + void choose_by_farthest_point( Kernel& k, + Point_container const &points, + int final_size, + int starting_point, + OutputIterator output_it) + { + // typedef typename Kernel::Point_d Point_d; + // typedef typename Kernel::FT FT; + // typedef CGAL::Search_traits< + // FT, Point_d, + // typename Kernel::Cartesian_const_iterator_d, + // typename Kernel::Construct_cartesian_const_iterator_d> Traits_base; + // typedef CGAL::Search_traits_adapter< std::ptrdiff_t, Point_d*, Traits_base > STraits; + // typedef CGAL::Fuzzy_sphere< STraits > Fuzzy_sphere; + + typename Kernel::Squared_distance_d sqdist = k.squared_distance_d_object(); + + int nb_points = boost::size(points); + assert(nb_points >= final_size); + + Clock t; + Gudhi::spatial_searching::Spatial_tree_data_structure< Kernel, Point_container> tree(points); + t.end(); + //std::cout << "Constructed the Kd tree: " << t.num_seconds() << " s." << std::endl; + + //CGAL::Fuzzy_sphere< CGAL::Search_trai> + + int current_number_of_landmarks = 0; // counter for landmarks + const double infty = std::numeric_limits::infinity(); // infinity (see next entry) + double curr_max_dist = infty; // used for defining the furhest point from L + std::vector< double > dist_to_L(nb_points, infty); // vector of current distances to L from points + + // Choose randomly the first landmark + int curr_max_w = starting_point; + + for (current_number_of_landmarks = 0; current_number_of_landmarks != final_size; current_number_of_landmarks++) { + // curr_max_w at this point is the next landmark + *output_it++ = points[curr_max_w]; + // std::cout << curr_max_w << "\n"; + //for (auto& p : points) { + auto search = tree.query_incremental_ANN(points[curr_max_w]); + auto search_it = search.begin(); + while (search_it != search.end() && search_it->second <= curr_max_dist ) { + //std::cout << search_it->second << " " << curr_max_dist << "\n"; + if (dist_to_L[search_it->first] > search_it->second) + dist_to_L[search_it->first] = search_it->second; + search_it++; + } + // choose the next curr_max_w + curr_max_dist = 0; + for (unsigned i = 0; i < dist_to_L.size(); i++) + if (dist_to_L[i] > curr_max_dist) { + curr_max_dist = dist_to_L[i]; + curr_max_w = i; + } + } + } + + template < typename Kernel, + typename Point_container, + typename OutputIterator> + void choose_by_farthest_point( Kernel& k, + Point_container const &points, + int final_size, + OutputIterator output_it) + { + // Choose randomly the first landmark + std::random_device rd; + std::mt19937 gen(rd()); + std::uniform_int_distribution<> dis(1, 6); + int starting_point = dis(gen); + + choose_by_farthest_point_old(k, points, final_size, starting_point, output_it); + } + + } // namespace subsampling } // namespace Gudhi diff --git a/src/Subsampling/test/test_choose_farthest_point.cpp b/src/Subsampling/test/test_choose_farthest_point.cpp index 87c2c38d..dff2cd4e 100644 --- a/src/Subsampling/test/test_choose_farthest_point.cpp +++ b/src/Subsampling/test/test_choose_farthest_point.cpp @@ -24,14 +24,15 @@ // # define TBB_USE_THREADING_TOOL // #endif -#define BOOST_TEST_DYN_LINK -#define BOOST_TEST_MODULE "witness_complex_points" -#include -#include +// #define BOOST_TEST_DYN_LINK +// #define BOOST_TEST_MODULE "test_choose_farthest_point" +//#include +//#include #include #include #include +#include #include @@ -40,18 +41,52 @@ typedef typename K::FT FT; typedef typename K::Point_d Point_d; -BOOST_AUTO_TEST_CASE(test_choose_farthest_point) { - std::vector< Point_d > points, results; - // Add grid points (625 points) - for (FT i = 0; i < 5; i += 1.0) - for (FT j = 0; j < 5; j += 1.0) - for (FT k = 0; k < 5; k += 1.0) - for (FT l = 0; l < 5; l += 1.0) +//BOOST_AUTO_TEST_CASE(test_choose_farthest_point) +int main() { + std::vector< Point_d > points, results, results2; + K k; + Clock t; + // Add grid points (810000 points) + for (FT i = 0; i < 30; i += 1.0) + for (FT j = 0; j < 30; j += 1.0) + for (FT k = 0; k < 30; k += 1.0) + for (FT l = 0; l < 30; l += 1.0) points.push_back(Point_d(std::vector({i, j, k, l}))); - results.clear(); - K k; - Gudhi::subsampling::choose_by_farthest_point(k, points, 100, std::back_inserter(results)); + unsigned final_size = 100, numeral = 1; + std::cout << "Test New Old\n"; + while (final_size < 100001) { + std::cout << final_size << ": "; + results.clear(); + t.begin(); + Gudhi::subsampling::choose_by_farthest_point(k, points, final_size, 0, std::back_inserter(results)); + t.end(); + std::cout << t.num_seconds() << " s, "; - assert(results.size() == 100); + // std::cout << "New algorithm result:\n"; + // for (auto p: results) + // std::cout << p << std::endl; + + results2.clear(); + t.begin(); + Gudhi::subsampling::choose_by_farthest_point_old(k, points, final_size, 0, std::back_inserter(results2)); + t.end(); + std::cout << t.num_seconds() << " s" << std::endl; + + + // std::cout << "Old algorithm result:\n"; + // for (auto p: results2) + // std::cout << p << std::endl; + + assert(results.size() == final_size); + assert(results2.size() == final_size); + assert(results == results2); + + switch (numeral) { + case 1: numeral = 2; final_size *= 2; break; + case 2: numeral = 5; final_size = final_size/2*5; break; + case 5: numeral = 1; final_size *= 2; break; + default: assert(false); + } + } } -- cgit v1.2.3 From 8587109e64af7ce1f17d8e7756e078a025a37bcb Mon Sep 17 00:00:00 2001 From: cjamin Date: Wed, 6 Jul 2016 16:05:39 +0000 Subject: Fix CMake scripts git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/subsampling_and_spatialsearching@1389 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: b97e07531b300c47ddefd056cc574d89c71a4400 --- src/Spatial_searching/example/CMakeLists.txt | 1 + src/Spatial_searching/test/CMakeLists.txt | 3 ++- src/Subsampling/example/CMakeLists.txt | 2 +- src/Subsampling/test/CMakeLists.txt | 5 +++-- 4 files changed, 7 insertions(+), 4 deletions(-) (limited to 'src/Subsampling/example/CMakeLists.txt') diff --git a/src/Spatial_searching/example/CMakeLists.txt b/src/Spatial_searching/example/CMakeLists.txt index c1190d1b..0885c24c 100644 --- a/src/Spatial_searching/example/CMakeLists.txt +++ b/src/Spatial_searching/example/CMakeLists.txt @@ -12,6 +12,7 @@ if(CGAL_FOUND) include_directories (BEFORE "../../include") add_executable( Spatial_searching_example_spatial_searching example_spatial_searching.cpp ) + target_link_libraries(Spatial_searching_example_spatial_searching ${CGAL_LIBRARY}) else() message(WARNING "Eigen3 not found. Version 3.1.0 is required for the Tangential_complex examples.") endif() diff --git a/src/Spatial_searching/test/CMakeLists.txt b/src/Spatial_searching/test/CMakeLists.txt index 297b6749..41059286 100644 --- a/src/Spatial_searching/test/CMakeLists.txt +++ b/src/Spatial_searching/test/CMakeLists.txt @@ -18,7 +18,8 @@ if(CGAL_FOUND) include_directories (BEFORE "../../include") add_executable( Spatial_searching_test_Spatial_tree_data_structure test_Spatial_tree_data_structure.cpp ) - target_link_libraries(Spatial_searching_test_Spatial_tree_data_structure ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) + target_link_libraries(Spatial_searching_test_Spatial_tree_data_structure + ${CGAL_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) else() message(WARNING "Eigen3 not found. Version 3.1.0 is required for the Spatial_searching tests.") endif() diff --git a/src/Subsampling/example/CMakeLists.txt b/src/Subsampling/example/CMakeLists.txt index e1e7cc71..532440eb 100644 --- a/src/Subsampling/example/CMakeLists.txt +++ b/src/Subsampling/example/CMakeLists.txt @@ -17,7 +17,7 @@ if(CGAL_FOUND) #target_link_libraries(Subsampling_example_choose_farthest_point ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) add_executable(Subsampling_example_sparsify_point_set example_sparsify_point_set.cpp) - target_link_libraries(Subsampling_example_sparsify_point_set ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) + target_link_libraries(Subsampling_example_sparsify_point_set ${CGAL_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) else() message(WARNING "Eigen3 not found. Version 3.1.0 is required for Subsampling feature.") endif() diff --git a/src/Subsampling/test/CMakeLists.txt b/src/Subsampling/test/CMakeLists.txt index 80b0ccbb..18fc84f4 100644 --- a/src/Subsampling/test/CMakeLists.txt +++ b/src/Subsampling/test/CMakeLists.txt @@ -21,12 +21,13 @@ if(CGAL_FOUND) include_directories (BEFORE "../../include") add_executable( Subsampling_test_pick_random_points test_pick_random_points.cpp ) + target_link_libraries(Subsampling_test_pick_random_points ${CGAL_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) add_executable( Subsampling_test_choose_farthest_point test_choose_farthest_point.cpp ) - target_link_libraries(Subsampling_test_choose_farthest_point ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) + target_link_libraries(Subsampling_test_choose_farthest_point ${CGAL_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) add_executable(Subsampling_test_sparsify_point_set test_sparsify_point_set.cpp) - target_link_libraries(Subsampling_test_sparsify_point_set ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) + target_link_libraries(Subsampling_test_sparsify_point_set ${CGAL_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) else() message(WARNING "Eigen3 not found. Version 3.1.0 is required for Subsampling feature.") endif() -- cgit v1.2.3 From d38ddb2d2b6943e1e9b26694ac624f85263ad24b Mon Sep 17 00:00:00 2001 From: skachano Date: Tue, 20 Sep 2016 09:45:31 +0000 Subject: Changed choose_by_farthest_point -> choose_n_farthest_points git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/subsampling_and_spatialsearching@1513 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 287ef6f3be6e4db4616ad92ff7369cd7722a1f2d --- src/Subsampling/example/CMakeLists.txt | 4 ++-- src/Subsampling/test/CMakeLists.txt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/Subsampling/example/CMakeLists.txt') diff --git a/src/Subsampling/example/CMakeLists.txt b/src/Subsampling/example/CMakeLists.txt index 532440eb..b6d71dac 100644 --- a/src/Subsampling/example/CMakeLists.txt +++ b/src/Subsampling/example/CMakeLists.txt @@ -13,8 +13,8 @@ if(CGAL_FOUND) add_executable( Subsampling_example_pick_random_points example_pick_random_points.cpp ) - add_executable( Subsampling_example_choose_by_farthest_point example_choose_by_farthest_point.cpp ) - #target_link_libraries(Subsampling_example_choose_farthest_point ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) + add_executable( Subsampling_example_choose_n_farthest_points example_choose_n_farthest_points.cpp ) + #target_link_libraries(Subsampling_example_choose_n_farthest_points ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) add_executable(Subsampling_example_sparsify_point_set example_sparsify_point_set.cpp) target_link_libraries(Subsampling_example_sparsify_point_set ${CGAL_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) diff --git a/src/Subsampling/test/CMakeLists.txt b/src/Subsampling/test/CMakeLists.txt index 18fc84f4..95241cd2 100644 --- a/src/Subsampling/test/CMakeLists.txt +++ b/src/Subsampling/test/CMakeLists.txt @@ -23,8 +23,8 @@ if(CGAL_FOUND) add_executable( Subsampling_test_pick_random_points test_pick_random_points.cpp ) target_link_libraries(Subsampling_test_pick_random_points ${CGAL_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) - add_executable( Subsampling_test_choose_farthest_point test_choose_farthest_point.cpp ) - target_link_libraries(Subsampling_test_choose_farthest_point ${CGAL_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) + add_executable( Subsampling_test_choose_n_farthest_points test_choose_n_farthest_points.cpp ) + target_link_libraries(Subsampling_test_choose_n_farthest_points ${CGAL_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) add_executable(Subsampling_test_sparsify_point_set test_sparsify_point_set.cpp) target_link_libraries(Subsampling_test_sparsify_point_set ${CGAL_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) -- cgit v1.2.3 From 6ad5ac6794ebc46638cd1f0862a553f40d2557d7 Mon Sep 17 00:00:00 2001 From: skachano Date: Tue, 20 Sep 2016 16:14:38 +0000 Subject: Renamed pick_random_points -> pick_n_random_points git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/subsampling_and_spatialsearching@1516 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 45cc8cca9debf56dd0d21762e537649dd92d9a4d --- src/Subsampling/doc/Intro_subsampling.h | 4 +- src/Subsampling/example/CMakeLists.txt | 2 +- .../example/example_pick_n_random_points.cpp | 29 ++++++++ .../example/example_pick_random_points.cpp | 29 -------- .../include/gudhi/pick_n_random_points.h | 82 ++++++++++++++++++++++ src/Subsampling/include/gudhi/pick_random_points.h | 82 ---------------------- src/Subsampling/test/CMakeLists.txt | 4 +- src/Subsampling/test/test_pick_n_random_points.cpp | 69 ++++++++++++++++++ src/Subsampling/test/test_pick_random_points.cpp | 69 ------------------ .../example/witness_complex_from_file.cpp | 4 +- .../example/witness_complex_sphere.cpp | 4 +- .../test/witness_complex_points.cpp | 4 +- 12 files changed, 191 insertions(+), 191 deletions(-) create mode 100644 src/Subsampling/example/example_pick_n_random_points.cpp delete mode 100644 src/Subsampling/example/example_pick_random_points.cpp create mode 100644 src/Subsampling/include/gudhi/pick_n_random_points.h delete mode 100644 src/Subsampling/include/gudhi/pick_random_points.h create mode 100644 src/Subsampling/test/test_pick_n_random_points.cpp delete mode 100644 src/Subsampling/test/test_pick_random_points.cpp (limited to 'src/Subsampling/example/CMakeLists.txt') diff --git a/src/Subsampling/doc/Intro_subsampling.h b/src/Subsampling/doc/Intro_subsampling.h index aed41430..06aee2fc 100644 --- a/src/Subsampling/doc/Intro_subsampling.h +++ b/src/Subsampling/doc/Intro_subsampling.h @@ -53,11 +53,11 @@ namespace subsampling { * * \include Subsampling/example_choose_by_farthest_point.cpp * - * \section randompointexamples Example: pick_random_points + * \section randompointexamples Example: pick_n_random_points * * This example outputs a subset of 100 points picked randomly. * - * \include Subsampling/example_pick_random_points.cpp + * \include Subsampling/example_pick_n_random_points.cpp * \copyright GNU General Public License v3. * \verbatim Contact: gudhi-users@lists.gforge.inria.fr \endverbatim */ diff --git a/src/Subsampling/example/CMakeLists.txt b/src/Subsampling/example/CMakeLists.txt index b6d71dac..4710cf00 100644 --- a/src/Subsampling/example/CMakeLists.txt +++ b/src/Subsampling/example/CMakeLists.txt @@ -11,7 +11,7 @@ if(CGAL_FOUND) include( ${EIGEN3_USE_FILE} ) include_directories (BEFORE "../../include") - add_executable( Subsampling_example_pick_random_points example_pick_random_points.cpp ) + 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 ) #target_link_libraries(Subsampling_example_choose_n_farthest_points ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) diff --git a/src/Subsampling/example/example_pick_n_random_points.cpp b/src/Subsampling/example/example_pick_n_random_points.cpp new file mode 100644 index 00000000..d2f063ba --- /dev/null +++ b/src/Subsampling/example/example_pick_n_random_points.cpp @@ -0,0 +1,29 @@ +#include + +#include +#include + +#include +#include +#include + +int main (void) +{ + typedef CGAL::Epick_d > K; + typedef typename K::FT FT; + typedef typename K::Point_d Point_d; + + CGAL::Random rd; + + std::vector points; + for (int i = 0 ; i < 500 ; ++i) + points.push_back(Point_d(std::array({rd.get_double(-1.,1),rd.get_double(-1.,1),rd.get_double(-1.,1),rd.get_double(-1.,1)}))); + + K k; + std::vector 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/src/Subsampling/example/example_pick_random_points.cpp b/src/Subsampling/example/example_pick_random_points.cpp deleted file mode 100644 index 348b1b81..00000000 --- a/src/Subsampling/example/example_pick_random_points.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include - -#include -#include - -#include -#include -#include - -int main (void) -{ - typedef CGAL::Epick_d > K; - typedef typename K::FT FT; - typedef typename K::Point_d Point_d; - - CGAL::Random rd; - - std::vector points; - for (int i = 0 ; i < 500 ; ++i) - points.push_back(Point_d(std::array({rd.get_double(-1.,1),rd.get_double(-1.,1),rd.get_double(-1.,1),rd.get_double(-1.,1)}))); - - K k; - std::vector results; - Gudhi::subsampling::pick_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/src/Subsampling/include/gudhi/pick_n_random_points.h b/src/Subsampling/include/gudhi/pick_n_random_points.h new file mode 100644 index 00000000..4ca1fafc --- /dev/null +++ b/src/Subsampling/include/gudhi/pick_n_random_points.h @@ -0,0 +1,82 @@ +/* This file is part of the Gudhi Library. The Gudhi library + * (Geometric Understanding in Higher Dimensions) is a generic C++ + * library for computational topology. + * + * Author(s): Siargey Kachanovich + * + * Copyright (C) 2016 INRIA + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef PICK_RANDOM_POINTS_H_ +#define PICK_RANDOM_POINTS_H_ + +#include + +#include // random_device, mt19937 +#include // shuffle +#include // iota +#include +#include + + +namespace Gudhi { + +namespace subsampling { + + /** + * \ingroup subsampling + * \brief Subsample a point set by picking random vertices. + * + * \details It chooses `final_size` distinct points from a random access range `points` + * and outputs them to the output iterator `output_it`. + * Point_container::iterator should be ValueSwappable and RandomAccessIterator. + */ + + template + void pick_n_random_points(Point_container const &points, + unsigned final_size, + OutputIterator output_it) { +#ifdef GUDHI_SUBS_PROFILING + Gudhi::Clock t; +#endif + + unsigned nbP = boost::size(points); + assert(nbP >= final_size); + std::vector landmarks(nbP); + std::iota(landmarks.begin(), landmarks.end(), 0); + + std::random_device rd; + std::mt19937 g(rd()); + + std::shuffle(landmarks.begin(), landmarks.end(), g); + landmarks.resize(final_size); + + for (int l: landmarks) + *output_it++ = points[l]; + +#ifdef GUDHI_SUBS_PROFILING + t.end(); + std::cerr << "Random landmark choice took " << t.num_seconds() + << " seconds." << std::endl; +#endif + } + +} // namesapce subsampling + +} // namespace Gudhi + +#endif // PICK_RANDOM_POINTS_H_ diff --git a/src/Subsampling/include/gudhi/pick_random_points.h b/src/Subsampling/include/gudhi/pick_random_points.h deleted file mode 100644 index 732ae3f7..00000000 --- a/src/Subsampling/include/gudhi/pick_random_points.h +++ /dev/null @@ -1,82 +0,0 @@ -/* This file is part of the Gudhi Library. The Gudhi library - * (Geometric Understanding in Higher Dimensions) is a generic C++ - * library for computational topology. - * - * Author(s): Siargey Kachanovich - * - * Copyright (C) 2016 INRIA - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef PICK_RANDOM_POINTS_H_ -#define PICK_RANDOM_POINTS_H_ - -#include - -#include // random_device, mt19937 -#include // shuffle -#include // iota -#include -#include - - -namespace Gudhi { - -namespace subsampling { - - /** - * \ingroup subsampling - * \brief Subsample a point set by picking random vertices. - * - * \details It chooses `final_size` distinct points from a random access range `points` - * and outputs them to the output iterator `output_it`. - * Point_container::iterator should be ValueSwappable and RandomAccessIterator. - */ - - template - void pick_random_points(Point_container const &points, - unsigned final_size, - OutputIterator output_it) { -#ifdef GUDHI_SUBS_PROFILING - Gudhi::Clock t; -#endif - - unsigned nbP = boost::size(points); - assert(nbP >= final_size); - std::vector landmarks(nbP); - std::iota(landmarks.begin(), landmarks.end(), 0); - - std::random_device rd; - std::mt19937 g(rd()); - - std::shuffle(landmarks.begin(), landmarks.end(), g); - landmarks.resize(final_size); - - for (int l: landmarks) - *output_it++ = points[l]; - -#ifdef GUDHI_SUBS_PROFILING - t.end(); - std::cerr << "Random landmark choice took " << t.num_seconds() - << " seconds." << std::endl; -#endif - } - -} // namesapce subsampling - -} // namespace Gudhi - -#endif // PICK_RANDOM_POINTS_H_ diff --git a/src/Subsampling/test/CMakeLists.txt b/src/Subsampling/test/CMakeLists.txt index 95241cd2..c9e48416 100644 --- a/src/Subsampling/test/CMakeLists.txt +++ b/src/Subsampling/test/CMakeLists.txt @@ -20,8 +20,8 @@ if(CGAL_FOUND) include( ${EIGEN3_USE_FILE} ) include_directories (BEFORE "../../include") - add_executable( Subsampling_test_pick_random_points test_pick_random_points.cpp ) - target_link_libraries(Subsampling_test_pick_random_points ${CGAL_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) + add_executable( Subsampling_test_pick_n_random_points test_pick_n_random_points.cpp ) + target_link_libraries(Subsampling_test_pick_n_random_points ${CGAL_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) add_executable( Subsampling_test_choose_n_farthest_points test_choose_n_farthest_points.cpp ) target_link_libraries(Subsampling_test_choose_n_farthest_points ${CGAL_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) diff --git a/src/Subsampling/test/test_pick_n_random_points.cpp b/src/Subsampling/test/test_pick_n_random_points.cpp new file mode 100644 index 00000000..6c8dbea2 --- /dev/null +++ b/src/Subsampling/test/test_pick_n_random_points.cpp @@ -0,0 +1,69 @@ +/* This file is part of the Gudhi Library. The Gudhi library + * (Geometric Understanding in Higher Dimensions) is a generic C++ + * library for computational topology. + * + * Author(s): Siargey Kachanovich + * + * Copyright (C) 2016 INRIA + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +// #ifdef _DEBUG +// # define TBB_USE_THREADING_TOOL +// #endif + +#define BOOST_TEST_DYN_LINK +#define BOOST_TEST_MODULE Subsampling - test pick_n_random_points +#include + +#include +#include +#include + +#include + + +BOOST_AUTO_TEST_CASE(test_pick_n_random_points) +{ + typedef CGAL::Epick_d K; + typedef typename K::FT FT; + typedef typename K::Point_d Point_d; + + std::vector vect; + vect.push_back(Point_d(std::vector({0,0,0,0}))); + vect.push_back(Point_d(std::vector({0,0,0,1}))); + vect.push_back(Point_d(std::vector({0,0,1,0}))); + vect.push_back(Point_d(std::vector({0,0,1,1}))); + vect.push_back(Point_d(std::vector({0,1,0,0}))); + vect.push_back(Point_d(std::vector({0,1,0,1}))); + vect.push_back(Point_d(std::vector({0,1,1,0}))); + vect.push_back(Point_d(std::vector({0,1,1,1}))); + vect.push_back(Point_d(std::vector({1,0,0,0}))); + vect.push_back(Point_d(std::vector({1,0,0,1}))); + vect.push_back(Point_d(std::vector({1,0,1,0}))); + vect.push_back(Point_d(std::vector({1,0,1,1}))); + vect.push_back(Point_d(std::vector({1,1,0,0}))); + vect.push_back(Point_d(std::vector({1,1,0,1}))); + vect.push_back(Point_d(std::vector({1,1,1,0}))); + vect.push_back(Point_d(std::vector({1,1,1,1}))); + + std::vector results; + Gudhi::subsampling::pick_n_random_points(vect, 5, std::back_inserter(results)); + std::cout << "landmark vector contains: "; + for (auto l: results) + std::cout << l << "\n"; + + BOOST_CHECK(results.size() == 5); +} diff --git a/src/Subsampling/test/test_pick_random_points.cpp b/src/Subsampling/test/test_pick_random_points.cpp deleted file mode 100644 index 16841eff..00000000 --- a/src/Subsampling/test/test_pick_random_points.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* This file is part of the Gudhi Library. The Gudhi library - * (Geometric Understanding in Higher Dimensions) is a generic C++ - * library for computational topology. - * - * Author(s): Siargey Kachanovich - * - * Copyright (C) 2016 INRIA - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -// #ifdef _DEBUG -// # define TBB_USE_THREADING_TOOL -// #endif - -#define BOOST_TEST_DYN_LINK -#define BOOST_TEST_MODULE Subsampling - test pick_random_points -#include - -#include -#include -#include - -#include - - -BOOST_AUTO_TEST_CASE(test_pick_random_points) -{ - typedef CGAL::Epick_d K; - typedef typename K::FT FT; - typedef typename K::Point_d Point_d; - - std::vector vect; - vect.push_back(Point_d(std::vector({0,0,0,0}))); - vect.push_back(Point_d(std::vector({0,0,0,1}))); - vect.push_back(Point_d(std::vector({0,0,1,0}))); - vect.push_back(Point_d(std::vector({0,0,1,1}))); - vect.push_back(Point_d(std::vector({0,1,0,0}))); - vect.push_back(Point_d(std::vector({0,1,0,1}))); - vect.push_back(Point_d(std::vector({0,1,1,0}))); - vect.push_back(Point_d(std::vector({0,1,1,1}))); - vect.push_back(Point_d(std::vector({1,0,0,0}))); - vect.push_back(Point_d(std::vector({1,0,0,1}))); - vect.push_back(Point_d(std::vector({1,0,1,0}))); - vect.push_back(Point_d(std::vector({1,0,1,1}))); - vect.push_back(Point_d(std::vector({1,1,0,0}))); - vect.push_back(Point_d(std::vector({1,1,0,1}))); - vect.push_back(Point_d(std::vector({1,1,1,0}))); - vect.push_back(Point_d(std::vector({1,1,1,1}))); - - std::vector results; - Gudhi::subsampling::pick_random_points(vect, 5, std::back_inserter(results)); - std::cout << "landmark vector contains: "; - for (auto l: results) - std::cout << l << "\n"; - - BOOST_CHECK(results.size() == 5); -} diff --git a/src/Witness_complex/example/witness_complex_from_file.cpp b/src/Witness_complex/example/witness_complex_from_file.cpp index 0d82ee38..5e9f0e81 100644 --- a/src/Witness_complex/example/witness_complex_from_file.cpp +++ b/src/Witness_complex/example/witness_complex_from_file.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include @@ -87,7 +87,7 @@ int main(int argc, char * const argv[]) { // Choose landmarks start = clock(); std::vector > knn; - Gudhi::subsampling::pick_random_points(point_vector, 100, std::back_inserter(landmarks)); + Gudhi::subsampling::pick_n_random_points(point_vector, 100, std::back_inserter(landmarks)); Gudhi::witness_complex::construct_closest_landmark_table(point_vector, landmarks, knn); end = clock(); std::cout << "Landmark choice for " << nbL << " landmarks took " diff --git a/src/Witness_complex/example/witness_complex_sphere.cpp b/src/Witness_complex/example/witness_complex_sphere.cpp index d0c4b4c4..e6f88274 100644 --- a/src/Witness_complex/example/witness_complex_sphere.cpp +++ b/src/Witness_complex/example/witness_complex_sphere.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include @@ -76,7 +76,7 @@ int main(int argc, char * const argv[]) { // Choose landmarks start = clock(); std::vector > knn; - Gudhi::subsampling::pick_random_points(point_vector, 100, std::back_inserter(landmarks)); + Gudhi::subsampling::pick_n_random_points(point_vector, 100, std::back_inserter(landmarks)); Gudhi::witness_complex::construct_closest_landmark_table(point_vector, landmarks, knn); // Compute witness complex diff --git a/src/Witness_complex/test/witness_complex_points.cpp b/src/Witness_complex/test/witness_complex_points.cpp index 596152f4..d40bbf14 100644 --- a/src/Witness_complex/test/witness_complex_points.cpp +++ b/src/Witness_complex/test/witness_complex_points.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include @@ -50,7 +50,7 @@ BOOST_AUTO_TEST_CASE(witness_complex_points) { bool b_print_output = false; // First test: random choice Simplex_tree complex1; - Gudhi::pick_random_points(points, 100, std::back_inserter(landmarks)); + Gudhi::subsampling::pick_n_random_points(points, 100, std::back_inserter(landmarks)); Gudhi::witness_complex::construct_closest_landmark_table(points, landmarks, knn); assert(!knn.empty()); WitnessComplex witnessComplex1(knn, 100, 3, complex1); -- cgit v1.2.3 From aa994dbd8dadfd4be416f13b13721e7e13c3623a Mon Sep 17 00:00:00 2001 From: cjamin Date: Thu, 22 Sep 2016 11:58:31 +0000 Subject: Require CGAL 4.8.1 (furthest neighbor is bugged before) See https://github.com/CGAL/cgal/pull/1105 git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/subsampling_and_spatialsearching@1536 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: fc980f30c107b39f8a47e18deb23820b411a9201 --- src/Subsampling/example/CMakeLists.txt | 4 ++-- src/Subsampling/test/CMakeLists.txt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/Subsampling/example/CMakeLists.txt') diff --git a/src/Subsampling/example/CMakeLists.txt b/src/Subsampling/example/CMakeLists.txt index 4710cf00..6bf717f7 100644 --- a/src/Subsampling/example/CMakeLists.txt +++ b/src/Subsampling/example/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.6) project(Subsampling_examples) if(CGAL_FOUND) - if (NOT CGAL_VERSION VERSION_LESS 4.8.0) + if (NOT CGAL_VERSION VERSION_LESS 4.8.1) message(STATUS "CGAL version: ${CGAL_VERSION}.") find_package(Eigen3 3.1.0) @@ -22,7 +22,7 @@ if(CGAL_FOUND) message(WARNING "Eigen3 not found. Version 3.1.0 is required for Subsampling feature.") endif() else() - message(WARNING "CGAL version: ${CGAL_VERSION} is too old to compile Subsampling examples. Version 4.8.0 is required.") + message(WARNING "CGAL version: ${CGAL_VERSION} is too old to compile Subsampling examples. Version 4.8.1 is required.") endif () else() message(WARNING "CGAL not found. It is required for the Subsampling examples.") diff --git a/src/Subsampling/test/CMakeLists.txt b/src/Subsampling/test/CMakeLists.txt index c9e48416..72de5ac7 100644 --- a/src/Subsampling/test/CMakeLists.txt +++ b/src/Subsampling/test/CMakeLists.txt @@ -11,7 +11,7 @@ if (GPROF_PATH) endif() if(CGAL_FOUND) - if (NOT CGAL_VERSION VERSION_LESS 4.8.0) + if (NOT CGAL_VERSION VERSION_LESS 4.8.1) message(STATUS "CGAL version: ${CGAL_VERSION}.") find_package(Eigen3 3.1.0) @@ -32,7 +32,7 @@ if(CGAL_FOUND) message(WARNING "Eigen3 not found. Version 3.1.0 is required for Subsampling feature.") endif() else() - message(WARNING "CGAL version: ${CGAL_VERSION} is too old to compile Subsampling tests. Version 4.8.0 is required.") + message(WARNING "CGAL version: ${CGAL_VERSION} is too old to compile Subsampling tests. Version 4.8.1 is required.") endif () else() message(WARNING "CGAL not found. It is required for the Subsampling tests.") -- cgit v1.2.3 From 39a0577d06d7d5349a08a64e4a73d0eaf67e6d1c Mon Sep 17 00:00:00 2001 From: cjamin Date: Thu, 22 Sep 2016 15:27:44 +0000 Subject: Clean-up CMakeLists.txt git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/subsampling_and_spatialsearching@1541 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 3204fef66b8a8358820531f8d6d2494c96a7226e --- src/Spatial_searching/example/CMakeLists.txt | 5 ----- src/Spatial_searching/test/CMakeLists.txt | 4 ---- src/Subsampling/example/CMakeLists.txt | 15 ++++----------- src/Subsampling/test/CMakeLists.txt | 9 ++------- 4 files changed, 6 insertions(+), 27 deletions(-) (limited to 'src/Subsampling/example/CMakeLists.txt') diff --git a/src/Spatial_searching/example/CMakeLists.txt b/src/Spatial_searching/example/CMakeLists.txt index 0c41d56c..3c3970d8 100644 --- a/src/Spatial_searching/example/CMakeLists.txt +++ b/src/Spatial_searching/example/CMakeLists.txt @@ -5,12 +5,7 @@ if(CGAL_FOUND) if (NOT CGAL_VERSION VERSION_LESS 4.8.1) message(STATUS "CGAL version: ${CGAL_VERSION}.") - find_package(Eigen3 3.1.0) if (EIGEN3_FOUND) - message(STATUS "Eigen3 version: ${EIGEN3_VERSION}.") - include( ${EIGEN3_USE_FILE} ) - include_directories (BEFORE "../../include") - add_executable( Spatial_searching_example_spatial_searching example_spatial_searching.cpp ) target_link_libraries(Spatial_searching_example_spatial_searching ${CGAL_LIBRARY}) else() diff --git a/src/Spatial_searching/test/CMakeLists.txt b/src/Spatial_searching/test/CMakeLists.txt index ed61cc64..0f2c5ae4 100644 --- a/src/Spatial_searching/test/CMakeLists.txt +++ b/src/Spatial_searching/test/CMakeLists.txt @@ -14,11 +14,7 @@ if(CGAL_FOUND) if (NOT CGAL_VERSION VERSION_LESS 4.8.1) message(STATUS "CGAL version: ${CGAL_VERSION}.") - find_package(Eigen3 3.1.0) if (EIGEN3_FOUND) - message(STATUS "Eigen3 version: ${EIGEN3_VERSION}.") - include( ${EIGEN3_USE_FILE} ) - include_directories (BEFORE "../../include") add_executable( Spatial_searching_test_Kd_tree_search test_Kd_tree_search.cpp ) target_link_libraries(Spatial_searching_test_Kd_tree_search diff --git a/src/Subsampling/example/CMakeLists.txt b/src/Subsampling/example/CMakeLists.txt index 6bf717f7..81b39d6e 100644 --- a/src/Subsampling/example/CMakeLists.txt +++ b/src/Subsampling/example/CMakeLists.txt @@ -5,19 +5,12 @@ if(CGAL_FOUND) if (NOT CGAL_VERSION VERSION_LESS 4.8.1) message(STATUS "CGAL version: ${CGAL_VERSION}.") - find_package(Eigen3 3.1.0) if (EIGEN3_FOUND) - message(STATUS "Eigen3 version: ${EIGEN3_VERSION}.") - include( ${EIGEN3_USE_FILE} ) - include_directories (BEFORE "../../include") - 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 ) - #target_link_libraries(Subsampling_example_choose_n_farthest_points ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) - - add_executable(Subsampling_example_sparsify_point_set example_sparsify_point_set.cpp) - target_link_libraries(Subsampling_example_sparsify_point_set ${CGAL_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) + 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_sparsify_point_set example_sparsify_point_set.cpp) + target_link_libraries(Subsampling_example_sparsify_point_set ${CGAL_LIBRARY}) else() message(WARNING "Eigen3 not found. Version 3.1.0 is required for Subsampling feature.") endif() diff --git a/src/Subsampling/test/CMakeLists.txt b/src/Subsampling/test/CMakeLists.txt index 72de5ac7..91d4ed8f 100644 --- a/src/Subsampling/test/CMakeLists.txt +++ b/src/Subsampling/test/CMakeLists.txt @@ -14,18 +14,13 @@ if(CGAL_FOUND) if (NOT CGAL_VERSION VERSION_LESS 4.8.1) message(STATUS "CGAL version: ${CGAL_VERSION}.") - find_package(Eigen3 3.1.0) if (EIGEN3_FOUND) - message(STATUS "Eigen3 version: ${EIGEN3_VERSION}.") - include( ${EIGEN3_USE_FILE} ) - include_directories (BEFORE "../../include") - add_executable( Subsampling_test_pick_n_random_points test_pick_n_random_points.cpp ) target_link_libraries(Subsampling_test_pick_n_random_points ${CGAL_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) add_executable( Subsampling_test_choose_n_farthest_points test_choose_n_farthest_points.cpp ) - target_link_libraries(Subsampling_test_choose_n_farthest_points ${CGAL_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) - + target_link_libraries(Subsampling_test_choose_n_farthest_points ${CGAL_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) + add_executable(Subsampling_test_sparsify_point_set test_sparsify_point_set.cpp) target_link_libraries(Subsampling_test_sparsify_point_set ${CGAL_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) else() -- cgit v1.2.3