diff options
Diffstat (limited to 'src/Witness_complex')
7 files changed, 34 insertions, 14 deletions
diff --git a/src/Witness_complex/doc/Witness_complex_doc.h b/src/Witness_complex/doc/Witness_complex_doc.h index 171a185f..d070ee34 100644 --- a/src/Witness_complex/doc/Witness_complex_doc.h +++ b/src/Witness_complex/doc/Witness_complex_doc.h @@ -90,8 +90,9 @@ int main(int argc, char * const argv[]) { Gudhi::Points_off_reader<Point_d> off_reader(file_name); point_vector = Point_vector(off_reader.get_point_cloud()); - // Choose landmarks - 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, @@ -109,6 +110,13 @@ int main(int argc, char * const argv[]) { \include Witness_complex/example_strong_witness_persistence.cpp + \section witnessexample3 Example3: Computing relaxed witness complex persistence from a distance matrix + + In this example we compute the relaxed witness complex persistence from a given matrix of closest landmarks to each witness. + Each landmark is given as the couple (index, distance). + + \include Witness_complex/example_nearest_landmark_table.cpp + \copyright GNU General Public License v3. 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 <gudhi/Simplex_tree.h> #include <gudhi/Euclidean_strong_witness_complex.h> #include <gudhi/pick_n_random_points.h> +#include <gudhi/choose_n_farthest_points.h> #include <gudhi/Points_off_io.h> #include <CGAL/Epick_d.h> @@ -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 f786fe7b..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 <gudhi/Persistent_cohomology.h> #include <gudhi/Points_off_io.h> #include <gudhi/pick_n_random_points.h> +#include <gudhi/choose_n_farthest_points.h> #include <boost/program_options.hpp> @@ -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 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 <gudhi/Simplex_tree.h> #include <gudhi/Euclidean_witness_complex.h> #include <gudhi/pick_n_random_points.h> +#include <gudhi/choose_n_farthest_points.h> #include <gudhi/Points_off_io.h> #include <CGAL/Epick_d.h> @@ -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 <gudhi/Persistent_cohomology.h> #include <gudhi/Points_off_io.h> #include <gudhi/pick_n_random_points.h> +#include <gudhi/choose_n_farthest_points.h> #include <boost/program_options.hpp> @@ -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 <gudhi/Simplex_tree.h> #include <gudhi/Euclidean_witness_complex.h> #include <gudhi/pick_n_random_points.h> +#include <gudhi/choose_n_farthest_points.h> #include <gudhi/reader_utils.h> #include <CGAL/Epick_d.h> @@ -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 c18335d3..b3d00b11 100644 --- a/src/Witness_complex/include/gudhi/Strong_witness_complex.h +++ b/src/Witness_complex/include/gudhi/Strong_witness_complex.h @@ -34,7 +34,8 @@ namespace Gudhi { namespace witness_complex { -/* \private + /** + * \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 +131,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 +173,6 @@ class Strong_witness_complex { simplex.pop_back(); } } - //@} }; } // namespace witness_complex |