summaryrefslogtreecommitdiff
path: root/src/Persistent_cohomology/example/rips_multifield_persistence.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Persistent_cohomology/example/rips_multifield_persistence.cpp')
-rw-r--r--src/Persistent_cohomology/example/rips_multifield_persistence.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/Persistent_cohomology/example/rips_multifield_persistence.cpp b/src/Persistent_cohomology/example/rips_multifield_persistence.cpp
index d4a07bb6..f4adc7a9 100644
--- a/src/Persistent_cohomology/example/rips_multifield_persistence.cpp
+++ b/src/Persistent_cohomology/example/rips_multifield_persistence.cpp
@@ -25,14 +25,21 @@
#include <gudhi/Simplex_tree.h>
#include <gudhi/Persistent_cohomology.h>
#include <gudhi/Persistent_cohomology/Multi_field.h>
+#include <gudhi/Points_off_io.h>
#include <boost/program_options.hpp>
#include <string>
#include <vector>
-
-typedef double Filtration_value;
+// Types definition
+using Simplex_tree = Gudhi::Simplex_tree</*Gudhi::Simplex_tree_options_fast_persistence*/>;
+using Filtration_value = Simplex_tree::Filtration_value;
+using Rips_complex = Gudhi::rips_complex::Rips_complex<Filtration_value>;
+using Multi_field = Gudhi::persistent_cohomology::Multi_field;
+using Persistent_cohomology = Gudhi::persistent_cohomology::Persistent_cohomology<Simplex_tree, Multi_field >;
+using Point = std::vector<double>;
+using Points_off_reader = Gudhi::Points_off_reader<Point>;
void program_options(int argc, char * argv[]
, std::string & off_file_points
@@ -54,22 +61,22 @@ int main(int argc, char * argv[]) {
program_options(argc, argv, off_file_points, filediag, threshold, dim_max, min_p, max_p, min_persistence);
- Gudhi::rips_complex::Rips_complex<> rips_complex_from_file(off_file_points);
+ Points_off_reader off_reader(off_file_points);
+ Rips_complex rips_complex_from_file(off_reader.get_point_cloud(), threshold,
+ euclidean_distance<Point>);
// Construct the Rips complex in a Simplex Tree
- using Simplex_tree = Gudhi::Simplex_tree<Gudhi::Simplex_tree_options_fast_persistence>;
Simplex_tree simplex_tree;
- if (rips_complex_from_file.create_complex(simplex_tree, threshold, dim_max, euclidean_distance<std::vector<double>>)) {
+ if (rips_complex_from_file.create_complex(simplex_tree, dim_max)) {
std::cout << "The complex contains " << simplex_tree.num_simplices() << " simplices \n";
std::cout << " and has dimension " << simplex_tree.dimension() << " \n";
// Sort the simplices in the order of the filtration
simplex_tree.initialize_filtration();
- using Multi_field = Gudhi::persistent_cohomology::Multi_field;
// Compute the persistence diagram of the complex
- Gudhi::persistent_cohomology::Persistent_cohomology<Simplex_tree, Multi_field > pcoh(simplex_tree);
+ Persistent_cohomology pcoh(simplex_tree);
// initializes the coefficient field for homology
pcoh.init_coefficients(min_p, max_p);