diff options
author | ROUVREAU Vincent <vincent.rouvreau@inria.fr> | 2021-01-26 09:11:21 +0100 |
---|---|---|
committer | ROUVREAU Vincent <vincent.rouvreau@inria.fr> | 2021-01-26 09:11:21 +0100 |
commit | e750f1d0a91fd6f56f2ce9c28ee576067fc4b8cc (patch) | |
tree | 05494f7b0571e53eaa1b72ee3862539ea20e3319 /src/Subsampling/example/example_custom_kernel.cpp | |
parent | 6e958975a3ca7e23b57bfa8830b76b8d99b3063f (diff) | |
parent | c838e3ec441109cc02ea4612dd2189860662298f (diff) |
Merge branch 'master' into coxeter_integration
Diffstat (limited to 'src/Subsampling/example/example_custom_kernel.cpp')
-rw-r--r-- | src/Subsampling/example/example_custom_kernel.cpp | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/src/Subsampling/example/example_custom_kernel.cpp b/src/Subsampling/example/example_custom_kernel.cpp deleted file mode 100644 index 535bf42a..00000000 --- a/src/Subsampling/example/example_custom_kernel.cpp +++ /dev/null @@ -1,63 +0,0 @@ -#include <gudhi/choose_n_farthest_points.h> - -#include <iostream> -#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::clog << "Before sparsification: " << points.size() << " points.\n"; - std::clog << "After sparsification: " << results.size() << " points.\n"; - std::clog << "Result table: {" << results[0] << "," << results[1] << "}\n"; - - return 0; -} |