diff options
author | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2016-11-16 11:49:41 +0000 |
---|---|---|
committer | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2016-11-16 11:49:41 +0000 |
commit | 668e76bbe8f350ab0fdf6f6105e8c7818a5ad38f (patch) | |
tree | 069ec9b257efeb05f775bf8f267b26adc720cb68 /src/Witness_complex/example | |
parent | def467c2cb019b7a5cc758b6778957be11465a6e (diff) | |
parent | 1839d09009b10ce3c62770e082a4d7816d991e14 (diff) |
Merged last trunk modifications
Make Witness compile and test
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/rips_complex_module@1755 636b058d-ea47-450e-bf9e-a15bfbe3eedb
Former-commit-id: e6eec55ac0a4cc66da3bb081a222cae5b998c1cf
Diffstat (limited to 'src/Witness_complex/example')
-rw-r--r-- | src/Witness_complex/example/witness_complex_from_file.cpp | 11 | ||||
-rw-r--r-- | src/Witness_complex/example/witness_complex_sphere.cpp | 12 |
2 files changed, 16 insertions, 7 deletions
diff --git a/src/Witness_complex/example/witness_complex_from_file.cpp b/src/Witness_complex/example/witness_complex_from_file.cpp index 6a203383..59dd28e0 100644 --- a/src/Witness_complex/example/witness_complex_from_file.cpp +++ b/src/Witness_complex/example/witness_complex_from_file.cpp @@ -26,7 +26,9 @@ #include <gudhi/Points_off_io.h> #include <gudhi/Simplex_tree.h> #include <gudhi/Witness_complex.h> -#include <gudhi/Landmark_choice_by_random_point.h> +#include <gudhi/Construct_closest_landmark_table.h> +#include <gudhi/pick_n_random_points.h> +#include <gudhi/reader_utils.h> #include <iostream> #include <fstream> @@ -36,6 +38,7 @@ typedef std::vector< int > typeVectorVertex; typedef std::vector< std::vector <double> > Point_Vector; +typedef Gudhi::Simplex_tree<> Simplex_tree; int main(int argc, char * const argv[]) { if (argc != 3) { @@ -49,7 +52,7 @@ int main(int argc, char * const argv[]) { clock_t start, end; // Construct the Simplex Tree - Gudhi::Simplex_tree<> simplex_tree; + Simplex_tree simplex_tree; // Read the OFF file (input file name given as parameter) and triangulate points Gudhi::Points_off_reader<std::vector <double>> off_reader(off_file_name); @@ -65,7 +68,9 @@ int main(int argc, char * const argv[]) { // Choose landmarks start = clock(); std::vector<std::vector< int > > knn; - Gudhi::witness_complex::landmark_choice_by_random_point(point_vector, nbL, knn); + Point_Vector landmarks; + Gudhi::subsampling::pick_n_random_points(point_vector, 100, std::back_inserter(landmarks)); + Gudhi::witness_complex::construct_closest_landmark_table<Simplex_tree::Filtration_value>(point_vector, landmarks, knn); end = clock(); std::cout << "Landmark choice for " << nbL << " landmarks took " << static_cast<double>(end - start) / CLOCKS_PER_SEC << " s. \n"; diff --git a/src/Witness_complex/example/witness_complex_sphere.cpp b/src/Witness_complex/example/witness_complex_sphere.cpp index b26c9f36..7ab86cc0 100644 --- a/src/Witness_complex/example/witness_complex_sphere.cpp +++ b/src/Witness_complex/example/witness_complex_sphere.cpp @@ -27,7 +27,8 @@ #include <gudhi/Simplex_tree.h> #include <gudhi/Witness_complex.h> -#include <gudhi/Landmark_choice_by_random_point.h> +#include <gudhi/Construct_closest_landmark_table.h> +#include <gudhi/pick_n_random_points.h> #include <gudhi/reader_utils.h> #include <iostream> @@ -39,6 +40,8 @@ #include "generators.h" +typedef Gudhi::Simplex_tree<> Simplex_tree; + /** Write a gnuplot readable file. * Data range is a random access range of pairs (arg, value) */ @@ -61,13 +64,13 @@ int main(int argc, char * const argv[]) { clock_t start, end; // Construct the Simplex Tree - Gudhi::Simplex_tree<> simplex_tree; + Simplex_tree simplex_tree; std::vector< std::pair<int, double> > l_time; // Read the point file for (int nbP = 500; nbP < 10000; nbP += 500) { - Point_Vector point_vector; + Point_Vector point_vector, landmarks; generate_points_sphere(point_vector, nbP, 4); std::cout << "Successfully generated " << point_vector.size() << " points.\n"; std::cout << "Ambient dimension is " << point_vector[0].size() << ".\n"; @@ -75,7 +78,8 @@ int main(int argc, char * const argv[]) { // Choose landmarks start = clock(); std::vector<std::vector< int > > knn; - Gudhi::witness_complex::landmark_choice_by_random_point(point_vector, number_of_landmarks, knn); + Gudhi::subsampling::pick_n_random_points(point_vector, 100, std::back_inserter(landmarks)); + Gudhi::witness_complex::construct_closest_landmark_table<Simplex_tree::Filtration_value>(point_vector, landmarks, knn); // Compute witness complex Gudhi::witness_complex::witness_complex(knn, number_of_landmarks, point_vector[0].size(), simplex_tree); |