diff options
author | MathieuCarriere <mathieu.carriere3@gmail.com> | 2020-01-16 21:26:02 -0500 |
---|---|---|
committer | MathieuCarriere <mathieu.carriere3@gmail.com> | 2020-01-16 21:26:02 -0500 |
commit | 19562b27182dcfa6ed262002c2bc8934382f5a53 (patch) | |
tree | 421f73315e9f971c176fb814557ff8af40bb1442 /src/python/include/Persistent_cohomology_interface.h | |
parent | c89df405c77bb7270db1a7d8f0e49bc22c1b010d (diff) |
get rid of persistence_generators and modified name for cubical complex
Diffstat (limited to 'src/python/include/Persistent_cohomology_interface.h')
-rw-r--r-- | src/python/include/Persistent_cohomology_interface.h | 29 |
1 files changed, 4 insertions, 25 deletions
diff --git a/src/python/include/Persistent_cohomology_interface.h b/src/python/include/Persistent_cohomology_interface.h index 0ad14477..1a1e716e 100644 --- a/src/python/include/Persistent_cohomology_interface.h +++ b/src/python/include/Persistent_cohomology_interface.h @@ -73,36 +73,15 @@ persistent_cohomology::Persistent_cohomology<FilteredComplex, persistent_cohomol return persistence; } - std::vector<std::pair<int, std::pair<std::pair<double, std::vector<int>>, std::pair<double,std::vector<int>>>>> get_persistence_generators(int homology_coeff_field, - double min_persistence) { - persistent_cohomology::Persistent_cohomology<FilteredComplex, - persistent_cohomology::Field_Zp>::init_coefficients(homology_coeff_field); - persistent_cohomology::Persistent_cohomology<FilteredComplex, - persistent_cohomology::Field_Zp>::compute_persistent_cohomology(min_persistence); - - // Custom sort and output persistence - cmp_intervals_by_dim_then_length cmp(stptr_); - auto persistent_pairs = persistent_cohomology::Persistent_cohomology<FilteredComplex, - persistent_cohomology::Field_Zp>::get_persistent_pairs(); - std::sort(std::begin(persistent_pairs), std::end(persistent_pairs), cmp); - - std::vector<std::pair<int, std::pair<std::pair<double, std::vector<int>>, std::pair<double,std::vector<int>>>>> persistence; - for (auto pair : persistent_pairs) { - std::vector<int> splx0, splx1; - for (auto vertex : stptr_->simplex_vertex_range(get<0>(pair))){splx0.push_back(vertex);} - if (isfinite(stptr_->filtration(get<1>(pair)))){ for (auto vertex : stptr_->simplex_vertex_range(get<1>(pair))){splx1.push_back(vertex);}} - persistence.push_back(std::make_pair(stptr_->dimension(get<0>(pair)), std::make_pair(std::make_pair(stptr_->filtration(get<0>(pair)), splx0), std::make_pair(stptr_->filtration(get<1>(pair)), splx1)))); - } - return persistence; - } - void top_dimensional_cofaces(std::vector<int> & cofaces, int splx){ if (stptr_->dimension(stptr_->simplex(splx)) == stptr_->dimension()){cofaces.push_back(stptr_->simplex(splx));} else{ for (auto v : stptr_->coboundary_simplex_range(stptr_->simplex(splx))){top_dimensional_cofaces(cofaces, stptr_->key(v));} } } - std::vector<std::pair<int, std::pair<std::pair<double, int>, std::pair<double, int>>>> get_persistence_cubical_generators(int homology_coeff_field, - double min_persistence) { + std::vector<std::pair<int, std::pair<std::pair<double, int>, std::pair<double, int>>>> get_cofaces_of_cubical_persistence_pairs(int homology_coeff_field, + double min_persistence) { + + // Warning: this function is meant to be used with CubicalComplex only!! // Gather all top-dimensional cells and store their simplex handles std::vector<int> max_splx; for (auto splx : stptr_->filtration_simplex_range()){ if (stptr_->dimension(splx) == stptr_->dimension()) max_splx.push_back(splx); } |