diff options
author | skachano <skachano@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2016-06-24 13:42:39 +0000 |
---|---|---|
committer | skachano <skachano@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2016-06-24 13:42:39 +0000 |
commit | 7928209595af6f7559fde36fa06c031cd47e7179 (patch) | |
tree | 5797f3cf082db94827ef0fa17ceeb2c50712c4f5 /src/Subsampling/test | |
parent | 9eaa65136751ab3362c13455163187bd60e7a1aa (diff) |
Copied Clément's example for 2 functions
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
Diffstat (limited to 'src/Subsampling/test')
-rw-r--r-- | src/Subsampling/test/test_choose_farthest_point.cpp | 65 |
1 files changed, 50 insertions, 15 deletions
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 <boost/test/unit_test.hpp> -#include <boost/mpl/list.hpp> +// #define BOOST_TEST_DYN_LINK +// #define BOOST_TEST_MODULE "test_choose_farthest_point" +//#include <boost/test/unit_test.hpp> +//#include <boost/mpl/list.hpp> #include <gudhi/choose_by_farthest_point.h> #include <vector> #include <iterator> +#include <gudhi/Clock.h> #include <CGAL/Epick_d.h> @@ -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<FT>({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); + } + } } |