summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-12-16 11:05:25 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-12-16 11:05:25 +0000
commite897b33b3184a230a24ddeff03c6b4ec070f2ab7 (patch)
tree673d070cf08800b17fbe0d50278cf89ede3c69a3
parent8340ca1acd568c93d115fcd46a996749a8cc295d (diff)
Fix persistence rips after create_complex voidification
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/distance_matrix_in_rips_module@1896 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: d4a1258ea01bae048f30621594d0daf280fd8abb
-rw-r--r--src/GudhUI/utils/Persistence_compute.h19
-rw-r--r--src/Persistent_cohomology/example/rips_distance_matrix_persistence.cpp43
-rw-r--r--src/Persistent_cohomology/example/rips_multifield_persistence.cpp44
-rw-r--r--src/Persistent_cohomology/example/rips_persistence.cpp44
4 files changed, 74 insertions, 76 deletions
diff --git a/src/GudhUI/utils/Persistence_compute.h b/src/GudhUI/utils/Persistence_compute.h
index 12283cbe..2dc03c8e 100644
--- a/src/GudhUI/utils/Persistence_compute.h
+++ b/src/GudhUI/utils/Persistence_compute.h
@@ -79,16 +79,15 @@ template<typename SkBlComplex> class Persistence_compute {
Rips_complex rips_complex(points, params.threshold, Euclidean_distance());
Simplex_tree st;
- if (rips_complex.create_complex(st, params.max_dim)) {
- Persistent_cohomology pcoh(st);
- // initializes the coefficient field for homology
- pcoh.init_coefficients(params.p);
- // put params.min_pers
- pcoh.compute_persistent_cohomology(params.min_pers);
- stream << "persistence: \n";
- stream << "p dimension birth death: \n";
- pcoh.output_diagram(stream);
- }
+ rips_complex.create_complex(st, params.max_dim);
+ Persistent_cohomology pcoh(st);
+ // initializes the coefficient field for homology
+ pcoh.init_coefficients(params.p);
+ // put params.min_pers
+ pcoh.compute_persistent_cohomology(params.min_pers);
+ stream << "persistence: \n";
+ stream << "p dimension birth death: \n";
+ pcoh.output_diagram(stream);
}
};
diff --git a/src/Persistent_cohomology/example/rips_distance_matrix_persistence.cpp b/src/Persistent_cohomology/example/rips_distance_matrix_persistence.cpp
index ee236d61..8517e7f6 100644
--- a/src/Persistent_cohomology/example/rips_distance_matrix_persistence.cpp
+++ b/src/Persistent_cohomology/example/rips_distance_matrix_persistence.cpp
@@ -63,28 +63,27 @@ int main(int argc, char * argv[]) {
// Construct the Rips complex in a Simplex Tree
Simplex_tree simplex_tree;
- 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();
-
- // Compute the persistence diagram of the complex
- Persistent_cohomology pcoh(simplex_tree);
- // initializes the coefficient field for homology
- pcoh.init_coefficients(p);
-
- pcoh.compute_persistent_cohomology(min_persistence);
-
- // Output the diagram in filediag
- if (filediag.empty()) {
- pcoh.output_diagram();
- } else {
- std::ofstream out(filediag);
- pcoh.output_diagram(out);
- out.close();
- }
+ 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();
+
+ // Compute the persistence diagram of the complex
+ Persistent_cohomology pcoh(simplex_tree);
+ // initializes the coefficient field for homology
+ pcoh.init_coefficients(p);
+
+ pcoh.compute_persistent_cohomology(min_persistence);
+
+ // Output the diagram in filediag
+ if (filediag.empty()) {
+ pcoh.output_diagram();
+ } else {
+ std::ofstream out(filediag);
+ pcoh.output_diagram(out);
+ out.close();
}
return 0;
}
diff --git a/src/Persistent_cohomology/example/rips_multifield_persistence.cpp b/src/Persistent_cohomology/example/rips_multifield_persistence.cpp
index 3389d8e1..7674b5a5 100644
--- a/src/Persistent_cohomology/example/rips_multifield_persistence.cpp
+++ b/src/Persistent_cohomology/example/rips_multifield_persistence.cpp
@@ -67,29 +67,29 @@ int main(int argc, char * argv[]) {
// Construct the Rips complex in a Simplex Tree
Simplex_tree simplex_tree;
- 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();
-
- // Compute the persistence diagram of the complex
- Persistent_cohomology pcoh(simplex_tree);
- // initializes the coefficient field for homology
- pcoh.init_coefficients(min_p, max_p);
-
- pcoh.compute_persistent_cohomology(min_persistence);
-
- // Output the diagram in filediag
- if (filediag.empty()) {
- pcoh.output_diagram();
- } else {
- std::ofstream out(filediag);
- pcoh.output_diagram(out);
- out.close();
- }
+ 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();
+
+ // Compute the persistence diagram of the complex
+ Persistent_cohomology pcoh(simplex_tree);
+ // initializes the coefficient field for homology
+ pcoh.init_coefficients(min_p, max_p);
+
+ pcoh.compute_persistent_cohomology(min_persistence);
+
+ // Output the diagram in filediag
+ if (filediag.empty()) {
+ pcoh.output_diagram();
+ } else {
+ std::ofstream out(filediag);
+ pcoh.output_diagram(out);
+ out.close();
}
+
return 0;
}
diff --git a/src/Persistent_cohomology/example/rips_persistence.cpp b/src/Persistent_cohomology/example/rips_persistence.cpp
index bc62b736..b70d0283 100644
--- a/src/Persistent_cohomology/example/rips_persistence.cpp
+++ b/src/Persistent_cohomology/example/rips_persistence.cpp
@@ -66,29 +66,29 @@ int main(int argc, char * argv[]) {
// Construct the Rips complex in a Simplex Tree
Simplex_tree simplex_tree;
- 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();
-
- // Compute the persistence diagram of the complex
- Persistent_cohomology pcoh(simplex_tree);
- // initializes the coefficient field for homology
- pcoh.init_coefficients(p);
-
- pcoh.compute_persistent_cohomology(min_persistence);
-
- // Output the diagram in filediag
- if (filediag.empty()) {
- pcoh.output_diagram();
- } else {
- std::ofstream out(filediag);
- pcoh.output_diagram(out);
- out.close();
- }
+ 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();
+
+ // Compute the persistence diagram of the complex
+ Persistent_cohomology pcoh(simplex_tree);
+ // initializes the coefficient field for homology
+ pcoh.init_coefficients(p);
+
+ pcoh.compute_persistent_cohomology(min_persistence);
+
+ // Output the diagram in filediag
+ if (filediag.empty()) {
+ pcoh.output_diagram();
+ } else {
+ std::ofstream out(filediag);
+ pcoh.output_diagram(out);
+ out.close();
}
+
return 0;
}