From e02efc78ac5e55512f145690391b0b794b139739 Mon Sep 17 00:00:00 2001 From: skachano Date: Fri, 17 Nov 2017 13:01:02 +0000 Subject: Added the commented choose_n_farthest_points everywhere git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/wit_doc_corrections@2909 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 9f7a325facf798748c4c08e3815fbbd3d4075b78 --- src/Witness_complex/doc/Witness_complex_doc.h | 6 +++--- .../example/example_strong_witness_complex_off.cpp | 8 +++++--- .../example/example_strong_witness_persistence.cpp | 6 ++++-- src/Witness_complex/example/example_witness_complex_off.cpp | 6 ++++-- .../example/example_witness_complex_persistence.cpp | 6 ++++-- src/Witness_complex/example/example_witness_complex_sphere.cpp | 4 +++- src/Witness_complex/include/gudhi/Strong_witness_complex.h | 5 +++-- 7 files changed, 26 insertions(+), 15 deletions(-) (limited to 'src/Witness_complex') diff --git a/src/Witness_complex/doc/Witness_complex_doc.h b/src/Witness_complex/doc/Witness_complex_doc.h index fb589a74..d070ee34 100644 --- a/src/Witness_complex/doc/Witness_complex_doc.h +++ b/src/Witness_complex/doc/Witness_complex_doc.h @@ -60,7 +60,6 @@ \section witnessexample1 Example 1: Constructing weak relaxed witness complex from an off file Let's start with a simple example, which reads an off point file and computes a weak witness complex. - In this example, instead of choosing landmarks randomly, one can also use the farthest point selection provided by Gudhi::subsampling::choose_n_farthest_points(). ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} @@ -91,8 +90,9 @@ int main(int argc, char * const argv[]) { Gudhi::Points_off_reader off_reader(file_name); point_vector = Point_vector(off_reader.get_point_cloud()); - // Choose landmarks (one can also use Gudhi::subsampling::choose_n_farthest_points()) - Gudhi::subsampling::pick_n_random_points(point_vector, nbL, std::back_inserter(landmarks)); + // Choose landmarks (one can choose either of the two methods below) + // Gudhi::subsampling::pick_n_random_points(point_vector, nbL, std::back_inserter(landmarks)); + Gudhi::subsampling::choose_n_farthest_points(K(), point_vector, nbL, Gudhi::subsampling::random_starting_point, std::back_inserter(landmarks)); // Compute witness complex Witness_complex witness_complex(landmarks, diff --git a/src/Witness_complex/example/example_strong_witness_complex_off.cpp b/src/Witness_complex/example/example_strong_witness_complex_off.cpp index 0ee9ee90..bc069654 100644 --- a/src/Witness_complex/example/example_strong_witness_complex_off.cpp +++ b/src/Witness_complex/example/example_strong_witness_complex_off.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -63,9 +64,10 @@ int main(int argc, char * const argv[]) { std::cout << "Successfully read " << point_vector.size() << " points.\n"; std::cout << "Ambient dimension is " << point_vector[0].dimension() << ".\n"; - // Choose landmarks - Gudhi::subsampling::pick_n_random_points(point_vector, nbL, std::back_inserter(landmarks)); - + // Choose landmarks (decomment one of the following two lines) + // Gudhi::subsampling::pick_n_random_points(point_vector, nbL, std::back_inserter(landmarks)); + Gudhi::subsampling::choose_n_farthest_points(K(), point_vector, nbL, Gudhi::subsampling::random_starting_point, std::back_inserter(landmarks)); + // Compute witness complex start = clock(); Witness_complex witness_complex(landmarks, diff --git a/src/Witness_complex/example/example_strong_witness_persistence.cpp b/src/Witness_complex/example/example_strong_witness_persistence.cpp index 1f0c5a42..e3e0c1ee 100644 --- a/src/Witness_complex/example/example_strong_witness_persistence.cpp +++ b/src/Witness_complex/example/example_strong_witness_persistence.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include @@ -76,8 +77,9 @@ int main(int argc, char * argv[]) { std::cout << "Successfully read " << witnesses.size() << " points.\n"; std::cout << "Ambient dimension is " << witnesses[0].dimension() << ".\n"; - // Choose landmarks from witnesses (one can also use Gudhi::subsampling::choose_n_farthest_points) - Gudhi::subsampling::pick_n_random_points(witnesses, nbL, std::back_inserter(landmarks)); + // Choose landmarks (decomment one of the following two lines) + // Gudhi::subsampling::pick_n_random_points(point_vector, nbL, std::back_inserter(landmarks)); + Gudhi::subsampling::choose_n_farthest_points(K(), witnesses, nbL, Gudhi::subsampling::random_starting_point, std::back_inserter(landmarks)); // Compute witness complex Strong_witness_complex strong_witness_complex(landmarks, diff --git a/src/Witness_complex/example/example_witness_complex_off.cpp b/src/Witness_complex/example/example_witness_complex_off.cpp index b36dac0d..be11c955 100644 --- a/src/Witness_complex/example/example_witness_complex_off.cpp +++ b/src/Witness_complex/example/example_witness_complex_off.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -44,8 +45,9 @@ int main(int argc, char * const argv[]) { std::cout << "Successfully read " << point_vector.size() << " points.\n"; std::cout << "Ambient dimension is " << point_vector[0].dimension() << ".\n"; - // Choose landmarks - Gudhi::subsampling::pick_n_random_points(point_vector, nbL, std::back_inserter(landmarks)); + // Choose landmarks (decomment one of the following two lines) + // Gudhi::subsampling::pick_n_random_points(point_vector, nbL, std::back_inserter(landmarks)); + Gudhi::subsampling::choose_n_farthest_points(K(), point_vector, nbL, Gudhi::subsampling::random_starting_point, std::back_inserter(landmarks)); // Compute witness complex start = clock(); diff --git a/src/Witness_complex/example/example_witness_complex_persistence.cpp b/src/Witness_complex/example/example_witness_complex_persistence.cpp index a1146922..a63b0837 100644 --- a/src/Witness_complex/example/example_witness_complex_persistence.cpp +++ b/src/Witness_complex/example/example_witness_complex_persistence.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include @@ -76,8 +77,9 @@ int main(int argc, char * argv[]) { std::cout << "Successfully read " << witnesses.size() << " points.\n"; std::cout << "Ambient dimension is " << witnesses[0].dimension() << ".\n"; - // Choose landmarks from witnesses - Gudhi::subsampling::pick_n_random_points(witnesses, nbL, std::back_inserter(landmarks)); + // Choose landmarks (decomment one of the following two lines) + // Gudhi::subsampling::pick_n_random_points(point_vector, nbL, std::back_inserter(landmarks)); + Gudhi::subsampling::choose_n_farthest_points(K(), witnesses, nbL, Gudhi::subsampling::random_starting_point, std::back_inserter(landmarks)); // Compute witness complex Witness_complex witness_complex(landmarks, diff --git a/src/Witness_complex/example/example_witness_complex_sphere.cpp b/src/Witness_complex/example/example_witness_complex_sphere.cpp index 124fd99b..a66da3f9 100644 --- a/src/Witness_complex/example/example_witness_complex_sphere.cpp +++ b/src/Witness_complex/example/example_witness_complex_sphere.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -75,7 +76,8 @@ int main(int argc, char * const argv[]) { // Choose landmarks start = clock(); - Gudhi::subsampling::pick_n_random_points(point_vector, number_of_landmarks, std::back_inserter(landmarks)); + // Gudhi::subsampling::pick_n_random_points(point_vector, number_of_landmarks, std::back_inserter(landmarks)); + Gudhi::subsampling::choose_n_farthest_points(K(), point_vector, number_of_landmarks, Gudhi::subsampling::random_starting_point, std::back_inserter(landmarks)); // Compute witness complex Witness_complex witness_complex(landmarks, diff --git a/src/Witness_complex/include/gudhi/Strong_witness_complex.h b/src/Witness_complex/include/gudhi/Strong_witness_complex.h index f079e910..38646201 100644 --- a/src/Witness_complex/include/gudhi/Strong_witness_complex.h +++ b/src/Witness_complex/include/gudhi/Strong_witness_complex.h @@ -34,7 +34,7 @@ namespace Gudhi { namespace witness_complex { -/* +/* \private * \class Strong_witness_complex * \brief Constructs strong witness complex for a given table of nearest landmarks with respect to witnesses. * \ingroup witness_complex @@ -130,6 +130,8 @@ class Strong_witness_complex { return true; } + //@} + private: /* \brief Adds recursively all the faces of a certain dimension dim-1 witnessed by the same witness. * Iterator is needed to know until how far we can take landmarks to form simplexes. @@ -170,7 +172,6 @@ class Strong_witness_complex { simplex.pop_back(); } } - //@} }; } // namespace witness_complex -- cgit v1.2.3