summaryrefslogtreecommitdiff
path: root/src/Witness_complex
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2017-11-20 22:01:19 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2017-11-20 22:01:19 +0000
commit975c40f92372948f11a7b1065a3944f737e550a9 (patch)
tree5dc051fb34389b2ff6d2e76a6d3825ec5cbc93e1 /src/Witness_complex
parent1b895dd0d76cbe13b92b68b7198f58631678200f (diff)
parentdc231e43e7d741e5e477de23140bf3b8982489ab (diff)
Merge last trunk modifications
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/add_utils_in_gudhi_v2@2922 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 9ea024337f05cfc4f9a1d645c6e6ee9aac9700ba
Diffstat (limited to 'src/Witness_complex')
-rw-r--r--src/Witness_complex/doc/Witness_complex_doc.h12
-rw-r--r--src/Witness_complex/example/example_strong_witness_complex_off.cpp8
-rw-r--r--src/Witness_complex/example/example_witness_complex_off.cpp6
-rw-r--r--src/Witness_complex/example/example_witness_complex_sphere.cpp4
-rw-r--r--src/Witness_complex/include/gudhi/Strong_witness_complex.h6
-rw-r--r--src/Witness_complex/utilities/strong_witness_persistence.cpp6
-rw-r--r--src/Witness_complex/utilities/weak_witness_persistence.cpp6
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 20834be0..5d5c0735 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/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_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_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
diff --git a/src/Witness_complex/utilities/strong_witness_persistence.cpp b/src/Witness_complex/utilities/strong_witness_persistence.cpp
index f786fe7b..e3e0c1ee 100644
--- a/src/Witness_complex/utilities/strong_witness_persistence.cpp
+++ b/src/Witness_complex/utilities/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/utilities/weak_witness_persistence.cpp b/src/Witness_complex/utilities/weak_witness_persistence.cpp
index a1146922..a63b0837 100644
--- a/src/Witness_complex/utilities/weak_witness_persistence.cpp
+++ b/src/Witness_complex/utilities/weak_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
Witness_complex witness_complex(landmarks,