summaryrefslogtreecommitdiff
path: root/src/Witness_complex/example
diff options
context:
space:
mode:
authorskachano <skachano@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-09-28 17:34:51 +0000
committerskachano <skachano@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-09-28 17:34:51 +0000
commite10dbc80a604cd1f53a4e9fee432d71c543a70a4 (patch)
tree167db5ca63c723fee6e7269b3478b63c7029f400 /src/Witness_complex/example
parent706d447efdb0da311f02b3677ce19e4a68100b03 (diff)
parent853bd71a57e36773a422698992527570587ec999 (diff)
Rewrite for the Weak Witness Complex
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/relaxed-witness@1586 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 00d6d906598893ab551157c00020ce33fe19cb5b
Diffstat (limited to 'src/Witness_complex/example')
-rw-r--r--src/Witness_complex/example/witness_complex_from_file.cpp8
-rw-r--r--src/Witness_complex/example/witness_complex_sphere.cpp17
2 files changed, 18 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 53207ad2..5e9f0e81 100644
--- a/src/Witness_complex/example/witness_complex_from_file.cpp
+++ b/src/Witness_complex/example/witness_complex_from_file.cpp
@@ -25,7 +25,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>
@@ -78,7 +79,7 @@ int main(int argc, char * const argv[]) {
Gudhi::Simplex_tree<> simplex_tree;
// Read the point file
- Point_Vector point_vector;
+ Point_Vector point_vector, landmarks;
read_points_cust(file_name, point_vector);
std::cout << "Successfully read " << point_vector.size() << " points.\n";
std::cout << "Ambient dimension is " << point_vector[0].size() << ".\n";
@@ -86,7 +87,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, nbL, knn);
+ 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 "
<< 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..3d4a54aa 100644
--- a/src/Witness_complex/example/witness_complex_sphere.cpp
+++ b/src/Witness_complex/example/witness_complex_sphere.cpp
@@ -27,9 +27,12 @@
#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 <CGAL/Epick_d.h>
+
#include <iostream>
#include <fstream>
#include <ctime>
@@ -67,7 +70,7 @@ int main(int argc, char * const argv[]) {
// 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,10 +78,16 @@ 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(point_vector, landmarks, knn);
// Compute witness complex
- Gudhi::witness_complex::witness_complex(knn, number_of_landmarks, point_vector[0].size(), simplex_tree);
+ // Gudhi::witness_complex::witness_complex(knn, number_of_landmarks, point_vector[0].size(), simplex_tree);
+ Gudhi::witness_complex::Witness_complex<Gudhi::Simplex_tree<>, CGAL::Epick_d<CGAL::Dynamic_dimension_tag>>(landmarks.begin(),
+ landmarks.end(),
+ point_vector.begin(),
+ point_vector.end(),
+ simplex_tree);
end = clock();
double time = static_cast<double>(end - start) / CLOCKS_PER_SEC;
std::cout << "Witness complex for " << number_of_landmarks << " landmarks took "