summaryrefslogtreecommitdiff
path: root/src/cython/include/Persistent_cohomology_interface.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/cython/include/Persistent_cohomology_interface.h')
-rw-r--r--src/cython/include/Persistent_cohomology_interface.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/cython/include/Persistent_cohomology_interface.h b/src/cython/include/Persistent_cohomology_interface.h
index faabc497..1ff0e09b 100644
--- a/src/cython/include/Persistent_cohomology_interface.h
+++ b/src/cython/include/Persistent_cohomology_interface.h
@@ -34,6 +34,7 @@ template<class FilteredComplex>
class Persistent_cohomology_interface : public
persistent_cohomology::Persistent_cohomology<FilteredComplex, persistent_cohomology::Field_Zp> {
private:
+
/*
* Compare two intervals by dimension, then by length.
*/
@@ -56,18 +57,23 @@ persistent_cohomology::Persistent_cohomology<FilteredComplex, persistent_cohomol
public:
Persistent_cohomology_interface(FilteredComplex* stptr)
- : persistent_cohomology::Persistent_cohomology<FilteredComplex, persistent_cohomology::Field_Zp>(*stptr, true),
+ : persistent_cohomology::Persistent_cohomology<FilteredComplex, persistent_cohomology::Field_Zp>(*stptr),
+ stptr_(stptr) { }
+
+ Persistent_cohomology_interface(FilteredComplex* stptr, bool persistence_dim_max)
+ : persistent_cohomology::Persistent_cohomology<FilteredComplex, persistent_cohomology::Field_Zp>(*stptr,
+ persistence_dim_max),
stptr_(stptr) { }
std::vector<std::pair<int, std::pair<double, double>>> get_persistence(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<double, double>>> persistence;
for (auto pair : persistent_pairs) {
persistence.push_back(std::make_pair(stptr_->dimension(get<0>(pair)),
@@ -77,7 +83,7 @@ persistent_cohomology::Persistent_cohomology<FilteredComplex, persistent_cohomol
return persistence;
}
-
+
private:
// A copy
FilteredComplex* stptr_;