diff options
author | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2016-12-01 23:11:43 +0000 |
---|---|---|
committer | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2016-12-01 23:11:43 +0000 |
commit | 658e2ad845801f3b2a7a349e499763d7f28a8bc9 (patch) | |
tree | a9434fb7cb1b0799a2f23e12d5d3d1a53229fad7 /src/cython/include/Subsampling_interface.h | |
parent | fcfc9de5eb7e309c0ac309f57e26672c31bbc836 (diff) | |
parent | 58c77ecd1c09c1cf116be44c1a7e9d18cd99970b (diff) |
Merge last trunk modifications
add Py test for subsampling
Add choose_n_furthest from off file
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_cythonize@1810 636b058d-ea47-450e-bf9e-a15bfbe3eedb
Former-commit-id: a23746a3dd427edc958b375f9f0ac4b4d2901fcb
Diffstat (limited to 'src/cython/include/Subsampling_interface.h')
-rw-r--r-- | src/cython/include/Subsampling_interface.h | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/cython/include/Subsampling_interface.h b/src/cython/include/Subsampling_interface.h index bd37a015..12c48012 100644 --- a/src/cython/include/Subsampling_interface.h +++ b/src/cython/include/Subsampling_interface.h @@ -45,12 +45,32 @@ std::vector<std::vector<double>> subsampling_n_farthest_points(std::vector<std:: std::vector<std::vector<double>> landmarks; Subsampling_dynamic_kernel k; choose_n_farthest_points(k, points, nb_points, std::back_inserter(landmarks)); - std::cout << "output " << landmarks.size() << std::endl; + return landmarks; +} + +std::vector<std::vector<double>> subsampling_n_farthest_points(std::vector<std::vector<double>>& points, unsigned nb_points, unsigned starting_point) { + std::vector<Subsampling_point_d> input, output; + for (auto point : points) + input.push_back(Subsampling_point_d(point.size(), point.begin(), point.end())); + std::vector<std::vector<double>> landmarks; + Subsampling_dynamic_kernel k; + choose_n_farthest_points(k, points, nb_points, starting_point, std::back_inserter(landmarks)); return landmarks; } +std::vector<std::vector<double>> subsampling_n_farthest_points_from_file(std::string& off_file, unsigned nb_points) { + Gudhi::Points_off_reader<std::vector<double>> off_reader(off_file); + std::vector<std::vector<double>> points = off_reader.get_point_cloud(); + return subsampling_n_farthest_points(points, nb_points); +} + +std::vector<std::vector<double>> subsampling_n_farthest_points_from_file(std::string& off_file, unsigned nb_points, unsigned starting_point) { + Gudhi::Points_off_reader<std::vector<double>> off_reader(off_file); + std::vector<std::vector<double>> points = off_reader.get_point_cloud(); + return subsampling_n_farthest_points(points, nb_points, starting_point); +} } // namespace subsampling } // namespace Gudhi |